Documentation TYPO3 par Ameos

check_lang.php

00001 <?php
00002 /* $Id: check_lang.php,v 2.0 2003/11/18 15:20:45 nijel Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4 foldmarker={,} fdm=marker:
00004 
00005 
00010 $failed = array();
00011 $passed = array();
00012 
00013 // 1. Do check
00014 $languageDirectory = dir('../lang');
00015 while ($name = $languageDirectory->read()) {
00016     if (strpos($name, '.inc.php')) {
00017         // 1.1 Checks parse errors and extra blank line
00018         include('../lang/' . $name);
00019         header('X-Ping: pong');
00020         // 1.1 Checks "^M"
00021         $content = fread(fopen('../lang/' . $name, 'r'), filesize('../lang/' . $name));
00022         if ($pos = strpos(' ' . $content, "\015")) {
00023             $failed[] = $name;
00024         } else {
00025             $passed[] = $name;
00026         }
00027     } // end if
00028 } // end while
00029 $languageDirectory->close();
00030 
00031 // 2. Checking results
00032 $start      = '';
00033 $failed_cnt = count($failed);
00034 sort($failed);
00035 $passed_cnt = count($passed);
00036 sort($passed);
00037 echo ($failed_cnt + $passed_cnt) . ' language files were checked.<br /><br />' . "\n";
00038 if ($failed_cnt) {
00039     echo '&nbsp;&nbsp;1.&nbsp;' . $failed_cnt . ' contain(s) some "^M":<br />' . "\n";
00040     for ($i = 0; $i < $failed_cnt; $i++) {
00041         echo '&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;' . $failed[$i] . '<br />' . "\n";
00042     } // end for
00043     if ($passed_cnt) {
00044         echo '<br />' . "\n";
00045         echo '&nbsp;&nbsp;2.&nbsp;' . $passed_cnt . ' seems right:<br />' . "\n";
00046         $start = '&nbsp;&nbsp;';
00047     }
00048 } // end if
00049 if ($passed_cnt) {
00050     if (!$failed_cnt) {
00051         echo 'They all passed checkings:<br />' . "\n";
00052     }
00053     for ($i = 0; $i < $passed_cnt; $i++) {
00054         echo $start . '&nbsp;&nbsp;-&nbsp;' . $passed[$i] . '<br />' . "\n";
00055     } // end for
00056 } // end if
00057 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6