|
MediaWiki REL1_35
|
Image gallery. More...


Public Member Functions | |
| __construct ( $mode='traditional', IContextSource $context=null) | |
| Create a new image gallery object. | |
| add ( $title, $html='', $alt='', $link='', $handlerOpts=[], $loading=self::LOADING_DEFAULT) | |
| 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=[], $loading=self::LOADING_DEFAULT) | |
| 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. | |
| setShowDimensions ( $f) | |
| Enable/Disable showing of the dimensions 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. | |
Public Member Functions inherited from ContextSource | |
| canUseWikiPage () | |
| Check whether a WikiPage object can be get with getWikiPage(). | |
| exportSession () | |
| Export the resolved user IP, HTTP headers, user ID, and session ID. | |
| getConfig () | |
| getContext () | |
| Get the base IContextSource object. | |
| getLanguage () | |
| getOutput () | |
| getRequest () | |
| getSkin () | |
| getStats () | |
| getTiming () | |
| getTitle () | |
| getUser () | |
| Stable to override. | |
| getWikiPage () | |
| Get the WikiPage object. | |
| msg ( $key,... $params) | |
| Get a Message object with context set Parameters are the same as wfMessage() | |
| setContext (IContextSource $context) | |
Static Public Member Functions | |
| static | factory ( $mode=false, IContextSource $context=null) |
| Get a new image gallery. | |
Public Attributes | |
| Parser false | $mParser |
| Registered parser object for output callbacks. | |
| const | LOADING_DEFAULT = 1 |
| const | LOADING_LAZY = 2 |
Protected Member Functions | |
| getRenderLang () | |
| Determines the correct language to be used for this image gallery. | |
Protected Attributes | |
| Title null | $contextTitle = null |
| Contextual title, used when images are being screened against the bad image list. | |
| array | $mAttribs = [] |
| bool string | $mCaption = false |
| Gallery caption. | |
| bool int | $mCaptionLength = true |
| Length to truncate filename to in caption when using "showfilename". | |
| int | $mHeights |
| bool | $mHideBadImages |
| Hide blacklisted images? | |
| array[] | $mImages |
| Gallery images -var array<int,array{0:Title,1:string,2:string,3:string,4:array,5:int}> | |
| string | $mMode |
| Gallery mode. | |
| int | $mPerRow |
| bool | $mShowBytes |
| Whether to show the filesize in bytes in categories. | |
| bool | $mShowDimensions |
| Whether to show the dimensions in categories. | |
| bool | $mShowFilename |
| Whether to show the filename. | |
| int | $mWidths |
Static Private Member Functions | |
| static | loadModes () |
Static Private Attributes | |
| static array | $modeMapping |
Image gallery.
Add images to the gallery using add(), then render that list to HTML using toHTML(). Stable to extend
Definition at line 32 of file ImageGalleryBase.php.
| ImageGalleryBase::__construct | ( | $mode = 'traditional', |
|
| IContextSource | $context = null |
||
| ) |
Create a new image gallery object.
You should not call this directly, but instead use ImageGalleryBase::factory().
Stable to call
| string | $mode | |
| IContextSource | null | $context |
Reimplemented in PackedImageGallery, and SlideshowImageGallery.
Definition at line 164 of file ImageGalleryBase.php.
References ContextSource\$context, ContextSource\getConfig(), and ContextSource\setContext().
| ImageGalleryBase::add | ( | $title, | |
$html = '', |
|||
$alt = '', |
|||
$link = '', |
|||
$handlerOpts = [], |
|||
$loading = self::LOADING_DEFAULT |
|||
| ) |
Add an image to the gallery.
| Title | $title | Title object of the image that is added to the gallery |
| string | $html | Additional HTML text to be shown. The name and size of the image are always shown. |
| string | $alt | Alt text for the image |
| string | $link | Override image link (optional) |
| array | $handlerOpts | Array of options for image handler (aka page number) |
| int | $loading | Sets loading attribute of the underlying (optional) |
Definition at line 284 of file ImageGalleryBase.php.
| ImageGalleryBase::count | ( | ) |
Definition at line 396 of file ImageGalleryBase.php.
References count().
Referenced by count().
|
static |
Get a new image gallery.
This is the method other callers should use to get a gallery.
| string | bool | $mode | Mode to use. False to use the default |
| IContextSource | null | $context |
| MWException |
Definition at line 116 of file ImageGalleryBase.php.
References ContextSource\$context, and IContextSource\getConfig().
| ImageGalleryBase::getContextTitle | ( | ) |
Get the contextual title, if applicable.
Definition at line 414 of file ImageGalleryBase.php.
| ImageGalleryBase::getImages | ( | ) |
Returns the list of images this gallery contains.
Definition at line 331 of file ImageGalleryBase.php.
|
protected |
Determines the correct language to be used for this image gallery.
Definition at line 422 of file ImageGalleryBase.php.
References ContextSource\getLanguage().
Referenced by TraditionalImageGallery\toHTML().
| ImageGalleryBase::insert | ( | $title, | |
$html = '', |
|||
$alt = '', |
|||
$link = '', |
|||
$handlerOpts = [], |
|||
$loading = self::LOADING_DEFAULT |
|||
| ) |
Add an image at the beginning of the gallery.
| Title | $title | Title object of the image that is added to the gallery |
| string | $html | Additional HTML text to be shown. The name and size of the image are always shown. |
| string | $alt | Alt text for the image |
| string | $link | Override image link (optional) |
| array | $handlerOpts | Array of options for image handler (aka page number) |
| int | $loading | Sets loading attribute of the underlying (optional) |
Definition at line 311 of file ImageGalleryBase.php.
References $title.
| ImageGalleryBase::isEmpty | ( | ) |
isEmpty() returns true if the gallery contains no images
Definition at line 339 of file ImageGalleryBase.php.
|
staticprivate |
Definition at line 136 of file ImageGalleryBase.php.
| ImageGalleryBase::setAdditionalOptions | ( | $options | ) |
Allow setting additional options.
This is meant to allow extensions to add additional parameters to <gallery> parser tag.
Stable to override
| array | $options | Attributes of gallery tag |
Reimplemented in SlideshowImageGallery.
Definition at line 270 of file ImageGalleryBase.php.
| ImageGalleryBase::setAttributes | ( | $attribs | ) |
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.
| array | $attribs | Array of HTML attribute pairs |
Definition at line 382 of file ImageGalleryBase.php.
| ImageGalleryBase::setCaption | ( | $caption | ) |
Set the caption (as plain text)
| string | $caption |
Definition at line 210 of file ImageGalleryBase.php.
| ImageGalleryBase::setCaptionHtml | ( | $caption | ) |
Set the caption (as HTML)
| string | $caption |
Definition at line 219 of file ImageGalleryBase.php.
| ImageGalleryBase::setContextTitle | ( | $title | ) |
Set the contextual title.
| Title | null | $title | Contextual title |
Definition at line 405 of file ImageGalleryBase.php.
References $title.
| ImageGalleryBase::setHeights | ( | $num | ) |
Set how high each image will be, in pixels.
| string | $num | Number. Unit other than 'px is invalid. Invalid numbers and those below 0 are ignored. |
Definition at line 254 of file ImageGalleryBase.php.
| ImageGalleryBase::setHideBadImages | ( | $flag = true | ) |
| ImageGalleryBase::setParser | ( | $parser | ) |
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!
| Parser | $parser |
Definition at line 193 of file ImageGalleryBase.php.
| ImageGalleryBase::setPerRow | ( | $num | ) |
Set how many images will be displayed per row.
| int | $num | Integer >= 0; If perrow=0 the gallery layout will adapt to screensize invalid numbers will be rejected |
Reimplemented in PackedImageGallery.
Definition at line 229 of file ImageGalleryBase.php.
| ImageGalleryBase::setShowBytes | ( | $f | ) |
Enable/Disable showing of the file size of an image in the gallery.
Enabled by default.
| bool | $f | Set to false to disable |
Definition at line 359 of file ImageGalleryBase.php.
| ImageGalleryBase::setShowDimensions | ( | $f | ) |
Enable/Disable showing of the dimensions of an image in the gallery.
Enabled by default.
| bool | $f | Set to false to disable |
Definition at line 349 of file ImageGalleryBase.php.
| ImageGalleryBase::setShowFilename | ( | $f | ) |
Enable/Disable showing of the filename of an image in the gallery.
Enabled by default.
| bool | $f | Set to false to disable |
Definition at line 369 of file ImageGalleryBase.php.
| ImageGalleryBase::setWidths | ( | $num | ) |
Set how wide each image will be, in pixels.
| string | $num | Number. Unit other than 'px is invalid. Invalid numbers and those below 0 are ignored. |
Definition at line 241 of file ImageGalleryBase.php.
|
abstract |
Display an html representation of the gallery.
Reimplemented in TraditionalImageGallery.
|
protected |
Contextual title, used when images are being screened against the bad image list.
Definition at line 90 of file ImageGalleryBase.php.
|
protected |
Definition at line 93 of file ImageGalleryBase.php.
|
protected |
|
protected |
Length to truncate filename to in caption when using "showfilename".
A value of 'true' will truncate the filename to one line using CSS and will be the behaviour after deprecation.
Definition at line 74 of file ImageGalleryBase.php.
Referenced by TraditionalImageGallery\getCaptionLength().
|
protected |
Definition at line 102 of file ImageGalleryBase.php.
Referenced by TraditionalImageGallery\getThumbParams(), and TraditionalImageGallery\toHTML().
|
protected |
Hide blacklisted images?
Definition at line 79 of file ImageGalleryBase.php.
|
protected |
Gallery images -var array<int,array{0:Title,1:string,2:string,3:string,4:array,5:int}>
Definition at line 40 of file ImageGalleryBase.php.
|
protected |
|
staticprivate |
Definition at line 105 of file ImageGalleryBase.php.
| Parser false ImageGalleryBase::$mParser |
Registered parser object for output callbacks.
Definition at line 84 of file ImageGalleryBase.php.
|
protected |
Definition at line 96 of file ImageGalleryBase.php.
|
protected |
Whether to show the filesize in bytes in categories.
Definition at line 45 of file ImageGalleryBase.php.
|
protected |
Whether to show the dimensions in categories.
Definition at line 50 of file ImageGalleryBase.php.
|
protected |
|
protected |
Definition at line 99 of file ImageGalleryBase.php.
Referenced by PackedImageGallery\getThumbParams(), and TraditionalImageGallery\getThumbParams().
| const ImageGalleryBase::LOADING_DEFAULT = 1 |
Definition at line 33 of file ImageGalleryBase.php.
| const ImageGalleryBase::LOADING_LAZY = 2 |
Definition at line 34 of file ImageGalleryBase.php.
Referenced by TraditionalImageGallery\toHTML().