#!/usr/local/php7/bin/php
<?php
error_reporting(-1);
require_once('ei-tools.php');
function usage() {
return "\n" . $GLOBALS['argv'][0] . " [script_name] [script_installation_path] [template_name]
\t - script_name --> " . implode(', ', $GLOBALS['supported_scripts']);
}
if (empty($argv[1])) err('Missing script name' . usage());
if (empty($argv[2])) err('Missing installation path' . usage());
if (empty($argv[3])) err('Missing template name' . usage());
$script = strtolower($argv[1]);
$path = $argv[2];
$template = $argv[3];
if (!is_dir($path) || !file_exists($path))
err('Invalid installation path');
script_supported($script);
$config_file = script_config_file($script, $path);
if (!file_exists($config_file))
err('Missing ' . $script . ' config file [' . $config_file . ']');
// get script details
$details = get_script_config($script, $config_file);
// check if template folder exists
switch($script) {
case "wordpress":
$dir = $path . '/wp-content/themes/' . $template;
break;
case "joomla":
$dir = $path . '/templates/' . $template;
break;
}
if (!is_dir($dir))
err('Template directory is missing: ' . $dir);
// set script template
set_script_template($script, $template, $details);
echo 1;