) as $include
) {
$file = file_get_contents($include);
- if (preg_match_all("~lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { // lang() always uses apostrophes
+ if (preg_match_all("~[^>]lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { // lang() always uses apostrophes
$messages_all += array_combine($matches[1], $matches[2]);
}
}
if ($lang != "xx") {
foreach (glob(__DIR__ . "/plugins/*.php") as $filename) {
$file = file_get_contents($filename);
- if (preg_match_all("~\\\$this->lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) {
- $messages = array_combine($matches[1], $matches[2]);
+ if (preg_match('~extends Adminer\\\\Plugin~', $file)) {
+ preg_match_all("~\\\$this->lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches);
+ $messages = array("''" => "") + array_combine($matches[1], $matches[2]);
$file = preg_replace("~(static \\\$translations = array\\((?!.*'$lang').*?)\t\\);~s", "\\1\t\t'$lang' => array(\n\t\t),\n\t);", $file);
file_put_contents($filename, $file);
update_translations($lang, $messages, $filename, "~(static \\\$translations = array\\(.*'$lang' => array\\(\n)(.*)(?=^\t\t\\),)~msU", "\t\t\t");
return $prefix . $s;
}, $file, -1, $count, PREG_OFFSET_CAPTURE);
if ($s != $file) {
+ $s = str_replace("array(\n\t\t\t'' => null,\n\t\t),", "array('' => null),", $s);
file_put_contents($filename, $s);
echo "$filename updated.\n";
}