public function execute($parameters)
 {
     $out = $this->getOutput();
     $skin = $this->getSkin();
     $this->setHeaders();
     $out->setArticleBodyOnly(true);
     // Default modules copied from OutputPage::addDefaultModules
     $out->addModules(array('mediawiki.user', 'mediawiki.page.startup', 'mediawiki.page.ready'));
     $out->addModules(array('ext.cx.header', 'ext.cx.stats'));
     // Load legacy modules if any, for the skin.
     // Some wikis have Common.js scripts that depend on this module.
     $defaultSkinModules = $skin->getDefaultModules();
     $out->addModules($defaultSkinModules['legacy']);
     Hooks::run('BeforePageDisplay', array(&$out, &$skin));
     $out->addHTML($out->headElement($skin));
     $out->addHTML(Html::element('noscript', array(), $this->msg('cx-javascript')->text()));
     $out->addHtml(MWDebug::getDebugHTML($this->getContext()));
     $toolbarList = Html::rawElement('ul', null, $skin->getPersonalToolsList());
     $out->addHTML(Html::rawElement('div', array('id' => 'p-personal'), $toolbarList));
     $out->addHTML($skin->bottomScripts());
     $out->addHTML('</body></html>');
 }
Пример #2
0
 /**
  * Output the basic end-page trail including bottomscripts, reporttime, and
  * debug stuff. This should be called right before outputting the closing
  * body and html tags.
  */
 function printTrail()
 {
     echo MWDebug::getDebugHTML($this->getSkin()->getContext());
     $this->html('bottomscripts');
     /* JS call to runBodyOnloadHook */
     $this->html('reporttime');
 }
 public function execute($parameters)
 {
     global $wgContentTranslationUseMagnusTool, $wgContentTranslationTranslateInTarget;
     $out = $this->getOutput();
     $skin = $this->getSkin();
     $request = $this->getRequest();
     $user = $this->getUser();
     $hasToken = $this->hasToken();
     $campaign = $request->getVal('campaign');
     $isCampaign = $this->isValidCampaign($campaign);
     // Direct access, isListed only affects Special:SpecialPages
     if (!ContentTranslationHooks::isEnabledForUser($user)) {
         if ($hasToken || $isCampaign) {
             // User has a token. Enabled cx for the user in this wiki.
             $this->enableCXBetaFeature();
         } else {
             if ($campaign) {
                 // Show login page if the URL has campaign parameter
                 $out->showPermissionsErrorPage(array(array('badaccess-groups')), 'edit');
                 return;
             }
             $out->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
             return;
         }
     }
     // Preloading to avoid FOUC
     $out->addModuleStyles('ext.cx.header.skin');
     if ($hasToken) {
         $out->addModules('ext.cx.translationview');
         // If Wikibase is installed, load the module for linking
         // the published article with the source article
         if ($wgContentTranslationTranslateInTarget && defined('WBC_VERSION')) {
             $out->addModules('ext.cx.wikibase.link');
         }
     } else {
         $out->addModules('ext.cx.dashboard');
         if ($wgContentTranslationUseMagnusTool) {
             $out->addModules('ext.cx.magnuslink');
         }
     }
     $this->setHeaders();
     $out->setArticleBodyOnly(true);
     // Default modules copied from OutputPage::addDefaultModules
     $out->addModules(array('mediawiki.user', 'mediawiki.page.startup', 'mediawiki.page.ready'));
     // Load legacy modules if any, for the skin.
     // Some wikis have Common.js scripts that depend on this module.
     $defaultSkinModules = $skin->getDefaultModules();
     $out->addModules($defaultSkinModules['legacy']);
     Hooks::run('BeforePageDisplay', array(&$out, &$skin));
     // T111668: Make sure we generate the personal tools
     // before we output the head, as extensions may add
     // things using the PersonalUrls hook.
     $toolbarList = Html::rawElement('ul', null, $skin->getPersonalToolsList());
     $out->addHTML($out->headElement($skin));
     $out->addHTML(Html::element('noscript', array(), $this->msg('cx-javascript')->text()));
     $out->addHtml(MWDebug::getDebugHTML($this->getContext()));
     $out->addHTML(Html::rawElement('div', array('id' => 'p-personal'), $toolbarList));
     $out->addHTML($skin->bottomScripts());
     $out->addHTML('</body></html>');
 }
Пример #4
0
 function printTrail()
 {
     echo MWDebug::getDebugHTML($this->getSkin()->getContext());
 }
Пример #5
0
 /**
  * Generate debug data HTML for displaying at the bottom of the main content
  * area.
  * @return String HTML containing debug data, if enabled (otherwise empty).
  */
 protected function generateDebugHTML()
 {
     global $wgShowDebug;
     $html = MWDebug::getDebugHTML($this->getContext());
     if ($wgShowDebug) {
         $listInternals = $this->formatDebugHTML($this->getOutput()->mDebugtext);
         $html .= "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">" . $listInternals . "</ul>\n";
     }
     return $html;
 }
Пример #6
0
 /**
  * Render the entire page
  * @param array $data Data used to build the page
  * @todo replace with template engines
  */
 protected function render($data)
 {
     $templateParser = new TemplateParser(__DIR__);
     $internalBanner = $data['internalBanner'];
     $preBodyText = isset($data['prebodyhtml']) ? $data['prebodyhtml'] : '';
     $data = array_merge($data, array('hasHistory' => isset($data['historyLink']), 'hasSubjectPage' => isset($data['subject-page']), 'isSpecialPage' => $this->isSpecialPage, 'hasPageActions' => count($this->getPageActions()), 'hasPreBodyText' => $internalBanner || $preBodyText || isset($data['page_actions']), 'footerRows' => $this->getFooterRows($data), 'debug' => MWDebug::getDebugHTML($this->getSkin()->getContext()), 'pageactionshtml' => $this->getPageActionsHtml($data), 'secondaryactionshtml' => $this->getSecondaryActionsHtml(), 'searchhtml' => $this->getSearchForm($data)));
     echo $templateParser->processTemplate('minervaNeue', $data);
 }