X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FOEmbed.php;h=674728036bdd7790d6b0675e014232152336aa6c;hb=ddd2c72be8e7245389f97d74dd847f5a20410936;hp=008269785262904c3314d7997f4f4fbc49badde7;hpb=a3651e464d3d8fdaa8a955765482c1e82af45c44;p=friendica.git diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 0082697852..674728036b 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -1,6 +1,6 @@ fetchFull($href . '&maxwidth=' . $a->getThemeInfoValue('videowidth')); if ($result->getReturnCode() === 200) { - $json_string = $result->getBody(); + $json_string = $result->getBodyString(); break; } } @@ -312,11 +312,10 @@ 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', 'replaceCallback'], $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); @@ -385,7 +384,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 +446,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 */