Ejemplo n.º 1
0
 public function __call($method, $args)
 {
     if (strpos($method, '_before') === 0 && strlen($method) > 7) {
         $method = strtolower(substr($method, 7, 1)) . substr($method, 8);
         list($before) = $args;
         $callback = isset($this->_____callbacks[$method]) ? $this->_____callbacks[$method] : array($this->_____, $method);
         return $this->_____callbacks[$method] = Gongo_Fn::before($callback, $before);
     } else {
         if (strpos($method, '_after') === 0 && strlen($method) > 6) {
             $method = strtolower(substr($method, 6, 1)) . substr($method, 7);
             list($after) = $args;
             $callback = isset($this->_____callbacks[$method]) ? $this->_____callbacks[$method] : array($this->_____, $method);
             return $this->_____callbacks[$method] = Gongo_Fn::after($callback, $after);
         } else {
             if (strpos($method, '_around') === 0 && strlen($method) > 7) {
                 $method = strtolower(substr($method, 7, 1)) . substr($method, 8);
                 list($around) = $args;
                 $callback = isset($this->_____callbacks[$method]) ? $this->_____callbacks[$method] : array($this->_____, $method);
                 return $this->_____callbacks[$method] = Gongo_Fn::around($callback, $around);
             } else {
                 if (strpos($method, '_getter') === 0 && strlen($method) > 7) {
                     $property = strtolower(substr($method, 7, 1)) . substr($method, 8);
                     list($around) = $args;
                     if (isset($this->_____getterCallbacks[$property])) {
                         $callback = $this->_____getterCallbacks[$property];
                     } else {
                         $callback = Gongo_Fn::property($this->_____)->getter($property);
                     }
                     return $this->_____getterCallbacks[$property] = Gongo_Fn::around($callback, $around);
                 } else {
                     if (strpos($method, '_setter') === 0 && strlen($method) > 7) {
                         $property = strtolower(substr($method, 7, 1)) . substr($method, 8);
                         list($around) = $args;
                         if (isset($this->_____setterCallbacks[$property])) {
                             $callback = $this->_____setterCallbacks[$property];
                         } else {
                             $callback = Gongo_Fn::property($this->_____)->setter($property);
                         }
                         return $this->_____setterCallbacks[$property] = Gongo_Fn::around($callback, $around);
                     }
                 }
             }
         }
     }
     if (isset($this->_____callbacks[$method])) {
         return call_user_func_array($this->_____callbacks[$method], $args);
     }
     return parent::__call($method, $args);
 }
Ejemplo n.º 2
0
Archivo: App.php Proyecto: no22/gongo
 protected function execute($callback, $url, $method)
 {
     $method = strtoupper($method);
     $params = $url->params;
     $callback = Gongo_Fn::before($callback, Gongo_Fn::quote($this)->setSessionValue);
     $urlMatch = $this->factory->getObj('Gongo_App_Url_Router', array('-mountPoint' => $url->options->mountPoint));
     $this->afterInitUrl($urlMatch);
     foreach (array('around', 'before', 'after') as $kind) {
         $callback = $this->setFilterCallback($kind, $callback, $urlMatch);
     }
     $this->attach('args', array('Gongo_Bean_ArrayWrapper', $params));
     return call_user_func_array($callback, $params);
 }
Ejemplo n.º 3
0
 function before($callback, $before)
 {
     return Gongo_Fn::before($callback, $before);
 }
Ejemplo n.º 4
0
 public function beforeInit($sName, $callback)
 {
     if (isset($this->components[$sName])) {
         $this->components[$sName] = Gongo_Fn::before($this->components[$sName], $callback);
     }
 }