<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Template |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2003 June Systems BV |
// +---------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or modify it |
// | under the terms of the GNU Lesser General Public License as published by |
// | the Free Software Foundation; either version 2.1 of the License, or (at |
// | your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public License |
// | along with this library; if not, write to the Free Software Foundation, |
// | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
// +---------------------------------------------------------------------------+
// | Authors: Janroel Koppen <hide@address.com> |
// +---------------------------------------------------------------------------+
//
// $Id: Template.inc.php 241 2008-06-13 08:27:16Z oli $
//
// Nitro's parent Template class
//
/**
* Nitro Template
*
* This is the file containing all Nitro template functions and classes. The
* main class is the NitroTemplate class which is the only one that should ever
* be used in other scripts. This class uses the rest of the functions in this file
* to do its work.
*
* @package Nitro
* @subpackage Base
* @author Janroel Koppen
* @version $Revision: 1.64 $
* @copyright 2004 June Systems BV
*/
/**
* Defines
*/
define ('NITRO_DEFAULT_DBALIAS', "Nitro");
$GlobalDBAlias = NITRO_DEFAULT_DBALIAS; // for Nitro_get_template(), Nitro_get_timestamp() and GetNitroTemplateID() only
require_once ('Nitro/NitroDB.inc.php');
/**
* Include Smarty files
*
* This class is based on the Smarty template engine (@link http://smarty.php.net)
*/
global $__NitroConf;
$SmartyIncludeDir = NITRO_PATH.$__NitroConf->CONF['Settings']['TemplateEnginePath'];
if (file_exists($SmartyIncludeDir)) {
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
set_include_path(get_include_path().";".$SmartyIncludeDir);
} else {
set_include_path(get_include_path().":".$SmartyIncludeDir);
}
require_once "Smarty.class.php";
} else {
echo "ERROR: cannot find template engine ".$SmartyIncludeDir."<BR>";
}
/**
* Nitro template class
*
* This is the Nitro Smarty template class. It supplies a wrapper around
* the smarty functions.
*
* @package Nitro
* @subpackage Base
*/
class NitroTemplate {
/* object $DB DB connection object @access private */
var $DB = NULL;
/* object $Sess Session object @access private */
var $Sess = NULL;
/* object $Conf Configuration object @access private */
var $Conf = NULL;
/* int $TemplateID Template ID */
var $TemplateID = NULL;
/* object $Engine Template object engine */
var $Engine = NULL;
/* string $Name Name of the loaded template */
var $Name = NULL;
/* string $IDString IDString of the loaded template */
var $IDString = NULL;
/* string $Version Version of the loaded template */
var $Version = NULL;
/* string $Language Language of the loaded template */
var $Language = NULL;
/* string $Published Published state of the loaded template */
var $Published = NULL;
/* string $VisibleFrom Begin of visibility of the loaded template */
var $VisibleFrom = NULL;
/* string $VisibleTill End of visibility of the loaded template */
var $VisibleTill = NULL;
/* string $Body Body van template */
var $Body = NULL;
/* string $Timestamp Unix timestamp van last edit */
var $TimeStamp = NULL;
var $CreatedByUserID = NULL;
var $CreatedOn = NULL;
var $EditedByUserID = NULL;
var $EditedOn = NULL;
var $Variables = Array();
var $Caching = FALSE;
var $CacheLifeTime = FALSE;
/**
* Nitro template constructor
*
* This function is the constructor of the template class. It initializes
* the Smarty template engine and sets class env variables.
*
* @access public
*/
function NitroTemplate( $TemplateID = FALSE, $Settings = FALSE, $DBAlias = NITRO_DEFAULT_DBALIAS) {
global $DB, $GlobalDBAlias, $__NSess, $__NitroConf;
$GlobalDBAlias = $DBAlias;
$this->DB = $DB[$DBAlias];
$this->Sess =& $__NSess;
$this->Conf =& $__NitroConf->CONF;
$this->TemplateID = $TemplateID;
if ($this->Engine = new Smarty()) {
if (NITRO_DEBUG) $this->Engine->error_reporting = true;
// Check whether all paths exist
$CachePath = NitroGetTmpCacheDir('Smarty');
// Check cache path. This is very crude, but if the path is not writable, nothing works!
if (!is_writeable($CachePath)) { echo 'ERROR: Smarty cachepath ('.$CachePath.') is not writable!'; exit; }
if (!file_exists($CachePath.DIRECTORY_SEPARATOR."template")) mkdir($CachePath.DIRECTORY_SEPARATOR."template");
if (!file_exists($CachePath.DIRECTORY_SEPARATOR."template_c")) mkdir($CachePath.DIRECTORY_SEPARATOR."template_c");
if (!file_exists($CachePath.DIRECTORY_SEPARATOR."config")) mkdir($CachePath.DIRECTORY_SEPARATOR."config");
if (!file_exists($CachePath.DIRECTORY_SEPARATOR."cache")) mkdir($CachePath.DIRECTORY_SEPARATOR."cache");
// register the resource name "Nitro"
$this->Engine->register_resource("Nitro", array("Nitro_get_template", "Nitro_get_timestamp", "Nitro_get_secure", "Nitro_get_trusted"));
// Smarty's template_dir can only be 1 directory, so only use first found Path from TEMPLATE_PATH
$Template_Paths = explode(PATH_SEPARATOR, TEMPLATE_PATH);
$this->Engine->template_dir = $Template_Paths[0];
$this->Engine->compile_dir = $CachePath.DIRECTORY_SEPARATOR."template_c".DIRECTORY_SEPARATOR;
$this->Engine->config_dir = $CachePath.DIRECTORY_SEPARATOR."config".DIRECTORY_SEPARATOR;
$this->Engine->cache_dir = $CachePath.DIRECTORY_SEPARATOR."cache".DIRECTORY_SEPARATOR;
$this->Engine->caching = FALSE; // temp
// register functions available to the templates
$this->Engine->register_function("PageIDString", "NitroSmartyGetPageIDString", false);
$this->Engine->register_function("PageLink", "NitroSmartyGetPageLink", false);
$this->Engine->register_function("NitroVariableAssign", "NitroVariableAssign", FALSE);
$this->Engine->register_function("NitroLanguage", "NitroSmartyLanguageQuery", FALSE);
$this->Engine->register_function("NitroGetText", "NitroSmartyGetText", FALSE);
$this->Engine->register_function("NitroStripTags", "NitroSmartyStripTags", FALSE);
$this->Engine->register_function("ObjectIDString", "NitroSmartyGetObjectIDString", FALSE);
$this->Engine->register_function("CurrentP", "NitroSmartyGetCurrentP", false);
$this->Engine->register_function("GetGlobalValue", "NitroSmartyGetGlobalValue", FALSE);
$this->Engine->register_function("SetGlobalValue", "NitroSmartySetGlobalValue", FALSE);
}
}
// NitroTemplate::Install($DB, $InstallSettings); creates db table(s) if necessary
function Install($DB, $InstallSettings = "") {
$Query = "CREATE TABLE IF NOT EXISTS `Template` (
`TemplateID` int(10) unsigned NOT NULL auto_increment,
`IDString` varchar(50) default NULL,
`Name` varchar(255),
`Data` text,
`TimeStamp` timestamp
PRIMARY KEY (`TemplateID`)) TYPE=MyISAM AUTO_INCREMENT=1 ;";
$Result = $DB->query($Query);
// FIX ME: create TemplateData too
// return ($Result);
}
/**
* Assign a value to a variable in the template
*
* @param string $VarName Name of the variable to set
* @param strin $Value Value of the variable to set
* @access public
*/
function Assign($VarName, $Value) {
if ($this->Engine) {
return ($this->Engine->assign($VarName, $Value));
}
}
function Clear($VarName) {
if ($this->Engine) {
return ($this->Engine->assign($VarName, NULL));
}
}
function ClearAll() {
if ($this->Engine) {
return ($this->Engine->clear_all_assign());
}
}
function Clear_All_Assign() {
echo "<!-- function deprecated: NitroTemplate->Clear_All_Assign() -->";
return ($this->ClearAll());
}
function Caching($Caching, $LifeTime = FALSE) {
$this->Caching = $Caching;
$this->CacheLifeTime = $LifeTime;
if ($this->Caching) {
if ((int)$LifeTime) {
$this->Engine->caching = 2;
$this->Engine->cache_lifetime = (int)$LifeTime;
} else {
$this->Engine->caching = 1;
}
} else {
$this->Engine->caching = 0;
$this->Engine->cache_lifetime = 0;
$this->Engine->force_compile = 1;
}
}
function IsCached($CacheID) {
return $this->Engine->is_cached("Nitro:".$this->TemplateID, $CacheID);
}
function ClearCache($CacheID) {
return $this->Engine->clear_cache("Nitro:".$this->TemplateID, $CacheID);
}
function Fetch($TemplateName = "/Defaults/Templates/Default.tpl", $CacheID = FALSE)
{
DebugGroup('Template', 'Fetch', "Fetching TemplateID ".$this->TemplateID, __FILE__, __LINE__, DEBUG_APPL_OK);
//echo "<!-- TemplateID: ".$this->TemplateID." TemplateName: $TemplateName \n-->";
if ($this->Engine) {
if (substr($this->TemplateID, 0, 5) == 'file:') {
$rv = $this->Engine->fetch($this->TemplateID, $CacheID); // OK?
} elseif ($this->TemplateID) {
$rv = $this->Engine->fetch("Nitro:".$this->TemplateID, $CacheID); // OK?
} else {
Debug('Template', 'Fetch', "No TemplateID, Fetching T ".$TemplateName, __FILE__, __LINE__, DEBUG_APPL_OK);
$Found = FALSE;
$Template_Paths = explode(PATH_SEPARATOR, TEMPLATE_PATH);
if (is_array($Template_Paths) && count($Template_Paths)) {
foreach ($Template_Paths AS $Template_Path) {
if (file_exists($Template_Path.$TemplateName)) {
$Found = $Template_Path.$TemplateName;
break;
}
}
}
if (strlen($Found)) {
$rv = $this->Engine->fetch($Found);
} else {
$rv = $this->Engine->fetch($TemplateName);
}
}
if (strlen($rv)) {
Debug('Template', 'Fetch', "Template fetched (".strlen($rv)." bytes)", __FILE__, __LINE__, DEBUG_APPL_OK);
} else {
Debug('Template', 'Fetch', "Error fetching template? Template was empty: ".$this->Engine->Error, __FILE__, __LINE__, DEBUG_APPL_ERR);
}
} else {
Debug('Template', 'Fetch', "No template engine", __FILE__, __LINE__, DEBUG_APPL_ERR);
$rv = "No Template Engine!";
}
DebugCloseGroup(DEBUG_APPL_OK);
return $rv;
}
function GetTemplateOptions() {
return FALSE;
}
function SetTemplateSettings($Settings) {
$this->Settings = $Settings;
}
function GetTemplateSettings() {
return $this->Settings;
}
function GetTemplateRuntimeOptions() {
return FALSE;
}
}
function NitroSmartySetGlobalValue($params)
{
extract($params);
if (strlen($Variable)) {
$globalVar = ereg_replace('(\[.*\])*', '', $Variable); // remove array [] from variable
eval('global $'.$globalVar.';');
eval('$Variable =& $'.$Variable.';');
$Variable = $Value;
}
}
function NitroSmartyGetGlobalValue($params)
{
extract($params);
if (strlen($Variable)) {
$globalVar = ereg_replace('(\[.*\])*', '', $Variable); // remove array [] from variable
eval('global $'.$globalVar.';');
eval('$Variable =& $'.$Variable.';');
return $Variable;
}
}
/**
* Function to get PageID string from System ID string within template
*/
function NitroSmartyGetPageIDString($params) {
extract($params);
return NitroGetPageIDString($SystemIDString);
}
/**
* Function to get ObjectID string from System ID string within template
*/
function NitroSmartyGetObjectIDString($params) {
extract($params);
return NitroGetObjectIDString($SystemIDString);
}
/**
* Function to get Nitro page link from System ID string within template
*/
function NitroSmartyGetPageLink($params) {
global $DB, $__NSess;
extract($params);
$IDString = NitroGetPageIDString($SystemIDString);
if (!$Text) {
$Query = "SELECT Title
FROM Page AS P, PageData AS PD
WHERE P.IDString = ".NitroPrepareDB($IDString)."
AND P.PageID = PD.PageID
AND (PD.Language = ".NitroPrepareDB($__NSess->Language)." OR PD.Language = '')
ORDER BY PD.Language DESC, PD.Version DESC
";
$Text = $DB["Nitro"]->getOne($Query);
}
if ($Class) $Class = " CLASS=\"$Class\"";
else $Class = "";
if ($Style) $Style = " STYLE=\"$Style\"";
else $Style = "";
return "<A HREF=\"".$this->Conf["Settings"]["PageURL"].$IDString."\"$Class$Style>$Text</A>";
}
function NitroVariableAssign($Variable) {
return ('<DIV class="NitroVariableAssign">'.$Variable.'</DIV>');
}
function NitroSmartyLanguageQuery($params) {
extract($params);
if ($IDString) {
include_once "Nitro/Text.inc.php";
return Language($IDString);
}
}
function NitroSmartyGetText($params) {
extract($params);
if ($IDString) {
include_once "Nitro/Text.inc.php";
$rv = GetObjectLink($IDString);
if (!$rv) $rv = $Default;
return $rv;
}
}
function NitroSmartyStripTags($params) {
extract($params);
$String = ereg_replace("<[^>]*>","",$String);
return $String;
}
function NitroSmartyGetCurrentP()
{
return $_GET['P'];
}
/**
* These functions originate from http://smarty.php.net
*
* http://smarty.php.net/manual/en/templates.from.elsewhere.php
*
* Usage:
* // register the resource name "Nitro"
* $smarty->register_resource("Nitro", array("Nitro_get_template",
* "Nitro_get_timestamp",
* "Nitro_get_secure",
* "Nitro_get_trusted"));
*
* // using resource from php script
* $smarty->display("Nitro:index.tpl");
*
* {* using resource from within Smarty template *}
* {include file="Nitro:/extras/navigation.tpl"}
*/
function Nitro_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
DebugGroup(__CLASS__, __FUNCTION__, "Getting template: ".$tpl_name, __FILE__, __LINE__, DEBUG_APPL_OK);
global $DB, $GlobalDBAlias, $__NSess, $__NitroTemplate_get_template_Cache;
if (!isset($__NitroTemplate_get_template_Cache)) $__NitroTemplate_get_template_Cache = array();
if (isset($__NitroTemplate_get_template_Cache[$tpl_name])) {
$tpl_source = $__NitroTemplate_get_template_Cache[$tpl_name];
Debug(__CLASS__, __FUNCTION__, "Using globally cached template", __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = TRUE;
} else {
Debug(__CLASS__, __FUNCTION__, "Getting template from database", __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = FALSE;
$TemplateID = $tpl_name; // Hack
$Query = "
SELECT TD.Body, T.IDString
FROM Template AS T
LEFT JOIN TemplateData AS TD
ON TD.TemplateID = T.TemplateID
WHERE T.TemplateID = ".(int)$TemplateID."
AND TD.Published = 1
AND (TD.VisibleFrom <= CURRENT_TIMESTAMP OR TD.VisibleFrom IS NULL)
AND (TD.VisibleTill > CURRENT_TIMESTAMP OR TD.VisibleTill IS NULL)
AND (TD.Language = ".NitroPrepareDB($__NSess->Language)." OR TD.Language = '')
ORDER BY TD.Language DESC, TD.Version DESC
";
$Result = $DB[$GlobalDBAlias]->query($Query, 1); if (!$Result) { return FALSE; }
if ($Result->NumRows()) {
if ($Row = $Result->fetchArray()) {
if($Row['Body'] == NULL){
Debug("Template", "Nitro_get_template", "Use hardcoded template: ".$Row['IDString'], __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = Nitro_get_template_file($Row['IDString'], $tpl_source);
$__NitroTemplate_get_template_Cache[$tpl_name] = $tpl_source;
}else{
Debug("Template", "Nitro_get_template", "Use dynamic template from database", __FILE__, __LINE__, DEBUG_APPL_OK);
$tpl_source = $Row['Body'];
$__NitroTemplate_get_template_Cache[$tpl_name] = $Row['Body'];
$RV = TRUE;
}
}
}
$Result->Free();
}
DebugCloseGroup(DEBUG_APPL_OK);
return $RV;
}
function Nitro_get_template_file($IDString = 'Default', &$Contents)
{
DebugGroup("Template", __FUNCTION__, "Getting template: ".$IDString, __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = FALSE;
$Template_Paths = explode(PATH_SEPARATOR, TEMPLATE_PATH);
if (is_array($Template_Paths) && count($Template_Paths)) {
foreach ($Template_Paths AS $Template_Path) {
$TemplateFilename = $Template_Path.$IDString.".tpl";
if (file_exists($TemplateFilename)) {
if ($Contents = file_get_contents($TemplateFilename)) {
Debug("Template", __FUNCTION__, "Succesfully read file ".$TemplateFilename, __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = TRUE;
break; // break out of Template_Paths foreach loop
} else {
Debug("Template", __FUNCTION__, "Failed reading file ".$TemplateFilename, __FILE__, __LINE__, DEBUG_APPL_OK);
}
} else {
Debug("Template", __FUNCTION__, "File does not exist ".$TemplateFilename, __FILE__, __LINE__, DEBUG_APPL_ERR);
}
}
} else {
Debug("Template", __FUNCTION__, "Template path is invalid", __FILE__, __LINE__, DEBUG_APPL_ERR);
}
DebugCloseGroup(DEBUG_APPL_OK);
return $RV;
}
function Nitro_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
global $DB, $GlobalDBAlias, $__NSess, $__NitroTemplate_get_timestamp_Cache;
if (!isset($__NitroTemplate_get_timestamp_Cache)) $__NitroTemplate_get_timestamp_Cache = array();
if (isset($__NitroTemplate_get_timestamp_Cache[$tpl_name])) {
$tpl_timestamp = $__NitroTemplate_get_timestamp_Cache[$tpl_name];
$RV = TRUE;
Debug("Template", __FUNCTION__, "Using cached timestamp: ".$__NitroTemplate_get_timestamp_Cache[$tpl_name], __FILE__, __LINE__, DEBUG_APPL_OK);
} else {
$RV = FALSE;
$TemplateID = $tpl_name; // Hack
$Query = "
SELECT TD.Timestamp, CASE WHEN TD.Body IS NULL THEN 1 ELSE 0 END AS Static, T.IDString
FROM Template AS T
LEFT JOIN TemplateData AS TD
ON TD.TemplateID = T.TemplateID
WHERE T.TemplateID = ".(int)$TemplateID."
AND TD.Published = 1
AND (TD.VisibleFrom <= CURRENT_TIMESTAMP OR TD.VisibleFrom IS NULL)
AND (TD.VisibleTill > CURRENT_TIMESTAMP OR TD.VisibleTill IS NULL)
AND (TD.Language = ".NitroPrepareDB($__NSess->Language)." OR TD.Language = '')
ORDER BY TD.Language DESC, TD.Version DESC
LIMIT 1
";
$Result = $DB[$GlobalDBAlias]->query($Query, 1);
if ($Result->NumRows()) {
$Row = $Result->fetchArray();
// Convert Edited dates to unix timestamp
$Row['Timestamp'] = strtotime($Row['Timestamp']);
if($Row['Static'] == 1){
//hardcoded file
$Template_Paths = explode(PATH_SEPARATOR, TEMPLATE_PATH);
if (is_array($Template_Paths) && count($Template_Paths)) {
foreach ($Template_Paths AS $Template_Path) {
Debug("Template", __FUNCTION__, "Checking ".$Row['IDString'].".tpl in ".$Template_Path, __FILE__, __LINE__, DEBUG_APPL_OK);
$TemplateFilename = $Template_Path.$Row['IDString'].".tpl";
if (file_exists($TemplateFilename)) {
$templateTimestamp = filemtime($TemplateFilename);
if ($templateTimestamp) {
$tpl_timestamp = $templateTimestamp;
$__NitroTemplate_get_timestamp_Cache[$tpl_name] = $templateTimestamp;
Debug("Template", __FUNCTION__, "Succesfully checked timestamp", __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = TRUE;
break; // break out of Template_Paths foreach loop
} else {
Debug("Template", __FUNCTION__, "Error checking timestamp", __FILE__, __LINE__, DEBUG_APPL_ERR);
}
} else {
Debug("Template", __FUNCTION__, "File does not exist", __FILE__, __LINE__, DEBUG_APPL_ERR);
}
}
} else {
Debug("Template", __FUNCTION__, "Template path is invalid", __FILE__, __LINE__, DEBUG_APPL_ERR);
}
} else {
Debug("Template", __FUNCTION__, "Use dynamic template from database", __FILE__, __LINE__, DEBUG_APPL_OK);
$tpl_timestamp = $Row['TimeStamp'];
$__NitroTemplate_get_timestamp_Cache[$tpl_name] = $Row['TimeStamp'];
$RV = TRUE;
}
}
$Result->Free();
}
return $RV;
}
function Nitro_get_secure($tpl_name, &$smarty_obj) {
// assume all templates are secure
return TRUE;
}
function Nitro_get_trusted($tpl_name, &$smarty_obj) {
// not used for templates
}
function NitroGetTemplateID($IDString) {
global $DB, $GlobalDBAlias, $__NitroGetTemplateID_Cache;
DebugGroup(__CLASS__, __FUNCTION__, "Nitro Get TemplateID ".$IDString, __FILE__, __LINE__, DEBUG_APPL_OK);
$RV = FALSE;
if (isset($__NitroGetTemplateID_Cache[$IDString])) {
$RV = $__NitroGetTemplateID_Cache[$IDString];
} else {
$Query = "SELECT T.TemplateID FROM Template AS T WHERE IDString='$IDString'";
$Result = $DB[$GlobalDBAlias]->query($Query, 1);
if ($Result->NumRows()) {
$Row = $Result->fetchArray();
$RV = $Row['TemplateID'];
}
$__NitroGetTemplateID_Cache[$IDString] = $RV;
}
DebugCloseGroup(DEBUG_APPL_OK);
return $RV;
}
// deprecated; use NitroGetTemplateID()
function GetNitroTemplateID($IDString) {
return NitroGetTemplateID($IDString);
}
function NitroGetTemplateVariables($TemplateID = FALSE, $IDString = FALSE, $Body = NULL) {
global $DB, $GlobalDBAlias;
//echo "Body: ".((isset($Body)) ? 'set' : 'unset').", ".(($Body) ? 'exists' : 'not exists');
//echo "IDString: ".((isset($IDString)) ? 'set' : 'unset').", ".(($IDString) ? 'exists' : 'not exists');
$Vars = array();
// retrieve List of Template Variables from X-Table
if ($TemplateID) {
$Query = "SELECT DISTINCT Variable FROM TemplateVariable AS TV
WHERE TV.TemplateID = ".(int)$TemplateID."
";
//echo "Query: $Query\n";
$Result = $DB[$GlobalDBAlias]->query($Query); if (!$Result) { return FALSE; }
if ($Result->NumRows()) {
while ($Row = $Result->fetchArray()) {
$Vars[] = $Row['Variable'];
}
}
$Result->Free();
}
if (($IDString) && !isset($Body)) {
Nitro_get_template_file($IDString, $Body);
}
if (isset($Body)) {
preg_match_all('/\{\$[a-z0-9_\-]+\|NitroVariableAssign\}/i', $Body, $Matched);
// eregi('{$([a-z_]*)}', $Body, $Matched);
//echo "<PRE>Matched: "; print_r($Matched[0]);
if (is_array($Matched[0]) && count($Matched[0])) {
foreach($Matched[0] AS $Var) {
$Vars[] = str_replace (array('{', '}', '$', '|NitroVariableAssign'), '', $Var);
}
} else {
$Vars = str_replace (array('{', '}', '$', '|NitroVariableAssign'), '', $Matched[0]);
}
}
$Vars = array_unique($Vars);
return $Vars;
}
?>