本文整理匯總了PHP中StringHelper::uppercaseFirst方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringHelper::uppercaseFirst方法的具體用法?PHP StringHelper::uppercaseFirst怎麽用?PHP StringHelper::uppercaseFirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringHelper
的用法示例。
在下文中一共展示了StringHelper::uppercaseFirst方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ucfirstFilter
/**
* Uppercases the first character of a multibyte string.
*
* @param string $string The multibyte string.
*
* @return string The string with the first character converted to upercase.
*/
public function ucfirstFilter($string)
{
return StringHelper::uppercaseFirst($string);
}
示例2: defineAttributes
/**
* @inheritDoc BaseModel::defineAttributes()
*
* @return array
*/
protected function defineAttributes()
{
$requiredTitle = isset($this->_requiredFields) && in_array('title', $this->_requiredFields);
$attributes = array('id' => AttributeType::Number, 'elementId' => AttributeType::Number, 'locale' => array(AttributeType::Locale, 'default' => craft()->i18n->getPrimarySiteLocaleId()), 'title' => array(AttributeType::String, 'required' => $requiredTitle, 'maxLength' => 255, 'label' => 'Title'));
foreach (craft()->fields->getAllFields() as $field) {
$fieldType = $field->getFieldType();
if ($fieldType) {
$attributeConfig = $fieldType->defineContentAttribute();
}
// Default to Mixed
if (!$fieldType || !$attributeConfig) {
$attributeConfig = AttributeType::Mixed;
}
$attributeConfig = ModelHelper::normalizeAttributeConfig($attributeConfig);
$attributeConfig['label'] = $field->name != '__blank__' ? $field->name : StringHelper::uppercaseFirst($field->handle);
if (isset($this->_requiredFields) && in_array($field->id, $this->_requiredFields)) {
$attributeConfig['required'] = true;
}
$attributes[$field->handle] = $attributeConfig;
}
return $attributes;
}