if ( $this->mPage->getID() ) {
# NS_FILE is in the user language, but this section (the actual wikitext)
# should be in page content language
- $pageLang = $this->getTitle()->getPageLanguage();
+ $pageLang = $this->getTitle()->getPageViewLanguage();
$out->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content',
'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(),
'class' => 'mw-content-'.$pageLang->getDir() ) ) );
$out->addHTML( Xml::element( 'h2',
array( 'id' => 'filelinks' ),
- wfMsg( 'imagelinks' ) ) . "\n" );
+ wfMessage( 'imagelinks' )->text() ) . "\n" );
$this->imageDupes();
# @todo FIXME: For some freaky reason, we can't redirect to foreign images.
# Yet we return metadata about the target. Definitely an issue in the FileRepo
}
if ( $showmeta ) {
- $out->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ) . "\n" );
+ $out->addHTML( Xml::element(
+ 'h2',
+ array( 'id' => 'metadata' ),
+ wfMessage( 'metadata' )->text() ) . "\n" );
$out->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
$out->addModules( array( 'mediawiki.action.view.metadata' ) );
}
*/
protected function showTOC( $metadata ) {
$r = array(
- '<li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>',
- '<li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>',
- '<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>',
+ '<li><a href="#file">' . wfMessage( 'file-anchor-link' )->escaped() . '</a></li>',
+ '<li><a href="#filehistory">' . wfMessage( 'filehist' )->escaped() . '</a></li>',
+ '<li><a href="#filelinks">' . wfMessage( 'imagelinks' )->escaped() . '</a></li>',
);
if ( $metadata ) {
- $r[] = '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>';
+ $r[] = '<li><a href="#metadata">' . wfMessage( 'metadata' )->escaped() . '</a></li>';
}
wfRunHooks( 'ImagePageShowTOC', array( $this, &$r ) );
*/
protected function makeMetadataTable( $metadata ) {
$r = "<div class=\"mw-imagepage-section-metadata\">";
- $r .= wfMsgNoTrans( 'metadata-help' );
+ $r .= wfMessage( 'metadata-help' )->plain();
$r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n";
foreach ( $metadata as $type => $stuff ) {
foreach ( $stuff as $v ) {
$height_orig = $this->displayImg->getHeight( $page );
$height = $height_orig;
- $longDesc = wfMsg( 'parentheses', $this->displayImg->getLongDesc() );
+ $longDesc = wfMessage( 'parentheses', $this->displayImg->getLongDesc() )->text();
wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$out ) );
# image
# "Download high res version" link below the image
- # $msgsize = wfMsgHtml( 'file-info-size', $width_orig, $height_orig, Linker::formatSize( $this->displayImg->getSize() ), $mime );
+ # $msgsize = wfMessage( 'file-info-size', $width_orig, $height_orig, Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
# We'll show a thumbnail of this image
if ( $width > $maxWidth || $height > $maxHeight ) {
# Calculate the thumbnail size.
# Note that $height <= $maxHeight now, but might not be identical
# because of rounding.
}
- $msgbig = wfMsgHtml( 'show-big-image' );
+ $msgbig = wfMessage( 'show-big-image' )->escaped();
if ( $this->displayImg->getRepo()->canTransformVia404() ) {
$thumbSizes = $wgImageLimits;
} else {
# Some sort of audio file that doesn't have dimensions
# Don't output a no hi res message for such a file
$msgsmall = '';
+ } elseif ( $this->displayImg->isVectorized() ) {
+ # For vectorized images, full size is just the frame size
+ $msgsmall = '';
} else {
# Image is small enough to show full size on image page
$msgsmall = wfMessage( 'file-nohires' )->parse();
$count = $this->displayImg->pageCount();
if ( $page > 1 ) {
- $label = $out->parse( wfMsg( 'imgmultipageprev' ), false );
+ $label = $out->parse( wfMessage( 'imgmultipageprev' )->text(), false );
$link = Linker::linkKnown(
$this->getTitle(),
$label,
}
if ( $page < $count ) {
- $label = wfMsg( 'imgmultipagenext' );
+ $label = wfMessage( 'imgmultipagenext' )->text();
$link = Linker::linkKnown(
$this->getTitle(),
$label,
'</td><td><div class="multipageimagenavbox">' .
Xml::openElement( 'form', $formParams ) .
Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
- wfMsgExt( 'imgmultigoto', array( 'parseinline', 'replaceafter' ), $select ) .
- Xml::submitButton( wfMsg( 'imgmultigo' ) ) .
+ wfMessage( 'imgmultigoto' )->rawParams( $select )->parse() .
+ Xml::submitButton( wfMessage( 'imgmultigo' )->text() ) .
Xml::closeElement( 'form' ) .
"<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
);
$medialink = "[[Media:$filename|$linktext]]";
if ( !$this->displayImg->isSafeFile() ) {
- $warning = wfMsgNoTrans( 'mediawarning' );
+ $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
}
}
+ // Add cannot animate thumbnail warning
+ if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
+ // Include the extension so wiki admins can
+ // customize it on a per file-type basis
+ // (aka say things like use format X instead).
+ // additionally have a specific message for
+ // file-no-thumb-animation-gif
+ $ext = $this->displayImg->getExtension();
+ $noAnimMesg = wfMessageFallback(
+ 'file-no-thumb-animation-' . $ext,
+ 'file-no-thumb-animation'
+ )->plain();
+
+ $out->addWikiText( <<<EOT
+<div class="mw-noanimatethumb">{$noAnimMesg}</div>
+EOT
+ );
+ }
+
if ( !$this->displayImg->isLocal() ) {
$this->printSharedImageText();
}
$wrap = "<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
$repo = $this->mPage->getFile()->getRepo()->getDisplayName();
- if ( $descUrl && $descText && wfMsgNoTrans( 'sharedupload-desc-here' ) !== '-' ) {
+ if ( $descUrl && $descText && wfMessage( 'sharedupload-desc-here' )->plain() !== '-' ) {
$out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-here', $repo, $descUrl ) );
- } elseif ( $descUrl && wfMsgNoTrans( 'sharedupload-desc-there' ) !== '-' ) {
+ } elseif ( $descUrl && wfMessage( 'sharedupload-desc-there' )->plain() !== '-' ) {
$out->wrapWikiMsg( $wrap, array( 'sharedupload-desc-there', $repo, $descUrl ) );
} else {
$out->wrapWikiMsg( $wrap, array( 'sharedupload', $repo ), ''/*BACKCOMPAT*/ );
}
$out = $this->getContext()->getOutput();
- $out->addHTML( "<br /><ul>\n" );
+ $out->addHTML( "<ul>\n" );
# "Upload a new version of this file" link
- if ( UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) {
- $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
+ $canUpload = $this->getTitle()->userCan( 'upload', $this->getContext()->getUser() );
+ if ( $canUpload && UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) {
+ $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMessage( 'uploadnewversion-linktext' )->text() );
$out->addHTML( "<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n" );
+ } else {
+ $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" );
}
# External editing link
if ( $wgUseExternalEditor ) {
$elink = Linker::linkKnown(
$this->getTitle(),
- wfMsgHtml( 'edit-externally' ),
+ wfMessage( 'edit-externally' )->escaped(),
array(),
array(
'action' => 'edit',
);
$out->addHTML(
'<li id="mw-imagepage-edit-external">' . $elink . ' <small>' .
- wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) .
- "</small></li>\n"
+ wfMessage( 'edit-externally-help' )->parse() .
+ "</small></li>\n"
);
}
} else {
$link = Linker::makeExternalLink( $file->getDescriptionUrl(),
$file->getTitle()->getPrefixedText() );
- $fromSrc = wfMsg( 'shared-repo-from', $file->getRepo()->getDisplayName() );
+ $fromSrc = wfMessage( 'shared-repo-from', $file->getRepo()->getDisplayName() )->text();
}
$out->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
}