mirkp - 2014-09-19 05:25:25 -
In reply to message 1 from mirkp
I was able to do this.
I change method Save() in this way:
public function Save($fname = false) {
$src = "<?php ".CE_NEWLINE."return array(".CE_NEWLINE;
foreach ($this->vars as $var) {
$src .= self::formatComments(wordwrap($var[CE_VARCOMMENT], CE_WORDWRAP, CE_NEWLINE));
$src .= "'".$var[CE_VARNAME]."' => ".$var[CE_VARVALUE].','.CE_NEWLINE.CE_NEWLINE;
//$src .= 'return '.$var[CE_VARVALUE].';'.CE_NEWLINE.CE_NEWLINE;
}
$src = $src.'); ?>';
if ($fname !== false) {
$fp = @fopen($fname, 'w');
if ($fp) {
@fwrite($fp, $src);
@fclose($fp);
}
}
return $src;
}
Result of generated file are that var name become index key of one main array.
This is generated config sample:
<?php
return array(
// Timeout in cURL
// operations
'cfg_curl_timeout' => 10,
// Banned IPs
'cfg_banned_ips' => array (
0 => '10.10.10.10',
1 => '10.20.30.40',
),
// ROOTDIR is defined
// before including
// config file
'cfg_cachedir' => ROOTDIR.'/maincache',
); ?>