diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2014-12-27 15:41:37 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2014-12-31 11:43:28 +0100 |
commit | c1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch) | |
tree | 2b38796e738dd74cb42ecd9bfd151803108386bc /includes/gallery | |
parent | b88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff) |
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/gallery')
-rw-r--r-- | includes/gallery/ImageGalleryBase.php | 165 | ||||
-rw-r--r-- | includes/gallery/NolinesImageGallery.php | 1 | ||||
-rw-r--r-- | includes/gallery/PackedImageGallery.php | 11 | ||||
-rw-r--r-- | includes/gallery/PackedOverlayImageGallery.php | 22 | ||||
-rw-r--r-- | includes/gallery/TraditionalImageGallery.php | 114 |
5 files changed, 184 insertions, 129 deletions
diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php index f8b8c505..b0a593de 100644 --- a/includes/gallery/ImageGalleryBase.php +++ b/includes/gallery/ImageGalleryBase.php @@ -28,53 +28,89 @@ * @ingroup Media */ abstract class ImageGalleryBase extends ContextSource { - var $mImages, $mShowBytes, $mShowFilename, $mMode; - var $mCaption = false; + /** + * @var array Gallery images + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 + */ + public $mImages; + + /** + * @var bool Whether to show the filesize in bytes in categories + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 + */ + public $mShowBytes; + + /** + * @var bool Whether to show the filename. Default: true + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 + */ + public $mShowFilename; + + /** + * @var string Gallery mode. Default: traditional + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 + */ + public $mMode; + + /** + * @var bool|string Gallery caption. Default: false + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 + */ + public $mCaption = false; /** - * Hide blacklisted images? + * @var bool Hide blacklisted images? + * @deprecated since 1.23 (was declared "var") and will be removed in 1.24 */ - var $mHideBadImages; + public $mHideBadImages; /** - * Registered parser object for output callbacks - * @var Parser + * @var Parser Registered parser object for output callbacks */ - var $mParser; + public $mParser; /** - * Contextual title, used when images are being screened - * against the bad image list + * @var Title Contextual title, used when images are being screened against + * the bad image list */ protected $contextTitle = false; + /** @var array */ protected $mAttribs = array(); + /** @var bool */ static private $modeMapping = false; /** * Get a new image gallery. This is the method other callers * should use to get a gallery. * - * @param String|bool $mode Mode to use. False to use the default. + * @param string|bool $mode Mode to use. False to use the default + * @param IContextSource|null $context + * @return ImageGalleryBase + * @throws MWException */ - static function factory( $mode = false ) { - global $wgGalleryOptions, $wgContLang; + static function factory( $mode = false, IContextSource $context = null ) { + global $wgContLang; self::loadModes(); + if ( !$context ) { + $context = RequestContext::getMainAndWarn( __METHOD__ ); + } if ( !$mode ) { - $mode = $wgGalleryOptions['mode']; + $galleryOpions = $context->getConfig()->get( 'GalleryOptions' ); + $mode = $galleryOpions['mode']; } $mode = $wgContLang->lc( $mode ); if ( isset( self::$modeMapping[$mode] ) ) { - return new self::$modeMapping[$mode]( $mode ); + return new self::$modeMapping[$mode]( $mode, $context ); } else { throw new MWException( "No gallery class registered for mode $mode" ); } } - static private function loadModes() { + private static function loadModes() { if ( self::$modeMapping === false ) { self::$modeMapping = array( 'traditional' => 'TraditionalImageGallery', @@ -93,18 +129,24 @@ abstract class ImageGalleryBase extends ContextSource { * * You should not call this directly, but instead use * ImageGalleryBase::factory(). + * @param string $mode + * @param IContextSource|null $context */ - function __construct( $mode = 'traditional' ) { - global $wgGalleryOptions; + function __construct( $mode = 'traditional', IContextSource $context = null ) { + if ( $context ) { + $this->setContext( $context ); + } + + $galleryOptions = $this->getConfig()->get( 'GalleryOptions' ); $this->mImages = array(); - $this->mShowBytes = $wgGalleryOptions['showBytes']; + $this->mShowBytes = $galleryOptions['showBytes']; $this->mShowFilename = true; $this->mParser = false; $this->mHideBadImages = false; - $this->mPerRow = $wgGalleryOptions['imagesPerRow']; - $this->mWidths = $wgGalleryOptions['imageWidth']; - $this->mHeights = $wgGalleryOptions['imageHeight']; - $this->mCaptionLength = $wgGalleryOptions['captionLength']; + $this->mPerRow = $galleryOptions['imagesPerRow']; + $this->mWidths = $galleryOptions['imageWidth']; + $this->mHeights = $galleryOptions['imageHeight']; + $this->mCaptionLength = $galleryOptions['captionLength']; $this->mMode = $mode; } @@ -116,7 +158,7 @@ abstract class ImageGalleryBase extends ContextSource { * @note This also triggers using the page's target * language instead of the user language. * - * @param $parser Parser + * @param Parser $parser */ function setParser( $parser ) { $this->mParser = $parser; @@ -124,6 +166,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set bad image flag + * @param bool $flag */ function setHideBadImages( $flag = true ) { $this->mHideBadImages = $flag; @@ -150,8 +193,8 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set how many images will be displayed per row. * - * @param $num Integer >= 0; If perrow=0 the gallery layout will adapt to screensize - * invalid numbers will be rejected + * @param int $num Integer >= 0; If perrow=0 the gallery layout will adapt + * to screensize invalid numbers will be rejected */ public function setPerRow( $num ) { if ( $num >= 0 ) { @@ -162,7 +205,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set how wide each image will be, in pixels. * - * @param $num Integer > 0; invalid numbers will be ignored + * @param int $num Integer > 0; invalid numbers will be ignored */ public function setWidths( $num ) { if ( $num > 0 ) { @@ -173,7 +216,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set how high each image will be, in pixels. * - * @param $num Integer > 0; invalid numbers will be ignored + * @param int $num Integer > 0; invalid numbers will be ignored */ public function setHeights( $num ) { if ( $num > 0 ) { @@ -186,29 +229,20 @@ abstract class ImageGalleryBase extends ContextSource { * to allow extensions to add additional parameters to * <gallery> parser tag. * - * @param Array $options Attributes of gallery tag. - */ - public function setAdditionalOptions( $options ) { } - - /** - * Instruct the class to use a specific skin for rendering - * - * @param $skin Skin object - * @deprecated since 1.18 Not used anymore + * @param array $options Attributes of gallery tag */ - function useSkin( $skin ) { - wfDeprecated( __METHOD__, '1.18' ); - /* no op */ + public function setAdditionalOptions( $options ) { } /** * Add an image to the gallery. * - * @param $title Title object of the image that is added to the gallery - * @param $html String: Additional HTML text to be shown. The name and size of the image are always shown. - * @param $alt String: Alt text for the image - * @param $link String: Override image link (optional) - * @param $handlerOpts Array: Array of options for image handler (aka page number) + * @param Title $title Title object of the image that is added to the gallery + * @param string $html Additional HTML text to be shown. The name and size + * of the image are always shown. + * @param string $alt Alt text for the image + * @param string $link Override image link (optional) + * @param array $handlerOpts Array of options for image handler (aka page number) */ function add( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) { if ( $title instanceof File ) { @@ -222,11 +256,12 @@ abstract class ImageGalleryBase extends ContextSource { /** * Add an image at the beginning of the gallery. * - * @param $title Title object of the image that is added to the gallery - * @param $html String: Additional HTML text to be shown. The name and size of the image are always shown. - * @param $alt String: Alt text for the image - * @param $link String: Override image link (optional) - * @param $handlerOpts Array: Array of options for image handler (aka page number) + * @param Title $title Title object of the image that is added to the gallery + * @param string $html Additional HTML text to be shown. The name and size + * of the image are always shown. + * @param string $alt Alt text for the image + * @param string $link Override image link (optional) + * @param array $handlerOpts Array of options for image handler (aka page number) */ function insert( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) { if ( $title instanceof File ) { @@ -237,6 +272,14 @@ abstract class ImageGalleryBase extends ContextSource { } /** + * Returns the list of images this gallery contains + * @return array + */ + public function getImages() { + return $this->mImages; + } + + /** * isEmpty() returns true if the gallery contains no images * @return bool */ @@ -248,7 +291,7 @@ abstract class ImageGalleryBase extends ContextSource { * Enable/Disable showing of the file size of an image in the gallery. * Enabled by default. * - * @param $f Boolean: set to false to disable. + * @param bool $f Set to false to disable */ function setShowBytes( $f ) { $this->mShowBytes = (bool)$f; @@ -258,7 +301,7 @@ abstract class ImageGalleryBase extends ContextSource { * Enable/Disable showing of the filename of an image in the gallery. * Enabled by default. * - * @param $f Boolean: set to false to disable. + * @param bool $f Set to false to disable */ function setShowFilename( $f ) { $this->mShowFilename = (bool)$f; @@ -271,7 +314,7 @@ abstract class ImageGalleryBase extends ContextSource { * Note -- if taking from user input, you should probably run through * Sanitizer::validateAttributes() first. * - * @param array $attribs of HTML attribute pairs + * @param array $attribs Array of HTML attribute pairs */ function setAttributes( $attribs ) { $this->mAttribs = $attribs; @@ -280,12 +323,12 @@ abstract class ImageGalleryBase extends ContextSource { /** * Display an html representation of the gallery * - * @return String The html + * @return string The html */ abstract public function toHTML(); /** - * @return Integer: number of images in the gallery + * @return int Number of images in the gallery */ public function count() { return count( $this->mImages ); @@ -294,7 +337,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set the contextual title * - * @param $title Title: contextual title + * @param Title $title Contextual title */ public function setContextTitle( $title ) { $this->contextTitle = $title; @@ -303,7 +346,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Get the contextual title, if applicable * - * @return mixed Title or false + * @return Title|bool Title or false */ public function getContextTitle() { return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title @@ -313,19 +356,11 @@ abstract class ImageGalleryBase extends ContextSource { /** * Determines the correct language to be used for this image gallery - * @return Language object + * @return Language */ protected function getRenderLang() { return $this->mParser ? $this->mParser->getTargetLanguage() : $this->getLanguage(); } - - /* Old constants no longer used. - const THUMB_PADDING = 30; - const GB_PADDING = 5; - const GB_BORDERS = 8; - */ - } - diff --git a/includes/gallery/NolinesImageGallery.php b/includes/gallery/NolinesImageGallery.php index 6b0d0fa6..70f5bd93 100644 --- a/includes/gallery/NolinesImageGallery.php +++ b/includes/gallery/NolinesImageGallery.php @@ -22,7 +22,6 @@ */ class NolinesImageGallery extends TraditionalImageGallery { - protected function getThumbPadding() { return 0; } diff --git a/includes/gallery/PackedImageGallery.php b/includes/gallery/PackedImageGallery.php index 963ee6b9..52a49ddb 100644 --- a/includes/gallery/PackedImageGallery.php +++ b/includes/gallery/PackedImageGallery.php @@ -21,7 +21,6 @@ */ class PackedImageGallery extends TraditionalImageGallery { - function __construct( $mode = 'traditional' ) { parent::__construct( $mode ); // Does not support per row option. @@ -49,6 +48,7 @@ class PackedImageGallery extends TraditionalImageGallery { /** * @param File $img The file being transformed. May be false + * @return array */ protected function getThumbParams( $img ) { if ( $img && $img->getMediaType() === MEDIATYPE_AUDIO ) { @@ -58,6 +58,7 @@ class PackedImageGallery extends TraditionalImageGallery { // factor, so use random big number. $width = $this->mHeights * 10 + 100; } + // self::SCALE_FACTOR so the js has some room to manipulate sizes. return array( 'width' => $width * self::SCALE_FACTOR, @@ -70,14 +71,18 @@ class PackedImageGallery extends TraditionalImageGallery { if ( $thumbWidth < 60 * self::SCALE_FACTOR ) { $thumbWidth = 60 * self::SCALE_FACTOR; } + return $thumbWidth / self::SCALE_FACTOR + $this->getThumbPadding(); } /** - * @param MediaTransformOutput|bool $thumb the thumbnail, or false if no thumb (which can happen) + * @param MediaTransformOutput|bool $thumb The thumbnail, or false if no + * thumb (which can happen) + * @return float */ protected function getGBWidth( $thumb ) { $thumbWidth = $thumb ? $thumb->getWidth() : $this->mWidths * self::SCALE_FACTOR; + return $this->getThumbDivWidth( $thumbWidth ) + $this->getGBPadding(); } @@ -90,6 +95,7 @@ class PackedImageGallery extends TraditionalImageGallery { /** * Add javascript which auto-justifies the rows by manipulating the image sizes. * Also ensures that the hover version of this degrades gracefully. + * @return array */ protected function getModules() { return array( 'mediawiki.page.gallery' ); @@ -98,6 +104,7 @@ class PackedImageGallery extends TraditionalImageGallery { /** * Do not support per-row on packed. It really doesn't work * since the images have varying widths. + * @param int $num */ public function setPerRow( $num ) { return; diff --git a/includes/gallery/PackedOverlayImageGallery.php b/includes/gallery/PackedOverlayImageGallery.php index bba06fcf..01360d05 100644 --- a/includes/gallery/PackedOverlayImageGallery.php +++ b/includes/gallery/PackedOverlayImageGallery.php @@ -22,12 +22,13 @@ */ class PackedOverlayImageGallery extends PackedImageGallery { - /** * Add the wrapper html around the thumb's caption * - * @param String $galleryText The caption - * @param MediaTransformOutput|boolean $thumb The thumb this caption is for or false for bad image. + * @param string $galleryText The caption + * @param MediaTransformOutput|bool $thumb The thumb this caption is for + * or false for bad image. + * @return string */ protected function wrapGalleryText( $galleryText, $thumb ) { @@ -37,17 +38,19 @@ class PackedOverlayImageGallery extends PackedImageGallery { return ''; } - # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which - # in version 4.8.6 generated crackpot html in its absence, see: - # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar + # ATTENTION: The newline after <div class="gallerytext"> is needed to + # accommodate htmltidy which in version 4.8.6 generated crackpot HTML + # in its absence, see: http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 + # -Ævar $thumbWidth = $this->getGBWidth( $thumb ) - $this->getThumbPadding() - $this->getGBPadding(); $captionWidth = ceil( $thumbWidth - 20 ); $outerWrapper = '<div class="gallerytextwrapper" style="width: ' . $captionWidth . 'px">'; + return "\n\t\t\t" . $outerWrapper . '<div class="gallerytext">' . "\n" - . $galleryText - . "\n\t\t\t</div>"; + . $galleryText + . "\n\t\t\t</div></div>"; } } @@ -57,4 +60,5 @@ class PackedOverlayImageGallery extends PackedImageGallery { * falls back to PackedHoverGallery. Degrades gracefully for * screen readers. */ -class PackedHoverImageGallery extends PackedOverlayImageGallery { } +class PackedHoverImageGallery extends PackedOverlayImageGallery { +} diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php index 1f60fa69..37f2221f 100644 --- a/includes/gallery/TraditionalImageGallery.php +++ b/includes/gallery/TraditionalImageGallery.php @@ -21,8 +21,6 @@ */ class TraditionalImageGallery extends ImageGalleryBase { - - /** * Return a HTML representation of the image gallery * @@ -38,8 +36,10 @@ class TraditionalImageGallery extends ImageGalleryBase { if ( $this->mPerRow > 0 ) { $maxwidth = $this->mPerRow * ( $this->mWidths + $this->getAllPadding() ); $oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : ''; - # _width is ignored by any sane browser. IE6 doesn't know max-width so it uses _width instead - $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle; + # _width is ignored by any sane browser. IE6 doesn't know max-width + # so it uses _width instead + $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . + $oldStyle; } $attribs = Sanitizer::mergeAttributes( @@ -60,6 +60,7 @@ class TraditionalImageGallery extends ImageGalleryBase { $lang = $this->getRenderLang(); # Output each image... foreach ( $this->mImages as $pair ) { + /** @var Title $nt */ $nt = $pair[0]; $text = $pair[1]; # "text" means "caption" here $alt = $pair[2]; @@ -90,28 +91,31 @@ class TraditionalImageGallery extends ImageGalleryBase { if ( !$img ) { # We're dealing with a non-image, spit out the name and be done with it. - $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' + $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' + . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' . htmlspecialchars( $nt->getText() ) . '</div>'; if ( $this->mParser instanceof Parser ) { $this->mParser->addTrackingCategory( 'broken-file-category' ); } - } elseif ( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) { + } elseif ( $this->mHideBadImages + && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) + ) { # The image is blacklisted, just show it as a text link. - $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' . - Linker::link( + $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . + ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' . + Linker::linkKnown( $nt, - htmlspecialchars( $nt->getText() ), - array(), - array(), - array( 'known', 'noclasses' ) + htmlspecialchars( $nt->getText() ) ) . '</div>'; } elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) { # Error generating thumbnail. - $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' + $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' + . ( $this->getThumbPadding() + $this->mHeights ) . 'px;">' . htmlspecialchars( $img->getLastError() ) . '</div>'; } else { + /** @var MediaTransformOutput $thumb */ $vpad = $this->getVPad( $this->mHeights, $thumb->getHeight() ); $imageParameters = array( @@ -120,7 +124,9 @@ class TraditionalImageGallery extends ImageGalleryBase { 'alt' => $alt, 'custom-url-link' => $link ); - # In the absence of both alt text and caption, fall back on providing screen readers with the filename as alt text + + // In the absence of both alt text and caption, fall back on + // providing screen readers with the filename as alt text if ( $alt == '' && $text == '' ) { $imageParameters['alt'] = $nt->getText(); } @@ -128,22 +134,27 @@ class TraditionalImageGallery extends ImageGalleryBase { $this->adjustImageParameters( $thumb, $imageParameters ); # Set both fixed width and min-height. - $thumbhtml = "\n\t\t\t" . - '<div class="thumb" style="width: ' . $this->getThumbDivWidth( $thumb->getWidth() ) . 'px;">' - # Auto-margin centering for block-level elements. Needed now that we have video - # handlers since they may emit block-level elements as opposed to simple <img> tags. - # ref http://css-discuss.incutio.com/?page=CenteringBlockElement + $thumbhtml = "\n\t\t\t" + . '<div class="thumb" style="width: ' + . $this->getThumbDivWidth( $thumb->getWidth() ) . 'px;">' + # Auto-margin centering for block-level elements. Needed + # now that we have video handlers since they may emit block- + # level elements as opposed to simple <img> tags. ref + # http://css-discuss.incutio.com/?page=CenteringBlockElement . '<div style="margin:' . $vpad . 'px auto;">' . $thumb->toHtml( $imageParameters ) . '</div></div>'; // Call parser transform hook - if ( $this->mParser && $img->getHandler() ) { - $img->getHandler()->parserTransformHook( $this->mParser, $img ); + /** @var MediaHandler $handler */ + $handler = $img->getHandler(); + if ( $this->mParser && $handler ) { + $handler->parserTransformHook( $this->mParser, $img ); } } - //TODO - // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" ); + // @todo Code is incomplete. + // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . + // ":{$ut}" ); // $ul = Linker::link( $linkTarget, $ut ); if ( $this->mShowBytes ) { @@ -158,48 +169,46 @@ class TraditionalImageGallery extends ImageGalleryBase { } $textlink = $this->mShowFilename ? - Linker::link( + Linker::linkKnown( $nt, - htmlspecialchars( $lang->truncate( $nt->getText(), $this->mCaptionLength ) ), - array(), - array(), - array( 'known', 'noclasses' ) + htmlspecialchars( $lang->truncate( $nt->getText(), $this->mCaptionLength ) ) ) . "<br />\n" : ''; - $galleryText = $textlink . $text . $fileSize; $galleryText = $this->wrapGalleryText( $galleryText, $thumb ); # Weird double wrapping (the extra div inside the li) needed due to FF2 bug # Can be safely removed if FF2 falls completely out of existence - $output .= - "\n\t\t" . '<li class="gallerybox" style="width: ' . $this->getGBWidth( $thumb ) . 'px">' - . '<div style="width: ' . $this->getGBWidth( $thumb ) . 'px">' - . $thumbhtml - . $galleryText - . "\n\t\t</div></li>"; + $output .= "\n\t\t" . '<li class="gallerybox" style="width: ' + . $this->getGBWidth( $thumb ) . 'px">' + . '<div style="width: ' . $this->getGBWidth( $thumb ) . 'px">' + . $thumbhtml + . $galleryText + . "\n\t\t</div></li>"; } $output .= "\n</ul>"; return $output; } - /** * Add the wrapper html around the thumb's caption * - * @param String $galleryText The caption - * @param MediaTransformOutput|boolean $thumb The thumb this caption is for or false for bad image. + * @param string $galleryText The caption + * @param MediaTransformOutput|bool $thumb The thumb this caption is for + * or false for bad image. + * @return string */ protected function wrapGalleryText( $galleryText, $thumb ) { - # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which - # in version 4.8.6 generated crackpot html in its absence, see: - # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar + # ATTENTION: The newline after <div class="gallerytext"> is needed to + # accommodate htmltidy which in version 4.8.6 generated crackpot html in + # its absence, see: http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 + # -Ævar return "\n\t\t\t" . '<div class="gallerytext">' . "\n" - . $galleryText - . "\n\t\t\t</div>"; + . $galleryText + . "\n\t\t\t</div>"; } /** @@ -213,7 +222,6 @@ class TraditionalImageGallery extends ImageGalleryBase { } /** - * * @note GB stands for gallerybox (as in the <li class="gallerybox"> element) * * @return int @@ -236,7 +244,7 @@ class TraditionalImageGallery extends ImageGalleryBase { /** * Get total padding. * - * @return int How many pixels of whitespace surround the thumbnail. + * @return int Number of pixels of whitespace surrounding the thumbnail. */ protected function getAllPadding() { return $this->getThumbPadding() + $this->getGBPadding() + $this->getGBBorders(); @@ -249,7 +257,7 @@ class TraditionalImageGallery extends ImageGalleryBase { * * @param int $boxHeight How high we want the box to be. * @param int $thumbHeight How high the thumbnail is. - * @return int How many vertical padding to add on each side. + * @return int Vertical padding to add on each side. */ protected function getVPad( $boxHeight, $thumbHeight ) { return ( $this->getThumbPadding() + $boxHeight - $thumbHeight ) / 2; @@ -259,6 +267,7 @@ class TraditionalImageGallery extends ImageGalleryBase { * Get the transform parameters for a thumbnail. * * @param File $img The file in question. May be false for invalid image + * @return array */ protected function getThumbParams( $img ) { return array( @@ -285,8 +294,8 @@ class TraditionalImageGallery extends ImageGalleryBase { * plus padding on gallerybox. * * @note Important: parameter will be false if no thumb used. - * @param Mixed $thumb MediaTransformObject object or false. - * @return int width of gallerybox element + * @param MediaTransformOutput|bool $thumb MediaTransformObject object or false. + * @return int Width of gallerybox element */ protected function getGBWidth( $thumb ) { return $this->mWidths + $this->getThumbPadding() + $this->getGBPadding(); @@ -297,7 +306,7 @@ class TraditionalImageGallery extends ImageGalleryBase { * * Primarily intended for subclasses. * - * @return Array modules to include + * @return array Modules to include */ protected function getModules() { return array(); @@ -308,9 +317,10 @@ class TraditionalImageGallery extends ImageGalleryBase { * * Used by a subclass to insert extra high resolution images. * @param MediaTransformOutput $thumb The thumbnail - * @param Array $imageParameters Array of options + * @param array $imageParameters Array of options */ - protected function adjustImageParameters( $thumb, &$imageParameters ) { } + protected function adjustImageParameters( $thumb, &$imageParameters ) { + } } /** @@ -318,7 +328,7 @@ class TraditionalImageGallery extends ImageGalleryBase { * if called the old way, for extensions that may expect traditional * mode. * - * @deprecated 1.22 Use ImageGalleryBase::factory instead. + * @deprecated since 1.22 Use ImageGalleryBase::factory instead. */ class ImageGallery extends TraditionalImageGallery { function __construct( $mode = 'traditional' ) { |