]> git.wh0rd.org Git - tt-rss.git/blob - classes/button/tweet.php
rework class system to use subdirectories
[tt-rss.git] / classes / button / tweet.php
1 <?php
2 class Button_Tweet extends Button {
3         function render($article_id) {
4                 $rv = "<img src=\"".theme_image($this->link, 'images/art-tweet.png')."\"
5                         class='tagsPic' style=\"cursor : pointer\"
6                         onclick=\"tweetArticle($article_id)\"
7                         title='".__('Share on Twitter')."'>";
8
9                 return $rv;
10         }
11
12         function getTweetInfo() {
13                 $id = db_escape_string($_REQUEST['id']);
14
15                 $result = db_query($this->link, "SELECT title, link
16                                 FROM ttrss_entries, ttrss_user_entries
17                                 WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
18
19                 if (db_num_rows($result) != 0) {
20                         $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')),
21                                 100, '...');
22                         $article_link = db_fetch_result($result, 0, 'link');
23                 }
24
25                 print json_encode(array("title" => $title, "link" => $article_link,
26                                 "id" => $id));
27         }
28
29
30 }
31 ?>