Example #1
0
 /**
  * Run's the set bounceback.
  * 
  * @access private
  * @final
  * @return boolean true if the check returns true and boolean false if not
  */
 private final function _runBounceBack()
 {
     // call hook
     Hook::call('Controller.runBounceBack.before', array(&$this->bounceback));
     if (isset($this->bounceback['check']) && method_exists($this->bounceback['check'][0], $this->bounceback['check'][1]) && (isset($this->bounceback['bounce']) && method_exists($this->bounceback['bounce'][0], $this->bounceback['bounce'][1])) && !$this->_viewExists(array("name" => $this->viewToLoad, "checkmethod" => true))) {
         $keys = array_keys(Reg::get('URI.working'));
         $values = array_values(Reg::get('URI.working'));
         $controllerPos = array_search('controller', $keys);
         if ($controllerPos === false) {
             $controllerPos = 0;
         }
         $this->params = array_combine($keys, array_slice(array_merge(array_slice($values, 0, $controllerPos + 1), array($this->bounceback['bounce'][1]), array_slice($values, $controllerPos + 1)), 0, count($keys)));
         Reg::set('Param', $this->params);
         $this->viewToLoad = Config::uriToMethod($this->params['view']);
         if ($this->_viewExists(array("name" => $this->viewToLoad, "checkmethod" => true)) !== true) {
             $return = false;
         } else {
             if (is_callable($this->bounceback['check']) && call_user_func($this->bounceback['check']) === false) {
                 $return = false;
             } else {
                 $return = true;
             }
         }
     } else {
         $return = false;
     }
     // call hook
     Hook::call('Controller.runBounceBack.after', array(&$return));
     return $return;
 }