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


PHP Strings::capitalize方法代码示例

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


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

示例1: getChangeDescription

 public function getChangeDescription()
 {
     if ($this->count === 1) {
         return $this->changeInfos[0]->getChangeDescription();
     }
     return sprintf("%s %d %s", Strings::capitalize(StringUtils::verbToPastTense($this->getAction())), $this->count, StringUtils::pluralize($this->getEntityName()));
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:7,代码来源:BulkChangeInfo.php

示例2: getChangeDescription

 public function getChangeDescription()
 {
     if ($this->action === 'activate') {
         return "Site language switched to '{$this->languageName}'";
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " translation '{$this->languageName}'";
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:7,代码来源:TranslationChangeInfo.php

示例3: getChangeDescription

 public function getChangeDescription()
 {
     if ($this->postType === "nav_menu_item") {
         return "Updated menu items";
     }
     switch ($this->getAction()) {
         case "create":
             return "Created {$this->postType} '{$this->postTitle}'";
         case "trash":
             return Strings::capitalize($this->postType) . " '{$this->postTitle}' moved to trash";
         case "untrash":
             return Strings::capitalize($this->postType) . " '{$this->postTitle}' moved from trash";
         case "delete":
             return "Deleted {$this->postType} '{$this->postTitle}'";
         case "draft":
             return "Created draft for {$this->postType} '{$this->postTitle}'";
         case "publish":
             return "Published {$this->postType} '{$this->postTitle}'";
     }
     if (count(array_intersect(self::$CONTENT_PROPERTIES, explode(",", $this->postUpdatedProperties))) > 0) {
         return "Edited {$this->postType} '{$this->postTitle}'";
     } else {
         return "Updated {$this->postType} '{$this->postTitle}'";
     }
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:25,代码来源:PostChangeInfo.php

示例4: getChangeDescription

 public function getChangeDescription()
 {
     if ($this->action === 'switch') {
         return "Theme switched to '{$this->themeName}'";
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " theme '{$this->themeName}'";
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:7,代码来源:ThemeChangeInfo.php

示例5: getChangeDescription

 public function getChangeDescription()
 {
     if ($this->count === 1) {
         return $this->changeInfos[0]->getChangeDescription();
     }
     return Strings::capitalize(StringUtils::verbToPastTense($this->getAction())) . " {$this->count} options";
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:7,代码来源:BulkOptionChangeInfo.php

示例6: create

 /**
  * @param \App\type $id
  * @return \App\PresenterLinkSettings
  */
 public function create($id)
 {
     $item = $this->menuItemDataSource->get($id, function (Selection $context) {
         $pageKey = ':menu_has_page.page.id';
         $context->select('section.module, menu.section_id, menu.name');
         $context->select("{$pageKey}");
         $context->where("{$pageKey} IS NOT NULL");
     });
     $module = Strings::capitalize($item->module);
     return $this->presenterLinkSettingsFactory->create(":{$module}:Page:default", ['id' => $item->id]);
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:15,代码来源:MenuPageLink.php

示例7: create

 /**
  * @param \App\type $id
  * @return \App\PresenterLinkSettings
  */
 public function create($id)
 {
     $item = $this->menuItemDataSource->get($id, function (Selection $context) {
         $pageKey = ':menu_has_presenter.presenter.code';
         $context->select('section.module, menu.section_id, menu.name');
         $context->select("{$pageKey}");
         $context->where("{$pageKey} IS NOT NULL");
     });
     $module = Strings::capitalize($item->module);
     $presenter = Strings::firstUpper($item->code);
     return $this->presenterLinkSettingsFactory->create(":{$module}:{$presenter}:", []);
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:16,代码来源:MenuPresenterLink.php

示例8: getChangeDescription

 public function getChangeDescription()
 {
     $entityName = $this->getScope();
     $action = $this->getAction();
     if ($this->count === 1) {
         $defaultDescription = $this->changeInfos[0]->getChangeDescription();
     } else {
         $defaultDescription = sprintf("%s %d %s", Strings::capitalize(StringUtils::verbToPastTense($action)), $this->count, StringUtils::pluralize($entityName));
     }
     $tags = array_map(function (TrackedChangeInfo $changeInfo) {
         return $changeInfo->getCustomTags();
     }, $this->changeInfos);
     return apply_filters("vp_bulk_change_description_{$entityName}", $defaultDescription, $action, $this->count, $tags);
 }
开发者ID:versionpress,项目名称:versionpress,代码行数:14,代码来源:BulkChangeInfo.php

示例9: getChangeDescription

 public function getChangeDescription()
 {
     switch ($this->action) {
         case "install":
             // Pre-1.0-beta2 message, see also WP-219
             return "Installed VersionPress";
         case "activate":
             return "Activated VersionPress " . $this->versionPressVersion;
         case "deactivate":
             return "Deactivated VersionPress";
         default:
             // just in case, this path shouldn't really be reached
             return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " VersionPress";
     }
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:15,代码来源:VersionPressChangeInfo.php

示例10: getChangeDescription

 public function getChangeDescription()
 {
     return Strings::capitalize(StringUtils::verbToPastTense($this->action)) . " plugin '{$this->pluginName}'";
 }
开发者ID:wp-cpm,项目名称:versionpress,代码行数:4,代码来源:PluginChangeInfo.php

示例11: streetWithoutRegions

 /**
  * @param int $cityId
  * @return array
  */
 protected function streetWithoutRegions($cityId, $title = NULL)
 {
     $data = [];
     if ($title) {
         $criteria = ['partCity.city.code' => $cityId, 'title LIKE' => '%' . $title . '%'];
     } else {
         $criteria = ['partCity.city.code' => $cityId];
     }
     $streets = $this->streetRepository->findBy($criteria, ['title' => Criteria::ASC, 'id' => Criteria::ASC]);
     foreach ($streets as $street) {
         if (is_numeric($street->title) || array_key_exists($street->title, $this->tempArray)) {
             continue;
         }
         $this->tempArray[$street->title] = 1;
         $data[] = ['streetId' => $street->id, 'title' => Strings::capitalize($street->title), 'code' => $street->code];
     }
     $city = $this->cityRepository->findOneBy(['code' => $cityId]);
     return ['city' => $city ? $city->title : NULL, 'streets' => $data];
 }
开发者ID:neogenia,项目名称:mvcr-street-api,代码行数:23,代码来源:ApiStreetsService.php

示例12: toPascalCase

 /**
  * Converts the given string to "PascalCase".
  * @param string $string
  * @return string
  */
 public static function toPascalCase($string)
 {
     return Strings::replace(Strings::capitalize(self::toSnakeCase($string)), '/[_-]/');
 }
开发者ID:meridius,项目名称:helpers,代码行数:9,代码来源:StringHelper.php

示例13: run

 /**
  * @param Application\Request $request
  *
  * @return Application\IResponse
  *
  * @throws Application\BadRequestException
  */
 public function run(Application\Request $request)
 {
     $this->request = $request;
     if ($this->httpRequest && $this->router && !$this->httpRequest->isAjax() && ($request->isMethod('get') || $request->isMethod('head'))) {
         $refUrl = clone $this->httpRequest->getUrl();
         $url = $this->router->constructUrl($request, $refUrl->setPath($refUrl->getScriptPath()));
         if ($url !== NULL && !$this->httpRequest->getUrl()->isEqual($url)) {
             return new Application\Responses\RedirectResponse($url, Http\IResponse::S301_MOVED_PERMANENTLY);
         }
     }
     $params = $request->getParameters();
     if (!isset($params['action'])) {
         throw new Application\BadRequestException('Parameter action is missing.');
     }
     if (!isset($params['id'])) {
         throw new Application\BadRequestException('Parameter id is missing.');
     }
     // calls $this->action<Action>()
     if (!($response = $this->tryCall(Application\UI\Presenter::formatActionMethod(Utils\Strings::capitalize($params['action'])), $params))) {
         throw new Application\BadRequestException('Action not callable.');
     }
     return $response;
 }
开发者ID:ales-zrak,项目名称:assets-loader,代码行数:30,代码来源:Presenter.php

示例14: isset

    /** @var \VersionPress\Storages\StorageFactory $storageFactory */
    $storageFactory = $versionPressContainer->resolve(VersionPressServices::STORAGE_FACTORY);
    /** @var \VersionPress\Storages\DirectoryStorage $termStorage */
    $termStorage = $storageFactory->getStorage('term');
    $termId = isset($newEntity['vp_term_id']) ? $newEntity['vp_term_id'] : $oldEntity['vp_term_id'];
    $term = $termStorage->loadEntity($termId);
    $tags['VP-Term-Name'] = $term['name'];
    return $tags;
}, 10, 4);
add_filter('vp_entity_files_term_taxonomy', function ($files, $oldEntity, $newEntity) {
    $files[] = ["type" => "all-storage-files", "entity" => "option"];
    // sometimes term change can affect option (e.g. deleting menu)
    return $files;
}, 10, 3);
add_filter('vp_bulk_change_description_composer', function ($description, $action, $count) {
    return sprintf("%s %d Composer packages", Strings::capitalize(StringUtils::verbToPastTense($action)), $count);
}, 10, 3);
add_filter('vp_bulk_change_description_revert', function ($description, $action, $count) {
    if ($action === 'undo' || $action === 'rollback') {
        return "Reverted" . " {$count} changes";
    }
    return $description;
}, 10, 3);
add_filter('vp_meta_entity_tags_postmeta', function ($tags, $oldEntity, $newEntity, $action, $oldParent, $newParent) {
    $tags['VP-Post-Type'] = isset($newParent['post_type']) ? $newParent['post_type'] : $oldParent['post_type'];
    $tags['VP-Post-Title'] = isset($newParent['post_title']) ? $newParent['post_title'] : $oldParent['post_title'];
    return $tags;
}, 10, 6);
add_filter('vp_meta_entity_files_postmeta', function ($files, $oldEntity, $newEntity, $oldParentEntity, $newParentEntity) {
    $postType = isset($newParentEntity['post_type']) ? $newParentEntity['post_type'] : $oldParentEntity['post_type'];
    if ($postType !== "attachment") {
开发者ID:versionpress,项目名称:versionpress,代码行数:31,代码来源:hooks.php

示例15: studlyCase

 /**
  * Converts the given string to `StudlyCase`
  * @param string $string
  * @return string
  */
 public static function studlyCase($string)
 {
     $string = Strings::capitalize(Strings::replace($string, ['/-/', '/_/'], ' '));
     return Strings::replace($string, '/ /');
 }
开发者ID:TomasVotruba,项目名称:Nette-RestRoute,代码行数:10,代码来源:Inflector.php


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