本文整理汇总了PHP中yii\helpers\Inflector::titleize方法的典型用法代码示例。如果您正苦于以下问题:PHP Inflector::titleize方法的具体用法?PHP Inflector::titleize怎么用?PHP Inflector::titleize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Inflector
的用法示例。
在下文中一共展示了Inflector::titleize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionConnector
/**
* Connector action
*/
public function actionConnector()
{
/** @var ElFinderComponent $elFinder */
$elFinder = Yii::$app->get('elFinder');
$roots = array_map(function ($root) {
/** @var Root $root */
return $root->getOptions();
}, $elFinder->roots);
/** @var FilesystemComponent $filesystem */
$filesystem = Yii::$app->get('filesystem');
foreach ($elFinder->filesystems as $key => $root) {
if (is_string($root)) {
$key = $root;
$root = [];
}
$fs = $filesystem->get($key);
if ($fs instanceof Filesystem) {
$defaults = ['driver' => 'Flysystem', 'filesystem' => $fs, 'alias' => Inflector::titleize($key)];
$roots[] = array_merge($defaults, $root);
}
}
$options = array('locale' => '', 'roots' => $roots);
$connector = new \elFinderConnector(new \elFinder($options));
$connector->run();
}
示例2: getChoices
public static function getChoices()
{
$types = \Yii::$app->get('typesRegister')->entityTypes;
array_walk($types, function (&$value, $key) {
$value = Inflector::titleize($key);
});
return array_merge(array(self::STRING_TYPE => Module::t('attribute', 'Text')), $types);
}
示例3: create
/**
* Useful helper for migrations and other stuff
* If description is null than it will be transformed like "editUserEmail" => "Edit user email"
*
* @param string $name
* @param null|string $description
* @param null|string $groupCode
* @param null|string $ruleName
* @param null|string $data
*
* @return static
*/
public static function create($name, $description = null, $groupCode = null, $ruleName = null, $data = null)
{
$item = new static();
$item->type = static::ITEM_TYPE;
$item->name = $name;
$item->description = ($description === null and static::ITEM_TYPE != static::TYPE_ROUTE) ? Inflector::titleize($name) : $description;
$item->rule_name = $ruleName;
$item->group_code = $groupCode;
$item->data = $data;
$item->save();
return $item;
}
示例4: actionInit
/**
* Инициализация проекта.
*/
public function actionInit()
{
$rawProjectName = pathinfo(Yii::getAlias('@app'), PATHINFO_FILENAME);
$rawProjectName = Inflector::camelize($rawProjectName);
$projectId = Inflector::camel2id($rawProjectName);
$projectId = Console::prompt('Project id', ['default' => $projectId]);
$projectName = Inflector::titleize($projectId);
$projectName = Console::prompt('Project name', ['default' => $projectName]);
$vagrantIp = '192.168.33.' . rand(100, 254);
$vagrantIp = Console::prompt('Vagrant IP', ['default' => $vagrantIp]);
$values = ['PROJECT-ID' => $projectId, 'PROJECT-NAME' => $projectName, 'VAGRANT-IP' => $vagrantIp];
$files = ['@app/build.xml' => ['PROJECT-ID'], '@app/Vagrantfile' => ['VAGRANT-IP', 'PROJECT-ID'], '@app/config/web.php' => ['PROJECT-NAME'], '@app/config/console.php' => ['PROJECT-NAME'], '@app/config/env/vagrant.php' => ['VAGRANT-IP', 'PROJECT-ID']];
$this->replaceInFiles($files, $values);
}
示例5: defaultColumns
public static function defaultColumns()
{
return ['user_comment' => ['attribute' => 'user_comment', 'filterAttribute' => 'user_comment_like'], 'tech_comment' => ['attribute' => 'tech_comment'], 'payment_system' => ['header' => Yii::t('hipanel:finance', 'Payment system'), 'value' => function ($model) {
return Inflector::titleize($model->params['system']);
}], 'txn' => ['header' => Yii::t('hipanel:finance', 'TXN'), 'value' => function ($model) {
return $model->params['txn'];
}], 'label' => ['header' => Yii::t('hipanel', 'Description'), 'value' => function ($model) {
return $model->params['label'];
}], 'amount' => ['header' => Yii::t('hipanel:finance', 'Amount'), 'format' => 'html', 'value' => function ($model) {
$html = Yii::t('hipanel:finance:change', 'Full:') . " " . Yii::$app->formatter->asCurrency($model->params['sum'], $model->params['purse_currency']) . "<br />";
$html .= Yii::t('hipanel:finance:change', 'Fee:') . " " . Yii::$app->formatter->asCurrency($model->params['fee'], $model->params['purse_currency']) . "<br />";
$html .= Yii::t('hipanel:finance:change', 'Sum:') . " " . Yii::$app->formatter->asCurrency($model->params['sum'] - $model->params['fee'], $model->params['purse_currency']);
return $html;
}], 'time' => ['value' => function ($model) {
return Yii::$app->formatter->asDatetime($model->time);
}], 'actions' => ['class' => ActionColumn::class, 'template' => '{view}', 'header' => Yii::t('hipanel', 'Actions')]];
}
示例6: init
public function init()
{
$possible = [];
$field = $this->model->{$this->field};
foreach ($this->defaultValues as $key => $values) {
$possible[$key] = ArrayHelper::merge($values, $this->values[$key] ?: []);
}
$this->values = ArrayHelper::merge($possible, $this->values);
foreach ($this->values as $classes => $values) {
if (in_array($field, $values, true)) {
$class = $classes;
break;
}
}
$this->color = isset($class) ? $class : 'warning';
if ($this->model->hasAttribute("{$this->field}_label")) {
$label = $this->model->getAttribute("{$this->field}_label");
} else {
$label = Inflector::titleize($this->model->{$this->field});
}
$this->label = Yii::t($this->i18nDictionary, $label);
}
示例7: getLabel
/**
* @inheritdoc
*/
public function getLabel()
{
return $this->label ?: Inflector::titleize($this->name);
}
示例8:
<?php
/**
* Output TreeView widget
*
* @var $this yii\web\View
*/
use dmstr\modules\pages\models\Tree;
use kartik\tree\TreeView;
use yii\helpers\Inflector;
$this->title = Inflector::titleize($this->context->module->id);
/**
* Wrapper templates
*/
$headerTemplate = <<<HTML
<div class="row">
<div class="col-sm-6" id="pages-detail-heading">
{heading}
</div>
<div class="col-sm-6" id="pages-detail-search">
{search}
</div>
</div>
HTML;
$mainTemplate = <<<HTML
<div class="row">
<div class="col-md-4" id="pages-detail-wrapper">
<div class="box boy-body">
{wrapper}
</div>
</div>
示例9: getDescriptor
/**
* Get descriptor.
*
* @return [[@doctodo return_type:getDescriptor]] [[@doctodo return_description:getDescriptor]]
*/
public function getDescriptor()
{
return Inflector::titleize($this->name, true);
}
示例10: implode
use yii\gii\plus\helpers\Helper;
use yii\helpers\Inflector;
/* @var $this yii\web\View */
/* @var $generator yii\gii\plus\generators\custom\model\Generator */
/* @var $ns string */
/* @var $modelName string */
/* @var $modelClass string|yii\boost\db\ActiveRecord */
/* @var $baseModelName string */
/* @var $baseModelClass string|yii\boost\db\ActiveRecord */
/* @var $queryNs string */
/* @var $queryName string */
/* @var $queryClass string|yii\boost\db\ActiveQuery */
/* @var $baseQueryName string */
/* @var $baseQueryClass string|yii\boost\db\ActiveQuery */
/* @var $tableSchema yii\gii\plus\db\TableSchema */
$uses = [$baseQueryClass];
Helper::sortUses($uses);
echo '<?php
namespace ', $queryNs, ';
use ', implode(';' . "\n" . 'use ', $uses), ';
/**
* ', Inflector::titleize($queryName), '
* @see \\', $modelClass, '
*/
class ', $queryName, ' extends ', $baseQueryName, '
{
}
';
示例11: return
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
*/
use hipanel\helpers\Url;
use hipanel\widgets\Box;
use hipanel\widgets\FileInput;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Inflector;
use yii\widgets\ActiveForm;
/**
* @var \hipanel\modules\client\models\Contact $contact
* @var \hipanel\modules\client\models\DocumentUploadForm $model
*/
$this->title = Yii::t('hipanel:client', 'Attached documents');
$this->params['breadcrumbs'][] = ['label' => Yii::t('hipanel:client', 'Contacts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Inflector::titleize($contact->name, true), 'url' => ['view', 'id' => $contact->id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="col-md-6">
<?php
$grouped = ArrayHelper::index($contact->documents, 'id', [function ($file) {
return (new DateTime($file->create_time))->modify('today')->format('U');
}]);
krsort($grouped, SORT_NUMERIC);
?>
<?php
foreach ($grouped as $date => $files) {
?>
<div class="panel panel-default">
示例12: implode
/* @var $fixtureName string */
/* @var $fixtureClass string|yii\boost\test\ActiveFixture */
/* @var $baseFixtureName string */
/* @var $baseFixtureClass string|yii\boost\test\ActiveFixture */
/* @var $dataFile string */
/* @var $tableSchema yii\gii\plus\db\TableSchema */
$uses = [$baseFixtureClass];
Helper::sortUses($uses);
echo '<?php
namespace ', $fixtureNs, ';
use ', implode(';' . "\n" . 'use ', $uses), ';
/**
* ', Inflector::titleize($fixtureName), ' fixture
* @see \\', $modelClass, '
*/
class ', $fixtureName, ' extends ', $baseFixtureName, '
{
public $modelClass = \'', $modelClass, '\';
';
/* @var $model yii\boost\db\ActiveRecord */
$model = new $modelClass();
// depends/backDepends
$depends = [];
$backDepends = [];
foreach ($modelClass::allRelations() as $relationName => $relation) {
if (!$relation['viaTable']) {
/* @var $relationClass string|yii\boost\db\ActiveRecord */
示例13: modelTitle
/**
* @return string
*/
public static function modelTitle()
{
return Inflector::titleize(static::classShortName());
}
示例14: getRelationAttributes
/**
* @param ActiveQuery $relation
* @param string $name
* @param string $label
* @param bool $recursive
* @return AttributeDescriptor[]
*/
protected function getRelationAttributes(ActiveQuery $relation, $name, $label = '', $recursive = true)
{
$searchableAttributes = [];
$label = $label ?: $name;
/** @var \im\search\components\SearchManager $searchManager */
$searchManager = Yii::$app->get('searchManager');
$modelClass = $relation->modelClass;
$searchableType = $searchManager->getSearchableTypeByClass($modelClass);
if (!$searchableType) {
$reflector = new ReflectionClass($modelClass);
/** @var SearchableInterface $searchableType */
$searchableType = Yii::createObject(['class' => 'im\\search\\components\\service\\db\\SearchableType', 'type' => Inflector::camel2id($reflector->getShortName(), '_'), 'modelClass' => $modelClass]);
}
$searchableAttributes[] = new AttributeDescriptor(['name' => Inflector::variablize($name), 'label' => Inflector::titleize($label), 'value' => function ($model) use($relation) {
return $relation;
}, 'type' => $searchableType->getType()]);
if ($recursive) {
foreach ($searchableType->getSearchableAttributes(false) as $attribute) {
$attribute->label = Inflector::titleize($name) . ' >> ' . $attribute->label;
$attribute->name = Inflector::variablize($label) . '.' . $attribute->name;
$searchableAttributes[] = $attribute;
}
}
return $searchableAttributes;
}
示例15: name
public function name()
{
$reflector = new \ReflectionClass($this);
return Inflector::titleize($reflector->getShortName());
}