Unify MonoBook <head> generation with legacy skins
[lhc/web/wiklou.git] / skins / MonoBook.php
index 00b7141..d380e2a 100644 (file)
@@ -64,49 +64,23 @@ class MonoBookTemplate extends QuickTemplate {
         * @access private
         */
        function execute() {
-               global $wgRequest;
+               global $wgRequest, $wgOut, $wgStyleVersion, $wgJsMimeType, $wgStylePath;
                $this->skin = $skin = $this->data['skin'];
                $action = $wgRequest->getText( 'action' );
 
                // Suppress warnings to prevent notices about missing indexes in $this->data
                wfSuppressWarnings();
 
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
-       foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
-               ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
-       } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
-       <head>
-               <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
-               <?php $this->html('headlinks') ?>
-               <title><?php $this->text('pagetitle') ?></title>
-               <?php $this->html('csslinks') ?>
-
-               <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
-               <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
+               $path = htmlspecialchars( $wgStylePath );
+               $wgOut->addScript( <<<HTML
+<!--[if lt IE 7]><script type="$wgJsMimeType" src="$path/common/IEFixes.js?$wgStyleVersion"></script>
+       <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
+HTML
+               );
 
-               <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
+               echo $wgOut->headElement( $this->skin );
 
-               <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
-<?php $this->html('headscripts') ?>
-<?php  if($this->data['jsvarurl']) { ?>
-               <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"></script>
-<?php  } ?>
-<?php  if($this->data['pagecss']) { ?>
-               <style type="text/css"><?php $this->html('pagecss') ?></style>
-<?php  }
-               if($this->data['usercss']) { ?>
-               <style type="text/css"><?php $this->html('usercss') ?></style>
-<?php  }
-               if($this->data['userjs']) { ?>
-               <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
-<?php  }
-               if($this->data['userjsprev']) { ?>
-               <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
-<?php  }
-               if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
-       </head>
-<body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
+?><body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
 <?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
  class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
        <div id="globalWrapper">