63 $this->displayImg =
$file;
64 $this->fileLoaded =
true;
68 if ( $this->fileLoaded ) {
71 $this->fileLoaded =
true;
73 $this->displayImg = $img =
false;
75 $this->getHookRunner()->onImagePageFindFile( $this, $img, $this->displayImg );
77 $services = MediaWikiServices::getInstance();
78 $img = $services->getRepoGroup()->findFile( $this->
getTitle() );
80 $img = $services->getRepoGroup()->getLocalRepo()->newFile( $this->
getTitle() );
83 $this->
getPage()->setFile( $img );
84 if ( !$this->displayImg ) {
85 $this->displayImg = $img;
87 $this->repo = $img->getRepo();
94 if ( $this->viewIsRenderAction ) {
101 $diff = $request->getVal(
'diff' );
102 $diffOnly = $request->getBool(
104 $this->
getContext()->getUser()->getOption(
'diffonly' )
107 if ( $this->
getTitle()->getNamespace() !==
NS_FILE || ( $diff !==
null && $diffOnly ) ) {
116 && $this->
getFile()->getRedirected()
122 $request->setVal(
'diffonly',
'true' );
129 if (
$wgShowEXIF && $this->displayImg->exists() ) {
131 $formattedMetadata = $this->displayImg->formatMetadata( $this->
getContext() );
133 $formattedMetadata =
false;
136 if ( !$diff && $this->displayImg->exists() ) {
137 $out->addHTML( $this->
showTOC( (
bool)$formattedMetadata ) );
144 # No need to display noarticletext, we use our own message, output in openShowImage()
145 if ( $this->
getPage()->getId() ) {
146 # NS_FILE is in the user language, but this section (the actual wikitext)
147 # should be in page content language
148 $pageLang = $this->
getTitle()->getPageViewLanguage();
149 $out->addHTML( Xml::openElement(
'div', [
'id' =>
'mw-imagepage-content',
150 'lang' => $pageLang->getHtmlCode(),
'dir' => $pageLang->getDir(),
151 'class' =>
'mw-content-' . $pageLang->getDir() ] ) );
155 $out->addHTML( Xml::closeElement(
'div' ) );
157 # Just need to set the right headers
158 $out->setArticleFlag(
true );
159 $out->setPageTitle( $this->
getTitle()->getPrefixedText() );
160 $this->
getPage()->doViewUpdates(
166 # Show shared description, if needed
167 if ( $this->mExtraDescription ) {
168 $fol = $this->
getContext()->msg(
'shareddescriptionfollows' );
169 if ( !$fol->isDisabled() ) {
170 $out->addWikiTextAsInterface( $fol->plain() );
172 $out->addHTML(
'<div id="shared-image-desc">' . $this->mExtraDescription .
"</div>\n" );
179 $out->addHTML( Xml::element(
'h2',
180 [
'id' =>
'filelinks' ],
181 $this->
getContext()->msg(
'imagelinks' )->text() ) .
"\n" );
183 # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
184 # Yet we return metadata about the target. Definitely an issue in the FileRepo
187 # Allow extensions to add something after the image links
189 $this->getHookRunner()->onImagePageAfterImageLinks( $this, $html );
191 $out->addHTML( $html );
194 if ( $formattedMetadata ) {
195 $out->addHTML( Xml::element(
197 [
'id' =>
'metadata' ],
198 $this->
getContext()->msg(
'metadata' )->text() ) .
"\n" );
199 $out->wrapWikiTextAsInterface(
200 'mw-imagepage-section-metadata',
203 $out->addModules( [
'mediawiki.action.view.metadata' ] );
207 if ( !$this->repo->isLocal() ) {
208 $css = $this->repo->getDescriptionStylesheetUrl();
210 $out->addStyle( $css );
214 $out->addModuleStyles( [
216 'mediawiki.action.view.filepage',
225 return $this->displayImg;
236 '<li><a href="#file">' . $this->
getContext()->msg(
'file-anchor-link' )->escaped() .
'</a></li>',
237 '<li><a href="#filehistory">' . $this->
getContext()->msg(
'filehist' )->escaped() .
'</a></li>',
238 '<li><a href="#filelinks">' . $this->
getContext()->msg(
'imagelinks' )->escaped() .
'</a></li>',
241 $this->getHookRunner()->onImagePageShowTOC( $this, $r );
244 $r[] =
'<li><a href="#metadata">' .
245 $this->
getContext()->msg(
'metadata' )->escaped() .
249 return '<ul id="filetoc">' . implode(
"\n", $r ) .
'</ul>';
261 $r = $this->
getContext()->msg(
'metadata-help' )->plain();
264 $r .=
"<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
265 foreach ( $metadata as
$type => $stuff ) {
266 foreach ( $stuff as $v ) {
267 $class = str_replace(
' ',
'_', $v[
'id'] );
268 if (
$type ==
'collapsed' ) {
269 $class .=
' mw-metadata-collapsible';
271 $r .= Html::rawElement(
'tr',
272 [
'class' => $class ],
273 Html::rawElement(
'th', [], $v[
'name'] )
274 . Html::rawElement(
'td', [], $v[
'value'] )
291 $handler =
$file->getHandler();
296 $config = MediaWikiServices::getInstance()->getMainConfig();
297 $requestLanguage = $request->
getVal(
'lang', $config->get(
'LanguageCode' ) );
298 if ( $handler->validateParam(
'lang', $requestLanguage ) ) {
299 return $file->getMatchedLanguage( $requestLanguage );
302 return $handler->getDefaultRenderLanguage(
$file );
312 $dirmark =
$lang->getDirMarkEntity();
315 if ( $this->displayImg->exists() ) {
319 $page = $request->getIntOrNull(
'page' );
320 if ( $page ===
null ) {
324 $params = [
'page' => $page ];
328 if ( $renderLang !==
null ) {
329 $params[
'lang'] = $renderLang;
332 $width_orig = $this->displayImg->getWidth( $page );
333 $width = $width_orig;
334 $height_orig = $this->displayImg->getHeight( $page );
335 $height = $height_orig;
338 $linktext = $filename;
340 $this->getHookRunner()->onImageOpenShowImageInlineBefore( $this, $out );
342 if ( $this->displayImg->allowInlineDisplay() ) {
344 # "Download high res version" link below the image
345 # $msgsize = $this->getContext()->msg( 'file-info-size', $width_orig, $height_orig,
346 # Language::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
347 # We'll show a thumbnail of this image
348 if ( $width > $maxWidth ||
349 $height > $maxHeight ||
350 $this->displayImg->isVectorized()
352 list( $width, $height ) = $this->displayImg->getDisplayWidthHeight(
353 $maxWidth, $maxHeight, $page
355 $linktext = $this->
getContext()->msg(
'show-big-image' )->escaped();
357 $thumbSizes = $this->
getThumbSizes( $width_orig, $height_orig );
358 # Generate thumbnails or thumbnail links as needed...
360 foreach ( $thumbSizes as $size ) {
369 if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
370 || ( $this->displayImg->isVectorized()
373 && $size[0] != $width && $size[1] != $height
375 $sizeLink = $this->
makeSizeLink( $params, $size[0], $size[1] );
377 $otherSizes[] = $sizeLink;
381 $otherSizes = array_unique( $otherSizes );
383 $sizeLinkBigImagePreview = $this->
makeSizeLink( $params, $width, $height );
385 if ( count( $otherSizes ) ) {
389 [
'class' =>
'mw-filepage-other-resolutions' ],
390 $this->
getContext()->msg(
'show-big-image-other' )
391 ->rawParams(
$lang->pipeList( $otherSizes ) )
392 ->params( count( $otherSizes ) )
396 } elseif ( $width == 0 && $height == 0 ) {
397 # Some sort of audio file that doesn't have dimensions
398 # Don't output a no hi res message for such a file
401 # Image is small enough to show full size on image page
402 $msgsmall = $this->
getContext()->msg(
'file-nohires' )->parse();
405 $params[
'width'] = $width;
406 $params[
'height'] = $height;
409 $params[
'imagePageParams'] = $request->getQueryValuesOnly();
410 $thumbnail = $this->displayImg->transform( $params );
413 $anchorclose = Html::rawElement(
415 [
'class' =>
'mw-filepage-resolutioninfo' ],
419 $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
421 $out->addModules(
'mediawiki.page.image.pagination' );
422 $out->addHTML(
'<table class="multipageimage"><tr><td>' );
427 'alt' => $this->displayImg->getTitle()->getPrefixedText(),
430 $out->addHTML(
'<div class="fullImageLink" id="file">' .
431 $thumbnail->toHtml( $options ) .
432 $anchorclose .
"</div>\n" );
436 $count = $this->displayImg->pageCount();
437 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
440 $label = $this->
getContext()->msg(
'imgmultipageprev' )->text();
447 [
'page' => $page - 1 ]
456 [
'page' => $page - 1 ]
462 if ( $page < $count ) {
463 $label = $this->
getContext()->msg(
'imgmultipagenext' )->text();
468 [
'page' => $page + 1 ]
477 [
'page' => $page + 1 ]
486 'name' =>
'pageselector',
490 for ( $i = 1; $i <= $count; $i++ ) {
491 $options[] = Xml::option(
$lang->formatNum( $i ), $i, $i == $page );
493 $select = Xml::tags(
'select',
494 [
'id' =>
'pageselector',
'name' =>
'page' ],
495 implode(
"\n", $options ) );
498 '</td><td><div class="multipageimagenavbox">' .
499 Xml::openElement(
'form', $formParams ) .
500 Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
501 $this->
getContext()->msg(
'imgmultigoto' )->rawParams( $select )->parse() .
502 $this->
getContext()->msg(
'word-separator' )->escaped() .
503 Xml::submitButton( $this->
getContext()->msg(
'imgmultigo' )->text() ) .
504 Xml::closeElement(
'form' ) .
505 "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
508 } elseif ( $this->displayImg->isSafeFile() ) {
509 # if direct link is allowed but it's not a renderable image, show an icon.
510 $icon = $this->displayImg->iconThumb();
512 $out->addHTML(
'<div class="fullImageLink" id="file">' .
513 $icon->toHtml( [
'file-link' =>
true ] ) .
517 $longDesc = $this->
getContext()->msg(
'parentheses', $this->displayImg->getLongDesc() )->text();
519 $handler = $this->displayImg->getHandler();
523 $warningConfig = $handler->getWarningConfig( $this->displayImg );
525 if ( $warningConfig !==
null ) {
529 $output->addJsConfigVars(
'wgFileWarning', $warningConfig );
530 $output->addModules( $warningConfig[
'module'] );
531 $output->addModules(
'mediawiki.filewarning' );
535 $medialink =
"[[Media:$filename|$linktext]]";
537 if ( !$this->displayImg->isSafeFile() ) {
538 $warning = $this->
getContext()->msg(
'mediawarning' )->plain();
547 $out->wrapWikiTextAsInterface(
'fullMedia', <<<EOT
548<span
class=
"dangerousLink">{$medialink}</span> $dirmark<span
class=
"fileInfo">$longDesc</span>
552 $out->wrapWikiTextAsInterface(
'mediaWarning', $warning );
554 $out->wrapWikiTextAsInterface(
'fullMedia', <<<EOT
555{$medialink} {$dirmark}<span
class=
"fileInfo">$longDesc</span>
560 $renderLangOptions = $this->displayImg->getAvailableLanguages();
561 if ( count( $renderLangOptions ) >= 1 ) {
562 $out->addHTML( $this->
doRenderLangOpt( $renderLangOptions, $renderLang ) );
566 if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
572 $ext = $this->displayImg->getExtension();
574 'file-no-thumb-animation-' .
$ext,
575 'file-no-thumb-animation'
578 $out->wrapWikiTextAsInterface(
'mw-noanimatethumb', $noAnimMesg );
581 if ( !$this->displayImg->isLocal() ) {
585 # Image does not exist
586 if ( !$this->
getPage()->getId() ) {
589 # No article exists either
590 # Show deletion log to be consistent with normal articles
591 LogEventsList::showLogExtract(
593 [
'delete',
'move',
'protect' ],
594 $this->
getTitle()->getPrefixedText(),
597 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
598 'showIfEmpty' =>
false,
599 'msgKey' => [
'moveddeleted-notice' ]
610 'filepage-nofile-link',
611 $uploadTitle->getFullURL( [
612 'wpDestFile' => $this->
getFile()->getName()
616 $nofile =
'filepage-nofile';
621 $out->setRobotPolicy(
'noindex,nofollow' );
622 $out->wrapWikiMsg(
"<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
626 $request->response()->statusHeader( 404 );
629 $out->setFileVersion( $this->displayImg );
640 if ( $sizeLinkBigImagePreview ) {
642 $previewTypeDiffers =
false;
643 $origExt = $thumbExt = $this->displayImg->getExtension();
644 if ( $this->displayImg->getHandler() ) {
645 $origMime = $this->displayImg->getMimeType();
646 $typeParams = $params;
647 $this->displayImg->getHandler()->normaliseParams( $this->displayImg, $typeParams );
648 list( $thumbExt, $thumbMime ) = $this->displayImg->getHandler()->getThumbType(
649 $origExt, $origMime, $typeParams );
650 if ( $thumbMime !== $origMime ) {
651 $previewTypeDiffers =
true;
654 if ( $previewTypeDiffers ) {
655 return $this->
getContext()->msg(
'show-big-image-preview-differ' )->
656 rawParams( $sizeLinkBigImagePreview )->
657 params( strtoupper( $origExt ) )->
658 params( strtoupper( $thumbExt ) )->
661 return $this->
getContext()->msg(
'show-big-image-preview' )->
662 rawParams( $sizeLinkBigImagePreview )->
678 $params[
'width'] = $width;
679 $params[
'height'] = $height;
680 $thumbnail = $this->displayImg->transform( $params );
681 if ( $thumbnail && !$thumbnail->isError() ) {
682 return Html::rawElement(
'a', [
683 'href' => $thumbnail->getUrl(),
684 'class' =>
'mw-thumbnail-link'
685 ], $this->getContext()->msg(
'show-big-image-size' )->numParams(
686 $thumbnail->getWidth(), $thumbnail->getHeight()
700 $descUrl = $this->
getFile()->getDescriptionUrl();
701 $descText = $this->
getFile()->getDescriptionText( $this->
getContext()->getLanguage() );
704 if ( $descUrl && !$this->
getPage()->getId() ) {
705 $out->setCanonicalUrl( $descUrl );
708 $wrap =
"<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
713 $this->
getContext()->msg(
'sharedupload-desc-here' )->plain() !==
'-'
715 $out->wrapWikiMsg( $wrap, [
'sharedupload-desc-here',
$repo, $descUrl ] );
716 } elseif ( $descUrl &&
717 $this->
getContext()->msg(
'sharedupload-desc-there' )->plain() !==
'-'
719 $out->wrapWikiMsg( $wrap, [
'sharedupload-desc-there',
$repo, $descUrl ] );
721 $out->wrapWikiMsg( $wrap, [
'sharedupload',
$repo ],
'' );
725 $this->mExtraDescription = $descText;
732 return $uploadTitle->getFullURL( [
733 'wpDestFile' => $this->
getFile()->getName(),
742 if ( !$this->
getContext()->getConfig()->
get(
'EnableUploads' ) ) {
751 $canUpload = $this->
getContext()->getAuthority()
752 ->probablyCan(
'upload', $this->
getTitle() );
753 if ( $canUpload && UploadBase::userCanReUpload(
760 $this->
getContext()->msg(
'uploadnewversion-linktext' )->text()
762 $attrs = [
'class' =>
'plainlinks',
'id' =>
'mw-imagepage-reupload-link' ];
763 $linkPara = Html::rawElement(
'p', $attrs, $ulink );
766 $attrs = [
'id' =>
'mw-imagepage-upload-disallowed' ];
767 $msg = $this->
getContext()->msg(
'upload-disallowed-here' )->text();
768 $linkPara = Html::element(
'p', $attrs, $msg );
771 $uploadLinks = Html::rawElement(
'div', [
'class' =>
'mw-imagepage-upload-links' ], $linkPara );
772 $this->
getContext()->getOutput()->addHTML( $uploadLinks );
790 MediaWikiServices::getInstance()->getLinkBatchFactory()
792 $out->addHTML( $pager->getBody() );
793 $out->preventClickjacking( $pager->getPreventClickjacking() );
795 $this->
getFile()->resetHistory();
797 # Exist check because we don't want to show this on pages where an image
798 # doesn't exist along with the noimage message, that would suck. -ævar
799 if ( $this->
getFile()->exists() ) {
813 [
'imagelinks',
'page' ],
814 [
'page_namespace',
'page_title',
'il_to' ],
815 [
'il_to' => $target,
'il_from = page_id' ],
817 [
'LIMIT' => $limit + 1,
'ORDER BY' =>
'il_from', ]
829 $redirects[$redir->getDBkey()] = [];
832 'page_title' => $redir->getDBkey(),
837 foreach (
$res as $row ) {
840 $count = count( $rows );
842 $hasMore = $count > $limit;
843 if ( !$hasMore && count( $redirects ) ) {
845 $limit - count( $rows ) + 1 );
846 foreach (
$res as $row ) {
847 $redirects[$row->il_to][] = $row;
850 $hasMore = (
$res->numRows() + count( $rows ) ) > $limit;
855 Html::rawElement(
'div',
856 [
'id' =>
'mw-imagepage-nolinkstoimage' ],
"\n$1\n" ),
862 $out->addHTML(
"<div id='mw-imagepage-section-linkstoimage'>\n" );
864 $out->addWikiMsg(
'linkstoimage', $count );
867 $out->addWikiMsg(
'linkstoimage-more',
868 $this->
getContext()->getLanguage()->formatNum( $limit ),
869 $this->
getTitle()->getPrefixedDBkey()
874 Html::openElement(
'ul',
875 [
'class' =>
'mw-imagepage-linkstoimage' ] ) .
"\n"
878 usort( $rows, [ $this,
'compare' ] );
880 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
884 foreach ( $rows as $element ) {
886 if ( $currentCount > $limit ) {
891 # Add a redirect=no to make redirect pages reachable
892 if ( isset( $redirects[$element->page_title] ) ) {
893 $query[
'redirect'] =
'no';
896 Title::makeTitle( $element->page_namespace, $element->page_title ),
899 if ( !isset( $redirects[$element->page_title] ) ) {
902 } elseif ( count( $redirects[$element->page_title] ) === 0 ) {
903 # Redirect without usages
904 $liContents = $this->
getContext()->msg(
'linkstoimage-redirect' )
905 ->rawParams( $link,
'' )
908 # Redirect with usages
910 foreach ( $redirects[$element->page_title] as $row ) {
912 if ( $currentCount > $limit ) {
917 Title::makeTitle( $row->page_namespace, $row->page_title ) );
918 $li .= Html::rawElement(
920 [
'class' =>
'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
925 $ul = Html::rawElement(
927 [
'class' =>
'mw-imagepage-redirectstofile' ],
930 $liContents = $this->
getContext()->msg(
'linkstoimage-redirect' )->rawParams(
931 $link, $ul )->parse();
933 $out->addHTML( Html::rawElement(
935 [
'class' =>
'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
941 $out->addHTML( Html::closeElement(
'ul' ) .
"\n" );
945 if ( $currentCount > $limit ) {
946 $out->addWikiMsg(
'morelinkstoimage', $this->
getTitle()->getPrefixedDBkey() );
948 $out->addHTML( Html::closeElement(
'div' ) .
"\n" );
955 $dupes = $this->
getPage()->getDuplicates();
956 if ( count( $dupes ) == 0 ) {
960 $out->addHTML(
"<div id='mw-imagepage-section-duplicates'>\n" );
961 $out->addWikiMsg(
'duplicatesoffile',
962 $this->
getContext()->getLanguage()->formatNum( count( $dupes ) ), $this->
getTitle()->getDBkey()
964 $out->addHTML(
"<ul class='mw-imagepage-duplicates'>\n" );
966 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
971 foreach ( $dupes as
$file ) {
973 if (
$file->isLocal() ) {
977 $file->getTitle()->getPrefixedText() );
980 $file->getRepo()->getDisplayName()
983 $out->addHTML(
"<li>{$link} {$fromSrc}</li>\n" );
985 $out->addHTML(
"</ul></div>\n" );
991 public function delete() {
993 if ( !
$file->exists() || !
$file->isLocal() ||
$file->getRedirected() ) {
998 '@phan-var LocalFile $file';
1003 $context->getUser(),
1004 $context->getOutput()
1006 $deleter->execute();
1016 $out->setPageTitle( $this->
getContext()->msg(
'internalerror' ) );
1017 $out->setRobotPolicy(
'noindex,nofollow' );
1018 $out->setArticleRelated(
false );
1019 $out->enableClientCache(
false );
1020 $out->addWikiTextAsInterface( $description );
1032 return $a->page_namespace <=> $b->page_namespace
1033 ?: strcmp( $a->page_title, $b->page_title );
1046 return MediaFileTrait::getImageLimitsFromOption( $user, $optionName );
1060 $matchedRenderLang = $this->displayImg->getMatchedLanguage( $renderLang );
1062 foreach ( $langChoices as
$lang ) {
1065 $matchedRenderLang ===
$lang
1073 $this->
getContext()->msg(
'img-lang-default' )->text(),
1075 $matchedRenderLang ===
null
1078 $select = Html::rawElement(
1080 [
'id' =>
'mw-imglangselector',
'name' =>
'lang' ],
1083 $submit = Xml::submitButton( $this->
getContext()->msg(
'img-lang-go' )->text() );
1085 $formContents = $this->
getContext()->msg(
'img-lang-info' )
1086 ->rawParams( $select, $submit )
1088 $formContents .= Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() );
1090 $langSelectLine = Html::rawElement(
'div', [
'id' =>
'mw-imglangselector-line' ],
1091 Html::rawElement(
'form', [
'action' =>
$wgScript ], $formContents )
1093 return $langSelectLine;
1102 $code = LanguageCode::bcp47(
$lang );
1103 $name = MediaWikiServices::getInstance()
1104 ->getLanguageNameUtils()
1105 ->getLanguageName( $code, $this->
getContext()->getLanguage()->getCode() );
1106 if ( $name !==
'' ) {
1107 $display = $this->
getContext()->msg(
'img-lang-opt', $code, $name )->text();
1130 if ( $this->displayImg->getRepo()->canTransformVia404() ) {
1138 $thumbSizes[] = [ $origWidth, $origHeight ];
1140 # Creating thumb links triggers thumbnail generation.
1141 # Just generate the thumb for the current users prefs.
1145 if ( !$this->displayImg->mustRender() ) {
1148 $thumbSizes[] = [ $origWidth, $origHeight ];
1159 return $this->
getPage()->getFile();
1167 return $this->
getPage()->isLocal();
1175 return $this->
getPage()->getDuplicates();
1183 return $this->
getPage()->getForeignCategories();
$wgScript
The URL path to index.php.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
$wgSVGMaxSize
Don't scale a SVG larger than this.
$wgEnableUploads
Allow users to upload files.
$wgShowEXIF
Show Exif data, on by default if available.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getFile()
Get the file for this page, if one exists.
Class for viewing MediaWiki article and history.
LinkRenderer $linkRenderer
getPage()
Get the WikiPage object of this instance.
Base class for file repositories.
getDisplayName()
Get the human-readable name of the repo.
Implements some public methods and some protected utility functions which are required by multiple ch...
Class for viewing MediaWiki file description pages.
getLanguageForRendering(WebRequest $request, File $file)
Returns language code to be used for dispaying the image, based on request context and languages avai...
showError( $description)
Display an error with a wikitext description.
imageHistory()
If the page we've just displayed is in the "Image" namespace, we follow it with an upload history of ...
compare( $a, $b)
Callback for usort() to do link sorts by (namespace, title) Function copied from Title::compare()
createXmlOptionStringForLanguage( $lang, $selected)
getThumbSizes( $origWidth, $origHeight)
Get alternative thumbnail sizes.
getImageLimitsFromOption( $user, $optionName)
Returns the corresponding $wgImageLimits entry for the selected user option.
string false $mExtraDescription
Guaranteed to be HTML, {.
makeSizeLink( $params, $width, $height)
Creates an thumbnail of specified size and returns an HTML link to it.
File false $displayImg
Only temporary false, most code can assume this is a File.
doRenderLangOpt(array $langChoices, $renderLang)
Output a drop-down box for language options for the file.
makeMetadataTable( $metadata)
Make a table with metadata to be shown in the output page.
queryImageLinks( $target, $limit)
uploadLinksBox()
Add the re-upload link (or message about not being able to re-upload) to the output.
printSharedImageText()
Show a notice that the file is from a shared repository.
closeShowImage()
For overloading.
showTOC( $metadata)
Create the TOC.
view()
This is the default action of the index.php entry point: just view the page of the given title.
getThumbPrevText( $params, $sizeLinkBigImagePreview)
Make the text under the image to say what size preview.
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
static makeThumbLinkObj(LinkTarget $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Represents a title within MediaWiki.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getVal( $name, $default=null)
Fetch a scalar from the input or return $default if it's not set.
Special handling for file pages.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang