Streamline constant
Now or never, before anyone uses them.
This commit is contained in:
parent
d8f6ef9333
commit
f34ccfb2f6
@ -712,20 +712,20 @@ define( 'CONSTANT_NAME', value );
|
|||||||
| FICTIONEER_OAUTH_ENDPOINT | string | URI slug to call the OAuth script. Default `'oauth2'`.
|
| FICTIONEER_OAUTH_ENDPOINT | string | URI slug to call the OAuth script. Default `'oauth2'`.
|
||||||
| FICTIONEER_EPUB_ENDPOINT | string | URI slug to call the ePUB script. Default `'download-epub'`.
|
| FICTIONEER_EPUB_ENDPOINT | string | URI slug to call the ePUB script. Default `'download-epub'`.
|
||||||
| FICTIONEER_LOGOUT_ENDPOINT | string | URI slug to call the logout script. Default `'fictioneer-logout'`.
|
| FICTIONEER_LOGOUT_ENDPOINT | string | URI slug to call the logout script. Default `'fictioneer-logout'`.
|
||||||
| FICTIONEER_PRIMARY_FONT | string | CSS name of the primary font. Default `'Open Sans'`.
|
| FICTIONEER_PRIMARY_FONT_CSS | string | CSS name of the primary font. Default `'Open Sans'`.
|
||||||
| FICTIONEER_PRIMARY_FONT_NAME | string | Display name of the primary font. Default `'Open Sans'`.
|
| FICTIONEER_PRIMARY_FONT_NAME | string | Display name of the primary font. Default `'Open Sans'`.
|
||||||
| FICTIONEER_COMMENTCODE_DURATION | int | How long guests can see their private/unapproved comments in _seconds_. Default `600`.
|
| FICTIONEER_COMMENTCODE_TTL | int | How long guests can see their private/unapproved comments in _seconds_. Default `600`.
|
||||||
| FICTIONEER_AJAX_TTL | int | How long to cache certain AJAX requests locally in _milliseconds_. Default `60000`.
|
| FICTIONEER_AJAX_TTL | int | How long to cache certain AJAX requests locally in _milliseconds_. Default `60000`.
|
||||||
| FICTIONEER_AJAX_LOGIN_TTL | int | How long to cache AJAX authentications locally in _milliseconds_. Default `15000`.
|
| FICTIONEER_AJAX_LOGIN_TTL | int | How long to cache AJAX authentications locally in _milliseconds_. Default `15000`.
|
||||||
| FICTIONEER_AJAX_POST_DEBOUNCE_RATE | int | How long to debounce AJAX requests of the same type _milliseconds_. Default `700`.
|
| FICTIONEER_AJAX_POST_DEBOUNCE_RATE | int | How long to debounce AJAX requests of the same type _milliseconds_. Default `700`.
|
||||||
| FICTIONEER_AUTHOR_KEYWORD_SEARCH_LIMIT | int | Maximum number of authors in the advanced search suggestions. Default `100`.
|
| FICTIONEER_AUTHOR_KEYWORD_SEARCH_LIMIT | int | Maximum number of authors in the advanced search suggestions. Default `100`.
|
||||||
| FICTIONEER_UPDATE_CHECK_TIMEOUT | int | Timeout between checks for theme updates in _seconds_. Default `3600`.
|
| FICTIONEER_UPDATE_CHECK_TIMEOUT | int | Timeout between checks for theme updates in _seconds_. Default `3600`.
|
||||||
| FICTIONEER_THEME_CACHE_PURGING | boolean | Whether to call the cache purge assist function on post updates. Default `true`.
|
| FICTIONEER_CACHE_PURGE_ASSIST | boolean | Whether to call the cache purge assist function on post updates. Default `true`.
|
||||||
| FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING | boolean | Whether to purge related post caches. Default `true`.
|
| FICTIONEER_RELATIONSHIP_PURGE_ASSIST | boolean | Whether to purge related post caches. Default `true`.
|
||||||
| FICTIONEER_STORY_CHAPTER_LIST_CACHE | boolean | Whether to cache chapter lists on story pages as Transients. Default `true`.
|
| FICTIONEER_CACHE_CHAPTER_LISTS | boolean | Whether to cache chapter lists on story pages as Transients. Default `true`.
|
||||||
| FICTIONEER_SEARCH_MENU_ITEMS | boolean | Whether to show search page links in menus. Default `true`.
|
| FICTIONEER_SHOW_SEARCH_IN_MENUS | boolean | Whether to show search page links in menus. Default `true`.
|
||||||
| FICTIONEER_THEME_SWITCH | boolean | Whether to the theme switch in child themes (back to base). Default `true`.
|
| FICTIONEER_THEME_SWITCH | boolean | Whether to the theme switch in child themes (back to base). Default `true`.
|
||||||
| FICTIONEER_ATTACHMENT_PAGES | boolean | Whether to enable pages for attachments (no theme templates). Default `false`.
|
| FICTIONEER_ATTACHMENT_PAGES | boolean | Whether to enable pages for attachments (no theme templates). Default `false`.
|
||||||
| FICTIONEER_SHOW_OAUTH_HASHES | boolean | Whether to show OAuth ID hashes in user profiles (admin only). Default `false`.
|
| FICTIONEER_SHOW_OAUTH_HASHES | boolean | Whether to show OAuth ID hashes in user profiles (admin only). Default `false`.
|
||||||
| FICTIONEER_SHOW_AJAX_COMMENT_DISALLOWED_KEYS | boolean | Whether to show feedback for rejected comment content. Default `true`.
|
| FICTIONEER_DISALLOWED_KEY_NOTICE | boolean | Whether to show feedback for rejected comment content. Default `true`.
|
||||||
| FICTIONEER_FILTER_STORY_CHAPTERS | boolean | Whether to filter selectable chapters by assigned story. Default `true`.
|
| FICTIONEER_FILTER_STORY_CHAPTERS | boolean | Whether to filter selectable chapters by assigned story. Default `true`.
|
||||||
|
@ -41,8 +41,8 @@ if ( ! defined( 'FICTIONEER_LOGOUT_ENDPOINT' ) ) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// String: CSS name of the primary font
|
// String: CSS name of the primary font
|
||||||
if ( ! defined( 'FICTIONEER_PRIMARY_FONT' ) ) {
|
if ( ! defined( 'FICTIONEER_PRIMARY_FONT_CSS' ) ) {
|
||||||
define( 'FICTIONEER_PRIMARY_FONT', 'Open Sans' );
|
define( 'FICTIONEER_PRIMARY_FONT_CSS', 'Open Sans' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// String: Display name of the primary font
|
// String: Display name of the primary font
|
||||||
@ -55,8 +55,8 @@ if ( ! defined( 'FICTIONEER_PRIMARY_FONT_NAME' ) ) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Integer: Commentcode expiration timer in seconds (-1 for infinite)
|
// Integer: Commentcode expiration timer in seconds (-1 for infinite)
|
||||||
if ( ! defined( 'FICTIONEER_COMMENTCODE_DURATION' ) ) {
|
if ( ! defined( 'FICTIONEER_COMMENTCODE_TTL' ) ) {
|
||||||
define( 'FICTIONEER_COMMENTCODE_DURATION', 600 );
|
define( 'FICTIONEER_COMMENTCODE_TTL', 600 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Integer: AJAX cache TTL in milliseconds
|
// Integer: AJAX cache TTL in milliseconds
|
||||||
@ -89,26 +89,26 @@ if ( ! defined( 'FICTIONEER_UPDATE_CHECK_TIMEOUT' ) ) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Boolean: Theme cache purging on post update
|
// Boolean: Theme cache purging on post update
|
||||||
if ( ! defined( 'FICTIONEER_THEME_CACHE_PURGING' ) ) {
|
if ( ! defined( 'FICTIONEER_CACHE_PURGE_ASSIST' ) ) {
|
||||||
define( 'FICTIONEER_THEME_CACHE_PURGING', true );
|
define( 'FICTIONEER_CACHE_PURGE_ASSIST', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Theme relationship cache purging on post update
|
// Boolean: Theme relationship cache purging on post update
|
||||||
if ( ! defined( 'FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING' ) ) {
|
if ( ! defined( 'FICTIONEER_RELATIONSHIP_PURGE_ASSIST' ) ) {
|
||||||
define( 'FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING', true );
|
define( 'FICTIONEER_RELATIONSHIP_PURGE_ASSIST', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Cache chapter lists on story pages as Transients
|
// Boolean: Cache chapter lists on story pages as Transients
|
||||||
if ( ! defined( 'FICTIONEER_STORY_CHAPTER_LIST_CACHE' ) ) {
|
if ( ! defined( 'FICTIONEER_CACHE_CHAPTER_LISTS' ) ) {
|
||||||
define( 'FICTIONEER_STORY_CHAPTER_LIST_CACHE', true );
|
define( 'FICTIONEER_CACHE_CHAPTER_LISTS', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Search menu items
|
// Boolean: Menu items for search
|
||||||
if ( ! defined( 'FICTIONEER_SEARCH_MENU_ITEMS' ) ) {
|
if ( ! defined( 'FICTIONEER_SHOW_SEARCH_IN_MENUS' ) ) {
|
||||||
define( 'FICTIONEER_SEARCH_MENU_ITEMS', true );
|
define( 'FICTIONEER_SHOW_SEARCH_IN_MENUS', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Base theme switch
|
// Boolean: Base theme switch in site settings
|
||||||
if ( ! defined( 'FICTIONEER_THEME_SWITCH' ) ) {
|
if ( ! defined( 'FICTIONEER_THEME_SWITCH' ) ) {
|
||||||
define( 'FICTIONEER_THEME_SWITCH', true );
|
define( 'FICTIONEER_THEME_SWITCH', true );
|
||||||
}
|
}
|
||||||
@ -124,8 +124,8 @@ if ( ! defined( 'FICTIONEER_SHOW_OAUTH_HASHES' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Show AJAX comment submission disallowed content keys
|
// Boolean: Show AJAX comment submission disallowed content keys
|
||||||
if ( ! defined( 'FICTIONEER_SHOW_AJAX_COMMENT_DISALLOWED_KEYS' ) ) {
|
if ( ! defined( 'FICTIONEER_DISALLOWED_KEY_NOTICE' ) ) {
|
||||||
define( 'FICTIONEER_SHOW_AJAX_COMMENT_DISALLOWED_KEYS', true );
|
define( 'FICTIONEER_DISALLOWED_KEY_NOTICE', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean: Only allow assigned chapters in stories
|
// Boolean: Only allow assigned chapters in stories
|
||||||
|
@ -132,7 +132,7 @@ function fictioneer_update_post_relationships( $post_id ) {
|
|||||||
fictioneer_save_relationship_registry( $registry );
|
fictioneer_save_relationship_registry( $registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING ) {
|
if ( FICTIONEER_RELATIONSHIP_PURGE_ASSIST ) {
|
||||||
add_action( 'acf/save_post', 'fictioneer_update_post_relationships', 100 );
|
add_action( 'acf/save_post', 'fictioneer_update_post_relationships', 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ if ( ! function_exists( 'fictioneer_refresh_post_caches' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge relationships
|
// Purge relationships
|
||||||
if ( FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING ) {
|
if ( FICTIONEER_RELATIONSHIP_PURGE_ASSIST ) {
|
||||||
$registry = fictioneer_get_relationship_registry();
|
$registry = fictioneer_get_relationship_registry();
|
||||||
|
|
||||||
// Always purge...
|
// Always purge...
|
||||||
@ -395,7 +395,7 @@ if ( ! function_exists( 'fictioneer_refresh_post_caches' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FICTIONEER_THEME_CACHE_PURGING && fictioneer_caching_active() ) {
|
if ( FICTIONEER_CACHE_PURGE_ASSIST && fictioneer_caching_active() ) {
|
||||||
add_action( 'save_post', 'fictioneer_refresh_post_caches' );
|
add_action( 'save_post', 'fictioneer_refresh_post_caches' );
|
||||||
add_action( 'untrash_post', 'fictioneer_refresh_post_caches' );
|
add_action( 'untrash_post', 'fictioneer_refresh_post_caches' );
|
||||||
add_action( 'trashed_post', 'fictioneer_refresh_post_caches' );
|
add_action( 'trashed_post', 'fictioneer_refresh_post_caches' );
|
||||||
|
@ -180,7 +180,7 @@ if ( ! function_exists( 'fictioneer_ajax_submit_contact_form' ) ) {
|
|||||||
|
|
||||||
// Only show error for keys in content, trash anything else as usual later.
|
// Only show error for keys in content, trash anything else as usual later.
|
||||||
// No need to tell someone his name or email address is blocked, etc.
|
// No need to tell someone his name or email address is blocked, etc.
|
||||||
if ( FICTIONEER_SHOW_AJAX_COMMENT_DISALLOWED_KEYS && $offenders[0] && $offenders[1] ) {
|
if ( FICTIONEER_DISALLOWED_KEY_NOTICE && $offenders[0] && $offenders[1] ) {
|
||||||
wp_send_json_error( ['error' => __( 'Disallowed key found: "' . implode( ', ', $offenders[1] ) . '".', 'fictioneer' )] );
|
wp_send_json_error( ['error' => __( 'Disallowed key found: "' . implode( ', ', $offenders[1] ) . '".', 'fictioneer' )] );
|
||||||
} elseif ( $offenders[0] ) {
|
} elseif ( $offenders[0] ) {
|
||||||
wp_send_json_error( ['error' => __( 'Disallowed keys found.', 'fictioneer' )] );
|
wp_send_json_error( ['error' => __( 'Disallowed keys found.', 'fictioneer' )] );
|
||||||
|
@ -69,7 +69,7 @@ function fictioneer_update_shortcode_relationships( $post_id, $post ) {
|
|||||||
fictioneer_save_relationship_registry( $registry );
|
fictioneer_save_relationship_registry( $registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FICTIONEER_THEME_RELATIONSHIP_CACHE_PURGING ) {
|
if ( FICTIONEER_RELATIONSHIP_PURGE_ASSIST ) {
|
||||||
add_action( 'save_post', 'fictioneer_update_shortcode_relationships', 10, 2 );
|
add_action( 'save_post', 'fictioneer_update_shortcode_relationships', 10, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ function fictioneer_root_attributes() {
|
|||||||
$output['data-theme'] = 'default';
|
$output['data-theme'] = 'default';
|
||||||
$output['data-mode'] = '';
|
$output['data-mode'] = '';
|
||||||
$output['data-font-weight'] = 'default';
|
$output['data-font-weight'] = 'default';
|
||||||
$output['data-primary-font'] = FICTIONEER_PRIMARY_FONT;
|
$output['data-primary-font'] = FICTIONEER_PRIMARY_FONT_CSS;
|
||||||
if ( $ajax_submit ) $output['data-ajax-submit'] = 'true';
|
if ( $ajax_submit ) $output['data-ajax-submit'] = 'true';
|
||||||
if ( ! FICTIONEER_THEME_SWITCH ) $output['data-force-child-theme'] = '1';
|
if ( ! FICTIONEER_THEME_SWITCH ) $output['data-force-child-theme'] = '1';
|
||||||
if ( get_option( 'fictioneer_enable_ajax_nonce', false ) ) $output['data-ajax-nonce'] = '1';
|
if ( get_option( 'fictioneer_enable_ajax_nonce', false ) ) $output['data-ajax-nonce'] = '1';
|
||||||
|
@ -265,7 +265,7 @@ if ( ! function_exists( 'fictioneer_ajax_submit_comment' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Preemptively check for disallowed keys (Settings > Discussion)
|
// Preemptively check for disallowed keys (Settings > Discussion)
|
||||||
if ( FICTIONEER_SHOW_AJAX_COMMENT_DISALLOWED_KEYS ) {
|
if ( FICTIONEER_DISALLOWED_KEY_NOTICE ) {
|
||||||
$offenders = fictioneer_check_comment_disallowed_list(
|
$offenders = fictioneer_check_comment_disallowed_list(
|
||||||
$comment_data['author'] ?? '',
|
$comment_data['author'] ?? '',
|
||||||
$comment_data['email'] ?? '',
|
$comment_data['email'] ?? '',
|
||||||
|
@ -499,8 +499,8 @@ if ( ! function_exists( 'fictioneer_theme_comment' ) ) {
|
|||||||
if ( $commentcode && is_array( $visibility_code ) ) {
|
if ( $commentcode && is_array( $visibility_code ) ) {
|
||||||
$commentcode = $visibility_code['code'] == $commentcode;
|
$commentcode = $visibility_code['code'] == $commentcode;
|
||||||
|
|
||||||
if ( FICTIONEER_COMMENTCODE_DURATION > 0 ) {
|
if ( FICTIONEER_COMMENTCODE_TTL > 0 ) {
|
||||||
$commentcode = $commentcode && $visibility_code['timestamp'] + FICTIONEER_COMMENTCODE_DURATION >= time();
|
$commentcode = $commentcode && $visibility_code['timestamp'] + FICTIONEER_COMMENTCODE_TTL >= time();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ if ( ! function_exists( 'fictioneer_mobile_user_menu' ) ) {
|
|||||||
$output['account'] = ob_get_clean();
|
$output['account'] = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FICTIONEER_SEARCH_MENU_ITEMS ) {
|
if ( FICTIONEER_SHOW_SEARCH_IN_MENUS ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
// Start HTML ---> ?>
|
// Start HTML ---> ?>
|
||||||
<a href="<?php echo esc_url( home_url( '/?s=' ) ); ?>">
|
<a href="<?php echo esc_url( home_url( '/?s=' ) ); ?>">
|
||||||
|
@ -96,7 +96,7 @@ if ( $profile_page && $profile_page > 0 ) {
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ( FICTIONEER_SEARCH_MENU_ITEMS ) : ?>
|
<?php if ( FICTIONEER_SHOW_SEARCH_IN_MENUS ) : ?>
|
||||||
<a
|
<a
|
||||||
href="<?php echo esc_url( home_url( '/?s=' ) ); ?>"
|
href="<?php echo esc_url( home_url( '/?s=' ) ); ?>"
|
||||||
title="<?php esc_attr_e( 'Search Page', 'fictioneer' ) ?>"
|
title="<?php esc_attr_e( 'Search Page', 'fictioneer' ) ?>"
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
<div class="select-wrapper">
|
<div class="select-wrapper">
|
||||||
<select id="reader-settings-font-select" name="fonts">
|
<select id="reader-settings-font-select" name="fonts">
|
||||||
<?php
|
<?php
|
||||||
$fonts = [FICTIONEER_PRIMARY_FONT, 'System Font', 'Lato', 'Helvetica Neue', 'Georgia', 'Roboto Mono', 'Roboto Serif', 'Cormorant Garamond', 'Open Dyslexic'];
|
$fonts = [FICTIONEER_PRIMARY_FONT_CSS, 'System Font', 'Lato', 'Helvetica Neue', 'Georgia', 'Roboto Mono', 'Roboto Serif', 'Cormorant Garamond', 'Open Dyslexic'];
|
||||||
$font_names = [FICTIONEER_PRIMARY_FONT_NAME, __( 'System Font', 'fictioneer' ), __( 'Lato', 'fictioneer' ), __( 'Helvetica Neue', 'fictioneer' ), __( 'Georgia', 'fictioneer' ), __( 'Roboto Mono', 'fictioneer' ), __( 'Roboto Serif', 'fictioneer' ), __( 'Cormorant Garamond', 'fictioneer' ), __( 'Open Dyslexic', 'fictioneer' )];
|
$font_names = [FICTIONEER_PRIMARY_FONT_NAME, __( 'System Font', 'fictioneer' ), __( 'Lato', 'fictioneer' ), __( 'Helvetica Neue', 'fictioneer' ), __( 'Georgia', 'fictioneer' ), __( 'Roboto Mono', 'fictioneer' ), __( 'Roboto Serif', 'fictioneer' ), __( 'Cormorant Garamond', 'fictioneer' ), __( 'Open Dyslexic', 'fictioneer' )];
|
||||||
$length = count( $fonts );
|
$length = count( $fonts );
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ if ( $custom_pages ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for cached chapters output
|
// Check for cached chapters output
|
||||||
$chapters_html = FICTIONEER_STORY_CHAPTER_LIST_CACHE ? get_transient( 'fictioneer_story_chapter_list_' . $story_id ) : null;
|
$chapters_html = FICTIONEER_CACHE_CHAPTER_LISTS ? get_transient( 'fictioneer_story_chapter_list_' . $story_id ) : null;
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
$hide_icons = fictioneer_get_field( 'fictioneer_story_hide_chapter_icons' ) || get_option( 'fictioneer_hide_chapter_icons' );
|
$hide_icons = fictioneer_get_field( 'fictioneer_story_hide_chapter_icons' ) || get_option( 'fictioneer_hide_chapter_icons' );
|
||||||
@ -351,7 +351,7 @@ $blog_posts = new WP_Query(
|
|||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
|
|
||||||
// Cache for next time (24 hours)
|
// Cache for next time (24 hours)
|
||||||
if ( FICTIONEER_STORY_CHAPTER_LIST_CACHE ) {
|
if ( FICTIONEER_CACHE_CHAPTER_LISTS ) {
|
||||||
set_transient( 'fictioneer_story_chapter_list_' . $story_id, $chapters_html, 86400 );
|
set_transient( 'fictioneer_story_chapter_list_' . $story_id, $chapters_html, 86400 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user