예제 #1
0
 /**
  *
  * @return \ORC\Util\Route
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance) || !is_object(self::$_instance)) {
         self::$_instance = new static(\ORC\MVC\Request::getInstance());
     }
     return self::$_instance;
 }
 public function __construct(Controller $c)
 {
     $this->_controller = $c;
     $this->_request = Request::getInstance();
     $this->_model_container = new CaseContainer();
     $this->_extra_container = new Container();
 }
예제 #3
0
 protected function includeTemplate($template_name_c0c4648d020076fcb9f7ef1460db10b0)
 {
     $args = func_get_args();
     array_shift($args);
     $data_5656d190508c77a079411fbbb437745f = array();
     foreach ($args as $arg) {
         if (is_array($arg)) {
             foreach ($arg as $k => $v) {
                 $data_5656d190508c77a079411fbbb437745f[$k] = $v;
             }
         }
     }
     $template_filename_c0c4648d020076fcb9f7ef1460db10b0 = $this->_controller->getFilePath('template', $template_name_c0c4648d020076fcb9f7ef1460db10b0);
     unset($args, $arg, $k, $v);
     $request = \ORC\MVC\Request::getInstance();
     extract($data_5656d190508c77a079411fbbb437745f);
     unset($data_5656d190508c77a079411fbbb437745f);
     //         $viewModel = $this->getViewModel();
     //         $modelData = $viewModel->getAllModelData();
     //         $request = \ORC\MVC\Request::getInstance();
     if (Config::getInstance()->get('debug.template')) {
         echo sprintf('<!-- using content template %s begin -->', $template_name_c0c4648d020076fcb9f7ef1460db10b0);
     }
     include $template_filename_c0c4648d020076fcb9f7ef1460db10b0;
     if (Config::getInstance()->get('debug.template')) {
         echo sprintf('<!-- using content template %s end -->', $template_name_c0c4648d020076fcb9f7ef1460db10b0);
     }
 }
 /**
  * @return \ORC\MVC\Request
  */
 public function getRequest()
 {
     return Request::getInstance();
 }
예제 #5
0
 protected function parseURI()
 {
     $request = Request::getInstance();
     $uri = trim($request->getURI(), '/');
     list($url_path, ) = explode('?', $uri, 2);
     $routes = $this->routes;
     //pre($routes);
     $trim_chars = "/\n\r\t\v ";
     $url_args = array();
     while (strlen($url_path) > 1 && !isset($routes[$url_path])) {
         $new_arg = substr($url_path, strrpos($url_path, '/'));
         $url_path = trim(substr($url_path, 0, strrpos($url_path, $new_arg)), '/');
         //             pre($url_path);
         // put the new arg into the list
         array_unshift($url_args, trim($new_arg, $trim_chars));
     }
     if ($url_path) {
         $this->actionName = $routes[$url_path];
     } else {
         //             throw new \ORC\Exception\NotExistsException('404 not found');
     }
     $request->set(Request::args, $url_args);
 }