]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/PageInfo.php
Issue 9657: Check the age of an item
[friendica.git] / src / Content / PageInfo.php
index 8a2ee9f9d995727792402e342dd8cb8d4cf60511..5396bc1bbe96d4d17a3eb55e6d40bf0918b62b76 100644 (file)
@@ -142,6 +142,10 @@ class PageInfo
                        $text .= " title='" . $data['title'] . "'";
                }
 
+               if (empty($data['text'])) {
+                       $data['text'] = '';
+               }
+
                // Only embedd a picture link when it seems to be a valid picture ("width" is set)
                if (!empty($data['images']) && !empty($data['images'][0]['width'])) {
                        $preview = str_replace(['[', ']'], ['[', ']'], htmlentities($data['images'][0]['src'], ENT_QUOTES, 'UTF-8', false));
@@ -163,7 +167,7 @@ class PageInfo
                        }
                }
 
-               $text .= ']' . $data['text'] ?? '' . '[/attachment]';
+               $text .= ']' . $data['text'] . '[/attachment]';
 
                $hashtags = '';
                if (!empty($data['keywords'])) {
@@ -261,7 +265,7 @@ class PageInfo
                }
 
                if (!$matches && $searchNakedUrls) {
-                       preg_match('~(?<=\W|^)(?<![=\]])(https?://.+)$~is', $body, $matches);
+                       preg_match(Strings::autoLinkRegEx(), $body, $matches);
                        if ($matches && !Strings::endsWith($body, $matches[1])) {
                                unset($matches);
                        }
@@ -288,7 +292,7 @@ class PageInfo
                        $quotedUrl
                )$#isx", function ($match) use ($url) {
                        // Stripping URLs with no label
-                       if (!isset($match[1])) {
+                       if (empty($match[1])) {
                                return '';
                        }