2010-09-30 01:11:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$arr = array();
|
|
|
|
|
|
|
|
$files = array('index.php','boot.php');
|
2011-01-28 02:45:19 +00:00
|
|
|
$files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
|
2010-09-30 01:11:23 +00:00
|
|
|
|
|
|
|
|
2017-01-26 13:44:46 +00:00
|
|
|
foreach ($files as $file) {
|
2010-09-30 01:11:23 +00:00
|
|
|
$str = file_get_contents($file);
|
|
|
|
|
|
|
|
$pat = '| t\(([^\)]*)\)|';
|
2011-03-13 12:51:59 +00:00
|
|
|
$patt = '| tt\(([^\)]*)\)|';
|
2010-09-30 01:11:23 +00:00
|
|
|
|
|
|
|
preg_match_all($pat,$str,$matches);
|
2011-03-13 12:51:59 +00:00
|
|
|
preg_match_all($patt, $str, $matchestt);
|
|
|
|
|
|
|
|
|
2017-01-26 13:44:46 +00:00
|
|
|
if (count($matches)){
|
|
|
|
foreach ($matches[1] as $match) {
|
|
|
|
if (! in_array($match,$arr))
|
2011-03-13 12:51:59 +00:00
|
|
|
$arr[] = $match;
|
|
|
|
}
|
|
|
|
}
|
2017-01-26 13:44:46 +00:00
|
|
|
if (count($matchestt)){
|
|
|
|
foreach ($matchestt[1] as $match) {
|
2011-03-13 12:51:59 +00:00
|
|
|
$matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match);
|
|
|
|
if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){
|
|
|
|
$arr[] = $matchtkns;
|
|
|
|
}
|
|
|
|
}
|
2010-09-30 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$s = '<?php' . "\n";
|
2011-03-13 12:51:59 +00:00
|
|
|
$s .= '
|
|
|
|
function string_plural_select($n){
|
|
|
|
return ($n != 1);
|
|
|
|
}
|
2010-09-30 01:11:23 +00:00
|
|
|
|
2011-03-13 12:51:59 +00:00
|
|
|
';
|
|
|
|
|
2017-01-26 13:44:46 +00:00
|
|
|
foreach ($arr as $a) {
|
2011-03-13 12:51:59 +00:00
|
|
|
if (is_array($a)){
|
2017-01-26 13:44:46 +00:00
|
|
|
if (substr($a[1],0,1) == '$') {
|
2011-03-13 12:51:59 +00:00
|
|
|
continue;
|
2017-01-26 13:44:46 +00:00
|
|
|
}
|
2011-03-13 12:51:59 +00:00
|
|
|
$s .= '$a->strings[' . $a[0] . "] = array(\n";
|
|
|
|
$s .= "\t0 => ". $a[0]. ",\n";
|
|
|
|
$s .= "\t1 => ". $a[1]. ",\n";
|
|
|
|
$s .= ");\n";
|
|
|
|
} else {
|
2017-01-26 13:44:46 +00:00
|
|
|
if (substr($a,0,1) == '$') {
|
|
|
|
continue;
|
|
|
|
}
|
2011-03-13 12:51:59 +00:00
|
|
|
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
|
|
|
|
}
|
2010-09-30 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$zones = timezone_identifiers_list();
|
2017-01-26 13:44:46 +00:00
|
|
|
foreach ($zones as $zone) {
|
2010-09-30 01:11:23 +00:00
|
|
|
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
|
2017-01-26 13:44:46 +00:00
|
|
|
}
|
|
|
|
|
2010-09-30 01:11:23 +00:00
|
|
|
echo $s;
|