ImageGallery Class Reference

Image gallery. More...

List of all members.

Public Member Functions

 __construct ()
 Create a new image gallery object.
 setParser ($parser)
 Register a parser object.
 setHideBadImages ($flag=true)
 Set bad image flag.
 setCaption ($caption)
 Set the caption (as plain text).
 setCaptionHtml ($caption)
 Set the caption (as HTML).
 setPerRow ($num)
 Set how many images will be displayed per row.
 setWidths ($num)
 Set how wide each image will be, in pixels.
 setHeights ($num)
 Set how high each image will be, in pixels.
 useSkin ($skin)
 Instruct the class to use a specific skin for rendering.
 getSkin ()
 Return the skin that should be used.
 add ($title, $html='')
 Add an image to the gallery.
 insert ($title, $html='')
 Add an image at the beginning of the gallery.
 isEmpty ()
 isEmpty() returns true if the gallery contains no images
 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.
 setAttributes ($attribs)
 Set arbitrary attributes to go on the HTML gallery output element.
 toHTML ()
 Return a HTML representation of the image gallery.
 count ()
 setContextTitle ($title)
 Set the contextual title.
 getContextTitle ()
 Get the contextual title, if applicable.

Public Attributes

 $mImages
 $mShowBytes
 $mShowFilename
 $mCaption = false
 $mSkin = false
 $mRevisionId = 0
 $mHideBadImages
 Hide blacklisted images?
 $mParser
 Registered parser object for output callbacks.

Private Attributes

 $contextTitle = false
 Contextual title, used when images are being screened against the bad image list.
 $mPerRow = 4
 $mWidths = 120
 $mHeights = 120
 $mAttribs = array()


Detailed Description

Image gallery.

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

Definition at line 12 of file ImageGallery.php.


Constructor & Destructor Documentation

ImageGallery::__construct (  ) 

Create a new image gallery object.

Definition at line 43 of file ImageGallery.php.


Member Function Documentation

ImageGallery::add ( title,
html = '' 
)

Add an image to the gallery.

Parameters:
$title Title object of the image that is added to the gallery
$html String: additional HTML text to be shown. The name and size of the image are always shown.

Definition at line 146 of file ImageGallery.php.

References $title, and wfDebug().

ImageGallery::count (  ) 

Returns:
int Number of images in the gallery

Definition at line 325 of file ImageGallery.php.

ImageGallery::getContextTitle (  ) 

Get the contextual title, if applicable.

Returns:
mixed Title or false

Definition at line 343 of file ImageGallery.php.

Referenced by toHTML().

ImageGallery::getSkin (  ) 

Return the skin that should be used.

Returns:
Skin object

Definition at line 130 of file ImageGallery.php.

References $wgUser.

Referenced by toHTML().

ImageGallery::insert ( title,
html = '' 
)

Add an image at the beginning of the gallery.

Parameters:
$title Title object of the image that is added to the gallery
$html String: Additional HTML text to be shown. The name and size of the image are always shown.

Definition at line 161 of file ImageGallery.php.

References $title.

ImageGallery::isEmpty (  ) 

isEmpty() returns true if the gallery contains no images

Definition at line 173 of file ImageGallery.php.

ImageGallery::setAttributes ( attribs  ) 

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

Should be suitable for a <table> element.

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

Parameters:
array of HTML attribute pairs

Definition at line 206 of file ImageGallery.php.

ImageGallery::setCaption ( caption  ) 

Set the caption (as plain text).

Parameters:
$caption Caption

Definition at line 70 of file ImageGallery.php.

ImageGallery::setCaptionHtml ( caption  ) 

Set the caption (as HTML).

Parameters:
$caption Caption

Definition at line 79 of file ImageGallery.php.

ImageGallery::setContextTitle ( title  ) 

Set the contextual title.

Parameters:
Title $title Contextual title

Definition at line 334 of file ImageGallery.php.

References $title.

ImageGallery::setHeights ( num  ) 

Set how high each image will be, in pixels.

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

Definition at line 110 of file ImageGallery.php.

ImageGallery::setHideBadImages ( flag = true  ) 

Set bad image flag.

Definition at line 61 of file ImageGallery.php.

ImageGallery::setParser ( parser  ) 

Register a parser object.

Definition at line 54 of file ImageGallery.php.

ImageGallery::setPerRow ( num  ) 

Set how many images will be displayed per row.

Parameters:
int $num > 0; invalid numbers will be rejected

Definition at line 88 of file ImageGallery.php.

ImageGallery::setShowBytes ( f  ) 

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

Enabled by default.

Parameters:
$f Boolean: set to false to disable.

Definition at line 183 of file ImageGallery.php.

ImageGallery::setShowFilename ( f  ) 

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

Enabled by default.

Parameters:
$f Boolean: set to false to disable.

Definition at line 193 of file ImageGallery.php.

ImageGallery::setWidths ( num  ) 

Set how wide each image will be, in pixels.

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

Definition at line 99 of file ImageGallery.php.

ImageGallery::toHTML (  ) 

Return a HTML representation of the image gallery.

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

Definition at line 220 of file ImageGallery.php.

References $i, $s, $text, $wgLang, getContextTitle(), getSkin(), Sanitizer::mergeAttributes(), Xml::openElement(), wfFindFile(), wfIsBadImage(), wfMsgExt(), wfMsgHtml(), and wfRunHooks().

ImageGallery::useSkin ( skin  ) 

Instruct the class to use a specific skin for rendering.

Parameters:
$skin Skin object

Definition at line 121 of file ImageGallery.php.


Member Data Documentation

ImageGallery::$contextTitle = false [private]

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

Definition at line 33 of file ImageGallery.php.

ImageGallery::$mAttribs = array() [private]

Definition at line 38 of file ImageGallery.php.

ImageGallery::$mCaption = false

Definition at line 15 of file ImageGallery.php.

ImageGallery::$mHeights = 120 [private]

Definition at line 36 of file ImageGallery.php.

ImageGallery::$mHideBadImages

Hide blacklisted images?

Definition at line 22 of file ImageGallery.php.

ImageGallery::$mImages

Definition at line 14 of file ImageGallery.php.

ImageGallery::$mParser

Registered parser object for output callbacks.

Definition at line 27 of file ImageGallery.php.

ImageGallery::$mPerRow = 4 [private]

Definition at line 35 of file ImageGallery.php.

ImageGallery::$mRevisionId = 0

Definition at line 17 of file ImageGallery.php.

ImageGallery::$mShowBytes

Definition at line 14 of file ImageGallery.php.

ImageGallery::$mShowFilename

Definition at line 14 of file ImageGallery.php.

ImageGallery::$mSkin = false

Definition at line 16 of file ImageGallery.php.

ImageGallery::$mWidths = 120 [private]

Definition at line 36 of file ImageGallery.php.


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

Generated on Sat Sep 5 02:08:38 2009 for MediaWiki by  doxygen 1.5.9