本文整理汇总了PHP中wfMsgGetKey函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgGetKey函数的具体用法?PHP wfMsgGetKey怎么用?PHP wfMsgGetKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgGetKey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getMessage
/**
* GETS a message from the MediaWiki namespace
*/
protected function getMessage(&$key)
{
$source = wfMsgGetKey($key, true, true, false);
if (wfEmptyMsg($key, $source)) {
return null;
}
return $source;
}
开发者ID:clrh,项目名称:mediawiki,代码行数:11,代码来源:SecureTag.php
示例2: wfFakeAnswersMessaging
/**
* @param $key
* @param $useDB
* @param $langCode
* @param $transform
* @return bool
*/
function wfFakeAnswersMessaging(&$key, &$useDB, &$langCode, &$transform)
{
$mask = "-answers2";
if (!preg_match("/{$mask}\$/", $key, $matches)) {
$key2 = "{$key}{$mask}";
$msg2 = wfMsgGetKey($key2, $useDB, $langCode, $transform);
if (!wfEmptyMsg($key2, $msg2)) {
$key = $key2;
}
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:FakeAnswersMessaging.php
示例3: intFunction
static function intFunction($parser, $part1 = '')
{
if (strval($part1) !== '') {
$args = array_slice(func_get_args(), 2);
$message = wfMsgGetKey($part1, true, false, false);
$message = wfMsgReplaceArgs($message, $args);
$message = $parser->replaceVariables($message);
// like $wgMessageCache->transform()
return $message;
} else {
return array('found' => false);
}
}
开发者ID:josephdye,项目名称:wikireader,代码行数:13,代码来源:CoreParserFunctions.php
示例4: getMessagesJs
/**
* getMessagesJs generates a javascript addMessages() calls for a given module and language
*
* @param String $moduleName the name of the module
* @param String $langCode Name of scriptText module ( that hosts messages )
* @return string
*/
public static function getMessagesJs($moduleName, $language)
{
global $wgOut;
// TODO this should be cached. Perhaps with Localisation Cache.
global $wgExtensionMessagesFiles;
// Empty out messages in the current scope
$messages = array();
require $wgExtensionMessagesFiles[$moduleName];
// iterate over the default messages, and get this wiki's current messages
// presumably this will include local overrides in MediaWiki: space
$messagesForJs = array();
// 'en' is the default language, so it will be the most complete
foreach (array_keys($messages['en']) as $key) {
$messagesForJs[$key] = wfMsgGetKey($key, true, $language, false);
}
$messagesJson = FormatJson::encode($messagesForJs);
return 'window.mediaWiki.addMessages(' . $messagesJson . ');';
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:UploadWizardMessages.php
示例5: getMessagesAndTests
private function getMessagesAndTests()
{
$messages = array();
$tests = array();
$wfMsgExtOptions = array('parsemag');
foreach (array('en', 'fr', 'ar', 'jp', 'zh') as $languageCode) {
$wfMsgExtOptions['language'] = $languageCode;
foreach (self::$keyToTestArgs as $key => $testArgs) {
foreach ($testArgs as $args) {
// get the raw template, without any transformations
$template = wfMsgGetKey($key, true, $languageCode, false);
// get the magic-parsed version with args
$wfMsgExtArgs = array_merge(array($key, $wfMsgExtOptions), $args);
$result = call_user_func_array('wfMsgExt', $wfMsgExtArgs);
// record the template, args, language, and expected result
// fake multiple languages by flattening them together
$langKey = $languageCode . '_' . $key;
$messages[$langKey] = $template;
$tests[] = array('name' => $languageCode . " " . $key . " " . join(",", $args), 'key' => $langKey, 'args' => $args, 'result' => $result, 'lang' => $languageCode);
}
}
}
return array($messages, $tests);
}
开发者ID:laiello,项目名称:media-wiki-law,代码行数:24,代码来源:makeJqueryMsgSpec.php
示例6: __construct
function __construct($msg, $width, $height)
{
$args = array_slice(func_get_args(), 3);
$htmlArgs = array_map('htmlspecialchars', $args);
$htmlArgs = array_map('nl2br', $htmlArgs);
$this->htmlMsg = wfMsgReplaceArgs(htmlspecialchars(wfMsgGetKey($msg, true)), $htmlArgs);
$this->textMsg = wfMsgReal($msg, $args);
$this->width = intval($width);
$this->height = intval($height);
$this->url = false;
$this->path = false;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:12,代码来源:MediaTransformOutput.php
示例7: getTimeZoneName
function getTimeZoneName()
{
if (!isset($this->timezoneName)) {
$tzUser = $this->getTimeZone();
$tzName = $tzUser->getName();
if ($tzName == 'UTC') {
$this->timezoneName = \wfMsgGetKey('utc', true, $this->languageCode);
} else {
$tzCityName = ' ';
$tzRegionName = ' ';
$tzInfo = explode('/', $tzName);
$tzRegion = $tzInfo[0];
$tzCity = $tzInfo[1];
$tzRegionMsgCode = 'timezoneregion-' . strtolower($tzRegion);
$tzRegionName = str_replace('_', ' ', \wfMsgGetKey($tzRegionMsgCode, true, $this->languageCode));
$tzCityName = str_replace('_', ' ', $tzCity);
if ($this->mwLanguageObj->isRTL()) {
$this->timezoneName = $tzCityName . '\\' . $tzRegionName;
} else {
$this->timezoneName = $tzRegionName . '/' . $tzCityName;
}
}
}
return $this->timezoneName;
}
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:25,代码来源:LocalizationHelper.php
示例8: reallyDoQuery
function reallyDoQuery($offset, $limit, $descending)
{
$result = new FakeResultWrapper(array());
$messageNames = $this->getAllMessages($descending);
$statuses = $this->getCustomisedStatuses($messageNames);
$count = 0;
foreach ($messageNames as $key) {
$customised = isset($statuses['pages'][$key]);
if ($customised !== $this->custom && ($descending && ($key < $offset || !$offset) || !$descending && $key > $offset) && ($this->prefix && preg_match($this->prefix, $key) || $this->prefix === false)) {
$result->result[] = array('am_title' => $key, 'am_actual' => wfMsgGetKey($key, true, $this->langcode, false), 'am_default' => wfMsgGetKey($key, false, $this->langcode, false), 'am_customised' => $customised, 'am_talk_exists' => isset($statuses['talks'][$key]));
$count++;
}
if ($count == $limit) {
break;
}
}
return $result;
}
开发者ID:rocLv,项目名称:conference,代码行数:18,代码来源:SpecialAllmessages.php
示例9: msg
/**
* Convenience method for retrieving a wfMsgForContent() message.
* Note: Any additional args not listed in the method signature are passed
* forward to the msg resolution function.
* @param String $msg The system message to use.
*/
function msg($msg)
{
$args = func_get_args();
array_shift($args);
return wfMsgReplaceArgs(wfMsgGetKey($this->mMsgPrefix . $msg, true), $args);
}
开发者ID:mediawiki-extensions,项目名称:mahalo-parserfunctions,代码行数:12,代码来源:mhoParserFunction.php
示例10: wfMsgExt
/**
* Returns message in the requested format
*
* @deprecated since 1.18
*
* @param string $key Key of the message
* @param array $options Processing rules.
* Can take the following options:
* parse: parses wikitext to HTML
* parseinline: parses wikitext to HTML and removes the surrounding
* p's added by parser or tidy
* escape: filters message through htmlspecialchars
* escapenoentities: same, but allows entity references like   through
* replaceafter: parameters are substituted after parsing or escaping
* parsemag: transform the message using magic phrases
* content: fetch message for content language instead of interface
* Also can accept a single associative argument, of the form 'language' => 'xx':
* language: Language object or language code to fetch message for
* (overridden by content).
* Behavior for conflicting options (e.g., parse+parseinline) is undefined.
*
* @return string
*/
function wfMsgExt($key, $options)
{
wfDeprecated(__METHOD__, '1.21');
$args = func_get_args();
array_shift($args);
array_shift($args);
$options = (array) $options;
$validOptions = array('parse', 'parseinline', 'escape', 'escapenoentities', 'replaceafter', 'parsemag', 'content');
foreach ($options as $arrayKey => $option) {
if (!preg_match('/^[0-9]+|language$/', $arrayKey)) {
// An unknown index, neither numeric nor "language"
wfWarn("wfMsgExt called with incorrect parameter key {$arrayKey}", 1, E_USER_WARNING);
} elseif (preg_match('/^[0-9]+$/', $arrayKey) && !in_array($option, $validOptions)) {
// A numeric index with unknown value
wfWarn("wfMsgExt called with incorrect parameter {$option}", 1, E_USER_WARNING);
}
}
if (in_array('content', $options, true)) {
$forContent = true;
$langCode = true;
$langCodeObj = null;
} elseif (array_key_exists('language', $options)) {
$forContent = false;
$langCode = wfGetLangObj($options['language']);
$langCodeObj = $langCode;
} else {
$forContent = false;
$langCode = false;
$langCodeObj = null;
}
$string = wfMsgGetKey($key, true, $langCode, false);
if (!in_array('replaceafter', $options, true)) {
$string = wfMsgReplaceArgs($string, $args);
}
$messageCache = MessageCache::singleton();
$parseInline = in_array('parseinline', $options, true);
if (in_array('parse', $options, true) || $parseInline) {
$string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj);
if ($string instanceof ParserOutput) {
$string = $string->getText();
}
if ($parseInline) {
$string = Parser::stripOuterParagraph($string);
}
} elseif (in_array('parsemag', $options, true)) {
$string = $messageCache->transform($string, !$forContent, $langCodeObj);
}
if (in_array('escape', $options, true)) {
$string = htmlspecialchars($string);
} elseif (in_array('escapenoentities', $options, true)) {
$string = Sanitizer::escapeHtmlAllowEntities($string);
}
if (in_array('replaceafter', $options, true)) {
$string = wfMsgReplaceArgs($string, $args);
}
return $string;
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:80,代码来源:GlobalFunctions.php
示例11: getPackage
/**
* Get messages for a given package as key => value structure
*
* Resolve messages list (entries matching "feature-*" pattern)
*
* @param string $name - name of the messages package
* @param boolean $allowWildcards - can packages with wildcard be added?
* @return array - key/value array of messages
*/
private static function getPackage($name, $allowWildcards = true)
{
wfProfileIn(__METHOD__);
$ret = null;
if (isset(self::$packages[$name])) {
self::log(__METHOD__, $name);
// get messages
$messages = self::$packages[$name];
$ret = array();
foreach ($messages as $message) {
// pattern to match messages (e.g. "feature-*")
if (substr($message, -1) == '*') {
// BugId:18482
if ($allowWildcards) {
$msgs = self::resolveMessagesPattern($message);
if (!empty($msgs)) {
$ret = array_merge($ret, $msgs);
}
} else {
Wikia::logBacktrace(__METHOD__);
wfProfileOut(__METHOD__);
trigger_error("JSMessages: '{$name}' package with wildcard matching can only be used in EXTERNAL mode", E_USER_ERROR);
return;
}
} else {
//@todo - this removes the {{PLURAL prefix, so plurals won't work in JS
//on the other hand we cannot simply set $transform to true, as we want the wiki links to be parsed
$msg = wfMsgGetKey($message, true);
// check for not existing message
if ($msg == htmlspecialchars("<{$message}>")) {
$msg = false;
}
$ret[$message] = $msg;
}
}
}
wfProfileOut(__METHOD__);
return $ret;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:48,代码来源:JSMessages.class.php
示例12: updateMessageValues
/**
* Updates an array of messages with the wfMsgGetKey value
*
* @param {Array} $jmsg Associative array of message key -> message value pairs
* @param {String} $langCode Language code override
*/
public static function updateMessageValues(&$messegeArray, $langCode = false)
{
global $wgLang;
// Check the langCode
if (!$langCode && $wgLang) {
$langCode = $wgLang->getCode();
}
// Get the msg keys for the a json array
foreach ($messegeArray as $msgKey => $na) {
// Language codes use dash instead of underscore internally
$msgLangCode = str_replace('_', '-', $langCode);
$messegeArray[$msgKey] = wfMsgGetKey($msgKey, true, $msgLangCode, false);
}
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:20,代码来源:ResourceLoader.php
示例13: wfMsgReal
function wfMsgReal($key, $args)
{
$message = wfMsgGetKey($key);
$message = wfMsgReplaceArgs($message, $args);
return $message;
}
开发者ID:JackPotte,项目名称:xtools,代码行数:6,代码来源:i18n.php
示例14: wfMsgExt
/**
* Returns message in the requested format
* @param string $key Key of the message
* @param array $options Processing rules:
* <i>parse<i>: parses wikitext to html
* <i>parseinline<i>: parses wikitext to html and removes the surrounding p's added by parser or tidy
* <i>escape<i>: filters message trough htmlspecialchars
* <i>replaceafter<i>: parameters are substituted after parsing or escaping
* <i>parsemag<i>: ??
*/
function wfMsgExt($key, $options)
{
global $wgOut, $wgParser;
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgGetKey($key, true, false, false);
if (!in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
if (in_array('parse', $options)) {
$string = $wgOut->parse($string, true, true);
} elseif (in_array('parseinline', $options)) {
$string = $wgOut->parse($string, true, true);
$m = array();
if (preg_match("~^<p>(.*)\n?</p>\$~", $string, $m)) {
$string = $m[1];
}
} elseif (in_array('parsemag', $options)) {
global $wgMessageCache;
if (isset($wgMessageCache)) {
$string = $wgMessageCache->transform($string);
}
}
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
if (in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
return $string;
}
开发者ID:negabaro,项目名称:alfresco,代码行数:45,代码来源:GlobalFunctions.php
示例15: msgExt
/**
* Returns message in the requested format after parsing wikitext to html
* This is meant to be equivalent to wfMsgExt() with parse, parsemag and escape as available options but using the DPL2 local parser instead of the global one (bugfix).
*/
function msgExt($key, $options)
{
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgGetKey($key, true, false, false);
$string = wfMsgReplaceArgs($string, $args);
if (in_array('parse', $options)) {
$this->mParserOptions->setInterfaceMessage(true);
$string = $this->mParser->recursiveTagParse($string);
$this->mParserOptions->setInterfaceMessage(false);
//$string = $parserOutput->getText();
} elseif (in_array('parsemag', $options)) {
$parser = ParserPool::create();
# Wikia
$parserOptions = new ParserOptions();
$parserOptions->setInterfaceMessage(true);
$parser->startExternalParse($this->mParserTitle, $parserOptions, OT_MSG);
$string = $parser->transformMsg($string, $parserOptions);
}
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
return $string;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:DynamicPageList2.php
示例16: wfMsgExt
/**
* Returns message in the requested format
* @param $key String: key of the message
* @param $options Array: processing rules. Can take the following options:
* <i>parse</i>: parses wikitext to HTML
* <i>parseinline</i>: parses wikitext to HTML and removes the surrounding
* p's added by parser or tidy
* <i>escape</i>: filters message through htmlspecialchars
* <i>escapenoentities</i>: same, but allows entity references like   through
* <i>replaceafter</i>: parameters are substituted after parsing or escaping
* <i>parsemag</i>: transform the message using magic phrases
* <i>content</i>: fetch message for content language instead of interface
* Also can accept a single associative argument, of the form 'language' => 'xx':
* <i>language</i>: Language object or language code to fetch message for
* (overriden by <i>content</i>).
* Behavior for conflicting options (e.g., parse+parseinline) is undefined.
*
* @return String
*/
function wfMsgExt($key, $options)
{
$args = func_get_args();
array_shift($args);
array_shift($args);
$options = (array) $options;
foreach ($options as $arrayKey => $option) {
if (!preg_match('/^[0-9]+|language$/', $arrayKey)) {
# An unknown index, neither numeric nor "language"
wfWarn("wfMsgExt called with incorrect parameter key {$arrayKey}", 1, E_USER_WARNING);
} elseif (preg_match('/^[0-9]+$/', $arrayKey) && !in_array($option, array('parse', 'parseinline', 'escape', 'escapenoentities', 'replaceafter', 'parsemag', 'content'))) {
# A numeric index with unknown value
wfWarn("wfMsgExt called with incorrect parameter {$option}", 1, E_USER_WARNING);
}
}
if (in_array('content', $options, true)) {
$forContent = true;
$langCode = true;
$langCodeObj = null;
} elseif (array_key_exists('language', $options)) {
$forContent = false;
$langCode = wfGetLangObj($options['language']);
$langCodeObj = $langCode;
} else {
$forContent = false;
$langCode = false;
$langCodeObj = null;
}
$string = wfMsgGetKey($key, true, $langCode, false);
if (!in_array('replaceafter', $options, true)) {
$string = wfMsgReplaceArgs($string, $args);
}
$messageCache = MessageCache::singleton();
if (in_array('parse', $options, true)) {
$string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj)->getText();
} elseif (in_array('parseinline', $options, true)) {
$string = $messageCache->parse($string, null, true, !$forContent, $langCodeObj)->getText();
$m = array();
if (preg_match('/^<p>(.*)\\n?<\\/p>\\n?$/sU', $string, $m)) {
$string = $m[1];
}
} elseif (in_array('parsemag', $options, true)) {
$string = $messageCache->transform($string, !$forContent, $langCodeObj);
}
if (in_array('escape', $options, true)) {
$string = htmlspecialchars($string);
} elseif (in_array('escapenoentities', $options, true)) {
$string = Sanitizer::escapeHtmlAllowEntities($string);
}
if (in_array('replaceafter', $options, true)) {
$string = wfMsgReplaceArgs($string, $args);
}
return $string;
}
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:73,代码来源:GlobalFunctions.php
示例17: wfMsgReal
/**
* Really get a message
* @return $key String: key to get.
* @return $args
* @return $useDB Boolean
* @return String: the requested message.
*/
function wfMsgReal($key, $args, $useDB = true, $forContent = false, $transform = true)
{
$fname = 'wfMsgReal';
$message = wfMsgGetKey($key, $useDB, $forContent, $transform);
$message = wfMsgReplaceArgs($message, $args);
return $message;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:14,代码来源:GlobalFunctions.php
示例18: wfMsgHtml
/**
* Return an HTML-escaped version of a message.
* Parameter replacements, if any, are done *after* the HTML-escaping,
* so parameters may contain HTML (eg links or form controls). Be sure
* to pre-escape them if you really do want plaintext, or just wrap
* the whole thing in htmlspecialchars().
*
* @param string $key
* @param string ... parameters
* @return string
*/
function wfMsgHtml($key)
{
$args = func_get_args();
array_shift($args);
return wfMsgReplaceArgs(htmlspecialchars(wfMsgGetKey($key, true)), $args);
}
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:17,代码来源:GlobalFunctions.php
示例19: wfMsgExt
/**
* Returns message in the requested format
* @param string $key Key of the message
* @param array $options Processing rules:
* <i>parse<i>: parses wikitext to html
* <i>parseinline<i>: parses wikitext to html and removes the surrounding p's added by parser or tidy
* <i>escape<i>: filters message trough htmlspecialchars
* <i>replaceafter<i>: parameters are substituted after parsing or escaping
*/
function wfMsgExt($key, $options)
{
global $wgOut, $wgMsgParserOptions, $wgParser;
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgGetKey($key, true, false, false);
if (!in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
if (in_array('parse', $options)) {
$string = $wgOut->parse($string, true, true);
} elseif (in_array('parseinline', $options)) {
$string = $wgOut->parse($string, true, true);
$m = array();
if (preg_match("~^<p>(.*)\n?</p>\$~", $string, $m)) {
$string = $m[1];
}
} elseif (in_array('parsemag', $options)) {
global $wgTitle;
$parser = new Parser();
$parserOptions = new ParserOptions();
$parserOptions->setInterfaceMessage(true);
$parser->startExternalParse($wgTitle, $parserOptions, OT_MSG);
$string = $parser->transformMsg($string, $parserOptions);
}
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
if (in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
return $string;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:46,代码来源:GlobalFunctions.php
示例20: getContent
/**
* Note that getContent/loadContent do not follow redirects anymore.
* If you need to fetch redirectable content easily, try
* the shortcut in Article::followRedirect()
*
* This function has side effects! Do not use this function if you
* only want the real revision text if any.
*
* @return Return the text of this revision
*/
public function getContent()
{
global $wgUser, $wgContLang, $wgMessageCache;
wfProfileIn(__METHOD__);
if ($this->getID() === 0) {
# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
# If this is a system message, get the default text.
list($message, $lang) = $wgMessageCache->figureMessage($wgContLang->lcfirst($this->mTitle->getText()));
$text = wfMsgGetKey($message, false, $lang, false);
if (wfEmptyMsg($message, $text)) {
$text = '';
}
} else {
$text = wfMsgExt($wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag');
}
wfProfileOut(__METHOD__);
return $text;
} else {
$this->loadContent();
wfProfileOut(__METHOD__);
return $this->mContent;
}
}
开发者ID:GodelDesign,项目名称:Godel,代码行数:35,代码来源:Article.php
注:本文中的wfMsgGetKey函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论