summaryrefslogtreecommitdiff
path: root/includes/resourceloader/ResourceLoaderContext.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/resourceloader/ResourceLoaderContext.php')
-rw-r--r--includes/resourceloader/ResourceLoaderContext.php50
1 files changed, 47 insertions, 3 deletions
diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php
index bf059b46..326b7c4a 100644
--- a/includes/resourceloader/ResourceLoaderContext.php
+++ b/includes/resourceloader/ResourceLoaderContext.php
@@ -73,6 +73,8 @@ class ResourceLoaderContext {
*/
public static function expandModuleNames( $modules ) {
$retval = array();
+ // For backwards compatibility with an earlier hack, replace ! with .
+ $modules = str_replace( '!', '.', $modules );
$exploded = explode( '|', $modules );
foreach ( $exploded as $group ) {
if ( strpos( $group, ',' ) === false ) {
@@ -98,18 +100,30 @@ class ResourceLoaderContext {
return $retval;
}
+ /**
+ * @return ResourceLoader
+ */
public function getResourceLoader() {
return $this->resourceLoader;
}
-
+
+ /**
+ * @return WebRequest
+ */
public function getRequest() {
return $this->request;
}
+ /**
+ * @return array
+ */
public function getModules() {
return $this->modules;
}
+ /**
+ * @return string
+ */
public function getLanguage() {
if ( $this->language === null ) {
global $wgLang;
@@ -121,49 +135,79 @@ class ResourceLoaderContext {
return $this->language;
}
+ /**
+ * @return string
+ */
public function getDirection() {
if ( $this->direction === null ) {
$this->direction = $this->request->getVal( 'dir' );
if ( !$this->direction ) {
- global $wgContLang;
- $this->direction = $wgContLang->getDir();
+ # directionality based on user language (see bug 6100)
+ $this->direction = Language::factory( $this->language )->getDir();
}
}
return $this->direction;
}
+ /**
+ * @return string
+ */
public function getSkin() {
return $this->skin;
}
+ /**
+ * @return string
+ */
public function getUser() {
return $this->user;
}
+ /**
+ * @return bool
+ */
public function getDebug() {
return $this->debug;
}
+ /**
+ * @return String
+ */
public function getOnly() {
return $this->only;
}
+ /**
+ * @return String
+ */
public function getVersion() {
return $this->version;
}
+ /**
+ * @return bool
+ */
public function shouldIncludeScripts() {
return is_null( $this->only ) || $this->only === 'scripts';
}
+ /**
+ * @return bool
+ */
public function shouldIncludeStyles() {
return is_null( $this->only ) || $this->only === 'styles';
}
+ /**
+ * @return bool
+ */
public function shouldIncludeMessages() {
return is_null( $this->only ) || $this->only === 'messages';
}
+ /**
+ * @return string
+ */
public function getHash() {
if ( !isset( $this->hash ) ) {
$this->hash = implode( '|', array(