feeds: unify naming

master
Andrew Dolgov 4 years ago
parent 6b006a18e7
commit 020f062a76

@ -96,7 +96,7 @@ class API extends Handler {
if ($feed_id) { if ($feed_id) {
$this->wrap(self::STATUS_OK, array("unread" => getFeedUnread($feed_id, $is_cat))); $this->wrap(self::STATUS_OK, array("unread" => getFeedUnread($feed_id, $is_cat)));
} else { } else {
$this->wrap(self::STATUS_OK, array("unread" => Feeds::getGlobalUnread())); $this->wrap(self::STATUS_OK, array("unread" => Feeds::_get_global_unread()));
} }
} }
@ -147,7 +147,7 @@ class API extends Handler {
$unread = getFeedUnread($line["id"], true); $unread = getFeedUnread($line["id"], true);
if ($enable_nested) if ($enable_nested)
$unread += Feeds::getCategoryChildrenUnread($line["id"]); $unread += Feeds::_get_cat_children_unread($line["id"]);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
array_push($cats, array("id" => (int) $line["id"], array_push($cats, array("id" => (int) $line["id"],
@ -165,7 +165,7 @@ class API extends Handler {
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
array_push($cats, array("id" => $cat_id, array_push($cats, array("id" => $cat_id,
"title" => Feeds::getCategoryTitle($cat_id), "title" => Feeds::_get_cat_title($cat_id),
"unread" => (int) $unread)); "unread" => (int) $unread));
} }
} }
@ -204,7 +204,7 @@ class API extends Handler {
$_SESSION['hasSandbox'] = $has_sandbox; $_SESSION['hasSandbox'] = $has_sandbox;
list($override_order, $skip_first_id_check) = Feeds::order_to_override_query(clean($_REQUEST["order_by"] ?? null)); list($override_order, $skip_first_id_check) = Feeds::_order_to_override_query(clean($_REQUEST["order_by"] ?? null));
/* do not rely on params below */ /* do not rely on params below */
@ -395,7 +395,7 @@ class API extends Handler {
if (!in_array($mode, ["all", "1day", "1week", "2week"])) if (!in_array($mode, ["all", "1day", "1week", "2week"]))
$mode = "all"; $mode = "all";
Feeds::catchup_feed($feed_id, $is_cat, $_SESSION["uid"], $mode); Feeds::_catchup($feed_id, $is_cat, $_SESSION["uid"], $mode);
$this->wrap(self::STATUS_OK, array("status" => "OK")); $this->wrap(self::STATUS_OK, array("status" => "OK"));
} }
@ -537,7 +537,7 @@ class API extends Handler {
$unread = getFeedUnread($i); $unread = getFeedUnread($i);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
$title = Feeds::getFeedTitle($i); $title = Feeds::_get_title($i);
$row = array( $row = array(
"id" => $i, "id" => $i,
@ -562,7 +562,7 @@ class API extends Handler {
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
$unread = getFeedUnread($line["id"], true) + $unread = getFeedUnread($line["id"], true) +
Feeds::getCategoryChildrenUnread($line["id"]); Feeds::_get_cat_children_unread($line["id"]);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
$row = array( $row = array(
@ -610,7 +610,7 @@ class API extends Handler {
$unread = getFeedUnread($line["id"]); $unread = getFeedUnread($line["id"]);
$has_icon = Feeds::feedHasIcon($line['id']); $has_icon = Feeds::_has_icon($line['id']);
if ($unread || !$unread_only) { if ($unread || !$unread_only) {
@ -676,7 +676,7 @@ class API extends Handler {
"skip_first_id_check" => $skip_first_id_check "skip_first_id_check" => $skip_first_id_check
); );
$qfh_ret = Feeds::queryFeedHeadlines($params); $qfh_ret = Feeds::_get_headlines($params);
$result = $qfh_ret[0]; $result = $qfh_ret[0];
$feed_title = $qfh_ret[1]; $feed_title = $qfh_ret[1];
@ -826,7 +826,7 @@ class API extends Handler {
$password = clean($_REQUEST["password"]); $password = clean($_REQUEST["password"]);
if ($feed_url) { if ($feed_url) {
$rc = Feeds::subscribe_to_feed($feed_url, $category_id, $login, $password); $rc = Feeds::_subscribe($feed_url, $category_id, $login, $password);
$this->wrap(self::STATUS_OK, array("status" => $rc)); $this->wrap(self::STATUS_OK, array("status" => $rc));
} else { } else {

@ -25,8 +25,8 @@ class Counters {
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
list ($tmp_unread, $tmp_marked) = self::getCategoryChildrenCounters($line["id"], $owner_uid); list ($tmp_unread, $tmp_marked) = self::getCategoryChildrenCounters($line["id"], $owner_uid);
$unread += $tmp_unread + Feeds::getCategoryUnread($line["id"], $owner_uid); $unread += $tmp_unread + Feeds::_get_cat_unread($line["id"], $owner_uid);
$marked += $tmp_marked + Feeds::getCategoryMarked($line["id"], $owner_uid); $marked += $tmp_marked + Feeds::_get_cat_marked($line["id"], $owner_uid);
} }
return [$unread, $marked]; return [$unread, $marked];
@ -38,7 +38,7 @@ class Counters {
/* Labels category */ /* Labels category */
$cv = array("id" => -2, "kind" => "cat", $cv = array("id" => -2, "kind" => "cat",
"counter" => Feeds::getCategoryUnread(-2)); "counter" => Feeds::_get_cat_unread(-2));
array_push($ret, $cv); array_push($ret, $cv);
@ -114,8 +114,8 @@ class Counters {
$last_error = htmlspecialchars($line["last_error"]); $last_error = htmlspecialchars($line["last_error"]);
$last_updated = TimeHelper::make_local_datetime($line['last_updated'], false); $last_updated = TimeHelper::make_local_datetime($line['last_updated'], false);
if (Feeds::feedHasIcon($id)) { if (Feeds::_has_icon($id)) {
$has_img = filemtime(Feeds::getIconFile($id)); $has_img = filemtime(Feeds::_get_icon_file($id));
} else { } else {
$has_img = false; $has_img = false;
} }
@ -149,7 +149,7 @@ class Counters {
$ret = []; $ret = [];
if ($global_unread == -1) { if ($global_unread == -1) {
$global_unread = Feeds::getGlobalUnread(); $global_unread = Feeds::_get_global_unread();
} }
$cv = [ $cv = [
@ -187,7 +187,7 @@ class Counters {
$count = getFeedUnread($i); $count = getFeedUnread($i);
if ($i == 0 || $i == -1 || $i == -2) if ($i == 0 || $i == -1 || $i == -2)
$auxctr = Feeds::getFeedArticles($i, false); $auxctr = Feeds::_get_counters($i, false);
else else
$auxctr = 0; $auxctr = 0;

@ -16,13 +16,13 @@ class Feeds extends Handler_Protected {
return array_search($method, $csrf_ignored) !== false; return array_search($method, $csrf_ignored) !== false;
} }
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, private function _format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
$offset, $override_order = false, $include_children = false, $check_first_id = false, $offset, $override_order = false, $include_children = false, $check_first_id = false,
$skip_first_id_check = false, $order_by = false) { $skip_first_id_check = false, $order_by = false) {
$disable_cache = false; $disable_cache = false;
$this->mark_timestamp("init"); $this->_mark_timestamp("init");
$reply = []; $reply = [];
$rgba_cache = []; $rgba_cache = [];
@ -41,7 +41,7 @@ class Feeds extends Handler_Protected {
} }
if ($method_split[0] == "MarkAllReadGR") { if ($method_split[0] == "MarkAllReadGR") {
$this->catchup_feed($method_split[1], false); $this->_catchup($method_split[1], false);
} }
// FIXME: might break tag display? // FIXME: might break tag display?
@ -103,10 +103,10 @@ class Feeds extends Handler_Protected {
"order_by" => $order_by "order_by" => $order_by
); );
$qfh_ret = $this->queryFeedHeadlines($params); $qfh_ret = $this->_get_headlines($params);
} }
$this->mark_timestamp("db query"); $this->_mark_timestamp("db query");
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") &&
!(in_array($feed, self::NEVER_GROUP_FEEDS) && !$cat_view); !(in_array($feed, self::NEVER_GROUP_FEEDS) && !$cat_view);
@ -157,13 +157,13 @@ class Feeds extends Handler_Protected {
}, },
$feed, $cat_view, $qfh_ret); $feed, $cat_view, $qfh_ret);
$this->mark_timestamp("object header"); $this->_mark_timestamp("object header");
$headlines_count = 0; $headlines_count = 0;
if ($result instanceof PDOStatement) { if ($result instanceof PDOStatement) {
while ($line = $result->fetch(PDO::FETCH_ASSOC)) { while ($line = $result->fetch(PDO::FETCH_ASSOC)) {
$this->mark_timestamp("article start: " . $line["id"] . " " . $line["title"]); $this->_mark_timestamp("article start: " . $line["id"] . " " . $line["title"]);
++$headlines_count; ++$headlines_count;
@ -181,7 +181,7 @@ class Feeds extends Handler_Protected {
$line, $max_excerpt_length); $line, $max_excerpt_length);
} }
$this->mark_timestamp(" hook_query_headlines"); $this->_mark_timestamp(" hook_query_headlines");
$id = $line["id"]; $id = $line["id"];
@ -226,7 +226,7 @@ class Feeds extends Handler_Protected {
array_push($topmost_article_ids, $id); array_push($topmost_article_ids, $id);
} }
$this->mark_timestamp(" labels"); $this->_mark_timestamp(" labels");
$line["feed_title"] = $line["feed_title"] ?? ""; $line["feed_title"] = $line["feed_title"] ?? "";
@ -244,32 +244,32 @@ class Feeds extends Handler_Protected {
}, },
$line); $line);
$this->mark_timestamp(" pre-sanitize"); $this->_mark_timestamp(" pre-sanitize");
$line["content"] = Sanitizer::sanitize($line["content"], $line["content"] = Sanitizer::sanitize($line["content"],
$line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]); $line['hide_images'], false, $line["site_url"], $highlight_words, $line["id"]);
$this->mark_timestamp(" sanitize"); $this->_mark_timestamp(" sanitize");
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_CDM, PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_CDM,
function ($result, $plugin) use (&$line) { function ($result, $plugin) use (&$line) {
$line = $result; $line = $result;
$this->mark_timestamp(" hook_render_cdm: " . get_class($plugin)); $this->_mark_timestamp(" hook_render_cdm: " . get_class($plugin));
}, },
$line); $line);
$this->mark_timestamp(" hook_render_cdm"); $this->_mark_timestamp(" hook_render_cdm");
$line['content'] = DiskCache::rewriteUrls($line['content']); $line['content'] = DiskCache::rewriteUrls($line['content']);
$this->mark_timestamp(" disk_cache_rewrite"); $this->_mark_timestamp(" disk_cache_rewrite");
if ($line['note']) if ($line['note'])
$line['note'] = Article::format_article_note($id, $line['note']); $line['note'] = Article::format_article_note($id, $line['note']);
else else
$line['note'] = ""; $line['note'] = "";
$this->mark_timestamp(" note"); $this->_mark_timestamp(" note");
if (!get_pref("CDM_EXPANDED")) { if (!get_pref("CDM_EXPANDED")) {
$line["cdm_excerpt"] = "<span class='collapse'> $line["cdm_excerpt"] = "<span class='collapse'>
@ -281,14 +281,14 @@ class Feeds extends Handler_Protected {
} }
} }
$this->mark_timestamp(" pre-enclosures"); $this->_mark_timestamp(" pre-enclosures");
$line["enclosures"] = Article::format_enclosures($id, $line["enclosures"] = Article::format_enclosures($id,
$line["always_display_enclosures"], $line["always_display_enclosures"],
$line["content"], $line["content"],
$line["hide_images"]); $line["hide_images"]);
$this->mark_timestamp(" enclosures"); $this->_mark_timestamp(" enclosures");
$line["updated_long"] = TimeHelper::make_local_datetime($line["updated"],true); $line["updated_long"] = TimeHelper::make_local_datetime($line["updated"],true);
$line["updated"] = TimeHelper::make_local_datetime($line["updated"], false, false, false, true); $line["updated"] = TimeHelper::make_local_datetime($line["updated"], false, false, false, true);
@ -296,7 +296,7 @@ class Feeds extends Handler_Protected {
$line['imported'] = T_sprintf("Imported at %s", $line['imported'] = T_sprintf("Imported at %s",
TimeHelper::make_local_datetime($line["date_entered"], false)); TimeHelper::make_local_datetime($line["date_entered"], false));
$this->mark_timestamp(" local-datetime"); $this->_mark_timestamp(" local-datetime");
if ($line["tag_cache"]) if ($line["tag_cache"])
$tags = explode(",", $line["tag_cache"]); $tags = explode(",", $line["tag_cache"]);
@ -305,9 +305,9 @@ class Feeds extends Handler_Protected {
$line["tags_str"] = Article::format_tags_string($tags); $line["tags_str"] = Article::format_tags_string($tags);
$this->mark_timestamp(" tags"); $this->_mark_timestamp(" tags");
if (self::feedHasIcon($feed_id)) { if (self::_has_icon($feed_id)) {
$line['feed_icon'] = "<img class=\"icon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">"; $line['feed_icon'] = "<img class=\"icon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
} else { } else {
$line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>"; $line['feed_icon'] = "<i class='icon-no-feed material-icons'>rss_feed</i>";
@ -316,7 +316,7 @@ class Feeds extends Handler_Protected {
//setting feed headline background color, needs to change text color based on dark/light //setting feed headline background color, needs to change text color based on dark/light
$fav_color = $line['favicon_avg_color'] ?? false; $fav_color = $line['favicon_avg_color'] ?? false;
$this->mark_timestamp(" pre-color"); $this->_mark_timestamp(" pre-color");
require_once "colors.php"; require_once "colors.php";
@ -324,7 +324,7 @@ class Feeds extends Handler_Protected {
if ($fav_color && $fav_color != 'fail') { if ($fav_color && $fav_color != 'fail') {
$rgba_cache[$feed_id] = _color_unpack($fav_color); $rgba_cache[$feed_id] = _color_unpack($fav_color);
} else { } else {
$rgba_cache[$feed_id] = _color_unpack($this->color_of($line['feed_title'])); $rgba_cache[$feed_id] = _color_unpack($this->_color_of($line['feed_title']));
} }
} }
@ -332,7 +332,7 @@ class Feeds extends Handler_Protected {
$line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)'; $line['feed_bg_color'] = 'rgba(' . implode(",", $rgba_cache[$feed_id]) . ',0.3)';
} }
$this->mark_timestamp(" color"); $this->_mark_timestamp(" color");
/* we don't need those */ /* we don't need those */
@ -342,11 +342,11 @@ class Feeds extends Handler_Protected {
array_push($reply['content'], $line); array_push($reply['content'], $line);
$this->mark_timestamp("article end"); $this->_mark_timestamp("article end");
} }
} }
$this->mark_timestamp("end of articles"); $this->_mark_timestamp("end of articles");
if (!$headlines_count) { if (!$headlines_count) {
@ -408,7 +408,7 @@ class Feeds extends Handler_Protected {
} }
} }
$this->mark_timestamp("end"); $this->_mark_timestamp("end");
return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply); return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply);
} }
@ -489,9 +489,9 @@ class Feeds extends Handler_Protected {
$reply['headlines'] = []; $reply['headlines'] = [];
list($override_order, $skip_first_id_check) = self::order_to_override_query($order_by); list($override_order, $skip_first_id_check) = self::_order_to_override_query($order_by);
$ret = $this->format_headlines_list($feed, $method, $ret = $this->_format_headlines_list($feed, $method,
$view_mode, $limit, $cat_view, $offset, $view_mode, $limit, $cat_view, $offset,
$override_order, true, $check_first_id, $skip_first_id_check, $order_by); $override_order, true, $check_first_id, $skip_first_id_check, $order_by);
@ -600,7 +600,7 @@ class Feeds extends Handler_Protected {
print "<fieldset>"; print "<fieldset>";
print "<input dojoType='dijit.form.ValidationTextBox' id='search_query' print "<input dojoType='dijit.form.ValidationTextBox' id='search_query'
style='font-size : 16px; width : 540px;' style='font-size : 16px; width : 540px;'
placeHolder=\"".T_sprintf("Search %s...", $this->getFeedTitle($active_feed_id, $is_cat))."\" placeHolder=\"".T_sprintf("Search %s...", $this->_get_title($active_feed_id, $is_cat))."\"
name='query' type='search' value=''>"; name='query' type='search' value=''>";
print "</fieldset>"; print "</fieldset>";
@ -686,7 +686,7 @@ class Feeds extends Handler_Protected {
</script> </script>
<div class="container"> <div class="container">
<h1>Feed Debugger: <?= "$feed_id: " . $this->getFeedTitle($feed_id) ?></h1> <h1>Feed Debugger: <?= "$feed_id: " . $this->_get_title($feed_id) ?></h1>
<div class="content"> <div class="content">
<form method="post" action=""> <form method="post" action="">
<input type="hidden" name="op" value="feeds"> <input type="hidden" name="op" value="feeds">
@ -731,7 +731,7 @@ class Feeds extends Handler_Protected {
} }
static function catchup_feed($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) { static function _catchup($feed, $cat_view, $owner_uid = false, $mode = 'all', $search = false) {
if (!$owner_uid) $owner_uid = $_SESSION['uid']; if (!$owner_uid) $owner_uid = $_SESSION['uid'];
@ -751,7 +751,7 @@ class Feeds extends Handler_Protected {
// fall back in case of no plugins // fall back in case of no plugins
if (empty($search_qpart)) { if (empty($search_qpart)) {
list($search_qpart, $search_words) = self::search_to_sql($search[0], $search[1], $owner_uid); list($search_qpart, $search_words) = self::_search_to_sql($search[0], $search[1], $owner_uid);
} }
} else { } else {
$search_qpart = "true"; $search_qpart = "true";
@ -791,7 +791,7 @@ class Feeds extends Handler_Protected {
if ($feed >= 0) { if ($feed >= 0) {
if ($feed > 0) { if ($feed > 0) {
$children = self::getChildCategories($feed, $owner_uid); $children = self::_get_child_cats($feed, $owner_uid);
array_push($children, $feed); array_push($children, $feed);
$children = array_map("intval", $children); $children = array_map("intval", $children);
@ -902,7 +902,7 @@ class Feeds extends Handler_Protected {
} }
} }
static function getFeedArticles($feed, $is_cat = false, $unread_only = false, static function _get_counters($feed, $is_cat = false, $unread_only = false,
$owner_uid = false) { $owner_uid = false) {
$n_feed = (int) $feed; $n_feed = (int) $feed;
@ -921,7 +921,7 @@ class Feeds extends Handler_Protected {
$match_part = ""; $match_part = "";
if ($is_cat) { if ($is_cat) {
return self::getCategoryUnread($n_feed, $owner_uid); return self::_get_cat_unread($n_feed, $owner_uid);
} else if ($n_feed == -6) { } else if ($n_feed == -6) {
return 0; return 0;
} else if ($feed != "0" && $n_feed == 0) { } else if ($feed != "0" && $n_feed == 0) {
@ -967,7 +967,7 @@ class Feeds extends Handler_Protected {
$label_id = Labels::feed_to_label_id($feed); $label_id = Labels::feed_to_label_id($feed);
return self::getLabelUnread($label_id, $owner_uid); return self::_get_label_unread($label_id, $owner_uid);
} }
if ($match_part) { if ($match_part) {
@ -1009,7 +1009,7 @@ class Feeds extends Handler_Protected {
$login = $need_auth ? clean($_REQUEST['login']) : ''; $login = $need_auth ? clean($_REQUEST['login']) : '';
$pass = $need_auth ? clean($_REQUEST['pass']) : ''; $pass = $need_auth ? clean($_REQUEST['pass']) : '';
$rc = Feeds::subscribe_to_feed($feed, $cat, $login, $pass); $rc = Feeds::_subscribe($feed, $cat, $login, $pass);
print json_encode(array("result" => $rc)); print json_encode(array("result" => $rc));
} }
@ -1027,7 +1027,7 @@ class Feeds extends Handler_Protected {
* 5 - Couldn't download the URL content. * 5 - Couldn't download the URL content.
* 6 - Content is an invalid XML. * 6 - Content is an invalid XML.
*/ */
static function subscribe_to_feed($url, $cat_id = 0, static function _subscribe($url, $cat_id = 0,
$auth_login = '', $auth_pass = '') { $auth_login = '', $auth_pass = '') {
global $fetch_last_error; global $fetch_last_error;
@ -1056,8 +1056,8 @@ class Feeds extends Handler_Protected {
return array("code" => 5, "message" => $fetch_last_error); return array("code" => 5, "message" => $fetch_last_error);
} }
if (mb_strpos($fetch_last_content_type, "html") !== false && self::is_html($contents)) { if (mb_strpos($fetch_last_content_type, "html") !== false && self::_is_html($contents)) {
$feedUrls = self::get_feeds_from_html($url, $contents); $feedUrls = self::_get_feeds_from_html($url, $contents);
if (count($feedUrls) == 0) { if (count($feedUrls) == 0) {
return array("code" => 3); return array("code" => 3);
@ -1100,15 +1100,15 @@ class Feeds extends Handler_Protected {
} }
} }
static function getIconFile($feed_id) { static function _get_icon_file($feed_id) {
return ICONS_DIR . "/$feed_id.ico"; return ICONS_DIR . "/$feed_id.ico";
} }
static function feedHasIcon($id) { static function _has_icon($id) {
return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0;
} }
static function getFeedIcon($id) { static function _get_icon($id) {
switch ($id) { switch ($id) {
case 0: case 0:
return "archive"; return "archive";
@ -1132,7 +1132,7 @@ class Feeds extends Handler_Protected {
if ($id < LABEL_BASE_INDEX) { if ($id < LABEL_BASE_INDEX) {
return "label"; return "label";
} else { } else {
$icon = self::getIconFile($id); $icon = self::_get_icon_file($id);
if ($icon && file_exists($icon)) { if ($icon && file_exists($icon)) {
return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon);
@ -1144,11 +1144,11 @@ class Feeds extends Handler_Protected {
return false; return false;
} }
static function getFeedTitle($id, $cat = false) { static function _get_title($id, $cat = false) {
$pdo = Db::pdo(); $pdo = Db::pdo();
if ($cat) { if ($cat) {
return self::getCategoryTitle($id); return self::_get_cat_title($id);
} else if ($id == -1) { } else if ($id == -1) {
return __("Starred articles"); return __("Starred articles");
} else if ($id == -2) { } else if ($id == -2) {
@ -1191,7 +1191,7 @@ class Feeds extends Handler_Protected {
} }
// only real cats // only real cats
static function getCategoryMarked($cat, $owner_uid = false) { static function _get_cat_marked($cat, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@ -1214,7 +1214,7 @@ class Feeds extends Handler_Protected {
} }
} }
static function getCategoryUnread($cat, $owner_uid = false) { static function _get_cat_unread($cat, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@ -1248,7 +1248,7 @@ class Feeds extends Handler_Protected {
} }
// only accepts real cats (>= 0) // only accepts real cats (>= 0)
static function getCategoryChildrenUnread($cat, $owner_uid = false) { static function _get_cat_children_unread($cat, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -1260,14 +1260,14 @@ class Feeds extends Handler_Protected {
$unread = 0; $unread = 0;
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
$unread += self::getCategoryUnread($line["id"], $owner_uid); $unread += self::_get_cat_unread($line["id"], $owner_uid);
$unread += self::getCategoryChildrenUnread($line["id"], $owner_uid); $unread += self::_get_cat_children_unread($line["id"], $owner_uid);
} }
return $unread; return $unread;
} }
static function getGlobalUnread($user_id = false) { static function _get_global_unread($user_id = false) {
if (!$user_id) $user_id = $_SESSION["uid"]; if (!$user_id) $user_id = $_SESSION["uid"];
@ -1283,7 +1283,7 @@ class Feeds extends Handler_Protected {
return $row["count"]; return $row["count"];
} }
static function getCategoryTitle($cat_id) { static function _get_cat_title($cat_id) {
if ($cat_id == -1) { if ($cat_id == -1) {
return __("Special"); return __("Special");
@ -1305,7 +1305,7 @@ class Feeds extends Handler_Protected {
} }
} }
static function getLabelUnread($label_id, $owner_uid = false) { private static function _get_label_unread($label_id, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -1322,7 +1322,7 @@ class Feeds extends Handler_Protected {
} }
} }
static function queryFeedHeadlines($params) { static function _get_headlines($params) {
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -1368,7 +1368,7 @@ class Feeds extends Handler_Protected {
// fall back in case of no plugins // fall back in case of no plugins
if (!$search_query_part) { if (!$search_query_part) {
list($search_query_part, $search_words) = self::search_to_sql($search, $search_language, $owner_uid); list($search_query_part, $search_words) = self::_search_to_sql($search, $search_language, $owner_uid);
} }
if (DB_TYPE == "pgsql") { if (DB_TYPE == "pgsql") {
@ -1406,7 +1406,7 @@ class Feeds extends Handler_Protected {
$unread = getFeedUnread($feed, $cat_view); $unread = getFeedUnread($feed, $cat_view);
if ($cat_view && $feed > 0 && $include_children) if ($cat_view && $feed > 0 && $include_children)
$unread += self::getCategoryChildrenUnread($feed); $unread += self::_get_cat_children_unread($feed);
if ($unread > 0) { if ($unread > 0) {
$view_query_part = " unread = true AND "; $view_query_part = " unread = true AND ";
@ -1450,7 +1450,7 @@ class Feeds extends Handler_Protected {
if ($feed > 0) { if ($feed > 0) {
if ($include_children) { if ($include_children) {
# sub-cats # sub-cats
$subcats = self::getChildCategories($feed, $owner_uid); $subcats = self::_get_child_cats($feed, $owner_uid);
array_push($subcats, $feed); array_push($subcats, $feed);
$subcats = array_map("intval", $subcats); $subcats = array_map("intval", $subcats);
@ -1574,7 +1574,7 @@ class Feeds extends Handler_Protected {
$feed_title = T_sprintf("Search results: %s", $search); $feed_title = T_sprintf("Search results: %s", $search);
} else { } else {
if ($cat_view) { if ($cat_view) {
$feed_title = self::getCategoryTitle($feed); $feed_title = self::_get_cat_title($feed);
} else { } else {
if (is_numeric($feed) && $feed > 0) { if (is_numeric($feed) && $feed > 0) {
$ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated $ssth = $pdo->prepare("SELECT title,site_url,last_error,last_updated
@ -1587,7 +1587,7 @@ class Feeds extends Handler_Protected {
$last_error = $row["last_error"]; $last_error = $row["last_error"];
$last_updated = $row["last_updated"]; $last_updated = $row["last_updated"];
} else { } else {
$feed_title = self::getFeedTitle($feed); $feed_title = self::_get_title($feed);
} }
} }
} }
@ -1802,7 +1802,7 @@ class Feeds extends Handler_Protected {
} }
static function getParentCategories($cat, $owner_uid) { static function _get_parent_cats($cat, $owner_uid) {
$rv = array(); $rv = array();
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -1813,13 +1813,13 @@ class Feeds extends Handler_Protected {
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
array_push($rv, $line["parent_cat"]); array_push($rv, $line["parent_cat"]);
$rv = array_merge($rv, self::getParentCategories($line["parent_cat"], $owner_uid)); $rv = array_merge($rv, self::_get_parent_cats($line["parent_cat"], $owner_uid));
} }
return $rv; return $rv;
} }
static function getChildCategories($cat, $owner_uid) { static function _get_child_cats($cat, $owner_uid) {
$rv = array(); $rv = array();
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -1830,13 +1830,13 @@ class Feeds extends Handler_Protected {
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
array_push($rv, $line["id"]); array_push($rv, $line["id"]);
$rv = array_merge($rv, self::getChildCategories($line["id"], $owner_uid)); $rv = array_merge($rv, self::_get_child_cats($line["id"], $owner_uid));
} }
return $rv; return $rv;
} }
static function getFeedCategory($feed) { static function _cat_of_feed($feed) {
$pdo = Db::pdo(); $pdo = Db::pdo();
$sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds $sth = $pdo->prepare("SELECT cat_id FROM ttrss_feeds
@ -1851,7 +1851,7 @@ class Feeds extends Handler_Protected {
} }
function color_of($name) { private function _color_of($name) {
$colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b", $colormap = [ "#1cd7d7","#d91111","#1212d7","#8e16e5","#7b7b7b",
"#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416",
"#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ];
@ -1867,7 +1867,7 @@ class Feeds extends Handler_Protected {
return $colormap[$sum]; return $colormap[$sum];
} }
static function get_feeds_from_html($url, $content) { private static function _get_feeds_from_html($url, $content) {
$url = UrlHelper::validate($url); $url = UrlHelper::validate($url);
$baseUrl = substr($url, 0, strrpos($url, '/') + 1); $baseUrl = substr($url, 0, strrpos($url, '/') + 1);
@ -1895,11 +1895,11 @@ class Feeds extends Handler_Protected {
return $feedUrls; return $feedUrls;
} }
static function is_html($content) { static function _is_html($content) {
return preg_match("/<html|DOCTYPE html/i", substr($content, 0, 8192)) !== 0; return preg_match("/<html|DOCTYPE html/i", substr($content, 0, 8192)) !== 0;
} }
static function add_feed_category($feed_cat, $parent_cat_id = false, $order_id = 0) { static function _add_cat($feed_cat, $parent_cat_id = false, $order_id = 0) {
if (!$feed_cat) return false; if (!$feed_cat) return false;
@ -1936,7 +1936,7 @@ class Feeds extends Handler_Protected {
return false; return false;
} }
static function get_feed_access_key($feed_id, $is_cat, $owner_uid = false) { static function _get_access_key($feed_id, $is_cat, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"]; if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@ -1972,9 +1972,9 @@ class Feeds extends Handler_Protected {
* @access public * @access public
* @return mixed * @return mixed
*/ */
static function purge_feed($feed_id, $purge_interval) { static function _purge($feed_id, $purge_interval) {
if (!$purge_interval) $purge_interval = self::feed_purge_interval($feed_id); if (!$purge_interval) $purge_interval = self::_get_purge_interval($feed_id);
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -2042,7 +2042,7 @@ class Feeds extends Handler_Protected {
return $rows_deleted; return $rows_deleted;
} }
static function feed_purge_interval($feed_id) { private static function _get_purge_interval($feed_id) {
$pdo = Db::pdo(); $pdo = Db::pdo();
@ -2063,7 +2063,7 @@ class Feeds extends Handler_Protected {
} }
} }
static function search_to_sql($search, $search_language, $owner_uid) { private static function _search_to_sql($search, $search_language, $owner_uid) {
$keywords = str_getcsv(trim($search), " "); $keywords = str_getcsv(trim($search), " ");
$query_keywords = array(); $query_keywords = array();
@ -2231,7 +2231,7 @@ class Feeds extends Handler_Protected {
return array($search_query_part, $search_words); return array($search_query_part, $search_words);
} }
static function order_to_override_query($order) { static function _order_to_override_query($order) {
$query = ""; $query = "";
$skip_first_id = false; $skip_first_id = false;
@ -2259,7 +2259,7 @@ class Feeds extends Handler_Protected {
return [$query, $skip_first_id]; return [$query, $skip_first_id];
} }
function mark_timestamp($label) { private function _mark_timestamp($label) {
if (empty($_REQUEST['timestamps'])) if (empty($_REQUEST['timestamps']))
return; return;

@ -12,7 +12,7 @@ class Handler_Public extends Handler {
if (!$limit) $limit = 60; if (!$limit) $limit = 60;
list($override_order, $skip_first_id_check) = Feeds::order_to_override_query($order); list($override_order, $skip_first_id_check) = Feeds::_order_to_override_query($order);
if (!$override_order) { if (!$override_order) {
$override_order = "date_entered DESC, updated DESC"; $override_order = "date_entered DESC, updated DESC";
@ -55,7 +55,7 @@ class Handler_Public extends Handler {
} }
} else { } else {
$qfh_ret = Feeds::queryFeedHeadlines($params); $qfh_ret = Feeds::_get_headlines($params);
} }
$result = $qfh_ret[0]; $result = $qfh_ret[0];
@ -65,7 +65,7 @@ class Handler_Public extends Handler {
$feed_self_url = get_self_url_prefix() . $feed_self_url = get_self_url_prefix() .
"/public.php?op=rss&id=$feed&key=" . "/public.php?op=rss&id=$feed&key=" .
Feeds::get_feed_access_key($feed, false, $owner_uid); Feeds::_get_access_key($feed, false, $owner_uid);
if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); if (!$feed_site_url) $feed_site_url = get_self_url_prefix();
@ -251,11 +251,11 @@ class Handler_Public extends Handler {
$uid = UserHelper::find_user_by_login($login); $uid = UserHelper::find_user_by_login($login);
if ($uid) { if ($uid) {
print Feeds::getGlobalUnread($uid); print Feeds::_get_global_unread($uid);
if ($fresh) { if ($fresh) {
print ";"; print ";";
print Feeds::getFeedArticles(-3, false, true, $uid); print Feeds::_get_counters(-3, false, true, $uid);
} }
} else { } else {
print "-1;User not found"; print "-1;User not found";
@ -803,7 +803,7 @@ class Handler_Public extends Handler {
<?php <?php
} else { } else {
$rc = Feeds::subscribe_to_feed($feed_url); $rc = Feeds::_subscribe($feed_url);
$feed_urls = false; $feed_urls = false;
switch ($rc['code']) { switch ($rc['code']) {

@ -31,7 +31,7 @@ class OPML extends Handler_Protected {
<body class='claro ttrss_utility'> <body class='claro ttrss_utility'>
<h1>".__('OPML Utility')."</h1><div class='content'>"; <h1>".__('OPML Utility')."</h1><div class='content'>";
Feeds::add_feed_category("Imported feeds"); Feeds::_add_cat("Imported feeds");
$this->opml_notice(__("Importing OPML...")); $this->opml_notice(__("Importing OPML..."));
@ -205,7 +205,7 @@ class OPML extends Handler_Protected {
if (!$tmp_line["match_on"]) { if (!$tmp_line["match_on"]) {
if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) { if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
$tmp_line["feed"] = Feeds::getFeedTitle( $tmp_line["feed"] = Feeds::_get_title(
$cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"], $cat_filter ? $tmp_line["cat_id"] : $tmp_line["feed_id"],
$cat_filter); $cat_filter);
} else { } else {
@ -218,13 +218,13 @@ class OPML extends Handler_Protected {
if (strpos($feed_id, "CAT:") === 0) { if (strpos($feed_id, "CAT:") === 0) {
$feed_id = (int)substr($feed_id, 4); $feed_id = (int)substr($feed_id, 4);
if ($feed_id) { if ($feed_id) {
array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); array_push($match, [Feeds::_get_cat_title($feed_id), true, false]);
} else { } else {
array_push($match, [0, true, true]); array_push($match, [0, true, true]);
} }
} else { } else {
if ($feed_id) { if ($feed_id) {
array_push($match, [Feeds::getFeedTitle((int)$feed_id), false, false]); array_push($match, [Feeds::_get_title((int)$feed_id), false, false]);
} else { } else {
array_push($match, [0, false, true]); array_push($match, [0, false, true]);
} }
@ -523,7 +523,7 @@ class OPML extends Handler_Protected {
$order_id = (int) $root_node->attributes->getNamedItem('ttrssSortOrder')->nodeValue; $order_id = (int) $root_node->attributes->getNamedItem('ttrssSortOrder')->nodeValue;
if (!$order_id) $order_id = 0; if (!$order_id) $order_id = 0;
Feeds::add_feed_category($cat_title, $parent_id, $order_id); Feeds::_add_cat($cat_title, $parent_id, $order_id);
$cat_id = $this->get_feed_category($cat_title, $parent_id); $cat_id = $this->get_feed_category($cat_title, $parent_id);
} }
@ -638,7 +638,7 @@ class OPML extends Handler_Protected {
$url_path = get_self_url_prefix(); $url_path = get_self_url_prefix();
$url_path .= "/opml.php?op=publish&key=" . $url_path .= "/opml.php?op=publish&key=" .
Feeds::get_feed_access_key('OPML:Publish', false, $_SESSION["uid"]); Feeds::_get_access_key('OPML:Publish', false, $_SESSION["uid"]);
return $url_path; return $url_path;
} }

@ -98,7 +98,7 @@ class Pref_Feeds extends Handler_Protected {
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['unread'] = -1; $feed['unread'] = -1;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::_get_icon($feed_line['id']);
$feed['param'] = TimeHelper::make_local_datetime( $feed['param'] = TimeHelper::make_local_datetime(
$feed_line['last_updated'], true); $feed_line['last_updated'], true);
$feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
@ -266,7 +266,7 @@ class Pref_Feeds extends Handler_Protected {
$feed['name'] = $feed_line['title']; $feed['name'] = $feed_line['title'];
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::_get_icon($feed_line['id']);
$feed['param'] = TimeHelper::make_local_datetime( $feed['param'] = TimeHelper::make_local_datetime(
$feed_line['last_updated'], true); $feed_line['last_updated'], true);
$feed['unread'] = -1; $feed['unread'] = -1;
@ -301,7 +301,7 @@ class Pref_Feeds extends Handler_Protected {
$feed['name'] = $feed_line['title']; $feed['name'] = $feed_line['title'];
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::_get_icon($feed_line['id']);
$feed['param'] = TimeHelper::make_local_datetime( $feed['param'] = TimeHelper::make_local_datetime(
$feed_line['last_updated'], true); $feed_line['last_updated'], true);
$feed['unread'] = -1; $feed['unread'] = -1;
@ -777,7 +777,7 @@ class Pref_Feeds extends Handler_Protected {
/* Icon */ /* Icon */
print "<img class='feedIcon feed-editor-icon' src=\"".Feeds::getFeedIcon($feed_id)."\">"; print "<img class='feedIcon feed-editor-icon' src=\"".Feeds::_get_icon($feed_id)."\">";
print "<form onsubmit='return false;' id='feed_icon_upload_form' print "<form onsubmit='return false;' id='feed_icon_upload_form'
enctype='multipart/form-data' method='POST'> enctype='multipart/form-data' method='POST'>
@ -1189,7 +1189,7 @@ class Pref_Feeds extends Handler_Protected {
function addCat() { function addCat() {
$feed_cat = clean($_REQUEST["cat"]); $feed_cat = clean($_REQUEST["cat"]);
Feeds::add_feed_category($feed_cat); Feeds::_add_cat($feed_cat);
} }
function importOpml() { function importOpml() {
@ -1420,9 +1420,9 @@ class Pref_Feeds extends Handler_Protected {
$obj['id'] = 'CAT:' . $cat_id; $obj['id'] = 'CAT:' . $cat_id;
$obj['items'] = array(); $obj['items'] = array();
$obj['name'] = Feeds::getCategoryTitle($cat_id); $obj['name'] = Feeds::_get_cat_title($cat_id);
$obj['type'] = 'category'; $obj['type'] = 'category';
$obj['unread'] = -1; //(int) Feeds::getCategoryUnread($cat_id); $obj['unread'] = -1; //(int) Feeds::_get_cat_unread($cat_id);
$obj['bare_id'] = $cat_id; $obj['bare_id'] = $cat_id;
return $obj; return $obj;
@ -1433,7 +1433,7 @@ class Pref_Feeds extends Handler_Protected {
$feed_id = (int) $feed_id; $feed_id = (int) $feed_id;
if (!$title) if (!$title)
$title = Feeds::getFeedTitle($feed_id, false); $title = Feeds::_get_title($feed_id, false);
if ($unread === false) if ($unread === false)
$unread = getFeedUnread($feed_id, false); $unread = getFeedUnread($feed_id, false);
@ -1444,7 +1444,7 @@ class Pref_Feeds extends Handler_Protected {
$obj['type'] = 'feed'; $obj['type'] = 'feed';
$obj['error'] = $error; $obj['error'] = $error;
$obj['updated'] = $updated; $obj['updated'] = $updated;
$obj['icon'] = Feeds::getFeedIcon($feed_id); $obj['icon'] = Feeds::_get_icon($feed_id);
$obj['bare_id'] = $feed_id; $obj['bare_id'] = $feed_id;
$obj['auxcounter'] = 0; $obj['auxcounter'] = 0;
@ -1611,11 +1611,11 @@ class Pref_Feeds extends Handler_Protected {
'id' => $feed_id, 'id' => $feed_id,
'is_cat' => (int)$is_cat, 'is_cat' => (int)$is_cat,
'q' => $search, 'q' => $search,
'key' => Feeds::get_feed_access_key($feed_id, $is_cat, $_SESSION["uid"]) 'key' => Feeds::_get_access_key($feed_id, $is_cat, $_SESSION["uid"])
]); ]);
print json_encode([ print json_encode([
"title" => Feeds::getFeedTitle($feed_id, $is_cat), "title" => Feeds::_get_title($feed_id, $is_cat),
"link" => $link "link" => $link
]); ]);
} }
@ -1627,7 +1627,7 @@ class Pref_Feeds extends Handler_Protected {
WHERE feed_id = ? AND is_cat = ? AND owner_uid = ?"); WHERE feed_id = ? AND is_cat = ? AND owner_uid = ?");
$sth->execute([$feed_id, bool_to_sql_bool($is_cat), $owner_uid]); $sth->execute([$feed_id, bool_to_sql_bool($is_cat), $owner_uid]);
return Feeds::get_feed_access_key($feed_id, $is_cat, $owner_uid); return Feeds::_get_access_key($feed_id, $is_cat, $owner_uid);
} }
// Silent // Silent

@ -189,10 +189,10 @@ class Pref_Filters extends Handler_Protected {
if (strpos($feed_id, "CAT:") === 0) { if (strpos($feed_id, "CAT:") === 0) {
$feed_id = (int)substr($feed_id, 4); $feed_id = (int)substr($feed_id, 4);
array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); array_push($feeds_fmt, Feeds::_get_cat_title($feed_id));
} else { } else {
if ($feed_id) if ($feed_id)
array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); array_push($feeds_fmt, Feeds::_get_title((int)$feed_id));
else else
array_push($feeds_fmt, __("All feeds")); array_push($feeds_fmt, __("All feeds"));
} }
@ -203,9 +203,9 @@ class Pref_Filters extends Handler_Protected {
} else { } else {
$where = $line["cat_filter"] ? $where = $line["cat_filter"] ?
Feeds::getCategoryTitle($line["cat_id"]) : Feeds::_get_cat_title($line["cat_id"]) :
($line["feed_id"] ? ($line["feed_id"] ?
Feeds::getFeedTitle($line["feed_id"]) : __("All feeds")); Feeds::_get_title($line["feed_id"]) : __("All feeds"));
} }
# $where = $line["cat_id"] . "/" . $line["feed_id"]; # $where = $line["cat_id"] . "/" . $line["feed_id"];
@ -494,10 +494,10 @@ class Pref_Filters extends Handler_Protected {
if (strpos($feed_id, "CAT:") === 0) { if (strpos($feed_id, "CAT:") === 0) {
$feed_id = (int)substr($feed_id, 4); $feed_id = (int)substr($feed_id, 4);
array_push($feeds_fmt, Feeds::getCategoryTitle($feed_id)); array_push($feeds_fmt, Feeds::_get_cat_title($feed_id));
} else { } else {
if ($feed_id) if ($feed_id)
array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); array_push($feeds_fmt, Feeds::_get_title((int)$feed_id));
else else
array_push($feeds_fmt, __("All feeds")); array_push($feeds_fmt, __("All feeds"));
} }

@ -219,7 +219,7 @@ class RPC extends Handler_Protected {
$search_query = clean($_REQUEST['search_query']); $search_query = clean($_REQUEST['search_query']);
$search_lang = clean($_REQUEST['search_lang']); $search_lang = clean($_REQUEST['search_lang']);
Feeds::catchup_feed($feed_id, $is_cat, false, $mode, [$search_query, $search_lang]); Feeds::_catchup($feed_id, $is_cat, false, $mode, [$search_query, $search_lang]);
// return counters here synchronously so that frontend can figure out next unread feed properly // return counters here synchronously so that frontend can figure out next unread feed properly
print json_encode(['counters' => Counters::getAllCounters()]); print json_encode(['counters' => Counters::getAllCounters()]);

@ -1239,7 +1239,7 @@ class RSSUtils {
Debug::log("purging feed...", Debug::$LOG_VERBOSE); Debug::log("purging feed...", Debug::$LOG_VERBOSE);
Feeds::purge_feed($feed, 0); Feeds::_purge($feed, 0);
$sth = $pdo->prepare("UPDATE ttrss_feeds SET $sth = $pdo->prepare("UPDATE ttrss_feeds SET
last_updated = NOW(), last_updated = NOW(),
@ -1706,7 +1706,7 @@ class RSSUtils {
$filters = array(); $filters = array();
$feed_id = (int) $feed_id; $feed_id = (int) $feed_id;
$cat_id = (int)Feeds::getFeedCategory($feed_id); $cat_id = (int)Feeds::_cat_of_feed($feed_id);
if ($cat_id == 0) if ($cat_id == 0)
$null_cat_qpart = "cat_id IS NULL OR"; $null_cat_qpart = "cat_id IS NULL OR";
@ -1720,7 +1720,7 @@ class RSSUtils {
$sth->execute([$owner_uid]); $sth->execute([$owner_uid]);
$check_cats = array_merge( $check_cats = array_merge(
Feeds::getParentCategories($cat_id, $owner_uid), Feeds::_get_parent_cats($cat_id, $owner_uid),
[$cat_id]); [$cat_id]);
$check_cats_str = join(",", $check_cats); $check_cats_str = join(",", $check_cats);

@ -217,7 +217,7 @@
// @deprecated // @deprecated
function getFeedUnread($feed, $is_cat = false) { function getFeedUnread($feed, $is_cat = false) {
return Feeds::getFeedArticles($feed, $is_cat, true, $_SESSION["uid"]); return Feeds::_get_counters($feed, $is_cat, true, $_SESSION["uid"]);
} }
// @deprecated // @deprecated

@ -501,7 +501,7 @@ const Feeds = {
const tree = dijit.byId("feedTree"); const tree = dijit.byId("feedTree");
if (tree && tree.model) if (tree && tree.model)
return tree.getFeedCategory(feed); return tree._cat_of_feed(feed);
} catch (e) { } catch (e) {
// //

@ -11,7 +11,7 @@ class Af_Comics_Gocomics extends Af_ComicFilter {
public function on_subscribe($url) { public function on_subscribe($url) {
if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url))
return '<?xml version="1.0" encoding="utf-8"?>'; // Get is_html() to return false. return '<?xml version="1.0" encoding="utf-8"?>'; // Get _is_html() to return false.
else else
return false; return false;
} }

@ -11,7 +11,7 @@ class Af_Comics_Gocomics_FarSide extends Af_ComicFilter {
public function on_subscribe($url) { public function on_subscribe($url) {
if (preg_match("#^https?://www\.thefarside\.com#", $url)) if (preg_match("#^https?://www\.thefarside\.com#", $url))
return '<?xml version="1.0" encoding="utf-8"?>'; // Get is_html() to return false. return '<?xml version="1.0" encoding="utf-8"?>'; // Get _is_html() to return false.
else else
return false; return false;
} }

@ -209,7 +209,7 @@ class Af_Psql_Trgm extends Plugin {
print "<li>" . print "<li>" .
"<i class='material-icons'>rss_feed</i> <a href='#' "<i class='material-icons'>rss_feed</i> <a href='#'
onclick='CommonDialogs.editFeed($f)'>" . onclick='CommonDialogs.editFeed($f)'>" .
Feeds::getFeedTitle($f) . "</a></li>"; Feeds::_get_title($f) . "</a></li>";
} }
print "</ul>"; print "</ul>";
} }

@ -122,7 +122,7 @@ class Af_Readability extends Plugin {
print "<li><i class='material-icons'>rss_feed</i> <a href='#' print "<li><i class='material-icons'>rss_feed</i> <a href='#'
onclick='CommonDialogs.editFeed($f)'>". onclick='CommonDialogs.editFeed($f)'>".
Feeds::getFeedTitle($f) . " " . ($is_append ? __("(append)") : "") . "</a></li>"; Feeds::_get_title($f) . " " . ($is_append ? __("(append)") : "") . "</a></li>";
} }
print "</ul>"; print "</ul>";
} }

@ -60,7 +60,7 @@ class VF_Shared extends Plugin {
"override_vfeed" => "ttrss_feeds.title AS feed_title," "override_vfeed" => "ttrss_feeds.title AS feed_title,"
); );
$qfh_ret = Feeds::queryFeedHeadlines($params); $qfh_ret = Feeds::_get_headlines($params);
$qfh_ret[1] = __("Shared articles"); $qfh_ret[1] = __("Shared articles");
return $qfh_ret; return $qfh_ret;

Loading…
Cancel
Save