X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FOEmbed.php;h=df2cafea45059b878fa05cd41e7fc84fc2697c82;hb=7e322c21b3ff25f2160bc76808e1412b2891bdae;hp=c113110662351f44d2328807cca1920d0d682c9d;hpb=f61fd93db02bc2d66e1473ca34dc1154e77217a3;p=friendica.git diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index c113110662..df2cafea45 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -312,8 +312,7 @@ class OEmbed */ public static function BBCode2HTML(string $text): string { - $stopoembed = DI::config()->get('system', 'no_oembed'); - if ($stopoembed == true) { + if (DI::config()->get('system', 'no_oembed')) { return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "" . DI::l10n()->t('Embedding disabled') . " : $1", $text); } return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", [self::class, 'replaceCallback'], $text); @@ -334,8 +333,8 @@ class OEmbed $html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text)); // If it doesn't parse at all, just return the text. - $dom = @DOMDocument::loadHTML($html_text); - if (!$dom) { + $dom = new DOMDocument(); + if (!@$dom->loadHTML($html_text)) { return $text; } $xpath = new DOMXPath($dom);