Example #1
0
 public function __construct()
 {
     parent::__construct(false);
     $this->add('/admin', ['module' => 'backend', 'controller' => 'index', 'action' => 'index']);
     $this->add('/index', ['module' => 'frontend', 'controller' => 'index', 'action' => 'index']);
     $this->add('/', ['module' => 'frontend', 'controller' => 'index', 'action' => 'index']);
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->setDefaultController('index');
     $this->setDefaultAction('index');
     $this->add('/:module/:controller/:action/:params', ['module' => 1, 'controller' => 2, 'action' => 3, 'params' => 4])->setName('default');
     $this->add('/:module/:controller', ['module' => 1, 'controller' => 2, 'action' => 'index'])->setName('default_action');
     $this->add('/:module', ['module' => 1, 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
 }
Example #3
0
 public function __construct(DiInterface $di)
 {
     parent::__construct(false);
     $this->clear();
     $this->removeExtraSlashes(true);
     $this->setUriSource(PhalconRouter::URI_SOURCE_SERVER_REQUEST_URI);
     $this->setDefaultAction('index');
     $this->setDefaultController('index');
     $this->setDI($di);
     $this->notFound(['controller' => 'error', 'action' => 'not-found']);
 }
Example #4
0
 public function __construct()
 {
     parent::__construct();
     $this->setDefaultController('index');
     $this->setDefaultAction('index');
     // $this->setDefaultModule("admin");
     $this->add('/:module/:controller/:action/:params', ['module' => 1, 'controller' => 2, 'action' => 3, 'params' => 4])->setName('default');
     $this->add('/:module/:controller', ['module' => 1, 'controller' => 2, 'action' => 'index'])->setName('default_action');
     $this->add('/:module', ['module' => 1, 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
     //暂时使用后台管理当首页
     $this->add('/', ['module' => 'admin', 'controller' => 'index', 'action' => 'index'])->setName('default_controller');
     $this->removeExtraSlashes(true);
 }
Example #5
0
 public function __construct()
 {
     parent::__construct(false);
     static::$runningUnitTest = Config::runningUnitTest();
     // @codeCoverageIgnoreStart
     if ($this->_sitePathPrefix = Config::get('app.site_path')) {
         $this->_uriSource = self::URI_SOURCE_GET_URL;
         $this->_sitePathLength = strlen($this->_sitePathPrefix);
     }
     // @codeCoverageIgnoreEnd
     $this->removeExtraSlashes(true);
     $routes = is_file($file = $_SERVER['PHWOOLCON_ROOT_PATH'] . '/app/routes.php') ? include $file : [];
     is_array($routes) and $this->addRoutes($routes);
     $this->cookies = static::$di->getShared('cookies');
     $this->response = static::$di->getShared('response');
     $this->response->setStatusCode(200);
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $session = \Phalcon\DI::getDefault()->getSession();
     //Set the default namespace for all controllers that doesn't match our custom routes
     //e.g '/auth/login' will route to something like 'MyApp\Controllers\AuthController::loginAction()'
     $this->setDefaultNamespace('PRIME\\Controllers\\');
     //Our custom routes will not use slashes at the of the URIs
     $this->removeExtraSlashes(true);
     if ($session->has("auth")) {
         //Retrieve its value
         $auth = $session->get("auth");
         $this->theme = $auth['theme'];
         $directory = '../app/themes/' . $this->theme . '/widgets/';
         //get all files in specified directory
         $files = glob($directory . "*", GLOB_ONLYDIR);
         $files = array_map('basename', $files);
         $this->themeLevel2SetupNamespacedRoutes("widgets", $files);
         $directory = '../app/authenticators/';
         //get all files in specified directory
         $files = glob($directory . "*", GLOB_ONLYDIR);
         $files = array_map('basename', $files);
         $this->level2SetupNamespacedRoutes("authenticators", $files);
         $directory = '../app/form_elements/';
         //get all files in specified directory
         $files = glob($directory . "*", GLOB_ONLYDIR);
         $files = array_map('basename', $files);
         $this->level2SetupNamespacedRoutes("form_elements", $files);
         $directory = '../app/data_connectors/';
         //get all files in specified directory
         $files = glob($directory . "*", GLOB_ONLYDIR);
         $files = array_map('basename', $files);
         $this->level2SetupNamespacedRoutes("data_connectors", $files);
         $directory = '../app/themes/' . $this->theme . '/portlets/';
         $this->themeLevel1SetupNamespacedRoutes("portlets");
         $directory = '../app/themes/' . $this->theme . '/dashboards/';
         $this->themeLevel1SetupNamespacedRoutes("dashboards");
         $directory = '../app/themes/' . $this->theme . '/logins/';
         $this->themeLevel1SetupNamespacedRoutes("logins");
     }
 }
Example #7
0
 /**
  * myRouter constructor.
  */
 public function __construct($defaultRoutes = true)
 {
     parent::__construct($defaultRoutes);
 }
Example #8
0
 public function __construct($bool)
 {
     parent::__construct($bool);
 }
Example #9
0
 /**
  * Standard router constructor
  *
  * @param DiInterface $dependencyInjector
  * @param bool $keepDefaultRoutes
  */
 public function __construct(DiInterface $dependencyInjector, $keepDefaultRoutes = false)
 {
     parent::__construct($keepDefaultRoutes);
     $this->removeExtraSlashes(true);
     $this->setDI($dependencyInjector);
 }
Example #10
0
 public function __construct(array $routes, $defaultRoute = false)
 {
     parent::__construct(false);
     $this->setUriSource(static::URI_SOURCE_SERVER_REQUEST_URI);
     $this->routes = $routes;
 }
Example #11
0
 public function __construct()
 {
     parent::__construct(false);
     $this->removeExtraSlashes(true);
 }
Example #12
0
 public function __construct($defaultRoutes = null, ILangService $lang = null)
 {
     $this->lang = $lang;
     parent::__construct($defaultRoutes);
 }
Example #13
0
 /**
  * Create a new extended Phalcon router.
  * 
  * @param boolean $default            
  * @param boolean $removeExtraSlashes
  */
 public function __construct($default = false, $removeExtraSlashes = true)
 {
     parent::__construct($default);
     $this->removeExtraSlashes($removeExtraSlashes);
 }