diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
commit | 222b01f5169f1c7e69762e0e8904c24f78f71882 (patch) | |
tree | 8e932e12546bb991357ec48eb1638d1770be7a35 /includes/MediaTransformOutput.php | |
parent | 00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff) |
update to MediaWiki 1.16.0
Diffstat (limited to 'includes/MediaTransformOutput.php')
-rw-r--r-- | includes/MediaTransformOutput.php | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/includes/MediaTransformOutput.php b/includes/MediaTransformOutput.php index 0367494f..a3fcc96e 100644 --- a/includes/MediaTransformOutput.php +++ b/includes/MediaTransformOutput.php @@ -80,20 +80,19 @@ abstract class MediaTransformOutput { } } - function getDescLinkAttribs( $alt = false, $params = '' ) { + function getDescLinkAttribs( $title = null, $params = '' ) { $query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : ''; if( $params ) { $query .= $query ? '&'.$params : $params; } - $title = $this->file->getTitle(); - if ( strval( $alt ) === '' ) { - $alt = $title->getText(); - } - return array( + $attribs = array( 'href' => $this->file->getTitle()->getLocalURL( $query ), 'class' => 'image', - 'title' => $alt ); + if ( $title ) { + $attribs['title'] = $title; + } + return $attribs; } } @@ -151,18 +150,22 @@ class ThumbnailImage extends MediaTransformOutput { } $alt = empty( $options['alt'] ) ? '' : $options['alt']; - # Note: if title is empty and alt is not, make the title empty, don't - # use alt; only use alt if title is not set - $title = !isset( $options['title'] ) ? $alt : $options['title']; - $query = empty($options['desc-query']) ? '' : $options['desc-query']; + + $query = empty( $options['desc-query'] ) ? '' : $options['desc-query']; if ( !empty( $options['custom-url-link'] ) ) { $linkAttribs = array( 'href' => $options['custom-url-link'] ); + if ( !empty( $options['title'] ) ) { + $linkAttribs['title'] = $options['title']; + } } elseif ( !empty( $options['custom-title-link'] ) ) { $title = $options['custom-title-link']; - $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() ); + $linkAttribs = array( + 'href' => $title->getLinkUrl(), + 'title' => empty( $options['title'] ) ? $title->getFullText() : $options['title'] + ); } elseif ( !empty( $options['desc-link'] ) ) { - $linkAttribs = $this->getDescLinkAttribs( $title, $query ); + $linkAttribs = $this->getDescLinkAttribs( empty( $options['title'] ) ? null : $options['title'], $query ); } elseif ( !empty( $options['file-link'] ) ) { $linkAttribs = array( 'href' => $this->file->getURL() ); } else { @@ -174,7 +177,6 @@ class ThumbnailImage extends MediaTransformOutput { 'src' => $this->url, 'width' => $this->width, 'height' => $this->height, - 'border' => 0, ); if ( !empty( $options['valign'] ) ) { $attribs['style'] = "vertical-align: {$options['valign']}"; |