diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 58fd20b7..81fc38f3 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -771,7 +771,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;
}
diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php
index 15871050..5b7e6f9c 100644
--- a/libs/plugins/function.counter.php
+++ b/libs/plugins/function.counter.php
@@ -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);
}
diff --git a/libs/plugins/function.html_radios.php b/libs/plugins/function.html_radios.php
index 32126125..293a6d27 100644
--- a/libs/plugins/function.html_radios.php
+++ b/libs/plugins/function.html_radios.php
@@ -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,
diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php
index 1ccaedfa..b446ff6f 100644
--- a/libs/plugins/function.html_select_date.php
+++ b/libs/plugins/function.html_select_date.php
@@ -187,9 +187,7 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem
'd' => 'Day'
) 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);
}
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) {
// $_REQUEST given
@@ -258,9 +256,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) {
@@ -268,7 +265,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 .= '' .
+ $_html_years .= '' .
$option_separator;
}
$op = $start_year > $end_year ? -1 : 1;
@@ -293,9 +290,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) {
@@ -303,14 +299,14 @@ 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 .= '' .
+ $_html_months .= '' .
$option_separator;
}
for ($i = 1; $i <= 12; $i++) {
$_val = sprintf('%02d', $i);
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) :
- ($month_format === '%m' ? $_val : strftime($month_format, $_month_timestamps[ $i ]));
- $_value = $month_value_format === '%m' ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]);
+ ($month_format === '%m' ? $_val : @strftime($month_format, $_month_timestamps[ $i ]));
+ $_value = $month_value_format === '%m' ? $_val : @strftime($month_value_format, $_month_timestamps[ $i ]);
$_html_months .= '' . $option_separator;
}
@@ -339,7 +335,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 .= '' .
+ $_html_days .= '' .
$option_separator;
}
for ($i = 1; $i <= 31; $i++) {
diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php
index ccae6d63..10563deb 100644
--- a/libs/plugins/function.html_select_time.php
+++ b/libs/plugins/function.html_select_time.php
@@ -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 .= '' .
+ $_html_hours .= '' .
$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 .= '' .
+ $_html_minutes .= '' .
$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 .= '' .
+ $_html_seconds .= '' .
$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_separator;
}
$_html_meridian .= '