]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/ItemContent.php
Make Storage testable & add tests
[friendica.git] / src / Model / ItemContent.php
index 25ae6b84241e3cc4fac78e77dd3f24402527f6ae..136323385c9c3355d1857ca1f909125e76a499b4 100644 (file)
@@ -6,12 +6,11 @@
 
 namespace Friendica\Model;
 
-use Friendica\BaseObject;
 use Friendica\Content\Text;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 
-class ItemContent extends BaseObject
+class ItemContent
 {
        /**
         * @brief Convert a message into plaintext for connectors to other networks
@@ -22,9 +21,10 @@ class ItemContent extends BaseObject
         * @param int    $htmlmode       This controls the behavior of the BBCode conversion
         * @param string $target_network Name of the network where the post should go to.
         *
-        * @see \Friendica\Content\Text\BBCode::getAttachedData
-        *
         * @return array Same array structure than \Friendica\Content\Text\BBCode::getAttachedData
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        * @see   \Friendica\Content\Text\BBCode::getAttachedData
+        *
         */
        public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = '')
        {
@@ -89,7 +89,7 @@ class ItemContent extends BaseObject
                        }
                }
 
-               $html = Text\BBCode::convert($post['text'] . defaults($post, 'after', ''), false, $htmlmode);
+               $html = Text\BBCode::convert($post['text'] . ($post['after'] ?? ''), false, $htmlmode);
                $msg = Text\HTML::toPlaintext($html, 0, true);
                $msg = trim(html_entity_decode($msg, ENT_QUOTES, 'UTF-8'));
 
@@ -98,7 +98,7 @@ class ItemContent extends BaseObject
                        if ($post['type'] == 'link') {
                                $link = $post['url'];
                        } elseif ($post['type'] == 'text') {
-                               $link = defaults($post, 'url', '');
+                               $link = $post['url'] ?? '';
                        } elseif ($post['type'] == 'video') {
                                $link = $post['url'];
                        } elseif ($post['type'] == 'photo') {