| | |
| | | class ini_parser{ |
| | | |
| | | private $config; |
| | | |
| | | |
| | | //* Converts a ini string to array |
| | | public function parse_ini_string($ini) { |
| | | $ini = str_replace("\r\n", "\n", $ini); |
| | | $lines = explode("\n", $ini); |
| | |
| | | } |
| | | return $this->config; |
| | | } |
| | | |
| | | public function get_ini_string($file) { |
| | | |
| | | |
| | | //* Converts a config array to a string |
| | | public function get_ini_string($config_array = '') { |
| | | if($config_array == '') $config_array = $this->config; |
| | | $content = ''; |
| | | foreach($this->config as $section => $data) { |
| | | foreach($config_array as $section => $data) { |
| | | $content .= "[$section]\n"; |
| | | foreach($data as $item => $value) { |
| | | if($value != ''){ |
| | | if($item != ''){ |
| | | $content .= "$item=$value\n"; |
| | | } |
| | | } |
| | | $content .= "\n"; |
| | | } |
| | | return $content; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | ?> |