david_williams | 97651d1 | 2007-07-28 03:46:34 +0000 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | |
| 4 | function parseProperties($filename) |
| 5 | { |
| 6 | $properties; |
| 7 | $i = 0; |
| 8 | $handle = fopen($filename, "r"); |
| 9 | if ($handle) |
| 10 | { |
| 11 | $size = filesize($filename); |
| 12 | $content = fread($handle, $size); |
| 13 | fclose($handle); |
| 14 | |
| 15 | $lineArray = explode("\n",$content); |
| 16 | |
| 17 | while(list(,$line) = each($lineArray)) { |
| 18 | $line = trim($line); |
| 19 | if (strlen($line) > 0) { |
| 20 | //echo $line, "<br />"; |
| 21 | $propertyPair = explode("=", $line); |
| 22 | $propertyPair[0] = trim($propertyPair[0], " \"\'"); |
| 23 | $propertyPair[1] = trim($propertyPair[1], " \"\'"); |
| 24 | |
| 25 | $properties[$propertyPair[0]] = $propertyPair[1]; |
| 26 | $i++; |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | return $properties; |
| 31 | } |
| 32 | |
| 33 | ?> |