* (bug 10196) Add classes and dir="ltr" to the <pre>s on user CSS and JS pages (new...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 10 Jun 2007 16:36:09 +0000 (16:36 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 10 Jun 2007 16:36:09 +0000 (16:36 +0000)
* Prettied up a regex slightly

RELEASE-NOTES
includes/Article.php

index 5fa0f16..23550ff 100644 (file)
@@ -74,6 +74,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   a path to the AdminSettings.php file
 * (bug 8781) Remind users to check file permissions for LocalSettings.php
   post-installation
+* (bug 10196) Add classes and dir="ltr" to the <pre>s on user CSS and JS pages
+  (new classes: mw-user-css, mw-user-js)
 
 == Bugfixes since 1.10 ==
 
index ebf3c64..6e7f779 100644 (file)
@@ -781,10 +781,10 @@ class Article {
                        # XXX: use $this->mTitle->usCssJsSubpage() when php is fixed/ a workaround is found
                        if (
                                $ns == NS_USER &&
-                               preg_match('/\\/[\\w]+\\.(?:css|js)$/', $this->mTitle->getDBkey())
+                               preg_match('!/[\w]+\.(css|js)$!', $this->mTitle->getDBkey(), $matches)
                        ) {
                                $wgOut->addWikiText( wfMsg('clearyourcache'));
-                               $wgOut->addHTML( '<pre>'.htmlspecialchars($this->mContent)."\n</pre>" );
+                               $wgOut->addHTML( "<pre class=\"mw-user-{$matches[1]}\" dir=\"ltr\">".htmlspecialchars($this->mContent)."\n</pre>" );
                        } else if ( $rt = Title::newFromRedirect( $text ) ) {
                                # Display redirect
                                $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';