parent = $parent; } public function addHTML( $html ) { $this->contents .= $html; $this->flush(); } public function addWikiText( $text ) { $this->addHTML( $this->parent->parse( $text ) ); } public function addHTMLNoFlush( $html ) { $this->contents .= $html; } 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 raw vector CSS, flipping if needed * @param string $dir 'ltr' or 'rtl' * @return String */ public function getCSS( $dir ) { $skinDir = dirname( dirname( __DIR__ ) ) . '/skins'; // All these files will be concatenated in sequence and loaded // as one file. // The string 'images/' in the files' contents will be replaced // by '../skins/$skinName/images/', where $skinName is what appears // before the last '/' in each of the strings. $cssFileNames = array( // Basically the "skins.vector" ResourceLoader module styles 'common/shared.css', 'common/commonElements.css', 'common/commonContent.css', 'common/commonInterface.css', 'vector/screen.css', // mw-config specific 'common/config.css', ); $css = ''; wfSuppressWarnings(); foreach ( $cssFileNames as $cssFileName ) { $fullCssFileName = "$skinDir/$cssFileName"; $cssFileContents = file_get_contents( $fullCssFileName ); if ( $cssFileContents ) { preg_match( "/^(\w+)\//", $cssFileName, $match ); $skinName = $match[1]; $css .= str_replace( 'images/', "../skins/$skinName/images/", $cssFileContents ); } else { $css .= "/** Your webserver cannot read $fullCssFileName. Please check file permissions. */"; } $css .= "\n"; } wfRestoreWarnings(); if( $dir == 'rtl' ) { $css = CSSJanus::transform( $css, true ); } return $css; } /** * "" to index.php?css=foobar for the "" * @return String */ private function getCssUrl() { return Html::linkedStyle( $_SERVER['PHP_SELF'] . '?css=' . $this->getDir() ); } 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 array */ 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; $dbTypes = $this->parent->getDBTypes(); $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 ) { ?>
parent->parse( wfMessage( 'config-sidebar' )->plain(), true ); ?>
getHeadAttribs() ); ?> <?php $this->outputTitle(); ?> getCssUrl() . "\n"; ?> getJQuery(); ?> escaped(); } public function getJQuery() { return Html::linkedScript( "../resources/jquery/jquery.js" ); } }