"; $shortfile = substr($file,$l); $lines = file($file); foreach ($lines as $line) { $myterms = array(); $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/',$line,$myterms); if ($res > 0) { foreach($myterms[1] as $term) { if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { $undefined_terms[$term] = $shortfile; //echo "Undefined: $term
"; } } } $res = 0; $res = preg_match_all('/\{[\'"](\\w*)[\'"]\|get_lang\}/',$line,$myterms); if ($res > 0) { foreach($myterms[1] as $term) { if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { $undefined_terms[$term] = $shortfile; //echo "Undefined: $term
"; } } } } flush(); } //$undefined_terms = array_flip($undefined_terms); if (count($undefined_terms)<1) { die("No missing terms
\n"); } else { echo "The following terms were nowhere to be found:
\n"; } foreach ($undefined_terms as $term => $file) { echo "\n"; } echo "
$termin $file"; if (substr($file,0,7)=='plugin/') { echo " (this one should be taken care of by the plugin's language files)"; } echo "
\n"; function get_all_php_files($base_path) { $list = scandir($base_path); $files = array(); foreach ($list as $item) { if (substr($item,0,1)=='.') {continue;} $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); if (in_array($base_path.$item.'/',$special_dirs)) {continue;} if (is_dir($base_path.$item)) { $files = array_merge($files,get_all_php_files($base_path.$item.'/')); } else { //only analyse php files $sub = substr($item,-4); if ($sub == '.php' or $sub == '.tpl') { $files[] = $base_path.$item; } } } $list = null; return $files; }