$files) { foreach ($files AS $file) { if (preg_match('#\.php$#', $file)) { $flatlist[] = "./$basepath$file"; } } } return $flatlist; } // ################################################################### // ################################################################### $listing = fetch_flat_listing(fetch_listing(getcwd())); $phrases = $db->query("SELECT * FROM phrase WHERE md5"); while ($phrase = $db->fetch_array($phrases)) { $replace["$phrase[md5]"] = $phrase['varname']; } foreach ($listing AS $filename) { $file = file_get_contents($filename); preg_match_all("#lang::r\('(.*?)'\)#", $file, $matches); foreach ($matches[0] AS $matchid => $match) { $mdstring = md5($matches[1]["$matchid"]); if ($replace["$mdstring"]) { $file = str_replace($match, 'lang::p(\'' . $replace["$mdstring"] . '\')', $file); } } if ($h = fopen($filename, 'w')) { fwrite($h, $file); } fclose($h); } ?>