Created
December 29, 2018 15:38
-
-
Save ar-android/b87bfb74f06dc1bfe909d483e64cb403 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require 'vendor/autoload.php'; | |
| require 'helpers.php'; | |
| Flight::route('/', function(){ | |
| if(isset($_GET['nerd'])){ | |
| echo home_url() . random_post(); | |
| die; | |
| } | |
| view('home'); | |
| }); | |
| Flight::route('/import', function(){ | |
| if(isset($_GET['nerd'])){ | |
| echo home_url() . random_post(); | |
| die; | |
| } | |
| view('import'); | |
| }); | |
| Flight::route('/pages/@page', function($page){ | |
| view('pages.page', ['page' => $page]); | |
| }); | |
| Flight::route('/@slug.jpg', function($slug){ | |
| $data = get_data($slug); | |
| return Flight::redirect(collect($data['images'])->random()['url']); | |
| }); | |
| Flight::route('/@slug.html', function($slug){ | |
| $data = get_data($slug); | |
| if($data === false){ | |
| return Flight::redirect(random_post()); | |
| } | |
| $data['keyword'] = str_replace('-', ' ', $slug); | |
| view('image', $data); | |
| }); | |
| Flight::map('notFound', function(){ | |
| Flight::redirect('/'); | |
| }); | |
| Flight::start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment