|
|
@ -1,18 +1,18 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
class YFrames extends Plugin {
|
|
|
|
class YFrames extends Plugin {
|
|
|
|
|
|
|
|
|
|
|
|
private $host;
|
|
|
|
private $host;
|
|
|
|
|
|
|
|
|
|
|
|
function about() {
|
|
|
|
function about() {
|
|
|
|
return array(1.0,
|
|
|
|
return array(1.0,
|
|
|
|
"iFrames for Youtube feeds",
|
|
|
|
"iFrames for Youtube feeds",
|
|
|
|
"phga");
|
|
|
|
"phga");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function init($host) {
|
|
|
|
function init($host) {
|
|
|
|
$this->host = $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);
|
|
|
|
$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",
|
|
|
|
if (preg_match_all("/.*(youtube|youtu)\.(com|be)\/watch\?v=([\w\d_-]+).*/i",
|
|
|
|
$article["link"], $matches, PREG_PATTERN_ORDER)) {
|
|
|
|
$article["link"], $matches, PREG_PATTERN_ORDER)) {
|
|
|
|
|
|
|
|
|
|
|
|
if ($matches[3][0]) {
|
|
|
|
if ($matches[3][0]) {
|
|
|
|
$link = "https://www.youtube.com/embed/" . $matches[3][0];
|
|
|
|
$link = "https://www.youtube.com/embed/" . $matches[3][0];
|
|
|
|
$attributes = "width='819' height='460' class='youtube-player' allowfullscreen";
|
|
|
|
$attributes = "width='819' height='460' class='youtube-player' allowfullscreen";
|
|
|
|
$yframe = "<iframe src='$link' $attributes></iframe>";
|
|
|
|
$yframe = "<iframe src='$link' $attributes></iframe>";
|
|
|
|
|
|
|
|
|
|
|
|
$article["content"] = $yframe;
|
|
|
|
$article["content"] = $yframe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$description = str_replace("\n", "<br/>", $article["enclosures"][0][3]);
|
|
|
|
$description = str_replace("\n", "<br/>", $article["enclosures"][0][3]);
|
|
|
|
if (strlen($description) > 0) {
|
|
|
|
if (strlen($description) > 0) {
|
|
|
|
$article["content"] .= "<br/>" . $description ;
|
|
|
|
$article["content"] .= "<br/>" . $description ;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$article["content"] .= "<br/>No video description available.";
|
|
|
|
$article["content"] .= "<br/>No video description available.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $article;
|
|
|
|
return $article;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function api_version() {
|
|
|
|
function api_version() {
|
|
|
|
return 2;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|