5.16.0 #33

Merged
Tetrakern merged 51 commits from next_update into main 2024-05-10 00:14:48 +08:00
2 changed files with 181 additions and 8 deletions
Showing only changes of commit 04fbaa7a0a - Show all commits

View File

@ -871,6 +871,179 @@ define( 'FICTIONEER_OPTIONS', array(
)
));
/**
* Return label of setting if defined
*
* @since 5.15.3
*
* @param string $option The name of the option.
*
* @return string The label of the option or the option name if none found.
*/
function fictioneer_get_option_label( $option ) {
static $labels = null;
// Labels
if ( $labels === null ) {
$labels = array(
'fictioneer_enable_maintenance_mode' => __( 'Enable maintenance mode', 'fictioneer' ),
'fictioneer_dark_mode_as_default' => __( 'Enable dark mode as default', 'fictioneer' ),
'fictioneer_show_authors' => __( 'Display authors on cards and posts', 'fictioneer' ),
'fictioneer_hide_chapter_icons' => __( 'Hide chapter icons', 'fictioneer' ),
'fictioneer_hide_taxonomies_on_story_cards' => __( 'Hide taxonomies on story cards', 'fictioneer' ),
'fictioneer_hide_taxonomies_on_chapter_cards' => __( 'Hide taxonomies on chapter cards', 'fictioneer' ),
'fictioneer_hide_taxonomies_on_recommendation_cards' => __( 'Hide taxonomies on recommendation cards', 'fictioneer' ),
'fictioneer_hide_taxonomies_on_collection_cards' => __( 'Hide taxonomies on collection cards', 'fictioneer' ),
'fictioneer_show_tags_on_story_cards' => __( 'Show tags on story cards', 'fictioneer' ),
'fictioneer_show_tags_on_chapter_cards' => __( 'Show tags on chapter cards', 'fictioneer' ),
'fictioneer_show_tags_on_recommendation_cards' => __( 'Show tags on recommendation cards', 'fictioneer' ),
'fictioneer_show_tags_on_collection_cards' => __( 'Show tags on collection cards', 'fictioneer' ),
'fictioneer_hide_taxonomies_on_pages' => __( 'Hide taxonomies on pages', 'fictioneer' ),
'fictioneer_hide_tags_on_pages' => __( 'Hide tags on pages', 'fictioneer' ),
'fictioneer_hide_content_warnings_on_pages' => __( 'Hide content warnings on pages', 'fictioneer' ),
'fictioneer_enable_theme_rss' => __( 'Enable theme RSS feeds and buttons', 'fictioneer' ),
'fictioneer_enable_oauth' => __( 'Enable OAuth 2.0 authentication', 'fictioneer' ),
'fictioneer_enable_lightbox' => __( 'Enable lightbox', 'fictioneer' ),
'fictioneer_enable_bookmarks' => __( 'Enable Bookmarks', 'fictioneer' ),
'fictioneer_enable_follows' => __( 'Enable Follows (requires account)', 'fictioneer' ),
'fictioneer_enable_checkmarks' => __( 'Enable Checkmarks (requires account)', 'fictioneer' ),
'fictioneer_enable_reminders' => __( 'Enable Reminders (requires account)', 'fictioneer' ),
'fictioneer_enable_suggestions' => __( 'Enable Suggestions', 'fictioneer' ),
'fictioneer_enable_tts' => __( 'Enable Text-To-Speech (experimental)', 'fictioneer' ),
'fictioneer_enable_seo' => __( 'Enable SEO features', 'fictioneer' ),
'fictioneer_enable_sitemap' => __( 'Enable theme sitemap generation', 'fictioneer' ),
'fictioneer_enable_epubs' => __( 'Enable ePUB converter (experimental)', 'fictioneer' ),
'fictioneer_require_js_to_comment' => __( 'Require JavaScript to comment', 'fictioneer' ),
'fictioneer_enable_ajax_comment_submit' => __( 'Enable AJAX comment submission', 'fictioneer' ),
'fictioneer_enable_comment_link_limit' => __( 'Limit comments to [n] link(s) or less', 'fictioneer' ),
'fictioneer_enable_comment_toolbar' => __( 'Enable comment toolbar', 'fictioneer' ),
'fictioneer_disable_comment_bbcodes' => __( 'Disable comment BBCodes', 'fictioneer' ),
'fictioneer_enable_ajax_comment_moderation' => __( 'Enable AJAX comment moderation', 'fictioneer' ),
'fictioneer_enable_custom_badges' => __( 'Enable custom badges', 'fictioneer' ),
'fictioneer_enable_patreon_badges' => __( 'Enable Patreon badges', 'fictioneer' ),
'fictioneer_enable_private_commenting' => __( 'Enable private commenting', 'fictioneer' ),
'fictioneer_enable_comment_notifications' => __( 'Enable comment reply notifications', 'fictioneer' ),
'fictioneer_enable_comment_reporting' => __( 'Enable comment reporting', 'fictioneer' ),
'fictioneer_disable_heartbeat' => __( 'Disable Heartbeat API', 'fictioneer' ),
'fictioneer_remove_head_clutter' => __( 'Remove clutter from HTML head', 'fictioneer' ),
'fictioneer_reduce_admin_bar' => __( 'Reduce admin bar items', 'fictioneer' ),
'fictioneer_bundle_stylesheets' => __( 'Bundle CSS files into one', 'fictioneer' ),
'fictioneer_bundle_scripts' => __( 'Bundle JavaScript files into one', 'fictioneer' ),
'fictioneer_do_not_save_comment_ip' => __( 'Do not save comment IP addresses', 'fictioneer' ),
'fictioneer_logout_redirects_home' => __( 'Logout redirects Home', 'fictioneer' ),
'fictioneer_disable_theme_logout' => __( 'Disable theme logout without nonce', 'fictioneer' ),
'fictioneer_consent_wrappers' => __( 'Add consent wrappers to embedded content', 'fictioneer' ),
'fictioneer_cookie_banner' => __( 'Enable cookie banner and consent function', 'fictioneer' ),
'fictioneer_enable_cache_compatibility' => __( 'Enable cache compatibility mode', 'fictioneer' ),
'fictioneer_enable_private_cache_compatibility' => __( 'Enable private cache compatibility mode', 'fictioneer' ),
'fictioneer_enable_ajax_comments' => __( 'Enable AJAX comment section', 'fictioneer' ),
'fictioneer_disable_comment_callback' => __( 'Disable theme comment style (callback)', 'fictioneer' ),
'fictioneer_disable_comment_query' => __( 'Disable theme comment query', 'fictioneer' ),
'fictioneer_disable_comment_form' => __( 'Disable theme comment form', 'fictioneer' ),
'fictioneer_disable_comment_pagination' => __( 'Disable theme comment pagination', 'fictioneer' ),
'fictioneer_disable_facebook_share' => __( 'Disable Facebook share button', 'fictioneer' ),
'fictioneer_disable_twitter_share' => __( 'Disable Twitter share button', 'fictioneer' ),
'fictioneer_disable_tumblr_share' => __( 'Disable Tumblr share button', 'fictioneer' ),
'fictioneer_disable_reddit_share' => __( 'Disable Reddit share button', 'fictioneer' ),
'fictioneer_disable_mastodon_share' => __( 'Disable Mastodon share button', 'fictioneer' ),
'fictioneer_disable_telegram_share' => __( 'Disable Telegram share button', 'fictioneer' ),
'fictioneer_disable_whatsapp_share' => __( 'Disable Whatsapp share button', 'fictioneer' ),
'fictioneer_delete_theme_options_on_deactivation' => __( 'Delete all settings and theme mods on deactivation', 'fictioneer' ),
'fictioneer_remove_wp_svg_filters' => __( 'Remove global WordPress SVG filters', 'fictioneer' ),
'fictioneer_enable_jquery_migrate' => __( 'Enable jQuery migrate script', 'fictioneer' ),
'fictioneer_disable_properties' => __( 'Disable Fictioneer CSS properties', 'fictioneer' ),
'fictioneer_enable_chapter_groups' => __( 'Enable chapter groups', 'fictioneer' ),
'fictioneer_disable_chapter_collapsing' => __( 'Disable collapsing of chapters', 'fictioneer' ),
'fictioneer_collapse_groups_by_default' => __( 'Collapse chapter groups by default', 'fictioneer' ),
'fictioneer_enable_public_cache_compatibility' => __( 'Enable public cache compatibility mode', 'fictioneer' ),
'fictioneer_show_full_post_content' => __( 'Display full posts instead of excerpts', 'fictioneer' ),
'fictioneer_enable_all_blocks' => __( 'Enable all Gutenberg blocks', 'fictioneer' ),
'fictioneer_enable_ajax_authentication' => __( 'Enable AJAX user authentication', 'fictioneer' ),
'fictioneer_disable_application_passwords' => __( 'Disable application passwords', 'fictioneer' ),
'fictioneer_enable_user_comment_editing' => __( 'Enable comment editing', 'fictioneer' ),
'fictioneer_enable_ajax_comment_form' => __( 'Enable AJAX comment form', 'fictioneer' ),
'fictioneer_enable_sticky_comments' => __( 'Enable sticky comments', 'fictioneer' ),
'fictioneer_disable_commenting' => __( 'Disable commenting across the site', 'fictioneer' ),
'fictioneer_purge_all_caches' => __( 'Purge all caches on content updates', 'fictioneer' ),
'fictioneer_disable_theme_search' => __( 'Disable advanced search', 'fictioneer' ),
'fictioneer_disable_contact_forms' => __( 'Disable theme contact forms', 'fictioneer' ),
'fictioneer_enable_storygraph_api' => __( 'Enable Storygraph API', 'fictioneer' ),
'fictioneer_restrict_rest_api' => __( 'Restrict Default REST API', 'fictioneer' ),
'fictioneer_enable_chapter_appending' => __( 'Append new chapters to story', 'fictioneer' ),
'fictioneer_limit_chapter_stories_by_author' => __( 'Restrict chapter stories by author', 'fictioneer' ),
'fictioneer_disable_all_widgets' => __( 'Disable all widgets', 'fictioneer' ),
'fictioneer_see_some_evil' => __( 'Monitor posts for suspicious content', 'fictioneer' ),
'fictioneer_enable_fast_ajax_comments' => __( 'Enable fast AJAX for comments', 'fictioneer' ),
'fictioneer_enable_rate_limits' => __( 'Enable rate limiting for AJAX requests', 'fictioneer' ),
'fictioneer_enable_advanced_meta_fields' => __( 'Enable advanced meta fields', 'fictioneer' ),
'fictioneer_show_story_changelog' => __( 'Show story changelog button', 'fictioneer' ),
'fictioneer_disable_font_awesome' => __( 'Disable Font Awesome integration', 'fictioneer' ),
'fictioneer_enable_site_age_confirmation' => __( 'Enable age confirmation modal for site', 'fictioneer' ),
'fictioneer_enable_post_age_confirmation' => __( 'Enable age confirmation modal for posts', 'fictioneer' ),
'fictioneer_disable_extended_story_list_meta_queries' => __( 'Disable extended story list meta queries', 'fictioneer' ),
'fictioneer_disable_extended_chapter_list_meta_queries' => __( 'Disable extended chapter list meta queries', 'fictioneer' ),
'fictioneer_count_characters_as_words' => __( 'Count characters instead of words', 'fictioneer' ),
'fictioneer_show_protected_excerpt' => __( 'Show excerpt on password-protected posts', 'fictioneer' ),
'fictioneer_hide_large_card_chapter_list' => __( 'Hide latest chapter list on large story cards', 'fictioneer' ),
'fictioneer_enable_patreon_locks' => __( 'Enable Patreon content gate', 'fictioneer' ),
'fictioneer_hide_password_form_with_patreon' => __( 'Hide password form on Patreon-gated posts', 'fictioneer' ),
'fictioneer_enable_maintenance_mode' => __( 'Enable maintenance mode', 'fictioneer' ),
'fictioneer_dark_mode_as_default' => __( 'Enable dark mode as default', 'fictioneer' ),
'fictioneer_user_profile_page' => __( 'Account page', 'fictioneer' ),
'fictioneer_bookmarks_page' => __( 'Bookmarks page', 'fictioneer' ),
'fictioneer_stories_page' => __( 'Stories page', 'fictioneer' ),
'fictioneer_chapters_page' => __( 'Chapters page', 'fictioneer' ),
'fictioneer_recommendations_page' => __( 'Recommendations page', 'fictioneer' ),
'fictioneer_collections_page' => __( 'Collections page', 'fictioneer' ),
'fictioneer_bookshelf_page' => __( 'Bookshelf page', 'fictioneer' ),
'fictioneer_404_page' => __( '404 page', 'fictioneer' ),
'fictioneer_comment_report_threshold' => __( 'Automatic moderation report threshold', 'fictioneer' ),
'fictioneer_comment_link_limit_threshold' => __( 'Comment link limit', 'fictioneer' ),
'fictioneer_words_per_minute' => __( 'Words per minute', 'fictioneer' ),
'fictioneer_user_comment_edit_time' => __( 'Minutes a comment can be edited', 'fictioneer' ),
'fictioneer_upload_size_limit' => __( 'Size limit for file uploads', 'fictioneer' ),
'fictioneer_word_count_multiplier' => __( 'Multiplier for displayed word counts', 'fictioneer' ),
'fictioneer_phrase_maintenance' => __( 'Maintenance note', 'fictioneer' ),
'fictioneer_phrase_login_modal' => __( 'Login modal', 'fictioneer' ),
'fictioneer_phrase_cookie_consent_banner' => __( 'Cookie consent banner', 'fictioneer' ),
'fictioneer_phrase_comment_reply_notification' => __( 'Comment reply notification email', 'fictioneer' ),
'fictioneer_system_email_address' => __( 'System email address', 'fictioneer' ),
'fictioneer_system_email_name' => __( 'System email name', 'fictioneer' ),
'fictioneer_patreon_label' => __( 'Patreon badge label', 'fictioneer' ),
'fictioneer_comments_notice' => __( 'Notice above comments', 'fictioneer' ),
'fictioneer_discord_client_id' => __( 'Discord Client ID', 'fictioneer' ),
'fictioneer_discord_client_secret' => __( 'Discord Client Secret', 'fictioneer' ),
'fictioneer_discord_channel_comments_webhook' => __( 'Discord comment channel webhook', 'fictioneer' ),
'fictioneer_discord_channel_stories_webhook' => __( 'Discord story channel webhook', 'fictioneer' ),
'fictioneer_discord_channel_chapters_webhook' => __( 'Discord chapter channel webhook', 'fictioneer' ),
'fictioneer_discord_invite_link' => __( 'Discord invite link', 'fictioneer' ),
'fictioneer_twitch_client_id' => __( 'Twitch Client ID', 'fictioneer' ),
'fictioneer_twitch_client_secret' => __( 'Twitch Client Secret', 'fictioneer' ),
'fictioneer_google_client_id' => __( 'Google Client ID', 'fictioneer' ),
'fictioneer_google_client_secret' => __( 'Google Client Secret', 'fictioneer' ),
'fictioneer_patreon_client_id' => __( 'Patreon Client ID', 'fictioneer' ),
'fictioneer_patreon_client_secret' => __( 'Patreon Client Secret', 'fictioneer' ),
'fictioneer_patreon_campaign_link' => __( 'Patreon campaign link', 'fictioneer' ),
'fictioneer_patreon_unlock_message' => __( 'Patreon gate message override', 'fictioneer' ),
'fictioneer_patreon_global_lock_tiers' => __( 'Global tiers to unlock post', 'fictioneer' ),
'fictioneer_patreon_global_lock_amount' => __( 'Global pledge threshold in cents', 'fictioneer' ),
'fictioneer_patreon_global_lock_lifetime_amount' => __( 'Global lifetime pledge threshold in cents', 'fictioneer' ),
'fictioneer_subitem_date_format' => __( 'Subitem long date format', 'fictioneer' ),
'fictioneer_subitem_short_date_format' => __( 'Subitem short date format', 'fictioneer' ),
'fictioneer_contact_email_addresses' => __( 'Contact form email receivers', 'fictioneer' ),
'fictioneer_upload_mime_types' => __( 'List of allowed file upload mime types', 'fictioneer' ),
'fictioneer_phrase_site_age_confirmation' => __( 'Age confirmation modal content for the site', 'fictioneer' ),
'fictioneer_phrase_post_age_confirmation' => __( 'Age confirmation modal content for posts', 'fictioneer' ),
'fictioneer_google_fonts_links' => __( 'List of Google Fonts links', 'fictioneer' ),
'fictioneer_comment_form_selector' => __( 'Comment form CSS selector', 'fictioneer' )
);
}
// Return label or option name if none found
return $labels[ $option ] ?? $option;
}
// =============================================================================
// REGISTER ADMIN SETTINGS
// =============================================================================

View File

@ -172,7 +172,7 @@ function fictioneer_settings_checkbox_added( $option, $value ) {
// Relay
fictioneer_log_checkbox_update(
FICTIONEER_OPTIONS['booleans'][ $option ]['label'] ?? FICTIONEER_OPTIONS['booleans'][ $option ]['name'],
fictioneer_get_option_label( $option ),
null,
$value
);
@ -197,7 +197,7 @@ function fictioneer_settings_checkbox_updated( $option, $old_value, $value ) {
// Relay
fictioneer_log_checkbox_update(
FICTIONEER_OPTIONS['booleans'][ $option ]['label'] ?? FICTIONEER_OPTIONS['booleans'][ $option ]['name'],
fictioneer_get_option_label( $option ),
$old_value,
$value
);
@ -270,7 +270,7 @@ function fictioneer_settings_page_assignment_added( $option, $value ) {
// Relay
fictioneer_log_page_assignment_update(
FICTIONEER_OPTIONS['integers'][ $option ]['label'] ?? FICTIONEER_OPTIONS['integers'][ $option ]['name'],
fictioneer_get_option_label( $option ),
null,
$value
);
@ -295,7 +295,7 @@ function fictioneer_settings_page_assignment_updated( $option, $old_value, $valu
// Relay
fictioneer_log_page_assignment_update(
FICTIONEER_OPTIONS['integers'][ $option ]['label'] ?? FICTIONEER_OPTIONS['integers'][ $option ]['name'],
fictioneer_get_option_label( $option ),
$old_value,
$value
);
@ -364,7 +364,7 @@ function fictioneer_settings_phrase_added( $option, $value ) {
// Relay
fictioneer_log_phrase_update(
FICTIONEER_OPTIONS['strings'][ $option ]['label'] ?? FICTIONEER_OPTIONS['strings'][ $option ]['name'],
fictioneer_get_option_label( $option ),
null,
$value
);
@ -389,7 +389,7 @@ function fictioneer_settings_phrase_updated( $option, $old_value, $value ) {
// Replay
fictioneer_log_phrase_update(
FICTIONEER_OPTIONS['strings'][ $option ]['label'] ?? FICTIONEER_OPTIONS['strings'][ $option ]['name'],
fictioneer_get_option_label( $option ),
$old_value,
$value
);
@ -465,7 +465,7 @@ function fictioneer_settings_connection_added( $option, $value ) {
// Relay
fictioneer_log_connection_update(
FICTIONEER_OPTIONS['strings'][ $option ]['label'] ?? FICTIONEER_OPTIONS['strings'][ $option ]['name'],
fictioneer_get_option_label( $option ),
null,
$value
);
@ -490,7 +490,7 @@ function fictioneer_settings_connection_updated( $option, $old_value, $value ) {
// Relay
fictioneer_log_connection_update(
FICTIONEER_OPTIONS['strings'][ $option ]['label'] ?? FICTIONEER_OPTIONS['strings'][ $option ]['name'],
fictioneer_get_option_label( $option ),
$old_value,
$value
);