getUrlManager() public method

Returns the URL manager for this application.
public getUrlManager ( ) : UrlManager
return yii\web\UrlManager the URL manager for this application.
Example #1
0
 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id => 'cp/' . $this->id, '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>' => 'cp/' . $this->id . '/<controller>', '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>'], false);
     /**
      * magic/default/download.html?id=1
      * ru-RU/magic/default/download.html?id=1
      */
     $app->getUrlManager()->addRules([$this->id . '/<controller:\\w+>/<action:\\w+>' => $this->id . '/<controller>/<action>', '<language:\\w+\\-\\w+>/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => $this->id . '/<controller>/<action>'], false);
 }
Example #2
0
 /**
  * Add default url rules of this module to custom urlManager of application
  * @param \yii\base\Application $app
  */
 public function addUrlRules(\yii\base\Application $app)
 {
     if ($app instanceof \yii\web\Application) {
         $app->getUrlManager()->addRules([['prefix' => $this->urlRulePrefix, 'class' => $this->urlRuleClass, 'controller' => [$this->id . '/user'], 'extraPatterns' => ['POST current' => 'current', 'POST extend' => 'extend'], 'pluralize' => false]]);
     } elseif ($app instanceof \yii\console\Application) {
         $app->controllerMap[$this->id] = ['class' => 'gbksoft\\modules\\tokens\\console\\AppController', 'module' => $this];
     }
 }
Example #3
0
 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([], false);
 }
Example #4
0
 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id => 'cp/' . $this->id, '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>' => 'cp/' . $this->id . '/<controller>', '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>'], false);
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/debug' => 'debug', '<language:\\w+\\-\\w+>/debug/<controller:\\w+>/<action:\\w+>' => 'debug/<controller>/<action>'], false);
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/gii' => 'gii/default/index', '<language:\\w+\\-\\w+>/gii/<id:\\w+>' => 'gii/default/view', '<language:\\w+\\-\\w+>/gii/<controller:\\w+>/<action:\\w+>' => 'gii/<controller>/<action>'], false);
 }
 private function addFrontendUrlRule(Application $app)
 {
     $rules = ['frontend/<layout:\\w+><view:(.*)>' => 'frontend/frontend/render-raw'];
     $app->getUrlManager()->addRules($rules);
 }
Example #6
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  *
  * @param Application $app the application currently running
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules([['pattern' => $this->id, 'route' => $this->id . '/default/index', 'suffix' => '.xml'], ['pattern' => $this->id . '/<type:[\\w-@]+>/<slug:[\\w-@]+>-<page:\\d+>', 'route' => $this->id . '/default/view', 'suffix' => '.xml'], ['pattern' => $this->id . '/<type:[\\w-@]+>/<slug:[\\w-@]+>', 'route' => $this->id . '/default/view', 'suffix' => '.xml'], $this->id => '/site/not-found', $this->id . '/default/' => '/site/not-found', $this->id . '/default/<alias:index|view>/' => '/site/not-found'], false);
 }
Example #7
0
 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>'], false);
 }
Example #8
0
 /**
  * Bootstrap method to be called during application bootstrap stage.
  * Adding routing rules and log target.
  * 
  * @param \yii\base\Application $app the application currently running
  */
 public function bootstrap($app)
 {
     if ($app instanceof WebApplication) {
         $app->getUrlManager()->addRules([new GroupUrlRule(['prefix' => 'podium', 'rules' => ['activate/<token:[\\w\\-]+>' => 'account/activate', 'admin/ban/<id:\\d+>' => 'admin/ban', 'admin/contents/<name:[\\w\\-]+>' => 'admin/contents', 'admin/delete/<id:\\d+>' => 'admin/delete', 'admin/delete-category/<id:\\d+>' => 'admin/delete-category', 'admin/delete-forum/<cid:\\d+>/<id:\\d+>' => 'admin/delete-forum', 'admin/edit-category/<id:\\d+>' => 'admin/edit-category', 'admin/edit-forum/<cid:\\d+>/<id:\\d+>' => 'admin/edit-forum', 'admin/forums/<cid:\\d+>' => 'admin/forums', 'admin/mod/<uid:\\d+>/<fid:\\d+>' => 'admin/mod', 'admin/mods/<id:\\d+>' => 'admin/mods', 'admin/new-forum/<cid:\\d+>' => 'admin/new-forum', 'admin/pm/<id:\\d+>' => 'admin/pm', 'admin/update/<id:\\d+>' => 'admin/update', 'admin/view/<id:\\d+>' => 'admin/view', 'admin' => 'admin/index', 'category/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/category', 'delete/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/delete', 'deletepost/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/deletepost', 'deleteposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/deleteposts', 'demote/<id:\\d+>' => 'admin/demote', 'edit/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/edit', 'forum/<cid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/forum', 'home' => 'default/index', 'install' => 'install/run', 'last/<id:\\d+>' => 'default/last', 'lock/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/lock', 'login' => 'account/login', 'logout' => 'profile/logout', 'members/posts/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/posts', 'members/threads/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/threads', 'members/view/<id:\\d+>/<slug:[\\w\\-]+>' => 'members/view', 'members' => 'members/index', 'members/ignore/<id:\\d+>' => 'members/ignore', 'messages/delete/<id:\\d+>' => 'messages/delete', 'messages/new/<user:\\d+>' => 'messages/new', 'messages/reply/<id:\\d+>' => 'messages/reply', 'messages/view/<id:\\d+>' => 'messages/view', 'move/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/move', 'moveposts/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/moveposts', 'new-email/<token:[\\w\\-]+>' => 'account/new-email', 'new-thread/<cid:\\d+>/<fid:\\d+>' => 'default/new-thread', 'pin/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/pin', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>' => 'default/post', 'post/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>' => 'default/post', 'profile' => 'profile/index', 'profile/add/<id:\\d+>' => 'profile/add', 'profile/delete/<id:\\d+>' => 'profile/delete', 'profile/mark/<id:\\d+>' => 'profile/mark', 'promote/<id:\\d+>' => 'admin/promote', 'reactivate' => 'account/reactivate', 'register' => 'account/register', 'report/<cid:\\d+>/<fid:\\d+>/<tid:\\d+>/<pid:\\d+>/<slug:[\\w\\-]+>' => 'default/report', 'reset' => 'account/reset', 'rss' => 'default/rss', 'search' => 'default/search', 'show/<id:\\d+>' => 'default/show', 'thread/<cid:\\d+>/<fid:\\d+>/<id:\\d+>/<slug:[\\w\\-]+>' => 'default/thread']])], false);
         $dbTarget = new DbTarget();
         $dbTarget->logTable = '{{%podium_log}}';
         $dbTarget->categories = ['bizley\\podium\\*'];
         $dbTarget->logVars = [];
         $app->getLog()->targets['podium'] = $dbTarget;
     } elseif ($app instanceof ConsoleApplication) {
         $this->controllerNamespace = 'bizley\\podium\\console';
     }
 }
Example #9
0
 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD roots' => 'roots', 'GET,HEAD leaves' => 'leaves', 'GET,HEAD {id}/children' => 'children', 'GET,HEAD {id}/descendants' => 'descendants', 'GET,HEAD {id}/leaves' => 'leaves', 'GET,HEAD {id}/ancestors' => 'ancestors', 'GET,HEAD {id}/parent' => 'parent', 'PUT,PATCH {id}/move' => 'move', 'POST search' => 'search'], 'controller' => ['categories' => 'catalog/rest/category', 'product-categories' => 'catalog/rest/product-category']], ['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD {id}/attributes' => 'attributes'], 'controller' => ['product-types' => 'catalog/rest/product-type']]], false);
 }
Example #10
0
 /**
  * Ajout du routing spécifique au module
  *      format : [verbe] regex-url => route
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(include __DIR__ . '/config/routing.php', false);
 }
Example #11
0
 /**
  * Ajout du routing spécifique au module
  *      format : [verbe] regex-url => route
  *
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(['GET    hlib/admin' => 'hlib/admin/index'], false);
 }
Example #12
0
 /**
  * @param \yii\base\Application $app
  */
 public function bootstrap($app)
 {
     $app->getUrlManager()->addRules(['GET /' => 'site/home/home', 'GET,POST login' => 'site/auth/login', 'GET logout' => 'site/auth/logout'], true);
 }
Example #13
0
 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id => 'cp/' . $this->id, '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>' => 'cp/' . $this->id . '/<controller>', '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>']);
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>' => '/', '<language:\\w+\\-\\w+>/<route:.+>' => 'page/page/route', '<route:.+>' => '/page/page/route'], true);
 }
Example #14
0
 /**
  * Adds module rules.
  *
  * @param Application $app
  */
 public function addRules($app)
 {
     $app->getUrlManager()->addRules([['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD roots' => 'roots', 'GET,HEAD leaves' => 'leaves', 'GET,HEAD {id}/children' => 'children', 'GET,HEAD {id}/descendants' => 'descendants', 'GET,HEAD {id}/leaves' => 'leaves', 'GET,HEAD {id}/ancestors' => 'ancestors', 'GET,HEAD {id}/parent' => 'parent', 'PUT,PATCH {id}/move' => 'move', 'POST search' => 'search'], 'controller' => ['menu-items' => 'cms/rest/menu-item']], ['class' => 'yii\\rest\\UrlRule', 'prefix' => 'api/v1', 'extraPatterns' => ['GET,HEAD {id}/items/roots' => 'roots', 'POST {id}/items/search' => 'search'], 'controller' => ['menus' => 'cms/rest/menu']]], false);
 }
Example #15
0
 /**
  * @param \yii\base\Application $app
  */
 public function registerRules($app)
 {
     $app->getUrlManager()->addRules(['<language:\\w+\\-\\w+>/cp/' . $this->id => 'cp/' . $this->id, '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>' => 'cp/' . $this->id . '/<controller>', '<language:\\w+\\-\\w+>/cp/' . $this->id . '/<controller:\\w+>/<action:\\w+>' => 'cp/' . $this->id . '/<controller>/<action>'], false);
     $app->getUrlManager()->addRules(['cp/login' => 'cp/' . $this->id . '/default/login', '<language:\\w+\\-\\w+>/cp/login' => 'cp/' . $this->id . '/default/login', 'cp/logout' => 'cp/' . $this->id . '/default/logout', '<language:\\w+\\-\\w+>/cp/logout' => 'cp/' . $this->id . '/default/logout'], false);
 }