Hook callbacks for 'ShowRawCssJs' should do their own output, if so desired; don...
authorRob Church <robchurch@users.mediawiki.org>
Fri, 29 Jun 2007 13:52:54 +0000 (13:52 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 29 Jun 2007 13:52:54 +0000 (13:52 +0000)
docs/hooks.txt
includes/Article.php

index 3716629..a74591a 100644 (file)
@@ -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
 
index d2db32b..6be656d 100644 (file)
@@ -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 <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>" );
                                }
                        
                        }