public function commonPrintStylesheet() {
return true;
}
+
+ /**
+ * Gets new talk page messages for the current user.
+ * @return MediaWiki message or if no new talk page messages, nothing
+ */
+ function getNewtalks() {
+ global $wgUser, $wgOut;
+ $newtalks = $wgUser->getNewMessageLinks();
+
+ if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
+ $userTitle = $this->mUser->getUserPage();
+ $userTalkTitle = $userTitle->getTalkPage();
+
+ if( !$userTalkTitle->equals( $this->mTitle ) ) {
+ $newMessagesLink = $this->link(
+ $userTalkTitle,
+ wfMsgHtml( 'newmessageslink' ),
+ array(),
+ array( 'redirect' => 'no' ),
+ array( 'known', 'noclasses' )
+ );
+
+ $newMessagesDiffLink = $this->link(
+ $userTalkTitle,
+ wfMsgHtml( 'newmessagesdifflink' ),
+ array(),
+ array( 'diff' => 'cur' ),
+ array( 'known', 'noclasses' )
+ );
+
+ $ntl = wfMsg(
+ 'youhavenewmessages',
+ $newMessagesLink,
+ $newMessagesDiffLink
+ );
+ # Disable Squid cache
+ $wgOut->setSquidMaxage( 0 );
+ }
+ } elseif( count( $newtalks ) ) {
+ // _>" " for BC <= 1.16
+ $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) );
+ $msgs = array();
+ foreach( $newtalks as $newtalk ) {
+ $msgs[] = Xml::element(
+ 'a',
+ array( 'href' => $newtalk['link'] ), $newtalk['wiki']
+ );
+ }
+ $parts = implode( $sep, $msgs );
+ $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts );
+ $wgOut->setSquidMaxage( 0 );
+ } else {
+ $ntl = '';
+ }
+ return $ntl;
+ }
+
}
// Users can have their language set differently than the
// content of the wiki. For these users, tell the web browser
// that interface elements are in a different language.
- $tpl->set( 'userlangattributes', '');
- $tpl->set( 'specialpageattributes', '');
+ $tpl->set( 'userlangattributes', '' );
+ $tpl->set( 'specialpageattributes', '' );
$lang = $wgLang->getCode();
$dir = $wgLang->getDir();
// The content of SpecialPages should be presented in the
// user's language. Content of regular pages should not be touched.
- if($this->mTitle->isSpecialPage()) {
+ if( $this->mTitle->isSpecialPage() ) {
$tpl->set( 'specialpageattributes', $attrs );
}
}
- $newtalks = $wgUser->getNewMessageLinks();
+ $newtalks = $this->getNewtalks();
- if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
- $usertitle = $this->mUser->getUserPage();
- $usertalktitle = $usertitle->getTalkPage();
-
- if( !$usertalktitle->equals( $this->mTitle ) ) {
- $newmessageslink = $this->link(
- $usertalktitle,
- wfMsgHtml( 'newmessageslink' ),
- array(),
- array( 'redirect' => 'no' ),
- array( 'known', 'noclasses' )
- );
-
- $newmessagesdifflink = $this->link(
- $usertalktitle,
- wfMsgHtml( 'newmessagesdifflink' ),
- array(),
- array( 'diff' => 'cur' ),
- array( 'known', 'noclasses' )
- );
-
- $ntl = wfMsg(
- 'youhavenewmessages',
- $newmessageslink,
- $newmessagesdifflink
- );
- # Disable Cache
- $out->setSquidMaxage( 0 );
- }
- } else if( count( $newtalks ) ) {
- // _>" " for BC <= 1.16
- $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) );
- $msgs = array();
- foreach( $newtalks as $newtalk ) {
- $msgs[] = Xml::element('a',
- array( 'href' => $newtalk['link'] ), $newtalk['wiki'] );
- }
- $parts = implode( $sep, $msgs );
- $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts );
- $out->setSquidMaxage( 0 );
- } else {
- $ntl = '';
- }
wfProfileOut( __METHOD__ . '-stuff2' );
wfProfileIn( __METHOD__ . '-stuff3' );
- $tpl->setRef( 'newtalk', $ntl );
+ $tpl->setRef( 'newtalk', $newtalks );
$tpl->setRef( 'skin', $this );
$tpl->set( 'logo', $this->logoText() );
if ( $out->isArticle() and ( !isset( $oldid ) or isset( $diff ) ) and