diff --git a/HTML/Template/IT.php b/HTML/Template/IT.php
index ce72d6d..847652c 100755
--- a/HTML/Template/IT.php
+++ b/HTML/Template/IT.php
@@ -389,9 +389,12 @@ class HTML_Template_IT
var $_options = array(
'preserve_data' => false,
'use_preg' => true,
- 'preserve_input'=> true
+ 'preserve_input'=> true,
+ 'check_placeholder_exists' => true,
);
+ public static $globalOptions = [];
+
/**
* Builds some complex regular expressions and optionally sets the
* file root directory.
@@ -408,6 +411,9 @@ class HTML_Template_IT
*/
function __construct($root = '', $options = null)
{
+ if (!empty(self::$globalOptions)) {
+ $this->setOptions(self::$globalOptions);
+ }
if (!is_null($options)) {
$this->setOptions($options);
}
@@ -481,6 +487,16 @@ function setOptions($options)
return IT_OK;
}
+ /**
+ * Define global options used for all new instances.
+ * options defined using constructor parameter will overwrite
+ * globalOptions
+ */
+ public static function setGlobalOptions($options)
+ {
+ self::$globalOptions = $options;
+ }
+
/**
* Print a certain block with all replacements done.
*
@@ -766,7 +782,7 @@ function setVariable($variable, $value = '')
$this->setVariable($key, $value);
}
} else {
- if ($this->checkPlaceholderExists($this->currentBlock, $variable)) {
+ if (!$this->_options['check_placeholder_exists'] || $this->checkPlaceholderExists($this->currentBlock, $variable)) {
$this->variableCache[$variable] = $value;
}
}