remove todo, after upgrade PHPExcel
[phpmyadmin/arisferyanto.git] / scripts / check_lang.php
blob4ecf9070b0b70c50afd048243e3fc776e48c732b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * This test script checks all the language files to ensure there is no errors
5 * inside and nothing is displayed on screen (eg no extra no blank line).
7 * @version $Id$
8 * @package phpMyAdmin-test
9 */
11 /**
14 $failed = array();
15 $passed = array();
17 // 1. Do check
18 $languageDirectory = dir('../lang');
19 while ($name = $languageDirectory->read()) {
20 if (strpos($name, '.inc.php')) {
21 // 1.1 Checks parse errors and extra blank line
22 include '../lang/' . $name;
23 header('X-Ping: pong');
24 // 1.1 Checks "^M"
25 $content = fread(fopen('../lang/' . $name, 'r'), filesize('../lang/' . $name));
26 if ($pos = strpos(' ' . $content, "\015")) {
27 $failed[] = $name;
28 } else {
29 $passed[] = $name;
31 } // end if
32 } // end while
33 $languageDirectory->close();
35 // 2. Checking results
36 $start = '';
37 $failed_cnt = count($failed);
38 sort($failed);
39 $passed_cnt = count($passed);
40 sort($passed);
41 echo ($failed_cnt + $passed_cnt) . ' language files were checked.<br /><br />' . "\n";
42 if ($failed_cnt) {
43 echo '&nbsp;&nbsp;1.&nbsp;' . $failed_cnt . ' contain(s) some "^M":<br />' . "\n";
44 for ($i = 0; $i < $failed_cnt; $i++) {
45 echo '&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;' . $failed[$i] . '<br />' . "\n";
46 } // end for
47 if ($passed_cnt) {
48 echo '<br />' . "\n";
49 echo '&nbsp;&nbsp;2.&nbsp;' . $passed_cnt . ' seems right:<br />' . "\n";
50 $start = '&nbsp;&nbsp;';
52 } // end if
53 if ($passed_cnt) {
54 if (!$failed_cnt) {
55 echo 'They all passed checkings:<br />' . "\n";
57 for ($i = 0; $i < $passed_cnt; $i++) {
58 echo $start . '&nbsp;&nbsp;-&nbsp;' . $passed[$i] . '<br />' . "\n";
59 } // end for
60 } // end if