r72368 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72367‎ | r72368 | r72369 >
Date:10:53, 4 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Better solution for r72367, this allows file modules to always be written in ltr, while site modules are written in whatever $wgContLang is.
Modified paths:
  • /trunk/phase3/includes/ResourceLoader.php (modified) (history)
  • /trunk/phase3/includes/ResourceLoaderContext.php (modified) (history)
  • /trunk/phase3/includes/ResourceLoaderModule.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ResourceLoaderContext.php
@@ -31,7 +31,6 @@
3232 protected $modules;
3333 protected $language;
3434 protected $direction;
35 - protected $flip;
3635 protected $skin;
3736 protected $debug;
3837 protected $only;
@@ -40,7 +39,7 @@
4140 /* Methods */
4241
4342 public function __construct( WebRequest $request, $server ) {
44 - global $wgUser, $wgLang, $wgContLang, $wgDefaultSkin;
 43+ global $wgUser, $wgLang, $wgDefaultSkin;
4544
4645 $this->request = $request;
4746 $this->server = $server;
@@ -61,8 +60,6 @@
6261 if ( !$this->skin ) {
6362 $this->skin = $wgDefaultSkin;
6463 }
65 - // Evaluate flip
66 - $this->flip = $wgContLang->getDir() !== $this->direction;
6764 }
6865
6966 public function getRequest() {
@@ -85,10 +82,6 @@
8683 return $this->direction;
8784 }
8885
89 - public function getFlip() {
90 - return $this->flip;
91 - }
92 -
9386 public function getSkin() {
9487 return $this->skin;
9588 }
Index: trunk/phase3/includes/ResourceLoader.php
@@ -294,7 +294,7 @@
295295 $context->shouldIncludeStyles() &&
296296 ( $styles .= self::$modules[$name]->getStyle( $context ) ) !== ''
297297 ) {
298 - if ( $context->getFlip() ) {
 298+ if ( self::$modules[$name]->getFlip( $context ) ) {
299299 $styles = self::filter( 'flip-css', $styles );
300300 }
301301 $styles = $context->getDebug() ? $styles : self::filter( 'minify-css', $styles );
Index: trunk/phase3/includes/ResourceLoaderModule.php
@@ -69,7 +69,16 @@
7070 global $wgResourceLoaderServerMaxage;
7171 return $wgResourceLoaderServerMaxage;
7272 }
 73+
 74+ /**
 75+ * Get whether CSS for this module should be flipped
 76+ */
 77+ public function getFlip( $context ) {
 78+ return $context->getDirection() === 'rtl';
 79+ }
7380
 81+ /* Abstract Methods */
 82+
7483 /**
7584 * Get all JS for this module for a given language and skin.
7685 * Includes all relevant JS except loader scripts.
@@ -423,7 +432,7 @@
424433 $this->modifiedTime[$context->getHash()] = max( $filesMtime, $msgBlobMtime );
425434 return $this->modifiedTime[$context->getHash()];
426435 }
427 -
 436+
428437 /* Protected Members */
429438
430439 /**
@@ -689,6 +698,10 @@
690699 }
691700
692701 public function getStyle( ResourceLoaderContext $context ) { return ''; }
 702+ public function getFlip( $context ) {
 703+ global $wgContLang;
 704+ return $wgContLang->getDir() !== $context->getDirection();
 705+ }
693706 public function getMessages() { return array(); }
694707 public function getLoaderScript() { return ''; }
695708 public function getDependencies() { return array(); }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72367Only flip CSS if dir is different from $wgContLangtparscal10:28, 4 September 2010

Status & tagging log