MediaWiki  REL1_24
ImageGalleryBase Class Reference

Image gallery. More...

Inheritance diagram for ImageGalleryBase:
Collaboration diagram for ImageGalleryBase:

List of all members.

Public Member Functions

 __construct ($mode= 'traditional', IContextSource $context=null)
 Create a new image gallery object.
 add ($title, $html= '', $alt= '', $link= '', $handlerOpts=array())
 Add an image to the gallery.
 count ()
 getContextTitle ()
 Get the contextual title, if applicable.
 getImages ()
 Returns the list of images this gallery contains.
 insert ($title, $html= '', $alt= '', $link= '', $handlerOpts=array())
 Add an image at the beginning of the gallery.
 isEmpty ()
 isEmpty() returns true if the gallery contains no images
 setAdditionalOptions ($options)
 Allow setting additional options.
 setAttributes ($attribs)
 Set arbitrary attributes to go on the HTML gallery output element.
 setCaption ($caption)
 Set the caption (as plain text)
 setCaptionHtml ($caption)
 Set the caption (as HTML)
 setContextTitle ($title)
 Set the contextual title.
 setHeights ($num)
 Set how high each image will be, in pixels.
 setHideBadImages ($flag=true)
 Set bad image flag.
 setParser ($parser)
 Register a parser object.
 setPerRow ($num)
 Set how many images will be displayed per row.
 setShowBytes ($f)
 Enable/Disable showing of the file size of an image in the gallery.
 setShowFilename ($f)
 Enable/Disable showing of the filename of an image in the gallery.
 setWidths ($num)
 Set how wide each image will be, in pixels.
 toHTML ()
 Display an html representation of the gallery.

Static Public Member Functions

static factory ($mode=false, IContextSource $context=null)
 Get a new image gallery.

Public Attributes

bool string $mCaption = false
 Gallery caption.
bool $mHideBadImages
 Hide blacklisted images?
array $mImages
 Gallery images.
string $mMode
 Gallery mode.
Parser $mParser
 Registered parser object for output callbacks.
bool $mShowBytes
 Whether to show the filesize in bytes in categories.
bool $mShowFilename
 Whether to show the filename.

Protected Member Functions

 getRenderLang ()
 Determines the correct language to be used for this image gallery.

Protected Attributes

Title $contextTitle = false
 Contextual title, used when images are being screened against the bad image list.
array $mAttribs = array()
 *

Static Private Member Functions

static loadModes ()

Static Private Attributes

static $modeMapping = false

Detailed Description

Image gallery.

Add images to the gallery using add(), then render that list to HTML using toHTML().

Definition at line 30 of file ImageGalleryBase.php.


Constructor & Destructor Documentation

ImageGalleryBase::__construct ( mode = 'traditional',
IContextSource context = null 
)

Create a new image gallery object.

You should not call this directly, but instead use ImageGalleryBase::factory().

Parameters:
string$mode
IContextSource | null$context

Definition at line 126 of file ImageGalleryBase.php.

References ContextSource\$context, array(), ContextSource\getConfig(), and ContextSource\setContext().


Member Function Documentation

ImageGalleryBase::add ( title,
html = '',
alt = '',
link = '',
handlerOpts = array() 
)

Add an image to the gallery.

Parameters:
Title$titleTitle object of the image that is added to the gallery
string$htmlAdditional HTML text to be shown. The name and size of the image are always shown.
string$altAlt text for the image
string$linkOverride image link (optional)
array$handlerOptsArray of options for image handler (aka page number)

Definition at line 238 of file ImageGalleryBase.php.

Returns:
int Number of images in the gallery

Definition at line 324 of file ImageGalleryBase.php.

Referenced by setContextTitle().

static ImageGalleryBase::factory ( mode = false,
IContextSource context = null 
) [static]

Get a new image gallery.

This is the method other callers should use to get a gallery.

Parameters:
string | bool$modeMode to use. False to use the default
IContextSource | null$context
Returns:
ImageGalleryBase
Exceptions:
MWException

Definition at line 84 of file ImageGalleryBase.php.

Referenced by NewFilesPager\getStartBody(), and ImageQueryPage\outputResults().

Get the contextual title, if applicable.

Returns:
Title|bool Title or false

Definition at line 342 of file ImageGalleryBase.php.

References $title.

Referenced by TraditionalImageGallery\toHTML().

Returns the list of images this gallery contains.

Returns:
array

Definition at line 269 of file ImageGalleryBase.php.

Determines the correct language to be used for this image gallery.

Returns:
Language

Definition at line 352 of file ImageGalleryBase.php.

Referenced by TraditionalImageGallery\toHTML().

ImageGalleryBase::insert ( title,
html = '',
alt = '',
link = '',
handlerOpts = array() 
)

Add an image at the beginning of the gallery.

Parameters:
Title$titleTitle object of the image that is added to the gallery
string$htmlAdditional HTML text to be shown. The name and size of the image are always shown.
string$altAlt text for the image
string$linkOverride image link (optional)
array$handlerOptsArray of options for image handler (aka page number)

Definition at line 257 of file ImageGalleryBase.php.

isEmpty() returns true if the gallery contains no images

Returns:
bool

Definition at line 277 of file ImageGalleryBase.php.

static ImageGalleryBase::loadModes ( ) [static, private]

Definition at line 104 of file ImageGalleryBase.php.

References ContextSource\$context.

Allow setting additional options.

This is meant to allow extensions to add additional parameters to <gallery> parser tag.

Parameters:
array$optionsAttributes of gallery tag

Definition at line 225 of file ImageGalleryBase.php.

Set arbitrary attributes to go on the HTML gallery output element.

Should be suitable for a

.

Note -- if taking from user input, you should probably run through Sanitizer::validateAttributes() first.

Parameters:
array$attribsArray of HTML attribute pairs

Definition at line 310 of file ImageGalleryBase.php.

Set the caption (as plain text)

Parameters:
string$captionCaption

Definition at line 171 of file ImageGalleryBase.php.

Set the caption (as HTML)

Parameters:
string$captionCaption

Definition at line 180 of file ImageGalleryBase.php.

Set the contextual title.

Parameters:
Title$titleContextual title

Definition at line 333 of file ImageGalleryBase.php.

References count().

Set how high each image will be, in pixels.

Parameters:
int$numInteger > 0; invalid numbers will be ignored

Definition at line 212 of file ImageGalleryBase.php.

Set bad image flag.

Parameters:
bool$flag

Definition at line 162 of file ImageGalleryBase.php.

Register a parser object.

If you do not set this and the output of this gallery ends up in parser cache, the javascript will break!

Note:
This also triggers using the page's target language instead of the user language.
Parameters:
Parser$parser

Definition at line 154 of file ImageGalleryBase.php.

Set how many images will be displayed per row.

Parameters:
int$numInteger >= 0; If perrow=0 the gallery layout will adapt to screensize invalid numbers will be rejected

Reimplemented in PackedImageGallery.

Definition at line 190 of file ImageGalleryBase.php.

Enable/Disable showing of the file size of an image in the gallery.

Enabled by default.

Parameters:
bool$fSet to false to disable

Definition at line 287 of file ImageGalleryBase.php.

Enable/Disable showing of the filename of an image in the gallery.

Enabled by default.

Parameters:
bool$fSet to false to disable

Definition at line 297 of file ImageGalleryBase.php.

Set how wide each image will be, in pixels.

Parameters:
int$numInteger > 0; invalid numbers will be ignored

Definition at line 201 of file ImageGalleryBase.php.

ImageGalleryBase::toHTML ( ) [abstract]

Display an html representation of the gallery.

Returns:
string The html

Reimplemented in TraditionalImageGallery.


Member Data Documentation

Title ImageGalleryBase::$contextTitle = false [protected]

Contextual title, used when images are being screened against the bad image list.

Definition at line 68 of file ImageGalleryBase.php.

array ImageGalleryBase::$mAttribs = array() [protected]

*

Definition at line 70 of file ImageGalleryBase.php.

bool string ImageGalleryBase::$mCaption = false

Gallery caption.

Default: false

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 54 of file ImageGalleryBase.php.

bool ImageGalleryBase::$mHideBadImages

Hide blacklisted images?

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 59 of file ImageGalleryBase.php.

array ImageGalleryBase::$mImages

Gallery images.

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 34 of file ImageGalleryBase.php.

string ImageGalleryBase::$mMode

Gallery mode.

Default: traditional

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 49 of file ImageGalleryBase.php.

ImageGalleryBase::$modeMapping = false [static, private]

Definition at line 73 of file ImageGalleryBase.php.

Parser ImageGalleryBase::$mParser

Registered parser object for output callbacks.

Definition at line 63 of file ImageGalleryBase.php.

bool ImageGalleryBase::$mShowBytes

Whether to show the filesize in bytes in categories.

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 39 of file ImageGalleryBase.php.

bool ImageGalleryBase::$mShowFilename

Whether to show the filename.

Default: true

Deprecated:
since 1.23 (was declared "var") and will be removed in 1.24

Definition at line 44 of file ImageGalleryBase.php.


The documentation for this class was generated from the following file: