Introduce a hook so extensions can customize what's considered to be a CSS/JS page...
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 2 Aug 2011 15:40:27 +0000 (15:40 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 2 Aug 2011 15:40:27 +0000 (15:40 +0000)
docs/hooks.txt
includes/Title.php

index c74dbd8..7e4eb0a 100644 (file)
@@ -1743,6 +1743,10 @@ $res: database result used to create the object
 $title: The title in question.
 &$types: The types of protection available.
 
+'TitleIsCssOrJsPage': Called when determining if a page is a CSS or JS page
+$title: Title object that is being checked
+$result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of Title::isCssOrJsPage()
+
 'TitleMoveComplete': after moving an article (title)
 $old: old title
 $nt: new title
index 3eae960..ca0838a 100644 (file)
@@ -1949,8 +1949,10 @@ class Title {
         * @return Bool
         */
        public function isCssOrJsPage() {
-               return $this->mNamespace == NS_MEDIAWIKI
+               $retval = $this->mNamespace == NS_MEDIAWIKI
                        && preg_match( '!\.(?:css|js)$!u', $this->mTextform ) > 0;
+               wfRunHooks( 'TitleIsCssOrJsPage', array( $this, &$retval ) );
+               return $retval;
        }
 
        /**