Skip to content

Commit

Permalink
[Itaku] extend the number of images shown in a post (#3780)
Browse files Browse the repository at this point in the history
* minor fixes

- extended itaku post if post does not have all images

* phpcbf

* .

* resolve deprecated explode param

yay null coalesces
  • Loading branch information
mruac authored Oct 21, 2023
1 parent 4722201 commit a6a4502
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bridges/ItakuBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '-':
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a6a4502

Please sign in to comment.