From 945346cbffe266beb48e930af859879821fb8ad6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 21 Apr 2015 14:07:20 +0300 Subject: add HOOK_RENDER_ENCLOSURE & af_youtube_embed plugin --- plugins/af_youtube_embed/init.php | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 plugins/af_youtube_embed/init.php (limited to 'plugins/af_youtube_embed/init.php') diff --git a/plugins/af_youtube_embed/init.php b/plugins/af_youtube_embed/init.php new file mode 100644 index 000000000..782011340 --- /dev/null +++ b/plugins/af_youtube_embed/init.php @@ -0,0 +1,40 @@ +host = $host; + + $host->add_hook($host::HOOK_RENDER_ENCLOSURE, $this); + } + + function hook_render_enclosure($entry, $hide_images) { + + $matches = array(); + + if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["url"], $matches) || + preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["url"], $matches) || + preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["url"], $matches)) { + + $vid_id = $matches[1]; + + return ""; + + } + } + + function api_version() { + return 2; + } + +} +?> -- cgit v1.2.3