Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderContext.php
index 2a5169a..0e96c6c 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Context for resource loader modules.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -39,6 +41,7 @@ class ResourceLoaderContext {
        protected $only;
        protected $version;
        protected $hash;
+       protected $raw;
 
        /* Methods */
 
@@ -62,8 +65,11 @@ class ResourceLoaderContext {
                $this->debug     = $request->getFuzzyBool( 'debug', $wgResourceLoaderDebug );
                $this->only      = $request->getVal( 'only' );
                $this->version   = $request->getVal( 'version' );
+               $this->raw       = $request->getFuzzyBool( 'raw' );
 
-               if ( !$this->skin ) {
+               $skinnames = Skin::getSkinNames();
+               // If no skin is specified, or we don't recognize the skin, use the default skin
+               if ( !$this->skin || !isset( $skinnames[$this->skin] ) ) {
                        $this->skin = $wgDefaultSkin;
                }
        }
@@ -155,7 +161,7 @@ class ResourceLoaderContext {
                        $this->direction = $this->request->getVal( 'dir' );
                        if ( !$this->direction ) {
                                # directionality based on user language (see bug 6100)
-                               $this->direction = Language::factory( $this->language )->getDir();
+                               $this->direction = Language::factory( $this->getLanguage() )->getDir();
                        }
                }
                return $this->direction;
@@ -196,6 +202,13 @@ class ResourceLoaderContext {
                return $this->version;
        }
 
+       /**
+        * @return bool
+        */
+       public function getRaw() {
+               return $this->raw;
+       }
+
        /**
         * @return bool
         */