X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FImagePage.php;h=3265b7f386066a34d22e9b8a27d7def2c3669a32;hb=8c3b4616cdf2bcd9c8cc1264b806c47b2523f163;hp=fda8f132bfc8ead6599aed2615c1accbad767b36;hpb=64e572519fecaf495c5461e66521cf084eea8d45;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ImagePage.php b/includes/ImagePage.php index fda8f132bf..3265b7f386 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -10,12 +10,22 @@ if( !defined( 'MEDIAWIKI' ) ) /** * Special handling for image description pages + * + * @addtogroup Media */ class ImagePage extends Article { /* private */ var $img; // Image object this page is shown for var $mExtraDescription = false; + function __construct( $title ) { + parent::__construct( $title ); + $this->img = wfFindFile( $this->mTitle ); + if ( !$this->img ) { + $this->img = wfLocalFile( $this->mTitle ); + } + } + /** * Handler for action=render * Include body text only; none of the image extras @@ -29,8 +39,6 @@ class ImagePage extends Article { function view() { global $wgOut, $wgShowEXIF, $wgRequest, $wgUser; - $this->img = new Image( $this->mTitle ); - $diff = $wgRequest->getVal( 'diff' ); $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); @@ -64,7 +72,7 @@ class ImagePage extends Article { # Show shared description, if needed if ( $this->mExtraDescription ) { $fol = wfMsg( 'shareddescriptionfollows' ); - if( $fol != '-' ) { + if( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) { $wgOut->addWikiText( $fol ); } $wgOut->addHTML( '
' ); @@ -100,7 +108,7 @@ class ImagePage extends Article {' );
}
- $wgOut->addHTML( ' ' . $anchoropen .
- "img->getTitle()->getPrefixedText() ).'" />' . $anchorclose . ' ' );
+ $imgAttribs = array(
+ 'border' => 0,
+ 'alt' => $this->img->getTitle()->getPrefixedText()
+ );
+
+ if ( $thumbnail ) {
+ $wgOut->addHTML( '' .
+ $thumbnail->toHtml( $imgAttribs, $linkAttribs ) .
+ $anchorclose . ' ' );
+ }
if ( $this->img->isMultipage() ) {
$count = $this->img->pageCount();
if ( $page > 1 ) {
$label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
- $link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
- $this->img->selectPage( $page - 1 );
- $thumb1 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
+ $link = $sk->makeKnownLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
+ $thumb1 = $sk->makeThumbLinkObj( $this->mTitle, $this->img, $link, $label, 'none',
+ array( 'page' => $page - 1 ) );
} else {
$thumb1 = '';
}
if ( $page < $count ) {
$label = wfMsg( 'imgmultipagenext' );
- $this->img->selectPage( $page + 1 );
- $link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
- $thumb2 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
+ $link = $sk->makeKnownLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
+ $thumb2 = $sk->makeThumbLinkObj( $this->mTitle, $this->img, $link, $label, 'none',
+ array( 'page' => $page + 1 ) );
} else {
$thumb2 = '';
}
@@ -284,7 +305,7 @@ class ImagePage extends Article {
htmlspecialchars( wfMsg( 'imgmultigo' ) ) . '">';
$wgOut->addHTML( ' |