r23553 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23552‎ | r23553 | r23554 >
Date:13:52, 29 June 2007
Author:robchurch
Status:old
Tags:
Comment:
Hook callbacks for 'ShowRawCssJs' should do their own output, if so desired; don't trust the text we get back from the hook.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -656,8 +656,8 @@
657657 Can be used to set custom CSS/JS
658658 $out: OutputPage object
659659
660 -'ShowRawCssJs': When presenting raw CSS and JavaScript during page views
661 -&$text: Text being shown
 660+'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views
 661+$text: Text being shown
662662 $title: Title of the custom script/stylesheet page
663663 $output: Current OutputPage object
664664
Index: trunk/phase3/includes/Article.php
@@ -783,18 +783,14 @@
784784 // Pages containing custom CSS or JavaScript get special treatment
785785 if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) {
786786 $wgOut->addHtml( wfMsgExt( 'clearyourcache', 'parse' ) );
787 - $text = $this->mContent;
788787
789 - // Give hooks a chance to do formatting...
790 - if( wfRunHooks( 'ShowRawCssJs', array( &$text, $this->mTitle, $wgOut ) ) ) {
 788+ // Give hooks a chance to customise the output
 789+ if( wfRunHooks( 'ShowRawCssJs', array( $text, $this->mTitle, $wgOut ) ) ) {
791790 // Wrap the whole lot in a <pre> and don't parse
792791 preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
793792 $wgOut->addHtml( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
794 - $wgOut->addHtml( htmlspecialchars( $text ) );
 793+ $wgOut->addHtml( htmlspecialchars( $this->mContent ) );
795794 $wgOut->addHtml( "\n</pre>\n" );
796 - } else {
797 - // Wrap hook output in a <div> with the right direction attribute
798 - $wgOut->addHtml( "<div dir=\"ltr\">\n{$text}\n</div>" );
799795 }
800796
801797 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r23554Fix r23553robchurch13:53, 29 June 2007
r23555Update for r23553, r23554robchurch13:57, 29 June 2007
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007

Status & tagging log