public function __construct() { parent::__construct(); $this->action = Input::server("REQUEST_URI"); }
private function getMethod($path) { $methods = kaikai\Cache::read("controller.{$this->getClassName()}.methods", function () { $class = new ReflectionClass($this); $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); $results = []; foreach ($methods as $method) { $methodName = $method->getName(); if (substr($methodName, 0, 2) == '__') { continue; } if (array_search($methodName, ['addComponent', 'executeControllerAction', 'setComponentResolverParameters'])) { continue; } $docComments = $this->parseDocComment($method->getDocComment()); $keyName = isset($docComments['action']) ? $docComments['action'] . $docComments['method'] : $methodName; $results[$keyName] = ['name' => $method->getName(), 'binder' => isset($docComments['binder']) ? $docComments['binder'] : controllers\ModelBinderRegister::getDefaultBinderClass()]; } return $results; }); if (isset($methods[$path . utils\Input::server('REQUEST_METHOD')])) { return $methods[$path . utils\Input::server('REQUEST_METHOD')]; } else { if (isset($methods[$path])) { return $methods[$path]; } } return false; }
public static function run() { Session::start(); honam\TemplateEngine::prependPath('views/shared'); honam\TemplateEngine::prependPath('views/layouts'); honam\AssetsLoader::setSiteUrl(Url::path('public')); honam\AssetsLoader::appendSourceDir('assets'); honam\AssetsLoader::setDestinationDir('public'); honam\Helper::setBaseUrl(Url::path('')); self::getRouter()->execute(substr(utils\Input::server('REQUEST_URI'), 1)); }
public function __construct() { \ntentan\honam\TemplateEngine::appendPath(__DIR__ . "/../../templates/menu"); $this->setCurrentUrl(Input::server('REQUEST_URI')); }