Changeset 1555 for trunk/gregarius/dist
- Timestamp:
- 09/03/06 15:04:40 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/dist/convert.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/dist/convert.php
r1554 r1555 2 2 include_once('intl/en.php'); 3 3 4 $EXCLUDE = array('intl', 'extlib'); 5 4 6 function Convert($dir) 5 7 { 6 if(!is_dir($dir) || "intl" == $dir) { 8 global $EXCLUDE; 9 10 if(!is_dir($dir) || in_array($dir, $EXCLUDE)) { 7 11 return; 8 12 } … … 10 14 $baseDir = opendir($dir); 11 15 while($file = readdir($baseDir)) { 12 if( "."== $file ||13 ".."== $file) {16 if('.' == $file || 17 '..' == $file) { 14 18 continue; 15 19 } … … 18 22 Convert($file); 19 23 } else { 20 $fp = fopen($file, 'w+'); 24 $old = fopen($file, 'r'); 25 $new = fopen($file . '.new', 'w'); 21 26 22 while(($line = fread($fp) != feof()) { 27 while(($line = fread($old)) != feof($old)) { 28 preg_match('/\.*.LBL_*.\.', $line, $matches); 23 29 30 if(is_array($matches)) { 31 foreach($matches as $match) { 32 preg_replace($match, eval('echo ' . $match . ';'), $line); 33 } 34 } 24 35 36 fwrite($new, $line); 25 37 } 26 flush($fp);27 fclose($fp);28 38 29 # define('A', "Hello, World"); 30 # $con = "A"; 31 # $val = eval('echo ' . $con . ';'); 32 # echo $val; 39 flush($new); 40 fclose($old); 41 fclose($new); 42 43 rename($old, $old . '.old'); 44 rename($new, $old); 45 46 echo "Completed .. " . $old . "\n"; 33 47 } 34 48 } 35 49 } 36 50 37 Convert( ".");51 Convert('.'); 38 52 ?>
