Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasd committed Apr 27, 2023
2 parents b34c913 + a733e82 commit 8f29a51
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tumblr/tumblr.php
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,10 @@ function tumblr_get_npf_data(DOMNode $node): array

function tumblr_get_attributes($node): array
{
if (empty($node->attributes)) {
return [];
}

$attributes = [];
foreach ($node->attributes as $key => $attribute) {
$attributes[$key] = trim($attribute->value);
Expand Down Expand Up @@ -1040,7 +1044,7 @@ function tumblr_insert_contact(stdClass $blog, int $uid)
'name' => $blog->title,
'nick' => $blog->name,
'addr' => $blog->name . '@tumblr.com',
'about' => $blog->description,
'about' => HTML::toBBCode($blog->description),
'updated' => date(DateTimeFormat::MYSQL, $blog->updated)
];
return Contact::insert($fields);
Expand Down Expand Up @@ -1090,7 +1094,7 @@ function tumblr_update_contact(stdClass $blog, int $uid, int $cid, int $pcid)
'name' => $info->response->blog->title,
'nick' => $info->response->blog->name,
'addr' => $info->response->blog->name . '@tumblr.com',
'about' => BBCode::convertForUriId($uri_id, $info->response->blog->description, BBCode::CONNECTORS),
'about' => HTML::toBBCode($info->response->blog->description),
'updated' => date(DateTimeFormat::MYSQL, $info->response->blog->updated),
'header' => $info->response->blog->theme->header_image_focused,
'rel' => $rel,
Expand Down Expand Up @@ -1173,7 +1177,11 @@ function tumblr_get_contact_by_url(string $url): array
}

if (!preg_match('#^https?://tumblr.com/(.+)#', $url, $matches) && !preg_match('#^https?://www\.tumblr.com/(.+)#', $url, $matches) && !preg_match('#^https?://(.+)\.tumblr.com#', $url, $matches)) {
$curlResult = DI::httpClient()->get($url);
try {
$curlResult = DI::httpClient()->get($url);
} catch (\Exception $e) {
return [];
}
$html = $curlResult->getBody();
if (empty($html)) {
return [];
Expand Down Expand Up @@ -1219,7 +1227,7 @@ function tumblr_get_contact_by_url(string $url): array
'pubkey' => '',
'priority' => 0,
'guid' => $data->response->blog->uuid,
'about' => $data->response->blog->description,
'about' => HTML::toBBCode($data->response->blog->description),
'photo' => $data->response->blog->avatar[0]->url,
'header' => $data->response->blog->theme->header_image_focused,
];
Expand Down

0 comments on commit 8f29a51

Please sign in to comment.