Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -539,6 +539,8 @@ |
540 | 540 | # Parser stuff |
541 | 541 | $wgHooks['ParserFirstCallInit'][] = 'FlaggedRevsHooks::onParserFirstCallInit'; |
542 | 542 | $wgHooks['LanguageGetMagic'][] = 'FlaggedRevsHooks::onLanguageGetMagic'; |
| 543 | + $wgHooks['ParserGetVariableValueSwitch'][] = 'FlaggedRevsHooks::onParserGetVariableValueSwitch'; |
| 544 | + $wgHooks['MagicWordwgVariableIDs'][] = 'FlaggedRevsHooks::onMagicWordwgVariableIDs'; |
543 | 545 | } |
544 | 546 | # Give bots the 'autoreview' right (here so it triggers after CentralAuth) |
545 | 547 | # @TODO: better way to ensure hook order |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -632,9 +632,29 @@ |
633 | 633 | public static function onLanguageGetMagic( &$magicWords, $langCode ) { |
634 | 634 | $magicWords['pagesusingpendingchanges'] = |
635 | 635 | array( 0, 'pagesusingpendingchanges' ); |
| 636 | + $magicWords['pendingchangelevel'] = |
| 637 | + array( 0, 'pendingchangelevel' ); |
636 | 638 | return true; |
637 | 639 | } |
638 | 640 | |
| 641 | + public static function onParserGetVariableValueSwitch( &$parser, &$cache, &$word, &$ret ) { |
| 642 | + if( $word == 'pendingchangelevel' ) { |
| 643 | + $title = $parser->getTitle(); |
| 644 | + if( !FlaggedRevs::inReviewNamespace( $title ) ) { |
| 645 | + $ret = ''; |
| 646 | + } else { |
| 647 | + $config = FlaggedRevs::getPageVisibilitySettings( $title ); |
| 648 | + $ret = $config['autoreview']; |
| 649 | + } |
| 650 | + } |
| 651 | + return true; |
| 652 | + } |
| 653 | + |
| 654 | + public static function onMagicWordwgVariableIDs( &$words ) { |
| 655 | + $words[] = 'pendingchangelevel'; |
| 656 | + return true; |
| 657 | + } |
| 658 | + |
639 | 659 | public static function parserPagesUsingPendingChanges( &$parser, $ns = '' ) { |
640 | 660 | $nsList = FlaggedRevs::getReviewNamespaces(); |
641 | 661 | |