2 /* vim: set expandtab sw=4 ts=4 sts=4 ft=php: */
3 declare(strict_types=1);
5 $tmpDir = dirname(__FILE__) . '/../twig-templates';
6 $potName = 'po/phpmyadmin.pot';
7 $replacements = json_decode(file_get_contents($tmpDir . '/replace.json'), true);
10 $pot = file_get_contents($potName);
12 /* Do the replacements */
13 $pot = preg_replace_callback(
14 '@(twig-templates[0-9a-f/]*.php):([0-9]*)@',
17 $filename = $matches[1];
18 $line = intval($matches[2]);
19 $replace = $replacements[$filename];
20 foreach ($replace[1] as $cacheline => $result) {
21 if ($line >= $cacheline) {
22 return $replace[0] . ':' . $result;
25 return $replace[0] . ':0';
30 /* Write fixed file */
31 $handle = fopen($potName, 'w');
32 fwrite($handle, $pot);