From 175f25b495c76c7bfbef4a51189094e26f25526e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Fri, 18 Sep 2026 07:09:18 -0700 Subject: [PATCH] Minor code fixes --- controller/main.php | 4 ++-- helper/validator.php | 6 +++--- template/twig/extension/skeleton_version_compare.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controller/main.php b/controller/main.php index dc83197..de166fb 100644 --- a/controller/main.php +++ b/controller/main.php @@ -143,7 +143,7 @@ public function handle() 'NAME' => $value, 'DESC' => $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_UI'), 'DESC_EXPLAIN' => $this->language->is_set('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') ? $this->language->lang('SKELETON_QUESTION_' . strtoupper($value) . '_EXPLAIN') : '', - 'VALUE' => isset($author_values[$value][$i]) ? $author_values[$value][$i] : '', + 'VALUE' => $author_values[$value][$i] ?? '', ]); } } @@ -268,7 +268,7 @@ protected function get_request_variable($value, $default, $array_key = null) if ($array_key !== null) { $return_value = $this->request->variable($value, [$default]); - return isset($return_value[$array_key]) ? $return_value[$array_key] : $default; + return $return_value[$array_key] ?? $default; } return $this->request->variable($value, $default); diff --git a/helper/validator.php b/helper/validator.php index dbec69d..4b23e2c 100644 --- a/helper/validator.php +++ b/helper/validator.php @@ -157,7 +157,7 @@ public function validate_extension_homepage($value) { $value = $this->validate_generated_string($value, 'SKELETON_INVALID_EXTENSION_URL'); - if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false) + if ($value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false) { throw new runtime_exception($this->language->lang('SKELETON_INVALID_EXTENSION_URL')); } @@ -188,7 +188,7 @@ public function validate_author_homepage($value) { $value = $this->validate_generated_string($value, 'SKELETON_INVALID_AUTHOR_URL'); - if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false) + if ($value !== '' && filter_var($value, FILTER_VALIDATE_URL) === false) { throw new runtime_exception($this->language->lang('SKELETON_INVALID_AUTHOR_URL')); } @@ -207,7 +207,7 @@ public function validate_author_email($value) { $value = $this->validate_generated_string($value, 'SKELETON_INVALID_AUTHOR_EMAIL'); - if ((string) $value !== '' && filter_var($value, FILTER_VALIDATE_EMAIL) === false) + if ($value !== '' && filter_var($value, FILTER_VALIDATE_EMAIL) === false) { throw new runtime_exception($this->language->lang('SKELETON_INVALID_AUTHOR_EMAIL')); } diff --git a/template/twig/extension/skeleton_version_compare.php b/template/twig/extension/skeleton_version_compare.php index f07921c..a804a83 100644 --- a/template/twig/extension/skeleton_version_compare.php +++ b/template/twig/extension/skeleton_version_compare.php @@ -53,7 +53,7 @@ public function version_compare() $args = func_get_args(); // Strip out any prefixed junk in front of a version number - $regex = '/^[\D]*(\d.*)$/'; + $regex = '/^\D*(\d.*)$/'; preg_match($regex, $args[0], $ver1); preg_match($regex, $args[1], $ver2);