本文整理匯總了PHP中Inflector::spacifyCaps方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::spacifyCaps方法的具體用法?PHP Inflector::spacifyCaps怎麽用?PHP Inflector::spacifyCaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::spacifyCaps方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Dwoo_Plugin_spacify_caps
function Dwoo_Plugin_spacify_caps(Dwoo $dwoo, $text)
{
return Inflector::spacifyCaps($text);
}
示例2: validate
public function validate($options)
{
// apply default
$options = array_merge(array('validator' => 'string', 'required' => true), $options);
// check 'field'
if (empty($options['field'])) {
die('FormValidator: required option "field" missing');
}
// check 'id' and default to 'field'
if (empty($options['id'])) {
if (is_array($options['field'])) {
throw new Exception('Option "id" is required when option "field" is an array');
} else {
$options['id'] = $options['field'];
}
}
// get validator
if (is_string($options['validator'])) {
$validator = array('Validators', $options['validator']);
} else {
$validator = $options['validator'];
}
// check validator
if (!is_callable($validator)) {
throw new Exception('Validator for field ' . $options['id'] . ' is not callable');
}
// return false if any errors are already registered under 'id'
if (array_key_exists($options['id'], $this->_errors)) {
return false;
}
// parse 'field' for multiple values and array paths
if (is_array($options['field'])) {
$value = array();
foreach ($options['field'] as $field_single) {
$value[] = $this->resolveValue($field_single);
}
// skip validation for empty fields that aren't required
if (!$options['required'] && !count(array_filter($value))) {
return true;
}
} else {
$value = $this->resolveValue($options['field']);
// skip validation for empty fields that aren't required
if (!$options['required'] && empty($value)) {
return true;
}
}
// call validator
$isValid = call_user_func($validator, $value, $options);
if ($isValid == false) {
if (!empty($options['errorMessage'])) {
$this->_errors[$options['id']] = gettext($options['errorMessage']);
} else {
// default 'errorMessage' built from 'id'
$this->_errors[$options['id']] = sprintf($options['required'] && empty($value) ? _('%s is missing.') : _('%s is invalid.'), Inflector::spacifyCaps($options['id']));
}
return false;
} else {
return true;
}
}
示例3: getColumnHeader
public static function getColumnHeader($field)
{
return !empty($field['label']) ? $field['label'] : Inflector::spacifyCaps($field['columnName']);
}