Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -111,7 +111,6 @@ |
112 | 112 | * Available filters are: |
113 | 113 | * - minify-js \see JSMin::minify |
114 | 114 | * - minify-css \see CSSMin::minify |
115 | | - * - flip-css \see CSSJanus::transform |
116 | 115 | * |
117 | 116 | * If $data is empty, only contains whitespace or the filter was unknown, |
118 | 117 | * $data is returned unmodified. |
— | — | @@ -126,7 +125,7 @@ |
127 | 126 | // For empty/whitespace-only data or for unknown filters, don't perform |
128 | 127 | // any caching or processing |
129 | 128 | if ( trim( $data ) === '' |
130 | | - || !in_array( $filter, array( 'minify-js', 'minify-css', 'flip-css' ) ) ) |
| 129 | + || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) |
131 | 130 | { |
132 | 131 | wfProfileOut( __METHOD__ ); |
133 | 132 | return $data; |
— | — | @@ -151,9 +150,6 @@ |
152 | 151 | case 'minify-css': |
153 | 152 | $result = CSSMin::minify( $data ); |
154 | 153 | break; |
155 | | - case 'flip-css': |
156 | | - $result = CSSJanus::transform( $data, true, false ); |
157 | | - break; |
158 | 154 | } |
159 | 155 | } catch ( Exception $exception ) { |
160 | 156 | throw new MWException( 'ResourceLoader filter error. ' . |
— | — | @@ -436,12 +432,6 @@ |
437 | 433 | $styles = array(); |
438 | 434 | if ( $context->shouldIncludeStyles() ) { |
439 | 435 | $styles = $module->getStyles( $context ); |
440 | | - // Flip CSS on a per-module basis |
441 | | - if ( $styles && $module->getFlip( $context ) ) { |
442 | | - foreach ( $styles as $media => $style ) { |
443 | | - $styles[$media] = $this->filter( 'flip-css', $style ); |
444 | | - } |
445 | | - } |
446 | 436 | } |
447 | 437 | |
448 | 438 | // Messages |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php |
— | — | @@ -100,7 +100,11 @@ |
101 | 101 | if ( $options['editfont'] !== 'default' ) { |
102 | 102 | $rules[] = "textarea { font-family: {$options['editfont']}; }\n"; |
103 | 103 | } |
104 | | - return array( 'all' => implode( "\n", $rules ) ); |
| 104 | + $style = implode( "\n", $rules ); |
| 105 | + if ( $this->getFlip( $context ) ) { |
| 106 | + $style = CSSJanus::transform( $style, true, false ); |
| 107 | + } |
| 108 | + return array( 'all' => $style ); |
105 | 109 | } |
106 | 110 | return array(); |
107 | 111 | } |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -247,9 +247,11 @@ |
248 | 248 | */ |
249 | 249 | public function getStyles( ResourceLoaderContext $context ) { |
250 | 250 | // Merge general styles and skin specific styles, retaining media type collation |
251 | | - $styles = $this->readStyleFiles( $this->styles ); |
| 251 | + $styles = $this->readStyleFiles( $this->styles, $this->getFlip( $context ) ); |
252 | 252 | $skinStyles = $this->readStyleFiles( |
253 | | - self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ) ); |
| 253 | + self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ), |
| 254 | + $this->getFlip( $context ) |
| 255 | + ); |
254 | 256 | |
255 | 257 | foreach ( $skinStyles as $media => $style ) { |
256 | 258 | if ( isset( $styles[$media] ) ) { |
— | — | @@ -456,14 +458,19 @@ |
457 | 459 | * @return Array: List of concatenated and remapped CSS data from $styles, |
458 | 460 | * keyed by media type |
459 | 461 | */ |
460 | | - protected function readStyleFiles( array $styles ) { |
| 462 | + protected function readStyleFiles( array $styles, $flip ) { |
461 | 463 | if ( empty( $styles ) ) { |
462 | 464 | return array(); |
463 | 465 | } |
464 | 466 | $styles = self::collateFilePathListByOption( $styles, 'media', 'all' ); |
465 | 467 | foreach ( $styles as $media => $files ) { |
466 | 468 | $styles[$media] = implode( |
467 | | - "\n", array_map( array( $this, 'readStyleFile' ), array_unique( $files ) ) |
| 469 | + "\n", |
| 470 | + array_map( |
| 471 | + array( $this, 'readStyleFile' ), |
| 472 | + array_unique( $files ), |
| 473 | + array( $flip ) |
| 474 | + ) |
468 | 475 | ); |
469 | 476 | } |
470 | 477 | return $styles; |
— | — | @@ -477,12 +484,15 @@ |
478 | 485 | * @param $path String: File path of script file to read |
479 | 486 | * @return String: CSS data in script file |
480 | 487 | */ |
481 | | - protected function readStyleFile( $path ) { |
| 488 | + protected function readStyleFile( $path, $flip ) { |
482 | 489 | $localPath = $this->getLocalPath( $path ); |
483 | 490 | $style = file_get_contents( $localPath ); |
484 | 491 | if ( $style === false ) { |
485 | 492 | throw new MWException( __METHOD__.": style file not found: \"$localPath\"" ); |
486 | 493 | } |
| 494 | + if ( $flip ) { |
| 495 | + $style = CSSJanus::transform( $style, true, false ); |
| 496 | + } |
487 | 497 | $dir = $this->getLocalPath( dirname( $path ) ); |
488 | 498 | $remoteDir = $this->getRemotePath( dirname( $path ) ); |
489 | 499 | // Get and register local file references |
Index: trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php |
— | — | @@ -86,6 +86,9 @@ |
87 | 87 | if ( !$style ) { |
88 | 88 | continue; |
89 | 89 | } |
| 90 | + if ( $this->getFlip( $context ) ) { |
| 91 | + $style = CSSJanus::transform( $style, true, false ); |
| 92 | + } |
90 | 93 | if ( !isset( $styles[$media] ) ) { |
91 | 94 | $styles[$media] = ''; |
92 | 95 | } |