]> git.mxchange.org Git - friendica.git/blob - util/extract.php
Merge branch 'omigeot-master'
[friendica.git] / util / extract.php
1 <?php
2
3         $arr = array();
4
5         $files = array('index.php','boot.php');
6         $files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
7
8
9         foreach($files as $file) {
10                 $str = file_get_contents($file);
11
12                 $pat = '| t\(([^\)]*)\)|';
13
14                 preg_match_all($pat,$str,$matches);
15
16                 if(! count($matches))
17                         continue;
18
19                 foreach($matches[1] as $match) {
20                         if(! in_array($match,$arr))
21                                 $arr[] = $match;
22                 }
23
24         }
25
26         $s = '<?php' . "\n";
27         foreach($arr as $a) {
28                 if(substr($a,0,1) == '$')
29                         continue;
30
31                 $s .= '$a->strings[' . $a . '] = ' . $a . ';' . "\n";
32         }
33
34         $zones = timezone_identifiers_list();
35         foreach($zones as $zone)
36                 $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
37         
38         echo $s;