Show no size links on image pages with errors
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 2 Feb 2013 11:29:49 +0000 (12:29 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 2 Feb 2013 11:29:49 +0000 (12:29 +0100)
This avoids useless
"Size of this preview: . Other resolutions:  |  |  | ."
on image pages.

Change-Id: Ieb2787a736ec5ae409ad17dd9919f4975f0b843e

includes/ImagePage.php

index a54bd92..3d70fa5 100644 (file)
@@ -369,12 +369,19 @@ class ImagePage extends Article {
                                                if ( $size[0] < $width_orig && $size[1] < $height_orig
                                                        && $size[0] != $width && $size[1] != $height )
                                                {
-                                                       $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] );
+                                                       $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
+                                                       if ( $sizeLink ) {
+                                                               $otherSizes[] = $sizeLink;
+                                                       }
                                                }
                                        }
-                                       $msgsmall = wfMessage( 'show-big-image-preview' )->
-                                               rawParams( $this->makeSizeLink( $params, $width, $height ) )->
-                                               parse();
+                                       $msgsmall = '';
+                                       $sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height );
+                                       if ( $sizeLinkBigImagePreview ) {
+                                               $msgsmall .= wfMessage( 'show-big-image-preview' )->
+                                                       rawParams( $sizeLinkBigImagePreview )->
+                                                       parse();
+                                       }
                                        if ( count( $otherSizes ) ) {
                                                $msgsmall .= ' ' .
                                                Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ),