From 9ec190c5452bc24855a48d7bbb684b4088cb7fa5 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Mon, 2 Jul 2007 23:22:39 +0000 Subject: [PATCH] Revert r23617 per Brion --- RELEASE-NOTES | 8 ++++---- docs/hooks.txt | 7 ++++++- includes/Article.php | 15 +++++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e0a4ba4633..b5343a2ae5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -104,18 +104,18 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9250) Remove hardcoded minimum image name length of three characters * Fixed DISPLAYTITLE behaviour to reject titles which don't normalise to the same title as the current page, and enabled per default -* (bug 10196) Add classes and dir="ltr" to
s wrapping CSS and JS pages - (new classes: mw-code, mw-css, mw-js) +* Wrap site CSS and JavaScript in a
 tag, like user JS/CSS
+* (bug 10196) Add classes and dir="ltr" to the 
s on CSS and JS pages (new
+  classes: mw-code, mw-css, mw-js)
 * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over
   usergroup assignment.
 * Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information
 * (bug 10387) Detect and handle '.php5' extension environments at install time
   Patch by Edward Z. Yang.
+* Introduce 'ShowRawCssJs' hook; see docs/hooks.txt for more information
 * (bug 10404) Show rights log for the selected user in Special:Userrights
 * New javascript for upload page that will show a warning if a file with the
   "destination filename" already exists.
-* (bug 10422) Do not wrap user JS/CSS in 
; allow it to render as wikitext.
-  like site CSS/JS.
 * Add 'editsection-brackets' message to allow localization (or removal) of the
   brackets in the "[edit]" link for sections.
 * (bug 10437) Move texvc styling to shared.css.
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 6f188e931a..a74591a8f6 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -656,9 +656,14 @@ $content_actions: The array of content actions
 		     Can be used to set custom CSS/JS
 $out: OutputPage object
 
+'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
+
 'AjaxAddScript': Called in output page just before the initialisation
 of the javascript ajax engine. The hook is only called when ajax
 is enabled ( $wgUseAjax = true; ).
 
 More hooks might be available but undocumented, you can execute
-./maintenance/findhooks.php to find hidden one.
+./maintenance/findhooks.php to find hidden one.
\ No newline at end of file
diff --git a/includes/Article.php b/includes/Article.php
index 58de866a81..9f3795e749 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -784,12 +784,15 @@ class Article {
 			if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) {
 				$wgOut->addHtml( wfMsgExt( 'clearyourcache', 'parse' ) );
 
-				// Add classes, give directionality.  Do parse it as wikitext
-				// (bug 10422).
-				preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
-				$wgOut->addHtml( "
\n" ); - $wgOut->addWikiText( $this->mContent ); - $wgOut->addHtml( "\n
\n" ); + // Give hooks a chance to customise the output + if( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $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( $this->mContent ) );
+					$wgOut->addHtml( "\n
\n" ); + } + } elseif ( $rt = Title::newFromRedirect( $text ) ) { -- 2.20.1