Location: PHPKode > projects > ACSoc Comics Library Management System > odin-0.589/strip.php
<?php

	array_shift($argv);
	$lang_file = array_shift($argv);
/*
	$lang = file($lang_file);
	array_unshift($lang, "");
	foreach ($lang as $ix=>$tx) {
		$lang[$ix]=trim($tx);
	}
*/
	require_once $lang_file;

	// UNICODE: ignore BOM (byte order mark)
	if (substr($lang[0], 0, 2) == "\xff\xfe") $lang[0] = substr($lang[0], 2);

	//require_once($lang_file);

foreach ($argv as $src_file) {
	
	$lines = file($src_file);
	$regex = '/\$lang\[(\d*)\]/';
	foreach ($lines as $l) {
		while (preg_match($regex, $l, $m)) {
			if (!$m[1]) break;
			$replace = $lang[$m[1]];
			$l = preg_replace($regex, $replace, $l, 1);
			$used[] = $m[1];
		}
		print $l;
	}
}

print "<?php\n";
$used = array_unique($used);
sort($used);
foreach ($used as $index) {
	print '$lang['.$index.'] = \''.$lang[$index]."';\n";
}
print "?>\n";
?>
Return current item: ACSoc Comics Library Management System