User DOMDocument object call instead of static in Content\OEmbed
This commit is contained in:
parent
ddad9721c0
commit
df706484cd
1 changed files with 4 additions and 2 deletions
|
@ -86,7 +86,8 @@ class OEmbed
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
$html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
|
$html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
|
||||||
if ($html_text) {
|
if ($html_text) {
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = new DOMDocument();
|
||||||
|
$dom->loadHTML($html_text);
|
||||||
if ($dom) {
|
if ($dom) {
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
$entries = $xpath->query("//link[@type='application/json+oembed']");
|
||||||
|
@ -274,7 +275,8 @@ class OEmbed
|
||||||
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
|
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
|
||||||
|
|
||||||
// If it doesn't parse at all, just return the text.
|
// If it doesn't parse at all, just return the text.
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = new DOMDocument();
|
||||||
|
$dom->loadHTML($html_text);
|
||||||
if (!$dom) {
|
if (!$dom) {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue