From 3655e7aaf1cc714e716c71c41c5f02bdf5e528d3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 9 Feb 2021 08:50:51 +0300 Subject: [PATCH] api: fix some php8 warnings (4) --- classes/api.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/classes/api.php b/classes/api.php index 2f07e9ead..342ad54cc 100755 --- a/classes/api.php +++ b/classes/api.php @@ -196,13 +196,13 @@ class API extends Handler { $offset = (int)clean($_REQUEST["skip"]); $filter = clean($_REQUEST["filter"] ?? ""); - $is_cat = self::param_to_bool(clean($_REQUEST["is_cat"])); + $is_cat = self::param_to_bool(clean($_REQUEST["is_cat"] ?? false)); $show_excerpt = self::param_to_bool(clean($_REQUEST["show_excerpt"])); $show_content = self::param_to_bool(clean($_REQUEST["show_content"])); /* all_articles, unread, adaptive, marked, updated */ $view_mode = clean($_REQUEST["view_mode"]); $include_attachments = self::param_to_bool(clean($_REQUEST["include_attachments"])); - $since_id = (int)clean($_REQUEST["since_id"]); + $since_id = (int)clean($_REQUEST["since_id"] ?? 0); $include_nested = self::param_to_bool(clean($_REQUEST["include_nested"])); $sanitize_content = !isset($_REQUEST["sanitize"]) || self::param_to_bool($_REQUEST["sanitize"]); @@ -352,11 +352,13 @@ class API extends Handler { $article["content"] = $line["content"]; } + $hook_object = ["article" => $article]; + PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, function ($result) use (&$article) { $article = $result; }, - ["article" => $article]); + $hook_object); $article['content'] = DiskCache::rewriteUrls($article['content']); @@ -783,11 +785,13 @@ class API extends Handler { $headline_row["note"] = $line["note"]; $headline_row["lang"] = $line["lang"]; + $hook_object = ["headline" => $headline_row]; + PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, function ($result) use (&$headline_row) { $headline_row = $result; }, - ["headline" => $headline_row]); + $hook_object); $headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']);