Source for file Tool.php
Documentation is available at Tool.php
* Command line tool to use the HTML_Template_PHPLIB validator and generator.
* @package HTML_Template_PHPLIB
* @author Christian Weiske <cweiske@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear.php.net/package/HTML_Template_PHPLIB
$this->{'do' . ucfirst($strAction)}($args);
}//function HTML_Template_PHPLIB_Tool($args)
$args = $GLOBALS['argv'];
* Returns the action to execute
* @param array &$args Array of command line arguments
* @return string Action to execute
}//function getAction(&$args)
* Echoes the message and exist php with the given
* @param string $strMessage Message to display
* @param int $nExitCode Exit code
function dieHard($strMessage, $nExitCode)
}//function dieHard($strMessage, $nExitCode)
* Prints the help message to stdout
Usage: html_template_phplibtool action parameters
Tool to validate and work with HTML templates
mode: (- and -- are optional)
h, help Show this help screen
g, generate Generate PHP code for the template
v, validate Validate a template file
* Validates the files given on the cmdline
* @param array $args Command line arguments (files)
$this->dieHard("No template files to validate\n", 1 );
require_once 'HTML/Template/PHPLIB/Validator.php';
foreach ($args as $file) {
if ($arErrors === true ) {
echo 'No errors found in ' . $file . "\n";
} else if ($arErrors === false ) {
echo 'Some unexpected error in ' . $file . "\n";
echo count($arErrors) . ' errors in ' . $file . "\n";
foreach ($arErrors as $arError) {
echo ' Line #' . $arError['line'] . ': ' . $arError['message'] . "\n";
echo 'File does not exist: ' . $file . "\n";
}//function doValidate($args)
* Generates PHP code for the given template file
* @param array $args Command line arguments
$this->dieHard("No template file given\n", 1 );
require_once 'HTML/Template/PHPLIB/Generator.php';
}//function doGenerate($args)
}//class HTML_Template_PHPLIB_Tool
Documentation generated on Mon, 11 Mar 2019 15:10:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|