[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
This commit is contained in:
mruac 2023-10-21 20:24:50 +10:30 committed by GitHub
parent 4722201281
commit a6a4502209
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -201,7 +201,7 @@ class ItakuBridge extends BridgeAbstract
'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 @@ class ItakuBridge extends BridgeAbstract
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)