mirror of
https://github.com/friendica/friendica
synced 2025-04-26 13:50:11 +00:00
Publish the provider fields in the API
This commit is contained in:
parent
e06160eeeb
commit
a012234d82
3 changed files with 32 additions and 18 deletions
|
@ -146,13 +146,15 @@ class BBCode
|
|||
public static function getAttachmentData($body)
|
||||
{
|
||||
$data = [
|
||||
'type' => '',
|
||||
'text' => '',
|
||||
'after' => '',
|
||||
'image' => null,
|
||||
'url' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'type' => '',
|
||||
'text' => '',
|
||||
'after' => '',
|
||||
'image' => null,
|
||||
'url' => '',
|
||||
'provider_name' => '',
|
||||
'provider_url' => '',
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
];
|
||||
|
||||
if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match)) {
|
||||
|
@ -253,6 +255,16 @@ class BBCode
|
|||
|
||||
$data['after'] = trim($match[4]);
|
||||
|
||||
$parts = parse_url($data['url']);
|
||||
if (!empty($parts['scheme']) && !empty($parts['host'])) {
|
||||
$data['provider_name'] = $parts['host'];
|
||||
$data['provider_url'] = $parts['scheme'] . '://' . $parts['host'];
|
||||
|
||||
if (!empty($parts['port'])) {
|
||||
$data['provider_url'] .= ':' . $parts['port'];
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue