X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=util%2Fextract.php;h=18fbb9df00add4d4d7d11c771c70f3d609050f26;hb=b8114f4e9d4764ab5be440d77c206337899d983a;hp=90127f3c1b2e4811108ed85c62a53027eb638e8c;hpb=4cff911939b263993eb41682ca558c975e2db01f;p=friendica.git diff --git a/util/extract.php b/util/extract.php old mode 100644 new mode 100755 index 90127f3c1b..18fbb9df00 --- a/util/extract.php +++ b/util/extract.php @@ -1,63 +1,100 @@ +#!/usr/bin/env php strings[' . $match . '] = ' . $match . ';' . "\n"; } } - if(count($matchestt)){ - foreach($matchestt[1] as $match) { - $matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match); - if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){ - $arr[] = $matchtkns; + } + if (count($matchestt)) { + foreach ($matchestt[1] as $match) { + $matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|", $match); + if (count($matchtkns) == 3 && !in_array($matchtkns[0], $arr)) { + if (substr($matchtkns[1], 0, 1) == '$') { + continue; } + + $arr[] = $matchtkns[0]; + + $s .= '$a->strings[' . $matchtkns[0] . "] = array(\n"; + $s .= "\t0 => " . $matchtkns[0] . ",\n"; + $s .= "\t1 => " . $matchtkns[1] . ",\n"; + $s .= ");\n"; } } - } +} - $s = 'strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n"; } -'; +echo $s; - foreach($arr as $a) { - if (is_array($a)){ - if(substr($a[1],0,1) == '$') - continue; - $s .= '$a->strings[' . $a[0] . "] = array(\n"; - $s .= "\t0 => ". $a[0]. ",\n"; - $s .= "\t1 => ". $a[1]. ",\n"; - $s .= ");\n"; - } else { - if(substr($a,0,1) == '$') - continue; - $s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n"; +function glob_recursive($path) { + $dir_iterator = new RecursiveDirectoryIterator($path); + $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); + + $return = []; + foreach ($iterator as $file) { + if ($file->getBasename() != '.' && $file->getBasename() != '..') { + $return[] = $file->getPathname(); } } - $zones = timezone_identifiers_list(); - foreach($zones as $zone) - $s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n"; - - echo $s; \ No newline at end of file + return $return; +}