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


PHP Finder::paths方法代码示例

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


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

示例1: _set_routing

 /**
  * Sets the routes.
  *
  * @return void
  */
 public function _set_routing()
 {
     if ($this->config->item('enable_query_strings') && isset($_GET[$this->config->item('controller_trigger')])) {
         // controller
         $this->class = trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')]));
         // module
         if (isset($_GET[$this->config->item('module_trigger')])) {
             $this->module = trim($this->uri->_filter_uri($_GET[$this->config->item('module_trigger')]));
             // check if it is installed
             include APPPATH . 'config/modules.php';
             if (in_array($this->module, array_keys($modules)) && !in_array($this->module, $disable_controller)) {
                 // get path
                 $this->module_path = $modules[$this->module];
             } else {
                 // no module with that name exists
                 $this->module = false;
             }
         }
         // method
         if (isset($_GET[$this->config->item('function_trigger')])) {
             $this->method = trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')]));
         }
         // language
         if (isset($_GET[$this->config->item('language_trigger')]) && ($key = $this->valid_lang_key($_GET[$this->config->item('language_trigger')]))) {
             $this->lang_key = $key;
             $this->apply_language();
         } else {
             // Browser detection : need to be rewritten
             // This function does not return the good language in case of root ("/") URL
             // It just returns the first found browser lang code, which can be incorrect.
             // $this->detect_language();
             // No browser detection : Ionize defined default lang code.
             $this->set_default_language();
         }
     } else {
         // Fetch the complete URI string
         $this->uri->_fetch_uri_string();
         // use the default controller
         if (empty($this->uri->uri_string)) {
             $this->load_default_uri();
         }
         $this->uri->_remove_url_suffix();
         // clean the uri and explode it
         $this->explode_segments($this->uri->uri_string);
         // LANGUAGE:
         // check if we have a valid language key there
         if ($key = $this->validate_lang_key($raw_key = current($this->uri->segments))) {
             $this->lang_key = $key;
             $this->apply_language();
             // remove the language key
             array_shift($this->uri->segments);
             if (empty($this->uri->segments)) {
                 // load the default uri again
                 $this->load_default_uri();
                 $this->uri->_remove_url_suffix();
                 // clean the uri and explode it
                 $this->explode_segments($this->uri->uri_string);
             } else {
                 // remove the language key from the uri_string
                 $this->uri->uri_string = '/' . preg_replace('/\\/?' . preg_quote($raw_key) . '\\//', '', $this->uri->uri_string);
             }
         } else {
             // No browser detection : Ionize defined default lang code.
             $this->set_default_language();
             // Browser detection : need to be rewritten
             // This function does not return the good language in case of root ("/") URL
             // It just returns the first found browser lang code, which can be incorrect.
             //				$this->detect_language();
         }
         // END LANGUAGE
         // get the generated module file and see if we can match to a module
         include APPPATH . 'config/modules.php';
         // get the first segment, to match to the modules
         $rmodule = current($this->uri->segments);
         // do we have a module with that name?
         if (in_array($rmodule, array_keys($modules)) && !in_array($rmodule, $disable_controller)) {
             // yes, remove it and store it as a module, also remove the module name from the uri
             $this->module_path = $modules[array_shift($this->uri->segments)];
             $this->module = $rmodule;
         } elseif (in_array($rmodule, array_keys($aliases))) {
             // yes, get module and controller, remove alias from the uri
             list($this->module_path, $c) = each($aliases[array_shift($this->uri->segments)]);
             $this->module = array_search($this->module_path, $modules);
             // add the controller back to it, so the match_to_routes() and find controller works as they should
             $this->uri->segments = array_merge(array($c), $this->uri->segments);
         }
         if ($this->module_path) {
             // we have module, add the module to the cascade
             Finder::$paths = array_merge(array(MODPATH . $this->module_path . '/'), Finder::$paths);
         }
         $this->uri->segments = $this->match_to_routes($this->uri->segments);
         $this->find_controller($this->uri->segments);
         // add the module first so it is correct
         if ($this->module_path) {
             $this->uri->segments = array_merge(array($this->module), $this->uri->segments);
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zillatek-project-svn-to-git,代码行数:101,代码来源:Router.php

示例2: _set_routing

 /**
  * Sets the routes.
  *
  * @return void
  */
 public function _set_routing()
 {
     if ($this->config->item('enable_query_strings') && isset($_GET[$this->config->item('controller_trigger')])) {
         // controller
         $this->class = trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')]));
         // module
         if (isset($_GET[$this->config->item('module_trigger')])) {
             $this->module = trim($this->uri->_filter_uri($_GET[$this->config->item('module_trigger')]));
             // check if it is installed
             include APPPATH . 'config/modules.php';
             if (in_array($this->module, array_keys($modules)) && !in_array($this->module, $disable_controller)) {
                 // get path
                 $this->module_path = $modules[$this->module];
             } else {
                 // no module with that name exists
                 $this->module = FALSE;
             }
         }
         // method
         if (isset($_GET[$this->config->item('function_trigger')])) {
             $this->method = trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')]));
         }
         // language
         if (isset($_GET[$this->config->item('language_trigger')]) && ($key = $this->valid_lang_key($_GET[$this->config->item('language_trigger')]))) {
             $this->lang_key = $key;
             $this->apply_language();
         } else {
             // Lang detection : Cookie, Browser
             $this->detect_language();
         }
     } else {
         // Fetch the complete URI string
         $this->uri->_fetch_uri_string();
         // use the default controller
         if (empty($this->uri->uri_string)) {
             $this->uri->uri_string = '';
         }
         $this->uri->_remove_url_suffix();
         // clean the uri and explode it
         $this->explode_segments($this->uri->uri_string);
         $this->raw_key = current($this->uri->segments);
         // Language key : check if we have a valid language key there
         if ($key = $this->validate_lang_key($this->raw_key)) {
             if (count($this->uri->segments) == 1 && $key == $this->config->item('default_lang_code')) {
                 $this->redirect_home_to_base_url();
             }
             $this->lang_key = $key;
             $this->apply_language();
             // remove the language key
             array_shift($this->uri->segments);
             if (empty($this->uri->segments)) {
                 $this->uri->uri_string = '';
             } else {
                 // remove the language key from the uri_string
                 $this->uri->uri_string = strstr($this->uri->uri_string, '/');
             }
         } else {
             // Lang detection : Cookie, Browser
             $this->detect_language();
             // Home Page : Redirect to detected lang ?
             if ($this->raw_key == '') {
                 $this->redirect_home_to_lang_url();
             }
         }
         // END Language key
         // get the generated module file and see if we can match to a module
         include APPPATH . 'config/modules.php';
         // get the first segment, to match to the modules
         $rmodule = current($this->uri->segments);
         // do we have a module with that name?
         if (in_array($rmodule, array_keys($modules)) && !in_array($rmodule, $disable_controller)) {
             // yes, remove it and store it as a module, also remove the module name from the uri
             $this->module_path = $modules[array_shift($this->uri->segments)];
             $this->module = $rmodule;
         } elseif (in_array($rmodule, array_keys($aliases))) {
             // yes, get module and controller, remove alias from the uri
             list($this->module_path, $c) = each($aliases[array_shift($this->uri->segments)]);
             $this->module = array_search($this->module_path, $modules);
             // add the controller back to it, so the match_to_routes() and find controller works as they should
             $this->uri->segments = array_merge(array($c), $this->uri->segments);
         }
         if ($this->module_path) {
             // we have module, add the module to the cascade
             Finder::$paths = array_merge(array(MODPATH . $this->module_path . '/'), Finder::$paths);
         }
         $this->uri->segments = $this->match_to_routes($this->uri->segments);
         $this->find_controller($this->uri->segments);
         // add the module first so it is correct
         if ($this->module_path) {
             $this->uri->segments = array_merge(array($this->module), $this->uri->segments);
         }
         // make them start with 1
         $this->uri->_reindex_segments();
     }
 }
开发者ID:pompalini,项目名称:emngo,代码行数:100,代码来源:Router.php


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