Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -32,11 +32,9 @@ |
33 | 33 | /** |
34 | 34 | * Constructor |
35 | 35 | */ |
36 | | - function ProofreadPage() { |
37 | | - global $wgParser, $wgHooks, $wgScriptPath; |
38 | | - $wgParser->setHook( 'pagelist', array( &$this, 'renderPageList' ) ); |
39 | | - $wgParser->setHook( 'pages', array( &$this, 'renderPages' ) ); |
40 | | - $wgParser->setHook( 'pagequality', array( &$this, 'pageQuality' ) ); |
| 36 | + function __construct() { |
| 37 | + global $wgHooks, $wgScriptPath; |
| 38 | + $wgHooks['ParserFirstCallInit'][] = array( $this, 'parserFirstCallInit' ); |
41 | 39 | $wgHooks['BeforePageDisplay'][] = array( &$this, 'beforePageDisplay' ); |
42 | 40 | $wgHooks['GetLinkColours'][] = array( &$this, 'getLinkColoursHook' ); |
43 | 41 | $wgHooks['ImageOpenShowImageInlineBefore'][] = array( &$this, 'imageMessage' ); |
— | — | @@ -71,6 +69,19 @@ |
72 | 70 | |
73 | 71 | } |
74 | 72 | |
| 73 | + /** |
| 74 | + * Set up our custom parser hooks when initializing parser. |
| 75 | + * |
| 76 | + * @param Parser $parser |
| 77 | + * @return boolean hook return value |
| 78 | + */ |
| 79 | + public function parserFirstCallInit( $parser ) { |
| 80 | + $parser->setHook( 'pagelist', array( $this, 'renderPageList' ) ); |
| 81 | + $parser->setHook( 'pages', array( $this, 'renderPages' ) ); |
| 82 | + $parser->setHook( 'pagequality', array( $this, 'pageQuality' ) ); |
| 83 | + return true; |
| 84 | + } |
| 85 | + |
75 | 86 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
76 | 87 | $resourceLoader->register( |
77 | 88 | 'ext.proofreadpage.page', |