当前位置: 首页>>代码示例>>PHP>>正文


PHP LanguageUtf8::ucfirst方法代码示例

本文整理汇总了PHP中LanguageUtf8::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageUtf8::ucfirst方法的具体用法?PHP LanguageUtf8::ucfirst怎么用?PHP LanguageUtf8::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LanguageUtf8的用法示例。


在下文中一共展示了LanguageUtf8::ucfirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ucfirst

 function ucfirst($string)
 {
     if ($string[0] == 'i') {
         return 'İ' . substr($string, 1);
     } else {
         return parent::ucfirst($string);
     }
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:8,代码来源:LanguageTr.php

示例2: parseCachedTable

 /**
  * parse the conversion table stored in the cache
  *
  * the tables should be in blocks of the following form:
  *		-{
  *			word => word ;
  *			word => word ;
  *			...
  *		}-
  *
  *	to make the tables more manageable, subpages are allowed
  *	and will be parsed recursively if $recursive=true
  *
  * @access private
  */
 function parseCachedTable($code, $subpage = '', $recursive = true)
 {
     global $wgMessageCache;
     static $parsed = array();
     if (!is_object($wgMessageCache)) {
         return array();
     }
     $key = 'Conversiontable/' . $code;
     if ($subpage) {
         $key .= '/' . $subpage;
     }
     if (array_key_exists($key, $parsed)) {
         return array();
     }
     $txt = $wgMessageCache->get($key, true, true, true);
     // get all subpage links of the form
     // [[MediaWiki:conversiontable/zh-xx/...|...]]
     $linkhead = $this->mLangObj->getNsText(NS_MEDIAWIKI) . ':Conversiontable';
     $subs = explode('[[', $txt);
     $sublinks = array();
     foreach ($subs as $sub) {
         $link = explode(']]', $sub, 2);
         if (count($link) != 2) {
             continue;
         }
         $b = explode('|', $link[0]);
         $b = explode('/', trim($b[0]), 3);
         if (count($b) == 3) {
             $sublink = $b[2];
         } else {
             $sublink = '';
         }
         if ($b[0] == $linkhead && $b[1] == $code) {
             $sublinks[] = $sublink;
         }
     }
     // parse the mappings in this page
     $blocks = explode($this->mMarkup['begin'], $txt);
     array_shift($blocks);
     $ret = array();
     foreach ($blocks as $block) {
         $mappings = explode($this->mMarkup['end'], $block, 2);
         $stripped = str_replace(array("'", '"', '*', '#'), '', $mappings[0]);
         $table = explode(';', $stripped);
         foreach ($table as $t) {
             $m = explode('=>', $t);
             if (count($m) != 2) {
                 continue;
             }
             // trim any trailling comments starting with '//'
             $tt = explode('//', $m[1], 2);
             $ret[trim($m[0])] = trim($tt[0]);
         }
     }
     $parsed[$key] = true;
     // recursively parse the subpages
     if ($recursive) {
         foreach ($sublinks as $link) {
             $s = $this->parseCachedTable($code, $link, $recursive);
             $ret = array_merge($ret, $s);
         }
     }
     if ($this->mUcfirst) {
         foreach ($ret as $k => $v) {
             $ret[LanguageUtf8::ucfirst($k)] = LanguageUtf8::ucfirst($v);
         }
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:84,代码来源:LanguageConverter.php


注:本文中的LanguageUtf8::ucfirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。