forked from torne/Tiny-Tiny-RSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add contributed plugins; load note plugin by default
- Loading branch information
Andrew Dolgov
committed
Dec 23, 2012
1 parent
a5c9a5c
commit 7252abe
Showing
16 changed files
with
359 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
class Flattr { | ||
private $link; | ||
private $host; | ||
|
||
function __construct($host) { | ||
$this->link = $host->get_link(); | ||
$this->host = $host; | ||
|
||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); | ||
} | ||
|
||
function hook_article_button($line) { | ||
|
||
$article_id = $line["id"]; | ||
|
||
$result = db_query($this->link, "SELECT link | ||
FROM ttrss_entries, ttrss_user_entries | ||
WHERE id = '$article_id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']); | ||
|
||
if (db_num_rows($result) != 0) { | ||
$article_link = db_fetch_result($result, 0, 'link'); | ||
} | ||
|
||
$response = null; | ||
if ($article_link) { | ||
$encoded = urlencode($article_link); | ||
$r = file_get_contents("https://api.flattr.com/rest/v2/things/lookup/?url=$encoded"); | ||
$response = json_decode($r, true); | ||
} | ||
|
||
$rv = null; | ||
if ($response and array_key_exists('link', $response)) { | ||
$rv = "<a id='flattr' href='" . $response['link'] . "'> | ||
<img src=\"".theme_image($this->link, 'plugins/flattr/flattr.png')."\" | ||
class='tagsPic' style=\"cursor : pointer\" | ||
title='".__('Flattr article')."'> | ||
</a>"; | ||
} else { | ||
$rv = ""; | ||
} | ||
|
||
return $rv; | ||
} | ||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function shareArticleToGooglePlus(id) { | ||
try { | ||
var query = "?op=pluginhandler&plugin=googleplus&method=getInfo&id=" + param_escape(id); | ||
|
||
console.log(query); | ||
|
||
var d = new Date(); | ||
var ts = d.getTime(); | ||
|
||
var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', | ||
"status=0,toolbar=0,location=0,width=500,height=450,scrollbars=1,menubar=0"); | ||
|
||
new Ajax.Request("backend.php", { | ||
parameters: query, | ||
onComplete: function(transport) { | ||
var ti = JSON.parse(transport.responseText); | ||
|
||
var share_url = "https://plus.google.com/share?url=" + param_escape(ti.link); | ||
|
||
w.location.href = share_url; | ||
|
||
} }); | ||
|
||
|
||
} catch (e) { | ||
exception_error("tweetArticle", e); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
class GooglePlus { | ||
private $link; | ||
private $host; | ||
|
||
function __construct($host) { | ||
$this->link = $host->get_link(); | ||
$this->host = $host; | ||
|
||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); | ||
} | ||
|
||
function get_js() { | ||
return file_get_contents(dirname(__FILE__) . "/googleplus.js"); | ||
} | ||
|
||
function hook_article_button($line) { | ||
$article_id = $line["id"]; | ||
|
||
$rv = "<img src=\"".theme_image($this->link, 'plugins/googleplus/googleplus.png')."\" | ||
class='tagsPic' style=\"cursor : pointer\" | ||
onclick=\"shareArticleToGooglePlus($article_id)\" | ||
title='".__('Share on Google+')."'>"; | ||
|
||
return $rv; | ||
} | ||
|
||
function getInfo() { | ||
$id = db_escape_string($_REQUEST['id']); | ||
|
||
$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'); | ||
} | ||
|
||
print json_encode(array("title" => $title, "link" => $article_link, | ||
"id" => $id)); | ||
} | ||
|
||
|
||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function shareArticleToIdentica(id) { | ||
try { | ||
var query = "?op=pluginhandler&plugin=identica&method=getInfo&id=" + param_escape(id); | ||
|
||
console.log(query); | ||
|
||
var d = new Date(); | ||
var ts = d.getTime(); | ||
|
||
var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', | ||
"status=0,toolbar=0,location=0,width=600,height=500,scrollbars=1,menubar=0"); | ||
|
||
new Ajax.Request("backend.php", { | ||
parameters: query, | ||
onComplete: function(transport) { | ||
var ti = JSON.parse(transport.responseText); | ||
|
||
var share_url = "http://identi.ca/index.php?action=bookmarkpopup&_=" + ts + | ||
"&title=" + param_escape(ti.title) + | ||
"&url=" + param_escape(ti.link); | ||
|
||
w.location.href = share_url; | ||
|
||
} }); | ||
|
||
|
||
} catch (e) { | ||
exception_error("shareArticleIdentica", e); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
class Identica { | ||
private $link; | ||
private $host; | ||
|
||
function __construct($host) { | ||
$this->link = $host->get_link(); | ||
$this->host = $host; | ||
|
||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); | ||
} | ||
|
||
function get_js() { | ||
return file_get_contents(dirname(__FILE__) . "/identica.js"); | ||
} | ||
|
||
function hook_article_button($line) { | ||
$article_id = $line["id"]; | ||
|
||
$rv = "<img src=\"".theme_image($this->link, 'plugins/identica/identica.png')."\" | ||
class='tagsPic' style=\"cursor : pointer\" | ||
onclick=\"shareArticleToIdentica($article_id)\" | ||
title='".__('Share on identi.ca')."'>"; | ||
|
||
return $rv; | ||
} | ||
|
||
function getInfo() { | ||
$id = db_escape_string($_REQUEST['id']); | ||
|
||
$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'); | ||
} | ||
|
||
print json_encode(array("title" => $title, "link" => $article_link, | ||
"id" => $id)); | ||
} | ||
|
||
|
||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function pinterest(id) { | ||
try { | ||
var query = "?op=pluginhandler&plugin=pinterest&method=getInfo&id=" + param_escape(id); | ||
|
||
console.log(query); | ||
|
||
var d = new Date(); | ||
var ts = d.getTime(); | ||
|
||
var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', | ||
"status=0,toolbar=0,location=0,width=650,height=600,scrollbars=1,menubar=0"); | ||
|
||
new Ajax.Request("backend.php", { | ||
parameters: query, | ||
onComplete: function(transport) { | ||
var ti = JSON.parse(transport.responseText); | ||
|
||
var share_url = "http://pinterest.com/pin/create/button/?" + | ||
"url=" + param_escape(ti.link) + | ||
"&description=" + param_escape(ti.title); | ||
|
||
w.location.href = share_url; | ||
|
||
} }); | ||
|
||
|
||
} catch (e) { | ||
exception_error("tweetArticle", e); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
class Pinterest { | ||
private $link; | ||
private $host; | ||
|
||
function __construct($host) { | ||
$this->link = $host->get_link(); | ||
$this->host = $host; | ||
|
||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); | ||
} | ||
|
||
function get_js() { | ||
return file_get_contents(dirname(__FILE__) . "/pinterest.js"); | ||
} | ||
|
||
function hook_article_button($line) { | ||
$article_id = $line["id"]; | ||
|
||
$rv = "<img src=\"".theme_image($this->link, 'plugins/pinterest/pinterest.png')."\" | ||
class='tagsPic' style=\"cursor : pointer\" | ||
onclick=\"pinterest($article_id)\" | ||
title='".__('Pinterest')."'>"; | ||
|
||
return $rv; | ||
} | ||
|
||
function getInfo() { | ||
$id = db_escape_string($_REQUEST['id']); | ||
|
||
$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'); | ||
} | ||
|
||
print json_encode(array("title" => $title, "link" => $article_link, | ||
"id" => $id)); | ||
} | ||
|
||
|
||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function shareArticleToPocket(id) { | ||
try { | ||
var query = "?op=pluginhandler&plugin=pocket&method=getInfo&id=" + param_escape(id); | ||
|
||
console.log(query); | ||
|
||
var d = new Date(); | ||
var ts = d.getTime(); | ||
|
||
var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', | ||
"status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0"); | ||
|
||
new Ajax.Request("backend.php", { | ||
parameters: query, | ||
onComplete: function(transport) { | ||
var ti = JSON.parse(transport.responseText); | ||
|
||
var share_url = "https://getpocket.com/save?" + | ||
"&title=" + param_escape(ti.title) + | ||
"&url=" + param_escape(ti.link); | ||
|
||
w.location.href = share_url; | ||
|
||
} }); | ||
|
||
|
||
} catch (e) { | ||
exception_error("tweetArticle", e); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
class Pocket { | ||
|
||
private $link; | ||
private $host; | ||
|
||
function __construct($host) { | ||
$this->link = $host->get_link(); | ||
$this->host = $host; | ||
|
||
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); | ||
} | ||
|
||
function get_js() { | ||
return file_get_contents(dirname(__FILE__) . "/pocket.js"); | ||
} | ||
|
||
function hook_article_button($line) { | ||
$article_id = $line["id"]; | ||
|
||
$rv = "<img src=\"".theme_image($this->link, 'plugins/pocket/pocket.png')."\" | ||
class='tagsPic' style=\"cursor : pointer\" | ||
onclick=\"shareArticleToPocket($article_id)\" | ||
title='".__('Pocket')."'>"; | ||
|
||
return $rv; | ||
} | ||
|
||
function getInfo() { | ||
$id = db_escape_string($_REQUEST['id']); | ||
|
||
$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'); | ||
} | ||
|
||
print json_encode(array("title" => $title, "link" => $article_link, | ||
"id" => $id)); | ||
} | ||
|
||
|
||
} | ||
?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.