r49007 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49006‎ | r49007 | r49008 >
Date:15:29, 29 March 2009
Author:ashley
Status:ok
Tags:
Comment:
further cleanup to skins. instead of referring the user to docs/skin.txt, why not to include the skin descriptions on the actual files? :)
Modified paths:
  • /trunk/phase3/skins/Chick.php (modified) (history)
  • /trunk/phase3/skins/MySkin.php (modified) (history)
  • /trunk/phase3/skins/Nostalgia.php (modified) (history)
  • /trunk/phase3/skins/Simple.php (modified) (history)
  • /trunk/phase3/skins/Standard.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/Simple.php
@@ -1,8 +1,8 @@
22 <?php
33 /**
4 - * See docs/skin.txt
 4+ * Simple: A lightweight skin with a simple white-background sidebar and no
 5+ * top bar.
56 *
6 - * @todo document
77 * @file
88 * @ingroup Skins
99 */
@@ -14,7 +14,7 @@
1515 require_once( dirname(__FILE__) . '/MonoBook.php' );
1616
1717 /**
18 - * @todo document
 18+ * Inherit main code from SkinTemplate, set the CSS and template filter.
1919 * @ingroup Skins
2020 */
2121 class SkinSimple extends SkinTemplate {
@@ -28,17 +28,16 @@
2929 function setupSkinUserCss( OutputPage $out ){
3030 $out->addStyle( 'simple/main.css', 'screen' );
3131 $out->addStyle( 'simple/rtl.css', '', '', 'rtl' );
32 -
3332 }
3433
3534 function reallyGenerateUserStylesheet() {
3635 global $wgUser;
3736 $s = '';
38 - if (($undopt = $wgUser->getOption("underline")) != 2) {
 37+ if( ( $undopt = $wgUser->getOption( 'underline' ) ) != 2 ) {
3938 $underline = $undopt ? 'underline' : 'none';
4039 $s .= "a { text-decoration: $underline; }\n";
4140 }
42 - if ($wgUser->getOption('highlightbroken')) {
 41+ if( $wgUser->getOption( 'highlightbroken' ) ) {
4342 $s .= "a.new, #quickbar a.new { text-decoration: line-through; }\n";
4443 } else {
4544 $s .= <<<END
@@ -59,17 +58,15 @@
6059 }
6160 END;
6261 }
63 - if ($wgUser->getOption('justify')) {
 62+ if( $wgUser->getOption( 'justify' ) ) {
6463 $s .= "#article, #bodyContent { text-align: justify; }\n";
6564 }
66 - if (!$wgUser->getOption('showtoc')) {
 65+ if( !$wgUser->getOption( 'showtoc' ) ) {
6766 $s .= "#toc { display: none; }\n";
6867 }
69 - if (!$wgUser->getOption('editsection')) {
 68+ if( !$wgUser->getOption( 'editsection' ) ) {
7069 $s .= ".editsection { display: none; }\n";
7170 }
7271 return $s;
7372 }
74 -}
75 -
76 -
 73+}
\ No newline at end of file
Index: trunk/phase3/skins/Standard.php
@@ -1,8 +1,7 @@
22 <?php
33 /**
4 - * See docs/skin.txt
 4+ * Standard (a.k.a. Classic) skin: old MediaWiki default skin
55 *
6 - * @todo document
76 * @file
87 * @ingroup Skins
98 */
@@ -72,10 +71,10 @@
7372
7473 if ( 3 == $this->qbSetting() ) { # Floating left
7574 $qb = "setup(\"quickbar\")";
76 - if($a["onload"]) {
77 - $a["onload"] .= ";$qb";
 75+ if( $a['onload'] ) {
 76+ $a['onload'] .= ";$qb";
7877 } else {
79 - $a["onload"] = $qb;
 78+ $a['onload'] = $qb;
8079 }
8180 }
8281 return $a;
@@ -83,27 +82,26 @@
8483
8584 function doAfterContent() {
8685 global $wgContLang, $wgLang;
87 - $fname = 'SkinStandard::doAfterContent';
88 - wfProfileIn( $fname );
89 - wfProfileIn( $fname.'-1' );
 86+ wfProfileIn( __METHOD__ );
 87+ wfProfileIn( __METHOD__ . '-1' );
9088
9189 $s = "\n</div><br style=\"clear:both\" />\n";
9290 $s .= "\n<div id='footer'>";
9391 $s .= '<table border="0" cellspacing="0"><tr>';
9492
95 - wfProfileOut( $fname.'-1' );
96 - wfProfileIn( $fname.'-2' );
 93+ wfProfileOut( __METHOD__ . '-1' );
 94+ wfProfileIn( __METHOD__ . '-2' );
9795
9896 $qb = $this->qbSetting();
99 - $shove = ($qb != 0);
100 - $left = ($qb == 1 || $qb == 3);
101 - if($wgContLang->isRTL()) $left = !$left;
 97+ $shove = ( $qb != 0 );
 98+ $left = ( $qb == 1 || $qb == 3 );
 99+ if( $wgContLang->isRTL() ) $left = !$left;
102100
103101 if ( $shove && $left ) { # Left
104102 $s .= $this->getQuickbarCompensator();
105103 }
106 - wfProfileOut( $fname.'-2' );
107 - wfProfileIn( $fname.'-3' );
 104+ wfProfileOut( __METHOD__ . '-2' );
 105+ wfProfileIn( __METHOD__ . '-3' );
108106 $l = $wgContLang->isRTL() ? 'right' : 'left';
109107 $s .= "<td class='bottom' align='$l' valign='top'>";
110108
@@ -115,17 +113,19 @@
116114 $this->searchForm() ) )
117115 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
118116
119 - $s .= "</td>";
 117+ $s .= '</td>';
120118 if ( $shove && !$left ) { # Right
121119 $s .= $this->getQuickbarCompensator();
122120 }
123121 $s .= "</tr></table>\n</div>\n</div>\n";
124122
125 - wfProfileOut( $fname.'-3' );
126 - wfProfileIn( $fname.'-4' );
127 - if ( 0 != $qb ) { $s .= $this->quickBar(); }
128 - wfProfileOut( $fname.'-4' );
129 - wfProfileOut( $fname );
 123+ wfProfileOut( __METHOD__ . '-3' );
 124+ wfProfileIn( __METHOD__ . '-4' );
 125+ if ( 0 != $qb ) {
 126+ $s .= $this->quickBar();
 127+ }
 128+ wfProfileOut( __METHOD__ . '-4' );
 129+ wfProfileOut( __METHOD__ );
130130 return $s;
131131 }
132132
@@ -133,12 +133,11 @@
134134 global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang;
135135 global $wgEnableUploads, $wgRemoteUploads;
136136
137 - $fname = 'Skin::quickBar';
138 - wfProfileIn( $fname );
 137+ wfProfileIn( __METHOD__ );
139138
140139 $action = $wgRequest->getText( 'action' );
141140 $wpPreview = $wgRequest->getBool( 'wpPreview' );
142 - $tns=$wgTitle->getNamespace();
 141+ $tns = $wgTitle->getNamespace();
143142
144143 $s = "\n<div id='quickbar'>";
145144 $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
@@ -162,17 +161,17 @@
163162 if( $wgUser->isLoggedIn() ) {
164163 $s.= $this->specialLink( 'watchlist' ) ;
165164 $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
166 - wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
 165+ wfMsg( 'mycontris' ), 'target=' . wfUrlencode( $wgUser->getName() ) );
167166 }
168167 // only show watchlist link if logged in
169168 $s .= "\n<hr class='sep' />";
170169 $articleExists = $wgTitle->getArticleId();
171 - if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) {
172 - if($wgOut->isArticle()) {
 170+ if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) {
 171+ if( $wgOut->isArticle() ) {
173172 $s .= '<strong>' . $this->editThisPage() . '</strong>';
174173 } else { # backlink to the article in edit or history mode
175 - if($articleExists){ # no backlink if no article
176 - switch($tns) {
 174+ if( $articleExists ){ # no backlink if no article
 175+ switch( $tns ) {
177176 case NS_TALK:
178177 case NS_USER_TALK:
179178 case NS_PROJECT_TALK:
@@ -208,19 +207,19 @@
209208 $text = wfMsg( 'categorypage' );
210209 break;
211210 default:
212 - $text= wfMsg( 'articlepage' );
 211+ $text = wfMsg( 'articlepage' );
213212 }
214213
215214 $link = $wgTitle->getText();
216 - if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary
217 - $link = $nstext . ':' . $link ;
 215+ if( $nstext = $wgContLang->getNsText( $tns ) ) { # add namespace if necessary
 216+ $link = $nstext . ':' . $link;
218217 }
219218
220219 $s .= $this->makeLink( $link, $text );
221220 } elseif( $wgTitle->getNamespace() != NS_SPECIAL ) {
222221 # we just throw in a "New page" text to tell the user that he's in edit mode,
223222 # and to avoid messing with the separator that is prepended to the next item
224 - $s .= '<strong>' . wfMsg('newpage') . '</strong>';
 223+ $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
225224 }
226225
227226 }
@@ -240,32 +239,31 @@
241240 unwatched. Therefore we do not show the "Watch this page" link in edit mode
242241 */
243242 if ( $wgUser->isLoggedIn() && $articleExists) {
244 - if($action!='edit' && $action != 'submit' )
245 - {
 243+ if( $action != 'edit' && $action != 'submit' ){
246244 $s .= $sep . $this->watchThisPage();
247245 }
248246 if ( $wgTitle->userCan( 'edit' ) )
249247 $s .= $sep . $this->moveThisPage();
250248 }
251 - if ( $wgUser->isAllowed('delete') and $articleExists ) {
 249+ if ( $wgUser->isAllowed( 'delete' ) and $articleExists ) {
252250 $s .= $sep . $this->deleteThisPage() .
253251 $sep . $this->protectThisPage();
254252 }
255253 $s .= $sep . $this->talkLink();
256 - if ($articleExists && $action !='history') {
 254+ if( $articleExists && $action != 'history' ) {
257255 $s .= $sep . $this->historyLink();
258256 }
259 - $s.=$sep . $this->whatLinksHere();
 257+ $s.= $sep . $this->whatLinksHere();
260258
261 - if($wgOut->isArticleRelated()) {
 259+ if( $wgOut->isArticleRelated() ) {
262260 $s .= $sep . $this->watchPageLinksLink();
263261 }
264262
265263 if ( NS_USER == $wgTitle->getNamespace()
266264 || $wgTitle->getNamespace() == NS_USER_TALK ) {
267265
268 - $id=User::idFromName($wgTitle->getText());
269 - $ip=User::isIP($wgTitle->getText());
 266+ $id = User::idFromName( $wgTitle->getText() );
 267+ $ip = User::isIP( $wgTitle->getText() );
270268
271269 if( $id || $ip ){
272270 $s .= $sep . $this->userContribsLink();
@@ -289,9 +287,8 @@
290288 }
291289
292290 $s .= "\n<br /></div>\n";
293 - wfProfileOut( $fname );
 291+ wfProfileOut( __METHOD__ );
294292 return $s;
295293 }
296294
297 -
298295 }
Index: trunk/phase3/skins/MySkin.php
@@ -1,8 +1,8 @@
22 <?php
33 /**
4 - * See docs/skin.txt
 4+ * MySkin: Monobook without the CSS. The idea is that you
 5+ * customise it using user or site CSS
56 *
6 - * @todo document
77 * @file
88 * @ingroup Skins
99 */
@@ -11,7 +11,7 @@
1212 die( -1 );
1313
1414 /**
15 - * @todo document
 15+ * Inherit main code from SkinTemplate, set the CSS and template filter.
1616 * @ingroup Skins
1717 */
1818 class SkinMySkin extends SkinTemplate {
Index: trunk/phase3/skins/Chick.php
@@ -1,8 +1,8 @@
22 <?php
33 /**
4 - * See docs/skin.txt
 4+ * Chick: A lightweight Monobook skin with no sidebar, the sidebar links are
 5+ * given at the bottom of the page instead, as in the unstyled MySkin.
56 *
6 - * @todo document
77 * @file
88 * @ingroup Skins
99 */
@@ -14,7 +14,7 @@
1515 require_once( dirname(__FILE__) . '/MonoBook.php' );
1616
1717 /**
18 - * @todo document
 18+ * Inherit main code from SkinTemplate, set the CSS and template filter.
1919 * @ingroup Skins
2020 */
2121 class SkinChick extends SkinTemplate {
@@ -33,6 +33,4 @@
3434 $out->addStyle( 'chick/IE55Fixes.css', 'screen,handheld', 'IE 5.5000' );
3535 $out->addStyle( 'chick/IE60Fixes.css', 'screen,handheld', 'IE 6' );
3636 }
37 -}
38 -
39 -
 37+}
\ No newline at end of file
Index: trunk/phase3/skins/Nostalgia.php
@@ -1,8 +1,7 @@
22 <?php
33 /**
4 - * See docs/skin.txt
 4+ * Nostalgia: A skin which looks like Wikipedia did in its first year (2001).
55 *
6 - * @todo document
76 * @file
87 * @ingroup Skins
98 */
@@ -19,18 +18,19 @@
2019 function getStylesheet() {
2120 return 'common/nostalgia.css';
2221 }
 22+
2323 function getSkinName() {
24 - return "nostalgia";
 24+ return 'nostalgia';
2525 }
2626
2727 function doBeforeContent() {
2828 $s = "\n<div id='content'>\n<div id='top'>\n";
29 - $s .= "<div id=\"logo\">".$this->logoText( "right" )."</div>";
 29+ $s .= '<div id="logo">' . $this->logoText( 'right' ) . '</div>';
3030
3131 $s .= $this->pageTitle();
3232 $s .= $this->pageSubtitle() . "\n";
3333
34 - $s .= "<div id=\"topbar\">";
 34+ $s .= '<div id="topbar">';
3535 $s .= $this->topLinks() . "\n<br />";
3636
3737 $notice = wfGetSiteNotice();
@@ -40,10 +40,10 @@
4141 $s .= $this->pageTitleLinks();
4242
4343 $ol = $this->otherLanguages();
44 - if($ol) $s .= "<br />" . $ol;
 44+ if( $ol ) $s .= '<br />' . $ol;
4545
4646 $cat = $this->getCategoryLinks();
47 - if($cat) $s .= "<br />" . $cat;
 47+ if( $cat ) $s .= '<br />' . $cat;
4848
4949 $s .= "<br clear='all' /></div><hr />\n</div>\n";
5050 $s .= "\n<div id='article'>";
@@ -79,7 +79,7 @@
8080 $s .= $sep . $this->specialLink( 'watchlist' );
8181 /* show my contributions link */
8282 $s .= $sep . $this->link(
83 - SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
 83+ SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
8484 wfMsgHtml( 'mycontris' ) );
8585 /* show my preferences link */
8686 $s .= $sep . $this->specialLink( 'preferences' );
@@ -111,6 +111,4 @@
112112
113113 return $s;
114114 }
115 -}
116 -
117 -
 115+}
\ No newline at end of file

Status & tagging log