PageRenderTime 22ms CodeModel.GetById 44ms RepoModel.GetById 5ms app.codeStats 0ms

/tools/check.php

https://github.com/benkeen/opentranslate.org
PHP | 39 lines | 25 code | 12 blank | 2 comment | 5 complexity | b147122e165b4656451b40a3ccedc343 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. $lines = file("en_us.php");
  3. //print_r($lines);
  4. $vars = array();
  5. foreach ($lines as $line)
  6. {
  7. if (preg_match("/^\\\$LANG\[\"(.*)\"\]/", $line, $match))
  8. {
  9. $key = $match[1];
  10. $vars[] = $key;
  11. }
  12. }
  13. sort($vars);
  14. //$vars = array_unique($vars);
  15. print_r(array_repeated($vars));
  16. function array_repeated($array) {
  17. if(!is_array($array)) return false;
  18. $repeated_values = Array();
  19. $array_unique = array_unique($array);
  20. if(count($array)-count($array_unique)) {
  21. for($i=0;$i<count($array);$i++) {
  22. if(!array_key_exists($i, $array_unique)) $repeated_values[] = $array[$i];
  23. }
  24. }
  25. return $repeated_values;
  26. }
  27. ?>