當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::demodulize方法代碼示例

本文整理匯總了PHP中Inflector::demodulize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::demodulize方法的具體用法?PHP Inflector::demodulize怎麽用?PHP Inflector::demodulize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inflector的用法示例。


在下文中一共展示了Inflector::demodulize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_demodulize

 /**
  * Test for Inflector::demodulize()
  *
  * @test
  */
 public function test_demodulize()
 {
     $output = Inflector::demodulize('Uri::main()');
     $expected = 'main()';
     $this->assertEquals($expected, $output);
 }
開發者ID:phabos,項目名稱:fuel-core,代碼行數:11,代碼來源:inflector.php

示例2: foreignKey

 /**
 * Returns $class_name in underscored form, with "_id" tacked on at the end.
 * This is for use in dealing with the database.
 *
 * @param string $class_name
 * @return string
 */
 public static function foreignKey($class_name, $separate_class_name_and_id_with_underscore = true)
 {
     return Inflector::underscore(Inflector::demodulize($class_name)) . ($separate_class_name_and_id_with_underscore ? "_id" : "id");
 }
開發者ID:scottdavis,項目名稱:nimble,代碼行數:11,代碼來源:inflector.php

示例3: _foreignKey

 /**
 * Returns $class_name in underscored form, with "_id" tacked on at the end.
 * This is for use in dealing with the database.
 *
 * @param string $class_name
 * @return string
 */
 private static function _foreignKey($class_name, $suffix = 'id', $separate_class_name_and_id_with_underscore = true)
 {
     return Inflector::underscore(Inflector::demodulize($class_name)) . ($separate_class_name_and_id_with_underscore ? "_" . $suffix : $suffix);
 }
開發者ID:scottdavis,項目名稱:nimblize,代碼行數:11,代碼來源:inflector.php

示例4: recognize_route


//.........這裏部分代碼省略.........
     }
     # strip trailing slash (if any)
     if (substr($browser_url, -1) == "/") {
         $browser_url = substr($browser_url, 0, -1);
     }
     if ($browser_url) {
         $this->url_path = explode("/", !is_null(Trax::$url_word_seperator) ? str_replace(Trax::$url_word_seperator, "_", $browser_url) : $browser_url);
     } else {
         $this->url_path = array();
     }
     if ($this->router->routes_count > 0) {
         $this->controllers_path = Trax::$controllers_path;
         $this->helpers_path = $this->helpers_base_path = Trax::$helpers_path;
         $this->application_controller_file = $this->controllers_path . "/application.php";
         $this->application_helper_file = $this->helpers_path . "/application_helper.php";
         $this->layouts_path = Trax::$layouts_path;
         $this->views_path = Trax::$views_path;
         $route = $this->router->find_route($browser_url);
         #echo "browser_url:$browser_url Found Route:".print_r($route, true)."<br>";
         //  find_route() returns an array if it finds a path that
         //  matches the URL, null if no match found
         if (is_array($route)) {
             //  Matching route found.  Try to get
             //  controller and action from route and URL
             #print_r($this->router);
             #echo "<br>";
             if ($route['plugin']) {
                 $this->plugin = $route['plugin'];
                 $this->controllers_path = Trax::$plugins_path . "/{$route['plugin']}/app/controllers";
                 $this->helpers_path = $this->helpers_base_path = Trax::$plugins_path . "/{$route['plugin']}/app/helpers";
                 $this->layouts_path = Trax::$plugins_path . "/{$route['plugin']}/app/views/layouts";
                 $this->views_path = Trax::$plugins_path . "/{$route['plugin']}/app/views";
             }
             $this->set_paths();
             $route_path = explode("/", $route['path']);
             $route_params = $route['params'];
             //  Find the controller from the route and URL
             if (is_array($route_params) && array_key_exists(":controller", $route_params)) {
                 //  ':controller' in route params overrides URL
                 $this->controller = $route_params[":controller"];
                 if (stristr($route_params[":controller"], "/")) {
                 }
             } elseif (is_array($route_path) && in_array(":controller", $route_path) && count($this->url_path) > 0) {
                 //  Set controller from URL if that field exists
                 $this->controller = strtolower($this->url_path[array_search(":controller", $route_path)]);
             }
             //error_log('controller='.$this->controller);
             //  Find the action from the route and URL
             if (is_array($route_params) && array_key_exists(":action", $route_params)) {
                 //  ':action' in route params overrides URL
                 $this->action = $route_params[':action'];
             } elseif (is_array($route_path) && in_array(":action", $route_path) && array_key_exists(@array_search(":action", $route_path), $this->url_path)) {
                 //  Get action from URL if that field exists
                 $this->action = strtolower($this->url_path[@array_search(":action", $route_path)]);
             }
             //error_log('action='.$this->action);
             //  FIXME: RoR uses :name as a keyword parameter, id
             //  is not treated as a special case.
             //  Do we want to do the same?
             $id = null;
             if (is_array($route_params) && array_key_exists(":id", $route_params)) {
                 //  ':id' in route params overrides URL
                 $id = $route_params[':id'];
             } elseif (@in_array(":id", $route_path)) {
                 #print_r($this->url_path);
                 #print_r($route_path);
                 #if(count($this->extra_path)) {
                 #foreach(array_reverse($this->extra_path) as $extra_path) {
                 #array_unshift($this->url_path, $extra_path);
                 #}
                 #}
                 #print_r($this->url_path);
                 $idPathKey = @array_search(":id", $route_path);
                 if (isset($this->url_path[$idPathKey])) {
                     $id = strtolower($this->url_path[$idPathKey]);
                 } else {
                     $id = null;
                 }
             }
             //  For historical reasons, continue to pass id
             //  in $_REQUEST
             if ($id != "") {
                 $_REQUEST['id'] = $id;
             }
             //error_log('id='.$id);
             $this->views_path .= "/" . $this->controller;
             $this->controller_file = $this->controllers_path . "/" . $this->controller . "_controller.php";
             $this->controller_class = Inflector::camelize(Inflector::demodulize($this->controller)) . "Controller";
             $this->helper_file = $this->helpers_path . "/" . $this->controller . "_helper.php";
             # error_log("controller:{$this->controller} - controller_file:{$this->controller_file} - controller_class:{$this->controller_class} - views_path:{$this->views_path}");
         }
     }
     if (is_file($this->controller_file)) {
         $this->loaded = true;
         return true;
     } else {
         $this->loaded = false;
         return false;
     }
 }
開發者ID:phpontrax,項目名稱:trax,代碼行數:101,代碼來源:action_controller.php


注:本文中的Inflector::demodulize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。