Commit 0b698d27 authored by totten's avatar totten

CRM-15832 - (js,smarty)-extractor.php - Extract main()

parent 2b67f012
#!/usr/bin/php
<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
/**
* js-extractor.php - rips gettext strings from Javascript ts() calls
*
......@@ -35,11 +33,29 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
*/
$root = $_SERVER['argv'][1];
array_splice($_SERVER['argv'], 1, 1);
/**
* Bootstrap, process command line arguments, and kick off the real work.
*/
function main($argc, $argv) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
global $root, $extensions;
// extensions of js files, used when going through a directory
$extensions = array('js');
$root = $argv[1];
array_splice($argv, 1, 1);
// extensions of js files, used when going through a directory
$extensions = array('js');
for ($ac = 1; $ac < $argc; $ac++) {
if (is_dir($argv[$ac])) {
do_dir($argv[$ac]);
}
else {
do_file($argv[$ac]);
}
}
}
/**
* "fix" string - strip slashes, escape and convert new lines to \n
......@@ -118,11 +134,4 @@ function do_dir($dir) {
$d->close();
}
for ($ac = 1; $ac < $_SERVER['argc']; $ac++) {
if (is_dir($_SERVER['argv'][$ac])) {
do_dir($_SERVER['argv'][$ac]);
}
else {
do_file($_SERVER['argv'][$ac]);
}
}
main($_SERVER['argc'], $_SERVER['argv']);
#!/usr/bin/php
<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
/**
* smarty-extractor.php - rips gettext strings from Smarty {ts} calls
*
......@@ -38,20 +36,38 @@ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
*/
$root = $_SERVER['argv'][1];
array_splice($_SERVER['argv'], 1, 1);
/**
* Bootstrap, process command line arguments, and kick off the real work.
*/
function main($argc, $argv) {
global $ldq, $rdq, $cmd, $root, $extensions;
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
// smarty open tag
$ldq = preg_quote('{');
$root = $argv[1];
array_splice($argv, 1, 1);
// smarty close tag
$rdq = preg_quote('}');
// smarty open tag
$ldq = preg_quote('{');
// smarty command
$cmd = preg_quote('ts');
// smarty close tag
$rdq = preg_quote('}');
// extensions of smarty files, used when going through a directory
$extensions = array('tpl', 'hlp');
// smarty command
$cmd = preg_quote('ts');
// extensions of smarty files, used when going through a directory
$extensions = array('tpl', 'hlp');
for ($ac = 1; $ac < $argc; $ac++) {
if (is_dir($argv[$ac])) {
do_dir($argv[$ac]);
}
else {
do_file($argv[$ac]);
}
}
}
/**
* "fix" string - strip slashes, escape and convert new lines to \n
......@@ -154,11 +170,4 @@ function do_dir($dir) {
$d->close();
}
for ($ac = 1; $ac < $_SERVER['argc']; $ac++) {
if (is_dir($_SERVER['argv'][$ac])) {
do_dir($_SERVER['argv'][$ac]);
}
else {
do_file($_SERVER['argv'][$ac]);
}
}
main($_SERVER['argc'], $_SERVER['argv']);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment