* Rename "searchquery" to "searchsubtitle" and support wiki text in it
* Introduce updateArticleCount maintenance script which uses a better check that
reflects what Article::isCountable() tests for
+* Introduce 'BadImage' hook; see docs/hooks.txt for more information
== Compatibility ==
'AutoAuthenticate': called to authenticate users on external/environmental means
$user: writes user object to this parameter
+'BadImage': When checking against the bad image list
+$name: Image name being checked
+&$bad: Whether or not the image is "bad"
+
+Change $bad and return false to override. If an image is "bad", it is not
+rendered inline in wiki pages or galleries in category pages.
+
'BlockIp': before an IP address or user is blocked
$block: the Block object about to be saved
$user: the user _doing_ the block (not the one being blocked)
*/\r
function wfIsBadImage( $name ) {\r
static $titleList = false;\r
- \r
- if( !$titleList ) {\r
- # Build the list now\r
- $titleList = array();\r
- $lines = explode( "\n", wfMsgForContent( 'bad_image_list' ) );\r
- foreach( $lines as $line ) {\r
- if( preg_match( '/^\*\s*\[\[:?(.*?)\]\]/i', $line, $matches ) ) {\r
- $title = Title::newFromText( $matches[1] );\r
- if( is_object( $title ) && $title->getNamespace() == NS_IMAGE )\r
- $titleList[ $title->getDBkey() ] = true;\r
+ wfProfileIn( __METHOD__ );\r
+ $bad = false;\r
+ if( wfRunHooks( 'BadImage', array( $name, &$bad ) ) {\r
+ if( !$titleList ) {\r
+ # Build the list now\r
+ $titleList = array();\r
+ $lines = explode( "\n", wfMsgForContent( 'bad_image_list' ) );\r
+ foreach( $lines as $line ) {\r
+ if( preg_match( '/^\*\s*\[\[:?(.*?)\]\]/i', $line, $matches ) ) {\r
+ $title = Title::newFromText( $matches[1] );\r
+ if( is_object( $title ) && $title->getNamespace() == NS_IMAGE )\r
+ $titleList[ $title->getDBkey() ] = true;\r
+ }\r
}\r
}\r
+ wfProfileOut( __METHOD__ );\r
+ return array_key_exists( $name, $titleList );\r
+ } else {\r
+ wfProfileOut( __METHOD__ );\r
+ return $bad;\r
}\r
- return array_key_exists( $name, $titleList );\r
}\r
\r
/**\r