Esempio n. 1
0
                    $args_started = false;
                    $found_domain = false;
                }
            }
            $this->process_token($token, $inplace);
        }
        if ($inplace) {
            $f = fopen($source_filename, 'w');
            fwrite($f, $this->modified_contents);
            fclose($f);
        }
    }
}
// run the CLI only if the file
// wasn't included
$included_files = get_included_files();
if ($included_files[0] == __FILE__) {
    $adddomain = new AddTextdomain();
    if (!isset($argv[1]) || !isset($argv[2])) {
        $adddomain->usage();
    }
    $inplace = false;
    if ('-i' == $argv[1]) {
        $inplace = true;
        if (!isset($argv[3])) {
            $adddomain->usage();
        }
        array_shift($argv);
    }
    $adddomain->process_file($argv[1], $argv[2], $inplace);
}