$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); }
} return $this->modified_contents; } } // 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); } if (is_dir($argv[2])) { $directory = new RecursiveDirectoryIterator($argv[2], RecursiveDirectoryIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator($directory); foreach ($files as $file) { if ('php' === $file->getExtension()) { $adddomain->process_file($argv[1], $file->getPathname(), $inplace); } } } else { $adddomain->process_file($argv[1], $argv[2], $inplace); } }