Siebrand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/97472
Change subject: Break long lines in gallery classes
......................................................................
Break long lines in gallery classes
Change-Id: I49d9618155f0edc3fbeacc7bcec6351ada3886eb
---
M includes/gallery/ImageGalleryBase.php
M includes/gallery/PackedImageGallery.php
M includes/gallery/PackedOverlayImageGallery.php
M includes/gallery/TraditionalImageGallery.php
4 files changed, 46 insertions(+), 28 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/72/97472/1
diff --git a/includes/gallery/ImageGalleryBase.php
b/includes/gallery/ImageGalleryBase.php
index 491f12d..e46916e 100644
--- a/includes/gallery/ImageGalleryBase.php
+++ b/includes/gallery/ImageGalleryBase.php
@@ -206,7 +206,8 @@
* 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 $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)
@@ -224,7 +225,8 @@
* 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 $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)
@@ -327,4 +329,3 @@
const GB_BORDERS = 8;
*/
}
-
diff --git a/includes/gallery/PackedImageGallery.php
b/includes/gallery/PackedImageGallery.php
index 1cb1fd9..2d2d0db 100644
--- a/includes/gallery/PackedImageGallery.php
+++ b/includes/gallery/PackedImageGallery.php
@@ -75,7 +75,8 @@
}
/**
- * @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)
*/
protected function getGBWidth( $thumb ) {
$thumbWidth = $thumb ? $thumb->getWidth() : $this->mWidths *
self::SCALE_FACTOR;
diff --git a/includes/gallery/PackedOverlayImageGallery.php
b/includes/gallery/PackedOverlayImageGallery.php
index ec35db2..bebc39e 100644
--- a/includes/gallery/PackedOverlayImageGallery.php
+++ b/includes/gallery/PackedOverlayImageGallery.php
@@ -26,7 +26,8 @@
* 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 MediaTransformOutput|boolean $thumb The thumb this caption is
for
+ * or false for bad image.
*/
protected function wrapGalleryText( $galleryText, $thumb ) {
@@ -36,9 +37,10 @@
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 );
diff --git a/includes/gallery/TraditionalImageGallery.php
b/includes/gallery/TraditionalImageGallery.php
index 2ee2d37..05c612b 100644
--- a/includes/gallery/TraditionalImageGallery.php
+++ b/includes/gallery/TraditionalImageGallery.php
@@ -36,8 +36,10 @@
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(
@@ -88,15 +90,19 @@
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;">' .
+ $thumbhtml = "\n\t\t\t" . '<div class="thumb"
style="height: ' .
+ ( $this->getThumbPadding() +
$this->mHeights ) . 'px;">' .
Linker::link(
$nt,
htmlspecialchars(
$nt->getText() ),
@@ -107,7 +113,8 @@
'</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 {
$vpad = $this->getVPad( $this->mHeights,
$thumb->getHeight() );
@@ -118,7 +125,9 @@
'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();
}
@@ -126,11 +135,13 @@
$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>';
@@ -140,8 +151,9 @@
}
}
- //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 ) {
@@ -170,7 +182,8 @@
# 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">'
+ $output .= "\n\t\t" . '<li class="gallerybox"
style="width: '
+ . $this->getGBWidth( $thumb ) . 'px">'
. '<div style="width: ' . $this->getGBWidth(
$thumb ) . 'px">'
. $thumbhtml
. $galleryText
@@ -185,12 +198,14 @@
* 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 MediaTransformOutput|boolean $thumb The thumb this caption is
for
+ * or false for bad image.
*/
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
@@ -208,7 +223,6 @@
}
/**
- *
* @note GB stands for gallerybox (as in the <li class="gallerybox">
element)
*
* @return int
--
To view, visit https://gerrit.wikimedia.org/r/97472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I49d9618155f0edc3fbeacc7bcec6351ada3886eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits