require_once( 'RecentChange.php' );
+global $wgLinkHolders;
+$wgLinkHolders = array(
+ 'namespaces' => array(),
+ 'dbkeys' => array(),
+ 'queries' => array(),
+ 'texts' => array(),
+ 'titles' => array()
+);
+global $wgInterwikiLinkHolders;
+$wgInterwikiLinkHolders = array();
+
/**
* @todo document
* @package MediaWiki
}
function getHeadScripts() {
- global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs;
+ global $wgStylePath, $wgUser, $wgContLang, $wgAllowUserJs;
$r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in
- $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
+ $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
$userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript'));
$r .= '<script type="text/javascript" src="'.$userjs."\"></script>\n";
}
# get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way)
function getUserStylesheet() {
- global $wgOut, $wgStylePath, $wgLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss;
+ global $wgOut, $wgStylePath, $wgContLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss;
$sheet = $this->getStylesheet();
$action = $wgRequest->getText('action');
$s = "@import \"$wgStylePath/$sheet\";\n";
- if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
+ if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n";
if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in
if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
$s .= $wgRequest->getText('wpTextbox1');
} else {
- $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
+ $userpage = $wgContLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
$s.= '@import "'.$this->makeUrl($userpage.'/'.$this->getSkinName().'.css', 'action=raw&ctype=text/css').'";'."\n";
}
}
* Some styles that are set by user through the user settings interface.
*/
function doGetUserStyles() {
- global $wgUser, $wgLang;
+ global $wgUser, $wgContLang;
- $csspage = $wgLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
+ $csspage = $wgContLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
$s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n";
if ( 1 == $wgUser->getOption( 'underline' ) ) {
}
function getExternalLinkAttributes( $link, $text, $class='' ) {
- global $wgUser, $wgOut, $wgLang;
+ global $wgUser, $wgOut, $wgContLang;
+ $same = ($link == $text);
$link = urldecode( $link );
- $link = $wgLang->checkTitleEncoding( $link );
+ $link = $wgContLang->checkTitleEncoding( $link );
$link = str_replace( '_', ' ', $link );
$link = htmlspecialchars( $link );
$r = ($class != '') ? " class='$class'" : " class='external'";
- if ( 1 == $wgUser->getOption( 'hover' ) ) {
+ if ( !$same && $wgUser->getOption( 'hover' ) ) {
$r .= " title=\"{$link}\"";
}
return $r;
}
if ( 1 == $wgUser->getOption( 'hover' ) ) {
- $r .= ' title ="' . $nt->getEscapedText() . '"';
+ $r .= ' title="' . $nt->getEscapedText() . '"';
}
return $r;
}
}
function doBeforeContent() {
- global $wgUser, $wgOut, $wgTitle, $wgLang, $wgSiteNotice;
+ global $wgUser, $wgOut, $wgTitle, $wgContLang, $wgSiteNotice;
$fname = 'Skin::doBeforeContent';
wfProfileIn( $fname );
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
- if($wgLang->isRTL()) $left = !$left;
+ if($wgContLang->isRTL()) $left = !$left;
if ( !$shove ) {
$s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
} elseif( $left ) {
$s .= $this->getQuickbarCompensator( $rows );
}
- $l = $wgLang->isRTL() ? 'right' : 'left';
+ $l = $wgContLang->isRTL() ? 'right' : 'left';
$s .= "<td {$borderhack} align='$l' valign='top'>\n";
$s .= $this->topLinks() ;
$s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
- $r = $wgLang->isRTL() ? "left" : "right";
+ $r = $wgContLang->isRTL() ? "left" : "right";
$s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
$s .= $this->nameAndLogin();
$s .= "\n<br />" . $this->searchForm() . "</td>";
}
function doAfterContent() {
- global $wgUser, $wgOut, $wgLang;
+ global $wgUser, $wgOut, $wgContLang;
$fname = 'Skin::doAfterContent';
wfProfileIn( $fname );
wfProfileIn( $fname.'-1' );
$qb = $this->qbSetting();
$shove = ($qb != 0);
$left = ($qb == 1 || $qb == 3);
- if($wgLang->isRTL()) $left = !$left;
+ if($wgContLang->isRTL()) $left = !$left;
if ( $shove && $left ) { # Left
$s .= $this->getQuickbarCompensator();
}
wfProfileOut( $fname.'-2' );
wfProfileIn( $fname.'-3' );
- $l = $wgLang->isRTL() ? 'right' : 'left';
+ $l = $wgContLang->isRTL() ? 'right' : 'left';
$s .= "<td class='bottom' align='$l' valign='top'>";
$s .= $this->bottomLinks();
}
function pageTitleLinks() {
- global $wgOut, $wgTitle, $wgUser, $wgLang, $wgUseApproval, $wgRequest;
+ global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgUseApproval, $wgRequest;
extract( $wgRequest->getValues( 'oldid', 'diff' ) );
$action = $wgRequest->getText( 'action' );
$s = $this->printableLink();
- if ( wfMsg ( 'disclaimers' ) != '-' ) $s .= ' | ' . $this->makeKnownLink( wfMsg( 'disclaimerpage' ), wfMsg( 'disclaimers' ) ) ;
+ if ( wfMsg ( 'disclaimers' ) != '-' )
+ $s .= ' | ' . $this->makeKnownLink(
+ wfMsgForContent( 'disclaimerpage' ),
+ wfMsg( 'disclaimers' ) ) ;
if ( $wgOut->isArticleRelated() ) {
if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
if(!(strcmp($wgTitle->getText(),$wgUser->getName()) == 0 &&
$wgTitle->getNamespace()==Namespace::getTalk(Namespace::getUser()))) {
$n =$wgUser->getName();
- $tl = $this->makeKnownLink( $wgLang->getNsText(
+ $tl = $this->makeKnownLink( $wgContLang->getNsText(
Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
wfMsg('newmessageslink') );
$s.= ' | <strong>'. wfMsg( 'newmessages', $tl ) . '</strong>';
}
function getUndeleteLink() {
- global $wgUser, $wgTitle, $wgLang, $action;
+ global $wgUser, $wgTitle, $wgContLang, $action;
if( $wgUser->isSysop() &&
(($wgTitle->getArticleId() == 0) || ($action == "history")) &&
($n = $wgTitle->isDeleted() ) ) {
return wfMsg( 'thisisdeleted',
$this->makeKnownLink(
- $wgLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
+ $wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
wfMsg( 'restorelink', $n ) ) );
}
return '';
}
function nameAndLogin() {
- global $wgUser, $wgTitle, $wgLang, $wgShowIPinHeader, $wgIP;
+ global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader, $wgIP;
- $li = $wgLang->specialPage( 'Userlogin' );
- $lo = $wgLang->specialPage( 'Userlogout' );
+ $li = $wgContLang->specialPage( 'Userlogin' );
+ $lo = $wgContLang->specialPage( 'Userlogout' );
$s = '';
if ( 0 == $wgUser->getID() ) {
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
$n = $wgIP;
- $tl = $this->makeKnownLink( $wgLang->getNsText(
+ $tl = $this->makeKnownLink( $wgContLang->getNsText(
Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
- $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
+ $wgContLang->getNsText( Namespace::getTalk( 0 ) ) );
$s .= $n . ' ('.$tl.')';
} else {
} else {
$n = $wgUser->getName();
$rt = $wgTitle->getPrefixedURL();
- $tl = $this->makeKnownLink( $wgLang->getNsText(
+ $tl = $this->makeKnownLink( $wgContLang->getNsText(
Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
- $wgLang->getNsText( Namespace::getTalk( 0 ) ) );
+ $wgContLang->getNsText( Namespace::getTalk( 0 ) ) );
$tl = " ({$tl})";
- $s .= $this->makeKnownLink( $wgLang->getNsText(
+ $s .= $this->makeKnownLink( $wgContLang->getNsText(
Namespace::getUser() ) . ":{$n}", $n ) . "{$tl}<br />" .
$this->makeKnownLink( $lo, wfMsg( 'logout' ),
"returnto={$rt}" ) . ' | ' .
$this->specialLink( 'preferences' );
}
- $s .= ' | ' . $this->makeKnownLink( wfMsg( 'helppage' ),
+ $s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
wfMsg( 'help' ) );
return $s;
}
function quickBar() {
- global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
+ global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
global $wgDisableUploads, $wgRemoteUploads;
$fname = 'Skin::quickBar';
. $sep . $this->specialLink( 'randompage' );
if ($wgUser->getID()) {
$s.= $sep . $this->specialLink( 'watchlist' ) ;
- $s .= $sep .$this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
+ $s .= $sep .$this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
}
// only show watchlist link if logged in
- if ( wfMsg ( 'currentevents' ) != '-' ) $s .= $sep . $this->makeKnownLink( wfMsg( 'currentevents' ), '' ) ;
+ if ( wfMsg ( 'currentevents' ) != '-' )
+ $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'currentevents' ), '' ) ;
$s .= "\n<br /><hr class='sep' />";
$articleExists = $wgTitle->getArticleId();
if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) {
}
$link = $wgTitle->getText();
- if ($nstext = $wgLang->getNsText($tns) ) { # add namespace if necessary
+ if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
$link = $nstext . ':' . $link ;
}
}
function specialPagesList() {
- global $wgUser, $wgOut, $wgLang, $wgServer, $wgRedirectScript;
+ global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript;
require_once('SpecialPage.php');
$a = array();
$pages = SpecialPage::getPages();
}
$go = wfMsg( 'go' );
$sp = wfMsg( 'specialpages' );
- $spp = $wgLang->specialPage( 'Specialpages' );
+ $spp = $wgContLang->specialPage( 'Specialpages' );
$s = '<form id="specialpages" method="get" class="inline" ' .
'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
$s .= "<option value=\"{$spp}\">{$sp}</option>\n";
foreach ( $a as $name => $desc ) {
- $p = $wgLang->specialPage( $name );
+ $p = $wgContLang->specialPage( $name );
$s .= "<option value=\"{$p}\">{$desc}</option>\n";
}
$s .= "</select>\n";
}
function mainPageLink() {
- $mp = wfMsg( 'mainpage' );
- $s = $this->makeKnownLink( $mp, $mp );
+ $mp = wfMsgForContent( 'mainpage' );
+ $mptxt = wfMsg( 'mainpage');
+ $s = $this->makeKnownLink( $mp, $mptxt );
return $s;
}
function copyrightLink() {
- $s = $this->makeKnownLink( wfMsg( 'copyrightpage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
wfMsg( 'copyrightpagename' ) );
return $s;
}
function aboutLink() {
- $s = $this->makeKnownLink( wfMsg( 'aboutpage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
wfMsg( 'aboutsite' ) );
return $s;
}
function disclaimerLink() {
- $s = $this->makeKnownLink( wfMsg( 'disclaimerpage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
wfMsg( 'disclaimers' ) );
return $s;
}
}
function moveThisPage() {
- global $wgTitle, $wgLang;
+ global $wgTitle, $wgContLang;
if ( $wgTitle->userCanEdit() ) {
- $s = $this->makeKnownLink( $wgLang->specialPage( 'Movepage' ),
+ $s = $this->makeKnownLink( $wgContLang->specialPage( 'Movepage' ),
wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
} // no message if page is protected - would be redundant
return $s;
}
function whatLinksHere() {
- global $wgTitle, $wgLang;
+ global $wgTitle, $wgContLang;
- $s = $this->makeKnownLink( $wgLang->specialPage( 'Whatlinkshere' ),
+ $s = $this->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ),
wfMsg( 'whatlinkshere' ), 'target=' . $wgTitle->getPrefixedURL() );
return $s;
}
function userContribsLink() {
- global $wgTitle, $wgLang;
+ global $wgTitle, $wgContLang;
- $s = $this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
+ $s = $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
wfMsg( 'contributions' ), 'target=' . $wgTitle->getPartialURL() );
return $s;
}
function emailUserLink() {
- global $wgTitle, $wgLang;
+ global $wgTitle, $wgContLang;
- $s = $this->makeKnownLink( $wgLang->specialPage( 'Emailuser' ),
+ $s = $this->makeKnownLink( $wgContLang->specialPage( 'Emailuser' ),
wfMsg( 'emailuser' ), 'target=' . $wgTitle->getPartialURL() );
return $s;
}
function watchPageLinksLink() {
- global $wgOut, $wgTitle, $wgLang;
+ global $wgOut, $wgTitle, $wgContLang;
if ( ! $wgOut->isArticleRelated() ) {
$s = '(' . wfMsg( 'notanarticle' ) . ')';
} else {
- $s = $this->makeKnownLink( $wgLang->specialPage(
+ $s = $this->makeKnownLink( $wgContLang->specialPage(
'Recentchangeslinked' ), wfMsg( 'recentchangeslinked' ),
'target=' . $wgTitle->getPrefixedURL() );
}
}
function otherLanguages() {
- global $wgOut, $wgLang, $wgTitle, $wgUseNewInterlanguage;
+ global $wgOut, $wgContLang, $wgTitle, $wgUseNewInterlanguage;
$a = $wgOut->getLanguageLinks();
if ( 0 == count( $a ) ) {
if ( !$wgUseNewInterlanguage ) return '';
- $ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
+ $ns = $wgContLang->getNsIndex ( $wgTitle->getNamespace () ) ;
if ( $ns != 0 AND $ns != 1 ) return '' ;
$pn = 'Intl' ;
$x = 'mode=addlink&xt='.$wgTitle->getDBkey() ;
- return $this->makeKnownLink( $wgLang->specialPage( $pn ),
+ return $this->makeKnownLink( $wgContLang->specialPage( $pn ),
wfMsg( 'intl' ) , $x );
}
if ( !$wgUseNewInterlanguage ) {
$s = wfMsg( 'otherlanguages' ) . ': ';
} else {
- global $wgLanguageCode ;
+ global $wgContLanguageCode ;
$x = 'mode=zoom&xt='.$wgTitle->getDBkey() ;
- $x .= '&xl='.$wgLanguageCode ;
- $s = $this->makeKnownLink( $wgLang->specialPage( 'Intl' ),
+ $x .= '&xl='.$wgContLanguageCode ;
+ $s = $this->makeKnownLink( $wgContLang->specialPage( 'Intl' ),
wfMsg( 'otherlanguages' ) , $x ) . ': ' ;
}
$s = wfMsg( 'otherlanguages' ) . ': ';
$first = true;
- if($wgLang->isRTL()) $s .= '<span dir="LTR">';
+ if($wgContLang->isRTL()) $s .= '<span dir="LTR">';
foreach( $a as $l ) {
if ( ! $first ) { $s .= ' | '; }
$first = false;
$nt = Title::newFromText( $l );
$url = $nt->getFullURL();
- $text = $wgLang->getLanguageName( $nt->getInterwiki() );
+ $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
if ( '' == $text ) { $text = $l; }
$style = $this->getExternalLinkAttributes( $l, $text );
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
}
- if($wgLang->isRTL()) $s .= '</span>';
+ if($wgContLang->isRTL()) $s .= '</span>';
return $s;
}
function bugReportsLink() {
- $s = $this->makeKnownLink( wfMsg( 'bugreportspage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
wfMsg( 'bugreports' ) );
return $s;
}
}
function talkLink() {
- global $wgLang, $wgTitle, $wgLinkCache;
+ global $wgContLang, $wgTitle, $wgLinkCache;
$tns = $wgTitle->getNamespace();
if ( -1 == $tns ) { return ''; }
$lns = Namespace::getTalk( $tns );
$text=$tp;
}
- $n = $wgLang->getNsText( $lns );
+ $n = $wgContLang->getNsText( $lns );
if ( '' == $n ) { $link = $pn; }
else { $link = $n.':'.$pn; }
}
function commentLink() {
- global $wgLang, $wgTitle, $wgLinkCache;
+ global $wgContLang, $wgTitle, $wgLinkCache;
$tns = $wgTitle->getNamespace();
if ( -1 == $tns ) { return ''; }
# assert Namespace::isTalk( $lns )
- $n = $wgLang->getNsText( $lns );
+ $n = $wgContLang->getNsText( $lns );
$pn = $wgTitle->getText();
$link = $n.':'.$pn;
* Pass a title object, not a title string
*/
function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgLinkHolders;
$fname = 'Skin::makeLinkObj';
# Fail gracefully
- if ( ! isset($nt) )
+ if ( ! isset($nt) ) {
+ # wfDebugDieBacktrace();
return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+ }
if ( $nt->isExternal() ) {
$u = $nt->getFullURL();
$trail = $m[2];
}
}
- $retVal = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>{$trail}";
+ # Assume $this->postParseLinkColour(). This prevents
+ # interwiki links from being parsed as external links.
+ global $wgInterwikiLinkHolders;
+ $t = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>";
+ $nr = array_push($wgInterwikiLinkHolders, $t);
+ $retVal = '<!--IWLINK '. ($nr-1) ."-->{$trail}";
} elseif ( 0 == $nt->getNamespace() && "" == $nt->getText() ) {
$retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
} elseif ( ( -1 == $nt->getNamespace() ) ||
}
# Allows wiki to bypass using linkcache, see OutputPage::parseLinkHolders()
- $retVal = '<!--LINK ' . implode( ' ', array( $nt->getNamespace(), $nt->getDBkey(),
- $query, $prefix . $text . $inside ) ) . "-->{$trail}";
+ $nr = array_push( $wgLinkHolders['namespaces'], $nt->getNamespace() );
+ $wgLinkHolders['dbkeys'][] = $nt->getDBkey();
+ $wgLinkHolders['queries'][] = $query;
+ $wgLinkHolders['texts'][] = $prefix.$text.$inside;
+ $wgLinkHolders['titles'][] = $nt;
+
+ $retVal = '<!--LINK '. ($nr-1) ."-->{$trail}";
} else {
# Work out link colour immediately
$aid = $nt->getArticleID() ;
global $wgOut, $wgUser;
# Fail gracefully
- if ( ! isset($nt) )
+ if ( ! isset($nt) ) {
+ # wfDebugDieBacktrace();
return "<!-- ERROR -->{$prefix}{$text}{$trail}";
+ }
$fname = 'Skin::makeBrokenLinkObj';
wfProfileIn( $fname );
return $title->getLocalURL( $urlaction );
}
/*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
- $title = Title::newFromText( wfMsg($name) );
+ $title = Title::newFromText( wfMsgForContent($name) );
$this->checkTitle($title, $name);
return $title->getLocalURL( $urlaction );
}
);
}
/*static*/ function makeI18nUrlDetails ( $name, $urlaction='' ) {
- $title = Title::newFromText( wfMsg($name) );
+ $title = Title::newFromText( wfMsgForContent($name) );
$this->checkTitle($title, $name);
return array(
'href' => $title->getLocalURL( $urlaction ),
}
function makeImageLinkObj( $nt, $alt = '' ) {
- global $wgLang, $wgUseImageResize;
+ global $wgContLang, $wgUseImageResize;
$img = Image::newFromTitle( $nt );
$url = $img->getURL();
# If thumbnail width has not been provided, it is set
# here to 180 pixels
if ( $align == '' ) {
- $align = $wgLang->isRTL() ? 'left' : 'right';
+ $align = $wgContLang->isRTL() ? 'left' : 'right';
}
if ( ! isset($width) ) {
$width = 180;
* $img is an Image object
*/
function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
- global $wgStylePath, $wgLang;
+ global $wgStylePath, $wgContLang;
# $image = Title::makeTitleSafe( NS_IMAGE, $name );
$url = $img->getURL();
$u = $img->getEscapeLocalURL();
$more = htmlspecialchars( wfMsg( 'thumbnail-more' ) );
- $magnifyalign = $wgLang->isRTL() ? 'left' : 'right';
- $textalign = $wgLang->isRTL() ? ' style="text-align:right"' : '';
+ $magnifyalign = $wgContLang->isRTL() ? 'left' : 'right';
+ $textalign = $wgContLang->isRTL() ? ' style="text-align:right"' : '';
$s = "<div class=\"thumb t{$align}\"><div style=\"width:{$oboxwidth}px;\">";
if ( $thumbUrl == '' ) {
}
function specialLink( $name, $key = '' ) {
- global $wgLang;
+ global $wgContLang;
if ( '' == $key ) { $key = strtolower( $name ); }
- $pn = $wgLang->ucfirst( $name );
- return $this->makeKnownLink( $wgLang->specialPage( $pn ),
+ $pn = $wgContLang->ucfirst( $name );
+ return $this->makeKnownLink( $wgContLang->specialPage( $pn ),
wfMsg( $key ) );
}
* Enhanced RC ungrouped line
*/
function recentChangesBlockLine ( $rcObj ) {
- global $wgStylePath, $wgLang ;
+ global $wgStylePath, $wgContLang ;
# Get rc_xxxx variables
extract( $rcObj->mAttribs ) ;
# Comment
if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
$rc_comment=$this->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgLang->emphasize( ' ('.$rc_comment.')' );
+ $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
}
$r .= "<br />\n" ;
* Enhanced RC group
*/
function recentChangesBlockGroup ( $block ) {
- global $wgStylePath, $wgLang ;
+ global $wgStylePath, $wgContLang ;
$r = '' ;
$M = wfMsg( 'minoreditletter' );
$rcl = 'RCL'.$this->rcCacheIndex ;
$rcm = 'RCM'.$this->rcCacheIndex ;
$toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ;
- $arrowdir = $wgLang->isRTL() ? 'l' : 'r';
+ $arrowdir = $wgContLang->isRTL() ? 'l' : 'r';
$tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" /></a></span>' ;
$tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" /></a></span>' ;
$r .= $tl ;
$r .= $rcObj->usertalklink ;
if ( $rc_comment != '' ) {
$rc_comment=$this->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgLang->emphasize( ' ('.$rc_comment.')' ) ;
+ $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' ) ;
}
$r .= "<br />\n" ;
}
}
function recentChangesLineOld( &$rc, $watched = false ) {
- global $wgTitle, $wgLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
+ global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
# Extract DB fields into local scope
extract( $rc->mAttribs );
$curIdEq = 'curid=' . $rc_cur_id;
# Make date header if necessary
- $date = $wgLang->date( $rc_timestamp, true);
+ $date = $wgContLang->date( $rc_timestamp, true);
+ $uidate = $wgLang->date( $rc_timestamp, true);
$s = '';
if ( $date != $this->lastdate ) {
if ( '' != $this->lastdate ) { $s .= "</ul>\n"; }
- $s .= "<h4>{$date}</h4>\n<ul class='special'>";
+ $s .= "<h4>{$uidate}</h4>\n<ul class='special'>";
$this->lastdate = $date;
$this->rclistOpen = true;
}
# User link (or contributions for unregistered users)
if ( 0 == $rc_user ) {
- $userLink = $this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
+ $userLink = $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
$rc_user_text, 'target=' . $rc_user_text );
} else {
- $userLink = $this->makeLink( $wgLang->getNsText( NS_USER ) . ':'.$rc_user_text, $rc_user_text );
+ $userLink = $this->makeLink( $wgContLang->getNsText( NS_USER ) . ':'.$rc_user_text, $rc_user_text );
}
$s .= $userLink;
# User talk link
- $talkname=$wgLang->getNsText(NS_TALK); # use the shorter name
+ $talkname=$wgContLang->getNsText(NS_TALK); # use the shorter name
global $wgDisableAnonTalk;
if( 0 == $rc_user && $wgDisableAnonTalk ) {
$userTalkLink = '';
} else {
- $utns=$wgLang->getNsText(NS_USER_TALK);
+ $utns=$wgContLang->getNsText(NS_USER_TALK);
$userTalkLink= $this->makeLink($utns . ':'.$rc_user_text, $talkname );
}
# Block link
$blockLink='';
if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
- $blockLink = $this->makeKnownLink( $wgLang->specialPage(
+ $blockLink = $this->makeKnownLink( $wgContLang->specialPage(
'Blockip' ), wfMsg( 'blocklink' ), 'ip='.$rc_user_text );
}
# Add comment
if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
$rc_comment=$this->formatComment($rc_comment,$rc->getTitle());
- $s .= $wgLang->emphasize(' (' . $rc_comment . ')');
+ $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
}
$s .= "</li>\n";
}
function recentChangesLineNew( &$baseRC, $watched = false ) {
- global $wgTitle, $wgLang, $wgUser, $wgRCSeconds;
+ global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds;
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC ) ;
$curIdEq = 'curid=' . $rc_cur_id;
# If it's a new day, add the headline and flush the cache
- $date = $wgLang->date( $rc_timestamp, true);
+ $date = $wgContLang->date( $rc_timestamp, true);
+ $uidate = $wgLang->date( $rc_timestamp, true);
$ret = '';
if ( $date != $this->lastdate ) {
# Process current cache
$ret = $this->recentChangesBlock () ;
$this->rc_cache = array() ;
- $ret .= "<h4>{$date}</h4>\n";
+ $ret .= "<h4>{$uidate}</h4>\n";
$this->lastdate = $date;
}
$clink = $this->makeKnownLinkObj( $rc->getTitle(), '' ) ;
}
- $time = $wgLang->time( $rc_timestamp, true, $wgRCSeconds );
+ $time = $wgContLang->time( $rc_timestamp, true, $wgRCSeconds );
$rc->watched = $watched ;
$rc->link = $clink ;
$rc->timestamp = $time;
# Make user link (or user contributions for unregistered users)
if ( $rc_user == 0 ) {
- $userLink = $this->makeKnownLink( $wgLang->specialPage( 'Contributions' ),
+ $userLink = $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
$rc_user_text, 'target=' . $rc_user_text );
} else {
- $userLink = $this->makeLink( $wgLang->getNsText(
+ $userLink = $this->makeLink( $wgContLang->getNsText(
Namespace::getUser() ) . ':'.$rc_user_text, $rc_user_text );
}
$rc->difflink = $diffLink;
# Make user talk link
- $utns=$wgLang->getNsText(NS_USER_TALK);
- $talkname=$wgLang->getNsText(NS_TALK); # use the shorter name
+ $utns=$wgContLang->getNsText(NS_USER_TALK);
+ $talkname=$wgContLang->getNsText(NS_TALK); # use the shorter name
$userTalkLink= $this->makeLink($utns . ':'.$rc_user_text, $talkname );
global $wgDisableAnonTalk;
if ( ( 0 == $rc_user ) && $wgUser->isSysop() ) {
- $blockLink = $this->makeKnownLink( $wgLang->specialPage(
+ $blockLink = $this->makeKnownLink( $wgContLang->specialPage(
'Blockip' ), wfMsg( 'blocklink' ), 'ip='.$rc_user_text );
if( $wgDisableAnonTalk )
$rc->usertalklink = ' ('.$blockLink.')';
* temporarily to a value pass. Should be adjusted further. --brion
*/
function formatComment($comment, $title = NULL) {
- global $wgLang;
+ global $wgContLang;
$comment = htmlspecialchars( $comment );
# The pattern for autogen comments is / * foo * /, which makes for
# format regular and media links - all other wiki formatting
# is ignored
- $medians = $wgLang->getNsText(Namespace::getMedia()).':';
+ $medians = $wgContLang->getNsText(Namespace::getMedia()).':';
while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) {
# Handle link renaming [[foo|text]] will show link as "text"
if( "" != $match[3] ) {
$thelink = $this->makeMediaLink( $submatch[1], "", $text );
} else {
# Other kind of link
- if( preg_match( wfMsg( "linktrail" ), $match[4], $submatch ) ) {
+ if( preg_match( wfMsgForContent( "linktrail" ), $match[4], $submatch ) ) {
$trail = $submatch[1];
} else {
$trail = "";
}
function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description ) {
- global $wgUser, $wgLang, $wgTitle;
+ global $wgUser, $wgLang, $wgContLang, $wgTitle;
$datetime = $wgLang->timeanddate( $timestamp, true );
$del = wfMsg( 'deleteimg' );
if ( 0 == $user ) {
$userlink = $usertext;
} else {
- $userlink = $this->makeLink( $wgLang->getNsText( Namespace::getUser() ) .
+ $userlink = $this->makeLink( $wgContLang->getNsText( Namespace::getUser() ) .
':'.$usertext, $usertext );
}
$nbytes = wfMsg( 'nbytes', $size );
if ( '' != $description && '*' != $description ) {
$sk=$wgUser->getSkin();
- $s .= $wgLang->emphasize(' (' . $sk->formatComment($description,$wgTitle) . ')');
+ $s .= $wgContLang->emphasize(' (' . $sk->formatComment($description,$wgTitle) . ')');
}
$s .= "</li>\n";
return $s;
* These two do not check for permissions: check $wgTitle->userCanEdit
* before calling them
*/
+ function editSectionScriptForOther( $title, $section, $head ) {
+ $ttl = Title::newFromText( $title );
+ $url = $ttl->escapeLocalURL( 'action=edit§ion='.$section );
+ return '<span oncontextmenu=\'document.location="'.$url.'";return false;\'>'.$head.'</span>';
+ }
+
function editSectionScript( $section, $head ) {
global $wgTitle, $wgRequest;
if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) {
return '<span oncontextmenu=\'document.location="'.$url.'";return false;\'>'.$head.'</span>';
}
+ function editSectionLinkForOther( $title, $section ) {
+ global $wgRequest;
+ global $wgUser, $wgContLang;
+
+ $title = Title::newFromText($title);
+ $editurl = '§ion='.$section;
+ $url = $this->makeKnownLink($title->getPrefixedText(),wfMsg('editsection'),'action=edit'.$editurl);
+
+ if( $wgContLang->isRTL() ) {
+ $farside = 'left';
+ $nearside = 'right';
+ } else {
+ $farside = 'right';
+ $nearside = 'left';
+ }
+ return "<div class=\"editsection\" style=\"float:$farside;margin-$nearside:5px;\">[".$url."]</div>";
+
+ }
+
function editSectionLink( $section ) {
global $wgRequest;
- global $wgTitle, $wgUser, $wgLang;
+ global $wgTitle, $wgUser, $wgContLang;
if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) {
# Section edit links would be out of sync on an old page.
$editurl = '§ion='.$section;
$url = $this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('editsection'),'action=edit'.$editurl);
- if( $wgLang->isRTL() ) {
+ if( $wgContLang->isRTL() ) {
$farside = 'left';
$nearside = 'right';
} else {