2013-07-11 09:48:39 +00:00
|
|
|
<?php
|
|
|
|
class VF_Shared extends Plugin {
|
|
|
|
|
2017-12-03 07:50:40 +00:00
|
|
|
/* @var PluginHost $host */
|
2013-07-11 09:48:39 +00:00
|
|
|
private $host;
|
|
|
|
|
|
|
|
function about() {
|
2021-03-01 09:11:42 +00:00
|
|
|
return array(null,
|
2013-07-11 09:48:39 +00:00
|
|
|
"Feed for all articles actively shared by URL",
|
|
|
|
"fox",
|
|
|
|
false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function init($host) {
|
|
|
|
$this->host = $host;
|
|
|
|
|
2018-12-05 19:33:09 +00:00
|
|
|
$host->add_feed(-1, __("Shared articles"), 'link', $this);
|
2013-07-11 09:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function api_version() {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_unread($feed_id) {
|
2018-11-03 12:08:43 +00:00
|
|
|
$sth = $this->pdo->prepare("select count(int_id) AS count
|
2017-12-03 07:50:40 +00:00
|
|
|
from ttrss_user_entries where owner_uid = ? and unread = true and uuid != ''");
|
|
|
|
$sth->execute([$_SESSION['uid']]);
|
2013-07-11 09:48:39 +00:00
|
|
|
|
2017-12-03 07:50:40 +00:00
|
|
|
if ($row = $sth->fetch()) {
|
|
|
|
return $row['count'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2013-07-11 09:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_total($feed_id) {
|
2018-11-03 12:08:43 +00:00
|
|
|
$sth = $this->pdo->prepare("select count(int_id) AS count
|
2017-12-03 07:50:40 +00:00
|
|
|
from ttrss_user_entries where owner_uid = ? and uuid != ''");
|
|
|
|
$sth->execute([$_SESSION['uid']]);
|
|
|
|
|
|
|
|
if ($row = $sth->fetch()) {
|
|
|
|
return $row['count'];
|
|
|
|
}
|
2013-07-11 09:48:39 +00:00
|
|
|
|
2017-12-03 07:50:40 +00:00
|
|
|
return 0;
|
2013-07-11 09:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_headlines($feed_id, $options) {
|
2015-07-11 22:29:36 +00:00
|
|
|
$params = array(
|
|
|
|
"feed" => -4,
|
|
|
|
"limit" => $options["limit"],
|
|
|
|
"view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
|
|
|
|
"search" => $options['search'],
|
|
|
|
"override_order" => $options['override_order'],
|
|
|
|
"offset" => $options["offset"],
|
|
|
|
"filter" => $options["filter"],
|
|
|
|
"since_id" => $options["since_id"],
|
|
|
|
"include_children" => $options["include_children"],
|
|
|
|
"override_strategy" => "uuid != ''",
|
|
|
|
"override_vfeed" => "ttrss_feeds.title AS feed_title,"
|
|
|
|
);
|
|
|
|
|
2021-02-15 12:43:07 +00:00
|
|
|
$qfh_ret = Feeds::_get_headlines($params);
|
2013-07-11 09:48:39 +00:00
|
|
|
$qfh_ret[1] = __("Shared articles");
|
|
|
|
|
|
|
|
return $qfh_ret;
|
|
|
|
}
|
|
|
|
|
2021-02-08 16:42:10 +00:00
|
|
|
}
|