ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
scan_shipped_markup.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30$ilias_root = dirname(__DIR__, 5);
31require $ilias_root . '/vendor/composer/vendor/autoload.php';
32
36foreach (glob($ilias_root . '/lang/ilias_*.lang') ?: [] as $file) {
37 $lang = substr(basename($file, '.lang'), 6);
38 $started = false;
39 foreach (file($file, FILE_IGNORE_NEW_LINES) ?: [] as $line) {
40 if (!$started) {
41 $started = trim($line) === '<!-- language file start -->';
42 continue;
43 }
44 $parts = explode('#:#', $line);
45 if (count($parts) < 3) {
46 continue;
47 }
48 $violations = $policy->findViolations(explode('###', $parts[2])[0]);
49 if ($violations === []) {
50 continue;
51 }
52 $total++;
53 $key = $parts[0] . '#:#' . $parts[1];
54 $by_key[$key]['langs'][] = $lang;
55 foreach ($violations as $violation) {
56 $by_key[$key]['violations'][$violation] = true;
57 }
58 }
59}
60ksort($by_key);
61
62echo sprintf("%d Werte in %d Keys\n\n", $total, count($by_key));
63echo "| Key | Sprachen | Verstoß |\n|---|---|---|\n";
64foreach ($by_key as $key => $data) {
65 $langs = count($data['langs']) >= 25
66 ? 'fast alle (' . count($data['langs']) . ')'
67 : implode(', ', $data['langs']);
68 $violations = implode('; ', array_map(
69 static fn(string $violation): string => str_replace('|', '\\|', $violation),
70 array_keys($data['violations'])
71 ));
72 echo sprintf("| `%s` | %s | %s |\n", $key, $langs, htmlspecialchars($violations, ENT_NOQUOTES));
73}
The HTML a translation value may contain, decided in one place for the shipped files (cleaned in Setu...
$ilias_root
Lists every value of the shipped lang/ilias_*.lang files that TranslationMarkupPolicy does not allow,...
$data
Definition: storeScorm.php:45