aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/libs/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'library/Smarty/libs/plugins')
-rw-r--r--library/Smarty/libs/plugins/modifier.debug_print_var.php6
-rw-r--r--library/Smarty/libs/plugins/modifier.regex_replace.php5
-rw-r--r--library/Smarty/libs/plugins/modifiercompiler.escape.php8
-rw-r--r--library/Smarty/libs/plugins/modifiercompiler.wordwrap.php6
-rw-r--r--library/Smarty/libs/plugins/shared.make_timestamp.php4
5 files changed, 15 insertions, 14 deletions
diff --git a/library/Smarty/libs/plugins/modifier.debug_print_var.php b/library/Smarty/libs/plugins/modifier.debug_print_var.php
index e3971a046..4ff8213ce 100644
--- a/library/Smarty/libs/plugins/modifier.debug_print_var.php
+++ b/library/Smarty/libs/plugins/modifier.debug_print_var.php
@@ -24,9 +24,9 @@
*/
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
{
- $_replace = array("\n" => '<i>\n</i>',
- "\r" => '<i>\r</i>',
- "\t" => '<i>\t</i>'
+ $_replace = array("\n" => '\n',
+ "\r" => '\r',
+ "\t" => '\t'
);
switch (gettype($var)) {
case 'array' :
diff --git a/library/Smarty/libs/plugins/modifier.regex_replace.php b/library/Smarty/libs/plugins/modifier.regex_replace.php
index abb1ff548..ffea16755 100644
--- a/library/Smarty/libs/plugins/modifier.regex_replace.php
+++ b/library/Smarty/libs/plugins/modifier.regex_replace.php
@@ -19,10 +19,11 @@
* @param string $string input string
* @param string|array $search regular expression(s) to search for
* @param string|array $replace string(s) that should be replaced
+ * @param int $limit the maximum number of replacements
*
* @return string
*/
-function smarty_modifier_regex_replace($string, $search, $replace)
+function smarty_modifier_regex_replace($string, $search, $replace, $limit = -1)
{
if (is_array($search)) {
foreach ($search as $idx => $s) {
@@ -32,7 +33,7 @@ function smarty_modifier_regex_replace($string, $search, $replace)
$search = _smarty_regex_replace_check($search);
}
- return preg_replace($search, $replace, $string);
+ return preg_replace($search, $replace, $string, $limit);
}
/**
diff --git a/library/Smarty/libs/plugins/modifiercompiler.escape.php b/library/Smarty/libs/plugins/modifiercompiler.escape.php
index 7e848aaec..0b29220ef 100644
--- a/library/Smarty/libs/plugins/modifiercompiler.escape.php
+++ b/library/Smarty/libs/plugins/modifiercompiler.escape.php
@@ -115,11 +115,11 @@ function smarty_modifiercompiler_escape($params, $compiler)
// could not optimize |escape call, so fallback to regular plugin
if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
- $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
- $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ $compiler->parent_compiler->template->compiled->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
+ $compiler->parent_compiler->template->compiled->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
} else {
- $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
- $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ $compiler->parent_compiler->template->compiled->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
+ $compiler->parent_compiler->template->compiled->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
}
return 'smarty_modifier_escape(' . join(', ', $params) . ')';
diff --git a/library/Smarty/libs/plugins/modifiercompiler.wordwrap.php b/library/Smarty/libs/plugins/modifiercompiler.wordwrap.php
index 2ad928ea1..6bb63247d 100644
--- a/library/Smarty/libs/plugins/modifiercompiler.wordwrap.php
+++ b/library/Smarty/libs/plugins/modifiercompiler.wordwrap.php
@@ -34,11 +34,11 @@ function smarty_modifiercompiler_wordwrap($params, $compiler)
$function = 'wordwrap';
if (Smarty::$_MBSTRING) {
if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
+ $compiler->parent_compiler->template->compiled->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
$compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
} else {
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
+ $compiler->parent_compiler->template->compiled->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
+ $compiler->parent_compiler->template->compiled->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
}
$function = 'smarty_mb_wordwrap';
}
diff --git a/library/Smarty/libs/plugins/shared.make_timestamp.php b/library/Smarty/libs/plugins/shared.make_timestamp.php
index 7c94e5f59..f87d40c7e 100644
--- a/library/Smarty/libs/plugins/shared.make_timestamp.php
+++ b/library/Smarty/libs/plugins/shared.make_timestamp.php
@@ -21,8 +21,8 @@ function smarty_make_timestamp($string)
if (empty($string)) {
// use "now":
return time();
- } elseif ($string instanceof DateTime) {
- return $string->getTimestamp();
+ } elseif ($string instanceof DateTime || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)) {
+ return (int) $string->format('U'); // PHP 5.2 BC
} elseif (strlen($string) == 14 && ctype_digit($string)) {
// it is mysql timestamp format of YYYYMMDDHHMMSS?
return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2),