]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_youtube_embed/init.php
2 class Af_Youtube_Embed
extends Plugin
{
7 "Embed videos in Youtube RSS feeds",
11 function init($host) {
14 $host->add_hook($host::HOOK_RENDER_ENCLOSURE
, $this);
18 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
20 function hook_render_enclosure($entry, $hide_images) {
24 if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["url"], $matches) ||
25 preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["url"], $matches) ||
26 preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["url"], $matches)) {
28 $vid_id = $matches[1];
30 return "<iframe class=\"youtube-player\"
31 type=\"text/html\" width=\"640\" height=\"385\"
32 src=\"https://www.youtube.com/embed/$vid_id\"
33 allowfullscreen frameborder=\"0\"></iframe>";
38 function api_version() {