* $conf->settings = array(
* 'wgMergeSetting' = array(
* # Value that will be shared among all wikis:
- * 'default' => array( NS_USER => true ),
+ * 'default' => array( NS_USER => true ),
*
* # Leading '+' means merging the array of value with the defaults
* '+beta' => array( NS_HELP => true ),
* @param $params Array: array of parameters.
* @return Mixed the value of the setting requested.
*/
- protected function getSetting( $settingName, $wiki, /*array*/ $params ){
+ protected function getSetting( $settingName, $wiki, /*array*/ $params ) {
$retval = null;
if( array_key_exists( $settingName, $this->settings ) ) {
$thisSetting =& $this->settings[$settingName];
$retval = $thisSetting[$tag];
}
break 2;
- } elseif( array_key_exists( "+$tag", $thisSetting ) && is_array($thisSetting["+$tag"]) ) {
+ } elseif( array_key_exists( "+$tag", $thisSetting ) && is_array( $thisSetting["+$tag"] ) ) {
if( !isset( $retval ) ) {
$retval = array();
}
$suffix = $params['suffix'];
if( !is_null( $suffix ) ) {
if( array_key_exists( $suffix, $thisSetting ) ) {
- if ( isset($retval) && is_array($retval) && is_array($thisSetting[$suffix]) ) {
+ if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) {
$retval = self::arrayMerge( $retval, $thisSetting[$suffix] );
} else {
$retval = $thisSetting[$suffix];
public function extractGlobalSetting( $setting, $wiki, $params ) {
$value = $this->getSetting( $setting, $wiki, $params );
if ( !is_null( $value ) ) {
- if (substr($setting,0,1) == '+' && is_array($value)) {
- $setting = substr($setting,1);
- if ( is_array($GLOBALS[$setting]) ) {
+ if ( substr( $setting, 0, 1 ) == '+' && is_array( $value ) ) {
+ $setting = substr( $setting, 1 );
+ if ( is_array( $GLOBALS[$setting] ) ) {
$GLOBALS[$setting] = self::arrayMerge( $GLOBALS[$setting], $value );
} else {
$GLOBALS[$setting] = $value;
* @param $wiki String
* @return array
*/
- protected function getWikiParams( $wiki ){
+ protected function getWikiParams( $wiki ) {
static $default = array(
'suffix' => null,
'lang' => null,
return $default;
}
- foreach( $default as $name => $def ){
+ foreach( $default as $name => $def ) {
if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) ) {
$ret[$name] = $default[$name];
}
* @param $wikiTags Array The tags assigned to the wiki.
* @return array
*/
- protected function mergeParams( $wiki, $suffix, /*array*/ $params, /*array*/ $wikiTags ){
+ protected function mergeParams( $wiki, $suffix, /*array*/ $params, /*array*/ $wikiTags ) {
$ret = $this->getWikiParams( $wiki );
if( is_null( $ret['suffix'] ) ) {
$ret['params'] += $params;
// Automatically fill that ones if needed
- if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ){
+ if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ) {
$ret['params']['lang'] = $ret['lang'];
}
if( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) ) {
$out = $array1;
for( $i = 1; $i < func_num_args(); $i++ ) {
foreach( func_get_arg( $i ) as $key => $value ) {
- if ( isset($out[$key]) && is_array($out[$key]) && is_array($value) ) {
+ if ( isset( $out[$key] ) && is_array( $out[$key] ) && is_array( $value ) ) {
$out[$key] = self::arrayMerge( $out[$key], $value );
- } elseif ( !isset($out[$key]) || !$out[$key] && !is_numeric($key) ) {
+ } elseif ( !isset( $out[$key] ) || !$out[$key] && !is_numeric( $key ) ) {
// Values that evaluate to true given precedence, for the primary purpose of merging permissions arrays.
$out[$key] = $value;
} elseif ( is_numeric( $key ) ) {