diff options
Diffstat (limited to 'plugins/af_youtube_embed/init.php')
-rw-r--r-- | plugins/af_youtube_embed/init.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/af_youtube_embed/init.php b/plugins/af_youtube_embed/init.php index b53a92f0e..72d25a826 100644 --- a/plugins/af_youtube_embed/init.php +++ b/plugins/af_youtube_embed/init.php @@ -16,23 +16,23 @@ class Af_Youtube_Embed extends Plugin { } function hook_iframe_whitelisted($src) { - return in_array($src, ["www.youtube.com", "youtube.com", "youtu.be"]); + return in_array($src, ["www.youtube.com", "youtube.com", + "www.youtube-nocookie.com", "youtube-nocookie.com", + "youtu.be"]); } function hook_render_enclosure($entry, $hide_images) { - $matches = array(); + $url = $entry["content_url"]; - if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["content_url"], $matches) || - preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["content_url"], $matches) || - preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["content_url"], $matches)) { + if ($vid_id = UrlHelper::url_to_youtube_vid($url)) { - $vid_id = $matches[1]; - - return "<iframe class=\"youtube-player\" - type=\"text/html\" width=\"640\" height=\"385\" - src=\"https://www.youtube.com/embed/$vid_id\" - allowfullscreen frameborder=\"0\"></iframe>"; + return "<div class='embed-responsive'> + <iframe class='youtube-player' + type='text/html' width='640' height='385' + src=\"https://www.youtube.com/embed/$vid_id\" + allowfullscreen frameborder='0'></iframe> + </div>"; } } |