当前位置: 首页>>代码示例>>PHP>>正文


PHP CUrlManager::processRules方法代码示例

本文整理汇总了PHP中CUrlManager::processRules方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrlManager::processRules方法的具体用法?PHP CUrlManager::processRules怎么用?PHP CUrlManager::processRules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUrlManager的用法示例。


在下文中一共展示了CUrlManager::processRules方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRules

 protected function processRules()
 {
     $rules = array();
     $method = strtolower(Yii::app()->getRequest()->getRequestType());
     //transform method's rules keys to lowercase
     $this->rules = array_combine(array_map(array($this, '__atToLowerCase'), array_keys($this->rules)), array_values($this->rules));
     //check if it has an index the same as the request type and if it does add its rules
     if (key_exists("@{$method}", $this->rules)) {
         $rules = $this->rules["@{$method}"];
     }
     //add the default rules
     if (is_array($rules)) {
         foreach ($this->rules as $k => $rule) {
             if (substr($k, 0, 1) !== '@') {
                 $rules[$k] = $rule;
             }
         }
     } elseif (is_string($rules)) {
         $rules = array("." => $rules);
     }
     //override the existing rules with only those that matche with the request type
     $this->rules = $rules;
     //disable cache that causes it to load wrong rules
     //cant use it as its defined as a constant and not able to change to use method's specific cache
     $this->cacheID = false;
     parent::processRules();
 }
开发者ID:aer123456,项目名称:yougou,代码行数:27,代码来源:VerbUrlManager.php

示例2: processRules

 /**
  * Build the rules from the DB
  */
 protected function processRules()
 {
     // Make sure db settings are set
     if (!Yii::app()->db) {
         die(sprintf("Could not connect to the database. Please set the DB settings in the protected/config/%s file.", YII_DEBUG ? 'dev.php' : 'production.php'));
     }
     $active_lang = implode('|', array_keys(Yii::app()->params['languages']));
     $domain = Yii::app()->params['current_domain'];
     if (($urlrules = Yii::app()->cache->get('customurlrules')) === false) {
         $dbCommand = Yii::app()->db->createCommand("SELECT alias, language FROM {{custompages}}")->query();
         $urlRules = $dbCommand->readAll();
         $_more = array();
         foreach ($urlRules as $rule) {
             $_more["http://<lang:({$rule['language']})>.{$domain}/<alias:({$rule['alias']})>"] = array('site/custompages/index');
         }
         // Do we use subdomains for languages or as directory seperators
         if (Yii::app()->params['subdomain_languages']) {
             $this->rules = array("http://<lang:({$active_lang})>.{$domain}/admin" => array('admin/index/index'), "http://<lang:({$active_lang})>.{$domain}/admin/<_c:([a-zA-z0-9-]+)>" => array('admin/<_c>/index/'), "http://<lang:({$active_lang})>.{$domain}/admin/<_c:([a-zA-z0-9-_]+)>/<_a:([a-zA-z0-9-_]+)>/*" => array('admin/<_c>/<_a>/'), "http://<lang:({$active_lang})>.{$domain}/admin/<_c:([a-zA-z0-9-_]+)>/<_a:([a-zA-z0-9-_]+)>/*" => array('admin/<_c>/<_a>'), "http://<lang:({$active_lang})>.{$domain}/admin/<_c:([a-zA-z0-9-]+)>/*" => array('admin/<_c>/index/'), "http://<lang:({$active_lang})>.{$domain}/admin/<_c:([a-zA-z0-9-]+)>/*" => array('admin/<_c>/index'), "http://<lang:({$active_lang})>.{$domain}/sitemap" => array('site/sitemap/index', 'urlSuffix' => '.xml', 'caseSensitive' => false), "http://<lang:({$active_lang})>.{$domain}/tutorials/category/<alias:(.*)>" => array('site/tutorials/viewcategory'), "http://<lang:({$active_lang})>.{$domain}/tutorials/view/<alias:(.*)>" => array('site/tutorials/viewtutorial'), "http://<lang:({$active_lang})>.{$domain}/blog/category/<alias:(.*)>" => array('site/blog/viewcategory'), "http://<lang:({$active_lang})>.{$domain}/blog/view/<alias:(.*)>" => array('site/blog/viewpost'), "http://<lang:({$active_lang})>.{$domain}/extensions/category/<alias:(.*)>" => array('site/extensions/viewcategory'), "http://<lang:({$active_lang})>.{$domain}/extensions/view/<alias:(.*)>" => array('site/extensions/viewpost'), "http://<lang:({$active_lang})>.{$domain}/extensions/download/<fileid:(\\d+)>-<alias:(.*)>" => array('site/extensions/download'), "http://<lang:({$active_lang})>.{$domain}/user/<uid:(\\d+)>-<alias:(.*)>" => array('site/users/viewprofile'), "http://<lang:({$active_lang})>.{$domain}/forum/topic/<topicid:(\\d+)>-<alias:(.*?)>/*" => array('site/forum/viewtopic'), "http://<lang:({$active_lang})>.{$domain}/<_c:([a-zA-z0-9-]+)>" => array('site/<_c>/index'), "http://<lang:({$active_lang})>.{$domain}/<_c:([a-zA-z0-9-_]+)>/<_a:([a-zA-z0-9-_]+)>/*" => array('site/<_c>/<_a>/'), "http://<lang:({$active_lang})>.{$domain}/<_c:([a-zA-z0-9-_]+)>/<_a:([a-zA-z0-9-_]+)>/*" => array('site/<_c>/<_a>'), "http://<lang:({$active_lang})>.{$domain}" => array('site/index/index'), "http://<lang:({$active_lang})>.{$domain}/" => array('site/index/index'), "http://<lang:({$active_lang})>.{$domain}/<_c:([a-zA-z0-9-_]+)>/*" => array('site/<_c>/index/'), "http://<lang:({$active_lang})>.{$domain}/<_c:([a-zA-z0-9-_]+)>/*" => array('site/<_c>/index'));
         } else {
             $this->rules = array("<lang:({$active_lang})>/admin" => 'admin/index/index', "<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>" => 'admin/<_c>/index', "<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>" => 'admin/<_c>/<_a>', "<lang:({$active_lang})>/admin/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>//*" => 'admin/<_c>/<_a>/', "<lang:({$active_lang})>/" => 'site/index/index', "<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>" => 'site/<_c>/index', "<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>" => 'site/<_c>/<_a>', "<lang:({$active_lang})>/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>//*" => 'site/<_c>/<_a>/', "http://{$domain}/sitemap" => array('site/sitemap/index', 'urlSuffix' => '.xml', 'caseSensitive' => false), "http://{$domain}/tutorials/category/<alias:(.*)>" => array('site/tutorials/viewcategory'), "http://{$domain}/tutorials/view/<alias:(.*)>" => array('site/tutorials/viewtutorial'), "http://{$domain}/blog/category/<alias:(.*)>" => array('site/blog/viewcategory'), "http://{$domain}/blog/view/<alias:(.*)>" => array('site/blog/viewpost'), "http://{$domain}/extensions/category/<alias:(.*)>" => array('site/extensions/viewcategory'), "http://{$domain}/extensions/view/<alias:(.*)>" => array('site/extensions/viewpost'), "http://{$domain}/extensions/download/<fileid:(\\d+)>-<alias:(.*)>" => array('site/extensions/download'), "http://{$domain}/user/<uid:(\\d+)>-<alias:(.*)>" => array('site/users/viewprofile'), "http://{$domain}/forum/topic/<topicid:(\\d+)>-<alias:(.*?)>/*" => array('site/forum/viewtopic'));
         }
         $urlrules = array_merge($_more, $this->rules);
         $urlrules = array_merge($urlrules, array("<alias:[0-9a-zA-Z_\\-]+>/*" => 'site/custompages/index'));
         Yii::app()->cache->set('customurlrules', $urlrules);
     }
     $this->rules = $urlrules;
     // Run parent
     parent::processRules();
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:32,代码来源:CustomUrlManager.php

示例3: processRules

 /**
  * Build the rules from the DB
  */
 protected function processRules()
 {
     if (($this->rules = Yii::app()->cache->get('customurlrules')) === false) {
         // Site Rules
         $this->rules = array('project/<id:\\d+>/<alias>' => 'site/projects/viewproject', 'issue/<id:\\d+>/<alias>' => 'site/tickets/viewticket', 'issues/<type:(priority|version|fixedin|type|status|category|project|milestone)>/<id:\\d+>/<alias>' => 'site/tickets/filterissues', 'issues/<type:(priority|version|fixedin|type|status|category|project|milestone)>/<id:\\d+>/<alias>/<rss:\\w+>' => 'site/tickets/filterissues', 'issues/tag/<tag>' => 'site/tickets/filterissuesbytag', 'wiki/<id:\\d+>/<alias>' => 'site/wiki/viewpage', 'wiki/<id:\\d+>/<alias>/<revisionid:\\d+>' => 'site/wiki/viewpagerevision', '' => 'site/index/index', '<_c:([a-zA-z0-9-]+)>' => 'site/<_c>/index', '<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>' => 'site/<_c>/<_a>', '<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>//*' => 'site/<_c>/<_a>/');
         Yii::app()->cache->set('customurlrules', $this->rules);
     }
     // Run parent
     parent::processRules();
 }
开发者ID:IuriiP,项目名称:yii-tracker,代码行数:13,代码来源:CustomUrlManager.php

示例4: processRules

 /**
  * Overrides processRules, allowing us to inject our own ruleset into the URL Manager
  * Takes no parameters
  **/
 protected function processRules()
 {
     $this->addBasicRules();
     $this->cacheRules('content', $this->contentUrlRulesId);
     $this->cacheRules('categories', $this->categoriesUrlRulesId);
     // Allow Sphinx Search settings to be dynamically via CiiSettings
     if (Cii::getConfig('sphinx_enabled')) {
         $this->rules['/search/<page:\\d+>'] = '/site/search';
         $this->rules['/search'] = '/site/search';
     }
     // Append our cache rules BEFORE we run the defaults
     $this->rules['<controller:\\w+>/<action:\\w+>/<id:\\d+>'] = '<controller>/<action>';
     $this->rules['<controller:\\w+>/<action:\\w+>'] = '<controller>/<action>';
     return parent::processRules();
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:19,代码来源:CiiURLManager.php

示例5: processRules

 /**
  * Overrides processRules, allowing us to inject our own ruleset into the URL Manager
  * Takes no parameters
  **/
 protected function processRules()
 {
     $this->cache = !YII_DEBUG;
     // Generate the clientRules
     $this->rules = $this->cache ? Yii::app()->cache->get('CiiMS::Routes') : array();
     if ($this->rules == false || empty($this->rules)) {
         $this->rules = array();
         $this->rules = $this->generateClientRules();
         $this->rules = CMap::mergearray($this->addRssRules(), $this->rules);
         $this->rules = CMap::mergeArray($this->addModuleRules(), $this->rules);
         Yii::app()->cache->set('CiiMS::Routes', $this->rules);
     }
     // Append our cache rules BEFORE we run the defaults
     $this->rules['<controller:\\w+>/<action:\\w+>/<id:\\d+>'] = '<controller>/<action>';
     $this->rules['<controller:\\w+>/<action:\\w+>'] = '<controller>/<action>';
     return parent::processRules();
 }
开发者ID:charlesportwoodii,项目名称:cii,代码行数:21,代码来源:CiiURLManager.php

示例6: processRules

 /**
  * Build the rules from the DB
  */
 protected function processRules()
 {
     $this->rules = array("/admin" => 'admin/index/index', "/admin/<_c:([a-zA-z0-9-]+)>" => 'admin/<_c>/index', "/admin/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-\\.]+)>/*" => 'admin/<_c>/<_a>', "/" => 'site/index/index', "/<_c:([a-zA-z0-9-]+)>" => 'site/<_c>/index', "/<_c:([a-zA-z0-9-]+)>/<_a:([a-zA-z0-9-]+)>/*" => 'site/<_c>/<_a>');
     // Run parent
     parent::processRules();
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:9,代码来源:CustomUrlManager.php


注:本文中的CUrlManager::processRules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。