dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Balancer: pass configuration array to flatten instead of individual booleans"
[lhc/web/wiklou.git]
/
includes
/
resourceloader
/
ResourceLoaderOOUIImageModule.php
diff --git
a/includes/resourceloader/ResourceLoaderOOUIImageModule.php
b/includes/resourceloader/ResourceLoaderOOUIImageModule.php
index
6d76493
..
52aa392
100644
(file)
--- a/
includes/resourceloader/ResourceLoaderOOUIImageModule.php
+++ b/
includes/resourceloader/ResourceLoaderOOUIImageModule.php
@@
-30,25
+30,32
@@
class ResourceLoaderOOUIImageModule extends ResourceLoaderImageModule {
}
// Core default themes
}
// Core default themes
- $themes =
array( 'default' => 'mediawiki' )
;
+ $themes =
[ 'default' => 'mediawiki' ]
;
$themes += ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
$name = $this->definition['name'];
$rootPath = $this->definition['rootPath'];
$themes += ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
$name = $this->definition['name'];
$rootPath = $this->definition['rootPath'];
- $definition =
array()
;
+ $definition =
[]
;
foreach ( $themes as $skin => $theme ) {
// TODO Allow extensions to specify this path somehow
$dataPath = $this->localBasePath . '/' . $rootPath . '/' . $theme . '/' . $name . '.json';
if ( file_exists( $dataPath ) ) {
$data = json_decode( file_get_contents( $dataPath ), true );
foreach ( $themes as $skin => $theme ) {
// TODO Allow extensions to specify this path somehow
$dataPath = $this->localBasePath . '/' . $rootPath . '/' . $theme . '/' . $name . '.json';
if ( file_exists( $dataPath ) ) {
$data = json_decode( file_get_contents( $dataPath ), true );
-
array_walk_recursive( $data['images'],
function ( &$path ) use ( $rootPath, $theme ) {
+
$fixPath =
function ( &$path ) use ( $rootPath, $theme ) {
// TODO Allow extensions to specify this path somehow
$path = $rootPath . '/' . $theme . '/' . $path;
// TODO Allow extensions to specify this path somehow
$path = $rootPath . '/' . $theme . '/' . $path;
+ };
+ array_walk( $data['images'], function ( &$value ) use ( $fixPath ) {
+ if ( is_string( $value['file'] ) ) {
+ $fixPath( $value['file'] );
+ } elseif ( is_array( $value['file'] ) ) {
+ array_walk_recursive( $value['file'], $fixPath );
+ }
} );
} else {
} );
} else {
- $data =
array()
;
+ $data =
[]
;
}
foreach ( $data as $key => $value ) {
}
foreach ( $data as $key => $value ) {
@@
-62,7
+69,9
@@
class ResourceLoaderOOUIImageModule extends ResourceLoaderImageModule {
if ( !isset( $definition[$key] ) ) {
$definition[$key] = $data[$key];
} elseif ( $definition[$key] !== $data[$key] ) {
if ( !isset( $definition[$key] ) ) {
$definition[$key] = $data[$key];
} elseif ( $definition[$key] !== $data[$key] ) {
- throw new Exception( "Mismatched OOUI theme definitions are not supported: trying to load $key of $theme theme" );
+ throw new Exception(
+ "Mismatched OOUI theme definitions are not supported: trying to load $key of $theme theme"
+ );
}
break;
}
}
break;
}