mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- reformat all code for unique style
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
09.02.2016
|
||||
- move some code from parser into compiler
|
||||
- reformat all code for unique style
|
||||
|
||||
05.02.2016
|
||||
- improvement internal compiler changes
|
||||
|
@@ -17,8 +17,8 @@ $smarty->cache_lifetime = 120;
|
||||
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
|
||||
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
|
||||
$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
|
||||
$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"),
|
||||
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
|
||||
$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"), array("I", "J", "K", "L"),
|
||||
array("M", "N", "O", "P")));
|
||||
|
||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
||||
|
@@ -26,8 +26,11 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
|
||||
protected $fetch;
|
||||
|
||||
protected $fetchTimestamp;
|
||||
|
||||
protected $save;
|
||||
|
||||
public function __construct()
|
||||
@@ -105,13 +108,8 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
||||
*/
|
||||
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
|
||||
{
|
||||
$this->save->execute(array(
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'cache_id' => $cache_id,
|
||||
'compile_id' => $compile_id,
|
||||
'content' => $content,
|
||||
));
|
||||
$this->save->execute(array('id' => $id, 'name' => $name, 'cache_id' => $cache_id, 'compile_id' => $compile_id,
|
||||
'content' => $content,));
|
||||
|
||||
return !!$this->save->rowCount();
|
||||
}
|
||||
@@ -151,8 +149,8 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
||||
}
|
||||
// equal test cache_id and match sub-groups
|
||||
if ($cache_id !== null) {
|
||||
$where[] = '(cache_id = ' . $this->db->quote($cache_id)
|
||||
. ' OR cache_id LIKE ' . $this->db->quote($cache_id . '|%') . ')';
|
||||
$where[] = '(cache_id = ' . $this->db->quote($cache_id) . ' OR cache_id LIKE ' .
|
||||
$this->db->quote($cache_id . '|%') . ')';
|
||||
}
|
||||
// run delete query
|
||||
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
|
||||
|
@@ -57,6 +57,7 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom
|
||||
AND id = :id
|
||||
AND cache_id = :cache_id
|
||||
AND compile_id = :compile_id');
|
||||
|
||||
protected $insertStatement = 'INSERT INTO %s
|
||||
|
||||
SET id = :id,
|
||||
@@ -76,9 +77,11 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom
|
||||
content = :content';
|
||||
|
||||
protected $deleteStatement = 'DELETE FROM %1$s WHERE %2$s';
|
||||
|
||||
protected $truncateStatement = 'TRUNCATE TABLE %s';
|
||||
|
||||
protected $fetchColumns = 'modified, content';
|
||||
|
||||
protected $fetchTimestampColumns = 'modified';
|
||||
|
||||
protected $pdo, $table, $database;
|
||||
@@ -137,9 +140,11 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom
|
||||
{
|
||||
|
||||
if (!is_null($cache_id) && !is_null($compile_id)) {
|
||||
$query = $this->fetchStatements['withCacheIdAndCompileId'] AND $args = Array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id);
|
||||
$query = $this->fetchStatements[ 'withCacheIdAndCompileId' ] AND
|
||||
$args = Array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id);
|
||||
} elseif (is_null($cache_id) && !is_null($compile_id)) {
|
||||
$query = $this->fetchStatements['withCompileId'] AND $args = Array('id' => $id, 'compile_id' => $compile_id);
|
||||
$query = $this->fetchStatements[ 'withCompileId' ] AND
|
||||
$args = Array('id' => $id, 'compile_id' => $compile_id);
|
||||
} elseif (!is_null($cache_id) && is_null($compile_id)) {
|
||||
$query = $this->fetchStatements[ 'withCacheId' ] AND $args = Array('id' => $id, 'cache_id' => $cache_id);
|
||||
} else {
|
||||
@@ -289,8 +294,8 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom
|
||||
}
|
||||
// equal test cache_id and match sub-groups
|
||||
if ($cache_id !== null) {
|
||||
$where[] = '(cache_id = ' . $this->pdo->quote($cache_id)
|
||||
. ' OR cache_id LIKE ' . $this->pdo->quote($cache_id . '|%') . ')';
|
||||
$where[] = '(cache_id = ' . $this->pdo->quote($cache_id) . ' OR cache_id LIKE ' .
|
||||
$this->pdo->quote($cache_id . '|%') . ')';
|
||||
}
|
||||
// equal test compile_id
|
||||
if ($compile_id !== null) {
|
||||
|
@@ -21,8 +21,10 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
|
||||
// prepared fetchTimestamp() statement
|
||||
protected $mtime;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
|
||||
|
@@ -1144,7 +1144,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
if (strpos($path, $nds) !== false) {
|
||||
$path = str_replace($nds, DS, $path);
|
||||
}
|
||||
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%', $path, $parts);
|
||||
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
|
||||
$path, $parts);
|
||||
$path = $parts[ 'path' ];
|
||||
if ($parts[ 'root' ] == '\\') {
|
||||
$parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
|
||||
@@ -1165,7 +1166,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* Empty template objects cache
|
||||
*/
|
||||
public function _clearTemplateCache() {
|
||||
public function _clearTemplateCache()
|
||||
{
|
||||
$this->_cache[ 'isCached' ] = array();
|
||||
$this->_cache[ 'tplObjects' ] = array();
|
||||
}
|
||||
|
@@ -128,7 +128,8 @@ class SmartyBC extends Smarty
|
||||
* @throws SmartyException
|
||||
* @internal param array $block_functs list of methods that are block format
|
||||
*/
|
||||
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
|
||||
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true,
|
||||
$block_methods = array())
|
||||
{
|
||||
settype($allowed, 'array');
|
||||
settype($smarty_args, 'boolean');
|
||||
|
@@ -83,7 +83,9 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
continue;
|
||||
}
|
||||
// convert mult. spaces & special chars to single space
|
||||
$_paragraph = preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), array(' ', ''), $_paragraph);
|
||||
$_paragraph =
|
||||
preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
|
||||
array(' ', ''), $_paragraph);
|
||||
// indent first line
|
||||
if ($indent_first > 0) {
|
||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||
|
@@ -27,12 +27,7 @@ function smarty_function_counter($params, $template)
|
||||
|
||||
$name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
|
||||
if (!isset($counters[ $name ])) {
|
||||
$counters[$name] = array(
|
||||
'start' => 1,
|
||||
'skip' => 1,
|
||||
'direction' => 'up',
|
||||
'count' => 1
|
||||
);
|
||||
$counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
|
||||
}
|
||||
$counter =& $counters[ $name ];
|
||||
|
||||
|
@@ -60,9 +60,7 @@ function smarty_function_cycle($params, $template)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (isset($cycle_vars[$name]['values'])
|
||||
&& $cycle_vars[$name]['values'] != $params['values']
|
||||
) {
|
||||
if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] != $params[ 'values' ]) {
|
||||
$cycle_vars[ $name ][ 'index' ] = 0;
|
||||
}
|
||||
$cycle_vars[ $name ][ 'values' ] = $params[ 'values' ];
|
||||
|
@@ -90,7 +90,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
if (method_exists($_sel, "__toString")) {
|
||||
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
||||
} else {
|
||||
trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_checkboxes: selected attribute contains an object of class '" .
|
||||
get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -102,7 +103,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
if (method_exists($_val, "__toString")) {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||
} else {
|
||||
trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
}
|
||||
} else {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val);
|
||||
@@ -110,7 +112,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
break;
|
||||
|
||||
case 'checkboxes':
|
||||
trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
|
||||
trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
|
||||
E_USER_WARNING);
|
||||
$options = (array) $_val;
|
||||
break;
|
||||
|
||||
@@ -124,7 +127,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
|
||||
E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if ($_val === true || $_val === $_key) {
|
||||
@@ -153,12 +157,16 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
$_html_result[] =
|
||||
smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||
$label_ids, $escape);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
$_html_result[] =
|
||||
smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||
$label_ids, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +177,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true)
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
|
||||
$label_ids, $escape = true)
|
||||
{
|
||||
$_output = '';
|
||||
|
||||
@@ -177,7 +186,8 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
if (method_exists($value, "__toString")) {
|
||||
$value = (string) $value->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -189,7 +199,8 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
if (method_exists($output, "__toString")) {
|
||||
$output = (string) $output->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: output is an object of class '" . get_class($output) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -199,7 +210,8 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
|
||||
if ($labels) {
|
||||
if ($label_ids) {
|
||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value));
|
||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
||||
$name . '_' . $value));
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
} else {
|
||||
$_output .= '<label>';
|
||||
|
@@ -159,5 +159,6 @@ function smarty_function_html_image($params, $template)
|
||||
$height = round($height * $_resize);
|
||||
}
|
||||
|
||||
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix;
|
||||
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
|
||||
$height . '"' . $extra . ' />' . $suffix;
|
||||
}
|
||||
|
@@ -72,7 +72,8 @@ function smarty_function_html_options($params)
|
||||
if (method_exists($_sel, "__toString")) {
|
||||
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
||||
} else {
|
||||
trigger_error("html_options: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: selected attribute contains an object of class '" .
|
||||
get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -84,7 +85,8 @@ function smarty_function_html_options($params)
|
||||
if (method_exists($_val, "__toString")) {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||
} else {
|
||||
trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
}
|
||||
} else {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val);
|
||||
@@ -98,7 +100,8 @@ function smarty_function_html_options($params)
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
|
||||
E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if ($_val === true || $_val === $_key) {
|
||||
@@ -142,7 +145,9 @@ function smarty_function_html_options($params)
|
||||
if (!empty($name)) {
|
||||
$_html_class = !empty($class) ? ' class="' . $class . '"' : '';
|
||||
$_html_id = !empty($id) ? ' id="' . $id . '"' : '';
|
||||
$_html_result = '<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
|
||||
$_html_result =
|
||||
'<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
|
||||
'</select>' . "\n";
|
||||
}
|
||||
|
||||
return $_html_result;
|
||||
@@ -166,7 +171,8 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
||||
if (method_exists($value, "__toString")) {
|
||||
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -177,7 +183,9 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
||||
$idx ++;
|
||||
} else {
|
||||
$_idx = 0;
|
||||
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx);
|
||||
$_html_result =
|
||||
smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
|
||||
$class, $_idx);
|
||||
$idx ++;
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,8 @@ function smarty_function_html_radios($params, $template)
|
||||
if (method_exists($_val, "__toString")) {
|
||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||
} else {
|
||||
trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
}
|
||||
} else {
|
||||
$selected = (string) $_val;
|
||||
@@ -96,7 +97,8 @@ function smarty_function_html_radios($params, $template)
|
||||
break;
|
||||
|
||||
case 'radios':
|
||||
trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
|
||||
trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
|
||||
E_USER_WARNING);
|
||||
$options = (array) $_val;
|
||||
break;
|
||||
|
||||
@@ -110,7 +112,8 @@ function smarty_function_html_radios($params, $template)
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
|
||||
trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
|
||||
E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if ($_val === true || $_val === $_key) {
|
||||
@@ -141,12 +144,16 @@ function smarty_function_html_radios($params, $template)
|
||||
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
$_html_result[] =
|
||||
smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||
$label_ids, $escape);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
$_html_result[] =
|
||||
smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||
$label_ids, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +164,8 @@ function smarty_function_html_radios($params, $template)
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
|
||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
|
||||
$escape)
|
||||
{
|
||||
$_output = '';
|
||||
|
||||
@@ -165,7 +173,8 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
if (method_exists($value, "__toString")) {
|
||||
$value = (string) $value->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: value is an object of class '" . get_class($value) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -177,7 +186,8 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
if (method_exists($output, "__toString")) {
|
||||
$output = (string) $output->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
|
||||
trigger_error("html_options: output is an object of class '" . get_class($output) .
|
||||
"' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
@@ -187,7 +197,8 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
|
||||
if ($labels) {
|
||||
if ($label_ids) {
|
||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value));
|
||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
||||
$name . '_' . $value));
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
} else {
|
||||
$_output .= '<label>';
|
||||
|
@@ -182,17 +182,16 @@ function smarty_function_html_select_date($params)
|
||||
// $_REQUEST[$field_array] given
|
||||
foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params['time'][$prefix . $_elementName])
|
||||
? $params['time'][$prefix . $_elementName]
|
||||
: date($_elementKey);
|
||||
$$_variableName =
|
||||
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
|
||||
date($_elementKey);
|
||||
}
|
||||
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) {
|
||||
// $_REQUEST given
|
||||
foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
|
||||
? $params['time'][$field_array][$prefix . $_elementName]
|
||||
: date($_elementKey);
|
||||
$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
|
||||
$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
|
||||
}
|
||||
} else {
|
||||
// no date found, use NOW
|
||||
@@ -243,13 +242,16 @@ function smarty_function_html_select_date($params)
|
||||
}
|
||||
|
||||
if ($year_as_text) {
|
||||
$_html_years = '<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra . $extra_attrs . ' />';
|
||||
$_html_years =
|
||||
'<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra .
|
||||
$extra_attrs . ' />';
|
||||
} else {
|
||||
$_html_years = '<select name="' . $_name . '"';
|
||||
if ($year_id !== null || $all_id !== null) {
|
||||
$_html_years .= ' id="' . smarty_function_escape_special_chars(
|
||||
$year_id !== null ? ($year_id ? $year_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_years .= ' id="' . smarty_function_escape_special_chars($year_id !== null ?
|
||||
($year_id ? $year_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)) . '"';
|
||||
}
|
||||
if ($year_size) {
|
||||
$_html_years .= ' size="' . $year_size . '"';
|
||||
@@ -257,14 +259,14 @@ function smarty_function_html_select_date($params)
|
||||
$_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($year_empty) || isset($all_empty)) {
|
||||
$_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
$op = $start_year > $end_year ? - 1 : 1;
|
||||
for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
|
||||
$_html_years .= '<option value="' . $i . '"'
|
||||
. ($_year == $i ? ' selected="selected"' : '')
|
||||
. '>' . $i . '</option>' . $option_separator;
|
||||
$_html_years .= '<option value="' . $i . '"' . ($_year == $i ? ' selected="selected"' : '') . '>' . $i .
|
||||
'</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_years .= '</select>';
|
||||
@@ -284,9 +286,10 @@ function smarty_function_html_select_date($params)
|
||||
|
||||
$_html_months = '<select name="' . $_name . '"';
|
||||
if ($month_id !== null || $all_id !== null) {
|
||||
$_html_months .= ' id="' . smarty_function_escape_special_chars(
|
||||
$month_id !== null ? ($month_id ? $month_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_months .= ' id="' . smarty_function_escape_special_chars($month_id !== null ?
|
||||
($month_id ? $month_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)) . '"';
|
||||
}
|
||||
if ($month_size) {
|
||||
$_html_months .= ' size="' . $month_size . '"';
|
||||
@@ -294,16 +297,17 @@ function smarty_function_html_select_date($params)
|
||||
$_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($month_empty) || isset($all_empty)) {
|
||||
$_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 12; $i ++) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
|
||||
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) :
|
||||
($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[ $i ]));
|
||||
$_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]);
|
||||
$_html_months .= '<option value="' . $_value . '"'
|
||||
. ($_val == $_month ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
$_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_months .= '</select>';
|
||||
@@ -322,9 +326,9 @@ function smarty_function_html_select_date($params)
|
||||
|
||||
$_html_days = '<select name="' . $_name . '"';
|
||||
if ($day_id !== null || $all_id !== null) {
|
||||
$_html_days .= ' id="' . smarty_function_escape_special_chars(
|
||||
$day_id !== null ? ($day_id ? $day_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_days .= ' id="' .
|
||||
smarty_function_escape_special_chars($day_id !== null ? ($day_id ? $day_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) : $_name)) . '"';
|
||||
}
|
||||
if ($day_size) {
|
||||
$_html_days .= ' size="' . $day_size . '"';
|
||||
@@ -332,16 +336,16 @@ function smarty_function_html_select_date($params)
|
||||
$_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($day_empty) || isset($all_empty)) {
|
||||
$_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 31; $i ++) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $day_format == '%02d' ? $_val : sprintf($day_format, $i);
|
||||
$_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i);
|
||||
$_html_days .= '<option value="' . $_value . '"'
|
||||
. ($_val == $_day ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
$_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' .
|
||||
$_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_days .= '</select>';
|
||||
|
@@ -153,26 +153,24 @@ function smarty_function_html_select_time($params)
|
||||
// $_REQUEST[$field_array] given
|
||||
foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params['time'][$prefix . $_elementName])
|
||||
? $params['time'][$prefix . $_elementName]
|
||||
: date($_elementKey);
|
||||
$$_variableName =
|
||||
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
|
||||
date($_elementKey);
|
||||
}
|
||||
$_meridian = isset($params['time'][$prefix . 'Meridian'])
|
||||
? (' ' . $params['time'][$prefix . 'Meridian'])
|
||||
: '';
|
||||
$_meridian =
|
||||
isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
|
||||
'';
|
||||
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
|
||||
// $_REQUEST given
|
||||
foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
|
||||
? $params['time'][$field_array][$prefix . $_elementName]
|
||||
: date($_elementKey);
|
||||
$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
|
||||
$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
|
||||
}
|
||||
$_meridian = isset($params['time'][$field_array][$prefix . 'Meridian'])
|
||||
? (' ' . $params['time'][$field_array][$prefix . 'Meridian'])
|
||||
: '';
|
||||
$_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
|
||||
(' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
|
||||
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
} else {
|
||||
@@ -203,9 +201,9 @@ function smarty_function_html_select_time($params)
|
||||
|
||||
$_html_hours = '<select name="' . $_name . '"';
|
||||
if ($hour_id !== null || $all_id !== null) {
|
||||
$_html_hours .= ' id="' . smarty_function_escape_special_chars(
|
||||
$hour_id !== null ? ($hour_id ? $hour_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_hours .= ' id="' .
|
||||
smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) : $_name)) . '"';
|
||||
}
|
||||
if ($hour_size) {
|
||||
$_html_hours .= ' size="' . $hour_size . '"';
|
||||
@@ -213,7 +211,8 @@ function smarty_function_html_select_time($params)
|
||||
$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($hour_empty) || isset($all_empty)) {
|
||||
$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
$start = $use_24_hours ? 0 : 1;
|
||||
@@ -224,15 +223,12 @@ function smarty_function_html_select_time($params)
|
||||
$_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
|
||||
|
||||
if (!$use_24_hours) {
|
||||
$_hour12 = $_hour == 0
|
||||
? 12
|
||||
: ($_hour <= 12 ? $_hour : $_hour - 12);
|
||||
$_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
|
||||
}
|
||||
|
||||
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
|
||||
$_html_hours .= '<option value="' . $_value . '"'
|
||||
. ($selected ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
$_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
|
||||
$_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_hours .= '</select>';
|
||||
@@ -252,9 +248,10 @@ function smarty_function_html_select_time($params)
|
||||
|
||||
$_html_minutes = '<select name="' . $_name . '"';
|
||||
if ($minute_id !== null || $all_id !== null) {
|
||||
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
|
||||
$minute_id !== null ? ($minute_id ? $minute_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ?
|
||||
($minute_id ? $minute_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)) . '"';
|
||||
}
|
||||
if ($minute_size) {
|
||||
$_html_minutes .= ' size="' . $minute_size . '"';
|
||||
@@ -262,7 +259,8 @@ function smarty_function_html_select_time($params)
|
||||
$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($minute_empty) || isset($all_empty)) {
|
||||
$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
|
||||
@@ -270,9 +268,8 @@ function smarty_function_html_select_time($params)
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
|
||||
$_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
|
||||
$_html_minutes .= '<option value="' . $_value . '"'
|
||||
. ($selected === $i ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
$_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_minutes .= '</select>';
|
||||
@@ -292,9 +289,10 @@ function smarty_function_html_select_time($params)
|
||||
|
||||
$_html_seconds = '<select name="' . $_name . '"';
|
||||
if ($second_id !== null || $all_id !== null) {
|
||||
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
|
||||
$second_id !== null ? ($second_id ? $second_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ?
|
||||
($second_id ? $second_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)) . '"';
|
||||
}
|
||||
if ($second_size) {
|
||||
$_html_seconds .= ' size="' . $second_size . '"';
|
||||
@@ -302,7 +300,8 @@ function smarty_function_html_select_time($params)
|
||||
$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($second_empty) || isset($all_empty)) {
|
||||
$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
|
||||
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
|
||||
@@ -310,9 +309,8 @@ function smarty_function_html_select_time($params)
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
|
||||
$_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
|
||||
$_html_seconds .= '<option value="' . $_value . '"'
|
||||
. ($selected === $i ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
$_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_seconds .= '</select>';
|
||||
@@ -332,9 +330,11 @@ function smarty_function_html_select_time($params)
|
||||
|
||||
$_html_meridian = '<select name="' . $_name . '"';
|
||||
if ($meridian_id !== null || $all_id !== null) {
|
||||
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
|
||||
$meridian_id !== null ? ($meridian_id ? $meridian_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
$_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ?
|
||||
($meridian_id ? $meridian_id :
|
||||
$_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)) . '"';
|
||||
}
|
||||
if ($meridian_size) {
|
||||
$_html_meridian .= ' size="' . $meridian_size . '"';
|
||||
@@ -342,12 +342,14 @@ function smarty_function_html_select_time($params)
|
||||
$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
|
||||
if (isset($meridian_empty) || isset($all_empty)) {
|
||||
$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) . '</option>' . $option_separator;
|
||||
$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
|
||||
'</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') . '>AM</option>' . $option_separator
|
||||
. '<option value="pm"' . ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator
|
||||
. '</select>';
|
||||
$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
|
||||
'>AM</option>' . $option_separator . '<option value="pm"' .
|
||||
($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
|
||||
'</select>';
|
||||
}
|
||||
|
||||
$_html = '';
|
||||
|
@@ -50,7 +50,8 @@
|
||||
*/
|
||||
function smarty_function_mailto($params)
|
||||
{
|
||||
static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
|
||||
static $_allowed_encoding =
|
||||
array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
|
||||
$extra = '';
|
||||
|
||||
if (empty($params[ 'address' ])) {
|
||||
@@ -96,7 +97,8 @@ function smarty_function_mailto($params)
|
||||
|
||||
$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
|
||||
if (!isset($_allowed_encoding[ $encode ])) {
|
||||
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING);
|
||||
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
|
||||
E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -117,12 +119,8 @@ function smarty_function_mailto($params)
|
||||
$ord[] = ord($string[ $x ]);
|
||||
}
|
||||
|
||||
$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n"
|
||||
. "{document.write(String.fromCharCode("
|
||||
. implode(',', $ord)
|
||||
. "))"
|
||||
. "}\n"
|
||||
. "</script>\n";
|
||||
$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
|
||||
implode(',', $ord) . "))" . "}\n" . "</script>\n";
|
||||
|
||||
return $_ret;
|
||||
} elseif ($encode == 'hex') {
|
||||
|
@@ -24,11 +24,10 @@
|
||||
*/
|
||||
function smarty_function_math($params, $template)
|
||||
{
|
||||
static $_allowed_funcs = array(
|
||||
'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
|
||||
'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
|
||||
'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true
|
||||
);
|
||||
static $_allowed_funcs =
|
||||
array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
|
||||
'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true, 'rand' => true,
|
||||
'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true);
|
||||
// be sure equation parameter is present
|
||||
if (empty($params[ 'equation' ])) {
|
||||
trigger_error("math: missing equation parameter", E_USER_WARNING);
|
||||
|
@@ -29,17 +29,23 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
||||
} else {
|
||||
// uppercase word breaks
|
||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
|
||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
|
||||
'smarty_mod_cap_mbconvert_cb', $string);
|
||||
}
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
||||
PREG_OFFSET_CAPTURE)) {
|
||||
foreach ($matches[ 1 ] as $match) {
|
||||
$upper_string = substr_replace($upper_string, mb_strtolower($match[0], Smarty::$_CHARSET), $match[1], strlen($match[0]));
|
||||
$upper_string =
|
||||
substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
|
||||
strlen($match[ 0 ]));
|
||||
}
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', $upper_string);
|
||||
$upper_string =
|
||||
preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb',
|
||||
$upper_string);
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
@@ -48,16 +54,21 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
$string = strtolower($string);
|
||||
}
|
||||
// uppercase (including hyphenated words)
|
||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
|
||||
$upper_string =
|
||||
preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb',
|
||||
$string);
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
||||
PREG_OFFSET_CAPTURE)) {
|
||||
foreach ($matches[ 1 ] as $match) {
|
||||
$upper_string = substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0]));
|
||||
$upper_string =
|
||||
substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
|
||||
}
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', $upper_string);
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb',
|
||||
$upper_string);
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,8 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth =
|
||||
}
|
||||
foreach ($var as $curr_key => $curr_val) {
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
|
||||
'</b> => ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
||||
'</b> => ' .
|
||||
smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
|
||||
$depth --;
|
||||
}
|
||||
break;
|
||||
|
@@ -66,7 +66,8 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
// php <5.2.3 - prevent double encoding
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
$string =
|
||||
str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
@@ -152,7 +153,8 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
|
||||
case 'javascript':
|
||||
// escape quotes and backslashes, newlines, etc.
|
||||
return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\/'));
|
||||
return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n',
|
||||
'</' => '<\/'));
|
||||
|
||||
case 'mail':
|
||||
if (Smarty::$_MBSTRING) {
|
||||
|
@@ -35,13 +35,15 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
||||
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
||||
$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
|
||||
if (!$break_words && !$middle) {
|
||||
$string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
|
||||
$string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '',
|
||||
mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
|
||||
}
|
||||
if (!$middle) {
|
||||
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
|
||||
}
|
||||
|
||||
return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
|
||||
return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc .
|
||||
mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
return $string;
|
||||
|
@@ -24,7 +24,8 @@ function smarty_modifiercompiler_count_words($params)
|
||||
if (Smarty::$_MBSTRING) {
|
||||
// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
|
||||
// expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
|
||||
return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
|
||||
return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
|
||||
$params[ 0 ] . ', $tmp)';
|
||||
}
|
||||
// no MBString fallback
|
||||
return 'str_word_count(' . $params[ 0 ] . ')';
|
||||
|
@@ -44,14 +44,10 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
switch ($esc_type) {
|
||||
case 'html':
|
||||
if ($_double_encode) {
|
||||
return 'htmlspecialchars('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true) . ', '
|
||||
. var_export($double_encode, true) . ')';
|
||||
return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
||||
var_export($double_encode, true) . ')';
|
||||
} elseif ($double_encode) {
|
||||
return 'htmlspecialchars('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true) . ')';
|
||||
return 'htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')';
|
||||
} else {
|
||||
// fall back to modifier.escape.php
|
||||
}
|
||||
@@ -60,19 +56,13 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if ($_double_encode) {
|
||||
// php >=5.2.3 - go native
|
||||
return 'mb_convert_encoding(htmlspecialchars('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true) . ', '
|
||||
. var_export($double_encode, true)
|
||||
. '), "HTML-ENTITIES", '
|
||||
. var_export($char_set, true) . ')';
|
||||
return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' .
|
||||
var_export($char_set, true) . ', ' . var_export($double_encode, true) .
|
||||
'), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
|
||||
} elseif ($double_encode) {
|
||||
// php <5.2.3 - only handle double encoding
|
||||
return 'mb_convert_encoding(htmlspecialchars('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true)
|
||||
. '), "HTML-ENTITIES", '
|
||||
. var_export($char_set, true) . ')';
|
||||
return 'mb_convert_encoding(htmlspecialchars(' . $params[ 0 ] . ', ENT_QUOTES, ' .
|
||||
var_export($char_set, true) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
|
||||
} else {
|
||||
// fall back to modifier.escape.php
|
||||
}
|
||||
@@ -81,15 +71,11 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
// no MBString fallback
|
||||
if ($_double_encode) {
|
||||
// php >=5.2.3 - go native
|
||||
return 'htmlentities('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true) . ', '
|
||||
. var_export($double_encode, true) . ')';
|
||||
return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
|
||||
var_export($double_encode, true) . ')';
|
||||
} elseif ($double_encode) {
|
||||
// php <5.2.3 - only handle double encoding
|
||||
return 'htmlentities('
|
||||
. $params[0] . ', ENT_QUOTES, '
|
||||
. var_export($char_set, true) . ')';
|
||||
return 'htmlentities(' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ')';
|
||||
} else {
|
||||
// fall back to modifier.escape.php
|
||||
}
|
||||
@@ -106,7 +92,8 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
|
||||
case 'javascript':
|
||||
// escape quotes and backslashes, newlines, etc.
|
||||
return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
|
||||
return 'strtr(' . $params[ 0 ] .
|
||||
', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
|
||||
}
|
||||
}
|
||||
catch (SmartyException $e) {
|
||||
@@ -115,11 +102,15 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
|
||||
// could not optimize |escape call, so fallback to regular plugin
|
||||
if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'file' ] =
|
||||
SMARTY_PLUGINS_DIR . 'modifier.escape.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'function' ] =
|
||||
'smarty_modifier_escape';
|
||||
} else {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'file' ] =
|
||||
SMARTY_PLUGINS_DIR . 'modifier.escape.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'function' ] =
|
||||
'smarty_modifier_escape';
|
||||
}
|
||||
|
||||
return 'smarty_modifier_escape(' . join(', ', $params) . ')';
|
||||
|
@@ -34,11 +34,15 @@ function smarty_modifiercompiler_wordwrap($params, $compiler)
|
||||
$function = 'wordwrap';
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
|
||||
$compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ 'wordwrap' ][ 'modifier' ][ 'file' ] =
|
||||
SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
|
||||
$compiler->template->required_plugins[ 'nocache' ][ 'wordwrap' ][ 'modifier' ][ 'function' ] =
|
||||
'smarty_mb_wordwrap';
|
||||
} else {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'wordwrap' ][ 'modifier' ][ 'file' ] =
|
||||
SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ 'wordwrap' ][ 'modifier' ][ 'function' ] =
|
||||
'smarty_mb_wordwrap';
|
||||
}
|
||||
$function = 'smarty_mb_wordwrap';
|
||||
}
|
||||
|
@@ -27,7 +27,8 @@ function smarty_outputfilter_trimwhitespace($source)
|
||||
$source = preg_replace("/\015\012|\015|\012/", "\n", $source);
|
||||
|
||||
// capture Internet Explorer Conditional Comments
|
||||
if (preg_match_all('#<!--\[[^\]]+\]>.*?<!\[[^\]]+\]-->#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all('#<!--\[[^\]]+\]>.*?<!\[[^\]]+\]-->#is', $source, $matches,
|
||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[ 0 ][ 0 ];
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
@@ -45,7 +46,8 @@ function smarty_outputfilter_trimwhitespace($source)
|
||||
|
||||
// capture html elements not to be messed with
|
||||
$_offset = 0;
|
||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
||||
$source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[ 0 ][ 0 ];
|
||||
$_length = strlen($match[ 0 ][ 0 ]);
|
||||
@@ -57,17 +59,14 @@ function smarty_outputfilter_trimwhitespace($source)
|
||||
}
|
||||
}
|
||||
|
||||
$expressions = array(
|
||||
// replace multiple spaces between tags by a single space
|
||||
$expressions = array(// replace multiple spaces between tags by a single space
|
||||
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
||||
// remove spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||
// maybe a \0 byte or something is interfering?
|
||||
'#^\s+<#Ss' => '<',
|
||||
'#>\s+$#Ss' => '>',
|
||||
);
|
||||
'#^\s+<#Ss' => '<', '#>\s+$#Ss' => '>',);
|
||||
|
||||
$source = preg_replace(array_keys($expressions), array_values($expressions), $source);
|
||||
// note: for some very weird reason trim() seems to remove spaces inside attributes.
|
||||
|
@@ -25,7 +25,8 @@ function smarty_literal_compiler_param($params, $index, $default = null)
|
||||
}
|
||||
// test if param is a literal
|
||||
if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) {
|
||||
throw new SmartyException('$param[' . $index . '] is not a literal and is thus not evaluatable at compile time');
|
||||
throw new SmartyException('$param[' . $index .
|
||||
'] is not a literal and is thus not evaluatable at compile time');
|
||||
}
|
||||
|
||||
$t = null;
|
||||
|
@@ -21,12 +21,14 @@ function smarty_make_timestamp($string)
|
||||
if (empty($string)) {
|
||||
// use "now":
|
||||
return time();
|
||||
} elseif ($string instanceof DateTime || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)) {
|
||||
} elseif ($string instanceof DateTime ||
|
||||
(interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
|
||||
) {
|
||||
return (int) $string->format('U'); // PHP 5.2 BC
|
||||
} elseif (strlen($string) == 14 && ctype_digit($string)) {
|
||||
// it is mysql timestamp format of YYYYMMDDHHMMSS?
|
||||
return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2),
|
||||
substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
|
||||
return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2),
|
||||
substr($string, 6, 2), substr($string, 0, 4));
|
||||
} elseif (is_numeric($string)) {
|
||||
// it is a numeric string, we handle it as timestamp
|
||||
return (int) $string;
|
||||
|
@@ -24,7 +24,8 @@ if (!function_exists('smarty_mb_wordwrap')) {
|
||||
function smarty_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false)
|
||||
{
|
||||
// break words into tokens using white space as a delimiter
|
||||
$tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$tokens =
|
||||
preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$length = 0;
|
||||
$t = '';
|
||||
$_previous = false;
|
||||
@@ -35,7 +36,8 @@ if (!function_exists('smarty_mb_wordwrap')) {
|
||||
$_tokens = array($_token);
|
||||
if ($token_length > $width) {
|
||||
if ($cut) {
|
||||
$_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1,
|
||||
PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,8 @@ abstract class Smarty_CacheResource
|
||||
*
|
||||
* @return bool true or false if the cached content does not exist
|
||||
*/
|
||||
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null, $update = false);
|
||||
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null,
|
||||
$update = false);
|
||||
|
||||
/**
|
||||
* Write the rendered template output to cache
|
||||
|
@@ -101,7 +101,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
*/
|
||||
public function populateTimestamp(Smarty_Template_Cached $cached)
|
||||
{
|
||||
$mtime = $this->fetchTimestamp($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id);
|
||||
$mtime =
|
||||
$this->fetchTimestamp($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id);
|
||||
if ($mtime !== null) {
|
||||
$cached->timestamp = $mtime;
|
||||
$cached->exists = !!$cached->timestamp;
|
||||
@@ -109,7 +110,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
return;
|
||||
}
|
||||
$timestamp = null;
|
||||
$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, $timestamp);
|
||||
$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content,
|
||||
$timestamp);
|
||||
$cached->timestamp = isset($timestamp) ? $timestamp : false;
|
||||
$cached->exists = !!$cached->timestamp;
|
||||
}
|
||||
@@ -131,7 +133,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
$content = $cached->content ? $cached->content : null;
|
||||
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
||||
if ($content === null || !$timestamp) {
|
||||
$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp);
|
||||
$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||
$_template->compile_id, $content, $timestamp);
|
||||
}
|
||||
if (isset($content)) {
|
||||
/** @var Smarty_Internal_Template $_smarty_tpl
|
||||
@@ -156,7 +159,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
*/
|
||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
||||
{
|
||||
return $this->save($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $_template->cache_lifetime, $content);
|
||||
return $this->save($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||
$_template->compile_id, $_template->cache_lifetime, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +176,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
$timestamp = null;
|
||||
if ($content === null) {
|
||||
$timestamp = null;
|
||||
$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp);
|
||||
$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||
$_template->compile_id, $content, $timestamp);
|
||||
}
|
||||
if (isset($content)) {
|
||||
return $content;
|
||||
|
@@ -69,7 +69,9 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*/
|
||||
public function populateTimestamp(Smarty_Template_Cached $cached)
|
||||
{
|
||||
if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content, $timestamp, $cached->source->uid)) {
|
||||
if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content,
|
||||
$timestamp, $cached->source->uid)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$cached->content = $content;
|
||||
@@ -94,7 +96,9 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
$content = $cached->content ? $cached->content : null;
|
||||
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
||||
if ($content === null || !$timestamp) {
|
||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp, $_template->source->uid)) {
|
||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||
$_template->compile_id, $content, $timestamp, $_template->source->uid)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +142,9 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
$content = $_template->cached->content ? $_template->cached->content : null;
|
||||
$timestamp = null;
|
||||
if ($content === null) {
|
||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp, $_template->source->uid)) {
|
||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||
$_template->compile_id, $content, $timestamp, $_template->source->uid)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -242,14 +248,16 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*
|
||||
* @return boolean success
|
||||
*/
|
||||
protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, &$timestamp = null, $resource_uid = null)
|
||||
protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null,
|
||||
&$timestamp = null, $resource_uid = null)
|
||||
{
|
||||
$t = $this->read(array($cid));
|
||||
$content = !empty($t[ $cid ]) ? $t[ $cid ] : null;
|
||||
$timestamp = null;
|
||||
|
||||
if ($content && ($timestamp = $this->getMetaTimestamp($content))) {
|
||||
$invalidated = $this->getLatestInvalidationTimestamp($cid, $resource_name, $cache_id, $compile_id, $resource_uid);
|
||||
$invalidated =
|
||||
$this->getLatestInvalidationTimestamp($cid, $resource_name, $cache_id, $compile_id, $resource_uid);
|
||||
if ($invalidated > $timestamp) {
|
||||
$timestamp = null;
|
||||
$content = null;
|
||||
@@ -296,7 +304,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
|
||||
protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||
$resource_uid = null)
|
||||
{
|
||||
$now = microtime(true);
|
||||
$key = null;
|
||||
@@ -336,7 +345,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*
|
||||
* @return float the microtime the CacheID was invalidated
|
||||
*/
|
||||
protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
|
||||
protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||
$resource_uid = null)
|
||||
{
|
||||
// abort if there is no CacheID
|
||||
if (false && !$cid) {
|
||||
@@ -370,7 +380,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
* @return array list of InvalidationKeys
|
||||
* @uses $invalidationKeyPrefix to prepend to each InvalidationKey
|
||||
*/
|
||||
protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
|
||||
protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||
$resource_uid = null)
|
||||
{
|
||||
$t = array('IVK#ALL');
|
||||
$_name = $_compile = '#';
|
||||
|
@@ -58,8 +58,8 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
||||
}
|
||||
$cached->lock_id = $_lock_dir . sha1($_cache_id . $_compile_id . $_template->source->uid) . '.lock';
|
||||
}
|
||||
$cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) .
|
||||
'.php';
|
||||
$cached->filepath =
|
||||
$_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';
|
||||
$cached->timestamp = $cached->exists = is_file($cached->filepath);
|
||||
if ($cached->exists) {
|
||||
$cached->timestamp = filemtime($cached->filepath);
|
||||
@@ -115,7 +115,9 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
||||
*/
|
||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
||||
{
|
||||
if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, $content, $_template->smarty) === true) {
|
||||
if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, $content,
|
||||
$_template->smarty) === true
|
||||
) {
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
opcache_invalidate($_template->cached->filepath, true);
|
||||
} elseif (function_exists('apc_compile_file')) {
|
||||
|
@@ -185,7 +185,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
|
||||
$sourceInfo = $compiler->template->source->filepath;
|
||||
} else {
|
||||
$basename = $compiler->template->source->handler->getBasename($compiler->template->source);
|
||||
$sourceInfo = $compiler->template->source->type .':' . ($basename ? $basename : $compiler->template->source->name);
|
||||
$sourceInfo =
|
||||
$compiler->template->source->type . ':' . ($basename ? $basename : $compiler->template->source->name);
|
||||
}
|
||||
|
||||
$output = "<?php\n";
|
||||
|
@@ -52,7 +52,8 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
||||
$compiler->_capture_stack[ 0 ][] = array($buffer, $assign, $append, $compiler->nocache);
|
||||
// maybe nocache because of nocache variables
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
$_output = "<?php \$_smarty_tpl->smarty->_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>";
|
||||
$_output =
|
||||
"<?php \$_smarty_tpl->smarty->_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
@@ -105,7 +106,8 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
|
||||
|
||||
list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack[ 0 ]);
|
||||
|
||||
$_output = "<?php list(\$_capture_buffer, \$_capture_assign, \$_capture_append) = array_pop(\$_smarty_tpl->smarty->_cache['capture_stack']);\n";
|
||||
$_output =
|
||||
"<?php list(\$_capture_buffer, \$_capture_assign, \$_capture_append) = array_pop(\$_smarty_tpl->smarty->_cache['capture_stack']);\n";
|
||||
$_output .= "if (!empty(\$_capture_buffer)) {\n";
|
||||
$_output .= " if (isset(\$_capture_assign)) \$_smarty_tpl->assign(\$_capture_assign, ob_get_contents());\n";
|
||||
$_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n";
|
||||
|
@@ -45,8 +45,7 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $valid_scopes = array('local' => true, 'parent' => true, 'root' => true,
|
||||
'tpl_root' => true);
|
||||
public $valid_scopes = array('local' => true, 'parent' => true, 'root' => true, 'tpl_root' => true);
|
||||
|
||||
/**
|
||||
* Compiles code for the {config_load} tag
|
||||
@@ -77,7 +76,8 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
|
||||
if (isset($_attr[ 'scope' ])) {
|
||||
$_attr[ 'scope' ] = trim($_attr[ 'scope' ], "'\"");
|
||||
if (!isset($this->valid_scopes[ $_attr[ 'scope' ] ])) {
|
||||
$compiler->trigger_template_error("illegal value '{$_attr['scope']}' for \"scope\" attribute", null, true);
|
||||
$compiler->trigger_template_error("illegal value '{$_attr['scope']}' for \"scope\" attribute", null,
|
||||
true);
|
||||
}
|
||||
if ($_attr[ 'scope' ] != 'local') {
|
||||
if ($_attr[ 'scope' ] == 'parent') {
|
||||
@@ -87,7 +87,8 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
|
||||
} elseif ($_attr[ 'scope' ] == 'tpl_root') {
|
||||
$_scope = Smarty::SCOPE_TPL_ROOT;
|
||||
}
|
||||
$_scope += (isset($_attr['bubble_up']) && $_attr['bubble_up'] == 'false') ? 0 : Smarty::SCOPE_BUBBLE_UP;
|
||||
$_scope += (isset($_attr[ 'bubble_up' ]) && $_attr[ 'bubble_up' ] == 'false') ? 0 :
|
||||
Smarty::SCOPE_BUBBLE_UP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
|
||||
$compiler->tag_nocache = true;
|
||||
|
||||
// display debug template
|
||||
$_output = "<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n";
|
||||
$_output =
|
||||
"<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n";
|
||||
$_output .= "unset(\$_smarty_debug);\n?>";
|
||||
return $_output;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $required_attributes = array('var');
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -30,6 +31,7 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $optional_attributes = array('assign');
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -58,7 +60,8 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
|
||||
}
|
||||
|
||||
// create template object
|
||||
$_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr['var'] . ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||
$_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr[ 'var' ] .
|
||||
", \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||
//was there an assign attribute?
|
||||
if (isset($_assign)) {
|
||||
$_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
|
||||
|
@@ -62,7 +62,8 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
|
||||
}
|
||||
unset($_attr[ 'nocache' ]);
|
||||
$_name = trim($_attr[ 'name' ], "'\"");
|
||||
$compiler->parent_compiler->tpl_function[$_name] = $compiler->parent_compiler->template->tpl_function[$_name] = array();
|
||||
$compiler->parent_compiler->tpl_function[ $_name ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ] = array();
|
||||
$save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code,
|
||||
$compiler->template->caching);
|
||||
$this->openTag($compiler, 'function', $save);
|
||||
@@ -105,9 +106,14 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$saved_data = $this->closeTag($compiler, array('function'));
|
||||
$_attr = $saved_data[ 0 ];
|
||||
$_name = trim($_attr[ 'name' ], "'\"");
|
||||
$compiler->parent_compiler->tpl_function[$_name]['called_functions'] = $compiler->parent_compiler->template->tpl_function[$_name]['called_functions'] = $compiler->called_functions;
|
||||
$compiler->parent_compiler->tpl_function[$_name]['compiled_filepath'] = $compiler->parent_compiler->template->tpl_function[$_name]['compiled_filepath'] = $compiler->parent_compiler->template->compiled->filepath;
|
||||
$compiler->parent_compiler->tpl_function[$_name]['uid'] = $compiler->parent_compiler->template->tpl_function[$_name]['uid'] = $compiler->template->source->uid;
|
||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'called_functions' ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ][ 'called_functions' ] =
|
||||
$compiler->called_functions;
|
||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'compiled_filepath' ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ][ 'compiled_filepath' ] =
|
||||
$compiler->parent_compiler->template->compiled->filepath;
|
||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'uid' ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ][ 'uid' ] = $compiler->template->source->uid;
|
||||
$compiler->called_functions = array();
|
||||
$_parameter = $_attr;
|
||||
unset($_parameter[ 'name' ]);
|
||||
@@ -133,7 +139,8 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}";
|
||||
$_funcNameCaching = $_funcName . '_nocache';
|
||||
if ($compiler->template->compiled->has_nocache_code) {
|
||||
$compiler->parent_compiler->tpl_function[$_name]['call_name_caching'] = $compiler->parent_compiler->template->tpl_function[$_name]['call_name_caching'] = $_funcNameCaching;
|
||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'call_name_caching' ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ][ 'call_name_caching' ] = $_funcNameCaching;
|
||||
$output = "<?php\n";
|
||||
$output .= "/* {$_funcNameCaching} */\n";
|
||||
$output .= "if (!function_exists('{$_funcNameCaching}')) {\n";
|
||||
@@ -147,7 +154,9 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
||||
$output .= "\\\$saved_tpl_vars = \\\$_smarty_tpl->tpl_vars;\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value);\n}\n?>";
|
||||
$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n\";?>";
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$output));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
||||
$output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
||||
$output .= "foreach (Smarty::\\\$global_tpl_vars as \\\$key => \\\$value){\n";
|
||||
@@ -158,11 +167,16 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$output .= "\$_smarty_tpl->tpl_vars = array_pop(\$_smarty_tpl->_cache['saved_tpl_vars']);\n}\n}\n";
|
||||
$output .= "/*/ {$_funcName}_nocache */\n\n";
|
||||
$output .= "?>\n";
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output));
|
||||
$_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", array($this,
|
||||
'removeNocache'), $_functionCode->to_smarty_php($compiler->parser)));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$output));
|
||||
$_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
|
||||
array($this, 'removeNocache'),
|
||||
$_functionCode->to_smarty_php($compiler->parser)));
|
||||
}
|
||||
$compiler->parent_compiler->tpl_function[$_name]['call_name'] = $compiler->parent_compiler->template->tpl_function[$_name]['call_name'] = $_funcName;
|
||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] =
|
||||
$compiler->parent_compiler->template->tpl_function[ $_name ][ 'call_name' ] = $_funcName;
|
||||
$output = "<?php\n";
|
||||
$output .= "/* {$_funcName} */\n";
|
||||
$output .= "if (!function_exists('{$_funcName}')) {\n";
|
||||
@@ -170,20 +184,25 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$output .= "\$saved_tpl_vars = \$_smarty_tpl->tpl_vars;\n";
|
||||
$output .= $_paramsCode;
|
||||
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value);\n}?>";
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$output));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
||||
$output = "<?php foreach (Smarty::\$global_tpl_vars as \$key => \$value){\n";
|
||||
$output .= "if (!isset(\$_smarty_tpl->tpl_vars[\$key]) || \$_smarty_tpl->tpl_vars[\$key] === \$value) \$saved_tpl_vars[\$key] = \$value;\n}\n";
|
||||
$output .= "\$_smarty_tpl->tpl_vars = \$saved_tpl_vars;\n}\n}\n";
|
||||
$output .= "/*/ {$_funcName} */\n\n";
|
||||
$output .= "?>\n";
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output));
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$output));
|
||||
$compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
|
||||
// nocache plugins must be copied
|
||||
if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) {
|
||||
foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) {
|
||||
foreach ($tmp as $type => $data) {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled'][$plugin][$type] = $data;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] =
|
||||
$data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,7 +222,9 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
*/
|
||||
function removeNocache($match)
|
||||
{
|
||||
$code = preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", '', $match[0]);
|
||||
$code =
|
||||
preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
|
||||
'', $match[ 0 ]);
|
||||
$code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code);
|
||||
return $code;
|
||||
}
|
||||
|
@@ -56,12 +56,13 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
|
||||
$_nocache = '';
|
||||
}
|
||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] .
|
||||
$_output =
|
||||
"<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" . $parameter['if condition']['var']['var'] .
|
||||
"$_nocache);\n";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" .
|
||||
$parameter['if condition']['var']['smarty_internal_index'] . " = " .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] . "$_nocache);\n";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value" . $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ] . " = " .
|
||||
$parameter[ 'if condition' ][ 'value' ] . ") {?>";
|
||||
} else {
|
||||
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ] .
|
||||
@@ -160,17 +161,19 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
|
||||
$this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
|
||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||
$_output = "<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]) || !is_array(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] . "$_nocache);\n";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" .
|
||||
$parameter['if condition']['var']['smarty_internal_index'] . " = " .
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value" . $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ] . " = " .
|
||||
$parameter[ 'if condition' ][ 'value' ] . ") {?>";
|
||||
} else {
|
||||
$_output = "<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" .
|
||||
$parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output =
|
||||
"<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ] .
|
||||
"])) \$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ] .
|
||||
"] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ] . "]->value = " .
|
||||
$parameter[ 'if condition' ][ 'value' ] . ") {?>";
|
||||
}
|
||||
@@ -196,9 +199,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
|
||||
"]) || !is_array(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" .
|
||||
$parameter['if condition']['var']['var'] . "$_nocache);\n");
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" .
|
||||
$parameter['if condition']['var']['smarty_internal_index'] . " = " .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"$_nocache);\n");
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value" . $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ] . " = " .
|
||||
$parameter[ 'if condition' ][ 'value' ] . ") {?>";
|
||||
} else {
|
||||
$_output = $compiler->appendCode($tmp, "<?php if (!isset(\$_smarty_tpl->tpl_vars[" .
|
||||
|
@@ -58,8 +58,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $valid_scopes = array('local' => true, 'parent' => true, 'root' => true,
|
||||
'tpl_root' => true);
|
||||
public $valid_scopes = array('local' => true, 'parent' => true, 'root' => true, 'tpl_root' => true);
|
||||
|
||||
/**
|
||||
* Compiles code for the {include} tag
|
||||
@@ -117,7 +116,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
if (isset($_attr[ 'scope' ])) {
|
||||
$_attr[ 'scope' ] = trim($_attr[ 'scope' ], "'\"");
|
||||
if (!isset($this->valid_scopes[ $_attr[ 'scope' ] ])) {
|
||||
$compiler->trigger_template_error("illegal value '{$_attr['scope']}' for \"scope\" attribute", null, true);
|
||||
$compiler->trigger_template_error("illegal value '{$_attr['scope']}' for \"scope\" attribute", null,
|
||||
true);
|
||||
}
|
||||
if ($_attr[ 'scope' ] != 'local') {
|
||||
if ($_attr[ 'scope' ] == 'parent') {
|
||||
@@ -167,8 +167,9 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
}
|
||||
// variable compile_id?
|
||||
if (isset($_attr[ 'compile_id' ])) {
|
||||
if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2 ||
|
||||
is_numeric($_attr['compile_id']))) || substr_count($_attr['compile_id'], '(') != 0 ||
|
||||
if (!((substr_count($_attr[ 'compile_id' ], '"') == 2 ||
|
||||
substr_count($_attr[ 'compile_id' ], "'") == 2 || is_numeric($_attr[ 'compile_id' ]))) ||
|
||||
substr_count($_attr[ 'compile_id' ], '(') != 0 ||
|
||||
substr_count($_attr[ 'compile_id' ], '$_smarty_tpl->') != 0
|
||||
) {
|
||||
$merge_compiled_includes = false;
|
||||
@@ -315,11 +316,12 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
{
|
||||
$compiler->smarty->allow_ambiguous_resources = true;
|
||||
/* @var Smarty_Internal_Template $tpl */
|
||||
$tpl =
|
||||
new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty, $compiler->template,
|
||||
$compiler->template->cache_id, $c_id, $_caching);
|
||||
$tpl = new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty,
|
||||
$compiler->template, $compiler->template->cache_id, $c_id,
|
||||
$_caching);
|
||||
if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) {
|
||||
$compiler->parent_compiler->mergedSubTemplatesData[$hashResourceName][$t_hash]['uid'] = $tpl->source->uid;
|
||||
$compiler->parent_compiler->mergedSubTemplatesData[ $hashResourceName ][ $t_hash ][ 'uid' ] =
|
||||
$tpl->source->uid;
|
||||
if (isset($compiler->template->ext->_inheritance)) {
|
||||
$tpl->ext->_inheritance = clone $compiler->template->ext->_inheritance;
|
||||
}
|
||||
@@ -337,7 +339,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
$sourceInfo = $compiler->template->source->filepath;
|
||||
} else {
|
||||
$basename = $compiler->template->source->handler->getBasename($compiler->template->source);
|
||||
$sourceInfo = $compiler->template->source->type .':' . ($basename ? $basename : $compiler->template->source->name);
|
||||
$sourceInfo = $compiler->template->source->type . ':' .
|
||||
($basename ? $basename : $compiler->template->source->name);
|
||||
}
|
||||
// get compiled code
|
||||
$compiled_code = "<?php\n\n";
|
||||
|
@@ -109,7 +109,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
||||
$_output .= "require_once '{$_filepath}' ;";
|
||||
require_once $_filepath;
|
||||
if (!is_callable($_function)) {
|
||||
$compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'", null, true);
|
||||
$compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'",
|
||||
null, true);
|
||||
}
|
||||
} else {
|
||||
$_filepath = 'null';
|
||||
@@ -118,7 +119,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
||||
if (!is_callable($_function)) {
|
||||
// try plugin
|
||||
if (!$_function = $compiler->getPlugin($_name, 'insert')) {
|
||||
$compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", null, true);
|
||||
$compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", null,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -66,8 +66,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
||||
$output .= "if (!is_callable({$callable})) {\nthrow new SmartyException('block tag \'{$tag}\' not callable or registered');\n}\n";
|
||||
}
|
||||
$output .= "\$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('{$tag}', {$_params});\n";
|
||||
$output .=
|
||||
"\$_block_repeat{$this->nesting}=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat{$this->nesting});\nwhile (\$_block_repeat{$this->nesting}) {\nob_start();\n?>";
|
||||
$output .= "\$_block_repeat{$this->nesting}=true;\necho {$callback}({$_params}, null, \$_smarty_tpl, \$_block_repeat{$this->nesting});\nwhile (\$_block_repeat{$this->nesting}) {\nob_start();\n?>";
|
||||
$this->openTag($compiler, $tag, array($_params, $compiler->nocache, $callback));
|
||||
// maybe nocache because of nocache variables or nocache plugin
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
|
@@ -174,8 +174,10 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
|
||||
if ($_content != '') {
|
||||
// run pre filter if required
|
||||
if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
|
||||
isset($nextCompiler->smarty->registered_filters['pre']))) {
|
||||
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content, $nextCompiler->template);
|
||||
isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
|
||||
) {
|
||||
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content,
|
||||
$nextCompiler->template);
|
||||
}
|
||||
$this->matchProperty($_content);
|
||||
}
|
||||
@@ -190,7 +192,6 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
|
||||
*/
|
||||
public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -48,7 +48,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
case 1:
|
||||
// registered modifier
|
||||
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
|
||||
$function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
|
||||
$function =
|
||||
$compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
|
||||
if (!is_array($function)) {
|
||||
$output = "{$function}({$params})";
|
||||
} else {
|
||||
@@ -66,7 +67,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
case 2:
|
||||
// registered modifier compiler
|
||||
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
|
||||
$output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);
|
||||
$output =
|
||||
call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
|
||||
$single_modifier, $compiler->smarty);
|
||||
$compiler->known_modifier_type[ $modifier ] = $type;
|
||||
break 2;
|
||||
}
|
||||
@@ -126,7 +129,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
$output = "{$function}({$params})";
|
||||
} else {
|
||||
if (is_object($function[ 0 ])) {
|
||||
$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
|
||||
$output =
|
||||
'$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
|
||||
$modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
|
||||
} else {
|
||||
$output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
|
||||
|
@@ -44,9 +44,12 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->compiled->has_nocache_code;
|
||||
$output = addcslashes($_attr[ 'code' ], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" .
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$compiler->processNocacheCode("<?php echo '" .
|
||||
$output .
|
||||
"';?>", true)));
|
||||
"';?>",
|
||||
true)));
|
||||
$compiler->template->compiled->has_nocache_code = $save;
|
||||
return '';
|
||||
}
|
||||
@@ -54,22 +57,28 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
if ($compiler->php_handling == Smarty::PHP_REMOVE) {
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_QUOTE) {
|
||||
$output = preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', array($this,
|
||||
'quote'), $_attr['code']);
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Text($output));
|
||||
$output =
|
||||
preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i',
|
||||
array($this, 'quote'), $_attr[ 'code' ]);
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Text($output));
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr[ 'type' ] == 'unmatched') {
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->compiled->has_nocache_code;
|
||||
$output = addcslashes($_attr[ 'code' ], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" .
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
||||
$compiler->processNocacheCode("<?php echo '" .
|
||||
$output .
|
||||
"';?>", true)));
|
||||
"';?>",
|
||||
true)));
|
||||
$compiler->template->compiled->has_nocache_code = $save;
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_ALLOW) {
|
||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||
$compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', null, true);
|
||||
$compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it',
|
||||
null, true);
|
||||
}
|
||||
$compiler->has_code = true;
|
||||
return $_attr[ 'code' ];
|
||||
@@ -79,7 +88,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
} else {
|
||||
$compiler->has_code = true;
|
||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||
$compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, true);
|
||||
$compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null,
|
||||
true);
|
||||
}
|
||||
$ldel = preg_quote($compiler->smarty->left_delimiter, '#');
|
||||
$rdel = preg_quote($compiler->smarty->right_delimiter, '#');
|
||||
@@ -91,8 +101,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
$compiler->trigger_template_error("illegal value of option flag \"{$match[2]}\"", null, true);
|
||||
}
|
||||
}
|
||||
return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#",
|
||||
"#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), array('<?php ', '?>'), $_attr['code']);
|
||||
return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"),
|
||||
array('<?php ', '?>'), $_attr[ 'code' ]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +167,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
$lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'");
|
||||
}
|
||||
while ($body) {
|
||||
if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) {
|
||||
if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~',
|
||||
$lex->data, $match, PREG_OFFSET_CAPTURE, $start)) {
|
||||
$value = $match[ 0 ][ 0 ];
|
||||
$from = $pos = $match[ 0 ][ 1 ];
|
||||
if ($pos > $close) {
|
||||
@@ -173,8 +184,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
}
|
||||
}
|
||||
while ($close > $pos && $close < $start) {
|
||||
if (preg_match('~' . preg_quote($closeTag, '~') .
|
||||
'~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $from)) {
|
||||
if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE,
|
||||
$from)) {
|
||||
$close = $match[ 0 ][ 1 ];
|
||||
$from = $close + strlen($match[ 0 ][ 0 ]);
|
||||
} else {
|
||||
|
@@ -58,7 +58,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
$output = $parameter[ 'value' ];
|
||||
// tag modifier
|
||||
if (!empty($parameter[ 'modifierlist' ])) {
|
||||
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'],
|
||||
$output = $compiler->compileTag('private_modifier', array(),
|
||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||
'value' => $output));
|
||||
}
|
||||
if (!$_attr[ 'nofilter' ]) {
|
||||
@@ -67,7 +68,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
if (empty($compiler->default_modifier_list)) {
|
||||
$modifierlist = array();
|
||||
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
|
||||
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
|
||||
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
|
||||
$single_default_modifier, $mod_array);
|
||||
for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
|
||||
if ($mod_array[ 0 ][ $i ] != ':') {
|
||||
$modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
|
||||
@@ -76,7 +78,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
}
|
||||
$compiler->default_modifier_list = $modifierlist;
|
||||
}
|
||||
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list,
|
||||
$output = $compiler->compileTag('private_modifier', array(),
|
||||
array('modifierlist' => $compiler->default_modifier_list,
|
||||
'value' => $output));
|
||||
}
|
||||
// autoescape html
|
||||
@@ -90,7 +93,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
if (!is_array($function)) {
|
||||
$output = "{$function}({$output},\$_smarty_tpl)";
|
||||
} elseif (is_object($function[ 0 ])) {
|
||||
$output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
|
||||
$output =
|
||||
"\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
|
||||
} else {
|
||||
$output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
|
||||
}
|
||||
@@ -98,7 +102,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
}
|
||||
// auto loaded filters
|
||||
if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) {
|
||||
foreach ((array) $compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name) {
|
||||
foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name)
|
||||
{
|
||||
$result = $this->compile_output_filter($compiler, $name, $output);
|
||||
if ($result !== false) {
|
||||
$output = $result;
|
||||
@@ -114,8 +119,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
) {
|
||||
$output = $result;
|
||||
} else {
|
||||
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => array($filter),
|
||||
'value' => $output));
|
||||
$output = $compiler->compileTag('private_modifier', array(),
|
||||
array('modifierlist' => array($filter), 'value' => $output));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,11 +145,15 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
$path = $compiler->smarty->loadPlugin($plugin_name, false);
|
||||
if ($path) {
|
||||
if ($compiler->template->caching) {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] =
|
||||
$path;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] =
|
||||
$plugin_name;
|
||||
} else {
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['file'] = $path;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] =
|
||||
$path;
|
||||
$compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] =
|
||||
$plugin_name;
|
||||
}
|
||||
} else {
|
||||
// not found
|
||||
|
@@ -34,10 +34,12 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C
|
||||
if (is_array($callback)) {
|
||||
if (is_object($callback[ 0 ])) {
|
||||
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
|
||||
$callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
|
||||
$callback =
|
||||
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
|
||||
} else {
|
||||
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
|
||||
$callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
|
||||
$callback =
|
||||
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
|
||||
}
|
||||
} else {
|
||||
$callable = "\$_block_plugin{$this->nesting}";
|
||||
|
@@ -69,7 +69,8 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
||||
if (!is_array($function)) {
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
|
||||
} elseif (is_object($function[ 0 ])) {
|
||||
$output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
$output =
|
||||
"<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
} else {
|
||||
$output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
}
|
||||
|
@@ -59,8 +59,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum',
|
||||
'index_prev', 'index_next', 'loop');
|
||||
public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev',
|
||||
'index_next', 'loop');
|
||||
|
||||
/**
|
||||
* {section} tag has no item properties
|
||||
@@ -103,7 +103,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
// maybe nocache because of nocache variables
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
|
||||
$initLocal = array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",);
|
||||
$initLocal =
|
||||
array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",);
|
||||
$initNamedProperty = array();
|
||||
$initFor = array();
|
||||
$incFor = array();
|
||||
@@ -214,8 +215,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
}
|
||||
|
||||
if (!isset($propValue[ 'start' ])) {
|
||||
$start_code = array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue['loop'],
|
||||
5 => ' - 1');
|
||||
$start_code =
|
||||
array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1');
|
||||
if ($propType[ 'loop' ] == 0) {
|
||||
$start_code[ 5 ] = '';
|
||||
$start_code[ 4 ] = $propValue[ 'loop' ] - 1;
|
||||
@@ -233,10 +234,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
}
|
||||
$propValue[ 'start' ] = join('', $start_code);
|
||||
} else {
|
||||
$start_code = array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ",
|
||||
4 => '0', 5 => ' : ', 6 => '-1', 7 => ', ',
|
||||
8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')', 11 => ' : ',
|
||||
12 => 'min(', 13 => $propValue['start'], 14 => ', ',
|
||||
$start_code =
|
||||
array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0',
|
||||
5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')',
|
||||
11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ',
|
||||
15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ',
|
||||
18 => $propType[ 'loop' ] == 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1",
|
||||
19 => ')');
|
||||
@@ -259,16 +260,17 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
$start_code[ $i ] = '';
|
||||
}
|
||||
if ($propType[ 'start' ] == 0) {
|
||||
$start_code = array(max($propValue['step'] > 0 ? 0 : - 1, $propValue['start'] +
|
||||
$propValue['loop']));
|
||||
$start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1,
|
||||
$propValue[ 'start' ] + $propValue[ 'loop' ]));
|
||||
}
|
||||
} else {
|
||||
for ($i = 1; $i <= 11; $i ++) {
|
||||
$start_code[ $i ] = '';
|
||||
}
|
||||
if ($propType[ 'start' ] == 0) {
|
||||
$start_code = array(min($propValue['step'] > 0 ? $propValue['loop'] : $propValue['loop'] -
|
||||
1, $propValue['start']));
|
||||
$start_code =
|
||||
array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
|
||||
$propValue[ 'start' ]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,11 +287,12 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
||||
$propValue[ 'total' ] = $propValue[ 'loop' ];
|
||||
$propType[ 'total' ] = $propType[ 'loop' ];
|
||||
} else {
|
||||
$propType['total'] = $propType['start'] + $propType['loop'] + $propType['step'] + $propType['max'];
|
||||
$propType[ 'total' ] =
|
||||
$propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
|
||||
if ($propType[ 'total' ] == 0) {
|
||||
$propValue['total'] = min(ceil(($propValue['step'] > 0 ? $propValue['loop'] -
|
||||
$propValue['start'] : (int) $propValue['start'] + 1) /
|
||||
abs($propValue['step'])), $propValue['max']);
|
||||
$propValue[ 'total' ] =
|
||||
min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
|
||||
(int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]);
|
||||
} else {
|
||||
$total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
|
||||
5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
|
||||
@@ -438,8 +441,8 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
|
||||
$compiler->tag_nocache = true;
|
||||
}
|
||||
|
||||
list($openTag, $compiler->nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section',
|
||||
'sectionelse'));
|
||||
list($openTag, $compiler->nocache, $local, $sectionVar) =
|
||||
$this->closeTag($compiler, array('section', 'sectionelse'));
|
||||
|
||||
$output = "<?php\n";
|
||||
if ($openTag == 'sectionelse') {
|
||||
|
@@ -59,11 +59,12 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
|
||||
}
|
||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||
$_output .= "if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" . $parameter['if condition']['var']['var'] .
|
||||
"$_nocache);\n";
|
||||
$_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" .
|
||||
$parameter['if condition']['var']['smarty_internal_index'] . " = " .
|
||||
"]) || !is_array(\$_smarty_tpl->tpl_vars[" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value)) \$_smarty_tpl->_createLocalArrayVariable(" .
|
||||
$parameter[ 'if condition' ][ 'var' ][ 'var' ] . "$_nocache);\n";
|
||||
$_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ][ 'var' ] .
|
||||
"]->value" . $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ] . " = " .
|
||||
$parameter[ 'if condition' ][ 'value' ] . ") {?>";
|
||||
} else {
|
||||
$_output .= "if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter[ 'if condition' ][ 'var' ] .
|
||||
|
@@ -80,7 +80,9 @@ abstract class Smarty_Internal_CompileBase
|
||||
if (in_array($kv[ 'key' ], $this->option_flags)) {
|
||||
if (is_bool($kv[ 'value' ])) {
|
||||
$_indexed_attr[ $kv[ 'key' ] ] = $kv[ 'value' ];
|
||||
} elseif (is_string($kv['value']) && in_array(trim($kv['value'], '\'"'), array('true', 'false'))) {
|
||||
} elseif (is_string($kv[ 'value' ]) &&
|
||||
in_array(trim($kv[ 'value' ], '\'"'), array('true', 'false'))
|
||||
) {
|
||||
if (trim($kv[ 'value' ]) == 'true') {
|
||||
$_indexed_attr[ $kv[ 'key' ] ] = true;
|
||||
} else {
|
||||
|
@@ -101,16 +101,16 @@ class Smarty_Internal_Config_File_Compiler
|
||||
public function compileTemplate(Smarty_Internal_Template $template)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->template->compiled->file_dependency[$this->template->source->uid] = array($this->template->source->filepath,
|
||||
$this->template->source->getTimeStamp(),
|
||||
$this->template->compiled->file_dependency[ $this->template->source->uid ] =
|
||||
array($this->template->source->filepath, $this->template->source->getTimeStamp(),
|
||||
$this->template->source->type);
|
||||
if ($this->smarty->debugging) {
|
||||
$this->smarty->_debug->start_compile($this->template);
|
||||
}
|
||||
// init the lexer/parser to compile the config file
|
||||
/* @var Smarty_Internal_ConfigFileLexer $lex */
|
||||
$lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) .
|
||||
"\n", $this);
|
||||
$lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . "\n",
|
||||
$this);
|
||||
/* @var Smarty_Internal_ConfigFileParser $parser */
|
||||
$parser = new $this->parser_class($lex, $this);
|
||||
|
||||
@@ -141,8 +141,9 @@ class Smarty_Internal_Config_File_Compiler
|
||||
$this->smarty->_debug->end_compile($this->template);
|
||||
}
|
||||
// template header code
|
||||
$template_header = "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " .
|
||||
strftime("%Y-%m-%d %H:%M:%S") . "\n";
|
||||
$template_header =
|
||||
"<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
|
||||
"\n";
|
||||
$template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
|
||||
|
||||
$code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' .
|
||||
@@ -170,7 +171,8 @@ class Smarty_Internal_Config_File_Compiler
|
||||
// $line--;
|
||||
}
|
||||
$match = preg_split("/\n/", $this->lex->data);
|
||||
$error_text = "Syntax error in config file '{$this->template->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
|
||||
$error_text =
|
||||
"Syntax error in config file '{$this->template->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
|
||||
if (isset($args)) {
|
||||
// individual error message
|
||||
$error_text .= $args;
|
||||
|
@@ -179,23 +179,31 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yypushstate($state)
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
array_push($this->_yy_stack, $this->_yy_state);
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
public function yypopstate()
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
$this->_yy_state = array_pop($this->_yy_stack);
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,14 +211,17 @@ class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
$this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern1 =
|
||||
"/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -225,7 +236,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state START');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state START');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -253,7 +265,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const START = 1;
|
||||
@@ -312,7 +325,8 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
$this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
$this->yy_global_pattern2 =
|
||||
"/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -327,7 +341,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state VALUE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state VALUE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -355,7 +370,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const VALUE = 2;
|
||||
@@ -404,8 +420,8 @@ class Smarty_Internal_Configfilelexer
|
||||
function yy_r2_7()
|
||||
{
|
||||
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes",
|
||||
"no"))
|
||||
if (!$this->configBooleanize ||
|
||||
!in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))
|
||||
) {
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||
@@ -449,7 +465,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -477,7 +494,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const NAKED_STRING_VALUE = 3;
|
||||
@@ -507,7 +525,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state COMMENT');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state COMMENT');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -535,7 +554,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const COMMENT = 4;
|
||||
@@ -577,7 +597,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state SECTION');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state SECTION');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -605,7 +626,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const SECTION = 5;
|
||||
@@ -641,7 +663,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TRIPPLE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data, $this->counter, 5) . '... state TRIPPLE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -669,7 +692,8 @@ class Smarty_Internal_Configfilelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const TRIPPLE = 6;
|
||||
|
@@ -375,10 +375,12 @@ class Smarty_Internal_Configfileparser
|
||||
static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
|
||||
|
||||
static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
|
||||
array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), array(1,), array(), array(), array(),
|
||||
array(2, 4,), array(15, 17,), array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
|
||||
array(6,), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(),
|
||||
array(), array(), array(), array(), array(),);
|
||||
array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,),
|
||||
array(1,), array(), array(), array(), array(2, 4,), array(15, 17,),
|
||||
array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
|
||||
array(6,), array(), array(), array(), array(), array(), array(), array(),
|
||||
array(), array(), array(), array(), array(), array(), array(), array(),
|
||||
array(),);
|
||||
|
||||
static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||
55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
|
||||
@@ -425,17 +427,20 @@ class Smarty_Internal_Configfileparser
|
||||
public $yystack = array(); /* The parser's stack */
|
||||
|
||||
public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
|
||||
'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END',
|
||||
'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', 'start', 'global_vars', 'sections', 'var_list',
|
||||
'section', 'newline', 'var', 'value',);
|
||||
'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT',
|
||||
'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
|
||||
'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
|
||||
|
||||
public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list',
|
||||
'sections ::= sections section', 'sections ::=', 'section ::= OPENB SECTION CLOSEB newline var_list',
|
||||
'section ::= OPENB DOT SECTION CLOSEB newline var_list', 'var_list ::= var_list newline',
|
||||
'var_list ::= var_list var', 'var_list ::=', 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT',
|
||||
'value ::= BOOL', 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
|
||||
'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END',
|
||||
'value ::= NAKED_STRING', 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
|
||||
'sections ::= sections section', 'sections ::=',
|
||||
'section ::= OPENB SECTION CLOSEB newline var_list',
|
||||
'section ::= OPENB DOT SECTION CLOSEB newline var_list',
|
||||
'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=',
|
||||
'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL',
|
||||
'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
|
||||
'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
|
||||
'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING',
|
||||
'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
|
||||
'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
|
||||
|
||||
public function tokenName($tokenType)
|
||||
@@ -516,7 +521,8 @@ class Smarty_Internal_Configfileparser
|
||||
}
|
||||
$yyruleno = $yyact - self::YYNSTATE;
|
||||
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
||||
$nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno][0]);
|
||||
$nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
|
||||
self::$yyRuleInfo[ $yyruleno ][ 0 ]);
|
||||
if (isset(self::$yyExpectedTokens[ $nextstate ])) {
|
||||
$expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
|
||||
if (isset($res4[ $nextstate ][ $token ])) {
|
||||
@@ -526,7 +532,9 @@ class Smarty_Internal_Configfileparser
|
||||
return array_unique($expected);
|
||||
}
|
||||
} else {
|
||||
if ($res4[$nextstate][$token] = in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
|
||||
if ($res4[ $nextstate ][ $token ] =
|
||||
in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
|
||||
) {
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
return array_unique($expected);
|
||||
@@ -556,10 +564,12 @@ class Smarty_Internal_Configfileparser
|
||||
} else {
|
||||
$yyact = $nextstate;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
@@ -600,7 +610,8 @@ class Smarty_Internal_Configfileparser
|
||||
}
|
||||
$yyruleno = $yyact - self::YYNSTATE;
|
||||
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
||||
$nextstate = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno][0]);
|
||||
$nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
|
||||
self::$yyRuleInfo[ $yyruleno ][ 0 ]);
|
||||
if (isset($res2[ $nextstate ][ $token ])) {
|
||||
if ($res2[ $nextstate ][ $token ]) {
|
||||
$this->yyidx = $yyidx;
|
||||
@@ -608,7 +619,10 @@ class Smarty_Internal_Configfileparser
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) && in_array($token, self::$yyExpectedTokens[$nextstate], true))) {
|
||||
if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
|
||||
in_array($token, self::$yyExpectedTokens[ $nextstate ],
|
||||
true))
|
||||
) {
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
return true;
|
||||
@@ -641,10 +655,12 @@ class Smarty_Internal_Configfileparser
|
||||
} else {
|
||||
$yyact = $nextstate;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
@@ -669,9 +685,13 @@ class Smarty_Internal_Configfileparser
|
||||
}
|
||||
$i += $iLookAhead;
|
||||
if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
|
||||
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
|
||||
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) &&
|
||||
($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
|
||||
) {
|
||||
if ($this->yyTraceFILE) {
|
||||
fwrite($this->yyTraceFILE, $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[$iLookAhead] . " => " . $this->yyTokenName[$iFallback] . "\n");
|
||||
fwrite($this->yyTraceFILE,
|
||||
$this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " .
|
||||
$this->yyTokenName[ $iFallback ] . "\n");
|
||||
}
|
||||
|
||||
return $this->yy_find_shift_action($iFallback);
|
||||
@@ -739,15 +759,17 @@ class Smarty_Internal_Configfileparser
|
||||
}
|
||||
|
||||
public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
|
||||
array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), array(0 => 23, 1 => 2),
|
||||
array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), array(0 => 26, 1 => 3), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), array(0 => 25, 1 => 3),);
|
||||
array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6),
|
||||
array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0),
|
||||
array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2),
|
||||
array(0 => 25, 1 => 3),);
|
||||
|
||||
public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
|
||||
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
|
||||
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
|
||||
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14,
|
||||
15 => 15, 16 => 16, 17 => 17, 18 => 17,);
|
||||
|
||||
#line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
function yy_r0()
|
||||
@@ -773,7 +795,8 @@ class Smarty_Internal_Configfileparser
|
||||
function yy_r5()
|
||||
{
|
||||
if ($this->configReadHidden) {
|
||||
$this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor,
|
||||
$this->yystack[ $this->yyidx + 0 ]->minor);
|
||||
}
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
@@ -787,7 +810,8 @@ class Smarty_Internal_Configfileparser
|
||||
#line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
function yy_r7()
|
||||
{
|
||||
$this->_retvalue = array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
|
||||
$this->_retvalue =
|
||||
array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor));
|
||||
}
|
||||
|
||||
#line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
@@ -856,7 +880,8 @@ class Smarty_Internal_Configfileparser
|
||||
public function yy_reduce($yyruleno)
|
||||
{
|
||||
if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) {
|
||||
fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, self::$yyRuleName[$yyruleno]);
|
||||
fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
|
||||
self::$yyRuleName[ $yyruleno ]);
|
||||
}
|
||||
|
||||
$this->_retvalue = $yy_lefthand_side = null;
|
||||
@@ -970,12 +995,14 @@ class Smarty_Internal_Configfileparser
|
||||
$yymx = $this->yystack[ $this->yyidx ]->major;
|
||||
if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
|
||||
fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt,
|
||||
$this->yyTokenName[ $yymajor ]);
|
||||
}
|
||||
$this->yy_destructor($yymajor, $yytokenvalue);
|
||||
$yymajor = self::YYNOCODE;
|
||||
} else {
|
||||
while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
|
||||
while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL &&
|
||||
($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
if ($this->yyidx < 0 || $yymajor == 0) {
|
||||
@@ -1004,7 +1031,8 @@ class Smarty_Internal_Configfileparser
|
||||
$this->yy_accept();
|
||||
$yymajor = self::YYNOCODE;
|
||||
}
|
||||
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
|
||||
}
|
||||
while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
* @subpackage Template
|
||||
*
|
||||
* @property int $scope
|
||||
|
||||
* The following methods will be dynamically loaded by the extension handler when they are called.
|
||||
* They are located in a corresponding Smarty_Internal_Method_xxxx class
|
||||
*
|
||||
@@ -203,7 +202,9 @@ class Smarty_Internal_Data
|
||||
* @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable
|
||||
* @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
|
||||
*/
|
||||
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, $error_enable = true){
|
||||
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
|
||||
$error_enable = true)
|
||||
{
|
||||
return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
|
||||
}
|
||||
|
||||
|
@@ -68,8 +68,8 @@ class Smarty_Internal_Extension_Handler
|
||||
if (!isset($this->_property_info[ $prop = $match[ 2 ] ])) {
|
||||
// convert camel case to underscored name
|
||||
$this->resolvedProperties[ $prop ] = $pn = strtolower(join('_',
|
||||
preg_split('/([A-Z][^A-Z]*)/', $prop, - 1,
|
||||
PREG_SPLIT_NO_EMPTY |
|
||||
preg_split('/([A-Z][^A-Z]*)/', $prop,
|
||||
- 1, PREG_SPLIT_NO_EMPTY |
|
||||
PREG_SPLIT_DELIM_CAPTURE)));
|
||||
$this->_property_info[ $prop ] = property_exists($data, $pn) ? 1 :
|
||||
($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
|
||||
|
@@ -40,7 +40,8 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S
|
||||
foreach ((array) $filters as $type => $value) {
|
||||
$this->_checkFilterType($type);
|
||||
if (!empty($smarty->autoload_filters[ $type ])) {
|
||||
$smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $value);
|
||||
$smarty->autoload_filters[ $type ] =
|
||||
array_merge($smarty->autoload_filters[ $type ], (array) $value);
|
||||
} else {
|
||||
$smarty->autoload_filters[ $type ] = (array) $value;
|
||||
}
|
||||
|
@@ -33,7 +33,8 @@ class Smarty_Internal_Method_ClearCache
|
||||
*
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
||||
public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null,
|
||||
$type = null)
|
||||
{
|
||||
$smarty->_clearTemplateCache();
|
||||
// load cache resource and call clear
|
||||
|
@@ -90,13 +90,14 @@ class Smarty_Internal_Method_ClearCompiledTemplate
|
||||
}
|
||||
} else {
|
||||
$unlink = false;
|
||||
if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) &&
|
||||
$a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
|
||||
if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =
|
||||
!strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
|
||||
(!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) &&
|
||||
substr_compare($_filepath, $_resource_part_1, - $_resource_part_1_length,
|
||||
$_resource_part_1_length) == 0) ||
|
||||
(isset($_filepath[$_resource_part_2_length]) &&
|
||||
substr_compare($_filepath, $_resource_part_2, - $_resource_part_2_length,
|
||||
substr_compare($_filepath, $_resource_part_1,
|
||||
- $_resource_part_1_length, $_resource_part_1_length) ==
|
||||
0) || (isset($_filepath[ $_resource_part_2_length ]) &&
|
||||
substr_compare($_filepath, $_resource_part_2,
|
||||
- $_resource_part_2_length,
|
||||
$_resource_part_2_length) == 0))
|
||||
) {
|
||||
if (isset($exp_time)) {
|
||||
|
@@ -25,7 +25,8 @@ class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_Com
|
||||
*
|
||||
* @return integer number of template files recompiled
|
||||
*/
|
||||
public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
|
||||
public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
|
||||
$max_errors = null)
|
||||
{
|
||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
|
||||
}
|
||||
|
@@ -31,7 +31,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
||||
*
|
||||
* @return integer number of template files recompiled
|
||||
*/
|
||||
public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
|
||||
public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0,
|
||||
$max_errors = null)
|
||||
{
|
||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
|
||||
}
|
||||
@@ -48,7 +49,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
||||
*
|
||||
* @return int number of template files compiled
|
||||
*/
|
||||
protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, $isConfig = false)
|
||||
protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors,
|
||||
$isConfig = false)
|
||||
{
|
||||
// switch off time limit
|
||||
if (function_exists('set_time_limit')) {
|
||||
@@ -81,7 +83,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
||||
/* @var Smarty_Internal_Template $_tpl */
|
||||
$_tpl = new $smarty->template_class($_file, $_smarty);
|
||||
$_tpl->caching = Smarty::CACHING_OFF;
|
||||
$_tpl->source = $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
|
||||
$_tpl->source =
|
||||
$isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
|
||||
if ($_tpl->mustCompile()) {
|
||||
$_tpl->compileTemplateSource();
|
||||
$_count ++;
|
||||
|
@@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetDebugTemplate
|
||||
* return name of debugging template
|
||||
*
|
||||
* @api Smarty::getDebugTemplate()
|
||||
|
||||
*
|
||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||
*
|
||||
* @return string
|
||||
|
@@ -31,7 +31,8 @@ class Smarty_Internal_Method_GetTemplateVars
|
||||
*
|
||||
* @return mixed variable value or or array of variables
|
||||
*/
|
||||
public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
|
||||
public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null,
|
||||
$searchParents = true)
|
||||
{
|
||||
if (isset($varName)) {
|
||||
$_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false);
|
||||
@@ -80,7 +81,8 @@ class Smarty_Internal_Method_GetTemplateVars
|
||||
*
|
||||
* @return \Smarty_Variable
|
||||
*/
|
||||
public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null, $searchParents = true, $errorEnable = true)
|
||||
public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null,
|
||||
$searchParents = true, $errorEnable = true)
|
||||
{
|
||||
if ($_ptr === null) {
|
||||
$_ptr = $data;
|
||||
|
@@ -40,8 +40,10 @@ class Smarty_Internal_Method_MustCompile
|
||||
}
|
||||
if ($_template->mustCompile === null) {
|
||||
$_template->mustCompile = (!$_template->source->handler->uncompiled &&
|
||||
($_template->smarty->force_compile || $_template->source->handler->recompiled || !$_template->compiled->exists ||
|
||||
($_template->smarty->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp())));
|
||||
($_template->smarty->force_compile || $_template->source->handler->recompiled ||
|
||||
!$_template->compiled->exists || ($_template->smarty->compile_check &&
|
||||
$_template->compiled->getTimeStamp() <
|
||||
$_template->source->getTimeStamp())));
|
||||
}
|
||||
|
||||
return $_template->mustCompile;
|
||||
|
@@ -30,7 +30,8 @@ class Smarty_Internal_Method_RegisterCacheResource
|
||||
*
|
||||
* @return \Smarty|\Smarty_Internal_Template
|
||||
*/
|
||||
public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name, Smarty_CacheResource $resource_handler)
|
||||
public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name,
|
||||
Smarty_CacheResource $resource_handler)
|
||||
{
|
||||
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
|
||||
$smarty->registered_cache_resources[ $name ] = $resource_handler;
|
||||
|
@@ -53,8 +53,8 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler
|
||||
$default_handler = $source->smarty->default_template_handler_func;
|
||||
}
|
||||
$_content = $_timestamp = null;
|
||||
$_return = call_user_func_array($default_handler, array($source->type, $source->name, &$_content, &$_timestamp,
|
||||
$source->smarty));
|
||||
$_return = call_user_func_array($default_handler,
|
||||
array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));
|
||||
if (is_string($_return)) {
|
||||
$source->exists = is_file($_return);
|
||||
if ($source->exists) {
|
||||
|
@@ -44,7 +44,8 @@ class Smarty_Internal_Method_RegisterObject
|
||||
* @return \Smarty|\Smarty_Internal_Template
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object, $allowed_methods_properties = array(), $format = true, $block_methods = array())
|
||||
public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object,
|
||||
$allowed_methods_properties = array(), $format = true, $block_methods = array())
|
||||
{
|
||||
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
|
||||
// test if allowed methods callable
|
||||
@@ -64,8 +65,8 @@ class Smarty_Internal_Method_RegisterObject
|
||||
}
|
||||
}
|
||||
// register the object
|
||||
$smarty->registered_objects[$object_name] = array($object, (array) $allowed_methods_properties,
|
||||
(boolean) $format, (array) $block_methods);
|
||||
$smarty->registered_objects[ $object_name ] =
|
||||
array($object, (array) $allowed_methods_properties, (boolean) $format, (array) $block_methods);
|
||||
return $obj;
|
||||
}
|
||||
}
|
@@ -35,7 +35,8 @@ class Smarty_Internal_Method_RegisterPlugin
|
||||
* @return \Smarty|\Smarty_Internal_Template
|
||||
* @throws SmartyException when the plugin tag is invalid
|
||||
*/
|
||||
public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, $cache_attr = null)
|
||||
public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true,
|
||||
$cache_attr = null)
|
||||
{
|
||||
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
|
||||
if (isset($smarty->registered_plugins[ $type ][ $name ])) {
|
||||
|
@@ -37,8 +37,8 @@ class Smarty_Internal_Method_RegisterResource
|
||||
public function registerResource(Smarty_Internal_TemplateBase $obj, $name, $resource_handler)
|
||||
{
|
||||
$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
|
||||
$smarty->registered_resources[$name] = $resource_handler instanceof
|
||||
Smarty_Resource ? $resource_handler : array($resource_handler, false);
|
||||
$smarty->registered_resources[ $name ] =
|
||||
$resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false);
|
||||
return $obj;
|
||||
}
|
||||
}
|
@@ -37,7 +37,8 @@ class Smarty_Internal_Nocache_Insert
|
||||
}
|
||||
// call insert
|
||||
if (isset($_assign)) {
|
||||
$_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
|
||||
$_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
|
||||
",\$_smarty_tpl), true);?>";
|
||||
} else {
|
||||
$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
|
||||
}
|
||||
@@ -46,6 +47,7 @@ class Smarty_Internal_Nocache_Insert
|
||||
$_tpl = $_tpl->parent;
|
||||
}
|
||||
|
||||
return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
|
||||
return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output .
|
||||
"/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
|
||||
}
|
||||
}
|
||||
|
@@ -40,13 +40,20 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
|
||||
public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
|
||||
{
|
||||
$last_subtree = count($this->subtrees) - 1;
|
||||
if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof Smarty_Internal_ParseTree_Tag && $this->subtrees[$last_subtree]->saved_block_nesting < $parser->block_nesting_level) {
|
||||
if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag &&
|
||||
$this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
|
||||
) {
|
||||
if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
|
||||
$this->subtrees[$last_subtree]->data = $parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo ' . $subtree->data . ';?>');
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
|
||||
'<?php echo ' . $subtree->data . ';?>');
|
||||
} elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
|
||||
$this->subtrees[$last_subtree]->data = $parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo "' . $subtree->data . '";?>');
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
|
||||
'<?php echo "' . $subtree->data . '";?>');
|
||||
} else {
|
||||
$this->subtrees[$last_subtree]->data = $parser->compiler->appendCode($this->subtrees[$last_subtree]->data, $subtree->data);
|
||||
$this->subtrees[ $last_subtree ]->data =
|
||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
|
||||
}
|
||||
} else {
|
||||
$this->subtrees[] = $subtree;
|
||||
|
@@ -44,7 +44,9 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
|
||||
}
|
||||
// if we are inside an {block} tag the path must be relative to current template
|
||||
if (isset($_template->ext->_inheritance) && $_template->ext->_inheritance->blockNesting && $_template->parent->parent->_objType == 2) {
|
||||
if (isset($_template->ext->_inheritance) && $_template->ext->_inheritance->blockNesting &&
|
||||
$_template->parent->parent->_objType == 2
|
||||
) {
|
||||
$path = dirname($_template->parent->parent->source->filepath) . DS . $file;
|
||||
} else {
|
||||
$path = dirname($_template->parent->source->filepath) . DS . $file;
|
||||
@@ -128,7 +130,8 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
$source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
|
||||
}
|
||||
$source->exists = true;
|
||||
$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : $source->smarty->_joined_template_dir));
|
||||
$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
|
||||
$source->smarty->_joined_template_dir));
|
||||
if ($source->smarty->compile_check == 1) {
|
||||
$source->timestamp = filemtime($source->filepath);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
||||
* @var bool
|
||||
*/
|
||||
public $uncompiled = true;
|
||||
|
||||
/**
|
||||
* container for short_open_tag directive's value before executing PHP templates
|
||||
*
|
||||
@@ -31,10 +32,8 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
||||
*/
|
||||
public $hasCompiledHandler = true;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHP Resource
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -60,7 +60,8 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
|
||||
{
|
||||
// return timestamp
|
||||
$time_stamp = false;
|
||||
call_user_func_array($source->smarty->registered_resources[$source->type][0][1], array($source->name, &$time_stamp, $source->smarty));
|
||||
call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
|
||||
array($source->name, &$time_stamp, $source->smarty));
|
||||
|
||||
return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
|
||||
}
|
||||
@@ -77,7 +78,8 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
|
||||
{
|
||||
// return template string
|
||||
$content = null;
|
||||
$t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$content, $source->smarty));
|
||||
$t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
|
||||
array($source->name, &$content, $source->smarty));
|
||||
if (is_bool($t) && !$t) {
|
||||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
||||
}
|
||||
|
@@ -121,7 +121,9 @@ class Smarty_Internal_Runtime_GetIncludePath
|
||||
public function getIncludePath($dirs, $file, Smarty $smarty)
|
||||
{
|
||||
//if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
|
||||
if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = function_exists('stream_resolve_include_path'))) {
|
||||
if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
|
||||
$this->_has_stream_include = function_exists('stream_resolve_include_path'))
|
||||
) {
|
||||
$this->isNewIncludePath($smarty);
|
||||
}
|
||||
// try PHP include_path
|
||||
@@ -158,8 +160,8 @@ class Smarty_Internal_Runtime_GetIncludePath
|
||||
}
|
||||
} else {
|
||||
foreach ($this->_include_dirs as $key => $_i_path) {
|
||||
$path = isset($this->isPath[$key][$dir_n]) ? $this->isPath[$key][$dir_n] : $this->isPath[$key][$dir_n] = is_dir($_dir_path = $_i_path .
|
||||
$dir) ? $_dir_path : false;
|
||||
$path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
|
||||
$this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
|
||||
if ($path === false) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -83,8 +83,10 @@ class Smarty_Internal_Runtime_TplFunction
|
||||
if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
|
||||
$content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
|
||||
}
|
||||
$tplPtr->smarty->ext->_updateCache->write($cache, $tplPtr, preg_replace('/\s*\?>\s*$/', "\n", $content) . "\n" .
|
||||
preg_replace(array('/^\s*<\?php\s+/', '/\s*\?>\s*$/'), "\n",
|
||||
$tplPtr->smarty->ext->_updateCache->write($cache, $tplPtr,
|
||||
preg_replace('/\s*\?>\s*$/', "\n", $content) .
|
||||
"\n" . preg_replace(array('/^\s*<\?php\s+/',
|
||||
'/\s*\?>\s*$/'), "\n",
|
||||
$match[ 0 ]));
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,8 @@ class Smarty_Internal_Runtime_WriteFile
|
||||
$_error_reporting = error_reporting();
|
||||
error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
|
||||
$_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
|
||||
$_dir_perms = property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
|
||||
$_dir_perms =
|
||||
property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
|
||||
if ($_file_perms !== null) {
|
||||
$old_umask = umask(0);
|
||||
}
|
||||
|
@@ -174,8 +174,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
|
||||
$level = ob_get_level();
|
||||
try {
|
||||
$_smarty_old_error_level =
|
||||
isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) :
|
||||
null;
|
||||
isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null;
|
||||
if ($function == 2) {
|
||||
if ($template->caching) {
|
||||
// return cache status of template
|
||||
|
@@ -760,7 +760,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
// not a variable variable
|
||||
$var = trim($variable, '\'');
|
||||
$this->tag_nocache = $this->tag_nocache |
|
||||
$this->template->ext->getTemplateVars->_getVariable($this->template, $var, null, true, false)->nocache;
|
||||
$this->template->ext->getTemplateVars->_getVariable($this->template, $var, null, true,
|
||||
false)->nocache;
|
||||
// todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
|
||||
}
|
||||
return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
|
||||
@@ -816,9 +817,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1\2',
|
||||
// remove spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||
'#^\s+<#Ss' => '<',
|
||||
'#>\s+$#Ss' => '>',
|
||||
$this->stripRegEx => '');
|
||||
'#^\s+<#Ss' => '<', '#>\s+$#Ss' => '>', $this->stripRegEx => '');
|
||||
|
||||
$text = preg_replace(array_keys($expressions), array_values($expressions), $text);
|
||||
$_offset = 0;
|
||||
@@ -1097,7 +1096,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
*
|
||||
* @param string $varName
|
||||
*/
|
||||
public function setNocacheInVariable($varName){
|
||||
public function setNocacheInVariable($varName)
|
||||
{
|
||||
// create nocache var to make it know for further compiling
|
||||
if ($_var = $this->getId($varName)) {
|
||||
if (isset($this->template->tpl_vars[ $_var ])) {
|
||||
@@ -1116,7 +1116,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
* @return int|string
|
||||
* @throws \SmartyCompilerException
|
||||
*/
|
||||
public function convertScope($_attr, $validScopes){
|
||||
public function convertScope($_attr, $validScopes)
|
||||
{
|
||||
$_scope = Smarty::SCOPE_LOCAL;
|
||||
if (isset($_attr[ 'scope' ])) {
|
||||
$_scopeName = trim($_attr[ 'scope' ], "'\"");
|
||||
@@ -1149,7 +1150,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
public function makeNocacheCode($code)
|
||||
{
|
||||
return "echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/<?php " .
|
||||
str_replace("^#^", "'", addcslashes($code, '\'\\')) . "?>/*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n";
|
||||
str_replace("^#^", "'", addcslashes($code, '\'\\')) .
|
||||
"?>/*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1228,7 +1230,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVarExport($value) {
|
||||
public function getVarExport($value)
|
||||
{
|
||||
return preg_replace('/\s/', '', var_export($value, true));
|
||||
}
|
||||
|
||||
@@ -1239,7 +1242,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function isVariable($value){
|
||||
public function isVariable($value)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return preg_match('/[$(]/', $value);
|
||||
}
|
||||
|
@@ -178,15 +178,14 @@ class Smarty_Internal_Templatelexer
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')',
|
||||
'OPENB' => '[', 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>',
|
||||
'EQUAL' => '=', 'NUMBER' => 'number', 'UNIMATH' => '+" , "-',
|
||||
'MATH' => '*" , "/" , "%', 'INCDEC' => '++" , "--',
|
||||
'SPACE' => ' ', 'DOLLAR' => '$', 'SEMICOLON' => ';',
|
||||
'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@', 'HATCH' => '#',
|
||||
'QUOTE' => '"', 'BACKTICK' => '`', 'VERT' => '"|" modifier',
|
||||
'DOT' => '.', 'COMMA' => '","', 'QMARK' => '"?"',
|
||||
'ID' => 'id, name', 'TEXT' => 'text',
|
||||
'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[',
|
||||
'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=',
|
||||
'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%',
|
||||
'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$',
|
||||
'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@',
|
||||
'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`',
|
||||
'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","',
|
||||
'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text',
|
||||
'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag',
|
||||
'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',
|
||||
'PHP' => '"<?php", "<%", "{php}" tag',
|
||||
@@ -334,7 +333,8 @@ class Smarty_Internal_Templatelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const TEXT = 1;
|
||||
@@ -470,7 +470,8 @@ class Smarty_Internal_Templatelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const TAG = 2;
|
||||
@@ -602,7 +603,8 @@ class Smarty_Internal_Templatelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const TAGBODY = 3;
|
||||
@@ -940,7 +942,8 @@ class Smarty_Internal_Templatelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const LITERAL = 4;
|
||||
@@ -1031,7 +1034,8 @@ class Smarty_Internal_Templatelexer
|
||||
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
while (true);
|
||||
} // end function
|
||||
|
||||
const DOUBLEQUOTEDSTRING = 5;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -359,12 +359,9 @@ class Smarty_Internal_TestInstall
|
||||
// test if sysplugins are available
|
||||
$source = SMARTY_SYSPLUGINS_DIR;
|
||||
if (is_dir($source)) {
|
||||
$expectedSysplugins = array('smartycompilerexception.php' => true,
|
||||
'smartyexception.php' => true,
|
||||
'smarty_cacheresource.php' => true,
|
||||
'smarty_cacheresource_custom.php' => true,
|
||||
'smarty_cacheresource_keyvaluestore.php' => true,
|
||||
'smarty_data.php' => true,
|
||||
$expectedSysplugins = array('smartycompilerexception.php' => true, 'smartyexception.php' => true,
|
||||
'smarty_cacheresource.php' => true, 'smarty_cacheresource_custom.php' => true,
|
||||
'smarty_cacheresource_keyvaluestore.php' => true, 'smarty_data.php' => true,
|
||||
'smarty_internal_block.php' => true,
|
||||
'smarty_internal_cacheresource_file.php' => true,
|
||||
'smarty_internal_compilebase.php' => true,
|
||||
@@ -407,8 +404,7 @@ class Smarty_Internal_TestInstall
|
||||
'smarty_internal_configfilelexer.php' => true,
|
||||
'smarty_internal_configfileparser.php' => true,
|
||||
'smarty_internal_config_file_compiler.php' => true,
|
||||
'smarty_internal_data.php' => true,
|
||||
'smarty_internal_debug.php' => true,
|
||||
'smarty_internal_data.php' => true, 'smarty_internal_debug.php' => true,
|
||||
'smarty_internal_extension_clear.php' => true,
|
||||
'smarty_internal_extension_handler.php' => true,
|
||||
'smarty_internal_method_addautoloadfilters.php' => true,
|
||||
@@ -489,18 +485,13 @@ class Smarty_Internal_TestInstall
|
||||
'smarty_internal_templatelexer.php' => true,
|
||||
'smarty_internal_templateparser.php' => true,
|
||||
'smarty_internal_testinstall.php' => true,
|
||||
'smarty_internal_undefined.php' => true,
|
||||
'smarty_resource.php' => true,
|
||||
'smarty_resource_custom.php' => true,
|
||||
'smarty_resource_recompiled.php' => true,
|
||||
'smarty_resource_uncompiled.php' => true,
|
||||
'smarty_security.php' => true,
|
||||
'smarty_template_cached.php' => true,
|
||||
'smarty_template_compiled.php' => true,
|
||||
'smarty_internal_undefined.php' => true, 'smarty_resource.php' => true,
|
||||
'smarty_resource_custom.php' => true, 'smarty_resource_recompiled.php' => true,
|
||||
'smarty_resource_uncompiled.php' => true, 'smarty_security.php' => true,
|
||||
'smarty_template_cached.php' => true, 'smarty_template_compiled.php' => true,
|
||||
'smarty_template_config.php' => true,
|
||||
'smarty_template_resource_base.php' => true,
|
||||
'smarty_template_source.php' => true,
|
||||
'smarty_undefined_variable.php' => true,
|
||||
'smarty_template_source.php' => true, 'smarty_undefined_variable.php' => true,
|
||||
'smarty_variable.php' => true,);
|
||||
$iterator = new DirectoryIterator($source);
|
||||
foreach ($iterator as $file) {
|
||||
@@ -539,30 +530,28 @@ class Smarty_Internal_TestInstall
|
||||
$source = SMARTY_PLUGINS_DIR;
|
||||
if (is_dir($source)) {
|
||||
$expectedPlugins =
|
||||
array('block.textformat.php' => true, 'function.counter.php' => true,
|
||||
'function.cycle.php' => true, 'function.fetch.php' => true,
|
||||
'function.html_checkboxes.php' => true, 'function.html_image.php' => true,
|
||||
'function.html_options.php' => true, 'function.html_radios.php' => true,
|
||||
'function.html_select_date.php' => true, 'function.html_select_time.php' => true,
|
||||
'function.html_table.php' => true, 'function.mailto.php' => true,
|
||||
'function.math.php' => true, 'modifier.capitalize.php' => true,
|
||||
array('block.textformat.php' => true, 'function.counter.php' => true, 'function.cycle.php' => true,
|
||||
'function.fetch.php' => true, 'function.html_checkboxes.php' => true,
|
||||
'function.html_image.php' => true, 'function.html_options.php' => true,
|
||||
'function.html_radios.php' => true, 'function.html_select_date.php' => true,
|
||||
'function.html_select_time.php' => true, 'function.html_table.php' => true,
|
||||
'function.mailto.php' => true, 'function.math.php' => true, 'modifier.capitalize.php' => true,
|
||||
'modifier.date_format.php' => true, 'modifier.debug_print_var.php' => true,
|
||||
'modifier.escape.php' => true, 'modifier.regex_replace.php' => true,
|
||||
'modifier.replace.php' => true, 'modifier.spacify.php' => true,
|
||||
'modifier.truncate.php' => true, 'modifiercompiler.cat.php' => true,
|
||||
'modifiercompiler.count_characters.php' => true, 'modifiercompiler.count_paragraphs.php' => true,
|
||||
'modifiercompiler.count_sentences.php' => true, 'modifiercompiler.count_words.php' => true,
|
||||
'modifiercompiler.default.php' => true, 'modifiercompiler.escape.php' => true,
|
||||
'modifiercompiler.from_charset.php' => true, 'modifiercompiler.indent.php' => true,
|
||||
'modifiercompiler.lower.php' => true, 'modifiercompiler.noprint.php' => true,
|
||||
'modifiercompiler.string_format.php' => true, 'modifiercompiler.strip.php' => true,
|
||||
'modifiercompiler.strip_tags.php' => true, 'modifiercompiler.to_charset.php' => true,
|
||||
'modifiercompiler.unescape.php' => true, 'modifiercompiler.upper.php' => true,
|
||||
'modifiercompiler.wordwrap.php' => true, 'outputfilter.trimwhitespace.php' => true,
|
||||
'shared.escape_special_chars.php' => true, 'shared.literal_compiler_param.php' => true,
|
||||
'shared.make_timestamp.php' => true, 'shared.mb_str_replace.php' => true,
|
||||
'shared.mb_unicode.php' => true, 'shared.mb_wordwrap.php' => true,
|
||||
'variablefilter.htmlspecialchars.php' => true,);
|
||||
'modifier.replace.php' => true, 'modifier.spacify.php' => true, 'modifier.truncate.php' => true,
|
||||
'modifiercompiler.cat.php' => true, 'modifiercompiler.count_characters.php' => true,
|
||||
'modifiercompiler.count_paragraphs.php' => true, 'modifiercompiler.count_sentences.php' => true,
|
||||
'modifiercompiler.count_words.php' => true, 'modifiercompiler.default.php' => true,
|
||||
'modifiercompiler.escape.php' => true, 'modifiercompiler.from_charset.php' => true,
|
||||
'modifiercompiler.indent.php' => true, 'modifiercompiler.lower.php' => true,
|
||||
'modifiercompiler.noprint.php' => true, 'modifiercompiler.string_format.php' => true,
|
||||
'modifiercompiler.strip.php' => true, 'modifiercompiler.strip_tags.php' => true,
|
||||
'modifiercompiler.to_charset.php' => true, 'modifiercompiler.unescape.php' => true,
|
||||
'modifiercompiler.upper.php' => true, 'modifiercompiler.wordwrap.php' => true,
|
||||
'outputfilter.trimwhitespace.php' => true, 'shared.escape_special_chars.php' => true,
|
||||
'shared.literal_compiler_param.php' => true, 'shared.make_timestamp.php' => true,
|
||||
'shared.mb_str_replace.php' => true, 'shared.mb_unicode.php' => true,
|
||||
'shared.mb_wordwrap.php' => true, 'variablefilter.htmlspecialchars.php' => true,);
|
||||
$iterator = new DirectoryIterator($source);
|
||||
foreach ($iterator as $file) {
|
||||
if (!$file->isDot()) {
|
||||
|
@@ -153,8 +153,8 @@ abstract class Smarty_Resource
|
||||
// try registered resource
|
||||
if (isset($smarty->registered_resources[ $type ])) {
|
||||
return $smarty->_cache[ 'resource_handlers' ][ $type ] =
|
||||
$smarty->registered_resources[$type] instanceof Smarty_Resource ? $smarty->registered_resources[$type] :
|
||||
new Smarty_Internal_Resource_Registered();
|
||||
$smarty->registered_resources[ $type ] instanceof Smarty_Resource ?
|
||||
$smarty->registered_resources[ $type ] : new Smarty_Internal_Resource_Registered();
|
||||
}
|
||||
|
||||
// try sysplugins dir
|
||||
@@ -246,7 +246,8 @@ abstract class Smarty_Resource
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkTimestamps() {
|
||||
public function checkTimestamps()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -377,11 +377,11 @@ class Smarty_Security
|
||||
public function isTrustedTag($tag_name, $compiler)
|
||||
{
|
||||
// check for internal always required tags
|
||||
if (in_array($tag_name, array('assign', 'call', 'private_filter', 'private_block_plugin',
|
||||
'private_function_plugin', 'private_object_block_function',
|
||||
'private_object_function', 'private_registered_function',
|
||||
'private_registered_block', 'private_special_variable',
|
||||
'private_print_expression', 'private_modifier'))) {
|
||||
if (in_array($tag_name,
|
||||
array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin',
|
||||
'private_object_block_function', 'private_object_function', 'private_registered_function',
|
||||
'private_registered_block', 'private_special_variable', 'private_print_expression',
|
||||
'private_modifier'))) {
|
||||
return true;
|
||||
}
|
||||
// check security settings
|
||||
@@ -414,7 +414,8 @@ class Smarty_Security
|
||||
if (!in_array($var_name, $this->disabled_special_smarty_vars)) {
|
||||
return true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("special variable '\$smarty.{$var_name}' not allowed by security setting", null, true);
|
||||
$compiler->trigger_template_error("special variable '\$smarty.{$var_name}' not allowed by security setting",
|
||||
null, true);
|
||||
}
|
||||
|
||||
return false; // should not, but who knows what happens to the compiler in the future?
|
||||
@@ -440,14 +441,16 @@ class Smarty_Security
|
||||
if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {
|
||||
return true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null, true);
|
||||
$compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null,
|
||||
true);
|
||||
}
|
||||
} elseif (in_array($modifier_name, $this->allowed_modifiers) &&
|
||||
!in_array($modifier_name, $this->disabled_modifiers)
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
$compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null, true);
|
||||
$compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null,
|
||||
true);
|
||||
}
|
||||
|
||||
return false; // should not, but who knows what happens to the compiler in the future?
|
||||
@@ -618,7 +621,8 @@ class Smarty_Security
|
||||
}
|
||||
}
|
||||
|
||||
$this->_php_resource_dir = $this->_checkDir($this->smarty->_realpath($filepath, true), $this->_php_resource_dir);
|
||||
$this->_php_resource_dir =
|
||||
$this->_checkDir($this->smarty->_realpath($filepath, true), $this->_php_resource_dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -99,7 +99,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
||||
$_smarty_tpl = $_template;
|
||||
if ($_template->source->handler->recompiled || !$_template->compiled->exists ||
|
||||
$_template->smarty->force_compile || ($_template->smarty->compile_check &&
|
||||
$_template->source->getTimeStamp() > $_template->compiled->getTimeStamp())
|
||||
$_template->source->getTimeStamp() >
|
||||
$_template->compiled->getTimeStamp())
|
||||
) {
|
||||
$this->compileTemplateSource($_template);
|
||||
$compileCheck = $_template->smarty->compile_check;
|
||||
|
@@ -72,7 +72,8 @@ class Smarty_Template_Config extends Smarty_Template_Source
|
||||
* @return Smarty_Template_Config Source Object
|
||||
* @throws SmartyException
|
||||
*/
|
||||
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
|
||||
public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null,
|
||||
$template_resource = null)
|
||||
{
|
||||
static $_incompatible_resources = array('extends' => true, 'php' => true);
|
||||
$template_resource = $_template->template_resource;
|
||||
@@ -80,7 +81,8 @@ class Smarty_Template_Config extends Smarty_Template_Source
|
||||
throw new SmartyException('Missing config name');
|
||||
}
|
||||
// parse resource_name, load resource handler
|
||||
list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $_template->smarty->default_config_type);
|
||||
list($name, $type) =
|
||||
Smarty_Resource::parseResourceName($template_resource, $_template->smarty->default_config_type);
|
||||
// make sure configs are not loaded via anything smarty can't handle
|
||||
if (isset($_incompatible_resources[ $type ])) {
|
||||
throw new SmartyException ("Unable to use resource '{$type}' for config");
|
||||
|
@@ -153,8 +153,8 @@ class Smarty_Template_Source
|
||||
$name = $template_resource;
|
||||
}
|
||||
|
||||
$handler = isset($smarty->_cache['resource_handlers'][$type]) ?
|
||||
$smarty->_cache['resource_handlers'][$type] :
|
||||
$handler =
|
||||
isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
|
||||
Smarty_Resource::load($smarty, $type);
|
||||
// create new source object
|
||||
$source = new Smarty_Template_Source($handler, $smarty, $template_resource, $type, $name);
|
||||
|
@@ -15,6 +15,7 @@ class Smarty_Variable
|
||||
* @var mixed
|
||||
*/
|
||||
public $value = null;
|
||||
|
||||
/**
|
||||
* if true any output of this variable will be not cached
|
||||
*
|
||||
|
@@ -18,18 +18,21 @@ class SmartyCompilerException extends SmartyException
|
||||
* @type int|null
|
||||
*/
|
||||
public $line = null;
|
||||
|
||||
/**
|
||||
* The template source snippet relating to the error
|
||||
*
|
||||
* @type string|null
|
||||
*/
|
||||
public $source = null;
|
||||
|
||||
/**
|
||||
* The raw text of the error message
|
||||
*
|
||||
* @type string|null
|
||||
*/
|
||||
public $desc = null;
|
||||
|
||||
/**
|
||||
* The resource identifier or template name
|
||||
*
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty exception class
|
||||
*
|
||||
|
Reference in New Issue
Block a user