getPath(); $file = $file_info->getFilename(); if ($file === 'spellchecker.php') { continue; } if (file_exists($file_path . '/' . $file) && preg_match('/.+\.(?:(php))$/', $file)) { $content = file_get_contents($file_path . '/' . $file); if (!empty($content)) { // English files and php files if (!preg_match('/(?:(\/language\/de))/', $file_path)) { $found_misspellings = array(); foreach ($spellings as $misspell => $correct) { if (preg_match('/\b(?:(' . $misspell . '))\b/', $content) != false) { $found_misspellings[$misspell] = $correct; } } if (!empty($found_misspellings)) { $lines = file($file_path . '/' . $file); foreach ($spellings as $misspell => $correct) { if (!isset($found_misspellings[$misspell])) { $continue; } foreach ($lines as $line_no => $line) { if (preg_match('/\b(?:(' . $misspell . '))\b/', $line) != false) { $output .= "Found misspelling \"$misspell\" in " . realpath($file_path) . "/$file at Line $line_no
Should probably be: $correct

"; } } } } } else { $found_misspellings = array(); foreach ($spellings_de as $misspell => $correct) { if (preg_match('/\b(?:(' . $misspell . '))\b/', $content) != false) { $found_misspellings[$misspell] = $correct; } } if (!empty($found_misspellings)) { $lines = file($file_path . '/' . $file); foreach ($spellings_de as $misspell => $correct) { if (!isset($found_misspellings[$misspell])) { $continue; } foreach ($lines as $line_no => $line) { if (preg_match('/\b(?:(' . $misspell . '))\b/', $line) != false) { $output .= "Found misspelling \"$misspell\" in " . realpath($file_path) . "/$file at Line $line_no
Should probably be: $correct

"; } } } } } } } } if (PHP_SAPI == 'cli') { $output = str_replace('
', "\n", $output); } echo $output; // Exit with 1 if script encountered issues if (strlen($output) > 0) { exit(1); }