diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/colors.php | 2 | ||||
| -rwxr-xr-x | include/controls.php | 6 | ||||
| -rw-r--r-- | include/functions.php | 6 | ||||
| -rwxr-xr-x | include/login_form.php | 2 |
4 files changed, 6 insertions, 10 deletions
diff --git a/include/colors.php b/include/colors.php index 35b84b9de..2dfa10dce 100644 --- a/include/colors.php +++ b/include/colors.php @@ -221,7 +221,7 @@ function _color_hue2rgb(float $m1, float $m2, float $h): int { * @return array{0: int, 1: int, 2: int} */ function _color_unpack(string $hex, bool $normalize = false): array { - $hex = strpos($hex, '#') !== 0 ? _resolve_htmlcolor($hex) : substr($hex, 1); + $hex = str_starts_with($hex, '#') ? substr($hex, 1) : _resolve_htmlcolor($hex); if (strlen($hex) == 4) { $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; diff --git a/include/controls.php b/include/controls.php index 4443bbc55..5c6174e3d 100755 --- a/include/controls.php +++ b/include/controls.php @@ -46,7 +46,7 @@ */ function input_tag(string $name, string $value, string $type = "text", array $attributes = [], string $id = ""): string { $attributes_str = attributes_to_string($attributes); - $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='dijit.form.TextBox'" : ""; + $dojo_type = str_contains($attributes_str, "dojoType") ? "" : "dojoType='dijit.form.TextBox'"; return "<input name=\"".htmlspecialchars($name)."\" $dojo_type ".attributes_to_string($attributes)." id=\"".htmlspecialchars($id)."\" type=\"$type\" value=\"".htmlspecialchars($value)."\">"; @@ -86,7 +86,7 @@ */ function select_tag(string $name, mixed $value, array $values, array $attributes = [], string $id = ""): string { $attributes_str = attributes_to_string($attributes); - $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='fox.form.Select'" : ""; + $dojo_type = str_contains($attributes_str, "dojoType") ? "" : "dojoType='fox.form.Select'"; $rv = "<select $dojo_type name=\"".htmlspecialchars($name)."\" id=\"".htmlspecialchars($id)."\" name=\"".htmlspecialchars($name)."\" $attributes_str>"; @@ -115,7 +115,7 @@ */ function select_hash(string $name, $value, array $values, array $attributes = [], string $id = ""): string { $attributes_str = attributes_to_string($attributes); - $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='fox.form.Select'" : ""; + $dojo_type = str_contains($attributes_str, "dojoType") ? "" : "dojoType='fox.form.Select'"; $rv = "<select $dojo_type name=\"".htmlspecialchars($name)."\" id=\"".htmlspecialchars($id)."\" name=\"".htmlspecialchars($name)."\" $attributes_str>"; diff --git a/include/functions.php b/include/functions.php index 95d31b248..5e906a977 100644 --- a/include/functions.php +++ b/include/functions.php @@ -279,11 +279,7 @@ } function with_trailing_slash(string $str) : string { - if (substr($str, -1) === "/") { - return $str; - } else { - return "$str/"; - } + return str_ends_with($str, '/') ? $str : "$str/"; } function make_password(int $length = 12): string { diff --git a/include/login_form.php b/include/login_form.php index 5ff2b378e..c0f1a93af 100755 --- a/include/login_form.php +++ b/include/login_form.php @@ -138,7 +138,7 @@ onblur="UtilityApp.fetchProfiles()" value="<?= $_SESSION["fake_password"] ?? "" ?>"/> </fieldset> - <?php if (strpos(Config::get(Config::PLUGINS), "auth_internal") !== false) { ?> + <?php if (str_contains(Config::get(Config::PLUGINS), "auth_internal")) { ?> <fieldset class="align-right"> <a href="public.php?op=forgotpass"><?= __("I forgot my password") ?></a> </fieldset> |