X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FOEmbed.php;h=7afdfac35c35361e230fcb3b235a0c54eb21a300;hb=739b6d6533fb54b1d7e6a641242c0103d73c487e;hp=7553cd9f81728e49c913d677b724621f9a83f8ff;hpb=6aa1dcfad371f34fea1f8e39b73de2cc3dd05784;p=friendica.git diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 7553cd9f81..7afdfac35c 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -316,7 +316,7 @@ class OEmbed if ($stopoembed == true) { return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "" . DI::l10n()->t('Embedding disabled') . " : $1", $text); } - return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", ['self', 'replaceCallback'], $text); + return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", [self::class, 'replaceCallback'], $text); } /** @@ -334,8 +334,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); @@ -385,7 +385,7 @@ class OEmbed } /** - * Returns a formmated HTML code from given URL and sets optional title + * Returns a formatted HTML code from given URL and sets optional title * * @param string $url URL to fetch * @param string $title Optional title (default: what comes from OEmbed object) @@ -447,7 +447,7 @@ class OEmbed * Generates an XPath query to select elements whose provided attribute contains * the provided value in a space-separated list. * - * @param string $attr Name of the attribute to seach + * @param string $attr Name of the attribute to search * @param string $value Value to search in a space-separated list * @return string */