X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItemContent.php;h=c51f471d8585b4d84fb7fdbb582adebd8fef4785;hb=3488b937ead0b3988d1f22c632bc2cc81393249b;hp=fe256d3e76f6b81f8f73f2dfc0e10c7b8d01fdcc;hpb=6d88984ee5faafc8d7f704a88aae2e4ae838d8e3;p=friendica.git diff --git a/src/Model/ItemContent.php b/src/Model/ItemContent.php index fe256d3e76..c51f471d85 100644 --- a/src/Model/ItemContent.php +++ b/src/Model/ItemContent.php @@ -9,6 +9,7 @@ namespace Friendica\Model; use Friendica\BaseObject; use Friendica\Content\Text; use Friendica\Core\PConfig; +use Friendica\Core\Protocol; require_once 'boot.php'; require_once 'include/items.php'; @@ -68,14 +69,13 @@ class ItemContent extends BaseObject } else {// Try to guess the correct target network switch ($htmlmode) { case 8: - $abstract = Text\BBCode::getAbstract($item['body'], NETWORK_TWITTER); + $abstract = Text\BBCode::getAbstract($item['body'], Protocol::TWITTER); break; + case 7: - $abstract = Text\BBCode::getAbstract($item['body'], NETWORK_STATUSNET); - break; - case 6: - $abstract = Text\BBCode::getAbstract($item['body'], NETWORK_APPNET); + $abstract = Text\BBCode::getAbstract($item['body'], Protocol::STATUSNET); break; + default: // We don't know the exact target. // We fetch an abstract since there is a posting limit. if ($limit > 0) { @@ -93,7 +93,7 @@ class ItemContent extends BaseObject } } - $html = Text\BBCode::convert($post['text'] . $post['after'], false, $htmlmode); + $html = Text\BBCode::convert($post['text'] . defaults($post, 'after', ''), false, $htmlmode); $msg = Text\HTML::toPlaintext($html, 0, true); $msg = trim(html_entity_decode($msg, ENT_QUOTES, 'UTF-8')); @@ -102,7 +102,7 @@ class ItemContent extends BaseObject if ($post['type'] == 'link') { $link = $post['url']; } elseif ($post['type'] == 'text') { - $link = $post['url']; + $link = defaults($post, 'url', ''); } elseif ($post['type'] == 'video') { $link = $post['url']; } elseif ($post['type'] == 'photo') { @@ -160,9 +160,8 @@ class ItemContent extends BaseObject } elseif (!isset($post['url'])) { $limit = $limit - 23; $post['url'] = $item['plink']; - // Which purpose has this line? It is now uncommented, but left as a reminder - //} elseif (strpos($b['body'], '[share') !== false) { - // $post['url'] = $b['plink']; + } elseif (strpos($item['body'], '[share') !== false) { + $post['url'] = $item['plink']; } elseif (PConfig::get($item['uid'], 'system', 'no_intelligent_shortening')) { $post['url'] = $item['plink']; }