" at the end of this file!' . PHP_EOL . PHP_EOL; return $text; } // substitutes a single token function i18n_substitute_text_token($token) { global $i18n_tokens; $a = trim($token[1]); if(isset($i18n_tokens[$a])) { return $i18n_tokens[$a]; } else { $f = i18n_get_filename(); if(is_readable($f)) { include($f); } elseif($handle = fopen($f, 'ab')) { fwrite($handle, i18n_get_file_open_text() ); fclose($handle); } else { return $a; } if(isset($i18n_tokens[$a])) { return $i18n_tokens[$a]; } $i18n_tokens[$a] = $a; $as = str_replace("'", "\\'", $a); $s = '$i18n_tokens' . "['" . $as . "']" . " = '" . $as . "'; // NEW " . now('Y-m-d H:i:s') . PHP_EOL; if($handle = fopen($f, 'ab')) { fwrite($handle, $s); fclose($handle); } } return $a; } // all contents starting and ending with @@ are replaced function i18n_substitute_text($tpl_output) { global $i18n_tokens; $f = i18n_get_filename(); if(!isset($i18n_tokens)) { if(is_readable($f)) { include($f); } elseif($handle = fopen($f, 'ab')) { fwrite($handle, i18n_get_file_open_text() ); fclose($handle); } } return preg_replace_callback('/@@(.+?)@@/', 'i18n_substitute_text_token', $tpl_output); } /////////////////////////////////////////////////////////////////////////////////////////////// ?>