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


PHP Text::camelize方法代码示例

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


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

示例1: pageAction

 public function pageAction()
 {
     $pageSlug = $this->getUriParameter('pageSlug');
     $pageTitle = \Phalcon\Text::camelize($pageSlug);
     $this->tag->setTitle($pageTitle);
     $this->view->pick('pages/' . $pageSlug);
 }
开发者ID:rajeshmsaaryan01,项目名称:website,代码行数:7,代码来源:PagesController.php

示例2: prepare

 protected function prepare(Type $type)
 {
     if (!$this->getConnection()->tableExists($this->table)) {
         throw new Exception("Table {$this->table} does not exist");
     }
     $name = $this->table;
     if ($this->tablePrefix && Text::startsWith($name, $this->tablePrefix)) {
         $name = substr($name, strlen($this->tablePrefix));
         $name = trim($name, '_');
     }
     if (empty($name)) {
         throw new Exception("Cannot infer model name from '{$this->table}'");
     }
     $name = Inflect::singularize($name);
     $model_name = Text::camelize($name);
     $vars['type'] = $type;
     $vars['namespace'] = $this->namespace;
     $vars['model_name'] = $model_name;
     $vars['table_name'] = $this->table;
     $vars['connection'] = $this->connectionService;
     $vars['name'] = str_replace('_', ' ', ucfirst($name));
     $vars['url'] = '/' . str_replace('_', '-', $name);
     $vars['primary_key'] = $this->primaryKey;
     return $vars;
 }
开发者ID:wenbinye,项目名称:admin-gen,代码行数:25,代码来源:Generator.php

示例3: resolve

 /**
  * {@inheritdoc}
  */
 public function resolve(&$value)
 {
     if (is_string($value) && strlen($value) > 0) {
         $value = \Phalcon\Text::camelize($value);
     }
     return $value;
 }
开发者ID:arius86,项目名称:core,代码行数:10,代码来源:Camelize.php

示例4: __get

 public function __get($name)
 {
     if ($this->getDI()->has($name)) {
         return parent::__get($name);
     }
     return $this->{lcfirst(\Phalcon\Text::camelize("get_{$name}"))}();
 }
开发者ID:skullab,项目名称:area51,代码行数:7,代码来源:Ui.php

示例5: dumpModulesFromVendor

 /**
  * Extract Vegas modules from composer vegas-cmf vendors.
  *
  * @param $modulesList
  * @return mixed
  */
 private function dumpModulesFromVendor(array &$modulesList)
 {
     if (!file_exists(APP_ROOT . '/composer.json')) {
         return $modulesList;
     }
     $fileContent = file_get_contents(APP_ROOT . DIRECTORY_SEPARATOR . 'composer.json');
     $json = json_decode($fileContent, true);
     $vendorDir = realpath(APP_ROOT . (isset($json['config']['vendor-dir']) ? DIRECTORY_SEPARATOR . $json['config']['vendor-dir'] : DIRECTORY_SEPARATOR . 'vendor'));
     $vendorDir .= DIRECTORY_SEPARATOR . 'vegas-cmf';
     $directoryIterator = new \DirectoryIterator($vendorDir);
     foreach ($directoryIterator as $libDir) {
         if ($libDir->isDot()) {
             continue;
         }
         //creates path to Module.php file
         $moduleSettingsFile = implode(DIRECTORY_SEPARATOR, [$vendorDir, $libDir, 'module', self::MODULE_SETTINGS_FILE]);
         if (!file_exists($moduleSettingsFile)) {
             continue;
         }
         $baseName = Text::camelize($libDir->getBasename());
         if (!isset($modulesList[$baseName])) {
             $modulesList[$baseName] = ['className' => $baseName . '\\' . pathinfo(self::MODULE_SETTINGS_FILE, PATHINFO_FILENAME), 'path' => $moduleSettingsFile];
         }
     }
     return $modulesList;
 }
开发者ID:szytko,项目名称:core,代码行数:32,代码来源:Loader.php

示例6: resetAction

 public function resetAction()
 {
     $connection = new \Phalcon\Db\Adapter\Pdo\Mysql($this->config->database->toArray());
     $tables = $connection->listTables();
     foreach ($tables as $table) {
         $tablename = \Phalcon\Text::camelize($table);
         $fd = fopen("{$this->config->application->formsDir}/{$tablename}Form.php", "w");
         fwrite($fd, "<?php" . self::NL . self::NL);
         // Begin class
         fwrite($fd, "class {$tablename}Form {" . self::NL);
         $columns = $connection->describeColumns($table);
         foreach ($columns as $column) {
             if ($column instanceof \Phalcon\Db\Column) {
                 // Escape if column is primary
                 if ($column->isPrimary()) {
                     continue;
                 }
                 // Begin method
                 $columnname = \Phalcon\Text::camelize($column->getName());
                 fwrite($fd, self::TAB . "private function _{$columnname}() {" . self::NL);
                 // Write element
                 $columntype_base = $this->_getBaseType($column->getType());
                 $columntype = $this->_getType($columntype_base, $column);
                 fwrite($fd, self::TAB . self::TAB . "\$element = new \\Phalcon\\Forms\\Element\\{$columntype}(\"{$columnname}\");" . self::NL);
                 fwrite($fd, self::TAB . self::TAB . "\$element->setLabel(\"{$columnname}\");" . self::NL);
                 // Add empty selection for select fields
                 if ($columntype == "Select") {
                     fwrite($fd, self::TAB . self::TAB . "\$element->setOptions([]);" . self::NL);
                 }
                 // Add validator on text fields
                 if ($columntype == "Text" && $column->getSize() > 0) {
                     fwrite($fd, self::TAB . self::TAB . "\$element->addValidator(new \\Phalcon\\Validation\\Validator\\StringLength([" . self::NL);
                     fwrite($fd, self::TAB . self::TAB . self::TAB . "\"max\" => {$column->getSize()}" . self::NL);
                     fwrite($fd, self::TAB . self::TAB . "]));" . self::NL);
                 }
                 // End method
                 fwrite($fd, self::TAB . self::TAB . "return \$element;" . self::NL);
                 fwrite($fd, self::TAB . "}" . self::NL);
             }
         }
         // Final method : construction of the form
         fwrite($fd, self::TAB . "public function setFields() {" . self::NL);
         foreach ($columns as $column) {
             if ($column instanceof \Phalcon\Db\Column) {
                 if ($column->isPrimary()) {
                     continue;
                 }
                 $columnname = \Phalcon\Text::camelize($column->getName());
                 fwrite($fd, self::TAB . self::TAB . "\$this->add(\$this->_{$columnname}());" . self::NL);
             }
         }
         fwrite($fd, self::TAB . "}" . self::NL);
         // End class
         fwrite($fd, "}" . self::NL . self::NL);
         fclose($fd);
     }
     $this->view->disable();
     echo "done!";
     return FALSE;
 }
开发者ID:Zheness,项目名称:phalconFormGenerator,代码行数:60,代码来源:IndexController.php

示例7: getMenuOptions

 /**
  * Return menu options
  *
  * @return array
  */
 public function getMenuOptions()
 {
     $this->_limitParamValue = 100;
     $rows = $this->getColumnData();
     $acl = $this->_di->get('acl');
     $viewer = $this->_di->get('viewer');
     $options = [];
     foreach ($rows as $row) {
         $option = [];
         $option['id'] = $row['id'];
         $option['text'] = $row['title'];
         if ($row['module'] && $row['controller']) {
             if (!$acl->isAllowed($viewer->getRole(), \Engine\Acl\Dispatcher::ACL_ADMIN_MODULE, \Engine\Acl\Dispatcher::ACL_ADMIN_CONTROLLER, '*') && !$acl->isAllowed($viewer->getRole(), \Engine\Acl\Dispatcher::ACL_ADMIN_MODULE, \Engine\Acl\Dispatcher::ACL_ADMIN_CONTROLLER, 'read')) {
                 if (!$acl->isAllowed($viewer->getRole(), $row['module'], $row['controller'], 'read')) {
                     continue;
                 }
             }
             $option['controller'] = \Phalcon\Text::camelize($row['module']) . ".controller." . \Phalcon\Text::camelize($row['controller']);
             $option['moduleName'] = \Phalcon\Text::camelize($row['module']);
             $option['controllerName'] = \Phalcon\Text::camelize($row['controller']);
             $option['leaf'] = true;
             $option['cls'] = 'window-list-item';
             $option['iconCls'] = 'window-list-item-icon';
         }
         $option['qtip'] = $row['description'];
         $options[] = $option;
     }
     return $options;
 }
开发者ID:relson,项目名称:phalcon_extjs,代码行数:34,代码来源:Item.php

示例8: __get

 /**
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     $getter = 'get' . \Phalcon\Text::camelize($name);
     if (method_exists($this, $getter)) {
         return $this->{$getter}();
     }
     return null;
 }
开发者ID:vegas-cmf,项目名称:exporter,代码行数:12,代码来源:ConfigurableTrait.php

示例9: camelize

 public static function camelize($title)
 {
     $words = explode(' ', trim($title));
     foreach ($words as $key => $word) {
         $words[$key] = \Phalcon\Text::camelize($word);
     }
     return implode(' ', $words);
 }
开发者ID:huoybb,项目名称:support,代码行数:8,代码来源:myTools.php

示例10: correctCase

 private function correctCase($key)
 {
     if (strpos($key, '_')) {
         return lcfirst(Text::camelize($key));
     } else {
         return $key;
     }
 }
开发者ID:igorsantos07,项目名称:phalcon-queue-db,代码行数:8,代码来源:Stats.php

示例11: createAction

 public function createAction($r_controller = null, $r_action = null, $r_id = null)
 {
     $mapServerConfig = $this->getDI()->getConfig()->mapserver;
     $fileName = $mapServerConfig->mapfileCacheDir . $mapServerConfig->contextesCacheDir . $this->request->getPost("code") . ".map";
     //Ne pas créer le contexte si il y en a déjà un avec le même code
     if (file_exists($fileName)) {
         $this->flash->error("Le fichier {$fileName} existe déjà!");
         return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "new", "param" => !is_null($r_id) ? "/" . $r_controller . "/" . $r_action . "/" . $r_id : ""));
     }
     $idContexteADupliquer = $this->request->getPost('id_contexte_a_dupliquer');
     //On désire dupliquer un contexte
     if ($idContexteADupliquer) {
         if (!$this->peutDupliquerContexte($idContexteADupliquer)) {
             $this->flash->error("Vous n'avez pas la permission de dupliquer le contexte {$idContexteADupliquer}.");
             return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "new", "param" => !is_null($r_id) ? "/" . $r_controller . "/" . $r_action . "/" . $r_id : ""));
         }
     }
     $this->traiterCodeOnlineRessource();
     $igoContexte = new IgoContexte();
     $igoContexte->mode = $this->request->getPost("mode");
     $igoContexte->position = $this->request->getPost("position");
     $igoContexte->zoom = $this->request->getPost("zoom");
     $igoContexte->code = $this->request->getPost("code");
     $igoContexte->nom = $this->request->getPost("nom");
     $igoContexte->description = $this->request->getPost("description");
     $igoContexte->mf_map_def = $this->request->getPost("mf_map_def");
     $igoContexte->date_modif = $this->request->getPost("date_modif");
     $igoContexte->json = $this->request->getPost("json");
     $igoContexte->mf_map_projection = $this->request->getPost("mf_map_projection");
     $igoContexte->profil_proprietaire_id = $this->request->getPost("profil_proprietaire_id");
     if ($igoContexte->profil_proprietaire_id == "") {
         $igoContexte->profil_proprietaire_id = null;
     }
     //Valider la sélection ou pas du profil propriétaire
     if (!$this->validationProfilProprietaire($igoContexte->profil_proprietaire_id, $messageErreurProfilProprietaire)) {
         foreach ($messageErreurProfilProprietaire as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "new", "param" => !is_null($r_id) ? "/" . $r_controller . "/" . $r_action . "/" . $r_id : ""));
     }
     $igoContexte->mf_map_meta_onlineresource = $this->request->getPost("mf_map_meta_onlineresource");
     $igoContexte->generer_onlineresource = $this->request->getPost("generer_onlineResource");
     try {
         if (!$igoContexte->save()) {
             foreach ($igoContexte->getMessages() as $message) {
                 $this->flash->error($message);
             }
             return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "new", "param" => !is_null($r_id) ? "/" . $r_controller . "/" . $r_action . "/" . $r_id : ""));
         }
         if ($idContexteADupliquer) {
             $this->dupliquerContexte($idContexteADupliquer, $igoContexte->id);
         }
         $this->flash->success(Text::camelize(str_replace("igo_", "", $this->ctlName)) . " " . $igoContexte->id . " créé avec succès");
     } catch (\Exception $e) {
         $this->flash->error($e->getMessage());
         return $this->dispatcher->forward(array("controller" => $this->ctlName, "action" => "new", "param" => !is_null($r_id) ? "/" . $r_controller . "/" . $r_action . "/" . $r_id : ""));
     }
 }
开发者ID:nbtetreault,项目名称:igo,代码行数:58,代码来源:IgoContexteController.php

示例12: camelize

 public static function camelize($module)
 {
     $tmpModuleNameArr = explode('-', $module);
     $moduleName = '';
     foreach ($tmpModuleNameArr as $part) {
         $moduleName .= \Phalcon\Text::camelize($part);
     }
     return $moduleName;
 }
开发者ID:devsnippet,项目名称:yona-cms,代码行数:9,代码来源:ModuleName.php

示例13: 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

示例14: beforeDispatchLoop

 /**
  * @param Event               $event
  * @param DispatcherInterface $dispatcher
  */
 public function beforeDispatchLoop(Event $event, DispatcherInterface $dispatcher, $data)
 {
     if ($dispatcher->getActionName()) {
         $actionName = $dispatcher->getActionName();
         $actionName = Text::camelize($actionName);
         $actionName = lcfirst($actionName);
         $dispatcher->setActionName($actionName);
     }
 }
开发者ID:sidroberts,项目名称:phalcon-events,代码行数:13,代码来源:HyphenatedAction.php

示例15: 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


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