Esempio n. 1
0
 /**
  * 创建并返回过滤链,如果过滤链已经被创建不重复创建
  * 
  * @return WindHandlerInterceptorChain
  * @throws WindException
  */
 private function _getInterceptorChain()
 {
     if (null === $this->_interceptorChain) {
         $chain = Wind::import($this->_class_interceptorChain);
         $this->_interceptorChain = WindFactory::createInstance($chain);
         $this->_interceptorChain->addInterceptors($this->_listener);
     }
     return $this->_interceptorChain;
 }
 /**
  * 注册过滤器,监听Application Run
  * 
  * @param WindHandlerInterceptor $filter        
  */
 public function registeFilter($filter)
 {
     if ($this->_chain === null) {
         Wind::import("WIND:filter.WindHandlerInterceptorChain");
         $this->_chain = new WindHandlerInterceptorChain();
     }
     if ($filter instanceof AbstractWindBootstrap) {
         $this->_chain->addInterceptors($filter);
     }
 }
 /**
  * 创建对应标签的解析器类实例对象,并加载到处理链中.
  * 
  * @param string content 模板内容
  * @param string compiler 标签编译器
  * @param string regex 正则表达式
  * @param WindViewerResolver $windViewerResolver 默认为null
  * @return string 返回处理后的模板内容
  */
 private function creatTagCompiler($content, $compiler, $regex, $windViewerResolver = null)
 {
     $content = preg_replace_callback($regex, array($this, '_creatTagCompiler'), $content);
     if ($this->windHandlerInterceptorChain === null) {
         $this->windHandlerInterceptorChain = new WindHandlerInterceptorChain();
     }
     $_compilerClass = Wind::import($compiler);
     $this->windHandlerInterceptorChain->addInterceptors(new $_compilerClass($this->_compilerCache, $this, $windViewerResolver, $this->getRequest(), $this->getResponse()));
     $this->_compilerCache = array();
     return $content;
 }
 /**
  * 注册过滤器,监听Application Run
  *
  * @param WindHandlerInterceptor $filter
  */
 public function registeFilter($filter)
 {
     if (!$filter instanceof WindHandlerInterceptor) {
         return;
     }
     if ($this->_chain === null) {
         Wind::import("WIND:filter.WindHandlerInterceptorChain");
         $this->_chain = new WindHandlerInterceptorChain();
     }
     $this->_chain->addInterceptors($filter);
 }