From f84493db51656cee37c2d9f4f06ce80313198017 Mon Sep 17 00:00:00 2001 From: Zheng Zhu Date: Fri, 24 Sep 2004 13:14:52 +0000 Subject: [PATCH] First batch of files modified to switch wgLang to wgContLang. --- includes/Article.php | 16 +++++----- includes/CacheManager.php | 4 +-- includes/CategoryPage.php | 14 ++++----- includes/DifferenceEngine.php | 4 +-- includes/EditPage.php | 14 ++++----- includes/Feed.php | 8 ++--- includes/ImageGallery.php | 4 +-- includes/ImagePage.php | 6 ++-- includes/MagicWord.php | 4 +-- includes/Metadata.php | 8 ++--- includes/OutputPage.php | 20 ++++++------ includes/PageHistory.php | 6 ++-- includes/Parser.php | 46 +++++++++++++-------------- includes/RawPage.php | 6 ++-- includes/Setup.php | 59 ++++++++++++++++++++--------------- 15 files changed, 113 insertions(+), 106 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 402ca81468..7dc3727662 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -738,7 +738,7 @@ class Article { * the given title. */ function view() { - global $wgUser, $wgOut, $wgLang, $wgRequest, $wgOnlySysopsCanPatrol; + global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol; global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol; $sk = $wgUser->getSkin(); @@ -1268,7 +1268,7 @@ class Article { * Add or remove this page to my watchlist based on value of $add */ function watch( $add = true ) { - global $wgUser, $wgOut, $wgLang; + global $wgUser, $wgOut; global $wgDeferredUpdateList; if ( 0 == $wgUser->getID() ) { @@ -1597,7 +1597,7 @@ class Article { * Perform a deletion and output success or failure messages */ function doDelete( $reason ) { - global $wgOut, $wgUser, $wgLang; + global $wgOut, $wgUser, $wgContLang; $fname = 'Article::doDelete'; wfDebug( $fname."\n" ); @@ -1608,8 +1608,8 @@ class Article { $wgOut->setRobotpolicy( 'noindex,nofollow' ); $sk = $wgUser->getSkin(); - $loglink = $sk->makeKnownLink( $wgLang->getNsText( NS_PROJECT ) . - ':' . wfMsg( 'dellogpage' ), wfMsg( 'deletionlog' ) ); + $loglink = $sk->makeKnownLink( $wgContLang->getNsText( NS_PROJECT ) . + ':' . wfMsgForContent( 'dellogpage' ), wfMsg( 'deletionlog' ) ); $text = wfMsg( 'deletedtext', $deleted, $loglink ); @@ -1626,7 +1626,7 @@ class Article { * Returns success */ function doDeleteArticle( $reason ) { - global $wgUser, $wgLang; + global $wgUser; global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer; $fname = 'Article::doDeleteArticle'; @@ -1747,7 +1747,7 @@ class Article { * Revert a modification */ function rollback() { - global $wgUser, $wgLang, $wgOut, $wgRequest; + global $wgUser, $wgOut, $wgRequest; $fname = 'Article::rollback'; if ( ! $wgUser->isSysop() ) { @@ -2160,7 +2160,7 @@ class Article { * Info about this page */ function info() { - global $wgUser, $wgTitle, $wgOut, $wgLang, $wgAllowPageInfo; + global $wgUser, $wgTitle, $wgOut, $wgAllowPageInfo; $fname = 'Article::info'; if ( !$wgAllowPageInfo ) { diff --git a/includes/CacheManager.php b/includes/CacheManager.php index 1a5711be11..ab6c66d5e4 100644 --- a/includes/CacheManager.php +++ b/includes/CacheManager.php @@ -31,11 +31,11 @@ class CacheManager { } function fileCacheName() { - global $wgFileCacheDirectory, $wgLang; + global $wgFileCacheDirectory, $wgContLang; if( !$this->mFileCache ) { $hash = md5( $key = $this->mTitle->getDbkey() ); if( $this->mTitle->getNamespace() ) - $key = $wgLang->getNsText( $this->mTitle->getNamespace() ) . ":" . $key; + $key = $wgContLang->getNsText( $this->mTitle->getNamespace() ) . ":" . $key; $key = str_replace( '.', '%2E', urlencode( $key ) ); $hash1 = substr( $hash, 0, 1 ); diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 5070c1bde7..cd864e7104 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -50,7 +50,7 @@ class CategoryPage extends Article { # This method generates the list of subcategories and pages for a category function oldCategoryMagic () { - global $wgLang, $wgUser ; + global $wgContLang, $wgUser ; $fname = 'CategoryPage::oldCategoryMagic'; @@ -73,7 +73,7 @@ class CategoryPage extends Article { # For all pages that link to this category while ( $x = $dbr->fetchObject ( $res ) ) { - $t = $wgLang->getNsText ( $x->cur_namespace ) ; + $t = $wgContLang->getNsText ( $x->cur_namespace ) ; if ( $t != '' ) $t .= ':' ; $t .= $x->cur_title ; @@ -103,7 +103,7 @@ class CategoryPage extends Article { } function newCategoryMagic () { - global $wgLang,$wgUser; + global $wgContLang,$wgUser; $sk =& $wgUser->getSkin(); @@ -127,7 +127,7 @@ class CategoryPage extends Article { $res = $dbr->query ( $sql ) ; while ( $x = $dbr->fetchObject ( $res ) ) { - $t = $ns = $wgLang->getNsText ( $x->cur_namespace ) ; + $t = $ns = $wgContLang->getNsText ( $x->cur_namespace ) ; if ( $t != '' ) $t .= ':' ; $t .= $x->cur_title ; @@ -140,13 +140,13 @@ class CategoryPage extends Article { // Workaround: If sortkey == "Category:".$title, than use $title for sorting, // else use sortkey... if ( ($ns.':'.$ctitle) == $x->cl_sortkey ) { - array_push ( $children_start_char, $wgLang->firstChar( $x->cur_title ) ); + array_push ( $children_start_char, $wgContLang->firstChar( $x->cur_title ) ); } else { - array_push ( $children_start_char, $wgLang->firstChar( $x->cl_sortkey ) ) ; + array_push ( $children_start_char, $wgContLang->firstChar( $x->cl_sortkey ) ) ; } } else { array_push ( $articles , $sk->makeKnownLink ( $t ) ) ; # Page in this category - array_push ( $articles_start_char, $wgLang->firstChar( $x->cl_sortkey ) ) ; + array_push ( $articles_start_char, $wgContLang->firstChar( $x->cl_sortkey ) ) ; } } $dbr->freeResult ( $res ) ; diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 52bf654d77..198c9b3931 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -58,7 +58,7 @@ class DifferenceEngine { function showDiffPage() { - global $wgUser, $wgTitle, $wgOut, $wgLang, $wgOnlySysopsCanPatrol, $wgUseRCPatrol; + global $wgUser, $wgTitle, $wgOut, $wgContLang, $wgOnlySysopsCanPatrol, $wgUseRCPatrol; $fname = 'DifferenceEngine::showDiffPage'; wfProfileIn( $fname ); @@ -102,7 +102,7 @@ class DifferenceEngine { } $sk = $wgUser->getSkin(); - $talk = $wgLang->getNsText( NS_TALK ); + $talk = $wgContLang->getNsText( NS_TALK ); $contribs = wfMsg( 'contribslink' ); $this->mOldComment = $sk->formatComment($this->mOldComment); diff --git a/includes/EditPage.php b/includes/EditPage.php index 1fb7925a7f..67ea7ca700 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -122,7 +122,7 @@ class EditPage { */ function editForm( $formtype ) { global $wgOut, $wgUser; - global $wgLang, $wgParser, $wgTitle; + global $wgLang, $wgContLang, $wgParser, $wgTitle; global $wgAllowAnonymousMinor; global $wgWhitelistEdit; global $wgSpamRegex, $wgFilterCallback; @@ -430,7 +430,7 @@ class EditPage { # if this is a comment, show a subject line at the top, which is also the edit summary. # Otherwise, show a summary field at the bottom - $summarytext = htmlspecialchars( $wgLang->recodeForEdit( $this->summary ) ); # FIXME + $summarytext = htmlspecialchars( $wgContLang->recodeForEdit( $this->summary ) ); # FIXME if( $this->section == 'new' ) { $commentsubject="{$subject}:
"; $editsummary = ''; @@ -470,7 +470,7 @@ enctype=\"application/x-www-form-urlencoded\"> {$commentsubject}
{$editsummary} @@ -493,7 +493,7 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . $wgOut->addHTML( "

" . wfMsg( "yourtext" ) . "

" ); } @@ -508,7 +508,7 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . * @todo document */ function blockedIPpage() { - global $wgOut, $wgUser, $wgLang, $wgIP; + global $wgOut, $wgUser, $wgContLang, $wgIP; $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) ); $wgOut->setRobotpolicy( 'noindex,nofollow' ); @@ -523,7 +523,7 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . } else { $name = $id; } - $link = '[[' . $wgLang->getNsText( Namespace::getUser() ) . + $link = '[[' . $wgContLang->getNsText( Namespace::getUser() ) . ":{$name}|{$name}]]"; $wgOut->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) ); @@ -534,7 +534,7 @@ htmlspecialchars( $wgLang->recodeForEdit( $this->textbox1 ) ) . * @todo document */ function userNotLoggedInPage() { - global $wgOut, $wgUser, $wgLang; + global $wgOut, $wgUser; $wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) ); $wgOut->setRobotpolicy( 'noindex,nofollow' ); diff --git a/includes/Feed.php b/includes/Feed.php index f154c861bc..3ac7fe3392 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -60,10 +60,10 @@ class FeedItem { * @todo document */ function xmlEncode( $string ) { - global $wgInputEncoding, $wgLang; + global $wgInputEncoding, $wgContLang; $string = str_replace( "\r\n", "\n", $string ); if( strcasecmp( $wgInputEncoding, 'utf-8' ) != 0 ) { - $string = $wgLang->iconv( $wgInputEncoding, 'utf-8', $string ); + $string = $wgContLang->iconv( $wgInputEncoding, 'utf-8', $string ); } return htmlspecialchars( $string ); } @@ -84,8 +84,8 @@ class FeedItem { * @todo document */ function getLanguage() { - global $wgLanguageCode; - return $wgLanguageCode; + global $wgContLanguageCode; + return $wgContLanguageCode; } /** * @todo document diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index d4384289e0..d29cf0d07e 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -27,7 +27,7 @@ class ImageGallery } function toHTML() { - global $wgLang, $wgUser; + global $wgLang, $wgContLang, $wgUser; $sk = $wgUser->getSkin(); @@ -41,7 +41,7 @@ class ImageGallery $nt = $img->getTitle(); //TODO - //$ul = $sk->makeLink( $wgLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut ); + //$ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut ); $ilink = '' . $nt->getText() . ''; $nb = wfMsg( "nbytes", $wgLang->formatNum( $img->getSize() ) ); diff --git a/includes/ImagePage.php b/includes/ImagePage.php index c717ce54d3..1668197732 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -192,7 +192,7 @@ class ImagePage extends Article { function doDelete() { - global $wgOut, $wgUser, $wgLang, $wgRequest; + global $wgOut, $wgUser, $wgContLang, $wgRequest; global $wgUseSquid, $wgInternalServer, $wgDeferredUpdateList; $fname = 'ImagePage::doDelete'; @@ -253,7 +253,7 @@ class ImagePage extends Article { # Image itself is now gone, and database is cleaned. # Now we remove the image description page. - $nt = Title::newFromText( $wgLang->getNsText( Namespace::getImage() ) . ":" . $image ); + $nt = Title::newFromText( $wgContLang->getNsText( Namespace::getImage() ) . ":" . $image ); $article = new Article( $nt ); $article->doDeleteArticle( $reason ); # ignore errors @@ -264,7 +264,7 @@ class ImagePage extends Article { $wgOut->setRobotpolicy( 'noindex,nofollow' ); $sk = $wgUser->getSkin(); - $loglink = $sk->makeKnownLink( $wgLang->getNsText( + $loglink = $sk->makeKnownLink( $wgContLang->getNsText( Namespace::getWikipedia() ) . ':' . wfMsg( 'dellogpage' ), wfMsg( 'deletionlog' ) ); diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 0508f96155..4651ba8212 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -116,9 +116,9 @@ class MagicWord { # Initialises this object with an ID function load( $id ) { - global $wgLang; + global $wgContLang; $this->mId = $id; - $wgLang->getMagic( $this ); + $wgContLang->getMagic( $this ); } /** diff --git a/includes/Metadata.php b/includes/Metadata.php index 4b1c6bcd54..57768b71f6 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -117,11 +117,11 @@ function dcEpilogue() { * @private */ function dcBasics($article) { - global $wgLanguageCode, $wgSitename; + global $wgContLanguageCode, $wgSitename; dcElement('title', $article->mTitle->getText()); dcPageOrString('publisher', wfMsg('aboutpage'), $wgSitename); - dcElement('language', $wgLanguageCode); + dcElement('language', $wgContLanguageCode); dcElement('type', 'Text'); dcElement('format', 'text/html'); dcElement('identifier', dcReallyFullUrl($article->mTitle)); @@ -271,7 +271,7 @@ function dcUrl($name, $url) { * @private */ function dcPerson($name, $id, $user_name='', $user_real_name='') { - global $wgLang; + global $wgContLang; if ($id == 0) { dcElement($name, wfMsg('anonymous')); @@ -282,7 +282,7 @@ function dcPerson($name, $id, $user_name='', $user_real_name='') { if( empty( $user_name ) ) { $user_name = User::whoIs($id); } - dcPageOrString($name, $wgLang->getNsText(NS_USER) . ':' . $user_name, wfMsg('siteuser', $user_name)); + dcPageOrString($name, $wgContLang->getNsText(NS_USER) . ':' . $user_name, wfMsg('siteuser', $user_name)); } } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index dcfe19f2d1..3f21307dd8 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -407,11 +407,11 @@ class OutputPage { } function out( $ins ) { - global $wgInputEncoding, $wgOutputEncoding, $wgLang; + global $wgInputEncoding, $wgOutputEncoding, $wgContLang; if ( 0 == strcmp( $wgInputEncoding, $wgOutputEncoding ) ) { $outs = $ins; } else { - $outs = $wgLang->iconv( $wgInputEncoding, $wgOutputEncoding, $ins ); + $outs = $wgContLang->iconv( $wgInputEncoding, $wgOutputEncoding, $ins ); if ( false === $outs ) { $outs = $ins; } } print $outs; @@ -419,12 +419,12 @@ class OutputPage { function setEncodings() { global $wgInputEncoding, $wgOutputEncoding; - global $wgUser, $wgLang; + global $wgUser, $wgContLang; $wgInputEncoding = strtolower( $wgInputEncoding ); if( $wgUser->getOption( 'altencoding' ) ) { - $wgLang->setAltEncoding(); + $wgContLang->setAltEncoding(); return; } @@ -550,7 +550,7 @@ class OutputPage { } function loginToUse() { - global $wgUser, $wgTitle, $wgLang; + global $wgUser, $wgTitle, $wgContLang; $this->setPageTitle( wfMsg( 'loginreqtitle' ) ); $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); @@ -562,7 +562,7 @@ class OutputPage { # We put a comment in the .html file so a Sysop can diagnose the page the # user can't see. $this->addHTML( "\n' ); $this->returnToMain(); # Flip back to the main page after 10 seconds. @@ -705,8 +705,8 @@ class OutputPage { * @private */ function headElement() { - global $wgDocType, $wgDTD, $wgLanguageCode, $wgOutputEncoding, $wgMimeType; - global $wgUser, $wgLang, $wgRequest; + global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType; + global $wgUser, $wgContLang, $wgRequest; $xml = ($wgMimeType == 'text/xml'); if( $xml ) { @@ -725,8 +725,8 @@ class OutputPage { } else { $xmlbits = ''; } - $rtl = $wgLang->isRTL() ? " dir='RTL'" : ''; - $ret .= "\n"; + $rtl = $wgContLang->isRTL() ? " dir='RTL'" : ''; + $ret .= "\n"; $ret .= "\n" . htmlspecialchars( $this->mHTMLtitle ) . "\n"; array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) ); diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 2bc77a8c03..f0c8a8aa27 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -144,7 +144,7 @@ class PageHistory { } function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor, $counter = '' ) { - global $wgLang; + global $wgLang, $wgContLang; $artname = Title::makeName( $ns, $ttl ); $last = wfMsg( 'last' ); @@ -167,10 +167,10 @@ class PageHistory { $link = $this->mSkin->makeKnownLink( $artname, $dt, $q ); if ( 0 == $u ) { - $ul = $this->mSkin->makeKnownLink( $wgLang->specialPage( 'Contributions' ), + $ul = $this->mSkin->makeKnownLink( $wgContLang->specialPage( 'Contributions' ), htmlspecialchars( $ut ), 'target=' . urlencode( $ut ) ); } else { - $ul = $this->mSkin->makeLink( $wgLang->getNsText( + $ul = $this->mSkin->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ':'.$ut , htmlspecialchars( $ut ) ); } diff --git a/includes/Parser.php b/includes/Parser.php index 999250cdfb..c575cdab0b 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1060,7 +1060,7 @@ class Parser * @access private */ function replaceInternalLinks( $s ) { - global $wgLang, $wgLinkCache; + global $wgLang, $wgContLang, $wgLinkCache; global $wgNamespacesWithSubpages; static $fname = 'Parser::replaceInternalLinks' ; wfProfileIn( $fname ); @@ -1084,7 +1084,7 @@ class Parser # e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched static $e2 = '/^(.*?)([a-zA-Z\x80-\xff]+)$/sD'; - $useLinkPrefixExtension = $wgLang->linkPrefixExtension(); + $useLinkPrefixExtension = $wgContLang->linkPrefixExtension(); # Special and Media are pseudo-namespaces; no pages actually exist in them $nottalk = !Namespace::isTalk( $this->mTitle->getNamespace() ); @@ -1185,7 +1185,7 @@ class Parser if( $noforce ) { # Interwikis - if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgLang->getLanguageName( $iw ) ) { + if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgContLang->getLanguageName( $iw ) ) { array_push( $this->mOutput->mLanguageLinks, $nt->getFullText() ); $tmp = $prefix . $trail ; $s .= (trim($tmp) == '')? '': $tmp; @@ -1492,32 +1492,32 @@ class Parser * @access private */ function getVariableValue( $index ) { - global $wgLang, $wgSitename, $wgServer; + global $wgContLang, $wgSitename, $wgServer; switch ( $index ) { case MAG_CURRENTMONTH: - return $wgLang->formatNum( date( 'm' ) ); + return $wgContLang->formatNum( date( 'm' ) ); case MAG_CURRENTMONTHNAME: - return $wgLang->getMonthName( date('n') ); + return $wgContLang->getMonthName( date('n') ); case MAG_CURRENTMONTHNAMEGEN: - return $wgLang->getMonthNameGen( date('n') ); + return $wgContLang->getMonthNameGen( date('n') ); case MAG_CURRENTDAY: - return $wgLang->formatNum( date('j') ); + return $wgContLang->formatNum( date('j') ); case MAG_PAGENAME: return $this->mTitle->getText(); case MAG_PAGENAMEE: return $this->mTitle->getPartialURL(); case MAG_NAMESPACE: # return Namespace::getCanonicalName($this->mTitle->getNamespace()); - return $wgLang->getNsText($this->mTitle->getNamespace()); # Patch by Dori + return $wgContLang->getNsText($this->mTitle->getNamespace()); # Patch by Dori case MAG_CURRENTDAYNAME: - return $wgLang->getWeekdayName( date('w')+1 ); + return $wgContLang->getWeekdayName( date('w')+1 ); case MAG_CURRENTYEAR: - return $wgLang->formatNum( date( 'Y' ) ); + return $wgContLang->formatNum( date( 'Y' ) ); case MAG_CURRENTTIME: - return $wgLang->time( wfTimestampNow(), false ); + return $wgContLang->time( wfTimestampNow(), false ); case MAG_NUMBEROFARTICLES: - return $wgLang->formatNum( wfNumberOfArticles() ); + return $wgContLang->formatNum( wfNumberOfArticles() ); case MAG_SITENAME: return $wgSitename; case MAG_SERVER: @@ -1653,7 +1653,7 @@ class Parser * @access private */ function braceSubstitution( $matches ) { - global $wgLinkCache, $wgLang; + global $wgLinkCache, $wgContLang; $fname = 'Parser::braceSubstitution'; $found = false; $nowiki = false; @@ -1720,12 +1720,12 @@ class Parser $mwNs = MagicWord::get( MAG_NS ); if ( $mwNs->matchStartAndRemove( $part1 ) ) { if ( intval( $part1 ) ) { - $text = $wgLang->getNsText( intval( $part1 ) ); + $text = $wgContLang->getNsText( intval( $part1 ) ); $found = true; } else { $index = Namespace::getCanonicalIndex( strtolower( $part1 ) ); if ( !is_null( $index ) ) { - $text = $wgLang->getNsText( $index ); + $text = $wgContLang->getNsText( $index ); $found = true; } } @@ -1762,7 +1762,7 @@ class Parser if ( !$found && $argc == 1 ) { $mwGrammar =& MagicWord::get( MAG_GRAMMAR ); if ( $mwGrammar->matchStartAndRemove( $part1 ) ) { - $text = $wgLang->convertGrammar( $args[0], $part1 ); + $text = $wgContLang->convertGrammar( $args[0], $part1 ); $found = true; } } @@ -2090,7 +2090,7 @@ class Parser * @access private */ /* private */ function formatHeadings( $text, $isMain=true ) { - global $wgInputEncoding, $wgMaxTocLevel, $wgLang, $wgLinkHolders; + global $wgInputEncoding, $wgMaxTocLevel, $wgContLang, $wgLinkHolders; $doNumberHeadings = $this->mOptions->getNumberHeadings(); $doShowToc = $this->mOptions->getShowToc(); @@ -2201,7 +2201,7 @@ class Parser if( $dot ) { $numbering .= '.'; } - $numbering .= $wgLang->formatNum( $sublevelCount[$i] ); + $numbering .= $wgContLang->formatNum( $sublevelCount[$i] ); $dot = 1; } } @@ -2528,7 +2528,7 @@ class Parser * @access private */ function pstPass2( $text, &$user ) { - global $wgLang, $wgLocaltimezone, $wgCurParser; + global $wgLang, $wgContLang, $wgLocaltimezone, $wgCurParser; # Variable replacement # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags @@ -2543,13 +2543,13 @@ class Parser $oldtz = getenv('TZ'); putenv('TZ='.$wgLocaltimezone); } /* Note: this is an ugly timezone hack for the European wikis */ - $d = $wgLang->timeanddate( date( 'YmdHis' ), false ) . + $d = $wgContLang->timeanddate( date( 'YmdHis' ), false ) . ' (' . date( 'T' ) . ')'; if(isset($wgLocaltimezone)) putenv('TZ='.$oldtzs); $text = preg_replace( '/~~~~~/', $d, $text ); - $text = preg_replace( '/~~~~/', '[[' . $wgLang->getNsText( NS_USER ) . ":$n|$k]] $d", $text ); - $text = preg_replace( '/~~~/', '[[' . $wgLang->getNsText( NS_USER ) . ":$n|$k]]", $text ); + $text = preg_replace( '/~~~~/', '[[' . $wgContLang->getNsText( NS_USER ) . ":$n|$k]] $d", $text ); + $text = preg_replace( '/~~~/', '[[' . $wgContLang->getNsText( NS_USER ) . ":$n|$k]]", $text ); # Context links: [[|name]] and [[name (context)|]] # diff --git a/includes/RawPage.php b/includes/RawPage.php index 268864555b..66a6305e2d 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -70,7 +70,7 @@ class RawPage { } function getrawtext () { - global $wgInputEncoding, $wgLang; + global $wgInputEncoding, $wgContLang; $fname = 'RawPage::getrawtext'; if( !$this->mTitle ) return ''; @@ -83,7 +83,7 @@ class RawPage { if($ns == NS_MEDIAWIKI) { $rawtext = wfMsg($t); if($wgInputEncoding != $this->mCharset) - $rawtext = $wgLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext ); + $rawtext = $wgContLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext ); return $rawtext; } # else get it from the DB @@ -100,7 +100,7 @@ class RawPage { if( $s = $dbr->fetchObject( $res ) ) { $rawtext = Article::getRevisionText( $s, "" ); if($wgInputEncoding != $this->mCharset) - $rawtext = $wgLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext ); + $rawtext = $wgContLang->iconv( $wgInputEncoding, $this->mCharset, $rawtext ); header( 'Last-modified: '.gmdate( "D, j M Y H:i:s", wfTimestamp2Unix( $s->timestamp )).' GMT' ); return $rawtext; } else { diff --git a/includes/Setup.php b/includes/Setup.php index 2ef0b4758d..c9a8f500b8 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -223,28 +223,28 @@ wfProfileOut( $fname.'-User' ); wfProfileIn( $fname.'-language' ); function setupLangObj(&$langclass, $langcode) { - global $wgUseLatin1; + global $wgUseLatin1; - if( ! class_exists( $langclass ) || ($langcode == 'en' && !$wgUseLatin1) ) { + if( ! class_exists( $langclass ) || ($langcode == 'en' && !$wgUseLatin1) ) { # Default to English/UTF-8 - require_once( 'languages/LanguageUtf8.php' ); - $langclass = 'LanguageUtf8'; - } + require_once( 'languages/LanguageUtf8.php' ); + $langclass = 'LanguageUtf8'; + } - $lang = new $langclass(); - if ( !is_object($lang) ) { - print "No language class ($wgLang)\N"; - } + $lang = new $langclass(); + if ( !is_object($lang) ) { + print "No language class ($wgLang)\N"; + } - if( $wgUseLatin1 && $langcode != 'en' ) { + if( $wgUseLatin1 && $langcode != 'en' ) { # For non-UTF-8 non-English. - require_once( 'languages/LanguageLatin1.php' ); - $xxx = new LanguageLatin1( $lang ); - unset( $lang ); - $lang = $xxx; - } - return $lang; + require_once( 'languages/LanguageLatin1.php' ); + $xxx = new LanguageLatin1( $lang ); + unset( $lang ); + $lang = $xxx; + } + return $lang; } require_once( 'languages/Language.php' ); @@ -261,13 +261,13 @@ if(!$wgUser->mDataLoaded) { $wgUser->loadDefaultFromLanguage(); } $wgLanguageCode = $wgUser->getOption('language'); $wgLangClass = 'Language'. str_replace( '-', '_', ucfirst( $wgLanguageCode ) ); - if($wgLangClass == $wgContLangClass) { - $wgLang = &$wgContLang; - } - else { - include_once("languages/$wgLangClass.php"); - $wgLang = setupLangObj($wgLangClass, $wgLanguageCode); - } +if($wgLangClass == $wgContLangClass) { + $wgLang = &$wgContLang; +} +else { + include_once("languages/$wgLangClass.php"); + $wgLang = setupLangObj($wgLangClass, $wgLanguageCode); +} wfProfileOut( $fname.'-language' ); @@ -276,11 +276,11 @@ wfProfileIn( $fname.'-MessageCache' ); $wgContMessageCache = new MessageCache; $wgContMessageCache->initialise( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $wgDBname, $wgContLang, $wgContLanguageCode ); if($wgLangClass == $wgContLangClass) { - $wgMessageCache = &$wgContMessageCache; + $wgMessageCache = &$wgContMessageCache; } else { - $wgMessageCache = new MessageCache; - $wgMessageCache->initialise( $messageMemc,false , $wgMsgCacheExpiry, $wgDBname.":$wgLangClass", $wgLang, $wgLanguageCode); + $wgMessageCache = new MessageCache; + $wgMessageCache->initialise( $messageMemc,false , $wgMsgCacheExpiry, $wgDBname.":$wgLangClass", $wgLang, $wgLanguageCode); } wfProfileOut( $fname.'-MessageCache' ); @@ -300,6 +300,13 @@ wfProfileOut( $fname.'-MessageCache' ); # $wgLang = $wgContLang; # $wgMessageCache = $wgContMessageCache; # +# TODO: Need to change reference to $wgLang to $wgContLang at proper +# places, including namespaces, dates in signatures, magic words, +# and links +# +# TODO: Need to look at the issue of input/output encoding +# + wfProfileIn( $fname.'-OutputPage' ); -- 2.20.1