From a6a450220991a42f34b3dfa3219b0cafbaba11eb Mon Sep 17 00:00:00 2001 From: mruac Date: Sat, 21 Oct 2023 20:24:50 +1030 Subject: [PATCH] [Itaku] extend the number of images shown in a post (#3780) * minor fixes - extended itaku post if post does not have all images * phpcbf * . * resolve deprecated explode param yay null coalesces --- bridges/ItakuBridge.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridges/ItakuBridge.php b/bridges/ItakuBridge.php index 62a130ff8b6..149757f5c4e 100644 --- a/bridges/ItakuBridge.php +++ b/bridges/ItakuBridge.php @@ -201,7 +201,7 @@ public function collectData() 'rating_e' => $this->getInput('rating_e') ]; - $tag_arr = explode(' ', $this->getInput('tags')); + $tag_arr = explode(' ', $this->getInput('tags') ?? ''); foreach ($tag_arr as $str) { switch ($str[0]) { case '-': @@ -446,6 +446,9 @@ private function getOwnerID($username) private function getPost($id, array $metadata = null) { + if (isset($metadata) && sizeof($metadata['gallery_images']) < $metadata['num_images']) { + $metadata = null; //force re-fetch of metadata + } $uri = self::URI . '/posts/' . $id; $url = self::URI . '/api/posts/' . $id . '/?format=json'; $data = $metadata ?? $this->getData($url, true, true)