本文整理汇总了PHP中title_case函数的典型用法代码示例。如果您正苦于以下问题:PHP title_case函数的具体用法?PHP title_case怎么用?PHP title_case使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了title_case函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* List the Builder's registry templates.
*/
public function handle()
{
$this->logo();
$type = $this->argument('addon');
$filter = in_array($type, config('streams::addons.types'));
$title = title_case($filter ? "{$type} " : '') . 'templates ';
/*
Get a list of all repositories from cache or builder templates registry.
Return all addon types or filter on $type provided
*/
$this->info("Retrieving a list of available {$title}");
$this->flush($this->getCacheKey($this->registry));
$repos = app('cache')->remember($this->getCacheKey($this->registry), $this->ttl, function () use($type, $filter) {
return collect($this->client->api('user')->repositories($this->registry))->map(function ($values) {
return array_only($values, ['name', 'stargazers_count', 'description']);
})->filter(function ($repo) use($filter, $type) {
return $filter ? str_contains($repo['name'], "-{$type}") : true;
});
});
if ($repos->count() > 0) {
$this->table(['Name', 'Description', '★'], $repos);
} else {
$this->comment("There are no available {$title}");
}
}
开发者ID:websemantics,项目名称:entity_builder-extension,代码行数:28,代码来源:ListTemplates.php
示例2: title_case
function title_case($title)
{
// words to capitalise
$uc_stopwords = array('3m', '5s', 'tpm', 'diy', 'cbs', 'cbt', 'cdm');
// special words to handle (from shakespeare)
$exact_stopwords = array('macneil' => 'MacNeil', 'macmorris' => 'MacMorris', 'macmillan' => 'MacMillan', 'machomer' => 'MacHomer', 'macready' => 'MacReady', 'c\'est' => 'c\'est');
return title_case($title, null, $uc_stopwords, $exact_stopwords);
}
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:8,代码来源:HermesDataSource.class.php
示例3: __construct
public function __construct(Model $model, $base = 'base')
{
parent::__construct($model, $base);
$this->bodyClass = 'skin-blue sidebar-mini sidebar-collapse';
$this->breadcrumb1 = title_case(trans('livecms::livecms.home'));
$this->breadcrumb1Icon = 'home fa-lg';
$this->breadcrumb2 = title_case(trans('livecms::livecms.' . $this->base));
// $this->breadcrumb2Url = route($this->baseClass.'.index');
$this->view->share();
}
开发者ID:livecms,项目名称:core,代码行数:10,代码来源:UserController.php
示例4: getFields
public function getFields()
{
$fields = $this->buildFields();
$alias = $this->aliases;
$theFields = [];
foreach ($fields as $field) {
$theFields[$field] = isset($alias[$field]) ? $alias[$field] : title_case($this->snakeToStr($field));
}
$keyName = $this->getKeyName();
return !array_key_exists($keyName, $theFields) ? [$keyName => $this->snakeToStr($keyName)] + $theFields : $theFields;
}
开发者ID:livecms,项目名称:core,代码行数:11,代码来源:BaseModelTrait.php
示例5: validate
/**
* Checks if the given data has a type and that type is a model that
* exists.
*
* @param string $attribute The attribute name
* @param mixed $value The value of the attribute
* @param array $parameters Any parameters passed into rule
* @param Validator $validator The validator instance
*
* @return boolean
*/
public function validate($attribute, $value, $parameters, $validator)
{
if (!isset($value->type)) {
return false;
}
$modelClassName = '\\App\\Models\\' . title_case($value->type);
if (!class_exists($modelClassName)) {
return false;
}
return true;
}
开发者ID:continuous-deployment,项目名称:pipes,代码行数:22,代码来源:ModelRule.php
示例6: index
public function index(Request $request)
{
$this->title = title_case($this->getTrans($this->base));
$this->description = $this->getTrans('alllist', ['list' => title_case($this->getTrans($this->base))]);
$this->breadcrumb3 = $this->getTrans('seeall');
if (isset($this->query['hierarchy'])) {
$this->fields = array_except($this->fields, ['parent']);
}
$this->view->share();
return view('livecms::admin.staticpage.index' . ($request->has('hierarchy') ? 'Hierarchy' : 'All'));
}
开发者ID:livecms,项目名称:core,代码行数:11,代码来源:StaticPageController.php
示例7: render
public function render($events)
{
return collect(array_combine(self::$IMAGES, str_split($events)))->filter(function ($event) {
return $event;
})->map(function ($event, $image) {
return '<img src="' . asset('images/' . $image . '.png') . '"
class="weather-event weather-event--' . $image . '"
alt="' . title_case($image) . '"
title="' . title_case($image) . '" />';
})->implode(' ');
}
开发者ID:Jarinus,项目名称:2.1-unwdmi-web,代码行数:11,代码来源:EventsRenderer.php
示例8: index
public function index(Request $request)
{
$model = $this->model->find(auth()->user()->id);
${camel_case($this->base)} = $model;
$this->title = title_case(trans('livecms::livecms.' . $this->base));
$this->description = trans('livecms::livecms.homeprofile');
$this->breadcrumb3 = trans('livecms::livecms.myprofile');
$this->params = array_merge($request->query() ? $request->query() : []);
$this->action = 'store';
$this->view->share();
return view('livecms::user.profile.home', compact(camel_case($this->base)));
}
开发者ID:livecms,项目名称:core,代码行数:12,代码来源:ProfileController.php
示例9: show
public function show(CourseRepositoryInterface $repo, SectionRepositoryInterface $sectionRepo, $subject_id, $course_id)
{
$course = $repo->find($course_id);
$sections = $sectionRepo->all($course_id);
$terms = [];
foreach ($sections as $section) {
if (!array_key_exists($section['term'], $terms)) {
$terms[$section['term']] = ['id' => $section['term'], 'name' => term_name($section['term']), 'sections' => []];
}
$terms[$section['term']]['sections'][] = $section;
}
array_set($course, 'sections', $sections);
return $this->view->make('frontend.courses.show', ['course' => $course, 'single_page' => true, 'terms' => $terms, 'title' => sprintf('Which Course For Me | %s - %s', $course['id'], title_case($course['title']))]);
}
开发者ID:beavers-io,项目名称:legacy-api,代码行数:14,代码来源:CourseController.php
示例10: makeValidator
/**
* Make a transformer validator from the type given.
*
* @param string $type Type of validator to make
*
* @return \App\Api\V1\Transformers\Validator|null
*/
public function makeValidator($type)
{
if (array_key_exists($type, $this->validators)) {
return $this->validators[$type]->reset();
}
$className = 'App\\Api\\V1\\Transformers\\Validators\\' . title_case($type) . 'Validator';
try {
$validator = app($className);
} catch (ReflectionException $exception) {
return null;
}
$this->validators[$type] = $validator;
return $validator;
}
开发者ID:continuous-deployment,项目名称:pipes,代码行数:21,代码来源:Factory.php
示例11: handle
public function handle()
{
if (($table = $this->option('table')) === null) {
$tables = $this->DBHelper->listTables();
$table = $this->choice('Choose table:', $tables, null);
}
$columns = collect($this->DBHelper->listColumns($table));
$this->transformer->setColumns($columns);
$namespace = config('thunderclap.namespace');
$moduleName = str_replace('_', '', title_case($table));
$containerPath = config('thunderclap.target_dir', base_path('modules'));
$modulePath = $containerPath . DIRECTORY_SEPARATOR . $moduleName;
// 1. check existing module
if (is_dir($modulePath)) {
$overwrite = $this->confirm("Folder {$modulePath} already exist, do you want to overwrite it?");
if ($overwrite) {
File::deleteDirectory($modulePath);
} else {
return false;
}
}
// 2. create modules directory
$this->info('Creating modules directory...');
$this->packerHelper->makeDir($containerPath);
$this->packerHelper->makeDir($modulePath);
// 3. copy module skeleton
$stubs = __DIR__ . '/../../stubs';
$this->info('Copying module skeleton into ' . $modulePath);
File::copyDirectory($stubs, $modulePath);
$templates = ['module-name' => str_replace('_', '-', $table), 'route-prefix' => config('thunderclap.routes.prefix')];
// 4. rename file and replace common string
$search = [':Namespace:', ':module_name:', ':module-name:', ':module name:', ':Module Name:', ':moduleName:', ':ModuleName:', ':FILLABLE:', ':TRANSFORMER_FIELDS:', ':VALIDATION_RULES:', ':LANG_FIELDS:', ':TABLE_HEADERS:', ':TABLE_FIELDS:', ':DETAIL_FIELDS:', ':FORM_CREATE_FIELDS:', ':FORM_EDIT_FIELDS:', ':VIEW_EXTENDS:', ':route-prefix:', ':route-middleware:', ':route-url-prefix:'];
$replace = [$namespace, snake_case($table), $templates['module-name'], str_replace('_', ' ', strtolower($table)), ucwords(str_replace('_', ' ', $table)), str_replace('_', '', camel_case($table)), str_replace('_', '', title_case($table)), $this->transformer->toFillableFields(), $this->transformer->toTransformerFields(), $this->transformer->toValidationRules(), $this->transformer->toLangFields(), $this->transformer->toTableHeaders(), $this->transformer->toTableFields(), $this->transformer->toDetailFields(), $this->transformer->toFormCreateFields(), $this->transformer->toFormUpdateFields(), config('thunderclap.view.extends'), $templates['route-prefix'], $this->toArrayElement(config('thunderclap.routes.middleware')), $this->getRouteUrlPrefix($templates['route-prefix'], $templates['module-name'])];
foreach (File::allFiles($modulePath) as $file) {
if (is_file($file)) {
$newFile = $deleteOriginal = false;
if (Str::endsWith($file, '.stub')) {
$newFile = Str::substr($file, 0, -5);
$deleteOriginal = true;
}
$this->packerHelper->replaceAndSave($file, $search, $replace, $newFile, $deleteOriginal);
}
}
$this->warn('Add following service provider to config/app.php ====> ' . $namespace . '\\' . ucwords(str_replace('_', ' ', $table)) . '\\ServiceProvider::class,');
}
开发者ID:laravolt,项目名称:thunderclap,代码行数:45,代码来源:Generator.php
示例12: update
public function update(MaterialRequest $request, Material $material)
{
// Update material
if (isset($request->title)) {
$material->title = ucwords($request->title);
$material->slug = str_slug($request->title, '-');
}
if (isset($request->objective)) {
$material->objective = ucfirst(strtolower($request->objective));
}
if (isset($request->target_language)) {
$material->target_language = ucfirst(strtolower($request->target_language));
}
if (isset($request->time_needed_prep)) {
$material->time_needed_prep = $request->time_needed_prep;
}
if (isset($request->time_needed_class)) {
$material->time_needed_class = $request->time_needed_class;
}
if (isset($request->materials)) {
$material->materials = ucfirst(strtolower($request->materials));
}
if (isset($request->procedure_before)) {
$material->procedure_before = ucfirst($request->procedure_before);
}
if (isset($request->procedure_in)) {
$material->procedure_in = ucfirst($request->procedure_in);
}
// store files
$dir = Auth::user()->username;
$path = public_path() . '/users/' . $dir;
$empty = count(glob("{$path}/*")) === 0 ? true : false;
if (!$empty) {
$files = [];
foreach (glob("{$path}/*") as $filename) {
array_push($files, $filename);
}
MaterialFile::store($files, $material);
}
if (isset($request->category_list)) {
// add category to categories table
$categoryIds = [];
//find or create new categories on material_category table
foreach ($request->Input('category_list') as $category) {
$material_category = Auth::user()->material_category()->firstOrCreate(['category' => title_case($category), 'slug' => str_slug($category, '-')]);
array_push($categoryIds, $material_category->id);
// update category to materials pivot table category / material
}
$material->categories()->sync($categoryIds);
}
if (isset($request->level)) {
$levelIds = [];
foreach ($request->Input('level') as $level) {
$material_level = MaterialLevel::firstOrCreate(['level' => title_case($level), 'slug' => str_slug($level, '-')]);
array_push($levelIds, $material_level->id);
}
// update level on materials pivot
$material->levels()->sync($levelIds);
}
if (isset($request->language_focus)) {
//add language focuses to material_language_focuses database
$language_focusIds = [];
foreach ($request->language_focus as $lf) {
$material_language_focus = MaterialLanguageFocus::firstOrCreate(['language_focus' => title_case($lf), 'slug' => str_slug($lf, '-')]);
array_push($language_focusIds, $material_language_focus->id);
}
// update language focus to materials pivot
$material->languageFocuses()->sync($language_focusIds);
}
if (isset($request->activity_use)) {
//add activity use to material_activity_uses database
$activity_useIds = [];
foreach ($request->activity_use as $au) {
$material_activity_use = MaterialActivityUse::firstOrCreate(['activity_use' => title_case($au), 'slug' => str_slug($au, '-')]);
array_push($activity_useIds, $material_activity_use->id);
}
// update activity use to materials pivot
$material->activityUses()->sync($activity_useIds);
}
if (isset($request->pupil_task)) {
//add pupil task to material_pupil_tasks database
$pupil_taskIds = [];
foreach ($request->pupil_task as $pt) {
$material_pupil_task = MaterialPupilTask::firstOrCreate(['pupil_task' => title_case($pt), 'slug' => str_slug($pt, '-')]);
array_push($pupil_taskIds, $material_pupil_task->id);
}
// add pupil task use to materials pivot
$material->pupilTasks()->sync($pupil_taskIds);
}
if (isset($request->book)) {
$book = MaterialBook::firstOrCreate(['book' => $request->book[0], 'slug' => str_slug($request->book[0], '-')]);
$material->book_id = $book->id;
}
if (isset($request->page)) {
$material->page = $request->page;
}
if (isset($request->follow_up)) {
//update material
$material->follow_up = ucfirst($request->follow_up);
}
//.........这里部分代码省略.........
开发者ID:barooahn,项目名称:MaterialsShare,代码行数:101,代码来源:MaterialsController.php
示例13: title_case
print $block['content'];
}
?>
<h3>Share This</h3>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<ul>
<li><fb:like href="http://www.aadl.org/catalog/record/<?php
echo $item['_id'];
?>
" layout="button_count" show_faces="false" width="450" font=""></fb:like></li>
<li><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.aadl.org/catalog/record/<?php
echo $item['_id'];
?>
" data-text="Enjoying <?php
echo title_case($item['title']);
?>
" data-count="none" data-via="aadl">Tweet</a></li>
</ul>
<!-- end left-hand column -->
</div>
<!-- begin right-hand column -->
<div class="item-right">
<div class="item-main">
<!-- Item Format Icon -->
<ul class="item-format-icon">
<li><img src="<?php
开发者ID:aadl,项目名称:sopac,代码行数:31,代码来源:sopac-record-musicdownload.tpl.php
示例14: getFormPath
/**
* Returns fully class name for form
*
* @return string
*/
protected function getFormPath()
{
$model = title_case(str_plural($this->model));
return 'App\\Forms\\Admin\\' . $model . 'Form';
}
开发者ID:CodeForCharlotte,项目名称:cmpd-holiday-gift-backend,代码行数:10,代码来源:AdminController.php
示例15: getTitleAttribute
public function getTitleAttribute()
{
return title_case($this->attributes['title']);
}
开发者ID:beavers-io,项目名称:legacy-api,代码行数:4,代码来源:Course.php
示例16: detachSocialAccount
/**
* Detach a social account from a user.
* @param $socialDriver
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function detachSocialAccount($socialDriver)
{
session();
user()->socialAccounts()->where('driver', '=', $socialDriver)->delete();
session()->flash('success', title_case($socialDriver) . ' account successfully detached');
return redirect(user()->getEditUrl());
}
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:12,代码来源:SocialAuthService.php
示例17: createCourse
private function createCourse(Subject $subj)
{
$title = title_case($this->faker->sentence(5));
$level = $this->faker->numberBetween(100, 800);
$description = $this->faker->text(200);
$data = ['id' => sprintf('%s%d', $subj->id, $level), 'subject_id' => $subj->id, 'level' => $level, 'title' => $title, 'description' => $description];
try {
Course::create($data);
} catch (QueryException $e) {
}
}
开发者ID:beavers-io,项目名称:legacy-api,代码行数:11,代码来源:DatabaseSeeder.php
示例18: changes
/**
* Display the changes, if any.
*/
public function changes($school)
{
// check for changes from origina;
if ($school->isDirty()) {
// display them
$this->comment($school->name);
foreach ($school->getDirty() as $key => $change) {
$this->info(' ' . title_case($key) . ' = ' . $change);
}
$this->changes++;
return true;
}
return false;
}
开发者ID:Hipp04,项目名称:registered-solutions,代码行数:17,代码来源:SchoolDataTransfer.php
示例19: get_types_flat
public function get_types_flat()
{
$_types = $this->get_types();
$_out = array();
foreach ($_types as $type) {
$_out[$type->id] = $type->label ? $type->label : title_case(str_replace('_', ' ', $type->slug));
}
return $_out;
}
开发者ID:nailsapp,项目名称:module-event,代码行数:9,代码来源:Event.php
示例20: _genderise
function _genderise($old_pre, $old, $old_post, $new)
{
// Determine case
$case = NULL;
// work it out here...
if (ctype_upper($old)) {
$case = 'upper';
}
if (ctype_lower($old)) {
$case = 'lower';
}
if (preg_match('/[A-Z][a-z]+/', $old)) {
$case = 'title';
}
// Transform string
switch ($case) {
case 'lower':
return $old_pre . strtolower($new) . $old_post;
break;
case 'upper':
return $old_pre . strtoupper($new) . $old_post;
break;
case 'title':
return $old_pre . title_case($new) . $old_post;
break;
}
return $old_pre . $new . $old_post;
}
开发者ID:nailsapp,项目名称:common,代码行数:28,代码来源:NAILS_inflector_helper.php
注:本文中的title_case函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论