diff --git a/classes/API.php b/classes/API.php index 45820f300..6dbb1f246 100644 --- a/classes/API.php +++ b/classes/API.php @@ -817,7 +817,7 @@ class API extends Handler { $headline_row["labels"] = $labels; - $headline_row["feed_title"] = isset($line["feed_title"]) ? $line["feed_title"] : $feed_title; + $headline_row["feed_title"] = $line["feed_title"] ?? $feed_title; $headline_row["comments_count"] = (int)$line["num_comments"]; $headline_row["comments_link"] = $line["comments"]; diff --git a/classes/DiskCache.php b/classes/DiskCache.php index 196eed02d..d6335a9e7 100644 --- a/classes/DiskCache.php +++ b/classes/DiskCache.php @@ -410,7 +410,7 @@ class DiskCache implements Cache_Adapter { $mimetype = $this->adapter->get_mime_type(basename($filename)); if ($mimetype) - return isset($this->mimeMap[$mimetype]) ? $this->mimeMap[$mimetype] : ""; + return $this->mimeMap[$mimetype] ?? ""; else return ""; } diff --git a/classes/Feeds.php b/classes/Feeds.php index 64674b2d2..4b80cd336 100644 --- a/classes/Feeds.php +++ b/classes/Feeds.php @@ -1495,23 +1495,23 @@ class Feeds extends Handler_Protected { // right before adding them to SQL part $feed = $params["feed"]; - $limit = isset($params["limit"]) ? $params["limit"] : 30; + $limit = $params["limit"] ?? 30; $view_mode = $params["view_mode"]; - $cat_view = isset($params["cat_view"]) ? $params["cat_view"] : false; - $search = isset($params["search"]) ? $params["search"] : false; - $search_language = isset($params["search_language"]) ? $params["search_language"] : ""; - $override_order = isset($params["override_order"]) ? $params["override_order"] : false; - $offset = isset($params["offset"]) ? $params["offset"] : 0; - $owner_uid = isset($params["owner_uid"]) ? $params["owner_uid"] : $_SESSION["uid"]; - $since_id = isset($params["since_id"]) ? $params["since_id"] : 0; - $include_children = isset($params["include_children"]) ? $params["include_children"] : false; - $ignore_vfeed_group = isset($params["ignore_vfeed_group"]) ? $params["ignore_vfeed_group"] : false; - $override_strategy = isset($params["override_strategy"]) ? $params["override_strategy"] : false; - $override_vfeed = isset($params["override_vfeed"]) ? $params["override_vfeed"] : false; - $start_ts = isset($params["start_ts"]) ? $params["start_ts"] : false; - $check_first_id = isset($params["check_first_id"]) ? $params["check_first_id"] : false; - $skip_first_id_check = isset($params["skip_first_id_check"]) ? $params["skip_first_id_check"] : false; - //$order_by = isset($params["order_by"]) ? $params["order_by"] : false; + $cat_view = $params["cat_view"] ?? false; + $search = $params["search"] ?? false; + $search_language = $params["search_language"] ?? ""; + $override_order = $params["override_order"] ?? false; + $offset = $params["offset"] ?? 0; + $owner_uid = $params["owner_uid"] ?? $_SESSION["uid"]; + $since_id = $params["since_id"] ?? 0; + $include_children = $params["include_children"] ?? false; + $ignore_vfeed_group = $params["ignore_vfeed_group"] ?? false; + $override_strategy = $params["override_strategy"] ?? false; + $override_vfeed = $params["override_vfeed"] ?? false; + $start_ts = $params["start_ts"] ?? false; + $check_first_id = $params["check_first_id"] ?? false; + $skip_first_id_check = $params["skip_first_id_check"] ?? false; + //$order_by = $params["order_by"] ?? false; $ext_tables_part = ""; $limit_query_part = ""; diff --git a/classes/PluginHost.php b/classes/PluginHost.php index 2098be4e6..f3febc431 100644 --- a/classes/PluginHost.php +++ b/classes/PluginHost.php @@ -586,11 +586,7 @@ class PluginHost { $method = strtolower($method); if (isset($this->handlers[$handler])) { - if (isset($this->handlers[$handler]["*"])) { - return $this->handlers[$handler]["*"]; - } else { - return $this->handlers[$handler][$method]; - } + return $this->handlers[$handler]["*"] ?? $this->handlers[$handler][$method]; } return false; @@ -752,15 +748,8 @@ class PluginHost { if ($profile_id) { $idx = get_class($sender); - $this->load_data(); - - if (isset($this->storage[$idx][$profile_id][$name])) { - return $this->storage[$idx][$profile_id][$name]; - } else { - return $default_value; - } - + return $this->storage[$idx][$profile_id][$name] ?? $default_value; } else { return $this->get($sender, $name, $default_value); } @@ -772,14 +761,8 @@ class PluginHost { */ function get(Plugin $sender, string $name, $default_value = false) { $idx = get_class($sender); - $this->load_data(); - - if (isset($this->storage[$idx][$name])) { - return $this->storage[$idx][$name]; - } else { - return $default_value; - } + return $this->storage[$idx][$name] ?? $default_value; } /** diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php index 5cbf3c6d1..2bd9ae0bd 100644 --- a/classes/Pref_Prefs.php +++ b/classes/Pref_Prefs.php @@ -1481,17 +1481,11 @@ class Pref_Prefs extends Handler_Protected { } private function _get_short_desc(string $pref_name): string { - if (isset($this->pref_help[$pref_name][0])) { - return $this->pref_help[$pref_name][0]; - } - return ""; + return $this->pref_help[$pref_name][0] ?? ""; } private function _get_help_text(string $pref_name): string { - if (isset($this->pref_help[$pref_name][1])) { - return $this->pref_help[$pref_name][1]; - } - return ""; + return $this->pref_help[$pref_name][1] ?? ""; } private function appPasswordList(): void { diff --git a/classes/Prefs.php b/classes/Prefs.php index f778f0f84..8d84d5ec2 100644 --- a/classes/Prefs.php +++ b/classes/Prefs.php @@ -303,11 +303,7 @@ class Prefs { */ private function _get_cache(string $pref_name, int $owner_uid, ?int $profile_id) { $cache_key = sprintf("%d/%d/%s", $owner_uid, $profile_id, $pref_name); - - if (isset($this->cache[$cache_key])) - return $this->cache[$cache_key]; - - return null; + return $this->cache[$cache_key] ?? null; } /** diff --git a/classes/UrlHelper.php b/classes/UrlHelper.php index 7c426bedf..ba1f474bc 100644 --- a/classes/UrlHelper.php +++ b/classes/UrlHelper.php @@ -276,19 +276,19 @@ class UrlHelper { } $url = $options["url"]; - $type = isset($options["type"]) ? $options["type"] : false; - $login = isset($options["login"]) ? $options["login"] : false; - $pass = isset($options["pass"]) ? $options["pass"] : false; - $auth_type = isset($options["auth_type"]) ? $options["auth_type"] : "basic"; - $post_query = isset($options["post_query"]) ? $options["post_query"] : false; - $timeout = isset($options["timeout"]) ? $options["timeout"] : false; - $last_modified = isset($options["last_modified"]) ? $options["last_modified"] : ""; - $useragent = isset($options["useragent"]) ? $options["useragent"] : false; - $followlocation = isset($options["followlocation"]) ? $options["followlocation"] : true; - $max_size = isset($options["max_size"]) ? $options["max_size"] : Config::get(Config::MAX_DOWNLOAD_FILE_SIZE); // in bytes - $http_accept = isset($options["http_accept"]) ? $options["http_accept"] : false; - $http_referrer = isset($options["http_referrer"]) ? $options["http_referrer"] : false; - $encoding = isset($options["encoding"]) ? $options["encoding"] : false; + $type = $options["type"] ?? false; + $login = $options["login"] ?? false; + $pass = $options["pass"] ?? false; + $auth_type = $options["auth_type"] ?? "basic"; + $post_query = $options["post_query"] ?? false; + $timeout = $options["timeout"] ?? false; + $last_modified = $options["last_modified"] ?? ""; + $useragent = $options["useragent"] ?? false; + $followlocation = $options["followlocation"] ?? true; + $max_size = $options["max_size"] ?? Config::get(Config::MAX_DOWNLOAD_FILE_SIZE); // in bytes + $http_accept = $options["http_accept"] ?? false; + $http_referrer = $options["http_referrer"] ?? false; + $encoding = $options["encoding"] ?? false; $url = ltrim($url, ' '); $url = str_replace(' ', '%20', $url); diff --git a/include/colors.php b/include/colors.php index 64e24f8f1..35b84b9de 100644 --- a/include/colors.php +++ b/include/colors.php @@ -156,10 +156,7 @@ function _resolve_htmlcolor(string $color): string { $color = strtolower($color); - if (isset($htmlcolors[$color])) - return $htmlcolors[$color]; - else - return $color; + return $htmlcolors[$color] ?? $color; } /** diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index 2fb45fdef..3a1fa4c16 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -64,13 +64,13 @@ class Auth_Remote extends Auth_Base { // LemonLDAP can send user informations via HTTP HEADER if (Config::get(Config::AUTH_AUTO_CREATE)) { // update user name - $fullname = isset($_SERVER['HTTP_USER_NAME']) ? $_SERVER['HTTP_USER_NAME'] : ($_SERVER['AUTHENTICATE_CN'] ?? ""); + $fullname = $_SERVER['HTTP_USER_NAME'] ?? $_SERVER['AUTHENTICATE_CN'] ?? ''; if ($fullname){ $sth = $this->pdo->prepare("UPDATE ttrss_users SET full_name = ? WHERE id = ?"); $sth->execute([$fullname, $user_id]); } // update user mail - $email = isset($_SERVER['HTTP_USER_MAIL']) ? $_SERVER['HTTP_USER_MAIL'] : ($_SERVER['AUTHENTICATE_MAIL'] ?? ""); + $email = $_SERVER['HTTP_USER_MAIL'] ?? $_SERVER['AUTHENTICATE_MAIL'] ?? ''; if ($email){ $sth = $this->pdo->prepare("UPDATE ttrss_users SET email = ? WHERE id = ?"); $sth->execute([$email, $user_id]);