From: Roan Kattouw Date: Tue, 2 Aug 2011 15:40:27 +0000 (+0000) Subject: Introduce a hook so extensions can customize what's considered to be a CSS/JS page... X-Git-Tag: 1.31.0-rc.0~28486 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=7ed75c87caace88a43d70b9b09918f02acf38c7d;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index c74dbd8a1f..7e4eb0a1d7 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/Title.php b/includes/Title.php index 3eae96048a..ca0838acb8 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; } /**