<?php /** * Setup and initialize any core components or modules. * * @copyright Copyright 2009, Titon (A PHP Micro Framework) * @link http://titonphp.com * @license http://opensource.org/licenses/bsd-license.php (The BSD License) */ namespace app\config; use titon\core\Environment; use titon\system\Dispatch; use titon\system\Hook; /** * Overwrite the default dispatcher with a custom dispatcher. * Can also restrict the dispatcher to a specific scope. */ switch (Environment::detect()) { case 'production': Dispatch::setup(function ($params) { return new \titon\modules\dispatchers\front\Front($params); }); break; }
* Convenience function for the directory, path and namespace separators. */ define('DS', DIRECTORY_SEPARATOR); define('PS', PATH_SEPARATOR); define('NS', '\\'); /** * Define the public html ROOT and path beneath (SUBROOT). */ define('ROOT', __DIR__ . DS); define('SUBROOT', dirname(ROOT) . DS); define('APP', ROOT . 'app' . DS); define('MODULES', ROOT . 'modules' . DS); define('VENDORS', ROOT . 'vendors' . DS); define('FRAMEWORK', ROOT . 'titon' . DS); /** * Load the core Titon files and initialize dispatcher; * Throw fatal error if libraries could not be found. */ if (!file_exists(FRAMEWORK)) { trigger_error('Titon: Application failed to load the core libraries. Please check your paths and configuration.', E_USER_ERROR); } include_once FRAMEWORK . 'Infastructure.php'; /** * Set the include paths for all important files. */ set_include_path(implode(PS, array(get_include_path(), ROOT, SUBROOT, APP, FRAMEWORK, MODULES, VENDORS))); /** * Dispatch the request. */ \titon\system\Dispatch::initialize();