init.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. class VF_Shared extends Plugin {
  3. private $host;
  4. function about() {
  5. return array(1.0,
  6. "Feed for all articles actively shared by URL",
  7. "fox",
  8. false);
  9. }
  10. function init($host) {
  11. $this->host = $host;
  12. $host->add_feed(-1, __("Shared articles"), 'plugins/vf_shared/share.png', $this);
  13. }
  14. function api_version() {
  15. return 2;
  16. }
  17. function get_unread($feed_id) {
  18. $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
  19. return db_fetch_result($result, 0, "count");
  20. }
  21. function get_total($feed_id) {
  22. $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
  23. return db_fetch_result($result, 0, "count");
  24. }
  25. //function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
  26. function get_headlines($feed_id, $options) {
  27. /*$qfh_ret = queryFeedHeadlines(-4,
  28. $options['limit'],
  29. $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
  30. false,
  31. $options['search'],
  32. $options['search_mode'],
  33. $options['override_order'],
  34. $options['offset'],
  35. $options['owner_uid'],
  36. $options['filter'],
  37. $options['since_id'],
  38. $options['include_children'],
  39. false,
  40. "uuid != ''",
  41. "ttrss_feeds.title AS feed_title,"); */
  42. $params = array(
  43. "feed" => -4,
  44. "limit" => $options["limit"],
  45. "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
  46. "search" => $options['search'],
  47. "override_order" => $options['override_order'],
  48. "offset" => $options["offset"],
  49. "filter" => $options["filter"],
  50. "since_id" => $options["since_id"],
  51. "include_children" => $options["include_children"],
  52. "override_strategy" => "uuid != ''",
  53. "override_vfeed" => "ttrss_feeds.title AS feed_title,"
  54. );
  55. $qfh_ret = queryFeedHeadlines($params);
  56. $qfh_ret[1] = __("Shared articles");
  57. return $qfh_ret;
  58. }
  59. }
  60. ?>