2006-05-16 22:21:14 +00:00
|
|
|
<?php
|
2006-01-07 12:31:39 +00:00
|
|
|
if ( ! defined( 'MEDIAWIKI' ) )
|
2006-06-07 06:40:24 +00:00
|
|
|
die( 1 );
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2004-09-14 20:57:54 +00:00
|
|
|
/**
|
|
|
|
|
* Image gallery
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2004-09-30 21:36:12 +00:00
|
|
|
* Add images to the gallery using add(), then render that list to HTML using toHTML().
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Media
|
2004-09-14 20:57:54 +00:00
|
|
|
*/
|
|
|
|
|
class ImageGallery
|
|
|
|
|
{
|
2004-11-13 10:53:46 +00:00
|
|
|
var $mImages, $mShowBytes, $mShowFilename;
|
2006-06-24 00:12:34 +00:00
|
|
|
var $mCaption = false;
|
2006-11-08 07:12:03 +00:00
|
|
|
var $mSkin = false;
|
2007-05-31 16:01:26 +00:00
|
|
|
var $mRevisionId = 0;
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2006-05-16 19:15:58 +00:00
|
|
|
/**
|
2007-08-22 13:40:22 +00:00
|
|
|
* Hide blacklisted images?
|
2006-05-16 19:15:58 +00:00
|
|
|
*/
|
2007-08-22 13:40:22 +00:00
|
|
|
var $mHideBadImages;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Registered parser object for output callbacks
|
|
|
|
|
*/
|
|
|
|
|
var $mParser;
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2007-01-20 22:34:05 +00:00
|
|
|
/**
|
|
|
|
|
* Contextual title, used when images are being screened
|
|
|
|
|
* against the bad image list
|
|
|
|
|
*/
|
|
|
|
|
private $contextTitle = false;
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2007-07-13 17:25:06 +00:00
|
|
|
private $mAttribs = array();
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2006-01-07 13:09:30 +00:00
|
|
|
/**
|
2004-09-30 21:36:12 +00:00
|
|
|
* Create a new image gallery object.
|
|
|
|
|
*/
|
2007-01-20 13:34:31 +00:00
|
|
|
function __construct( ) {
|
2010-03-13 11:42:04 +00:00
|
|
|
global $wgGalleryOptions;
|
2004-11-13 10:53:46 +00:00
|
|
|
$this->mImages = array();
|
2010-03-13 11:42:04 +00:00
|
|
|
$this->mShowBytes = $wgGalleryOptions['showBytes'];
|
2004-11-13 10:53:46 +00:00
|
|
|
$this->mShowFilename = true;
|
2007-08-22 13:40:22 +00:00
|
|
|
$this->mParser = false;
|
|
|
|
|
$this->mHideBadImages = false;
|
2010-03-13 11:42:04 +00:00
|
|
|
$this->mPerRow = $wgGalleryOptions['imagesPerRow'];
|
|
|
|
|
$this->mWidths = $wgGalleryOptions['imageWidth'];
|
|
|
|
|
$this->mHeights = $wgGalleryOptions['imageHeight'];
|
|
|
|
|
$this->mCaptionLength = $wgGalleryOptions['captionLength'];
|
2006-05-16 19:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2007-08-22 13:40:22 +00:00
|
|
|
* Register a parser object
|
2006-05-16 19:15:58 +00:00
|
|
|
*/
|
2007-08-22 13:40:22 +00:00
|
|
|
function setParser( $parser ) {
|
|
|
|
|
$this->mParser = $parser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set bad image flag
|
|
|
|
|
*/
|
|
|
|
|
function setHideBadImages( $flag = true ) {
|
|
|
|
|
$this->mHideBadImages = $flag;
|
2004-09-14 20:57:54 +00:00
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2006-06-24 00:12:34 +00:00
|
|
|
/**
|
2007-01-04 19:47:11 +00:00
|
|
|
* Set the caption (as plain text)
|
2006-06-24 00:12:34 +00:00
|
|
|
*
|
|
|
|
|
* @param $caption Caption
|
|
|
|
|
*/
|
|
|
|
|
function setCaption( $caption ) {
|
2007-01-04 19:47:11 +00:00
|
|
|
$this->mCaption = htmlspecialchars( $caption );
|
|
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2007-01-04 19:47:11 +00:00
|
|
|
/**
|
|
|
|
|
* Set the caption (as HTML)
|
|
|
|
|
*
|
|
|
|
|
* @param $caption Caption
|
|
|
|
|
*/
|
2007-02-02 03:32:03 +00:00
|
|
|
public function setCaptionHtml( $caption ) {
|
2006-06-24 00:12:34 +00:00
|
|
|
$this->mCaption = $caption;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-02 03:32:03 +00:00
|
|
|
/**
|
|
|
|
|
* Set how many images will be displayed per row.
|
|
|
|
|
*
|
2010-03-01 21:36:57 +00:00
|
|
|
* @param $num Integer > 0; invalid numbers will be rejected
|
2007-02-02 03:32:03 +00:00
|
|
|
*/
|
|
|
|
|
public function setPerRow( $num ) {
|
|
|
|
|
if ($num > 0) {
|
|
|
|
|
$this->mPerRow = (int)$num;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set how wide each image will be, in pixels.
|
|
|
|
|
*
|
2010-03-01 21:36:57 +00:00
|
|
|
* @param $num Integer > 0; invalid numbers will be ignored
|
2007-02-02 03:32:03 +00:00
|
|
|
*/
|
|
|
|
|
public function setWidths( $num ) {
|
|
|
|
|
if ($num > 0) {
|
|
|
|
|
$this->mWidths = (int)$num;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set how high each image will be, in pixels.
|
|
|
|
|
*
|
2010-03-01 21:36:57 +00:00
|
|
|
* @param $num Integer > 0; invalid numbers will be ignored
|
2007-02-02 03:32:03 +00:00
|
|
|
*/
|
|
|
|
|
public function setHeights( $num ) {
|
|
|
|
|
if ($num > 0) {
|
|
|
|
|
$this->mHeights = (int)$num;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-08 07:12:03 +00:00
|
|
|
/**
|
|
|
|
|
* Instruct the class to use a specific skin for rendering
|
|
|
|
|
*
|
|
|
|
|
* @param $skin Skin object
|
|
|
|
|
*/
|
|
|
|
|
function useSkin( $skin ) {
|
2007-01-22 23:50:42 +00:00
|
|
|
$this->mSkin = $skin;
|
2006-11-08 07:12:03 +00:00
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2006-11-08 07:12:03 +00:00
|
|
|
/**
|
|
|
|
|
* Return the skin that should be used
|
|
|
|
|
*
|
|
|
|
|
* @return Skin object
|
|
|
|
|
*/
|
|
|
|
|
function getSkin() {
|
|
|
|
|
if( !$this->mSkin ) {
|
|
|
|
|
global $wgUser;
|
2007-01-22 23:50:42 +00:00
|
|
|
$skin = $wgUser->getSkin();
|
2006-11-08 07:12:03 +00:00
|
|
|
} else {
|
2007-01-22 23:50:42 +00:00
|
|
|
$skin = $this->mSkin;
|
2006-11-08 07:12:03 +00:00
|
|
|
}
|
|
|
|
|
return $skin;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-30 21:36:12 +00:00
|
|
|
/**
|
2005-01-05 22:07:44 +00:00
|
|
|
* Add an image to the gallery.
|
2004-09-30 21:36:12 +00:00
|
|
|
*
|
2007-05-30 21:02:32 +00:00
|
|
|
* @param $title Title object of the image that is added to the gallery
|
2006-04-19 15:46:24 +00:00
|
|
|
* @param $html String: additional HTML text to be shown. The name and size of the image are always shown.
|
2004-09-30 21:36:12 +00:00
|
|
|
*/
|
2007-05-30 21:02:32 +00:00
|
|
|
function add( $title, $html='' ) {
|
|
|
|
|
if ( $title instanceof File ) {
|
|
|
|
|
// Old calling convention
|
|
|
|
|
$title = $title->getTitle();
|
|
|
|
|
}
|
|
|
|
|
$this->mImages[] = array( $title, $html );
|
|
|
|
|
wfDebug( "ImageGallery::add " . $title->getText() . "\n" );
|
2004-09-14 20:57:54 +00:00
|
|
|
}
|
2005-01-05 22:07:44 +00:00
|
|
|
|
2004-12-21 03:26:43 +00:00
|
|
|
/**
|
2005-01-05 22:07:44 +00:00
|
|
|
* Add an image at the beginning of the gallery.
|
|
|
|
|
*
|
2007-05-30 21:02:32 +00:00
|
|
|
* @param $title Title object of the image that is added to the gallery
|
2006-04-19 15:46:24 +00:00
|
|
|
* @param $html String: Additional HTML text to be shown. The name and size of the image are always shown.
|
2005-01-05 22:07:44 +00:00
|
|
|
*/
|
2007-05-30 21:02:32 +00:00
|
|
|
function insert( $title, $html='' ) {
|
2007-06-15 15:02:44 +00:00
|
|
|
if ( $title instanceof File ) {
|
|
|
|
|
// Old calling convention
|
|
|
|
|
$title = $title->getTitle();
|
|
|
|
|
}
|
2007-05-30 21:02:32 +00:00
|
|
|
array_unshift( $this->mImages, array( &$title, $html ) );
|
2004-12-21 03:26:43 +00:00
|
|
|
}
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2005-01-05 22:07:44 +00:00
|
|
|
|
2004-09-30 21:36:12 +00:00
|
|
|
/**
|
2005-04-16 04:33:34 +00:00
|
|
|
* isEmpty() returns true if the gallery contains no images
|
2004-09-30 21:36:12 +00:00
|
|
|
*/
|
|
|
|
|
function isEmpty() {
|
|
|
|
|
return empty( $this->mImages );
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-13 10:53:46 +00:00
|
|
|
/**
|
|
|
|
|
* Enable/Disable showing of the file size of an image in the gallery.
|
|
|
|
|
* Enabled by default.
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2006-04-19 15:46:24 +00:00
|
|
|
* @param $f Boolean: set to false to disable.
|
2004-11-13 10:53:46 +00:00
|
|
|
*/
|
|
|
|
|
function setShowBytes( $f ) {
|
2010-06-09 15:06:11 +00:00
|
|
|
$this->mShowBytes = (bool)$f;
|
2004-11-13 10:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Enable/Disable showing of the filename of an image in the gallery.
|
|
|
|
|
* Enabled by default.
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2006-04-19 15:46:24 +00:00
|
|
|
* @param $f Boolean: set to false to disable.
|
2004-11-13 10:53:46 +00:00
|
|
|
*/
|
|
|
|
|
function setShowFilename( $f ) {
|
2010-06-09 15:06:11 +00:00
|
|
|
$this->mShowFilename = (bool)$f;
|
2004-11-13 10:53:46 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-07-13 17:25:06 +00:00
|
|
|
/**
|
|
|
|
|
* Set arbitrary attributes to go on the HTML gallery output element.
|
|
|
|
|
* Should be suitable for a <table> element.
|
2008-04-14 07:45:50 +00:00
|
|
|
*
|
2007-07-13 17:25:06 +00:00
|
|
|
* Note -- if taking from user input, you should probably run through
|
|
|
|
|
* Sanitizer::validateAttributes() first.
|
|
|
|
|
*
|
2010-03-01 21:36:57 +00:00
|
|
|
* @param $attribs Array of HTML attribute pairs
|
2007-07-13 17:25:06 +00:00
|
|
|
*/
|
|
|
|
|
function setAttributes( $attribs ) {
|
|
|
|
|
$this->mAttribs = $attribs;
|
|
|
|
|
}
|
2004-11-13 10:53:46 +00:00
|
|
|
|
2004-09-30 21:36:12 +00:00
|
|
|
/**
|
|
|
|
|
* Return a HTML representation of the image gallery
|
2006-01-07 13:09:30 +00:00
|
|
|
*
|
2004-09-30 21:36:12 +00:00
|
|
|
* For each image in the gallery, display
|
|
|
|
|
* - a thumbnail
|
|
|
|
|
* - the image name
|
|
|
|
|
* - the additional text provided when adding the image
|
|
|
|
|
* - the size of the image
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-09-14 20:57:54 +00:00
|
|
|
function toHTML() {
|
2007-04-20 12:31:36 +00:00
|
|
|
global $wgLang;
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2006-11-08 07:12:03 +00:00
|
|
|
$sk = $this->getSkin();
|
|
|
|
|
|
2007-07-13 17:25:06 +00:00
|
|
|
$attribs = Sanitizer::mergeAttributes(
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'gallery',
|
|
|
|
|
'cellspacing' => '0',
|
|
|
|
|
'cellpadding' => '0' ),
|
|
|
|
|
$this->mAttribs );
|
|
|
|
|
$s = Xml::openElement( 'table', $attribs );
|
2006-06-24 00:12:34 +00:00
|
|
|
if( $this->mCaption )
|
2007-02-02 03:32:03 +00:00
|
|
|
$s .= "\n\t<caption>{$this->mCaption}</caption>";
|
|
|
|
|
|
2008-03-03 02:17:28 +00:00
|
|
|
$params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
|
2004-09-14 20:57:54 +00:00
|
|
|
$i = 0;
|
|
|
|
|
foreach ( $this->mImages as $pair ) {
|
2007-05-30 21:02:32 +00:00
|
|
|
$nt = $pair[0];
|
2009-07-15 04:18:16 +00:00
|
|
|
$text = $pair[1]; # "text" means "caption" here
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-05-31 16:01:26 +00:00
|
|
|
# Give extensions a chance to select the file revision for us
|
2008-05-19 18:55:48 +00:00
|
|
|
$time = $descQuery = false;
|
|
|
|
|
wfRunHooks( 'BeforeGalleryFindFile', array( &$this, &$nt, &$time, &$descQuery ) );
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2010-11-10 09:16:28 +00:00
|
|
|
if ( $nt->getNamespace() == NS_FILE ) {
|
|
|
|
|
$img = wfFindFile( $nt, array( 'time' => $time ) );
|
|
|
|
|
} else {
|
|
|
|
|
$img = false;
|
|
|
|
|
}
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2010-11-10 09:16:28 +00:00
|
|
|
if( !$img ) {
|
2006-06-29 23:27:13 +00:00
|
|
|
# We're dealing with a non-image, spit out the name and be done with it.
|
2007-02-02 03:32:03 +00:00
|
|
|
$thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">'
|
|
|
|
|
. htmlspecialchars( $nt->getText() ) . '</div>';
|
2007-08-22 13:40:22 +00:00
|
|
|
} elseif( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
|
2006-06-29 23:27:13 +00:00
|
|
|
# The image is blacklisted, just show it as a text link.
|
2009-06-06 17:00:20 +00:00
|
|
|
$thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">' .
|
|
|
|
|
$sk->link(
|
|
|
|
|
$nt,
|
|
|
|
|
htmlspecialchars( $nt->getText() ),
|
2009-06-06 17:05:48 +00:00
|
|
|
array(),
|
2009-06-06 17:00:20 +00:00
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
) .
|
|
|
|
|
'</div>';
|
2007-04-20 12:31:36 +00:00
|
|
|
} elseif( !( $thumb = $img->transform( $params ) ) ) {
|
2006-06-29 23:27:13 +00:00
|
|
|
# Error generating thumbnail.
|
2007-02-02 03:32:03 +00:00
|
|
|
$thumbhtml = "\n\t\t\t".'<div style="height: '.($this->mHeights*1.25+2).'px;">'
|
2006-06-29 23:27:13 +00:00
|
|
|
. htmlspecialchars( $img->getLastError() ) . '</div>';
|
2007-01-20 22:34:05 +00:00
|
|
|
} else {
|
2007-02-02 03:32:03 +00:00
|
|
|
$vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
|
2009-07-15 04:18:16 +00:00
|
|
|
|
|
|
|
|
$imageParameters = array(
|
|
|
|
|
'desc-link' => true,
|
|
|
|
|
'desc-query' => $descQuery
|
|
|
|
|
);
|
|
|
|
|
# In the absence of a caption, fall back on providing screen readers with the filename as alt text
|
|
|
|
|
if ( $text == '' ) {
|
|
|
|
|
$imageParameters['alt'] = $nt->getText();
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-08-31 02:51:23 +00:00
|
|
|
$thumbhtml = "\n\t\t\t".
|
|
|
|
|
'<div class="thumb" style="padding: ' . $vpad . 'px 0; width: ' .($this->mWidths+30).'px;">'
|
|
|
|
|
# Auto-margin centering for block-level elements. Needed now that we have video
|
|
|
|
|
# handlers since they may emit block-level elements as opposed to simple <img> tags.
|
|
|
|
|
# ref http://css-discuss.incutio.com/?page=CenteringBlockElement
|
|
|
|
|
. '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
|
2009-07-15 04:18:16 +00:00
|
|
|
. $thumb->toHtml( $imageParameters ) . '</div></div>';
|
2007-08-22 13:40:22 +00:00
|
|
|
|
|
|
|
|
// Call parser transform hook
|
|
|
|
|
if ( $this->mParser && $img->getHandler() ) {
|
|
|
|
|
$img->getHandler()->parserTransformHook( $this->mParser, $img );
|
|
|
|
|
}
|
2004-12-07 23:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-14 20:57:54 +00:00
|
|
|
//TODO
|
2009-06-06 17:00:20 +00:00
|
|
|
// $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
|
|
|
|
|
// $ul = $sk->link( $linkTarget, $ut );
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2004-12-05 19:14:31 +00:00
|
|
|
if( $this->mShowBytes ) {
|
2007-05-30 21:02:32 +00:00
|
|
|
if( $img ) {
|
2006-05-05 12:21:12 +00:00
|
|
|
$nb = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
|
|
|
|
|
$wgLang->formatNum( $img->getSize() ) );
|
2004-12-05 19:14:31 +00:00
|
|
|
} else {
|
2005-08-31 14:11:32 +00:00
|
|
|
$nb = wfMsgHtml( 'filemissing' );
|
2004-12-05 19:14:31 +00:00
|
|
|
}
|
2005-08-31 14:11:32 +00:00
|
|
|
$nb = "$nb<br />\n";
|
2004-12-05 19:14:31 +00:00
|
|
|
} else {
|
|
|
|
|
$nb = '';
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2004-11-13 10:53:46 +00:00
|
|
|
$textlink = $this->mShowFilename ?
|
2009-06-06 17:00:20 +00:00
|
|
|
$sk->link(
|
|
|
|
|
$nt,
|
2010-03-13 11:42:04 +00:00
|
|
|
htmlspecialchars( $wgLang->truncate( $nt->getText(), $this->mCaptionLength ) ),
|
2009-06-06 17:00:20 +00:00
|
|
|
array(),
|
|
|
|
|
array(),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
) . "<br />\n" :
|
2004-11-13 10:53:46 +00:00
|
|
|
'' ;
|
2004-09-14 20:57:54 +00:00
|
|
|
|
2006-06-29 23:27:13 +00:00
|
|
|
# ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
|
|
|
|
|
# in version 4.8.6 generated crackpot html in its absence, see:
|
|
|
|
|
# http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
|
|
|
|
|
|
2007-02-02 03:32:03 +00:00
|
|
|
if ( $i % $this->mPerRow == 0 ) {
|
|
|
|
|
$s .= "\n\t<tr>";
|
|
|
|
|
}
|
|
|
|
|
$s .=
|
2007-09-13 08:31:14 +00:00
|
|
|
"\n\t\t" . '<td><div class="gallerybox" style="width: '.($this->mWidths+35).'px;">'
|
2007-02-02 03:32:03 +00:00
|
|
|
. $thumbhtml
|
|
|
|
|
. "\n\t\t\t" . '<div class="gallerytext">' . "\n"
|
|
|
|
|
. $textlink . $text . $nb
|
|
|
|
|
. "\n\t\t\t</div>"
|
|
|
|
|
. "\n\t\t</div></td>";
|
|
|
|
|
if ( $i % $this->mPerRow == $this->mPerRow - 1 ) {
|
|
|
|
|
$s .= "\n\t</tr>";
|
|
|
|
|
}
|
|
|
|
|
++$i;
|
2004-09-14 20:57:54 +00:00
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
if( $i % $this->mPerRow != 0 ) {
|
|
|
|
|
$s .= "\n\t</tr>";
|
2004-12-01 16:45:26 +00:00
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
$s .= "\n</table>";
|
2004-09-14 20:57:54 +00:00
|
|
|
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
2007-02-02 03:32:03 +00:00
|
|
|
|
2006-11-24 06:41:02 +00:00
|
|
|
/**
|
2010-03-01 21:36:57 +00:00
|
|
|
* @return Integer: number of images in the gallery
|
2006-11-24 06:41:02 +00:00
|
|
|
*/
|
|
|
|
|
public function count() {
|
|
|
|
|
return count( $this->mImages );
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-01-20 22:34:05 +00:00
|
|
|
/**
|
|
|
|
|
* Set the contextual title
|
|
|
|
|
*
|
2010-03-01 21:36:57 +00:00
|
|
|
* @param $title Title: contextual title
|
2007-01-20 22:34:05 +00:00
|
|
|
*/
|
|
|
|
|
public function setContextTitle( $title ) {
|
|
|
|
|
$this->contextTitle = $title;
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-01-20 22:34:05 +00:00
|
|
|
/**
|
|
|
|
|
* Get the contextual title, if applicable
|
|
|
|
|
*
|
|
|
|
|
* @return mixed Title or false
|
|
|
|
|
*/
|
|
|
|
|
public function getContextTitle() {
|
|
|
|
|
return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title
|
|
|
|
|
? $this->contextTitle
|
|
|
|
|
: false;
|
|
|
|
|
}
|
2004-09-14 20:57:54 +00:00
|
|
|
|
|
|
|
|
} //class
|