Exemple #1
0
 /**
  * @param array $routes
  * @return JO_Router
  */
 public static function getInstance($routes = array())
 {
     if (self::$_instance == null) {
         self::$_instance = new self($routes);
     }
     return self::$_instance;
 }
Exemple #2
0
 public function _initStoreSettings()
 {
     $request = JO_Request::getInstance();
     if ($request->getModule() == 'install') {
         return '';
     }
     $store = new WM_Store();
     $store_settings = $store->getStoreSettings();
     if ($store_settings) {
         foreach ($store_settings as $value) {
             if ($value['serialize']) {
                 JO_Registry::set($value['key'], self::mb_unserialize($value['value']));
             } else {
                 JO_Registry::set($value['key'], $value['value']);
             }
         }
     }
     if (!JO_Registry::get('admin_limit')) {
         JO_Registry::set('admin_limit', 15);
     }
     if (!JO_Registry::get('front_limit')) {
         JO_Registry::set('front_limit', 10);
     }
     if (!JO_Session::get('user_id')) {
         JO_Session::set('user_id', 0);
     }
     if ($request->getModule() == 'default' && JO_Registry::get('default_module')) {
         $request->setModule(JO_Registry::get('default_module'));
         $modules = WM_Modules::getList();
         if ($modules) {
             rsort($modules);
             $router = JO_Router::getInstance();
             $router->addRoute('default', new JO_Router_Regex('(' . implode('|', $modules) . ')/?(\\w+)?/?(\\w+)?/?', array('module' => JO_Registry::get('default_module'), 'controller' => 'index', 'action' => 'index'), array(1 => 'module', 2 => 'controller', 3 => 'action')));
             $matched = $router->match($request->getRequest('uri'), true);
             if ($matched) {
                 foreach ($matched as $key => $value) {
                     $request->setParams($key, $value);
                 }
             }
         }
     }
     //		$default_domains = JO_Registry::get('default_domain');
     //		if($default_domains && is_array($default_domains) && count($default_domains) > 1) {
     //			$search = array_search($request->getDomain(), $default_domains);
     //			if($search != $request->getModule()) {
     //				$request->setModule($search);
     //			}
     //		}
     JO_Registry::set('default_config_language_id', JO_Registry::get('config_language_id'));
 }
Exemple #3
0
 /**
  * @return JO_Router
  */
 public function getRouter()
 {
     if ($this->_route == null) {
         $this->_route = JO_Router::getInstance();
     }
     return $this->_route;
 }