Compare commits

...

18 Commits

Author SHA1 Message Date
Simon Wisselink 3251b1c32d Merge branch 'master' into 420upd 2022-11-22 21:31:35 +01:00
Ian e6ee257ca2 Merge branch 'master' into 420upd 2022-09-29 09:24:42 +02:00
Ian 0d4939e135 Improve issue with certain ?? ternary in 159ed4ee02
for smarty class magic __get() method.
2022-09-15 12:15:37 +02:00
Ian fc06d246bf Temporary fix strftime deprecation notes up from PHP 8.1+
Convert to DateTime Interface with intl before PHP 9.
2022-08-10 12:23:39 +02:00
Ian 292ad986cd plugins: Extend b1f59d19b644774dfd1e4282c190a5e72915ac95 2022-08-10 11:39:42 +02:00
Ian d024c3df4c Fix end_template/end_render debug condition to check for set start time
with PHP 8.1+
2022-08-10 11:38:36 +02:00
Ian f98ba948c4 Remove space line for consistency 2022-08-10 11:38:22 +02:00
Ian 7468378e3b plugins: math fix array item indents for readability 2022-08-10 11:37:54 +02:00
Ian de1f382f0b Fixup dff1955cd5 debug template 2022-08-10 11:37:24 +02:00
Ian a85296ab94 Remove line for consistency 2022-08-10 11:37:05 +02:00
Ian 40f40e549d plugins: modifier.escape fix typo 2022-08-10 11:36:35 +02:00
Ian 64e50e00c9 plugins: shared.mb_str_replace add a space line 2022-08-10 11:36:18 +02:00
Ian 159ed4ee02 Use PHP 7 Null Coalescing Operator (??) 2022-08-10 11:36:02 +02:00
Ian 7f579fdc69 plugins: mailto fix tabs to spaces 2022-08-10 11:35:35 +02:00
Ian c26151da1d plugins: Update doc header link to current smarty docs 2022-08-10 11:35:14 +02:00
Ian 078e2dbc1b plugins: Fix a SmartyException typo 2022-08-10 11:34:57 +02:00
Ian 36d157180a autoloader: Remove registerBC method in follow of Smarty 4 cleanup 2022-08-10 11:34:31 +02:00
Ian eec791d943 plugins: complete modifier escacpe and modifiercompiler escape for Smarty 5 PHP cleanup 2022-08-10 11:34:08 +02:00
62 changed files with 154 additions and 194 deletions
-25
View File
@@ -46,31 +46,6 @@ class Smarty_Autoloader
*/
public static $rootClasses = array('smarty' => 'Smarty.class.php');
/**
* Registers Smarty_Autoloader backward compatible to older installations.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function registerBC($prepend = false)
{
/**
* register the class autoloader
*/
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
}
if (SMARTY_SPL_AUTOLOAD
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
) {
$registeredAutoLoadFunctions = spl_autoload_functions();
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
spl_autoload_register();
}
} else {
self::register($prepend);
}
}
/**
* Registers Smarty_Autoloader as an SPL autoloader.
*
+1 -2
View File
@@ -139,7 +139,6 @@ class Smarty extends Smarty_Internal_TemplateBase
const DEBUG_OFF = 0;
const DEBUG_ON = 1;
const DEBUG_INDIVIDUAL = 2;
/**
* filter types
*/
@@ -780,7 +779,7 @@ class Smarty extends Smarty_Internal_TemplateBase
$this->_normalizeTemplateConfig($isConfig);
}
if ($index !== null) {
return isset($dir[ $index ]) ? $dir[ $index ] : null;
return ($dir[ $index ] ?? null);
}
return $dir;
}
+7 -17
View File
@@ -12,7 +12,6 @@
margin: 1px;
padding: 0;
}
h1 {
margin: 0;
text-align: left;
@@ -22,7 +21,6 @@
font-weight: bold;
font-size: 1.2em;
}
h2 {
background-color: #9B410E;
color: white;
@@ -31,7 +29,6 @@
padding: 2px;
border-top: 1px solid black;
}
h3 {
text-align: left;
font-weight: bold;
@@ -39,71 +36,58 @@
font-size: 0.7em;
padding: 2px;
}
body {
background: black;
}
p, table, div {
background: #f0ead8;
}
p {
margin: 0;
font-style: italic;
text-align: center;
}
table {
width: 100%;
}
th, td {
font-family: monospace;
vertical-align: top;
text-align: left;
}
td {
color: green;
}
tr:nth-child(odd) {
background-color: #eeeeee;
}
tr:nth-child(even) {
background-color: #fafafa;
}
.exectime {
font-size: 0.8em;
font-style: italic;
}
#bold div {
color: black;
font-weight: bold;
}
#blue h3 {
color: blue;
}
#normal div {
color: black;
font-weight: normal;
}
#table_assigned_vars th {
color: blue;
font-weight: bold;
}
#table_config_vars th {
color: maroon;
}
{/literal}
</style>
</head>
<body>
@@ -121,6 +105,7 @@
</span>
<br>
{/foreach}
</div>
{/if}
@@ -144,11 +129,14 @@
{$vars['attributes']|debug_print_var nofilter}
{/if}
</td>
</tr>
{/foreach}
</table>
<h2>assigned config file variables</h2>
{if NOT empty($config_vars)}
<table id="table_config_vars">
{foreach $config_vars as $vars}
<tr>
@@ -163,6 +151,8 @@
{/foreach}
</table>
{/if}
</body>
</html>
{/capture}
+1 -1
View File
@@ -20,7 +20,7 @@
* - indent_char - string (" ")
* - wrap_boundary - boolean (true)
*
* @link https://www.smarty.net/manual/en/language.function.textformat.php {textformat}
* @link https://www.smarty.net/docs/en/language.function.textformat.php {textformat}
* (Smarty online manual)
*
* @param array $params parameters
+2 -2
View File
@@ -12,7 +12,7 @@
* Purpose: print out a counter value
*
* @author Monte Ohrt <monte at ohrt dot com>
* @link https://www.smarty.net/manual/en/language.function.counter.php {counter}
* @link https://www.smarty.net/docs/en/language.function.counter.php {counter}
* (Smarty online manual)
*
* @param array $params parameters
@@ -23,7 +23,7 @@
function smarty_function_counter($params, $template)
{
static $counters = array();
$name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
$name = $params[ 'name' ] ?? 'default';
if (!isset($counters[ $name ])) {
$counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
}
+1 -1
View File
@@ -28,7 +28,7 @@
* {cycle name=row values="one,two,three" reset=true}
* {cycle name=row}
*
* @link https://www.smarty.net/manual/en/language.function.cycle.php {cycle}
* @link https://www.smarty.net/docs/en/language.function.cycle.php {cycle}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Mark Priatel <mpriatel@rogers.com>
+1 -1
View File
@@ -11,7 +11,7 @@
* Name: fetch
* Purpose: fetch file, web or ftp data and display results
*
* @link https://www.smarty.net/manual/en/language.function.fetch.php {fetch}
* @link https://www.smarty.net/docs/en/language.function.fetch.php {fetch}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
+1 -1
View File
@@ -29,7 +29,7 @@
* - assign (optional) - assign the output as an array to this variable
* - escape (optional) - escape the content (not value), defaults to true
*
* @link https://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
* @link https://www.smarty.net/docs/en/language.function.html.checkboxes.php {html_checkboxes}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
+1 -1
View File
@@ -21,7 +21,7 @@
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
* - path_prefix - prefix for path output (optional, default empty)
*
* @link https://www.smarty.net/manual/en/language.function.html.image.php {html_image}
* @link https://www.smarty.net/docs/en/language.function.html.image.php {html_image}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Duda <duda@big.hu>
+1 -1
View File
@@ -21,7 +21,7 @@
* - id (optional) - string default not set
* - class (optional) - string default not set
*
* @link https://www.smarty.net/manual/en/language.function.html.options.php {html_image}
* @link https://www.smarty.net/docs/en/language.function.html.options.php {html_image}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
+2 -2
View File
@@ -29,7 +29,7 @@
* {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
*
* @link https://www.smarty.net/manual/en/language.function.html.radios.php {html_radios}
* @link https://www.smarty.net/docs/en/language.function.html.radios.php {html_radios}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com>
@@ -156,7 +156,7 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template
}
} else {
foreach ($values as $_i => $_key) {
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
$_val = $output[ $_i ] ?? '';
$_html_result[] =
smarty_function_html_radios_output(
$name,
+9 -13
View File
@@ -28,7 +28,7 @@
* - 2.0 complete rewrite for performance,
* added attributes month_names, *_id
*
* @link https://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
* @link https://www.smarty.net/docs/en/language.function.html.select.date.php {html_select_date}
* (Smarty online manual)
* @version 2.0
* @author Andrei Zmievski
@@ -179,9 +179,7 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
'd' => 'Day'
] as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName =
isset($time[$prefix . $_elementName]) ? $time[$prefix . $_elementName] :
date($_elementKey);
$$_variableName = $params[ 'time' ][ $prefix . $_elementName ] ?? date($_elementKey);
}
} elseif (isset($time[$field_array][$prefix . 'Year'])) {
// $_REQUEST given
@@ -265,9 +263,8 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
if ($year_id !== null || $all_id !== null) {
$_html_years .= ' id="' . smarty_function_escape_special_chars(
$year_id !== null ?
($year_id ? $year_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
($year_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($year_size) {
@@ -275,7 +272,7 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
}
$_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($year_empty) || isset($all_empty)) {
$_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' .
$_html_years .= '<option value="">' . ($year_empty ?? $all_empty) . '</option>' .
$option_separator;
}
$op = $start_year > $end_year ? -1 : 1;
@@ -300,9 +297,8 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
if ($month_id !== null || $all_id !== null) {
$_html_months .= ' id="' . smarty_function_escape_special_chars(
$month_id !== null ?
($month_id ? $month_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
($month_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($month_size) {
@@ -310,7 +306,7 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
}
$_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($month_empty) || isset($all_empty)) {
$_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' .
$_html_months .= '<option value="">' . ($month_empty ?? $all_empty) . '</option>' .
$option_separator;
}
for ($i = 1; $i <= 12; $i++) {
@@ -346,7 +342,7 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
}
$_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($day_empty) || isset($all_empty)) {
$_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' .
$_html_days .= '<option value="">' . ($day_empty ?? $all_empty) . '</option>' .
$option_separator;
}
for ($i = 1; $i <= 31; $i++) {
+13 -19
View File
@@ -11,7 +11,7 @@
* Name: html_select_time
* Purpose: Prints the dropdowns for time selection
*
* @link https://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
* @link https://www.smarty.net/docs/en/language.function.html.select.time.php {html_select_time}
* (Smarty online manual)
* @author Roberto Berto <roberto@berto.net>
* @author Monte Ohrt <monte AT ohrt DOT com>
@@ -147,9 +147,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
's' => 'Second'
) as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName =
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
date($_elementKey);
$$_variableName = $params[ 'time' ][ $prefix . $_elementName ] ?? date($_elementKey);
}
$_meridian =
isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
@@ -199,7 +197,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
if ($hour_id !== null || $all_id !== null) {
$_html_hours .= ' id="' .
smarty_function_escape_special_chars(
$hour_id !== null ? ($hour_id ? $hour_id : $_name) :
$hour_id !== null ? ($hour_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
@@ -208,7 +206,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
}
$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($hour_empty) || isset($all_empty)) {
$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
$_html_hours .= '<option value="">' . ($hour_empty ?? $all_empty) . '</option>' .
$option_separator;
}
$start = $use_24_hours ? 0 : 1;
@@ -241,9 +239,8 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
if ($minute_id !== null || $all_id !== null) {
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
$minute_id !== null ?
($minute_id ? $minute_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
($minute_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($minute_size) {
@@ -251,7 +248,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
}
$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($minute_empty) || isset($all_empty)) {
$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
$_html_minutes .= '<option value="">' . ($minute_empty ?? $all_empty) . '</option>' .
$option_separator;
}
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
@@ -279,9 +276,8 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
if ($second_id !== null || $all_id !== null) {
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
$second_id !== null ?
($second_id ? $second_id : $_name) :
($all_id ? ($all_id . $_name) :
$_name)
($second_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($second_size) {
@@ -289,7 +285,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
}
$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($second_empty) || isset($all_empty)) {
$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
$_html_seconds .= '<option value="">' . ($second_empty ?? $all_empty) . '</option>' .
$option_separator;
}
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
@@ -317,10 +313,8 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
if ($meridian_id !== null || $all_id !== null) {
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
$meridian_id !== null ?
($meridian_id ? $meridian_id :
$_name) :
($all_id ? ($all_id . $_name) :
$_name)
($meridian_id ?? $_name) :
($all_id ? ($all_id . $_name) : $_name)
) . '"';
}
if ($meridian_size) {
@@ -328,7 +322,7 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem
}
$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($meridian_empty) || isset($all_empty)) {
$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
$_html_meridian .= '<option value="">' . ($meridian_empty ?? $all_empty) .
'</option>' . $option_separator;
}
$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
+1 -1
View File
@@ -38,7 +38,7 @@
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
* @author credit to boots <boots dot smarty at yahoo dot com>
* @version 1.1
* @link https://www.smarty.net/manual/en/language.function.html.table.php {html_table}
* @link https://www.smarty.net/docs/en/language.function.html.table.php {html_table}
* (Smarty online manual)
*
* @param array $params parameters
+1 -1
View File
@@ -36,7 +36,7 @@
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
* {mailto address="me@domain.com" extra='class="mailto"'}
*
* @link https://www.smarty.net/manual/en/language.function.mailto.php {mailto}
* @link https://www.smarty.net/docs/en/language.function.mailto.php {mailto}
* (Smarty online manual)
* @version 1.2
* @author Monte Ohrt <monte at ohrt dot com>
+27 -27
View File
@@ -12,7 +12,7 @@
* Name: math
* Purpose: handle math computations in template
*
* @link https://www.smarty.net/manual/en/language.function.math.php {math}
* @link https://www.smarty.net/docs/en/language.function.math.php {math}
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
@@ -25,35 +25,35 @@ function smarty_function_math($params, $template)
{
static $_allowed_funcs =
array(
'int' => true,
'abs' => true,
'ceil' => true,
'acos' => true,
'int' => true,
'abs' => true,
'ceil' => true,
'acos' => true,
'acosh' => true,
'cos' => true,
'cosh' => true,
'deg2rad' => true,
'rad2deg' => true,
'exp' => true,
'floor' => true,
'log' => true,
'log10' => true,
'max' => true,
'min' => true,
'pi' => true,
'pow' => true,
'rand' => true,
'round' => true,
'asin' => true,
'cos' => true,
'cosh' => true,
'deg2rad' => true,
'rad2deg' => true,
'exp' => true,
'floor' => true,
'log' => true,
'log10' => true,
'max' => true,
'min' => true,
'pi' => true,
'pow' => true,
'rand' => true,
'round' => true,
'asin' => true,
'asinh' => true,
'sin' => true,
'sinh' => true,
'sqrt' => true,
'srand' => true,
'atan' => true,
'sin' => true,
'sinh' => true,
'sqrt' => true,
'srand' => true,
'atan' => true,
'atanh' => true,
'tan' => true,
'tanh' => true
'tan' => true,
'tanh' => true
);
// be sure equation parameter is present
+2 -1
View File
@@ -15,7 +15,8 @@
* - format: strftime format for output
* - default_date: default date if $string is empty
*
* @link https://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.date.format.php date_format
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input date string
+2 -2
View File
@@ -17,7 +17,7 @@
* @param string $string input string
* @param string $esc_type escape type
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
* @param boolean $double_encode encode already encoded entities again, used for htmlspecialchars() or htmlentities()
*
* @return string escaped input string
*/
@@ -25,10 +25,10 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
{
static $is_loaded_1 = false;
static $is_loaded_2 = false;
if (!$char_set) {
$char_set = Smarty::$_CHARSET;
}
$string = (string)$string;
switch ($esc_type) {
+1 -1
View File
@@ -11,7 +11,7 @@
* Name: regex_replace
* Purpose: regular expression search/replace
*
* @link https://www.smarty.net/manual/en/language.modifier.regex.replace.php
* @link https://www.smarty.net/docs/en/language.modifier.regex.replace.php
* regex_replace (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: replace
* Purpose: simple search/replace
*
* @link https://www.smarty.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.replace.php replace
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
*
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: spacify
* Purpose: add spaces between characters in a string
*
* @link https://www.smarty.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.spacify.php spacify
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input string
+2 -1
View File
@@ -13,7 +13,8 @@
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
*
* @link https://www.smarty.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.truncate.php truncate
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input string
+1 -1
View File
@@ -14,7 +14,7 @@
* Input: string to catenate
* Example: {$var|cat:"foo"}
*
* @link https://www.smarty.net/manual/en/language.modifier.cat.php cat
* @link https://www.smarty.net/docs/en/language.modifier.cat.php cat
* (Smarty online manual)
* @author Uwe Tews
*
@@ -11,8 +11,8 @@
* Name: count_characters
* Purpose: count the number of characters in a text
*
* @link https://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online
* manual)
* @link https://www.smarty.net/docs/en/language.modifier.count.characters.php count_characters
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
@@ -11,7 +11,7 @@
* Name: count_paragraphs
* Purpose: count the number of paragraphs in a text
*
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* @link https://www.smarty.net/docs/en/language.modifier.count.paragraphs.php
* count_paragraphs (Smarty online manual)
* @author Uwe Tews
*
@@ -11,7 +11,7 @@
* Name: count_sentences
* Purpose: count the number of sentences in a text
*
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* @link https://www.smarty.net/docs/en/language.modifier.count.paragraphs.php
* count_sentences (Smarty online manual)
* @author Uwe Tews
*
@@ -11,7 +11,8 @@
* Name: count_words
* Purpose: count the number of words in a text
*
* @link https://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.count.words.php count_words
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: default
* Purpose: designate default value for empty variables
*
* @link https://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.default default
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -3
View File
@@ -11,7 +11,8 @@
* Name: escape
* Purpose: escape string for output
*
* @link https://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.escape count_characters
* (Smarty online manual)
* @author Rodney Rehm
*
* @param array $params parameters
@@ -41,7 +42,6 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
case 'html':
return 'htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
var_export($double_encode, true) . ')';
// no break
case 'htmlall':
if (Smarty::$_MBSTRING) {
return 'htmlentities(mb_convert_encoding((string)' . $params[ 0 ] . ', \'UTF-8\', ' .
@@ -51,7 +51,6 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
// no MBString fallback
return 'htmlentities((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . var_export($char_set, true) . ', ' .
var_export($double_encode, true) . ')';
// no break
case 'url':
return 'rawurlencode((string)' . $params[ 0 ] . ')';
case 'urlpathinfo':
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: indent
* Purpose: indent lines of text
*
* @link https://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.indent.php indent
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: lower
* Purpose: convert string to lowercase
*
* @link https://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.lower.php lower
* (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
*
@@ -11,7 +11,8 @@
* Name: string_format
* Purpose: format strings via sprintf
*
* @link https://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.string.format.php string_format
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -1
View File
@@ -14,7 +14,8 @@
* Example: {$var|strip} {$var|strip:"&nbsp;"}
* Date: September 25th, 2002
*
* @link https://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.strip.php strip
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: lower
* Purpose: convert string to uppercase
*
* @link https://www.smarty.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.upper.php lower
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
+2 -1
View File
@@ -11,7 +11,8 @@
* Name: wordwrap
* Purpose: wrap a string of text at a given length
*
* @link https://www.smarty.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
* @link https://www.smarty.net/docs/en/language.modifier.wordwrap.php wordwrap
* (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
@@ -26,7 +26,7 @@ function smarty_literal_compiler_param($params, $index, $default = null)
if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) {
throw new SmartyException(
'$param[' . $index .
'] is not a literal and is thus not evaluatable at compile time'
'] is not a literal and is thus not evaluable at compile time'
);
}
$t = null;
+1
View File
@@ -63,6 +63,7 @@ if (!function_exists('smarty_mb_str_replace')) {
}
$parts = mb_split(preg_quote($search), $subject ?? "") ?: array();
// If original regex encoding was not unicode...
if(!$reg_is_unicode) {
// ...restore original regex encoding to avoid breaking the system.
@@ -117,7 +117,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
$cached->content,
$timestamp
);
$cached->timestamp = isset($timestamp) ? $timestamp : false;
$cached->timestamp = $timestamp ?? false;
$cached->exists = !!$cached->timestamp;
}
@@ -138,8 +138,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
if (!$cached) {
$cached = $_smarty_tpl->cached;
}
$content = $cached->content ? $cached->content : null;
$timestamp = $cached->timestamp ? $cached->timestamp : null;
$content = $cached->content ?? null;
$timestamp = $cached->timestamp ?? null;
if ($content === null || !$timestamp) {
$this->fetch(
$_smarty_tpl->cached->filepath,
@@ -187,7 +187,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
*/
public function readCachedContent(Smarty_Internal_Template $_template)
{
$content = $_template->cached->content ? $_template->cached->content : null;
$content = $_template->cached->content ?? null;
$timestamp = null;
if ($content === null) {
$timestamp = null;
@@ -102,8 +102,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
if (!$cached) {
$cached = $_smarty_tpl->cached;
}
$content = $cached->content ? $cached->content : null;
$timestamp = $cached->timestamp ? $cached->timestamp : null;
$content = $cached->content ?? null;
$timestamp = $cached->timestamp ?? null;
if ($content === null || !$timestamp) {
if (!$this->fetch(
$_smarty_tpl->cached->filepath,
@@ -148,7 +148,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
*/
public function readCachedContent(Smarty_Internal_Template $_template)
{
$content = $_template->cached->content ? $_template->cached->content : null;
$content = $_template->cached->content ?? null;
$timestamp = null;
if ($content === null) {
if (!$this->fetch(
@@ -112,7 +112,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_
$_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];
unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);
$_name = $_attr[ 'name' ];
$_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
$_assign = $_attr[ 'assign' ] ?? null;
unset($_attr[ 'assign' ], $_attr[ 'name' ]);
foreach ($_attr as $name => $stat) {
if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) {
@@ -63,9 +63,9 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args, $parameter, 'capture');
$buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'";
$assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null';
$append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null';
$buffer = $_attr[ 'name' ] ?? "'default'";
$assign = $_attr[ 'assign' ] ?? 'null';
$append = $_attr[ 'append' ] ?? 'null';
$compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache);
// maybe nocache because of nocache variables
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
@@ -63,7 +63,7 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase
if ($this->blockType === 'Child') {
$compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ][ 'callsChild' ] = 'true';
}
$_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;
$_assign = $_attr[ 'assign' ] ?? null;
$output = "<?php \n";
if (isset($_assign)) {
$output .= "ob_start();\n";
@@ -157,7 +157,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
$output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php ";
$output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n";
$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";\n?>";
$output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash ?? '', ob_get_clean());\n";
$output .= "<?php echo str_replace('{$compiler->template->compiled->nocache_hash}', \$_smarty_tpl->compiled->nocache_hash, ob_get_clean());\n";
$output .= "}\n}\n";
$output .= $compiler->cStyleComment("/ {$_funcName}_nocache ") . "\n\n";
$output .= "?>\n";
@@ -196,7 +196,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
}
$has_compiled_template = false;
if ($merge_compiled_includes) {
$c_id = isset($_attr[ 'compile_id' ]) ? $_attr[ 'compile_id' ] : $compiler->template->compile_id;
$c_id = $_attr[ 'compile_id' ] ?? $compiler->template->compile_id;
// we must observe different compile_id and caching
$t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching'));
$compiler->smarty->allow_ambiguous_resources = true;
@@ -314,7 +314,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
} else {
$basename = $tpl->source->handler->getBasename($tpl->source);
$sourceInfo = $tpl->source->type . ':' .
($basename ? $basename : $tpl->source->name);
($basename ?? $tpl->source->name);
}
// get compiled code
$compiled_code = "<?php\n\n";
@@ -193,7 +193,7 @@ class Smarty_Internal_Configfilelexer
$this->yyTraceFILE,
"%sState push %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
$this->state_name[ $this->_yy_state ] ?? $this->_yy_state
);
}
array_push($this->_yy_stack, $this->_yy_state);
@@ -203,7 +203,7 @@ class Smarty_Internal_Configfilelexer
$this->yyTraceFILE,
"%snew State %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
$this->state_name[ $this->_yy_state ] ?? $this->_yy_state
);
}
}
@@ -215,7 +215,7 @@ class Smarty_Internal_Configfilelexer
$this->yyTraceFILE,
"%sState pop %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
$this->state_name[ $this->_yy_state ] ?? $this->_yy_state
);
}
$this->_yy_state = array_pop($this->_yy_stack);
@@ -224,7 +224,7 @@ class Smarty_Internal_Configfilelexer
$this->yyTraceFILE,
"%snew State %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
$this->state_name[ $this->_yy_state ] ?? $this->_yy_state
);
}
}
@@ -237,7 +237,7 @@ class Smarty_Internal_Configfilelexer
$this->yyTraceFILE,
"%sState set %s\n",
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state
$this->state_name[ $this->_yy_state ] ?? $this->_yy_state
);
}
}
+3 -2
View File
@@ -69,6 +69,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
public function end_template(Smarty_Internal_Template $template)
{
$key = $this->get_key($template);
if (!isset($this->template_data[ $this->index ][ $key ][ 'start_template_time' ])) return; // see internal_template L 243
$this->template_data[ $this->index ][ $key ][ 'total_time' ] +=
microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_template_time' ];
//$this->template_data[$this->index][$key]['properties'] = $template->properties;
@@ -142,6 +143,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
public function end_render(Smarty_Internal_Template $template)
{
$key = $this->get_key($template);
if (!isset($this->template_data[ $this->index ][ $key ][ 'start_time' ])) return; // see template_compiled L 119
$this->template_data[ $this->index ][ $key ][ 'render_time' ] +=
microtime(true) - $this->template_data[ $this->index ][ $key ][ 'start_time' ];
}
@@ -220,8 +222,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
$debObj->debugging = false;
$debObj->debugging_ctrl = 'NONE';
$debObj->error_reporting = E_ALL & ~E_NOTICE;
$debObj->debug_tpl =
isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
$debObj->debug_tpl = $smarty->debug_tpl ?? 'file:' . dirname(__FILE__) . '/../debug.tpl';
$debObj->registered_plugins = array();
$debObj->registered_resources = array();
$debObj->registered_filters = array();
@@ -67,7 +67,7 @@ class Smarty_Internal_Extension_Handler
public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
{
/* @var Smarty $data ->smarty */
$smarty = isset($data->smarty) ? $data->smarty : $data;
$smarty = isset($data->smarty) ? $data->smarty : $data; // don't use ?? for isset here since that would need a follow-up property define in Smarty class for __get()
if (!isset($smarty->ext->$name)) {
if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) {
$basename = $this->upperCase($match[ 4 ]);
@@ -30,7 +30,7 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S
$smarty = $obj->_getSmartyObj();
if ($type !== null) {
$this->_checkFilterType($type);
return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array();
return ($smarty->autoload_filters[ $type ] ?? array());
}
return $smarty->autoload_filters;
}
@@ -40,7 +40,7 @@ class Smarty_Internal_Method_GetStreamVariable
fclose($fp);
return $_result;
}
$smarty = isset($data->smarty) ? $data->smarty : $data;
$smarty = $data->smarty ?? $data;
if ($smarty->error_unassigned) {
throw new SmartyException('Undefined stream variable "' . $variable . '"');
} else {
@@ -44,7 +44,7 @@ class Smarty_Internal_Method_RegisterFilter
{
$smarty = $obj->_getSmartyObj();
$this->_checkFilterType($type);
$name = isset($name) ? $name : $this->_getFilterName($callback);
$name = $name ?? $this->_getFilterName($callback);
if (!is_callable($callback)) {
throw new SmartyException("{$type}filter '{$name}' not callable");
}
@@ -150,7 +150,7 @@ class Smarty_Internal_Runtime_Capture
public function getBuffer(Smarty_Internal_Template $_template, $name = null)
{
if (isset($name)) {
return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
return ($this->namedBuffer[ $name ] ?? null);
} else {
return $this->namedBuffer;
}
@@ -120,14 +120,12 @@ class Smarty_Internal_Runtime_GetIncludePath
public function getIncludePath($dirs, $file, Smarty $smarty)
{
//if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
if (!(isset($this->_has_stream_include) ? $this->_has_stream_include :
$this->_has_stream_include = function_exists('stream_resolve_include_path'))
) {
if (!($this->_has_stream_include ?? ($this->_has_stream_include = function_exists('stream_resolve_include_path')))) {
$this->isNewIncludePath($smarty);
}
// try PHP include_path
foreach ($dirs as $dir) {
$dir_n = isset($this->number[ $dir ]) ? $this->number[ $dir ] : $this->number[ $dir ] = $this->counter++;
$dir_n = $this->number[ $dir ] ?? ($this->number[ $dir ] = $this->counter++);
if (isset($this->isFile[ $dir_n ][ $file ])) {
if ($this->isFile[ $dir_n ][ $file ]) {
return $this->isFile[ $dir_n ][ $file ];
@@ -153,14 +151,13 @@ class Smarty_Internal_Runtime_GetIncludePath
$this->_user_dirs[ $dir_n ] = $dir;
}
if ($this->_has_stream_include) {
$path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
$path = stream_resolve_include_path($dir . ($file ?? ''));
if ($path) {
return $this->isFile[ $dir_n ][ $file ] = $path;
}
} else {
foreach ($this->_include_dirs as $key => $_i_path) {
$path = isset($this->isPath[ $key ][ $dir_n ]) ? $this->isPath[ $key ][ $dir_n ] :
$this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false;
$path = $this->isPath[ $key ][ $dir_n ] ?? ($this->isPath[ $key ][ $dir_n ] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false);
if ($path === false) {
continue;
}
@@ -141,7 +141,7 @@ class Smarty_Internal_Runtime_Inheritance
*/
public function instanceBlock(Smarty_Internal_Template $tpl, $className, $name, $tplIndex = null)
{
$block = new $className($name, isset($tplIndex) ? $tplIndex : $this->tplIndex);
$block = new $className($name, ($tplIndex ?? $this->tplIndex));
if (isset($this->childRoot[ $name ])) {
$block->child = $this->childRoot[ $name ];
}
@@ -21,8 +21,7 @@ class Smarty_Internal_Runtime_TplFunction
*/
public function callTemplateFunction(Smarty_Internal_Template $tpl, $name, $params, $nocache)
{
$funcParam = isset($tpl->tplFunctions[ $name ]) ? $tpl->tplFunctions[ $name ] :
(isset($tpl->smarty->tplFunctions[ $name ]) ? $tpl->smarty->tplFunctions[ $name ] : null);
$funcParam = $tpl->tplFunctions[ $name ] ?? ($tpl->smarty->tplFunctions[ $name ] ?? null);
if (isset($funcParam)) {
if (!$tpl->caching || ($tpl->caching && $nocache)) {
$function = $funcParam[ 'call_name' ];
@@ -84,8 +83,7 @@ class Smarty_Internal_Runtime_TplFunction
public function getTplFunction(Smarty_Internal_Template $tpl, $name = null)
{
if (isset($name)) {
return isset($tpl->tplFunctions[ $name ]) ? $tpl->tplFunctions[ $name ] :
(isset($tpl->smarty->tplFunctions[ $name ]) ? $tpl->smarty->tplFunctions[ $name ] : false);
return ($tpl->tplFunctions[ $name ] ?? ($tpl->smarty->tplFunctions[ $name ] ?? false));
} else {
return empty($tpl->tplFunctions) ? $tpl->smarty->tplFunctions : $tpl->tplFunctions;
}
+5 -5
View File
@@ -222,7 +222,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$this->smarty->ext->_cacheModify->cacheModifiedCheck(
$this->cached,
$this,
isset($content) ? $content : ob_get_clean()
($content ?? ob_get_clean())
);
} else {
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled)
@@ -293,7 +293,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$smarty = &$this->smarty;
$_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl);
// recursive call ?
if ((isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId()) !== $_templateId) {
if (($tpl->templateId ?? $tpl->_getTemplateId()) !== $_templateId) {
// already in template cache?
if (isset(self::$tplObjCache[ $_templateId ])) {
// copy data from cached object
@@ -538,7 +538,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
} else {
$tpl->mustCompile = !$is_valid;
$resource = $tpl->compiled;
$resource->includes = isset($properties[ 'includes' ]) ? $properties[ 'includes' ] : array();
$resource->includes = $properties[ 'includes' ] ?? array();
}
if ($is_valid) {
$resource->unifunc = $properties[ 'unifunc' ];
@@ -580,8 +580,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
*/
public function _getTemplateId()
{
return isset($this->templateId) ? $this->templateId : $this->templateId =
$this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id);
return ($this->templateId ?? ($this->templateId =
$this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id)));
}
/**
@@ -186,7 +186,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
} else {
// get template object
$saveVars = false;
$template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false);
$template = $smarty->createTemplate($template, $cache_id, $compile_id, ($parent ?? $this), false);
if ($this->_objType === 1) {
// set caching in template object
$template->caching = $this->caching;
@@ -428,8 +428,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
}
$this->smarty->_debug->start_compile($this->template);
}
$this->parent_compiler = $parent_compiler ? $parent_compiler : $this;
$nocache = isset($nocache) ? $nocache : false;
$this->parent_compiler = $parent_compiler ?? $this;
$nocache = $nocache ?? false;
if (empty($template->compiled->nocache_hash)) {
$template->compiled->nocache_hash = $this->nocache_hash;
} else {
@@ -1029,7 +1029,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
$_scope = $_scopeName;
} elseif (is_string($_scopeName)) {
$_scopeName = trim($_scopeName, '\'"');
$_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false;
$_scope = $validScopes[ $_scopeName ] ?? false;
} else {
$_scope = false;
}
+1 -1
View File
@@ -54,7 +54,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
$source->timestamp = $mtime;
} else {
$this->fetch($source->name, $content, $timestamp);
$source->timestamp = isset($timestamp) ? $timestamp : false;
$source->timestamp = $timestamp ?? false;
if (isset($content)) {
$source->content = $content;
}
-1
View File
@@ -22,7 +22,6 @@
#[\AllowDynamicProperties]
class Smarty_Security
{
/**
* This is the list of template directories that are considered secure.
* $template_dir is in this list implicitly.
+1 -1
View File
@@ -230,7 +230,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
if (!$_template->source->handler->recompiled) {
return file_get_contents($this->filepath);
}
return isset($this->content) ? $this->content : false;
return ($this->content ?? false);
}
/**
+2 -4
View File
@@ -135,9 +135,7 @@ class Smarty_Template_Source
*/
public function __construct(Smarty $smarty, $resource, $type, $name)
{
$this->handler =
isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
Smarty_Resource::load($smarty, $type);
$this->handler = $smarty->_cache[ 'resource_handlers' ][ $type ] ?? Smarty_Resource::load($smarty, $type);
$this->smarty = $smarty;
$this->resource = $resource;
$this->type = $type;
@@ -208,6 +206,6 @@ class Smarty_Template_Source
*/
public function getContent()
{
return isset($this->content) ? $this->content : $this->handler->getContent($this);
return ($this->content ?? $this->handler->getContent($this));
}
}
@@ -22,6 +22,7 @@ class SmartyCompilerException extends SmartyException
{
$this->line = $line;
}
/**
* The template source snippet relating to the error
*