Ejemplo n.º 1
0
 /**
  * 应用启动运行的函数
  * 
  * @access public
  * @return mixed
  */
 public function run()
 {
     //实现对Application的扩展
     Tiny::$_iserror = true;
     $appExtension = ExtensionFactory::getFactory('appExtension');
     if ($appExtension !== null) {
         $appExtension->before();
         $this->doRequest();
         $appExtension->after();
     } else {
         $this->doRequest();
     }
     Tiny::$_iserror = false;
 }
Ejemplo n.º 2
0
 /**
  * 控制器运行时的方法
  * 
  * @access public
  * @return mixed
  */
 public function run()
 {
     if (Tiny::app()->checkToken('redirect')) {
         $data = Req::args();
         unset($data['con'], $data['act'], $data['tiny_token_redirect']);
         $this->setDatas($data);
     }
     $this->init();
     $id = Req::args('act');
     if ($id === null) {
         $id = $this->defaultAction;
     }
     //防止页面的循环调用
     if (!$this->module->popRequestStack($this->id . '@' . $id)) {
         $this->module->pushRequestStack($this->id . '@' . $id);
     } else {
         if ($this->module->popRequestStack($this->id . '@' . $id)) {
             throw new Exception("Can't repeat redirect to the same position, you action is {$this->id}.", E_USER_ERROR);
         }
     }
     $this->action = $this->createAction($id);
     //所有Controller处理的扩展处理
     $contExtensions = ExtensionFactory::getFactory('controllerExtension');
     if ($contExtensions !== null) {
         $contExtensions->before($this);
         if (!is_null($this->action)) {
             $this->action->run();
         }
         $contExtensions->after($this);
     } else {
         if (!is_null($this->action)) {
             $this->action->run();
         }
     }
 }
 /**
  * 设置配制信息
  * 
  * @access public
  * @param mixed $config
  * @return mixed
  */
 public static function setExtConfig($config)
 {
     if (is_array($config)) {
         self::$extConfig = $config;
     }
 }