diff --git a/src/Adapters/Adapter.php b/src/Adapters/Adapter.php index df68416..0dfbbe8 100644 --- a/src/Adapters/Adapter.php +++ b/src/Adapters/Adapter.php @@ -10,6 +10,7 @@ use Embed\Http\Url; use Embed\Providers\Provider; use Embed\Utils; +use Exception; /** * Base class extended by all adapters. @@ -317,7 +318,11 @@ return $this->getFirstFromProviders(function (Provider $provider) use ($blacklist, $homeUrl) { $url = $provider->getUrl(); - if ($homeUrl === $url || (!empty($blacklist) && Url::create($url)->match($blacklist))) { + try { + if ($homeUrl === $url || (!empty($blacklist) && Url::create($url)->match($blacklist))) { + return false; + } + } catch (Exception $error) { return false; } diff --git a/src/Adapters/File.php b/src/Adapters/File.php index 1e4348f..f3e9159 100644 --- a/src/Adapters/File.php +++ b/src/Adapters/File.php @@ -28,6 +28,7 @@ 'image/png' => ['photo', 'imageHtml'], 'image/bmp' => ['photo', 'imageHtml'], 'image/ico' => ['photo', 'imageHtml'], + 'image/webp' => ['photo', 'imageHtml'], 'text/rtf' => ['rich', 'google'], 'application/pdf' => ['rich', 'google'], 'application/msword' => ['rich', 'google'], diff --git a/src/Http/Url.php b/src/Http/Url.php index abbb843..85165af 100644 --- a/src/Http/Url.php +++ b/src/Http/Url.php @@ -540,10 +540,6 @@ foreach ((array) $query as $key => $value) { $this->info['query'][hex2bin($key)] = $value; } - - array_walk_recursive($this->info['query'], function (&$value) { - $value = urldecode($value); - }); } /** @@ -624,9 +620,9 @@ private static function getSuffixes() { if (self::$public_suffix_list === null) { - self::$public_suffix_list = include __DIR__.'/../resources/public_suffix_list.php'; - } - + self::$public_suffix_list = (@include __DIR__.'/../resources/public_suffix_list.php') ?: []; + } + return self::$public_suffix_list; } diff --git a/src/Providers/OEmbed/Instagram.php b/src/Providers/OEmbed/Instagram.php index 16d1dac..4da969b 100644 --- a/src/Providers/OEmbed/Instagram.php +++ b/src/Providers/OEmbed/Instagram.php @@ -10,7 +10,7 @@ 'instagram.com/p/*', 'www.instagram.com/p/*', ]; - protected static $endPoint = 'http://api.instagram.com/oembed'; + protected static $endPoint = 'https://api.instagram.com/oembed'; /** * {@inheritdoc} diff --git a/src/Providers/OEmbed/Poll.php b/src/Providers/OEmbed/Poll.php new file mode 100644 index 0000000..97815dd --- /dev/null +++ b/src/Providers/OEmbed/Poll.php @@ -0,0 +1,8 @@ +