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
// 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 <pre> and don't parse
preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
$wgOut->addHtml( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
- $wgOut->addHtml( htmlspecialchars( $text ) );
+ $wgOut->addHtml( htmlspecialchars( $this->mContent ) );
$wgOut->addHtml( "\n</pre>\n" );
- } else {
- // Wrap hook output in a <div> with the right direction attribute
- $wgOut->addHtml( "<div dir=\"ltr\">\n{$text}\n</div>" );
}
}