Followup r95753 per CR: prevent extensions from making isMovable() return true for...
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderUserOptionsModule.php
index ae654b8..1989353 100644 (file)
@@ -29,8 +29,14 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
 
        protected $modifiedTime = array();
 
+       protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
+
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array|int|Mixed
+        */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                $hash = $context->getHash();
                if ( isset( $this->modifiedTime[$hash] ) ) {
@@ -40,7 +46,7 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                global $wgUser;
 
                if ( $context->getUser() === $wgUser->getName() ) {
-                       return $this->modifiedTime[$hash] = $wgUser->getTouched();
+                       return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX, $wgUser->getTouched() );
                } else {
                        return 1;
                }
@@ -64,12 +70,22 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                }
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
-               return Xml::encodeJsCall( 'mediaWiki.user.options.set', 
+               return Xml::encodeJsCall( 'mw.user.options.set', 
                        array( $this->contextUserOptions( $context ) ) );
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        public function getStyles( ResourceLoaderContext $context ) {
+               // FIXME: This stuff should really be in its own module, because it gets double-loaded otherwise
+               // (once through a <link>, once when embedded as JS)
                global $wgAllowUserCssPrefs;
 
                if ( $wgAllowUserCssPrefs ) {
@@ -77,6 +93,8 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
 
                        // Build CSS rules
                        $rules = array();
+
+                       // Underline: 2 = browser default, 1 = always, 0 = never
                        if ( $options['underline'] < 2 ) {
                                $rules[] = "a { text-decoration: " . 
                                        ( $options['underline'] ? 'underline' : 'none' ) . "; }";
@@ -109,13 +127,14 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                return array();
        }
 
-       public function getFlip( $context ) {
-               global $wgContLang;
-
-               return $wgContLang->getDir() !== $context->getDirection();
-       }
-
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'private';
        }
+       
+       public function getDependencies() {
+               return array( 'mediawiki.user' );
+       }
 }