100 $mode = $galleryOptions[
'mode'];
105 if ( isset( self::$modeMapping[$mode] ) ) {
106 $class = self::$modeMapping[$mode];
107 return new $class( $mode,
$context );
109 throw new MWException(
"No gallery class registered for mode $mode" );
114 if ( self::$modeMapping ===
false ) {
115 self::$modeMapping = [
116 'traditional' =>
'TraditionalImageGallery',
117 'nolines' =>
'NolinesImageGallery',
118 'packed' =>
'PackedImageGallery',
119 'packed-hover' =>
'PackedHoverImageGallery',
120 'packed-overlay' =>
'PackedOverlayImageGallery',
121 'slideshow' =>
'SlideshowImageGallery',
124 Hooks::run(
'GalleryGetModes', [ &self::$modeMapping ] );
141 $galleryOptions = $this->
getConfig()->get(
'GalleryOptions' );
143 $this->mShowBytes = $galleryOptions[
'showBytes'];
144 $this->mShowDimensions = $galleryOptions[
'showDimensions'];
145 $this->mShowFilename =
true;
146 $this->mParser =
false;
147 $this->mHideBadImages =
false;
148 $this->mPerRow = $galleryOptions[
'imagesPerRow'];
149 $this->mWidths = $galleryOptions[
'imageWidth'];
150 $this->mHeights = $galleryOptions[
'imageHeight'];
151 $this->mCaptionLength = $galleryOptions[
'captionLength'];
152 $this->mMode = $mode;
174 $this->mHideBadImages = $flag;
183 $this->mCaption = htmlspecialchars( $caption );
192 $this->mCaption = $caption;
203 $this->mPerRow = (int)$num;
214 $this->mWidths = (int)$num;
225 $this->mHeights = (int)$num;
249 function add( $title,
$html =
'', $alt =
'',
$link =
'', $handlerOpts = [] ) {
273 array_unshift( $this->mImages, [ &
$title,
$html, $alt,
$link, $handlerOpts ] );
289 return empty( $this->mImages );
299 $this->mShowDimensions = (bool)$f;
309 $this->mShowBytes = (bool)$f;
319 $this->mShowFilename = (bool)$f;
346 return count( $this->mImages );
355 $this->contextTitle =
$title;
364 return is_object( $this->contextTitle ) && $this->contextTitle instanceof
Title
365 ? $this->contextTitle
374 return $this->mParser
375 ? $this->mParser->getTargetLanguage()
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
getConfig()
Get the Config object.
getLanguage()
Get the Language object.
setContext(IContextSource $context)
Set the IContextSource object.
Implements some public methods and some protected utility functions which are required by multiple ch...
setShowDimensions( $f)
Enable/Disable showing of the dimensions of an image in the gallery.
bool string $mCaption
Gallery caption.
setHeights( $num)
Set how high each image will be, in pixels.
bool $mShowDimensions
Whether to show the dimensions in categories.
__construct( $mode='traditional', IContextSource $context=null)
Create a new image gallery object.
isEmpty()
isEmpty() returns true if the gallery contains no images
setAttributes( $attribs)
Set arbitrary attributes to go on the HTML gallery output element.
bool $mHideBadImages
Hide blacklisted images?
setCaption( $caption)
Set the caption (as plain text)
setHideBadImages( $flag=true)
Set bad image flag.
Parser $mParser
Registered parser object for output callbacks.
setCaptionHtml( $caption)
Set the caption (as HTML)
getContextTitle()
Get the contextual title, if applicable.
string $mMode
Gallery mode.
setAdditionalOptions( $options)
Allow setting additional options.
setPerRow( $num)
Set how many images will be displayed per row.
insert( $title, $html='', $alt='', $link='', $handlerOpts=[])
Add an image at the beginning of the gallery.
setContextTitle( $title)
Set the contextual title.
Title $contextTitle
Contextual title, used when images are being screened against the bad image list.
bool $mShowFilename
Whether to show the filename.
setParser( $parser)
Register a parser object.
static factory( $mode=false, IContextSource $context=null)
Get a new image gallery.
bool $mShowBytes
Whether to show the filesize in bytes in categories.
toHTML()
Display an html representation of the gallery.
setShowBytes( $f)
Enable/Disable showing of the file size of an image in the gallery.
getRenderLang()
Determines the correct language to be used for this image gallery.
setWidths( $num)
Set how wide each image will be, in pixels.
getImages()
Returns the list of images this gallery contains.
setShowFilename( $f)
Enable/Disable showing of the filename of an image in the gallery.
array $mImages
Gallery images.
add( $title, $html='', $alt='', $link='', $handlerOpts=[])
Add an image to the gallery.
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
static getMainAndWarn( $func=__METHOD__)
Get the RequestContext object associated with the main request and gives a warning to the log,...
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
when a variable name is used in a it is silently declared as a new local masking the global
the array() calling protocol came about after MediaWiki 1.4rc1.
do that in ParserLimitReportFormat instead $parser
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
namespace and then decline to actually register it file or subcat img or subcat $title
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.