[Embed] Using oscarotero/Embed as first attempt to get oEmbed/OpenGraph data, fallback

to previous implementation otherwise.
This commit is contained in:
Miguel Dantas
2019-07-07 13:26:10 +01:00
committed by Diogo Cordeiro
parent b25632ebc4
commit 462ea26303
5 changed files with 61 additions and 41 deletions

View File

@@ -104,7 +104,7 @@ class EmbedHelper
$unicode_check_dom = new DOMDocument();
$ok = $unicode_check_dom->loadHTML($body);
if (!$ok) {
throw new oEmbedHelper_BadHtmlException();
throw new EmbedHelper_BadHtmlException();
}
$metaNodes = $unicode_check_dom->getElementsByTagName('meta');
foreach ($metaNodes as $metaNode) {
@@ -135,7 +135,7 @@ class EmbedHelper
error_reporting($old);
if (!$ok) {
throw new oEmbedHelper_BadHtmlException();
throw new EmbedHelper_BadHtmlException();
}
Event::handle('GetRemoteUrlMetadataFromDom', array($url, $dom, &$metadata));
@@ -185,7 +185,7 @@ class EmbedHelper
}
}
throw new oEmbedHelper_DiscoveryException();
throw new EmbedHelper_DiscoveryException();
}
/**
@@ -245,7 +245,7 @@ class EmbedHelper
}
}
class oEmbedHelper_Exception extends Exception
class EmbedHelper_Exception extends Exception
{
public function __construct($message = "", $code = 0, $previous = null)
{
@@ -253,7 +253,7 @@ class oEmbedHelper_Exception extends Exception
}
}
class oEmbedHelper_BadHtmlException extends oEmbedHelper_Exception
class EmbedHelper_BadHtmlException extends EmbedHelper_Exception
{
public function __construct($previous=null)
{
@@ -261,7 +261,7 @@ class oEmbedHelper_BadHtmlException extends oEmbedHelper_Exception
}
}
class oEmbedHelper_DiscoveryException extends oEmbedHelper_Exception
class EmbedHelper_DiscoveryException extends EmbedHelper_Exception
{
public function __construct($previous=null)
{