r81507 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81506‎ | r81507 | r81508 >
Date:04:18, 4 February 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Completely remove support for legacy style skins. All legacy skinning options are now part of a SkinLegacy/LegacySkinTemplate pair that inherits from the normal SkinTemplate setup. Also ported our three built in skins to use the new legacy classes. ( ;) if you want to kill legacy skins now, you only have to svn rm 4 files)
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinLegacy.php (added) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /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
@@ -15,12 +15,46 @@
1616 * @todo document
1717 * @ingroup Skins
1818 */
19 -class SkinCologneBlue extends Skin {
 19+class SkinCologneBlue extends SkinLegacy {
 20+ var $skinname = 'cologneblue', $stylename = 'cologneblue',
 21+ $template = 'CologneBlueTemplate';
2022
21 - function getSkinName() {
22 - return 'cologneblue';
 23+ function setupSkinUserCss( OutputPage $out ){
 24+ parent::setupSkinUserCss( $out );
 25+ $out->addModuleStyles( 'skins.cologneblue' );
 26+
 27+ global $wgContLang;
 28+ $qb = $this->qbSetting();
 29+ $rules = array();
 30+
 31+ if ( 2 == $qb ) { # Right
 32+ $rules[] = "#quickbar { position: absolute; right: 4px; }";
 33+ $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
 34+ } elseif ( 1 == $qb ) {
 35+ $rules[] = "#quickbar { position: absolute; left: 4px; }";
 36+ $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
 37+ } elseif ( 3 == $qb ) { # Floating left
 38+ $rules[] = "#quickbar { position:absolute; left:4px }";
 39+ $rules[] = "#topbar { margin-left: 148px }";
 40+ $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
 41+ $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
 42+ } elseif ( 4 == $qb ) { # Floating right
 43+ $rules[] = "#quickbar { position: fixed; right: 4px; }";
 44+ $rules[] = "#topbar { margin-right: 148px }";
 45+ $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
 46+ $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
 47+ }
 48+ $style = implode( "\n", $rules );
 49+ if ( $wgContLang->getDir() === 'rtl' ) {
 50+ $style = CSSJanus::transform( $style, true, false );
 51+ }
 52+ $out->addInlineStyle( $style );
2353 }
2454
 55+}
 56+
 57+class CologneBlueTemplate extends LegacyTemplate {
 58+
2559 function doBeforeContent() {
2660 $mainPageObj = Title::newMainPage();
2761
@@ -41,7 +75,7 @@
4276
4377 $s .= '<font size="-1"><span id="langlinks">';
4478 $s .= str_replace( '<br />', '', $this->otherLanguages() );
45 - $cat = $this->getCategoryLinks();
 79+ $cat = $this->getSkin()->getCategoryLinks();
4680 if( $cat ) {
4781 $s .= "<br />$cat\n";
4882 }
@@ -69,7 +103,7 @@
70104 $s .= "\n<div id='footer'>";
71105 $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
72106
73 - $qb = $this->qbSetting();
 107+ $qb = $this->getSkin()->qbSetting();
74108 if ( 1 == $qb || 3 == $qb ) { # Left
75109 $s .= $this->getQuickbarCompensator();
76110 }
@@ -77,14 +111,14 @@
78112
79113 $s .= $this->bottomLinks();
80114 $s .= $wgLang->pipeList( array(
81 - "\n<br />" . $this->link(
 115+ "\n<br />" . $this->getSkin()->link(
82116 Title::newMainPage(),
83117 null,
84118 array(),
85119 array(),
86120 array( 'known', 'noclasses' )
87121 ),
88 - $this->aboutLink(),
 122+ $this->getSkin()->aboutLink(),
89123 $this->searchForm( wfMsg( 'qbfind' ) )
90124 ) );
91125
@@ -102,44 +136,12 @@
103137 return $s;
104138 }
105139
106 - function setupSkinUserCss( OutputPage $out ){
107 - parent::setupSkinUserCss( $out );
108 - $out->addModuleStyles( 'skins.cologneblue' );
109 -
110 - global $wgContLang;
111 - $qb = $this->qbSetting();
112 - $rules = array();
113 -
114 - if ( 2 == $qb ) { # Right
115 - $rules[] = "#quickbar { position: absolute; right: 4px; }";
116 - $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
117 - } elseif ( 1 == $qb ) {
118 - $rules[] = "#quickbar { position: absolute; left: 4px; }";
119 - $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
120 - } elseif ( 3 == $qb ) { # Floating left
121 - $rules[] = "#quickbar { position:absolute; left:4px }";
122 - $rules[] = "#topbar { margin-left: 148px }";
123 - $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
124 - $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
125 - } elseif ( 4 == $qb ) { # Floating right
126 - $rules[] = "#quickbar { position: fixed; right: 4px; }";
127 - $rules[] = "#topbar { margin-right: 148px }";
128 - $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
129 - $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
130 - }
131 - $style = implode( "\n", $rules );
132 - if ( $wgContLang->getDir() === 'rtl' ) {
133 - $style = CSSJanus::transform( $style, true, false );
134 - }
135 - $out->addInlineStyle( $style );
136 - }
137 -
138140 function sysLinks() {
139141 global $wgUser, $wgLang;
140142 $li = SpecialPage::getTitleFor( 'Userlogin' );
141143 $lo = SpecialPage::getTitleFor( 'Userlogout' );
142144
143 - $rt = $this->mTitle->getPrefixedURL();
 145+ $rt = $this->getSkin()->getTitle()->getPrefixedURL();
144146 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
145147 $q = array();
146148 } else {
@@ -147,20 +149,20 @@
148150 }
149151
150152 $s = array(
151 - $this->mainPageLink(),
152 - $this->linkKnown(
 153+ $this->getSkin()->mainPageLink(),
 154+ $this->getSkin()->linkKnown(
153155 Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
154156 wfMsg( 'about' )
155157 ),
156 - $this->linkKnown(
 158+ $this->getSkin()->linkKnown(
157159 Title::newFromText( wfMsgForContent( 'helppage' ) ),
158160 wfMsg( 'help' )
159161 ),
160 - $this->linkKnown(
 162+ $this->getSkin()->linkKnown(
161163 Title::newFromText( wfMsgForContent( 'faqpage' ) ),
162164 wfMsg( 'faq' )
163165 ),
164 - $this->specialLink( 'Specialpages' )
 166+ $this->getSkin()->specialLink( 'Specialpages' )
165167 );
166168
167169 /* show links to different language variants */
@@ -171,14 +173,14 @@
172174 $s[] = $this->extensionTabLinks();
173175 }
174176 if ( $wgUser->isLoggedIn() ) {
175 - $s[] = $this->linkKnown(
 177+ $s[] = $this->getSkin()->linkKnown(
176178 $lo,
177179 wfMsg( 'logout' ),
178180 array(),
179181 $q
180182 );
181183 } else {
182 - $s[] = $this->linkKnown(
 184+ $s[] = $this->getSkin()->linkKnown(
183185 $li,
184186 wfMsg( 'login' ),
185187 array(),
@@ -196,7 +198,7 @@
197199 function quickBar(){
198200 global $wgOut, $wgUser;
199201
200 - $tns = $this->mTitle->getNamespace();
 202+ $tns = $this->getSkin()->getTitle()->getNamespace();
201203
202204 $s = "\n<div id='quickbar'>";
203205
@@ -207,7 +209,7 @@
208210 $s .= $this->menuHead( 'qbbrowse' );
209211
210212 # Use the first heading from the Monobook sidebar as the "browse" section
211 - $bar = $this->buildSidebar();
 213+ $bar = $this->getSkin()->buildSidebar();
212214 unset( $bar['SEARCH'] );
213215 unset( $bar['LANGUAGES'] );
214216 unset( $bar['TOOLBOX'] );
@@ -224,7 +226,7 @@
225227 $s .= $this->menuHead( 'qbedit' );
226228 $s .= '<strong>' . $this->editThisPage() . '</strong>';
227229
228 - $s .= $sep . $this->linkKnown(
 230+ $s .= $sep . $this->getSkin()->linkKnown(
229231 Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
230232 wfMsg( 'edithelp' )
231233 );
@@ -262,10 +264,10 @@
263265 . $sep . $this->watchPageLinksLink();
264266
265267 if( $tns == NS_USER || $tns == NS_USER_TALK ) {
266 - $id = User::idFromName( $this->mTitle->getText() );
 268+ $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
267269 if( $id != 0 ) {
268270 $s .= $sep . $this->userContribsLink();
269 - if( $this->showEmailUser( $id ) ) {
 271+ if( $this->getSkin()->showEmailUser( $id ) ) {
270272 $s .= $sep . $this->emailUserLink();
271273 }
272274 }
@@ -275,7 +277,7 @@
276278
277279 $s .= $this->menuHead( 'qbmyoptions' );
278280 if ( $wgUser->isLoggedIn() ) {
279 - $tl = $this->link(
 281+ $tl = $this->getSkin()->link(
280282 $wgUser->getTalkPage(),
281283 wfMsg( 'mytalk' ),
282284 array(),
@@ -286,30 +288,30 @@
287289 $tl .= ' *';
288290 }
289291
290 - $s .= $this->link(
 292+ $s .= $this->getSkin()->link(
291293 $wgUser->getUserPage(),
292294 wfMsg( 'mypage' ),
293295 array(),
294296 array(),
295297 array( 'known', 'noclasses' )
296 - ) . $sep . $tl . $sep . $this->specialLink( 'Watchlist' )
 298+ ) . $sep . $tl . $sep . $this->getSkin()->specialLink( 'Watchlist' )
297299 . $sep .
298 - $this->link(
 300+ $this->getSkin()->link(
299301 SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
300302 wfMsg( 'mycontris' ),
301303 array(),
302304 array(),
303305 array( 'known', 'noclasses' )
304 - ) . $sep . $this->specialLink( 'Preferences' )
305 - . $sep . $this->specialLink( 'Userlogout' );
 306+ ) . $sep . $this->getSkin()->specialLink( 'Preferences' )
 307+ . $sep . $this->getSkin()->specialLink( 'Userlogout' );
306308 } else {
307 - $s .= $this->specialLink( 'Userlogin' );
 309+ $s .= $this->getSkin()->specialLink( 'Userlogin' );
308310 }
309311
310312 $s .= $this->menuHead( 'qbspecialpages' )
311 - . $this->specialLink( 'Newpages' )
312 - . $sep . $this->specialLink( 'Listfiles' )
313 - . $sep . $this->specialLink( 'Statistics' );
 313+ . $this->getSkin()->specialLink( 'Newpages' )
 314+ . $sep . $this->getSkin()->specialLink( 'Listfiles' )
 315+ . $sep . $this->getSkin()->specialLink( 'Statistics' );
314316 if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
315317 $s .= $sep . $this->getUploadLink();
316318 }
@@ -321,7 +323,7 @@
322324 . wfMsg( 'sitesupport' ) . '</a>';
323325 }
324326
325 - $s .= $sep . $this->link(
 327+ $s .= $sep . $this->getSkin()->link(
326328 SpecialPage::getTitleFor( 'Specialpages' ),
327329 wfMsg( 'moredotdotdot' ),
328330 array(),
@@ -342,7 +344,7 @@
343345 global $wgRequest, $wgUseTwoButtonsSearchForm;
344346
345347 $search = $wgRequest->getText( 'search' );
346 - $action = $this->escapeSearchLink();
 348+ $action = $this->data['searchaction'];
347349 $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
348350 if( $label != '' ) {
349351 $s .= "{$label}: ";
Index: trunk/phase3/skins/Standard.php
@@ -14,7 +14,9 @@
1515 * @todo document
1616 * @ingroup Skins
1717 */
18 -class SkinStandard extends Skin {
 18+class SkinStandard extends SkinLegacy {
 19+ var $skinname = 'standard', $stylename = 'standard',
 20+ $template = 'StandardTemplate';
1921
2022 /**
2123 *
@@ -48,6 +50,10 @@
4951 $out->addInlineStyle( $style );
5052 }
5153
 54+}
 55+
 56+class StandardTemplate extends LegacyTemplate {
 57+
5258 function doAfterContent() {
5359 global $wgContLang, $wgLang;
5460 wfProfileIn( __METHOD__ );
@@ -60,7 +66,7 @@
6167 wfProfileOut( __METHOD__ . '-1' );
6268 wfProfileIn( __METHOD__ . '-2' );
6369
64 - $qb = $this->qbSetting();
 70+ $qb = $this->getSkin()->qbSetting();
6571 $shove = ( $qb != 0 );
6672 $left = ( $qb == 1 || $qb == 3 );
6773
@@ -74,9 +80,9 @@
7581
7682 $s .= $this->bottomLinks();
7783 $s .= "\n<br />" . $wgLang->pipeList( array(
78 - $this->mainPageLink(),
79 - $this->aboutLink(),
80 - $this->specialLink( 'Recentchanges' ),
 84+ $this->getSkin()->mainPageLink(),
 85+ $this->getSkin()->aboutLink(),
 86+ $this->getSkin()->specialLink( 'Recentchanges' ),
8187 $this->searchForm() ) )
8288 . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
8389
@@ -103,15 +109,15 @@
104110
105111 $action = $wgRequest->getText( 'action' );
106112 $wpPreview = $wgRequest->getBool( 'wpPreview' );
107 - $tns = $this->mTitle->getNamespace();
 113+ $tns = $this->getSkin()->getTitle()->getNamespace();
108114
109115 $s = "\n<div id='quickbar'>";
110 - $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
 116+ $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
111117
112118 $sep = "\n<br />";
113119
114120 # Use the first heading from the Monobook sidebar as the "browse" section
115 - $bar = $this->buildSidebar();
 121+ $bar = $this->getSkin()->buildSidebar();
116122 unset( $bar['SEARCH'] );
117123 unset( $bar['LANGUAGES'] );
118124 unset( $bar['TOOLBOX'] );
@@ -125,8 +131,8 @@
126132 }
127133
128134 if( $wgUser->isLoggedIn() ) {
129 - $s.= $this->specialLink( 'Watchlist' ) ;
130 - $s .= $sep . $this->linkKnown(
 135+ $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
 136+ $s .= $sep . $this->getSkin()->linkKnown(
131137 SpecialPage::getTitleFor( 'Contributions' ),
132138 wfMsg( 'mycontris' ),
133139 array(),
@@ -135,7 +141,7 @@
136142 }
137143 // only show watchlist link if logged in
138144 $s .= "\n<hr class='sep' />";
139 - $articleExists = $this->mTitle->getArticleId();
 145+ $articleExists = $this->getSkin()->getTitle()->getArticleId();
140146 if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) {
141147 if( $wgOut->isArticle() ) {
142148 $s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -180,17 +186,17 @@
181187 $text = wfMsg( 'articlepage' );
182188 }
183189
184 - $link = $this->mTitle->getText();
 190+ $link = $this->getSkin()->getTitle()->getText();
185191 $nstext = $wgContLang->getNsText( $tns );
186192 if( $nstext ) { # add namespace if necessary
187193 $link = $nstext . ':' . $link;
188194 }
189195
190 - $s .= $this->link(
 196+ $s .= $this->getSkin()->link(
191197 Title::newFromText( $link ),
192198 $text
193199 );
194 - } elseif( $this->mTitle->getNamespace() != NS_SPECIAL ) {
 200+ } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL ) {
195201 # we just throw in a "New page" text to tell the user that he's in edit mode,
196202 # and to avoid messing with the separator that is prepended to the next item
197203 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
@@ -198,9 +204,9 @@
199205 }
200206
201207 # "Post a comment" link
202 - if( ( $this->mTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
203 - $s .= '<br />' . $this->link(
204 - $this->mTitle,
 208+ if( ( $this->getSkin()->getTitle()->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
 209+ $s .= '<br />' . $this->getSkin()->link(
 210+ $this->getSkin()->getTitle(),
205211 wfMsg( 'postcomment' ),
206212 array(),
207213 array(
@@ -220,7 +226,7 @@
221227 if( $action != 'edit' && $action != 'submit' ) {
222228 $s .= $sep . $this->watchThisPage();
223229 }
224 - if ( $this->mTitle->userCan( 'edit' ) )
 230+ if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
225231 $s .= $sep . $this->moveThisPage();
226232 }
227233 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
@@ -238,12 +244,12 @@
239245 }
240246
241247 if (
242 - NS_USER == $this->mTitle->getNamespace() ||
243 - $this->mTitle->getNamespace() == NS_USER_TALK
 248+ NS_USER == $this->getSkin()->getTitle()->getNamespace() ||
 249+ $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
244250 ) {
245251
246 - $id = User::idFromName( $this->mTitle->getText() );
247 - $ip = User::isIP( $this->mTitle->getText() );
 252+ $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
 253+ $ip = User::isIP( $this->getSkin()->getTitle()->getText() );
248254
249255 if( $id || $ip ){
250256 $s .= $sep . $this->userContribsLink();
@@ -259,7 +265,7 @@
260266 $s .= $this->getUploadLink() . $sep;
261267 }
262268
263 - $s .= $this->specialLink( 'Specialpages' );
 269+ $s .= $this->getSkin()->specialLink( 'Specialpages' );
264270
265271 global $wgSiteSupportPage;
266272 if( $wgSiteSupportPage ) {
Index: trunk/phase3/skins/Nostalgia.php
@@ -14,20 +14,22 @@
1515 * @todo document
1616 * @ingroup Skins
1717 */
18 -class SkinNostalgia extends Skin {
 18+class SkinNostalgia extends SkinLegacy {
 19+ var $skinname = 'nostalgia', $stylename = 'nostalgia',
 20+ $template = 'NostalgiaTemplate';
1921
20 - function getSkinName() {
21 - return 'nostalgia';
22 - }
23 -
2422 function setupSkinUserCss( OutputPage $out ){
2523 parent::setupSkinUserCss( $out );
2624 $out->addModuleStyles( 'skins.nostalgia' );
2725 }
2826
 27+}
 28+
 29+class NostalgiaTemplate extends LegacyTemplate {
 30+
2931 function doBeforeContent() {
3032 $s = "\n<div id='content'>\n<div id='top'>\n";
31 - $s .= '<div id="logo">' . $this->logoText( 'right' ) . '</div>';
 33+ $s .= '<div id="logo">' . $this->getSkin()->logoText( 'right' ) . '</div>';
3234
3335 $s .= $this->pageTitle();
3436 $s .= $this->pageSubtitle() . "\n";
@@ -46,7 +48,7 @@
4749 $s .= '<br />' . $ol;
4850 }
4951
50 - $cat = $this->getCategoryLinks();
 52+ $cat = $this->getSkin()->getCategoryLinks();
5153 if( $cat ) {
5254 $s .= '<br />' . $cat;
5355 }
@@ -61,8 +63,8 @@
6264 global $wgOut, $wgUser;
6365 $sep = " |\n";
6466
65 - $s = $this->mainPageLink() . $sep
66 - . $this->specialLink( 'Recentchanges' );
 67+ $s = $this->getSkin()->mainPageLink() . $sep
 68+ . $this->getSkin()->specialLink( 'Recentchanges' );
6769
6870 if ( $wgOut->isArticle() ) {
6971 $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->historyLink();
@@ -72,29 +74,29 @@
7375 $s .= $this->variantLinks();
7476 $s .= $this->extensionTabLinks();
7577 if ( $wgUser->isAnon() ) {
76 - $s .= $sep . $this->specialLink( 'Userlogin' );
 78+ $s .= $sep . $this->getSkin()->specialLink( 'Userlogin' );
7779 } else {
7880 /* show user page and user talk links */
79 - $s .= $sep . $this->link( $wgUser->getUserPage(), wfMsgHtml( 'mypage' ) );
80 - $s .= $sep . $this->link( $wgUser->getTalkPage(), wfMsgHtml( 'mytalk' ) );
 81+ $s .= $sep . $this->getSkin()->link( $wgUser->getUserPage(), wfMsgHtml( 'mypage' ) );
 82+ $s .= $sep . $this->getSkin()->link( $wgUser->getTalkPage(), wfMsgHtml( 'mytalk' ) );
8183 if ( $wgUser->getNewtalk() ) {
8284 $s .= ' *';
8385 }
8486 /* show watchlist link */
85 - $s .= $sep . $this->specialLink( 'Watchlist' );
 87+ $s .= $sep . $this->getSkin()->specialLink( 'Watchlist' );
8688 /* show my contributions link */
87 - $s .= $sep . $this->link(
 89+ $s .= $sep . $this->getSkin()->link(
8890 SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ),
8991 wfMsgHtml( 'mycontris' ) );
9092 /* show my preferences link */
91 - $s .= $sep . $this->specialLink( 'Preferences' );
 93+ $s .= $sep . $this->getSkin()->specialLink( 'Preferences' );
9294 /* show upload file link */
9395 if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) {
9496 $s .= $sep . $this->getUploadLink();
9597 }
9698
9799 /* show log out link */
98 - $s .= $sep . $this->specialLink( 'Userlogout' );
 100+ $s .= $sep . $this->getSkin()->specialLink( 'Userlogout' );
99101 }
100102
101103 $s .= $sep . $this->specialPagesList();
@@ -109,8 +111,8 @@
110112
111113 $s .= $this->bottomLinks();
112114 $s .= "\n<br />" . $this->pageStats();
113 - $s .= "\n<br />" . $this->mainPageLink()
114 - . ' | ' . $this->aboutLink()
 115+ $s .= "\n<br />" . $this->getSkin()->mainPageLink()
 116+ . ' | ' . $this->getSkin()->aboutLink()
115117 . ' | ' . $this->searchForm();
116118
117119 $s .= "\n</div>\n</div>\n";
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -179,8 +179,6 @@
180180 return;
181181 }
182182
183 - $wgOut->suppressQuickbar();
184 -
185183 $oldTitle = $this->mOldPage->getPrefixedText();
186184 $newTitle = $this->mNewPage->getPrefixedText();
187185 if ( $oldTitle == $newTitle ) {
@@ -204,6 +202,9 @@
205203 }
206204
207205 $sk = $wgUser->getSkin();
 206+ if ( method_exists( $sk, 'suppressQuickbar' ) ) {
 207+ $sk->suppressQuickbar();
 208+ }
208209
209210 // Check if page is editable
210211 $editable = $this->mNewRev->getTitle()->userCan( 'edit' );
Index: trunk/phase3/includes/OutputPage.php
@@ -129,13 +129,6 @@
130130 var $mAllowUserJs;
131131
132132 /**
133 - * This was for the old skins and for users with 640x480 screen.
134 - * Please note old skins are still used and might prove useful for
135 - * users having old computers or visually impaired.
136 - */
137 - var $mSuppressQuickbar = false;
138 -
139 - /**
140133 * @EasterEgg I just love the name for this self documenting variable.
141134 * @todo document
142135 */
@@ -1072,23 +1065,6 @@
10731066 }
10741067
10751068 /**
1076 - * Suppress the quickbar from the output, only for skin supporting
1077 - * the quickbar
1078 - */
1079 - public function suppressQuickbar() {
1080 - $this->mSuppressQuickbar = true;
1081 - }
1082 -
1083 - /**
1084 - * Return whether the quickbar should be suppressed from the output
1085 - *
1086 - * @return Boolean
1087 - */
1088 - public function isQuickbarSuppressed() {
1089 - return $this->mSuppressQuickbar;
1090 - }
1091 -
1092 - /**
10931069 * Remove user JavaScript from scripts to load
10941070 */
10951071 public function disallowUserJs() {
Index: trunk/phase3/includes/AutoLoader.php
@@ -223,6 +223,8 @@
224224 'SiteStatsUpdate' => 'includes/SiteStats.php',
225225 'Skin' => 'includes/Skin.php',
226226 'SkinTemplate' => 'includes/SkinTemplate.php',
 227+ 'SkinLegacy' => 'includes/SkinLegacy.php',
 228+ 'LegacyTemplate' => 'includes/SkinLegacy.php',
227229 'SpecialMycontributions' => 'includes/SpecialPage.php',
228230 'SpecialMypage' => 'includes/SpecialPage.php',
229231 'SpecialMytalk' => 'includes/SpecialPage.php',
Index: trunk/phase3/includes/SkinLegacy.php
@@ -0,0 +1,937 @@
 2+<?php
 3+/**
 4+ * @defgroup Skins Skins
 5+ */
 6+
 7+if ( !defined( 'MEDIAWIKI' ) ) {
 8+ die( 1 );
 9+}
 10+
 11+class SkinLegacy extends SkinTemplate {
 12+ var $useHeadElement = true;
 13+
 14+ /**
 15+ * Add skin specific stylesheets
 16+ * @param $out OutputPage
 17+ */
 18+ function setupSkinUserCss( OutputPage $out ) {
 19+ $out->addModuleStyles( 'mediawiki.legacy.shared' );
 20+ $out->addModuleStyles( 'mediawiki.legacy.oldshared' );
 21+ }
 22+
 23+ public function commonPrintStylesheet() {
 24+ return true;
 25+ }
 26+
 27+ /**
 28+ * This was for the old skins and for users with 640x480 screen.
 29+ * Please note old skins are still used and might prove useful for
 30+ * users having old computers or visually impaired.
 31+ */
 32+ var $mSuppressQuickbar = false;
 33+
 34+ /**
 35+ * Suppress the quickbar from the output, only for skin supporting
 36+ * the quickbar
 37+ */
 38+ public function suppressQuickbar() {
 39+ $this->mSuppressQuickbar = true;
 40+ }
 41+
 42+ /**
 43+ * Return whether the quickbar should be suppressed from the output
 44+ *
 45+ * @return Boolean
 46+ */
 47+ public function isQuickbarSuppressed() {
 48+ return $this->mSuppressQuickbar;
 49+ }
 50+
 51+ function qbSetting() {
 52+ global $wgOut, $wgUser;
 53+ if ( $this->isQuickbarSuppressed() ) {
 54+ return 0;
 55+ }
 56+ $q = $wgUser->getOption( 'quickbar', 0 );
 57+ return $q;
 58+ }
 59+
 60+}
 61+
 62+class LegacyTemplate extends BaseTemplate {
 63+
 64+ // How many search boxes have we made? Avoid duplicate id's.
 65+ protected $searchboxes = '';
 66+
 67+ function execute() {
 68+ $this->html( 'headelement' );
 69+ echo $this->beforeContent();
 70+ $this->html( 'bodytext' );
 71+ echo "\n";
 72+ echo $this->afterContent();
 73+ $this->html( 'dataAfterContent' );
 74+ $this->printTrail();
 75+ echo "\n</body></html>";
 76+ }
 77+
 78+ /**
 79+ * This will be called immediately after the <body> tag. Split into
 80+ * two functions to make it easier to subclass.
 81+ */
 82+ function beforeContent() {
 83+ return $this->doBeforeContent();
 84+ }
 85+
 86+ function doBeforeContent() {
 87+ global $wgContLang;
 88+ wfProfileIn( __METHOD__ );
 89+
 90+ $s = '';
 91+ $qb = $this->getSkin()->qbSetting();
 92+
 93+ $langlinks = $this->otherLanguages();
 94+ if ( $langlinks ) {
 95+ $rows = 2;
 96+ $borderhack = '';
 97+ } else {
 98+ $rows = 1;
 99+ $langlinks = false;
 100+ $borderhack = 'class="top"';
 101+ }
 102+
 103+ $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
 104+ "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
 105+
 106+ $shove = ( $qb != 0 );
 107+ $left = ( $qb == 1 || $qb == 3 );
 108+
 109+ if ( !$shove ) {
 110+ $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
 111+ $this->logoText() . '</td>';
 112+ } elseif ( $left ) {
 113+ $s .= $this->getQuickbarCompensator( $rows );
 114+ }
 115+
 116+ $l = $wgContLang->alignStart();
 117+ $s .= "<td {$borderhack} align='$l' valign='top'>\n";
 118+
 119+ $s .= $this->topLinks();
 120+ $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n";
 121+
 122+ $r = $wgContLang->alignEnd();
 123+ $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
 124+ $s .= $this->nameAndLogin();
 125+ $s .= "\n<br />" . $this->searchForm() . '</td>';
 126+
 127+ if ( $langlinks ) {
 128+ $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
 129+ }
 130+
 131+ if ( $shove && !$left ) { # Right
 132+ $s .= $this->getQuickbarCompensator( $rows );
 133+ }
 134+
 135+ $s .= "</tr>\n</table>\n</div>\n";
 136+ $s .= "\n<div id='article'>\n";
 137+
 138+ $notice = wfGetSiteNotice();
 139+
 140+ if ( $notice ) {
 141+ $s .= "\n<div id='siteNotice'>$notice</div>\n";
 142+ }
 143+ $s .= $this->pageTitle();
 144+ $s .= $this->pageSubtitle();
 145+ $s .= $this->getSkin()->getCategories();
 146+
 147+ wfProfileOut( __METHOD__ );
 148+ return $s;
 149+ }
 150+
 151+ /**
 152+ * This gets called shortly before the </body> tag.
 153+ * @return String HTML to be put before </body>
 154+ */
 155+ function afterContent() {
 156+ return $this->doAfterContent();
 157+ }
 158+
 159+ /** overloaded by derived classes */
 160+ function doAfterContent() {
 161+ return '</div></div>';
 162+ }
 163+
 164+ function searchForm() {
 165+ global $wgRequest, $wgUseTwoButtonsSearchForm;
 166+
 167+ $search = $wgRequest->getText( 'search' );
 168+
 169+ $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="'
 170+ . $this->getSkin()->escapeSearchLink() . "\">\n"
 171+ . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
 172+ . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
 173+ . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
 174+
 175+ if ( $wgUseTwoButtonsSearchForm ) {
 176+ $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
 177+ } else {
 178+ $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
 179+ }
 180+
 181+ $s .= '</form>';
 182+
 183+ // Ensure unique id's for search boxes made after the first
 184+ $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
 185+
 186+ return $s;
 187+ }
 188+
 189+ function pageStats() {
 190+ global $wgOut, $wgLang, $wgRequest, $wgUser;
 191+ global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
 192+
 193+ if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null( $wgRequest->getVal( 'diff' ) ) ) {
 194+ return '';
 195+ }
 196+
 197+ if ( !$wgOut->isArticle() || !$this->getSkin()->getTitle()->exists() ) {
 198+ return '';
 199+ }
 200+
 201+ $article = new Article( $this->getSkin()->getTitle(), 0 );
 202+
 203+ $s = '';
 204+
 205+ if ( !$wgDisableCounters ) {
 206+ $count = $wgLang->formatNum( $article->getCount() );
 207+
 208+ if ( $count ) {
 209+ $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
 210+ }
 211+ }
 212+
 213+ if ( $wgMaxCredits != 0 ) {
 214+ $s .= ' ' . Credits::getCredits( $article, $wgMaxCredits, $wgShowCreditsIfMax );
 215+ } else {
 216+ $s .= $this->data['lastmod'];
 217+ }
 218+
 219+ if ( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
 220+ $dbr = wfGetDB( DB_SLAVE );
 221+ $res = $dbr->select(
 222+ 'watchlist',
 223+ array( 'COUNT(*) AS n' ),
 224+ array(
 225+ 'wl_title' => $dbr->strencode( $this->getSkin()->getTitle()->getDBkey() ),
 226+ 'wl_namespace' => $this->getSkin()->getTitle()->getNamespace()
 227+ ),
 228+ __METHOD__
 229+ );
 230+ $x = $dbr->fetchObject( $res );
 231+
 232+ $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview',
 233+ array( 'parseinline' ), $wgLang->formatNum( $x->n )
 234+ );
 235+ }
 236+
 237+ return $s . ' ' . $this->getSkin()->getCopyright();
 238+ }
 239+
 240+ function topLinks() {
 241+ global $wgOut;
 242+
 243+ $s = array(
 244+ $this->getSkin()->mainPageLink(),
 245+ $this->getSkin()->specialLink( 'Recentchanges' )
 246+ );
 247+
 248+ if ( $wgOut->isArticleRelated() ) {
 249+ $s[] = $this->editThisPage();
 250+ $s[] = $this->historyLink();
 251+ }
 252+
 253+ # Many people don't like this dropdown box
 254+ # $s[] = $this->specialPagesList();
 255+
 256+ if ( $this->variantLinks() ) {
 257+ $s[] = $this->variantLinks();
 258+ }
 259+
 260+ if ( $this->extensionTabLinks() ) {
 261+ $s[] = $this->extensionTabLinks();
 262+ }
 263+
 264+ // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
 265+ return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
 266+ }
 267+
 268+ /**
 269+ * Language/charset variant links for classic-style skins
 270+ * @return string
 271+ */
 272+ function variantLinks() {
 273+ $s = '';
 274+
 275+ /* show links to different language variants */
 276+ global $wgDisableLangConversion, $wgLang, $wgContLang;
 277+
 278+ $variants = $wgContLang->getVariants();
 279+
 280+ if ( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
 281+ foreach ( $variants as $code ) {
 282+ $varname = $wgContLang->getVariantname( $code );
 283+
 284+ if ( $varname == 'disable' ) {
 285+ continue;
 286+ }
 287+ $s = $wgLang->pipeList( array(
 288+ $s,
 289+ '<a href="' . $this->getSkin()->getTitle()->escapeLocalURL( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
 290+ ) );
 291+ }
 292+ }
 293+
 294+ return $s;
 295+ }
 296+
 297+ /**
 298+ * Compatibility for extensions adding functionality through tabs.
 299+ * Eventually these old skins should be replaced with SkinTemplate-based
 300+ * versions, sigh...
 301+ * @return string
 302+ * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff
 303+ */
 304+ function extensionTabLinks() {
 305+ $tabs = array();
 306+ $out = '';
 307+ $s = array();
 308+ wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) );
 309+ foreach ( $tabs as $tab ) {
 310+ $s[] = Xml::element( 'a',
 311+ array( 'href' => $tab['href'] ),
 312+ $tab['text'] );
 313+ }
 314+
 315+ if ( count( $s ) ) {
 316+ global $wgLang;
 317+
 318+ $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
 319+ $out .= $wgLang->pipeList( $s );
 320+ }
 321+
 322+ return $out;
 323+ }
 324+
 325+ function bottomLinks() {
 326+ global $wgOut, $wgUser, $wgUseTrackbacks;
 327+ $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
 328+
 329+ $s = '';
 330+ if ( $wgOut->isArticleRelated() ) {
 331+ $element[] = '<strong>' . $this->editThisPage() . '</strong>';
 332+
 333+ if ( $wgUser->isLoggedIn() ) {
 334+ $element[] = $this->watchThisPage();
 335+ }
 336+
 337+ $element[] = $this->talkLink();
 338+ $element[] = $this->historyLink();
 339+ $element[] = $this->whatLinksHere();
 340+ $element[] = $this->watchPageLinksLink();
 341+
 342+ if ( $wgUseTrackbacks ) {
 343+ $element[] = $this->trackbackLink();
 344+ }
 345+
 346+ if (
 347+ $this->getSkin()->getTitle()->getNamespace() == NS_USER ||
 348+ $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
 349+ ) {
 350+ $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
 351+ $ip = User::isIP( $this->getSkin()->getTitle()->getText() );
 352+
 353+ # Both anons and non-anons have contributions list
 354+ if ( $id || $ip ) {
 355+ $element[] = $this->userContribsLink();
 356+ }
 357+
 358+ if ( $this->getSkin()->showEmailUser( $id ) ) {
 359+ $element[] = $this->emailUserLink();
 360+ }
 361+ }
 362+
 363+ $s = implode( $element, $sep );
 364+
 365+ if ( $this->getSkin()->getTitle()->getArticleId() ) {
 366+ $s .= "\n<br />";
 367+
 368+ // Delete/protect/move links for privileged users
 369+ if ( $wgUser->isAllowed( 'delete' ) ) {
 370+ $s .= $this->deleteThisPage();
 371+ }
 372+
 373+ if ( $wgUser->isAllowed( 'protect' ) ) {
 374+ $s .= $sep . $this->protectThisPage();
 375+ }
 376+
 377+ if ( $wgUser->isAllowed( 'move' ) ) {
 378+ $s .= $sep . $this->moveThisPage();
 379+ }
 380+ }
 381+
 382+ $s .= "<br />\n" . $this->otherLanguages();
 383+ }
 384+
 385+ return $s;
 386+ }
 387+
 388+ function otherLanguages() {
 389+ global $wgOut, $wgContLang, $wgHideInterlanguageLinks;
 390+
 391+ if ( $wgHideInterlanguageLinks ) {
 392+ return '';
 393+ }
 394+
 395+ $a = $wgOut->getLanguageLinks();
 396+
 397+ if ( 0 == count( $a ) ) {
 398+ return '';
 399+ }
 400+
 401+ $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
 402+ $first = true;
 403+
 404+ if ( $wgContLang->isRTL() ) {
 405+ $s .= '<span dir="LTR">';
 406+ }
 407+
 408+ foreach ( $a as $l ) {
 409+ if ( !$first ) {
 410+ $s .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
 411+ }
 412+
 413+ $first = false;
 414+
 415+ $nt = Title::newFromText( $l );
 416+ $url = $nt->escapeFullURL();
 417+ $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
 418+ $title = htmlspecialchars( $nt->getText() );
 419+
 420+ if ( $text == '' ) {
 421+ $text = $l;
 422+ }
 423+
 424+ $style = $this->getExternalLinkAttributes();
 425+ $s .= "<a href=\"{$url}\" title=\"{$title}\"{$style}>{$text}</a>";
 426+ }
 427+
 428+ if ( $wgContLang->isRTL() ) {
 429+ $s .= '</span>';
 430+ }
 431+
 432+ return $s;
 433+ }
 434+
 435+ /**
 436+ * Show a drop-down box of special pages
 437+ */
 438+ function specialPagesList() {
 439+ global $wgContLang, $wgServer, $wgRedirectScript;
 440+
 441+ $pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
 442+
 443+ foreach ( $pages as $name => $page ) {
 444+ $pages[$name] = $page->getDescription();
 445+ }
 446+
 447+ $go = wfMsg( 'go' );
 448+ $sp = wfMsg( 'specialpages' );
 449+ $spp = $wgContLang->specialPage( 'Specialpages' );
 450+
 451+ $s = '<form id="specialpages" method="get" ' .
 452+ 'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
 453+ $s .= "<select name=\"wpDropdown\">\n";
 454+ $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
 455+
 456+
 457+ foreach ( $pages as $name => $desc ) {
 458+ $p = $wgContLang->specialPage( $name );
 459+ $s .= "<option value=\"{$p}\">{$desc}</option>\n";
 460+ }
 461+
 462+ $s .= "</select>\n";
 463+ $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
 464+ $s .= "</form>\n";
 465+
 466+ return $s;
 467+ }
 468+
 469+ function pageTitleLinks() {
 470+ global $wgOut, $wgUser, $wgRequest, $wgLang;
 471+
 472+ $oldid = $wgRequest->getVal( 'oldid' );
 473+ $diff = $wgRequest->getVal( 'diff' );
 474+ $action = $wgRequest->getText( 'action' );
 475+
 476+ $s[] = $this->printableLink();
 477+ $disclaimer = $this->getSkin()->disclaimerLink(); # may be empty
 478+
 479+ if ( $disclaimer ) {
 480+ $s[] = $disclaimer;
 481+ }
 482+
 483+ $privacy = $this->getSkin()->privacyLink(); # may be empty too
 484+
 485+ if ( $privacy ) {
 486+ $s[] = $privacy;
 487+ }
 488+
 489+ if ( $wgOut->isArticleRelated() ) {
 490+ if ( $this->getSkin()->getTitle()->getNamespace() == NS_FILE ) {
 491+ $name = $this->getSkin()->getTitle()->getDBkey();
 492+ $image = wfFindFile( $this->getSkin()->getTitle() );
 493+
 494+ if ( $image ) {
 495+ $link = htmlspecialchars( $image->getURL() );
 496+ $style = $this->getInternalLinkAttributes( $link, $name );
 497+ $s[] = "<a href=\"{$link}\"{$style}>{$name}</a>";
 498+ }
 499+ }
 500+ }
 501+
 502+ if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
 503+ $s[] .= $this->getSkin()->link(
 504+ $this->getSkin()->getTitle(),
 505+ wfMsg( 'currentrev' ),
 506+ array(),
 507+ array(),
 508+ array( 'known', 'noclasses' )
 509+ );
 510+ }
 511+
 512+ if ( $wgUser->getNewtalk() ) {
 513+ # do not show "You have new messages" text when we are viewing our
 514+ # own talk page
 515+ if ( !$this->getSkin()->getTitle()->equals( $wgUser->getTalkPage() ) ) {
 516+ $tl = $this->getSkin()->link(
 517+ $wgUser->getTalkPage(),
 518+ wfMsgHtml( 'newmessageslink' ),
 519+ array(),
 520+ array( 'redirect' => 'no' ),
 521+ array( 'known', 'noclasses' )
 522+ );
 523+
 524+ $dl = $this->getSkin()->link(
 525+ $wgUser->getTalkPage(),
 526+ wfMsgHtml( 'newmessagesdifflink' ),
 527+ array(),
 528+ array( 'diff' => 'cur' ),
 529+ array( 'known', 'noclasses' )
 530+ );
 531+ $s[] = '<strong>' . wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
 532+ # disable caching
 533+ $wgOut->setSquidMaxage( 0 );
 534+ $wgOut->enableClientCache( false );
 535+ }
 536+ }
 537+
 538+ $undelete = $this->getSkin()->getUndeleteLink();
 539+
 540+ if ( !empty( $undelete ) ) {
 541+ $s[] = $undelete;
 542+ }
 543+
 544+ return $wgLang->pipeList( $s );
 545+ }
 546+
 547+ /**
 548+ * Gets the h1 element with the page title.
 549+ * @return string
 550+ */
 551+ function pageTitle() {
 552+ global $wgOut;
 553+ $s = '<h1 class="pagetitle">' . $wgOut->getPageTitle() . '</h1>';
 554+ return $s;
 555+ }
 556+
 557+ function pageSubtitle() {
 558+ global $wgOut;
 559+
 560+ $sub = $wgOut->getSubtitle();
 561+
 562+ if ( $sub == '' ) {
 563+ global $wgExtraSubtitle;
 564+ $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
 565+ }
 566+
 567+ $subpages = $this->getSkin()->subPageSubtitle();
 568+ $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
 569+ $s = "<p class='subtitle'>{$sub}</p>\n";
 570+
 571+ return $s;
 572+ }
 573+
 574+ function printableLink() {
 575+ global $wgOut, $wgFeedClasses, $wgRequest, $wgLang;
 576+
 577+ $s = array();
 578+
 579+ if ( !$wgOut->isPrintable() ) {
 580+ $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
 581+ $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
 582+ }
 583+
 584+ if ( $wgOut->isSyndicated() ) {
 585+ foreach ( $wgFeedClasses as $format => $class ) {
 586+ $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
 587+ $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
 588+ . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
 589+ }
 590+ }
 591+ return $wgLang->pipeList( $s );
 592+ }
 593+
 594+ function getQuickbarCompensator( $rows = 1 ) {
 595+ return "<td width='152' rowspan='{$rows}'>&#160;</td>";
 596+ }
 597+
 598+ function editThisPage() {
 599+ global $wgOut;
 600+
 601+ if ( !$wgOut->isArticleRelated() ) {
 602+ $s = wfMsg( 'protectedpage' );
 603+ } else {
 604+ if ( $this->getSkin()->getTitle()->quickUserCan( 'edit' ) && $this->getSkin()->getTitle()->exists() ) {
 605+ $t = wfMsg( 'editthispage' );
 606+ } elseif ( $this->getSkin()->getTitle()->quickUserCan( 'create' ) && !$this->getSkin()->getTitle()->exists() ) {
 607+ $t = wfMsg( 'create-this-page' );
 608+ } else {
 609+ $t = wfMsg( 'viewsource' );
 610+ }
 611+
 612+ $s = $this->getSkin()->link(
 613+ $this->getSkin()->getTitle(),
 614+ $t,
 615+ array(),
 616+ $this->getSkin()->editUrlOptions(),
 617+ array( 'known', 'noclasses' )
 618+ );
 619+ }
 620+
 621+ return $s;
 622+ }
 623+
 624+ function deleteThisPage() {
 625+ global $wgUser, $wgRequest;
 626+
 627+ $diff = $wgRequest->getVal( 'diff' );
 628+
 629+ if ( $this->getSkin()->getTitle()->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
 630+ $t = wfMsg( 'deletethispage' );
 631+
 632+ $s = $this->getSkin()->link(
 633+ $this->getSkin()->getTitle(),
 634+ $t,
 635+ array(),
 636+ array( 'action' => 'delete' ),
 637+ array( 'known', 'noclasses' )
 638+ );
 639+ } else {
 640+ $s = '';
 641+ }
 642+
 643+ return $s;
 644+ }
 645+
 646+ function protectThisPage() {
 647+ global $wgUser, $wgRequest;
 648+
 649+ $diff = $wgRequest->getVal( 'diff' );
 650+
 651+ if ( $this->getSkin()->getTitle()->getArticleId() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
 652+ if ( $this->getSkin()->getTitle()->isProtected() ) {
 653+ $text = wfMsg( 'unprotectthispage' );
 654+ $query = array( 'action' => 'unprotect' );
 655+ } else {
 656+ $text = wfMsg( 'protectthispage' );
 657+ $query = array( 'action' => 'protect' );
 658+ }
 659+
 660+ $s = $this->getSkin()->link(
 661+ $this->getSkin()->getTitle(),
 662+ $text,
 663+ array(),
 664+ $query,
 665+ array( 'known', 'noclasses' )
 666+ );
 667+ } else {
 668+ $s = '';
 669+ }
 670+
 671+ return $s;
 672+ }
 673+
 674+ function watchThisPage() {
 675+ global $wgOut;
 676+ ++$this->mWatchLinkNum;
 677+
 678+ if ( $wgOut->isArticleRelated() ) {
 679+ if ( $this->getSkin()->getTitle()->userIsWatching() ) {
 680+ $text = wfMsg( 'unwatchthispage' );
 681+ $query = array( 'action' => 'unwatch' );
 682+ $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
 683+ } else {
 684+ $text = wfMsg( 'watchthispage' );
 685+ $query = array( 'action' => 'watch' );
 686+ $id = 'mw-watch-link' . $this->mWatchLinkNum;
 687+ }
 688+
 689+ $s = $this->getSkin()->link(
 690+ $this->getSkin()->getTitle(),
 691+ $text,
 692+ array( 'id' => $id ),
 693+ $query,
 694+ array( 'known', 'noclasses' )
 695+ );
 696+ } else {
 697+ $s = wfMsg( 'notanarticle' );
 698+ }
 699+
 700+ return $s;
 701+ }
 702+
 703+ function moveThisPage() {
 704+ if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
 705+ return $this->getSkin()->link(
 706+ SpecialPage::getTitleFor( 'Movepage' ),
 707+ wfMsg( 'movethispage' ),
 708+ array(),
 709+ array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() ),
 710+ array( 'known', 'noclasses' )
 711+ );
 712+ } else {
 713+ // no message if page is protected - would be redundant
 714+ return '';
 715+ }
 716+ }
 717+
 718+ function historyLink() {
 719+ return $this->getSkin()->link(
 720+ $this->getSkin()->getTitle(),
 721+ wfMsgHtml( 'history' ),
 722+ array( 'rel' => 'archives' ),
 723+ array( 'action' => 'history' )
 724+ );
 725+ }
 726+
 727+ function whatLinksHere() {
 728+ return $this->getSkin()->link(
 729+ SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
 730+ wfMsgHtml( 'whatlinkshere' ),
 731+ array(),
 732+ array(),
 733+ array( 'known', 'noclasses' )
 734+ );
 735+ }
 736+
 737+ function userContribsLink() {
 738+ return $this->getSkin()->link(
 739+ SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
 740+ wfMsgHtml( 'contributions' ),
 741+ array(),
 742+ array(),
 743+ array( 'known', 'noclasses' )
 744+ );
 745+ }
 746+
 747+ function emailUserLink() {
 748+ return $this->getSkin()->link(
 749+ SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
 750+ wfMsg( 'emailuser' ),
 751+ array(),
 752+ array(),
 753+ array( 'known', 'noclasses' )
 754+ );
 755+ }
 756+
 757+ function watchPageLinksLink() {
 758+ global $wgOut;
 759+
 760+ if ( !$wgOut->isArticleRelated() ) {
 761+ return '(' . wfMsg( 'notanarticle' ) . ')';
 762+ } else {
 763+ return $this->getSkin()->link(
 764+ SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
 765+ wfMsg( 'recentchangeslinked-toolbox' ),
 766+ array(),
 767+ array(),
 768+ array( 'known', 'noclasses' )
 769+ );
 770+ }
 771+ }
 772+
 773+ function trackbackLink() {
 774+ return '<a href="' . $this->getSkin()->getTitle()->trackbackURL() . '">'
 775+ . wfMsg( 'trackbacklink' ) . '</a>';
 776+ }
 777+
 778+ function talkLink() {
 779+ if ( NS_SPECIAL == $this->getSkin()->getTitle()->getNamespace() ) {
 780+ # No discussion links for special pages
 781+ return '';
 782+ }
 783+
 784+ $linkOptions = array();
 785+
 786+ if ( $this->getSkin()->getTitle()->isTalkPage() ) {
 787+ $link = $this->getSkin()->getTitle()->getSubjectPage();
 788+ switch( $link->getNamespace() ) {
 789+ case NS_MAIN:
 790+ $text = wfMsg( 'articlepage' );
 791+ break;
 792+ case NS_USER:
 793+ $text = wfMsg( 'userpage' );
 794+ break;
 795+ case NS_PROJECT:
 796+ $text = wfMsg( 'projectpage' );
 797+ break;
 798+ case NS_FILE:
 799+ $text = wfMsg( 'imagepage' );
 800+ # Make link known if image exists, even if the desc. page doesn't.
 801+ if ( wfFindFile( $link ) )
 802+ $linkOptions[] = 'known';
 803+ break;
 804+ case NS_MEDIAWIKI:
 805+ $text = wfMsg( 'mediawikipage' );
 806+ break;
 807+ case NS_TEMPLATE:
 808+ $text = wfMsg( 'templatepage' );
 809+ break;
 810+ case NS_HELP:
 811+ $text = wfMsg( 'viewhelppage' );
 812+ break;
 813+ case NS_CATEGORY:
 814+ $text = wfMsg( 'categorypage' );
 815+ break;
 816+ default:
 817+ $text = wfMsg( 'articlepage' );
 818+ }
 819+ } else {
 820+ $link = $this->getSkin()->getTitle()->getTalkPage();
 821+ $text = wfMsg( 'talkpage' );
 822+ }
 823+
 824+ $s = $this->getSkin()->link( $link, $text, array(), array(), $linkOptions );
 825+
 826+ return $s;
 827+ }
 828+
 829+ function commentLink() {
 830+ global $wgOut;
 831+
 832+ if ( $this->getSkin()->getTitle()->getNamespace() == NS_SPECIAL ) {
 833+ return '';
 834+ }
 835+
 836+ # __NEWSECTIONLINK___ changes behaviour here
 837+ # If it is present, the link points to this page, otherwise
 838+ # it points to the talk page
 839+ if ( $this->getSkin()->getTitle()->isTalkPage() ) {
 840+ $title = $this->getSkin()->getTitle();
 841+ } elseif ( $wgOut->showNewSectionLink() ) {
 842+ $title = $this->getSkin()->getTitle();
 843+ } else {
 844+ $title = $this->getSkin()->getTitle()->getTalkPage();
 845+ }
 846+
 847+ return $this->getSkin()->link(
 848+ $title,
 849+ wfMsg( 'postcomment' ),
 850+ array(),
 851+ array(
 852+ 'action' => 'edit',
 853+ 'section' => 'new'
 854+ ),
 855+ array( 'known', 'noclasses' )
 856+ );
 857+ }
 858+
 859+ function getUploadLink() {
 860+ global $wgUploadNavigationUrl;
 861+
 862+ if ( $wgUploadNavigationUrl ) {
 863+ # Using an empty class attribute to avoid automatic setting of "external" class
 864+ return $this->makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '' ) );
 865+ } else {
 866+ return $this->getSkin()->link(
 867+ SpecialPage::getTitleFor( 'Upload' ),
 868+ wfMsgHtml( 'upload' ),
 869+ array(),
 870+ array(),
 871+ array( 'known', 'noclasses' )
 872+ );
 873+ }
 874+ }
 875+
 876+ function nameAndLogin() {
 877+ global $wgUser, $wgLang, $wgContLang;
 878+
 879+ $logoutPage = $wgContLang->specialPage( 'Userlogout' );
 880+
 881+ $ret = '';
 882+
 883+ if ( $wgUser->isAnon() ) {
 884+ if ( $this->getSkin()->showIPinHeader() ) {
 885+ $name = wfGetIP();
 886+
 887+ $talkLink = $this->getSkin()->link( $wgUser->getTalkPage(),
 888+ $wgLang->getNsText( NS_TALK ) );
 889+
 890+ $ret .= "$name ($talkLink)";
 891+ } else {
 892+ $ret .= wfMsg( 'notloggedin' );
 893+ }
 894+
 895+ $returnTo = $this->getSkin()->getTitle()->getPrefixedDBkey();
 896+ $query = array();
 897+
 898+ if ( $logoutPage != $returnTo ) {
 899+ $query['returnto'] = $returnTo;
 900+ }
 901+
 902+ $loginlink = $wgUser->isAllowed( 'createaccount' )
 903+ ? 'nav-login-createaccount'
 904+ : 'login';
 905+ $ret .= "\n<br />" . $this->getSkin()->link(
 906+ SpecialPage::getTitleFor( 'Userlogin' ),
 907+ wfMsg( $loginlink ), array(), $query
 908+ );
 909+ } else {
 910+ $returnTo = $this->getSkin()->getTitle()->getPrefixedDBkey();
 911+ $talkLink = $this->getSkin()->link( $wgUser->getTalkPage(),
 912+ $wgLang->getNsText( NS_TALK ) );
 913+
 914+ $ret .= $this->getSkin()->link( $wgUser->getUserPage(),
 915+ htmlspecialchars( $wgUser->getName() ) );
 916+ $ret .= " ($talkLink)<br />";
 917+ $ret .= $wgLang->pipeList( array(
 918+ $this->getSkin()->link(
 919+ SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
 920+ array(), array( 'returnto' => $returnTo )
 921+ ),
 922+ $this->getSkin()->specialLink( 'Preferences' ),
 923+ ) );
 924+ }
 925+
 926+ $ret = $wgLang->pipeList( array(
 927+ $ret,
 928+ $this->getSkin()->link(
 929+ Title::newFromText( wfMsgForContent( 'helppage' ) ),
 930+ wfMsg( 'help' )
 931+ ),
 932+ ) );
 933+
 934+ return $ret;
 935+ }
 936+
 937+}
 938+
Property changes on: trunk/phase3/includes/SkinLegacy.php
___________________________________________________________________
Added: svn:eol-style
1939 + native
Index: trunk/phase3/includes/Skin.php
@@ -15,13 +15,11 @@
1616 *
1717 * @ingroup Skins
1818 */
19 -class Skin extends Linker {
 19+abstract class Skin extends Linker {
2020 /**#@+
2121 * @private
2222 */
2323 var $mWatchLinkNum = 0; // Appended to end of watch link id's
24 - // How many search boxes have we made? Avoid duplicate id's.
25 - protected $searchboxes = '';
2624 /**#@-*/
2725 protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
2826 protected $skinname = 'standard';
@@ -181,18 +179,6 @@
182180 return $this->skinname;
183181 }
184182
185 - function qbSetting() {
186 - global $wgOut, $wgUser;
187 -
188 - if ( $wgOut->isQuickbarSuppressed() ) {
189 - return 0;
190 - }
191 -
192 - $q = $wgUser->getOption( 'quickbar', 0 );
193 -
194 - return $q;
195 - }
196 -
197183 function initPage( OutputPage $out ) {
198184 global $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI;
199185
@@ -439,6 +425,7 @@
440426 /**
441427 * Outputs the HTML generated by other functions.
442428 * @param $out Object: instance of OutputPage
 429+ * @todo Exterminate!
443430 */
444431 function outputPage( OutputPage $out ) {
445432 global $wgDebugComments;
@@ -656,11 +643,9 @@
657644 /**
658645 * Add skin specific stylesheets
659646 * @param $out OutputPage
 647+ * @delete
660648 */
661 - function setupSkinUserCss( OutputPage $out ) {
662 - $out->addModuleStyles( 'mediawiki.legacy.shared' );
663 - $out->addModuleStyles( 'mediawiki.legacy.oldshared' );
664 - }
 649+ abstract function setupSkinUserCss( OutputPage $out );
665650
666651 function getPageClasses( $title ) {
667652 $numeric = 'ns-' . $title->getNamespace();
@@ -695,79 +680,6 @@
696681 return $wgLogo;
697682 }
698683
699 - /**
700 - * This will be called immediately after the <body> tag. Split into
701 - * two functions to make it easier to subclass.
702 - */
703 - function beforeContent() {
704 - return $this->doBeforeContent();
705 - }
706 -
707 - function doBeforeContent() {
708 - global $wgContLang;
709 - wfProfileIn( __METHOD__ );
710 -
711 - $s = '';
712 - $qb = $this->qbSetting();
713 -
714 - $langlinks = $this->otherLanguages();
715 - if ( $langlinks ) {
716 - $rows = 2;
717 - $borderhack = '';
718 - } else {
719 - $rows = 1;
720 - $langlinks = false;
721 - $borderhack = 'class="top"';
722 - }
723 -
724 - $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
725 - "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
726 -
727 - $shove = ( $qb != 0 );
728 - $left = ( $qb == 1 || $qb == 3 );
729 -
730 - if ( !$shove ) {
731 - $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
732 - $this->logoText() . '</td>';
733 - } elseif ( $left ) {
734 - $s .= $this->getQuickbarCompensator( $rows );
735 - }
736 -
737 - $l = $wgContLang->alignStart();
738 - $s .= "<td {$borderhack} align='$l' valign='top'>\n";
739 -
740 - $s .= $this->topLinks();
741 - $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n";
742 -
743 - $r = $wgContLang->alignEnd();
744 - $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
745 - $s .= $this->nameAndLogin();
746 - $s .= "\n<br />" . $this->searchForm() . '</td>';
747 -
748 - if ( $langlinks ) {
749 - $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
750 - }
751 -
752 - if ( $shove && !$left ) { # Right
753 - $s .= $this->getQuickbarCompensator( $rows );
754 - }
755 -
756 - $s .= "</tr>\n</table>\n</div>\n";
757 - $s .= "\n<div id='article'>\n";
758 -
759 - $notice = wfGetSiteNotice();
760 -
761 - if ( $notice ) {
762 - $s .= "\n<div id='siteNotice'>$notice</div>\n";
763 - }
764 - $s .= $this->pageTitle();
765 - $s .= $this->pageSubtitle();
766 - $s .= $this->getCategories();
767 -
768 - wfProfileOut( __METHOD__ );
769 - return $s;
770 - }
771 -
772684 function getCategoryLinks() {
773685 global $wgOut, $wgUseCategoryBrowser;
774686 global $wgContLang, $wgUser;
@@ -879,10 +791,6 @@
880792 return "<div id='catlinks' class='$classes'>{$catlinks}</div>";
881793 }
882794
883 - function getQuickbarCompensator( $rows = 1 ) {
884 - return "<td width='152' rowspan='{$rows}'>&#160;</td>";
885 - }
886 -
887795 /**
888796 * This runs a hook to allow extensions placing their stuff after content
889797 * and article metadata (e.g. categories).
@@ -976,15 +884,6 @@
977885
978886 /**
979887 * This gets called shortly before the </body> tag.
980 - * @return String HTML to be put before </body>
981 - */
982 - function afterContent() {
983 - $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
984 - return $printfooter . $this->generateDebugHTML() . $this->doAfterContent();
985 - }
986 -
987 - /**
988 - * This gets called shortly before the </body> tag.
989888 * @param $out OutputPage object
990889 * @return String HTML-wrapped JS code to be put before </body>
991890 */
@@ -1001,94 +900,6 @@
1002901 return wfMsg( 'retrievedfrom', '<a href="' . $url . '">' . $url . '</a>' );
1003902 }
1004903
1005 - function printFooter() {
1006 - return "<p>" . $this->printSource() .
1007 - "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
1008 - }
1009 -
1010 - /** overloaded by derived classes */
1011 - function doAfterContent() {
1012 - return '</div></div>';
1013 - }
1014 -
1015 - function pageTitleLinks() {
1016 - global $wgOut, $wgUser, $wgRequest, $wgLang;
1017 -
1018 - $oldid = $wgRequest->getVal( 'oldid' );
1019 - $diff = $wgRequest->getVal( 'diff' );
1020 - $action = $wgRequest->getText( 'action' );
1021 -
1022 - $s[] = $this->printableLink();
1023 - $disclaimer = $this->disclaimerLink(); # may be empty
1024 -
1025 - if ( $disclaimer ) {
1026 - $s[] = $disclaimer;
1027 - }
1028 -
1029 - $privacy = $this->privacyLink(); # may be empty too
1030 -
1031 - if ( $privacy ) {
1032 - $s[] = $privacy;
1033 - }
1034 -
1035 - if ( $wgOut->isArticleRelated() ) {
1036 - if ( $this->mTitle->getNamespace() == NS_FILE ) {
1037 - $name = $this->mTitle->getDBkey();
1038 - $image = wfFindFile( $this->mTitle );
1039 -
1040 - if ( $image ) {
1041 - $link = htmlspecialchars( $image->getURL() );
1042 - $style = $this->getInternalLinkAttributes( $link, $name );
1043 - $s[] = "<a href=\"{$link}\"{$style}>{$name}</a>";
1044 - }
1045 - }
1046 - }
1047 -
1048 - if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
1049 - $s[] .= $this->link(
1050 - $this->mTitle,
1051 - wfMsg( 'currentrev' ),
1052 - array(),
1053 - array(),
1054 - array( 'known', 'noclasses' )
1055 - );
1056 - }
1057 -
1058 - if ( $wgUser->getNewtalk() ) {
1059 - # do not show "You have new messages" text when we are viewing our
1060 - # own talk page
1061 - if ( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
1062 - $tl = $this->link(
1063 - $wgUser->getTalkPage(),
1064 - wfMsgHtml( 'newmessageslink' ),
1065 - array(),
1066 - array( 'redirect' => 'no' ),
1067 - array( 'known', 'noclasses' )
1068 - );
1069 -
1070 - $dl = $this->link(
1071 - $wgUser->getTalkPage(),
1072 - wfMsgHtml( 'newmessagesdifflink' ),
1073 - array(),
1074 - array( 'diff' => 'cur' ),
1075 - array( 'known', 'noclasses' )
1076 - );
1077 - $s[] = '<strong>' . wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
1078 - # disable caching
1079 - $wgOut->setSquidMaxage( 0 );
1080 - $wgOut->enableClientCache( false );
1081 - }
1082 - }
1083 -
1084 - $undelete = $this->getUndeleteLink();
1085 -
1086 - if ( !empty( $undelete ) ) {
1087 - $s[] = $undelete;
1088 - }
1089 -
1090 - return $wgLang->pipeList( $s );
1091 - }
1092 -
1093904 function getUndeleteLink() {
1094905 global $wgUser, $wgLang, $wgRequest;
1095906
@@ -1121,53 +932,6 @@
1122933 return '';
1123934 }
1124935
1125 - function printableLink() {
1126 - global $wgOut, $wgFeedClasses, $wgRequest, $wgLang;
1127 -
1128 - $s = array();
1129 -
1130 - if ( !$wgOut->isPrintable() ) {
1131 - $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
1132 - $s[] = "<a href=\"$printurl\" rel=\"alternate\">" . wfMsg( 'printableversion' ) . '</a>';
1133 - }
1134 -
1135 - if ( $wgOut->isSyndicated() ) {
1136 - foreach ( $wgFeedClasses as $format => $class ) {
1137 - $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
1138 - $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
1139 - . " class=\"feedlink\">" . wfMsgHtml( "feed-$format" ) . "</a>";
1140 - }
1141 - }
1142 - return $wgLang->pipeList( $s );
1143 - }
1144 -
1145 - /**
1146 - * Gets the h1 element with the page title.
1147 - * @return string
1148 - */
1149 - function pageTitle() {
1150 - global $wgOut;
1151 - $s = '<h1 class="pagetitle">' . $wgOut->getPageTitle() . '</h1>';
1152 - return $s;
1153 - }
1154 -
1155 - function pageSubtitle() {
1156 - global $wgOut;
1157 -
1158 - $sub = $wgOut->getSubtitle();
1159 -
1160 - if ( $sub == '' ) {
1161 - global $wgExtraSubtitle;
1162 - $sub = wfMsgExt( 'tagline', 'parsemag' ) . $wgExtraSubtitle;
1163 - }
1164 -
1165 - $subpages = $this->subPageSubtitle();
1166 - $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
1167 - $s = "<p class='subtitle'>{$sub}</p>\n";
1168 -
1169 - return $s;
1170 - }
1171 -
1172936 function subPageSubtitle() {
1173937 $subpages = '';
1174938
@@ -1229,67 +993,6 @@
1230994 return $wgShowIPinHeader && session_id() != '';
1231995 }
1232996
1233 - function nameAndLogin() {
1234 - global $wgUser, $wgLang, $wgContLang;
1235 -
1236 - $logoutPage = $wgContLang->specialPage( 'Userlogout' );
1237 -
1238 - $ret = '';
1239 -
1240 - if ( $wgUser->isAnon() ) {
1241 - if ( $this->showIPinHeader() ) {
1242 - $name = wfGetIP();
1243 -
1244 - $talkLink = $this->link( $wgUser->getTalkPage(),
1245 - $wgLang->getNsText( NS_TALK ) );
1246 -
1247 - $ret .= "$name ($talkLink)";
1248 - } else {
1249 - $ret .= wfMsg( 'notloggedin' );
1250 - }
1251 -
1252 - $returnTo = $this->mTitle->getPrefixedDBkey();
1253 - $query = array();
1254 -
1255 - if ( $logoutPage != $returnTo ) {
1256 - $query['returnto'] = $returnTo;
1257 - }
1258 -
1259 - $loginlink = $wgUser->isAllowed( 'createaccount' )
1260 - ? 'nav-login-createaccount'
1261 - : 'login';
1262 - $ret .= "\n<br />" . $this->link(
1263 - SpecialPage::getTitleFor( 'Userlogin' ),
1264 - wfMsg( $loginlink ), array(), $query
1265 - );
1266 - } else {
1267 - $returnTo = $this->mTitle->getPrefixedDBkey();
1268 - $talkLink = $this->link( $wgUser->getTalkPage(),
1269 - $wgLang->getNsText( NS_TALK ) );
1270 -
1271 - $ret .= $this->link( $wgUser->getUserPage(),
1272 - htmlspecialchars( $wgUser->getName() ) );
1273 - $ret .= " ($talkLink)<br />";
1274 - $ret .= $wgLang->pipeList( array(
1275 - $this->link(
1276 - SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
1277 - array(), array( 'returnto' => $returnTo )
1278 - ),
1279 - $this->specialLink( 'Preferences' ),
1280 - ) );
1281 - }
1282 -
1283 - $ret = $wgLang->pipeList( array(
1284 - $ret,
1285 - $this->link(
1286 - Title::newFromText( wfMsgForContent( 'helppage' ) ),
1287 - wfMsg( 'help' )
1288 - ),
1289 - ) );
1290 -
1291 - return $ret;
1292 - }
1293 -
1294997 function getSearchLink() {
1295998 $searchPage = SpecialPage::getTitleFor( 'Search' );
1296999 return $searchPage->getLocalURL();
@@ -1299,229 +1002,6 @@
13001003 return htmlspecialchars( $this->getSearchLink() );
13011004 }
13021005
1303 - function searchForm() {
1304 - global $wgRequest, $wgUseTwoButtonsSearchForm;
1305 -
1306 - $search = $wgRequest->getText( 'search' );
1307 -
1308 - $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="'
1309 - . $this->escapeSearchLink() . "\">\n"
1310 - . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
1311 - . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
1312 - . '<input type="submit" name="go" value="' . wfMsg( 'searcharticle' ) . '" />';
1313 -
1314 - if ( $wgUseTwoButtonsSearchForm ) {
1315 - $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMsg( 'searchbutton' ) . "\" />\n";
1316 - } else {
1317 - $s .= ' <a href="' . $this->escapeSearchLink() . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a>\n";
1318 - }
1319 -
1320 - $s .= '</form>';
1321 -
1322 - // Ensure unique id's for search boxes made after the first
1323 - $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
1324 -
1325 - return $s;
1326 - }
1327 -
1328 - function topLinks() {
1329 - global $wgOut;
1330 -
1331 - $s = array(
1332 - $this->mainPageLink(),
1333 - $this->specialLink( 'Recentchanges' )
1334 - );
1335 -
1336 - if ( $wgOut->isArticleRelated() ) {
1337 - $s[] = $this->editThisPage();
1338 - $s[] = $this->historyLink();
1339 - }
1340 -
1341 - # Many people don't like this dropdown box
1342 - # $s[] = $this->specialPagesList();
1343 -
1344 - if ( $this->variantLinks() ) {
1345 - $s[] = $this->variantLinks();
1346 - }
1347 -
1348 - if ( $this->extensionTabLinks() ) {
1349 - $s[] = $this->extensionTabLinks();
1350 - }
1351 -
1352 - // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
1353 - return implode( $s, wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n" );
1354 - }
1355 -
1356 - /**
1357 - * Compatibility for extensions adding functionality through tabs.
1358 - * Eventually these old skins should be replaced with SkinTemplate-based
1359 - * versions, sigh...
1360 - * @return string
1361 - */
1362 - function extensionTabLinks() {
1363 - $tabs = array();
1364 - $out = '';
1365 - $s = array();
1366 - wfRunHooks( 'SkinTemplateTabs', array( $this, &$tabs ) );
1367 - foreach ( $tabs as $tab ) {
1368 - $s[] = Xml::element( 'a',
1369 - array( 'href' => $tab['href'] ),
1370 - $tab['text'] );
1371 - }
1372 -
1373 - if ( count( $s ) ) {
1374 - global $wgLang;
1375 -
1376 - $out = wfMsgExt( 'pipe-separator' , 'escapenoentities' );
1377 - $out .= $wgLang->pipeList( $s );
1378 - }
1379 -
1380 - return $out;
1381 - }
1382 -
1383 - /**
1384 - * Language/charset variant links for classic-style skins
1385 - * @return string
1386 - */
1387 - function variantLinks() {
1388 - $s = '';
1389 -
1390 - /* show links to different language variants */
1391 - global $wgDisableLangConversion, $wgLang, $wgContLang;
1392 -
1393 - $variants = $wgContLang->getVariants();
1394 -
1395 - if ( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
1396 - foreach ( $variants as $code ) {
1397 - $varname = $wgContLang->getVariantname( $code );
1398 -
1399 - if ( $varname == 'disable' ) {
1400 - continue;
1401 - }
1402 - $s = $wgLang->pipeList( array(
1403 - $s,
1404 - '<a href="' . $this->mTitle->escapeLocalURL( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
1405 - ) );
1406 - }
1407 - }
1408 -
1409 - return $s;
1410 - }
1411 -
1412 - function bottomLinks() {
1413 - global $wgOut, $wgUser, $wgUseTrackbacks;
1414 - $sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
1415 -
1416 - $s = '';
1417 - if ( $wgOut->isArticleRelated() ) {
1418 - $element[] = '<strong>' . $this->editThisPage() . '</strong>';
1419 -
1420 - if ( $wgUser->isLoggedIn() ) {
1421 - $element[] = $this->watchThisPage();
1422 - }
1423 -
1424 - $element[] = $this->talkLink();
1425 - $element[] = $this->historyLink();
1426 - $element[] = $this->whatLinksHere();
1427 - $element[] = $this->watchPageLinksLink();
1428 -
1429 - if ( $wgUseTrackbacks ) {
1430 - $element[] = $this->trackbackLink();
1431 - }
1432 -
1433 - if (
1434 - $this->mTitle->getNamespace() == NS_USER ||
1435 - $this->mTitle->getNamespace() == NS_USER_TALK
1436 - ) {
1437 - $id = User::idFromName( $this->mTitle->getText() );
1438 - $ip = User::isIP( $this->mTitle->getText() );
1439 -
1440 - # Both anons and non-anons have contributions list
1441 - if ( $id || $ip ) {
1442 - $element[] = $this->userContribsLink();
1443 - }
1444 -
1445 - if ( $this->showEmailUser( $id ) ) {
1446 - $element[] = $this->emailUserLink();
1447 - }
1448 - }
1449 -
1450 - $s = implode( $element, $sep );
1451 -
1452 - if ( $this->mTitle->getArticleId() ) {
1453 - $s .= "\n<br />";
1454 -
1455 - // Delete/protect/move links for privileged users
1456 - if ( $wgUser->isAllowed( 'delete' ) ) {
1457 - $s .= $this->deleteThisPage();
1458 - }
1459 -
1460 - if ( $wgUser->isAllowed( 'protect' ) ) {
1461 - $s .= $sep . $this->protectThisPage();
1462 - }
1463 -
1464 - if ( $wgUser->isAllowed( 'move' ) ) {
1465 - $s .= $sep . $this->moveThisPage();
1466 - }
1467 - }
1468 -
1469 - $s .= "<br />\n" . $this->otherLanguages();
1470 - }
1471 -
1472 - return $s;
1473 - }
1474 -
1475 - function pageStats() {
1476 - global $wgOut, $wgLang, $wgRequest, $wgUser;
1477 - global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
1478 -
1479 - if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null( $wgRequest->getVal( 'diff' ) ) ) {
1480 - return '';
1481 - }
1482 -
1483 - if ( !$wgOut->isArticle() || !$this->mTitle->exists() ) {
1484 - return '';
1485 - }
1486 -
1487 - $article = new Article( $this->mTitle, 0 );
1488 -
1489 - $s = '';
1490 -
1491 - if ( !$wgDisableCounters ) {
1492 - $count = $wgLang->formatNum( $article->getCount() );
1493 -
1494 - if ( $count ) {
1495 - $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
1496 - }
1497 - }
1498 -
1499 - if ( $wgMaxCredits != 0 ) {
1500 - $s .= ' ' . Credits::getCredits( $article, $wgMaxCredits, $wgShowCreditsIfMax );
1501 - } else {
1502 - $s .= $this->lastModified( $article );
1503 - }
1504 -
1505 - if ( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) {
1506 - $dbr = wfGetDB( DB_SLAVE );
1507 - $res = $dbr->select(
1508 - 'watchlist',
1509 - array( 'COUNT(*) AS n' ),
1510 - array(
1511 - 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ),
1512 - 'wl_namespace' => $this->mTitle->getNamespace()
1513 - ),
1514 - __METHOD__
1515 - );
1516 - $x = $dbr->fetchObject( $res );
1517 -
1518 - $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview',
1519 - array( 'parseinline' ), $wgLang->formatNum( $x->n )
1520 - );
1521 - }
1522 -
1523 - return $s . ' ' . $this->getCopyright();
1524 - }
1525 -
15261006 function getCopyright( $type = 'detect' ) {
15271007 global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
15281008
@@ -1656,40 +1136,6 @@
16571137 }
16581138
16591139 /**
1660 - * Show a drop-down box of special pages
1661 - */
1662 - function specialPagesList() {
1663 - global $wgContLang, $wgServer, $wgRedirectScript;
1664 -
1665 - $pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
1666 -
1667 - foreach ( $pages as $name => $page ) {
1668 - $pages[$name] = $page->getDescription();
1669 - }
1670 -
1671 - $go = wfMsg( 'go' );
1672 - $sp = wfMsg( 'specialpages' );
1673 - $spp = $wgContLang->specialPage( 'Specialpages' );
1674 -
1675 - $s = '<form id="specialpages" method="get" ' .
1676 - 'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
1677 - $s .= "<select name=\"wpDropdown\">\n";
1678 - $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
1679 -
1680 -
1681 - foreach ( $pages as $name => $desc ) {
1682 - $p = $wgContLang->specialPage( $name );
1683 - $s .= "<option value=\"{$p}\">{$desc}</option>\n";
1684 - }
1685 -
1686 - $s .= "</select>\n";
1687 - $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
1688 - $s .= "</form>\n";
1689 -
1690 - return $s;
1691 - }
1692 -
1693 - /**
16941140 * Renders a $wgFooterIcons icon acording to the method's arguments
16951141 * @param $icon Array: The icon to build the html for, see $wgFooterIcons for the format of this array
16961142 * @param $withImage Boolean: Whether to use the icon's image or output a text-only footericon
@@ -1767,32 +1213,6 @@
17681214 return $this->footerLink( 'disclaimers', 'disclaimerpage' );
17691215 }
17701216
1771 - function editThisPage() {
1772 - global $wgOut;
1773 -
1774 - if ( !$wgOut->isArticleRelated() ) {
1775 - $s = wfMsg( 'protectedpage' );
1776 - } else {
1777 - if ( $this->mTitle->quickUserCan( 'edit' ) && $this->mTitle->exists() ) {
1778 - $t = wfMsg( 'editthispage' );
1779 - } elseif ( $this->mTitle->quickUserCan( 'create' ) && !$this->mTitle->exists() ) {
1780 - $t = wfMsg( 'create-this-page' );
1781 - } else {
1782 - $t = wfMsg( 'viewsource' );
1783 - }
1784 -
1785 - $s = $this->link(
1786 - $this->mTitle,
1787 - $t,
1788 - array(),
1789 - $this->editUrlOptions(),
1790 - array( 'known', 'noclasses' )
1791 - );
1792 - }
1793 -
1794 - return $s;
1795 - }
1796 -
17971217 /**
17981218 * Return URL options for the 'edit page' link.
17991219 * This may include an 'oldid' specifier, if the current page view is such.
@@ -1810,129 +1230,6 @@
18111231 return $options;
18121232 }
18131233
1814 - function deleteThisPage() {
1815 - global $wgUser, $wgRequest;
1816 -
1817 - $diff = $wgRequest->getVal( 'diff' );
1818 -
1819 - if ( $this->mTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
1820 - $t = wfMsg( 'deletethispage' );
1821 -
1822 - $s = $this->link(
1823 - $this->mTitle,
1824 - $t,
1825 - array(),
1826 - array( 'action' => 'delete' ),
1827 - array( 'known', 'noclasses' )
1828 - );
1829 - } else {
1830 - $s = '';
1831 - }
1832 -
1833 - return $s;
1834 - }
1835 -
1836 - function protectThisPage() {
1837 - global $wgUser, $wgRequest;
1838 -
1839 - $diff = $wgRequest->getVal( 'diff' );
1840 -
1841 - if ( $this->mTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
1842 - if ( $this->mTitle->isProtected() ) {
1843 - $text = wfMsg( 'unprotectthispage' );
1844 - $query = array( 'action' => 'unprotect' );
1845 - } else {
1846 - $text = wfMsg( 'protectthispage' );
1847 - $query = array( 'action' => 'protect' );
1848 - }
1849 -
1850 - $s = $this->link(
1851 - $this->mTitle,
1852 - $text,
1853 - array(),
1854 - $query,
1855 - array( 'known', 'noclasses' )
1856 - );
1857 - } else {
1858 - $s = '';
1859 - }
1860 -
1861 - return $s;
1862 - }
1863 -
1864 - function watchThisPage() {
1865 - global $wgOut;
1866 - ++$this->mWatchLinkNum;
1867 -
1868 - if ( $wgOut->isArticleRelated() ) {
1869 - if ( $this->mTitle->userIsWatching() ) {
1870 - $text = wfMsg( 'unwatchthispage' );
1871 - $query = array( 'action' => 'unwatch' );
1872 - $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
1873 - } else {
1874 - $text = wfMsg( 'watchthispage' );
1875 - $query = array( 'action' => 'watch' );
1876 - $id = 'mw-watch-link' . $this->mWatchLinkNum;
1877 - }
1878 -
1879 - $s = $this->link(
1880 - $this->mTitle,
1881 - $text,
1882 - array( 'id' => $id ),
1883 - $query,
1884 - array( 'known', 'noclasses' )
1885 - );
1886 - } else {
1887 - $s = wfMsg( 'notanarticle' );
1888 - }
1889 -
1890 - return $s;
1891 - }
1892 -
1893 - function moveThisPage() {
1894 - if ( $this->mTitle->quickUserCan( 'move' ) ) {
1895 - return $this->link(
1896 - SpecialPage::getTitleFor( 'Movepage' ),
1897 - wfMsg( 'movethispage' ),
1898 - array(),
1899 - array( 'target' => $this->mTitle->getPrefixedDBkey() ),
1900 - array( 'known', 'noclasses' )
1901 - );
1902 - } else {
1903 - // no message if page is protected - would be redundant
1904 - return '';
1905 - }
1906 - }
1907 -
1908 - function historyLink() {
1909 - return $this->link(
1910 - $this->mTitle,
1911 - wfMsgHtml( 'history' ),
1912 - array( 'rel' => 'archives' ),
1913 - array( 'action' => 'history' )
1914 - );
1915 - }
1916 -
1917 - function whatLinksHere() {
1918 - return $this->link(
1919 - SpecialPage::getTitleFor( 'Whatlinkshere', $this->mTitle->getPrefixedDBkey() ),
1920 - wfMsgHtml( 'whatlinkshere' ),
1921 - array(),
1922 - array(),
1923 - array( 'known', 'noclasses' )
1924 - );
1925 - }
1926 -
1927 - function userContribsLink() {
1928 - return $this->link(
1929 - SpecialPage::getTitleFor( 'Contributions', $this->mTitle->getDBkey() ),
1930 - wfMsgHtml( 'contributions' ),
1931 - array(),
1932 - array(),
1933 - array( 'known', 'noclasses' )
1934 - );
1935 - }
1936 -
19371234 function showEmailUser( $id ) {
19381235 global $wgUser;
19391236 $targetUser = User::newFromId( $id );
@@ -1940,182 +1237,6 @@
19411238 $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
19421239 }
19431240
1944 - function emailUserLink() {
1945 - return $this->link(
1946 - SpecialPage::getTitleFor( 'Emailuser', $this->mTitle->getDBkey() ),
1947 - wfMsg( 'emailuser' ),
1948 - array(),
1949 - array(),
1950 - array( 'known', 'noclasses' )
1951 - );
1952 - }
1953 -
1954 - function watchPageLinksLink() {
1955 - global $wgOut;
1956 -
1957 - if ( !$wgOut->isArticleRelated() ) {
1958 - return '(' . wfMsg( 'notanarticle' ) . ')';
1959 - } else {
1960 - return $this->link(
1961 - SpecialPage::getTitleFor( 'Recentchangeslinked', $this->mTitle->getPrefixedDBkey() ),
1962 - wfMsg( 'recentchangeslinked-toolbox' ),
1963 - array(),
1964 - array(),
1965 - array( 'known', 'noclasses' )
1966 - );
1967 - }
1968 - }
1969 -
1970 - function trackbackLink() {
1971 - return '<a href="' . $this->mTitle->trackbackURL() . '">'
1972 - . wfMsg( 'trackbacklink' ) . '</a>';
1973 - }
1974 -
1975 - function otherLanguages() {
1976 - global $wgOut, $wgContLang, $wgHideInterlanguageLinks;
1977 -
1978 - if ( $wgHideInterlanguageLinks ) {
1979 - return '';
1980 - }
1981 -
1982 - $a = $wgOut->getLanguageLinks();
1983 -
1984 - if ( 0 == count( $a ) ) {
1985 - return '';
1986 - }
1987 -
1988 - $s = wfMsg( 'otherlanguages' ) . wfMsg( 'colon-separator' );
1989 - $first = true;
1990 -
1991 - if ( $wgContLang->isRTL() ) {
1992 - $s .= '<span dir="LTR">';
1993 - }
1994 -
1995 - foreach ( $a as $l ) {
1996 - if ( !$first ) {
1997 - $s .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
1998 - }
1999 -
2000 - $first = false;
2001 -
2002 - $nt = Title::newFromText( $l );
2003 - $url = $nt->escapeFullURL();
2004 - $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
2005 - $title = htmlspecialchars( $nt->getText() );
2006 -
2007 - if ( $text == '' ) {
2008 - $text = $l;
2009 - }
2010 -
2011 - $style = $this->getExternalLinkAttributes();
2012 - $s .= "<a href=\"{$url}\" title=\"{$title}\"{$style}>{$text}</a>";
2013 - }
2014 -
2015 - if ( $wgContLang->isRTL() ) {
2016 - $s .= '</span>';
2017 - }
2018 -
2019 - return $s;
2020 - }
2021 -
2022 - function talkLink() {
2023 - if ( NS_SPECIAL == $this->mTitle->getNamespace() ) {
2024 - # No discussion links for special pages
2025 - return '';
2026 - }
2027 -
2028 - $linkOptions = array();
2029 -
2030 - if ( $this->mTitle->isTalkPage() ) {
2031 - $link = $this->mTitle->getSubjectPage();
2032 - switch( $link->getNamespace() ) {
2033 - case NS_MAIN:
2034 - $text = wfMsg( 'articlepage' );
2035 - break;
2036 - case NS_USER:
2037 - $text = wfMsg( 'userpage' );
2038 - break;
2039 - case NS_PROJECT:
2040 - $text = wfMsg( 'projectpage' );
2041 - break;
2042 - case NS_FILE:
2043 - $text = wfMsg( 'imagepage' );
2044 - # Make link known if image exists, even if the desc. page doesn't.
2045 - if ( wfFindFile( $link ) )
2046 - $linkOptions[] = 'known';
2047 - break;
2048 - case NS_MEDIAWIKI:
2049 - $text = wfMsg( 'mediawikipage' );
2050 - break;
2051 - case NS_TEMPLATE:
2052 - $text = wfMsg( 'templatepage' );
2053 - break;
2054 - case NS_HELP:
2055 - $text = wfMsg( 'viewhelppage' );
2056 - break;
2057 - case NS_CATEGORY:
2058 - $text = wfMsg( 'categorypage' );
2059 - break;
2060 - default:
2061 - $text = wfMsg( 'articlepage' );
2062 - }
2063 - } else {
2064 - $link = $this->mTitle->getTalkPage();
2065 - $text = wfMsg( 'talkpage' );
2066 - }
2067 -
2068 - $s = $this->link( $link, $text, array(), array(), $linkOptions );
2069 -
2070 - return $s;
2071 - }
2072 -
2073 - function commentLink() {
2074 - global $wgOut;
2075 -
2076 - if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
2077 - return '';
2078 - }
2079 -
2080 - # __NEWSECTIONLINK___ changes behaviour here
2081 - # If it is present, the link points to this page, otherwise
2082 - # it points to the talk page
2083 - if ( $this->mTitle->isTalkPage() ) {
2084 - $title = $this->mTitle;
2085 - } elseif ( $wgOut->showNewSectionLink() ) {
2086 - $title = $this->mTitle;
2087 - } else {
2088 - $title = $this->mTitle->getTalkPage();
2089 - }
2090 -
2091 - return $this->link(
2092 - $title,
2093 - wfMsg( 'postcomment' ),
2094 - array(),
2095 - array(
2096 - 'action' => 'edit',
2097 - 'section' => 'new'
2098 - ),
2099 - array( 'known', 'noclasses' )
2100 - );
2101 - }
2102 -
2103 - function getUploadLink() {
2104 - global $wgUploadNavigationUrl;
2105 -
2106 - if ( $wgUploadNavigationUrl ) {
2107 - # Using an empty class attribute to avoid automatic setting of "external" class
2108 - return $this->makeExternalLink( $wgUploadNavigationUrl, wfMsgHtml( 'upload' ), false, null, array( 'class' => '' ) );
2109 - } else {
2110 - return $this->link(
2111 - SpecialPage::getTitleFor( 'Upload' ),
2112 - wfMsgHtml( 'upload' ),
2113 - array(),
2114 - array(),
2115 - array( 'known', 'noclasses' )
2116 - );
2117 - }
2118 - }
2119 -
21201241 /**
21211242 * Return a fully resolved style path url to images or styles stored in the common folder.
21221243 * This method returns a url resolved using the configured skin style path

Follow-up revisions

RevisionCommit summaryAuthorDate
r81569Followup comment to r81507. The api is using a legacy langlinks method no mod...dantman20:16, 5 February 2011
r81582Add releasenotes for r81507.dantman00:20, 6 February 2011
r83933Followup to r81507: Call to undefined method StandardTemplate::showEmailUser()...saper17:59, 14 March 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   11:46, 5 February 2011

Getting: [05-Feb-2011 11:44:14] PHP Fatal error: Call to undefined method SkinVector::otherLanguages() in D:\www\MW_trunk\phase3\includes\api\ApiParse.php on line 385

#Comment by Platonides (talk | contribs)   22:19, 5 February 2011

Needs release notes.

I would also add a comment about that on Skin.php Note that you are forcing to change the base class of custom skins from Skin to LegacySkin.

#Comment by Dantman (talk | contribs)   23:27, 5 February 2011

Custom skins should be SkinTemplate based, all this legacy stuff left behind in the Skin class basically exists only for standard/Classic, Nostalgia, and CologneBlue. We've got no reason to support two way's of doing the same thing (one which is less maintained) for custom skins. ie: Custom skins shouldn't be changing to LegacySkin, if they are so old that they break (which I don't think we have any real 3rd party skins that old) they should be using SkinTemplate properly.

#Comment by Platonides (talk | contribs)   23:41, 5 February 2011

Unlikely, but if there are such extensions out there, a note to the one-line change needed would be better than "rewrite the skin using SkinTemplate"

#Comment by Dantman (talk | contribs)   01:00, 6 February 2011

It's actually not a one line change.

Things like $this->link( are now $this->getSkin()->link( $this->mTitle -> $this->getSkin()->getTitle() There are some methods that belong inside the LegacyTemplate and some methods that belong inside the SkinLegacy. Some things like $this->escapeSearchLink(); need to be updated to their SkinTemplate equivs like $this->data['searchaction'];

The old skins did a lot of ugly hardcoded stuff. Trying to continue doing that in a custom skin is not a desirable thing to do. To be honest, if we could I'd like to completely erase the legacy skin code instead of trying to hack it up to become a SkinTemplate based LegacySkin system. These corner cases in maintaining "classic" bad behavior while trying to shove new features into skins get in the way of skin system improvements.

In any case, I'm quite certain that we don't have a single 3rd party skin that is not SkinTemplate based. Every one of the pile of ugly hacked together skins I've seen have still been SkinTemplate based. MonoBook was the skin that introduced actual skinning and hacking around with the skin system, before that the skin system was so hard to wield no-one besides core devs really used it.

#Comment by 😂 (talk | contribs)   04:12, 24 March 2011

This broke support for every extension using SkinTemplateTabs.

#Comment by Dantman (talk | contribs)   12:58, 24 March 2011

No, I broke support for SkinTemplateTabs awhile back when I replace content_actions with content_navigation and made everything use the Vector style SkinTemplateNavigation hook. Extensions already would be broken in vector if they didn't have SkinTemplateNavigation, they have two whole releases now before SkinTemplateNavigation becomes mandatory in place of SkinTemplateTabs.

#Comment by 😂 (talk | contribs)   13:51, 24 March 2011

Was there any reason for renaming it other than getting rid of SkinTemplateTabs? Lots of extensions use it....

#Comment by Dantman (talk | contribs)   13:54, 24 March 2011

SkinTemplateTabs uses a flat array, SkinTemplateNavigation uses a categorized array, where tabs are grouped into 'namespaces', 'variants', 'views', and 'actions'. SkinTemplateTabs is simply incompatible as a common format.

#Comment by 😂 (talk | contribs)   13:56, 24 March 2011

Do you plan on fixing the dozens of extensions you've broken?

#Comment by Dantman (talk | contribs)   04:33, 26 March 2011

Perhaps that can be a project when I have time...

In any case, far as I'm concerned all those extensions 'broken' by making everything use SkinTemplateNavigation were already broken since the extension would not function in vector. Extensions have had since 1.16 (my change is to 1.18) when SkinTemplateNavigation was introduced to be updated to include a SkinTemplateNavigation hook.

(unmarking fixme since the SkinTemplateTabs change has nothing to do with this commit)

#Comment by 😂 (talk | contribs)   22:42, 27 March 2011

Breaking things once is no excuse to break it again.

#Comment by Dantman (talk | contribs)   16:15, 28 March 2011

They were never un broken.

#Comment by Tim Starling (talk | contribs)   06:38, 6 September 2011

Apparently that was in r79383.

#Comment by 😂 (talk | contribs)   17:06, 28 March 2011

(unindenting for sanity) All I know is, it works with Monobook in 1.16/17, and now it doesn't.

#Comment by Aaron Schulz (talk | contribs)   06:02, 7 July 2011

Is this fully resolved?

#Comment by Jack Phoenix (talk | contribs)   22:18, 8 August 2011

I don't like this.

Sure, I'm all for moving Cologne Blue & friends out of core, whether it be to an extension or just killing them off entirely. However, I don't think this is the direction we should be taking. SkinTemplate is, to put it nicely, a big fucking mess. We shouldn't be encouraging people to move to it, we should be encouraging them to move off from it.

The way I see it, Skin should be the base class for all skins, like how I tried with my SkinSystemRewrite project. Admittedly my approach wasn't the prettiest one, but you can see the general idea.

With SkinTemplate, nothing is really standardized; you have to do all kinds of hacks for the simplest things and there's very little consistency to speak of, if any.

Your statement I'm quite certain that we don't have a single 3rd party skin that is not SkinTemplate based is false; there are custom skins that extend Skin instead of SkinTemplate, such as the skin used by Halopedia (http://www.halopedian.com/ — can't make it a normal external link because CR's parser sucks), the Sports skin used by ArmchairGM, the Games skin used by gaming.wikia back in 2007...it's quite annoying to have to adjust skins for every MW release. One-line patches, two-line patches, even 30-line patches are OK and I've done those. Asking me to rewrite four skins that work well in 1.16 for 1.19 doesn't seem very fair to me.

#Comment by Reedy (talk | contribs)   20:47, 10 August 2011

As crappy as this may be, I'm thinking that trying to back it out now, is going to just cause more issues.

One of these things again, if we don't like, we revert sooner, so we don't get these issues...

#Comment by Dantman (talk | contribs)   21:54, 10 August 2011

On the state of SkinTemplate, I don't see how that 'flaw' in SkinTemplate is relevant to the legacy skin system. The patch you end up needing to apply there isn't even applicable because if MonoBook was implemented using the old skin system you still wouldn't be able to put something in that spot, you'd still need to apply the same kind of patch.

I do agree that the detached SkinTemplate+QuickTemplate methodology and pattern of pre-assigning keys in ways that make some skinning possibilities prohibitive is flawed. But the original Skin system is not the answer to that, the original Skin system is exponentially worse. Only allowing before/after input instead of proper full control over the body of the skin to the skin author, aging methods incompatible with standard features... I do have plans for a skin system that doesn't have the flaws of SkinTemplate. It's also possible to replace SkinTemplate with a layer meant for complete compatibility on top of that layer (ie: That better skin system can be put into place while remaining completely compatible with all SkinTemplate systems, and without creating a fork in implementations that causes SkinTemplate skins to start stagnating like legacy skins did and getting in the way of the implementation of new features). The legacy skin system however, is just in the way. The way it works doesn't make building a compat layer on top of either SkinTemplate or the new system a possibility without requiring modifications to skins using it.

Does anyone even use the ArmchairGM skin or Games skin anymore? I can't even find the source for those, much less someone using them. Halopedian, I suppose it will need to be fixed for 1.19; I could take a look at what it would take to fix. Though frankly it looks so much more like a SkinTemplate skin than a LegacySkin that it doesn't look like it would be anywhere near the trouble to port that fixing something like CologneBlue would be. And fourth skin? What skin?

#Comment by Jack Phoenix (talk | contribs)   23:47, 11 August 2011

Fair enough.

Needless to say, any and all improvements to the skin system are welcome — but in the future, please do retain backwards compatibility for a few releases.

As for the ArmchairGM and Games skin, they're currently not used by any site out there, but I for one had plans to use the skins. After all, the ArmchairGM codebase was open sourced less than two weeks ago (see http://ashleywiki.blogspot.com/2011/08/armchairgm-is-finally-open-source.html ); ever since I've been working on those two skins, improving them and bringing them up to modern standards. Still, there's plenty of things to do and that's why I haven't committed my work; I don't like committing half-baked code. I definitely plan to commit and use those skins, though; they were nearly lost and it'd have been a great shame had they been lost for good.

The fourth Skin-based skin is what I call Magazine; a skin based on the various different skins written for Wikia's magazine wikis back in 2007 or so. Originally each magazine wiki had their own skin; the only distinction (besides the skin name, of course) between the skins was the CSS. I cleaned up one of these skin files and made it support themes. Sure, it's quite ugly right now, but in the right hands, someone could turn it into a pretty decent skin, I think. One of these days I should clean up the code and release it; before that, I probably should fix the usage of $wgMessageCache and other equally ugly things in the code. (Do we have a better place for custom skins than trunk/extensions/skins/? It seems less than ideal to me since the folder contains many skins and most core skins are in $IP/skins/...)

#Comment by Dantman (talk | contribs)   01:40, 12 August 2011

I tried to argue for a /trunk/skins/ but never got one, /trunk/extensions/skins/ seams to be the only place if you're going to check something into svn (I never got around to putting Monaco into svn because I was never satisfied that I was finished with monaco-port and svn would make working on it too much of a hassle). Take a look at /trunk/extensions/skins/p2wiki/. I've come up with a pattern for packaging skins that keeps them with other skins and lets you drop a folder into /skins/ and install instead of having to add both a folder and a php file.

#Comment by Hashar (talk | contribs)   11:35, 3 January 2012

Marking SkinLegacy as resolved. It was released with 1.18 and deployed live. Most of the issues raised above are about potential backwards compatibles issues with foreign skins. I guess they will have to adapt their skins now.

Status & tagging log