aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lookup_for_second_argument.php
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lookup_for_second_argument.php')
-rw-r--r--tools/lookup_for_second_argument.php61
1 files changed, 0 insertions, 61 deletions
diff --git a/tools/lookup_for_second_argument.php b/tools/lookup_for_second_argument.php
deleted file mode 100644
index 97ce33728..000000000
--- a/tools/lookup_for_second_argument.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Lookup for second argument in functions _t() and _d() in source code
- *
- * PHP 5.3
- *
- * @license MIT
- * @author Filip (transformation to build a gettext dictionary)
- * @copyright 2014/02
- * based on extract2lang.php by author Romain d'Alverny, rdalverny, rda
-*/
-
-if (php_sapi_name() !== 'cli') {
- echo "CLI only.\n";
- exit(1);
-}
-
-if (version_compare(PHP_VERSION, '5.3.0') < 0) {
- echo "PHP 5.3 needed.\n";
- exit(1);
-}
-
-$php_source = isset($argv[1]) ? $argv[1] : null;
-$domain = isset($argv[2]) ? $argv[2] : null;
-
-if (is_null($php_source) || is_null($domain)) {
- echo <<<U
-Usage:
- php tools/lookup_for_second_argument.php path/to/source.php domain_name
-
- Example:
- php tools/lookup_for_second_argument.php en/index.php index
-
- You can join multiple sources with apostrophe - single quote (') like this:
- 'en/3/download_index.php en/for-pc/index.php en/for-server/index.php en/3/index.php en/3/nav.php'
-
-U;
- exit(1);
-}
-
-date_default_timezone_set(@date_default_timezone_get());
-
-$cmd = sprintf('grep -HrnEi "_(e|t|h|d)\((.*)" %s', $php_source);
-exec($cmd, $out);
-
-foreach ($out as $str) {
- $arr = explode(':', $str);
- $file = array_shift($arr);
- $line = array_shift($arr);
- $arr = implode(':', $arr);
- $arr = str_replace('\\\'', '_apostrophe_', $arr);
- if (preg_match_all('/\_(t|d)\(\'(.+)\'(,.+)$/im', $arr, $test)) { // qq i=PCRE_CASELESS, m=PCRE_MULTILINE, U=PCRE_UNGREEDY
- foreach ($test[3] as $more_arg) { // qq
- $att = $php_source . ' (line ' . $line . '): '. trim($arr) . PHP_EOL; // qq
- $attention[] = $att;
- echo $att . PHP_EOL;
- }
- }
-}
-
-exit(0);