* (bug 5849) Remove some hard-coded references to "Wikipedia" in messages
* (bug 5967) Improvement to German localisation (de)
* (bug 5962) Update for Italian language (it)
+* Suppress images in galleries which appear on the bad image list (when rendering
+ for a wiki page; galleries in special pages and categories are unaffected)
== Compatibility ==
-<?php
+t<?php
if ( ! defined( 'MEDIAWIKI' ) )
die( -1 );
class ImageGallery
{
var $mImages, $mShowBytes, $mShowFilename;
+
+ /**
+ * Is the gallery on a wiki page (i.e. not a special page)
+ */
+ var $mParsing;
/**
* Create a new image gallery object.
$this->mImages = array();
$this->mShowBytes = true;
$this->mShowFilename = true;
+ $this->mParsing = false;
+ }
+
+ /**
+ * Set the "parse" bit so we know to hide "bad" images
+ */
+ function setParsing( $val = true ) {
+ $this->mParsing = $val;
}
/**
$name = $img->getName();
$nt = $img->getTitle();
- // Not an image. Just print the name and skip.
- if ( $nt->getNamespace() != NS_IMAGE ) {
+ # If we're dealing with a non-image, or a blacklisted image,
+ # spit out the name and be done with it
+ if( $nt->getNamespace() != NS_IMAGE
+ || ( $this->mParsing && wfIsBadImage( $nt->getDBkey() ) ) ) {
$s .=
(($i%4==0) ? "<tr>\n" : '') .
'<td><div class="gallerybox" style="height: 152px;">' .
$ig = new ImageGallery();
$ig->setShowBytes( false );
$ig->setShowFilename( false );
+ $ig->setParsing();
$lines = explode( "\n", $text );
foreach ( $lines as $line ) {