From 020f062a76746a313fae9c82fbcf9b37fcc9d459 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 15:43:07 +0300 Subject: [PATCH] feeds: unify naming --- classes/api.php | 20 +-- classes/counters.php | 14 +- classes/feeds.php | 152 +++++++++--------- classes/handler/public.php | 12 +- classes/opml.php | 12 +- classes/pref/feeds.php | 24 +-- classes/pref/filters.php | 12 +- classes/rpc.php | 2 +- classes/rssutils.php | 6 +- include/functions.php | 2 +- js/Feeds.js | 2 +- .../af_comics/filters/af_comics_gocomics.php | 2 +- .../filters/af_comics_gocomics_farside.php | 2 +- plugins/af_psql_trgm/init.php | 2 +- plugins/af_readability/init.php | 2 +- plugins/vf_shared/init.php | 2 +- 16 files changed, 134 insertions(+), 134 deletions(-) diff --git a/classes/api.php b/classes/api.php index 2531f0017..73e5c221a 100755 --- a/classes/api.php +++ b/classes/api.php @@ -96,7 +96,7 @@ class API extends Handler { if ($feed_id) { $this->wrap(self::STATUS_OK, array("unread" => getFeedUnread($feed_id, $is_cat))); } 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); if ($enable_nested) - $unread += Feeds::getCategoryChildrenUnread($line["id"]); + $unread += Feeds::_get_cat_children_unread($line["id"]); if ($unread || !$unread_only) { array_push($cats, array("id" => (int) $line["id"], @@ -165,7 +165,7 @@ class API extends Handler { if ($unread || !$unread_only) { array_push($cats, array("id" => $cat_id, - "title" => Feeds::getCategoryTitle($cat_id), + "title" => Feeds::_get_cat_title($cat_id), "unread" => (int) $unread)); } } @@ -204,7 +204,7 @@ class API extends Handler { $_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 */ @@ -395,7 +395,7 @@ class API extends Handler { if (!in_array($mode, ["all", "1day", "1week", "2week"])) $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")); } @@ -537,7 +537,7 @@ class API extends Handler { $unread = getFeedUnread($i); if ($unread || !$unread_only) { - $title = Feeds::getFeedTitle($i); + $title = Feeds::_get_title($i); $row = array( "id" => $i, @@ -562,7 +562,7 @@ class API extends Handler { while ($line = $sth->fetch()) { $unread = getFeedUnread($line["id"], true) + - Feeds::getCategoryChildrenUnread($line["id"]); + Feeds::_get_cat_children_unread($line["id"]); if ($unread || !$unread_only) { $row = array( @@ -610,7 +610,7 @@ class API extends Handler { $unread = getFeedUnread($line["id"]); - $has_icon = Feeds::feedHasIcon($line['id']); + $has_icon = Feeds::_has_icon($line['id']); if ($unread || !$unread_only) { @@ -676,7 +676,7 @@ class API extends Handler { "skip_first_id_check" => $skip_first_id_check ); - $qfh_ret = Feeds::queryFeedHeadlines($params); + $qfh_ret = Feeds::_get_headlines($params); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; @@ -826,7 +826,7 @@ class API extends Handler { $password = clean($_REQUEST["password"]); 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)); } else { diff --git a/classes/counters.php b/classes/counters.php index 59605df18..29ced3d6c 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -25,8 +25,8 @@ class Counters { while ($line = $sth->fetch()) { list ($tmp_unread, $tmp_marked) = self::getCategoryChildrenCounters($line["id"], $owner_uid); - $unread += $tmp_unread + Feeds::getCategoryUnread($line["id"], $owner_uid); - $marked += $tmp_marked + Feeds::getCategoryMarked($line["id"], $owner_uid); + $unread += $tmp_unread + Feeds::_get_cat_unread($line["id"], $owner_uid); + $marked += $tmp_marked + Feeds::_get_cat_marked($line["id"], $owner_uid); } return [$unread, $marked]; @@ -38,7 +38,7 @@ class Counters { /* Labels category */ $cv = array("id" => -2, "kind" => "cat", - "counter" => Feeds::getCategoryUnread(-2)); + "counter" => Feeds::_get_cat_unread(-2)); array_push($ret, $cv); @@ -114,8 +114,8 @@ class Counters { $last_error = htmlspecialchars($line["last_error"]); $last_updated = TimeHelper::make_local_datetime($line['last_updated'], false); - if (Feeds::feedHasIcon($id)) { - $has_img = filemtime(Feeds::getIconFile($id)); + if (Feeds::_has_icon($id)) { + $has_img = filemtime(Feeds::_get_icon_file($id)); } else { $has_img = false; } @@ -149,7 +149,7 @@ class Counters { $ret = []; if ($global_unread == -1) { - $global_unread = Feeds::getGlobalUnread(); + $global_unread = Feeds::_get_global_unread(); } $cv = [ @@ -187,7 +187,7 @@ class Counters { $count = getFeedUnread($i); if ($i == 0 || $i == -1 || $i == -2) - $auxctr = Feeds::getFeedArticles($i, false); + $auxctr = Feeds::_get_counters($i, false); else $auxctr = 0; diff --git a/classes/feeds.php b/classes/feeds.php index 4cc76bd62..6bf176261 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -16,13 +16,13 @@ class Feeds extends Handler_Protected { 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, $skip_first_id_check = false, $order_by = false) { $disable_cache = false; - $this->mark_timestamp("init"); + $this->_mark_timestamp("init"); $reply = []; $rgba_cache = []; @@ -41,7 +41,7 @@ class Feeds extends Handler_Protected { } if ($method_split[0] == "MarkAllReadGR") { - $this->catchup_feed($method_split[1], false); + $this->_catchup($method_split[1], false); } // FIXME: might break tag display? @@ -103,10 +103,10 @@ class Feeds extends Handler_Protected { "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") && !(in_array($feed, self::NEVER_GROUP_FEEDS) && !$cat_view); @@ -157,13 +157,13 @@ class Feeds extends Handler_Protected { }, $feed, $cat_view, $qfh_ret); - $this->mark_timestamp("object header"); + $this->_mark_timestamp("object header"); $headlines_count = 0; if ($result instanceof PDOStatement) { 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; @@ -181,7 +181,7 @@ class Feeds extends Handler_Protected { $line, $max_excerpt_length); } - $this->mark_timestamp(" hook_query_headlines"); + $this->_mark_timestamp(" hook_query_headlines"); $id = $line["id"]; @@ -226,7 +226,7 @@ class Feeds extends Handler_Protected { array_push($topmost_article_ids, $id); } - $this->mark_timestamp(" labels"); + $this->_mark_timestamp(" labels"); $line["feed_title"] = $line["feed_title"] ?? ""; @@ -244,32 +244,32 @@ class Feeds extends Handler_Protected { }, $line); - $this->mark_timestamp(" pre-sanitize"); + $this->_mark_timestamp(" pre-sanitize"); $line["content"] = Sanitizer::sanitize($line["content"], $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, function ($result, $plugin) use (&$line) { $line = $result; - $this->mark_timestamp(" hook_render_cdm: " . get_class($plugin)); + $this->_mark_timestamp(" hook_render_cdm: " . get_class($plugin)); }, $line); - $this->mark_timestamp(" hook_render_cdm"); + $this->_mark_timestamp(" hook_render_cdm"); $line['content'] = DiskCache::rewriteUrls($line['content']); - $this->mark_timestamp(" disk_cache_rewrite"); + $this->_mark_timestamp(" disk_cache_rewrite"); if ($line['note']) $line['note'] = Article::format_article_note($id, $line['note']); else $line['note'] = ""; - $this->mark_timestamp(" note"); + $this->_mark_timestamp(" note"); if (!get_pref("CDM_EXPANDED")) { $line["cdm_excerpt"] = " @@ -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["always_display_enclosures"], $line["content"], $line["hide_images"]); - $this->mark_timestamp(" enclosures"); + $this->_mark_timestamp(" enclosures"); $line["updated_long"] = TimeHelper::make_local_datetime($line["updated"],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", TimeHelper::make_local_datetime($line["date_entered"], false)); - $this->mark_timestamp(" local-datetime"); + $this->_mark_timestamp(" local-datetime"); if ($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); - $this->mark_timestamp(" tags"); + $this->_mark_timestamp(" tags"); - if (self::feedHasIcon($feed_id)) { + if (self::_has_icon($feed_id)) { $line['feed_icon'] = "\"\""; } else { $line['feed_icon'] = "rss_feed"; @@ -316,7 +316,7 @@ class Feeds extends Handler_Protected { //setting feed headline background color, needs to change text color based on dark/light $fav_color = $line['favicon_avg_color'] ?? false; - $this->mark_timestamp(" pre-color"); + $this->_mark_timestamp(" pre-color"); require_once "colors.php"; @@ -324,7 +324,7 @@ class Feeds extends Handler_Protected { if ($fav_color && $fav_color != 'fail') { $rgba_cache[$feed_id] = _color_unpack($fav_color); } 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)'; } - $this->mark_timestamp(" color"); + $this->_mark_timestamp(" color"); /* we don't need those */ @@ -342,11 +342,11 @@ class Feeds extends Handler_Protected { 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) { @@ -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); } @@ -489,9 +489,9 @@ class Feeds extends Handler_Protected { $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, $override_order, true, $check_first_id, $skip_first_id_check, $order_by); @@ -600,7 +600,7 @@ class Feeds extends Handler_Protected { print "
"; print "getFeedTitle($active_feed_id, $is_cat))."\" + placeHolder=\"".T_sprintf("Search %s...", $this->_get_title($active_feed_id, $is_cat))."\" name='query' type='search' value=''>"; print "
"; @@ -686,7 +686,7 @@ class Feeds extends Handler_Protected {
-

Feed Debugger: getFeedTitle($feed_id) ?>

+

Feed Debugger: _get_title($feed_id) ?>

@@ -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']; @@ -751,7 +751,7 @@ class Feeds extends Handler_Protected { // fall back in case of no plugins 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 { $search_qpart = "true"; @@ -791,7 +791,7 @@ class Feeds extends Handler_Protected { if ($feed >= 0) { if ($feed > 0) { - $children = self::getChildCategories($feed, $owner_uid); + $children = self::_get_child_cats($feed, $owner_uid); array_push($children, $feed); $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) { $n_feed = (int) $feed; @@ -921,7 +921,7 @@ class Feeds extends Handler_Protected { $match_part = ""; if ($is_cat) { - return self::getCategoryUnread($n_feed, $owner_uid); + return self::_get_cat_unread($n_feed, $owner_uid); } else if ($n_feed == -6) { return 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); - return self::getLabelUnread($label_id, $owner_uid); + return self::_get_label_unread($label_id, $owner_uid); } if ($match_part) { @@ -1009,7 +1009,7 @@ class Feeds extends Handler_Protected { $login = $need_auth ? clean($_REQUEST['login']) : ''; $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)); } @@ -1027,7 +1027,7 @@ class Feeds extends Handler_Protected { * 5 - Couldn't download the URL content. * 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 = '') { global $fetch_last_error; @@ -1056,8 +1056,8 @@ class Feeds extends Handler_Protected { return array("code" => 5, "message" => $fetch_last_error); } - if (mb_strpos($fetch_last_content_type, "html") !== false && self::is_html($contents)) { - $feedUrls = self::get_feeds_from_html($url, $contents); + if (mb_strpos($fetch_last_content_type, "html") !== false && self::_is_html($contents)) { + $feedUrls = self::_get_feeds_from_html($url, $contents); if (count($feedUrls) == 0) { 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"; } - static function feedHasIcon($id) { + static function _has_icon($id) { return is_file(ICONS_DIR . "/$id.ico") && filesize(ICONS_DIR . "/$id.ico") > 0; } - static function getFeedIcon($id) { + static function _get_icon($id) { switch ($id) { case 0: return "archive"; @@ -1132,7 +1132,7 @@ class Feeds extends Handler_Protected { if ($id < LABEL_BASE_INDEX) { return "label"; } else { - $icon = self::getIconFile($id); + $icon = self::_get_icon_file($id); if ($icon && file_exists($icon)) { return ICONS_URL . "/" . basename($icon) . "?" . filemtime($icon); @@ -1144,11 +1144,11 @@ class Feeds extends Handler_Protected { return false; } - static function getFeedTitle($id, $cat = false) { + static function _get_title($id, $cat = false) { $pdo = Db::pdo(); if ($cat) { - return self::getCategoryTitle($id); + return self::_get_cat_title($id); } else if ($id == -1) { return __("Starred articles"); } else if ($id == -2) { @@ -1191,7 +1191,7 @@ class Feeds extends Handler_Protected { } // 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"]; @@ -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"]; @@ -1248,7 +1248,7 @@ class Feeds extends Handler_Protected { } // 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"]; $pdo = Db::pdo(); @@ -1260,14 +1260,14 @@ class Feeds extends Handler_Protected { $unread = 0; while ($line = $sth->fetch()) { - $unread += self::getCategoryUnread($line["id"], $owner_uid); - $unread += self::getCategoryChildrenUnread($line["id"], $owner_uid); + $unread += self::_get_cat_unread($line["id"], $owner_uid); + $unread += self::_get_cat_children_unread($line["id"], $owner_uid); } return $unread; } - static function getGlobalUnread($user_id = false) { + static function _get_global_unread($user_id = false) { if (!$user_id) $user_id = $_SESSION["uid"]; @@ -1283,7 +1283,7 @@ class Feeds extends Handler_Protected { return $row["count"]; } - static function getCategoryTitle($cat_id) { + static function _get_cat_title($cat_id) { if ($cat_id == -1) { 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"]; $pdo = Db::pdo(); @@ -1322,7 +1322,7 @@ class Feeds extends Handler_Protected { } } - static function queryFeedHeadlines($params) { + static function _get_headlines($params) { $pdo = Db::pdo(); @@ -1368,7 +1368,7 @@ class Feeds extends Handler_Protected { // fall back in case of no plugins 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") { @@ -1406,7 +1406,7 @@ class Feeds extends Handler_Protected { $unread = getFeedUnread($feed, $cat_view); if ($cat_view && $feed > 0 && $include_children) - $unread += self::getCategoryChildrenUnread($feed); + $unread += self::_get_cat_children_unread($feed); if ($unread > 0) { $view_query_part = " unread = true AND "; @@ -1450,7 +1450,7 @@ class Feeds extends Handler_Protected { if ($feed > 0) { if ($include_children) { # sub-cats - $subcats = self::getChildCategories($feed, $owner_uid); + $subcats = self::_get_child_cats($feed, $owner_uid); array_push($subcats, $feed); $subcats = array_map("intval", $subcats); @@ -1574,7 +1574,7 @@ class Feeds extends Handler_Protected { $feed_title = T_sprintf("Search results: %s", $search); } else { if ($cat_view) { - $feed_title = self::getCategoryTitle($feed); + $feed_title = self::_get_cat_title($feed); } else { if (is_numeric($feed) && $feed > 0) { $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_updated = $row["last_updated"]; } 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(); $pdo = Db::pdo(); @@ -1813,13 +1813,13 @@ class Feeds extends Handler_Protected { while ($line = $sth->fetch()) { 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; } - static function getChildCategories($cat, $owner_uid) { + static function _get_child_cats($cat, $owner_uid) { $rv = array(); $pdo = Db::pdo(); @@ -1830,13 +1830,13 @@ class Feeds extends Handler_Protected { while ($line = $sth->fetch()) { 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; } - static function getFeedCategory($feed) { + static function _cat_of_feed($feed) { $pdo = Db::pdo(); $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", "#39f110","#0bbea6","#ec0e0e","#1534f2","#b9e416", "#479af2","#f36b14","#10c7e9","#1e8fe7","#e22727" ]; @@ -1867,7 +1867,7 @@ class Feeds extends Handler_Protected { return $colormap[$sum]; } - static function get_feeds_from_html($url, $content) { + private static function _get_feeds_from_html($url, $content) { $url = UrlHelper::validate($url); $baseUrl = substr($url, 0, strrpos($url, '/') + 1); @@ -1895,11 +1895,11 @@ class Feeds extends Handler_Protected { return $feedUrls; } - static function is_html($content) { + static function _is_html($content) { return preg_match("/

".__('OPML Utility')."

"; - Feeds::add_feed_category("Imported feeds"); + Feeds::_add_cat("Imported feeds"); $this->opml_notice(__("Importing OPML...")); @@ -205,7 +205,7 @@ class OPML extends Handler_Protected { if (!$tmp_line["match_on"]) { 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); } else { @@ -218,13 +218,13 @@ class OPML extends Handler_Protected { if (strpos($feed_id, "CAT:") === 0) { $feed_id = (int)substr($feed_id, 4); if ($feed_id) { - array_push($match, [Feeds::getCategoryTitle($feed_id), true, false]); + array_push($match, [Feeds::_get_cat_title($feed_id), true, false]); } else { array_push($match, [0, true, true]); } } else { 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 { array_push($match, [0, false, true]); } @@ -523,7 +523,7 @@ class OPML extends Handler_Protected { $order_id = (int) $root_node->attributes->getNamedItem('ttrssSortOrder')->nodeValue; 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); } @@ -638,7 +638,7 @@ class OPML extends Handler_Protected { $url_path = get_self_url_prefix(); $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; } diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index af3877159..edba71c5c 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -98,7 +98,7 @@ class Pref_Feeds extends Handler_Protected { $feed['checkbox'] = false; $feed['unread'] = -1; $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_line['last_updated'], true); $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['checkbox'] = false; $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_line['last_updated'], true); $feed['unread'] = -1; @@ -301,7 +301,7 @@ class Pref_Feeds extends Handler_Protected { $feed['name'] = $feed_line['title']; $feed['checkbox'] = false; $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_line['last_updated'], true); $feed['unread'] = -1; @@ -777,7 +777,7 @@ class Pref_Feeds extends Handler_Protected { /* Icon */ - print ""; + print ""; print " @@ -1189,7 +1189,7 @@ class Pref_Feeds extends Handler_Protected { function addCat() { $feed_cat = clean($_REQUEST["cat"]); - Feeds::add_feed_category($feed_cat); + Feeds::_add_cat($feed_cat); } function importOpml() { @@ -1420,9 +1420,9 @@ class Pref_Feeds extends Handler_Protected { $obj['id'] = 'CAT:' . $cat_id; $obj['items'] = array(); - $obj['name'] = Feeds::getCategoryTitle($cat_id); + $obj['name'] = Feeds::_get_cat_title($cat_id); $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; return $obj; @@ -1433,7 +1433,7 @@ class Pref_Feeds extends Handler_Protected { $feed_id = (int) $feed_id; if (!$title) - $title = Feeds::getFeedTitle($feed_id, false); + $title = Feeds::_get_title($feed_id, false); if ($unread === false) $unread = getFeedUnread($feed_id, false); @@ -1444,7 +1444,7 @@ class Pref_Feeds extends Handler_Protected { $obj['type'] = 'feed'; $obj['error'] = $error; $obj['updated'] = $updated; - $obj['icon'] = Feeds::getFeedIcon($feed_id); + $obj['icon'] = Feeds::_get_icon($feed_id); $obj['bare_id'] = $feed_id; $obj['auxcounter'] = 0; @@ -1611,11 +1611,11 @@ class Pref_Feeds extends Handler_Protected { 'id' => $feed_id, 'is_cat' => (int)$is_cat, '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([ - "title" => Feeds::getFeedTitle($feed_id, $is_cat), + "title" => Feeds::_get_title($feed_id, $is_cat), "link" => $link ]); } @@ -1627,7 +1627,7 @@ class Pref_Feeds extends Handler_Protected { WHERE feed_id = ? AND is_cat = ? AND 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 diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 1c264f642..62bcb8f59 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -189,10 +189,10 @@ class Pref_Filters extends Handler_Protected { if (strpos($feed_id, "CAT:") === 0) { $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 { if ($feed_id) - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); + array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); else array_push($feeds_fmt, __("All feeds")); } @@ -203,9 +203,9 @@ class Pref_Filters extends Handler_Protected { } else { $where = $line["cat_filter"] ? - Feeds::getCategoryTitle($line["cat_id"]) : + Feeds::_get_cat_title($line["cat_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"]; @@ -494,10 +494,10 @@ class Pref_Filters extends Handler_Protected { if (strpos($feed_id, "CAT:") === 0) { $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 { if ($feed_id) - array_push($feeds_fmt, Feeds::getFeedTitle((int)$feed_id)); + array_push($feeds_fmt, Feeds::_get_title((int)$feed_id)); else array_push($feeds_fmt, __("All feeds")); } diff --git a/classes/rpc.php b/classes/rpc.php index 2bbaf4135..206a93d60 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -219,7 +219,7 @@ class RPC extends Handler_Protected { $search_query = clean($_REQUEST['search_query']); $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 print json_encode(['counters' => Counters::getAllCounters()]); diff --git a/classes/rssutils.php b/classes/rssutils.php index 9dd7c4ab1..0e90d8fe4 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -1239,7 +1239,7 @@ class RSSUtils { Debug::log("purging feed...", Debug::$LOG_VERBOSE); - Feeds::purge_feed($feed, 0); + Feeds::_purge($feed, 0); $sth = $pdo->prepare("UPDATE ttrss_feeds SET last_updated = NOW(), @@ -1706,7 +1706,7 @@ class RSSUtils { $filters = array(); $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) $null_cat_qpart = "cat_id IS NULL OR"; @@ -1720,7 +1720,7 @@ class RSSUtils { $sth->execute([$owner_uid]); $check_cats = array_merge( - Feeds::getParentCategories($cat_id, $owner_uid), + Feeds::_get_parent_cats($cat_id, $owner_uid), [$cat_id]); $check_cats_str = join(",", $check_cats); diff --git a/include/functions.php b/include/functions.php index eaf7d8243..4557c0411 100644 --- a/include/functions.php +++ b/include/functions.php @@ -217,7 +217,7 @@ // @deprecated 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 diff --git a/js/Feeds.js b/js/Feeds.js index 986936285..73f1bc338 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -501,7 +501,7 @@ const Feeds = { const tree = dijit.byId("feedTree"); if (tree && tree.model) - return tree.getFeedCategory(feed); + return tree._cat_of_feed(feed); } catch (e) { // diff --git a/plugins/af_comics/filters/af_comics_gocomics.php b/plugins/af_comics/filters/af_comics_gocomics.php index 949b7a235..6c5c7c0d3 100644 --- a/plugins/af_comics/filters/af_comics_gocomics.php +++ b/plugins/af_comics/filters/af_comics_gocomics.php @@ -11,7 +11,7 @@ class Af_Comics_Gocomics extends Af_ComicFilter { public function on_subscribe($url) { if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) - return ''; // Get is_html() to return false. + return ''; // Get _is_html() to return false. else return false; } diff --git a/plugins/af_comics/filters/af_comics_gocomics_farside.php b/plugins/af_comics/filters/af_comics_gocomics_farside.php index 9663da8f9..89322209d 100644 --- a/plugins/af_comics/filters/af_comics_gocomics_farside.php +++ b/plugins/af_comics/filters/af_comics_gocomics_farside.php @@ -11,7 +11,7 @@ class Af_Comics_Gocomics_FarSide extends Af_ComicFilter { public function on_subscribe($url) { if (preg_match("#^https?://www\.thefarside\.com#", $url)) - return ''; // Get is_html() to return false. + return ''; // Get _is_html() to return false. else return false; } diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php index 163b0ec38..47ff98fc2 100644 --- a/plugins/af_psql_trgm/init.php +++ b/plugins/af_psql_trgm/init.php @@ -209,7 +209,7 @@ class Af_Psql_Trgm extends Plugin { print "
  • " . "rss_feed " . - Feeds::getFeedTitle($f) . "
  • "; + Feeds::_get_title($f) . ""; } print ""; } diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php index a76c98380..4d21a831c 100755 --- a/plugins/af_readability/init.php +++ b/plugins/af_readability/init.php @@ -122,7 +122,7 @@ class Af_Readability extends Plugin { print "
  • rss_feed ". - Feeds::getFeedTitle($f) . " " . ($is_append ? __("(append)") : "") . "
  • "; + Feeds::_get_title($f) . " " . ($is_append ? __("(append)") : "") . ""; } print ""; } diff --git a/plugins/vf_shared/init.php b/plugins/vf_shared/init.php index 8c38cbf32..1112f6f2f 100644 --- a/plugins/vf_shared/init.php +++ b/plugins/vf_shared/init.php @@ -60,7 +60,7 @@ class VF_Shared extends Plugin { "override_vfeed" => "ttrss_feeds.title AS feed_title," ); - $qfh_ret = Feeds::queryFeedHeadlines($params); + $qfh_ret = Feeds::_get_headlines($params); $qfh_ret[1] = __("Shared articles"); return $qfh_ret;