prefs cleanup

This commit is contained in:
Andrew Dolgov 2021-02-25 14:59:02 +03:00
parent f137e64a13
commit 1464abbbfc
3 changed files with 19 additions and 28 deletions

View File

@ -71,21 +71,18 @@ class Pref_Prefs extends Handler_Protected {
];
$this->pref_help = [
Prefs::ALLOW_DUPLICATE_POSTS => array(__("Allow duplicate articles"), ""),
Prefs::BLACKLISTED_TAGS => array(__("Blacklisted tags"), ""),
Prefs::DEFAULT_SEARCH_LANGUAGE => array(__("Default language"), __("Used for full-text search")),
Prefs::CDM_AUTO_CATCHUP => array(__("Mark read on scroll"), __("Mark articles as read as you scroll past them")),
Prefs::CDM_EXPANDED => array(__("Always expand articles")),
Prefs::COMBINED_DISPLAY_MODE => array(__("Combined mode"), __("Show flat list of articles instead of separate panels")),
Prefs::CONFIRM_FEED_CATCHUP => array(__("Confirm marking feeds as read")),
Prefs::DEFAULT_ARTICLE_LIMIT => array(__("Amount of articles to display at once")),
Prefs::DEFAULT_UPDATE_INTERVAL => array(__("Default update interval")),
Prefs::DIGEST_CATCHUP => array(__("Mark sent articles as read")),
Prefs::DIGEST_ENABLE => array(__("Enable digest"), __("Send daily digest of new (and unread) headlines to your e-mail address")),
Prefs::DIGEST_PREFERRED_TIME => array(__("Try to send around this time"), __("Time in UTC")),
Prefs::ENABLE_API_ACCESS => array(__("Enable API"), __("Allows accessing this account through the API")),
Prefs::ENABLE_FEED_CATS => array(__("Enable categories")),
Prefs::FEEDS_SORT_BY_UNREAD => array(__("Sort feeds by unread articles count"), ""),
Prefs::FRESH_ARTICLE_MAX_AGE => array(__("Maximum age of fresh articles"), "<strong>" . __("hours") . "</strong>"),
Prefs::HIDE_READ_FEEDS => array(__("Hide read feeds")),
Prefs::HIDE_READ_SHOWS_SPECIAL => array(__("Always show special feeds"), __("While hiding read feeds")),
@ -93,27 +90,19 @@ class Pref_Prefs extends Handler_Protected {
Prefs::ON_CATCHUP_SHOW_NEXT_FEED => array(__("Automatically show next feed"), __("After marking one as read")),
Prefs::PURGE_OLD_DAYS => array(__("Purge articles older than"), __("<strong>days</strong> (0 disables)")),
Prefs::PURGE_UNREAD_ARTICLES => array(__("Purge unread articles")),
Prefs::REVERSE_HEADLINES => array(__("Reverse headline order (oldest first)")),
Prefs::SHORT_DATE_FORMAT => array(__("Short date format")),
Prefs::SHOW_CONTENT_PREVIEW => array(__("Show content preview in headlines")),
Prefs::SORT_HEADLINES_BY_FEED_DATE => array(__("Sort headlines by feed date"), __("Use feed-specified date to sort headlines instead of local import date.")),
Prefs::SSL_CERT_SERIAL => array(__("SSL client certificate")),
Prefs::STRIP_IMAGES => array(__("Do not embed media")),
Prefs::USER_STYLESHEET => array(__("Customize stylesheet")),
Prefs::USER_TIMEZONE => array(__("Time zone")),
Prefs::VFEED_GROUP_BY_FEED => array(__("Group by feed"), __("Group multiple-feed output by originating feed")),
Prefs::USER_LANGUAGE => array(__("Language")),
Prefs::USER_CSS_THEME => array(__("Theme"))
];
// hidden in the main prefs UI
// hidden in the main prefs UI (use to hide things that have description set above)
$this->pref_blacklist = [
Prefs::ALLOW_DUPLICATE_POSTS,
Prefs::REVERSE_HEADLINES,
Prefs::SORT_HEADLINES_BY_FEED_DATE,
Prefs::DEFAULT_ARTICLE_LIMIT,
Prefs::FEEDS_SORT_BY_UNREAD,
Prefs::USER_STYLESHEET
//
];
}

View File

@ -4,8 +4,8 @@ class Prefs {
const PURGE_OLD_DAYS = "PURGE_OLD_DAYS";
const DEFAULT_UPDATE_INTERVAL = "DEFAULT_UPDATE_INTERVAL";
const DEFAULT_ARTICLE_LIMIT = "DEFAULT_ARTICLE_LIMIT";
const ALLOW_DUPLICATE_POSTS = "ALLOW_DUPLICATE_POSTS";
//const DEFAULT_ARTICLE_LIMIT = "DEFAULT_ARTICLE_LIMIT";
//const ALLOW_DUPLICATE_POSTS = "ALLOW_DUPLICATE_POSTS";
const ENABLE_FEED_CATS = "ENABLE_FEED_CATS";
const SHOW_CONTENT_PREVIEW = "SHOW_CONTENT_PREVIEW";
const SHORT_DATE_FORMAT = "SHORT_DATE_FORMAT";
@ -44,14 +44,14 @@ class Prefs {
//const _THEME_ID = "_THEME_ID";
const USER_TIMEZONE = "USER_TIMEZONE";
const USER_STYLESHEET = "USER_STYLESHEET";
const SORT_HEADLINES_BY_FEED_DATE = "SORT_HEADLINES_BY_FEED_DATE";
//const SORT_HEADLINES_BY_FEED_DATE = "SORT_HEADLINES_BY_FEED_DATE";
const SSL_CERT_SERIAL = "SSL_CERT_SERIAL";
const DIGEST_PREFERRED_TIME = "DIGEST_PREFERRED_TIME";
//const _PREFS_SHOW_EMPTY_CATS = "_PREFS_SHOW_EMPTY_CATS";
const _DEFAULT_INCLUDE_CHILDREN = "_DEFAULT_INCLUDE_CHILDREN";
//const AUTO_ASSIGN_LABELS = "AUTO_ASSIGN_LABELS";
const _ENABLED_PLUGINS = "_ENABLED_PLUGINS";
const _MOBILE_REVERSE_HEADLINES = "_MOBILE_REVERSE_HEADLINES";
//const _MOBILE_REVERSE_HEADLINES = "_MOBILE_REVERSE_HEADLINES";
const USER_CSS_THEME = "USER_CSS_THEME";
const USER_LANGUAGE = "USER_LANGUAGE";
const DEFAULT_SEARCH_LANGUAGE = "DEFAULT_SEARCH_LANGUAGE";
@ -60,8 +60,8 @@ class Prefs {
private const _DEFAULTS = [
Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ],
Prefs::DEFAULT_UPDATE_INTERVAL => [ 30, Config::T_INT ],
Prefs::DEFAULT_ARTICLE_LIMIT => [ 30, Config::T_INT ],
Prefs::ALLOW_DUPLICATE_POSTS => [ false, Config::T_BOOL ],
//Prefs::DEFAULT_ARTICLE_LIMIT => [ 30, Config::T_INT ],
//Prefs::ALLOW_DUPLICATE_POSTS => [ false, Config::T_BOOL ],
Prefs::ENABLE_FEED_CATS => [ true, Config::T_BOOL ],
Prefs::SHOW_CONTENT_PREVIEW => [ true, Config::T_BOOL ],
Prefs::SHORT_DATE_FORMAT => [ "M d, G:i", Config::T_STRING ],
@ -100,14 +100,14 @@ class Prefs {
//Prefs::_THEME_ID => [ 0, Config::T_BOOL ],
Prefs::USER_TIMEZONE => [ "Automatic", Config::T_STRING ],
Prefs::USER_STYLESHEET => [ "", Config::T_STRING ],
Prefs::SORT_HEADLINES_BY_FEED_DATE => [ false, Config::T_BOOL ],
//Prefs::SORT_HEADLINES_BY_FEED_DATE => [ false, Config::T_BOOL ],
Prefs::SSL_CERT_SERIAL => [ "", Config::T_STRING ],
Prefs::DIGEST_PREFERRED_TIME => [ "00:00", Config::T_STRING ],
//Prefs::_PREFS_SHOW_EMPTY_CATS => [ false, Config::T_BOOL ],
Prefs::_DEFAULT_INCLUDE_CHILDREN => [ false, Config::T_BOOL ],
//Prefs::AUTO_ASSIGN_LABELS => [ false, Config::T_BOOL ],
Prefs::_ENABLED_PLUGINS => [ "", Config::T_STRING ],
Prefs::_MOBILE_REVERSE_HEADLINES => [ false, Config::T_BOOL ],
//Prefs::_MOBILE_REVERSE_HEADLINES => [ false, Config::T_BOOL ],
Prefs::USER_CSS_THEME => [ "" , Config::T_STRING ],
Prefs::USER_LANGUAGE => [ "" , Config::T_STRING ],
Prefs::DEFAULT_SEARCH_LANGUAGE => [ "" , Config::T_STRING ],
@ -115,7 +115,7 @@ class Prefs {
];
const _PROFILE_BLACKLIST = [
Prefs::ALLOW_DUPLICATE_POSTS,
//Prefs::ALLOW_DUPLICATE_POSTS,
Prefs::PURGE_OLD_DAYS,
Prefs::PURGE_UNREAD_ARTICLES,
Prefs::DIGEST_ENABLE,
@ -125,9 +125,10 @@ class Prefs {
//Prefs::UPDATE_POST_ON_CHECKSUM_CHANGE,
Prefs::DEFAULT_UPDATE_INTERVAL,
Prefs::USER_TIMEZONE,
Prefs::SORT_HEADLINES_BY_FEED_DATE,
//Prefs::SORT_HEADLINES_BY_FEED_DATE,
Prefs::SSL_CERT_SERIAL,
Prefs::DIGEST_PREFERRED_TIME
Prefs::DIGEST_PREFERRED_TIME,
Prefs::_PREFS_MIGRATED
];
private static $instance;

View File

@ -380,10 +380,11 @@ class RPC extends Handler_Protected {
private function make_init_params() {
$params = array();
foreach (array("ON_CATCHUP_SHOW_NEXT_FEED", "HIDE_READ_FEEDS",
"ENABLE_FEED_CATS", "FEEDS_SORT_BY_UNREAD", "CONFIRM_FEED_CATCHUP",
"CDM_AUTO_CATCHUP", "FRESH_ARTICLE_MAX_AGE",
"HIDE_READ_SHOWS_SPECIAL", "COMBINED_DISPLAY_MODE") as $param) {
foreach ([Prefs::ON_CATCHUP_SHOW_NEXT_FEED, Prefs::HIDE_READ_FEEDS,
Prefs::ENABLE_FEED_CATS, Prefs::FEEDS_SORT_BY_UNREAD,
Prefs::CONFIRM_FEED_CATCHUP, Prefs::CDM_AUTO_CATCHUP,
Prefs::FRESH_ARTICLE_MAX_AGE, Prefs::HIDE_READ_SHOWS_SPECIAL,
Prefs::COMBINED_DISPLAY_MODE] as $param) {
$params[strtolower($param)] = (int) get_pref($param);
}