http://www.mediawiki.org/wiki/Special:Code/MediaWiki/93759

Revision: 93759
Author:   catrope
Date:     2011-08-02 15:40:27 +0000 (Tue, 02 Aug 2011)
Log Message:
-----------
Introduce a hook so extensions can customize what's considered to be a CSS/JS 
page. This is needed for the Gadgets extension in the RL2 branch

Modified Paths:
--------------
    trunk/phase3/docs/hooks.txt
    trunk/phase3/includes/Title.php

Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2011-08-02 15:40:03 UTC (rev 93758)
+++ trunk/phase3/docs/hooks.txt 2011-08-02 15:40:27 UTC (rev 93759)
@@ -1743,6 +1743,10 @@
 $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

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2011-08-02 15:40:03 UTC (rev 93758)
+++ trunk/phase3/includes/Title.php     2011-08-02 15:40:27 UTC (rev 93759)
@@ -1949,8 +1949,10 @@
         * @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;
        }
 
        /**


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to