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


PHP Text::uncamelize方法代碼示例

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


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

示例1: getSource

 public function getSource()
 {
     $nowClassName = get_class($this);
     $trueClassName = str_replace(__NAMESPACE__ . '\\', '', $nowClassName);
     $trueClassName = Text::uncamelize($trueClassName);
     return DB_PREFIX . strtolower($trueClassName);
 }
開發者ID:ylh990835774,項目名稱:phalcon_ydjc,代碼行數:7,代碼來源:BaseModel.php

示例2: build

 /**
  * Generate view
  */
 public function build()
 {
     $action = Text::uncamelize($this->_options['action']);
     $viewName = explode('-', str_replace('_', '-', Text::uncamelize($this->_options['name'])));
     if (count($viewName) > 1) {
         array_pop($viewName);
     }
     $viewName = implode('-', $viewName);
     $viewDir = $this->_options['directory'] . DIRECTORY_SEPARATOR . $viewName;
     $viewPath = $viewDir . DIRECTORY_SEPARATOR . $action . '.volt';
     $code = "<?php\n" . Tools::getCopyright() . "\n?>\n";
     $code = str_replace("\t", "    ", $code);
     if (!file_exists($viewPath) || $this->_options['force'] == true) {
         if (!is_dir($viewDir)) {
             mkdir($viewDir, 0777, true);
             chmod($viewDir, 0777);
         }
         if (!@file_put_contents($viewPath, $code)) {
             throw new \Exception("Unable to write to '{$viewPath}'");
         }
         chmod($viewPath, 0777);
     } else {
         throw new \Exception("The View '{$action}' already exists");
     }
     return $viewName;
 }
開發者ID:magnxpyr,項目名稱:phalcon-webtools,代碼行數:29,代碼來源:View.php

示例3: initialize

 public function initialize()
 {
     foreach (self::$routes as $route => $controller) {
         $name = str_replace('_', '-', Text::uncamelize($controller));
         $this->add($route, $controller)->setName($name);
     }
 }
開發者ID:dubhunter,項目名稱:hunter-light,代碼行數:7,代碼來源:AppRouter.php

示例4: run

 public function run($parameters)
 {
     $name = $this->getOption(array('name', 1));
     $className = Text::camelize(isset($parameters[2]) ? $parameters[2] : $name);
     $fileName = Text::uncamelize($className);
     $schema = $this->getOption('schema');
     $modelBuilder = new \Phalcon\Builder\Model(array('name' => $name, 'schema' => $schema, 'className' => $className, 'fileName' => $fileName, 'genSettersGetters' => $this->isReceivedOption('get-set'), 'genDocMethods' => $this->isReceivedOption('doc'), 'namespace' => $this->getOption('namespace'), 'directory' => $this->getOption('directory'), 'force' => $this->isReceivedOption('force')));
     $modelBuilder->build();
 }
開發者ID:TommyAzul,項目名稱:docker-centos6,代碼行數:9,代碼來源:Model.php

示例5: run

 /**
  * @param $parameters
  */
 public function run($parameters)
 {
     $name = $this->getOption(array('name', 1));
     $className = Text::camelize(isset($parameters[1]) ? $parameters[1] : $name);
     $fileName = Text::uncamelize($className);
     $schema = $this->getOption('schema');
     $modelBuilder = new ModelBuilder(array('name' => $name, 'schema' => $schema, 'className' => $className, 'fileName' => $fileName, 'genSettersGetters' => $this->isReceivedOption('get-set'), 'genDocMethods' => $this->isReceivedOption('doc'), 'namespace' => $this->getOption('namespace'), 'directory' => $this->getOption('directory'), 'modelsDir' => $this->getOption('output'), 'extends' => $this->getOption('extends'), 'excludeFields' => $this->getOption('excludefields'), 'force' => $this->isReceivedOption('force'), 'mapColumn' => $this->isReceivedOption('mapcolumn')));
     $modelBuilder->build();
 }
開發者ID:doit76,項目名稱:phalcon-devtools,代碼行數:12,代碼來源:Model.php

示例6: install

 /**
  * @param Filter $filter
  */
 public static function install($filter)
 {
     foreach (get_class_methods(get_called_class()) as $method) {
         if ($method != __METHOD__) {
             $filter->add(Text::uncamelize($method), function ($value) use($method) {
                 return call_user_func([get_called_class(), $method], $value);
             });
         }
     }
 }
開發者ID:dubhunter,項目名稱:talon,代碼行數:13,代碼來源:FilterCollection.php

示例7: testUncamelizeString

 /**
  * Tests the uncamelize function
  *
  * @author Nikos Dimopoulos <nikos@niden.net>
  * @since  2012-10-30
  */
 public function testUncamelizeString()
 {
     $uncamelizeTests = array('camelize' => 'camelize', 'CameLiZe' => 'came_li_ze', 'cAmeLize' => 'c_ame_lize', '_camelize' => '_camelize', '123camelize' => '123camelize', 'c_a_m_e_l_i_z_e' => 'c_a_m_e_l_i_z_e', 'Camelize' => 'camelize', 'camel_ize' => 'camel_ize', 'CameLize' => 'came_lize');
     $template = "Text::uncamelize did not convert the string '%s' correctly";
     foreach ($uncamelizeTests as $input => $uncamelized) {
         $expected = $uncamelized;
         $actual = PhText::uncamelize($input);
         $this->assertEquals($expected, $actual, sprintf($template, $input));
     }
 }
開發者ID:lisong,項目名稱:cphalcon,代碼行數:16,代碼來源:UnitTest.php

示例8: install

 /**
  * @param VoltCompiler $compiler
  */
 public static function install($compiler)
 {
     foreach (get_class_methods(get_called_class()) as $method) {
         if ($method != __METHOD__) {
             $compiler->addFunction(Text::uncamelize($method), function ($resolvedArgs, $exprArgs) use($method) {
                 return get_called_class() . '::' . $method . '(' . $resolvedArgs . ')';
             });
         }
     }
 }
開發者ID:dubhunter,項目名稱:talon,代碼行數:13,代碼來源:FunctionCollection.php

示例9: modulesConfig

 public function modulesConfig($modules_list)
 {
     $namespaces = array();
     $modules = array();
     if (!empty($modules_list)) {
         foreach ($modules_list as $module) {
             $namespaces[$module] = APPLICATION_PATH . '/modules/' . $module;
             $simple = Text::uncamelize($module);
             $simple = str_replace('_', '-', $simple);
             $modules[$simple] = array('className' => $module . '\\Module', 'path' => APPLICATION_PATH . '/modules/' . $module . '/Module.php');
         }
     }
     $modules_array = array('loader' => array('namespaces' => $namespaces), 'modules' => $modules);
     return $modules_array;
 }
開發者ID:devsnippet,項目名稱:yona-cms,代碼行數:15,代碼來源:Modules.php

示例10: initialize

 public function initialize()
 {
     if (static::PREFIX) {
         $this->setPrefix(static::PREFIX);
     }
     foreach (static::ROUTES as $route => $controller) {
         $namespace = '';
         if (static::SPACE) {
             $namespace = static::SPACE . '\\';
         }
         $name = implode('-', array_map(function ($name) {
             $name = Text::uncamelize($name);
             $name = str_replace('_', '-', $name);
             return $name;
         }, explode('\\', $controller)));
         $this->add($route, $namespace . $controller)->setName($name);
     }
 }
開發者ID:dubhunter,項目名稱:talon,代碼行數:18,代碼來源:NamedGroup.php

示例11: afterExecuteRoute

 public function afterExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher)
 {
     /** @var \Phalcon\Mvc\Router $route */
     $route = $dispatcher->getDI()->get('router');
     $view = $dispatcher->getDI()->getService('view')->resolve();
     $wasForwarded = $dispatcher->wasForwarded();
     if ($wasForwarded) {
         return;
     }
     if ($route->getMatchedRoute()) {
         $paths = $route->getMatchedRoute()->getPaths();
         $controller = $paths['controller'];
         $action = \Phalcon\Text::uncamelize($paths['action']);
         $action = str_replace("_", "-", $action);
         $template = $controller . '/' . $action;
         $view->pick([$template]);
     }
 }
開發者ID:sb15,項目名稱:phalcon-ext,代碼行數:18,代碼來源:ViewTemplateName.php

示例12: __construct

 public function __construct()
 {
     $class = new \ReflectionClass('\\Phalcon\\Tag');
     $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
     $code = file_get_contents(__DIR__ . '/Generator.tpl');
     // Functions
     $skip = ['getEscaper', 'renderAttributes', 'setDI', 'getDI', 'getUrlService', 'getEscaperService', 'setAutoescape', 'setDefault', 'setDefaults', 'displayTo', 'hasValue', 'getValue', 'resetInput', 'setTitle', 'setTitleSeparator', 'appendTitle', 'prependTitle', 'setDocType'];
     $functions = [];
     foreach ($methods as $method) {
         if (in_array($method->getName(), $skip)) {
             continue;
         }
         $name = lcfirst(\Phalcon\Text::uncamelize($method->getName()));
         if ($method->getName() == 'getDocType') {
             $name = 'get_doctype';
         }
         $callable = sprintf('Phalcon\\Tag::%s', $method->getName());
         $functions[] = sprintf("new Twig_SimpleFunction('%s', '%s')", $name, $callable);
     }
     $functions = implode(",\n", $functions);
     // Create PHP code
     $this->code = str_replace('%functions%', $functions, $code);
 }
開發者ID:kristoftorfs,項目名稱:volt-intellisense,代碼行數:23,代碼來源:Generator.php

示例13: uncamelize

 public static function uncamelize($str)
 {
     return parent::uncamelize($str);
 }
開發者ID:lisong,項目名稱:cphalcon,代碼行數:4,代碼來源:Text.php

示例14: uncamelize

 public static function uncamelize($str, $delimiter = null)
 {
     return parent::uncamelize($str, $delimiter);
 }
開發者ID:mattvb91,項目名稱:cphalcon,代碼行數:4,代碼來源:Text.php

示例15: _getForm

 /**
  * Return form fullname
  *
  * @param string $module
  * @param string $grid
  * @return string
  */
 protected function _getForm($module, $form)
 {
     $module = str_replace("-", "_", \Phalcon\Text::uncamelize($module));
     $module = explode("_", $module);
     foreach ($module as $i => &$word) {
         if ($i == 0) {
             continue;
         }
         $word = ucfirst($word);
     }
     $module = implode("", $module);
     $form = str_replace("-", "_", \Phalcon\Text::uncamelize($form));
     $form = explode("_", $form);
     foreach ($form as $i => &$word) {
         if ($i == 0) {
             continue;
         }
         $word = ucfirst($word);
     }
     $form = implode("\\", $form);
     return "\\" . ucfirst($module) . "\\Form\\Extjs\\" . ucfirst($form);
 }
開發者ID:relson,項目名稱:phalcon_extjs,代碼行數:29,代碼來源:Base.php


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