public function goPage($page) { /* テンプレートファイルを取得 */ $theme = Configure::read('theme'); $template_path = THEME_DIR . $theme . '/'; if (!file_exists($template_path . 'Template.php')) { $template_path = LIB_DIR; } $template_class = 'Template'; if ($template_path == LIB_DIR) { $template_class = 'TemplateBase'; } require_once $template_path . $template_class . '.php'; /* ページを取得し、遷移する */ $page_routing = Routes::get(); $template = new $template_class($page_routing[$page]['php']); if (isset($page_routing[$page]['js'])) { if (is_array($page_routing[$page]['js'])) { $template->script_src += $page_routing[$page]['js']; } else { $template->script_src[] = $page_routing[$page]['js']; } } if (isset($page_routing[$page]['css'])) { if (is_array($page_routing[$page]['css'])) { $template->style_src += $page_routing[$page]['css']; } else { $template->style_src[] = $page_routing[$page]['css']; } } $template->render(); }
/** * Determines the current route and runs it. */ public static function run() { // Pull the current path out of the get arguments directly $length = strlen(APP_RELATIVE_URL) == 0 ? 0 : strlen(APP_RELATIVE_URL) + 1; $path = substr(urldecode(parse_url(filter_input(INPUT_SERVER, 'REQUEST_URI'), PHP_URL_PATH)), $length); try { // Get the appropriate route for the path $route = Routes::get($path); // If our route is null, we should 404 if ($route == null) { header('Status: 404 Not Found', true, 404); View::renderView('404'); return; } // See whther or not we have to check the token if ($route->isTokenNeeded()) { Auth::checkToken(); } // Get the current path variables self::$currentPathVariables = self::pullVariables($path, $route); // Run the route $route->run(); // See if the last rendered path variable needs to be set if (View::hasRenderedView()) { Session::set(self::LAST_RENDERED_PATH_KEY, $path); } } catch (Exception $ex) { View::renderJson($ex->getMessage(), false); exit; } }
public static function init() { // Carrega as variaveis de confiruracao para toda a aplicacao Configs::load(); // Define o modulo self::$moduleName = Routes::get('module'); // Define o controller self::setController(); // Define o metodo self::setMethod(); }
<?php Routes::get('/', 'demo\\action\\HomeAction@main'); Routes::group(array('prefix' => '/user'), function () { Routes::any('/info', 'demo\\action\\HomeAction@info'); });
} } else { if ($ret) { return self::$_uri[$keye]; } else { echo self::$_uri[$keye]; } } } public static function ini() { include_once "../app/Routes.php"; Routes::run(); } public static function filter($filter, $call, $falsecall = null) { //if($filter=="auth") self::$_call_auth=$call; // self::$_filters[$filter] = $call; if (!is_null($falsecall)) { self::$_falsecall[$filter] = $falsecall; } } public static function current() { return self::$current; } } Routes::get(Config::get('panel.route'), function () { Page::put('panel.index'); });
public static function post($uri, $callback, $subdomains = null) { return Routes::get($uri, $callback); }
<?php Routes::group('/dash/media', function () { /** * url: /dash/media/list * */ Routes::get(['/list', 'name' => 'media_bundle_list'], 'Media\\Events\\Index@indexAction'); Routes::get(['/editor', 'name' => 'media_bundle_editor'], 'Media\\Events\\Index@editorAction'); }); Routes::group('/api/v1', function () { Routes::post(['/uploaded', 'name' => 'media_upload_v1'], 'Media\\Apis\\V1\\Uploader@uploadAction')->setFormats(['json', 'php']); });
<?php Routes::get("/tiga-framework", "WelcomeController@index");
// if (isset($except)) { $i = 0; foreach ($all as $value) { if (Table::contains($except, $value)) { unset($all[$i]); } $i++; } } // if (isset($only)) { foreach ($all as $key => $value) { $ext = false; foreach ($only as $value2) { if ($value == $value2) { $ext = true; break; } } if (!$ext) { unset($all[$key]); } } } return $all; } } Routes::get(Config::get('panel.route'), function () { include Config::get('panel.folder') . '/home.php'; });
<link href="./css/font-awesome.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="./css/jquery.gritter.css" /> <link rel="stylesheet" type="text/css" href="./css/style.css"> <link href="./css/css.min.css" rel="stylesheet"> </head> <body> <section id="container"> <?php include 'left.php'; ?> <section id="main-content"> <section class="wrapper"> <div class="row"> <div class="col-lg-9 main-chart"> <?php echo Routes::get($r); ?> </div> <?php include 'right.php'; ?> </div><! --/row --> </section> </section> <?php include 'footer.php'; ?> </section> <script src="./js/chart.min.js"></script> <!--[if lt IE 9]> <script src="./js/html5shiv.min.js"></script>
<?php Routes::get("/tiga-framework", function () { return Response::content("Welcome to Tiga!"); })->end();
return <<<WELCOME <!doctype html> <html lang='en'> <head> <meta charset='utf-8'> <title>FastD Module</title> <style> body { font-family: 'Source Sans Pro', sans-serif; -webkit-font-smoothing: antialiased; } section { text-align: center; padding-top: 150px; } section h1 { font-size: 32px; } </style> </head> <body> <section> <h1>Welcome to FastD Module Framework.</h1> </section> </body> </html> WELCOME; } } Routes::get('/', '\\Welcome@welcomeAction');
<?php Routes::get('/login', 'DemoBundle:Events:Index@indexAction'); Routes::get('/welcome', 'DemoBundle:Events:Index@welcomeAction');