Smarty v4 update to v4.4.1
This commit is contained in:
@@ -107,7 +107,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '4.3.0';
|
const SMARTY_VERSION = '4.4.1';
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
*/
|
*/
|
||||||
|
|||||||
15
src/plugins/modifier.implode.php
Normal file
15
src/plugins/modifier.implode.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
*
|
||||||
|
* @package Smarty
|
||||||
|
* @subpackage PluginsModifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
function smarty_modifier_implode($values, $separator = '')
|
||||||
|
{
|
||||||
|
if (is_array($separator)) {
|
||||||
|
return implode((string) ($values ?? ''), (array) $separator);
|
||||||
|
}
|
||||||
|
return implode((string) ($separator ?? ''), (array) $values);
|
||||||
|
}
|
||||||
11
src/plugins/modifiercompiler.json_encode.php
Normal file
11
src/plugins/modifiercompiler.json_encode.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
*
|
||||||
|
* @package Smarty
|
||||||
|
* @subpackage PluginsModifierCompiler
|
||||||
|
*/
|
||||||
|
function smarty_modifiercompiler_json_encode($params) {
|
||||||
|
return 'json_encode(' . $params[0] . (isset($params[1]) ? ', (int) ' . $params[1] : '') . ')';
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
function smarty_modifiercompiler_lower($params)
|
function smarty_modifiercompiler_lower($params)
|
||||||
{
|
{
|
||||||
if (Smarty::$_MBSTRING) {
|
if (Smarty::$_MBSTRING) {
|
||||||
return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
return 'mb_strtolower((string) ' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
||||||
}
|
}
|
||||||
// no MBString fallback
|
// no MBString fallback
|
||||||
return 'strtolower((string) ' . $params[ 0 ] . ')';
|
return 'strtolower((string) ' . $params[ 0 ] . ')';
|
||||||
|
|||||||
12
src/plugins/modifiercompiler.substr.php
Normal file
12
src/plugins/modifiercompiler.substr.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
*
|
||||||
|
* @package Smarty
|
||||||
|
* @subpackage PluginsModifierCompiler
|
||||||
|
*/
|
||||||
|
function smarty_modifiercompiler_substr($params) {
|
||||||
|
return 'substr((string) ' . $params[0] . ', (int) ' . $params[1] .
|
||||||
|
(isset($params[2]) ? ', (int) ' . $params[2] : '') . ')';
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
function smarty_function_escape_special_chars($string)
|
function smarty_function_escape_special_chars($string)
|
||||||
{
|
{
|
||||||
if (!is_array($string)) {
|
if (!is_array($string)) {
|
||||||
$string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false);
|
$string = htmlspecialchars((string) $string, ENT_COMPAT, Smarty::$_CHARSET, false);
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
|||||||
}
|
}
|
||||||
// autoescape html
|
// autoescape html
|
||||||
if ($compiler->template->smarty->escape_html) {
|
if ($compiler->template->smarty->escape_html) {
|
||||||
$output = "htmlspecialchars((string) {$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
|
$output = "htmlspecialchars((string) ({$output}), ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
|
||||||
}
|
}
|
||||||
// loop over registered filters
|
// loop over registered filters
|
||||||
if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
|
if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Smarty_Internal_ErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->allowUndefinedArrayKeys && preg_match(
|
if ($this->allowUndefinedArrayKeys && preg_match(
|
||||||
'/^(Undefined index|Undefined array key|Trying to access array offset on value of type)/',
|
'/^(Undefined index|Undefined array key|Trying to access array offset on)/',
|
||||||
$errstr
|
$errstr
|
||||||
)) {
|
)) {
|
||||||
return; // suppresses this error
|
return; // suppresses this error
|
||||||
|
|||||||
Reference in New Issue
Block a user