diff --git a/init.php b/init.php index 1bcb71e..85c07d8 100644 --- a/init.php +++ b/init.php @@ -1,18 +1,18 @@ host = $host; + function init($host) { + $this->host = $host; - $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); + $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); $host->add_hook($host::HOOK_IFRAME_WHITELISTED, $this); } @@ -27,27 +27,27 @@ class YFrames extends Plugin { if (preg_match_all("/.*(youtube|youtu)\.(com|be)\/watch\?v=([\w\d_-]+).*/i", $article["link"], $matches, PREG_PATTERN_ORDER)) { - if ($matches[3][0]) { - $link = "https://www.youtube.com/embed/" . $matches[3][0]; - $attributes = "width='819' height='460' class='youtube-player' allowfullscreen"; - $yframe = ""; + if ($matches[3][0]) { + $link = "https://www.youtube.com/embed/" . $matches[3][0]; + $attributes = "width='819' height='460' class='youtube-player' allowfullscreen"; + $yframe = ""; - $article["content"] = $yframe; - } - } + $article["content"] = $yframe; + } + } - $description = str_replace("\n", "
", $article["enclosures"][0][3]); - if (strlen($description) > 0) { - $article["content"] .= "
" . $description ; - } else { - $article["content"] .= "
No video description available."; - } + $description = str_replace("\n", "
", $article["enclosures"][0][3]); + if (strlen($description) > 0) { + $article["content"] .= "
" . $description ; + } else { + $article["content"] .= "
No video description available."; + } - return $article; - } + return $article; + } - function api_version() { - return 2; - } + function api_version() { + return 2; + } }