|
MediaWiki master
|
Image gallery. More...
Inherits MediaWiki\Context\ContextSource.
Inherited by MediaWiki\Gallery\TraditionalImageGallery.

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, ?array $imageOptions=null) | |
| 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, ?array $imageOptions=null) | |
| 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) | |
| 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 MediaWiki\Context\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. | |
| getActionName () | |
| Get the action name for the current web request. | |
| getAuthority () | |
| getConfig () | |
| getContext () | |
| Get the base IContextSource object. | |
| getCsrfTokenSet () | |
| Get a repository to obtain and match CSRF tokens. | |
| getLanguage () | |
| getLanguageCode () | |
| getOutput () | |
| getRequest () | |
| getSkin () | |
| getTiming () | |
| getTitle () | |
| getUser () | |
| 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 = [] |
| string false | $mCaption = false |
| Gallery caption. | |
| bool int | $mCaptionLength = true |
| Length to truncate filename to in caption when using "showfilename". | |
| int | $mHeights |
| bool | $mHideBadImages |
| Hide bad images? | |
| array[] | $mImages |
| Gallery images. | |
| 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 |
Image gallery.
Add images to the gallery using add(), then render that list to HTML using toHTML().
Definition at line 28 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::__construct | ( | $mode = 'traditional', | |
| ?IContextSource | $context = null ) |
Create a new image gallery object.
You should not call this directly, but instead use ImageGalleryBase::factory().
| string | $mode | |
| IContextSource | null | $context |
Reimplemented in MediaWiki\Gallery\PackedImageGallery, and MediaWiki\Gallery\SlideshowImageGallery.
Definition at line 161 of file ImageGalleryBase.php.
References MediaWiki\MainConfigNames\GalleryOptions, MediaWiki\Context\ContextSource\getConfig(), and MediaWiki\Context\ContextSource\setContext().
| MediaWiki\Gallery\ImageGalleryBase::add | ( | $title, | |
| $html = '', | |||
| $alt = '', | |||
| $link = '', | |||
| $handlerOpts = [], | |||
| $loading = self::LOADING_DEFAULT, | |||
| ?array | $imageOptions = null ) |
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 | null | $alt | Alt text for the image, or null to omit |
| 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) |
| ?array | $imageOptions | To supercede the $link param |
Definition at line 291 of file ImageGalleryBase.php.
References wfDebug().
| MediaWiki\Gallery\ImageGalleryBase::count | ( | ) |
Definition at line 406 of file ImageGalleryBase.php.
References MediaWiki\Gallery\ImageGalleryBase\count().
Referenced by MediaWiki\Gallery\ImageGalleryBase\count().
|
static |
Get a new image gallery.
This is the method other callers should use to get a gallery.
| string | false | $mode | Mode to use. False to use the default |
| IContextSource | null | $context |
| ImageGalleryClassNotFoundException |
Definition at line 112 of file ImageGalleryBase.php.
References MediaWiki\MainConfigNames\GalleryOptions, and MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\Category\CategoryViewer\clearCategoryState().
| MediaWiki\Gallery\ImageGalleryBase::getContextTitle | ( | ) |
Get the contextual title, if applicable.
Definition at line 424 of file ImageGalleryBase.php.
References MediaWiki\Gallery\ImageGalleryBase\$contextTitle.
| MediaWiki\Gallery\ImageGalleryBase::getImages | ( | ) |
Returns the list of images this gallery contains.
Definition at line 341 of file ImageGalleryBase.php.
References MediaWiki\Gallery\ImageGalleryBase\$mImages.
|
protected |
Determines the correct language to be used for this image gallery.
Definition at line 432 of file ImageGalleryBase.php.
References MediaWiki\Context\ContextSource\getLanguage().
Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().
| MediaWiki\Gallery\ImageGalleryBase::insert | ( | $title, | |
| $html = '', | |||
| $alt = '', | |||
| $link = '', | |||
| $handlerOpts = [], | |||
| $loading = self::LOADING_DEFAULT, | |||
| ?array | $imageOptions = null ) |
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 | null | $alt | Alt text for the image, or null to omit |
| 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) |
| ?array | $imageOptions | To supercede the $link param |
Definition at line 320 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::isEmpty | ( | ) |
isEmpty() returns true if the gallery contains no images
Definition at line 349 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::setAdditionalOptions | ( | $options | ) |
Allow setting additional options.
This is meant to allow extensions to add additional parameters to <gallery> parser tag.
| array | $options | Attributes of gallery tag |
Reimplemented in MediaWiki\Gallery\SlideshowImageGallery.
Definition at line 276 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 392 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::setCaption | ( | $caption | ) |
Set the caption (as plain text)
| string | $caption |
Definition at line 206 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::setCaptionHtml | ( | $caption | ) |
Set the caption (as HTML)
| string | $caption |
Definition at line 215 of file ImageGalleryBase.php.
| MediaWiki\Gallery\ImageGalleryBase::setContextTitle | ( | $title | ) |
Set the contextual title.
| Title | null | $title | Contextual title |
Definition at line 415 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 255 of file ImageGalleryBase.php.
References MediaWiki\Gallery\ImageGalleryBase\$mParser, MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
| MediaWiki\Gallery\ImageGalleryBase::setHideBadImages | ( | $flag = true | ) |
| bool | $flag |
Definition at line 197 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 190 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 MediaWiki\Gallery\PackedImageGallery.
Definition at line 225 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 369 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 359 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 379 of file ImageGalleryBase.php.
| MediaWiki\Gallery\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 237 of file ImageGalleryBase.php.
References MediaWiki\Gallery\ImageGalleryBase\$mParser, MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
abstract |
Display an html representation of the gallery.
Reimplemented in MediaWiki\Gallery\TraditionalImageGallery.
|
protected |
Contextual title, used when images are being screened against the bad image list.
Definition at line 86 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\ImageGalleryBase\getContextTitle().
|
protected |
Definition at line 89 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 70 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\TraditionalImageGallery\getCaptionLength().
|
protected |
Definition at line 98 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\TraditionalImageGallery\getThumbParams(), and MediaWiki\Gallery\TraditionalImageGallery\toHTML().
|
protected |
Hide bad images?
Definition at line 75 of file ImageGalleryBase.php.
|
protected |
Gallery images.
Definition at line 36 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\ImageGalleryBase\getImages().
|
protected |
| Parser false MediaWiki\Gallery\ImageGalleryBase::$mParser |
Registered parser object for output callbacks.
Definition at line 80 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\ImageGalleryBase\setHeights(), and MediaWiki\Gallery\ImageGalleryBase\setWidths().
|
protected |
Definition at line 92 of file ImageGalleryBase.php.
|
protected |
Whether to show the filesize in bytes in categories.
Definition at line 41 of file ImageGalleryBase.php.
|
protected |
Whether to show the dimensions in categories.
Definition at line 46 of file ImageGalleryBase.php.
|
protected |
|
protected |
Definition at line 95 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\PackedImageGallery\getThumbParams(), and MediaWiki\Gallery\TraditionalImageGallery\getThumbParams().
| const MediaWiki\Gallery\ImageGalleryBase::LOADING_DEFAULT = 1 |
Definition at line 29 of file ImageGalleryBase.php.
| const MediaWiki\Gallery\ImageGalleryBase::LOADING_LAZY = 2 |
Definition at line 30 of file ImageGalleryBase.php.
Referenced by MediaWiki\Gallery\TraditionalImageGallery\toHTML().