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

PHP MessageCache类代码示例

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

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



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

示例1: setUp

 public function setUp()
 {
     global $wgOut, $wgUser, $wgMessageCache;
     $wgOut = $this;
     $wgUser = new User(2);
     $wgMessageCache = new MessageCache();
     $wgMessageCache->addMessages(array('rdf' => 'Rdf', 'rdf-inpage' => "Embedded In-page Turtle", 'rdf-dcmes' => "Dublin Core Metadata Element Set", 'rdf-cc' => "Creative Commons", 'rdf-image' => "Embedded images", 'rdf-linksfrom' => "Links from the page", 'rdf-links' => "All links", 'rdf-history' => "Historical versions", 'rdf-interwiki' => "Interwiki links", 'rdf-categories' => "Categories", 'rdf-target' => "Target page", 'rdf-modelnames' => "Model(s)", 'rdf-format' => "Output format", 'rdf-output-xml' => "XML", 'rdf-output-turtle' => "Turtle", 'rdf-output-ntriples' => "NTriples", 'rdf-instructions' => "Select the target page and RDF models you're interested in."));
     MwRdf::$ModelMakers = array('MwRdf_CreativeCommons_Modeler', 'MwRdf_LinksFrom_Modeler', 'MwRdf_LinksTo_Modeler', 'MwRdf_InPage_Modeler', 'MwRdf_DCmes_Modeler', 'MwRdf_History_Modeler', 'MwRdf_Image_Modeler', 'MwRdf_Categories_Modeler', 'MwRdf_Interwiki_Modeler');
     MwRdf::ShowForm();
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:10,代码来源:MwRdfTest_Form.php


示例2: initMessagesHref

 /** Build $this->messages array */
 private function initMessagesHref()
 {
     # List of default messages for the sidebar:
     $URL_messages = array('mainpage', 'portal-url', 'currentevents-url', 'recentchanges-url', 'randompage-url', 'helppage');
     foreach ($URL_messages as $m) {
         $titleName = MessageCache::singleton()->get($m);
         $title = Title::newFromText($titleName);
         $this->messages[$m]['href'] = $title->getLocalURL();
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:11,代码来源:SideBarTest.php


示例3: setUp

 protected function setUp()
 {
     global $wgLanguageCode, $wgContLang;
     if ($wgLanguageCode != $wgContLang->getCode()) {
         throw new MWException("Error in MediaWikiLangTestCase::setUp(): " . "\$wgLanguageCode ('{$wgLanguageCode}') is different from " . "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")");
     }
     parent::setUp();
     $this->setUserLang('en');
     // For mainpage to be 'Main Page'
     $this->setContentLang('en');
     MessageCache::singleton()->disable();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:MediaWikiLangTestCase.php


示例4: setUp

 protected function setUp()
 {
     global $wgLanguageCode, $wgContLang;
     parent::setUp();
     if ($wgLanguageCode != $wgContLang->getCode()) {
         throw new MWException("Error in MediaWikiLangTestCase::setUp(): " . "\$wgLanguageCode ('{$wgLanguageCode}') is different from " . "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")");
     }
     $langCode = 'en';
     # For mainpage to be 'Main Page'
     $langObj = Language::factory($langCode);
     $this->setMwGlobals(array('wgLanguageCode' => $langCode, 'wgLang' => $langObj, 'wgContLang' => $langObj));
     MessageCache::singleton()->disable();
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:13,代码来源:MediaWikiLangTestCase.php


示例5: setUp

 public function setUp()
 {
     global $wgLanguageCode, $wgLang, $wgContLang;
     self::$oldLang = $wgLang;
     self::$oldContLang = $wgContLang;
     if ($wgLanguageCode != $wgContLang->getCode()) {
         throw new MWException("Error in MediaWikiLangTestCase::setUp(): " . "\$wgLanguageCode ('{$wgLanguageCode}') is different from " . "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")");
     }
     $wgLanguageCode = 'en';
     # For mainpage to be 'Main Page'
     $wgContLang = $wgLang = Language::factory($wgLanguageCode);
     MessageCache::singleton()->disable();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:MediaWikiLangTestCase.php


示例6: setUp

 public function setUp()
 {
     global $wgLanguageCode, $wgLang, $wgContLang;
     self::$oldLang = $wgLang;
     self::$oldContLang = $wgContLang;
     if ($wgLanguageCode != $wgContLang->getCode()) {
         die("nooo!");
     }
     $wgLanguageCode = 'en';
     # For mainpage to be 'Main Page'
     $wgContLang = $wgLang = Language::factory($wgLanguageCode);
     MessageCache::singleton()->disable();
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:13,代码来源:MediaWikiLangTestCase.php


示例7: onMessageCacheGet

 /**
  * From WikimediaMessages
  *
  * @return bool
  */
 public static function onMessageCacheGet(&$lcKey)
 {
     global $wgLanguageCode;
     static $keys = array('centralauth-groupname');
     if (in_array($lcKey, $keys, true)) {
         $prefixedKey = "miraheze-{$lcKey}";
         // MessageCache uses ucfirst if ord( key ) is < 128, which is true of all
         // of the above.  Revisit if non-ASCII keys are used.
         $ucKey = ucfirst($lcKey);
         $cache = MessageCache::singleton();
         if ($cache->getMsgFromNamespace($ucKey, $wgLanguageCode) === false) {
             $lcKey = $prefixedKey;
         }
     }
     return true;
 }
开发者ID:reviforks,项目名称:MirahezeMagic,代码行数:21,代码来源:MirahezeMagic.hooks.php


示例8: setUp

 protected function setUp()
 {
     global $wgLanguageCode, $wgContLang;
     parent::setUp();
     if ($wgLanguageCode != $wgContLang->getCode()) {
         throw new MWException("Error in MediaWikiLangTestCase::setUp(): " . "\$wgLanguageCode ('{$wgLanguageCode}') is different from " . "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")");
     }
     // HACK: Call getLanguage() so the real $wgContLang is cached as the user language
     // rather than our fake one. This is to avoid breaking other, unrelated tests.
     RequestContext::getMain()->getLanguage();
     $langCode = 'en';
     # For mainpage to be 'Main Page'
     $langObj = Language::factory($langCode);
     $this->setMwGlobals(array('wgLanguageCode' => $langCode, 'wgLang' => $langObj, 'wgContLang' => $langObj));
     MessageCache::singleton()->disable();
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:16,代码来源:MediaWikiLangTestCase.php


示例9: onMessageCacheGet

 /**
  * When core requests certain messages, change the key to a Kol-Zchut version.
  *
  * @note Don't make this a closure, it causes the Database Dumps to fail.
  *   See https://bugs.php.net/bug.php?id=52144
  *
  * @param String &$lcKey message key to check and possibly convert
  *
  * @return bool
  */
 public static function onMessageCacheGet(&$lcKey)
 {
     global $wgLanguageCode;
     static $keys = array('aboutpage', 'aboutsite', 'copyright', 'copyrightwarning', 'deletereason-dropdown', 'edithelppage', 'hidetoc', 'showtoc', 'lastmodifiedat', 'lastmodifiedatby', 'login', 'logouttext', 'nav-login-createaccount', 'userlogin', 'userloginnocreate', 'logout', 'userlogout', 'notloggedin', 'nologin', 'gotaccountlink', 'createaccounterror', 'signupstart', 'noarticletext', 'noarticletext-nopermission', 'protect-dropdown', 'siteuser', 'siteusers', 'tagline', 'tooltip-p-logo', 'tooltip-n-mainpage', 'tooltip-n-mainpage-description', "accesskey-p-logo", "accesskey-n-mainpage", 'enotif_body_intro_deleted', 'enotif_body_intro_created', 'enotif_body_intro_moved', 'enotif_body_intro_restored', 'enotif_body_intro_changed', 'enotif_lastvisited', 'enotif_lastdiff', 'enotif_body', 'search-nonefound', 'upload', 'userpage', 'helena-disclaimers', 'wr-langlinks-label');
     if (in_array($lcKey, $keys, true)) {
         $prefixedKey = "kz-{$lcKey}";
         // MessageCache uses ucfirst if ord( key ) is < 128, which is true of all
         // of the above.  Revisit if non-ASCII keys are used.
         $ucKey = ucfirst($lcKey);
         $cache = MessageCache::singleton();
         if ($cache->getMsgFromNamespace($ucKey, $wgLanguageCode) === false) {
             $lcKey = $prefixedKey;
         }
     }
     return true;
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-WRMessages,代码行数:26,代码来源:WRMessages.hooks.php


示例10: getContent

 /**
  * @param $title Title
  * @return null|string
  */
 protected function getContent($title)
 {
     if ($title->getNamespace() === NS_MEDIAWIKI) {
         // The first "true" is to use the database, the second is to use the content langue
         // and the last one is to specify the message key already contains the language in it ("/de", etc.)
         $text = MessageCache::singleton()->get($title->getDBkey(), true, true, true);
         return $text === false ? '' : $text;
     }
     if (!$title->isCssJsSubpage() && !$title->isCssOrJsPage()) {
         return null;
     }
     $revision = Revision::newFromTitle($title, false, Revision::READ_NORMAL);
     if (!$revision) {
         return null;
     }
     return $revision->getRawText();
 }
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:21,代码来源:ResourceLoaderWikiModule.php


示例11: initMessagesHref

 /** Build $this->messages array */
 private function initMessagesHref()
 {
     # List of default messages for the sidebar. The sidebar doesn't care at
     # all whether they are full URLs, interwiki links or local titles.
     $URL_messages = array('mainpage', 'portal-url', 'currentevents-url', 'recentchanges-url', 'randompage-url', 'helppage');
     # We're assuming that isValidURI works as advertised: it's also
     # tested separately, in tests/phpunit/includes/HttpTest.php.
     foreach ($URL_messages as $m) {
         $titleName = MessageCache::singleton()->get($m);
         if (Http::isValidURI($titleName)) {
             $this->messages[$m]['href'] = $titleName;
         } else {
             $title = Title::newFromText($titleName);
             $this->messages[$m]['href'] = $title->getLocalURL();
         }
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:18,代码来源:SideBarTest.php


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


示例13: setupGlobals

 /**
  * Set up the global variables for a consistent environment for each test.
  * Ideally this should replace the global configuration entirely.
  * @param array $opts
  * @param string $config
  * @return RequestContext
  */
 protected function setupGlobals($opts = array(), $config = '')
 {
     global $wgFileBackends;
     # Find out values for some special options.
     $lang = self::getOptionValue('language', $opts, 'en');
     $variant = self::getOptionValue('variant', $opts, false);
     $maxtoclevel = self::getOptionValue('wgMaxTocLevel', $opts, 999);
     $linkHolderBatchSize = self::getOptionValue('wgLinkHolderBatchSize', $opts, 1000);
     $uploadDir = $this->getUploadDir();
     if ($this->getCliArg('use-filebackend')) {
         if (self::$backendToUse) {
             $backend = self::$backendToUse;
         } else {
             $name = $this->getCliArg('use-filebackend');
             $useConfig = array();
             foreach ($wgFileBackends as $conf) {
                 if ($conf['name'] == $name) {
                     $useConfig = $conf;
                 }
             }
             $useConfig['name'] = 'local-backend';
             // swap name
             unset($useConfig['lockManager']);
             unset($useConfig['fileJournal']);
             $class = $useConfig['class'];
             self::$backendToUse = new $class($useConfig);
             $backend = self::$backendToUse;
         }
     } else {
         # Replace with a mock. We do not care about generating real
         # files on the filesystem, just need to expose the file
         # informations.
         $backend = new MockFileBackend(array('name' => 'local-backend', 'wikiId' => wfWikiId()));
     }
     $settings = array('wgLocalFileRepo' => array('class' => 'LocalRepo', 'name' => 'local', 'url' => 'http://example.com/images', 'hashLevels' => 2, 'transformVia404' => false, 'backend' => $backend), 'wgEnableUploads' => self::getOptionValue('wgEnableUploads', $opts, true), 'wgLanguageCode' => $lang, 'wgDBprefix' => $this->db->getType() != 'oracle' ? 'unittest_' : 'ut_', 'wgRawHtml' => self::getOptionValue('wgRawHtml', $opts, false), 'wgNamespacesWithSubpages' => array(NS_MAIN => isset($opts['subpage'])), 'wgAllowExternalImages' => self::getOptionValue('wgAllowExternalImages', $opts, true), 'wgThumbLimits' => array(self::getOptionValue('thumbsize', $opts, 180)), 'wgMaxTocLevel' => $maxtoclevel, 'wgUseTeX' => isset($opts['math']) || isset($opts['texvc']), 'wgMathDirectory' => $uploadDir . '/math', 'wgDefaultLanguageVariant' => $variant, 'wgLinkHolderBatchSize' => $linkHolderBatchSize, 'wgUseTidy' => isset($opts['tidy']));
     if ($config) {
         $configLines = explode("\n", $config);
         foreach ($configLines as $line) {
             list($var, $value) = explode('=', $line, 2);
             $settings[$var] = eval("return {$value};");
             // ???
         }
     }
     $this->savedGlobals = array();
     /** @since 1.20 */
     Hooks::run('ParserTestGlobals', array(&$settings));
     $langObj = Language::factory($lang);
     $settings['wgContLang'] = $langObj;
     $settings['wgLang'] = $langObj;
     $context = new RequestContext();
     $settings['wgOut'] = $context->getOutput();
     $settings['wgUser'] = $context->getUser();
     $settings['wgRequest'] = $context->getRequest();
     // We (re)set $wgThumbLimits to a single-element array above.
     $context->getUser()->setOption('thumbsize', 0);
     foreach ($settings as $var => $val) {
         if (array_key_exists($var, $GLOBALS)) {
             $this->savedGlobals[$var] = $GLOBALS[$var];
         }
         $GLOBALS[$var] = $val;
     }
     MWTidy::destroySingleton();
     MagicWord::clearCache();
     # The entries saved into RepoGroup cache with previous globals will be wrong.
     RepoGroup::destroySingleton();
     FileBackendGroup::destroySingleton();
     # Create dummy files in storage
     $this->setupUploads();
     # Publish the articles after we have the final language set
     $this->publishTestArticles();
     MessageCache::destroyInstance();
     return $context;
 }
开发者ID:huatuoorg,项目名称:mediawiki,代码行数:80,代码来源:NewParserTest.php


示例14: onArticleDelete

 /**
  * Clears caches when article is deleted
  *
  * @param Title $title
  */
 public static function onArticleDelete(Title $title)
 {
     global $wgContLang;
     // Update existence markers on article/talk tabs...
     $other = $title->getOtherPage();
     $other->purgeSquid();
     $title->touchLinks();
     $title->purgeSquid();
     MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle($title);
     // File cache
     HTMLFileCache::clearFileCache($title);
     InfoAction::invalidateCache($title);
     // Messages
     if ($title->getNamespace() == NS_MEDIAWIKI) {
         MessageCache::singleton()->replace($title->getDBkey(), false);
         if ($wgContLang->hasVariants()) {
             $wgContLang->updateConversionTable($title);
         }
     }
     // Images
     if ($title->getNamespace() == NS_FILE) {
         DeferredUpdates::addUpdate(new HTMLCacheUpdate($title, 'imagelinks'));
     }
     // User talk pages
     if ($title->getNamespace() == NS_USER_TALK) {
         $user = User::newFromName($title->getText(), false);
         if ($user) {
             $user->setNewtalk(false);
         }
     }
     // Image redirects
     RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect($title);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:38,代码来源:WikiPage.php


示例15: wfEmptyMsg

/**
 * Since wfMsg() and co suck, they don't return false if the message key they
 * looked up didn't exist but instead the key wrapped in <>'s, this function checks for the
 * nonexistence of messages by checking the MessageCache::get() result directly.
 *
 * @deprecated since 1.18. Use Message::isDisabled().
 *
 * @param string $key The message key looked up
 * @return bool True if the message *doesn't* exist.
 */
function wfEmptyMsg($key)
{
    wfDeprecated(__METHOD__, '1.21');
    return MessageCache::singleton()->get($key, true, false) === false;
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:15,代码来源:GlobalFunctions.php


示例16:

<?php

/**
 * Bootstrapping for MediaWiki PHPUnit tests
 * This file is included by phpunit and is NOT in the global scope.
 *
 * @file
 */
if (!defined('MW_PHPUNIT_TEST')) {
    echo <<<EOF
You are running these tests directly from phpunit. You may not have all globals correctly set.
Running phpunit.php instead is recommended.
EOF;
    require_once __DIR__ . "/phpunit.php";
}
// Output a notice when running with older versions of PHPUnit
if (version_compare(PHPUnit_Runner_Version::id(), "3.6.7", "<")) {
    echo <<<EOF
********************************************************************************

These tests run best with version PHPUnit 3.6.7 or better. Earlier versions may
show failures because earlier versions of PHPUnit do not properly implement
dependencies.

********************************************************************************

EOF;
}
/** @todo Check if this is really needed */
MessageCache::destroyInstance();
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:30,代码来源:bootstrap.php


示例17: testNormalizeKey

 /**
  * @dataProvider provideNormalizeKey
  */
 public function testNormalizeKey($key, $expected)
 {
     $actual = MessageCache::normalizeKey($key);
     $this->assertEquals($expected, $actual);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:8,代码来源:MessageCacheTest.php


示例18: composeCommonMailtext

 /**
  * Generate the generic "this page has been changed" e-mail text.
  */
 private function composeCommonMailtext()
 {
     global $wgPasswordSender, $wgNoReplyAddress;
     global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
     global $wgEnotifImpersonal, $wgEnotifUseRealName;
     $this->composed_common = true;
     # You as the WikiAdmin and Sysops can make use of plenty of
     # named variables when composing your notification emails while
     # simply editing the Meta pages
     $keys = array();
     $postTransformKeys = array();
     $pageTitleUrl = $this->title->getCanonicalURL();
     $pageTitle = $this->title->getPrefixedText();
     if ($this->oldid) {
         // Always show a link to the diff which triggered the mail. See bug 32210.
         $keys['$NEWPAGE'] = "\n\n" . wfMessage('enotif_lastdiff', $this->title->getCanonicalURL(array('diff' => 'next', 'oldid' => $this->oldid)))->inContentLanguage()->text();
         if (!$wgEnotifImpersonal) {
             // For personal mail, also show a link to the diff of all changes
             // since last visited.
             $keys['$NEWPAGE'] .= "\n\n" . wfMessage('enotif_lastvisited', $this->title->getCanonicalURL(array('diff' => '0', 'oldid' => $this->oldid)))->inContentLanguage()->text();
         }
         $keys['$OLDID'] = $this->oldid;
         // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
         $keys['$CHANGEDORCREATED'] = wfMessage('changed')->inContentLanguage()->text();
     } else {
         # clear $OLDID placeholder in the message template
         $keys['$OLDID'] = '';
         $keys['$NEWPAGE'] = '';
         // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
         $keys['$CHANGEDORCREATED'] = wfMessage('created')->inContentLanguage()->text();
     }
     $keys['$PAGETITLE'] = $this->title->getPrefixedText();
     $keys['$PAGETITLE_URL'] = $this->title->getCanonicalURL();
     $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMessage('minoredit')->inContentLanguage()->text() : '';
     $keys['$UNWATCHURL'] = $this->title->getCanonicalURL('action=unwatch');
     if ($this->editor->isAnon()) {
         # real anon (user:xxx.xxx.xxx.xxx)
         $keys['$PAGEEDITOR'] = wfMessage('enotif_anon_editor', $this->editor->getName())->inContentLanguage()->text();
         $keys['$PAGEEDITOR_EMAIL'] = wfMessage('noemailtitle')->inContentLanguage()->text();
     } else {
         $keys['$PAGEEDITOR'] = $wgEnotifUseRealName && $this->editor->getRealName() !== '' ? $this->editor->getRealName() : $this->editor->getName();
         $emailPage = SpecialPage::getSafeTitleFor('Emailuser', $this->editor->getName());
         $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL();
     }
     $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalURL();
     $keys['$HELPPAGE'] = wfExpandUrl(Skin::makeInternalOrExternalUrl(wfMessage('helppage')->inContentLanguage()->text()));
     # Replace this after transforming the message, bug 35019
     $postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary;
     // Now build message's subject and body
     // Messages:
     // enotif_subject_deleted, enotif_subject_created, enotif_subject_moved,
     // enotif_subject_restored, enotif_subject_changed
     $this->subject = wfMessage('enotif_subject_' . $this->pageStatus)->inContentLanguage()->params($pageTitle, $keys['$PAGEEDITOR'])->text();
     // Messages:
     // enotif_body_intro_deleted, enotif_body_intro_created, enotif_body_intro_moved,
     // enotif_body_intro_restored, enotif_body_intro_changed
     $keys['$PAGEINTRO'] = wfMessage('enotif_body_intro_' . $this->pageStatus)->inContentLanguage()->params($pageTitle, $keys['$PAGEEDITOR'], $pageTitleUrl)->text();
     $body = wfMessage('enotif_body')->inContentLanguage()->plain();
     $body = strtr($body, $keys);
     $body = MessageCache::singleton()->transform($body, false, null, $this->title);
     $this->body = wordwrap(strtr($body, $postTransformKeys), 72);
     # Reveal the page editor's address as REPLY-TO address only if
     # the user has not opted-out and the option is enabled at the
     # global configuration level.
     $adminAddress = new MailAddress($wgPasswordSender, wfMessage('emailsender')->inContentLanguage()->text());
     if ($wgEnotifRevealEditorAddress && $this->editor->getEmail() != '' && $this->editor->getOption('enotifrevealaddr')) {
         $editorAddress = MailAddress::newFromUser($this->editor);
         if ($wgEnotifFromEditor) {
             $this->from = $editorAddress;
         } else {
             $this->from = $adminAddress;
             $this->replyto = $editorAddress;
         }
     } else {
         $this->from = $adminAddress;
         $this->replyto = new MailAddress($wgNoReplyAddress);
     }
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:81,代码来源:EmailNotification.php


示例19: addToSidebarPlain

 /**
  * Add content from plain text
  * @since 1.17
  * @param $bar array
  * @param $text string
  * @return Array
  */
 function addToSidebarPlain(&$bar, $text)
 {
     $lines = explode("\n", $text);
     $heading = '';
     foreach ($lines as $line) {
         if (strpos($line, '*') !== 0) {
             continue;
         }
         $line = rtrim($line, "\r");
         // for Windows compat
         if (strpos($line, '**') !== 0) {
             $heading = trim($line, '* ');
             if (!array_key_exists($heading, $bar)) {
                 $bar[$heading] = array();
             }
         } else {
             $line = trim($line, '* ');
             if (strpos($line, '|') !== false) {
                 // sanity check
                 $line = MessageCache::singleton()->transform($line, false, null, $this->getTitle());
                 $line = array_map('trim', explode('|', $line, 2));
                 if (count($line) !== 2) {
                     // Second sanity check, could be hit by people doing
                     // funky stuff with parserfuncs... (bug 33321)
                     continue;
                 }
                 $extraAttribs = array();
                 $msgLink = $this->msg($line[0])->inContentLanguage();
                 if ($msgLink->exists()) {
                     $link = $msgLink->text();
                     if ($link == '-') {
                         continue;
                     }
                 } else {
                     $link = $line[0];
                 }
                 $msgText = $this->msg($line[1]);
                 if ($msgText->exists()) {
                     $text = $msgText->text();
                 } else {
                     $text = $line[1];
                 }
                 if (preg_match('/^(?i:' . wfUrlProtocols() . ')/', $link)) {
                     $href = $link;
                     // Parser::getExternalLinkAttribs won't work here because of the Namespace things
                     global $wgNoFollowLinks, $wgNoFollowDomainExceptions;
                     if ($wgNoFollowLinks && !wfMatchesDomainList($href, $wgNoFollowDomainExceptions)) {
                         $extraAttribs['rel'] = 'nofollow';
                     }
                     global $wgExternalLinkTarget;
                     if ($wgExternalLinkTarget) {
                         $extraAttribs['target'] = $wgExternalLinkTarget;
                     }
                 } else {
                     $title = Title::newFromText($link);
                     if ($title) {
                         $title = $title->fixSpecialName();
                         $href = $title->getLinkURL();
                     } else {
                         $href = 'INVALID-TITLE';
                     }
                 }
                 $bar[$heading][] = array_merge(array('text' => $text, 'href' => $href, 'id' => 'n-' . Sanitizer::escapeId(strtr($line[1], ' ', '-'), 'noninitial'), 'active' => false), $extraAttribs);
             } else {
                 continue;
             }
         }
     }
     return $bar;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:77,代码来源:Skin.php


示例20: getPageLanguage

 /**
  * Get the language in which the content of this page is written.
  * Defaults to $wgContLang, but in certain cases it can be e.g.
  * $wgLang (such as special pages, which are in the user language).
  *
  * @since 1.18
  * @return object Language
  */
 public function getPageLanguage()
 {
     global $wgLang;
     if ($this->getNamespace() == NS_SPECIAL) {
         // special pages are in the user language
         return $wgLang;
     } elseif ($this->isRedirect()) {
         // the arrow on a redirect page is aligned according to the user language
         return $wgLang;
     } elseif ($this->isCssOrJsPage()) {
         // css/js should always be LTR and is, in fact, English
         return wfGetLangObj('en');
     } elseif ($this->getNamespace() == NS_MEDIAWIKI) {
         // Parse mediawiki messages with correct target language
         list(, $lang) = MessageCache::singleton()->figureMessage($this->getText());
         return wfGetLangObj($lang);
     }
     global $wgContLang;
     // If nothing special, it should be in the wiki content language
     $pageLang = $wgContLang;
     // Hook at the end because we don't want to override the above stuff
     wfRunHooks('PageContentLanguage', array($this, &$pageLang, $wgLang));
     return wfGetLangObj($pageLang);
 }
开发者ID:namrenni,项目名称:mediawiki,代码行数:32,代码来源:Title.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP MessageGroups类代码示例发布时间:2022-05-23
下一篇:
PHP MessageBox类代码示例发布时间: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