Esempio n. 1
0
 /**
  * @param ImagePage $imagePage
  */
 public function __construct($imagePage)
 {
     global $wgShowArchiveThumbnails;
     $this->current = $imagePage->getPage()->getFile();
     $this->img = $imagePage->getDisplayedFile();
     $this->title = $imagePage->getTitle();
     $this->imagePage = $imagePage;
     $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
     $this->setContext($imagePage->getContext());
 }
 /**
  * Get a Filepage as parsed HTML
  * @param Title $title
  * @return string
  */
 private function getFilePage(Title $title)
 {
     // HACK: HACK: HACK:
     $context = new DerivativeContext($this->getContext());
     $context->setTitle($title);
     $context->setOutput(new OutputPage($context));
     $page = new ImagePage($title);
     $page->setContext($context);
     // T123821: Without setting the wiki page on the derivative context,
     // DerivativeContext#getWikiPage will (eventually) fall back to
     // RequestContext#getWikiPage. Here, the request context is distinct from the
     // derivative context and deliberately constructed with a bad title in the prelude
     // of api.php.
     $context->setWikiPage($page->getPage());
     $page->view();
     $html = $context->getOutput()->getHTML();
     return $html;
 }