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


PHP Parser::getFunctionLang方法代碼示例

本文整理匯總了PHP中Parser::getFunctionLang方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parser::getFunctionLang方法的具體用法?PHP Parser::getFunctionLang怎麽用?PHP Parser::getFunctionLang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parser的用法示例。


在下文中一共展示了Parser::getFunctionLang方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: formatDate

 /**
  * @param Parser $parser
  * @param string $date
  * @param string $defaultPref
  *
  * @return string
  */
 static function formatDate($parser, $date, $defaultPref = null)
 {
     $lang = $parser->getFunctionLang();
     $df = DateFormatter::getInstance($lang);
     $date = trim($date);
     $pref = $parser->getOptions()->getDateFormat();
     // Specify a different default date format other than the the normal default
     // if the user has 'default' for their setting
     if ($pref == 'default' && $defaultPref) {
         $pref = $defaultPref;
     }
     $date = $df->reformat($pref, $date, array('match-whole'));
     return $date;
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:21,代碼來源:CoreParserFunctions.php

示例2: bidi

 /**
  * @param Parser $parser
  * @param string $text
  * @return string
  */
 public static function bidi($parser, $text = '')
 {
     return $parser->getFunctionLang()->embedBidi($text);
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:9,代碼來源:CoreParserFunctions.php

示例3: pagesize

 /**
  * Return the size of the given page, or 0 if it's nonexistent.  This is an
  * expensive parser function and can't be called too many times per page.
  *
  * @param Parser $parser
  * @param string $page Name of page to check (Default: empty string)
  * @param string $raw Should number be human readable with commas or just number
  * @return string
  */
 public static function pagesize($parser, $page = '', $raw = null)
 {
     $title = Title::newFromText($page);
     if (!is_object($title)) {
         return self::formatRaw(0, $raw, $parser->getFunctionLang());
     }
     // fetch revision from cache/database and return the value
     $rev = self::getCachedRevisionObject($parser, $title);
     $length = $rev ? $rev->getSize() : 0;
     if ($length === null) {
         // We've had bugs where rev_len was not being recorded for empty pages, see T135414
         $length = 0;
     }
     return self::formatRaw($length, $raw, $parser->getFunctionLang());
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:24,代碼來源:CoreParserFunctions.php

示例4: plural

 /**
  * @param Parser $parser
  * @param string $text
  * @return string
  */
 public static function plural($parser, $text = '')
 {
     $forms = array_slice(func_get_args(), 2);
     $text = $parser->getFunctionLang()->parseFormattedNumber($text);
     settype($text, ctype_digit($text) ? 'int' : 'float');
     return $parser->getFunctionLang()->convertPlural($text, $forms);
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:12,代碼來源:CoreParserFunctions.php


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