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


PHP lcfirst函数代码示例

本文整理汇总了PHP中lcfirst函数的典型用法代码示例。如果您正苦于以下问题:PHP lcfirst函数的具体用法?PHP lcfirst怎么用?PHP lcfirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getExtensionSummary

 /**
  * Returns information about this extension plugin
  *
  * @param array $params Parameters to the hook
  *
  * @return string Information about pi1 plugin
  * @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar
  */
 public function getExtensionSummary(array $params)
 {
     $relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png';
     $this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService');
     $this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService');
     $this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize');
     if ($params['row']['list_type'] != 'calendarize_calendar') {
         return '';
     }
     $this->flexFormService->load($params['row']['pi_flexform']);
     if (!$this->flexFormService->isValid()) {
         return '';
     }
     $actions = $this->flexFormService->get('switchableControllerActions', 'main');
     $parts = GeneralUtility::trimExplode(';', $actions, true);
     $parts = array_map(function ($element) {
         $split = explode('->', $element);
         return ucfirst($split[1]);
     }, $parts);
     $actionKey = lcfirst(implode('', $parts));
     $this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize'));
     $this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main'));
     if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) {
         $this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!');
     }
     $this->addPageIdsToTable();
     return $this->layoutService->render();
 }
开发者ID:kaptankorkut,项目名称:calendarize,代码行数:36,代码来源:CmsLayout.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Prepare variables
     $table = lcfirst($this->option('table'));
     $viewVars = compact('table');
     // Prompt
     $this->line('');
     $this->info("Table name: {$table}");
     $this->comment("A migration that creates social_sites and user_social_sites tables," . " referencing the {$table} table will" . " be created in app/database/migrations directory");
     $this->line('');
     if ($this->confirm("Proceed with the migration creation? [Yes|no]")) {
         $this->info("Creating migration...");
         // Generate
         $filename = 'database/migrations/' . date('Y_m_d_His') . "_create_oauth_client_setup_tables.php";
         $output = $this->app['view']->make('laravel-oauth-client::generators.migration', $viewVars)->render();
         $filename = $this->app['path'] . '/' . trim($filename, '/');
         $directory = dirname($filename);
         if (!is_dir($directory)) {
             @mkdir($directory, 0755, true);
         }
         @file_put_contents($filename, $output, FILE_APPEND);
         $this->info("Migration successfully created!");
     }
     $this->call('dump-autoload');
 }
开发者ID:xwiz,项目名称:laravel-oauth-client,代码行数:30,代码来源:MigrationCommand.php

示例3: camelCase

 public static function camelCase($str, $exclude = array())
 {
     $str = preg_replace('/[^a-z0-9' . implode('', $exclude) . ']+/i', ' ', $str);
     // uppercase the first character of each word
     $str = ucwords(trim($str));
     return lcfirst(str_replace(' ', '', $str));
 }
开发者ID:norkazuleta,项目名称:proyectoServer,代码行数:7,代码来源:Utility.php

示例4: generate

 /**
  * Generate the CRUD controller.
  *
  * @param BundleInterface   $bundle           A bundle object
  * @param string            $entity           The entity relative class name
  * @param ClassMetadataInfo $metadata         The entity class metadata
  * @param string            $format           The configuration format (xml, yaml, annotation)
  * @param string            $routePrefix      The route name prefix
  * @param array             $needWriteActions Wether or not to generate write actions
  *
  * @throws \RuntimeException
  */
 public function generate(BundleInterface $bundle, $entity, ClassMetadataInfo $metadata, $format, $routePrefix, $needWriteActions, $forceOverwrite)
 {
     $this->routePrefix = $routePrefix;
     $this->routeNamePrefix = self::getRouteNamePrefix($routePrefix);
     $this->actions = $needWriteActions ? array('index', 'show', 'new', 'edit', 'delete') : array('index', 'show');
     if (count($metadata->identifier) != 1) {
         throw new \RuntimeException('The CRUD generator does not support entity classes with multiple or no primary keys.');
     }
     $this->entity = $entity;
     $this->entitySingularized = lcfirst(Inflector::singularize($entity));
     $this->entityPluralized = lcfirst(Inflector::pluralize($entity));
     $this->bundle = $bundle;
     $this->metadata = $metadata;
     $this->setFormat($format);
     $this->generateControllerClass($forceOverwrite);
     $dir = sprintf('%s/Resources/views/%s', $this->rootDir, str_replace('\\', '/', strtolower($this->entity)));
     if (!file_exists($dir)) {
         $this->filesystem->mkdir($dir, 0777);
     }
     $this->generateIndexView($dir);
     if (in_array('show', $this->actions)) {
         $this->generateShowView($dir);
     }
     if (in_array('new', $this->actions)) {
         $this->generateNewView($dir);
     }
     if (in_array('edit', $this->actions)) {
         $this->generateEditView($dir);
     }
     $this->generateTestClass();
     $this->generateConfiguration();
 }
开发者ID:spinx,项目名称:SensioGeneratorBundle,代码行数:44,代码来源:DoctrineCrudGenerator.php

示例5: addContent

 /**
  * Generate view content
  *
  * @param string          $moduleName
  * @param ClassReflection $loadedEntity
  */
 protected function addContent($moduleName, ClassReflection $loadedEntity)
 {
     // prepare some params
     $moduleIdentifier = $this->filterCamelCaseToUnderscore($moduleName);
     $entityName = $loadedEntity->getShortName();
     $entityParam = lcfirst($entityName);
     $formParam = lcfirst(str_replace('Entity', '', $loadedEntity->getShortName())) . 'DataForm';
     $moduleRoute = $this->filterCamelCaseToDash($moduleName);
     // set action body
     $body = [];
     $body[] = 'use ' . $loadedEntity->getName() . ';';
     $body[] = '';
     $body[] = '/** @var ' . $entityName . ' $' . $entityParam . ' */';
     $body[] = '$' . $entityParam . ' = $this->' . $entityParam . ';';
     $body[] = '';
     $body[] = '$this->h1(\'' . $moduleIdentifier . '_title_update\');';
     $body[] = '';
     $body[] = '$this->' . $formParam . '->setAttribute(\'action\', $this->url(\'' . $moduleRoute . '/update\', [\'id\' => $' . $entityParam . '->getIdentifier()]));';
     $body[] = '';
     $body[] = 'echo $this->bootstrapForm($this->' . $formParam . ');';
     $body[] = '?>';
     $body[] = '<p>';
     $body[] = '    <a class="btn btn-primary" href="<?php echo $this->url(\'' . $moduleRoute . '\'); ?>">';
     $body[] = '        <i class="fa fa-table"></i>';
     $body[] = '        <?php echo $this->translate(\'' . $moduleIdentifier . '_action_index\'); ?>';
     $body[] = '    </a>';
     $body[] = '</p>';
     $body = implode(AbstractGenerator::LINE_FEED, $body);
     // add method
     $this->setContent($body);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:37,代码来源:UpdateActionViewGenerator.php

示例6: timespan

/**
 * Rewrites CI's timespan function
 * Leaving only years and months
 * @param int $seconds Number of Seconds
 * @param string $time Unix Timestamp
 * @return string String representaton of date difference
 */
function timespan($seconds = 1, $time = '')
{
    $CI =& get_instance();
    $CI->lang->load('date');
    if (!is_numeric($seconds)) {
        $seconds = 1;
    }
    if (!is_numeric($time)) {
        $time = time();
    }
    if ($time <= $seconds) {
        $seconds = 1;
    } else {
        $seconds = $time - $seconds;
    }
    $str = '';
    $years = floor($seconds / 31536000);
    if ($years > 0) {
        $str .= $years . ' ' . lcfirst($CI->lang->line($years > 1 ? 'date_years' : 'date_year')) . ', ';
    }
    $seconds -= $years * 31536000;
    $months = floor($seconds / 2628000);
    if ($years > 0 or $months > 0) {
        if ($months > 0) {
            $str .= $months . ' ' . lcfirst($CI->lang->line($months > 1 ? 'date_months' : 'date_month')) . ', ';
        }
    }
    return substr(trim($str), 0, -1);
}
开发者ID:alex-krav,项目名称:personal-page-codeigniter,代码行数:36,代码来源:MY_date_helper.php

示例7: toJson

 /**
  * Get our comparison data by scanning our comparison directory
  * @return array
  */
 public function toJson()
 {
     // Add our current directory pointer to the array (can't be done in property definition)
     array_unshift($this->comparisonDir, dirname(__FILE__));
     // Try to do this platform independent
     $comparisonDir = implode(DIRECTORY_SEPARATOR, $this->comparisonDir);
     if (!count($this->comparisonCache)) {
         // Iterate our directory looking for comparison classes
         foreach (new DirectoryIterator($comparisonDir) as $file) {
             // Skip sub-dirs and dot files
             if ($file->isDir() || $file->isDot()) {
                 continue;
             }
             $fileName = $file->getFilename();
             $className = str_replace('.php', '', $fileName);
             $reflectClass = new ReflectionClass('\\Verdict\\Filter\\Comparison\\' . $className);
             // Skip interfaces and abstracts
             if (!$reflectClass->isInstantiable() || !$reflectClass->implementsInterface('\\Verdict\\Filter\\Comparison\\ComparisonInterface') || $className === 'Truth') {
                 continue;
             }
             $reflectMethod = $reflectClass->getMethod('getDisplay');
             $this->comparisonCache[lcfirst($className)] = $reflectMethod->invoke(null);
         }
         // First, lowercase our sort order array
         $sortOrder = array_map('lcfirst', $this->sortOrder);
         // Next, sort our keys based on their position inside our sort order array
         uksort($this->comparisonCache, function ($a, $b) use($sortOrder) {
             return array_search($a, $sortOrder) - array_search($b, $sortOrder);
         });
     }
     return $this->comparisonCache;
 }
开发者ID:rfink,项目名称:verdict,代码行数:36,代码来源:Discover.php

示例8: getFunctions

 /**
  * {@inheritdoc}
  */
 public function getFunctions()
 {
     return ['getsearchresultsnippet' => new \Twig_SimpleFunction('getSearchResultSnippet', function ($object) {
         $pathArray = explode('\\', get_class($object));
         return 'SyliusSearchBundle:SearchResultSnippets:' . lcfirst(array_pop($pathArray)) . '.html.twig';
     })];
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:SearchElementExtension.php

示例9: extractAttributes

 /**
  * {@inheritdoc}
  */
 protected function extractAttributes($object, $format = null, array $context = array())
 {
     // If not using groups, detect manually
     $attributes = array();
     // methods
     $reflClass = new \ReflectionClass($object);
     foreach ($reflClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflMethod) {
         if ($reflMethod->getNumberOfRequiredParameters() !== 0 || $reflMethod->isStatic() || $reflMethod->isConstructor() || $reflMethod->isDestructor()) {
             continue;
         }
         $name = $reflMethod->name;
         if (0 === strpos($name, 'get') || 0 === strpos($name, 'has')) {
             // getters and hassers
             $attributeName = lcfirst(substr($name, 3));
         } elseif (strpos($name, 'is') === 0) {
             // issers
             $attributeName = lcfirst(substr($name, 2));
         }
         if ($this->isAllowedAttribute($object, $attributeName)) {
             $attributes[$attributeName] = true;
         }
     }
     // properties
     foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) {
         if ($reflProperty->isStatic() || !$this->isAllowedAttribute($object, $reflProperty->name)) {
             continue;
         }
         $attributes[$reflProperty->name] = true;
     }
     return array_keys($attributes);
 }
开发者ID:cilefen,项目名称:symfony,代码行数:34,代码来源:ObjectNormalizer.php

示例10: generate

 /**
  * Generates set of code based on data.
  *
  * @return array
  */
 public function generate()
 {
     $this->prepareData($this->data);
     $columnFields = ['name', 'description', 'label'];
     $table = $this->describe->getTable($this->data['name']);
     foreach ($table as $column) {
         if ($column->isAutoIncrement()) {
             continue;
         }
         $field = strtolower($column->getField());
         $method = 'set_' . $field;
         $this->data['camel'][$field] = lcfirst(camelize($method));
         $this->data['underscore'][$field] = underscore($method);
         array_push($this->data['columns'], $field);
         if ($column->isForeignKey()) {
             $referencedTable = Tools::stripTableSchema($column->getReferencedTable());
             $this->data['foreignKeys'][$field] = $referencedTable;
             array_push($this->data['models'], $referencedTable);
             $dropdown = ['list' => plural($referencedTable), 'table' => $referencedTable, 'field' => $field];
             if (!in_array($field, $columnFields)) {
                 $field = $this->describe->getPrimaryKey($referencedTable);
                 $dropdown['field'] = $field;
             }
             array_push($this->data['dropdowns'], $dropdown);
         }
     }
     return $this->data;
 }
开发者ID:rougin,项目名称:combustor,代码行数:33,代码来源:ControllerGenerator.php

示例11: formatAction

 public function formatAction($action, $suffix)
 {
     if ($this->isDefaultAction($action)) {
         return is_null($suffix) ? RouterParameter::DEFAULT_ACTION_METHOD : RouterParameter::DEFAULT_ACTION_NAME_URL . $suffix;
     }
     return lcfirst(StringUtils::camelize($action)) . $suffix;
 }
开发者ID:waspframework,项目名称:waspframework,代码行数:7,代码来源:AbstractActionFinder.php

示例12: printException

 /**
  * @param ExampleEvent $event
  */
 protected function printException(ExampleEvent $event)
 {
     if (null === ($exception = $event->getException())) {
         return;
     }
     $title = str_replace('\\', DIRECTORY_SEPARATOR, $event->getSpecification()->getTitle());
     $title = str_pad($title, 50, ' ', STR_PAD_RIGHT);
     $message = $this->getPresenter()->presentException($exception, $this->io->isVerbose());
     if ($exception instanceof PendingException) {
         $this->io->writeln(sprintf('<pending-bg>%s</pending-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <pending>- %s</pending>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<pending>%s</pending>', lcfirst($message)), 6);
         $this->io->writeln();
     } elseif ($exception instanceof SkippingException) {
         if ($this->io->isVerbose()) {
             $this->io->writeln(sprintf('<skipped-bg>%s</skipped-bg>', $title));
             $this->io->writeln(sprintf('<lineno>%4d</lineno>  <skipped>? %s</skipped>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
             $this->io->writeln(sprintf('<skipped>%s</skipped>', lcfirst($message)), 6);
             $this->io->writeln();
         }
     } elseif (ExampleEvent::FAILED === $event->getResult()) {
         $this->io->writeln(sprintf('<failed-bg>%s</failed-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <failed>✘ %s</failed>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<failed>%s</failed>', lcfirst($message)), 6);
         $this->io->writeln();
     } else {
         $this->io->writeln(sprintf('<broken-bg>%s</broken-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <broken>! %s</broken>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<broken>%s</broken>', lcfirst($message)), 6);
         $this->io->writeln();
     }
 }
开发者ID:franzliedke,项目名称:phpspec,代码行数:35,代码来源:ConsoleFormatter.php

示例13: __call

 public function __call($method, $args)
 {
     if (preg_match('/(set|get)([A-Z][a-zA-Z]*)/', $method, $matches) === 0) {
         throw new \BadMethodCallException("Invalid method name: {$method}");
     }
     $type = $matches[1];
     $attr = lcfirst($matches[2]);
     if (!in_array($attr, array_keys($this->nodes))) {
         $attr = preg_replace('/([A-Z][a-z]*)/', '-$1', $attr);
         $attr = strtolower($attr);
         if (!in_array($attr, array_keys($this->nodes))) {
             throw new \BadMethodCallException("Invalid attribute name: {$attr}");
         }
     }
     if ($type == 'get') {
         return $this->nodes[$attr];
     }
     if (!is_array($args) || count($args) == 0) {
         throw new \InvalidArgumentException("Missing method arguments: {$method}");
     }
     if (count($args) > 1) {
         throw new \InvalidArgumentException('Expected 1 argument. ' . count($args) . ' passed.');
     }
     $this->nodes[$attr] = reset($args);
     return $this;
 }
开发者ID:eumatheusgomes,项目名称:cielo,代码行数:26,代码来源:NodeGetterSetter.php

示例14: beforeAction

 public function beforeAction($action)
 {
     //log flush instantly
     \Yii::$app->getLog()->flushInterval = 1;
     foreach (\Yii::$app->getLog()->targets as $logTarget) {
         $logTarget->exportInterval = 1;
     }
     $module = $this->module;
     $this->realClient = new \GearmanWorker();
     if (!empty($module) && isset(\Yii::$app->params['gearman'][$module->getUniqueId()])) {
         $this->group = $module->getUniqueId();
     }
     $this->realClient->addServers(\Yii::$app->params['gearman'][$this->group]);
     /**
      * 注册可用的方法
      */
     $methods = get_class_methods(get_class($this));
     if ($methods) {
         $this->stdout("Available worker:" . PHP_EOL, Console::BOLD);
         foreach ($methods as $method) {
             if (substr($method, 0, strlen($this->callbackPrefix)) == $this->callbackPrefix) {
                 $funcName = "{$module->id}/{$this->id}/" . lcfirst(substr($method, strlen($this->callbackPrefix)));
                 $this->stdout("\t" . $funcName . PHP_EOL);
                 $that = $this;
                 $this->realClient->addFunction($funcName, function ($gearmanJob) use($that, $method) {
                     call_user_func([$that, $method], $gearmanJob);
                     $that->cleanUp();
                 });
             }
         }
     }
     return parent::beforeAction($action);
 }
开发者ID:highestgoodlikewater,项目名称:yii2-liuxy-extension,代码行数:33,代码来源:Worker.php

示例15: __set

 public function __set($attribute, $value)
 {
     $attribute = lcfirst($attribute);
     if (isset($this->{$attribute})) {
         $this->{$attribute} = $value;
     }
 }
开发者ID:nealerickson,项目名称:li3_loggr,代码行数:7,代码来源:loggr_event.php


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