45 private $contents =
'';
51 private $headerDone =
false;
66 $this->contents .= $html;
75 $this->
addHTML( $this->parent->parse( $text ) );
82 $this->contents .= $html;
90 throw new LogicException( __METHOD__ .
' called after sending headers' );
92 $this->redirectTarget =
$url;
98 if ( !$this->redirectTarget ) {
113 'lang' => $this->getLanguage()->getCode(),
120 'interface-message-box'
123 'mw-config/config.css',
126 $module->setConfig( $resourceLoader->getConfig() );
129 $styles = ResourceLoader::makeCombinedStyles(
130 $module->readStyleFiles(
131 $module->getStyleFiles( $rlContext ),
136 return implode(
"\n", $styles );
144 private function getCssUrl() {
145 return Html::linkedStyle( $this->parent->getUrl( [
'css' => 1 ] ) );
152 if ( !$this->redirectTarget && strlen( $this->contents ) ) {
153 echo $this->contents;
155 $this->contents =
'';
163 private function getLanguage() {
164 return RequestContext::getMain()->getLanguage();
172 'dir' => $this->getLanguage()->getDir(),
173 'lang' => $this->getLanguage()->getHtmlCode(),
183 return $this->headerDone;
188 $this->parent->request->response()->header(
'Content-Type: text/html; charset=utf-8' );
189 $this->parent->request->response()->header(
'X-Frame-Options: DENY' );
191 $cspPolicy =
"default-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none';" .
192 " script-src 'self' 'nonce-" . $this->
getCSPNonce() .
"';" .
193 " img-src 'self'; frame-src 'self'; base-uri 'none'";
195 $this->parent->request->response()->header(
'Content-Security-Policy: ' . $cspPolicy );
197 if ( $this->redirectTarget ) {
198 $this->parent->request->response()->header(
'Location: ' . $this->redirectTarget );
206 <meta name=
"robots" content=
"noindex, nofollow" />
207 <meta http-equiv=
"Content-type" content=
"text/html; charset=utf-8" />
209 <?php echo $this->
getCodex() .
"\n"; ?>
210 <?php echo $this->getCssUrl() .
"\n"; ?>
212 <?php echo Html::linkedScript(
'config.js' ) .
"\n"; ?>
215<?php echo Html::openElement(
'body', [
'class' => $this->getLanguage()->getDir() ] ) .
"\n"; ?>
216<div
id=
"mw-page-base"></div>
217<div
id=
"mw-head-base"></div>
218<div
id=
"content" class=
"mw-body" role=
"main">
219<div
id=
"bodyContent" class=
"mw-body-content">
231 <div
class=
"portal" id=
"p-logo">
232 <a href=
"https://www.mediawiki.org/" title=
"Main Page"></a>
236 $message =
wfMessage(
'config-sidebar' )->plain();
239 foreach ( explode(
'----', $message ) as $section ) {
240 echo
'<div class="portal"><div class="body">';
241 echo $this->parent->parse( $section,
true );
245 echo
'<div class="portal"><div class="body"><ul>';
247 'config-sidebar-relnotes' =>
'ReleaseNotes',
248 'config-sidebar-license' =>
'Copying',
249 'config-sidebar-upgrade' =>
'UpgradeDoc',
250 ] as $msgKey => $pageName ) {
251 echo $this->parent->makeLinkItem(
252 $this->parent->getDocUrl( $pageName ),
256 echo
'</ul></div></div>';
262 echo Html::closeElement(
'body' ) . Html::closeElement(
'html' );
273 return Html::linkedScript(
"../resources/lib/jquery/jquery.js" );
280 return Html::linkedStyle(
"../resources/lib/codex/codex.style.css" );
291 if ( $nonce ===
null ) {
293 $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.
Group all the pieces relevant to the context of a request into one instance.
Context object that contains information about the state of a specific ResourceLoader web request.