/** * STATIC CONSTRUCTOR * custom method that will be called whenever * a static method of this class is called. **/ public static function _construct() { // Load the routes file if (!file_exists(CORE . 'routes' . EXT)) { Core::error404('routes'); } include CORE . 'routes' . EXT; if (!isset($_RTR) || !is_array($_RTR)) { Core::error('RTRFRM', 'LIBTIT', __METHOD__); } self::$_RTR =& $_RTR; unset($_RTR); // Get the default controller self::$_CTR = Core::config('controller'); // Is there an uri string? if not, show default controller if (Uri::fetch() == '') { // If no controller is specified, throw an error. if (!self::$_CTR) { Core::error('RTRCTR', 'LIBTIT', __METHOD__); } // set the current class and method (Controller & Action respectively) self::_set(array(self::$_CTR, 'index')); return; } // remove the url_suffix if needed Uri::removesuffix(); // compile the segments into an array Uri::explode(); // parse any custom routing that it may exist self::_parsecustom(); // Re-index the segment array so that it starts with 1 rather than 0 Uri::reindex(); }