mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2026-01-07 18:59:16 +00:00
move tweet button to a plugin, implement basic support for article action button plugins
This commit is contained in:
@@ -704,11 +704,15 @@ class Feeds extends Protected_Handler {
|
||||
onclick=\"emailArticle($id)\"
|
||||
alt='Zoom' title='".__('Forward by email')."'>";
|
||||
|
||||
if (ENABLE_TWEET_BUTTON) {
|
||||
$reply['content'] .= "<img src=\"".theme_image($this->link, 'images/art-tweet.png')."\"
|
||||
class='tagsPic' style=\"cursor : pointer\"
|
||||
onclick=\"tweetArticle($id)\"
|
||||
alt='Zoom' title='".__('Share on Twitter')."'>";
|
||||
$button_plugins = explode(",", ARTICLE_BUTTON_PLUGINS);
|
||||
|
||||
foreach ($button_plugins as $p) {
|
||||
$pclass = "${p}_button";
|
||||
|
||||
if (class_exists($pclass)) {
|
||||
$plugin = new $pclass($link);
|
||||
$rv['content'] .= $plugin->render($id);
|
||||
}
|
||||
}
|
||||
|
||||
$reply['content'] .= "<img src=\"".theme_image($this->link, 'images/art-share.png')."\"
|
||||
|
||||
@@ -753,21 +753,16 @@ class RPC extends Protected_Handler {
|
||||
return;
|
||||
}
|
||||
|
||||
function getTweetInfo() {
|
||||
$id = db_escape_string($_REQUEST['id']);
|
||||
function buttonPlugin() {
|
||||
$pclass = basename($_REQUEST['plugin']) . "_button";
|
||||
$method = $_REQUEST['plugin_method'];
|
||||
|
||||
$result = db_query($this->link, "SELECT title, link
|
||||
FROM ttrss_entries, ttrss_user_entries
|
||||
WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
|
||||
|
||||
if (db_num_rows($result) != 0) {
|
||||
$title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')),
|
||||
100, '...');
|
||||
$article_link = db_fetch_result($result, 0, 'link');
|
||||
if (class_exists($pclass)) {
|
||||
$plugin = new $pclass($this->link);
|
||||
if (method_exists($plugin, $method)) {
|
||||
return $plugin->$method();
|
||||
}
|
||||
}
|
||||
|
||||
print json_encode(array("title" => $title, "link" => $article_link,
|
||||
"id" => $id));
|
||||
}
|
||||
|
||||
function setNote() {
|
||||
|
||||
Reference in New Issue
Block a user