|
|
@ -51,58 +51,59 @@ class BaseCfg extends Base |
|
|
|
$name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); |
|
|
|
|
|
|
|
$value = $item->getValue($this); |
|
|
|
if (is_string($value)) |
|
|
|
switch(gettype($value)) |
|
|
|
{ |
|
|
|
if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) ) |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name} = \"{$value}\"\n"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (is_integer($value)) |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
} |
|
|
|
else if (is_bool($value)) |
|
|
|
{ |
|
|
|
$value = $value ? 1 : 0; |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
} |
|
|
|
else if (is_object($value) && $value instanceof BaseCfg) |
|
|
|
{ |
|
|
|
$ret .= $value->toString($className); |
|
|
|
} |
|
|
|
else if(is_null($value)) |
|
|
|
{ |
|
|
|
//$ret .= "{$className}.{$name} = \"null\"\n";
|
|
|
|
$ret = $ret; |
|
|
|
} |
|
|
|
else if(is_float($value)) |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
} |
|
|
|
else if(is_array($value)) |
|
|
|
{ |
|
|
|
foreach(StringHelper::arrayToString($value) as $value) |
|
|
|
{ |
|
|
|
if( $name == 'imagepipelines' && $className == 'film' ) |
|
|
|
case 'string': |
|
|
|
if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) ) |
|
|
|
{ |
|
|
|
$value = sprintf("%03d", substr($value,0,strpos($value,'.'))).substr($value,strpos($value,'.')); |
|
|
|
$ret .= "{$className}.{$name}.{$value}\n"; |
|
|
|
$ret .= "{$className}.{$name} = \"{$value}\"\n"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name}.{$value}\n"; |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name} = \"unknow type\"\n"; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'integer': |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'boolean': |
|
|
|
$value = $value ? 1 : 0; |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'object': |
|
|
|
$ret .= $value->toString($className); |
|
|
|
break; |
|
|
|
|
|
|
|
case 'NULL': |
|
|
|
break; |
|
|
|
|
|
|
|
case 'double': |
|
|
|
$ret .= "{$className}.{$name} = {$value}\n"; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'array': |
|
|
|
foreach(StringHelper::arrayToString($value) as $value) |
|
|
|
{ |
|
|
|
if( $name == 'imagepipelines' && $className == 'film' ) |
|
|
|
{ |
|
|
|
$value = sprintf("%03d", substr($value,0,strpos($value,'.'))).substr($value,strpos($value,'.')); |
|
|
|
$ret .= "{$className}.{$name}.{$value}\n"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$ret .= "{$className}.{$name}.{$value}\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
$ret .= "{$className}.{$name} = \"unknow type\"\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return $ret; |
|
|
|
} |
|
|
|