public static function classmap($app, $dir_prefix, $routes) { foreach ($routes as $regex => $appfile) { if ($regex == '/') { // sometimes users will enter /admin instead of /admin/, so if // the regex is a /, wee need to change it to /? to account for // this issue. $regex .= '?'; } if (preg_match('~^' . $dir_prefix . $regex . '$~', ROUTES_CURRENTURI)) { import::app($app . '/' . $appfile . '.php'); $app = new $appfile(); return true; } echo $dir_prefix . $regex . "\n"; } die('LogError: No Class Routes Found For ' . ROUTES_CURRENTURI); }
<?php require dirname(__FILE__) . '/src/import.php'; /** * Depending on the platform used to deploy this solution, it may be required * to account for static files within php. If .htaccess is available then it is * should be used insted of the following: */ import::routes(); if (preg_match('~^/(public|images|javascript|stylesheets)/~', ROUTES_CURRENTURI)) { import::src('static.php'); exit; } import::app('routes.php');