• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP LanguageUtf8类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: stripForSearch

 function stripForSearch($string)
 {
     $fname = "LanguageZh::stripForSearch";
     wfProfileIn($fname);
     // eventually this should be a word segmentation
     // for now just treat each character as a word
     $t = preg_replace("/([\\xc0-\\xff][\\x80-\\xbf]*)/e", "' ' .\"\$1\"", $string);
     //always convert to zh-cn before indexing. it should be
     //better to use zh-cn for search, since conversion from
     //Traditional to Simplified is less ambiguous than the
     //other way around
     $t = $this->mConverter->autoConvert($t, 'zh-cn');
     $t = LanguageUtf8::stripForSearch($t);
     wfProfileOut($fname);
     return $t;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:16,代码来源:LanguageZh.php


示例2: lc

 function lc($str, $first = false)
 {
     if (function_exists('mb_strtolower')) {
         if ($first) {
             if (LanguageUtf8::isMultibyte($str)) {
                 return mb_strtolower(mb_substr($str, 0, 1)) . mb_substr($str, 1);
             } else {
                 return strtolower(substr($str, 0, 1)) . substr($str, 1);
             }
         } else {
             return LanguageUtf8::isMultibyte($str) ? mb_strtolower($str) : strtolower($str);
         }
     } else {
         if (LanguageUtf8::isMultibyte($str)) {
             global $wikiLowerChars;
             $x = $first ? '^' : '';
             return preg_replace("/{$x}([A-Z]|[\\xc0-\\xff][\\x80-\\xbf]*)/e", "strtr( \"\$1\" , \$wikiLowerChars )", $str);
         } else {
             return $first ? strtolower(substr($str, 0, 1)) . substr($str, 1) : strtolower($str);
         }
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:22,代码来源:LanguageUtf8.php


示例3: stripForSearch

 function stripForSearch($string)
 {
     # MySQL fulltext index doesn't grok utf-8, so we
     # need to fold cases and convert to hex
     $s = $string;
     # Strip known punctuation ?
     #$s = preg_replace( '/\xe3\x80[\x80-\xbf]/', '', $s ); # U3000-303f
     # Space strings of like hiragana/katakana/kanji
     $hiragana = '(?:\\xe3(?:\\x81[\\x80-\\xbf]|\\x82[\\x80-\\x9f]))';
     # U3040-309f
     $katakana = '(?:\\xe3(?:\\x82[\\xa0-\\xbf]|\\x83[\\x80-\\xbf]))';
     # U30a0-30ff
     $kanji = '(?:\\xe3[\\x88-\\xbf][\\x80-\\xbf]' . '|[\\xe4-\\xe8][\\x80-\\xbf]{2}' . '|\\xe9[\\x80-\\xa5][\\x80-\\xbf]' . '|\\xe9\\xa6[\\x80-\\x99])';
     # U3200-9999 = \xe3\x88\x80-\xe9\xa6\x99
     $s = preg_replace("/({$hiragana}+|{$katakana}+|{$kanji}+)/", ' $1 ', $s);
     # Double-width roman characters: ff00-ff5f ~= 0020-007f
     $s = preg_replace('/\\xef\\xbc([\\x80-\\xbf])/e', 'chr((ord("$1") & 0x3f) + 0x20)', $s);
     $s = preg_replace('/\\xef\\xbd([\\x80-\\x99])/e', 'chr((ord("$1") & 0x3f) + 0x60)', $s);
     # Do general case folding and UTF-8 armoring
     return LanguageUtf8::stripForSearch($s);
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:21,代码来源:LanguageJa.php


示例4: LanguageOs

 function LanguageOs()
 {
     global $wgNamespaceNamesOs, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:5,代码来源:LanguageOs.php


示例5: LanguageCv

 function LanguageCv()
 {
     global $wgNamespaceNamesCv, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:5,代码来源:LanguageCv.php


示例6: LanguageUdm

 function LanguageUdm()
 {
     global $wgNamespaceNamesUdm, $wgMetaNamespace;
     LanguageUtf8::LanguageUtf8();
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:5,代码来源:LanguageUdm.php


示例7: compare

 function compare($a, $b)
 {
     if ($a['name'] === $b['name']) {
         return 0;
     } else {
         return LanguageUtf8::lc($a['name']) > LanguageUtf8::lc($b['name']) ? 1 : -1;
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:8,代码来源:SpecialVersion.php


示例8: 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


示例9: getDefaultUserOptions

 function getDefaultUserOptions()
 {
     $opt = parent::getDefaultUserOptions();
     $opt['quickbar'] = 2;
     # Right-to-left
     return $opt;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:7,代码来源:LanguageYi.php


示例10: getMessage

 function getMessage($key)
 {
     if (isset($this->mMessagesEs[$key])) {
         return $this->mMessagesEs[$key];
     } else {
         return parent::getMessage($key);
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:8,代码来源:LanguageEs.php


示例11: ucfirst

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


示例12: getMessage

 function getMessage($key)
 {
     global $wgAllMessagesLa;
     if (isset($wgAllMessagesLa[$key])) {
         return $wgAllMessagesLa[$key];
     }
     return parent::getMessage($key);
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:8,代码来源:LanguageLa.php


示例13: getMessage

 function getMessage($key)
 {
     global $wgAllMessagesTa;
     if (array_key_exists($key, $wgAllMessagesTa)) {
         return $wgAllMessagesTa[$key];
     } else {
         return parent::getMessage($key);
     }
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:9,代码来源:LanguageTa.php


示例14: timeanddate

 function timeanddate($ts, $adj = false, $format = false, $timecorrection = false)
 {
     $format = $this->dateFormat($format);
     if ($format == MW_DATE_ISO) {
         return parent::timeanddate($ts, $adj, $format, $timecorrection);
     } else {
         return $this->date($ts, $adj, $format, $timecorrection) . " kl." . $this->time($ts, $adj, $format, $timecorrection);
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:9,代码来源:LanguageSv.php


示例15: getMessage

 function getMessage($key)
 {
     global $wgAllMessagesMs;
     if (isset($wgAllMessagesMs[$key])) {
         return $wgAllMessagesMs[$key];
     } else {
         return parent::getMessage($key);
     }
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:9,代码来源:LanguageMs.php


示例16: getDefaultUserOptions

 function getDefaultUserOptions()
 {
     $opt = parent::getDefaultUserOptions();
     $opt["quickbar"] = 2;
     # Right-to-left
     $opt["underline"] = 0;
     # Underline is hard to read in Arabic script
     return $opt;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:9,代码来源:LanguageUr.php


示例17: date

 function date($ts, $adj = false, $format = true, $timecorrection = false)
 {
     $datePreference = $this->dateFormat($format);
     if ($datePreference == MW_DATE_ISO) {
         return parent::date($ts, $adj, $datePreference, $timecorrection);
     } else {
         if ($adj) {
             $ts = $this->userAdjust($ts, $timecorrection);
         }
         # Adjust based on the timezone setting.
         // 20050310001506 => 10.03.2005
         $date = substr($ts, 6, 2) . '.' . substr($ts, 4, 2) . '.' . substr($ts, 0, 4);
         return $date;
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:15,代码来源:LanguageBe.php


示例18: formatDay

 function formatDay($day, $format)
 {
     return parent::formatDay($day, $format) . '.';
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:4,代码来源:LanguageNo.php


示例19:

 function &getMagicWords()
 {
     $t = $this->mMagicWordsMk + parent::getMagicWords();
     return $t;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:5,代码来源:LanguageMk.php


示例20: getNamespaces

 function getNamespaces()
 {
     return $this->mNamespaceNamesAst + parent::getNamespaces();
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:4,代码来源:LanguageAst.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Language_Pack_Upgrader类代码示例发布时间:2022-05-23
下一篇:
PHP LanguageManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap