<?php
/**
* Template Processor Engine
* =========================================================================
*
* @File: template.class.php
* @Version: 1.0.2
* @Authors: Kalle Sommer Nielsen <hide@address.com>
*
* =========================================================================
*
* This source code was written by Kalle Sommer Nielsen, this source is
* copyrighted by the ClanTemplates Development Team, and can only be
* used with this copyright notice included.
*
* (C) 2002 ClanTemplates Development Team
*
* =========================================================================
*
* This source code can be downloaded from serveral sites:
*
* http://www.phpclasses.org/
* http://kalle.pastebin.com/
*
* If you feel like you wanna make an improvement, publish or use the
* source code, then please email me at the email listed above.
*
* =========================================================================
*
* Visit www.clantemplates.com for free gaming templates
*
* =========================================================================
*/
class Template
{
/**
* Current cache, contains over all cache in $cache and build
* cache in $current
*/
var $current;
var $cache;
/**
* Template options, can be changed via set_option()
*/
var $allowphp;
var $autoglobal;
var $phpvars;
var $dirprotect;
var $usetempinfo;
var $cwd;
var $ext;
var $trackerrors;
var $cleanoutput;
/**
* Highlight options
*/
var $highlight;
var $highlightmono;
/**
* Holds current defined template variables in $tempvars and
* $options holds change-able options, the $tempvars are stored
* as child categories
*/
var $options;
var $tempvars;
/**
* Used for some sort of log, to see which templates has been
* loaded, how many bytes and total size. The Array has child
* arrays to store data
*/
var $tempinfo;
/**
* Disabled templates holder
*/
var $disabledtemps;
/**
* If any errors has been triggered, this is set to true
*/
var $errortrigger;
/**
* Error handler configuration
*/
var $errorhandler;
/**
* Compiler configuration
*/
var $nocompilerstop;
var $noautoglobals;
/**
* @FUNCTION: Template
* @PARAMETER: $options ARRAY / NULL
* @PARAMETER: $errorhandler ARRAY
*
* @DESCRIPTION:
* Class Constructor
*/
function Template($options = Array(), $errorhandler = Array())
{
/**
* Set Error handler
*/
if(is_array($errorhandler))
{
$this->set_error_handler($errorhandler);
}
/**
* Default options for PHP4 <= compact
*/
/**
* Options
*/
$this->ext = 'html';
$this->cwd = '';
$this->dirprotect = true;
$this->allowphp = false;
$this->usetempinfo = false;
$this->autoglobal = false;
$this->trackerrors = false;
$this->cleanoutput = false;
/**
* Highlight options
*/
$this->highlight = false;
$this->highlightmono = true;
/**
* Miscellaneous
*/
$this->tempvars = Array();
$this->tempinfo = Array();
$this->disabledtemps = Array();
/**
* Compiler configuration
*/
$this->nocompilerstop = true;
$this->noautoglobals = Array();
/**
* Allowed changable options
*/
$this->options = Array(
'autoglobal', 'allowphp', 'highlight', 'nocompilerstop',
'usetempinfo', 'cwd', 'ext', 'highlightmono',
'dirprotect', 'vartype', 'trackerrors', 'cleanoutput'
);
/**
* Errors
*/
$this->errortrigger = false;
$this->errorhandler = Array('type' => 'object', 'object' => __FUNCTION__, 'function' => 'plainerror');
/**
* Apply options
*/
$this->set_configuration($options);
}
/**
* @FUNCTION: get_configuration
* @PARAMETER: $object BOOLEAN
* @PARAMETER: $tempvars BOOLEAN
*
* @DESCRIPTION:
* Returns current configuration as either an object or
* array (with or without template variables)
*/
function get_configuration($object = true, $tempvars = false)
{
if($object)
{
$cfg = new stdClass;
}
else
{
$cfg = Array();
}
foreach($this->options as $option)
{
if($object)
{
$cfg->$option = $this->$option;
}
else
{
$cfg[$option] = $this->$option;
}
}
if($tempvars)
{
if($object)
{
$cfg->tempvars = new stdClass;
}
else
{
$cfg['tempvars'] = Array();
}
if(sizeof($this->tempvars))
{
foreach($this->tempvars as $var => $val)
{
if($object)
{
$cfg->tempvars->$var = $val;
}
else
{
$cfg['tempvars'][$var] = $val;
}
}
}
}
return($cfg);
}
/**
* @FUNCTION: set_option
* @PARAMETER: $var STRING
* @PARAMETER: $val STRING
*
* @DESCRIPTION:
* Applies an single option
*/
function set_option($var, $val)
{
/**
* Allowed to change that option?
*/
if(in_array(strtolower($var), $this->options))
{
/**
* Change...
*/
$this->$var = $val;
}
else
{
/**
* ... No we ain't, throw an error
*/
$this->error("Trying to define a not allowed option!");
}
}
/**
* @FUNCTION: load
* @PARAMETER: $file STRING
* @PARAMETER: $build BOOLEAN
* @PARAMETER: $cwdingore BOOLEAN
* @PARAMETER: $dirprotect BOOLEAN
* @PARAMETER: $source BOOLEAN
* @PARAMETER: $disabledingore BOOLEAN
* @PARAMETER: $htmlencode BOOLEAN
* @PARAMETER: $extingore BOOLEAN
*
* @DESCRIPTION:
* Loads a template into current cache or build cache
*/
function load($file, $build = false, $cwdingore = false, $dirprotect = true, $source = false, $disabledingore = false, $htmlencode = false, $extingore = false)
{
/**
* Is template disabled?
*/
if(!$disabledingore)
{
if(in_array($file, $this->disabledtemps))
{
$this->error('Cannot load a disabled template!');
}
}
/**
* Directory protect
*/
$dirprotect = (!$dirprotect) ? $this->dirprotect : true;
/**
* Load template
*/
$contents = $this->get_template_contents($file, $cwdingore, $dirprotect, $source, $htmlencode, $extingore);
/**
* Adding to the build cache?
*/
if($build)
{
$this->current .= $contents;
}
else
{
$this->cache .= $contents;
}
}
/**
* @FUNCTION: build
* @PARAMETER: $clear BOOLEAN
*
* @DESCRIPTION:
* Builds the build cache into over all cache
*/
function build($clear = true)
{
/**
* Cache that current build isn't empty before adding
*/
if(!empty($this->current))
{
/**
* Add to current cache and clear build cache
*/
$this->cache .= $this->current;
/**
* Clear build cache?
*/
if($clear)
{
$this->clear_cache(true);
}
}
}
/**
* @FUNCTION: clear_cache
* @PARAMETER: $build BOOLEAN
*
* @DESCRIPTION:
* Clears current cache
*/
function clear_cache($build)
{
/**
* Clear build cache ?
*/
if($build)
{
$this->current = '';
}
else
{
$this->cache = '';
}
}
/**
* @FUNCTION: clear_tempvars
*
* @DESCRIPTION:
* Clears all defined template variables
*/
function clear_tempvars()
{
/**
* Any defined template variables?
*/
if(sizeof($this->tempvars))
{
/**
* Override
*/
$this->tempvars = Array();
}
}
/**
* @FUNCTION: assign_vars
* @PARAMETER: $vars ARRAY
* @PARAMETER: $upper BOOLEAN
*
* @DESCRIPTION:
* Assign variables to the tempvars array
*/
function assign_vars($vars = Array(), $upper = false)
{
/**
* Is there any data in the array?
*/
if(is_array($vars) && sizeof($vars))
{
/**
* Add template variables
*/
foreach($vars as $var => $val)
{
$this->assign_var($var, $val, $upper);
}
return(true);
}
else
{
return(false);
}
}
/**
* @FUNCTION: compile
*
* @DESCRIPTION:
* Compile and evaluate cache
*/
function compile()
{
/**
* Clean output buffer ?
*/
if($this->cleanoutput)
{
@ob_end_clean();
}
/**
* Any cache to compile?
*/
if(!$this->highlight && (!empty($this->cache) || !$this->errortrigger))
{
/**
* Assign template variables
*/
if(sizeof($this->tempvars))
{
/**
* Loop all defined template variables
*/
foreach($this->tempvars as $category => $content)
{
$category = strtolower($category);
/**
* Handler for child types
*/
foreach($content as $var => $val)
{
/**
* Handlers
*/
switch($category)
{
case('php'):
eval("\$" . $var . " = '" . str_replace('\'', '\\\'', $val) . "';");
break;
case('html'):
$this->cache = str_replace('<' . $var . '>', $val, $this->cache);
break;
case('xhtml'):
$this->cache = str_replace('<' . $var . ' />', $val, $this->cache);
break;
default:
$this->cache = str_replace('{' . $var . '}', $val, $this->cache);
break;
}
}
}
}
/**
* Is there any global defined variables?
*/
if(sizeof($GLOBALS) > 0 && $this->autoglobal && $this->allowphp)
{
$str = 'global ';
/**
* Super global arrays from PHP 4.1.1 >=
*/
$superglobals = Array('GLOBALS', '_ENV', '_COOKIE', '_SERVER', '_POST', '_GET', '_REQUEST', '_FILES', '_SESSION');
/**
* "Long" super global arrays from PHP 4.1.0 <=
*/
$longsuperglobals = Array('HTTP_ENV_VARS', 'HTTP_POST_VARS', 'HTTP_GET_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_POST_FILES', 'HTTP_SESS_VARS');
/**
* Loop all variables
*/
while(list($var) = each($GLOBALS))
{
/**
* Check that current variable isn't a super global
*/
if(!in_array($var, $superglobals) && !in_array($var, Array('superglobals', 'longsuperglobals')) || substr(PHP_VERSION, 0, 1) <= 4)
{
/**
* Compare again with PHP versions
*/
if(substr(PHP_VERSION, 0, 1) == 5 && @ini_get('register_long_arrays') && !in_array($var, $longsuperglobals) || substr(PHP_VERSION, 0, 1) <= 4 && !in_array($var, $longsuperglobals))
{
if(!in_array($var, $this->noautoglobals))
{
$str .= "\$" . $var . ", ";
}
}
}
}
/**
* Any variables that wasn't super global found ?
*/
if(strlen($str) > 10)
{
/**
* Make them global
*/
$str = substr($str, 0, (strlen($str) - 2)) . ";";
eval($str);
unset($str, $var, $superglobals, $longsuperglobals);
}
}
/**
* Is php allowed to be evaluated?
*/
if($this->allowphp)
{
/**
* Evaluate the php
*/
$eval = @eval("?>" . $this->cache . "<?php ");
/**
* Did eval() produce any errors?
*/
if(strtoupper(gettype($eval)) != 'NULL')
{
$this->error((@ini_get('track_errors') && $this->trackerrors) ? $php_errormsg : 'Compiler error, compiling failed!');
}
}
else
{
/**
* Print cache
*/
($this->nocompilerstop) ? print($this->cache): die($this->cache);
}
}
elseif($this->highlight)
{
/**
* Safe mode check
*/
if(!@ini_get('safe_mode'))
{
/**
* Change the font, to make the source look alot nicer
*/
$this->cache = $this->replace_monospace(highlight_string($this->cache, true));
($this->nocompilerstop) ? print($this->cache): die($this->cache);
}
else
{
$this->error('Unable to use highlight feature when safe mode is turned on!');
}
}
elseif(!$this->errortrigger)
{
$this->error('Unable to compile cache, an error has been triggered!');
}
else
{
return(false);
}
if(!$this->nocompilerstop)
{
exit();
}
return(true);
}
/**
* @FUNCTION: replace_var
* @PARAMETER: $var STRING
* @PARAMETER: $value MIXED
* @PARAMATER: $upper BOOLEAN
* @PARAMETER: $build BOOLEAN
*
* @DESCRIPTION:
* Replaces variables using the curly brackets that the template variables
* require in the cache or build
*/
function replace_var($var, $value, $upper = false, $build = false)
{
/**
* Use strtoupper() ?
*/
$var = ($upper) ? strtoupper($var) : $var;
/**
* Build ?
*/
$cache = ($build) ? 'current' : 'cache';
/**
* Make variable replacement design for different types
*/
if($this->vartype == 'html')
{
$variable = '<' . $var . '>';
}
elseif($this->vartype == 'xhtml')
{
$variable = '<' . $var . ' />';
}
elseif($this->vartype == 'php')
{
$variable = '$' . $var;
}
else
{
$variable = '{' . $var . '}';
}
/**
* Replace data
*/
$this->$cache = str_replace($variable, $value, $this->$cache);
}
/**
* @FUNCTION: exists
* @PARAMETER: $file STRING
* @PARAMETER: $cwdingore BOOLEAN
* @PARAMETER: $dirprotect BOOLEAN
* @PARAMETER: $extingore BOOLEAN
*
* @DESCRIPTION:
* Checks if a template file can be located in the template directory
*/
function exists($file, $cwdingore = false, $dirprotect = true, $extingore = false)
{
/**
* Directory protect
*/
$dirprotect = (!$dirprotect) ? $this->dirprotect : true;
if($dirprotect)
{
if(ereg("\\\\", $file) || ereg("\\/", $file))
{
$this->error('Cannot load template from directory as its not allowed!');
}
}
/**
* Make path
*/
if($cwdingore)
{
$path = $file;
}
else
{
$path = $this->cwd . $file;
}
/**
* Ingore extension ?
*/
if(!$extingore)
{
$path .= '.' . $this->ext;
}
/**
* Does template exists?
*/
return((is_file($path) ? true : false));
}
/**
* @FUNCTION: get_template_contents
* @PARAMETER: $file STRING
* @PARAMETER: $cwdingore BOOLEAN
* @PARAMETER: $dirprotect BOOLEAN
* @PARAMETER: $source BOOLEAN
* @PARAMETER: $htmlencode BOOLEAN
* @PARAMETER: $extingore BOOLEAN
*
* @DESCRIPTION:
* Checks if a template file can be located in the template directory
*/
function get_template_contents($file, $cwdingore = false, $dirprotect = true, $source = false, $htmlencode = false, $extingore = false)
{
/**
* Directory protect
*/
$dirprotect = (!$dirprotect) ? $this->dirprotect : true;
/**
* Make path
*/
if($cwdingore)
{
$path = $file;
}
else
{
$path = $this->cwd . $file;
}
/**
* Ingore extension ?
*/
if(!$extingore)
{
$path .= '.' . $this->ext;
}
/**
* Does template file exists?
*/
if(!$this->exists($file, $cwdingore, $dirprotect, $extingore))
{
/**
* Sadly not, trigger error event ...
*/
$this->error("Template Error\n\nUnable to load non-existing template!\nTemplate: " . $file);
}
/**
* Get template data
*/
if($source)
{
/**
* Safe mode check
*/
if(@ini_get('safe_mode'))
{
$this->error('Unable to use highlight feature when safe mode is turned on!');
}
else
{
$data = $this->replace_monospace(highlight_file($path, true));
}
}
elseif(!is_readable($path))
{
$this->error('Template file is not read-able!');
}
else
{
/**
* Standard file data
*/
$data = @file_get_contents($path) or $this->error('Error while reading template file data!');
}
/**
* Log data
*/
if($this->usetempinfo)
{
$this->tempinfo[] = Array(
'file' => $file,
'size' => filesize($path),
'path' => $path,
'cwdingore' => $cwdingore
);
}
/**
* HTML Encode ?
*/
$data = ($htmlencode) ? htmlspecialchars($data) : $data;
/**
* Return it
*/
return($data);
}
/**
* @FUNCTION: error
* @PARAMETER: $msg STRING
*
* @DESCRIPTION:
* call the core to trigger error event
*/
function error($msg = '')
{
/**
* Defaults
*/
$obj = null;
$errors = true;
/**
* Is valid error handler ?
*/
if($this->errorhandler['type'] == 'object' && class_exists($this->errorhandler['object']) && method_exists(new $this->errorhandler['object'], $this->errorhandler['function']))
{
/**
* Instance
*/
$obj = new $this->errorhandler['object'];
/**
* No errors
*/
$errors = false;
}
elseif($this->errorhandler['type'] == 'function' && function_exists($this->errorhandler['function']))
{
/**
* Function variable
*/
$function = $this->errorhandler['function'];
/**
* No errors
*/
$errors = false;
}
/**
* Any errors?
*/
if($errors)
{
/**
* Make plain text error, which calls trigger_error()
*/
$this->plainerror('Error handler setup failed!');
}
/**
* Is object?
*/
if(is_object($obj))
{
/**
* Object handler
*/
$obj->{$this->errorhandler['function']}($msg);
}
else
{
/**
* Function handler
*/
$function($msg);
}
/**
* End
*/
return(true);
}
/**
* @FUNCTION: plainerror
*
* @DESCRIPTION:
* Makes a plaintext error, only used when error handler fails
*/
function plainerror($msg)
{
trigger_error(nl2br($msg) . "<br /> <br />", E_USER_ERROR);
}
/**
* @FUNCTION: errortrigger
*
* @DESCRIPTION:
* Checks whenever an error is triggered or not
*/
function errortrigger()
{
return(($this->errortrigger) ? true : false);
}
/**
* @FUNCTION loadedtemps
*
* @DESCRIPTION
* Returns information that can be used as debug
* when the 'usetempinfo' option is enabled'
*/
function loadedtemps()
{
if($this->usetempinfo)
{
return($this->tempinfo);
}
else
{
$this->error('Can\'t access the template info, since its disabled!');
}
return(false);
}
/**
* @FUNCTION: addcache
* @PARAMETER: $code STRING
* @PARAMETER: $build BOOLEAN
* @PARAMETER: $source BOOLEAN
* @PARAMETER: $htmlencode BOOLEAN
*
* @DESCRIPTION
* Adds a custom piece of code into the cache
*/
function addcache($code, $build = false, $source = false, $htmlencode = false)
{
/**
* HTML Encode ?
*/
$code = ($htmlencode) ? htmlspecialchars($code) : $code;
/**
* Build ?
*/
$cache = ($build) ? 'current' : 'cache';
/**
* Highlight ?
*/
if($source)
{
/**
* Safe mode check
*/
if(@ini_get('safe_mode'))
{
$this->error('Unable to use highlight feature when safe mode is turned on!');
}
else
{
$this->$cache .= $this->replace_monospace(highlight_string($code, true));
}
}
else
{
/**
* Nothing special, just add the code...
*/
$this->$cache .= $code;
}
}
/**
* @FUNCTION: set_error_handler
* @PARAMETER: $setup ARRAY
*
* @DESCRIPTION:
* Sets error handler configuration
*/
function set_error_handler($setup = Array())
{
/**
* Prevent php error from being triggered if set_error_handler()
* is executed twice or more times
*/
if(!function_exists('array_keys_exists'))
{
/**
* Internal function to check if array keys exists
*/
function array_keys_exists($keys = Array(), $array = Array())
{
if(!is_array($keys) || !is_array($array) || sizeof($keys) != sizeof($array))
{
return(false);
}
$return = Array();
for($c = 0; $c < sizeof($array); ++$c)
{
$return[] = (array_key_exists($keys[$c], $array)) ? 'true' : 'false';
}
if(in_array('false', $return))
{
return(false);
}
return(true);
}
}
/**
* Validate setup
*/
if(is_array($setup) && sizeof($setup) >= 2)
{
/**
* Does the array has the correct array keys?
*/
if(array_keys_exists(Array('type', 'object', 'function'), $setup))
{
/**
* Set error handler data
*/
$this->errorhandler = Array(
'type' => $setup['type'],
'object' => $setup['object'],
'function' => $setup['function']
);
}
elseif(array_keys_exists(Array('type', 'function'), $setup))
{
/**
* Set error handler data
*/
$this->errorhandler = Array(
'type' => $setup['type'],
'function' => $setup['function']
);
}
else
{
$this->error('Unable to set error handler!');
}
}
/**
* Everything worked out
*/
return(true);
}
/**
* @FUNCTION: replace_monospace
* @PARAMETER: $source STRING
*
* @DESCRIPTION:
* Adds a style to the <code> tags in highlight'd sources if
* the option 'highlightmono' is turned on
*/
function replace_monospace($source)
{
/**
* Return source
*/
return(($this->highlightmono) ? str_replace('<code>', '<code style="font: 11px Monaco, Courier, Monospace;">', $source) : $source);
}
/**
* @FUNCTION: clear_tempinfo
*
* @DESCRIPTION:
* Clears all defined tempinfo data
*/
function clear_tempinfo()
{
if(sizeof($this->tempinfo))
{
$this->tempinfo = Array();
}
return(true);
}
/**
* @FUNCTION: set_configuration
* @PARAMETER: $options ARRAY
*
* @DESCRIPTION:
* Sets a new configuration with multiple options at once
*/
function set_configuration($options)
{
/**
* Check if any options has been set though the
* $options parameter
*/
if(sizeof($options) && !is_null($options))
{
foreach($options as $var => $val)
{
if(!in_array(strtolower(gettype($val)), Array('resource', 'object', 'array')))
{
$this->set_option($var, $val);
}
else
{
$this->error('Trying to set an option to a type of resource/object/array which isn\'t allowed!');
}
}
}
}
/**
* @FUNCTION: disable_templates
* @PARAMETER: $templates ARRAY
*
* @DESCRIPTION:
* Disables a set of templates
*/
function disable_templates($templates)
{
if(is_array($templates) && sizeof($templates))
{
foreach($templates as $name)
{
$this->disable_template($name);
}
return(true);
}
else
{
return(false);
}
}
/**
* @FUNCTION: disable_template
* @PARAMETER: $template STRING
*
* @DESCRIPTION:
* Disables a single template
*/
function disable_template($template)
{
if(is_string($template) && strlen($template) > 0 && !in_array($template, $this->disabledtemps))
{
$this->disabledtemps[] = $template;
return(true);
}
else
{
return(false);
}
}
/**
* @FUNCTION: get_disabled_templates
* @PARAMETER: $returnobj BOOLEAN
*
* @DESCRIPTION:
* Gets disabled templates
*/
function get_disabled_templates($returnobj = false)
{
if(sizeof($this->disabledtemps))
{
if($returnobj)
{
$obj = new stdClass;
foreach($this->disabledtemps as $temp)
{
$obj->$temp = true;
}
return($obj);
}
else
{
return($this->disabledtemps);
}
}
else
{
return(false);
}
}
/**
* @FUNCTION: is_disabled
* @PARAMETER: $file STRING
*
* @DESCRIPTION:
* Checks if a template is disabled
*/
function is_disabled($file)
{
return(in_array($file, $this->disabledtemps));
}
/**
* @FUNCTION: clear_disabled_templates
*
* @DESCRIPTION:
* Clear all disabled templates
*/
function clear_disabled_templates()
{
if(sizeof($this->disabledtemps))
{
$this->disabledtemps = Array();
}
}
/**
* @FUNCTION: get_cache
* @PARAMETER: $build BOOLEAN
*
* @DESCRIPTION:
* Gets current cache 'as-it-is-now'
*/
function get_cache($build)
{
return(($build) ? $this->current : $this->cache);
}
/**
* @FUNCTION: disable_autoglobal_var
* @PARAMETER: $variable STRING
*
* @DESCRIPTION:
* Disable an autoglobal variable
*/
function disable_autoglobal_var($variable)
{
if(ereg("^[a-zA-Z0-9_]", $variable) && !in_array($variable, $this->noautoglobals))
{
$this->noautoglobals[] = $variable;
}
else
{
$this->error('Trying to disable an invalid variable name (means it contains invalid characters)');
}
}
/**
* @FUNCTION: disable_autoglobal_vars
* @PARAMETER: $vars ARRAY
*
* @DESCRIPTION:
* Disable a set of autoglobal variables
*/
function disable_autoglobal_vars($vars = Array())
{
if(sizeof($vars) && is_array($vars))
{
foreach($vars as $var)
{
$this->disable_autoglobal_var($var);
}
}
else
{
return(false);
}
}
/**
* @FUNCTION: get_disabled_autoglobals
*
* @DESCRIPTION:
* Gets all disabled autoglobal variables
*/
function get_disabled_autoglobals()
{
return($this->noautoglobals);
}
/**
* @FUNCTION: clear_disabled_autoglobals
*
* @DESCRIPTION:
* Clears all disabled autoglobals
*/
function clear_disabled_autoglobals()
{
if(sizeof($this->noautoglobals))
{
$this->noautoglobals = Array();
}
else
{
return(false);
}
}
/**
* @FUNCTION: assign_var
* @PARAMETER: $var STRING
* @PARAMETER: $val MIXED
* @PARAMETER: $upper BOOLEAN
*
* @DESCRIPTION:
* Assigns a single variable
*/
function assign_var($var, $val, $upper = false)
{
$var = ($upper) ? strtoupper($var) : $var;
$this->tempvars[$this->vartype][$var] = $val;
}
/**
* @FUNCTION: replace_vars
* @PARAMETER: $vars ARRAY
* @PARAMETER: $upper BOOLEAN
* @PARAMETER: $build BOOLEAN
*
* @DESCRIPTION:
* Replace a set of variables
*/
function replace_vars($vars = Array(), $upper = false, $build = false)
{
if(sizeof($vars) && is_array($vars))
{
foreach($vars as $var => $val)
{
$this->replace_var($var, $val, $upper, $build);
}
return(true);
}
else
{
return(false);
}
}
}
?>