MediaWiki  1.34.4
ImagePage.php
Go to the documentation of this file.
1 <?php
25 
34 class ImagePage extends Article {
36  private $displayImg;
37 
39  private $repo;
40 
42  private $fileLoaded;
43 
45  protected $mExtraDescription = false;
46 
51  protected function newPage( Title $title ) {
52  // Overload mPage with a file-specific page
53  return new WikiFilePage( $title );
54  }
55 
60  public function setFile( $file ) {
61  $this->mPage->setFile( $file );
62  $this->displayImg = $file;
63  $this->fileLoaded = true;
64  }
65 
66  protected function loadFile() {
67  if ( $this->fileLoaded ) {
68  return;
69  }
70  $this->fileLoaded = true;
71 
72  $this->displayImg = $img = false;
73 
74  Hooks::run( 'ImagePageFindFile', [ $this, &$img, &$this->displayImg ] );
75  if ( !$img ) { // not set by hook?
76  $services = MediaWikiServices::getInstance();
77  $img = $services->getRepoGroup()->findFile( $this->getTitle() );
78  if ( !$img ) {
79  $img = $services->getRepoGroup()->getLocalRepo()->newFile( $this->getTitle() );
80  }
81  }
82  $this->mPage->setFile( $img );
83  if ( !$this->displayImg ) { // not set by hook?
84  $this->displayImg = $img;
85  }
86  $this->repo = $img->getRepo();
87  }
88 
89  public function view() {
90  global $wgShowEXIF;
91 
92  // For action=render, include body text only; none of the image extras
93  if ( $this->viewIsRenderAction ) {
94  parent::view();
95  return;
96  }
97 
98  $out = $this->getContext()->getOutput();
99  $request = $this->getContext()->getRequest();
100  $diff = $request->getVal( 'diff' );
101  $diffOnly = $request->getBool(
102  'diffonly',
103  $this->getContext()->getUser()->getOption( 'diffonly' )
104  );
105 
106  if ( $this->getTitle()->getNamespace() != NS_FILE || ( $diff !== null && $diffOnly ) ) {
107  parent::view();
108  return;
109  }
110 
111  $this->loadFile();
112 
113  if ( $this->getTitle()->getNamespace() == NS_FILE && $this->mPage->getFile()->getRedirected() ) {
114  if ( $this->getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !== null ) {
115  $request->setVal( 'diffonly', 'true' );
116  }
117 
118  parent::view();
119  return;
120  }
121 
122  if ( $wgShowEXIF && $this->displayImg->exists() ) {
123  // @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
124  $formattedMetadata = $this->displayImg->formatMetadata( $this->getContext() );
125  $showmeta = $formattedMetadata !== false;
126  } else {
127  $showmeta = false;
128  }
129 
130  if ( !$diff && $this->displayImg->exists() ) {
131  $out->addHTML( $this->showTOC( $showmeta ) );
132  }
133 
134  if ( !$diff ) {
135  $this->openShowImage();
136  }
137 
138  # No need to display noarticletext, we use our own message, output in openShowImage()
139  if ( $this->mPage->getId() ) {
140  # NS_FILE is in the user language, but this section (the actual wikitext)
141  # should be in page content language
142  $pageLang = $this->getTitle()->getPageViewLanguage();
143  $out->addHTML( Xml::openElement( 'div', [ 'id' => 'mw-imagepage-content',
144  'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(),
145  'class' => 'mw-content-' . $pageLang->getDir() ] ) );
146 
147  parent::view();
148 
149  $out->addHTML( Xml::closeElement( 'div' ) );
150  } else {
151  # Just need to set the right headers
152  $out->setArticleFlag( true );
153  $out->setPageTitle( $this->getTitle()->getPrefixedText() );
154  $this->mPage->doViewUpdates( $this->getContext()->getUser(), $this->getOldID() );
155  }
156 
157  # Show shared description, if needed
158  if ( $this->mExtraDescription ) {
159  $fol = $this->getContext()->msg( 'shareddescriptionfollows' );
160  if ( !$fol->isDisabled() ) {
161  $out->addWikiTextAsInterface( $fol->plain() );
162  }
163  $out->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . "</div>\n" );
164  }
165 
166  $this->closeShowImage();
167  $this->imageHistory();
168  // TODO: Cleanup the following
169 
170  $out->addHTML( Xml::element( 'h2',
171  [ 'id' => 'filelinks' ],
172  $this->getContext()->msg( 'imagelinks' )->text() ) . "\n" );
173  $this->imageDupes();
174  # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
175  # Yet we return metadata about the target. Definitely an issue in the FileRepo
176  $this->imageLinks();
177 
178  # Allow extensions to add something after the image links
179  $html = '';
180  Hooks::run( 'ImagePageAfterImageLinks', [ $this, &$html ] );
181  if ( $html ) {
182  $out->addHTML( $html );
183  }
184 
185  if ( $showmeta ) {
186  $out->addHTML( Xml::element(
187  'h2',
188  [ 'id' => 'metadata' ],
189  $this->getContext()->msg( 'metadata' )->text() ) . "\n" );
190  $out->wrapWikiTextAsInterface(
191  'mw-imagepage-section-metadata',
192  $this->makeMetadataTable( $formattedMetadata )
193  );
194  $out->addModules( [ 'mediawiki.action.view.metadata' ] );
195  }
196 
197  // Add remote Filepage.css
198  if ( !$this->repo->isLocal() ) {
199  $css = $this->repo->getDescriptionStylesheetUrl();
200  if ( $css ) {
201  $out->addStyle( $css );
202  }
203  }
204 
205  $out->addModuleStyles( [
206  'filepage', // always show the local local Filepage.css, T31277
207  'mediawiki.action.view.filepage', // Add MediaWiki styles for a file page
208  ] );
209  }
210 
214  public function getDisplayedFile() {
215  $this->loadFile();
216  return $this->displayImg;
217  }
218 
225  protected function showTOC( $metadata ) {
226  $r = [
227  '<li><a href="#file">' . $this->getContext()->msg( 'file-anchor-link' )->escaped() . '</a></li>',
228  '<li><a href="#filehistory">' . $this->getContext()->msg( 'filehist' )->escaped() . '</a></li>',
229  '<li><a href="#filelinks">' . $this->getContext()->msg( 'imagelinks' )->escaped() . '</a></li>',
230  ];
231 
232  Hooks::run( 'ImagePageShowTOC', [ $this, &$r ] );
233 
234  if ( $metadata ) {
235  $r[] = '<li><a href="#metadata">' .
236  $this->getContext()->msg( 'metadata' )->escaped() .
237  '</a></li>';
238  }
239 
240  return '<ul id="filetoc">' . implode( "\n", $r ) . '</ul>';
241  }
242 
251  protected function makeMetadataTable( $metadata ) {
252  $r = $this->getContext()->msg( 'metadata-help' )->plain();
253  // Intial state is collapsed
254  // see filepage.css and mediawiki.action.view.metadata module.
255  $r .= "<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
256  foreach ( $metadata as $type => $stuff ) {
257  foreach ( $stuff as $v ) {
258  $class = str_replace( ' ', '_', $v['id'] );
259  if ( $type == 'collapsed' ) {
260  $class .= ' mw-metadata-collapsible';
261  }
262  $r .= Html::rawElement( 'tr',
263  [ 'class' => $class ],
264  Html::rawElement( 'th', [], $v['name'] )
265  . Html::rawElement( 'td', [], $v['value'] )
266  );
267  }
268  }
269  $r .= "</table>\n";
270  return $r;
271  }
272 
282  public function getEmptyPageParserOutput( ParserOptions $options ) {
283  $this->loadFile();
284  if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && $this->getId() == 0 ) {
285  return new ParserOutput();
286  }
287  return parent::getEmptyPageParserOutput( $options );
288  }
289 
298  private function getLanguageForRendering( WebRequest $request, File $file ) {
299  $handler = $file->getHandler();
300  if ( !$handler ) {
301  return null;
302  }
303 
304  $config = MediaWikiServices::getInstance()->getMainConfig();
305  $requestLanguage = $request->getVal( 'lang', $config->get( 'LanguageCode' ) );
306  if ( $handler->validateParam( 'lang', $requestLanguage ) ) {
307  return $file->getMatchedLanguage( $requestLanguage );
308  }
309 
310  return $handler->getDefaultRenderLanguage( $file );
311  }
312 
313  protected function openShowImage() {
315 
316  $this->loadFile();
317  $out = $this->getContext()->getOutput();
318  $user = $this->getContext()->getUser();
319  $lang = $this->getContext()->getLanguage();
320  $dirmark = $lang->getDirMarkEntity();
321  $request = $this->getContext()->getRequest();
322 
323  list( $maxWidth, $maxHeight ) = $this->getImageLimitsFromOption( $user, 'imagesize' );
324 
325  if ( $this->displayImg->exists() ) {
326  # image
327  $page = $request->getIntOrNull( 'page' );
328  if ( is_null( $page ) ) {
329  $params = [];
330  $page = 1;
331  } else {
332  $params = [ 'page' => $page ];
333  }
334 
335  $renderLang = $this->getLanguageForRendering( $request, $this->displayImg );
336  if ( !is_null( $renderLang ) ) {
337  $params['lang'] = $renderLang;
338  }
339 
340  $width_orig = $this->displayImg->getWidth( $page );
341  $width = $width_orig;
342  $height_orig = $this->displayImg->getHeight( $page );
343  $height = $height_orig;
344 
345  $filename = wfEscapeWikiText( $this->displayImg->getName() );
346  $linktext = $filename;
347 
348  // Avoid PHP 7.1 warning from passing $this by reference
349  $imagePage = $this;
350 
351  Hooks::run( 'ImageOpenShowImageInlineBefore', [ &$imagePage, &$out ] );
352 
353  if ( $this->displayImg->allowInlineDisplay() ) {
354  # image
355  # "Download high res version" link below the image
356  # $msgsize = $this->getContext()->msg( 'file-info-size', $width_orig, $height_orig,
357  # Language::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
358  # We'll show a thumbnail of this image
359  if ( $width > $maxWidth || $height > $maxHeight || $this->displayImg->isVectorized() ) {
360  list( $width, $height ) = $this->getDisplayWidthHeight(
361  $maxWidth, $maxHeight, $width, $height
362  );
363  $linktext = $this->getContext()->msg( 'show-big-image' )->escaped();
364 
365  $thumbSizes = $this->getThumbSizes( $width_orig, $height_orig );
366  # Generate thumbnails or thumbnail links as needed...
367  $otherSizes = [];
368  foreach ( $thumbSizes as $size ) {
369  // We include a thumbnail size in the list, if it is
370  // less than or equal to the original size of the image
371  // asset ($width_orig/$height_orig). We also exclude
372  // the current thumbnail's size ($width/$height)
373  // since that is added to the message separately, so
374  // it can be denoted as the current size being shown.
375  // Vectorized images are limited by $wgSVGMaxSize big,
376  // so all thumbs less than or equal that are shown.
377  if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
378  || ( $this->displayImg->isVectorized()
379  && max( $size[0], $size[1] ) <= $wgSVGMaxSize )
380  )
381  && $size[0] != $width && $size[1] != $height
382  ) {
383  $sizeLink = $this->makeSizeLink( $params, $size[0], $size[1] );
384  if ( $sizeLink ) {
385  $otherSizes[] = $sizeLink;
386  }
387  }
388  }
389  $otherSizes = array_unique( $otherSizes );
390 
391  $sizeLinkBigImagePreview = $this->makeSizeLink( $params, $width, $height );
392  $msgsmall = $this->getThumbPrevText( $params, $sizeLinkBigImagePreview );
393  if ( count( $otherSizes ) ) {
394  $msgsmall .= ' ' .
396  'span',
397  [ 'class' => 'mw-filepage-other-resolutions' ],
398  $this->getContext()->msg( 'show-big-image-other' )
399  ->rawParams( $lang->pipeList( $otherSizes ) )
400  ->params( count( $otherSizes ) )
401  ->parse()
402  );
403  }
404  } elseif ( $width == 0 && $height == 0 ) {
405  # Some sort of audio file that doesn't have dimensions
406  # Don't output a no hi res message for such a file
407  $msgsmall = '';
408  } else {
409  # Image is small enough to show full size on image page
410  $msgsmall = $this->getContext()->msg( 'file-nohires' )->parse();
411  }
412 
413  $params['width'] = $width;
414  $params['height'] = $height;
415  $thumbnail = $this->displayImg->transform( $params );
416  Linker::processResponsiveImages( $this->displayImg, $thumbnail, $params );
417 
418  $anchorclose = Html::rawElement(
419  'div',
420  [ 'class' => 'mw-filepage-resolutioninfo' ],
421  $msgsmall
422  );
423 
424  $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
425  if ( $isMulti ) {
426  $out->addModules( 'mediawiki.page.image.pagination' );
427  $out->addHTML( '<table class="multipageimage"><tr><td>' );
428  }
429 
430  if ( $thumbnail ) {
431  $options = [
432  'alt' => $this->displayImg->getTitle()->getPrefixedText(),
433  'file-link' => true,
434  ];
435  $out->addHTML( '<div class="fullImageLink" id="file">' .
436  $thumbnail->toHtml( $options ) .
437  $anchorclose . "</div>\n" );
438  }
439 
440  if ( $isMulti ) {
441  $count = $this->displayImg->pageCount();
442 
443  if ( $page > 1 ) {
444  $label = $this->getContext()->msg( 'imgmultipageprev' )->text();
445  // on the client side, this link is generated in ajaxifyPageNavigation()
446  // in the mediawiki.page.image.pagination module
447  $link = Linker::linkKnown(
448  $this->getTitle(),
449  htmlspecialchars( $label ),
450  [],
451  [ 'page' => $page - 1 ]
452  );
453  $thumb1 = Linker::makeThumbLinkObj(
454  $this->getTitle(),
455  $this->displayImg,
456  $link,
457  $label,
458  'none',
459  [ 'page' => $page - 1 ]
460  );
461  } else {
462  $thumb1 = '';
463  }
464 
465  if ( $page < $count ) {
466  $label = $this->getContext()->msg( 'imgmultipagenext' )->text();
467  $link = Linker::linkKnown(
468  $this->getTitle(),
469  htmlspecialchars( $label ),
470  [],
471  [ 'page' => $page + 1 ]
472  );
473  $thumb2 = Linker::makeThumbLinkObj(
474  $this->getTitle(),
475  $this->displayImg,
476  $link,
477  $label,
478  'none',
479  [ 'page' => $page + 1 ]
480  );
481  } else {
482  $thumb2 = '';
483  }
484 
485  global $wgScript;
486 
487  $formParams = [
488  'name' => 'pageselector',
489  'action' => $wgScript,
490  ];
491  $options = [];
492  for ( $i = 1; $i <= $count; $i++ ) {
493  $options[] = Xml::option( $lang->formatNum( $i ), $i, $i == $page );
494  }
495  $select = Xml::tags( 'select',
496  [ 'id' => 'pageselector', 'name' => 'page' ],
497  implode( "\n", $options ) );
498 
499  $out->addHTML(
500  '</td><td><div class="multipageimagenavbox">' .
501  Xml::openElement( 'form', $formParams ) .
502  Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
503  $this->getContext()->msg( 'imgmultigoto' )->rawParams( $select )->parse() .
504  $this->getContext()->msg( 'word-separator' )->escaped() .
505  Xml::submitButton( $this->getContext()->msg( 'imgmultigo' )->text() ) .
506  Xml::closeElement( 'form' ) .
507  "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
508  );
509  }
510  } elseif ( $this->displayImg->isSafeFile() ) {
511  # if direct link is allowed but it's not a renderable image, show an icon.
512  $icon = $this->displayImg->iconThumb();
513 
514  $out->addHTML( '<div class="fullImageLink" id="file">' .
515  $icon->toHtml( [ 'file-link' => true ] ) .
516  "</div>\n" );
517  }
518 
519  $longDesc = $this->getContext()->msg( 'parentheses', $this->displayImg->getLongDesc() )->text();
520 
521  $handler = $this->displayImg->getHandler();
522 
523  // If this is a filetype with potential issues, warn the user.
524  if ( $handler ) {
525  $warningConfig = $handler->getWarningConfig( $this->displayImg );
526 
527  if ( $warningConfig !== null ) {
528  // The warning will be displayed via CSS and JavaScript.
529  // We just need to tell the client side what message to use.
530  $output = $this->getContext()->getOutput();
531  $output->addJsConfigVars( 'wgFileWarning', $warningConfig );
532  $output->addModules( $warningConfig['module'] );
533  $output->addModules( 'mediawiki.filewarning' );
534  }
535  }
536 
537  $medialink = "[[Media:$filename|$linktext]]";
538 
539  if ( !$this->displayImg->isSafeFile() ) {
540  $warning = $this->getContext()->msg( 'mediawarning' )->plain();
541  // dirmark is needed here to separate the file name, which
542  // most likely ends in Latin characters, from the description,
543  // which may begin with the file type. In RTL environment
544  // this will get messy.
545  // The dirmark, however, must not be immediately adjacent
546  // to the filename, because it can get copied with it.
547  // See T27277.
548  // phpcs:disable Generic.Files.LineLength
549  $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
550 <span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span>
551 EOT
552  );
553  // phpcs:enable
554  $out->wrapWikiTextAsInterface( 'mediaWarning', $warning );
555  } else {
556  $out->wrapWikiTextAsInterface( 'fullMedia', <<<EOT
557 {$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
558 EOT
559  );
560  }
561 
562  $renderLangOptions = $this->displayImg->getAvailableLanguages();
563  if ( count( $renderLangOptions ) >= 1 ) {
564  $out->addHTML( $this->doRenderLangOpt( $renderLangOptions, $renderLang ) );
565  }
566 
567  // Add cannot animate thumbnail warning
568  if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
569  // Include the extension so wiki admins can
570  // customize it on a per file-type basis
571  // (aka say things like use format X instead).
572  // additionally have a specific message for
573  // file-no-thumb-animation-gif
574  $ext = $this->displayImg->getExtension();
575  $noAnimMesg = wfMessageFallback(
576  'file-no-thumb-animation-' . $ext,
577  'file-no-thumb-animation'
578  )->plain();
579 
580  $out->wrapWikiTextAsInterface( 'mw-noanimatethumb', $noAnimMesg );
581  }
582 
583  if ( !$this->displayImg->isLocal() ) {
584  $this->printSharedImageText();
585  }
586  } else {
587  # Image does not exist
588  if ( !$this->getId() ) {
589  $dbr = wfGetDB( DB_REPLICA );
590 
591  # No article exists either
592  # Show deletion log to be consistent with normal articles
594  $out,
595  [ 'delete', 'move', 'protect' ],
596  $this->getTitle()->getPrefixedText(),
597  '',
598  [ 'lim' => 10,
599  'conds' => [ 'log_action != ' . $dbr->addQuotes( 'revision' ) ],
600  'showIfEmpty' => false,
601  'msgKey' => [ 'moveddeleted-notice' ]
602  ]
603  );
604  }
605 
606  if ( $wgEnableUploads && MediaWikiServices::getInstance()
608  ->userHasRight( $user, 'upload' )
609  ) {
610  // Only show an upload link if the user can upload
611  $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
612  $nofile = [
613  'filepage-nofile-link',
614  $uploadTitle->getFullURL( [ 'wpDestFile' => $this->mPage->getFile()->getName() ] )
615  ];
616  } else {
617  $nofile = 'filepage-nofile';
618  }
619  // Note, if there is an image description page, but
620  // no image, then this setRobotPolicy is overridden
621  // by Article::View().
622  $out->setRobotPolicy( 'noindex,nofollow' );
623  $out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
624  if ( !$this->getId() && $wgSend404Code ) {
625  // If there is no image, no shared image, and no description page,
626  // output a 404, to be consistent with Article::showMissingArticle.
627  $request->response()->statusHeader( 404 );
628  }
629  }
630  $out->setFileVersion( $this->displayImg );
631  }
632 
640  protected function getThumbPrevText( $params, $sizeLinkBigImagePreview ) {
641  if ( $sizeLinkBigImagePreview ) {
642  // Show a different message of preview is different format from original.
643  $previewTypeDiffers = false;
644  $origExt = $thumbExt = $this->displayImg->getExtension();
645  if ( $this->displayImg->getHandler() ) {
646  $origMime = $this->displayImg->getMimeType();
647  $typeParams = $params;
648  $this->displayImg->getHandler()->normaliseParams( $this->displayImg, $typeParams );
649  list( $thumbExt, $thumbMime ) = $this->displayImg->getHandler()->getThumbType(
650  $origExt, $origMime, $typeParams );
651  if ( $thumbMime !== $origMime ) {
652  $previewTypeDiffers = true;
653  }
654  }
655  if ( $previewTypeDiffers ) {
656  return $this->getContext()->msg( 'show-big-image-preview-differ' )->
657  rawParams( $sizeLinkBigImagePreview )->
658  params( strtoupper( $origExt ) )->
659  params( strtoupper( $thumbExt ) )->
660  parse();
661  } else {
662  return $this->getContext()->msg( 'show-big-image-preview' )->
663  rawParams( $sizeLinkBigImagePreview )->
664  parse();
665  }
666  } else {
667  return '';
668  }
669  }
670 
678  protected function makeSizeLink( $params, $width, $height ) {
679  $params['width'] = $width;
680  $params['height'] = $height;
681  $thumbnail = $this->displayImg->transform( $params );
682  if ( $thumbnail && !$thumbnail->isError() ) {
683  return Html::rawElement( 'a', [
684  'href' => $thumbnail->getUrl(),
685  'class' => 'mw-thumbnail-link'
686  ], $this->getContext()->msg( 'show-big-image-size' )->numParams(
687  $thumbnail->getWidth(), $thumbnail->getHeight()
688  )->parse() );
689  } else {
690  return '';
691  }
692  }
693 
697  protected function printSharedImageText() {
698  $out = $this->getContext()->getOutput();
699  $this->loadFile();
700 
701  $descUrl = $this->mPage->getFile()->getDescriptionUrl();
702  $descText = $this->mPage->getFile()->getDescriptionText( $this->getContext()->getLanguage() );
703 
704  /* Add canonical to head if there is no local page for this shared file */
705  if ( $descUrl && $this->mPage->getId() == 0 ) {
706  $out->setCanonicalUrl( $descUrl );
707  }
708 
709  $wrap = "<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
710  $repo = $this->mPage->getFile()->getRepo()->getDisplayName();
711 
712  if ( $descUrl &&
713  $descText &&
714  $this->getContext()->msg( 'sharedupload-desc-here' )->plain() !== '-'
715  ) {
716  $out->wrapWikiMsg( $wrap, [ 'sharedupload-desc-here', $repo, $descUrl ] );
717  } elseif ( $descUrl &&
718  $this->getContext()->msg( 'sharedupload-desc-there' )->plain() !== '-'
719  ) {
720  $out->wrapWikiMsg( $wrap, [ 'sharedupload-desc-there', $repo, $descUrl ] );
721  } else {
722  $out->wrapWikiMsg( $wrap, [ 'sharedupload', $repo ], ''/*BACKCOMPAT*/ );
723  }
724 
725  if ( $descText ) {
726  $this->mExtraDescription = $descText;
727  }
728  }
729 
730  public function getUploadUrl() {
731  $this->loadFile();
732  $uploadTitle = SpecialPage::getTitleFor( 'Upload' );
733  return $uploadTitle->getFullURL( [
734  'wpDestFile' => $this->mPage->getFile()->getName(),
735  'wpForReUpload' => 1
736  ] );
737  }
738 
742  protected function uploadLinksBox() {
743  if ( !$this->getContext()->getConfig()->get( 'EnableUploads' ) ) {
744  return;
745  }
746 
747  $this->loadFile();
748  if ( !$this->mPage->getFile()->isLocal() ) {
749  return;
750  }
751 
752  $canUpload = MediaWikiServices::getInstance()->getPermissionManager()
753  ->quickUserCan( 'upload', $this->getContext()->getUser(), $this->getTitle() );
754  if ( $canUpload && UploadBase::userCanReUpload(
755  $this->getContext()->getUser(),
756  $this->mPage->getFile() )
757  ) {
758  // "Upload a new version of this file" link
759  $ulink = Linker::makeExternalLink(
760  $this->getUploadUrl(),
761  $this->getContext()->msg( 'uploadnewversion-linktext' )->text()
762  );
763  $attrs = [ 'class' => 'plainlinks', 'id' => 'mw-imagepage-reupload-link' ];
764  $linkPara = Html::rawElement( 'p', $attrs, $ulink );
765  } else {
766  // "You cannot overwrite this file." message
767  $attrs = [ 'id' => 'mw-imagepage-upload-disallowed' ];
768  $msg = $this->getContext()->msg( 'upload-disallowed-here' )->text();
769  $linkPara = Html::element( 'p', $attrs, $msg );
770  }
771 
772  $uploadLinks = Html::rawElement( 'div', [ 'class' => 'mw-imagepage-upload-links' ], $linkPara );
773  $this->getContext()->getOutput()->addHTML( $uploadLinks );
774  }
775 
779  protected function closeShowImage() {
780  }
781 
786  protected function imageHistory() {
787  $this->loadFile();
788  $out = $this->getContext()->getOutput();
789  $pager = new ImageHistoryPseudoPager( $this );
790  $out->addHTML( $pager->getBody() );
791  $out->preventClickjacking( $pager->getPreventClickjacking() );
792 
793  $this->mPage->getFile()->resetHistory(); // free db resources
794 
795  # Exist check because we don't want to show this on pages where an image
796  # doesn't exist along with the noimage message, that would suck. -ævar
797  if ( $this->mPage->getFile()->exists() ) {
798  $this->uploadLinksBox();
799  }
800  }
801 
807  protected function queryImageLinks( $target, $limit ) {
808  $dbr = wfGetDB( DB_REPLICA );
809 
810  return $dbr->select(
811  [ 'imagelinks', 'page' ],
812  [ 'page_namespace', 'page_title', 'il_to' ],
813  [ 'il_to' => $target, 'il_from = page_id' ],
814  __METHOD__,
815  [ 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', ]
816  );
817  }
818 
819  protected function imageLinks() {
820  $limit = 100;
821 
822  $out = $this->getContext()->getOutput();
823 
824  $rows = [];
825  $redirects = [];
826  foreach ( $this->getTitle()->getRedirectsHere( NS_FILE ) as $redir ) {
827  $redirects[$redir->getDBkey()] = [];
828  $rows[] = (object)[
829  'page_namespace' => NS_FILE,
830  'page_title' => $redir->getDBkey(),
831  ];
832  }
833 
834  $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
835  foreach ( $res as $row ) {
836  $rows[] = $row;
837  }
838  $count = count( $rows );
839 
840  $hasMore = $count > $limit;
841  if ( !$hasMore && count( $redirects ) ) {
842  $res = $this->queryImageLinks( array_keys( $redirects ),
843  $limit - count( $rows ) + 1 );
844  foreach ( $res as $row ) {
845  $redirects[$row->il_to][] = $row;
846  $count++;
847  }
848  $hasMore = ( $res->numRows() + count( $rows ) ) > $limit;
849  }
850 
851  if ( $count == 0 ) {
852  $out->wrapWikiMsg(
853  Html::rawElement( 'div',
854  [ 'id' => 'mw-imagepage-nolinkstoimage' ], "\n$1\n" ),
855  'nolinkstoimage'
856  );
857  return;
858  }
859 
860  $out->addHTML( "<div id='mw-imagepage-section-linkstoimage'>\n" );
861  if ( !$hasMore ) {
862  $out->addWikiMsg( 'linkstoimage', $count );
863  } else {
864  // More links than the limit. Add a link to [[Special:Whatlinkshere]]
865  $out->addWikiMsg( 'linkstoimage-more',
866  $this->getContext()->getLanguage()->formatNum( $limit ),
867  $this->getTitle()->getPrefixedDBkey()
868  );
869  }
870 
871  $out->addHTML(
872  Html::openElement( 'ul',
873  [ 'class' => 'mw-imagepage-linkstoimage' ] ) . "\n"
874  );
875  $count = 0;
876 
877  // Sort the list by namespace:title
878  usort( $rows, [ $this, 'compare' ] );
879 
880  // Create links for every element
881  $currentCount = 0;
882  foreach ( $rows as $element ) {
883  $currentCount++;
884  if ( $currentCount > $limit ) {
885  break;
886  }
887 
888  $query = [];
889  # Add a redirect=no to make redirect pages reachable
890  if ( isset( $redirects[$element->page_title] ) ) {
891  $query['redirect'] = 'no';
892  }
893  $link = Linker::linkKnown(
894  Title::makeTitle( $element->page_namespace, $element->page_title ),
895  null, [], $query
896  );
897  if ( !isset( $redirects[$element->page_title] ) ) {
898  # No redirects
899  $liContents = $link;
900  } elseif ( count( $redirects[$element->page_title] ) === 0 ) {
901  # Redirect without usages
902  $liContents = $this->getContext()->msg( 'linkstoimage-redirect' )
903  ->rawParams( $link, '' )
904  ->parse();
905  } else {
906  # Redirect with usages
907  $li = '';
908  foreach ( $redirects[$element->page_title] as $row ) {
909  $currentCount++;
910  if ( $currentCount > $limit ) {
911  break;
912  }
913 
914  $link2 = Linker::linkKnown( Title::makeTitle( $row->page_namespace, $row->page_title ) );
915  $li .= Html::rawElement(
916  'li',
917  [ 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
918  $link2
919  ) . "\n";
920  }
921 
923  'ul',
924  [ 'class' => 'mw-imagepage-redirectstofile' ],
925  $li
926  ) . "\n";
927  $liContents = $this->getContext()->msg( 'linkstoimage-redirect' )->rawParams(
928  $link, $ul )->parse();
929  }
930  $out->addHTML( Html::rawElement(
931  'li',
932  [ 'class' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
933  $liContents
934  ) . "\n"
935  );
936 
937  }
938  $out->addHTML( Html::closeElement( 'ul' ) . "\n" );
939  $res->free();
940 
941  // Add a links to [[Special:Whatlinkshere]]
942  if ( $count > $limit ) {
943  $out->addWikiMsg( 'morelinkstoimage', $this->getTitle()->getPrefixedDBkey() );
944  }
945  $out->addHTML( Html::closeElement( 'div' ) . "\n" );
946  }
947 
948  protected function imageDupes() {
949  $this->loadFile();
950  $out = $this->getContext()->getOutput();
951 
952  $dupes = $this->mPage->getDuplicates();
953  if ( count( $dupes ) == 0 ) {
954  return;
955  }
956 
957  $out->addHTML( "<div id='mw-imagepage-section-duplicates'>\n" );
958  $out->addWikiMsg( 'duplicatesoffile',
959  $this->getContext()->getLanguage()->formatNum( count( $dupes ) ), $this->getTitle()->getDBkey()
960  );
961  $out->addHTML( "<ul class='mw-imagepage-duplicates'>\n" );
962 
966  foreach ( $dupes as $file ) {
967  $fromSrc = '';
968  if ( $file->isLocal() ) {
969  $link = Linker::linkKnown( $file->getTitle() );
970  } else {
971  $link = Linker::makeExternalLink( $file->getDescriptionUrl(),
972  $file->getTitle()->getPrefixedText() );
973  $fromSrc = $this->getContext()->msg(
974  'shared-repo-from',
975  $file->getRepo()->getDisplayName()
976  )->escaped();
977  }
978  $out->addHTML( "<li>{$link} {$fromSrc}</li>\n" );
979  }
980  $out->addHTML( "</ul></div>\n" );
981  }
982 
986  public function delete() {
987  $file = $this->mPage->getFile();
988  if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
989  // Standard article deletion
990  parent::delete();
991  return;
992  }
993  '@phan-var LocalFile $file';
994 
995  $deleter = new FileDeleteForm( $file );
996  $deleter->execute();
997  }
998 
1004  function showError( $description ) {
1005  $out = $this->getContext()->getOutput();
1006  $out->setPageTitle( $this->getContext()->msg( 'internalerror' ) );
1007  $out->setRobotPolicy( 'noindex,nofollow' );
1008  $out->setArticleRelated( false );
1009  $out->enableClientCache( false );
1010  $out->addWikiTextAsInterface( $description );
1011  }
1012 
1021  protected function compare( $a, $b ) {
1022  return $a->page_namespace <=> $b->page_namespace
1023  ?: strcmp( $a->page_title, $b->page_title );
1024  }
1025 
1034  public function getImageLimitsFromOption( $user, $optionName ) {
1035  global $wgImageLimits;
1036 
1037  $option = $user->getIntOption( $optionName );
1038  if ( !isset( $wgImageLimits[$option] ) ) {
1039  $option = User::getDefaultOption( $optionName );
1040  }
1041 
1042  // The user offset might still be incorrect, specially if
1043  // $wgImageLimits got changed (see T10858).
1044  if ( !isset( $wgImageLimits[$option] ) ) {
1045  // Default to the first offset in $wgImageLimits
1046  $option = 0;
1047  }
1048 
1049  // if nothing is set, fallback to a hardcoded default
1050  return $wgImageLimits[$option] ?? [ 800, 600 ];
1051  }
1052 
1060  protected function doRenderLangOpt( array $langChoices, $renderLang ) {
1061  global $wgScript;
1062  $opts = '';
1063 
1064  $matchedRenderLang = $this->displayImg->getMatchedLanguage( $renderLang );
1065 
1066  foreach ( $langChoices as $lang ) {
1067  $opts .= $this->createXmlOptionStringForLanguage(
1068  $lang,
1069  $matchedRenderLang === $lang
1070  );
1071  }
1072 
1073  // Allow for the default case in an svg <switch> that is displayed if no
1074  // systemLanguage attribute matches
1075  $opts .= "\n" .
1076  Xml::option(
1077  $this->getContext()->msg( 'img-lang-default' )->text(),
1078  'und',
1079  is_null( $matchedRenderLang )
1080  );
1081 
1082  $select = Html::rawElement(
1083  'select',
1084  [ 'id' => 'mw-imglangselector', 'name' => 'lang' ],
1085  $opts
1086  );
1087  $submit = Xml::submitButton( $this->getContext()->msg( 'img-lang-go' )->text() );
1088 
1089  $formContents = $this->getContext()->msg( 'img-lang-info' )
1090  ->rawParams( $select, $submit )
1091  ->parse();
1092  $formContents .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
1093 
1094  $langSelectLine = Html::rawElement( 'div', [ 'id' => 'mw-imglangselector-line' ],
1095  Html::rawElement( 'form', [ 'action' => $wgScript ], $formContents )
1096  );
1097  return $langSelectLine;
1098  }
1099 
1105  private function createXmlOptionStringForLanguage( $lang, $selected ) {
1106  $code = LanguageCode::bcp47( $lang );
1107  $name = Language::fetchLanguageName( $code, $this->getContext()->getLanguage()->getCode() );
1108  if ( $name !== '' ) {
1109  $display = $this->getContext()->msg( 'img-lang-opt', $code, $name )->text();
1110  } else {
1111  $display = $code;
1112  }
1113  return "\n" .
1114  Xml::option(
1115  $display,
1116  $lang,
1117  $selected
1118  );
1119  }
1120 
1135  protected function getDisplayWidthHeight( $maxWidth, $maxHeight, $width, $height ) {
1136  if ( !$maxWidth || !$maxHeight ) {
1137  // should never happen
1138  throw new MWException( 'Using a choice from $wgImageLimits that is 0x0' );
1139  }
1140 
1141  if ( !$width || !$height ) {
1142  return [ 0, 0 ];
1143  }
1144 
1145  # Calculate the thumbnail size.
1146  if ( $width <= $maxWidth && $height <= $maxHeight ) {
1147  // Vectorized image, do nothing.
1148  } elseif ( $width / $height >= $maxWidth / $maxHeight ) {
1149  # The limiting factor is the width, not the height.
1150  $height = round( $height * $maxWidth / $width );
1151  $width = $maxWidth;
1152  # Note that $height <= $maxHeight now.
1153  } else {
1154  $newwidth = floor( $width * $maxHeight / $height );
1155  $height = round( $height * $newwidth / $width );
1156  $width = $newwidth;
1157  # Note that $height <= $maxHeight now, but might not be identical
1158  # because of rounding.
1159  }
1160  return [ $width, $height ];
1161  }
1162 
1171  protected function getThumbSizes( $origWidth, $origHeight ) {
1172  global $wgImageLimits;
1173  if ( $this->displayImg->getRepo()->canTransformVia404() ) {
1174  $thumbSizes = $wgImageLimits;
1175  // Also include the full sized resolution in the list, so
1176  // that users know they can get it. This will link to the
1177  // original file asset if mustRender() === false. In the case
1178  // that we mustRender, some users have indicated that they would
1179  // find it useful to have the full size image in the rendered
1180  // image format.
1181  $thumbSizes[] = [ $origWidth, $origHeight ];
1182  } else {
1183  # Creating thumb links triggers thumbnail generation.
1184  # Just generate the thumb for the current users prefs.
1185  $thumbSizes = [
1186  $this->getImageLimitsFromOption( $this->getContext()->getUser(), 'thumbsize' )
1187  ];
1188  if ( !$this->displayImg->mustRender() ) {
1189  // We can safely include a link to the "full-size" preview,
1190  // without actually rendering.
1191  $thumbSizes[] = [ $origWidth, $origHeight ];
1192  }
1193  }
1194  return $thumbSizes;
1195  }
1196 
1201  public function getFile() {
1202  return $this->mPage->getFile();
1203  }
1204 
1209  public function isLocal() {
1210  return $this->mPage->isLocal();
1211  }
1212 
1217  public function getDuplicates() {
1218  return $this->mPage->getDuplicates();
1219  }
1220 
1225  public function getForeignCategories() {
1226  return $this->mPage->getForeignCategories();
1227  }
1228 
1229 }
User\getDefaultOption
static getDefaultOption( $opt)
Get a given default option value.
Definition: User.php:1734
$wgSend404Code
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
Definition: DefaultSettings.php:3546
ImagePage\makeSizeLink
makeSizeLink( $params, $width, $height)
Creates an thumbnail of specified size and returns an HTML link to it.
Definition: ImagePage.php:678
ImagePage\getForeignCategories
getForeignCategories()
Definition: ImagePage.php:1225
Language\fetchLanguageName
static fetchLanguageName( $code, $inLanguage=self::AS_AUTONYMS, $include=self::ALL)
Definition: Language.php:832
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:42
wfMessageFallback
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
Definition: GlobalFunctions.php:1286
ParserOutput
Definition: ParserOutput.php:25
ImagePage\getUploadUrl
getUploadUrl()
Definition: ImagePage.php:730
ImagePage\createXmlOptionStringForLanguage
createXmlOptionStringForLanguage( $lang, $selected)
Definition: ImagePage.php:1105
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
ImagePage\closeShowImage
closeShowImage()
For overloading.
Definition: ImagePage.php:779
ImagePage\openShowImage
openShowImage()
Definition: ImagePage.php:313
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
ImagePage\getFile
getFile()
Definition: ImagePage.php:1201
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:206
$wgSVGMaxSize
$wgSVGMaxSize
Don't scale a SVG larger than this.
Definition: DefaultSettings.php:1239
ImagePage\$fileLoaded
bool $fileLoaded
Definition: ImagePage.php:42
ImagePage\uploadLinksBox
uploadLinksBox()
Add the re-upload link (or message about not being able to re-upload) to the output.
Definition: ImagePage.php:742
NS_FILE
const NS_FILE
Definition: Defines.php:75
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
Xml\option
static option( $text, $value=null, $selected=false, $attribs=[])
Convenience function to build an HTML drop-down list item.
Definition: Xml.php:484
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:141
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:83
Linker\processResponsiveImages
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
Definition: Linker.php:642
ImagePage
Definition: ImagePage.php:34
Wikimedia\Rdbms\ResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: ResultWrapper.php:23
$res
$res
Definition: testCompression.php:52
Linker\makeThumbLinkObj
static makeThumbLinkObj(LinkTarget $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
Definition: Linker.php:493
ImagePage\setFile
setFile( $file)
Definition: ImagePage.php:60
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:108
ImagePage\$repo
FileRepo $repo
Definition: ImagePage.php:39
$dbr
$dbr
Definition: testCompression.php:50
ImagePage\getLanguageForRendering
getLanguageForRendering(WebRequest $request, File $file)
Returns language code to be used for dispaying the image, based on request context and languages avai...
Definition: ImagePage.php:298
FileRepo
Base class for file repositories.
Definition: FileRepo.php:39
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:315
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:61
MWException
MediaWiki exception.
Definition: MWException.php:26
Article\getTitle
getTitle()
Get the title object of the article.
Definition: Article.php:221
ImagePage\showTOC
showTOC( $metadata)
Create the TOC.
Definition: ImagePage.php:225
ImagePage\imageLinks
imageLinks()
Definition: ImagePage.php:819
getPermissionManager
getPermissionManager()
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2555
ImagePage\getDisplayWidthHeight
getDisplayWidthHeight( $maxWidth, $maxHeight, $width, $height)
Get the width and height to display image at.
Definition: ImagePage.php:1135
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:41
ImagePage\newPage
newPage(Title $title)
Definition: ImagePage.php:51
Article\getContext
getContext()
Gets the context this Article is executed in.
Definition: Article.php:2267
FileDeleteForm
File deletion user interface.
Definition: FileDeleteForm.php:31
$title
$title
Definition: testCompression.php:34
Linker\makeExternalLink
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
Definition: Linker.php:848
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:586
LogEventsList\showLogExtract
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Definition: LogEventsList.php:619
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
ImagePage\showError
showError( $description)
Display an error with a wikitext description.
Definition: ImagePage.php:1004
ImagePage\view
view()
This is the default action of the index.php entry point: just view the page of the given title.
Definition: ImagePage.php:89
ImagePage\imageDupes
imageDupes()
Definition: ImagePage.php:948
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:802
FileRepo\getDisplayName
getDisplayName()
Get the human-readable name of the repo.
Definition: FileRepo.php:1794
ImagePage\makeMetadataTable
makeMetadataTable( $metadata)
Make a table with metadata to be shown in the output page.
Definition: ImagePage.php:251
ImagePage\getThumbPrevText
getThumbPrevText( $params, $sizeLinkBigImagePreview)
Make the text under the image to say what size preview.
Definition: ImagePage.php:640
ImagePage\getThumbSizes
getThumbSizes( $origWidth, $origHeight)
Get alternative thumbnail sizes.
Definition: ImagePage.php:1171
$ul
$ul
Definition: upgradeLogging.php:218
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1531
ImagePage\getDisplayedFile
getDisplayedFile()
Definition: ImagePage.php:214
WebRequest
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Definition: WebRequest.php:42
$wgImageLimits
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
Definition: DefaultSettings.php:1482
Title
Represents a title within MediaWiki.
Definition: Title.php:42
ImagePage\queryImageLinks
queryImageLinks( $target, $limit)
Definition: ImagePage.php:807
Article\getUser
getUser( $audience=RevisionRecord::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
Definition: Article.php:2589
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:117
UploadBase\userCanReUpload
static userCanReUpload(User $user, File $img)
Check if a user is the last uploader.
Definition: UploadBase.php:1978
WebRequest\getVal
getVal( $name, $default=null)
Fetch a scalar from the input or return $default if it's not set.
Definition: WebRequest.php:483
ImagePage\$displayImg
File false $displayImg
Definition: ImagePage.php:36
ImagePage\doRenderLangOpt
doRenderLangOpt(array $langChoices, $renderLang)
Output a drop-down box for language options for the file.
Definition: ImagePage.php:1060
LanguageCode\bcp47
static bcp47( $code)
Get the normalised IETF language tag See unit test for examples.
Definition: LanguageCode.php:178
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
$wgEnableUploads
$wgEnableUploads
Allow users to upload files.
Definition: DefaultSettings.php:423
ImagePage\compare
compare( $a, $b)
Callback for usort() to do link sorts by (namespace, title) Function copied from Title::compare()
Definition: ImagePage.php:1021
Article\getId
getId()
Call to WikiPage function for backwards compatibility.
Definition: Article.php:2501
ImagePage\getImageLimitsFromOption
getImageLimitsFromOption( $user, $optionName)
Returns the corresponding $wgImageLimits entry for the selected user option.
Definition: ImagePage.php:1034
$ext
if(!is_readable( $file)) $ext
Definition: router.php:48
WikiFilePage
Special handling for file pages.
Definition: WikiFilePage.php:31
ImageHistoryPseudoPager
Definition: ImageHistoryPseudoPager.php:23
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:38
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
ImagePage\loadFile
loadFile()
Definition: ImagePage.php:66
ImagePage\isLocal
isLocal()
Definition: ImagePage.php:1209
Article\getOldID
getOldID()
Definition: Article.php:326
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
ImagePage\$mExtraDescription
bool $mExtraDescription
Definition: ImagePage.php:45
ImagePage\getEmptyPageParserOutput
getEmptyPageParserOutput(ParserOptions $options)
Overloading Article's getEmptyPageParserOutput method.
Definition: ImagePage.php:282
$wgShowEXIF
$wgShowEXIF
Show Exif data, on by default if available.
Definition: DefaultSettings.php:825
ImagePage\getDuplicates
getDuplicates()
Definition: ImagePage.php:1217
ImagePage\printSharedImageText
printSharedImageText()
Show a notice that the file is from a shared repository.
Definition: ImagePage.php:697
ImagePage\imageHistory
imageHistory()
If the page we've just displayed is in the "Image" namespace, we follow it with an upload history of ...
Definition: ImagePage.php:786
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459
$type
$type
Definition: testCompression.php:48