hyphenToUnderscore() public static method

public static hyphenToUnderscore ( $string )
示例#1
0
 protected static function normalize($request)
 {
     if (is_null($request)) {
         $request = Mapper::parse();
     }
     $request['controller'] = Inflector::hyphenToUnderscore($request['controller']);
     $request['action'] = Inflector::hyphenToUnderscore($request['action']);
     return $request;
 }
示例#2
0
 /**
  *  Chama o controller e a action solicitadas pela URL.
  * 
  *  @return mixed Instância do novo controller ou falso em caso de erro
  */
 public function dispatch()
 {
     $path = Mapper::parse();
     $path["controller"] = Inflector::hyphenToUnderscore($path["controller"]);
     $path["action"] = Inflector::hyphenToUnderscore($path["action"]);
     $controller_name = Inflector::camelize($path["controller"]) . "Controller";
     if ($controller =& ClassRegistry::load($controller_name, "Controller")) {
         if (!can_call_method($controller, $path['action']) && !App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
             $this->error("missingAction", array("controller" => $path["controller"], "action" => $path["action"]));
             return false;
         }
     } else {
         if (App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
             $controller =& ClassRegistry::load("AppController", "Controller");
         } else {
             $this->error("missingController", array("controller" => $path["controller"]));
             return false;
         }
     }
     $controller->params = $path;
     $controller->componentEvent("initialize");
     $controller->beforeFilter();
     $controller->componentEvent("startup");
     if (in_array($path["action"], $controller->methods) && can_call_method($controller, $path["action"])) {
         $params = $path["params"];
         if (!is_null($path["id"])) {
             $params = array_merge(array($path["id"]), $params);
         }
         call_user_func_array(array(&$controller, $path["action"]), $params);
     }
     if ($controller->autoRender) {
         $controller->render();
     }
     $controller->componentEvent("shutdown");
     echo $controller->output;
     $controller->afterFilter();
     return $controller;
 }
示例#3
0
 /**
  * Centraliza a criação de botões. Pode ser um submit, um reset ou button
  *    
  * @param string $type_field Tipo do botão a ser criado. Pode ser submit, button ou reset
  * @param string $name_field O nome do botão
  * @return $this
  */
 public function tagButton($type_field, $name_field)
 {
     $this->input($type_field, $name_field, false);
     $this->attr('value', Inflector::humanize($name_field))->attr('id', Inflector::hyphenToUnderscore(Inflector::slug($name_field)))->attr('name', Inflector::hyphenToUnderscore(Inflector::slug($name_field)));
     return $this;
 }