Index: trunk/extensions/ReaderFeedback/ReaderFeedback.hooks.php |
— | — | @@ -4,15 +4,14 @@ |
5 | 5 | /** |
6 | 6 | * Add ReaderFeedback css/js. |
7 | 7 | */ |
8 | | - public static function injectStyleAndJS() { |
9 | | - global $wgOut, $wgTitle; |
10 | | - if( $wgOut->hasHeadItem( 'ReaderFeedback' ) ) |
| 8 | + public static function injectStyleAndJS( $out ) { |
| 9 | + if( $out->hasHeadItem( 'ReaderFeedback' ) ) |
11 | 10 | return true; # Don't double-load |
12 | | - if( !isset($wgTitle) || !$wgOut->isArticleRelated() ) { |
13 | | - return self::InjectStyleForSpecial(); // try special page CSS? |
| 11 | + if( !$out->getTitle() || !$out->isArticleRelated() ) { |
| 12 | + return self::InjectStyleForSpecial( $out ); // try special page CSS? |
14 | 13 | } |
15 | 14 | # Try to only add to relevant pages |
16 | | - if( !ReaderFeedback::isPageRateable($wgTitle) ) { |
| 15 | + if( !ReaderFeedback::isPageRateable( $out->getTitle() ) ) { |
17 | 16 | return true; |
18 | 17 | } |
19 | 18 | global $wgScriptPath, $wgJsMimeType, $wgFeedbackStylePath, $wgFeedbackStyleVersion; |
— | — | @@ -22,9 +21,9 @@ |
23 | 22 | $cssFile = "$stylePath/readerfeedback.css?$wgFeedbackStyleVersion"; |
24 | 23 | $jsFile = "$stylePath/readerfeedback.js?$wgFeedbackStyleVersion"; |
25 | 24 | // Add CSS |
26 | | - $wgOut->addExtensionStyle( $cssFile ); |
| 25 | + $out->addExtensionStyle( $cssFile ); |
27 | 26 | // Add JS |
28 | | - $wgOut->addScriptFile( $jsFile ); |
| 27 | + $out->addScriptFile( $jsFile ); |
29 | 28 | |
30 | 29 | return true; |
31 | 30 | } |
— | — | @@ -41,18 +40,17 @@ |
42 | 41 | /** |
43 | 42 | * Add ReaderFeedback css for relevant special pages. |
44 | 43 | */ |
45 | | - public static function InjectStyleForSpecial() { |
46 | | - global $wgTitle, $wgOut; |
47 | | - if( empty($wgTitle) || $wgTitle->getNamespace() !== NS_SPECIAL ) { |
| 44 | + public static function InjectStyleForSpecial( $out ) { |
| 45 | + if ( !is_object( $out->getTitle() ) || $out->getTitle()->getNamespace() !== NS_SPECIAL ) { |
48 | 46 | return true; |
49 | 47 | } |
50 | 48 | $spPages = array( 'RatingHistory' ); |
51 | 49 | foreach( $spPages as $key ) { |
52 | | - if( $wgTitle->isSpecial( $key ) ) { |
| 50 | + if( $out->getTitle()->isSpecial( $key ) ) { |
53 | 51 | global $wgScriptPath, $wgFeedbackStylePath, $wgFeedbacktyleVersion; |
54 | 52 | $stylePath = str_replace( '$wgScriptPath', $wgScriptPath, $wgFeedbackStylePath ); |
55 | 53 | $encCssFile = htmlspecialchars( "$stylePath/readerfeedback.css?$wgFeedbacktyleVersion" ); |
56 | | - $wgOut->addExtensionStyle( $encCssFile ); |
| 54 | + $out->addExtensionStyle( $encCssFile ); |
57 | 55 | break; |
58 | 56 | } |
59 | 57 | } |
— | — | @@ -164,9 +162,8 @@ |
165 | 163 | } |
166 | 164 | |
167 | 165 | public static function addRatingLink( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { |
168 | | - global $wgTitle; |
169 | 166 | # Add rating tab |
170 | | - if( isset($wgTitle) && ReaderFeedback::isPageRateable($wgTitle) ) { |
| 167 | + if( $skintemplate->getTitle() && ReaderFeedback::isPageRateable( $skintemplate->getTitle() ) ) { |
171 | 168 | $nav_urls['ratinghist'] = array( |
172 | 169 | 'text' => wfMsg( 'ratinghistory-link' ), |
173 | 170 | 'href' => $skintemplate->makeSpecialUrl( 'RatingHistory', |