img = wfFindFile( $this->mTitle ); if ( !$this->img ) { $this->img = wfLocalFile( $this->mTitle ); } $this->repo = $this->img->repo; } /** * Handler for action=render * Include body text only; none of the image extras */ function render() { global $wgOut; $wgOut->setArticleBodyOnly( true ); $wgOut->addSecondaryWikitext( $this->getContent() ); } function view() { global $wgOut, $wgShowEXIF, $wgRequest, $wgUser; $diff = $wgRequest->getVal( 'diff' ); $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); if ( $this->mTitle->getNamespace() != NS_IMAGE || ( isset( $diff ) && $diffOnly ) ) return Article::view(); if ($wgShowEXIF && $this->img->exists()) { // FIXME: bad interface, see note on MediaHandler::formatMetadata(). $formattedMetadata = $this->img->formatMetadata(); $showmeta = $formattedMetadata !== false; } else { $showmeta = false; } if ($this->img->exists()) $wgOut->addHTML($this->showTOC($showmeta)); $this->openShowImage(); # No need to display noarticletext, we use our own message, output in openShowImage() if ( $this->getID() ) { Article::view(); } else { # Just need to set the right headers $wgOut->setArticleFlag( true ); $wgOut->setRobotpolicy( 'index,follow' ); $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); $this->viewUpdates(); } # Show shared description, if needed if ( $this->mExtraDescription ) { $fol = wfMsg( 'shareddescriptionfollows' ); if( $fol != '-' && !wfEmptyMsg( 'shareddescriptionfollows', $fol ) ) { $wgOut->addWikiText( $fol ); } $wgOut->addHTML( '
' ); } $this->closeShowImage(); $this->imageHistory(); $this->imageLinks(); if ( $showmeta ) { global $wgStylePath, $wgStyleVersion; $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) ); $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) ); $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" ); $wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) ); $wgOut->addHTML( "\n" . "\n" ); } } /** * Create the TOC * * @access private * * @param bool $metadata Whether or not to show the metadata link * @return string */ function showTOC( $metadata ) { global $wgLang; $r = '' );
}
if ( $thumbnail ) {
$options = array(
'alt' => $this->img->getTitle()->getPrefixedText(),
'file-link' => true,
);
$wgOut->addHTML( ' ' .
$thumbnail->toHtml( $options ) .
$anchorclose . ' ' );
}
if ( $this->img->isMultipage() ) {
$count = $this->img->pageCount();
if ( $page > 1 ) {
$label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
$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' );
$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 = '';
}
global $wgScript;
$select = '';
$wgOut->addHTML( ' |
' . wfMsg( "nolinkstoimage" ) . "
\n" ); return; } $wgOut->addHTML( '' . wfMsg( 'linkstoimage' ) . "
\n