private static function defaultRoute() { $tab = explode('/', substr(static::$_uri, 1)); if (count($tab) > 1) { if (3 != count($tab)) { $module = container()->getConfig()->getDefaultModule(); $module = Inflector::lower($module); $controller = Inflector::lower(Arrays::first($tab)); $action = $tab[1]; } else { list($module, $controller, $action) = $tab; $module = Inflector::lower($module); $controller = Inflector::lower($controller); $action = Inflector::lower($action); } $action = repl(array('.html', '.php', '.asp', '.jsp', '.cfm', '.py', '.pl'), array('', '', '', '', '', '', ''), $action); if (true === container()->getMultiSite()) { $moduleDir = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module; } else { $moduleDir = APPLICATION_PATH . DS . 'modules' . DS . $module; } $controllerDir = $moduleDir . DS . 'controllers'; $controllerFile = $controllerDir . DS . $controller . 'Controller.php'; if (true === File::exists($controllerFile)) { require_once $controllerFile; $controllerClass = 'Thin\\' . $controller . 'Controller'; $controllerInstance = new $controllerClass(); $actions = get_class_methods($controllerInstance); $actionName = $action . 'Action'; if (Arrays::inArray($actionName, $actions)) { $dispatch = new Dispatch(); $dispatch->setModule($module); $dispatch->setController($controller); $dispatch->setAction(Inflector::uncamelize($action, '-')); Utils::set('appDispatch', $dispatch); return true; } } } return null; }