diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /includes/ImageGallery.php | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'includes/ImageGallery.php')
-rw-r--r-- | includes/ImageGallery.php | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 1106124a..91c3190f 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -1,6 +1,24 @@ <?php -if ( ! defined( 'MEDIAWIKI' ) ) - die( 1 ); +/** + * Image gallery. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ /** * Image gallery @@ -75,7 +93,7 @@ class ImageGallery { /** * Set the caption (as plain text) * - * @param $caption Caption + * @param $caption string Caption */ function setCaption( $caption ) { $this->mCaption = htmlspecialchars( $caption ); @@ -141,23 +159,24 @@ class ImageGallery { * @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) */ - function add( $title, $html = '', $alt = '' ) { + function add( $title, $html = '', $alt = '', $link = '') { if ( $title instanceof File ) { // Old calling convention $title = $title->getTitle(); } - $this->mImages[] = array( $title, $html, $alt ); + $this->mImages[] = array( $title, $html, $alt, $link ); wfDebug( 'ImageGallery::add ' . $title->getText() . "\n" ); } /** - * 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 - */ + * 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 + */ function insert( $title, $html = '', $alt = '' ) { if ( $title instanceof File ) { // Old calling convention @@ -168,6 +187,7 @@ class ImageGallery { /** * isEmpty() returns true if the gallery contains no images + * @return bool */ function isEmpty() { return empty( $this->mImages ); @@ -215,6 +235,7 @@ class ImageGallery { * - the additional text provided when adding the image * - the size of the image * + * @return string */ function toHTML() { global $wgLang; @@ -243,6 +264,7 @@ class ImageGallery { $nt = $pair[0]; $text = $pair[1]; # "text" means "caption" here $alt = $pair[2]; + $link = $pair[3]; $descQuery = false; if ( $nt->getNamespace() == NS_FILE ) { @@ -287,6 +309,7 @@ class ImageGallery { 'desc-link' => true, 'desc-query' => $descQuery, '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 if ( $alt == '' && $text == '' ) { @@ -316,7 +339,7 @@ class ImageGallery { if( $img ) { $fileSize = htmlspecialchars( $wgLang->formatSize( $img->getSize() ) ); } else { - $fileSize = wfMsgHtml( 'filemissing' ); + $fileSize = wfMessage( 'filemissing' )->escaped(); } $fileSize = "$fileSize<br />\n"; } else { @@ -344,9 +367,9 @@ class ImageGallery { . '<div style="width: ' . ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING ) . 'px">' . $thumbhtml . "\n\t\t\t" . '<div class="gallerytext">' . "\n" - . $textlink . $text . $fileSize + . $textlink . $text . $fileSize . "\n\t\t\t</div>" - . "\n\t\t</div></li>"; + . "\n\t\t</div></li>"; } $output .= "\n</ul>"; @@ -376,8 +399,8 @@ class ImageGallery { */ public function getContextTitle() { return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title - ? $this->contextTitle - : false; + ? $this->contextTitle + : false; } } //class |