Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -311,8 +311,8 @@ |
312 | 312 | // Users can have their language set differently than the |
313 | 313 | // content of the wiki. For these users, tell the web browser |
314 | 314 | // that interface elements are in a different language. |
315 | | - $tpl->set( 'userlangattributes', ''); |
316 | | - $tpl->set( 'specialpageattributes', ''); |
| 315 | + $tpl->set( 'userlangattributes', '' ); |
| 316 | + $tpl->set( 'specialpageattributes', '' ); |
317 | 317 | |
318 | 318 | $lang = $wgLang->getCode(); |
319 | 319 | $dir = $wgLang->getDir(); |
— | — | @@ -323,60 +323,17 @@ |
324 | 324 | |
325 | 325 | // The content of SpecialPages should be presented in the |
326 | 326 | // user's language. Content of regular pages should not be touched. |
327 | | - if($this->mTitle->isSpecialPage()) { |
| 327 | + if( $this->mTitle->isSpecialPage() ) { |
328 | 328 | $tpl->set( 'specialpageattributes', $attrs ); |
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | | - $newtalks = $wgUser->getNewMessageLinks(); |
| 332 | + $newtalks = $this->getNewtalks(); |
333 | 333 | |
334 | | - if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) { |
335 | | - $usertitle = $this->mUser->getUserPage(); |
336 | | - $usertalktitle = $usertitle->getTalkPage(); |
337 | | - |
338 | | - if( !$usertalktitle->equals( $this->mTitle ) ) { |
339 | | - $newmessageslink = $this->link( |
340 | | - $usertalktitle, |
341 | | - wfMsgHtml( 'newmessageslink' ), |
342 | | - array(), |
343 | | - array( 'redirect' => 'no' ), |
344 | | - array( 'known', 'noclasses' ) |
345 | | - ); |
346 | | - |
347 | | - $newmessagesdifflink = $this->link( |
348 | | - $usertalktitle, |
349 | | - wfMsgHtml( 'newmessagesdifflink' ), |
350 | | - array(), |
351 | | - array( 'diff' => 'cur' ), |
352 | | - array( 'known', 'noclasses' ) |
353 | | - ); |
354 | | - |
355 | | - $ntl = wfMsg( |
356 | | - 'youhavenewmessages', |
357 | | - $newmessageslink, |
358 | | - $newmessagesdifflink |
359 | | - ); |
360 | | - # Disable Cache |
361 | | - $out->setSquidMaxage( 0 ); |
362 | | - } |
363 | | - } else if( count( $newtalks ) ) { |
364 | | - // _>" " for BC <= 1.16 |
365 | | - $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) ); |
366 | | - $msgs = array(); |
367 | | - foreach( $newtalks as $newtalk ) { |
368 | | - $msgs[] = Xml::element('a', |
369 | | - array( 'href' => $newtalk['link'] ), $newtalk['wiki'] ); |
370 | | - } |
371 | | - $parts = implode( $sep, $msgs ); |
372 | | - $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts ); |
373 | | - $out->setSquidMaxage( 0 ); |
374 | | - } else { |
375 | | - $ntl = ''; |
376 | | - } |
377 | 334 | wfProfileOut( __METHOD__ . '-stuff2' ); |
378 | 335 | |
379 | 336 | wfProfileIn( __METHOD__ . '-stuff3' ); |
380 | | - $tpl->setRef( 'newtalk', $ntl ); |
| 337 | + $tpl->setRef( 'newtalk', $newtalks ); |
381 | 338 | $tpl->setRef( 'skin', $this ); |
382 | 339 | $tpl->set( 'logo', $this->logoText() ); |
383 | 340 | if ( $out->isArticle() and ( !isset( $oldid ) or isset( $diff ) ) and |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -2181,4 +2181,61 @@ |
2182 | 2182 | public function commonPrintStylesheet() { |
2183 | 2183 | return true; |
2184 | 2184 | } |
| 2185 | + |
| 2186 | + /** |
| 2187 | + * Gets new talk page messages for the current user. |
| 2188 | + * @return MediaWiki message or if no new talk page messages, nothing |
| 2189 | + */ |
| 2190 | + function getNewtalks() { |
| 2191 | + global $wgUser, $wgOut; |
| 2192 | + $newtalks = $wgUser->getNewMessageLinks(); |
| 2193 | + |
| 2194 | + if( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) { |
| 2195 | + $userTitle = $this->mUser->getUserPage(); |
| 2196 | + $userTalkTitle = $userTitle->getTalkPage(); |
| 2197 | + |
| 2198 | + if( !$userTalkTitle->equals( $this->mTitle ) ) { |
| 2199 | + $newMessagesLink = $this->link( |
| 2200 | + $userTalkTitle, |
| 2201 | + wfMsgHtml( 'newmessageslink' ), |
| 2202 | + array(), |
| 2203 | + array( 'redirect' => 'no' ), |
| 2204 | + array( 'known', 'noclasses' ) |
| 2205 | + ); |
| 2206 | + |
| 2207 | + $newMessagesDiffLink = $this->link( |
| 2208 | + $userTalkTitle, |
| 2209 | + wfMsgHtml( 'newmessagesdifflink' ), |
| 2210 | + array(), |
| 2211 | + array( 'diff' => 'cur' ), |
| 2212 | + array( 'known', 'noclasses' ) |
| 2213 | + ); |
| 2214 | + |
| 2215 | + $ntl = wfMsg( |
| 2216 | + 'youhavenewmessages', |
| 2217 | + $newMessagesLink, |
| 2218 | + $newMessagesDiffLink |
| 2219 | + ); |
| 2220 | + # Disable Squid cache |
| 2221 | + $wgOut->setSquidMaxage( 0 ); |
| 2222 | + } |
| 2223 | + } elseif( count( $newtalks ) ) { |
| 2224 | + // _>" " for BC <= 1.16 |
| 2225 | + $sep = str_replace( '_', ' ', wfMsgHtml( 'newtalkseparator' ) ); |
| 2226 | + $msgs = array(); |
| 2227 | + foreach( $newtalks as $newtalk ) { |
| 2228 | + $msgs[] = Xml::element( |
| 2229 | + 'a', |
| 2230 | + array( 'href' => $newtalk['link'] ), $newtalk['wiki'] |
| 2231 | + ); |
| 2232 | + } |
| 2233 | + $parts = implode( $sep, $msgs ); |
| 2234 | + $ntl = wfMsgHtml( 'youhavenewmessagesmulti', $parts ); |
| 2235 | + $wgOut->setSquidMaxage( 0 ); |
| 2236 | + } else { |
| 2237 | + $ntl = ''; |
| 2238 | + } |
| 2239 | + return $ntl; |
| 2240 | + } |
| 2241 | + |
2185 | 2242 | } |