本文整理匯總了PHP中Inflector::capitalize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::capitalize方法的具體用法?PHP Inflector::capitalize怎麽用?PHP Inflector::capitalize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::capitalize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: image_tag
/**
* Build image tags to an image asset
*
* @param mixed An image asset optionally followed by an
* array describing options to apply to the tag
* generated for this asset.<br>The asset is a
* string in one of the formats accepted as value
* of the $source argument of
* {@link image_path()}.<br> The optional second
* argument is an array whose keys are names of
* attributes of the image tag and whose corresponding
* values are the values assigned to each
* attribute. The image size can be specified in
* two ways: by specifying option values "width" =>
* <i>width</i> and "height" => <i>height</i>, or
* by specifying option "size" => "<i>width</i>
* x <i>height</i>". If omitted, options default to:
* <ul>
* <li>"alt" => <i>humanized filename</i></li>
* <li>"width" and "height" value computed from
* value of "size"</li>
* </ul>
* @return string A image tag for each asset in the argument list
* @uses image_path()
* @uses tag()
*/
function image_tag($source, $options = array())
{
$options['src'] = $this->image_path($source);
$options['alt'] = array_key_exists('alt', $options) ? $options['alt'] : Inflector::capitalize(reset($file_array = explode('.', basename($options['src']))));
if (isset($options['size'])) {
$size = explode('x', $options["size"]);
$options['width'] = reset($size);
$options['height'] = end($size);
unset($options['size']);
}
return $this->tag("img", $options);
}
示例2: build_callbacks
private function build_callbacks($options)
{
$callbacks = array();
foreach ($options as $callback => $code) {
if (in_array($callback, $this->javascript_callbacks)) {
$name = 'on' . Inflector::capitalize($callback);
$callbacks[$name] = "function(request){{$code}}";
}
}
return $callbacks;
}