當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::capitalize方法代碼示例

本文整理匯總了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);
 }
開發者ID:phpontrax,項目名稱:trax,代碼行數:38,代碼來源:asset_tag_helper.php

示例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;
 }
開發者ID:phpontrax,項目名稱:trax,代碼行數:11,代碼來源:javascript_helper.php


注:本文中的Inflector::capitalize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。