$lang_name) { $lang = array(); $langfile = "../../" . $plugin_path . "languages/" . $language . ".php"; if (!file_exists($langfile)) { continue; } $compare = file_get_contents($langfile); preg_match_all("/\[([a-zA-Z0-9_]*)\]/", $compare, $params); // Which are wrong? $wrong = array_diff($params[0], $params_correct[0]); if (count($wrong) > 0) { $replaced = $compare; foreach ($wrong as $w) { if (!is_numeric(str_replace(["[","]"], "", $w))) { $replaced = str_replace($w, "[badparam]", $replaced); $count++; } } file_put_contents($langfile, $replaced); } } } echo "Replaced $count incorrect language strings with \"[badparam]\"";