dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change @since and @deprecated notes to 1.22
[lhc/web/wiklou.git]
/
includes
/
ImageGallery.php
diff --git
a/includes/ImageGallery.php
b/includes/ImageGallery.php
index
037093a
..
43cf7f6
100644
(file)
--- a/
includes/ImageGallery.php
+++ b/
includes/ImageGallery.php
@@
-93,7
+93,7
@@
class ImageGallery {
/**
* Set the caption (as plain text)
*
/**
* Set the caption (as plain text)
*
- * @param
$caption string
Caption
+ * @param
string $caption
Caption
*/
function setCaption( $caption ) {
$this->mCaption = htmlspecialchars( $caption );
*/
function setCaption( $caption ) {
$this->mCaption = htmlspecialchars( $caption );
@@
-102,7
+102,7
@@
class ImageGallery {
/**
* Set the caption (as HTML)
*
/**
* Set the caption (as HTML)
*
- * @param
$caption String:
Caption
+ * @param
string $caption
Caption
*/
public function setCaptionHtml( $caption ) {
$this->mCaption = $caption;
*/
public function setCaptionHtml( $caption ) {
$this->mCaption = $caption;
@@
-220,7
+220,7
@@
class ImageGallery {
* Note -- if taking from user input, you should probably run through
* Sanitizer::validateAttributes() first.
*
* Note -- if taking from user input, you should probably run through
* Sanitizer::validateAttributes() first.
*
- * @param
$attribs Array
of HTML attribute pairs
+ * @param
array $attribs
of HTML attribute pairs
*/
function setAttributes( $attribs ) {
$this->mAttribs = $attribs;
*/
function setAttributes( $attribs ) {
$this->mAttribs = $attribs;
@@
-238,8
+238,6
@@
class ImageGallery {
* @return string
*/
function toHTML() {
* @return string
*/
function toHTML() {
- global $wgLang;
-
if ( $this->mPerRow > 0 ) {
$maxwidth = $this->mPerRow * ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING + self::GB_BORDERS );
$oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : '';
if ( $this->mPerRow > 0 ) {
$maxwidth = $this->mPerRow * ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING + self::GB_BORDERS );
$oldStyle = isset( $this->mAttribs['style'] ) ? $this->mAttribs['style'] : '';
@@
-255,6
+253,7
@@
class ImageGallery {
$output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
}
$output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
}
+ $lang = $this->getLang();
$params = array(
'width' => $this->mWidths,
'height' => $this->mHeights
$params = array(
'width' => $this->mWidths,
'height' => $this->mHeights
@@
-283,11
+282,11
@@
class ImageGallery {
$img = false;
}
$img = false;
}
- if( !$img ) {
+ if
( !$img ) {
# We're dealing with a non-image, spit out the name and be done with it.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $nt->getText() ) . '</div>';
# We're dealing with a non-image, spit out the name and be done with it.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $nt->getText() ) . '</div>';
- } 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 style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">' .
Linker::link(
# The image is blacklisted, just show it as a text link.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">' .
Linker::link(
@@
-298,12
+297,12
@@
class ImageGallery {
array( 'known', 'noclasses' )
) .
'</div>';
array( 'known', 'noclasses' )
) .
'</div>';
- } elseif( !( $thumb = $img->transform( $params ) ) ) {
+ } elseif
( !( $thumb = $img->transform( $params ) ) ) {
# Error generating thumbnail.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $img->getLastError() ) . '</div>';
} else {
# Error generating thumbnail.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $img->getLastError() ) . '</div>';
} else {
- $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2;
+ $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /
2;
$imageParameters = array(
'desc-link' => true,
$imageParameters = array(
'desc-link' => true,
@@
-335,9
+334,9
@@
class ImageGallery {
// $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
// $ul = Linker::link( $linkTarget, $ut );
// $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
// $ul = Linker::link( $linkTarget, $ut );
- if( $this->mShowBytes ) {
- if( $img ) {
- $fileSize = htmlspecialchars( $
wgL
ang->formatSize( $img->getSize() ) );
+ if
( $this->mShowBytes ) {
+ if
( $img ) {
+ $fileSize = htmlspecialchars( $
l
ang->formatSize( $img->getSize() ) );
} else {
$fileSize = wfMessage( 'filemissing' )->escaped();
}
} else {
$fileSize = wfMessage( 'filemissing' )->escaped();
}
@@
-349,7
+348,7
@@
class ImageGallery {
$textlink = $this->mShowFilename ?
Linker::link(
$nt,
$textlink = $this->mShowFilename ?
Linker::link(
$nt,
- htmlspecialchars( $
wgL
ang->truncate( $nt->getText(), $this->mCaptionLength ) ),
+ htmlspecialchars( $
l
ang->truncate( $nt->getText(), $this->mCaptionLength ) ),
array(),
array(),
array( 'known', 'noclasses' )
array(),
array(),
array( 'known', 'noclasses' )
@@
-361,7
+360,7
@@
class ImageGallery {
# http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
# Weird double wrapping (the extra div inside the li) needed due to FF2 bug
# http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
# Weird double wrapping (the extra div inside the li) needed due to FF2 bug
- # Can be safely removed if FF2 falls completely out of exist
a
nce
+ # Can be safely removed if FF2 falls completely out of exist
e
nce
$output .=
"\n\t\t" . '<li class="gallerybox" style="width: ' . ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING ) . 'px">'
. '<div style="width: ' . ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING ) . 'px">'
$output .=
"\n\t\t" . '<li class="gallerybox" style="width: ' . ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING ) . 'px">'
. '<div style="width: ' . ( $this->mWidths + self::THUMB_PADDING + self::GB_PADDING ) . 'px">'
@@
-403,4
+402,15
@@
class ImageGallery {
: false;
}
: false;
}
+ /**
+ * Determines the correct language to be used for this image gallery
+ * @return Language object
+ */
+ private function getLang() {
+ global $wgLang;
+ return $this->mParser
+ ? $this->mParser->getTargetLanguage()
+ : $wgLang;
+ }
+
} //class
} //class