Index: trunk/extensions/Collection/Collection.php |
— | — | @@ -268,8 +268,6 @@ |
269 | 269 | $wgAjaxExportList[] = 'wfAjaxCollectionAddCategory'; |
270 | 270 | |
271 | 271 | function wfAjaxCollectionGetBookCreatorBoxContent( $ajaxHint = '', $oldid = null, $pageName = null ) { |
272 | | - global $wgUser; |
273 | | - |
274 | 272 | if ( !is_null( $oldid ) ) { |
275 | 273 | $oldid = intval( $oldid ); |
276 | 274 | } |
— | — | @@ -282,7 +280,7 @@ |
283 | 281 | $title = Title::newMainPage(); |
284 | 282 | } |
285 | 283 | |
286 | | - $html = CollectionHooks::getBookCreatorBoxContent( $wgUser->getSkin(), $title, $ajaxHint, $oldid ); |
| 284 | + $html = CollectionHooks::getBookCreatorBoxContent( $title, $ajaxHint, $oldid ); |
287 | 285 | |
288 | 286 | $json = new Services_JSON(); |
289 | 287 | $result = array(); |
Index: trunk/extensions/Collection/Collection.hooks.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /* |
5 | 4 | * Collection Extension for MediaWiki |
6 | 5 | * |
— | — | @@ -97,7 +96,7 @@ |
98 | 97 | if ( !CollectionSession::isEnabled() ) { |
99 | 98 | $out .= Xml::tags( 'li', |
100 | 99 | array( 'id' => 'coll-create_a_book' ), |
101 | | - $sk->link( |
| 100 | + Linker::link( |
102 | 101 | SpecialPage::getTitleFor( 'Book' ), |
103 | 102 | wfMsgHtml( 'coll-create_a_book' ), |
104 | 103 | array( |
— | — | @@ -111,7 +110,7 @@ |
112 | 111 | } else { |
113 | 112 | $out .= Xml::tags( 'li', |
114 | 113 | array( 'id' => 'coll-book_creator_disable' ), |
115 | | - $sk->link( |
| 114 | + Linker::link( |
116 | 115 | SpecialPage::getTitleFor( 'Book' ), |
117 | 116 | wfMsgHtml( 'coll-book_creator_disable' ), |
118 | 117 | array( |
— | — | @@ -140,7 +139,7 @@ |
141 | 140 | $params['writer'] = $writer; |
142 | 141 | $out .= Xml::tags( 'li', |
143 | 142 | array( 'id' => 'coll-download-as-' . $writer ), |
144 | | - $sk->link( |
| 143 | + Linker::link( |
145 | 144 | SpecialPage::getTitleFor( 'Book' ), |
146 | 145 | wfMsgHtml( 'coll-download_as', htmlspecialchars( $wgCollectionFormats[$writer] ) ), |
147 | 146 | array( |
— | — | @@ -200,17 +199,16 @@ |
201 | 200 | if ( $skin ) { |
202 | 201 | $title = $skin->getTitle(); |
203 | 202 | } else { |
204 | | - global $wgTitle, $wgUser; |
| 203 | + global $wgTitle; |
205 | 204 | $title = $wgTitle; |
206 | | - $skin = $wgUser->getSkin(); |
207 | 205 | } |
208 | 206 | |
209 | 207 | if ( $title->isSpecial( 'Book' ) ) { |
210 | 208 | $cmd = $wgRequest->getVal( 'bookcmd', '' ); |
211 | 209 | if ( $cmd == 'suggest' ) { |
212 | | - $siteNotice .= self::renderBookCreatorBox( $title, $skin, 'suggest' ); |
| 210 | + $siteNotice .= self::renderBookCreatorBox( $title, 'suggest' ); |
213 | 211 | } elseif ( $cmd == '' ) { |
214 | | - $siteNotice .= self::renderBookCreatorBox( $title, $skin, 'showbook' ); |
| 212 | + $siteNotice .= self::renderBookCreatorBox( $title, 'showbook' ); |
215 | 213 | } |
216 | 214 | return true; |
217 | 215 | } |
— | — | @@ -225,7 +223,7 @@ |
226 | 224 | return true; |
227 | 225 | } |
228 | 226 | |
229 | | - $siteNotice .= self::renderBookCreatorBox( $title, $skin ); |
| 227 | + $siteNotice .= self::renderBookCreatorBox( $title ); |
230 | 228 | return true; |
231 | 229 | } |
232 | 230 | |
— | — | @@ -235,7 +233,7 @@ |
236 | 234 | * @param $mode string |
237 | 235 | * @return string |
238 | 236 | */ |
239 | | - static function renderBookCreatorBox( $title, $skin, $mode = '' ) { |
| 237 | + static function renderBookCreatorBox( $title, $mode = '' ) { |
240 | 238 | global $wgCollectionStyleVersion; |
241 | 239 | global $wgOut; |
242 | 240 | global $wgScriptPath; |
— | — | @@ -273,7 +271,7 @@ |
274 | 272 | array( 'class' => 'collection-creatorbox-row' ), |
275 | 273 | Xml::tags( 'div', |
276 | 274 | array( 'class' => 'mw-float-end' ), |
277 | | - $skin->link( |
| 275 | + Linker::link( |
278 | 276 | Title::newFromText( wfMsg( 'coll-helppage' ) ), |
279 | 277 | Xml::element( 'img', |
280 | 278 | array( |
— | — | @@ -298,7 +296,7 @@ |
299 | 297 | wfMsgHtml( 'coll-book_creator' ) |
300 | 298 | ) |
301 | 299 | . ' (' |
302 | | - . $skin->link( |
| 300 | + . Linker::link( |
303 | 301 | SpecialPage::getTitleFor( 'Book' ), |
304 | 302 | wfMsgHtml( 'coll-disable' ), |
305 | 303 | array( |
— | — | @@ -316,21 +314,21 @@ |
317 | 315 | 'id' => 'coll-book_creator_box', |
318 | 316 | 'class' => 'collection-creatorbox-row', |
319 | 317 | ), |
320 | | - self::getBookCreatorBoxContent( $skin, $title, $addRemoveState, $oldid ) |
| 318 | + self::getBookCreatorBoxContent( $title, $addRemoveState, $oldid ) |
321 | 319 | ); |
322 | 320 | |
323 | 321 | $html .= Xml::closeElement( 'div' ); |
324 | 322 | return $html; |
325 | 323 | } |
326 | 324 | |
327 | | - static function getBookCreatorBoxContent( $skin, $title, $ajaxHint = null, $oldid = null ) { |
| 325 | + static function getBookCreatorBoxContent( $title, $ajaxHint = null, $oldid = null ) { |
328 | 326 | global $wgScriptPath; |
329 | 327 | |
330 | 328 | $imagePath = "$wgScriptPath/extensions/Collection/images"; |
331 | 329 | |
332 | | - return self::getBookCreatorBoxAddRemoveLink( $skin, $imagePath, $ajaxHint, $title, $oldid ) |
333 | | - . self::getBookCreatorBoxShowBookLink( $skin, $imagePath, $ajaxHint ) |
334 | | - . self::getBookCreatorBoxSuggestLink( $skin, $imagePath, $ajaxHint ); |
| 330 | + return self::getBookCreatorBoxAddRemoveLink( $imagePath, $ajaxHint, $title, $oldid ) |
| 331 | + . self::getBookCreatorBoxShowBookLink( $imagePath, $ajaxHint ) |
| 332 | + . self::getBookCreatorBoxSuggestLink( $imagePath, $ajaxHint ); |
335 | 333 | } |
336 | 334 | |
337 | 335 | /** |
— | — | @@ -341,7 +339,7 @@ |
342 | 340 | * @param $oldid |
343 | 341 | * @return string |
344 | 342 | */ |
345 | | - static function getBookCreatorBoxAddRemoveLink( $sk, $imagePath, $ajaxHint, $title, $oldid ) { |
| 343 | + static function getBookCreatorBoxAddRemoveLink( $imagePath, $ajaxHint, $title, $oldid ) { |
346 | 344 | $namespace = $title->getNamespace(); |
347 | 345 | $ptext = $title->getPrefixedText(); |
348 | 346 | |
— | — | @@ -389,7 +387,7 @@ |
390 | 388 | } |
391 | 389 | } |
392 | 390 | |
393 | | - return $sk->link( |
| 391 | + return Linker::link( |
394 | 392 | SpecialPage::getTitleFor( 'Book' ), |
395 | 393 | Xml::element( 'img', |
396 | 394 | array( |
— | — | @@ -412,8 +410,9 @@ |
413 | 411 | |
414 | 412 | } |
415 | 413 | |
416 | | - static function getBookCreatorBoxShowBookLink( $sk, $imagePath, $ajaxHint ) { |
| 414 | + static function getBookCreatorBoxShowBookLink( $imagePath, $ajaxHint ) { |
417 | 415 | $numArticles = CollectionSession::countArticles(); |
| 416 | + |
418 | 417 | if ( $ajaxHint == 'showbook' ) { |
419 | 418 | return Xml::tags( 'strong', |
420 | 419 | array( |
— | — | @@ -431,7 +430,7 @@ |
432 | 431 | . ' (' . wfMsgExt( 'coll-n_pages', array( 'parsemag', 'escape' ), $numArticles ) . ')' |
433 | 432 | ); |
434 | 433 | } else { |
435 | | - return $sk->link( |
| 434 | + return Linker::link( |
436 | 435 | SpecialPage::getTitleFor( 'Book' ), |
437 | 436 | Xml::element( 'img', |
438 | 437 | array( |
— | — | @@ -454,7 +453,7 @@ |
455 | 454 | } |
456 | 455 | } |
457 | 456 | |
458 | | - static function getBookCreatorBoxSuggestLink( $sk, $imagePath, $ajaxHint ) { |
| 457 | + static function getBookCreatorBoxSuggestLink( $imagePath, $ajaxHint ) { |
459 | 458 | if ( wfMsg( 'coll-suggest_enabled' ) != '1' ) { |
460 | 459 | return ''; |
461 | 460 | } |
— | — | @@ -476,7 +475,7 @@ |
477 | 476 | . ' ' . wfMsgHtml( 'coll-make_suggestions' ) |
478 | 477 | ); |
479 | 478 | } else { |
480 | | - return $sk->link( |
| 479 | + return Linker::link( |
481 | 480 | SpecialPage::getTitleFor( 'Book' ), |
482 | 481 | Xml::element( 'img', |
483 | 482 | array( |
— | — | @@ -517,4 +516,3 @@ |
518 | 517 | return true; |
519 | 518 | } |
520 | 519 | } |
521 | | - |
Index: trunk/extensions/Collection/Collection.body.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /* |
5 | 4 | * Collection Extension for MediaWiki |
6 | 5 | * |
— | — | @@ -39,11 +38,7 @@ |
40 | 39 | } |
41 | 40 | |
42 | 41 | function execute( $par ) { |
43 | | - global $wgOut; |
44 | | - global $wgRequest; |
45 | | - global $wgUser; |
46 | | - global $wgContLang; |
47 | | - global $wgCollectionMaxArticles; |
| 42 | + global $wgOut, $wgRequest, $wgUser, $wgContLang, $wgCollectionMaxArticles; |
48 | 43 | |
49 | 44 | // support previous URLs (e.g. used in templates) which used the "$par" part |
50 | 45 | // (i.e. subpages of the Special page) |
— | — | @@ -305,9 +300,7 @@ |
306 | 301 | } |
307 | 302 | |
308 | 303 | function renderBookCreatorPage( $referer, $par ) { |
309 | | - global $wgOut; |
310 | | - global $wgUser; |
311 | | - global $wgJsMimeType; |
| 304 | + global $wgOut, $wgJsMimeType; |
312 | 305 | |
313 | 306 | $this->setHeaders(); |
314 | 307 | $wgOut->setPageTitle( wfMsg( 'coll-book_creator' ) ); |
— | — | @@ -327,7 +320,6 @@ |
328 | 321 | if ( is_null( $title ) || $title->equals( $this->getTitle( $par ) ) ) { |
329 | 322 | $title = Title::newMainPage(); |
330 | 323 | } |
331 | | - $sk = $wgUser->getSkin(); |
332 | 324 | |
333 | 325 | $wgOut->addHTML( |
334 | 326 | Xml::tags( 'div', |
— | — | @@ -356,7 +348,7 @@ |
357 | 349 | array( |
358 | 350 | 'class' => 'collection-button cancel', |
359 | 351 | ), |
360 | | - $sk->link( |
| 352 | + Linker::link( |
361 | 353 | $title, |
362 | 354 | wfMsgHtml( 'coll-cancel' ), |
363 | 355 | array( |
— | — | @@ -430,8 +422,7 @@ |
431 | 423 | } |
432 | 424 | |
433 | 425 | static function getBookPagePrefixes() { |
434 | | - global $wgUser; |
435 | | - global $wgCommunityCollectionNamespace; |
| 426 | + global $wgUser, $wgCommunityCollectionNamespace; |
436 | 427 | |
437 | 428 | $result = array(); |
438 | 429 | |
— | — | @@ -458,8 +449,7 @@ |
459 | 450 | } |
460 | 451 | |
461 | 452 | function renderSpecialPage() { |
462 | | - global $wgCollectionFormats; |
463 | | - global $wgOut; |
| 453 | + global $wgCollectionFormats, $wgOut; |
464 | 454 | |
465 | 455 | if ( !CollectionSession::hasSession() ) { |
466 | 456 | CollectionSession::startSession(); |
— | — | @@ -619,8 +609,7 @@ |
620 | 610 | } |
621 | 611 | |
622 | 612 | static function addCategory( $title ) { |
623 | | - global $wgCollectionMaxArticles; |
624 | | - global $wgCollectionArticleNamespaces; |
| 613 | + global $wgCollectionMaxArticles, $wgCollectionArticleNamespaces; |
625 | 614 | |
626 | 615 | $limit = $wgCollectionMaxArticles - CollectionSession::countArticles(); |
627 | 616 | if ( $limit <= 0 ) { |
— | — | @@ -876,12 +865,8 @@ |
877 | 866 | } |
878 | 867 | |
879 | 868 | function getLicenseInfos() { |
880 | | - global $wgCollectionLicenseName; |
881 | | - global $wgCollectionLicenseURL; |
882 | | - global $wgRightsIcon; |
883 | | - global $wgRightsPage; |
884 | | - global $wgRightsText; |
885 | | - global $wgRightsUrl; |
| 869 | + global $wgCollectionLicenseName, $wgCollectionLicenseURL, $wgRightsIcon; |
| 870 | + global $wgRightsPage, $wgRightsText, $wgRightsUrl; |
886 | 871 | |
887 | 872 | $licenseInfo = array( |
888 | 873 | "type" => "license", |
— | — | @@ -1082,9 +1067,7 @@ |
1083 | 1068 | } |
1084 | 1069 | |
1085 | 1070 | function download() { |
1086 | | - global $wgOut; |
1087 | | - global $wgRequest; |
1088 | | - global $wgCollectionContentTypeToFilename; |
| 1071 | + global $wgOut, $wgRequest, $wgCollectionContentTypeToFilename; |
1089 | 1072 | |
1090 | 1073 | $tempfile = tmpfile(); |
1091 | 1074 | $r = self::mwServeCommand( 'render_status', array( |
— | — | @@ -1210,10 +1193,7 @@ |
1211 | 1194 | } |
1212 | 1195 | |
1213 | 1196 | static function mwServeCommand( $command, $args ) { |
1214 | | - global $wgOut; |
1215 | | - global $wgCollectionMWServeURL; |
1216 | | - global $wgCollectionMWServeCredentials; |
1217 | | - global $wgCollectionFormatToServeURL; |
| 1197 | + global $wgOut, $wgCollectionMWServeURL, $wgCollectionMWServeCredentials, $wgCollectionFormatToServeURL; |
1218 | 1198 | |
1219 | 1199 | $serveURL = $wgCollectionMWServeURL; |
1220 | 1200 | if ( array_key_exists( $args['writer'], $wgCollectionFormatToServeURL ) ) |