44 private $contents =
'';
50 private $headerDone =
false;
65 $this->contents .= $html;
74 $this->
addHTML( $this->parent->parse( $text ) );
81 $this->contents .= $html;
89 throw new LogicException( __METHOD__ .
' called after sending headers' );
91 $this->redirectTarget =
$url;
97 if ( !$this->redirectTarget ) {
112 'lang' => $this->getLanguage()->getCode(),
119 'interface-message-box'
122 'mw-config/config.css',
125 $module->setConfig( $resourceLoader->getConfig() );
128 $styles = ResourceLoader::makeCombinedStyles(
129 $module->readStyleFiles(
130 $module->getStyleFiles( $rlContext ),
134 return implode(
"\n", $styles );
142 private function getCssUrl() {
143 return Html::linkedStyle( $this->parent->getUrl( [
'css' => 1 ] ) );
150 if ( !$this->redirectTarget && strlen( $this->contents ) ) {
151 echo $this->contents;
153 $this->contents =
'';
161 private function getLanguage() {
173 'dir' => $this->getLanguage()->getDir(),
174 'lang' => $this->getLanguage()->getHtmlCode(),
184 return $this->headerDone;
189 $this->parent->request->response()->header(
'Content-Type: text/html; charset=utf-8' );
190 $this->parent->request->response()->header(
'X-Frame-Options: DENY' );
192 $cspPolicy =
"default-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none';" .
193 " script-src 'self' 'nonce-" . $this->
getCSPNonce() .
"';" .
194 " img-src 'self'; frame-src 'self'; base-uri 'none'";
196 $this->parent->request->response()->header(
'Content-Security-Policy: ' . $cspPolicy );
198 if ( $this->redirectTarget ) {
199 $this->parent->request->response()->header(
'Location: ' . $this->redirectTarget );
207 <meta name=
"robots" content=
"noindex, nofollow" />
208 <meta http-equiv=
"Content-type" content=
"text/html; charset=utf-8" />
210 <?php echo $this->
getCodex() .
"\n"; ?>
211 <?php echo $this->getCssUrl() .
"\n"; ?>
213 <?php echo Html::linkedScript(
'config.js' ) .
"\n"; ?>
216<?php echo Html::openElement(
'body', [
'class' => $this->getLanguage()->getDir() ] ) .
"\n"; ?>
217<div
id=
"mw-page-base"></div>
218<div
id=
"mw-head-base"></div>
219<div
id=
"content" class=
"mw-body" role=
"main">
220<div
id=
"bodyContent" class=
"mw-body-content">
232 <div
class=
"portal" id=
"p-logo">
233 <a href=
"https://www.mediawiki.org/" title=
"Main Page"></a>
237 $message =
wfMessage(
'config-sidebar' )->plain();
240 foreach ( explode(
'----', $message ) as $section ) {
241 echo
'<div class="portal"><div class="body">';
242 echo $this->parent->parse( $section,
true );
246 echo
'<div class="portal"><div class="body"><ul>';
248 'config-sidebar-relnotes' =>
'ReleaseNotes',
249 'config-sidebar-license' =>
'Copying',
250 'config-sidebar-upgrade' =>
'UpgradeDoc',
251 ] as $msgKey => $pageName ) {
252 echo $this->parent->makeLinkItem(
253 $this->parent->getDocUrl( $pageName ),
257 echo
'</ul></div></div>';
263 echo Html::closeElement(
'body' ) . Html::closeElement(
'html' );
274 return Html::linkedScript(
"../resources/lib/jquery/jquery.js" );
281 return Html::linkedStyle(
"../resources/lib/codex/codex.style.css" );
292 if ( $nonce ===
null ) {
294 $nonce = base64_encode( random_bytes( 18 ) );
const MW_VERSION
The running version of MediaWiki.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(MW_ENTRY_POINT==='index') if(!defined( 'MW_NO_SESSION') &&MW_ENTRY_POINT !=='cli' $wgLang
Context object that contains information about the state of a specific ResourceLoader web request.