r62094 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62093‎ | r62094 | r62095 >
Date:19:24, 7 February 2010
Author:ashley
Status:ok
Tags:
Comment:
cleanup to CologneBlue.php, Nostalgia.php and Standard.php
Modified paths:
  • /trunk/phase3/skins/CologneBlue.php (modified) (history)
  • /trunk/phase3/skins/Nostalgia.php (modified) (history)
  • /trunk/phase3/skins/Standard.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/CologneBlue.php
@@ -7,8 +7,9 @@
88 * @ingroup Skins
99 */
1010
11 -if( !defined( 'MEDIAWIKI' ) )
 11+if( !defined( 'MEDIAWIKI' ) ) {
1212 die( -1 );
 13+}
1314
1415 /**
1516 * @todo document
@@ -46,7 +47,9 @@
4748 $s .= '<font size="-1"><span id="langlinks">';
4849 $s .= str_replace( '<br />', '', $this->otherLanguages() );
4950 $cat = $this->getCategoryLinks();
50 - if( $cat ) $s .= "<br />$cat\n";
 51+ if( $cat ) {
 52+ $s .= "<br />$cat\n";
 53+ }
5154 $s .= '<br />' . $this->pageTitleLinks();
5255 $s .= '</span></font>';
5356
@@ -110,20 +113,20 @@
111114
112115 if ( 2 == $qb ) { # Right
113116 $s .= "#quickbar { position: absolute; right: 4px; }\n" .
114 - "#article { margin-left: 4px; margin-right: 148px; }\n";
115 - } else if ( 1 == $qb ) {
 117+ "#article { margin-left: 4px; margin-right: 148px; }\n";
 118+ } elseif ( 1 == $qb ) {
116119 $s .= "#quickbar { position: absolute; left: 4px; }\n" .
117 - "#article { margin-left: 148px; margin-right: 4px; }\n";
118 - } else if ( 3 == $qb ) { # Floating left
 120+ "#article { margin-left: 148px; margin-right: 4px; }\n";
 121+ } elseif ( 3 == $qb ) { # Floating left
119122 $s .= "#quickbar { position:absolute; left:4px } \n" .
120 - "#topbar { margin-left: 148px }\n" .
121 - "#article { margin-left:148px; margin-right: 4px; } \n" .
122 - "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
123 - } else if ( 4 == $qb ) { # Floating right
 123+ "#topbar { margin-left: 148px }\n" .
 124+ "#article { margin-left:148px; margin-right: 4px; } \n" .
 125+ "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
 126+ } elseif ( 4 == $qb ) { # Floating right
124127 $s .= "#quickbar { position: fixed; right: 4px; } \n" .
125 - "#topbar { margin-right: 148px }\n" .
126 - "#article { margin-right: 148px; margin-left: 4px; } \n" .
127 - "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
 128+ "#topbar { margin-right: 148px }\n" .
 129+ "#article { margin-right: 148px; margin-left: 4px; } \n" .
 130+ "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
128131 }
129132 return $s;
130133 }
@@ -242,8 +245,8 @@
243246
244247 $s .= $this->menuHead( 'qbpageoptions' );
245248 $s .= $this->talkLink()
246 - . $sep . $this->commentLink()
247 - . $sep . $this->printableLink();
 249+ . $sep . $this->commentLink()
 250+ . $sep . $this->printableLink();
248251 if ( $wgUser->isLoggedIn() ) {
249252 $s .= $sep . $this->watchThisPage();
250253 }
@@ -251,9 +254,9 @@
252255 $s .= $sep;
253256
254257 $s .= $this->menuHead( 'qbpageinfo' )
255 - . $this->historyLink()
256 - . $sep . $this->whatLinksHere()
257 - . $sep . $this->watchPageLinksLink();
 258+ . $this->historyLink()
 259+ . $sep . $this->whatLinksHere()
 260+ . $sep . $this->watchPageLinksLink();
258261
259262 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
260263 $id = User::idFromName( $this->mTitle->getText() );
@@ -278,35 +281,33 @@
279282 array( 'known', 'noclasses' )
280283 );
281284 if ( $wgUser->getNewtalk() ) {
282 - $tl .= " *";
 285+ $tl .= ' *';
283286 }
284287
285288 $s .= $this->link(
286 - $wgUser->getUserPage(),
287 - wfMsg( 'mypage' ),
288 - array(),
289 - array(),
290 - array( 'known', 'noclasses' )
291 - )
292 - . $sep . $tl
293 - . $sep . $this->specialLink( 'watchlist' )
294 - . $sep . $this->link(
295 - SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
296 - wfMsg( 'mycontris' ),
297 - array(),
298 - array(),
299 - array( 'known', 'noclasses' )
300 - )
301 - . $sep . $this->specialLink( 'preferences' )
302 - . $sep . $this->specialLink( 'userlogout' );
 289+ $wgUser->getUserPage(),
 290+ wfMsg( 'mypage' ),
 291+ array(),
 292+ array(),
 293+ array( 'known', 'noclasses' )
 294+ ) . $sep . $tl . $sep . $this->specialLink( 'watchlist' )
 295+ . $sep .
 296+ $this->link(
 297+ SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
 298+ wfMsg( 'mycontris' ),
 299+ array(),
 300+ array(),
 301+ array( 'known', 'noclasses' )
 302+ ) . $sep . $this->specialLink( 'preferences' )
 303+ . $sep . $this->specialLink( 'userlogout' );
303304 } else {
304305 $s .= $this->specialLink( 'userlogin' );
305306 }
306307
307308 $s .= $this->menuHead( 'qbspecialpages' )
308 - . $this->specialLink( 'newpages' )
309 - . $sep . $this->specialLink( 'listfiles' )
310 - . $sep . $this->specialLink( 'statistics' );
 309+ . $this->specialLink( 'newpages' )
 310+ . $sep . $this->specialLink( 'listfiles' )
 311+ . $sep . $this->specialLink( 'statistics' );
311312 if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
312313 $s .= $sep . $this->specialLink( 'upload' );
313314 }
@@ -315,7 +316,7 @@
316317
317318 if( $wgSiteSupportPage ) {
318319 $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
319 - . wfMsg( 'sitesupport' ) . '</a>';
 320+ . wfMsg( 'sitesupport' ) . '</a>';
320321 }
321322
322323 $s .= $sep . $this->link(
@@ -330,12 +331,12 @@
331332 return $s;
332333 }
333334
334 - function menuHead( $key ){
 335+ function menuHead( $key ) {
335336 $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
336337 return $s;
337338 }
338339
339 - function searchForm( $label = '' ){
 340+ function searchForm( $label = '' ) {
340341 global $wgRequest, $wgUseTwoButtonsSearchForm;
341342
342343 $search = $wgRequest->getText( 'search' );
@@ -346,13 +347,14 @@
347348 }
348349
349350 $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
350 - . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
351 - . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
 351+ . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
 352+ . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
352353
353 - if( $wgUseTwoButtonsSearchForm )
 354+ if( $wgUseTwoButtonsSearchForm ) {
354355 $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
355 - else
 356+ } else {
356357 $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
 358+ }
357359
358360 $s .= '</form>';
359361
Index: trunk/phase3/skins/Standard.php
@@ -6,21 +6,15 @@
77 * @ingroup Skins
88 */
99
10 -if( !defined( 'MEDIAWIKI' ) )
 10+if( !defined( 'MEDIAWIKI' ) ) {
1111 die( -1 );
 12+}
1213
1314 /**
1415 * @todo document
1516 * @ingroup Skins
1617 */
1718 class SkinStandard extends Skin {
18 - /*
19 - * OutputPage
20 - */
21 - function outputPage( OutputPage $out ) {
22 - global $wgStylePath;
23 - parent::outputPage( $out );
24 - }
2519
2620 /**
2721 *
@@ -28,7 +22,7 @@
2923 function setupSkinUserCss( OutputPage $out ){
3024 if ( 3 == $this->qbSetting() ) { # Floating left
3125 $out->addStyle( 'common/quickbar.css' );
32 - } else if ( 4 == $this->qbSetting() ) { # Floating right
 26+ } elseif ( 4 == $this->qbSetting() ) { # Floating right
3327 $out->addStyle( 'common/quickbar-right.css' );
3428 }
3529 parent::setupSkinUserCss( $out );
@@ -43,15 +37,15 @@
4438
4539 if ( 2 == $qb ) { # Right
4640 $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
47 - "border-left: 2px solid #000000; }\n" .
48 - "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
49 - } else if ( 1 == $qb || 3 == $qb ) {
 41+ "border-left: 2px solid #000000; }\n" .
 42+ "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
 43+ } elseif ( 1 == $qb || 3 == $qb ) {
5044 $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
51 - "border-right: 1px solid gray; }\n" .
52 - "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
53 - } else if ( 4 == $qb) {
 45+ "border-right: 1px solid gray; }\n" .
 46+ "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
 47+ } elseif ( 4 == $qb ) {
5448 $s .= "#quickbar { border-right: 1px solid gray; }\n" .
55 - "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
 49+ "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
5650 }
5751 return $s;
5852 }
@@ -71,10 +65,12 @@
7266 $qb = $this->qbSetting();
7367 $shove = ( $qb != 0 );
7468 $left = ( $qb == 1 || $qb == 3 );
75 - if( $wgContLang->isRTL() ) $left = !$left;
 69+ if( $wgContLang->isRTL() ) {
 70+ $left = !$left;
 71+ }
7672
7773 if ( $shove && $left ) { # Left
78 - $s .= $this->getQuickbarCompensator();
 74+ $s .= $this->getQuickbarCompensator();
7975 }
8076 wfProfileOut( __METHOD__ . '-2' );
8177 wfProfileIn( __METHOD__ . '-3' );
@@ -87,7 +83,7 @@
8884 $this->aboutLink(),
8985 $this->specialLink( 'recentchanges' ),
9086 $this->searchForm() ) )
91 - . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
 87+ . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
9288
9389 $s .= '</td>';
9490 if ( $shove && !$left ) { # Right
@@ -229,14 +225,14 @@
230226 article with "Watch this article" checkbox disabled, the article is transparently
231227 unwatched. Therefore we do not show the "Watch this page" link in edit mode
232228 */
233 - if ( $wgUser->isLoggedIn() && $articleExists) {
234 - if( $action != 'edit' && $action != 'submit' ){
 229+ if ( $wgUser->isLoggedIn() && $articleExists ) {
 230+ if( $action != 'edit' && $action != 'submit' ) {
235231 $s .= $sep . $this->watchThisPage();
236232 }
237233 if ( $this->mTitle->userCan( 'edit' ) )
238234 $s .= $sep . $this->moveThisPage();
239235 }
240 - if ( $wgUser->isAllowed( 'delete' ) and $articleExists ) {
 236+ if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
241237 $s .= $sep . $this->deleteThisPage() .
242238 $sep . $this->protectThisPage();
243239 }
@@ -244,14 +240,16 @@
245241 if( $articleExists && $action != 'history' ) {
246242 $s .= $sep . $this->historyLink();
247243 }
248 - $s.= $sep . $this->whatLinksHere();
 244+ $s .= $sep . $this->whatLinksHere();
249245
250246 if( $wgOut->isArticleRelated() ) {
251247 $s .= $sep . $this->watchPageLinksLink();
252248 }
253249
254 - if ( NS_USER == $this->mTitle->getNamespace()
255 - || $this->mTitle->getNamespace() == NS_USER_TALK ) {
 250+ if (
 251+ NS_USER == $this->mTitle->getNamespace() ||
 252+ $this->mTitle->getNamespace() == NS_USER_TALK
 253+ ) {
256254
257255 $id = User::idFromName( $this->mTitle->getText() );
258256 $ip = User::isIP( $this->mTitle->getText() );
Index: trunk/phase3/skins/Nostalgia.php
@@ -6,8 +6,9 @@
77 * @ingroup Skins
88 */
99
10 -if( !defined( 'MEDIAWIKI' ) )
 10+if( !defined( 'MEDIAWIKI' ) ) {
1111 die( -1 );
 12+}
1213
1314 /**
1415 * @todo document
@@ -40,10 +41,14 @@
4142 $s .= $this->pageTitleLinks();
4243
4344 $ol = $this->otherLanguages();
44 - if( $ol ) $s .= '<br />' . $ol;
 45+ if( $ol ) {
 46+ $s .= '<br />' . $ol;
 47+ }
4548
4649 $cat = $this->getCategoryLinks();
47 - if( $cat ) $s .= '<br />' . $cat;
 50+ if( $cat ) {
 51+ $s .= '<br />' . $cat;
 52+ }
4853
4954 $s .= "<br clear='all' /></div><hr />\n</div>\n";
5055 $s .= "\n<div id='article'>";
@@ -104,8 +109,8 @@
105110 $s .= $this->bottomLinks();
106111 $s .= "\n<br />" . $this->pageStats();
107112 $s .= "\n<br />" . $this->mainPageLink()
108 - . " | " . $this->aboutLink()
109 - . " | " . $this->searchForm();
 113+ . ' | ' . $this->aboutLink()
 114+ . ' | ' . $this->searchForm();
110115
111116 $s .= "\n</div>\n</div>\n";
112117

Status & tagging log