예제 #1
0
 public function runActionNamed($action)
 {
     $methodName = preg_replace('/[^a-z0-9_]+/', ' ', $action);
     $methodName = ucwords($methodName);
     $methodName = str_replace(' ', '', $methodName);
     $methodName[0] = strtolower($methodName[0]);
     $methodName .= 'Action';
     if (!method_exists($this, $methodName)) {
         HTTP::notFoundHeader();
         die('Page not found');
     }
     $this->{$methodName}();
 }
예제 #2
0
파일: CMS.php 프로젝트: fierce/fierce
 public static function handleRequest($db)
 {
     $pages = $db->Page->find(['url' => Env::get('controller_url')]);
     if (count($pages) == 0) {
         HTTP::notFoundHeader();
         $pages = $db->Page->find(['url' => '/404']);
     }
     if (count($pages) == 0) {
         die('Page not found');
     }
     $page = array_shift($pages);
     // display the page
     $controllerClass = $page->class;
     $controllerClass::run($page, $db);
 }