当前位置: 首页>>代码示例>>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;未经允许,请勿转载。