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

PHP wfGetLangObj函数代码示例

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

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



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

示例1: testGetPageLanguage

 /**
  * @dataProvider dataGetPageLanguage
  */
 public function testGetPageLanguage($title, $expected)
 {
     if (is_string($title)) {
         $title = Title::newFromText($title);
     }
     $expected = wfGetLangObj($expected);
     $handler = ContentHandler::getForTitle($title);
     $lang = $handler->getPageLanguage($title);
     $this->assertEquals($expected->getCode(), $lang->getCode());
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:13,代码来源:ContentHandlerTest.php


示例2: execute

 /**
  * Show the special page
  *
  * @param string $par Parameter passed to the page or null
  */
 public function execute($par)
 {
     $request = $this->getRequest();
     $out = $this->getOutput();
     $this->setHeaders();
     if (!$this->getConfig()->get('UseDatabaseMessages')) {
         $out->addWikiMsg('allmessagesnotsupportedDB');
         return;
     }
     $this->outputHeader('allmessagestext');
     $out->addModuleStyles('mediawiki.special');
     $this->table = new AllmessagesTablePager($this, array(), wfGetLangObj($request->getVal('lang', $par)));
     $this->langcode = $this->table->lang->getCode();
     $out->addHTML($this->table->buildForm());
     $out->addParserOutputContent($this->table->getFullOutput());
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:21,代码来源:SpecialAllMessages.php


示例3: execute

 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     $request = $this->getRequest();
     $out = $this->getOutput();
     $this->setHeaders();
     global $wgUseDatabaseMessages;
     if (!$wgUseDatabaseMessages) {
         $out->addWikiMsg('allmessagesnotsupportedDB');
         return;
     } else {
         $this->outputHeader('allmessagestext');
     }
     $out->addModuleStyles('mediawiki.special');
     $this->table = new AllmessagesTablePager($this, array(), wfGetLangObj($request->getVal('lang', $par)));
     $this->langcode = $this->table->lang->getCode();
     $out->addHTML($this->table->buildForm() . $this->table->getNavigationBar() . $this->table->getBody() . $this->table->getNavigationBar());
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:22,代码来源:SpecialAllmessages.php


示例4: execute

 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $this->setHeaders();
     global $wgUseDatabaseMessages;
     if (!$wgUseDatabaseMessages) {
         $wgOut->addWikiMsg('allmessagesnotsupportedDB');
         return;
     } else {
         $this->outputHeader('allmessagestext');
     }
     $this->filter = $wgRequest->getVal('filter', 'all');
     $this->prefix = $wgRequest->getVal('prefix', '');
     $this->table = new AllmessagesTablePager($this, $conds = array(), wfGetLangObj($wgRequest->getVal('lang', $par)));
     $this->langCode = $this->table->lang->getCode();
     $wgOut->addHTML($this->buildForm() . $this->table->getNavigationBar() . $this->table->getLimitForm() . $this->table->getBody() . $this->table->getNavigationBar());
 }
开发者ID:rocLv,项目名称:conference,代码行数:22,代码来源:SpecialAllmessages.php


示例5: executeIndex

 public function executeIndex()
 {
     global $wgRequest, $wgContLang;
     $day = $wgRequest->getVal('day');
     $type = $wgRequest->getVal('type');
     $lang = $wgRequest->getVal('lang', 'en');
     if ($type != 'views-digest' && $type != 'complete-digest') {
         $wgContLang = wfGetLangObj($lang);
     }
     if (!empty($day)) {
         $this->previewBody = F::app()->renderView("FounderEmails", $day, array('language' => $lang));
         $this->previewBody = strtr($this->previewBody, array('$USERNAME' => 'UserName', '$WIKINAME' => '<a href="#" style="color:#2C85D5;">WikiName</a>', '$HDWIKINAME' => '<a href="#" style="color:#fa5c1f;">WikiName</a>', '$UNIQUEVIEWS' => '6'));
     } else {
         if (!empty($type)) {
             $this->previewBody = F::app()->renderView("FounderEmails", 'GeneralUpdate', array('type' => $type, 'language' => $lang, '$PAGEURL' => 'http://www.wikia.com', '$MYHOMEURL' => 'http://www.wikia.com', '$UNIQUEVIEWS' => '1', '$USEREDITS' => '2', '$USERJOINS' => '3', '$EDITORTALKPAGEURL' => 'http://www.wikia.com'));
             $this->previewBody = strtr($this->previewBody, array('$USERNAME' => 'UserName', '$WIKINAME' => '<a href="#" style="color:#2C85D5;">WikiName</a>', '$PAGETITLE' => '<a href="#" style="color:#2C85D5;">PageTitle</a>', '$EDITORNAME' => '<a href="#" style="color:#2C85D5;">EditorName</a>'));
         }
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:19,代码来源:FounderEmailsController.class.php


示例6: getPageViewLanguage

 /**
  * Get the language in which the content of this page is written when
  * viewed by user. 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.20
  * @return Language
  */
 public function getPageViewLanguage()
 {
     global $wgLang;
     if ($this->isSpecialPage()) {
         // If the user chooses a variant, the content is actually
         // in a language whose code is the variant code.
         $variant = $wgLang->getPreferredVariant();
         if ($wgLang->getCode() !== $variant) {
             return Language::factory($variant);
         }
         return $wgLang;
     }
     // Checking if DB language is set
     $dbPageLanguage = $this->getDbPageLanguageCode();
     if ($dbPageLanguage) {
         $pageLang = wfGetLangObj($dbPageLanguage);
         $variant = $pageLang->getPreferredVariant();
         if ($pageLang->getCode() !== $variant) {
             $pageLang = Language::factory($variant);
         }
         return $pageLang;
     }
     // @note Can't be cached persistently, depends on user settings.
     // @note ContentHandler::getPageViewLanguage() may need to load the
     //   content to determine the page language!
     $contentHandler = ContentHandler::getForTitle($this);
     $pageLang = $contentHandler->getPageViewLanguage($this);
     return $pageLang;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:37,代码来源:Title.php


示例7: getJsData

 /**
  * Returns an array of config data for this filter to be stored in the JS
  * @return null
  */
 public function getJsData()
 {
     global $wgAmericanDates;
     return $this->getParamHashes($this->getQueryResults(), $this->getActualParameters()) + array('firstDay' => $wgAmericanDates ? '0' : wfMsg('srf-filtered-firstdayofweek'), 'isRTL' => wfGetLangObj(true)->isRTL());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:9,代码来源:SRF_FV_Calendar.php


示例8: getInstance

 /**
  * Get a DateFormatter object
  *
  * @param Language|string|null $lang In which language to format the date
  * 		Defaults to the site content language
  * @return DateFormatter
  */
 public static function getInstance($lang = null)
 {
     global $wgContLang, $wgMainCacheType;
     $lang = $lang ? wfGetLangObj($lang) : $wgContLang;
     $cache = ObjectCache::getLocalServerInstance($wgMainCacheType);
     static $dateFormatter = false;
     if (!$dateFormatter) {
         $dateFormatter = $cache->getWithSetCallback($cache->makeKey('dateformatter', $lang->getCode()), $cache::TTL_HOUR, function () use($lang) {
             return new DateFormatter($lang);
         });
     }
     return $dateFormatter;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:20,代码来源:DateFormatter.php


示例9: getJsData

 /**
  * Returns an array of config data for this filter to be stored in the JS
  * @return null
  */
 public function getJsData()
 {
     global $wgAmericanDates;
     return $this->getParamHashes($this->getQueryResults(), $this->getActualParameters()) + array('firstDay' => $wgAmericanDates ? '0' : Message::newFromKey('srf-filtered-firstdayofweek')->inContentLanguage()->text(), 'isRTL' => wfGetLangObj(true)->isRTL());
 }
开发者ID:cicalese,项目名称:SemanticResultFormats,代码行数:9,代码来源:SRF_FV_Calendar.php


示例10: getPageViewLanguage

 /**
  * Returns the english language, because CSS is english, and should be handled as such.
  *
  * @param Title $title
  * @param Content $content
  * @return Language wfGetLangObj( 'en' )
  *
  * @see ContentHandler::getPageViewLanguage()
  */
 public function getPageViewLanguage(Title $title, Content $content = null)
 {
     return wfGetLangObj('en');
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:13,代码来源:CssContentHandler.php


示例11: doEditSectionLink

 /**
  * Create a section edit link.  This supersedes editSectionLink() and
  * editSectionLinkForOther().
  *
  * @param $nt      Title  The title being linked to (may not be the same as
  *   $wgTitle, if the section is included from a template)
  * @param string $section The designation of the section being pointed to,
  *   to be included in the link, like "&section=$section"
  * @param string $tooltip The tooltip to use for the link: will be escaped
  *   and wrapped in the 'editsectionhint' message
  * @param $lang    string Language code
  * @return         string HTML to use for edit link
  */
 public function doEditSectionLink(Title $nt, $section, $tooltip = null, $lang = false)
 {
     // HTML generated here should probably have userlangattributes
     // added to it for LTR text on RTL pages
     $lang = wfGetLangObj($lang);
     $attribs = array();
     if (!is_null($tooltip)) {
         # Bug 25462: undo double-escaping.
         $tooltip = Sanitizer::decodeCharReferences($tooltip);
         $attribs['title'] = wfMessage('editsectionhint')->rawParams($tooltip)->inLanguage($lang)->text();
     }
     $link = Linker::link($nt, wfMessage('editsection')->inLanguage($lang)->text(), $attribs, array('action' => 'edit', 'section' => $section), array('noclasses', 'known'));
     # Run the old hook.  This takes up half of the function . . . hopefully
     # we can rid of it someday.
     $attribs = '';
     if ($tooltip) {
         $attribs = wfMessage('editsectionhint')->rawParams($tooltip)->inLanguage($lang)->escaped();
         $attribs = " title=\"{$attribs}\"";
     }
     $result = null;
     wfRunHooks('EditSectionLink', array(&$this, $nt, $section, $attribs, $link, &$result, $lang));
     if (!is_null($result)) {
         # For reverse compatibility, add the brackets *after* the hook is
         # run, and even add them to hook-provided text.  (This is the main
         # reason that the EditSectionLink hook is deprecated in favor of
         # DoEditSectionLink: it can't change the brackets or the span.)
         $result = wfMessage('editsection-brackets')->rawParams($result)->inLanguage($lang)->escaped();
         return "<span class=\"editsection\">{$result}</span>";
     }
     # Add the brackets and the span, and *then* run the nice new hook, with
     # clean and non-redundant arguments.
     $result = wfMessage('editsection-brackets')->rawParams($link)->inLanguage($lang)->escaped();
     $result = "<span class=\"editsection\">{$result}</span>";
     wfRunHooks('DoEditSectionLink', array($this, $nt, $section, $tooltip, &$result, $lang));
     return $result;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:49,代码来源:Skin.php


示例12: 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 &#160; 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


示例13: doEditSectionLink

	/**
	 * Create a section edit link.  This supersedes editSectionLink() and
	 * editSectionLinkForOther().
	 *
	 * @param $nt      Title  The title being linked to (may not be the same as
	 *   $wgTitle, if the section is included from a template)
	 * @param string $section The designation of the section being pointed to,
	 *   to be included in the link, like "&section=$section"
	 * @param string $tooltip The tooltip to use for the link: will be escaped
	 *   and wrapped in the 'editsectionhint' message
	 * @param $lang    string Language code
	 * @return         string HTML to use for edit link
	 */
	public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) {
		// HTML generated here should probably have userlangattributes
		// added to it for LTR text on RTL pages

		$lang = wfGetLangObj( $lang );

		$attribs = array();
		if ( !is_null( $tooltip ) ) {
			# Bug 25462: undo double-escaping.
			$tooltip = Sanitizer::decodeCharReferences( $tooltip );
			$attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
				->inLanguage( $lang )->text();
		}
		$link = Linker::link( $nt, wfMessage( 'editsection' )->inLanguage( $lang )->text(),
			$attribs,
			array( 'action' => 'edit', 'section' => $section ),
			array( 'noclasses', 'known' )
		);

		# Add the brackets and the span and run the hook.
		$result = '<span class="mw-editsection">'
			. '<span class="mw-editsection-bracket">[</span>'
			. $link
			. '<span class="mw-editsection-bracket">]</span>'
			. '</span>';

		wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
		return $result;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:42,代码来源:Skin.php


示例14: getPreviewText

 /**
  * Get the rendered text for previewing.
  * @return string
  */
 function getPreviewText()
 {
     global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang, $wgMessageCache;
     wfProfileIn(__METHOD__);
     if ($this->mTriedSave && !$this->mTokenOk) {
         if ($this->mTokenOkExceptSuffix) {
             $note = wfMsg('token_suffix_mismatch');
         } else {
             $note = wfMsg('session_fail_preview');
         }
     } else {
         $note = wfMsg('previewnote');
     }
     $parserOptions = ParserOptions::newFromUser($wgUser);
     $parserOptions->setEditSection(false);
     $parserOptions->setIsPreview(true);
     $parserOptions->setIsSectionPreview(!is_null($this->section) && $this->section !== '');
     global $wgRawHtml;
     if ($wgRawHtml && !$this->mTokenOk) {
         // Could be an offsite preview attempt. This is very unsafe if
         // HTML is enabled, as it could be an attack.
         return $wgOut->parse("<div class='previewnote'>" . wfMsg('session_fail_preview_html') . "</div>");
     }
     # don't parse user css/js, show message about preview
     # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here
     if ($this->isCssJsSubpage) {
         if (preg_match("/\\.css\$/", $this->mTitle->getText())) {
             $previewtext = wfMsg('usercsspreview');
         } else {
             if (preg_match("/\\.js\$/", $this->mTitle->getText())) {
                 $previewtext = wfMsg('userjspreview');
             }
         }
         $parserOptions->setTidy(true);
         $parserOutput = $wgParser->parse($previewtext, $this->mTitle, $parserOptions);
         $previewHTML = $parserOutput->mText;
     } elseif ($rt = Title::newFromRedirectArray($this->textbox1)) {
         $previewHTML = $this->mArticle->viewRedirect($rt, false);
     } else {
         $toparse = $this->textbox1;
         # If we're adding a comment, we need to show the
         # summary as the headline
         if ($this->section == "new" && $this->summary != "") {
             $toparse = "== {$this->summary} ==\n\n" . $toparse;
         }
         if ($this->mMetaData != "") {
             $toparse .= "\n" . $this->mMetaData;
         }
         // Parse mediawiki messages with correct target language
         if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
             list(, $lang) = $wgMessageCache->figureMessage($this->mTitle->getText());
             $obj = wfGetLangObj($lang);
             $parserOptions->setTargetLanguage($obj);
         }
         $parserOptions->setTidy(true);
         $parserOptions->enableLimitReport();
         $parserOutput = $wgParser->parse($this->mArticle->preSaveTransform($toparse), $this->mTitle, $parserOptions);
         $previewHTML = $parserOutput->getText();
         $this->mParserOutput = $parserOutput;
         $wgOut->addParserOutputNoText($parserOutput);
         if (count($parserOutput->getWarnings())) {
             $note .= "\n\n" . implode("\n\n", $parserOutput->getWarnings());
         }
     }
     $previewhead = '<h2>' . htmlspecialchars(wfMsg('preview')) . "</h2>\n" . "<div class='previewnote'>" . $wgOut->parse($note) . "</div>\n";
     if ($this->isConflict) {
         $previewhead .= '<h2>' . htmlspecialchars(wfMsg('previewconflict')) . "</h2>\n";
     }
     wfProfileOut(__METHOD__);
     return $previewhead . $previewHTML;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:75,代码来源:EditPage.php


示例15: get

 /**
  * Get a message from either the content language or the user language.
  *
  * @param string $key The message cache key
  * @param bool $useDB Get the message from the DB, false to use only the localisation
  * @param string $langcode Code of the language to get the message for, if
  *                         it is a valid code create a language for that
  *                         language, if it is a string but not a valid code
  *                         then make a basic language object, if it is a
  *                         false boolean then use the current users
  *                         language (as a fallback for the old parameter
  *                         functionality), or if it is a true boolean then
  *                         use the wikis content language (also as a
  *                         fallback).
  * @param bool $isFullKey Specifies whether $key is a two part key "lang/msg".
  */
 function get($key, $useDB = true, $langcode = true, $isFullKey = false)
 {
     global $wgContLanguageCode, $wgContLang;
     $lang = wfGetLangObj($langcode);
     $langcode = $lang->getCode();
     # If uninitialised, someone is trying to call this halfway through Setup.php
     if (!$this->mInitialised) {
         return '&lt;' . htmlspecialchars($key) . '&gt;';
     }
     $message = false;
     # Normalise title-case input
     $lckey = $wgContLang->lcfirst($key);
     $lckey = str_replace(' ', '_', $lckey);
     # Try the MediaWiki namespace
     if (!$this->mDisable && $useDB) {
         $title = $wgContLang->ucfirst($lckey);
         if (!$isFullKey && $langcode != $wgContLanguageCode) {
             $title .= '/' . $langcode;
         }
         $message = $this->getMsgFromNamespace($title, $langcode);
     }
     # Try the extension array
     if ($message === false && isset($this->mExtensionMessages[$langcode][$lckey])) {
         $message = $this->mExtensionMessages[$langcode][$lckey];
     }
     if ($message === false && isset($this->mExtensionMessages['en'][$lckey])) {
         $message = $this->mExtensionMessages['en'][$lckey];
     }
     # Try the array in the language object
     if ($message === false) {
         $message = $lang->getMessage($lckey);
         if (is_null($message)) {
             $message = false;
         }
     }
     # Try the array of another language
     $pos = strrpos($lckey, '/');
     if ($message === false && $pos !== false) {
         $mkey = substr($lckey, 0, $pos);
         $code = substr($lckey, $pos + 1);
         if ($code) {
             # We may get calls for things that are http-urls from sidebar
             # Let's not load nonexistent languages for those
             $validCodes = array_keys(Language::getLanguageNames());
             if (in_array($code, $validCodes)) {
                 $message = Language::getMessageFor($mkey, $code);
                 if (is_null($message)) {
                     $message = false;
                 }
             }
         }
     }
     # Is this a custom message? Try the default language in the db...
     if (($message === false || $message === '-') && !$this->mDisable && $useDB && !$isFullKey && $langcode != $wgContLanguageCode) {
         $message = $this->getMsgFromNamespace($wgContLang->ucfirst($lckey), $wgContLanguageCode);
     }
     # Final fallback
     if ($message === false) {
         return '&lt;' . htmlspecialchars($key) . '&gt;';
     }
     return $message;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:78,代码来源:MessageCache.php


示例16: getPageLanguage

 /**
  * Get the language in which the content of this page is written in
  * wikitext. 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 Language
  */
 public function getPageLanguage()
 {
     global $wgLang;
     if ($this->isSpecialPage()) {
         // special pages are in the user language
         return $wgLang;
     }
     //TODO: use the LinkCache to cache this! Note that this may depend on user settings, so the cache should be only per-request.
     //NOTE: ContentHandler::getPageLanguage() may need to load the content to determine the page language!
     $contentHandler = ContentHandler::getForTitle($this);
     $pageLang = $contentHandler->getPageLanguage($this);
     return wfGetLangObj($pageLang);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:21,代码来源:Title.php


示例17: getPageLanguage

 /**
  * Get the language in which the content of the given page is written.
  *
  * This default implementation just returns $wgContLang (except for pages
  * in the MediaWiki namespace)
  *
  * Note that the pages language is not cacheable, since it may in some
  * cases depend on user settings.
  *
  * Also note that the page language may or may not depend on the actual content of the page,
  * that is, this method may load the content in order to determine the language.
  *
  * @since 1.21
  *
  * @param Title $title The page to determine the language for.
  * @param Content $content The page's content, if you have it handy, to avoid reloading it.
  *
  * @return Language The page's language
  */
 public function getPageLanguage(Title $title, Content $content = null)
 {
     global $wgContLang, $wgLang;
     $pageLang = $wgContLang;
     if ($title->getNamespace() == NS_MEDIAWIKI) {
         // Parse mediawiki messages with correct target language
         list(, $lang) = MessageCache::singleton()->figureMessage($title->getText());
         $pageLang = wfGetLangObj($lang);
     }
     wfRunHooks('PageContentLanguage', array($title, &$pageLang, $wgLang));
     return wfGetLangObj($pageLang);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:31,代码来源:ContentHandler.php


示例18: resolveMessagesPattern

 /**
  * Return list of messages matching given pattern
  *
  * Example: 'feature-foo-*'
  *
  * @param string $pattern - pattern to match against ALL messages in the system
  * @return array - key/value list of matching messages
  */
 private static function resolveMessagesPattern($pattern)
 {
     $fname = __METHOD__ . "::{$pattern}";
     wfProfileIn($fname);
     self::log(__METHOD__, $pattern);
     $pattern = substr($pattern, 0, -1);
     $patternLen = strlen($pattern);
     // get list of all messages loaded by MW
     $lang = wfGetLangObj(false);
     $langCode = $lang->getCode();
     if ($lang instanceof StubUserLang) {
         $lang = $lang->_newObject();
     }
     $messageKeys = self::getAllMessageKeys($lang);
     $ret = array();
     foreach ($messageKeys as $msg) {
         if (is_array($msg)) {
             var_dump($msg);
         }
         if (substr($msg, 0, $patternLen) === $pattern) {
             $ret[$msg] = wfmsgExt($msg, array('language' => $langCode));
         }
     }
     wfProfileOut($fname);
     return $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:JSMessages.class.php


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


示例20: adder

 /**
  * @param $source jQuery selector for element containing the source
  * @param $lang Language code or object
  * @return string
  */
 public function adder($source, $lang)
 {
     if (!$this->editMode) {
         return '';
     }
     $target = self::jQueryPathId($this->getTextareaId());
     $source = self::jQueryPathId($source);
     $dir = wfGetLangObj($lang)->getDir();
     $params = array('onclick' => "jQuery({$target}).val(jQuery({$source}).text()).focus(); return false;", 'href' => '#', 'title' => wfMsg('translate-use-suggestion'), 'class' => 'mw-translate-adder mw-translate-adder-' . $dir);
     return Html::element('a', $params, '↓');
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:TranslationHelpers.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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