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


PHP Language::getMessagesFor方法代码示例

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


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

示例1: execute

 public function execute()
 {
     global $wgMessageCache;
     $params = $this->extractRequestParams();
     if (!is_null($params['lang'])) {
         global $wgLang;
         $wgLang = Language::factory($params['lang']);
     }
     //Determine which messages should we print
     $messages_target = array();
     if ($params['messages'] == '*') {
         $wgMessageCache->loadAllMessages();
         $message_names = array_keys(array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en')));
         sort($message_names);
         $messages_target = $message_names;
     } else {
         $messages_target = explode('|', $params['messages']);
     }
     //Filter messages
     if (isset($params['filter'])) {
         $messages_filtered = array();
         foreach ($messages_target as $message) {
             if (strpos($message, $params['filter']) !== false) {
                 //!== is used because filter can be at the beginnig of the string
                 $messages_filtered[] = $message;
             }
         }
         $messages_target = $messages_filtered;
     }
     //Get all requested messages
     $messages = array();
     $skip = !is_null($params['from']);
     foreach ($messages_target as $message) {
         // Skip all messages up to $params['from']
         if ($skip && $message === $params['from']) {
             $skip = false;
         }
         if (!$skip) {
             $messages[$message] = wfMsg($message);
         }
     }
     //Print the result
     $result = $this->getResult();
     $messages_out = array();
     foreach ($messages as $name => $value) {
         $message = array();
         $message['name'] = $name;
         if (wfEmptyMsg($name, $value)) {
             $message['missing'] = '';
         } else {
             $result->setContent($message, $value);
         }
         $fit = $result->addValue(array('query', $this->getModuleName()), null, $message);
         if (!$fit) {
             $this->setContinueEnumParameter('from', $name);
             break;
         }
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'message');
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:60,代码来源:ApiQueryAllmessages.php

示例2: execute

 public function execute()
 {
     $englishMessages = array_keys(Language::getMessagesFor('en'));
     foreach ($englishMessages as $key) {
         $this->output("{$key}\n");
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:7,代码来源:alltrans.php

示例3: execute

 public function execute()
 {
     $messages = array();
     foreach (array_keys(Language::getMessagesFor('en')) as $key) {
         $messages[$key] = wfMsg($key);
     }
     $this->output("MediaWiki {$wgVersion} language file\n");
     $this->output(serialize($messages));
 }
开发者ID:rocLv,项目名称:conference,代码行数:9,代码来源:dumpMessages.php

示例4: execute

 public function execute()
 {
     global $wgMessageCache;
     $params = $this->extractRequestParams();
     if (!is_null($params['lang'])) {
         global $wgLang;
         $wgLang = Language::factory($params['lang']);
     }
     //Determine which messages should we print
     $messages_target = array();
     if ($params['messages'] == '*') {
         $wgMessageCache->loadAllMessages();
         $message_names = array_keys(array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en')));
         sort($message_names);
         $messages_target = $message_names;
     } else {
         $messages_target = explode('|', $params['messages']);
     }
     //Filter messages
     if (isset($params['filter'])) {
         $messages_filtered = array();
         foreach ($messages_target as $message) {
             if (strpos($message, $params['filter']) !== false) {
                 //!== is used because filter can be at the beginnig of the string
                 $messages_filtered[] = $message;
             }
         }
         $messages_target = $messages_filtered;
     }
     $wgMessageCache->disableTransform();
     //Get all requested messages
     $messages = array();
     foreach ($messages_target as $message) {
         $message = trim($message);
         //Message list can be formatted like "msg1 | msg2 | msg3", so let's trim() it
         $messages[$message] = wfMsg($message);
     }
     //Print the result
     $result = $this->getResult();
     $messages_out = array();
     foreach ($messages as $name => $value) {
         $message = array();
         $message['name'] = $name;
         $result->setContent($message, $value);
         $messages_out[] = $message;
     }
     $result->setIndexedTagName($messages_out, 'message');
     $result->addValue('query', $this->getModuleName(), $messages_out);
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:49,代码来源:ApiQueryAllmessages.php

示例5: wfSpecialAllmessages

/**
 * Constructor.
 */
function wfSpecialAllmessages()
{
    global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
    global $wgUseDatabaseMessages, $wgLang;
    # The page isn't much use if the MediaWiki namespace is not being used
    if (!$wgUseDatabaseMessages) {
        $wgOut->addWikiMsg('allmessagesnotsupportedDB');
        return;
    }
    wfProfileIn(__METHOD__);
    wfProfileIn(__METHOD__ . '-setup');
    $ot = $wgRequest->getText('ot');
    $navText = wfMsg('allmessagestext');
    # Make sure all extension messages are available
    $wgMessageCache->loadAllMessages();
    $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en'));
    ksort($sortedArray);
    $messages = array();
    foreach ($sortedArray as $key => $value) {
        $messages[$key]['enmsg'] = $value;
        $messages[$key]['statmsg'] = wfMsgReal($key, array(), false, false, false);
        $messages[$key]['msg'] = wfMsgNoTrans($key);
        $sortedArray[$key] = NULL;
        // trade bytes from $sortedArray to this
    }
    unset($sortedArray);
    // trade bytes from $sortedArray to this
    wfProfileOut(__METHOD__ . '-setup');
    wfProfileIn(__METHOD__ . '-output');
    $wgOut->addScriptFile('allmessages.js');
    if ($ot == 'php') {
        $navText .= wfAllMessagesMakePhp($messages);
        $wgOut->addHTML($wgLang->pipeList(array('PHP', '<a href="' . $wgTitle->escapeLocalUrl('ot=html') . '">HTML</a>', '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>' . '<pre>' . htmlspecialchars($navText) . '</pre>')));
    } else {
        if ($ot == 'xml') {
            $wgOut->disable();
            header('Content-type: text/xml');
            echo wfAllMessagesMakeXml($messages);
        } else {
            $wgOut->addHTML($wgLang->pipeList(array('<a href="' . $wgTitle->escapeLocalUrl('ot=php') . '">PHP</a>', 'HTML', '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>')));
            $wgOut->addWikiText($navText);
            $wgOut->addHTML(wfAllMessagesMakeHTMLText($messages));
        }
    }
    wfProfileOut(__METHOD__ . '-output');
    wfProfileOut(__METHOD__);
}
开发者ID:ruizrube,项目名称:spdef,代码行数:50,代码来源:SpecialAllmessages.php

示例6: wfSpecialAllmessages

/**
 * Constructor.
 */
function wfSpecialAllmessages()
{
    global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
    global $wgUseDatabaseMessages;
    # The page isn't much use if the MediaWiki namespace is not being used
    if (!$wgUseDatabaseMessages) {
        $wgOut->addWikiMsg('allmessagesnotsupportedDB');
        return;
    }
    wfProfileIn(__METHOD__);
    wfProfileIn(__METHOD__ . '-setup');
    $ot = $wgRequest->getText('ot');
    $navText = wfMsg('allmessagestext');
    # Make sure all extension messages are available
    $wgMessageCache->loadAllMessages();
    $wgOut->addScript("<script src='/skins/common/allmessages.js'></script>");
    $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en'));
    ksort($sortedArray);
    $messages = array();
    $wgMessageCache->disableTransform();
    foreach ($sortedArray as $key => $value) {
        $messages[$key]['enmsg'] = $value;
        $messages[$key]['statmsg'] = wfMsgNoDb($key);
        $messages[$key]['msg'] = wfMsg($key);
    }
    $wgMessageCache->enableTransform();
    wfProfileOut(__METHOD__ . '-setup');
    wfProfileIn(__METHOD__ . '-output');
    if ($ot == 'php') {
        $navText .= wfAllMessagesMakePhp($messages);
        $wgOut->addHTML('PHP | <a href="' . $wgTitle->escapeLocalUrl('ot=html') . '">HTML</a> | ' . '<a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>' . '<pre>' . htmlspecialchars($navText) . '</pre>');
    } else {
        if ($ot == 'xml') {
            $wgOut->disable();
            header('Content-type: text/xml');
            echo wfAllMessagesMakeXml($messages);
        } else {
            $wgOut->addHTML('<a href="' . $wgTitle->escapeLocalUrl('ot=php') . '">PHP</a> | ' . 'HTML |  <a href="' . $wgTitle->escapeLocalUrl('ot=xml') . '">XML</a>');
            $wgOut->addWikiText($navText);
            $wgOut->addHTML(wfAllMessagesMakeHTMLText($messages));
        }
    }
    wfProfileOut(__METHOD__ . '-output');
    wfProfileOut(__METHOD__);
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:48,代码来源:SpecialAllmessages.php

示例7: wfSpecialAllmessages

/**
 *
 */
function wfSpecialAllmessages()
{
    global $wgOut, $wgRequest, $wgMessageCache, $wgTitle;
    global $wgUseDatabaseMessages;
    # The page isn't much use if the MediaWiki namespace is not being used
    if (!$wgUseDatabaseMessages) {
        $wgOut->addWikiText(wfMsg('allmessagesnotsupportedDB'));
        return;
    }
    $fname = "wfSpecialAllMessages";
    wfProfileIn($fname);
    wfProfileIn("{$fname}-setup");
    $ot = $wgRequest->getText('ot');
    $navText = wfMsg('allmessagestext');
    # Make sure all extension messages are available
    MessageCache::loadAllMessages();
    $first = true;
    $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en'));
    ksort($sortedArray);
    $messages = array();
    $wgMessageCache->disableTransform();
    foreach ($sortedArray as $key => $value) {
        $messages[$key]['enmsg'] = $value;
        $messages[$key]['statmsg'] = wfMsgNoDb($key);
        $messages[$key]['msg'] = wfMsg($key);
    }
    $wgMessageCache->enableTransform();
    wfProfileOut("{$fname}-setup");
    wfProfileIn("{$fname}-output");
    if ($ot == 'php') {
        $navText .= makePhp($messages);
        $wgOut->addHTML('PHP | <a href="' . $wgTitle->escapeLocalUrl('ot=html') . '">HTML</a><pre>' . htmlspecialchars($navText) . '</pre>');
    } else {
        $wgOut->addHTML('<a href="' . $wgTitle->escapeLocalUrl('ot=php') . '">PHP</a> | HTML');
        $wgOut->addWikiText($navText);
        $wgOut->addHTML(makeHTMLText($messages));
    }
    wfProfileOut("{$fname}-output");
    wfProfileOut($fname);
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:43,代码来源:SpecialAllmessages.php

示例8: dirname

<?php

/**
 * @todo document
 * @addtogroup Maintenance
 */
/** */
require_once dirname(__FILE__) . '/../commandLine.inc';
$wgMessageCache->disableTransform();
$messages = array();
$wgEnglishMessages = array_keys(Language::getMessagesFor('en'));
foreach ($wgEnglishMessages as $key) {
    $messages[$key] = wfMsg($key);
}
print "MediaWiki {$wgVersion} language file\n";
print serialize($messages);
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:16,代码来源:dumpMessages.php

示例9: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     global $wgLang;
     $oldLang = null;
     if (!is_null($params['lang'])) {
         $oldLang = $wgLang;
         // Keep $wgLang for restore later
         $wgLang = Language::factory($params['lang']);
     }
     $prop = array_flip((array) $params['prop']);
     // Determine which messages should we print
     if (in_array('*', $params['messages'])) {
         $message_names = array_keys(Language::getMessagesFor('en'));
         sort($message_names);
         $messages_target = $message_names;
     } else {
         $messages_target = $params['messages'];
     }
     // Filter messages
     if (isset($params['filter'])) {
         $messages_filtered = array();
         foreach ($messages_target as $message) {
             // !== is used because filter can be at the beginning of the string
             if (strpos($message, $params['filter']) !== false) {
                 $messages_filtered[] = $message;
             }
         }
         $messages_target = $messages_filtered;
     }
     // Get all requested messages and print the result
     $skip = !is_null($params['from']);
     $useto = !is_null($params['to']);
     $result = $this->getResult();
     foreach ($messages_target as $message) {
         // Skip all messages up to $params['from']
         if ($skip && $message === $params['from']) {
             $skip = false;
         }
         if ($useto && $message > $params['to']) {
             break;
         }
         if (!$skip) {
             $a = array('name' => $message);
             $args = null;
             if (isset($params['args']) && count($params['args']) != 0) {
                 $args = $params['args'];
             }
             // Check if the parser is enabled:
             if ($params['enableparser']) {
                 $msg = wfMsgExt($message, array('parsemag'), $args);
             } elseif ($args) {
                 $msgString = wfMsgGetKey($message, true, false, false);
                 $msg = wfMsgReplaceArgs($msgString, $args);
             } else {
                 $msg = wfMsgGetKey($message, true, false, false);
             }
             if (wfEmptyMsg($message, $msg)) {
                 $a['missing'] = '';
             } else {
                 ApiResult::setContent($a, $msg);
                 if (isset($prop['default'])) {
                     $default = wfMsgGetKey($message, false, false, false);
                     if ($default !== $msg) {
                         if (wfEmptyMsg($message, $default)) {
                             $a['defaultmissing'] = '';
                         } else {
                             $a['default'] = $default;
                         }
                     }
                 }
             }
             $fit = $result->addValue(array('query', $this->getModuleName()), null, $a);
             if (!$fit) {
                 $this->setContinueEnumParameter('from', $message);
                 break;
             }
         }
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'message');
     if (!is_null($oldLang)) {
         $wgLang = $oldLang;
         // Restore $oldLang
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:85,代码来源:ApiQueryAllmessages.php

示例10: dirname

 *
 * @package MediaWiki
 * @subpackage Maintenance
 */
require_once dirname(__FILE__) . '/../commandLine.inc';
if (isset($args[0])) {
    $code = $args[0];
} else {
    $code = $wgLang->getCode();
}
if ($code == 'en') {
    print "Current selected language is English. Cannot check translations.\n";
    exit;
}
$filename = Language::getMessagesFileName($code);
if (file_exists($filename)) {
    require $filename;
} else {
    $messages = array();
}
$count = $total = 0;
$wgEnglishMessages = Language::getMessagesFor('en');
$wgLocalMessages = $messages;
foreach ($wgLocalMessages as $key => $msg) {
    ++$total;
    if (!isset($wgEnglishMessages[$key])) {
        print "* {$key}\n";
        ++$count;
    }
}
print "{$count} messages of {$total} are unused in the language {$code}\n";
开发者ID:puring0815,项目名称:OpenKore,代码行数:31,代码来源:unusedMessages.php

示例11: execute

    function execute($par)
    {
        global $wgOut, $wgRequest, $wgUser;
        global $wgExtensionMessagesFiles, $wgMessageCache;
        if (!in_array('sysop', $wgUser->getGroups())) {
            $wgOut->setArticleRelated(false);
            $wgOut->setRobotpolicy('noindex,nofollow');
            $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
            return;
        }
        $target = isset($par) ? $par : $wgRequest->getVal('target');
        $filename = $wgRequest->getVal('mwextension');
        if ($target || $filename) {
            if ($target && !$filename) {
                foreach ($wgExtensionMessagesFiles as $m) {
                    if (stripos($m, $target) !== false) {
                        $filename = $m;
                        break;
                    }
                }
            }
        }
        $wgOut->addHTML('<link rel="stylesheet" href="/extensions/min/f/extensions/wikihow/mwmessages.css,/skins/WikiHow/popupEdit.css" type="text/css" />');
        $wgOut->addScript('<script type="text/javascript" src="/extensions/min/f/skins/WikiHow/popupEdit.js"></script>');
        $wgOut->addHTML("<div class='mwmessages'/><form action='/Special:MWMessages' method='POST' name='mwmessagesform'>");
        $wgOut->addHTML("Browse by Extension<br/><select name='mwextension' onchange='document.mwmessagesform.submit();'>");
        foreach ($wgExtensionMessagesFiles as $m) {
            $key = preg_replace("@.*/@", "", $m);
            $key = preg_replace("@\\..*@", "", $key);
            $addinfo = MWMessages::getExtensionInfo($key);
            if ($filename == $m) {
                $wgOut->addHTML("<OPTION VALUE='{$m}' SELECTED>{$key}{$addinfo}</OPTION>\n");
            } else {
                $wgOut->addHTML("<OPTION VALUE='{$m}'>{$key}{$addinfo}</OPTION>\n");
            }
        }
        $wgOut->addHTML("</select><input type='submit' value='Go'>");
        $wgOut->addHTML("</form>");
        if ($wgRequest->wasPosted()) {
            $search = $wgRequest->getVal('mwmessagessearch');
            if ($search) {
                $wgMessageCache->mAllMessagesLoaded = false;
                $wgMessageCache->loadAllMessages();
                $lang = 'en';
                $sortedArray = array_merge(Language::getMessagesFor('en'), $wgMessageCache->getExtensionMessagesFor('en'));
                $wgOut->addHTML("<table class='mwmessages'>\n\t\t\t\t\t\t<tr><td><b>Lang</b></td><td><b>Key</b></td><td><b>Value</b></td></tr>");
                foreach ($sortedArray as $key => $val) {
                    $val = wfMsg($key);
                    if (stripos($val, $search) !== false) {
                        $t = Title::makeTitle(NS_MEDIAWIKI, $key);
                        $qe_url = '<a href="#" onclick="initPopupEdit(\'' . Title::makeTitle(NS_SPECIAL, 'QuickEdit')->getFullURL() . '?type=editform&target=' . $t->getPrefixedURL() . '\') ;">' . $key . '</a>';
                        $wgOut->addHTML("<tr><td class='mw_lang'>{$lang}</td><td class='mw_key'>{$qe_url}</td><td class='mw_val'>" . htmlspecialchars($val) . "</td></tr>");
                    }
                }
                $dbr = wfGetDB(DB_SLAVE);
                $res = $dbr->select('page', array('page_title', 'page_namespace'), array('page_namespace' => NS_MEDIAWIKI));
                while ($row = $dbr->fetchObject($res)) {
                    $t = Title::makeTitle($row->page_namespace, $row->page_title);
                    if (!$t) {
                        continue;
                    }
                    $r = Revision::newFromTitle($t);
                    if (!$r) {
                        continue;
                    }
                    $val = $r->getText();
                    if (stripos($val, $search) !== false) {
                        $qe_url = '<a href="#" onclick="initPopupEdit(\'' . Title::makeTitle(NS_SPECIAL, 'QuickEdit')->getFullURL() . '?type=editform&target=' . $t->getPrefixedURL() . '\') ;">' . $row->page_title . '</a>';
                        $wgOut->addHTML("<tr><td class='mw_lang'>{$lang}</td><td class='mw_key'>{$qe_url}</td><td class='mw_val'>" . htmlspecialchars($val) . "</td></tr>");
                    }
                }
                $wgOut->addHTML("</table>");
            }
        }
        if ($filename) {
            // reset messages
            $messages = array();
            require_once $filename;
            $wgOut->addHTML("<table class='mwmessages'>\n\t\t\t\t\t<tr><td><b>Lang</b></td><td><b>Key</b></td><td><b>Value</b></td></tr>");
            $index = 0;
            foreach ($messages as $lang => $arrs) {
                foreach ($arrs as $key => $val) {
                    $newval = wfMsg($key);
                    if ($newval != "&lt;{$key}&gt;") {
                        $val = $newval;
                    }
                    $t = Title::makeTitle(NS_MEDIAWIKI, $key);
                    $qe_url = '<a href="#" onclick="initPopupEdit(\'' . Title::makeTitle(NS_SPECIAL, 'QuickEdit')->getFullURL() . '?type=editform&target=' . $t->getPrefixedURL() . '\'); setText(' . $index . ');">' . $key . '</a>';
                    $wgOut->addHTML("<tr><td class='mw_lang'>{$lang}</td><td class='mw_key'>{$qe_url}</td><td class='mw_val' id='mw_{$index}'>" . htmlspecialchars($val) . "</td></tr>");
                    $index++;
                }
            }
            $wgOut->addHTML("</table>");
        }
        $wgOut->addHTML("</div><br/><br/><div class='mwmessages'>Or search for a message that's not an extension message:<br/><br/>\n\t\t\t\t<form action='/Special:MWMessages' method='POST' name='mwmessagesform_search'>\n\t\t\t\t<center>\n\t\t\t\t<input type='text' name='mwmessagessearch' value=\"" . htmlspecialchars($wgRequest->getVal('mwmessagessearch')) . "\" style='width:300px;font-size:110%;'>\n\t\t\t\t<input type='submit' value='Search for messages'/>\n\t\t\t\t</center>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t");
        $wgOut->addScript('
<script type="text/javascript">
		var gAutoSummaryText = "Updating mediawiki message with MWMessages extensions";
		var gQuickEditComplete = "' . wfMsg('Quickedit-complete') . '";
		var gId = null;
//.........这里部分代码省略.........
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:MWMessages.body.php

示例12: getDefinitions

 function getDefinitions()
 {
     $data = file_get_contents(dirname(__FILE__) . '/wikimedia-mostused-2011.txt');
     $data = str_replace("\r", '', $data);
     $messages = explode("\n", $data);
     $contents = Language::getMessagesFor($this->getSourceLanguage());
     $definitions = array();
     foreach ($messages as $key) {
         if (isset($contents[$key])) {
             $definitions[$key] = $contents[$key];
         }
     }
     return $definitions;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:14,代码来源:MessageGroups.php

示例13: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     if (is_null($params['lang'])) {
         global $wgLang;
         $langObj = $wgLang;
     } else {
         $langObj = Language::factory($params['lang']);
     }
     if ($params['enableparser']) {
         if (!is_null($params['title'])) {
             $title = Title::newFromText($params['title']);
             if (!$title) {
                 $this->dieUsageMsg(array('invalidtitle', $params['title']));
             }
         } else {
             $title = Title::newFromText('API');
         }
     }
     $prop = array_flip((array) $params['prop']);
     // Determine which messages should we print
     if (in_array('*', $params['messages'])) {
         $message_names = array_keys(Language::getMessagesFor('en'));
         sort($message_names);
         $messages_target = $message_names;
     } else {
         $messages_target = $params['messages'];
     }
     // Filter messages that have the specified prefix
     // Because we sorted the message array earlier, they will appear in a clump:
     if (isset($params['prefix'])) {
         $skip = false;
         $messages_filtered = array();
         foreach ($messages_target as $message) {
             // === 0: must be at beginning of string (position 0)
             if (strpos($message, $params['prefix']) === 0) {
                 if (!$skip) {
                     $skip = true;
                 }
                 $messages_filtered[] = $message;
             } elseif ($skip) {
                 break;
             }
         }
         $messages_target = $messages_filtered;
     }
     // Filter messages that contain specified string
     if (isset($params['filter'])) {
         $messages_filtered = array();
         foreach ($messages_target as $message) {
             // !== is used because filter can be at the beginning of the string
             if (strpos($message, $params['filter']) !== false) {
                 $messages_filtered[] = $message;
             }
         }
         $messages_target = $messages_filtered;
     }
     // Whether we have any sort of message customisation filtering
     $customiseFilterEnabled = $params['customised'] !== 'all';
     if ($customiseFilterEnabled) {
         global $wgContLang;
         $lang = $langObj->getCode();
         $customisedMessages = AllmessagesTablePager::getCustomisedStatuses(array_map(array($langObj, 'ucfirst'), $messages_target), $lang, $lang != $wgContLang->getCode());
         $customised = $params['customised'] === 'modified';
     }
     // Get all requested messages and print the result
     $skip = !is_null($params['from']);
     $useto = !is_null($params['to']);
     $result = $this->getResult();
     foreach ($messages_target as $message) {
         // Skip all messages up to $params['from']
         if ($skip && $message === $params['from']) {
             $skip = false;
         }
         if ($useto && $message > $params['to']) {
             break;
         }
         if (!$skip) {
             $a = array('name' => $message);
             $args = array();
             if (isset($params['args']) && count($params['args']) != 0) {
                 $args = $params['args'];
             }
             if ($customiseFilterEnabled) {
                 $messageIsCustomised = isset($customisedMessages['pages'][$langObj->ucfirst($message)]);
                 if ($customised === $messageIsCustomised) {
                     if ($customised) {
                         $a['customised'] = '';
                     }
                 } else {
                     continue;
                 }
             }
             $msg = wfMessage($message, $args)->inLanguage($langObj);
             if (!$msg->exists()) {
                 $a['missing'] = '';
             } else {
                 // Check if the parser is enabled:
                 if ($params['enableparser']) {
                     $msgString = $msg->title($title)->text();
//.........这里部分代码省略.........
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:101,代码来源:ApiQueryAllmessages.php

示例14: getKeys

 /**
  * Not really needed anymore
  */
 function getKeys()
 {
     global $wgContLang;
     if (!$this->mKeys) {
         $this->mKeys = array();
         $allMessages = Language::getMessagesFor('en');
         foreach ($allMessages as $key => $value) {
             $title = $wgContLang->ucfirst($key);
             array_push($this->mKeys, $title);
         }
     }
     return $this->mKeys;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:16,代码来源:MessageCache.php


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