api: fix some php8 warnings (4)

This commit is contained in:
Andrew Dolgov 2021-02-09 08:50:51 +03:00
parent aba028a375
commit 3655e7aaf1
1 changed files with 8 additions and 4 deletions

View File

@ -196,13 +196,13 @@ class API extends Handler {
$offset = (int)clean($_REQUEST["skip"]); $offset = (int)clean($_REQUEST["skip"]);
$filter = clean($_REQUEST["filter"] ?? ""); $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_excerpt = self::param_to_bool(clean($_REQUEST["show_excerpt"]));
$show_content = self::param_to_bool(clean($_REQUEST["show_content"])); $show_content = self::param_to_bool(clean($_REQUEST["show_content"]));
/* all_articles, unread, adaptive, marked, updated */ /* all_articles, unread, adaptive, marked, updated */
$view_mode = clean($_REQUEST["view_mode"]); $view_mode = clean($_REQUEST["view_mode"]);
$include_attachments = self::param_to_bool(clean($_REQUEST["include_attachments"])); $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"])); $include_nested = self::param_to_bool(clean($_REQUEST["include_nested"]));
$sanitize_content = !isset($_REQUEST["sanitize"]) || $sanitize_content = !isset($_REQUEST["sanitize"]) ||
self::param_to_bool($_REQUEST["sanitize"]); self::param_to_bool($_REQUEST["sanitize"]);
@ -352,11 +352,13 @@ class API extends Handler {
$article["content"] = $line["content"]; $article["content"] = $line["content"];
} }
$hook_object = ["article" => $article];
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API,
function ($result) use (&$article) { function ($result) use (&$article) {
$article = $result; $article = $result;
}, },
["article" => $article]); $hook_object);
$article['content'] = DiskCache::rewriteUrls($article['content']); $article['content'] = DiskCache::rewriteUrls($article['content']);
@ -783,11 +785,13 @@ class API extends Handler {
$headline_row["note"] = $line["note"]; $headline_row["note"] = $line["note"];
$headline_row["lang"] = $line["lang"]; $headline_row["lang"] = $line["lang"];
$hook_object = ["headline" => $headline_row];
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API,
function ($result) use (&$headline_row) { function ($result) use (&$headline_row) {
$headline_row = $result; $headline_row = $result;
}, },
["headline" => $headline_row]); $hook_object);
$headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']); $headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']);