init.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /**
  18. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  19. */
  20. function get_unread($feed_id) {
  21. $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and unread = true and uuid != ''");
  22. return db_fetch_result($result, 0, "count");
  23. }
  24. /**
  25. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  26. */
  27. function get_total($feed_id) {
  28. $result = db_query("select count(int_id) AS count from ttrss_user_entries where owner_uid = ".$_SESSION["uid"]." and uuid != ''");
  29. return db_fetch_result($result, 0, "count");
  30. }
  31. /**
  32. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  33. */
  34. function get_headlines($feed_id, $options) {
  35. $params = array(
  36. "feed" => -4,
  37. "limit" => $options["limit"],
  38. "view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
  39. "search" => $options['search'],
  40. "override_order" => $options['override_order'],
  41. "offset" => $options["offset"],
  42. "filter" => $options["filter"],
  43. "since_id" => $options["since_id"],
  44. "include_children" => $options["include_children"],
  45. "override_strategy" => "uuid != ''",
  46. "override_vfeed" => "ttrss_feeds.title AS feed_title,"
  47. );
  48. $qfh_ret = Feeds::queryFeedHeadlines($params);
  49. $qfh_ret[1] = __("Shared articles");
  50. return $qfh_ret;
  51. }
  52. }