Installer: Simplify css request
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 4 Jun 2014 19:25:55 +0000 (21:25 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 4 Jun 2014 19:25:55 +0000 (21:25 +0200)
Instead of passing around the direction in the request, just set
'css=1'. We already have the language code and directionality
available and even rely on it between requests to set other
localisation-related things.

Change-Id: I717cb299b3639024e79880039e0d1f2ff273ab44

includes/installer/WebInstaller.php
includes/installer/WebInstallerOutput.php

index 66e8bd9..46348f9 100644 (file)
@@ -180,9 +180,9 @@ class WebInstaller extends Installer {
                        return $this->session;
                }
 
-               $cssDir = $this->request->getVal( 'css' );
-               if ( $cssDir ) {
-                       $this->outputCss( $cssDir );
+               $isCSS = $this->request->getVal( 'css' );
+               if ( $isCSS ) {
+                       $this->outputCss();
                        return $this->session;
                }
 
@@ -1154,12 +1154,11 @@ class WebInstaller extends Installer {
        }
 
        /**
-        * @param string $dir CSS direction ( rtl or ltr )
+        * Output stylesheet for web installer pages
         */
-       public function outputCss( $dir ) {
-               $dir = ( $dir == 'rtl' ? 'rtl' : 'ltr' );
+       public function outputCss() {
                $this->request->response()->header( 'Content-type: text/css' );
-               echo $this->output->getCSS( $dir );
+               echo $this->output->getCSS();
        }
 
        /**
index c3fd51d..fd6ed00 100644 (file)
@@ -125,11 +125,9 @@ class WebInstallerOutput {
         *   designed to be used in, rather than just grabbing a list of filenames from it,
         *   and not properly handling such details as media types in module definitions.
         *
-        * @param string $dir 'ltr' or 'rtl'
-        *
         * @return string
         */
-       public function getCSS( $dir ) {
+       public function getCSS() {
                // All CSS files these modules reference will be concatenated in sequence
                // and loaded as one file.
                $moduleNames = array(
@@ -200,7 +198,7 @@ class WebInstallerOutput {
 
                $css = $prepend . $css;
 
-               if ( $dir == 'rtl' ) {
+               if ( $this->getDir() == 'rtl' ) {
                        $css = CSSJanus::transform( $css, true );
                }
 
@@ -208,12 +206,12 @@ class WebInstallerOutput {
        }
 
        /**
-        * "<link>" to index.php?css=foobar for the "<head>"
+        * "<link>" to index.php?css=1 for the "<head>"
         *
         * @return string
         */
        private function getCssUrl() {
-               return Html::linkedStyle( $_SERVER['PHP_SELF'] . '?css=' . $this->getDir() );
+               return Html::linkedStyle( $_SERVER['PHP_SELF'] . '?css=1' );
        }
 
        public function useShortHeader( $use = true ) {