public static function route($uri) { self::_loadModules(); Hook::trigger(__CLASS__, 'preDispatch', array('uri' => $uri)); $parsed = parse_url($uri); $parts = explode('/', substr($parsed['path'], 1)); Controller::route($parts); // $routeName = str_replace('/', '_', substr($parsed['path'], 1)); // print_r($routeName); exit; // // print_r($_GET); exit; switch ($parts[0]) { case 'page': self::routePage($parts); break; } }
<?php $GLOBALS['start'] = microtime(TRUE); include 'system/helpers/bootstrap.php'; Config::set('base_path', __DIR__); Config::set('webroot', getWebserverPath(__DIR__)); Config::set('profiler_enable', FALSE); Registry::set('db', new PDOV('orion', 'db', 'db', 'CMS7', 'mysql')); Registry::get('db')->log_queries = Config::get('profiler_enable'); CMS7_Content_Cache::initCache(new CMS7_Memcached('localhost', '11211')); $controller = new Controller(); $controller->route(); include 'system/helpers/profiler.php';
*/ if (file_exists('bootstrap.php')) { require 'bootstrap.php'; } /** * Initialize the built-in cache support. Provides a * consistent cache API (based on Memcache) so we can always * include caching in our handlers and in the front controller. */ if (!isset($memcache) || !is_object($memcache)) { $memcache = Cache::init(conf('Cache')); } /** * Route the request to the appropriate handler and get * the handler's response. */ if ($i18n->url_includes_lang) { $handler = $controller->route($i18n->new_request_uri); } else { $handler = $controller->route($_SERVER['REQUEST_URI']); } $page->body = $controller->handle($handler, false); /** * Render and send the output to the client, using gzip * compression if conf[General][compress_output] is true. */ $out = $page->render($tpl); if (conf('General', 'compress_output') && extension_loaded('zlib')) { ob_start('ob_gzhandler'); } echo $out;
<?php // // Copyright (c) 2013, Zynga Inc. // https://github.com/zynga/saigon // Author: Matt West (https://github.com/mhwest13) // License: BSD 2-Clause // // Requires for includes of functions and definitions require_once dirname(dirname(__FILE__)) . '/conf/saigon.inc.php'; // Lets load up the composer autoloader require_once BASE_PATH . '/vendor/autoload.php'; // Lets load up the saigon autoloader require_once BASE_PATH . '/lib/classLoader.class.php'; Saigon_ClassLoader::register(); // Kick the tires and light the fires Controller::route();
/** * Run an internal request from one handler to another. */ public function run($uri, $data = array(), $internal = true) { $c = new Controller(count(self::$hooks) > 0 ? self::$hooks : conf('Hooks')); $c->page($this->_page); $c->i18n($this->_i18n); $c->template($this->_tpl); $c->cache($this->_cache); $handler = $c->route($uri); if (!isset(self::$called[$uri])) { self::$called[$uri] = 1; } else { self::$called[$uri]++; } return $c->handle($handler, $internal, $data); }
<?php require_once 'bin/settings.php'; require_once 'bin/controller.php'; require_once 'bin/state.php'; State::start(); $request = str_replace("/TLLL/", "", $_SERVER['REQUEST_URI']); $params = explode("/", $request); Controller::route($params);
/** * Run an internal request from one handler to another. */ public function run($uri, $data = array()) { $c = new Controller(); $handler = $c->route($uri); if (!isset(self::$called[$uri])) { self::$called[$uri] = 1; } else { self::$called[$uri]++; } return $c->handle($handler, true, $data); }