/** * Get the IContextSource in use here * @return IContextSource */ public final function getContext() { if ($this->context instanceof IContextSource) { return $this->context; } return $this->page->getContext(); }
/** * Get the IContextSource in use here * @return IContextSource */ final public function getContext() { if ( $this->context instanceof IContextSource ) { return $this->context; } else if ( $this->page instanceof Article ) { // NOTE: $this->page can be a WikiPage, which does not have a context. wfDebug( __METHOD__ . ': no context known, falling back to Article\'s context.' ); return $this->page->getContext(); } wfWarn( __METHOD__ . ': no context known, falling back to RequestContext::getMain().' ); return RequestContext::getMain(); }
/** * Handler for CategoryPageView hook * Add JavaScript to the page if there are images in the category * @param CategoryPage $catPage * @return bool */ public static function getModulesForCategory(&$catPage) { $title = $catPage->getTitle(); $cat = Category::newFromTitle($title); if ($cat->getFileCount() > 0) { $out = $catPage->getContext()->getOutput(); return self::getModules($out); } return true; }