Go to the documentation of this file.
36 if ( $this->mPerRow > 0 ) {
37 $maxwidth = $this->mPerRow * ( $this->mWidths + $this->
getAllPadding() );
38 $oldStyle = isset( $this->mAttribs[
'style'] ) ? $this->mAttribs[
'style'] :
'';
39 # _width is ignored by any sane browser. IE6 doesn't know max-width
40 # so it uses _width instead
41 $this->mAttribs[
'style'] =
"max-width: {$maxwidth}px;_width: {$maxwidth}px;" .
46 array(
'class' =>
'gallery mw-gallery-' . $this->mMode ), $this->mAttribs );
50 if ( $this->mParser ) {
51 $this->mParser->getOutput()->addModules( $modules );
53 $this->
getOutput()->addModules( $modules );
56 if ( $this->mCaption ) {
57 $output .=
"\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
61 # Output each image...
62 foreach ( $this->mImages
as $pair ) {
65 $text = $pair[1]; #
"text" means
"caption" here
70 if ( $nt->getNamespace() ===
NS_FILE ) {
72 if ( $this->mParser instanceof Parser ) {
73 # Give extensions a chance to select the file revision for us
77 # Fetch and register the file (file title may be different via hooks)
78 list( $img, $nt ) = $this->mParser->fetchFileAndTitle( $nt,
$options );
88 $transformOptions =
$params + $pair[4];
93 # We're dealing with a non-image, spit out the name and be done with it.
94 $thumbhtml =
"\n\t\t\t" .
'<div class="thumb" style="height: '
96 . htmlspecialchars( $nt->getText() ) .
'</div>';
98 if ( $this->mParser instanceof Parser ) {
99 $this->mParser->addTrackingCategory(
'broken-file-category' );
101 } elseif ( $this->mHideBadImages
104 # The image is blacklisted, just show it as a text link.
105 $thumbhtml =
"\n\t\t\t" .
'<div class="thumb" style="height: ' .
109 htmlspecialchars( $nt->getText() )
112 } elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) {
113 # Error generating thumbnail.
114 $thumbhtml =
"\n\t\t\t" .
'<div class="thumb" style="height: '
116 . htmlspecialchars( $img->getLastError() ) .
'</div>';
119 $vpad = $this->
getVPad( $this->mHeights, $thumb->getHeight() );
121 $imageParameters =
array(
123 'desc-query' => $descQuery,
125 'custom-url-link' =>
$link
130 if ( $alt ==
'' && $text ==
'' ) {
131 $imageParameters[
'alt'] = $nt->getText();
136 # Set both fixed width and min-height.
137 $thumbhtml =
"\n\t\t\t"
138 .
'<div class="thumb" style="width: '
140 # Auto-margin centering
for block-level elements. Needed
141 # now
that we have video handlers since they may emit
block-
142 # level elements
as opposed to simple <img>
tags. ref
144 .
'<div style="margin:' . $vpad .
'px auto;">'
145 . $thumb->toHtml( $imageParameters ) .
'</div></div>';
149 $handler = $img->getHandler();
150 if ( $this->mParser && $handler ) {
151 $handler->parserTransformHook( $this->mParser, $img );
160 if ( $this->mShowBytes ) {
162 $fileSize = htmlspecialchars( $lang->formatSize( $img->getSize() ) );
164 $fileSize = $this->
msg(
'filemissing' )->escaped();
166 $fileSize =
"$fileSize<br />\n";
171 $textlink = $this->mShowFilename ?
174 htmlspecialchars( $lang->truncate( $nt->getText(), $this->mCaptionLength ) )
178 $galleryText = $textlink . $text . $fileSize;
181 # Weird double wrapping (the extra div inside the li) needed due to FF2 bug
182 # Can be safely removed if FF2 falls completely out of existence
183 $output .=
"\n\t\t" .
'<li class="gallerybox" style="width: '
185 .
'<div style="width: ' . $this->
getGBWidth( $thumb ) .
'px">'
188 .
"\n\t\t</div></li>";
204 # ATTENTION: The newline after <div class="gallerytext"> is needed to
205 # accommodate htmltidy which in version 4.8.6 generated crackpot html in
206 # its absence, see: http://bugzilla.wikimedia.org/show_bug.cgi?id=1765
209 return "\n\t\t\t" .
'<div class="gallerytext">' .
"\n"
262 protected function getVPad( $boxHeight, $thumbHeight ) {
274 'width' => $this->mWidths,
275 'height' => $this->mHeights
336 parent::__construct( $mode );
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getThumbParams( $img)
Get the transform parameters for a thumbnail.
toHTML()
Return a HTML representation of the image gallery.
static mergeAttributes( $a, $b)
Merge two sets of HTML attributes.
getContextTitle()
Get the contextual title, if applicable.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
__construct( $mode='traditional')
Create a new image gallery object.
static openElement( $element, $attribs=null)
This opens an XML element.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
getGBBorders()
Get how much extra space the borders around the image takes up.
getVPad( $boxHeight, $thumbHeight)
Get vertical padding for a thumbnail.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getOutput()
Get the OutputPage object.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
wrapGalleryText( $galleryText, $thumb)
Add the wrapper html around the thumb's caption.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getModules()
Get a list of modules to include in the page.
getGBWidth( $thumb)
Width of gallerybox .
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
wfIsBadImage( $name, $contextTitle=false, $blacklist=null)
Determine if an image exists on the 'bad image list'.
adjustImageParameters( $thumb, &$imageParameters)
Adjust the image parameters for a thumbnail.
getAllPadding()
Get total padding.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LoginAuthenticateAudit' this hook is for auditing only etc block
pre inside other HTML tags(bug 54946) !! wikitext a< div >< pre > foo</pre ></div >< pre ></pre > !! html< p >a</p >< div >< pre > foo</pre ></div >< pre ></pre > !! end !! test HTML pre followed by indent-pre !! wikitext< pre >foo</pre > bar !! html< pre >foo</pre >< pre >bar</pre > !! end !!test Block tag pre !!options parsoid !! wikitext< p >< pre >foo</pre ></p > !! html< p data-parsoid
getRenderLang()
Determines the correct language to be used for this image gallery.
getThumbPadding()
How much padding such the thumb have between image and inner div that that contains the border.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
wfFindFile( $title, $options=array())
Find a file.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if that
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
getThumbDivWidth( $thumbWidth)
Get the width of the inner div that contains the thumbnail in question.