Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $this->contentType("text/html");
     $this->title = Ac::request()->directory();
     $this->meta_description = "";
     $this->meta_keywords = "";
     $this->meta_robots = "INDEX,FOLLOW";
     $this->link_canonical = Ac::router()->directoryUrl();
 }
Пример #2
0
 public function call()
 {
     Ac::trigger(__CLASS__ . "_before_" . __FUNCTION__, $this);
     $klass = $this->controller;
     $fn = $this->action;
     $result = null;
     if ($fn == "__index") {
         $validate_fn = "validate_index";
     } elseif ($fn == "__handle") {
         $validate_fn = "validate_handle";
     } else {
         $validate_fn = str_replace("action_", "validate_", $this->action);
     }
     $this->controllerInstance = new $klass();
     $is_valid = false;
     if (!is_callable(array($this->controllerInstance, $fn))) {
         $fn = "__handle";
     }
     if (method_exists($klass, $validate_fn)) {
         if ($this->controllerInstance->{$validate_fn}($this->action)) {
             $is_valid = true;
             $result = $this->controllerInstance->{$fn}();
         } else {
             $result = $this->controllerInstance->__handle();
         }
     } else {
         if ($this->controllerInstance->__validate($this->action)) {
             $is_valid = true;
             $result = $this->controllerInstance->{$fn}();
         } else {
             $result = $this->controllerInstance->__handle();
         }
     }
     $result = Ac::trigger(__CLASS__ . "_on_" . __FUNCTION__, $result);
     return $result;
 }