X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=49650545d6e5152db5535d652295db82a44a6f74;hb=4d39b368b76ec3521d6e739574aa71d5de84f857;hp=ecf4f894e11e91f797d7b5234aa839df448227a4;hpb=fe1d13368540b6d7d919e659565243d94d6c278c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ImagePage.php b/includes/ImagePage.php index ecf4f894e1..49650545d6 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -327,7 +327,8 @@ class ImagePage extends Article { $height_orig = $this->displayImg->getHeight( $page ); $height = $height_orig; - $longDesc = wfMessage( 'parentheses', $this->displayImg->getLongDesc() )->text(); + $filename = wfEscapeWikiText( $this->displayImg->getName() ); + $linktext = $filename; wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) ); @@ -351,7 +352,7 @@ class ImagePage extends Article { # Note that $height <= $maxHeight now, but might not be identical # because of rounding. } - $msgbig = wfMessage( 'show-big-image' )->escaped(); + $linktext = wfMessage( 'show-big-image' )->escaped(); if ( $this->displayImg->getRepo()->canTransformVia404() ) { $thumbSizes = $wgImageLimits; } else { @@ -397,7 +398,6 @@ class ImagePage extends Article { $params['height'] = $height; $thumbnail = $this->displayImg->transform( $params ); - $showLink = true; $anchorclose = Html::rawElement( 'div', array( 'class' => 'mw-filepage-resolutioninfo' ), $msgsmall ); $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1; @@ -471,48 +471,39 @@ class ImagePage extends Article { "
$thumb1\n$thumb2
" ); } - } else { + } elseif ( $this->displayImg->isSafeFile() ) { # if direct link is allowed but it's not a renderable image, show an icon. - if ( $this->displayImg->isSafeFile() ) { - $icon = $this->displayImg->iconThumb(); - - $out->addHTML( '\n" ); - } + $icon = $this->displayImg->iconThumb(); - $showLink = true; + $out->addHTML( '\n" ); } - if ( $showLink ) { - $filename = wfEscapeWikiText( $this->displayImg->getName() ); - $linktext = $filename; - if ( isset( $msgbig ) ) { - $linktext = wfEscapeWikiText( $msgbig ); - } - $medialink = "[[Media:$filename|$linktext]]"; - - if ( !$this->displayImg->isSafeFile() ) { - $warning = wfMessage( 'mediawarning' )->plain(); - // dirmark is needed here to separate the file name, which - // most likely ends in Latin characters, from the description, - // which may begin with the file type. In RTL environment - // this will get messy. - // The dirmark, however, must not be immediately adjacent - // to the filename, because it can get copied with it. - // See bug 25277. - $out->addWikiText( <<displayImg->getLongDesc() )->text(); + + $medialink = "[[Media:$filename|$linktext]]"; + + if ( !$this->displayImg->isSafeFile() ) { + $warning = wfMessage( 'mediawarning' )->plain(); + // dirmark is needed here to separate the file name, which + // most likely ends in Latin characters, from the description, + // which may begin with the file type. In RTL environment + // this will get messy. + // The dirmark, however, must not be immediately adjacent + // to the filename, because it can get copied with it. + // See bug 25277. + $out->addWikiText( <<{$medialink} $dirmark$longDesc
$warning
EOT - ); - } else { - $out->addWikiText( <<addWikiText( <<{$medialink} {$dirmark}$longDesc EOT - ); - } + ); } // Add cannot animate thumbnail warning @@ -614,7 +605,7 @@ EOT /* Add canonical to head if there is no local page for this shared file */ if( $descUrl && $this->mPage->getID() == 0 ) { - $out->addLink( array( 'rel' => 'canonical', 'href' => $descUrl ) ); + $out->setCanonicalUrl( $descUrl ); } $wrap = "
\n$1\n
\n"; @@ -796,9 +787,14 @@ EOT $link = Linker::linkKnown( Title::makeTitle( $element->page_namespace, $element->page_title ) ); if ( !isset( $redirects[$element->page_title] ) ) { + # No redirects $liContents = $link; + } elseif ( count( $redirects[$element->page_title] ) === 0 ) { + # Redirect without usages + $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams( $link, '' )->parse(); } else { - $ul = "
    \n"; + # Redirect with usages + $li = ''; foreach ( $redirects[$element->page_title] as $row ) { $currentCount++; if ( $currentCount > $limit ) { @@ -806,13 +802,18 @@ EOT } $link2 = Linker::linkKnown( Title::makeTitle( $row->page_namespace, $row->page_title ) ); - $ul .= Html::rawElement( + $li .= Html::rawElement( 'li', array( 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ), $link2 ) . "\n"; } - $ul .= '
'; + + $ul = Html::rawElement( + 'ul', + array( 'class' => 'mw-imagepage-redirectstofile'), + $li + ) . "\n"; $liContents = wfMessage( 'linkstoimage-redirect' )->rawParams( $link, $ul )->parse(); } @@ -1225,7 +1226,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { * @param ImagePage $imagePage */ function __construct( $imagePage ) { - parent::__construct(); + parent::__construct( $imagePage->getContext() ); $this->mImagePage = $imagePage; $this->mTitle = clone ( $imagePage->getTitle() ); $this->mTitle->setFragment( '#filehistory' );