Changeset 118
- Timestamp:
- 03/04/08 02:30:14 (9 months ago)
- Files:
-
- trunk/Phergie/Plugin/Set.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/Set.php
r117 r118 30 30 // Replace var/value 31 31 if (preg_match('#^\s*('.str_replace('.', '\\.', $var).'\s*=\s*)(.*)$#im', $contents, $m)) { 32 $contents = str_replace($m[2], $this->make Value($value, $m[2], $append), $contents);33 $this->setIni($var, trim($this->makeValue($value, $m[2], $append), '" '));32 $contents = str_replace($m[2], $this->makeIniValue($value, $m[2], $append), $contents); 33 $this->setIni($var, $this->parseIniValue($this->makeIniValue($value, $m[2], $append))); 34 34 // Insert it if not set 35 35 } else { 36 $contents .= "\r\n".$var.' = '.$this->make Value($value);37 $this->setIni($var, trim($value, '" '));36 $contents .= "\r\n".$var.' = '.$this->makeIniValue($value); 37 $this->setIni($var, $this->parseIniValue($value)); 38 38 } 39 39 // Save ini file … … 44 44 * Builds a ini value 45 45 */ 46 protected function make Value($new, $old = "", $append = false)46 protected function makeIniValue($new, $old = "", $append = false) 47 47 { 48 48 $new = trim($new, '" '); … … 65 65 } 66 66 } 67 68 protected function parseIniValue($value) 69 { 70 $value = trim($value, '" '); 71 switch (strtolower($value)) { 72 case 'true': 73 case 'on': 74 case '1': 75 return '1'; 76 case 'false': 77 case 'off': 78 case '0': 79 case '': 80 return ''; 81 default: 82 return $value; 83 } 84 } 67 85 }