r45130 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45129‎ | r45130 | r45131 >
Date:16:46, 28 December 2008
Author:ialex
Status:ok
Tags:
Comment:
* Since we are in Linker, use $this->link() rather than grabbing it from $wgUser->getSkin() (which is $this in the most cases)
* Add new lines in output
* Whitespaces tweaks
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1596,12 +1596,9 @@
15971597 * @param bool $section Whether this is for a section edit
15981598 * @return string HTML output
15991599 */
1600 - public function formatTemplates( $templates, $preview = false, $section = false) {
1601 - global $wgUser;
 1600+ public function formatTemplates( $templates, $preview = false, $section = false ) {
16021601 wfProfileIn( __METHOD__ );
16031602
1604 - $sk = $wgUser->getSkin();
1605 -
16061603 $outText = '';
16071604 if ( count( $templates ) > 0 ) {
16081605 # Do a batch existence check
@@ -1620,7 +1617,7 @@
16211618 } else {
16221619 $outText .= wfMsgExt( 'templatesused', array( 'parse' ) );
16231620 }
1624 - $outText .= '</div><ul>';
 1621+ $outText .= "</div><ul>\n";
16251622
16261623 usort( $templates, array( 'Title', 'compare' ) );
16271624 foreach ( $templates as $titleObj ) {
@@ -1633,13 +1630,13 @@
16341631 $protected = '';
16351632 }
16361633 if( $titleObj->quickUserCan( 'edit' ) ) {
1637 - $editLink = $sk->link( $titleObj, wfMsg( 'editlink' ), array(), array( 'action' => 'edit' ), 'known' );
 1634+ $editLink = $this->link( $titleObj, wfMsgHtml( 'editlink' ), array(), array( 'action' => 'edit' ), 'known' );
16381635 } else {
1639 - $editLink = $sk->link( $titleObj, wfMsg( 'viewsourcelink' ), array(), array( 'action' => 'edit' ), 'known' );
 1636+ $editLink = $this->link( $titleObj, wfMsgHtml( 'viewsourcelink' ), array(), array( 'action' => 'edit' ), 'known' );
16401637 }
1641 - $talkLink = $sk->link( $titleObj->getTalkPage(), wfMsg( 'talkpagelinktext' ) );
 1638+ $talkLink = $this->link( $titleObj->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) );
16421639 $outText .= Xml::tags( 'li', array(),
1643 - $sk->link( $titleObj ) . ' (' . $editLink . ' ' . wfMsg( 'pipe-separator' ) . ' ' . $talkLink . ') ' . $protected );
 1640+ $this->link( $titleObj ) . ' (' . $editLink . ' ' . wfMsgHtml( 'pipe-separator' ) . ' ' . $talkLink . ') ' . $protected ) . "\n";
16441641 }
16451642 $outText .= '</ul>';
16461643 }
@@ -1654,21 +1651,19 @@
16551652 * or similar
16561653 * @return string HTML output
16571654 */
1658 - public function formatHiddenCategories( $hiddencats) {
1659 - global $wgUser, $wgLang;
 1655+ public function formatHiddenCategories( $hiddencats ) {
 1656+ global $wgLang;
16601657 wfProfileIn( __METHOD__ );
16611658
1662 - $sk = $wgUser->getSkin();
1663 -
16641659 $outText = '';
16651660 if ( count( $hiddencats ) > 0 ) {
16661661 # Construct the HTML
16671662 $outText = '<div class="mw-hiddenCategoriesExplanation">';
16681663 $outText .= wfMsgExt( 'hiddencategories', array( 'parse' ), $wgLang->formatnum( count( $hiddencats ) ) );
1669 - $outText .= '</div><ul>';
 1664+ $outText .= "</div><ul>\n";
16701665
16711666 foreach ( $hiddencats as $titleObj ) {
1672 - $outText .= '<li>' . $sk->link( $titleObj, null, array(), array(), 'known' ) . '</li>'; # If it's hidden, it must exist - no need to check with a LinkBatch
 1667+ $outText .= '<li>' . $this->link( $titleObj, null, array(), array(), 'known' ) . "</li>\n"; # If it's hidden, it must exist - no need to check with a LinkBatch
16731668 }
16741669 $outText .= '</ul>';
16751670 }

Status & tagging log