X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FText%2FBBCode.php;h=c9a1bfe0521ec58fe56352c149989fce3895094e;hb=3842f02b021f2f32dbe6707c22af5760c3353dfa;hp=da95c3d67338204aea087cb1f9fef0e9f02f277b;hpb=cbf8a273ff7a8cb1dea22fd0a9beb587022031e1;p=friendica.git
diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php
index da95c3d673..c9a1bfe052 100644
--- a/src/Content/Text/BBCode.php
+++ b/src/Content/Text/BBCode.php
@@ -1,6 +1,6 @@
get($mtch[1]);
+ $curlResult = DI::httpClient()->get($mtch[1], HttpClientAccept::IMAGE);
if (!$curlResult->isSuccess()) {
continue;
}
+ Logger::debug('Got picture', ['Content-Type' => $curlResult->getHeader('Content-Type'), 'url' => $mtch[1]]);
+
$i = $curlResult->getBody();
$type = $curlResult->getContentType();
$type = Images::getMimeTypeByData($i, $mtch[1], $type);
@@ -1052,7 +1055,7 @@ class BBCode
$author_contact = Contact::getByURL($attributes['profile'], false, ['id', 'url', 'addr', 'name', 'micro']);
$author_contact['url'] = ($author_contact['url'] ?? $attributes['profile']);
- $author_contact['addr'] = ($author_contact['addr'] ?? '') ?: Protocol::getAddrFromProfileUrl($attributes['profile']);
+ $author_contact['addr'] = ($author_contact['addr'] ?? '');
$attributes['author'] = ($author_contact['name'] ?? '') ?: $attributes['author'];
$attributes['avatar'] = ($author_contact['micro'] ?? '') ?: $attributes['avatar'];
@@ -1096,7 +1099,7 @@ class BBCode
$attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
}
- $img_str = ' $value) {
if (!empty($value)) {
@@ -1129,13 +1132,13 @@ class BBCode
private static function convertShareCallback(array $attributes, array $author_contact, $content, $is_quote_share, $simplehtml)
{
DI::profiler()->startRecording('rendering');
- $mention = Protocol::formatMention($attributes['profile'], $attributes['author']);
+ $mention = $attributes['author'] . ' (' . ($author_contact['addr'] ?? '') . ')';
switch ($simplehtml) {
case self::API:
$text = ($is_quote_share? '
' : '') .
- '' . html_entity_decode('♲ ', ENT_QUOTES, 'UTF-8') . ' ' . $author_contact['addr'] . ":
\n" .
- '
' . $content . ''; + '' . html_entity_decode('♲', ENT_QUOTES, 'UTF-8') . ' ' . $author_contact['addr'] . ":
' . $content . ''; break; case self::DIASPORA: if (stripos(Strings::normaliseLink($attributes['link']), 'http://twitter.com/') === 0) { @@ -1160,7 +1163,7 @@ class BBCode $headline .= DI::l10n()->t('%2$s %3$s', $attributes['link'], $mention, $attributes['posted']); $headline .= ':' . "\n"; - $text = ($is_quote_share? '
' . trim($content) . '' . "\n"; + $text = ($is_quote_share? '
' . trim($content) . '' . "\n"; break; case self::OSTATUS: @@ -1201,7 +1204,7 @@ class BBCode $text = DI::cache()->get($cache_key); if (is_null($text)) { - $curlResult = DI::httpClient()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); + $curlResult = DI::httpClient()->head($match[1], [HttpClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); if ($curlResult->isSuccess()) { $mimetype = $curlResult->getHeader('Content-Type')[0] ?? ''; } else { @@ -1214,7 +1217,7 @@ class BBCode $text = "[url=" . $match[2] . ']' . $match[2] . "[/url]"; // if its not a picture then look if its a page that contains a picture link - $body = DI::httpClient()->fetch($match[1]); + $body = DI::httpClient()->fetch($match[1], HttpClientAccept::HTML, 0); if (empty($body)) { DI::cache()->set($cache_key, $text); return $text; @@ -1272,7 +1275,7 @@ class BBCode return $text; } - $curlResult = DI::httpClient()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); + $curlResult = DI::httpClient()->head($match[1], [HttpClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); if ($curlResult->isSuccess()) { $mimetype = $curlResult->getHeader('Content-Type')[0] ?? ''; } else { @@ -1290,7 +1293,7 @@ class BBCode } // if its not a picture then look if its a page that contains a picture link - $body = DI::httpClient()->fetch($match[1]); + $body = DI::httpClient()->fetch($match[1], HttpClientAccept::HTML, 0); if (empty($body)) { DI::cache()->set($cache_key, $text); return $text; @@ -1780,7 +1783,7 @@ class BBCode $text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '