$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));
}
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);
}
$quotedUrl
)$#isx", function ($match) use ($url) {
// Stripping URLs with no label
- if (!isset($match[1])) {
+ if (empty($match[1])) {
return '';
}