mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Update PSR-2
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
"name": "smarty/smarty",
|
"name": "smarty/smarty",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"description": "Smarty - the compiling PHP template engine",
|
"description": "Smarty - the compiling PHP template engine",
|
||||||
"keywords": ["templating"],
|
"keywords": [
|
||||||
|
"templating"
|
||||||
|
],
|
||||||
"homepage": "http://www.smarty.net",
|
"homepage": "http://www.smarty.net",
|
||||||
"license": "LGPL-3.0",
|
"license": "LGPL-3.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
@@ -28,12 +30,13 @@
|
|||||||
"php": ">=5.2"
|
"php": ">=5.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": ["libs/bootstrap.php"]
|
"files": [
|
||||||
|
"libs/bootstrap.php"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.1.x-dev"
|
"dev-master": "3.1.x-dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -17,11 +17,15 @@ $smarty->cache_lifetime = 120;
|
|||||||
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
|
$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
|
||||||
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
|
$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
|
||||||
$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
|
$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"),
|
$smarty->assign(
|
||||||
array("M", "N", "O", "P")));
|
"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"),
|
$smarty->assign(
|
||||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
"contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||||
|
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234"))
|
||||||
|
);
|
||||||
|
|
||||||
$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
|
$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
|
||||||
$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
|
$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
|
||||||
|
@@ -43,8 +43,10 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
|||||||
}
|
}
|
||||||
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
|
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
|
||||||
$this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id');
|
$this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id');
|
||||||
$this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content)
|
$this->save = $this->db->prepare(
|
||||||
VALUES (:id, :name, :cache_id, :compile_id, :content)');
|
'REPLACE INTO output_cache (id, name, cache_id, compile_id, content)
|
||||||
|
VALUES (:id, :name, :cache_id, :compile_id, :content)'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,8 +110,10 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
|||||||
*/
|
*/
|
||||||
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
|
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,
|
$this->save->execute(
|
||||||
'content' => $content,));
|
array('id' => $id, 'name' => $name, 'cache_id' => $cache_id, 'compile_id' => $compile_id,
|
||||||
|
'content' => $content,)
|
||||||
|
);
|
||||||
|
|
||||||
return !!$this->save->rowCount();
|
return !!$this->save->rowCount();
|
||||||
}
|
}
|
||||||
|
@@ -54,8 +54,8 @@ class Smarty_Autoloader
|
|||||||
if (!defined('SMARTY_SPL_AUTOLOAD')) {
|
if (!defined('SMARTY_SPL_AUTOLOAD')) {
|
||||||
define('SMARTY_SPL_AUTOLOAD', 0);
|
define('SMARTY_SPL_AUTOLOAD', 0);
|
||||||
}
|
}
|
||||||
if (SMARTY_SPL_AUTOLOAD &&
|
if (SMARTY_SPL_AUTOLOAD
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
|
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
|
||||||
) {
|
) {
|
||||||
$registeredAutoLoadFunctions = spl_autoload_functions();
|
$registeredAutoLoadFunctions = spl_autoload_functions();
|
||||||
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
|
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
|
||||||
|
@@ -1008,8 +1008,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
$cache_id = null,
|
$cache_id = null,
|
||||||
$compile_id = null,
|
$compile_id = null,
|
||||||
$caching = null,
|
$caching = null,
|
||||||
Smarty_Internal_Template $template = null)
|
Smarty_Internal_Template $template = null
|
||||||
{
|
) {
|
||||||
$template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
|
$template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
|
||||||
$template_name;
|
$template_name;
|
||||||
$cache_id = $cache_id === null ? $this->cache_id : $cache_id;
|
$cache_id = $cache_id === null ? $this->cache_id : $cache_id;
|
||||||
@@ -1036,7 +1036,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* @param string $path file path
|
* @param string $path file path
|
||||||
* @param bool $realpath if true - convert to absolute
|
* @param bool $realpath if true - convert to absolute
|
||||||
* false - convert to relative
|
* false - convert to relative
|
||||||
* null - keep as it is but remove /./ /../
|
* null - keep as it is but
|
||||||
|
* remove /./ /../
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -1045,9 +1046,11 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
$nds = array('/' => '\\', '\\' => '/');
|
$nds = array('/' => '\\', '\\' => '/');
|
||||||
// normalize DIRECTORY_SEPARATOR
|
// normalize DIRECTORY_SEPARATOR
|
||||||
//$path = str_replace(array($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $path);
|
//$path = str_replace(array($nds[DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR, $path);
|
||||||
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
|
preg_match(
|
||||||
|
'%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u',
|
||||||
$path,
|
$path,
|
||||||
$parts);
|
$parts
|
||||||
|
);
|
||||||
$path = $parts[ 'path' ];
|
$path = $parts[ 'path' ];
|
||||||
if ($parts[ 'root' ] === '\\') {
|
if ($parts[ 'root' ] === '\\') {
|
||||||
$parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
|
$parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
|
||||||
@@ -1059,7 +1062,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
do {
|
do {
|
||||||
$path = preg_replace(
|
$path = preg_replace(
|
||||||
array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),
|
array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'),
|
||||||
DIRECTORY_SEPARATOR, $path, -1, $count);
|
DIRECTORY_SEPARATOR, $path, -1, $count
|
||||||
|
);
|
||||||
} while($count > 0);
|
} while($count > 0);
|
||||||
return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path);
|
return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path);
|
||||||
}
|
}
|
||||||
@@ -1270,7 +1274,9 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
|
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
|
||||||
}}}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1297,7 +1303,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
} else {
|
} else {
|
||||||
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
|
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1320,7 +1327,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Normalize template_dir or config_dir
|
* Normalize template_dir or config_dir
|
||||||
*
|
*
|
||||||
* @param bool $isConfig true for config_dir
|
* @param bool $isConfig true for config_dir
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
private function _normalizeTemplateConfig($isConfig)
|
private function _normalizeTemplateConfig($isConfig)
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
require_once(dirname(__FILE__) . '/Smarty.class.php');
|
require_once dirname(__FILE__) . '/Smarty.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Backward Compatibility Wrapper Class
|
* Smarty Backward Compatibility Wrapper Class
|
||||||
@@ -53,7 +53,6 @@ class SmartyBC extends Smarty
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize new SmartyBC object
|
* Initialize new SmartyBC object
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -131,8 +130,8 @@ class SmartyBC extends Smarty
|
|||||||
* @internal param array $block_functs list of methods that are block format
|
* @internal param array $block_functs list of methods that are block format
|
||||||
*/
|
*/
|
||||||
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true,
|
public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true,
|
||||||
$block_methods = array())
|
$block_methods = array()
|
||||||
{
|
) {
|
||||||
settype($allowed, 'array');
|
settype($allowed, 'array');
|
||||||
settype($smarty_args, 'boolean');
|
settype($smarty_args, 'boolean');
|
||||||
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
|
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
|
||||||
|
@@ -12,6 +12,6 @@
|
|||||||
* Load and register Smarty Autoloader
|
* Load and register Smarty Autoloader
|
||||||
*/
|
*/
|
||||||
if (!class_exists('Smarty_Autoloader')) {
|
if (!class_exists('Smarty_Autoloader')) {
|
||||||
require dirname(__FILE__) . '/Autoloader.php';
|
include dirname(__FILE__) . '/Autoloader.php';
|
||||||
}
|
}
|
||||||
Smarty_Autoloader::register(true);
|
Smarty_Autoloader::register(true);
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
* - indent_char - string (" ")
|
* - indent_char - string (" ")
|
||||||
* - wrap_boundary - boolean (true)
|
* - wrap_boundary - boolean (true)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
*
|
*
|
||||||
@@ -39,8 +38,10 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_modifier_mb_wordwrap',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php')));
|
array(array('function' => 'smarty_modifier_mb_wordwrap',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$style = null;
|
$style = null;
|
||||||
@@ -88,10 +89,12 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te
|
|||||||
}
|
}
|
||||||
// convert mult. spaces & special chars to single space
|
// convert mult. spaces & special chars to single space
|
||||||
$_paragraph =
|
$_paragraph =
|
||||||
preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER,
|
preg_replace(
|
||||||
|
array('!\s+!' . Smarty::$_UTF8_MODIFIER,
|
||||||
'!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
|
'!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
|
||||||
array(' ',
|
array(' ',
|
||||||
''), $_paragraph);
|
''), $_paragraph
|
||||||
|
);
|
||||||
// indent first line
|
// indent first line
|
||||||
if ($indent_first > 0) {
|
if ($indent_first > 0) {
|
||||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
* {cycle name=row values="one,two,three" reset=true}
|
* {cycle name=row values="one,two,three" reset=true}
|
||||||
* {cycle name=row}
|
* {cycle name=row}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
|
* @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
* - assign (optional) - assign the output as an array to this variable
|
* - assign (optional) - assign the output as an array to this variable
|
||||||
* - escape (optional) - escape the content (not value), defaults to true
|
* - escape (optional) - escape the content (not value), defaults to true
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||||
@@ -45,8 +44,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template)
|
function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
|
|
||||||
$name = 'checkbox';
|
$name = 'checkbox';
|
||||||
$values = null;
|
$values = null;
|
||||||
@@ -91,8 +92,10 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
if (method_exists($_sel, '__toString')) {
|
if (method_exists($_sel, '__toString')) {
|
||||||
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_checkboxes: selected attribute contains an object of class \'' .
|
trigger_error(
|
||||||
get_class($_sel) . '\' without __toString() method', E_USER_NOTICE);
|
'html_checkboxes: selected attribute contains an object of class \'' .
|
||||||
|
get_class($_sel) . '\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -104,8 +107,10 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
if (method_exists($_val, '__toString')) {
|
if (method_exists($_val, '__toString')) {
|
||||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_checkboxes: selected attribute is an object of class \'' . get_class($_val) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$selected = smarty_function_escape_special_chars((string) $_val);
|
$selected = smarty_function_escape_special_chars((string) $_val);
|
||||||
@@ -113,8 +118,10 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'checkboxes':
|
case 'checkboxes':
|
||||||
trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
|
trigger_error(
|
||||||
E_USER_WARNING);
|
'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
$options = (array) $_val;
|
$options = (array) $_val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -128,8 +135,10 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
case 'readonly':
|
case 'readonly':
|
||||||
if (!empty($params[ 'strict' ])) {
|
if (!empty($params[ 'strict' ])) {
|
||||||
if (!is_scalar($_val)) {
|
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",
|
trigger_error(
|
||||||
E_USER_NOTICE);
|
"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) {
|
if ($_val === true || $_val === $_key) {
|
||||||
@@ -159,15 +168,19 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
if (isset($options)) {
|
if (isset($options)) {
|
||||||
foreach ($options as $_key => $_val) {
|
foreach ($options as $_key => $_val) {
|
||||||
$_html_result[] =
|
$_html_result[] =
|
||||||
smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
smarty_function_html_checkboxes_output(
|
||||||
$label_ids, $escape);
|
$name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||||
|
$label_ids, $escape
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($values as $_i => $_key) {
|
foreach ($values as $_i => $_key) {
|
||||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||||
$_html_result[] =
|
$_html_result[] =
|
||||||
smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
smarty_function_html_checkboxes_output(
|
||||||
$label_ids, $escape);
|
$name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||||
|
$label_ids, $escape
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,16 +204,18 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
|
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
|
||||||
$label_ids, $escape = true)
|
$label_ids, $escape = true
|
||||||
{
|
) {
|
||||||
$_output = '';
|
$_output = '';
|
||||||
|
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
if (method_exists($value, '__toString')) {
|
if (method_exists($value, '__toString')) {
|
||||||
$value = (string) $value->__toString();
|
$value = (string) $value->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: value is an object of class \'' . get_class($value) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: value is an object of class \'' . get_class($value) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -212,8 +227,10 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
if (method_exists($output, '__toString')) {
|
if (method_exists($output, '__toString')) {
|
||||||
$output = (string) $output->__toString();
|
$output = (string) $output->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: output is an object of class \'' . get_class($output) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: output is an object of class \'' . get_class($output) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -223,8 +240,12 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
|
|
||||||
if ($labels) {
|
if ($labels) {
|
||||||
if ($label_ids) {
|
if ($label_ids) {
|
||||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
$_id = smarty_function_escape_special_chars(
|
||||||
$name . '_' . $value));
|
preg_replace(
|
||||||
|
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
||||||
|
$name . '_' . $value
|
||||||
|
)
|
||||||
|
);
|
||||||
$_output .= '<label for="' . $_id . '">';
|
$_output .= '<label for="' . $_id . '">';
|
||||||
} else {
|
} else {
|
||||||
$_output .= '<label>';
|
$_output .= '<label>';
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
|
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
|
||||||
* - path_prefix - prefix for path output (optional, default empty)
|
* - path_prefix - prefix for path output (optional, default empty)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
|
* @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
@@ -38,8 +37,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_image($params, Smarty_Internal_Template $template)
|
function smarty_function_html_image($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
|
|
||||||
$alt = '';
|
$alt = '';
|
||||||
$file = '';
|
$file = '';
|
||||||
@@ -65,7 +66,7 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template)
|
|||||||
if (!is_array($_val)) {
|
if (!is_array($_val)) {
|
||||||
$$_key = smarty_function_escape_special_chars($_val);
|
$$_key = smarty_function_escape_special_chars($_val);
|
||||||
} else {
|
} else {
|
||||||
throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
throw new SmartyException("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template)
|
|||||||
if (!is_array($_val)) {
|
if (!is_array($_val)) {
|
||||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||||
} else {
|
} else {
|
||||||
throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
throw new SmartyException("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,6 @@
|
|||||||
* - id (optional) - string default not set
|
* - id (optional) - string default not set
|
||||||
* - class (optional) - string default not set
|
* - class (optional) - string default not set
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
|
* @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
@@ -37,8 +36,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_options($params, Smarty_Internal_Template $template)
|
function smarty_function_html_options($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
|
|
||||||
$name = null;
|
$name = null;
|
||||||
$values = null;
|
$values = null;
|
||||||
@@ -75,8 +76,10 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat
|
|||||||
if (method_exists($_sel, '__toString')) {
|
if (method_exists($_sel, '__toString')) {
|
||||||
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: selected attribute contains an object of class \'' .
|
trigger_error(
|
||||||
get_class($_sel) . '\' without __toString() method', E_USER_NOTICE);
|
'html_options: selected attribute contains an object of class \'' .
|
||||||
|
get_class($_sel) . '\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -88,8 +91,10 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat
|
|||||||
if (method_exists($_val, '__toString')) {
|
if (method_exists($_val, '__toString')) {
|
||||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: selected attribute is an object of class \'' . get_class($_val) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: selected attribute is an object of class \'' . get_class($_val) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$selected = smarty_function_escape_special_chars((string) $_val);
|
$selected = smarty_function_escape_special_chars((string) $_val);
|
||||||
@@ -103,8 +108,10 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat
|
|||||||
case 'readonly':
|
case 'readonly':
|
||||||
if (!empty($params[ 'strict' ])) {
|
if (!empty($params[ 'strict' ])) {
|
||||||
if (!is_scalar($_val)) {
|
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",
|
trigger_error(
|
||||||
E_USER_NOTICE);
|
"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) {
|
if ($_val === true || $_val === $_key) {
|
||||||
@@ -183,8 +190,10 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
|||||||
if (method_exists($value, '__toString')) {
|
if (method_exists($value, '__toString')) {
|
||||||
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: value is an object of class \'' . get_class($value) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: value is an object of class \'' . get_class($value) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -196,8 +205,10 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
|||||||
} else {
|
} else {
|
||||||
$_idx = 0;
|
$_idx = 0;
|
||||||
$_html_result =
|
$_html_result =
|
||||||
smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
|
smarty_function_html_options_optgroup(
|
||||||
$class, $_idx);
|
$key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null,
|
||||||
|
$class, $_idx
|
||||||
|
);
|
||||||
$idx ++;
|
$idx ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
* {html_radios values=$ids name='box' separator='<br>' output=$names}
|
* {html_radios values=$ids name='box' separator='<br>' output=$names}
|
||||||
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
|
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
|
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||||
@@ -45,8 +44,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_radios($params, Smarty_Internal_Template $template)
|
function smarty_function_html_radios($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
|
|
||||||
$name = 'radio';
|
$name = 'radio';
|
||||||
$values = null;
|
$values = null;
|
||||||
@@ -74,8 +75,10 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
|
|||||||
if (method_exists($_val, '__toString')) {
|
if (method_exists($_val, '__toString')) {
|
||||||
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_radios: selected attribute is an object of class \'' . get_class($_val) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_radios: selected attribute is an object of class \'' . get_class($_val) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$selected = (string) $_val;
|
$selected = (string) $_val;
|
||||||
@@ -98,8 +101,10 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'radios':
|
case 'radios':
|
||||||
trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
|
trigger_error(
|
||||||
E_USER_WARNING);
|
'html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
$options = (array) $_val;
|
$options = (array) $_val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -113,8 +118,10 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
|
|||||||
case 'readonly':
|
case 'readonly':
|
||||||
if (!empty($params[ 'strict' ])) {
|
if (!empty($params[ 'strict' ])) {
|
||||||
if (!is_scalar($_val)) {
|
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",
|
trigger_error(
|
||||||
E_USER_NOTICE);
|
"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) {
|
if ($_val === true || $_val === $_key) {
|
||||||
@@ -146,15 +153,19 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
|
|||||||
if (isset($options)) {
|
if (isset($options)) {
|
||||||
foreach ($options as $_key => $_val) {
|
foreach ($options as $_key => $_val) {
|
||||||
$_html_result[] =
|
$_html_result[] =
|
||||||
smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
smarty_function_html_radios_output(
|
||||||
$label_ids, $escape);
|
$name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||||
|
$label_ids, $escape
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($values as $_i => $_key) {
|
foreach ($values as $_i => $_key) {
|
||||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||||
$_html_result[] =
|
$_html_result[] =
|
||||||
smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
|
smarty_function_html_radios_output(
|
||||||
$label_ids, $escape);
|
$name, $_key, $_val, $selected, $extra, $separator, $labels,
|
||||||
|
$label_ids, $escape
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,16 +189,18 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
|
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
|
||||||
$escape)
|
$escape
|
||||||
{
|
) {
|
||||||
$_output = '';
|
$_output = '';
|
||||||
|
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
if (method_exists($value, '__toString')) {
|
if (method_exists($value, '__toString')) {
|
||||||
$value = (string) $value->__toString();
|
$value = (string) $value->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: value is an object of class \'' . get_class($value) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: value is an object of class \'' . get_class($value) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -199,8 +212,10 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
|||||||
if (method_exists($output, '__toString')) {
|
if (method_exists($output, '__toString')) {
|
||||||
$output = (string) $output->__toString();
|
$output = (string) $output->__toString();
|
||||||
} else {
|
} else {
|
||||||
trigger_error('html_options: output is an object of class \'' . get_class($output) .
|
trigger_error(
|
||||||
'\' without __toString() method', E_USER_NOTICE);
|
'html_options: output is an object of class \'' . get_class($output) .
|
||||||
|
'\' without __toString() method', E_USER_NOTICE
|
||||||
|
);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -210,8 +225,12 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
|||||||
|
|
||||||
if ($labels) {
|
if ($labels) {
|
||||||
if ($label_ids) {
|
if ($label_ids) {
|
||||||
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
$_id = smarty_function_escape_special_chars(
|
||||||
$name . '_' . $value));
|
preg_replace(
|
||||||
|
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
|
||||||
|
$name . '_' . $value
|
||||||
|
)
|
||||||
|
);
|
||||||
$_output .= '<label for="' . $_id . '">';
|
$_output .= '<label for="' . $_id . '">';
|
||||||
} else {
|
} else {
|
||||||
$_output .= '<label>';
|
$_output .= '<label>';
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
* - 2.0 complete rewrite for performance,
|
* - 2.0 complete rewrite for performance,
|
||||||
* added attributes month_names, *_id
|
* added attributes month_names, *_id
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
|
* @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
@@ -45,8 +44,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_select_date($params, Smarty_Internal_Template $template)
|
function smarty_function_html_select_date($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
// generate timestamps used for month names only
|
// generate timestamps used for month names only
|
||||||
static $_month_timestamps = null;
|
static $_month_timestamps = null;
|
||||||
static $_current_year = null;
|
static $_current_year = null;
|
||||||
@@ -111,8 +112,10 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
|
|||||||
switch ($_key) {
|
switch ($_key) {
|
||||||
case 'time':
|
case 'time':
|
||||||
if (!is_array($_value) && $_value !== null) {
|
if (!is_array($_value) && $_value !== null) {
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_make_timestamp',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php')));
|
array(array('function' => 'smarty_make_timestamp',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))
|
||||||
|
);
|
||||||
$time = smarty_make_timestamp($_value);
|
$time = smarty_make_timestamp($_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -250,10 +253,12 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
|
|||||||
} else {
|
} else {
|
||||||
$_html_years = '<select name="' . $_name . '"';
|
$_html_years = '<select name="' . $_name . '"';
|
||||||
if ($year_id !== null || $all_id !== null) {
|
if ($year_id !== null || $all_id !== null) {
|
||||||
$_html_years .= ' id="' . smarty_function_escape_special_chars($year_id !== null ?
|
$_html_years .= ' id="' . smarty_function_escape_special_chars(
|
||||||
|
$year_id !== null ?
|
||||||
($year_id ? $year_id : $_name) :
|
($year_id ? $year_id : $_name) :
|
||||||
($all_id ? ($all_id . $_name) :
|
($all_id ? ($all_id . $_name) :
|
||||||
$_name)) . '"';
|
$_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($year_size) {
|
if ($year_size) {
|
||||||
$_html_years .= ' size="' . $year_size . '"';
|
$_html_years .= ' size="' . $year_size . '"';
|
||||||
@@ -288,10 +293,12 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
|
|||||||
|
|
||||||
$_html_months = '<select name="' . $_name . '"';
|
$_html_months = '<select name="' . $_name . '"';
|
||||||
if ($month_id !== null || $all_id !== null) {
|
if ($month_id !== null || $all_id !== null) {
|
||||||
$_html_months .= ' id="' . smarty_function_escape_special_chars($month_id !== null ?
|
$_html_months .= ' id="' . smarty_function_escape_special_chars(
|
||||||
|
$month_id !== null ?
|
||||||
($month_id ? $month_id : $_name) :
|
($month_id ? $month_id : $_name) :
|
||||||
($all_id ? ($all_id . $_name) :
|
($all_id ? ($all_id . $_name) :
|
||||||
$_name)) . '"';
|
$_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($month_size) {
|
if ($month_size) {
|
||||||
$_html_months .= ' size="' . $month_size . '"';
|
$_html_months .= ' size="' . $month_size . '"';
|
||||||
@@ -329,8 +336,10 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
|
|||||||
$_html_days = '<select name="' . $_name . '"';
|
$_html_days = '<select name="' . $_name . '"';
|
||||||
if ($day_id !== null || $all_id !== null) {
|
if ($day_id !== null || $all_id !== null) {
|
||||||
$_html_days .= ' id="' .
|
$_html_days .= ' id="' .
|
||||||
smarty_function_escape_special_chars($day_id !== null ? ($day_id ? $day_id : $_name) :
|
smarty_function_escape_special_chars(
|
||||||
($all_id ? ($all_id . $_name) : $_name)) . '"';
|
$day_id !== null ? ($day_id ? $day_id : $_name) :
|
||||||
|
($all_id ? ($all_id . $_name) : $_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($day_size) {
|
if ($day_size) {
|
||||||
$_html_days .= ' size="' . $day_size . '"';
|
$_html_days .= ' size="' . $day_size . '"';
|
||||||
|
@@ -26,8 +26,10 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_select_time($params, Smarty_Internal_Template $template)
|
function smarty_function_html_select_time($params, Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php')));
|
array(array('function' => 'smarty_function_escape_special_chars',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))
|
||||||
|
);
|
||||||
$prefix = 'Time_';
|
$prefix = 'Time_';
|
||||||
$field_array = null;
|
$field_array = null;
|
||||||
$field_separator = "\n";
|
$field_separator = "\n";
|
||||||
@@ -78,8 +80,10 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
|
|||||||
switch ($_key) {
|
switch ($_key) {
|
||||||
case 'time':
|
case 'time':
|
||||||
if (!is_array($_value) && $_value !== null) {
|
if (!is_array($_value) && $_value !== null) {
|
||||||
$template->_checkPlugins(array(array('function' => 'smarty_make_timestamp',
|
$template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php')));
|
array(array('function' => 'smarty_make_timestamp',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))
|
||||||
|
);
|
||||||
$time = smarty_make_timestamp($_value);
|
$time = smarty_make_timestamp($_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -203,8 +207,10 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
|
|||||||
$_html_hours = '<select name="' . $_name . '"';
|
$_html_hours = '<select name="' . $_name . '"';
|
||||||
if ($hour_id !== null || $all_id !== null) {
|
if ($hour_id !== null || $all_id !== null) {
|
||||||
$_html_hours .= ' id="' .
|
$_html_hours .= ' id="' .
|
||||||
smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) :
|
smarty_function_escape_special_chars(
|
||||||
($all_id ? ($all_id . $_name) : $_name)) . '"';
|
$hour_id !== null ? ($hour_id ? $hour_id : $_name) :
|
||||||
|
($all_id ? ($all_id . $_name) : $_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($hour_size) {
|
if ($hour_size) {
|
||||||
$_html_hours .= ' size="' . $hour_size . '"';
|
$_html_hours .= ' size="' . $hour_size . '"';
|
||||||
@@ -249,10 +255,12 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
|
|||||||
|
|
||||||
$_html_minutes = '<select name="' . $_name . '"';
|
$_html_minutes = '<select name="' . $_name . '"';
|
||||||
if ($minute_id !== null || $all_id !== null) {
|
if ($minute_id !== null || $all_id !== null) {
|
||||||
$_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ?
|
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
|
||||||
|
$minute_id !== null ?
|
||||||
($minute_id ? $minute_id : $_name) :
|
($minute_id ? $minute_id : $_name) :
|
||||||
($all_id ? ($all_id . $_name) :
|
($all_id ? ($all_id . $_name) :
|
||||||
$_name)) . '"';
|
$_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($minute_size) {
|
if ($minute_size) {
|
||||||
$_html_minutes .= ' size="' . $minute_size . '"';
|
$_html_minutes .= ' size="' . $minute_size . '"';
|
||||||
@@ -290,10 +298,12 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
|
|||||||
|
|
||||||
$_html_seconds = '<select name="' . $_name . '"';
|
$_html_seconds = '<select name="' . $_name . '"';
|
||||||
if ($second_id !== null || $all_id !== null) {
|
if ($second_id !== null || $all_id !== null) {
|
||||||
$_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ?
|
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
|
||||||
|
$second_id !== null ?
|
||||||
($second_id ? $second_id : $_name) :
|
($second_id ? $second_id : $_name) :
|
||||||
($all_id ? ($all_id . $_name) :
|
($all_id ? ($all_id . $_name) :
|
||||||
$_name)) . '"';
|
$_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($second_size) {
|
if ($second_size) {
|
||||||
$_html_seconds .= ' size="' . $second_size . '"';
|
$_html_seconds .= ' size="' . $second_size . '"';
|
||||||
@@ -331,11 +341,13 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
|
|||||||
|
|
||||||
$_html_meridian = '<select name="' . $_name . '"';
|
$_html_meridian = '<select name="' . $_name . '"';
|
||||||
if ($meridian_id !== null || $all_id !== null) {
|
if ($meridian_id !== null || $all_id !== null) {
|
||||||
$_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ?
|
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
|
||||||
|
$meridian_id !== null ?
|
||||||
($meridian_id ? $meridian_id :
|
($meridian_id ? $meridian_id :
|
||||||
$_name) :
|
$_name) :
|
||||||
($all_id ? ($all_id . $_name) :
|
($all_id ? ($all_id . $_name) :
|
||||||
$_name)) . '"';
|
$_name)
|
||||||
|
) . '"';
|
||||||
}
|
}
|
||||||
if ($meridian_size) {
|
if ($meridian_size) {
|
||||||
$_html_meridian .= ' size="' . $meridian_size . '"';
|
$_html_meridian .= ' size="' . $meridian_size . '"';
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
|
* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
|
||||||
* {table loop=$data cols="first,second,third" tr_attr=$colors}
|
* {table loop=$data cols="first,second,third" tr_attr=$colors}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
|
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
|
||||||
* @author credit to boots <boots dot smarty at yahoo dot com>
|
* @author credit to boots <boots dot smarty at yahoo dot com>
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
|
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
|
||||||
* {mailto address="me@domain.com" extra='class="mailto"'}
|
* {mailto address="me@domain.com" extra='class="mailto"'}
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
|
* @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
|
||||||
* (Smarty online manual)
|
* (Smarty online manual)
|
||||||
* @version 1.2
|
* @version 1.2
|
||||||
@@ -97,8 +96,10 @@ function smarty_function_mailto($params)
|
|||||||
|
|
||||||
$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
|
$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
|
||||||
if (!isset($_allowed_encoding[ $encode ])) {
|
if (!isset($_allowed_encoding[ $encode ])) {
|
||||||
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
|
trigger_error(
|
||||||
E_USER_WARNING);
|
"mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -29,23 +29,32 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
||||||
} else {
|
} else {
|
||||||
// uppercase word breaks
|
// uppercase word breaks
|
||||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
|
$upper_string = preg_replace_callback(
|
||||||
'smarty_mod_cap_mbconvert_cb', $string);
|
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
|
||||||
|
'smarty_mod_cap_mbconvert_cb', $string
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// check uc_digits case
|
// check uc_digits case
|
||||||
if (!$uc_digits) {
|
if (!$uc_digits) {
|
||||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
if (preg_match_all(
|
||||||
PREG_OFFSET_CAPTURE)) {
|
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
||||||
|
PREG_OFFSET_CAPTURE
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches[ 1 ] as $match) {
|
foreach ($matches[ 1 ] as $match) {
|
||||||
$upper_string =
|
$upper_string =
|
||||||
substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
|
substr_replace(
|
||||||
strlen($match[ 0 ]));
|
$upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
|
||||||
|
strlen($match[ 0 ])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$upper_string =
|
$upper_string =
|
||||||
preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb',
|
preg_replace_callback(
|
||||||
$upper_string);
|
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb',
|
||||||
|
$upper_string
|
||||||
|
);
|
||||||
return $upper_string;
|
return $upper_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,20 +64,27 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
|||||||
}
|
}
|
||||||
// uppercase (including hyphenated words)
|
// uppercase (including hyphenated words)
|
||||||
$upper_string =
|
$upper_string =
|
||||||
preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb',
|
preg_replace_callback(
|
||||||
$string);
|
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb',
|
||||||
|
$string
|
||||||
|
);
|
||||||
// check uc_digits case
|
// check uc_digits case
|
||||||
if (!$uc_digits) {
|
if (!$uc_digits) {
|
||||||
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
if (preg_match_all(
|
||||||
PREG_OFFSET_CAPTURE)) {
|
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
|
||||||
|
PREG_OFFSET_CAPTURE
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches[ 1 ] as $match) {
|
foreach ($matches[ 1 ] as $match) {
|
||||||
$upper_string =
|
$upper_string =
|
||||||
substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
|
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 = preg_replace_callback(
|
||||||
$upper_string);
|
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb',
|
||||||
|
$upper_string
|
||||||
|
);
|
||||||
return $upper_string;
|
return $upper_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
|
|||||||
static $is_loaded = false;
|
static $is_loaded = false;
|
||||||
if (!$is_loaded) {
|
if (!$is_loaded) {
|
||||||
if (!is_callable('smarty_make_timestamp')) {
|
if (!is_callable('smarty_make_timestamp')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php';
|
||||||
}
|
}
|
||||||
$is_loaded = true;
|
$is_loaded = true;
|
||||||
}
|
}
|
||||||
|
@@ -48,9 +48,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
// php <5.2.3 - prevent double encoding
|
// php <5.2.3 - prevent double encoding
|
||||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||||
$string = str_replace(array('%%%SMARTY_START%%%',
|
$string = str_replace(
|
||||||
|
array('%%%SMARTY_START%%%',
|
||||||
'%%%SMARTY_END%%%'), array('&',
|
'%%%SMARTY_END%%%'), array('&',
|
||||||
';'), $string);
|
';'), $string
|
||||||
|
);
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
@@ -71,9 +73,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||||
$string =
|
$string =
|
||||||
str_replace(array('%%%SMARTY_START%%%',
|
str_replace(
|
||||||
|
array('%%%SMARTY_START%%%',
|
||||||
'%%%SMARTY_END%%%'), array('&',
|
'%%%SMARTY_END%%%'), array('&',
|
||||||
';'), $string);
|
';'), $string
|
||||||
|
);
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
@@ -92,9 +96,11 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
} else {
|
} else {
|
||||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||||
$string = htmlentities($string, ENT_QUOTES, $char_set);
|
$string = htmlentities($string, ENT_QUOTES, $char_set);
|
||||||
$string = str_replace(array('%%%SMARTY_START%%%',
|
$string = str_replace(
|
||||||
|
array('%%%SMARTY_START%%%',
|
||||||
'%%%SMARTY_END%%%'), array('&',
|
'%%%SMARTY_END%%%'), array('&',
|
||||||
';'), $string);
|
';'), $string
|
||||||
|
);
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
@@ -126,7 +132,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (!$is_loaded_1) {
|
if (!$is_loaded_1) {
|
||||||
if (!is_callable('smarty_mb_to_unicode')) {
|
if (!is_callable('smarty_mb_to_unicode')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||||
}
|
}
|
||||||
$is_loaded_1 = true;
|
$is_loaded_1 = true;
|
||||||
}
|
}
|
||||||
@@ -150,7 +156,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (!$is_loaded_1) {
|
if (!$is_loaded_1) {
|
||||||
if (!is_callable('smarty_mb_to_unicode')) {
|
if (!is_callable('smarty_mb_to_unicode')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||||
}
|
}
|
||||||
$is_loaded_1 = true;
|
$is_loaded_1 = true;
|
||||||
}
|
}
|
||||||
@@ -171,29 +177,35 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
|
|
||||||
case 'javascript':
|
case 'javascript':
|
||||||
// escape quotes and backslashes, newlines, etc.
|
// escape quotes and backslashes, newlines, etc.
|
||||||
return strtr($string, array('\\' => '\\\\',
|
return strtr(
|
||||||
|
$string, array('\\' => '\\\\',
|
||||||
"'" => "\\'",
|
"'" => "\\'",
|
||||||
'"' => '\\"',
|
'"' => '\\"',
|
||||||
"\r" => '\\r',
|
"\r" => '\\r',
|
||||||
"\n" => '\\n',
|
"\n" => '\\n',
|
||||||
'</' => '<\/'));
|
'</' => '<\/')
|
||||||
|
);
|
||||||
|
|
||||||
case 'mail':
|
case 'mail':
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (!$is_loaded_2) {
|
if (!$is_loaded_2) {
|
||||||
if (!is_callable('smarty_mb_str_replace')) {
|
if (!is_callable('smarty_mb_str_replace')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
|
||||||
}
|
}
|
||||||
$is_loaded_2 = true;
|
$is_loaded_2 = true;
|
||||||
}
|
}
|
||||||
return smarty_mb_str_replace(array('@',
|
return smarty_mb_str_replace(
|
||||||
|
array('@',
|
||||||
'.'), array(' [AT] ',
|
'.'), array(' [AT] ',
|
||||||
' [DOT] '), $string);
|
' [DOT] '), $string
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
// no MBString fallback
|
||||||
return str_replace(array('@',
|
return str_replace(
|
||||||
|
array('@',
|
||||||
'.'), array(' [AT] ',
|
'.'), array(' [AT] ',
|
||||||
' [DOT] '), $string);
|
' [DOT] '), $string
|
||||||
|
);
|
||||||
|
|
||||||
case 'nonstd':
|
case 'nonstd':
|
||||||
// escape non-standard chars, such as ms document quotes
|
// escape non-standard chars, such as ms document quotes
|
||||||
@@ -201,7 +213,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
|||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (!$is_loaded_1) {
|
if (!$is_loaded_1) {
|
||||||
if (!is_callable('smarty_mb_to_unicode')) {
|
if (!is_callable('smarty_mb_to_unicode')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||||
}
|
}
|
||||||
$is_loaded_1 = true;
|
$is_loaded_1 = true;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
* Name: mb_wordwrap
|
* Name: mb_wordwrap
|
||||||
* Purpose: Wrap a string to a given number of characters
|
* Purpose: Wrap a string to a given number of characters
|
||||||
*
|
*
|
||||||
|
|
||||||
* @link http://php.net/manual/en/function.wordwrap.php for similarity
|
* @link http://php.net/manual/en/function.wordwrap.php for similarity
|
||||||
*
|
*
|
||||||
* @param string $str the string to wrap
|
* @param string $str the string to wrap
|
||||||
@@ -36,10 +35,12 @@ function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = fa
|
|||||||
$_tokens = array($_token);
|
$_tokens = array($_token);
|
||||||
if ($token_length > $width) {
|
if ($token_length > $width) {
|
||||||
if ($cut) {
|
if ($cut) {
|
||||||
$_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER,
|
$_tokens = preg_split(
|
||||||
|
'!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER,
|
||||||
$_token,
|
$_token,
|
||||||
-1,
|
-1,
|
||||||
PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ function smarty_modifier_replace($string, $search, $replace)
|
|||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
if (!$is_loaded) {
|
if (!$is_loaded) {
|
||||||
if (!is_callable('smarty_mb_str_replace')) {
|
if (!is_callable('smarty_mb_str_replace')) {
|
||||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
|
include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
|
||||||
}
|
}
|
||||||
$is_loaded = true;
|
$is_loaded = true;
|
||||||
}
|
}
|
||||||
|
@@ -35,8 +35,10 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
|||||||
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
||||||
$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
|
$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
|
||||||
if (!$break_words && !$middle) {
|
if (!$break_words && !$middle) {
|
||||||
$string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '',
|
$string = preg_replace(
|
||||||
mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
|
'/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '',
|
||||||
|
mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!$middle) {
|
if (!$middle) {
|
||||||
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
|
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
|
||||||
|
@@ -24,8 +24,10 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
|
|||||||
{
|
{
|
||||||
static $_double_encode = null;
|
static $_double_encode = null;
|
||||||
static $is_loaded = false;
|
static $is_loaded = false;
|
||||||
$compiler->template->_checkPlugins(array(array('function' => 'smarty_literal_compiler_param',
|
$compiler->template->_checkPlugins(
|
||||||
'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php')));
|
array(array('function' => 'smarty_literal_compiler_param',
|
||||||
|
'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'))
|
||||||
|
);
|
||||||
if ($_double_encode === null) {
|
if ($_double_encode === null) {
|
||||||
$_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
|
$_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompi
|
|||||||
}
|
}
|
||||||
$function = 'wordwrap';
|
$function = 'wordwrap';
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
$function = $compiler->getPlugin('mb_wordwrap','modifier');
|
$function = $compiler->getPlugin('mb_wordwrap', 'modifier');
|
||||||
}
|
}
|
||||||
return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')';
|
return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')';
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,11 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||||||
$source = preg_replace('/\015\012|\015|\012/', "\n", $source);
|
$source = preg_replace('/\015\012|\015|\012/', "\n", $source);
|
||||||
|
|
||||||
// capture Internet Explorer and KnockoutJS Conditional Comments
|
// capture Internet Explorer and KnockoutJS Conditional Comments
|
||||||
if (preg_match_all('#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches,
|
if (preg_match_all(
|
||||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
'#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches,
|
||||||
|
PREG_OFFSET_CAPTURE | PREG_SET_ORDER
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$store[] = $match[ 0 ][ 0 ];
|
$store[] = $match[ 0 ][ 0 ];
|
||||||
$_length = strlen($match[ 0 ][ 0 ]);
|
$_length = strlen($match[ 0 ][ 0 ]);
|
||||||
@@ -46,8 +49,11 @@ function smarty_outputfilter_trimwhitespace($source)
|
|||||||
|
|
||||||
// capture html elements not to be messed with
|
// capture html elements not to be messed with
|
||||||
$_offset = 0;
|
$_offset = 0;
|
||||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
if (preg_match_all(
|
||||||
$source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
'#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
||||||
|
$source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$store[] = $match[ 0 ][ 0 ];
|
$store[] = $match[ 0 ][ 0 ];
|
||||||
$_length = strlen($match[ 0 ][ 0 ]);
|
$_length = strlen($match[ 0 ][ 0 ]);
|
||||||
|
@@ -25,8 +25,10 @@ function smarty_literal_compiler_param($params, $index, $default = null)
|
|||||||
}
|
}
|
||||||
// test if param is a literal
|
// test if param is a literal
|
||||||
if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) {
|
if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) {
|
||||||
throw new SmartyException('$param[' . $index .
|
throw new SmartyException(
|
||||||
'] is not a literal and is thus not evaluatable at compile time');
|
'$param[' . $index .
|
||||||
|
'] is not a literal and is thus not evaluatable at compile time'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$t = null;
|
$t = null;
|
||||||
|
@@ -21,14 +21,16 @@ function smarty_make_timestamp($string)
|
|||||||
if (empty($string)) {
|
if (empty($string)) {
|
||||||
// use "now":
|
// use "now":
|
||||||
return time();
|
return time();
|
||||||
} elseif ($string instanceof DateTime ||
|
} elseif ($string instanceof DateTime
|
||||||
(interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
|
|| (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
|
||||||
) {
|
) {
|
||||||
return (int) $string->format('U'); // PHP 5.2 BC
|
return (int) $string->format('U'); // PHP 5.2 BC
|
||||||
} elseif (strlen($string) === 14 && ctype_digit($string)) {
|
} elseif (strlen($string) === 14 && ctype_digit($string)) {
|
||||||
// it is mysql timestamp format of YYYYMMDDHHMMSS?
|
// 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),
|
return mktime(
|
||||||
substr($string, 6, 2), substr($string, 0, 4));
|
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)) {
|
} elseif (is_numeric($string)) {
|
||||||
// it is a numeric string, we handle it as timestamp
|
// it is a numeric string, we handle it as timestamp
|
||||||
return (int) $string;
|
return (int) $string;
|
||||||
|
@@ -51,7 +51,8 @@ abstract class Smarty_CacheResource
|
|||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null,
|
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null,
|
||||||
$update = false);
|
$update = false
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the rendered template output to cache
|
* Write the rendered template output to cache
|
||||||
|
@@ -110,8 +110,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$timestamp = null;
|
$timestamp = null;
|
||||||
$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content,
|
$this->fetch(
|
||||||
$timestamp);
|
$cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content,
|
||||||
|
$timestamp
|
||||||
|
);
|
||||||
$cached->timestamp = isset($timestamp) ? $timestamp : false;
|
$cached->timestamp = isset($timestamp) ? $timestamp : false;
|
||||||
$cached->exists = !!$cached->timestamp;
|
$cached->exists = !!$cached->timestamp;
|
||||||
}
|
}
|
||||||
@@ -126,16 +128,18 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
||||||
$update = false)
|
$update = false
|
||||||
{
|
) {
|
||||||
if (!$cached) {
|
if (!$cached) {
|
||||||
$cached = $_smarty_tpl->cached;
|
$cached = $_smarty_tpl->cached;
|
||||||
}
|
}
|
||||||
$content = $cached->content ? $cached->content : null;
|
$content = $cached->content ? $cached->content : null;
|
||||||
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
||||||
if ($content === null || !$timestamp) {
|
if ($content === null || !$timestamp) {
|
||||||
$this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id,
|
$this->fetch(
|
||||||
$_smarty_tpl->compile_id, $content, $timestamp);
|
$_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id,
|
||||||
|
$_smarty_tpl->compile_id, $content, $timestamp
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (isset($content)) {
|
if (isset($content)) {
|
||||||
eval('?>' . $content);
|
eval('?>' . $content);
|
||||||
@@ -156,8 +160,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
||||||
{
|
{
|
||||||
return $this->save($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
return $this->save(
|
||||||
$_template->compile_id, $_template->cache_lifetime, $content);
|
$_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||||
|
$_template->compile_id, $_template->cache_lifetime, $content
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,8 +179,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
$timestamp = null;
|
$timestamp = null;
|
||||||
if ($content === null) {
|
if ($content === null) {
|
||||||
$timestamp = null;
|
$timestamp = null;
|
||||||
$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
$this->fetch(
|
||||||
$_template->compile_id, $content, $timestamp);
|
$_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||||
|
$_template->compile_id, $content, $timestamp
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (isset($content)) {
|
if (isset($content)) {
|
||||||
return $content;
|
return $content;
|
||||||
|
@@ -69,8 +69,10 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function populateTimestamp(Smarty_Template_Cached $cached)
|
public function populateTimestamp(Smarty_Template_Cached $cached)
|
||||||
{
|
{
|
||||||
if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content,
|
if (!$this->fetch(
|
||||||
$timestamp, $cached->source->uid)
|
$cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content,
|
||||||
|
$timestamp, $cached->source->uid
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -89,16 +91,18 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
||||||
$update = false)
|
$update = false
|
||||||
{
|
) {
|
||||||
if (!$cached) {
|
if (!$cached) {
|
||||||
$cached = $_smarty_tpl->cached;
|
$cached = $_smarty_tpl->cached;
|
||||||
}
|
}
|
||||||
$content = $cached->content ? $cached->content : null;
|
$content = $cached->content ? $cached->content : null;
|
||||||
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
$timestamp = $cached->timestamp ? $cached->timestamp : null;
|
||||||
if ($content === null || !$timestamp) {
|
if ($content === null || !$timestamp) {
|
||||||
if (!$this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id,
|
if (!$this->fetch(
|
||||||
$_smarty_tpl->compile_id, $content, $timestamp, $_smarty_tpl->source->uid)
|
$_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id,
|
||||||
|
$_smarty_tpl->compile_id, $content, $timestamp, $_smarty_tpl->source->uid
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,8 +143,10 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
$content = $_template->cached->content ? $_template->cached->content : null;
|
$content = $_template->cached->content ? $_template->cached->content : null;
|
||||||
$timestamp = null;
|
$timestamp = null;
|
||||||
if ($content === null) {
|
if ($content === null) {
|
||||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
if (!$this->fetch(
|
||||||
$_template->compile_id, $content, $timestamp, $_template->source->uid)
|
$_template->cached->filepath, $_template->source->name, $_template->cache_id,
|
||||||
|
$_template->compile_id, $content, $timestamp, $_template->source->uid
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -204,7 +210,6 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*
|
*
|
||||||
* @return string filepath of cache file
|
* @return string filepath of cache file
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
protected function getTemplateUid(Smarty $smarty, $resource_name)
|
protected function getTemplateUid(Smarty $smarty, $resource_name)
|
||||||
{
|
{
|
||||||
@@ -247,8 +252,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @return boolean success
|
* @return boolean success
|
||||||
*/
|
*/
|
||||||
protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null,
|
protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null,
|
||||||
&$timestamp = null, $resource_uid = null)
|
&$timestamp = null, $resource_uid = null
|
||||||
{
|
) {
|
||||||
$t = $this->read(array($cid));
|
$t = $this->read(array($cid));
|
||||||
$content = !empty($t[ $cid ]) ? $t[ $cid ] : null;
|
$content = !empty($t[ $cid ]) ? $t[ $cid ] : null;
|
||||||
$timestamp = null;
|
$timestamp = null;
|
||||||
@@ -307,8 +312,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null,
|
protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||||
$resource_uid = null)
|
$resource_uid = null
|
||||||
{
|
) {
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
$key = null;
|
$key = null;
|
||||||
// invalidate everything
|
// invalidate everything
|
||||||
@@ -348,8 +353,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @return float the microtime the CacheID was invalidated
|
* @return float the microtime the CacheID was invalidated
|
||||||
*/
|
*/
|
||||||
protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||||
$resource_uid = null)
|
$resource_uid = null
|
||||||
{
|
) {
|
||||||
// abort if there is no CacheID
|
// abort if there is no CacheID
|
||||||
if (false && !$cid) {
|
if (false && !$cid) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -383,8 +388,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
* @uses $invalidationKeyPrefix to prepend to each InvalidationKey
|
* @uses $invalidationKeyPrefix to prepend to each InvalidationKey
|
||||||
*/
|
*/
|
||||||
protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null,
|
||||||
$resource_uid = null)
|
$resource_uid = null
|
||||||
{
|
) {
|
||||||
$t = array('IVK#ALL');
|
$t = array('IVK#ALL');
|
||||||
$_name = $_compile = '#';
|
$_name = $_compile = '#';
|
||||||
if ($resource_name) {
|
if ($resource_name) {
|
||||||
|
@@ -32,11 +32,13 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
$_filepath = sha1($source->uid . $smarty->_joined_template_dir);
|
$_filepath = sha1($source->uid . $smarty->_joined_template_dir);
|
||||||
$cached->filepath = $smarty->getCacheDir();
|
$cached->filepath = $smarty->getCacheDir();
|
||||||
if (isset($_template->cache_id)) {
|
if (isset($_template->cache_id)) {
|
||||||
$cached->filepath .= preg_replace(array('![^\w|]+!',
|
$cached->filepath .= preg_replace(
|
||||||
|
array('![^\w|]+!',
|
||||||
'![|]+!'),
|
'![|]+!'),
|
||||||
array('_',
|
array('_',
|
||||||
$_compile_dir_sep),
|
$_compile_dir_sep),
|
||||||
$_template->cache_id) . $_compile_dir_sep;
|
$_template->cache_id
|
||||||
|
) . $_compile_dir_sep;
|
||||||
}
|
}
|
||||||
if (isset($_template->compile_id)) {
|
if (isset($_template->compile_id)) {
|
||||||
$cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep;
|
$cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep;
|
||||||
@@ -89,8 +91,8 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl,
|
public function process(Smarty_Internal_Template $_smarty_tpl,
|
||||||
Smarty_Template_Cached $cached = null,
|
Smarty_Template_Cached $cached = null,
|
||||||
$update = false)
|
$update = false
|
||||||
{
|
) {
|
||||||
$_smarty_tpl->cached->valid = false;
|
$_smarty_tpl->cached->valid = false;
|
||||||
if ($update && defined('HHVM_VERSION')) {
|
if ($update && defined('HHVM_VERSION')) {
|
||||||
eval('?>' . file_get_contents($_smarty_tpl->cached->filepath));
|
eval('?>' . file_get_contents($_smarty_tpl->cached->filepath));
|
||||||
@@ -111,12 +113,14 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
||||||
{
|
{
|
||||||
if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath,
|
if ($_template->smarty->ext->_writeFile->writeFile(
|
||||||
|
$_template->cached->filepath,
|
||||||
$content,
|
$content,
|
||||||
$_template->smarty) === true
|
$_template->smarty
|
||||||
|
) === true
|
||||||
) {
|
) {
|
||||||
if (function_exists('opcache_invalidate') &&
|
if (function_exists('opcache_invalidate')
|
||||||
(!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1
|
&& (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1
|
||||||
) {
|
) {
|
||||||
opcache_invalidate($_template->cached->filepath, true);
|
opcache_invalidate($_template->cached->filepath, true);
|
||||||
} else if (function_exists('apc_compile_file')) {
|
} else if (function_exists('apc_compile_file')) {
|
||||||
|
@@ -50,7 +50,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
|
|||||||
* @param array $args array with attributes from parser
|
* @param array $args array with attributes from parser
|
||||||
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
|
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
|
||||||
* @param array $parameter array with compilation parameter
|
* @param array $parameter array with compilation parameter
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
|
||||||
{
|
{
|
||||||
@@ -72,11 +71,13 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
|
|||||||
$compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className;
|
$compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className;
|
||||||
$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
|
$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array();
|
||||||
$compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className;
|
$compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className;
|
||||||
$this->openTag($compiler,
|
$this->openTag(
|
||||||
|
$compiler,
|
||||||
'block',
|
'block',
|
||||||
array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
|
array($_attr, $compiler->nocache, $compiler->parser->current_buffer,
|
||||||
$compiler->template->compiled->has_nocache_code,
|
$compiler->template->compiled->has_nocache_code,
|
||||||
$compiler->template->caching));
|
$compiler->template->caching)
|
||||||
|
);
|
||||||
$compiler->saveRequiredPlugins(true);
|
$compiler->saveRequiredPlugins(true);
|
||||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||||
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
|
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
|
||||||
@@ -86,7 +87,6 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Compile BlockClose Class
|
* Smarty Internal Plugin Compile BlockClose Class
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance
|
class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
|
|||||||
$output .= "class {$_className} extends Smarty_Internal_Block\n";
|
$output .= "class {$_className} extends Smarty_Internal_Block\n";
|
||||||
$output .= "{\n";
|
$output .= "{\n";
|
||||||
foreach ($_block as $property => $value) {
|
foreach ($_block as $property => $value) {
|
||||||
$output .= "public \${$property} = " . var_export($value,true) .";\n";
|
$output .= "public \${$property} = " . var_export($value, true) .";\n";
|
||||||
}
|
}
|
||||||
$output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n";
|
$output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n";
|
||||||
$output .= $compiler->compileRequiredPlugins();
|
$output .= $compiler->compileRequiredPlugins();
|
||||||
@@ -136,9 +136,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
|
|||||||
$output .= "ob_start();\n";
|
$output .= "ob_start();\n";
|
||||||
}
|
}
|
||||||
$output .= "?>\n";
|
$output .= "?>\n";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
|
$output
|
||||||
|
)
|
||||||
|
);
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
||||||
$output = "<?php\n";
|
$output = "<?php\n";
|
||||||
if (isset($_assign)) {
|
if (isset($_assign)) {
|
||||||
@@ -148,9 +152,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
|
|||||||
$output .= "}\n";
|
$output .= "}\n";
|
||||||
$output .= "/* {/block {$_name}} */\n\n";
|
$output .= "/* {/block {$_name}} */\n\n";
|
||||||
$output .= "?>\n";
|
$output .= "?>\n";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
|
$output
|
||||||
|
)
|
||||||
|
);
|
||||||
$compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
|
$compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
|
||||||
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
|
$compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();
|
||||||
// restore old status
|
// restore old status
|
||||||
|
@@ -36,7 +36,7 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
|||||||
* Compiles code for the {$smarty.capture.xxx}
|
* Compiles code for the {$smarty.capture.xxx}
|
||||||
*
|
*
|
||||||
* @param array $args array with attributes from parser
|
* @param array $args array with attributes from parser
|
||||||
* @param \Smarty_Internal_TemplateCompilerBase$compiler compiler object
|
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
|
||||||
* @param array $parameter array with compilation parameter
|
* @param array $parameter array with compilation parameter
|
||||||
*
|
*
|
||||||
* @return string compiled code
|
* @return string compiled code
|
||||||
|
@@ -53,8 +53,10 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase
|
|||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
$tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'";
|
$tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'";
|
||||||
if (!isset($compiler->_cache[ 'blockNesting' ])) {
|
if (!isset($compiler->_cache[ 'blockNesting' ])) {
|
||||||
$compiler->trigger_template_error("{$tag} used outside {block} tags ",
|
$compiler->trigger_template_error(
|
||||||
$compiler->parser->lex->taglineno);
|
"{$tag} used outside {block} tags ",
|
||||||
|
$compiler->parser->lex->taglineno
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$compiler->has_code = true;
|
$compiler->has_code = true;
|
||||||
$compiler->suppressNocacheProcessing = true;
|
$compiler->suppressNocacheProcessing = true;
|
||||||
|
@@ -108,11 +108,13 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
|
|||||||
$inlineUids = $match[ 1 ];
|
$inlineUids = $match[ 1 ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
'<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' .
|
'<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' .
|
||||||
(isset($template) ?
|
(isset($template) ?
|
||||||
", {$template}{$inlineUids}" :
|
", {$template}{$inlineUids}" :
|
||||||
'') . ");\n?>");
|
'') . ");\n?>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,10 +128,14 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh
|
|||||||
*/
|
*/
|
||||||
private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template)
|
private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template)
|
||||||
{
|
{
|
||||||
$compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag(
|
||||||
$compiler->compileTag('include',
|
$compiler->parser,
|
||||||
|
$compiler->compileTag(
|
||||||
|
'include',
|
||||||
array($template,
|
array($template,
|
||||||
array('scope' => 'parent'))));
|
array('scope' => 'parent'))
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -119,8 +119,10 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
|||||||
if ($fromName) {
|
if ($fromName) {
|
||||||
foreach (array('item', 'key') as $a) {
|
foreach (array('item', 'key') as $a) {
|
||||||
if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) {
|
if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) {
|
||||||
$compiler->trigger_template_error("'{$a}' and 'from' may not have same variable name '{$fromName}'",
|
$compiler->trigger_template_error(
|
||||||
null, true);
|
"'{$a}' and 'from' may not have same variable name '{$fromName}'",
|
||||||
|
null, true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,8 +189,10 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
|
|||||||
}
|
}
|
||||||
$needTotal = isset($itemAttr[ 'total' ]);
|
$needTotal = isset($itemAttr[ 'total' ]);
|
||||||
// Register tag
|
// Register tag
|
||||||
$this->openTag($compiler, 'foreach',
|
$this->openTag(
|
||||||
array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2));
|
$compiler, 'foreach',
|
||||||
|
array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2)
|
||||||
|
);
|
||||||
// maybe nocache because of nocache variables
|
// maybe nocache because of nocache variables
|
||||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||||
// generate output code
|
// generate output code
|
||||||
|
@@ -143,9 +143,13 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
$output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
$output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
||||||
$output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>";
|
$output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>";
|
||||||
$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>";
|
$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
|
$output
|
||||||
|
)
|
||||||
|
);
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
||||||
$output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
$output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
|
||||||
$output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n";
|
$output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n";
|
||||||
@@ -154,13 +158,21 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
$output .= "}\n}\n";
|
$output .= "}\n}\n";
|
||||||
$output .= "/*/ {$_funcName}_nocache */\n\n";
|
$output .= "/*/ {$_funcName}_nocache */\n\n";
|
||||||
$output .= "?>\n";
|
$output .= "?>\n";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
$_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
|
$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'),
|
array($this, 'removeNocache'),
|
||||||
$_functionCode->to_smarty_php($compiler->parser)));
|
$_functionCode->to_smarty_php($compiler->parser)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName;
|
$compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName;
|
||||||
$output = "<?php\n";
|
$output = "<?php\n";
|
||||||
@@ -171,16 +183,24 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n";
|
$output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n";
|
||||||
$output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], $compiler->required_plugins[ 'nocache' ]));
|
$output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], $compiler->required_plugins[ 'nocache' ]));
|
||||||
$output .= "?>\n";
|
$output .= "?>\n";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
|
$output
|
||||||
|
)
|
||||||
|
);
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
$compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);
|
||||||
$output = "<?php\n}}\n";
|
$output = "<?php\n}}\n";
|
||||||
$output .= "/*/ {$_funcName} */\n\n";
|
$output .= "/*/ {$_funcName} */\n\n";
|
||||||
$output .= "?>\n";
|
$output .= "?>\n";
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$output));
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
|
$compiler->parser,
|
||||||
|
$output
|
||||||
|
)
|
||||||
|
);
|
||||||
$compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
|
$compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);
|
||||||
// restore old buffer
|
// restore old buffer
|
||||||
$compiler->parser->current_buffer = $saved_data[ 1 ];
|
$compiler->parser->current_buffer = $saved_data[ 1 ];
|
||||||
@@ -201,8 +221,10 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
|||||||
function removeNocache($match)
|
function removeNocache($match)
|
||||||
{
|
{
|
||||||
$code =
|
$code =
|
||||||
preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/",
|
preg_replace(
|
||||||
'', $match[ 0 ]);
|
"/((<\?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);
|
$code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code);
|
||||||
return $code;
|
return $code;
|
||||||
}
|
}
|
||||||
|
@@ -55,8 +55,10 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
|
|||||||
$assignCompiler = new Smarty_Internal_Compile_Assign();
|
$assignCompiler = new Smarty_Internal_Compile_Assign();
|
||||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
||||||
$_output .= $assignCompiler->compile($assignAttr, $compiler,
|
$_output .= $assignCompiler->compile(
|
||||||
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]));
|
$assignAttr, $compiler,
|
||||||
|
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
||||||
$_output .= $assignCompiler->compile($assignAttr, $compiler, array());
|
$_output .= $assignCompiler->compile($assignAttr, $compiler, array());
|
||||||
@@ -143,8 +145,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
|
|||||||
$assignAttr[][ 'value' ] = $prefixVar;
|
$assignAttr[][ 'value' ] = $prefixVar;
|
||||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
||||||
$assignCode .= $assignCompiler->compile($assignAttr, $compiler,
|
$assignCode .= $assignCompiler->compile(
|
||||||
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]));
|
$assignAttr, $compiler,
|
||||||
|
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
||||||
$assignCode .= $assignCompiler->compile($assignAttr, $compiler, array());
|
$assignCode .= $assignCompiler->compile($assignAttr, $compiler, array());
|
||||||
|
@@ -91,8 +91,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
$compiled->includes[ $fullResourceName ]++;
|
$compiled->includes[ $fullResourceName ]++;
|
||||||
$cache_tpl = true;
|
$cache_tpl = true;
|
||||||
} else {
|
} else {
|
||||||
if ("{$compiler->template->source->type}:{$compiler->template->source->name}" ==
|
if ("{$compiler->template->source->type}:{$compiler->template->source->name}" == $fullResourceName
|
||||||
$fullResourceName
|
|
||||||
) {
|
) {
|
||||||
// recursive call of current template
|
// recursive call of current template
|
||||||
$compiled->includes[ $fullResourceName ] = 2;
|
$compiled->includes[ $fullResourceName ] = 2;
|
||||||
@@ -193,9 +192,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
$t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching'));
|
$t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching'));
|
||||||
$compiler->smarty->allow_ambiguous_resources = true;
|
$compiler->smarty->allow_ambiguous_resources = true;
|
||||||
/* @var Smarty_Internal_Template $tpl */
|
/* @var Smarty_Internal_Template $tpl */
|
||||||
$tpl = new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty,
|
$tpl = new $compiler->smarty->template_class(
|
||||||
|
trim($fullResourceName, '"\''), $compiler->smarty,
|
||||||
$compiler->template, $compiler->template->cache_id, $c_id,
|
$compiler->template, $compiler->template->cache_id, $c_id,
|
||||||
$_caching);
|
$_caching
|
||||||
|
);
|
||||||
$uid = $tpl->source->type . $tpl->source->uid;
|
$uid = $tpl->source->type . $tpl->source->uid;
|
||||||
if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) {
|
if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) {
|
||||||
$has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash);
|
$has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash);
|
||||||
@@ -277,8 +278,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
*/
|
*/
|
||||||
public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler,
|
public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler,
|
||||||
Smarty_Internal_Template $tpl,
|
Smarty_Internal_Template $tpl,
|
||||||
$t_hash)
|
$t_hash
|
||||||
{
|
) {
|
||||||
$uid = $tpl->source->type . $tpl->source->uid;
|
$uid = $tpl->source->type . $tpl->source->uid;
|
||||||
if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) {
|
if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) {
|
||||||
$compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid;
|
$compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid;
|
||||||
@@ -317,9 +318,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
|||||||
if ($tpl->compiled->has_nocache_code) {
|
if ($tpl->compiled->has_nocache_code) {
|
||||||
// replace nocache_hash
|
// replace nocache_hash
|
||||||
$compiled_code =
|
$compiled_code =
|
||||||
str_replace("{$tpl->compiled->nocache_hash}",
|
str_replace(
|
||||||
|
"{$tpl->compiled->nocache_hash}",
|
||||||
$compiler->template->compiled->nocache_hash,
|
$compiler->template->compiled->nocache_hash,
|
||||||
$compiled_code);
|
$compiled_code
|
||||||
|
);
|
||||||
$compiler->template->compiled->has_nocache_code = true;
|
$compiler->template->compiled->has_nocache_code = true;
|
||||||
}
|
}
|
||||||
$compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code;
|
$compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code;
|
||||||
|
@@ -56,7 +56,10 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
|
|||||||
}
|
}
|
||||||
// check and get attributes
|
// check and get attributes
|
||||||
$_attr = $this->getAttributes($compiler, $args);
|
$_attr = $this->getAttributes($compiler, $args);
|
||||||
/** @var Smarty_Internal_Template $_smarty_tpl
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @var Smarty_Internal_Template $_smarty_tpl
|
||||||
* used in evaluated code
|
* used in evaluated code
|
||||||
*/
|
*/
|
||||||
$_smarty_tpl = $compiler->template;
|
$_smarty_tpl = $compiler->template;
|
||||||
|
@@ -104,11 +104,13 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
|||||||
}
|
}
|
||||||
// code for script file loading
|
// code for script file loading
|
||||||
$_output .= "require_once '{$_filepath}' ;";
|
$_output .= "require_once '{$_filepath}' ;";
|
||||||
require_once $_filepath;
|
include_once $_filepath;
|
||||||
if (!is_callable($_function)) {
|
if (!is_callable($_function)) {
|
||||||
$compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'",
|
$compiler->trigger_template_error(
|
||||||
|
" {insert} function '{$_function}' is not callable in script file '{$_script}'",
|
||||||
null,
|
null,
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_filepath = 'null';
|
$_filepath = 'null';
|
||||||
@@ -117,9 +119,11 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
|||||||
if (!is_callable($_function)) {
|
if (!is_callable($_function)) {
|
||||||
// try plugin
|
// try plugin
|
||||||
if (!$_function = $compiler->getPlugin($_name, 'insert')) {
|
if (!$_function = $compiler->getPlugin($_name, 'insert')) {
|
||||||
$compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'",
|
$compiler->trigger_template_error(
|
||||||
|
"{insert} no function or plugin found for '{$_name}'",
|
||||||
null,
|
null,
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,9 +84,11 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
|||||||
$mod_content2 = "\$_block_content{$this->nesting}";
|
$mod_content2 = "\$_block_content{$this->nesting}";
|
||||||
$mod_content = "\$_block_content{$this->nesting} = ob_get_clean();\n";
|
$mod_content = "\$_block_content{$this->nesting} = ob_get_clean();\n";
|
||||||
$mod_pre = "ob_start();\n";
|
$mod_pre = "ob_start();\n";
|
||||||
$mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(),
|
$mod_post = 'echo ' . $compiler->compileTag(
|
||||||
|
'private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifier_list' ],
|
array('modifierlist' => $parameter[ 'modifier_list' ],
|
||||||
'value' => 'ob_get_clean()')) . ";\n";
|
'value' => 'ob_get_clean()')
|
||||||
|
) . ";\n";
|
||||||
}
|
}
|
||||||
$output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n";
|
$output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n";
|
||||||
$output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>';
|
$output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>';
|
||||||
|
@@ -178,11 +178,13 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com
|
|||||||
$_content = $nextCompiler->template->source->getContent();
|
$_content = $nextCompiler->template->source->getContent();
|
||||||
if ($_content !== '') {
|
if ($_content !== '') {
|
||||||
// run pre filter if required
|
// run pre filter if required
|
||||||
if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
|
if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ])
|
||||||
isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
|
|| isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
|
||||||
) {
|
) {
|
||||||
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content,
|
$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter(
|
||||||
$nextCompiler->template);
|
'pre', $_content,
|
||||||
|
$nextCompiler->template
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->matchProperty($_content);
|
$this->matchProperty($_content);
|
||||||
}
|
}
|
||||||
|
@@ -64,9 +64,11 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
|
|||||||
// compile code
|
// compile code
|
||||||
$output = "{$function}({$_params},\$_smarty_tpl)";
|
$output = "{$function}({$_params},\$_smarty_tpl)";
|
||||||
if (!empty($parameter[ 'modifierlist' ])) {
|
if (!empty($parameter[ 'modifierlist' ])) {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
|
'private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
'value' => $output));
|
'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$output = "<?php echo {$output};?>\n";
|
$output = "<?php echo {$output};?>\n";
|
||||||
return $output;
|
return $output;
|
||||||
|
@@ -52,8 +52,10 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
|
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
|
||||||
if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) {
|
if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) {
|
||||||
$output =
|
$output =
|
||||||
sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))',
|
sprintf(
|
||||||
Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params);
|
'call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))',
|
||||||
|
Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params
|
||||||
|
);
|
||||||
$compiler->known_modifier_type[ $modifier ] = $type;
|
$compiler->known_modifier_type[ $modifier ] = $type;
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
@@ -63,8 +65,10 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
// registered modifier compiler
|
// registered modifier compiler
|
||||||
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
|
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
|
||||||
$output =
|
$output =
|
||||||
call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
|
call_user_func(
|
||||||
$single_modifier, $compiler->smarty);
|
$compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
|
||||||
|
$single_modifier, $compiler->smarty
|
||||||
|
);
|
||||||
$compiler->known_modifier_type[ $modifier ] = $type;
|
$compiler->known_modifier_type[ $modifier ] = $type;
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
@@ -73,8 +77,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
// modifiercompiler plugin
|
// modifiercompiler plugin
|
||||||
if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
|
if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
|
||||||
// check if modifier allowed
|
// check if modifier allowed
|
||||||
if (!is_object($compiler->smarty->security_policy) ||
|
if (!is_object($compiler->smarty->security_policy)
|
||||||
$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
|| $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
||||||
) {
|
) {
|
||||||
$plugin = 'smarty_modifiercompiler_' . $modifier;
|
$plugin = 'smarty_modifiercompiler_' . $modifier;
|
||||||
$output = $plugin($single_modifier, $compiler);
|
$output = $plugin($single_modifier, $compiler);
|
||||||
@@ -87,8 +91,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
// modifier plugin
|
// modifier plugin
|
||||||
if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
|
if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
|
||||||
// check if modifier allowed
|
// check if modifier allowed
|
||||||
if (!is_object($compiler->smarty->security_policy) ||
|
if (!is_object($compiler->smarty->security_policy)
|
||||||
$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
|| $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
||||||
) {
|
) {
|
||||||
$output = "{$function}({$params})";
|
$output = "{$function}({$params})";
|
||||||
}
|
}
|
||||||
@@ -100,8 +104,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
// PHP function
|
// PHP function
|
||||||
if (is_callable($modifier)) {
|
if (is_callable($modifier)) {
|
||||||
// check if modifier allowed
|
// check if modifier allowed
|
||||||
if (!is_object($compiler->smarty->security_policy) ||
|
if (!is_object($compiler->smarty->security_policy)
|
||||||
$compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
|
|| $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
|
||||||
) {
|
) {
|
||||||
$output = "{$modifier}({$params})";
|
$output = "{$modifier}({$params})";
|
||||||
}
|
}
|
||||||
@@ -111,14 +115,14 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// default plugin handler
|
// default plugin handler
|
||||||
if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
|
if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])
|
||||||
(is_callable($compiler->smarty->default_plugin_handler_func) &&
|
|| (is_callable($compiler->smarty->default_plugin_handler_func)
|
||||||
$compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
|
&& $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
|
||||||
) {
|
) {
|
||||||
$function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
|
$function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
|
||||||
// check if modifier allowed
|
// check if modifier allowed
|
||||||
if (!is_object($compiler->smarty->security_policy) ||
|
if (!is_object($compiler->smarty->security_policy)
|
||||||
$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
|| $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
|
||||||
) {
|
) {
|
||||||
if (!is_array($function)) {
|
if (!is_array($function)) {
|
||||||
$output = "{$function}({$params})";
|
$output = "{$function}({$params})";
|
||||||
@@ -130,8 +134,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
|
if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
|
||||||
isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
|
|| isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
|
||||||
) {
|
) {
|
||||||
// was a plugin
|
// was a plugin
|
||||||
$compiler->known_modifier_type[ $modifier ] = 4;
|
$compiler->known_modifier_type[ $modifier ] = 4;
|
||||||
|
@@ -70,8 +70,10 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
|||||||
$output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
|
$output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
|
||||||
}
|
}
|
||||||
if (!empty($parameter[ 'modifierlist' ])) {
|
if (!empty($parameter[ 'modifierlist' ])) {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output));
|
'private_modifier', array(),
|
||||||
|
array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (empty($_assign)) {
|
if (empty($_assign)) {
|
||||||
return "<?php echo {$output};?>\n";
|
return "<?php echo {$output};?>\n";
|
||||||
|
@@ -43,10 +43,16 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
if ($_attr[ 'type' ] === 'xml') {
|
if ($_attr[ 'type' ] === 'xml') {
|
||||||
$compiler->tag_nocache = true;
|
$compiler->tag_nocache = true;
|
||||||
$output = addcslashes($_attr[ 'code' ], "'\\");
|
$output = addcslashes($_attr[ 'code' ], "'\\");
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$compiler->processNocacheCode("<?php echo '{$output}';?>",
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
true)));
|
$compiler->parser,
|
||||||
|
$compiler->processNocacheCode(
|
||||||
|
"<?php echo '{$output}';?>",
|
||||||
|
true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if ($_attr[ 'type' ] !== 'tag') {
|
if ($_attr[ 'type' ] !== 'tag') {
|
||||||
@@ -54,23 +60,35 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
return '';
|
return '';
|
||||||
} elseif ($compiler->php_handling === Smarty::PHP_QUOTE) {
|
} elseif ($compiler->php_handling === Smarty::PHP_QUOTE) {
|
||||||
$output =
|
$output =
|
||||||
preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i',
|
preg_replace_callback(
|
||||||
array($this, 'quote'), $_attr[ 'code' ]);
|
'#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i',
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
array($this, 'quote'), $_attr[ 'code' ]
|
||||||
new Smarty_Internal_ParseTree_Text($output));
|
);
|
||||||
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
|
$compiler->parser,
|
||||||
|
new Smarty_Internal_ParseTree_Text($output)
|
||||||
|
);
|
||||||
return '';
|
return '';
|
||||||
} elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') {
|
} elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') {
|
||||||
$compiler->tag_nocache = true;
|
$compiler->tag_nocache = true;
|
||||||
$output = addcslashes($_attr[ 'code' ], "'\\");
|
$output = addcslashes($_attr[ 'code' ], "'\\");
|
||||||
$compiler->parser->current_buffer->append_subtree($compiler->parser,
|
$compiler->parser->current_buffer->append_subtree(
|
||||||
new Smarty_Internal_ParseTree_Tag($compiler->parser,
|
$compiler->parser,
|
||||||
$compiler->processNocacheCode("<?php echo '{$output}';?>",
|
new Smarty_Internal_ParseTree_Tag(
|
||||||
true)));
|
$compiler->parser,
|
||||||
|
$compiler->processNocacheCode(
|
||||||
|
"<?php echo '{$output}';?>",
|
||||||
|
true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
return '';
|
return '';
|
||||||
} elseif ($compiler->php_handling === Smarty::PHP_ALLOW) {
|
} elseif ($compiler->php_handling === Smarty::PHP_ALLOW) {
|
||||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||||
$compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it',
|
$compiler->trigger_template_error(
|
||||||
null, true);
|
'$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it',
|
||||||
|
null, true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$compiler->has_code = true;
|
$compiler->has_code = true;
|
||||||
return $_attr[ 'code' ];
|
return $_attr[ 'code' ];
|
||||||
@@ -80,8 +98,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
} else {
|
} else {
|
||||||
$compiler->has_code = true;
|
$compiler->has_code = true;
|
||||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||||
$compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null,
|
$compiler->trigger_template_error(
|
||||||
true);
|
'{php}{/php} tags not allowed. Use SmartyBC to enable them', null,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$ldel = preg_quote($compiler->smarty->left_delimiter, '#');
|
$ldel = preg_quote($compiler->smarty->left_delimiter, '#');
|
||||||
$rdel = preg_quote($compiler->smarty->right_delimiter, '#');
|
$rdel = preg_quote($compiler->smarty->right_delimiter, '#');
|
||||||
@@ -93,8 +113,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
$compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true);
|
$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}$#"),
|
return preg_replace(
|
||||||
array('<?php ', '?>'), $_attr[ 'code' ]);
|
array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"),
|
||||||
|
array('<?php ', '?>'), $_attr[ 'code' ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +170,8 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
if ($lex->phpType === 'unmatched') {
|
if ($lex->phpType === 'unmatched') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (($lex->phpType === 'php' || $lex->phpType === 'asp') &&
|
if (($lex->phpType === 'php' || $lex->phpType === 'asp')
|
||||||
($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE)
|
&& ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -161,8 +183,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
$lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'");
|
$lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'");
|
||||||
}
|
}
|
||||||
while ($body) {
|
while ($body) {
|
||||||
if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~',
|
if (preg_match(
|
||||||
$lex->data, $match, PREG_OFFSET_CAPTURE, $start)) {
|
'~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~',
|
||||||
|
$lex->data, $match, PREG_OFFSET_CAPTURE, $start
|
||||||
|
)
|
||||||
|
) {
|
||||||
$value = $match[ 0 ][ 0 ];
|
$value = $match[ 0 ][ 0 ];
|
||||||
$from = $pos = $match[ 0 ][ 1 ];
|
$from = $pos = $match[ 0 ][ 1 ];
|
||||||
if ($pos > $close) {
|
if ($pos > $close) {
|
||||||
@@ -178,8 +203,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ($close > $pos && $close < $start) {
|
while ($close > $pos && $close < $start) {
|
||||||
if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE,
|
if (preg_match(
|
||||||
$from)) {
|
'~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE,
|
||||||
|
$from
|
||||||
|
)
|
||||||
|
) {
|
||||||
$close = $match[ 0 ][ 1 ];
|
$close = $match[ 0 ][ 1 ];
|
||||||
$from = $close + strlen($match[ 0 ][ 0 ]);
|
$from = $close + strlen($match[ 0 ][ 0 ]);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -49,9 +49,11 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
$output = $parameter[ 'value' ];
|
$output = $parameter[ 'value' ];
|
||||||
// tag modifier
|
// tag modifier
|
||||||
if (!empty($parameter[ 'modifierlist' ])) {
|
if (!empty($parameter[ 'modifierlist' ])) {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
|
'private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
'value' => $output));
|
'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (isset($_attr[ 'assign' ])) {
|
if (isset($_attr[ 'assign' ])) {
|
||||||
// assign output to variable
|
// assign output to variable
|
||||||
@@ -64,8 +66,10 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
if (empty($compiler->default_modifier_list)) {
|
if (empty($compiler->default_modifier_list)) {
|
||||||
$modifierlist = array();
|
$modifierlist = array();
|
||||||
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
|
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
|
||||||
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
|
preg_match_all(
|
||||||
$single_default_modifier, $mod_array);
|
'/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/',
|
||||||
|
$single_default_modifier, $mod_array
|
||||||
|
);
|
||||||
for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
|
for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) {
|
||||||
if ($mod_array[ 0 ][ $i ] !== ':') {
|
if ($mod_array[ 0 ][ $i ] !== ':') {
|
||||||
$modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
|
$modifierlist[ $key ][] = $mod_array[ 0 ][ $i ];
|
||||||
@@ -74,9 +78,11 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
}
|
}
|
||||||
$compiler->default_modifier_list = $modifierlist;
|
$compiler->default_modifier_list = $modifierlist;
|
||||||
}
|
}
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
|
'private_modifier', array(),
|
||||||
array('modifierlist' => $compiler->default_modifier_list,
|
array('modifierlist' => $compiler->default_modifier_list,
|
||||||
'value' => $output));
|
'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// autoescape html
|
// autoescape html
|
||||||
if ($compiler->template->smarty->escape_html) {
|
if ($compiler->template->smarty->escape_html) {
|
||||||
@@ -110,13 +116,15 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($compiler->variable_filters as $filter) {
|
foreach ($compiler->variable_filters as $filter) {
|
||||||
if (count($filter) === 1 &&
|
if (count($filter) === 1
|
||||||
($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false
|
&& ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false
|
||||||
) {
|
) {
|
||||||
$output = $result;
|
$output = $result;
|
||||||
} else {
|
} else {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
array('modifierlist' => array($filter), 'value' => $output));
|
'private_modifier', array(),
|
||||||
|
array('modifierlist' => array($filter), 'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,9 +76,11 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($parameter[ 'modifierlist' ])) {
|
if (!empty($parameter[ 'modifierlist' ])) {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag(
|
||||||
|
'private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
'value' => $output));
|
'value' => $output)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$output = "<?php echo {$output};?>\n";
|
$output = "<?php echo {$output};?>\n";
|
||||||
return $output;
|
return $output;
|
||||||
|
@@ -33,8 +33,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
|||||||
if ($variable === false) {
|
if ($variable === false) {
|
||||||
$compiler->trigger_template_error("special \$Smarty variable name index can not be variable", null, true);
|
$compiler->trigger_template_error("special \$Smarty variable name index can not be variable", null, true);
|
||||||
}
|
}
|
||||||
if (!isset($compiler->smarty->security_policy) ||
|
if (!isset($compiler->smarty->security_policy)
|
||||||
$compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler)
|
|| $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler)
|
||||||
) {
|
) {
|
||||||
switch ($variable) {
|
switch ($variable) {
|
||||||
case 'foreach':
|
case 'foreach':
|
||||||
@@ -52,8 +52,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
|||||||
case 'now':
|
case 'now':
|
||||||
return 'time()';
|
return 'time()';
|
||||||
case 'cookies':
|
case 'cookies':
|
||||||
if (isset($compiler->smarty->security_policy) &&
|
if (isset($compiler->smarty->security_policy)
|
||||||
!$compiler->smarty->security_policy->allow_super_globals
|
&& !$compiler->smarty->security_policy->allow_super_globals
|
||||||
) {
|
) {
|
||||||
$compiler->trigger_template_error("(secure mode) super globals not permitted");
|
$compiler->trigger_template_error("(secure mode) super globals not permitted");
|
||||||
break;
|
break;
|
||||||
@@ -66,8 +66,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
|||||||
case 'server':
|
case 'server':
|
||||||
case 'session':
|
case 'session':
|
||||||
case 'request':
|
case 'request':
|
||||||
if (isset($compiler->smarty->security_policy) &&
|
if (isset($compiler->smarty->security_policy)
|
||||||
!$compiler->smarty->security_policy->allow_super_globals
|
&& !$compiler->smarty->security_policy->allow_super_globals
|
||||||
) {
|
) {
|
||||||
$compiler->trigger_template_error("(secure mode) super globals not permitted");
|
$compiler->trigger_template_error("(secure mode) super globals not permitted");
|
||||||
break;
|
break;
|
||||||
@@ -88,8 +88,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
|||||||
return "Smarty::SMARTY_VERSION";
|
return "Smarty::SMARTY_VERSION";
|
||||||
|
|
||||||
case 'const':
|
case 'const':
|
||||||
if (isset($compiler->smarty->security_policy) &&
|
if (isset($compiler->smarty->security_policy)
|
||||||
!$compiler->smarty->security_policy->allow_constants
|
&& !$compiler->smarty->security_policy->allow_constants
|
||||||
) {
|
) {
|
||||||
$compiler->trigger_template_error("(secure mode) constants not permitted");
|
$compiler->trigger_template_error("(secure mode) constants not permitted");
|
||||||
break;
|
break;
|
||||||
|
@@ -28,7 +28,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim
|
|||||||
*/
|
*/
|
||||||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
|
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
|
||||||
{
|
{
|
||||||
parent::compile($args,$compiler);
|
parent::compile($args, $compiler);
|
||||||
return $compiler->smarty->right_delimiter;
|
return $compiler->smarty->right_delimiter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -264,8 +264,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
|||||||
$start_code[ $i ] = '';
|
$start_code[ $i ] = '';
|
||||||
}
|
}
|
||||||
if ($propType[ 'start' ] === 0) {
|
if ($propType[ 'start' ] === 0) {
|
||||||
$start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1,
|
$start_code = array(max(
|
||||||
$propValue[ 'start' ] + $propValue[ 'loop' ]));
|
$propValue[ 'step' ] > 0 ? 0 : - 1,
|
||||||
|
$propValue[ 'start' ] + $propValue[ 'loop' ]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for ($i = 1; $i <= 11; $i ++) {
|
for ($i = 1; $i <= 11; $i ++) {
|
||||||
@@ -273,8 +275,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
|||||||
}
|
}
|
||||||
if ($propType[ 'start' ] === 0) {
|
if ($propType[ 'start' ] === 0) {
|
||||||
$start_code =
|
$start_code =
|
||||||
array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
|
array(min(
|
||||||
$propValue[ 'start' ]));
|
$propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1,
|
||||||
|
$propValue[ 'start' ]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,8 +299,12 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
|
|||||||
$propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
|
$propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ];
|
||||||
if ($propType[ 'total' ] === 0) {
|
if ($propType[ 'total' ] === 0) {
|
||||||
$propValue[ 'total' ] =
|
$propValue[ 'total' ] =
|
||||||
min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
|
min(
|
||||||
(int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]);
|
ceil(
|
||||||
|
($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] :
|
||||||
|
(int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])
|
||||||
|
), $propValue[ 'max' ]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
|
$total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ",
|
||||||
5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
|
5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ',
|
||||||
|
@@ -37,10 +37,12 @@ class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_Compile
|
|||||||
public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
|
public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
|
||||||
{
|
{
|
||||||
if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) {
|
if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) {
|
||||||
$compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
|
$compiler->registerPostCompileCallback(
|
||||||
|
array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
|
||||||
array($initChildSequence),
|
array($initChildSequence),
|
||||||
'inheritanceInit',
|
'inheritanceInit',
|
||||||
$initChildSequence);
|
$initChildSequence
|
||||||
|
);
|
||||||
|
|
||||||
$compiler->_cache['inheritanceInit'] = true;
|
$compiler->_cache['inheritanceInit'] = true;
|
||||||
}
|
}
|
||||||
|
@@ -56,8 +56,10 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
|
|||||||
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
|
||||||
$_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
|
$_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
|
||||||
$_output .= $assignCompiler->compile($assignAttr, $compiler,
|
$_output .= $assignCompiler->compile(
|
||||||
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]));
|
$assignAttr, $compiler,
|
||||||
|
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
|
||||||
$_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
|
$_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";
|
||||||
|
@@ -103,8 +103,10 @@ abstract class Smarty_Internal_CompileBase
|
|||||||
if (isset($this->optionMap[ $v ])) {
|
if (isset($this->optionMap[ $v ])) {
|
||||||
$_indexed_attr[ $k ] = $this->optionMap[ $v ];
|
$_indexed_attr[ $k ] = $this->optionMap[ $v ];
|
||||||
} else {
|
} else {
|
||||||
$compiler->trigger_template_error("illegal value '" . var_export($v, true) .
|
$compiler->trigger_template_error(
|
||||||
"' for option flag '{$k}'", null, true);
|
"illegal value '" . var_export($v, true) .
|
||||||
|
"' for option flag '{$k}'", null, true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// must be named attribute
|
// must be named attribute
|
||||||
@@ -124,8 +126,12 @@ abstract class Smarty_Internal_CompileBase
|
|||||||
if ($this->optional_attributes !== array('_any')) {
|
if ($this->optional_attributes !== array('_any')) {
|
||||||
if (!isset($this->mapCache[ 'all' ])) {
|
if (!isset($this->mapCache[ 'all' ])) {
|
||||||
$this->mapCache[ 'all' ] =
|
$this->mapCache[ 'all' ] =
|
||||||
array_fill_keys(array_merge($this->required_attributes, $this->optional_attributes,
|
array_fill_keys(
|
||||||
$this->option_flags), true);
|
array_merge(
|
||||||
|
$this->required_attributes, $this->optional_attributes,
|
||||||
|
$this->option_flags
|
||||||
|
), true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
foreach ($_indexed_attr as $key => $dummy) {
|
foreach ($_indexed_attr as $key => $dummy) {
|
||||||
if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) {
|
if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) {
|
||||||
|
@@ -114,9 +114,13 @@ class Smarty_Internal_Config_File_Compiler
|
|||||||
}
|
}
|
||||||
// init the lexer/parser to compile the config file
|
// init the lexer/parser to compile the config file
|
||||||
/* @var Smarty_Internal_ConfigFileLexer $this ->lex */
|
/* @var Smarty_Internal_ConfigFileLexer $this ->lex */
|
||||||
$this->lex = new $this->lexer_class(str_replace(array("\r\n",
|
$this->lex = new $this->lexer_class(
|
||||||
"\r"), "\n", $template->source->getContent()) . "\n",
|
str_replace(
|
||||||
$this);
|
array("\r\n",
|
||||||
|
"\r"), "\n", $template->source->getContent()
|
||||||
|
) . "\n",
|
||||||
|
$this
|
||||||
|
);
|
||||||
/* @var Smarty_Internal_ConfigFileParser $this ->parser */
|
/* @var Smarty_Internal_ConfigFileParser $this ->parser */
|
||||||
$this->parser = new $this->parser_class($this->lex, $this);
|
$this->parser = new $this->parser_class($this->lex, $this);
|
||||||
|
|
||||||
|
@@ -166,39 +166,47 @@ class Smarty_Internal_Configfilelexer
|
|||||||
public function yypushstate($state)
|
public function yypushstate($state)
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState push %s\n",
|
"%sState push %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
array_push($this->_yy_stack, $this->_yy_state);
|
array_push($this->_yy_stack, $this->_yy_state);
|
||||||
$this->_yy_state = $state;
|
$this->_yy_state = $state;
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%snew State %s\n",
|
"%snew State %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yypopstate()
|
public function yypopstate()
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState pop %s\n",
|
"%sState pop %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->_yy_state = array_pop($this->_yy_stack);
|
$this->_yy_state = array_pop($this->_yy_stack);
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%snew State %s\n",
|
"%snew State %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,11 +214,13 @@ class Smarty_Internal_Configfilelexer
|
|||||||
{
|
{
|
||||||
$this->_yy_state = $state;
|
$this->_yy_state = $state;
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState set %s\n",
|
"%sState set %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,10 +244,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state START');
|
5
|
||||||
|
) . '... state START'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -262,8 +276,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -332,10 +348,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state VALUE');
|
5
|
||||||
|
) . '... state VALUE'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -360,8 +380,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -404,8 +426,9 @@ class Smarty_Internal_Configfilelexer
|
|||||||
|
|
||||||
function yy_r2_7()
|
function yy_r2_7()
|
||||||
{
|
{
|
||||||
if (!$this->configBooleanize ||
|
if (!$this->configBooleanize
|
||||||
!in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) {
|
|| !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))
|
||||||
|
) {
|
||||||
$this->yypopstate();
|
$this->yypopstate();
|
||||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||||
return true; //reprocess in new state
|
return true; //reprocess in new state
|
||||||
@@ -447,10 +470,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state NAKED_STRING_VALUE');
|
5
|
||||||
|
) . '... state NAKED_STRING_VALUE'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -475,8 +502,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -507,10 +536,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state COMMENT');
|
5
|
||||||
|
) . '... state COMMENT'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -535,8 +568,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -577,10 +612,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state SECTION');
|
5
|
||||||
|
) . '... state SECTION'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -605,8 +644,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -642,10 +683,14 @@ class Smarty_Internal_Configfilelexer
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state TRIPPLE');
|
5
|
||||||
|
) . '... state TRIPPLE'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -670,8 +715,10 @@ class Smarty_Internal_Configfilelexer
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
|
@@ -9,7 +9,7 @@ class TPC_yyStackEntry
|
|||||||
** is the value of the token */
|
** is the value of the token */
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Configfileparse
|
* Smarty Internal Plugin Configfileparse
|
||||||
@@ -23,7 +23,7 @@ class TPC_yyStackEntry
|
|||||||
*/
|
*/
|
||||||
class Smarty_Internal_Configfileparser
|
class Smarty_Internal_Configfileparser
|
||||||
{
|
{
|
||||||
#line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
const TPC_OPENB = 1;
|
const TPC_OPENB = 1;
|
||||||
const TPC_SECTION = 2;
|
const TPC_SECTION = 2;
|
||||||
const TPC_CLOSEB = 3;
|
const TPC_CLOSEB = 3;
|
||||||
@@ -375,9 +375,11 @@ class Smarty_Internal_Configfileparser
|
|||||||
}
|
}
|
||||||
$yytos = array_pop($this->yystack);
|
$yytos = array_pop($this->yystack);
|
||||||
if ($this->yyTraceFILE && $this->yyidx >= 0) {
|
if ($this->yyTraceFILE && $this->yyidx >= 0) {
|
||||||
fwrite($this->yyTraceFILE,
|
fwrite(
|
||||||
|
$this->yyTraceFILE,
|
||||||
$this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] .
|
$this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] .
|
||||||
"\n");
|
"\n"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$yymajor = $yytos->major;
|
$yymajor = $yytos->major;
|
||||||
self::yy_destructor($yymajor, $yytos->minor);
|
self::yy_destructor($yymajor, $yytos->minor);
|
||||||
@@ -429,7 +431,8 @@ class Smarty_Internal_Configfileparser
|
|||||||
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
||||||
$nextstate = $this->yy_find_reduce_action(
|
$nextstate = $this->yy_find_reduce_action(
|
||||||
$this->yystack[ $this->yyidx ]->stateno,
|
$this->yystack[ $this->yyidx ]->stateno,
|
||||||
self::$yyRuleInfo[ $yyruleno ][ 0 ]);
|
self::$yyRuleInfo[ $yyruleno ][ 0 ]
|
||||||
|
);
|
||||||
if (isset(self::$yyExpectedTokens[ $nextstate ])) {
|
if (isset(self::$yyExpectedTokens[ $nextstate ])) {
|
||||||
$expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
|
$expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
|
||||||
if (isset($res4[ $nextstate ][ $token ])) {
|
if (isset($res4[ $nextstate ][ $token ])) {
|
||||||
@@ -439,8 +442,8 @@ class Smarty_Internal_Configfileparser
|
|||||||
return array_unique($expected);
|
return array_unique($expected);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($res4[ $nextstate ][ $token ] =
|
if ($res4[ $nextstate ][ $token ] = in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
|
||||||
in_array($token, self::$yyExpectedTokens[ $nextstate ], true)) {
|
) {
|
||||||
$this->yyidx = $yyidx;
|
$this->yyidx = $yyidx;
|
||||||
$this->yystack = $stack;
|
$this->yystack = $stack;
|
||||||
return array_unique($expected);
|
return array_unique($expected);
|
||||||
@@ -515,7 +518,8 @@ class Smarty_Internal_Configfileparser
|
|||||||
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
$this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
|
||||||
$nextstate = $this->yy_find_reduce_action(
|
$nextstate = $this->yy_find_reduce_action(
|
||||||
$this->yystack[ $this->yyidx ]->stateno,
|
$this->yystack[ $this->yyidx ]->stateno,
|
||||||
self::$yyRuleInfo[ $yyruleno ][ 0 ]);
|
self::$yyRuleInfo[ $yyruleno ][ 0 ]
|
||||||
|
);
|
||||||
if (isset($res2[ $nextstate ][ $token ])) {
|
if (isset($res2[ $nextstate ][ $token ])) {
|
||||||
if ($res2[ $nextstate ][ $token ]) {
|
if ($res2[ $nextstate ][ $token ]) {
|
||||||
$this->yyidx = $yyidx;
|
$this->yyidx = $yyidx;
|
||||||
@@ -523,10 +527,13 @@ class Smarty_Internal_Configfileparser
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
|
if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ])
|
||||||
in_array($token,
|
&& in_array(
|
||||||
|
$token,
|
||||||
self::$yyExpectedTokens[ $nextstate ],
|
self::$yyExpectedTokens[ $nextstate ],
|
||||||
true))) {
|
true
|
||||||
|
))
|
||||||
|
) {
|
||||||
$this->yyidx = $yyidx;
|
$this->yyidx = $yyidx;
|
||||||
$this->yystack = $stack;
|
$this->yystack = $stack;
|
||||||
return true;
|
return true;
|
||||||
@@ -584,15 +591,19 @@ class Smarty_Internal_Configfileparser
|
|||||||
return self::YY_NO_ACTION;
|
return self::YY_NO_ACTION;
|
||||||
}
|
}
|
||||||
$i += $iLookAhead;
|
$i += $iLookAhead;
|
||||||
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
|
if ($i < 0 || $i >= self::YY_SZ_ACTTAB
|
||||||
self::$yy_lookahead[ $i ] != $iLookAhead) {
|
|| self::$yy_lookahead[ $i ] != $iLookAhead
|
||||||
|
) {
|
||||||
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
|
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
|
||||||
&& ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
|
&& ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
|
||||||
|
) {
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fwrite($this->yyTraceFILE,
|
fwrite(
|
||||||
|
$this->yyTraceFILE,
|
||||||
$this->yyTracePrompt . 'FALLBACK ' .
|
$this->yyTracePrompt . 'FALLBACK ' .
|
||||||
$this->yyTokenName[ $iLookAhead ] . ' => ' .
|
$this->yyTokenName[ $iLookAhead ] . ' => ' .
|
||||||
$this->yyTokenName[ $iFallback ] . "\n");
|
$this->yyTokenName[ $iFallback ] . "\n"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return $this->yy_find_shift_action($iFallback);
|
return $this->yy_find_shift_action($iFallback);
|
||||||
}
|
}
|
||||||
@@ -616,8 +627,9 @@ class Smarty_Internal_Configfileparser
|
|||||||
return self::YY_NO_ACTION;
|
return self::YY_NO_ACTION;
|
||||||
}
|
}
|
||||||
$i += $iLookAhead;
|
$i += $iLookAhead;
|
||||||
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
|
if ($i < 0 || $i >= self::YY_SZ_ACTTAB
|
||||||
self::$yy_lookahead[ $i ] != $iLookAhead) {
|
|| self::$yy_lookahead[ $i ] != $iLookAhead
|
||||||
|
) {
|
||||||
return self::$yy_default[ $stateno ];
|
return self::$yy_default[ $stateno ];
|
||||||
} else {
|
} else {
|
||||||
return self::$yy_action[ $i ];
|
return self::$yy_action[ $i ];
|
||||||
@@ -635,7 +647,7 @@ class Smarty_Internal_Configfileparser
|
|||||||
while ($this->yyidx >= 0) {
|
while ($this->yyidx >= 0) {
|
||||||
$this->yy_pop_parser_stack();
|
$this->yy_pop_parser_stack();
|
||||||
}
|
}
|
||||||
#line 239 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 239 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
$this->internalError = true;
|
$this->internalError = true;
|
||||||
$this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
|
$this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
|
||||||
return;
|
return;
|
||||||
@@ -646,15 +658,19 @@ class Smarty_Internal_Configfileparser
|
|||||||
$yytos->minor = $yypMinor;
|
$yytos->minor = $yypMinor;
|
||||||
$this->yystack[] = $yytos;
|
$this->yystack[] = $yytos;
|
||||||
if ($this->yyTraceFILE && $this->yyidx > 0) {
|
if ($this->yyTraceFILE && $this->yyidx > 0) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sShift %d\n",
|
"%sShift %d\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
$yyNewState);
|
$yyNewState
|
||||||
|
);
|
||||||
fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
|
fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
|
||||||
for ($i = 1; $i <= $this->yyidx; $i++) {
|
for ($i = 1; $i <= $this->yyidx; $i++) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
" %s",
|
" %s",
|
||||||
$this->yyTokenName[ $this->yystack[ $i ]->major ]);
|
$this->yyTokenName[ $this->yystack[ $i ]->major ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
fwrite($this->yyTraceFILE, "\n");
|
fwrite($this->yyTraceFILE, "\n");
|
||||||
}
|
}
|
||||||
@@ -677,100 +693,105 @@ class Smarty_Internal_Configfileparser
|
|||||||
$this->_retvalue = null;
|
$this->_retvalue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 245 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 245 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r5()
|
function yy_r5()
|
||||||
{
|
{
|
||||||
if ($this->configReadHidden) {
|
if ($this->configReadHidden) {
|
||||||
$this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor,
|
$this->add_section_vars(
|
||||||
$this->yystack[ $this->yyidx + 0 ]->minor);
|
$this->yystack[ $this->yyidx + -3 ]->minor,
|
||||||
|
$this->yystack[ $this->yyidx + 0 ]->minor
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->_retvalue = null;
|
$this->_retvalue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 250 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 250 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r6()
|
function yy_r6()
|
||||||
{
|
{
|
||||||
$this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
|
$this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 264 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 264 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r7()
|
function yy_r7()
|
||||||
{
|
{
|
||||||
$this->_retvalue =
|
$this->_retvalue =
|
||||||
array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor));
|
array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor));
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 269 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 269 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r8()
|
function yy_r8()
|
||||||
{
|
{
|
||||||
$this->_retvalue = array();
|
$this->_retvalue = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 277 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 277 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r9()
|
function yy_r9()
|
||||||
{
|
{
|
||||||
$this->_retvalue = array('key' => $this->yystack[ $this->yyidx + -2 ]->minor,
|
$this->_retvalue = array('key' => $this->yystack[ $this->yyidx + -2 ]->minor,
|
||||||
'value' => $this->yystack[ $this->yyidx + 0 ]->minor);
|
'value' => $this->yystack[ $this->yyidx + 0 ]->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 281 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 281 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r10()
|
function yy_r10()
|
||||||
{
|
{
|
||||||
$this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor;
|
$this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r11()
|
function yy_r11()
|
||||||
{
|
{
|
||||||
$this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor;
|
$this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 291 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 291 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r12()
|
function yy_r12()
|
||||||
{
|
{
|
||||||
$this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
|
$this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 296 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 296 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r13()
|
function yy_r13()
|
||||||
{
|
{
|
||||||
$this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
|
$this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 300 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 300 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r14()
|
function yy_r14()
|
||||||
{
|
{
|
||||||
$this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
|
$this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 304 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 304 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r15()
|
function yy_r15()
|
||||||
{
|
{
|
||||||
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor);
|
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 308 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 308 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r16()
|
function yy_r16()
|
||||||
{
|
{
|
||||||
$this->_retvalue = '';
|
$this->_retvalue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
function yy_r17()
|
function yy_r17()
|
||||||
{
|
{
|
||||||
$this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
|
$this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
public function yy_reduce($yyruleno)
|
public function yy_reduce($yyruleno)
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE && $yyruleno >= 0
|
if ($this->yyTraceFILE && $yyruleno >= 0
|
||||||
&& $yyruleno < count(self::$yyRuleName)) {
|
&& $yyruleno < count(self::$yyRuleName)
|
||||||
fprintf($this->yyTraceFILE,
|
) {
|
||||||
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sReduce (%d) [%s].\n",
|
"%sReduce (%d) [%s].\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
$yyruleno,
|
$yyruleno,
|
||||||
self::$yyRuleName[ $yyruleno ]);
|
self::$yyRuleName[ $yyruleno ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->_retvalue = $yy_lefthand_side = null;
|
$this->_retvalue = $yy_lefthand_side = null;
|
||||||
if (isset(self::$yyReduceMap[ $yyruleno ])) {
|
if (isset(self::$yyReduceMap[ $yyruleno ])) {
|
||||||
@@ -803,7 +824,7 @@ class Smarty_Internal_Configfileparser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
public function yy_parse_failed()
|
public function yy_parse_failed()
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
@@ -814,10 +835,10 @@ class Smarty_Internal_Configfileparser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
public function yy_syntax_error($yymajor, $TOKEN)
|
public function yy_syntax_error($yymajor, $TOKEN)
|
||||||
{
|
{
|
||||||
#line 232 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 232 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
$this->internalError = true;
|
$this->internalError = true;
|
||||||
$this->yymajor = $yymajor;
|
$this->yymajor = $yymajor;
|
||||||
$this->compiler->trigger_config_file_error();
|
$this->compiler->trigger_config_file_error();
|
||||||
@@ -831,7 +852,7 @@ class Smarty_Internal_Configfileparser
|
|||||||
while ($this->yyidx >= 0) {
|
while ($this->yyidx >= 0) {
|
||||||
$this->yy_pop_parser_stack();
|
$this->yy_pop_parser_stack();
|
||||||
}
|
}
|
||||||
#line 225 "../smarty/lexer/smarty_internal_configfileparser.y"
|
// line 225 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||||
$this->successful = !$this->internalError;
|
$this->successful = !$this->internalError;
|
||||||
$this->internalError = false;
|
$this->internalError = false;
|
||||||
$this->retvalue = $this->_retvalue;
|
$this->retvalue = $this->_retvalue;
|
||||||
@@ -851,15 +872,18 @@ class Smarty_Internal_Configfileparser
|
|||||||
}
|
}
|
||||||
$yyendofinput = ($yymajor == 0);
|
$yyendofinput = ($yymajor == 0);
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sInput %s\n",
|
"%sInput %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
$this->yyTokenName[ $yymajor ]);
|
$this->yyTokenName[ $yymajor ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
$yyact = $this->yy_find_shift_action($yymajor);
|
$yyact = $this->yy_find_shift_action($yymajor);
|
||||||
if ($yymajor < self::YYERRORSYMBOL &&
|
if ($yymajor < self::YYERRORSYMBOL
|
||||||
!$this->yy_is_expected_token($yymajor)) {
|
&& !$this->yy_is_expected_token($yymajor)
|
||||||
|
) {
|
||||||
// force a syntax error
|
// force a syntax error
|
||||||
$yyact = self::YY_ERROR_ACTION;
|
$yyact = self::YY_ERROR_ACTION;
|
||||||
}
|
}
|
||||||
@@ -875,9 +899,11 @@ class Smarty_Internal_Configfileparser
|
|||||||
$this->yy_reduce($yyact - self::YYNSTATE);
|
$this->yy_reduce($yyact - self::YYNSTATE);
|
||||||
} else if ($yyact === self::YY_ERROR_ACTION) {
|
} else if ($yyact === self::YY_ERROR_ACTION) {
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sSyntax Error!\n",
|
"%sSyntax Error!\n",
|
||||||
$this->yyTracePrompt);
|
$this->yyTracePrompt
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (self::YYERRORSYMBOL) {
|
if (self::YYERRORSYMBOL) {
|
||||||
if ($this->yyerrcnt < 0) {
|
if ($this->yyerrcnt < 0) {
|
||||||
@@ -886,10 +912,12 @@ class Smarty_Internal_Configfileparser
|
|||||||
$yymx = $this->yystack[ $this->yyidx ]->major;
|
$yymx = $this->yystack[ $this->yyidx ]->major;
|
||||||
if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) {
|
if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) {
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sDiscard input token %s\n",
|
"%sDiscard input token %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
$this->yyTokenName[ $yymajor ]);
|
$this->yyTokenName[ $yymajor ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->yy_destructor($yymajor, $yytokenvalue);
|
$this->yy_destructor($yymajor, $yytokenvalue);
|
||||||
$yymajor = self::YYNOCODE;
|
$yymajor = self::YYNOCODE;
|
||||||
|
@@ -103,7 +103,11 @@ abstract class Smarty_Internal_Data
|
|||||||
} else {
|
} else {
|
||||||
if ($tpl_var !== '') {
|
if ($tpl_var !== '') {
|
||||||
if ($this->_objType === 2) {
|
if ($this->_objType === 2) {
|
||||||
/** @var Smarty_Internal_Template $this */
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @var Smarty_Internal_Template $this
|
||||||
|
*/
|
||||||
$this->_assignInScope($tpl_var, $value, $nocache);
|
$this->_assignInScope($tpl_var, $value, $nocache);
|
||||||
} else {
|
} else {
|
||||||
$this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
|
$this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache);
|
||||||
@@ -203,8 +207,8 @@ abstract class Smarty_Internal_Data
|
|||||||
* @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
|
* @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
|
||||||
*/
|
*/
|
||||||
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
|
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true,
|
||||||
$error_enable = true)
|
$error_enable = true
|
||||||
{
|
) {
|
||||||
return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
|
return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
/**
|
/**
|
||||||
* Smarty error handler
|
* Smarty error handler
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
@@ -98,12 +97,14 @@ class Smarty_Internal_ErrorHandler
|
|||||||
// or the error was within smarty but masked to be ignored
|
// or the error was within smarty but masked to be ignored
|
||||||
if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
|
if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
|
||||||
if (self::$previousErrorHandler) {
|
if (self::$previousErrorHandler) {
|
||||||
return call_user_func(self::$previousErrorHandler,
|
return call_user_func(
|
||||||
|
self::$previousErrorHandler,
|
||||||
$errno,
|
$errno,
|
||||||
$errstr,
|
$errstr,
|
||||||
$errfile,
|
$errfile,
|
||||||
$errline,
|
$errline,
|
||||||
$errcontext);
|
$errcontext
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
*
|
*
|
||||||
* Load extensions dynamically
|
* Load extensions dynamically
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
@@ -50,7 +49,7 @@ class Smarty_Internal_Extension_Handler
|
|||||||
*/
|
*/
|
||||||
private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
|
private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
|
||||||
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
|
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
|
||||||
'TemplateVars' => 0, 'Literals' => 'Literals',);#
|
'TemplateVars' => 0, 'Literals' => 'Literals',);//
|
||||||
|
|
||||||
private $resolvedProperties = array();
|
private $resolvedProperties = array();
|
||||||
|
|
||||||
@@ -71,8 +70,9 @@ class Smarty_Internal_Extension_Handler
|
|||||||
if (!isset($smarty->ext->$name)) {
|
if (!isset($smarty->ext->$name)) {
|
||||||
if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) {
|
if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) {
|
||||||
$basename = $this->upperCase($match[4]);
|
$basename = $this->upperCase($match[4]);
|
||||||
if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) &&
|
if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ])
|
||||||
is_string($this->_property_info[ $basename ])) {
|
&& is_string($this->_property_info[ $basename ])
|
||||||
|
) {
|
||||||
$class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ];
|
$class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ];
|
||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
$classObj = new $class();
|
$classObj = new $class();
|
||||||
@@ -90,12 +90,18 @@ class Smarty_Internal_Extension_Handler
|
|||||||
if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) {
|
if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) {
|
||||||
$property = isset($this->resolvedProperties['property'][ $basename ]) ?
|
$property = isset($this->resolvedProperties['property'][ $basename ]) ?
|
||||||
$this->resolvedProperties['property'][ $basename ] :
|
$this->resolvedProperties['property'][ $basename ] :
|
||||||
$property = $this->resolvedProperties['property'][ $basename ] = strtolower(join('_',
|
$property = $this->resolvedProperties['property'][ $basename ] = strtolower(
|
||||||
preg_split('/([A-Z][^A-Z]*)/',
|
join(
|
||||||
|
'_',
|
||||||
|
preg_split(
|
||||||
|
'/([A-Z][^A-Z]*)/',
|
||||||
$basename,
|
$basename,
|
||||||
-1,
|
-1,
|
||||||
PREG_SPLIT_NO_EMPTY |
|
PREG_SPLIT_NO_EMPTY |
|
||||||
PREG_SPLIT_DELIM_CAPTURE)));
|
PREG_SPLIT_DELIM_CAPTURE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if ($property !== false) {
|
if ($property !== false) {
|
||||||
if (property_exists($data, $property)) {
|
if (property_exists($data, $property)) {
|
||||||
|
@@ -18,10 +18,11 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S
|
|||||||
*
|
*
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||||
* @param array $filters filters to load automatically
|
* @param array $filters filters to load automatically
|
||||||
* @param string $type "pre", "output", … specify the
|
* @param string $type "pre", "output", … specify
|
||||||
* filter type to set. Defaults to
|
* the filter type to set.
|
||||||
* none treating $filters' keys as
|
* Defaults to none treating
|
||||||
* the appropriate types
|
* $filters' keys as the
|
||||||
|
* appropriate types
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
|
@@ -52,8 +52,8 @@ class Smarty_Internal_Method_Append
|
|||||||
$data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst;
|
$data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(is_array($data->tpl_vars[ $tpl_var ]->value) ||
|
if (!(is_array($data->tpl_vars[ $tpl_var ]->value)
|
||||||
$data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess)
|
|| $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess)
|
||||||
) {
|
) {
|
||||||
settype($data->tpl_vars[ $tpl_var ]->value, 'array');
|
settype($data->tpl_vars[ $tpl_var ]->value, 'array');
|
||||||
}
|
}
|
||||||
|
@@ -35,8 +35,8 @@ class Smarty_Internal_Method_ClearCache
|
|||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null,
|
public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null,
|
||||||
$type = null)
|
$type = null
|
||||||
{
|
) {
|
||||||
$smarty->_clearTemplateCache();
|
$smarty->_clearTemplateCache();
|
||||||
// load cache resource and call clear
|
// load cache resource and call clear
|
||||||
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
|
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
|
||||||
|
@@ -90,18 +90,20 @@ class Smarty_Internal_Method_ClearCompiledTemplate
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$unlink = false;
|
$unlink = false;
|
||||||
if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =
|
if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a =!strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
|
||||||
!strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
|
&& (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ])
|
||||||
(!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) &&
|
&& substr_compare(
|
||||||
substr_compare($_filepath,
|
$_filepath,
|
||||||
$_resource_part_1,
|
$_resource_part_1,
|
||||||
-$_resource_part_1_length,
|
-$_resource_part_1_length,
|
||||||
$_resource_part_1_length) ===
|
$_resource_part_1_length
|
||||||
0) || (isset($_filepath[ $_resource_part_2_length ]) &&
|
) ===0) || (isset($_filepath[ $_resource_part_2_length ])
|
||||||
substr_compare($_filepath,
|
&& substr_compare(
|
||||||
|
$_filepath,
|
||||||
$_resource_part_2,
|
$_resource_part_2,
|
||||||
-$_resource_part_2_length,
|
-$_resource_part_2_length,
|
||||||
$_resource_part_2_length) === 0))
|
$_resource_part_2_length
|
||||||
|
) === 0))
|
||||||
) {
|
) {
|
||||||
if (isset($exp_time)) {
|
if (isset($exp_time)) {
|
||||||
if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) {
|
if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) {
|
||||||
|
@@ -26,8 +26,8 @@ class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_Com
|
|||||||
* @return int number of template files recompiled
|
* @return int number of template files recompiled
|
||||||
*/
|
*/
|
||||||
public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
|
public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
|
||||||
$max_errors = null)
|
$max_errors = null
|
||||||
{
|
) {
|
||||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
|
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -34,8 +34,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
$extension = '.tpl',
|
$extension = '.tpl',
|
||||||
$force_compile = false,
|
$force_compile = false,
|
||||||
$time_limit = 0,
|
$time_limit = 0,
|
||||||
$max_errors = null)
|
$max_errors = null
|
||||||
{
|
) {
|
||||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
|
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
$force_compile,
|
$force_compile,
|
||||||
$time_limit,
|
$time_limit,
|
||||||
$max_errors,
|
$max_errors,
|
||||||
$isConfig = false)
|
$isConfig = false
|
||||||
{
|
) {
|
||||||
// switch off time limit
|
// switch off time limit
|
||||||
if (function_exists('set_time_limit')) {
|
if (function_exists('set_time_limit')) {
|
||||||
@set_time_limit($time_limit);
|
@set_time_limit($time_limit);
|
||||||
@@ -67,8 +67,10 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
|
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
|
||||||
// loop over array of source directories
|
// loop over array of source directories
|
||||||
foreach ($sourceDir as $_dir) {
|
foreach ($sourceDir as $_dir) {
|
||||||
$_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
|
$_dir_1 = new RecursiveDirectoryIterator(
|
||||||
FilesystemIterator::FOLLOW_SYMLINKS : 0);
|
$_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
|
||||||
|
FilesystemIterator::FOLLOW_SYMLINKS : 0
|
||||||
|
);
|
||||||
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
|
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
|
||||||
foreach ($_dir_2 as $_fileinfo) {
|
foreach ($_dir_2 as $_fileinfo) {
|
||||||
$_file = $_fileinfo->getFilename();
|
$_file = $_fileinfo->getFilename();
|
||||||
|
@@ -48,6 +48,7 @@ class Smarty_Internal_Method_ConfigLoad
|
|||||||
* @param string $config_file filename
|
* @param string $config_file filename
|
||||||
* @param mixed $sections array of section names, single
|
* @param mixed $sections array of section names, single
|
||||||
* section or null
|
* section or null
|
||||||
|
|
||||||
* @param int $scope scope into which config variables
|
* @param int $scope scope into which config variables
|
||||||
* shall be loaded
|
* shall be loaded
|
||||||
*
|
*
|
||||||
@@ -76,7 +77,6 @@ class Smarty_Internal_Method_ConfigLoad
|
|||||||
*
|
*
|
||||||
* @param \Smarty_Internal_Template $tpl
|
* @param \Smarty_Internal_Template $tpl
|
||||||
* @param array $new_config_vars
|
* @param array $new_config_vars
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
|
public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars)
|
||||||
{
|
{
|
||||||
|
@@ -32,8 +32,8 @@ class Smarty_Internal_Method_GetTemplateVars
|
|||||||
* @return mixed variable value or or array of variables
|
* @return mixed variable value or or array of variables
|
||||||
*/
|
*/
|
||||||
public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null,
|
public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null,
|
||||||
$searchParents = true)
|
$searchParents = true
|
||||||
{
|
) {
|
||||||
if (isset($varName)) {
|
if (isset($varName)) {
|
||||||
$_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false);
|
$_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false);
|
||||||
if (is_object($_var)) {
|
if (is_object($_var)) {
|
||||||
@@ -82,8 +82,8 @@ class Smarty_Internal_Method_GetTemplateVars
|
|||||||
* @return \Smarty_Variable
|
* @return \Smarty_Variable
|
||||||
*/
|
*/
|
||||||
public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null,
|
public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null,
|
||||||
$searchParents = true, $errorEnable = true)
|
$searchParents = true, $errorEnable = true
|
||||||
{
|
) {
|
||||||
if ($_ptr === null) {
|
if ($_ptr === null) {
|
||||||
$_ptr = $data;
|
$_ptr = $data;
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ class Smarty_Internal_Method_Literals
|
|||||||
*
|
*
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||||
* @param array|string $literals literal or list of literals
|
* @param array|string $literals literal or list of literals
|
||||||
* to add
|
* to addto add
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
@@ -60,7 +60,7 @@ class Smarty_Internal_Method_Literals
|
|||||||
*
|
*
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||||
* @param array|string $literals literal or list of literals
|
* @param array|string $literals literal or list of literals
|
||||||
* to set
|
* to setto set
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
@@ -90,8 +90,10 @@ class Smarty_Internal_Method_Literals
|
|||||||
$error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array();
|
$error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array();
|
||||||
$error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error;
|
$error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error;
|
||||||
if (!empty($error)) {
|
if (!empty($error)) {
|
||||||
throw new SmartyException('User defined literal(s) "' . $error .
|
throw new SmartyException(
|
||||||
'" may not be identical with left or right delimiter');
|
'User defined literal(s) "' . $error .
|
||||||
|
'" may not be identical with left or right delimiter'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$smarty->literals = array_merge((array)$smarty->literals, (array)$literals);
|
$smarty->literals = array_merge((array)$smarty->literals, (array)$literals);
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ class Smarty_Internal_Method_LoadPlugin
|
|||||||
} else {
|
} else {
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
$this->plugin_files[ $file ] = $file;
|
$this->plugin_files[ $file ] = $file;
|
||||||
require_once($file);
|
include_once $file;
|
||||||
return $file;
|
return $file;
|
||||||
} else {
|
} else {
|
||||||
$this->plugin_files[ $file ] = false;
|
$this->plugin_files[ $file ] = false;
|
||||||
@@ -87,7 +87,7 @@ class Smarty_Internal_Method_LoadPlugin
|
|||||||
$file = $_plugin_dir . $name;
|
$file = $_plugin_dir . $name;
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
|
$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
|
||||||
require_once($file);
|
include_once $file;
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
|
$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
|
||||||
@@ -100,7 +100,7 @@ class Smarty_Internal_Method_LoadPlugin
|
|||||||
$file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
|
$file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
|
||||||
$this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
|
$this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
|
||||||
if ($file !== false) {
|
if ($file !== false) {
|
||||||
require_once($file);
|
include_once $file;
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,8 +31,8 @@ class Smarty_Internal_Method_RegisterCacheResource
|
|||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
*/
|
*/
|
||||||
public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name,
|
public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name,
|
||||||
Smarty_CacheResource $resource_handler)
|
Smarty_CacheResource $resource_handler
|
||||||
{
|
) {
|
||||||
$smarty = $obj->_getSmartyObj();
|
$smarty = $obj->_getSmartyObj();
|
||||||
$smarty->registered_cache_resources[ $name ] = $resource_handler;
|
$smarty->registered_cache_resources[ $name ] = $resource_handler;
|
||||||
return $obj;
|
return $obj;
|
||||||
|
@@ -55,16 +55,20 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler
|
|||||||
$default_handler = $source->smarty->default_template_handler_func;
|
$default_handler = $source->smarty->default_template_handler_func;
|
||||||
}
|
}
|
||||||
$_content = $_timestamp = null;
|
$_content = $_timestamp = null;
|
||||||
$_return = call_user_func_array($default_handler,
|
$_return = call_user_func_array(
|
||||||
array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));
|
$default_handler,
|
||||||
|
array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty)
|
||||||
|
);
|
||||||
if (is_string($_return)) {
|
if (is_string($_return)) {
|
||||||
$source->exists = is_file($_return);
|
$source->exists = is_file($_return);
|
||||||
if ($source->exists) {
|
if ($source->exists) {
|
||||||
$source->timestamp = filemtime($_return);
|
$source->timestamp = filemtime($_return);
|
||||||
} else {
|
} else {
|
||||||
throw new SmartyException('Default handler: Unable to load ' .
|
throw new SmartyException(
|
||||||
|
'Default handler: Unable to load ' .
|
||||||
($source->isConfig ? 'config' : 'template') .
|
($source->isConfig ? 'config' : 'template') .
|
||||||
" default file '{$_return}' for '{$source->type}:{$source->name}'");
|
" default file '{$_return}' for '{$source->type}:{$source->name}'"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$source->name = $source->filepath = $_return;
|
$source->name = $source->filepath = $_return;
|
||||||
$source->uid = sha1($source->filepath);
|
$source->uid = sha1($source->filepath);
|
||||||
@@ -75,8 +79,10 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler
|
|||||||
$source->handler = Smarty_Resource::load($source->smarty, 'eval');
|
$source->handler = Smarty_Resource::load($source->smarty, 'eval');
|
||||||
} else {
|
} else {
|
||||||
$source->exists = false;
|
$source->exists = false;
|
||||||
throw new SmartyException('Default handler: No ' . ($source->isConfig ? 'config' : 'template') .
|
throw new SmartyException(
|
||||||
" default content for '{$source->type}:{$source->name}'");
|
'Default handler: No ' . ($source->isConfig ? 'config' : 'template') .
|
||||||
|
" default content for '{$source->type}:{$source->name}'"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -28,16 +28,23 @@ class Smarty_Internal_Method_RegisterObject
|
|||||||
* @param string $object_name
|
* @param string $object_name
|
||||||
* @param object $object the
|
* @param object $object the
|
||||||
* referenced
|
* referenced
|
||||||
* PHP object to
|
* PHP
|
||||||
|
* object
|
||||||
|
* to
|
||||||
* register
|
* register
|
||||||
|
*
|
||||||
* @param array $allowed_methods_properties list of
|
* @param array $allowed_methods_properties list of
|
||||||
* allowed
|
* allowed
|
||||||
* methods
|
* methods
|
||||||
* (empty = all)
|
* (empty
|
||||||
|
* = all)
|
||||||
|
*
|
||||||
* @param bool $format smarty
|
* @param bool $format smarty
|
||||||
* argument
|
* argument
|
||||||
* format, else
|
* format,
|
||||||
|
* else
|
||||||
* traditional
|
* traditional
|
||||||
|
*
|
||||||
* @param array $block_methods list of
|
* @param array $block_methods list of
|
||||||
* block-methods
|
* block-methods
|
||||||
*
|
*
|
||||||
@@ -45,8 +52,8 @@ class Smarty_Internal_Method_RegisterObject
|
|||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object,
|
public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object,
|
||||||
$allowed_methods_properties = array(), $format = true, $block_methods = array())
|
$allowed_methods_properties = array(), $format = true, $block_methods = array()
|
||||||
{
|
) {
|
||||||
$smarty = $obj->_getSmartyObj();
|
$smarty = $obj->_getSmartyObj();
|
||||||
// test if allowed methods callable
|
// test if allowed methods callable
|
||||||
if (!empty($allowed_methods_properties)) {
|
if (!empty($allowed_methods_properties)) {
|
||||||
|
@@ -30,14 +30,15 @@ class Smarty_Internal_Method_RegisterPlugin
|
|||||||
* @param callback $callback PHP callback to register
|
* @param callback $callback PHP callback to register
|
||||||
* @param bool $cacheable if true (default) this
|
* @param bool $cacheable if true (default) this
|
||||||
* function is cache able
|
* function is cache able
|
||||||
|
|
||||||
* @param mixed $cache_attr caching attributes if any
|
* @param mixed $cache_attr caching attributes if any
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
* @throws SmartyException when the plugin tag is invalid
|
* @throws SmartyException when the plugin tag is invalid
|
||||||
*/
|
*/
|
||||||
public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true,
|
public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true,
|
||||||
$cache_attr = null)
|
$cache_attr = null
|
||||||
{
|
) {
|
||||||
$smarty = $obj->_getSmartyObj();
|
$smarty = $obj->_getSmartyObj();
|
||||||
if (isset($smarty->registered_plugins[ $type ][ $name ])) {
|
if (isset($smarty->registered_plugins[ $type ][ $name ])) {
|
||||||
throw new SmartyException("Plugin tag '{$name}' already registered");
|
throw new SmartyException("Plugin tag '{$name}' already registered");
|
||||||
|
@@ -27,9 +27,11 @@ class Smarty_Internal_Method_RegisterResource
|
|||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||||
* @param string $name name of resource type
|
* @param string $name name of resource type
|
||||||
* @param Smarty_Resource|array $resource_handler or instance of
|
* @param Smarty_Resource|array $resource_handler or instance of
|
||||||
* Smarty_Resource, or
|
* Smarty_Resource,
|
||||||
* array of callbacks to
|
* or array of
|
||||||
* handle resource
|
* callbacks to
|
||||||
|
* handle
|
||||||
|
* resource
|
||||||
* (deprecated)
|
* (deprecated)
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
|
@@ -32,10 +32,11 @@ class Smarty_Internal_Method_SetAutoloadFilters
|
|||||||
*
|
*
|
||||||
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
|
||||||
* @param array $filters filters to load automatically
|
* @param array $filters filters to load automatically
|
||||||
* @param string $type "pre", "output", … specify the
|
* @param string $type "pre", "output", … specify
|
||||||
* filter type to set. Defaults to
|
* the filter type to set.
|
||||||
* none treating $filters' keys as
|
* Defaults to none treating
|
||||||
* the appropriate types
|
* $filters' keys as the
|
||||||
|
* appropriate types
|
||||||
*
|
*
|
||||||
* @return \Smarty|\Smarty_Internal_Template
|
* @return \Smarty|\Smarty_Internal_Template
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
|
@@ -32,7 +32,7 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil
|
|||||||
if (isset($smarty->registered_filters[ $type ])) {
|
if (isset($smarty->registered_filters[ $type ])) {
|
||||||
$_filter_name = "smarty_{$type}filter_{$name}";
|
$_filter_name = "smarty_{$type}filter_{$name}";
|
||||||
if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
|
if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) {
|
||||||
unset ($smarty->registered_filters[ $type ][ $_filter_name ]);
|
unset($smarty->registered_filters[ $type ][ $_filter_name ]);
|
||||||
if (empty($smarty->registered_filters[ $type ])) {
|
if (empty($smarty->registered_filters[ $type ])) {
|
||||||
unset($smarty->registered_filters[ $type ]);
|
unset($smarty->registered_filters[ $type ]);
|
||||||
}
|
}
|
||||||
|
@@ -40,17 +40,21 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
|
|||||||
public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
|
public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
|
||||||
{
|
{
|
||||||
$last_subtree = count($this->subtrees) - 1;
|
$last_subtree = count($this->subtrees) - 1;
|
||||||
if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag &&
|
if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag
|
||||||
$this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
|
&& $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
|
||||||
) {
|
) {
|
||||||
if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
|
if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
|
||||||
$this->subtrees[ $last_subtree ]->data =
|
$this->subtrees[ $last_subtree ]->data =
|
||||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
|
$parser->compiler->appendCode(
|
||||||
'<?php echo ' . $subtree->data . ';?>');
|
$this->subtrees[ $last_subtree ]->data,
|
||||||
|
'<?php echo ' . $subtree->data . ';?>'
|
||||||
|
);
|
||||||
} elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
|
} elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
|
||||||
$this->subtrees[ $last_subtree ]->data =
|
$this->subtrees[ $last_subtree ]->data =
|
||||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
|
$parser->compiler->appendCode(
|
||||||
'<?php echo "' . $subtree->data . '";?>');
|
$this->subtrees[ $last_subtree ]->data,
|
||||||
|
'<?php echo "' . $subtree->data . '";?>'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->subtrees[ $last_subtree ]->data =
|
$this->subtrees[ $last_subtree ]->data =
|
||||||
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
|
$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
|
||||||
|
@@ -28,7 +28,6 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create root of parse tree for template elements
|
* Create root of parse tree for template elements
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -101,8 +100,10 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
|
|||||||
if ($subtree === '') {
|
if ($subtree === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n",
|
$code .= preg_replace(
|
||||||
$subtree);
|
'/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n",
|
||||||
|
$subtree
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
|
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
|
||||||
|
@@ -35,11 +35,11 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
|||||||
return is_file($file) ? $file : false;
|
return is_file($file) ? $file : false;
|
||||||
}
|
}
|
||||||
// go relative to a given template?
|
// go relative to a given template?
|
||||||
if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() &&
|
if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl()
|
||||||
preg_match('#^[.]{1,2}[\\\/]#', $file)
|
&& preg_match('#^[.]{1,2}[\\\/]#', $file)
|
||||||
) {
|
) {
|
||||||
if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' &&
|
if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends'
|
||||||
!isset($_template->parent->_cache[ 'allow_relative_path' ])
|
&& !isset($_template->parent->_cache[ 'allow_relative_path' ])
|
||||||
) {
|
) {
|
||||||
throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
|
throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
|
||||||
}
|
}
|
||||||
@@ -124,8 +124,10 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
|||||||
$source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
|
$source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
|
||||||
}
|
}
|
||||||
$source->exists = true;
|
$source->exists = true;
|
||||||
$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
|
$source->uid = sha1(
|
||||||
$source->smarty->_joined_template_dir));
|
$source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
|
||||||
|
$source->smarty->_joined_template_dir)
|
||||||
|
);
|
||||||
$source->timestamp = filemtime($source->filepath);
|
$source->timestamp = filemtime($source->filepath);
|
||||||
} else {
|
} else {
|
||||||
$source->timestamp = $source->exists = false;
|
$source->timestamp = $source->exists = false;
|
||||||
@@ -160,8 +162,10 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
|||||||
if ($source->exists) {
|
if ($source->exists) {
|
||||||
return file_get_contents($source->filepath);
|
return file_get_contents($source->filepath);
|
||||||
}
|
}
|
||||||
throw new SmartyException('Unable to read ' . ($source->isConfig ? 'config' : 'template') .
|
throw new SmartyException(
|
||||||
" {$source->type} '{$source->name}'");
|
'Unable to read ' . ($source->isConfig ? 'config' : 'template') .
|
||||||
|
" {$source->type} '{$source->name}'"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -88,8 +88,10 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
|||||||
throw new SmartyException('PHP templates are disabled');
|
throw new SmartyException('PHP templates are disabled');
|
||||||
}
|
}
|
||||||
if (!$source->exists) {
|
if (!$source->exists) {
|
||||||
throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'" .
|
throw new SmartyException(
|
||||||
($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : ''));
|
"Unable to load template '{$source->type}:{$source->name}'" .
|
||||||
|
($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare variables
|
// prepare variables
|
||||||
@@ -99,11 +101,14 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
|||||||
if (function_exists('ini_set')) {
|
if (function_exists('ini_set')) {
|
||||||
ini_set('short_open_tag', '1');
|
ini_set('short_open_tag', '1');
|
||||||
}
|
}
|
||||||
/** @var Smarty_Internal_Template $_smarty_template
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @var Smarty_Internal_Template $_smarty_template
|
||||||
* used in included file
|
* used in included file
|
||||||
*/
|
*/
|
||||||
$_smarty_template = $_template;
|
$_smarty_template = $_template;
|
||||||
include($source->filepath);
|
include $source->filepath;
|
||||||
if (function_exists('ini_set')) {
|
if (function_exists('ini_set')) {
|
||||||
ini_set('short_open_tag', $this->short_open_tag);
|
ini_set('short_open_tag', $this->short_open_tag);
|
||||||
}
|
}
|
||||||
|
@@ -58,8 +58,10 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
|
|||||||
{
|
{
|
||||||
// return timestamp
|
// return timestamp
|
||||||
$time_stamp = false;
|
$time_stamp = false;
|
||||||
call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
|
call_user_func_array(
|
||||||
array($source->name, &$time_stamp, $source->smarty));
|
$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;
|
return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
|
||||||
}
|
}
|
||||||
@@ -76,8 +78,10 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
|
|||||||
{
|
{
|
||||||
// return template string
|
// return template string
|
||||||
$content = null;
|
$content = null;
|
||||||
$t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
|
$t = call_user_func_array(
|
||||||
array($source->name, &$content, $source->smarty));
|
$source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
|
||||||
|
array($source->name, &$content, $source->smarty)
|
||||||
|
);
|
||||||
if (is_bool($t) && !$t) {
|
if (is_bool($t) && !$t) {
|
||||||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
class Smarty_Internal_Runtime_CacheModify
|
class Smarty_Internal_Runtime_CacheModify
|
||||||
{
|
{
|
||||||
@@ -34,7 +33,7 @@ class Smarty_Internal_Runtime_CacheModify
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'cli':
|
case 'cli':
|
||||||
if ( /* ^phpunit */
|
if (/* ^phpunit */
|
||||||
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
||||||
) {
|
) {
|
||||||
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
|
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
|
||||||
@@ -42,7 +41,7 @@ class Smarty_Internal_Runtime_CacheModify
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if ( /* ^phpunit */
|
if (/* ^phpunit */
|
||||||
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
||||||
) {
|
) {
|
||||||
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
|
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified';
|
||||||
@@ -54,7 +53,7 @@ class Smarty_Internal_Runtime_CacheModify
|
|||||||
} else {
|
} else {
|
||||||
switch (PHP_SAPI) {
|
switch (PHP_SAPI) {
|
||||||
case 'cli':
|
case 'cli':
|
||||||
if ( /* ^phpunit */
|
if (/* ^phpunit */
|
||||||
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
!empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */
|
||||||
) {
|
) {
|
||||||
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] =
|
$_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] =
|
||||||
|
@@ -88,8 +88,8 @@ class Smarty_Internal_Runtime_CacheResourceFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check compile id
|
// check compile id
|
||||||
if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) ||
|
if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ])
|
||||||
$_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id)
|
|| $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -26,8 +26,8 @@ class Smarty_Internal_Runtime_CodeFrame
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false,
|
public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false,
|
||||||
Smarty_Internal_TemplateCompilerBase $compiler = null)
|
Smarty_Internal_TemplateCompilerBase $compiler = null
|
||||||
{
|
) {
|
||||||
// build property code
|
// build property code
|
||||||
$properties[ 'version' ] = Smarty::SMARTY_VERSION;
|
$properties[ 'version' ] = Smarty::SMARTY_VERSION;
|
||||||
$properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
|
$properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
|
||||||
@@ -42,7 +42,7 @@ class Smarty_Internal_Runtime_CodeFrame
|
|||||||
}
|
}
|
||||||
$output = "<?php\n";
|
$output = "<?php\n";
|
||||||
$output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
|
$output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") .
|
||||||
"\n from '" . str_replace('*/','* /',$_template->source->filepath) . "' */\n\n";
|
"\n from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n";
|
||||||
$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
|
$output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n";
|
||||||
$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
|
$dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
|
||||||
($cache ? 'true' : 'false') . ')';
|
($cache ? 'true' : 'false') . ')';
|
||||||
@@ -65,11 +65,15 @@ class Smarty_Internal_Runtime_CodeFrame
|
|||||||
$output .= "<?php }\n";
|
$output .= "<?php }\n";
|
||||||
// remove unneeded PHP tags
|
// remove unneeded PHP tags
|
||||||
if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) {
|
if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) {
|
||||||
$curr_split = preg_split('/\s*\?>[\n]?<\?php\s*/',
|
$curr_split = preg_split(
|
||||||
$output);
|
'/\s*\?>[\n]?<\?php\s*/',
|
||||||
preg_match_all('/\s*\?>[\n]?<\?php\s*/',
|
$output
|
||||||
|
);
|
||||||
|
preg_match_all(
|
||||||
|
'/\s*\?>[\n]?<\?php\s*/',
|
||||||
$output,
|
$output,
|
||||||
$curr_parts);
|
$curr_parts
|
||||||
|
);
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach ($curr_split as $idx => $curr_output) {
|
foreach ($curr_split as $idx => $curr_output) {
|
||||||
$output .= $curr_output;
|
$output .= $curr_output;
|
||||||
@@ -79,8 +83,10 @@ class Smarty_Internal_Runtime_CodeFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preg_match('/\?>\s*$/', $output)) {
|
if (preg_match('/\?>\s*$/', $output)) {
|
||||||
$curr_split = preg_split('/\?>\s*$/',
|
$curr_split = preg_split(
|
||||||
$output);
|
'/\?>\s*$/',
|
||||||
|
$output
|
||||||
|
);
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach ($curr_split as $idx => $curr_output) {
|
foreach ($curr_split as $idx => $curr_output) {
|
||||||
$output .= $curr_output;
|
$output .= $curr_output;
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Runtime_Foreach
|
class Smarty_Internal_Runtime_Foreach
|
||||||
{
|
{
|
||||||
@@ -35,8 +34,8 @@ class Smarty_Internal_Runtime_Foreach
|
|||||||
* @return mixed $from
|
* @return mixed $from
|
||||||
*/
|
*/
|
||||||
public function init(Smarty_Internal_Template $tpl, $from, $item, $needTotal = false, $key = null, $name = null,
|
public function init(Smarty_Internal_Template $tpl, $from, $item, $needTotal = false, $key = null, $name = null,
|
||||||
$properties = array())
|
$properties = array()
|
||||||
{
|
) {
|
||||||
$needTotal = $needTotal || isset($properties[ 'total' ]);
|
$needTotal = $needTotal || isset($properties[ 'total' ]);
|
||||||
$saveVars = array();
|
$saveVars = array();
|
||||||
$total = null;
|
$total = null;
|
||||||
@@ -97,7 +96,6 @@ class Smarty_Internal_Runtime_Foreach
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* [util function] counts an array, arrayAccess/traversable or PDOStatement object
|
* [util function] counts an array, arrayAccess/traversable or PDOStatement object
|
||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
@@ -109,13 +109,11 @@ class Smarty_Internal_Runtime_GetIncludePath
|
|||||||
* @param \Smarty $smarty
|
* @param \Smarty $smarty
|
||||||
*
|
*
|
||||||
* @return bool|string full filepath or false
|
* @return bool|string full filepath or false
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function getIncludePath($dirs, $file, Smarty $smarty)
|
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 = false)) {
|
||||||
if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
|
if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = function_exists('stream_resolve_include_path'))
|
||||||
$this->_has_stream_include = function_exists('stream_resolve_include_path'))
|
|
||||||
) {
|
) {
|
||||||
$this->isNewIncludePath($smarty);
|
$this->isNewIncludePath($smarty);
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
class Smarty_Internal_Runtime_Inheritance
|
class Smarty_Internal_Runtime_Inheritance
|
||||||
{
|
{
|
||||||
@@ -64,7 +63,6 @@ class Smarty_Internal_Runtime_Inheritance
|
|||||||
* @param \Smarty_Internal_Template $tpl template object of caller
|
* @param \Smarty_Internal_Template $tpl template object of caller
|
||||||
* @param bool $initChild if true init for child template
|
* @param bool $initChild if true init for child template
|
||||||
* @param array $blockNames outer level block name
|
* @param array $blockNames outer level block name
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
|
public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
|
||||||
{
|
{
|
||||||
@@ -113,9 +111,11 @@ class Smarty_Internal_Runtime_Inheritance
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->state = 2;
|
$this->state = 2;
|
||||||
}
|
}
|
||||||
if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') ||
|
if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends')
|
||||||
$tpl->smarty->extends_recursion)) {
|
|| $tpl->smarty->extends_recursion)
|
||||||
$tpl->_subTemplateRender($template,
|
) {
|
||||||
|
$tpl->_subTemplateRender(
|
||||||
|
$template,
|
||||||
$tpl->cache_id,
|
$tpl->cache_id,
|
||||||
$tpl->compile_id,
|
$tpl->compile_id,
|
||||||
$tpl->caching ? 9999 : 0,
|
$tpl->caching ? 9999 : 0,
|
||||||
@@ -124,7 +124,8 @@ class Smarty_Internal_Runtime_Inheritance
|
|||||||
2,
|
2,
|
||||||
false,
|
false,
|
||||||
$uid,
|
$uid,
|
||||||
$func);
|
$func
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,8 +168,8 @@ class Smarty_Internal_Runtime_Inheritance
|
|||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block,
|
public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block,
|
||||||
Smarty_Internal_Block $parent = null)
|
Smarty_Internal_Block $parent = null
|
||||||
{
|
) {
|
||||||
if ($block->hide && !isset($block->child)) {
|
if ($block->hide && !isset($block->child)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -187,8 +188,8 @@ class Smarty_Internal_Runtime_Inheritance
|
|||||||
if ($block->prepend && isset($parent)) {
|
if ($block->prepend && isset($parent)) {
|
||||||
$this->callParent($tpl, $block, '{block prepend}');
|
$this->callParent($tpl, $block, '{block prepend}');
|
||||||
if ($block->append) {
|
if ($block->append) {
|
||||||
if ($block->callsChild || !isset($block->child) ||
|
if ($block->callsChild || !isset($block->child)
|
||||||
($block->child->hide && !isset($block->child->child))
|
|| ($block->child->hide && !isset($block->child->child))
|
||||||
) {
|
) {
|
||||||
$this->callBlock($block, $tpl);
|
$this->callBlock($block, $tpl);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Runtime_Make_Nocache
|
class Smarty_Internal_Runtime_Make_Nocache
|
||||||
{
|
{
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
class Smarty_Internal_Runtime_TplFunction
|
class Smarty_Internal_Runtime_TplFunction
|
||||||
{
|
{
|
||||||
@@ -36,14 +35,14 @@ class Smarty_Internal_Runtime_TplFunction
|
|||||||
}
|
}
|
||||||
if (function_exists($function)) {
|
if (function_exists($function)) {
|
||||||
$this->saveTemplateVariables($tpl, $name);
|
$this->saveTemplateVariables($tpl, $name);
|
||||||
$function ($tpl, $params);
|
$function($tpl, $params);
|
||||||
$this->restoreTemplateVariables($tpl, $name);
|
$this->restoreTemplateVariables($tpl, $name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// try to load template function dynamically
|
// try to load template function dynamically
|
||||||
if ($this->addTplFuncToCache($tpl, $name, $function)) {
|
if ($this->addTplFuncToCache($tpl, $name, $function)) {
|
||||||
$this->saveTemplateVariables($tpl, $name);
|
$this->saveTemplateVariables($tpl, $name);
|
||||||
$function ($tpl, $params);
|
$function($tpl, $params);
|
||||||
$this->restoreTemplateVariables($tpl, $name);
|
$this->restoreTemplateVariables($tpl, $name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -90,7 +89,6 @@ class Smarty_Internal_Runtime_TplFunction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Add template function to cache file for nocache calls
|
* Add template function to cache file for nocache calls
|
||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $tpl
|
* @param Smarty_Internal_Template $tpl
|
||||||
@@ -126,11 +124,15 @@ class Smarty_Internal_Runtime_TplFunction
|
|||||||
if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
|
if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
|
||||||
$content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
|
$content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
|
||||||
}
|
}
|
||||||
$tplPtr->smarty->ext->_updateCache->write($tplPtr,
|
$tplPtr->smarty->ext->_updateCache->write(
|
||||||
|
$tplPtr,
|
||||||
preg_replace('/\s*\?>\s*$/', "\n", $content) .
|
preg_replace('/\s*\?>\s*$/', "\n", $content) .
|
||||||
"\n" . preg_replace(array('/^\s*<\?php\s+/',
|
"\n" . preg_replace(
|
||||||
|
array('/^\s*<\?php\s+/',
|
||||||
'/\s*\?>\s*$/',), "\n",
|
'/\s*\?>\s*$/',), "\n",
|
||||||
$match[ 0 ]));
|
$match[ 0 ]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
class Smarty_Internal_Runtime_UpdateCache
|
class Smarty_Internal_Runtime_UpdateCache
|
||||||
{
|
{
|
||||||
@@ -67,8 +66,8 @@ class Smarty_Internal_Runtime_UpdateCache
|
|||||||
*/
|
*/
|
||||||
public function removeNoCacheHash(Smarty_Template_Cached $cached,
|
public function removeNoCacheHash(Smarty_Template_Cached $cached,
|
||||||
Smarty_Internal_Template $_template,
|
Smarty_Internal_Template $_template,
|
||||||
$no_output_filter)
|
$no_output_filter
|
||||||
{
|
) {
|
||||||
$php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/';
|
$php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/';
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
$hash_array = $cached->hashes;
|
$hash_array = $cached->hashes;
|
||||||
@@ -78,22 +77,30 @@ class Smarty_Internal_Runtime_UpdateCache
|
|||||||
$_template->cached->has_nocache_code = false;
|
$_template->cached->has_nocache_code = false;
|
||||||
// get text between non-cached items
|
// get text between non-cached items
|
||||||
$cache_split =
|
$cache_split =
|
||||||
preg_split("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
preg_split(
|
||||||
$content);
|
"!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||||
|
$content
|
||||||
|
);
|
||||||
// get non-cached items
|
// get non-cached items
|
||||||
preg_match_all("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
preg_match_all(
|
||||||
|
"!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||||
$content,
|
$content,
|
||||||
$cache_parts);
|
$cache_parts
|
||||||
|
);
|
||||||
$content = '';
|
$content = '';
|
||||||
// loop over items, stitch back together
|
// loop over items, stitch back together
|
||||||
foreach ($cache_split as $curr_idx => $curr_split) {
|
foreach ($cache_split as $curr_idx => $curr_split) {
|
||||||
if (preg_match($php_pattern, $curr_split)) {
|
if (preg_match($php_pattern, $curr_split)) {
|
||||||
// escape PHP tags in template content
|
// escape PHP tags in template content
|
||||||
$php_split = preg_split($php_pattern,
|
$php_split = preg_split(
|
||||||
$curr_split);
|
$php_pattern,
|
||||||
preg_match_all($php_pattern,
|
$curr_split
|
||||||
|
);
|
||||||
|
preg_match_all(
|
||||||
|
$php_pattern,
|
||||||
$curr_split,
|
$curr_split,
|
||||||
$php_parts);
|
$php_parts
|
||||||
|
);
|
||||||
foreach ($php_split as $idx_php => $curr_php) {
|
foreach ($php_split as $idx_php => $curr_php) {
|
||||||
$content .= $curr_php;
|
$content .= $curr_php;
|
||||||
if (isset($php_parts[ 0 ][ $idx_php ])) {
|
if (isset($php_parts[ 0 ][ $idx_php ])) {
|
||||||
@@ -108,9 +115,9 @@ class Smarty_Internal_Runtime_UpdateCache
|
|||||||
$content .= $cache_parts[ 2 ][ $curr_idx ];
|
$content .= $cache_parts[ 2 ][ $curr_idx ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$no_output_filter && !$_template->cached->has_nocache_code &&
|
if (!$no_output_filter && !$_template->cached->has_nocache_code
|
||||||
(isset($_template->smarty->autoload_filters[ 'output' ]) ||
|
&& (isset($_template->smarty->autoload_filters[ 'output' ])
|
||||||
isset($_template->smarty->registered_filters[ 'output' ]))
|
|| isset($_template->smarty->registered_filters[ 'output' ]))
|
||||||
) {
|
) {
|
||||||
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
|
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage PluginsInternal
|
* @subpackage PluginsInternal
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
class Smarty_Internal_Runtime_UpdateScope
|
class Smarty_Internal_Runtime_UpdateScope
|
||||||
{
|
{
|
||||||
@@ -17,14 +16,14 @@ class Smarty_Internal_Runtime_UpdateScope
|
|||||||
* @param Smarty_Internal_Template $tpl data object
|
* @param Smarty_Internal_Template $tpl data object
|
||||||
* @param string|null $varName variable name
|
* @param string|null $varName variable name
|
||||||
* @param int $tagScope tag scope to which bubble up variable value
|
* @param int $tagScope tag scope to which bubble up variable value
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
|
public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
|
||||||
{
|
{
|
||||||
if ($tagScope) {
|
if ($tagScope) {
|
||||||
$this->_updateVarStack($tpl, $varName);
|
$this->_updateVarStack($tpl, $varName);
|
||||||
$tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
|
$tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
|
||||||
if (!$tpl->scope && !$tagScope) return;
|
if (!$tpl->scope && !$tagScope) { return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$mergedScope = $tagScope | $tpl->scope;
|
$mergedScope = $tagScope | $tpl->scope;
|
||||||
if ($mergedScope) {
|
if ($mergedScope) {
|
||||||
@@ -35,7 +34,8 @@ class Smarty_Internal_Runtime_UpdateScope
|
|||||||
foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
|
foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
|
||||||
$this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
|
$this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
|
||||||
if($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {
|
if($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) {
|
||||||
$this->_updateVarStack($ptr, $varName); }
|
$this->_updateVarStack($ptr, $varName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -89,9 +89,15 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
|||||||
then written to compiled files. */
|
then written to compiled files. */
|
||||||
// init the lexer/parser to compile the template
|
// init the lexer/parser to compile the template
|
||||||
$this->parser =
|
$this->parser =
|
||||||
new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n",
|
new $this->parser_class(
|
||||||
"\r"), "\n", $_content), $this),
|
new $this->lexer_class(
|
||||||
$this);
|
str_replace(
|
||||||
|
array("\r\n",
|
||||||
|
"\r"), "\n", $_content
|
||||||
|
), $this
|
||||||
|
),
|
||||||
|
$this
|
||||||
|
);
|
||||||
if ($isTemplateSource && $this->template->caching) {
|
if ($isTemplateSource && $this->template->caching) {
|
||||||
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
|
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
|
||||||
}
|
}
|
||||||
@@ -127,8 +133,10 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
|||||||
if (count($this->_tag_stack) > 0) {
|
if (count($this->_tag_stack) > 0) {
|
||||||
// get stacked info
|
// get stacked info
|
||||||
list($openTag, $_data) = array_pop($this->_tag_stack);
|
list($openTag, $_data) = array_pop($this->_tag_stack);
|
||||||
$this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag .
|
$this->trigger_template_error(
|
||||||
"{$this->smarty->right_delimiter} tag");
|
"unclosed {$this->smarty->left_delimiter}" . $openTag .
|
||||||
|
"{$this->smarty->right_delimiter} tag"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// call post compile callbacks
|
// call post compile callbacks
|
||||||
foreach ($this->postCompileCallbacks as $cb) {
|
foreach ($this->postCompileCallbacks as $cb) {
|
||||||
@@ -148,7 +156,6 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
|||||||
* @param array $parameter optional parameter array
|
* @param array $parameter optional parameter array
|
||||||
* @param string $key optional key for callback
|
* @param string $key optional key for callback
|
||||||
* @param bool $replace if true replace existing keyed callback
|
* @param bool $replace if true replace existing keyed callback
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
|
public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false)
|
||||||
{
|
{
|
||||||
|
@@ -145,8 +145,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null,
|
public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null,
|
||||||
$_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null,
|
$_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null,
|
||||||
$_isConfig = false)
|
$_isConfig = false
|
||||||
{
|
) {
|
||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
// Smarty parameter
|
// Smarty parameter
|
||||||
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
|
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
|
||||||
@@ -184,8 +184,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
}
|
}
|
||||||
// checks if template exists
|
// checks if template exists
|
||||||
if (!$this->source->exists) {
|
if (!$this->source->exists) {
|
||||||
throw new SmartyException("Unable to load template '{$this->source->type}:{$this->source->name}'" .
|
throw new SmartyException(
|
||||||
($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : ''));
|
"Unable to load template '{$this->source->type}:{$this->source->name}'" .
|
||||||
|
($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// disable caching for evaluated code
|
// disable caching for evaluated code
|
||||||
if ($this->source->handler->recompiled) {
|
if ($this->source->handler->recompiled) {
|
||||||
@@ -193,8 +195,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
}
|
}
|
||||||
// read from cache or render
|
// read from cache or render
|
||||||
if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) {
|
if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) {
|
||||||
if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id ||
|
if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id
|
||||||
$this->cached->compile_id !== $this->compile_id
|
|| $this->cached->compile_id !== $this->compile_id
|
||||||
) {
|
) {
|
||||||
$this->loadCached(true);
|
$this->loadCached(true);
|
||||||
}
|
}
|
||||||
@@ -209,12 +211,14 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
// display or fetch
|
// display or fetch
|
||||||
if ($display) {
|
if ($display) {
|
||||||
if ($this->caching && $this->smarty->cache_modified_check) {
|
if ($this->caching && $this->smarty->cache_modified_check) {
|
||||||
$this->smarty->ext->_cacheModify->cacheModifiedCheck($this->cached, $this,
|
$this->smarty->ext->_cacheModify->cacheModifiedCheck(
|
||||||
isset($content) ? $content : ob_get_clean());
|
$this->cached, $this,
|
||||||
|
isset($content) ? $content : ob_get_clean()
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
|
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
||||||
!$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) ||
|
&& !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ])
|
||||||
isset($this->smarty->registered_filters[ 'output' ]))
|
|| isset($this->smarty->registered_filters[ 'output' ]))
|
||||||
) {
|
) {
|
||||||
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
||||||
} else {
|
} else {
|
||||||
@@ -234,10 +238,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$this->smarty->_debug->display_debug($this, true);
|
$this->smarty->_debug->display_debug($this, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$no_output_filter &&
|
if (!$no_output_filter
|
||||||
(!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
|
&& (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
|
||||||
(isset($this->smarty->autoload_filters[ 'output' ]) ||
|
&& (isset($this->smarty->autoload_filters[ 'output' ])
|
||||||
isset($this->smarty->registered_filters[ 'output' ]))
|
|| isset($this->smarty->registered_filters[ 'output' ]))
|
||||||
) {
|
) {
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
|
||||||
}
|
}
|
||||||
@@ -264,8 +268,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope,
|
public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope,
|
||||||
$forceTplCache, $uid = null, $content_func = null)
|
$forceTplCache, $uid = null, $content_func = null
|
||||||
{
|
) {
|
||||||
$tpl = clone $this;
|
$tpl = clone $this;
|
||||||
$tpl->parent = $this;
|
$tpl->parent = $this;
|
||||||
$smarty = &$this->smarty;
|
$smarty = &$this->smarty;
|
||||||
@@ -322,9 +326,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$tpl->scope = $scope;
|
$tpl->scope = $scope;
|
||||||
if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) {
|
if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) {
|
||||||
// check if template object should be cached
|
// check if template object should be cached
|
||||||
if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) &&
|
if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ])
|
||||||
self::$subTplInfo[ $tpl->template_resource ] > 1) ||
|
&& self::$subTplInfo[ $tpl->template_resource ] > 1)
|
||||||
($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ]))
|
|| ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ]))
|
||||||
) {
|
) {
|
||||||
self::$tplObjCache[ $tpl->templateId ] = $tpl;
|
self::$tplObjCache[ $tpl->templateId ] = $tpl;
|
||||||
}
|
}
|
||||||
@@ -369,7 +373,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get called sub-templates and save call count
|
* Get called sub-templates and save call count
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _subTemplateRegister()
|
public function _subTemplateRegister()
|
||||||
{
|
{
|
||||||
@@ -399,7 +402,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
* @param mixed $value value
|
* @param mixed $value value
|
||||||
* @param bool $nocache nocache flag
|
* @param bool $nocache nocache flag
|
||||||
* @param int $scope scope into which variable shall be assigned
|
* @param int $scope scope into which variable shall be assigned
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _assignInScope($varName, $value, $nocache = false, $scope = 0)
|
public function _assignInScope($varName, $value, $nocache = false, $scope = 0)
|
||||||
{
|
{
|
||||||
@@ -426,14 +428,15 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function _checkPlugins($plugins) {
|
public function _checkPlugins($plugins)
|
||||||
|
{
|
||||||
static $checked = array();
|
static $checked = array();
|
||||||
foreach($plugins as $plugin) {
|
foreach($plugins as $plugin) {
|
||||||
$name = join('::', (array)$plugin[ 'function' ]);
|
$name = join('::', (array)$plugin[ 'function' ]);
|
||||||
if (!isset($checked[$name])) {
|
if (!isset($checked[$name])) {
|
||||||
if (!is_callable($plugin['function'])) {
|
if (!is_callable($plugin['function'])) {
|
||||||
if (is_file($plugin['file'])) {
|
if (is_file($plugin['file'])) {
|
||||||
require_once $plugin['file'];
|
include_once $plugin['file'];
|
||||||
if (is_callable($plugin['function'])) {
|
if (is_callable($plugin['function'])) {
|
||||||
$checked[ $name ] = true;
|
$checked[ $name ] = true;
|
||||||
}
|
}
|
||||||
@@ -476,8 +479,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$is_valid = true;
|
$is_valid = true;
|
||||||
if (!empty($properties[ 'file_dependency' ]) &&
|
if (!empty($properties[ 'file_dependency' ])
|
||||||
((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON)
|
&& ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON)
|
||||||
) {
|
) {
|
||||||
// check file dependencies at compiled code
|
// check file dependencies at compiled code
|
||||||
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
||||||
@@ -507,8 +510,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
}
|
}
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
// CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
|
// CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
|
||||||
if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 &&
|
if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0
|
||||||
(time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ]))
|
&& (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ]))
|
||||||
) {
|
) {
|
||||||
$is_valid = false;
|
$is_valid = false;
|
||||||
}
|
}
|
||||||
@@ -596,7 +599,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load inheritance object
|
* Load inheritance object
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _loadInheritance()
|
public function _loadInheritance()
|
||||||
{
|
{
|
||||||
@@ -607,7 +609,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload inheritance object
|
* Unload inheritance object
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function _cleanUp()
|
public function _cleanUp()
|
||||||
{
|
{
|
||||||
@@ -627,8 +628,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
$this->smarty->loadPlugin($this->source->compiler_class);
|
$this->smarty->loadPlugin($this->source->compiler_class);
|
||||||
}
|
}
|
||||||
$this->compiler =
|
$this->compiler =
|
||||||
new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class,
|
new $this->source->compiler_class(
|
||||||
$this->smarty);
|
$this->source->template_lexer_class, $this->source->template_parser_class,
|
||||||
|
$this->smarty
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -329,10 +329,12 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
|
|||||||
* @throws \SmartyException
|
* @throws \SmartyException
|
||||||
*/
|
*/
|
||||||
public function registerObject($object_name, $object, $allowed_methods_properties = array(), $format = true,
|
public function registerObject($object_name, $object, $allowed_methods_properties = array(), $format = true,
|
||||||
$block_methods = array())
|
$block_methods = array()
|
||||||
{
|
) {
|
||||||
return $this->ext->registerObject->registerObject($this, $object_name, $object, $allowed_methods_properties,
|
return $this->ext->registerObject->registerObject(
|
||||||
$format, $block_methods);
|
$this, $object_name, $object, $allowed_methods_properties,
|
||||||
|
$format, $block_methods
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -324,10 +324,12 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function __construct(Smarty $smarty)
|
public function __construct(Smarty $smarty)
|
||||||
{
|
{
|
||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
$this->nocache_hash = str_replace(array('.',
|
$this->nocache_hash = str_replace(
|
||||||
|
array('.',
|
||||||
','),
|
','),
|
||||||
'_',
|
'_',
|
||||||
uniqid(rand(), true));
|
uniqid(rand(), true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,17 +344,21 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
*/
|
*/
|
||||||
public function compileTemplate(Smarty_Internal_Template $template,
|
public function compileTemplate(Smarty_Internal_Template $template,
|
||||||
$nocache = null,
|
$nocache = null,
|
||||||
Smarty_Internal_TemplateCompilerBase $parent_compiler = null)
|
Smarty_Internal_TemplateCompilerBase $parent_compiler = null
|
||||||
{
|
) {
|
||||||
// get code frame of compiled template
|
// get code frame of compiled template
|
||||||
$_compiled_code = $template->smarty->ext->_codeFrame->create($template,
|
$_compiled_code = $template->smarty->ext->_codeFrame->create(
|
||||||
$this->compileTemplateSource($template,
|
$template,
|
||||||
|
$this->compileTemplateSource(
|
||||||
|
$template,
|
||||||
$nocache,
|
$nocache,
|
||||||
$parent_compiler),
|
$parent_compiler
|
||||||
|
),
|
||||||
$this->postFilter($this->blockOrFunctionCode) .
|
$this->postFilter($this->blockOrFunctionCode) .
|
||||||
join('', $this->mergedSubTemplatesCode),
|
join('', $this->mergedSubTemplatesCode),
|
||||||
false,
|
false,
|
||||||
$this);
|
$this
|
||||||
|
);
|
||||||
return $_compiled_code;
|
return $_compiled_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,8 +374,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
*/
|
*/
|
||||||
public function compileTemplateSource(Smarty_Internal_Template $template,
|
public function compileTemplateSource(Smarty_Internal_Template $template,
|
||||||
$nocache = null,
|
$nocache = null,
|
||||||
Smarty_Internal_TemplateCompilerBase $parent_compiler = null)
|
Smarty_Internal_TemplateCompilerBase $parent_compiler = null
|
||||||
{
|
) {
|
||||||
try {
|
try {
|
||||||
// save template object in compiler class
|
// save template object in compiler class
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
@@ -455,8 +461,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function postFilter($code)
|
public function postFilter($code)
|
||||||
{
|
{
|
||||||
// run post filter if on code
|
// run post filter if on code
|
||||||
if (!empty($code) &&
|
if (!empty($code)
|
||||||
(isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ]))
|
&& (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ]))
|
||||||
) {
|
) {
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template);
|
return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template);
|
||||||
} else {
|
} else {
|
||||||
@@ -475,8 +481,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function preFilter($_content)
|
public function preFilter($_content)
|
||||||
{
|
{
|
||||||
// run pre filter if required
|
// run pre filter if required
|
||||||
if ($_content !== '' &&
|
if ($_content !== ''
|
||||||
((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ])))
|
&& ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ])))
|
||||||
) {
|
) {
|
||||||
return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template);
|
return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template);
|
||||||
} else {
|
} else {
|
||||||
@@ -523,11 +529,13 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
// not a variable variable
|
// not a variable variable
|
||||||
$var = trim($variable, '\'');
|
$var = trim($variable, '\'');
|
||||||
$this->tag_nocache = $this->tag_nocache |
|
$this->tag_nocache = $this->tag_nocache |
|
||||||
$this->template->ext->getTemplateVars->_getVariable($this->template,
|
$this->template->ext->getTemplateVars->_getVariable(
|
||||||
|
$this->template,
|
||||||
$var,
|
$var,
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
false)->nocache;
|
false
|
||||||
|
)->nocache;
|
||||||
// todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
|
// todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
|
||||||
}
|
}
|
||||||
return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
|
return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
|
||||||
@@ -558,8 +566,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
public function compilePHPFunctionCall($name, $parameter)
|
public function compilePHPFunctionCall($name, $parameter)
|
||||||
{
|
{
|
||||||
if (!$this->smarty->security_policy || $this->smarty->security_policy->isTrustedPhpFunction($name, $this)) {
|
if (!$this->smarty->security_policy || $this->smarty->security_policy->isTrustedPhpFunction($name, $this)) {
|
||||||
if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0 ||
|
if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0
|
||||||
strcasecmp($name, 'array') === 0 || is_callable($name)
|
|| strcasecmp($name, 'array') === 0 || is_callable($name)
|
||||||
) {
|
) {
|
||||||
$func_name = strtolower($name);
|
$func_name = strtolower($name);
|
||||||
$par = implode(',', $parameter);
|
$par = implode(',', $parameter);
|
||||||
@@ -578,13 +586,16 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$isset_par = str_replace("')->value", "',null,true,false)->value", $par);
|
$isset_par = str_replace("')->value", "',null,true,false)->value", $par);
|
||||||
}
|
}
|
||||||
return $name . '(' . $isset_par . ')';
|
return $name . '(' . $isset_par . ')';
|
||||||
} else if (in_array($func_name,
|
} else if (in_array(
|
||||||
|
$func_name,
|
||||||
array('empty',
|
array('empty',
|
||||||
'reset',
|
'reset',
|
||||||
'current',
|
'current',
|
||||||
'end',
|
'end',
|
||||||
'prev',
|
'prev',
|
||||||
'next'))) {
|
'next')
|
||||||
|
)
|
||||||
|
) {
|
||||||
if (count($parameter) !== 1) {
|
if (count($parameter) !== 1) {
|
||||||
$this->trigger_template_error("Illegal number of parameter in '{$func_name()}'");
|
$this->trigger_template_error("Illegal number of parameter in '{$func_name()}'");
|
||||||
}
|
}
|
||||||
@@ -625,8 +636,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (strpos($text, '<') !== false) {
|
if (strpos($text, '<') !== false) {
|
||||||
// capture html elements not to be messed with
|
// capture html elements not to be messed with
|
||||||
$_offset = 0;
|
$_offset = 0;
|
||||||
if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
if (preg_match_all(
|
||||||
$text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
'#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
|
||||||
|
$text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$store[] = $match[ 0 ][ 0 ];
|
$store[] = $match[ 0 ][ 0 ];
|
||||||
$_length = strlen($match[ 0 ][ 0 ]);
|
$_length = strlen($match[ 0 ][ 0 ]);
|
||||||
@@ -648,8 +662,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
|
|
||||||
$text = preg_replace(array_keys($expressions), array_values($expressions), $text);
|
$text = preg_replace(array_keys($expressions), array_values($expressions), $text);
|
||||||
$_offset = 0;
|
$_offset = 0;
|
||||||
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches,
|
if (preg_match_all(
|
||||||
PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
'#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches,
|
||||||
|
PREG_OFFSET_CAPTURE | PREG_SET_ORDER
|
||||||
|
)
|
||||||
|
) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
$_length = strlen($match[ 0 ][ 0 ]);
|
$_length = strlen($match[ 0 ][ 0 ]);
|
||||||
$replace = $store[ $match[ 1 ][ 0 ] ];
|
$replace = $store[ $match[ 1 ][ 0 ] ];
|
||||||
@@ -710,8 +727,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$_tag = explode('_', $tag);
|
$_tag = explode('_', $tag);
|
||||||
$_tag = array_map('ucfirst', $_tag);
|
$_tag = array_map('ucfirst', $_tag);
|
||||||
$class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag);
|
$class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag);
|
||||||
if (class_exists($class_name) &&
|
if (class_exists($class_name)
|
||||||
(!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))
|
&& (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))
|
||||||
) {
|
) {
|
||||||
self::$_tag_objects[ $tag ] = new $class_name;
|
self::$_tag_objects[ $tag ] = new $class_name;
|
||||||
} else {
|
} else {
|
||||||
@@ -801,13 +818,15 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$callback = null;
|
$callback = null;
|
||||||
$script = null;
|
$script = null;
|
||||||
$cacheable = true;
|
$cacheable = true;
|
||||||
$result = call_user_func_array($this->smarty->default_plugin_handler_func,
|
$result = call_user_func_array(
|
||||||
|
$this->smarty->default_plugin_handler_func,
|
||||||
array($tag,
|
array($tag,
|
||||||
$plugin_type,
|
$plugin_type,
|
||||||
$this->template,
|
$this->template,
|
||||||
&$callback,
|
&$callback,
|
||||||
&$script,
|
&$script,
|
||||||
&$cacheable,));
|
&$cacheable,)
|
||||||
|
);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->tag_nocache = $this->tag_nocache || !$cacheable;
|
$this->tag_nocache = $this->tag_nocache || !$cacheable;
|
||||||
if ($script !== null) {
|
if ($script !== null) {
|
||||||
@@ -823,7 +842,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] =
|
$this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] =
|
||||||
$callback;
|
$callback;
|
||||||
}
|
}
|
||||||
require_once $script;
|
include_once $script;
|
||||||
} else {
|
} else {
|
||||||
$this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found");
|
$this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found");
|
||||||
}
|
}
|
||||||
@@ -875,8 +894,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
// If the template is not evaluated and we have a nocache section and or a nocache tag
|
// If the template is not evaluated and we have a nocache section and or a nocache tag
|
||||||
if ($is_code && !empty($content)) {
|
if ($is_code && !empty($content)) {
|
||||||
// generate replacement code
|
// generate replacement code
|
||||||
if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching &&
|
if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching
|
||||||
!$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache)
|
&& !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache)
|
||||||
) {
|
) {
|
||||||
$this->template->compiled->has_nocache_code = true;
|
$this->template->compiled->has_nocache_code = true;
|
||||||
$_output = addcslashes($content, '\'\\');
|
$_output = addcslashes($content, '\'\\');
|
||||||
@@ -1015,14 +1034,21 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
} else {
|
} else {
|
||||||
$line = (int)$line;
|
$line = (int)$line;
|
||||||
}
|
}
|
||||||
if (in_array($this->template->source->type,
|
if (in_array(
|
||||||
|
$this->template->source->type,
|
||||||
array('eval',
|
array('eval',
|
||||||
'string'))) {
|
'string')
|
||||||
$templateName = $this->template->source->type . ':' . trim(preg_replace('![\t\r\n]+!',
|
)
|
||||||
|
) {
|
||||||
|
$templateName = $this->template->source->type . ':' . trim(
|
||||||
|
preg_replace(
|
||||||
|
'![\t\r\n]+!',
|
||||||
' ',
|
' ',
|
||||||
strlen($lex->data) > 40 ?
|
strlen($lex->data) > 40 ?
|
||||||
substr($lex->data, 0, 40) .
|
substr($lex->data, 0, 40) .
|
||||||
'...' : $lex->data));
|
'...' : $lex->data
|
||||||
|
)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$templateName = $this->template->source->type . ':' . $this->template->source->filepath;
|
$templateName = $this->template->source->type . ':' . $this->template->source->filepath;
|
||||||
}
|
}
|
||||||
@@ -1104,11 +1130,13 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
*/
|
*/
|
||||||
public function replaceDelimiter($lexerPreg)
|
public function replaceDelimiter($lexerPreg)
|
||||||
{
|
{
|
||||||
return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'),
|
return str_replace(
|
||||||
|
array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'),
|
||||||
array($this->ldelPreg, $this->literalPreg, $this->rdelPreg,
|
array($this->ldelPreg, $this->literalPreg, $this->rdelPreg,
|
||||||
$this->smarty->getAutoLiteral() ? '{1,}' : '{9}',
|
$this->smarty->getAutoLiteral() ? '{1,}' : '{9}',
|
||||||
$this->smarty->getAutoLiteral() ? '' : '\\s*'),
|
$this->smarty->getAutoLiteral() ? '' : '\\s*'),
|
||||||
$lexerPreg);
|
$lexerPreg
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1153,9 +1181,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
{
|
{
|
||||||
if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) {
|
if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) {
|
||||||
$tag = $this->getOpenBlockTag();
|
$tag = $this->getOpenBlockTag();
|
||||||
$this->trigger_template_error("unclosed '{{$tag}}' in doubled quoted string",
|
$this->trigger_template_error(
|
||||||
|
"unclosed '{{$tag}}' in doubled quoted string",
|
||||||
null,
|
null,
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1395,9 +1425,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
}
|
}
|
||||||
// compile the smarty tag (required compile classes to compile the tag are auto loaded)
|
// compile the smarty tag (required compile classes to compile the tag are auto loaded)
|
||||||
if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
|
if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
|
||||||
if (isset($this->parent_compiler->tpl_function[ $tag ]) ||
|
if (isset($this->parent_compiler->tpl_function[ $tag ])
|
||||||
(isset ($this->template->smarty->ext->_tplFunction) &&
|
|| (isset($this->template->smarty->ext->_tplFunction)
|
||||||
$this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false)
|
&& $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false)
|
||||||
) {
|
) {
|
||||||
// template defined by {template} tag
|
// template defined by {template} tag
|
||||||
$args[ '_attr' ][ 'name' ] = "'{$tag}'";
|
$args[ '_attr' ][ 'name' ] = "'{$tag}'";
|
||||||
@@ -1428,23 +1458,27 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
// check if tag is a registered object
|
// check if tag is a registered object
|
||||||
if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) {
|
if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) {
|
||||||
$method = $parameter[ 'object_method' ];
|
$method = $parameter[ 'object_method' ];
|
||||||
if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) &&
|
if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])
|
||||||
(empty($this->smarty->registered_objects[ $tag ][ 1 ]) ||
|
&& (empty($this->smarty->registered_objects[ $tag ][ 1 ])
|
||||||
in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ]))
|
|| in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ]))
|
||||||
) {
|
) {
|
||||||
return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method);
|
return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method);
|
||||||
} else if (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) {
|
} else if (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) {
|
||||||
return $this->callTagCompiler('private_object_block_function',
|
return $this->callTagCompiler(
|
||||||
|
'private_object_block_function',
|
||||||
$args,
|
$args,
|
||||||
$parameter,
|
$parameter,
|
||||||
$tag,
|
$tag,
|
||||||
$method);
|
$method
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// throw exception
|
// throw exception
|
||||||
$this->trigger_template_error('not allowed method "' . $method . '" in registered object "' .
|
$this->trigger_template_error(
|
||||||
|
'not allowed method "' . $method . '" in registered object "' .
|
||||||
$tag . '"',
|
$tag . '"',
|
||||||
null,
|
null,
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if tag is registered
|
// check if tag is registered
|
||||||
@@ -1465,25 +1499,29 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) {
|
if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) {
|
||||||
$this->tag_nocache = true;
|
$this->tag_nocache = true;
|
||||||
}
|
}
|
||||||
return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ],
|
return call_user_func_array(
|
||||||
|
$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ],
|
||||||
array($new_args,
|
array($new_args,
|
||||||
$this));
|
$this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// compile registered function or block function
|
// compile registered function or block function
|
||||||
if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) {
|
if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) {
|
||||||
return $this->callTagCompiler('private_registered_' . $plugin_type,
|
return $this->callTagCompiler(
|
||||||
|
'private_registered_' . $plugin_type,
|
||||||
$args,
|
$args,
|
||||||
$parameter,
|
$parameter,
|
||||||
$tag);
|
$tag
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check plugins from plugins folder
|
// check plugins from plugins folder
|
||||||
foreach ($this->plugin_search_order as $plugin_type) {
|
foreach ($this->plugin_search_order as $plugin_type) {
|
||||||
if ($plugin_type === Smarty::PLUGIN_COMPILER &&
|
if ($plugin_type === Smarty::PLUGIN_COMPILER
|
||||||
$this->smarty->loadPlugin('smarty_compiler_' . $tag) &&
|
&& $this->smarty->loadPlugin('smarty_compiler_' . $tag)
|
||||||
(!isset($this->smarty->security_policy) ||
|
&& (!isset($this->smarty->security_policy)
|
||||||
$this->smarty->security_policy->isTrustedTag($tag, $this))
|
|| $this->smarty->security_policy->isTrustedTag($tag, $this))
|
||||||
) {
|
) {
|
||||||
$plugin = 'smarty_compiler_' . $tag;
|
$plugin = 'smarty_compiler_' . $tag;
|
||||||
if (is_callable($plugin)) {
|
if (is_callable($plugin)) {
|
||||||
@@ -1507,14 +1545,16 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
throw new SmartyException("Plugin '{$tag}' not callable");
|
throw new SmartyException("Plugin '{$tag}' not callable");
|
||||||
} else {
|
} else {
|
||||||
if ($function = $this->getPlugin($tag, $plugin_type)) {
|
if ($function = $this->getPlugin($tag, $plugin_type)) {
|
||||||
if (!isset($this->smarty->security_policy) ||
|
if (!isset($this->smarty->security_policy)
|
||||||
$this->smarty->security_policy->isTrustedTag($tag, $this)
|
|| $this->smarty->security_policy->isTrustedTag($tag, $this)
|
||||||
) {
|
) {
|
||||||
return $this->callTagCompiler('private_' . $plugin_type . '_plugin',
|
return $this->callTagCompiler(
|
||||||
|
'private_' . $plugin_type . '_plugin',
|
||||||
$args,
|
$args,
|
||||||
$parameter,
|
$parameter,
|
||||||
$tag,
|
$tag,
|
||||||
$function);
|
$function
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1548,14 +1588,18 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$new_args[ $key ] = $mixed;
|
$new_args[ $key ] = $mixed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ],
|
return call_user_func_array(
|
||||||
|
$this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ],
|
||||||
array($new_args,
|
array($new_args,
|
||||||
$this));
|
$this)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return $this->callTagCompiler('private_registered_' . $plugin_type,
|
return $this->callTagCompiler(
|
||||||
|
'private_registered_' . $plugin_type,
|
||||||
$args,
|
$args,
|
||||||
$parameter,
|
$parameter,
|
||||||
$tag);
|
$tag
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1566,22 +1610,26 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) {
|
if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) {
|
||||||
$method = $parameter[ 'object_method' ];
|
$method = $parameter[ 'object_method' ];
|
||||||
if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) {
|
if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) {
|
||||||
return $this->callTagCompiler('private_object_block_function',
|
return $this->callTagCompiler(
|
||||||
|
'private_object_block_function',
|
||||||
$args,
|
$args,
|
||||||
$parameter,
|
$parameter,
|
||||||
$tag,
|
$tag,
|
||||||
$method);
|
$method
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// throw exception
|
// throw exception
|
||||||
$this->trigger_template_error('not allowed closing tag method "' . $method .
|
$this->trigger_template_error(
|
||||||
|
'not allowed closing tag method "' . $method .
|
||||||
'" in registered object "' . $base_tag . '"',
|
'" in registered object "' . $base_tag . '"',
|
||||||
null,
|
null,
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// registered block tag ?
|
// registered block tag ?
|
||||||
if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) ||
|
if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ])
|
||||||
isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ])
|
|| isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ])
|
||||||
) {
|
) {
|
||||||
return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
|
return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
|
||||||
}
|
}
|
||||||
@@ -1595,8 +1643,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
}
|
}
|
||||||
// function plugin?
|
// function plugin?
|
||||||
if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) {
|
if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) {
|
||||||
if (!isset($this->smarty->security_policy) ||
|
if (!isset($this->smarty->security_policy)
|
||||||
$this->smarty->security_policy->isTrustedTag($tag, $this)
|
|| $this->smarty->security_policy->isTrustedTag($tag, $this)
|
||||||
) {
|
) {
|
||||||
return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function);
|
return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function);
|
||||||
}
|
}
|
||||||
@@ -1608,9 +1656,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) {
|
if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) {
|
||||||
$this->tag_nocache = true;
|
$this->tag_nocache = true;
|
||||||
}
|
}
|
||||||
return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ],
|
return call_user_func_array(
|
||||||
|
$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ],
|
||||||
array($args,
|
array($args,
|
||||||
$this));
|
$this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
|
if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
|
||||||
$plugin = 'smarty_compiler_' . $tag;
|
$plugin = 'smarty_compiler_' . $tag;
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
* This is the template file lexer.
|
* This is the template file lexer.
|
||||||
* It is generated from the smarty_internal_templatelexer.plex file
|
* It is generated from the smarty_internal_templatelexer.plex file
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @author Uwe Tews <uwe.tews@googlemail.com>
|
* @author Uwe Tews <uwe.tews@googlemail.com>
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Templatelexer
|
class Smarty_Internal_Templatelexer
|
||||||
@@ -219,7 +218,6 @@ class Smarty_Internal_Templatelexer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* open lexer/parser trace file
|
* open lexer/parser trace file
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function PrintTrace()
|
public function PrintTrace()
|
||||||
{
|
{
|
||||||
@@ -258,39 +256,47 @@ class Smarty_Internal_Templatelexer
|
|||||||
public function yypushstate($state)
|
public function yypushstate($state)
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState push %s\n",
|
"%sState push %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
array_push($this->_yy_stack, $this->_yy_state);
|
array_push($this->_yy_stack, $this->_yy_state);
|
||||||
$this->_yy_state = $state;
|
$this->_yy_state = $state;
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%snew State %s\n",
|
"%snew State %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yypopstate()
|
public function yypopstate()
|
||||||
{
|
{
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState pop %s\n",
|
"%sState pop %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->_yy_state = array_pop($this->_yy_stack);
|
$this->_yy_state = array_pop($this->_yy_stack);
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%snew State %s\n",
|
"%snew State %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,15 +304,17 @@ class Smarty_Internal_Templatelexer
|
|||||||
{
|
{
|
||||||
$this->_yy_state = $state;
|
$this->_yy_state = $state;
|
||||||
if ($this->yyTraceFILE) {
|
if ($this->yyTraceFILE) {
|
||||||
fprintf($this->yyTraceFILE,
|
fprintf(
|
||||||
|
$this->yyTraceFILE,
|
||||||
"%sState set %s\n",
|
"%sState set %s\n",
|
||||||
$this->yyTracePrompt,
|
$this->yyTracePrompt,
|
||||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||||
$this->_yy_state);
|
$this->_yy_state
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yylex1()
|
public function yylex1()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern1)) {
|
if (!isset($this->yy_global_pattern1)) {
|
||||||
$this->yy_global_pattern1 =
|
$this->yy_global_pattern1 =
|
||||||
@@ -326,10 +334,14 @@ public function yylex1()
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state TEXT');
|
5
|
||||||
|
) . '... state TEXT'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -354,8 +366,10 @@ public function yylex1()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -368,11 +382,13 @@ public function yylex1()
|
|||||||
|
|
||||||
function yy_r1_2()
|
function yy_r1_2()
|
||||||
{
|
{
|
||||||
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",
|
preg_match(
|
||||||
|
"/[*]{$this->compiler->getRdelPreg()}[\n]?/",
|
||||||
$this->data,
|
$this->data,
|
||||||
$match,
|
$match,
|
||||||
PREG_OFFSET_CAPTURE,
|
PREG_OFFSET_CAPTURE,
|
||||||
$this->counter);
|
$this->counter
|
||||||
|
);
|
||||||
if (isset($match[ 0 ][ 1 ])) {
|
if (isset($match[ 0 ][ 1 ])) {
|
||||||
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
||||||
} else {
|
} else {
|
||||||
@@ -420,7 +436,7 @@ public function yylex1()
|
|||||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yylex2()
|
public function yylex2()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern2)) {
|
if (!isset($this->yy_global_pattern2)) {
|
||||||
$this->yy_global_pattern2 =
|
$this->yy_global_pattern2 =
|
||||||
@@ -440,10 +456,14 @@ public function yylex2()
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state TAG');
|
5
|
||||||
|
) . '... state TAG'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -468,8 +488,10 @@ public function yylex2()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -559,7 +581,7 @@ public function yylex2()
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yylex3()
|
public function yylex3()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern3)) {
|
if (!isset($this->yy_global_pattern3)) {
|
||||||
$this->yy_global_pattern3 =
|
$this->yy_global_pattern3 =
|
||||||
@@ -579,10 +601,14 @@ public function yylex3()
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state TAGBODY');
|
5
|
||||||
|
) . '... state TAGBODY'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -607,8 +633,10 @@ public function yylex3()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -766,8 +794,8 @@ public function yylex3()
|
|||||||
function yy_r3_43()
|
function yy_r3_43()
|
||||||
{
|
{
|
||||||
// resolve conflicts with shorttag and right_delimiter starting with '='
|
// resolve conflicts with shorttag and right_delimiter starting with '='
|
||||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
|
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()
|
||||||
$this->smarty->getRightDelimiter()) {
|
) {
|
||||||
preg_match('/\s+/', $this->value, $match);
|
preg_match('/\s+/', $this->value, $match);
|
||||||
$this->value = $match[ 0 ];
|
$this->value = $match[ 0 ];
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||||
@@ -847,7 +875,7 @@ public function yylex3()
|
|||||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function yylex4()
|
public function yylex4()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern4)) {
|
if (!isset($this->yy_global_pattern4)) {
|
||||||
$this->yy_global_pattern4 =
|
$this->yy_global_pattern4 =
|
||||||
@@ -867,10 +895,14 @@ public function yylex4()
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state LITERAL');
|
5
|
||||||
|
) . '... state LITERAL'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -895,8 +927,10 @@ public function yylex4()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
@@ -924,7 +958,7 @@ public function yylex4()
|
|||||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||||
} // end function
|
} // end function
|
||||||
|
|
||||||
public function yylex5()
|
public function yylex5()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern5)) {
|
if (!isset($this->yy_global_pattern5)) {
|
||||||
$this->yy_global_pattern5 =
|
$this->yy_global_pattern5 =
|
||||||
@@ -944,10 +978,14 @@ public function yylex5()
|
|||||||
$yymatches = array_filter($yymatches);
|
$yymatches = array_filter($yymatches);
|
||||||
}
|
}
|
||||||
if (empty($yymatches)) {
|
if (empty($yymatches)) {
|
||||||
throw new Exception('Error: lexing failed because a rule matched' .
|
throw new Exception(
|
||||||
' an empty string. Input "' . substr($this->data,
|
'Error: lexing failed because a rule matched' .
|
||||||
|
' an empty string. Input "' . substr(
|
||||||
|
$this->data,
|
||||||
$this->counter,
|
$this->counter,
|
||||||
5) . '... state DOUBLEQUOTEDSTRING');
|
5
|
||||||
|
) . '... state DOUBLEQUOTEDSTRING'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
next($yymatches); // skip global match
|
next($yymatches); // skip global match
|
||||||
$this->token = key($yymatches); // token number
|
$this->token = key($yymatches); // token number
|
||||||
@@ -972,8 +1010,10 @@ public function yylex5()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected input at line' . $this->line .
|
throw new Exception(
|
||||||
': ' . $this->data[ $this->counter ]);
|
'Unexpected input at line' . $this->line .
|
||||||
|
': ' . $this->data[ $this->counter ]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} while (true);
|
} while (true);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user