Index: trunk/extensions/ReplaceText/SpecialReplaceText.php |
— | — | @@ -16,7 +16,10 @@ |
17 | 17 | |
18 | 18 | $this->user = $wgUser; |
19 | 19 | $this->setHeaders(); |
20 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 20 | + if ( method_exists( $wgOut, 'addModuleStyles' ) && |
| 21 | + !is_null( $wgOut->getResourceLoader()->getModule( 'mediawiki.special' ) ) ) { |
| 22 | + $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 23 | + } |
21 | 24 | $this->doSpecialReplaceText(); |
22 | 25 | } |
23 | 26 | |
— | — | @@ -264,6 +267,7 @@ |
265 | 268 | array( |
266 | 269 | 'type'=>'button', |
267 | 270 | 'id' => 'mw-search-toggleall', |
| 271 | + // 'onclick' value needed for MW 1.16 |
268 | 272 | 'onclick' => 'mwToggleSearchCheckboxes("all");', |
269 | 273 | 'value' => wfMsg( 'powersearch-toggleall' ) |
270 | 274 | ) |
— | — | @@ -273,6 +277,7 @@ |
274 | 278 | array( |
275 | 279 | 'type'=>'button', |
276 | 280 | 'id' => 'mw-search-togglenone', |
| 281 | + // 'onclick' value needed for MW 1.16 |
277 | 282 | 'onclick' => 'mwToggleSearchCheckboxes("none");', |
278 | 283 | 'value' => wfMsg( 'powersearch-togglenone' ) |
279 | 284 | ) |
— | — | @@ -304,8 +309,12 @@ |
305 | 310 | Xml::submitButton( wfMsg( 'replacetext_continue' ) ) . |
306 | 311 | Xml::closeElement( 'form' ) |
307 | 312 | ); |
308 | | - // add javascript specific to special:search |
309 | | - $wgOut->addModules( 'mediawiki.special.search' ); |
| 313 | + // Add Javascript specific to Special:Search |
| 314 | + if ( method_exists( $wgOut, 'addModules' ) ) { |
| 315 | + $wgOut->addModules( 'mediawiki.special.search' ); |
| 316 | + } else { |
| 317 | + $wgOut->addScriptFile( 'search.js' ); |
| 318 | + } |
310 | 319 | } |
311 | 320 | |
312 | 321 | /** |
— | — | @@ -472,11 +481,11 @@ |
473 | 482 | foreach ( $cuts as $_ ) { |
474 | 483 | list( $index, $len, ) = $_; |
475 | 484 | $context .= self::convertWhiteSpaceToHTML( |
476 | | - $wgLang->truncate( substr( $text, 0, $index ), - $cw, '...', false ) |
| 485 | + $wgLang->truncate( substr( $text, 0, $index ), - $cw, '...', false ) |
477 | 486 | ); |
478 | 487 | $snippet = self::convertWhiteSpaceToHTML( substr( $text, $index, $len ) ); |
479 | 488 | if ( $use_regex ) { |
480 | | - $targetStr = "/$target/U"; |
| 489 | + $targetStr = "/$target/U"; |
481 | 490 | } else { |
482 | 491 | $targetq = preg_quote( self::convertWhiteSpaceToHTML( $target ), '/' ); |
483 | 492 | $targetStr = "/$targetq/i"; |
— | — | @@ -529,7 +538,7 @@ |
530 | 539 | $tables = array( 'page', 'revision', 'text' ); |
531 | 540 | $vars = array( 'page_id', 'page_namespace', 'page_title', 'old_text' ); |
532 | 541 | if ( $use_regex ) { |
533 | | - $comparisonCond = 'old_text REGEXP ' . $dbr->addQuotes( $search ); |
| 542 | + $comparisonCond = 'old_text REGEXP ' . $dbr->addQuotes( $search ); |
534 | 543 | } else { |
535 | 544 | $any = $dbr->anyString(); |
536 | 545 | $comparisonCond = 'old_text ' . $dbr->buildLike( $any, $search, $any ); |