Esempio n. 1
0
 /**
  * Sets the callback as an array containing Controller, Method & Parameters
  *
  * @param string $destination
  */
 private static function _set_callback($destination)
 {
     if (is_callable($destination)) {
         self::$callback = array($destination, self::$_attr);
     } else {
         $result = explode('/', trim($destination, '/'));
         //fix the controller now
         $controller = $result[0] == "" ? configItem('site')['default_controller'] : str_replace('-', '/', $result[0]);
         //if no method, set it to index
         $method = isset($result[1]) ? $result[1] : 'index';
         //if controller is valid file
         if (self::fileExists($file = ucfirst(configItem('site')['cust_controller_dir']) . $controller . '.php', false)) {
             self::$callback = array(ucFirst($controller), $method, self::$_attr);
         } else {
             header("HTTP/1.0 404 Not Found");
             self::$_base->hook('404', array('file' => $file, 'controller' => $controller, 'method' => $method, 'message' => '404'));
             die;
         }
     }
 }
Esempio n. 2
0
 /**
  * Sets the callback as an array containing Controller, Method & Parameters
  *
  * @param string $destination
  */
 private static function _set_callback($destination)
 {
     if (is_callable($destination)) {
         self::$callback = array($destination, self::$_attr);
     } else {
         $result = explode('/', trim($destination, '/'));
         //fix the controller now
         $controller = $result[0] == "" ? configItem('site')['default_controller'] : str_replace('-', '/', $result[0]);
         //if no method, set it to index
         $method = isset($result[1]) ? $result[1] : 'index';
         //if controller is valid file
         if (self::fileExists($file = ucfirst(configItem('site')['cust_controller_dir']) . $controller . '.php', false)) {
             self::$callback = array(ucFirst($controller), $method, self::$_attr);
         } else {
             die("<b>Exception: </b>Incorrect routing");
         }
     }
 }