diff --git a/Cite.php b/Cite.php index 4b2f70ff8..045bb8cc9 100644 --- a/Cite.php +++ b/Cite.php @@ -18,8 +18,6 @@ if ( ! defined( 'MEDIAWIKI' ) ) */ $wgHooks['ParserFirstCallInit'][] = 'wfCite'; -$wgHooks['BeforePageDisplay'][] = 'wfCiteBeforePageDisplay'; - $wgExtensionCredits['parserhook'][] = array( 'path' => __FILE__, @@ -98,22 +96,4 @@ $wgResourceModules['ext.rtlcite'] = $citeResourceTemplate + array( 'position' => 'top', ); -/** - * @param $out OutputPage - * @param $sk Skin - * @return bool - */ -function wfCiteBeforePageDisplay( $out, &$sk ) { - global $wgCiteEnablePopups; - - $out->addModules( 'ext.cite' ); - if ( $wgCiteEnablePopups ) { - $out->addModules( 'ext.cite.popups' ); - } - - /* RTL support quick-fix module */ - $out->addModuleStyles( 'ext.rtlcite' ); - return true; -} - /**#@-*/ diff --git a/Cite_body.php b/Cite_body.php index 27432f479..08c607224 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -155,6 +155,7 @@ class Cite { * @return string */ function ref( $str, $argv, $parser ) { + global $wgCiteEnablePopups; if ( $this->mInCite ) { return htmlspecialchars( "$str" ); } else { @@ -162,6 +163,12 @@ class Cite { $this->mInCite = true; $ret = $this->guardedRef( $str, $argv, $parser ); $this->mInCite = false; + $parserOutput = $parser->getOutput(); + $parserOutput->addModules( 'ext.cite' ); + if ( $wgCiteEnablePopups ) { + $parserOutput->addModules( 'ext.cite.popups' ); + } + $parserOutput->addModuleStyles( 'ext.rtlcite' ); return $ret; } }