From: Rob Church Date: Fri, 29 Jun 2007 13:52:54 +0000 (+0000) Subject: Hook callbacks for 'ShowRawCssJs' should do their own output, if so desired; don... X-Git-Tag: 1.31.0-rc.0~52327 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=8a2aee5478052ef8551e44028aa9702cfd900cbe;p=lhc%2Fweb%2Fwiklou.git Hook callbacks for 'ShowRawCssJs' should do their own output, if so desired; don't trust the text we get back from the hook. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 371662934a..a74591a8f6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -656,8 +656,8 @@ $content_actions: The array of content actions Can be used to set custom CSS/JS $out: OutputPage object -'ShowRawCssJs': When presenting raw CSS and JavaScript during page views -&$text: Text being shown +'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views +$text: Text being shown $title: Title of the custom script/stylesheet page $output: Current OutputPage object diff --git a/includes/Article.php b/includes/Article.php index d2db32b238..6be656dead 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -783,18 +783,14 @@ class Article { // Pages containing custom CSS or JavaScript get special treatment if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) { $wgOut->addHtml( wfMsgExt( 'clearyourcache', 'parse' ) ); - $text = $this->mContent; - // Give hooks a chance to do formatting... - if( wfRunHooks( 'ShowRawCssJs', array( &$text, $this->mTitle, $wgOut ) ) ) { + // Give hooks a chance to customise the output + if( wfRunHooks( 'ShowRawCssJs', array( $text, $this->mTitle, $wgOut ) ) ) { // Wrap the whole lot in a
 and don't parse
 					preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
 					$wgOut->addHtml( "
\n" );
-					$wgOut->addHtml( htmlspecialchars( $text ) );
+					$wgOut->addHtml( htmlspecialchars( $this->mContent ) );
 					$wgOut->addHtml( "\n
\n" ); - } else { - // Wrap hook output in a
with the right direction attribute - $wgOut->addHtml( "
\n{$text}\n
" ); } }