예제 #1
0
    private function processTemplateContent($template)
    {
        ob_start();
        eval($template);
        $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }
    public function printUsage($errorMessage)
    {
        echo "AutoConfig: {$errorMessage}\n\n";
        echo "AutoConfig: Processes a template file (or directory) using data from a properties file to\n" . "produce a new file (or set of files).\n\n";
        echo "Usage: AutoConfig.php [options]\n";
        echo "Where options are:\n";
        echo "  -p props_file : Properties file to use.\n";
        echo "  -tf template_file : Template file. Cannot be used with the -td option.\n";
        echo "  -td template_dir : Template directory. Cannot be used with the -tf option.\n";
        echo "  -o output_dir : Output directory.\n";
        echo "  -r 0755 : permission on generated files in octal format .\n";
        return false;
    }
}
// Main
$autoconfig = new AutoConfig();
if ($autoconfig->parseArgs($argv)) {
    $autoconfig->process();
    exit(0);
    // For some reason, under ubuntu exit code is 255 without this line...
} else {
    exit(1);
}