source: www/work/phpmyadmin_1/scripts/check_lang.php@ 1

Last change on this file since 1 was 1, checked in by george, 17 years ago

Prvotní import všeho

File size: 1.8 KB
Line 
1<?php
2/* $Id: check_lang.php,v 2.0 2003/11/18 15:20:45 nijel Exp $ */
3// vim: expandtab sw=4 ts=4 sts=4 foldmarker={,} fdm=marker:
4
5
6/**
7 * This test script checks all the language files to ensure there is no errors
8 * inside and nothing is displayed on screen (eg no extra no blank line).
9 */
10$failed = array();
11$passed = array();
12
13// 1. Do check
14$languageDirectory = dir('../lang');
15while ($name = $languageDirectory->read()) {
16 if (strpos($name, '.inc.php')) {
17 // 1.1 Checks parse errors and extra blank line
18 include('../lang/' . $name);
19 header('X-Ping: pong');
20 // 1.1 Checks "^M"
21 $content = fread(fopen('../lang/' . $name, 'r'), filesize('../lang/' . $name));
22 if ($pos = strpos(' ' . $content, "\015")) {
23 $failed[] = $name;
24 } else {
25 $passed[] = $name;
26 }
27 } // end if
28} // end while
29$languageDirectory->close();
30
31// 2. Checking results
32$start = '';
33$failed_cnt = count($failed);
34sort($failed);
35$passed_cnt = count($passed);
36sort($passed);
37echo ($failed_cnt + $passed_cnt) . ' language files were checked.<br /><br />' . "\n";
38if ($failed_cnt) {
39 echo '&nbsp;&nbsp;1.&nbsp;' . $failed_cnt . ' contain(s) some "^M":<br />' . "\n";
40 for ($i = 0; $i < $failed_cnt; $i++) {
41 echo '&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;' . $failed[$i] . '<br />' . "\n";
42 } // end for
43 if ($passed_cnt) {
44 echo '<br />' . "\n";
45 echo '&nbsp;&nbsp;2.&nbsp;' . $passed_cnt . ' seems right:<br />' . "\n";
46 $start = '&nbsp;&nbsp;';
47 }
48} // end if
49if ($passed_cnt) {
50 if (!$failed_cnt) {
51 echo 'They all passed checkings:<br />' . "\n";
52 }
53 for ($i = 0; $i < $passed_cnt; $i++) {
54 echo $start . '&nbsp;&nbsp;-&nbsp;' . $passed[$i] . '<br />' . "\n";
55 } // end for
56} // end if
57?>
Note: See TracBrowser for help on using the repository browser.