From d0417bf115b7a02378a9412320e89a53c8bfb680 Mon Sep 17 00:00:00 2001 From: ruan <2369127-ruany@users.noreply.gitlab.com> Date: Fri, 4 Sep 2020 07:28:46 +0200 Subject: [PATCH] Simplify/optimize get_name() --- inc/page.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/inc/page.php b/inc/page.php index 426f717..9cdc35b 100644 --- a/inc/page.php +++ b/inc/page.php @@ -293,10 +293,8 @@ class Page { * @return null|string */ function get_name($uuid) { - if ($uuid === null || $uuid === "" || strrpos($uuid, "#", -strlen($uuid)) !== false) return null; - if (in_array($uuid, $this->settings->console_aliases)) { - return $this->settings->console_name; - } + if ($uuid === null || $uuid === "" || $uuid[0] === '#') return null; + if (in_array($uuid, $this->settings->console_aliases)) return $this->settings->console_name; if (array_key_exists($uuid, $this->uuid_name_cache)) return $this->uuid_name_cache[$uuid]; $result = null;