parent = $parent; } /** * @param string $html */ public function addHTML( $html ) { $this->contents .= $html; $this->flush(); } /** * @param string $text */ public function addWikiText( $text ) { $this->addHTML( $this->parent->parse( $text ) ); } /** * @param string $html */ public function addHTMLNoFlush( $html ) { $this->contents .= $html; } /** * @param string $url * * @throws MWException */ public function redirect( $url ) { if ( $this->headerDone ) { throw new MWException( __METHOD__ . ' called after sending headers' ); } $this->redirectTarget = $url; } public function output() { $this->flush(); $this->outputFooter(); } /** * Get the stylesheet of the MediaWiki skin. * * @return string */ public function getCSS() { global $wgStyleDirectory; $moduleNames = array( // See SkinTemplate::setupSkinUserCss 'mediawiki.legacy.shared', // See Vector::setupSkinUserCss 'mediawiki.skinning.interface', ); if ( file_exists( "$wgStyleDirectory/Vector/Vector.php" ) ) { // Force loading Vector skin if available as a fallback skin // for whatever ResourceLoader wants to have as the default. // Include instead of require, as this will work without it, it will just look bad. // We need the 'global' statement for $wgResourceModules because the Vector skin adds the // definitions for its RL modules there that we use implicitly below. // @codingStandardsIgnoreStart global $wgResourceModules; // This is NOT UNUSED! // @codingStandardsIgnoreEnd include_once "$wgStyleDirectory/Vector/Vector.php"; $moduleNames[] = 'skins.vector.styles'; } $moduleNames[] = 'mediawiki.legacy.config'; $resourceLoader = new ResourceLoader(); $rlContext = new ResourceLoaderContext( $resourceLoader, new FauxRequest( array( 'debug' => 'true', 'lang' => $this->getLanguageCode(), 'only' => 'styles', ) ) ); $styles = array(); foreach ( $moduleNames as $moduleName ) { /** @var ResourceLoaderFileModule $module */ $module = $resourceLoader->getModule( $moduleName ); // Based on: ResourceLoaderFileModule::getStyles (without the DB query) $styles = array_merge( $styles, ResourceLoader::makeCombinedStyles( $module->readStyleFiles( $module->getStyleFiles( $rlContext ), $module->getFlip( $rlContext ) ) ) ); } return implode( "\n", $styles ); } /** * "" to index.php?css=1 for the "" * * @return string */ private function getCssUrl() { return Html::linkedStyle( $_SERVER['PHP_SELF'] . '?css=1' ); } public function useShortHeader( $use = true ) { $this->useShortHeader = $use; } public function allowFrames( $allow = true ) { $this->allowFrames = $allow; } public function flush() { if ( !$this->headerDone ) { $this->outputHeader(); } if ( !$this->redirectTarget && strlen( $this->contents ) ) { echo $this->contents; flush(); $this->contents = ''; } } /** * @return string */ public function getDir() { global $wgLang; return is_object( $wgLang ) ? $wgLang->getDir() : 'ltr'; } /** * @return string */ public function getLanguageCode() { global $wgLang; return is_object( $wgLang ) ? $wgLang->getCode() : 'en'; } /** * @return string[] */ public function getHeadAttribs() { return array( 'dir' => $this->getDir(), 'lang' => $this->getLanguageCode(), ); } /** * Get whether the header has been output * * @return bool */ public function headerDone() { return $this->headerDone; } public function outputHeader() { $this->headerDone = true; $this->parent->request->response()->header( 'Content-Type: text/html; charset=utf-8' ); if ( !$this->allowFrames ) { $this->parent->request->response()->header( 'X-Frame-Options: DENY' ); } if ( $this->redirectTarget ) { $this->parent->request->response()->header( 'Location: ' . $this->redirectTarget ); return; } if ( $this->useShortHeader ) { $this->outputShortHeader(); return; } ?> getHeadAttribs() ); ?> <?php $this->outputTitle(); ?> getCssUrl() . "\n"; ?> getJQuery() . "\n"; ?> $this->getDir() ) ) . "\n"; ?>

outputTitle(); ?>

useShortHeader ) { echo Html::closeElement( 'body' ) . Html::closeElement( 'html' ); return; } ?>
parent->parse( wfMessage( 'config-sidebar' )->plain(), true ); ?>
getHeadAttribs() ); ?> <?php $this->outputTitle(); ?> getCssUrl() . "\n"; ?> getJQuery(); ?> escaped(); } /** * @return string */ public function getJQuery() { return Html::linkedScript( "../resources/lib/jquery/jquery.js" ); } }