]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/OEmbed.php
Friendica copyright changed from 2023 to 2034
[friendica.git] / src / Content / OEmbed.php
index c113110662351f44d2328807cca1920d0d682c9d..8a4634539a12a9f0011134d86c81e84f78b709fa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -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", "<!-- oembed $1 --><i>" . DI::l10n()->t('Embedding disabled') . " : $1</i><!-- /oembed $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);