2013-03-21 13:36:48 +01:00
|
|
|
<?php
|
|
|
|
class Embed_Original extends Plugin {
|
2017-12-03 08:58:13 +01:00
|
|
|
|
|
|
|
/* @var PluginHost $host */
|
2013-03-21 13:36:48 +01:00
|
|
|
private $host;
|
|
|
|
|
|
|
|
function init($host) {
|
|
|
|
$this->host = $host;
|
|
|
|
|
|
|
|
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
|
|
|
|
}
|
|
|
|
|
|
|
|
function about() {
|
|
|
|
return array(1.0,
|
|
|
|
"Try to display original article content inside tt-rss",
|
|
|
|
"fox");
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_js() {
|
|
|
|
return file_get_contents(dirname(__FILE__) . "/init.js");
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_css() {
|
|
|
|
return file_get_contents(dirname(__FILE__) . "/init.css");
|
|
|
|
}
|
|
|
|
|
|
|
|
function hook_article_button($line) {
|
|
|
|
$id = $line["id"];
|
|
|
|
|
|
|
|
$rv = "<img src=\"plugins/embed_original/button.png\"
|
|
|
|
class='tagsPic' style=\"cursor : pointer\"
|
|
|
|
onclick=\"embedOriginalArticle($id)\"
|
|
|
|
title='".__('Toggle embed original')."'>";
|
|
|
|
|
|
|
|
return $rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getUrl() {
|
2017-12-03 08:58:13 +01:00
|
|
|
$id = $_REQUEST['id'];
|
2013-03-21 13:36:48 +01:00
|
|
|
|
2017-12-03 08:58:13 +01:00
|
|
|
$sth = $this->pdo->prepare("SELECT link
|
2013-03-21 13:36:48 +01:00
|
|
|
FROM ttrss_entries, ttrss_user_entries
|
2017-12-03 08:58:13 +01:00
|
|
|
WHERE id = ? AND ref_id = id AND owner_uid = ?");
|
|
|
|
$sth->execute([$id, $_SESSION['uid']]);
|
2013-03-21 13:36:48 +01:00
|
|
|
|
2017-12-03 08:58:13 +01:00
|
|
|
if ($row = $sth->fetch()) {
|
|
|
|
$url = $row['link'];
|
|
|
|
} else {
|
|
|
|
$url = "";
|
2013-03-21 13:36:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
print json_encode(array("url" => $url, "id" => $id));
|
|
|
|
}
|
|
|
|
|
2013-04-19 15:31:56 +02:00
|
|
|
function api_version() {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2017-04-26 19:57:36 +02:00
|
|
|
}
|