Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -120,8 +120,7 @@ |
121 | 121 | * @return A string containing the HTML with the factbox |
122 | 122 | */ |
123 | 123 | private function displayData( SMWSemanticData $data, $left = true, $incoming = false ) { |
124 | | - global $wgUser; |
125 | | - $skin = $wgUser->getSkin(); |
| 124 | + $skin = $this->getSkin(); |
126 | 125 | // Some of the CSS classes are different for the left or the right side. |
127 | 126 | // In this case, there is an "i" after the "smwb-". This is set here. |
128 | 127 | $ccsPrefix = $left ? 'smwb-' : 'smwb-i'; |
— | — | @@ -202,9 +201,10 @@ |
203 | 202 | * @return string HTML with the link to the article, browse, and search pages |
204 | 203 | */ |
205 | 204 | private function displayValue( SMWPropertyValue $property, SMWDataValue $dataValue, $incoming ) { |
206 | | - global $wgUser; |
207 | | - $skin = $wgUser->getSkin(); |
| 205 | + $skin = $this->getSkin(); |
| 206 | + |
208 | 207 | $html = $dataValue->getLongHTMLText( $skin ); |
| 208 | + |
209 | 209 | if ( $dataValue->getTypeID() == '_wpg' ) { |
210 | 210 | $html .= " " . SMWInfolink::newBrowsingLink( '+', $dataValue->getLongWikiText() )->getHTML( $skin ); |
211 | 211 | } elseif ( $incoming && $property->isVisible() ) { |
— | — | @@ -212,6 +212,7 @@ |
213 | 213 | } else { |
214 | 214 | $html .= $dataValue->getInfolinkText( SMW_OUTPUT_HTML, $skin ); |
215 | 215 | } |
| 216 | + |
216 | 217 | return $html; |
217 | 218 | } |
218 | 219 | |
— | — | @@ -221,14 +222,17 @@ |
222 | 223 | * @return A string containing the HTML with the subject line |
223 | 224 | */ |
224 | 225 | private function displayHead() { |
225 | | - global $wgUser, $wgOut; |
226 | | - $skin = $wgUser->getSkin(); |
| 226 | + global $wgOut; |
| 227 | + |
| 228 | + $skin = $this->getSkin(); |
| 229 | + |
227 | 230 | $wgOut->setHTMLTitle( $this->subject->getTitle() ); |
228 | 231 | $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n"; |
229 | 232 | $html .= "<tr class=\"smwb-title\"><td colspan=\"2\">\n"; |
230 | 233 | $html .= $skin->makeLinkObj( $this->subject->getTitle() ) . "\n"; // @todo Replace makeLinkObj with link as soon as we drop MW1.12 compatibility |
231 | 234 | $html .= "</td></tr>\n"; |
232 | 235 | $html .= "</table>\n"; |
| 236 | + |
233 | 237 | return $html; |
234 | 238 | } |
235 | 239 | |
— | — | @@ -282,11 +286,9 @@ |
283 | 287 | * @return string HTML with the link to this page |
284 | 288 | */ |
285 | 289 | private function linkhere( $text, $out, $in, $offset ) { |
286 | | - global $wgUser; |
287 | | - $skin = $wgUser->getSkin(); |
288 | 290 | $dir = $out ? ( $in ? 'both':'out' ):'in'; |
289 | 291 | $frag = ( $text == wfMsg( 'smw_browse_show_incoming' ) ) ? '#smw_browse_incoming':''; |
290 | | - return '<a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'Browse', |
| 292 | + return '<a href="' . htmlspecialchars( $this->getSkin()->makeSpecialUrl( 'Browse', |
291 | 293 | "offset={$offset}&dir={$dir}&article=" . urlencode( $this->subject->getLongWikiText() ) ) ) . "$frag\">$text</a>"; |
292 | 294 | } |
293 | 295 | |
— | — | @@ -373,4 +375,22 @@ |
374 | 376 | $text = preg_replace( '/[\s]/u', $nonBreakingSpace, $text, - 1, $count ); |
375 | 377 | return $count > 2 ? preg_replace( '/($nonBreakingSpace)/u', ' ', $text, max( 0, $count - 2 ) ):$text; |
376 | 378 | } |
| 379 | + |
| 380 | + /** |
| 381 | + * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage. |
| 382 | + * |
| 383 | + * @since 1.6 |
| 384 | + * |
| 385 | + * @return Skin |
| 386 | + */ |
| 387 | + public function getSkin() { |
| 388 | + if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
| 389 | + return parent::getSkin(); |
| 390 | + } |
| 391 | + else { |
| 392 | + global $wgUser; |
| 393 | + return $wgUser->getSkin(); |
| 394 | + } |
| 395 | + } |
| 396 | + |
377 | 397 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | * @ingroup SpecialPage |
22 | 22 | */ |
23 | 23 | class SMWPageProperty extends SpecialPage { |
| 24 | + |
24 | 25 | /** |
25 | 26 | * Constructor |
26 | 27 | */ |
— | — | @@ -29,10 +30,10 @@ |
30 | 31 | } |
31 | 32 | |
32 | 33 | public function execute( $query ) { |
33 | | - global $wgRequest, $wgOut, $wgUser; |
34 | | - $skin = $wgUser->getSkin(); |
| 34 | + global $wgRequest, $wgOut; |
| 35 | + $skin = $this->getSkin(); |
35 | 36 | $this->setHeaders(); |
36 | | - |
| 37 | + |
37 | 38 | // Get parameters |
38 | 39 | $pagename = $wgRequest->getVal( 'from' ); |
39 | 40 | $propname = $wgRequest->getVal( 'type' ); |
— | — | @@ -121,4 +122,22 @@ |
122 | 123 | $wgOut->addHTML( $html ); |
123 | 124 | SMWOutputs::commitToOutputPage( $wgOut ); // make sure locally collected output data is pushed to the output! |
124 | 125 | } |
| 126 | + |
| 127 | + /** |
| 128 | + * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage. |
| 129 | + * |
| 130 | + * @since 1.6 |
| 131 | + * |
| 132 | + * @return Skin |
| 133 | + */ |
| 134 | + public function getSkin() { |
| 135 | + if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
| 136 | + return parent::getSkin(); |
| 137 | + } |
| 138 | + else { |
| 139 | + global $wgUser; |
| 140 | + return $wgUser->getSkin(); |
| 141 | + } |
| 142 | + } |
| 143 | + |
125 | 144 | } |