Index: trunk/phase3/skins/CologneBlue.php |
— | — | @@ -15,12 +15,46 @@ |
16 | 16 | * @todo document |
17 | 17 | * @ingroup Skins |
18 | 18 | */ |
19 | | -class SkinCologneBlue extends Skin { |
| 19 | +class SkinCologneBlue extends SkinLegacy { |
| 20 | + var $skinname = 'cologneblue', $stylename = 'cologneblue', |
| 21 | + $template = 'CologneBlueTemplate'; |
20 | 22 | |
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 ); |
23 | 53 | } |
24 | 54 | |
| 55 | +} |
| 56 | + |
| 57 | +class CologneBlueTemplate extends LegacyTemplate { |
| 58 | + |
25 | 59 | function doBeforeContent() { |
26 | 60 | $mainPageObj = Title::newMainPage(); |
27 | 61 | |
— | — | @@ -41,7 +75,7 @@ |
42 | 76 | |
43 | 77 | $s .= '<font size="-1"><span id="langlinks">'; |
44 | 78 | $s .= str_replace( '<br />', '', $this->otherLanguages() ); |
45 | | - $cat = $this->getCategoryLinks(); |
| 79 | + $cat = $this->getSkin()->getCategoryLinks(); |
46 | 80 | if( $cat ) { |
47 | 81 | $s .= "<br />$cat\n"; |
48 | 82 | } |
— | — | @@ -69,7 +103,7 @@ |
70 | 104 | $s .= "\n<div id='footer'>"; |
71 | 105 | $s .= '<table width="98%" border="0" cellspacing="0"><tr>'; |
72 | 106 | |
73 | | - $qb = $this->qbSetting(); |
| 107 | + $qb = $this->getSkin()->qbSetting(); |
74 | 108 | if ( 1 == $qb || 3 == $qb ) { # Left |
75 | 109 | $s .= $this->getQuickbarCompensator(); |
76 | 110 | } |
— | — | @@ -77,14 +111,14 @@ |
78 | 112 | |
79 | 113 | $s .= $this->bottomLinks(); |
80 | 114 | $s .= $wgLang->pipeList( array( |
81 | | - "\n<br />" . $this->link( |
| 115 | + "\n<br />" . $this->getSkin()->link( |
82 | 116 | Title::newMainPage(), |
83 | 117 | null, |
84 | 118 | array(), |
85 | 119 | array(), |
86 | 120 | array( 'known', 'noclasses' ) |
87 | 121 | ), |
88 | | - $this->aboutLink(), |
| 122 | + $this->getSkin()->aboutLink(), |
89 | 123 | $this->searchForm( wfMsg( 'qbfind' ) ) |
90 | 124 | ) ); |
91 | 125 | |
— | — | @@ -102,44 +136,12 @@ |
103 | 137 | return $s; |
104 | 138 | } |
105 | 139 | |
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 | | - |
138 | 140 | function sysLinks() { |
139 | 141 | global $wgUser, $wgLang; |
140 | 142 | $li = SpecialPage::getTitleFor( 'Userlogin' ); |
141 | 143 | $lo = SpecialPage::getTitleFor( 'Userlogout' ); |
142 | 144 | |
143 | | - $rt = $this->mTitle->getPrefixedURL(); |
| 145 | + $rt = $this->getSkin()->getTitle()->getPrefixedURL(); |
144 | 146 | if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { |
145 | 147 | $q = array(); |
146 | 148 | } else { |
— | — | @@ -147,20 +149,20 @@ |
148 | 150 | } |
149 | 151 | |
150 | 152 | $s = array( |
151 | | - $this->mainPageLink(), |
152 | | - $this->linkKnown( |
| 153 | + $this->getSkin()->mainPageLink(), |
| 154 | + $this->getSkin()->linkKnown( |
153 | 155 | Title::newFromText( wfMsgForContent( 'aboutpage' ) ), |
154 | 156 | wfMsg( 'about' ) |
155 | 157 | ), |
156 | | - $this->linkKnown( |
| 158 | + $this->getSkin()->linkKnown( |
157 | 159 | Title::newFromText( wfMsgForContent( 'helppage' ) ), |
158 | 160 | wfMsg( 'help' ) |
159 | 161 | ), |
160 | | - $this->linkKnown( |
| 162 | + $this->getSkin()->linkKnown( |
161 | 163 | Title::newFromText( wfMsgForContent( 'faqpage' ) ), |
162 | 164 | wfMsg( 'faq' ) |
163 | 165 | ), |
164 | | - $this->specialLink( 'Specialpages' ) |
| 166 | + $this->getSkin()->specialLink( 'Specialpages' ) |
165 | 167 | ); |
166 | 168 | |
167 | 169 | /* show links to different language variants */ |
— | — | @@ -171,14 +173,14 @@ |
172 | 174 | $s[] = $this->extensionTabLinks(); |
173 | 175 | } |
174 | 176 | if ( $wgUser->isLoggedIn() ) { |
175 | | - $s[] = $this->linkKnown( |
| 177 | + $s[] = $this->getSkin()->linkKnown( |
176 | 178 | $lo, |
177 | 179 | wfMsg( 'logout' ), |
178 | 180 | array(), |
179 | 181 | $q |
180 | 182 | ); |
181 | 183 | } else { |
182 | | - $s[] = $this->linkKnown( |
| 184 | + $s[] = $this->getSkin()->linkKnown( |
183 | 185 | $li, |
184 | 186 | wfMsg( 'login' ), |
185 | 187 | array(), |
— | — | @@ -196,7 +198,7 @@ |
197 | 199 | function quickBar(){ |
198 | 200 | global $wgOut, $wgUser; |
199 | 201 | |
200 | | - $tns = $this->mTitle->getNamespace(); |
| 202 | + $tns = $this->getSkin()->getTitle()->getNamespace(); |
201 | 203 | |
202 | 204 | $s = "\n<div id='quickbar'>"; |
203 | 205 | |
— | — | @@ -207,7 +209,7 @@ |
208 | 210 | $s .= $this->menuHead( 'qbbrowse' ); |
209 | 211 | |
210 | 212 | # Use the first heading from the Monobook sidebar as the "browse" section |
211 | | - $bar = $this->buildSidebar(); |
| 213 | + $bar = $this->getSkin()->buildSidebar(); |
212 | 214 | unset( $bar['SEARCH'] ); |
213 | 215 | unset( $bar['LANGUAGES'] ); |
214 | 216 | unset( $bar['TOOLBOX'] ); |
— | — | @@ -224,7 +226,7 @@ |
225 | 227 | $s .= $this->menuHead( 'qbedit' ); |
226 | 228 | $s .= '<strong>' . $this->editThisPage() . '</strong>'; |
227 | 229 | |
228 | | - $s .= $sep . $this->linkKnown( |
| 230 | + $s .= $sep . $this->getSkin()->linkKnown( |
229 | 231 | Title::newFromText( wfMsgForContent( 'edithelppage' ) ), |
230 | 232 | wfMsg( 'edithelp' ) |
231 | 233 | ); |
— | — | @@ -262,10 +264,10 @@ |
263 | 265 | . $sep . $this->watchPageLinksLink(); |
264 | 266 | |
265 | 267 | if( $tns == NS_USER || $tns == NS_USER_TALK ) { |
266 | | - $id = User::idFromName( $this->mTitle->getText() ); |
| 268 | + $id = User::idFromName( $this->getSkin()->getTitle()->getText() ); |
267 | 269 | if( $id != 0 ) { |
268 | 270 | $s .= $sep . $this->userContribsLink(); |
269 | | - if( $this->showEmailUser( $id ) ) { |
| 271 | + if( $this->getSkin()->showEmailUser( $id ) ) { |
270 | 272 | $s .= $sep . $this->emailUserLink(); |
271 | 273 | } |
272 | 274 | } |
— | — | @@ -275,7 +277,7 @@ |
276 | 278 | |
277 | 279 | $s .= $this->menuHead( 'qbmyoptions' ); |
278 | 280 | if ( $wgUser->isLoggedIn() ) { |
279 | | - $tl = $this->link( |
| 281 | + $tl = $this->getSkin()->link( |
280 | 282 | $wgUser->getTalkPage(), |
281 | 283 | wfMsg( 'mytalk' ), |
282 | 284 | array(), |
— | — | @@ -286,30 +288,30 @@ |
287 | 289 | $tl .= ' *'; |
288 | 290 | } |
289 | 291 | |
290 | | - $s .= $this->link( |
| 292 | + $s .= $this->getSkin()->link( |
291 | 293 | $wgUser->getUserPage(), |
292 | 294 | wfMsg( 'mypage' ), |
293 | 295 | array(), |
294 | 296 | array(), |
295 | 297 | array( 'known', 'noclasses' ) |
296 | | - ) . $sep . $tl . $sep . $this->specialLink( 'Watchlist' ) |
| 298 | + ) . $sep . $tl . $sep . $this->getSkin()->specialLink( 'Watchlist' ) |
297 | 299 | . $sep . |
298 | | - $this->link( |
| 300 | + $this->getSkin()->link( |
299 | 301 | SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ), |
300 | 302 | wfMsg( 'mycontris' ), |
301 | 303 | array(), |
302 | 304 | array(), |
303 | 305 | 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' ); |
306 | 308 | } else { |
307 | | - $s .= $this->specialLink( 'Userlogin' ); |
| 309 | + $s .= $this->getSkin()->specialLink( 'Userlogin' ); |
308 | 310 | } |
309 | 311 | |
310 | 312 | $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' ); |
314 | 316 | if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) { |
315 | 317 | $s .= $sep . $this->getUploadLink(); |
316 | 318 | } |
— | — | @@ -321,7 +323,7 @@ |
322 | 324 | . wfMsg( 'sitesupport' ) . '</a>'; |
323 | 325 | } |
324 | 326 | |
325 | | - $s .= $sep . $this->link( |
| 327 | + $s .= $sep . $this->getSkin()->link( |
326 | 328 | SpecialPage::getTitleFor( 'Specialpages' ), |
327 | 329 | wfMsg( 'moredotdotdot' ), |
328 | 330 | array(), |
— | — | @@ -342,7 +344,7 @@ |
343 | 345 | global $wgRequest, $wgUseTwoButtonsSearchForm; |
344 | 346 | |
345 | 347 | $search = $wgRequest->getText( 'search' ); |
346 | | - $action = $this->escapeSearchLink(); |
| 348 | + $action = $this->data['searchaction']; |
347 | 349 | $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">"; |
348 | 350 | if( $label != '' ) { |
349 | 351 | $s .= "{$label}: "; |
Index: trunk/phase3/skins/Standard.php |
— | — | @@ -14,7 +14,9 @@ |
15 | 15 | * @todo document |
16 | 16 | * @ingroup Skins |
17 | 17 | */ |
18 | | -class SkinStandard extends Skin { |
| 18 | +class SkinStandard extends SkinLegacy { |
| 19 | + var $skinname = 'standard', $stylename = 'standard', |
| 20 | + $template = 'StandardTemplate'; |
19 | 21 | |
20 | 22 | /** |
21 | 23 | * |
— | — | @@ -48,6 +50,10 @@ |
49 | 51 | $out->addInlineStyle( $style ); |
50 | 52 | } |
51 | 53 | |
| 54 | +} |
| 55 | + |
| 56 | +class StandardTemplate extends LegacyTemplate { |
| 57 | + |
52 | 58 | function doAfterContent() { |
53 | 59 | global $wgContLang, $wgLang; |
54 | 60 | wfProfileIn( __METHOD__ ); |
— | — | @@ -60,7 +66,7 @@ |
61 | 67 | wfProfileOut( __METHOD__ . '-1' ); |
62 | 68 | wfProfileIn( __METHOD__ . '-2' ); |
63 | 69 | |
64 | | - $qb = $this->qbSetting(); |
| 70 | + $qb = $this->getSkin()->qbSetting(); |
65 | 71 | $shove = ( $qb != 0 ); |
66 | 72 | $left = ( $qb == 1 || $qb == 3 ); |
67 | 73 | |
— | — | @@ -74,9 +80,9 @@ |
75 | 81 | |
76 | 82 | $s .= $this->bottomLinks(); |
77 | 83 | $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' ), |
81 | 87 | $this->searchForm() ) ) |
82 | 88 | . '<br /><span id="pagestats">' . $this->pageStats() . '</span>'; |
83 | 89 | |
— | — | @@ -103,15 +109,15 @@ |
104 | 110 | |
105 | 111 | $action = $wgRequest->getText( 'action' ); |
106 | 112 | $wpPreview = $wgRequest->getBool( 'wpPreview' ); |
107 | | - $tns = $this->mTitle->getNamespace(); |
| 113 | + $tns = $this->getSkin()->getTitle()->getNamespace(); |
108 | 114 | |
109 | 115 | $s = "\n<div id='quickbar'>"; |
110 | | - $s .= "\n" . $this->logoText() . "\n<hr class='sep' />"; |
| 116 | + $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />"; |
111 | 117 | |
112 | 118 | $sep = "\n<br />"; |
113 | 119 | |
114 | 120 | # Use the first heading from the Monobook sidebar as the "browse" section |
115 | | - $bar = $this->buildSidebar(); |
| 121 | + $bar = $this->getSkin()->buildSidebar(); |
116 | 122 | unset( $bar['SEARCH'] ); |
117 | 123 | unset( $bar['LANGUAGES'] ); |
118 | 124 | unset( $bar['TOOLBOX'] ); |
— | — | @@ -125,8 +131,8 @@ |
126 | 132 | } |
127 | 133 | |
128 | 134 | 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( |
131 | 137 | SpecialPage::getTitleFor( 'Contributions' ), |
132 | 138 | wfMsg( 'mycontris' ), |
133 | 139 | array(), |
— | — | @@ -135,7 +141,7 @@ |
136 | 142 | } |
137 | 143 | // only show watchlist link if logged in |
138 | 144 | $s .= "\n<hr class='sep' />"; |
139 | | - $articleExists = $this->mTitle->getArticleId(); |
| 145 | + $articleExists = $this->getSkin()->getTitle()->getArticleId(); |
140 | 146 | if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) { |
141 | 147 | if( $wgOut->isArticle() ) { |
142 | 148 | $s .= '<strong>' . $this->editThisPage() . '</strong>'; |
— | — | @@ -180,17 +186,17 @@ |
181 | 187 | $text = wfMsg( 'articlepage' ); |
182 | 188 | } |
183 | 189 | |
184 | | - $link = $this->mTitle->getText(); |
| 190 | + $link = $this->getSkin()->getTitle()->getText(); |
185 | 191 | $nstext = $wgContLang->getNsText( $tns ); |
186 | 192 | if( $nstext ) { # add namespace if necessary |
187 | 193 | $link = $nstext . ':' . $link; |
188 | 194 | } |
189 | 195 | |
190 | | - $s .= $this->link( |
| 196 | + $s .= $this->getSkin()->link( |
191 | 197 | Title::newFromText( $link ), |
192 | 198 | $text |
193 | 199 | ); |
194 | | - } elseif( $this->mTitle->getNamespace() != NS_SPECIAL ) { |
| 200 | + } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL ) { |
195 | 201 | # we just throw in a "New page" text to tell the user that he's in edit mode, |
196 | 202 | # and to avoid messing with the separator that is prepended to the next item |
197 | 203 | $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>'; |
— | — | @@ -198,9 +204,9 @@ |
199 | 205 | } |
200 | 206 | |
201 | 207 | # "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(), |
205 | 211 | wfMsg( 'postcomment' ), |
206 | 212 | array(), |
207 | 213 | array( |
— | — | @@ -220,7 +226,7 @@ |
221 | 227 | if( $action != 'edit' && $action != 'submit' ) { |
222 | 228 | $s .= $sep . $this->watchThisPage(); |
223 | 229 | } |
224 | | - if ( $this->mTitle->userCan( 'edit' ) ) |
| 230 | + if ( $this->getSkin()->getTitle()->userCan( 'edit' ) ) |
225 | 231 | $s .= $sep . $this->moveThisPage(); |
226 | 232 | } |
227 | 233 | if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) { |
— | — | @@ -238,12 +244,12 @@ |
239 | 245 | } |
240 | 246 | |
241 | 247 | 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 |
244 | 250 | ) { |
245 | 251 | |
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() ); |
248 | 254 | |
249 | 255 | if( $id || $ip ){ |
250 | 256 | $s .= $sep . $this->userContribsLink(); |
— | — | @@ -259,7 +265,7 @@ |
260 | 266 | $s .= $this->getUploadLink() . $sep; |
261 | 267 | } |
262 | 268 | |
263 | | - $s .= $this->specialLink( 'Specialpages' ); |
| 269 | + $s .= $this->getSkin()->specialLink( 'Specialpages' ); |
264 | 270 | |
265 | 271 | global $wgSiteSupportPage; |
266 | 272 | if( $wgSiteSupportPage ) { |
Index: trunk/phase3/skins/Nostalgia.php |
— | — | @@ -14,20 +14,22 @@ |
15 | 15 | * @todo document |
16 | 16 | * @ingroup Skins |
17 | 17 | */ |
18 | | -class SkinNostalgia extends Skin { |
| 18 | +class SkinNostalgia extends SkinLegacy { |
| 19 | + var $skinname = 'nostalgia', $stylename = 'nostalgia', |
| 20 | + $template = 'NostalgiaTemplate'; |
19 | 21 | |
20 | | - function getSkinName() { |
21 | | - return 'nostalgia'; |
22 | | - } |
23 | | - |
24 | 22 | function setupSkinUserCss( OutputPage $out ){ |
25 | 23 | parent::setupSkinUserCss( $out ); |
26 | 24 | $out->addModuleStyles( 'skins.nostalgia' ); |
27 | 25 | } |
28 | 26 | |
| 27 | +} |
| 28 | + |
| 29 | +class NostalgiaTemplate extends LegacyTemplate { |
| 30 | + |
29 | 31 | function doBeforeContent() { |
30 | 32 | $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>'; |
32 | 34 | |
33 | 35 | $s .= $this->pageTitle(); |
34 | 36 | $s .= $this->pageSubtitle() . "\n"; |
— | — | @@ -46,7 +48,7 @@ |
47 | 49 | $s .= '<br />' . $ol; |
48 | 50 | } |
49 | 51 | |
50 | | - $cat = $this->getCategoryLinks(); |
| 52 | + $cat = $this->getSkin()->getCategoryLinks(); |
51 | 53 | if( $cat ) { |
52 | 54 | $s .= '<br />' . $cat; |
53 | 55 | } |
— | — | @@ -61,8 +63,8 @@ |
62 | 64 | global $wgOut, $wgUser; |
63 | 65 | $sep = " |\n"; |
64 | 66 | |
65 | | - $s = $this->mainPageLink() . $sep |
66 | | - . $this->specialLink( 'Recentchanges' ); |
| 67 | + $s = $this->getSkin()->mainPageLink() . $sep |
| 68 | + . $this->getSkin()->specialLink( 'Recentchanges' ); |
67 | 69 | |
68 | 70 | if ( $wgOut->isArticle() ) { |
69 | 71 | $s .= $sep . '<strong>' . $this->editThisPage() . '</strong>' . $sep . $this->historyLink(); |
— | — | @@ -72,29 +74,29 @@ |
73 | 75 | $s .= $this->variantLinks(); |
74 | 76 | $s .= $this->extensionTabLinks(); |
75 | 77 | if ( $wgUser->isAnon() ) { |
76 | | - $s .= $sep . $this->specialLink( 'Userlogin' ); |
| 78 | + $s .= $sep . $this->getSkin()->specialLink( 'Userlogin' ); |
77 | 79 | } else { |
78 | 80 | /* 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' ) ); |
81 | 83 | if ( $wgUser->getNewtalk() ) { |
82 | 84 | $s .= ' *'; |
83 | 85 | } |
84 | 86 | /* show watchlist link */ |
85 | | - $s .= $sep . $this->specialLink( 'Watchlist' ); |
| 87 | + $s .= $sep . $this->getSkin()->specialLink( 'Watchlist' ); |
86 | 88 | /* show my contributions link */ |
87 | | - $s .= $sep . $this->link( |
| 89 | + $s .= $sep . $this->getSkin()->link( |
88 | 90 | SpecialPage::getSafeTitleFor( 'Contributions', $wgUser->getName() ), |
89 | 91 | wfMsgHtml( 'mycontris' ) ); |
90 | 92 | /* show my preferences link */ |
91 | | - $s .= $sep . $this->specialLink( 'Preferences' ); |
| 93 | + $s .= $sep . $this->getSkin()->specialLink( 'Preferences' ); |
92 | 94 | /* show upload file link */ |
93 | 95 | if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser ) === true ) { |
94 | 96 | $s .= $sep . $this->getUploadLink(); |
95 | 97 | } |
96 | 98 | |
97 | 99 | /* show log out link */ |
98 | | - $s .= $sep . $this->specialLink( 'Userlogout' ); |
| 100 | + $s .= $sep . $this->getSkin()->specialLink( 'Userlogout' ); |
99 | 101 | } |
100 | 102 | |
101 | 103 | $s .= $sep . $this->specialPagesList(); |
— | — | @@ -109,8 +111,8 @@ |
110 | 112 | |
111 | 113 | $s .= $this->bottomLinks(); |
112 | 114 | $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() |
115 | 117 | . ' | ' . $this->searchForm(); |
116 | 118 | |
117 | 119 | $s .= "\n</div>\n</div>\n"; |
Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -179,8 +179,6 @@ |
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | | - $wgOut->suppressQuickbar(); |
184 | | - |
185 | 183 | $oldTitle = $this->mOldPage->getPrefixedText(); |
186 | 184 | $newTitle = $this->mNewPage->getPrefixedText(); |
187 | 185 | if ( $oldTitle == $newTitle ) { |
— | — | @@ -204,6 +202,9 @@ |
205 | 203 | } |
206 | 204 | |
207 | 205 | $sk = $wgUser->getSkin(); |
| 206 | + if ( method_exists( $sk, 'suppressQuickbar' ) ) { |
| 207 | + $sk->suppressQuickbar(); |
| 208 | + } |
208 | 209 | |
209 | 210 | // Check if page is editable |
210 | 211 | $editable = $this->mNewRev->getTitle()->userCan( 'edit' ); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -129,13 +129,6 @@ |
130 | 130 | var $mAllowUserJs; |
131 | 131 | |
132 | 132 | /** |
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 | | - /** |
140 | 133 | * @EasterEgg I just love the name for this self documenting variable. |
141 | 134 | * @todo document |
142 | 135 | */ |
— | — | @@ -1072,23 +1065,6 @@ |
1073 | 1066 | } |
1074 | 1067 | |
1075 | 1068 | /** |
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 | | - /** |
1093 | 1069 | * Remove user JavaScript from scripts to load |
1094 | 1070 | */ |
1095 | 1071 | public function disallowUserJs() { |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -223,6 +223,8 @@ |
224 | 224 | 'SiteStatsUpdate' => 'includes/SiteStats.php', |
225 | 225 | 'Skin' => 'includes/Skin.php', |
226 | 226 | 'SkinTemplate' => 'includes/SkinTemplate.php', |
| 227 | + 'SkinLegacy' => 'includes/SkinLegacy.php', |
| 228 | + 'LegacyTemplate' => 'includes/SkinLegacy.php', |
227 | 229 | 'SpecialMycontributions' => 'includes/SpecialPage.php', |
228 | 230 | 'SpecialMypage' => 'includes/SpecialPage.php', |
229 | 231 | '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 .= ' <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}'> </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 |
1 | 939 | + native |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -15,13 +15,11 @@ |
16 | 16 | * |
17 | 17 | * @ingroup Skins |
18 | 18 | */ |
19 | | -class Skin extends Linker { |
| 19 | +abstract class Skin extends Linker { |
20 | 20 | /**#@+ |
21 | 21 | * @private |
22 | 22 | */ |
23 | 23 | 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 = ''; |
26 | 24 | /**#@-*/ |
27 | 25 | protected $mRevisionId; // The revision ID we're looking at, null if not applicable. |
28 | 26 | protected $skinname = 'standard'; |
— | — | @@ -181,18 +179,6 @@ |
182 | 180 | return $this->skinname; |
183 | 181 | } |
184 | 182 | |
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 | | - |
197 | 183 | function initPage( OutputPage $out ) { |
198 | 184 | global $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI; |
199 | 185 | |
— | — | @@ -439,6 +425,7 @@ |
440 | 426 | /** |
441 | 427 | * Outputs the HTML generated by other functions. |
442 | 428 | * @param $out Object: instance of OutputPage |
| 429 | + * @todo Exterminate! |
443 | 430 | */ |
444 | 431 | function outputPage( OutputPage $out ) { |
445 | 432 | global $wgDebugComments; |
— | — | @@ -656,11 +643,9 @@ |
657 | 644 | /** |
658 | 645 | * Add skin specific stylesheets |
659 | 646 | * @param $out OutputPage |
| 647 | + * @delete |
660 | 648 | */ |
661 | | - function setupSkinUserCss( OutputPage $out ) { |
662 | | - $out->addModuleStyles( 'mediawiki.legacy.shared' ); |
663 | | - $out->addModuleStyles( 'mediawiki.legacy.oldshared' ); |
664 | | - } |
| 649 | + abstract function setupSkinUserCss( OutputPage $out ); |
665 | 650 | |
666 | 651 | function getPageClasses( $title ) { |
667 | 652 | $numeric = 'ns-' . $title->getNamespace(); |
— | — | @@ -695,79 +680,6 @@ |
696 | 681 | return $wgLogo; |
697 | 682 | } |
698 | 683 | |
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 | | - |
772 | 684 | function getCategoryLinks() { |
773 | 685 | global $wgOut, $wgUseCategoryBrowser; |
774 | 686 | global $wgContLang, $wgUser; |
— | — | @@ -879,10 +791,6 @@ |
880 | 792 | return "<div id='catlinks' class='$classes'>{$catlinks}</div>"; |
881 | 793 | } |
882 | 794 | |
883 | | - function getQuickbarCompensator( $rows = 1 ) { |
884 | | - return "<td width='152' rowspan='{$rows}'> </td>"; |
885 | | - } |
886 | | - |
887 | 795 | /** |
888 | 796 | * This runs a hook to allow extensions placing their stuff after content |
889 | 797 | * and article metadata (e.g. categories). |
— | — | @@ -976,15 +884,6 @@ |
977 | 885 | |
978 | 886 | /** |
979 | 887 | * 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. |
989 | 888 | * @param $out OutputPage object |
990 | 889 | * @return String HTML-wrapped JS code to be put before </body> |
991 | 890 | */ |
— | — | @@ -1001,94 +900,6 @@ |
1002 | 901 | return wfMsg( 'retrievedfrom', '<a href="' . $url . '">' . $url . '</a>' ); |
1003 | 902 | } |
1004 | 903 | |
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 | | - |
1093 | 904 | function getUndeleteLink() { |
1094 | 905 | global $wgUser, $wgLang, $wgRequest; |
1095 | 906 | |
— | — | @@ -1121,53 +932,6 @@ |
1122 | 933 | return ''; |
1123 | 934 | } |
1124 | 935 | |
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 | | - |
1172 | 936 | function subPageSubtitle() { |
1173 | 937 | $subpages = ''; |
1174 | 938 | |
— | — | @@ -1229,67 +993,6 @@ |
1230 | 994 | return $wgShowIPinHeader && session_id() != ''; |
1231 | 995 | } |
1232 | 996 | |
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 | | - |
1294 | 997 | function getSearchLink() { |
1295 | 998 | $searchPage = SpecialPage::getTitleFor( 'Search' ); |
1296 | 999 | return $searchPage->getLocalURL(); |
— | — | @@ -1299,229 +1002,6 @@ |
1300 | 1003 | return htmlspecialchars( $this->getSearchLink() ); |
1301 | 1004 | } |
1302 | 1005 | |
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 .= ' <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 | | - |
1526 | 1006 | function getCopyright( $type = 'detect' ) { |
1527 | 1007 | global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest; |
1528 | 1008 | |
— | — | @@ -1656,40 +1136,6 @@ |
1657 | 1137 | } |
1658 | 1138 | |
1659 | 1139 | /** |
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 | | - /** |
1694 | 1140 | * Renders a $wgFooterIcons icon acording to the method's arguments |
1695 | 1141 | * @param $icon Array: The icon to build the html for, see $wgFooterIcons for the format of this array |
1696 | 1142 | * @param $withImage Boolean: Whether to use the icon's image or output a text-only footericon |
— | — | @@ -1767,32 +1213,6 @@ |
1768 | 1214 | return $this->footerLink( 'disclaimers', 'disclaimerpage' ); |
1769 | 1215 | } |
1770 | 1216 | |
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 | | - |
1797 | 1217 | /** |
1798 | 1218 | * Return URL options for the 'edit page' link. |
1799 | 1219 | * This may include an 'oldid' specifier, if the current page view is such. |
— | — | @@ -1810,129 +1230,6 @@ |
1811 | 1231 | return $options; |
1812 | 1232 | } |
1813 | 1233 | |
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 | | - |
1937 | 1234 | function showEmailUser( $id ) { |
1938 | 1235 | global $wgUser; |
1939 | 1236 | $targetUser = User::newFromId( $id ); |
— | — | @@ -1940,182 +1237,6 @@ |
1941 | 1238 | $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users |
1942 | 1239 | } |
1943 | 1240 | |
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 | | - |
2120 | 1241 | /** |
2121 | 1242 | * Return a fully resolved style path url to images or styles stored in the common folder. |
2122 | 1243 | * This method returns a url resolved using the configured skin style path |