Fix tab sizes in files

How did this even happen?
This commit is contained in:
Tetrakern 2024-01-27 21:00:00 +01:00
parent 3740947d8f
commit 995fa50b11
28 changed files with 2138 additions and 2137 deletions

View File

@ -361,23 +361,23 @@ if ( ! function_exists( 'fictioneer_add_or_update_term' ) ) {
*/
function fictioneer_add_or_update_term( $name, $taxonomy, $args = [] ) {
$parent = $args['parent'] ?? 0;
$alias_of = $args['alias_of'] ?? '';
$description = $args['description'] ?? '';
$parent = $args['parent'] ?? 0;
$alias_of = $args['alias_of'] ?? '';
$description = $args['description'] ?? '';
$result = false;
// Does term already exist?
$old = get_term_by( 'name', $name, $taxonomy );
$old = get_term_by( 'name', $name, $taxonomy );
// Get parent or create one if it does not yet exist
if ( $parent != 0 ) {
$parent = get_term_by( 'name', $parent, $taxonomy );
if ( $parent != 0 ) {
$parent = get_term_by( 'name', $parent, $taxonomy );
$parent = $parent ? $parent->term_id : fictioneer_add_or_update_term( $args['parent'], $taxonomy );
}
}
// Get alias or create one if it does not yet exist
if ( ! empty( $alias_of ) ) {
$alias_of = get_term_by( 'name', $alias_of, $taxonomy );
if ( ! empty( $alias_of ) ) {
$alias_of = get_term_by( 'name', $alias_of, $taxonomy );
if ( ! $alias_of ) {
$alias_of = fictioneer_add_or_update_term( $args['alias_of'], $taxonomy );
@ -385,31 +385,31 @@ if ( ! function_exists( 'fictioneer_add_or_update_term' ) ) {
}
$alias_of = $alias_of ? $alias_of->slug : '';
}
}
if ( ! $old ) {
if ( ! $old ) {
// Create term
$result = wp_insert_term(
$name,
$taxonomy,
array(
'alias_of' => $alias_of,
'parent' => $parent,
'description' => $description
)
);
} else {
$result = wp_insert_term(
$name,
$taxonomy,
array(
'alias_of' => $alias_of,
'parent' => $parent,
'description' => $description
)
);
} else {
// Update term
$result = wp_update_term(
$old->term_id,
$taxonomy,
array(
'alias_of' => $alias_of,
'parent' => $parent,
'description' => $description
)
);
}
$result = wp_update_term(
$old->term_id,
$taxonomy,
array(
'alias_of' => $alias_of,
'parent' => $parent,
'description' => $description
)
);
}
if ( ! is_wp_error( $result ) ) {
return $result['term_id'];

View File

@ -208,13 +208,13 @@ if ( ! function_exists( 'fictioneer_get_icon' ) ) {
function fictioneer_get_icon( $icon, $classes = '', $id = '', $inserts = '' ) {
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<svg id="<?php echo $id; ?>" <?php echo $inserts; ?> class="icon _<?php echo $icon; ?> <?php echo $classes; ?>">
<use xlink:href="<?php echo get_template_directory_uri(); ?>/img/icon-sprite.svg?ver=<?php echo FICTIONEER_VERSION; ?>#icon-<?php echo $icon; ?>"></use>
</svg>
<?php // <--- End HTML
<?php // <--- End HTML
return ob_get_clean();
return ob_get_clean();
}
}
@ -412,13 +412,13 @@ if ( ! function_exists( 'fictioneer_get_footer_copyright_note' ) ) {
function fictioneer_get_footer_copyright_note( $args ) {
ob_start();
// Start HTML ---> ?>
<span>© <?php echo date( 'Y' ); ?></span>
// Start HTML ---> ?>
<span>© <?php echo date( 'Y' ); ?></span>
<span><?php echo get_bloginfo( 'name' ); ?></span>
<span>|</span>
<a href="https://github.com/Tetrakern/fictioneer" target="_blank" rel="noreferrer"><?php echo fictioneer_get_version(); ?></a>
<?php // <--- End HTML
return ob_get_clean();
<?php // <--- End HTML
return ob_get_clean();
}
}
@ -487,8 +487,8 @@ if ( ! function_exists( 'fictioneer_get_breadcrumbs' ) ) {
$args['breadcrumbs'] = apply_filters( 'fictioneer_filter_breadcrumbs_array', $args['breadcrumbs'], $args );
ob_start();
// Start HTML ---> ?>
<ol vocab="https://schema.org/" typeof="BreadcrumbList" class="breadcrumbs">
// Start HTML ---> ?>
<ol vocab="https://schema.org/" typeof="BreadcrumbList" class="breadcrumbs">
<?php foreach ( $args['breadcrumbs'] as $key => $value ) : ?>
<li class="breadcrumbs__item" property="itemListElement" typeof="ListItem">
<?php if ( $count > $key + 1 ): ?>
@ -504,8 +504,8 @@ if ( ! function_exists( 'fictioneer_get_breadcrumbs' ) ) {
</li>
<?php endforeach; ?>
</ol>
<?php // <--- End HTML
return ob_get_clean();
<?php // <--- End HTML
return ob_get_clean();
}
}
@ -526,23 +526,23 @@ if ( ! function_exists( 'fictioneer_get_multi_author_nodes' ) ) {
function fictioneer_get_multi_author_nodes( $authors ) {
// Setup
$author_nodes = [];
$author_nodes = [];
// If no author was found...
if ( empty( $authors ) ) {
return __( 'Unknown', 'No story author(s) were found.', 'fictioneer' );
}
// The meta field returns an array of IDs
foreach ( $authors as $author ) {
$author_nodes[] = fictioneer_get_author_node( $author );
}
// The meta field returns an array of IDs
foreach ( $authors as $author ) {
$author_nodes[] = fictioneer_get_author_node( $author );
}
// Remove empty items
$author_nodes = array_filter( $author_nodes );
// Build and return HTML
return implode( ', ', array_unique( $author_nodes ) );
// Build and return HTML
return implode( ', ', array_unique( $author_nodes ) );
}
}
@ -587,26 +587,26 @@ if ( ! function_exists( 'fictioneer_get_story_page_cover' ) ) {
*/
function fictioneer_get_story_page_cover( $story ) {
ob_start();
// Start HTML ---> ?>
<figure class="story__thumbnail">
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php
the_post_thumbnail(
array( 200, 300 ),
array(
'alt' => sprintf( __( '%s Cover', 'fictioneer' ), $story['title'] ),
'class' => 'webfeedsFeaturedVisual story__thumbnail-image'
)
);
?>
<div id="ribbon-read" class="story__thumbnail-ribbon hidden">
<div class="ribbon _read"><?php _ex( 'Read', 'Caption of the _read_ ribbon.', 'fictioneer' ); ?></div>
</div>
</a>
</figure>
<?php // <--- End HTML
return ob_get_clean();
ob_start();
// Start HTML ---> ?>
<figure class="story__thumbnail">
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php
the_post_thumbnail(
array( 200, 300 ),
array(
'alt' => sprintf( __( '%s Cover', 'fictioneer' ), $story['title'] ),
'class' => 'webfeedsFeaturedVisual story__thumbnail-image'
)
);
?>
<div id="ribbon-read" class="story__thumbnail-ribbon hidden">
<div class="ribbon _read"><?php _ex( 'Read', 'Caption of the _read_ ribbon.', 'fictioneer' ); ?></div>
</div>
</a>
</figure>
<?php // <--- End HTML
return ob_get_clean();
}
}
@ -850,8 +850,8 @@ if ( ! function_exists( 'fictioneer_get_chapter_author_nodes' ) ) {
function fictioneer_get_chapter_author_nodes( $chapter_id ) {
// Setup
$all_authors = get_post_meta( $chapter_id, 'fictioneer_chapter_co_authors', true ) ?? [];
$all_authors = is_array( $all_authors ) ? $all_authors : [];
array_unshift( $all_authors, get_post_field( 'post_author', $chapter_id ) );
$all_authors = is_array( $all_authors ) ? $all_authors : [];
array_unshift( $all_authors, get_post_field( 'post_author', $chapter_id ) );
// Return author nodes
return fictioneer_get_multi_author_nodes( $all_authors );
@ -899,36 +899,36 @@ if ( ! function_exists( 'fictioneer_get_chapter_micro_menu' ) ) {
}
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<label for="modal-formatting-toggle" class="micro-menu__item micro-menu__modal-formatting" tabindex="-1">
<?php fictioneer_icon( 'font-settings' ); ?>
</label>
<?php // <--- End HTML
$micro_menu['formatting'] = ob_get_clean();
<?php // <--- End HTML
$micro_menu['formatting'] = ob_get_clean();
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<button type="button" title="<?php esc_attr_e( 'Enter fullscreen', 'fictioneer' ); ?>" class="micro-menu__item micro-menu__enter-fullscreen open-fullscreen hide-on-iOS hide-on-fullscreen" tabindex="-1">
<?php fictioneer_icon( 'expand' ); ?>
</button>
<?php // <--- End HTML
$micro_menu['open_fullscreen'] = ob_get_clean();
<?php // <--- End HTML
$micro_menu['open_fullscreen'] = ob_get_clean();
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<button type="button" title="<?php esc_attr_e( 'Exit fullscreen', 'fictioneer' ); ?>" class="micro-menu__item micro-menu__close-fullscreen close-fullscreen hide-on-iOS show-on-fullscreen hidden" tabindex="-1">
<?php fictioneer_icon( 'collapse' ); ?>
</button>
<?php // <--- End HTML
$micro_menu['close_fullscreen'] = ob_get_clean();
<?php // <--- End HTML
$micro_menu['close_fullscreen'] = ob_get_clean();
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<button type="button" title="<?php echo fcntr( 'jump_to_bookmark', true ); ?>" class="micro-menu__item micro-menu__bookmark button--bookmark hidden" tabindex="-1">
<i class="fa-solid fa-bookmark"></i>
</button>
<?php // <--- End HTML
$micro_menu['bookmark_jump'] = ob_get_clean();
<?php // <--- End HTML
$micro_menu['bookmark_jump'] = ob_get_clean();
if ( $args['prev_index'] !== false ) {
ob_start();
@ -941,10 +941,10 @@ if ( ! function_exists( 'fictioneer_get_chapter_micro_menu' ) ) {
}
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<a href="#top" data-block="center" aria-label="<?php _e( 'Scroll to top of the chapter', 'fictioneer' ); ?>" class="micro-menu__item micro-menu__up up" tabindex="-1"><i class="fa-solid fa-caret-up"></i></a>
<?php // <--- End HTML
$micro_menu['top'] = ob_get_clean();
<?php // <--- End HTML
$micro_menu['top'] = ob_get_clean();
if ( $args['next_index'] ) {
ob_start();
@ -960,12 +960,12 @@ if ( ! function_exists( 'fictioneer_get_chapter_micro_menu' ) ) {
$micro_menu = apply_filters( 'fictioneer_filter_chapter_micro_menu', $micro_menu, $args );
ob_start();
// Start HTML ---> ?>
// Start HTML ---> ?>
<div id="micro-menu" class="micro-menu">
<?php echo implode( '', $micro_menu ); ?>
</div>
<?php // <--- End HTML
return ob_get_clean();
<?php // <--- End HTML
return ob_get_clean();
}
}
@ -1081,9 +1081,9 @@ if ( ! function_exists( 'fictioneer_get_recommendation_page_cover' ) ) {
*/
function fictioneer_get_recommendation_page_cover( $recommendation ) {
ob_start();
// Start HTML ---> ?>
<figure class="recommendation__thumbnail">
ob_start();
// Start HTML ---> ?>
<figure class="recommendation__thumbnail">
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php
the_post_thumbnail(
@ -1096,8 +1096,8 @@ if ( ! function_exists( 'fictioneer_get_recommendation_page_cover' ) ) {
?>
</a>
</figure>
<?php // <--- End HTML
return ob_get_clean();
<?php // <--- End HTML
return ob_get_clean();
}
}
@ -1125,7 +1125,7 @@ if ( ! function_exists( 'fictioneer_get_taxonomy_pills' ) ) {
return '';
}
ob_start();
ob_start();
// Loop over all groups...
foreach ( $taxonomy_groups as $key => $group ) {
@ -1145,7 +1145,7 @@ if ( ! function_exists( 'fictioneer_get_taxonomy_pills' ) ) {
}
}
return ob_get_clean();
return ob_get_clean();
}
}

View File

@ -5,8 +5,8 @@
// =============================================================================
define(
'FICTIONEER_WP_CAPABILITIES',
array(
'FICTIONEER_WP_CAPABILITIES',
array(
'edit_post',
'read_post',
'delete_post',
@ -20,83 +20,83 @@ define(
'delete_others_posts',
'edit_private_posts',
'edit_published_posts'
)
)
);
define(
'FICTIONEER_STORY_CAPABILITIES',
array(
'edit_fcn_story',
'read_fcn_story',
'delete_fcn_story',
'edit_fcn_stories',
'edit_others_fcn_stories',
'publish_fcn_stories',
'read_private_fcn_stories',
'delete_fcn_stories',
'delete_private_fcn_stories',
'delete_published_fcn_stories',
'delete_others_fcn_stories',
'edit_private_fcn_stories',
'edit_published_fcn_stories'
)
'FICTIONEER_STORY_CAPABILITIES',
array(
'edit_fcn_story',
'read_fcn_story',
'delete_fcn_story',
'edit_fcn_stories',
'edit_others_fcn_stories',
'publish_fcn_stories',
'read_private_fcn_stories',
'delete_fcn_stories',
'delete_private_fcn_stories',
'delete_published_fcn_stories',
'delete_others_fcn_stories',
'edit_private_fcn_stories',
'edit_published_fcn_stories'
)
);
define(
'FICTIONEER_CHAPTER_CAPABILITIES',
array(
'edit_fcn_chapter',
'read_fcn_chapter',
'delete_fcn_chapter',
'edit_fcn_chapters',
'edit_others_fcn_chapters',
'publish_fcn_chapters',
'read_private_fcn_chapters',
'delete_fcn_chapters',
'delete_private_fcn_chapters',
'delete_published_fcn_chapters',
'delete_others_fcn_chapters',
'edit_private_fcn_chapters',
'edit_published_fcn_chapters'
)
'FICTIONEER_CHAPTER_CAPABILITIES',
array(
'edit_fcn_chapter',
'read_fcn_chapter',
'delete_fcn_chapter',
'edit_fcn_chapters',
'edit_others_fcn_chapters',
'publish_fcn_chapters',
'read_private_fcn_chapters',
'delete_fcn_chapters',
'delete_private_fcn_chapters',
'delete_published_fcn_chapters',
'delete_others_fcn_chapters',
'edit_private_fcn_chapters',
'edit_published_fcn_chapters'
)
);
define(
'FICTIONEER_COLLECTION_CAPABILITIES',
array(
'edit_fcn_collection',
'read_fcn_collection',
'delete_fcn_collection',
'edit_fcn_collections',
'edit_others_fcn_collections',
'publish_fcn_collections',
'read_private_fcn_collections',
'delete_fcn_collections',
'delete_private_fcn_collections',
'delete_published_fcn_collections',
'delete_others_fcn_collections',
'edit_private_fcn_collections',
'edit_published_fcn_collections'
)
'FICTIONEER_COLLECTION_CAPABILITIES',
array(
'edit_fcn_collection',
'read_fcn_collection',
'delete_fcn_collection',
'edit_fcn_collections',
'edit_others_fcn_collections',
'publish_fcn_collections',
'read_private_fcn_collections',
'delete_fcn_collections',
'delete_private_fcn_collections',
'delete_published_fcn_collections',
'delete_others_fcn_collections',
'edit_private_fcn_collections',
'edit_published_fcn_collections'
)
);
define(
'FICTIONEER_RECOMMENDATION_CAPABILITIES',
array(
'edit_fcn_recommendation',
'read_fcn_recommendation',
'delete_fcn_recommendation',
'edit_fcn_recommendations',
'edit_others_fcn_recommendations',
'publish_fcn_recommendations',
'read_private_fcn_recommendations',
'delete_fcn_recommendations',
'delete_private_fcn_recommendations',
'delete_published_fcn_recommendations',
'delete_others_fcn_recommendations',
'edit_private_fcn_recommendations',
'edit_published_fcn_recommendations'
)
'FICTIONEER_RECOMMENDATION_CAPABILITIES',
array(
'edit_fcn_recommendation',
'read_fcn_recommendation',
'delete_fcn_recommendation',
'edit_fcn_recommendations',
'edit_others_fcn_recommendations',
'publish_fcn_recommendations',
'read_private_fcn_recommendations',
'delete_fcn_recommendations',
'delete_private_fcn_recommendations',
'delete_published_fcn_recommendations',
'delete_others_fcn_recommendations',
'edit_private_fcn_recommendations',
'edit_published_fcn_recommendations'
)
);
// =============================================================================
@ -110,61 +110,61 @@ define(
*/
function fictioneer_fcn_story_post_type() {
$labels = array(
'name' => _x( 'Stories', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Story', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Stories', 'fictioneer' ),
'name_admin_bar' => __( 'Story', 'fictioneer' ),
'archives' => __( 'Story Archives', 'fictioneer' ),
'attributes' => __( 'Story Attributes', 'fictioneer' ),
'all_items' => __( 'All Stories', 'fictioneer' ),
'add_new_item' => __( 'Add New Story', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Story', 'fictioneer' ),
'edit_item' => __( 'Edit Story', 'fictioneer' ),
'update_item' => __( 'Update Story', 'fictioneer' ),
'view_item' => __( 'View Story', 'fictioneer' ),
'view_items' => __( 'View Stories', 'fictioneer' ),
'search_items' => __( 'Search Stories', 'fictioneer' ),
'not_found' => __( 'No stories found', 'fictioneer' ),
'not_found_in_trash' => __( 'No stories found in Trash', 'fictioneer' ),
'featured_image' => __( 'Story Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into story', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this story', 'fictioneer' ),
'items_list' => __( 'Stories list', 'fictioneer' ),
'items_list_navigation' => __( 'Stories list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter stories list', 'fictioneer' ),
);
$labels = array(
'name' => _x( 'Stories', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Story', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Stories', 'fictioneer' ),
'name_admin_bar' => __( 'Story', 'fictioneer' ),
'archives' => __( 'Story Archives', 'fictioneer' ),
'attributes' => __( 'Story Attributes', 'fictioneer' ),
'all_items' => __( 'All Stories', 'fictioneer' ),
'add_new_item' => __( 'Add New Story', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Story', 'fictioneer' ),
'edit_item' => __( 'Edit Story', 'fictioneer' ),
'update_item' => __( 'Update Story', 'fictioneer' ),
'view_item' => __( 'View Story', 'fictioneer' ),
'view_items' => __( 'View Stories', 'fictioneer' ),
'search_items' => __( 'Search Stories', 'fictioneer' ),
'not_found' => __( 'No stories found', 'fictioneer' ),
'not_found_in_trash' => __( 'No stories found in Trash', 'fictioneer' ),
'featured_image' => __( 'Story Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into story', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this story', 'fictioneer' ),
'items_list' => __( 'Stories list', 'fictioneer' ),
'items_list_navigation' => __( 'Stories list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter stories list', 'fictioneer' ),
);
$args = array(
'label' => __( 'Story', 'fictioneer' ),
'description' => __( 'Holds stories and details about them.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-book',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail', 'revisions'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
$args = array(
'label' => __( 'Story', 'fictioneer' ),
'description' => __( 'Holds stories and details about them.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-book',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail', 'revisions'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
'rewrite' => array( 'slug' => 'story' ),
'show_in_rest' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_story', 'fcn_stories'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_STORY_CAPABILITIES ),
'map_meta_cap' => true
);
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_story', 'fcn_stories'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_STORY_CAPABILITIES ),
'map_meta_cap' => true
);
register_post_type( 'fcn_story', $args );
register_post_type( 'fcn_story', $args );
}
add_action( 'init', 'fictioneer_fcn_story_post_type', 0 );
@ -179,61 +179,61 @@ add_action( 'init', 'fictioneer_fcn_story_post_type', 0 );
*/
function fictioneer_fcn_chapter_post_type() {
$labels = array(
'name' => _x( 'Chapters', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Chapter', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Chapters', 'fictioneer' ),
'name_admin_bar' => __( 'Chapter', 'fictioneer' ),
'archives' => __( 'Chapter Archives', 'fictioneer' ),
'attributes' => __( 'Chapter Attributes', 'fictioneer' ),
'all_items' => __( 'All Chapters', 'fictioneer' ),
'add_new_item' => __( 'Add New Chapter', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Chapter', 'fictioneer' ),
'edit_item' => __( 'Edit Chapter', 'fictioneer' ),
'update_item' => __( 'Update Chapter', 'fictioneer' ),
'view_item' => __( 'View Chapter', 'fictioneer' ),
'view_items' => __( 'View Chapters', 'fictioneer' ),
'search_items' => __( 'Search Chapters', 'fictioneer' ),
'not_found' => __( 'No chapters found', 'fictioneer' ),
'not_found_in_trash' => __( 'No chapters found in Trash', 'fictioneer' ),
'featured_image' => __( 'Chapter Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into chapter', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this chapter', 'fictioneer' ),
'items_list' => __( 'Chapters list', 'fictioneer' ),
'items_list_navigation' => __( 'Chapters list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter chapters list', 'fictioneer' ),
);
$labels = array(
'name' => _x( 'Chapters', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Chapter', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Chapters', 'fictioneer' ),
'name_admin_bar' => __( 'Chapter', 'fictioneer' ),
'archives' => __( 'Chapter Archives', 'fictioneer' ),
'attributes' => __( 'Chapter Attributes', 'fictioneer' ),
'all_items' => __( 'All Chapters', 'fictioneer' ),
'add_new_item' => __( 'Add New Chapter', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Chapter', 'fictioneer' ),
'edit_item' => __( 'Edit Chapter', 'fictioneer' ),
'update_item' => __( 'Update Chapter', 'fictioneer' ),
'view_item' => __( 'View Chapter', 'fictioneer' ),
'view_items' => __( 'View Chapters', 'fictioneer' ),
'search_items' => __( 'Search Chapters', 'fictioneer' ),
'not_found' => __( 'No chapters found', 'fictioneer' ),
'not_found_in_trash' => __( 'No chapters found in Trash', 'fictioneer' ),
'featured_image' => __( 'Chapter Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into chapter', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this chapter', 'fictioneer' ),
'items_list' => __( 'Chapters list', 'fictioneer' ),
'items_list_navigation' => __( 'Chapters list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter chapters list', 'fictioneer' ),
);
$args = array(
'label' => __( 'Chapter', 'fictioneer' ),
'description' => __( 'Holds chapters and details about them.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-text-page',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail', 'comments', 'revisions'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
$args = array(
'label' => __( 'Chapter', 'fictioneer' ),
'description' => __( 'Holds chapters and details about them.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-text-page',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail', 'comments', 'revisions'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
'rewrite' => array( 'slug' => 'chapter' ),
'show_in_rest' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_chapter', 'fcn_chapters'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_CHAPTER_CAPABILITIES ),
'map_meta_cap' => true
);
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 6,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_chapter', 'fcn_chapters'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_CHAPTER_CAPABILITIES ),
'map_meta_cap' => true
);
register_post_type( 'fcn_chapter', $args );
register_post_type( 'fcn_chapter', $args );
}
add_action( 'init', 'fictioneer_fcn_chapter_post_type', 0 );
@ -248,61 +248,61 @@ add_action( 'init', 'fictioneer_fcn_chapter_post_type', 0 );
*/
function fictioneer_fcn_collection_post_type() {
$labels = array(
'name' => _x( 'Collections', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Collection', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Collections', 'fictioneer' ),
'name_admin_bar' => __( 'Collection', 'fictioneer' ),
'archives' => __( 'Collection Archives', 'fictioneer' ),
'attributes' => __( 'Collection Attributes', 'fictioneer' ),
'all_items' => __( 'All Collections', 'fictioneer' ),
'add_new_item' => __( 'Add New Collection', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Collection', 'fictioneer' ),
'edit_item' => __( 'Edit Collection', 'fictioneer' ),
'update_item' => __( 'Update Collection', 'fictioneer' ),
'view_item' => __( 'View Collection', 'fictioneer' ),
'view_items' => __( 'View Collections', 'fictioneer' ),
'search_items' => __( 'Search Collections', 'fictioneer' ),
'not_found' => __( 'No collections found', 'fictioneer' ),
'not_found_in_trash' => __( 'No collections found in Trash', 'fictioneer' ),
'featured_image' => __( 'Collection Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into collection', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this collection', 'fictioneer' ),
'items_list' => __( 'Collections list', 'fictioneer' ),
'items_list_navigation' => __( 'Collections list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter collections list', 'fictioneer' ),
);
$labels = array(
'name' => _x( 'Collections', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Collection', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Collections', 'fictioneer' ),
'name_admin_bar' => __( 'Collection', 'fictioneer' ),
'archives' => __( 'Collection Archives', 'fictioneer' ),
'attributes' => __( 'Collection Attributes', 'fictioneer' ),
'all_items' => __( 'All Collections', 'fictioneer' ),
'add_new_item' => __( 'Add New Collection', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Collection', 'fictioneer' ),
'edit_item' => __( 'Edit Collection', 'fictioneer' ),
'update_item' => __( 'Update Collection', 'fictioneer' ),
'view_item' => __( 'View Collection', 'fictioneer' ),
'view_items' => __( 'View Collections', 'fictioneer' ),
'search_items' => __( 'Search Collections', 'fictioneer' ),
'not_found' => __( 'No collections found', 'fictioneer' ),
'not_found_in_trash' => __( 'No collections found in Trash', 'fictioneer' ),
'featured_image' => __( 'Collection Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into collection', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this collection', 'fictioneer' ),
'items_list' => __( 'Collections list', 'fictioneer' ),
'items_list_navigation' => __( 'Collections list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter collections list', 'fictioneer' ),
);
$args = array(
'label' => __( 'Collection', 'fictioneer' ),
'description' => __( 'Collections of stories, chapters, and recommendations.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-category',
'supports' => ['title', 'author', 'editor', 'thumbnail'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
$args = array(
'label' => __( 'Collection', 'fictioneer' ),
'description' => __( 'Collections of stories, chapters, and recommendations.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-category',
'supports' => ['title', 'author', 'editor', 'thumbnail'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
'rewrite' => array( 'slug' => 'collection' ),
'show_in_rest' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 7,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_collection', 'fcn_collections'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_COLLECTION_CAPABILITIES ),
'map_meta_cap' => true
);
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 7,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_collection', 'fcn_collections'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_COLLECTION_CAPABILITIES ),
'map_meta_cap' => true
);
register_post_type( 'fcn_collection', $args );
register_post_type( 'fcn_collection', $args );
}
add_action( 'init', 'fictioneer_fcn_collection_post_type', 0 );
@ -317,61 +317,61 @@ add_action( 'init', 'fictioneer_fcn_collection_post_type', 0 );
*/
function fictioneer_fcn_recommendation_post_type() {
$labels = array(
'name' => _x( 'Recommendations', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Recommendation', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Recommend.', 'fictioneer' ),
'name_admin_bar' => __( 'Recommendation', 'fictioneer' ),
'archives' => __( 'Recommendation Archives', 'fictioneer' ),
'attributes' => __( 'Recommendation Attributes', 'fictioneer' ),
'all_items' => __( 'All Recommend.', 'fictioneer' ),
'add_new_item' => __( 'Add New Recommendation', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Recommendation', 'fictioneer' ),
'edit_item' => __( 'Edit Recommendation', 'fictioneer' ),
'update_item' => __( 'Update Recommendation', 'fictioneer' ),
'view_item' => __( 'View Recommendation', 'fictioneer' ),
'view_items' => __( 'View Recommendations', 'fictioneer' ),
'search_items' => __( 'Search Recommendations', 'fictioneer' ),
'not_found' => __( 'No recommendations found', 'fictioneer' ),
'not_found_in_trash' => __( 'No recommendations found in Trash', 'fictioneer' ),
'featured_image' => __( 'Recommendation Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into recommendation', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this recommendation', 'fictioneer' ),
'items_list' => __( 'Recommendations list', 'fictioneer' ),
'items_list_navigation' => __( 'Recommendations list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter recommendations list', 'fictioneer' ),
);
$labels = array(
'name' => _x( 'Recommendations', 'Post type general name', 'fictioneer' ),
'singular_name' => _x( 'Recommendation', 'Post type singular name', 'fictioneer' ),
'menu_name' => __( 'Recommend.', 'fictioneer' ),
'name_admin_bar' => __( 'Recommendation', 'fictioneer' ),
'archives' => __( 'Recommendation Archives', 'fictioneer' ),
'attributes' => __( 'Recommendation Attributes', 'fictioneer' ),
'all_items' => __( 'All Recommend.', 'fictioneer' ),
'add_new_item' => __( 'Add New Recommendation', 'fictioneer' ),
'add_new' => __( 'Add New', 'fictioneer' ),
'new_item' => __( 'New Recommendation', 'fictioneer' ),
'edit_item' => __( 'Edit Recommendation', 'fictioneer' ),
'update_item' => __( 'Update Recommendation', 'fictioneer' ),
'view_item' => __( 'View Recommendation', 'fictioneer' ),
'view_items' => __( 'View Recommendations', 'fictioneer' ),
'search_items' => __( 'Search Recommendations', 'fictioneer' ),
'not_found' => __( 'No recommendations found', 'fictioneer' ),
'not_found_in_trash' => __( 'No recommendations found in Trash', 'fictioneer' ),
'featured_image' => __( 'Recommendation Cover Image', 'fictioneer' ),
'set_featured_image' => __( 'Set cover image', 'fictioneer' ),
'remove_featured_image' => __( 'Remove cover image', 'fictioneer' ),
'use_featured_image' => __( 'Use as cover image', 'fictioneer' ),
'insert_into_item' => __( 'Insert into recommendation', 'fictioneer' ),
'uploaded_to_this_item' => __( 'Uploaded to this recommendation', 'fictioneer' ),
'items_list' => __( 'Recommendations list', 'fictioneer' ),
'items_list_navigation' => __( 'Recommendations list navigation', 'fictioneer' ),
'filter_items_list' => __( 'Filter recommendations list', 'fictioneer' ),
);
$args = array(
'label' => __( 'Recommendation', 'fictioneer' ),
'description' => __( 'Recommendations for external stories.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-star-filled',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
$args = array(
'label' => __( 'Recommendation', 'fictioneer' ),
'description' => __( 'Recommendations for external stories.', 'fictioneer' ),
'labels' => $labels,
'menu_icon' => 'dashicons-star-filled',
'supports' => ['title', 'author', 'editor', 'excerpt', 'thumbnail'],
'taxonomies' => ['category', 'post_tag', 'fcn_fandom', 'fcn_character', 'fcn_genre', 'fcn_content_warning'],
'hierarchical' => false,
'public' => true,
'rewrite' => array( 'slug' => 'recommendation' ),
'show_in_rest' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 8,
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_recommendation', 'fcn_recommendations'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_RECOMMENDATION_CAPABILITIES ),
'map_meta_cap' => true
);
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 8,
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => ['fcn_recommendation', 'fcn_recommendations'],
'capabilities' => array_combine( FICTIONEER_WP_CAPABILITIES, FICTIONEER_RECOMMENDATION_CAPABILITIES ),
'map_meta_cap' => true
);
register_post_type( 'fcn_recommendation', $args );
register_post_type( 'fcn_recommendation', $args );
}
add_action( 'init', 'fictioneer_fcn_recommendation_post_type', 0 );
@ -408,12 +408,12 @@ function fictioneer_add_genre_taxonomy() {
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
'capabilities' => array(
'manage_terms' => 'manage_fcn_genres',
'edit_terms' => 'edit_fcn_genres',
'delete_terms' => 'delete_fcn_genres',
'assign_terms' => 'assign_fcn_genres'
)
'capabilities' => array(
'manage_terms' => 'manage_fcn_genres',
'edit_terms' => 'edit_fcn_genres',
'delete_terms' => 'delete_fcn_genres',
'assign_terms' => 'assign_fcn_genres'
)
);
register_taxonomy( 'fcn_genre', ['fcn_chapter', 'fcn_story', 'fcn_collection', 'fcn_recommendation'], $args );
@ -453,12 +453,12 @@ function fictioneer_add_fandom_taxonomy() {
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'fandom' ),
'capabilities' => array(
'manage_terms' => 'manage_fcn_fandoms',
'edit_terms' => 'edit_fcn_fandoms',
'delete_terms' => 'delete_fcn_fandoms',
'assign_terms' => 'assign_fcn_fandoms'
)
'capabilities' => array(
'manage_terms' => 'manage_fcn_fandoms',
'edit_terms' => 'edit_fcn_fandoms',
'delete_terms' => 'delete_fcn_fandoms',
'assign_terms' => 'assign_fcn_fandoms'
)
);
register_taxonomy( 'fcn_fandom', ['fcn_chapter', 'fcn_story', 'fcn_collection', 'fcn_recommendation'], $args );
@ -498,12 +498,12 @@ function fictioneer_add_character_taxonomy() {
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'character' ),
'capabilities' => array(
'manage_terms' => 'manage_fcn_characters',
'edit_terms' => 'edit_fcn_characters',
'delete_terms' => 'delete_fcn_characters',
'assign_terms' => 'assign_fcn_characters'
)
'capabilities' => array(
'manage_terms' => 'manage_fcn_characters',
'edit_terms' => 'edit_fcn_characters',
'delete_terms' => 'delete_fcn_characters',
'assign_terms' => 'assign_fcn_characters'
)
);
register_taxonomy( 'fcn_character', ['fcn_chapter', 'fcn_story', 'fcn_collection', 'fcn_recommendation'], $args );
@ -543,12 +543,12 @@ function fictioneer_add_content_warning_taxonomy() {
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'content-warning' ),
'capabilities' => array(
'manage_terms' => 'manage_fcn_content_warnings',
'edit_terms' => 'edit_fcn_content_warnings',
'delete_terms' => 'delete_fcn_content_warnings',
'assign_terms' => 'assign_fcn_content_warnings'
)
'capabilities' => array(
'manage_terms' => 'manage_fcn_content_warnings',
'edit_terms' => 'edit_fcn_content_warnings',
'delete_terms' => 'delete_fcn_content_warnings',
'assign_terms' => 'assign_fcn_content_warnings'
)
);
register_taxonomy( 'fcn_content_warning', ['fcn_chapter', 'fcn_story', 'fcn_collection', 'fcn_recommendation'], $args );
@ -571,22 +571,22 @@ add_action( 'init', 'fictioneer_add_content_warning_taxonomy', 0 );
*/
function fictioneer_override_default_taxonomy_capability_check( $caps, $cap ) {
$targets = [
'manage_categories',
'edit_categories',
'delete_categories',
'assign_categories',
'manage_post_tags',
'edit_post_tags',
'delete_post_tags',
'assign_post_tags',
];
$targets = [
'manage_categories',
'edit_categories',
'delete_categories',
'assign_categories',
'manage_post_tags',
'edit_post_tags',
'delete_post_tags',
'assign_post_tags',
];
if ( in_array( $cap, $targets ) ) {
$caps = [ $cap ];
}
if ( in_array( $cap, $targets ) ) {
$caps = [ $cap ];
}
return $caps;
return $caps;
}
add_filter( 'map_meta_cap', 'fictioneer_override_default_taxonomy_capability_check', 9999, 2 );
@ -602,15 +602,15 @@ add_filter( 'map_meta_cap', 'fictioneer_override_default_taxonomy_capability_che
*/
function fictioneer_restrict_tag_creation( $term, $taxonomy ) {
if ( $taxonomy == 'post_tag' ) {
return new WP_Error( 'term_addition_blocked', __( 'You are unauthorized to add new terms.' ) );
}
if ( $taxonomy == 'post_tag' ) {
return new WP_Error( 'term_addition_blocked', __( 'You are unauthorized to add new terms.' ) );
}
return $term;
return $term;
}
if ( ! current_user_can( 'edit_post_tags' ) && ! current_user_can( 'manage_options' ) ) {
add_filter( 'pre_insert_term', 'fictioneer_restrict_tag_creation', 9999, 2 );
add_filter( 'pre_insert_term', 'fictioneer_restrict_tag_creation', 9999, 2 );
}
// =============================================================================
@ -624,27 +624,27 @@ if ( ! current_user_can( 'edit_post_tags' ) && ! current_user_can( 'manage_optio
*/
function fictioneer_remove_sub_menus() {
// Setup
$current_user = wp_get_current_user();
$user_caps = array_keys( array_filter( $current_user->allcaps ) );
$taxonomies = ['category', 'post_tag', 'fcn_genre', 'fcn_fandom', 'fcn_character', 'fcn_content_warning'];
$post_types = ['post', 'page', 'fcn_story', 'fcn_chapter', 'fcn_collection', 'fcn_recommendation'];
// Setup
$current_user = wp_get_current_user();
$user_caps = array_keys( array_filter( $current_user->allcaps ) );
$taxonomies = ['category', 'post_tag', 'fcn_genre', 'fcn_fandom', 'fcn_character', 'fcn_content_warning'];
$post_types = ['post', 'page', 'fcn_story', 'fcn_chapter', 'fcn_collection', 'fcn_recommendation'];
// Filter out undesired menus
foreach ( $post_types as $type ) {
$plural = $type == 'fcn_story' ? 'fcn_stories' : "{$type}s";
// Filter out undesired menus
foreach ( $post_types as $type ) {
$plural = $type == 'fcn_story' ? 'fcn_stories' : "{$type}s";
if ( ! in_array( "edit_{$plural}", $user_caps ) ) {
foreach ( $taxonomies as $tax ) {
if ( ! in_array( $tax, $user_caps ) ) {
remove_submenu_page(
"edit-tags.php?taxonomy=category&amp;post_type={$type}",
"edit-tags.php?taxonomy={$tax}&amp;post_type={$type}"
);
}
}
}
}
if ( ! in_array( "edit_{$plural}", $user_caps ) ) {
foreach ( $taxonomies as $tax ) {
if ( ! in_array( $tax, $user_caps ) ) {
remove_submenu_page(
"edit-tags.php?taxonomy=category&amp;post_type={$type}",
"edit-tags.php?taxonomy={$tax}&amp;post_type={$type}"
);
}
}
}
}
}
add_action( 'admin_menu', 'fictioneer_remove_sub_menus' );
@ -661,72 +661,72 @@ add_action( 'admin_menu', 'fictioneer_remove_sub_menus' );
*/
function fictioneer_add_chapter_story_filter_dropdown( $post_type ) {
$screen = get_current_screen();
$screen = get_current_screen();
// Make sure this is the chapter list table view
if (
empty( $screen ) ||
$screen->id !== 'edit-fcn_chapter' ||
$post_type !== 'fcn_chapter'
) {
return;
}
// Make sure this is the chapter list table view
if (
empty( $screen ) ||
$screen->id !== 'edit-fcn_chapter' ||
$post_type !== 'fcn_chapter'
) {
return;
}
// Setup
$current_user = wp_get_current_user();
$user_caps = array_keys( array_filter( $current_user->allcaps ) );
$args = array(
'post_type' => 'fcn_story',
'post_status' => 'any',
'posts_per_page' => 200,
'orderby' => 'modified',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false
);
// Setup
$current_user = wp_get_current_user();
$user_caps = array_keys( array_filter( $current_user->allcaps ) );
$args = array(
'post_type' => 'fcn_story',
'post_status' => 'any',
'posts_per_page' => 200,
'orderby' => 'modified',
'order' => 'DESC',
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false
);
// If not an editor, only show the author's own stories
if ( ! in_array( 'edit_others_fcn_stories', $user_caps ) ) {
$args['author'] = get_current_user_id();
}
// If not an editor, only show the author's own stories
if ( ! in_array( 'edit_others_fcn_stories', $user_caps ) ) {
$args['author'] = get_current_user_id();
}
// Get stories
$posts = get_posts( $args );
// Get stories
$posts = get_posts( $args );
// Do not display nothing or one
if ( count( $posts ) < 2 ) {
return;
}
// Do not display nothing or one
if ( count( $posts ) < 2 ) {
return;
}
// Restore alphabetic order
usort( $posts, function( $a, $b ) {
return strcmp( $a->post_title, $b->post_title );
});
// Restore alphabetic order
usort( $posts, function( $a, $b ) {
return strcmp( $a->post_title, $b->post_title );
});
// Build dropdown
$selected = absint( $_GET['filter_story'] ?? 0 );
// Build dropdown
$selected = absint( $_GET['filter_story'] ?? 0 );
// Open
echo '<select name="filter_story"><option value="">' . __( 'All Stories', 'fictioneer' ) . '</option>';
// Open
echo '<select name="filter_story"><option value="">' . __( 'All Stories', 'fictioneer' ) . '</option>';
// Note if there are too many stories
if ( count( $posts ) >= 200 ) {
echo '<option value="" disabled>' . __( '200 MOST RECENTLY UPDATED', 'fictioneer' ) . '</option>';
}
// Note if there are too many stories
if ( count( $posts ) >= 200 ) {
echo '<option value="" disabled>' . __( '200 MOST RECENTLY UPDATED', 'fictioneer' ) . '</option>';
}
// Items
foreach ( $posts as $post ) {
echo sprintf(
'<option value="%s" %s>%s</option>',
$post->ID,
$selected == $post->ID ? 'selected' : '',
$post->post_title
);
}
// Items
foreach ( $posts as $post ) {
echo sprintf(
'<option value="%s" %s>%s</option>',
$post->ID,
$selected == $post->ID ? 'selected' : '',
$post->post_title
);
}
// Close
echo '</select>';
// Close
echo '</select>';
}
add_action( 'restrict_manage_posts', 'fictioneer_add_chapter_story_filter_dropdown' );
@ -737,43 +737,43 @@ add_action( 'restrict_manage_posts', 'fictioneer_add_chapter_story_filter_dropdo
*/
function fictioneer_filter_chapters_by_story( $query ) {
global $post_type;
global $post_type;
// Abort if...
if ( ! function_exists( 'get_current_screen' ) ) {
return;
}
// Abort if...
if ( ! function_exists( 'get_current_screen' ) ) {
return;
}
$screen = get_current_screen();
$screen = get_current_screen();
// Make damn sure this is the chapter list table query
if (
! is_admin() ||
! $query->is_main_query() ||
$query->query_vars['post_type'] === 'fcn_story' ||
$post_type !== 'fcn_chapter' ||
empty( $_GET['filter_story'] ?? 0 ) ||
empty( $screen ) ||
$screen->id !== 'edit-fcn_chapter'
) {
return;
}
// Make damn sure this is the chapter list table query
if (
! is_admin() ||
! $query->is_main_query() ||
$query->query_vars['post_type'] === 'fcn_story' ||
$post_type !== 'fcn_chapter' ||
empty( $_GET['filter_story'] ?? 0 ) ||
empty( $screen ) ||
$screen->id !== 'edit-fcn_chapter'
) {
return;
}
// Prepare meta query
$meta_query = array(
array(
'key' => 'fictioneer_chapter_story',
'value' => absint( $_GET['filter_story'] ?? 0 ),
'compare' => '='
)
);
// Prepare meta query
$meta_query = array(
array(
'key' => 'fictioneer_chapter_story',
'value' => absint( $_GET['filter_story'] ?? 0 ),
'compare' => '='
)
);
// Apply to query
$query->set( 'meta_query', $meta_query );
// Apply to query
$query->set( 'meta_query', $meta_query );
}
if ( is_admin() ) {
add_action( 'pre_get_posts', 'fictioneer_filter_chapters_by_story' );
add_action( 'pre_get_posts', 'fictioneer_filter_chapters_by_story' );
}
?>

View File

@ -5,9 +5,9 @@
// =============================================================================
define(
'FICTIONEER_BASE_CAPABILITIES',
array(
'fcn_read_others_files',
'FICTIONEER_BASE_CAPABILITIES',
array(
'fcn_read_others_files',
'fcn_edit_others_files',
'fcn_delete_others_files',
'fcn_select_page_template',
@ -29,12 +29,12 @@ define(
'fcn_story_pages',
'fcn_edit_date',
'fcn_moderate_post_comments'
)
)
);
define(
'FICTIONEER_TAXONOMY_CAPABILITIES',
array(
'FICTIONEER_TAXONOMY_CAPABILITIES',
array(
// Categories
'manage_categories',
'edit_categories',
@ -65,7 +65,7 @@ define(
'edit_fcn_content_warnings',
'delete_fcn_content_warnings',
'assign_fcn_content_warnings'
)
)
);
/**
@ -408,7 +408,7 @@ function fictioneer_add_moderator_role() {
}
// Add
return add_role(
return add_role(
'fcn_moderator',
__( 'Moderator', 'fictioneer' ),
$caps

View File

@ -414,10 +414,10 @@ function fictioneer_add_classes_to_body( $classes ) {
// Add classes to defaults
foreach ( $includes as $class => $test ) {
if ( $test ) {
if ( $test ) {
$classes[ $class ] = $class;
}
}
}
// Continue filter
return $classes;
@ -990,7 +990,7 @@ add_filter( 'autoptimize_filter_js_replacetag', 'fictioneer_replace_ao_insert_po
*/
function fictioneer_ao_exclude_scripts( $exclude ) {
return $exclude . '';
return $exclude . '';
}
add_filter( 'autoptimize_filter_js_exclude', 'fictioneer_ao_exclude_scripts', 10, 1 );
@ -1004,7 +1004,7 @@ add_filter( 'autoptimize_filter_js_exclude', 'fictioneer_ao_exclude_scripts', 10
*/
function fictioneer_ao_exclude_css( $exclude ) {
return $exclude . ', fonts.css';
return $exclude . ', fonts.css';
}
add_filter( 'autoptimize_filter_css_exclude', 'fictioneer_ao_exclude_css', 10, 1 );

View File

@ -2064,8 +2064,8 @@ if ( ! function_exists( 'fictioneer_get_post_author_ids' ) ) {
function fictioneer_get_post_author_ids( $post_id ) {
$author_ids = get_post_meta( $post_id, 'fictioneer_story_co_authors', true ) ?: [];
$author_ids = is_array( $author_ids ) ? $author_ids : [];
array_unshift( $author_ids, get_post_field( 'post_author', $post_id ) );
$author_ids = is_array( $author_ids ) ? $author_ids : [];
array_unshift( $author_ids, get_post_field( 'post_author', $post_id ) );
return array_unique( $author_ids );
}
@ -2224,7 +2224,7 @@ if ( ! function_exists( 'fictioneer_get_stories_total_word_count' ) ) {
}
// Setup
$word_count = 0;
$word_count = 0;
// Query all stories
$stories = get_posts(
@ -2241,14 +2241,14 @@ if ( ! function_exists( 'fictioneer_get_stories_total_word_count' ) ) {
// Sum of all word counts
foreach( $stories as $story ) {
$story_data = fictioneer_get_story_data( $story->ID, false ); // Does not refresh comment count!
$word_count += $story_data['word_count'];
}
$word_count += $story_data['word_count'];
}
// Cache for next time
set_transient( 'fictioneer_stories_total_word_count', $word_count );
// Return newly calculated value
return $word_count;
return $word_count;
}
}

View File

@ -787,8 +787,8 @@ if ( get_option( 'fictioneer_consent_wrappers' ) ) {
*/
function fictioneer_user_contact_methods( $methods ) {
$methods['twitter'] = __( 'Twitter Username' );
return $methods;
$methods['twitter'] = __( 'Twitter Username' );
return $methods;
}
add_filter( 'user_contactmethods', 'fictioneer_user_contact_methods' );
@ -838,11 +838,11 @@ if ( ! FICTIONEER_ATTACHMENT_PAGES ) {
*/
function fictioneer_extend_allowed_protocols( $protocols ){
$protocols[] = 's3'; // Amazon S3 bucket
$protocols[] = 'spotify'; // Load a track, album, artist, search, or playlist in Spotify
$protocols[] = 'steam'; // Interact with Steam: install apps, purchase games, run games, etc
$protocols[] = 's3'; // Amazon S3 bucket
$protocols[] = 'spotify'; // Load a track, album, artist, search, or playlist in Spotify
$protocols[] = 'steam'; // Interact with Steam: install apps, purchase games, run games, etc
return $protocols;
return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'fictioneer_extend_allowed_protocols' );

View File

@ -1,60 +1,61 @@
<?php
class Customizer_Range_Value_Control extends \WP_Customize_Control {
public $type = 'range-value';
public $type = 'range-value';
/**
* Enqueue scripts/styles.
*
* @since 3.4.0
*/
public function enqueue() {
wp_enqueue_script( 'customizer-range-value-control', $this->abs_path_to_url( dirname( __FILE__ ) . '/js/customizer-range-value-control.js' ), array( 'jquery' ), rand(), true );
wp_enqueue_style( 'customizer-range-value-control', $this->abs_path_to_url( dirname( __FILE__ ) . '/css/customizer-range-value-control.css' ), array(), rand() );
}
/**
* Enqueue scripts/styles.
*
* @since 3.4.0
*/
public function enqueue() {
wp_enqueue_script( 'customizer-range-value-control', $this->abs_path_to_url( dirname( __FILE__ ) . '/js/customizer-range-value-control.js' ), array( 'jquery' ), rand(), true );
wp_enqueue_style( 'customizer-range-value-control', $this->abs_path_to_url( dirname( __FILE__ ) . '/css/customizer-range-value-control.css' ), array(), rand() );
}
/**
* Render the control's content.
*
*
* @author soderlind
* @version 1.2.0
* @version 1.2.1 Style fixed by Tetrakern
*/
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php if ( ! empty( $this->description ) ) : ?>
<div class="description customize-control-description"><?php echo $this->description; ?></div>
<?php endif; ?>
<div class="range-slider">
<span style="display: flex; align-items: center;">
<input class="range-slider__range" type="range" value="<?php echo esc_attr( $this->value() ); ?>"
<?php
$this->input_attrs();
$this->link();
?>
>
<span class="range-slider__value">0</span>
</span>
</div>
</label>
<?php
}
/**
* Render the control's content.
*
*
* @author soderlind
* @version 1.2.0
* @version 1.2.1 Style fixed by Tetrakern
*/
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php if ( ! empty( $this->description ) ) : ?>
<div class="description customize-control-description"><?php echo $this->description; ?></div>
<?php endif; ?>
<div class="range-slider">
<span style="display: flex; align-items: center;">
<input class="range-slider__range" type="range" value="<?php echo esc_attr( $this->value() ); ?>"
<?php
$this->input_attrs();
$this->link();
?>
>
<span class="range-slider__value">0</span>
</span>
</div>
</label>
<?php
}
/**
* Plugin / theme agnostic path to URL
*
* @see https://wordpress.stackexchange.com/a/264870/14546
* @param string $path file path
* @return string URL
*/
private function abs_path_to_url( $path = '' ) {
$url = str_replace(
wp_normalize_path( untrailingslashit( ABSPATH ) ),
site_url(),
wp_normalize_path( $path )
);
return esc_url_raw( $url );
}
/**
* Plugin / theme agnostic path to URL
*
* @see https://wordpress.stackexchange.com/a/264870/14546
* @param string $path file path
*
* @return string URL
*/
private function abs_path_to_url( $path = '' ) {
$url = str_replace(
wp_normalize_path( untrailingslashit( ABSPATH ) ),
site_url(),
wp_normalize_path( $path )
);
return esc_url_raw( $url );
}
}

View File

@ -15,12 +15,12 @@
value.each(function() {
var value = $(this).prev().attr('value');
var suffix = ($(this).prev().attr('suffix')) ? $(this).prev().attr('suffix') : '';
var suffix = ($(this).prev().attr('suffix')) ? $(this).prev().attr('suffix') : '';
$(this).text(value + suffix).html();
});
range.on('input', function() {
var suffix = ($(this).attr('suffix')) ? $(this).attr('suffix') : '';
var suffix = ($(this).attr('suffix')) ? $(this).attr('suffix') : '';
$(this).next(value).text(this.value + suffix).html();
});
});

View File

@ -277,11 +277,11 @@ function fictioneer_comment_form_args( $defaults = [], $post_id = null ) {
$must_login_oauth = '<div class="fictioneer-respond__must-login">' . __( 'You must be <label for="modal-login-toggle">logged in</label> to comment.', 'fictioneer' ) . '</div>';
$must_login_default = sprintf(
'<div class="fictioneer-respond__must-login">%s</div>',
sprintf(
__( 'You must be <a href="%s">logged in</a> to post a comment.' ),
wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
)
'<div class="fictioneer-respond__must-login">%s</div>',
sprintf(
__( 'You must be <a href="%s">logged in</a> to post a comment.' ),
wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
)
);
$args['must_log_in'] = empty( $oauth_links ) ? $must_login_default : $must_login_oauth;

File diff suppressed because it is too large Load Diff

View File

@ -20,14 +20,14 @@ require_once( '_settings_actions.php' );
*/
function fictioneer_add_admin_menu() {
$fictioneer_plugins = array_filter(
get_option( 'active_plugins' ) ?: [],
function( $plugin ) {
return strpos( $plugin, 'fictioneer' ) !== false;
}
);
$fictioneer_plugins = array_filter(
get_option( 'active_plugins' ) ?: [],
function( $plugin ) {
return strpos( $plugin, 'fictioneer' ) !== false;
}
);
add_menu_page(
add_menu_page(
__( 'Fictioneer Settings', 'fictioneer' ),
__( 'Fictioneer', 'fictioneer' ),
'manage_options',
@ -37,94 +37,94 @@ function fictioneer_add_admin_menu() {
61
);
$general_hook = add_submenu_page(
'fictioneer',
__( 'General', 'fictioneer' ),
__( 'General', 'fictioneer' ),
'manage_options',
'fictioneer',
'fictioneer_settings_general'
);
$general_hook = add_submenu_page(
'fictioneer',
__( 'General', 'fictioneer' ),
__( 'General', 'fictioneer' ),
'manage_options',
'fictioneer',
'fictioneer_settings_general'
);
$roles_hook = add_submenu_page(
'fictioneer',
__( 'Roles', 'fictioneer' ),
__( 'Roles', 'fictioneer' ),
'manage_options',
'fictioneer_roles',
'fictioneer_settings_roles'
);
$roles_hook = add_submenu_page(
'fictioneer',
__( 'Roles', 'fictioneer' ),
__( 'Roles', 'fictioneer' ),
'manage_options',
'fictioneer_roles',
'fictioneer_settings_roles'
);
if ( ! empty( $fictioneer_plugins ) ) {
$plugins_hook = add_submenu_page(
'fictioneer',
__( 'Plugins', 'fictioneer' ),
__( 'Plugins', 'fictioneer' ),
'manage_options',
'fictioneer_plugins',
'fictioneer_settings_plugins'
);
}
if ( ! empty( $fictioneer_plugins ) ) {
$plugins_hook = add_submenu_page(
'fictioneer',
__( 'Plugins', 'fictioneer' ),
__( 'Plugins', 'fictioneer' ),
'manage_options',
'fictioneer_plugins',
'fictioneer_settings_plugins'
);
}
$connections_hook = add_submenu_page(
'fictioneer',
__( 'Connections', 'fictioneer' ),
__( 'Connections', 'fictioneer' ),
'manage_options',
'fictioneer_connections',
'fictioneer_settings_connections'
);
$connections_hook = add_submenu_page(
'fictioneer',
__( 'Connections', 'fictioneer' ),
__( 'Connections', 'fictioneer' ),
'manage_options',
'fictioneer_connections',
'fictioneer_settings_connections'
);
$phrases_hook = add_submenu_page(
'fictioneer',
__( 'Phrases', 'fictioneer' ),
__( 'Phrases', 'fictioneer' ),
'manage_options',
'fictioneer_phrases',
'fictioneer_settings_phrases'
);
$phrases_hook = add_submenu_page(
'fictioneer',
__( 'Phrases', 'fictioneer' ),
__( 'Phrases', 'fictioneer' ),
'manage_options',
'fictioneer_phrases',
'fictioneer_settings_phrases'
);
$epubs_hook = add_submenu_page(
'fictioneer',
__( 'ePUBs', 'fictioneer' ),
__( 'ePUBs', 'fictioneer' ),
'manage_options',
'fictioneer_epubs',
'fictioneer_settings_epubs'
);
$epubs_hook = add_submenu_page(
'fictioneer',
__( 'ePUBs', 'fictioneer' ),
__( 'ePUBs', 'fictioneer' ),
'manage_options',
'fictioneer_epubs',
'fictioneer_settings_epubs'
);
$seo_hook = add_submenu_page(
'fictioneer',
__( 'SEO', 'fictioneer' ),
__( 'SEO', 'fictioneer' ),
'manage_options',
'fictioneer_seo',
'fictioneer_settings_seo'
);
$seo_hook = add_submenu_page(
'fictioneer',
__( 'SEO', 'fictioneer' ),
__( 'SEO', 'fictioneer' ),
'manage_options',
'fictioneer_seo',
'fictioneer_settings_seo'
);
$tools_hook = add_submenu_page(
'fictioneer',
__( 'Tools', 'fictioneer' ),
__( 'Tools', 'fictioneer' ),
'manage_options',
'fictioneer_tools',
'fictioneer_settings_tools'
);
$tools_hook = add_submenu_page(
'fictioneer',
__( 'Tools', 'fictioneer' ),
__( 'Tools', 'fictioneer' ),
'manage_options',
'fictioneer_tools',
'fictioneer_settings_tools'
);
$logs_hook = add_submenu_page(
'fictioneer',
__( 'Logs', 'fictioneer' ),
__( 'Logs', 'fictioneer' ),
'manage_options',
'fictioneer_logs',
'fictioneer_settings_logs'
);
$logs_hook = add_submenu_page(
'fictioneer',
__( 'Logs', 'fictioneer' ),
__( 'Logs', 'fictioneer' ),
'manage_options',
'fictioneer_logs',
'fictioneer_settings_logs'
);
add_action( 'admin_init', 'fictioneer_register_settings' );
add_action( 'admin_init', 'fictioneer_register_settings' );
// Add screen options
// Add screen options
add_action( "load-{$epubs_hook}", 'fictioneer_settings_epubs_screen_options' );
add_action( "load-{$seo_hook}", 'fictioneer_settings_seo_screen_options' );
add_action( "load-{$seo_hook}", 'fictioneer_settings_seo_screen_options' );
}
add_action( 'admin_menu', 'fictioneer_add_admin_menu' );
@ -136,12 +136,12 @@ add_action( 'admin_menu', 'fictioneer_add_admin_menu' );
function fictioneer_settings_epubs_screen_options() {
// Add pagination option
$args = array(
'label' => __( 'ePUBs per page', 'fcnes' ),
'default' => 25,
'option' => 'fictioneer_epubs_per_page'
);
add_screen_option( 'per_page', $args );
$args = array(
'label' => __( 'ePUBs per page', 'fcnes' ),
'default' => 25,
'option' => 'fictioneer_epubs_per_page'
);
add_screen_option( 'per_page', $args );
}
/**
@ -152,12 +152,12 @@ function fictioneer_settings_epubs_screen_options() {
function fictioneer_settings_seo_screen_options() {
// Add pagination option
$args = array(
'label' => __( 'Items per page', 'fcnes' ),
'default' => 25,
'option' => 'fictioneer_seo_items_per_page'
);
add_screen_option( 'per_page', $args );
$args = array(
'label' => __( 'Items per page', 'fcnes' ),
'default' => 25,
'option' => 'fictioneer_seo_items_per_page'
);
add_screen_option( 'per_page', $args );
}
/**
@ -192,81 +192,81 @@ add_filter( 'set-screen-option', 'fictioneer_save_screen_options', 10, 3 );
// =============================================================================
if ( ! function_exists( 'fictioneer_settings_header' ) ) {
/**
* Output HTML for the settings page header
*
* @since 4.7
*
* @param string $tab The current tab to highlight. Defaults to 'general'.
*/
/**
* Output HTML for the settings page header
*
* @since 4.7
*
* @param string $tab The current tab to highlight. Defaults to 'general'.
*/
function fictioneer_settings_header( $tab = 'general' ) {
// Setup
$output = [];
$fictioneer_plugins = array_filter(
get_option( 'active_plugins' ) ?: [],
function( $plugin ) {
return strpos( $plugin, 'fictioneer' ) !== false;
}
);
function fictioneer_settings_header( $tab = 'general' ) {
// Setup
$output = [];
$fictioneer_plugins = array_filter(
get_option( 'active_plugins' ) ?: [],
function( $plugin ) {
return strpos( $plugin, 'fictioneer' ) !== false;
}
);
// General tab
$output['general'] = '<a href="?page=fictioneer" class="fictioneer-settings__nav-tab' . ( $tab == 'general' ? ' active' : '' ) . '">' . __( 'General', 'fictioneer' ) . '</a>';
// General tab
$output['general'] = '<a href="?page=fictioneer" class="fictioneer-settings__nav-tab' . ( $tab == 'general' ? ' active' : '' ) . '">' . __( 'General', 'fictioneer' ) . '</a>';
// Roles tab
$output['roles'] = '<a href="?page=fictioneer_roles" class="fictioneer-settings__nav-tab' . ( $tab == 'roles' ? ' active' : '' ) . '">' . __( 'Roles', 'fictioneer' ) . '</a>';
// Roles tab
$output['roles'] = '<a href="?page=fictioneer_roles" class="fictioneer-settings__nav-tab' . ( $tab == 'roles' ? ' active' : '' ) . '">' . __( 'Roles', 'fictioneer' ) . '</a>';
// Plugins tab
if ( ! empty( $fictioneer_plugins ) ) {
$output['plugins'] = '<a href="?page=fictioneer_plugins" class="fictioneer-settings__nav-tab' . ( $tab == 'plugins' ? ' active' : '' ) . '">' . __( 'Plugins', 'fictioneer' ) . '</a>';
}
// Plugins tab
if ( ! empty( $fictioneer_plugins ) ) {
$output['plugins'] = '<a href="?page=fictioneer_plugins" class="fictioneer-settings__nav-tab' . ( $tab == 'plugins' ? ' active' : '' ) . '">' . __( 'Plugins', 'fictioneer' ) . '</a>';
}
// Connections tab
$output['connections'] = '<a href="?page=fictioneer_connections" class="fictioneer-settings__nav-tab' . ( $tab == 'connections' ? ' active' : '' ) . '">' . __( 'Connections', 'fictioneer' ) . '</a>';
// Connections tab
$output['connections'] = '<a href="?page=fictioneer_connections" class="fictioneer-settings__nav-tab' . ( $tab == 'connections' ? ' active' : '' ) . '">' . __( 'Connections', 'fictioneer' ) . '</a>';
// Phrases tab
$output['phrases'] = '<a href="?page=fictioneer_phrases" class="fictioneer-settings__nav-tab' . ( $tab == 'phrases' ? ' active' : '' ) . '">' . __( 'Phrases', 'fictioneer' ) . '</a>';
// Phrases tab
$output['phrases'] = '<a href="?page=fictioneer_phrases" class="fictioneer-settings__nav-tab' . ( $tab == 'phrases' ? ' active' : '' ) . '">' . __( 'Phrases', 'fictioneer' ) . '</a>';
// EPubs tab
$output['epubs'] = '<a href="?page=fictioneer_epubs" class="fictioneer-settings__nav-tab' . ( $tab == 'epubs' ? ' active' : '' ) . '">' . __( 'ePUBs', 'fictioneer' ) . '</a>';
// EPubs tab
$output['epubs'] = '<a href="?page=fictioneer_epubs" class="fictioneer-settings__nav-tab' . ( $tab == 'epubs' ? ' active' : '' ) . '">' . __( 'ePUBs', 'fictioneer' ) . '</a>';
// SEO tab (if enabled)
if ( get_option( 'fictioneer_enable_seo' ) ) {
$output['seo'] = '<a href="?page=fictioneer_seo" class="fictioneer-settings__nav-tab' . ( $tab == 'seo' ? ' active' : '' ) . '">' . __( 'SEO', 'fictioneer' ) . '</a>';
}
// SEO tab (if enabled)
if ( get_option( 'fictioneer_enable_seo' ) ) {
$output['seo'] = '<a href="?page=fictioneer_seo" class="fictioneer-settings__nav-tab' . ( $tab == 'seo' ? ' active' : '' ) . '">' . __( 'SEO', 'fictioneer' ) . '</a>';
}
// Tools tab
$output['tools'] = '<a href="?page=fictioneer_tools" class="fictioneer-settings__nav-tab' . ( $tab == 'tools' ? ' active' : '' ) . '">' . __( 'Tools', 'fictioneer' ) . '</a>';
// Tools tab
$output['tools'] = '<a href="?page=fictioneer_tools" class="fictioneer-settings__nav-tab' . ( $tab == 'tools' ? ' active' : '' ) . '">' . __( 'Tools', 'fictioneer' ) . '</a>';
// Logs tab
$output['logs'] = '<a href="?page=fictioneer_logs" class="fictioneer-settings__nav-tab' . ( $tab == 'logs' ? ' active' : '' ) . '">' . __( 'Logs', 'fictioneer' ) . '</a>';
// Logs tab
$output['logs'] = '<a href="?page=fictioneer_logs" class="fictioneer-settings__nav-tab' . ( $tab == 'logs' ? ' active' : '' ) . '">' . __( 'Logs', 'fictioneer' ) . '</a>';
// Apply filters
$output = apply_filters( 'fictioneer_filter_admin_settings_navigation', $output );
// Apply filters
$output = apply_filters( 'fictioneer_filter_admin_settings_navigation', $output );
// Start HTML ---> ?>
<header class="fictioneer-settings__header">
<div>
<h1><?php _e( 'Fictioneer', 'fictioneer' ); ?></h1>
<div class="fictioneer-settings__header-links">
<a href="https://github.com/Tetrakern/fictioneer/releases" target="_blank"><?php echo FICTIONEER_VERSION; ?></a>
&bull;
<a href="https://github.com/Tetrakern/fictioneer#readme" target="_blank"><?php
// Start HTML ---> ?>
<header class="fictioneer-settings__header">
<div>
<h1><?php _e( 'Fictioneer', 'fictioneer' ); ?></h1>
<div class="fictioneer-settings__header-links">
<a href="https://github.com/Tetrakern/fictioneer/releases" target="_blank"><?php echo FICTIONEER_VERSION; ?></a>
&bull;
<a href="https://github.com/Tetrakern/fictioneer#readme" target="_blank"><?php
_e( 'Documentation on Github', 'fictioneer' );
?></a>
&bull;
<a href="https://ko-fi.com/tetrakern" target="_blank"><?php _e( 'Support me on Ko-fi', 'fictioneer' ); ?></a>
</div>
&bull;
<a href="https://ko-fi.com/tetrakern" target="_blank"><?php _e( 'Support me on Ko-fi', 'fictioneer' ); ?></a>
</div>
<?php if ( CHILD_VERSION && CHILD_NAME ) : ?>
<div class="fictioneer-settings__header-links">
<span><?php echo CHILD_VERSION; ?> &bull; <?php echo CHILD_NAME; ?></span>
</div>
<?php endif; ?>
</div>
<nav class="fictioneer-settings__nav"><?php echo implode( '', $output ); ?></nav>
</header>
<?php // <--- End HTML
}
</div>
<nav class="fictioneer-settings__nav"><?php echo implode( '', $output ); ?></nav>
</header>
<?php // <--- End HTML
}
}
// =============================================================================
@ -280,7 +280,7 @@ if ( ! function_exists( 'fictioneer_settings_header' ) ) {
*/
function fictioneer_settings_connections() {
get_template_part( 'includes/functions/settings/_settings_page_connections' );
get_template_part( 'includes/functions/settings/_settings_page_connections' );
}
/**
@ -290,7 +290,7 @@ function fictioneer_settings_connections() {
*/
function fictioneer_settings_general() {
get_template_part( 'includes/functions/settings/_settings_page_general' );
get_template_part( 'includes/functions/settings/_settings_page_general' );
}
/**
@ -300,7 +300,7 @@ function fictioneer_settings_general() {
*/
function fictioneer_settings_roles() {
get_template_part( 'includes/functions/settings/_settings_page_roles' );
get_template_part( 'includes/functions/settings/_settings_page_roles' );
}
/**
@ -310,7 +310,7 @@ function fictioneer_settings_roles() {
*/
function fictioneer_settings_plugins() {
get_template_part( 'includes/functions/settings/_settings_page_plugins' );
get_template_part( 'includes/functions/settings/_settings_page_plugins' );
}
/**
@ -320,7 +320,7 @@ function fictioneer_settings_plugins() {
*/
function fictioneer_settings_epubs() {
get_template_part( 'includes/functions/settings/_settings_page_epubs' );
get_template_part( 'includes/functions/settings/_settings_page_epubs' );
}
/**
@ -330,7 +330,7 @@ function fictioneer_settings_epubs() {
*/
function fictioneer_settings_seo() {
get_template_part( 'includes/functions/settings/_settings_page_seo' );
get_template_part( 'includes/functions/settings/_settings_page_seo' );
}
/**
@ -340,7 +340,7 @@ function fictioneer_settings_seo() {
*/
function fictioneer_settings_phrases() {
get_template_part( 'includes/functions/settings/_settings_page_phrases' );
get_template_part( 'includes/functions/settings/_settings_page_phrases' );
}
/**
@ -350,7 +350,7 @@ function fictioneer_settings_phrases() {
*/
function fictioneer_settings_tools() {
get_template_part( 'includes/functions/settings/_settings_page_tools' );
get_template_part( 'includes/functions/settings/_settings_page_tools' );
}
/**
@ -360,7 +360,7 @@ function fictioneer_settings_tools() {
*/
function fictioneer_settings_logs() {
get_template_part( 'includes/functions/settings/_settings_page_logs' );
get_template_part( 'includes/functions/settings/_settings_page_logs' );
}
// =============================================================================
@ -378,36 +378,36 @@ function fictioneer_settings_logs() {
*/
function fictioneer_settings_capability_card( $title, $caps, $role ) {
// Start HTML ---> ?>
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php echo $title; ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row fictioneer-card__row--capabilities">
<?php
foreach ( $caps as $cap ) {
$role_caps = $role['capabilities'];
$set = in_array( $cap, $role_caps ) && ( $role_caps[ $cap ] ?? 0 );
$name = str_replace( '_', ' ', $cap );
$name = str_replace( 'fcn ', '', $name );
$name = ucwords( $name );
// Start HTML ---> ?>
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php echo $title; ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row fictioneer-card__row--capabilities">
<?php
foreach ( $caps as $cap ) {
$role_caps = $role['capabilities'];
$set = in_array( $cap, $role_caps ) && ( $role_caps[ $cap ] ?? 0 );
$name = str_replace( '_', ' ', $cap );
$name = str_replace( 'fcn ', '', $name );
$name = ucwords( $name );
// Special cases
$name = $name == 'Unfiltered Html' ? 'Unfiltered HTML' : $name;
$name = str_replace( 'Recommendations', 'Recommend.', $name );
$name = str_replace( 'Custom Css', 'Custom CSS', $name );
$name = str_replace( 'Seo Meta', 'SEO Meta', $name );
$name = str_replace( 'Custom Page Css', 'Custom Page CSS', $name );
$name = str_replace( 'Custom Epub Css', 'Custom ePUB CSS', $name );
// Special cases
$name = $name == 'Unfiltered Html' ? 'Unfiltered HTML' : $name;
$name = str_replace( 'Recommendations', 'Recommend.', $name );
$name = str_replace( 'Custom Css', 'Custom CSS', $name );
$name = str_replace( 'Seo Meta', 'SEO Meta', $name );
$name = str_replace( 'Custom Page Css', 'Custom Page CSS', $name );
$name = str_replace( 'Custom Epub Css', 'Custom ePUB CSS', $name );
fictioneer_settings_capability_checkbox( $cap, $name, $set );
}
?>
</div>
</div>
</div>
</div>
<?php // <--- End HTML
fictioneer_settings_capability_checkbox( $cap, $name, $set );
}
?>
</div>
</div>
</div>
</div>
<?php // <--- End HTML
}
/**
@ -440,17 +440,17 @@ function fictioneer_settings_capability_checkbox( $cap, $name, $set ) {
*/
function fictioneer_settings_label_checkbox( $option, $sub_label = null ) {
// Start HTML ---> ?>
<label class="fictioneer-label-checkbox" for="<?php echo $option; ?>">
<input name="<?php echo $option; ?>" type="checkbox" id="<?php echo $option; ?>" <?php echo checked( 1, get_option( $option ), false ); ?> value="1" autocomplete="off">
<div>
<span><?php echo FICTIONEER_OPTIONS['booleans'][ $option ]['label']; ?></span>
<?php if ( ! empty( $sub_label ) ) : ?>
<p class="fictioneer-sub-label"><?php echo $sub_label; ?></p>
<?php endif; ?>
</div>
</label>
<?php // <--- End HTML
// Start HTML ---> ?>
<label class="fictioneer-label-checkbox" for="<?php echo $option; ?>">
<input name="<?php echo $option; ?>" type="checkbox" id="<?php echo $option; ?>" <?php echo checked( 1, get_option( $option ), false ); ?> value="1" autocomplete="off">
<div>
<span><?php echo FICTIONEER_OPTIONS['booleans'][ $option ]['label']; ?></span>
<?php if ( ! empty( $sub_label ) ) : ?>
<p class="fictioneer-sub-label"><?php echo $sub_label; ?></p>
<?php endif; ?>
</div>
</label>
<?php // <--- End HTML
}
/**
@ -463,12 +463,12 @@ function fictioneer_settings_label_checkbox( $option, $sub_label = null ) {
*/
function fictioneer_settings_text_input( $option, $type = 'text' ) {
// Start HTML ---> ?>
<label class="fictioneer-label-textfield" for="<?php echo $option; ?>">
<input name="<?php echo $option; ?>" placeholder="<?php echo FICTIONEER_OPTIONS['strings'][ $option ]['placeholder']; ?>" type="<?php echo $type; ?>" id="<?php echo $option; ?>" value="<?php echo esc_attr( get_option( $option ) ); ?>" autocomplete="off">
<p class="fictioneer-sub-label"><?php echo FICTIONEER_OPTIONS['strings'][ $option ]['label']; ?></p>
</label>
<?php // <--- End HTML
// Start HTML ---> ?>
<label class="fictioneer-label-textfield" for="<?php echo $option; ?>">
<input name="<?php echo $option; ?>" placeholder="<?php echo FICTIONEER_OPTIONS['strings'][ $option ]['placeholder']; ?>" type="<?php echo $type; ?>" id="<?php echo $option; ?>" value="<?php echo esc_attr( get_option( $option ) ); ?>" autocomplete="off">
<p class="fictioneer-sub-label"><?php echo FICTIONEER_OPTIONS['strings'][ $option ]['label']; ?></p>
</label>
<?php // <--- End HTML
}
/**
@ -481,10 +481,10 @@ function fictioneer_settings_text_input( $option, $type = 'text' ) {
*/
function fictioneer_settings_textarea( $option, $height = 'auto' ) {
// Start HTML ---> ?>
<textarea class="fictioneer-textarea" name="<?php echo $option; ?>" id="<?php echo $option; ?>" rows="4" style="height: <?php echo $height; ?>;"><?php echo get_option( $option ); ?></textarea>
<p class="fictioneer-sub-label"><?php echo FICTIONEER_OPTIONS['strings'][ $option ]['label']; ?></p>
<?php // <--- End HTML
// Start HTML ---> ?>
<textarea class="fictioneer-textarea" name="<?php echo $option; ?>" id="<?php echo $option; ?>" rows="4" style="height: <?php echo $height; ?>;"><?php echo get_option( $option ); ?></textarea>
<p class="fictioneer-sub-label"><?php echo FICTIONEER_OPTIONS['strings'][ $option ]['label']; ?></p>
<?php // <--- End HTML
}
/**
@ -496,15 +496,15 @@ function fictioneer_settings_textarea( $option, $height = 'auto' ) {
*/
function fictioneer_settings_page_assignment( $option ) {
wp_dropdown_pages(
array(
'name' => $option,
'id' => $option,
'option_none_value' => _x( 'None', 'No selection page assignment.', 'fictioneer' ),
'show_option_no_change' => _x( 'None', 'No selection page assignment.', 'fictioneer' ),
'selected' => get_option( $option )
)
);
wp_dropdown_pages(
array(
'name' => $option,
'id' => $option,
'option_none_value' => _x( 'None', 'No selection page assignment.', 'fictioneer' ),
'show_option_no_change' => _x( 'None', 'No selection page assignment.', 'fictioneer' ),
'selected' => get_option( $option )
)
);
echo '<p class="fictioneer-sub-label">' . FICTIONEER_OPTIONS['integers'][ $option ]['label'] . '</p>';
echo '<p class="fictioneer-sub-label">' . FICTIONEER_OPTIONS['integers'][ $option ]['label'] . '</p>';
}

View File

@ -9,7 +9,7 @@
*
* @since 5.2.5
*
* @param string $action Name of the tool action.
* @param string $action Name of the tool action.
*/
function fictioneer_verify_tool_action( $action ) {
@ -29,8 +29,8 @@ function fictioneer_verify_tool_action( $action ) {
*
* @since 5.2.5
*
* @param string $notice Optional. The notice message to include in the redirect URL.
* @param string $type Optional. The type of notice. Default 'success'.
* @param string $notice Optional. The notice message to include in the redirect URL.
* @param string $type Optional. The type of notice. Default 'success'.
*/
function fictioneer_finish_tool_action( $notice = '', $type = 'success' ) {
@ -50,12 +50,12 @@ if ( ! function_exists( 'fictioneer_get_default_genres' ) ) {
*
* @since 4.7.0
*
* @param array Decoded JSON with default genres and meta data.
* @return array Decoded JSON with default genres and meta data.
*/
function fictioneer_get_default_genres() {
return json_decode( file_get_contents( get_template_directory_uri() . '/json/genres.json' ) );
}
function fictioneer_get_default_genres() {
return json_decode( file_get_contents( get_template_directory_uri() . '/json/genres.json' ) );
}
}
if ( ! function_exists( 'fictioneer_get_default_tags' ) ) {
@ -64,12 +64,12 @@ if ( ! function_exists( 'fictioneer_get_default_tags' ) ) {
*
* @since 4.7.0
*
* @param array Decoded JSON with default tags and meta data.
* @return array Decoded JSON with default tags and meta data.
*/
function fictioneer_get_default_tags() {
return json_decode( file_get_contents( get_template_directory_uri() . '/json/tags.json' ) );
}
function fictioneer_get_default_tags() {
return json_decode( file_get_contents( get_template_directory_uri() . '/json/tags.json' ) );
}
}
// =============================================================================
@ -78,20 +78,20 @@ if ( ! function_exists( 'fictioneer_get_default_tags' ) ) {
if ( ! defined( 'FICTIONEER_ADMIN_SETTINGS_NOTICES' ) ) {
define(
'FICTIONEER_ADMIN_SETTINGS_NOTICES',
array(
'fictioneer-story-tags-to-genres' => __( 'All story tags have been converted to genres.', 'fictioneer' ),
'fictioneer-duplicate-tags-to-genres' => __( 'All story tags have been duplicated to genres.', 'fictioneer' ),
'fictioneer-chapter-tags-to-genres' => __( 'All chapter tags have been converted to genres.', 'fictioneer' ),
'fictioneer-duplicate-tags-to-genres' => __( 'All chapter tags have been duplicated to genres.', 'fictioneer' ),
'fictioneer-append-default-genres' => __( 'Default genres have been added to the list.', 'fictioneer' ),
'fictioneer-append-default-tags' => __( 'Default tags have been added to the list.', 'fictioneer' ),
'fictioneer-remove-unused-tags' => __( 'All unused tags have been removed.', 'fictioneer' ),
'fictioneer-deleted-epubs' => __( 'All ePUB files have been deleted.', 'fictioneer' ),
'fictioneer-purge-theme-caches' => __( 'Theme caches have been purged.', 'fictioneer' ),
'fictioneer-added-moderator-role' => __( 'Moderator role has been added.', 'fictioneer' ),
'FICTIONEER_ADMIN_SETTINGS_NOTICES',
array(
'fictioneer-story-tags-to-genres' => __( 'All story tags have been converted to genres.', 'fictioneer' ),
'fictioneer-duplicate-tags-to-genres' => __( 'All story tags have been duplicated to genres.', 'fictioneer' ),
'fictioneer-chapter-tags-to-genres' => __( 'All chapter tags have been converted to genres.', 'fictioneer' ),
'fictioneer-duplicate-tags-to-genres' => __( 'All chapter tags have been duplicated to genres.', 'fictioneer' ),
'fictioneer-append-default-genres' => __( 'Default genres have been added to the list.', 'fictioneer' ),
'fictioneer-append-default-tags' => __( 'Default tags have been added to the list.', 'fictioneer' ),
'fictioneer-remove-unused-tags' => __( 'All unused tags have been removed.', 'fictioneer' ),
'fictioneer-deleted-epubs' => __( 'All ePUB files have been deleted.', 'fictioneer' ),
'fictioneer-purge-theme-caches' => __( 'Theme caches have been purged.', 'fictioneer' ),
'fictioneer-added-moderator-role' => __( 'Moderator role has been added.', 'fictioneer' ),
'fictioneer-not-added-moderator-role' => __( 'Moderator role could not be added or already exists.', 'fictioneer' ),
'fictioneer-removed-moderator-role' => __( 'Moderator role has been removed.', 'fictioneer' ),
'fictioneer-removed-moderator-role' => __( 'Moderator role has been removed.', 'fictioneer' ),
'fictioneer-reset-post-relationship-registry' => __( 'Post relationship registry reset.', 'fictioneer' ),
'fictioneer-fix-users' => __( 'This function does currently not cover any issues.', 'fictioneer' ),
'fictioneer-fix-stories' => __( 'This function does currently not cover any issues.', 'fictioneer' ),
@ -120,8 +120,8 @@ if ( ! defined( 'FICTIONEER_ADMIN_SETTINGS_NOTICES' ) ) {
'fictioneer-add-story-sticky' => __( 'The "fictioneer_story_sticky" meta field has been appended with value 0.', 'fictioneer' ),
'fictioneer-add-chapter-hidden' => __( 'The "fictioneer_chapter_hidden" meta field has been appended with value 0.', 'fictioneer' ),
'fictioneer-chapters-appended' => __( '%s chapters have been appended.', 'fictioneer' )
)
);
)
);
}
/**

View File

@ -16,7 +16,7 @@
*/
function fictioneer_validate_settings_ajax() {
return is_admin() &&
return is_admin() &&
wp_doing_ajax() &&
current_user_can( 'manage_options' ) &&
! empty( $_POST['nonce'] ) &&
@ -45,7 +45,7 @@ function fictioneer_ajax_delete_epub() {
$path = wp_upload_dir()['basedir'] . '/epubs/' . $file_name;
// Delete file from directory
wp_delete_file( $path );
wp_delete_file( $path );
// Check if deletion was successful
if ( ! file_exists( $path ) ) {
@ -99,17 +99,17 @@ add_action( 'wp_ajax_fictioneer_ajax_delete_epub', 'fictioneer_ajax_delete_epub'
*/
function fictioneer_ajax_purge_schema() {
if ( fictioneer_validate_settings_ajax() ) {
if ( fictioneer_validate_settings_ajax() ) {
// Abort if...
if ( empty( $_POST['post_id'] ?? '' ) ) {
wp_send_json_error( array( 'notice' => __( 'ID missing', 'fictioneer' ) ) );
}
// Setup
$post_id = fictioneer_validate_id( $_POST['post_id'] );
$post_id = fictioneer_validate_id( $_POST['post_id'] );
// Delete schema stored in post meta
if ( $post_id && delete_post_meta( $post_id, 'fictioneer_schema' ) ) {
if ( $post_id && delete_post_meta( $post_id, 'fictioneer_schema' ) ) {
// Log
fictioneer_log(
sprintf(
@ -137,7 +137,7 @@ function fictioneer_ajax_purge_schema() {
)
)
);
} else {
} else {
// Error
wp_send_json_error(
array(
@ -147,8 +147,8 @@ function fictioneer_ajax_purge_schema() {
)
)
);
}
}
}
}
// Invalid
wp_send_json_error( array( 'notice' => __( 'Invalid request.', 'fictioneer' ) ) );

View File

@ -5,16 +5,16 @@
// =============================================================================
/**
* Log a message to the theme log file
* Logs a message to the theme log file
*
* @since 5.0.0
*
* @param string $message What has been updated
* @param WP_User|null $user The user who did it. Defaults to current user.
* @param string $message What has been updated
* @param WP_User|null $user The user who did it. Defaults to current user.
*/
function fictioneer_log( $message, $current_user = null ) {
// Setup
// Setup
$current_user = $current_user ?? wp_get_current_user();
$username = _x( 'System', 'Default name in logs.', 'fictioneer' );
$log_file = WP_CONTENT_DIR . '/fictioneer-logs.log';
@ -98,12 +98,12 @@ function fictioneer_get_log() {
// =============================================================================
/**
* Log post update
* Logs post update
*
* @since 5.0.0
*
* @param int $post_id The post ID.
* @param string $action The action performed.
* @param int $post_id The post ID.
* @param string $action The action performed.
*/
function fictioneer_log_post_update( $post_id, $action ) {
@ -120,8 +120,8 @@ function fictioneer_log_post_update( $post_id, $action ) {
fictioneer_get_safe_title( $post_id )
);
// Log
fictioneer_log( $message );
// Log
fictioneer_log( $message );
}
// =============================================================================
@ -129,30 +129,30 @@ function fictioneer_log_post_update( $post_id, $action ) {
// =============================================================================
/**
* Log update of checkbox option
* Logs update of checkbox option
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param boolean|null $old_value The previous value or null if not set.
* @param boolean $value The new value.
* @param boolean $value The new value.
*/
function fictioneer_log_checkbox_update( $option, $old_value, $value ) {
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
return;
}
// Build message
// Build message
$update = sprintf(
_x( '%1$s: %2$s', 'Pattern for checkbox option in logs: "{Checked} {Option}".', 'fictioneer' ),
$value ? _x( 'Checked', 'State of checkbox option in logs.', 'fictioneer' ) : _x( 'Unchecked', 'State of checkbox option in logs.', 'fictioneer' ),
$option
);
// Log
fictioneer_log( $update );
// Log
fictioneer_log( $update );
}
/**
@ -160,7 +160,7 @@ function fictioneer_log_checkbox_update( $option, $old_value, $value ) {
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param boolean $value The new value.
*/
@ -184,9 +184,9 @@ add_action( 'added_option', 'fictioneer_settings_checkbox_added', 10, 2 );
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param boolean $old_value The previous value.
* @param boolean $value The new value.
* @param boolean $value The new value.
*/
function fictioneer_settings_checkbox_updated( $option, $old_value, $value ) {
@ -222,22 +222,22 @@ define(
);
/**
* Log update of page assignment
* Logs update of page assignment
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param int|null $old_value The previous value or null if not set.
* @param int $value The new value.
* @param int $value The new value.
*/
function fictioneer_log_page_assignment_update( $option, $old_value, $value ) {
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
return;
}
// Build message
// Build message
$message = sprintf(
_x(
'%1$s page assignment changed from #%2$s to #%3$s',
@ -249,8 +249,8 @@ function fictioneer_log_page_assignment_update( $option, $old_value, $value ) {
$value
);
// Log
fictioneer_log( $message );
// Log
fictioneer_log( $message );
}
/**
@ -282,9 +282,9 @@ add_action( 'added_option', 'fictioneer_settings_page_assignment_added', 10, 2 )
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param int $old_value The previous value.
* @param int $value The new value.
* @param int $value The new value.
*/
function fictioneer_settings_page_assignment_updated( $option, $old_value, $value ) {
@ -317,22 +317,22 @@ define(
);
/**
* Log update of phrase option
* Logs update of phrase option
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param string|null $old_value The previous value or null if not set.
* @param string $value The new value.
* @param string $value The new value.
*/
function fictioneer_log_phrase_update( $option, $old_value, $value ) {
// Abort if...
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
return;
}
// Build message
// Build message
$message = sprintf(
_x(
'Phrase for the %1$s changed to \'%2$s\'',
@ -343,8 +343,8 @@ function fictioneer_log_phrase_update( $option, $old_value, $value ) {
preg_replace( '/\s+/', ' ', $value )
);
// Log
fictioneer_log( $message );
// Log
fictioneer_log( $message );
}
/**
@ -376,9 +376,9 @@ add_action( 'added_option', 'fictioneer_settings_phrase_added', 10, 2 );
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param string $old_value The previous value.
* @param string $value The new value.
* @param string $value The new value.
*/
function fictioneer_settings_phrase_updated( $option, $old_value, $value ) {
@ -417,22 +417,22 @@ define(
);
/**
* Log update of connection option
* Logs update of connection option
*
* @since 5.0.0
*
* @param string $connection Name of the connection option.
* @param string $connection Name of the connection option.
* @param int|null $old_value ID of the old page or null if unset.
* @param int $value ID of the new page.
* @param int $value ID of the new page.
*/
function fictioneer_log_connection_update( $connection, $old_value, $value ) {
// Abort if...
// Abort if...
if ( ! is_null( $old_value ) && $old_value === $value ) {
return;
}
// Build message
// Build message
$message = sprintf(
_x(
'%s updated.',
@ -442,8 +442,8 @@ function fictioneer_log_connection_update( $connection, $old_value, $value ) {
$connection
);
// Log
fictioneer_log( $message );
// Log
fictioneer_log( $message );
}
/**
@ -475,9 +475,9 @@ add_action( 'added_option', 'fictioneer_settings_connection_added', 10, 2 );
*
* @since 5.0.0
*
* @param string $option Name of the option.
* @param string $option Name of the option.
* @param string $old_value The previous value.
* @param string $value The new value.
* @param string $value The new value.
*/
function fictioneer_settings_connection_updated( $option, $old_value, $value ) {
@ -501,12 +501,12 @@ add_action( 'updated_option', 'fictioneer_settings_connection_updated', 10, 3 );
add_action( 'trashed_post', function( $post_id ) {
// Relay
fictioneer_log_post_update( $post_id, __( 'trashed', 'fictioneer' ) );
fictioneer_log_post_update( $post_id, __( 'trashed', 'fictioneer' ) );
});
add_action( 'untrashed_post', function( $post_id ) {
// Relay
fictioneer_log_post_update( $post_id, __( 'restored', 'fictioneer' ) );
fictioneer_log_post_update( $post_id, __( 'restored', 'fictioneer' ) );
});
// =============================================================================
@ -536,7 +536,7 @@ function fictioneer_log_published_posts( $post_id ) {
}
// Relay
fictioneer_log_post_update( $post_id, $action );
fictioneer_log_post_update( $post_id, $action );
}
add_action( 'publish_post', 'fictioneer_log_published_posts' );
add_action( 'publish_page', 'fictioneer_log_published_posts' );
@ -565,7 +565,7 @@ function fictioneer_log_pending_posts( $post_id ) {
}
// Relay
fictioneer_log_post_update( $post_id, __( 'submitted for review', 'fictioneer' ) );
fictioneer_log_post_update( $post_id, __( 'submitted for review', 'fictioneer' ) );
}
add_action( 'pending_post', 'fictioneer_log_pending_posts' );

View File

@ -13,108 +13,108 @@
<?php fictioneer_settings_header( 'connections' ); ?>
<div class="fictioneer-settings__content">
<form method="post" action="options.php" class="fictioneer-form">
<?php settings_fields( 'fictioneer-settings-connections-group' ); ?>
<?php do_settings_sections( 'fictioneer-settings-connections-group' ); ?>
<form method="post" action="options.php" class="fictioneer-form">
<?php settings_fields( 'fictioneer-settings-connections-group' ); ?>
<?php do_settings_sections( 'fictioneer-settings-connections-group' ); ?>
<div class="fictioneer-columns fictioneer-columns--two-columns">
<div class="fictioneer-columns fictioneer-columns--two-columns">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Discord', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Discord', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_client_id' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_client_secret' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_invite_link' ); ?>
</div>
<hr>
<hr>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<p><?php printf( __( 'You can set up <a href="%s" target="_blank" rel="noreferrer noopener nofollow">channel webhooks</a> to send notifications to Discord whenever a comment, story, or chapter is first <em>published</em>. This is useful for moderation (instead of emails) and to keep people posted.', 'fictioneer' ), 'https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks' ); ?></p>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_channel_comments_webhook' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_channel_stories_webhook' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_discord_channel_chapters_webhook' ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Twitch', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Twitch', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_twitch_client_id' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_twitch_client_secret' ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Google', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Google', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_google_client_id' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_google_client_secret' ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Patreon', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">
<h3 class="fictioneer-card__header"><?php _e( 'Patreon', 'fictioneer' ); ?></h3>
<div class="fictioneer-card__content">
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_patreon_client_id' ); ?>
</div>
<div class="fictioneer-card__row">
<div class="fictioneer-card__row">
<?php fictioneer_settings_text_input( 'fictioneer_patreon_client_secret' ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php do_action( 'fictioneer_admin_settings_connections' ); ?>
<?php do_action( 'fictioneer_admin_settings_connections' ); ?>
</div>
</div>
<div class="fictioneer-actions"><?php submit_button(); ?></div>
<div class="fictioneer-actions"><?php submit_button(); ?></div>
</form>
</form>
</div>
</div>

View File

@ -10,9 +10,9 @@
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'general' ); ?>
<?php fictioneer_settings_header( 'general' ); ?>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<form method="post" action="options.php" class="fictioneer-form">
<?php settings_fields( 'fictioneer-settings-general-group' ); ?>

View File

@ -10,9 +10,9 @@
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'logs' ); ?>
<?php fictioneer_settings_header( 'logs' ); ?>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<div class="fictioneer-card">
<div class="fictioneer-card__wrapper">

View File

@ -10,9 +10,9 @@
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'phrases' ); ?>
<?php fictioneer_settings_header( 'phrases' ); ?>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<form method="post" action="options.php" class="fictioneer-form">
<?php settings_fields( 'fictioneer-settings-phrases-group' ); ?>

View File

@ -10,9 +10,9 @@
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'plugins' ); ?>
<?php fictioneer_settings_header( 'plugins' ); ?>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<div class="fictioneer-single-column">
<?php do_action( 'fictioneer_admin_settings_plugins' ); ?>
</div>

View File

@ -233,7 +233,7 @@ $current_role = $roles[ $current_role_slug ];
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'roles' ); ?>
<?php fictioneer_settings_header( 'roles' ); ?>
<ul class="fictioneer-settings__subnav">
<?php
@ -249,7 +249,7 @@ $current_role = $roles[ $current_role_slug ];
<button type="button" class="" data-dialog-target="add-role-dialog"><span class="dashicons dashicons-plus"></span></button>
</ul>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<form method="post" action="<?php echo $admin_url; ?>" class="fictioneer-form">
<input type="hidden" name="action" value="fictioneer_update_role">
<input type="hidden" name="role" value="<?php echo $current_role_slug; ?>">

View File

@ -10,9 +10,9 @@
<div class="fictioneer-settings">
<?php fictioneer_settings_header( 'tools' ); ?>
<?php fictioneer_settings_header( 'tools' ); ?>
<div class="fictioneer-settings__content">
<div class="fictioneer-settings__content">
<div class="fictioneer-columns fictioneer-columns--two-columns">
<div class="fictioneer-card">

View File

@ -186,9 +186,9 @@ if ( current_user_can( 'fcn_allow_self_delete' ) ) {
if ( ! defined( 'FICTIONEER_ADMIN_PROFILE_NOTICES' ) ) {
define(
'FICTIONEER_ADMIN_PROFILE_NOTICES',
array(
'admin-profile-unset-oauth-patreon' => __( 'Patreon connection successfully removed.', 'fictioneer' ),
'FICTIONEER_ADMIN_PROFILE_NOTICES',
array(
'admin-profile-unset-oauth-patreon' => __( 'Patreon connection successfully removed.', 'fictioneer' ),
'admin-profile-unset-oauth-google' => __( 'Google connection successfully removed.', 'fictioneer' ),
'admin-profile-unset-oauth-twitch' => __( 'Twitch connection successfully removed.', 'fictioneer' ),
'admin-profile-unset-oauth-discord' => __( 'Discord connection successfully removed.', 'fictioneer' ),
@ -210,8 +210,8 @@ if ( ! defined( 'FICTIONEER_ADMIN_PROFILE_NOTICES' ) ) {
'oauth_merged_twitch' => __( 'Twitch account successfully linked.', 'fictioneer' ),
'oauth_merged_patreon' => __( 'Patreon account successfully linked.', 'fictioneer' ),
'admin-profile-not-deleted' => __( 'Database error. Account could not be deleted.', 'fictioneer' )
)
);
)
);
}
/**

View File

@ -1,273 +1,273 @@
{
"action": {
"name": "Action"
},
"adventure": {
"name": "Adventure"
},
"alternateUniverse": {
"name": "Alternate Universe"
},
"anthology": {
"name": "Anthology"
},
"apocalyptic": {
"name": "Apocalyptic"
},
"atompunk": {
"name": "Atompunk",
"parent": "Science Fiction"
},
"biography": {
"name": "Biography"
},
"biopunk": {
"name": "Biopunk",
"parent": "Science Fiction"
},
"bisexual": {
"name": "Bisexual",
"parent": "LGBT+"
},
"bodyHorror": {
"name": "Body Horror",
"parent": "Horror"
},
"boysLove": {
"name": "Boys Love",
"parent": "LGBT+",
"aliasOf": "Gay"
},
"cassetteFuturism": {
"name": "Cassette Futurism",
"parent": "Science Fiction"
},
"children": {
"name": "Childrens"
},
"comedy": {
"name": "Comedy"
},
"contemporary": {
"name": "Contemporary"
},
"cosmicHorror": {
"name": "Cosmic Horror",
"parent": "Horror"
},
"crime": {
"name": "Crime"
},
"crossover": {
"name": "Crossover"
},
"cyberpunk": {
"name": "Cyberpunk",
"parent": "Science Fiction"
},
"detective": {
"name": "Detective"
},
"dieselpunk": {
"name": "Dieselpunk",
"parent": "Science Fiction"
},
"drama": {
"name": "Drama"
},
"dungeon": {
"name": "Dungeon"
},
"erotica": {
"name": "Erotica"
},
"espionage": {
"name": "Espionage"
},
"fantasy": {
"name": "Fantasy"
},
"gameLit": {
"name": "GameLit"
},
"gay": {
"name": "Gay",
"parent": "LGBT+"
},
"girlslove": {
"name": "Girls Love",
"parent": "LGBT+",
"aliasOf": "Lesbian"
},
"gothic": {
"name": "Gothic"
},
"grimdark": {
"name": "Grimdark"
},
"harem": {
"name": "Harem"
},
"highFantasy": {
"name": "High Fantasy",
"parent": "Fantasy"
},
"historical": {
"name": "Historical"
},
"horror": {
"name": "Horror"
},
"isekai": {
"name": "Isekai"
},
"lesbian": {
"name": "Lesbian",
"parent": "LGBT+"
},
"lgbt": {
"name": "LGBT+"
},
"litRpg": {
"name": "LitRPG"
},
"lowFantasy": {
"name": "Low Fantasy",
"parent": "Fantasy"
},
"lunarpunk": {
"name": "Lunarpunk",
"parent": "Science Fiction"
},
"magicalRealism": {
"name": "Magical Realism"
},
"mecha": {
"name": "Mecha"
},
"military": {
"name": "Military"
},
"music": {
"name": "Music"
},
"mystery": {
"name": "Mystery"
},
"nanopunk": {
"name": "Nanopunk",
"parent": "Science Fiction"
},
"noir": {
"name": "Noir",
"parent": "Crime"
},
"nonHuman": {
"name": "Non-Human"
},
"nonfiction": {
"name": "Nonfiction"
},
"philosophy": {
"name": "Philosophy"
},
"poetry": {
"name": "Poetry"
},
"postApocalyptic": {
"name": "Post Apocalyptic",
"parent": "Apocalyptic"
},
"psychological": {
"name": "Psychological"
},
"raypunk": {
"name": "Raypunk",
"parent": "Science Fiction"
},
"romance": {
"name": "Romance"
},
"satire": {
"name": "Satire"
},
"schoolLife": {
"name": "School Life"
},
"scienceFiction": {
"name": "Science Fiction"
},
"sex": {
"name": "Sex",
"description": "Discussions or depictions of sexual intercourse and adjacent topics in decent detail, not exciting enough to qualify as Erotica and certainly not explicit enough for Smut."
},
"shortStory": {
"name": "Short Story"
},
"sliceOfLife": {
"name": "Slice of Life"
},
"smut": {
"name": "Smut"
},
"space": {
"name": "Space"
},
"spaceOpera": {
"name": "Space Opera",
"parent": "Space"
},
"sports": {
"name": "Sports"
},
"steampunk": {
"name": "Steampunk",
"parent": "Science Fiction"
},
"suicideSelfHarm": {
"name": "Suicide / Self Harm"
},
"superheroes": {
"name": "Superheroes"
},
"supernatural": {
"name": "Supernatural"
},
"survival": {
"name": "Survival"
},
"thriller": {
"name": "Thriller"
},
"tragedy": {
"name": "Tragedy"
},
"transgender": {
"name": "Transgender",
"parent": "LGBT+"
},
"trueCrime": {
"name": "True Crime",
"parent": "Crime"
},
"urbanFantasy": {
"name": "Urban Fantasy",
"parent": "Fantasy"
},
"western": {
"name": "Western"
},
"whalepunk": {
"name": "Whalepunk",
"parent": "Science Fiction"
},
"wuxia": {
"name": "Wuxia"
},
"xianxia": {
"name": "Xianxia"
},
"zombie": {
"name": "Zombie"
}
"action": {
"name": "Action"
},
"adventure": {
"name": "Adventure"
},
"alternateUniverse": {
"name": "Alternate Universe"
},
"anthology": {
"name": "Anthology"
},
"apocalyptic": {
"name": "Apocalyptic"
},
"atompunk": {
"name": "Atompunk",
"parent": "Science Fiction"
},
"biography": {
"name": "Biography"
},
"biopunk": {
"name": "Biopunk",
"parent": "Science Fiction"
},
"bisexual": {
"name": "Bisexual",
"parent": "LGBT+"
},
"bodyHorror": {
"name": "Body Horror",
"parent": "Horror"
},
"boysLove": {
"name": "Boys Love",
"parent": "LGBT+",
"aliasOf": "Gay"
},
"cassetteFuturism": {
"name": "Cassette Futurism",
"parent": "Science Fiction"
},
"children": {
"name": "Childrens"
},
"comedy": {
"name": "Comedy"
},
"contemporary": {
"name": "Contemporary"
},
"cosmicHorror": {
"name": "Cosmic Horror",
"parent": "Horror"
},
"crime": {
"name": "Crime"
},
"crossover": {
"name": "Crossover"
},
"cyberpunk": {
"name": "Cyberpunk",
"parent": "Science Fiction"
},
"detective": {
"name": "Detective"
},
"dieselpunk": {
"name": "Dieselpunk",
"parent": "Science Fiction"
},
"drama": {
"name": "Drama"
},
"dungeon": {
"name": "Dungeon"
},
"erotica": {
"name": "Erotica"
},
"espionage": {
"name": "Espionage"
},
"fantasy": {
"name": "Fantasy"
},
"gameLit": {
"name": "GameLit"
},
"gay": {
"name": "Gay",
"parent": "LGBT+"
},
"girlslove": {
"name": "Girls Love",
"parent": "LGBT+",
"aliasOf": "Lesbian"
},
"gothic": {
"name": "Gothic"
},
"grimdark": {
"name": "Grimdark"
},
"harem": {
"name": "Harem"
},
"highFantasy": {
"name": "High Fantasy",
"parent": "Fantasy"
},
"historical": {
"name": "Historical"
},
"horror": {
"name": "Horror"
},
"isekai": {
"name": "Isekai"
},
"lesbian": {
"name": "Lesbian",
"parent": "LGBT+"
},
"lgbt": {
"name": "LGBT+"
},
"litRpg": {
"name": "LitRPG"
},
"lowFantasy": {
"name": "Low Fantasy",
"parent": "Fantasy"
},
"lunarpunk": {
"name": "Lunarpunk",
"parent": "Science Fiction"
},
"magicalRealism": {
"name": "Magical Realism"
},
"mecha": {
"name": "Mecha"
},
"military": {
"name": "Military"
},
"music": {
"name": "Music"
},
"mystery": {
"name": "Mystery"
},
"nanopunk": {
"name": "Nanopunk",
"parent": "Science Fiction"
},
"noir": {
"name": "Noir",
"parent": "Crime"
},
"nonHuman": {
"name": "Non-Human"
},
"nonfiction": {
"name": "Nonfiction"
},
"philosophy": {
"name": "Philosophy"
},
"poetry": {
"name": "Poetry"
},
"postApocalyptic": {
"name": "Post Apocalyptic",
"parent": "Apocalyptic"
},
"psychological": {
"name": "Psychological"
},
"raypunk": {
"name": "Raypunk",
"parent": "Science Fiction"
},
"romance": {
"name": "Romance"
},
"satire": {
"name": "Satire"
},
"schoolLife": {
"name": "School Life"
},
"scienceFiction": {
"name": "Science Fiction"
},
"sex": {
"name": "Sex",
"description": "Discussions or depictions of sexual intercourse and adjacent topics in decent detail, not exciting enough to qualify as Erotica and certainly not explicit enough for Smut."
},
"shortStory": {
"name": "Short Story"
},
"sliceOfLife": {
"name": "Slice of Life"
},
"smut": {
"name": "Smut"
},
"space": {
"name": "Space"
},
"spaceOpera": {
"name": "Space Opera",
"parent": "Space"
},
"sports": {
"name": "Sports"
},
"steampunk": {
"name": "Steampunk",
"parent": "Science Fiction"
},
"suicideSelfHarm": {
"name": "Suicide / Self Harm"
},
"superheroes": {
"name": "Superheroes"
},
"supernatural": {
"name": "Supernatural"
},
"survival": {
"name": "Survival"
},
"thriller": {
"name": "Thriller"
},
"tragedy": {
"name": "Tragedy"
},
"transgender": {
"name": "Transgender",
"parent": "LGBT+"
},
"trueCrime": {
"name": "True Crime",
"parent": "Crime"
},
"urbanFantasy": {
"name": "Urban Fantasy",
"parent": "Fantasy"
},
"western": {
"name": "Western"
},
"whalepunk": {
"name": "Whalepunk",
"parent": "Science Fiction"
},
"wuxia": {
"name": "Wuxia"
},
"xianxia": {
"name": "Xianxia"
},
"zombie": {
"name": "Zombie"
}
}

View File

@ -6,10 +6,10 @@
* @subpackage Fictioneer
* @since 5.0.0
*
* @internal $args['simple'] Optional. Hide advanced options.
* @internal $args['placeholder'] Optional. Change search placeholder.
* @internal $args['simple'] Optional. Hide advanced options.
* @internal $args['placeholder'] Optional. Change search placeholder.
* @internal $args['preselect_type'] Optional. Default post type to query.
* @internal $args['cache'] Whether to account for active caching.
* @internal $args['cache'] Whether to account for active caching.
*/
?>
@ -25,369 +25,369 @@ $post_type = sanitize_text_field( $_GET['post_type'] ?? $args['preselect_type']
// Advanced setup
if ( $show_advanced ) {
$sentence = sanitize_text_field( $_GET['sentence'] ?? 0 );
$order = sanitize_text_field( $_GET['order'] ?? 'desc' );
$orderby = sanitize_text_field( $_GET['orderby'] ?? 'modified' );
$sentence = sanitize_text_field( $_GET['sentence'] ?? 0 );
$order = sanitize_text_field( $_GET['order'] ?? 'desc' );
$orderby = sanitize_text_field( $_GET['orderby'] ?? 'modified' );
$all_authors = get_users(
array(
'has_published_posts' => ['fcn_story', 'fcn_chapter', 'fcn_recommendation', 'post']
)
);
$all_authors = get_users(
array(
'has_published_posts' => ['fcn_story', 'fcn_chapter', 'fcn_recommendation', 'post']
)
);
$skip_author_keywords = count( $all_authors ) > FICTIONEER_AUTHOR_KEYWORD_SEARCH_LIMIT;
$skip_author_keywords = count( $all_authors ) > FICTIONEER_AUTHOR_KEYWORD_SEARCH_LIMIT;
$queried_authors_in = sanitize_text_field( $_GET['authors'] ?? 0 );
$queried_authors_out = sanitize_text_field( $_GET['ex_authors'] ?? 0 );
$author_name = sanitize_text_field( $_GET['author_name'] ?? 0 ); // Simple text field
$queried_authors_in = sanitize_text_field( $_GET['authors'] ?? 0 );
$queried_authors_out = sanitize_text_field( $_GET['ex_authors'] ?? 0 );
$author_name = sanitize_text_field( $_GET['author_name'] ?? 0 ); // Simple text field
$all_tags = get_tags();
$all_genres = get_tags( array( 'taxonomy' => 'fcn_genre' ) );
$all_fandoms = get_tags( array( 'taxonomy' => 'fcn_fandom' ) );
$all_characters = get_tags( array( 'taxonomy' => 'fcn_character' ) );
$all_warnings = get_tags( array( 'taxonomy' => 'fcn_content_warning' ) );
$all_tags = get_tags();
$all_genres = get_tags( array( 'taxonomy' => 'fcn_genre' ) );
$all_fandoms = get_tags( array( 'taxonomy' => 'fcn_fandom' ) );
$all_characters = get_tags( array( 'taxonomy' => 'fcn_character' ) );
$all_warnings = get_tags( array( 'taxonomy' => 'fcn_content_warning' ) );
$queried_genres = sanitize_text_field( $_GET['genres'] ?? 0 );
$queried_fandoms = sanitize_text_field( $_GET['fandoms'] ?? 0 );
$queried_characters = sanitize_text_field( $_GET['characters'] ?? 0 );
$queried_warnings = sanitize_text_field( $_GET['warnings'] ?? 0 );
$queried_tags = sanitize_text_field( $_GET['tags'] ?? 0 );
$queried_genres = sanitize_text_field( $_GET['genres'] ?? 0 );
$queried_fandoms = sanitize_text_field( $_GET['fandoms'] ?? 0 );
$queried_characters = sanitize_text_field( $_GET['characters'] ?? 0 );
$queried_warnings = sanitize_text_field( $_GET['warnings'] ?? 0 );
$queried_tags = sanitize_text_field( $_GET['tags'] ?? 0 );
$queried_ex_genres = sanitize_text_field( $_GET['ex_genres'] ?? 0 );
$queried_ex_fandoms = sanitize_text_field( $_GET['ex_fandoms'] ?? 0 );
$queried_ex_characters = sanitize_text_field( $_GET['ex_characters'] ?? 0 );
$queried_ex_warnings = sanitize_text_field( $_GET['ex_warnings'] ?? 0 );
$queried_ex_tags = sanitize_text_field( $_GET['ex_tags'] ?? 0 );
$queried_ex_genres = sanitize_text_field( $_GET['ex_genres'] ?? 0 );
$queried_ex_fandoms = sanitize_text_field( $_GET['ex_fandoms'] ?? 0 );
$queried_ex_characters = sanitize_text_field( $_GET['ex_characters'] ?? 0 );
$queried_ex_warnings = sanitize_text_field( $_GET['ex_warnings'] ?? 0 );
$queried_ex_tags = sanitize_text_field( $_GET['ex_tags'] ?? 0 );
$is_advanced_search = $post_type != 'any' || $sentence != '0' || $order != 'desc' || $orderby != 'modified' || $queried_tags || $queried_genres || $queried_fandoms || $queried_characters || $queried_warnings || $queried_ex_tags || $queried_ex_genres || $queried_ex_fandoms || $queried_ex_characters || $queried_ex_warnings || $queried_authors_in || $queried_authors_out || $author_name;
$is_advanced_search = $post_type != 'any' || $sentence != '0' || $order != 'desc' || $orderby != 'modified' || $queried_tags || $queried_genres || $queried_fandoms || $queried_characters || $queried_warnings || $queried_ex_tags || $queried_ex_genres || $queried_ex_fandoms || $queried_ex_characters || $queried_ex_warnings || $queried_authors_in || $queried_authors_out || $author_name;
// Prime author cache
if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $all_authors );
}
// Prime author cache
if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $all_authors );
}
// Prepare data JSONs
$all_terms = array_merge( $all_tags, $all_genres, $all_fandoms, $all_characters, $all_warnings );
$allow_list = [];
// Prepare data JSONs
$all_terms = array_merge( $all_tags, $all_genres, $all_fandoms, $all_characters, $all_warnings );
$allow_list = [];
foreach ( $all_terms as $term ) {
$allow_list[ rawurlencode( strtolower( $term->name ) ) ] = $term->term_id;
}
foreach ( $all_terms as $term ) {
$allow_list[ rawurlencode( strtolower( $term->name ) ) ] = $term->term_id;
}
if ( ! $skip_author_keywords ) {
foreach ( $all_authors as $author ) {
$allow_list[ rawurlencode( strtolower( $author->display_name ) ) ] = $author->ID;
}
}
if ( ! $skip_author_keywords ) {
foreach ( $all_authors as $author ) {
$allow_list[ rawurlencode( strtolower( $author->display_name ) ) ] = $author->ID;
}
}
}
?>
<form
role="search"
method="get"
class="search-form <?php if ( ! $show_advanced ) echo '_simple'; ?>"
action="<?php echo esc_url( home_url( '/' ) ); ?>"
data-advanced="<?php echo ( is_search() && $show_advanced && $no_params ) ? 'true' : 'false'; ?>"
role="search"
method="get"
class="search-form <?php if ( ! $show_advanced ) echo '_simple'; ?>"
action="<?php echo esc_url( home_url( '/' ) ); ?>"
data-advanced="<?php echo ( is_search() && $show_advanced && $no_params ) ? 'true' : 'false'; ?>"
>
<?php if ( $show_advanced ) : ?>
<div class="allow-list" hidden><?php echo json_encode( $allow_list ); ?></div>
<?php else : ?>
<input type="hidden" name="post_type" value="<?php echo $post_type; ?>">
<?php endif; ?>
<?php if ( $show_advanced ) : ?>
<div class="allow-list" hidden><?php echo json_encode( $allow_list ); ?></div>
<?php else : ?>
<input type="hidden" name="post_type" value="<?php echo $post_type; ?>">
<?php endif; ?>
<div class="search-form__bar">
<div class="search-form__bar">
<input
type="search"
class="search-form__string"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
value="<?php echo trim( get_search_query() ); ?>"
name="s"
spellcheck="false"
autocomplete="off"
autocorrect="off"
>
<input
type="search"
class="search-form__string"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
value="<?php echo trim( get_search_query() ); ?>"
name="s"
spellcheck="false"
autocomplete="off"
autocorrect="off"
>
<div class="search-form__bar-actions">
<?php if ( $show_advanced ) : ?>
<button
type="button"
class="search-form__advanced-toggle"
tabindex="0"
><?php _ex( 'Advanced', 'Advanced search toggle.', 'fictioneer' ); ?></button>
<?php endif; ?>
<button type="submit" class="search-form__submit" aria-label="<?php echo esc_attr__( 'Submit search request', 'fictioneer' ); ?>"><i class="fa-solid fa-magnifying-glass"></i></button>
</div>
<div class="search-form__bar-actions">
<?php if ( $show_advanced ) : ?>
<button
type="button"
class="search-form__advanced-toggle"
tabindex="0"
><?php _ex( 'Advanced', 'Advanced search toggle.', 'fictioneer' ); ?></button>
<?php endif; ?>
<button type="submit" class="search-form__submit" aria-label="<?php echo esc_attr__( 'Submit search request', 'fictioneer' ); ?>"><i class="fa-solid fa-magnifying-glass"></i></button>
</div>
</div>
</div>
<?php if ( $show_advanced ) : ?>
<?php if ( $show_advanced ) : ?>
<div class="search-form__current">
<?php if ( $is_advanced_search && ! $cache_mode ) : ?>
<div class="search-form__current">
<?php if ( $is_advanced_search && ! $cache_mode ) : ?>
<button
type="button"
class="reset"
data-reset="<?php echo esc_attr_x( 'Search form reset.', 'Advanced search reset message.', 'fictioneer' ); ?>"
><?php _ex( 'Reset', 'Advanced search reset button.', 'fictioneer' ); ?></button>
<button
type="button"
class="reset"
data-reset="<?php echo esc_attr_x( 'Search form reset.', 'Advanced search reset message.', 'fictioneer' ); ?>"
><?php _ex( 'Reset', 'Advanced search reset button.', 'fictioneer' ); ?></button>
<span class="search-form__current-type"><?php
$translations = array(
'any' => _x( 'Any', 'Advanced search option.', 'fictioneer' ),
'fcn_chapter' => _x( 'Chapters', 'Advanced search option.', 'fictioneer' ),
'fcn_story' => _x( 'Stories', 'Advanced search option.', 'fictioneer' ),
'fcn_recommendation' => _x( 'Recommendations', 'Advanced search option.', 'fictioneer' ),
'fcn_collection' => _x( 'Collections', 'Advanced search option.', 'fictioneer' ),
'post' => _x( 'Posts', 'Advanced search option.', 'fictioneer' )
);
<span class="search-form__current-type"><?php
$translations = array(
'any' => _x( 'Any', 'Advanced search option.', 'fictioneer' ),
'fcn_chapter' => _x( 'Chapters', 'Advanced search option.', 'fictioneer' ),
'fcn_story' => _x( 'Stories', 'Advanced search option.', 'fictioneer' ),
'fcn_recommendation' => _x( 'Recommendations', 'Advanced search option.', 'fictioneer' ),
'fcn_collection' => _x( 'Collections', 'Advanced search option.', 'fictioneer' ),
'post' => _x( 'Posts', 'Advanced search option.', 'fictioneer' )
);
printf(
_x( '<b>Type:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $post_type ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
printf(
_x( '<b>Type:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $post_type ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
<span class="search-form__current-match"><?php
$translations = array(
'0' => _x( 'Keywords', 'Advanced search option.', 'fictioneer' ),
'1' => _x( 'Phrase', 'Advanced search option.', 'fictioneer' )
);
<span class="search-form__current-match"><?php
$translations = array(
'0' => _x( 'Keywords', 'Advanced search option.', 'fictioneer' ),
'1' => _x( 'Phrase', 'Advanced search option.', 'fictioneer' )
);
printf(
_x( '<b>Match:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $sentence ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
printf(
_x( '<b>Match:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $sentence ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
<span class="search-form__current-sort"><?php
$translations = array(
'relevance' => _x( 'Relevance', 'Advanced search option.', 'fictioneer' ),
'date' => _x( 'Published', 'Advanced search option.', 'fictioneer' ),
'modified' => _x( 'Updated', 'Advanced search option.', 'fictioneer' ),
'title' => _x( 'Title', 'Advanced search option.', 'fictioneer' )
);
<span class="search-form__current-sort"><?php
$translations = array(
'relevance' => _x( 'Relevance', 'Advanced search option.', 'fictioneer' ),
'date' => _x( 'Published', 'Advanced search option.', 'fictioneer' ),
'modified' => _x( 'Updated', 'Advanced search option.', 'fictioneer' ),
'title' => _x( 'Title', 'Advanced search option.', 'fictioneer' )
);
printf(
_x( '<b>Sort:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $orderby ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
printf(
_x( '<b>Sort:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $orderby ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
<span class="search-form__current-order"><?php
$translations = array(
'desc' => _x( 'Descending', 'Advanced search option.', 'fictioneer' ),
'asc' => _x( 'Ascending', 'Advanced search option.', 'fictioneer' )
);
<span class="search-form__current-order"><?php
$translations = array(
'desc' => _x( 'Descending', 'Advanced search option.', 'fictioneer' ),
'asc' => _x( 'Ascending', 'Advanced search option.', 'fictioneer' )
);
printf(
_x( '<b>Order:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $order ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
printf(
_x( '<b>Order:</b> <span>%s</span>', 'Advanced search summary.', 'fictioneer' ),
$translations[ $order ] ?? __( 'Invalid Value', 'fictioneer' )
);
?></span>
<?php
// [query string, type, class suffix, summary heading]
$queried_terms = array(
[$queried_genres, 'fcn_genre', 'genres', 'genres_and', _x( '%sGenres:', 'Advanced search summary.', 'fictioneer' ),],
[$queried_fandoms, 'fcn_fandom', 'fandoms', 'fandoms_and', _x( '%sFandoms:', 'Advanced search summary.', 'fictioneer' )],
[$queried_characters, 'fcn_character', 'characters', 'characters_and', _x( '%sCharacters:', 'Advanced search summary.', 'fictioneer' )],
[$queried_warnings, 'fcn_content_warning', 'warnings', 'warnings_and', _x( '%sWarnings:', 'Advanced search summary.', 'fictioneer' )],
[$queried_tags, 'post_tag', 'tags', 'tags_and', _x( '%sTags:', 'Advanced search summary.', 'fictioneer' )],
[$queried_authors_in, 'author', 'authors', 'authors_and', _x( '%sAuthors:', 'Advanced search summary.', 'fictioneer' )],
[$author_name, 'author_name', 'author', 'author_and', _x( '%sAuthor:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_genres, 'fcn_genre', 'ex-genres', 'ex_genres_and', _x( '%sExcluded Genres:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_fandoms, 'fcn_fandom', 'ex-fandoms', 'ex_fandoms_and', _x( '%sExcluded Fandoms:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_characters, 'fcn_character', 'ex-characters', 'ex_characters_and', _x( '%sExcluded Characters:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_warnings, 'fcn_content_warning', 'ex-warnings', 'ex_warnings_and', _x( '%sExcluded Warnings:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_tags, 'post_tag', 'ex-tags', 'ex_tags_and', _x( '%sExcluded Tags:', 'Excluded Advanced search summary.', 'fictioneer' )],
[$queried_authors_out, 'author', 'authors', 'ex_authors_and', _x( '%sExcluded Authors:', 'Advanced search summary.', 'fictioneer' )],
);
<?php
// [query string, type, class suffix, summary heading]
$queried_terms = array(
[$queried_genres, 'fcn_genre', 'genres', 'genres_and', _x( '%sGenres:', 'Advanced search summary.', 'fictioneer' ),],
[$queried_fandoms, 'fcn_fandom', 'fandoms', 'fandoms_and', _x( '%sFandoms:', 'Advanced search summary.', 'fictioneer' )],
[$queried_characters, 'fcn_character', 'characters', 'characters_and', _x( '%sCharacters:', 'Advanced search summary.', 'fictioneer' )],
[$queried_warnings, 'fcn_content_warning', 'warnings', 'warnings_and', _x( '%sWarnings:', 'Advanced search summary.', 'fictioneer' )],
[$queried_tags, 'post_tag', 'tags', 'tags_and', _x( '%sTags:', 'Advanced search summary.', 'fictioneer' )],
[$queried_authors_in, 'author', 'authors', 'authors_and', _x( '%sAuthors:', 'Advanced search summary.', 'fictioneer' )],
[$author_name, 'author_name', 'author', 'author_and', _x( '%sAuthor:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_genres, 'fcn_genre', 'ex-genres', 'ex_genres_and', _x( '%sExcluded Genres:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_fandoms, 'fcn_fandom', 'ex-fandoms', 'ex_fandoms_and', _x( '%sExcluded Fandoms:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_characters, 'fcn_character', 'ex-characters', 'ex_characters_and', _x( '%sExcluded Characters:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_warnings, 'fcn_content_warning', 'ex-warnings', 'ex_warnings_and', _x( '%sExcluded Warnings:', 'Advanced search summary.', 'fictioneer' )],
[$queried_ex_tags, 'post_tag', 'ex-tags', 'ex_tags_and', _x( '%sExcluded Tags:', 'Excluded Advanced search summary.', 'fictioneer' )],
[$queried_authors_out, 'author', 'authors', 'ex_authors_and', _x( '%sExcluded Authors:', 'Advanced search summary.', 'fictioneer' )],
);
foreach ( $queried_terms as $quad ) {
// Skip if nothing has been queried
if ( empty( $quad[0] ) ) {
continue;
}
foreach ( $queried_terms as $quad ) {
// Skip if nothing has been queried
if ( empty( $quad[0] ) ) {
continue;
}
// Open wrapper
echo "<span class='search-form__current-{$quad[2]}'>";
// Open wrapper
echo "<span class='search-form__current-{$quad[2]}'>";
// AND/OR?
$and = ( $_GET[ $quad[3] ] ?? 0 ) === '1' ?
_x( '[&] ', 'Advanced search summary AND operation note.', 'fictioneer' ) : '';
// AND/OR?
$and = ( $_GET[ $quad[3] ] ?? 0 ) === '1' ?
_x( '[&] ', 'Advanced search summary AND operation note.', 'fictioneer' ) : '';
// Heading (needs whitespace left and right)
printf( ' <b>' . $quad[4] . '</b> ', $and );
// Heading (needs whitespace left and right)
printf( ' <b>' . $quad[4] . '</b> ', $and );
// Item names from IDs
$item_ids = explode( ',', $quad[0] );
$names = [];
// Item names from IDs
$item_ids = explode( ',', $quad[0] );
$names = [];
// Author or taxonomy?
switch ( $quad[1] ) {
case 'author':
foreach ( $item_ids as $author_id ) {
$author = get_user_by( 'ID', $author_id );
// Author or taxonomy?
switch ( $quad[1] ) {
case 'author':
foreach ( $item_ids as $author_id ) {
$author = get_user_by( 'ID', $author_id );
if ( $author ) {
$names[] = $author->display_name;
}
}
break;
case 'author_name':
$names[] = $author_name;
break;
default:
foreach ( $item_ids as $term_id ) {
$term = get_term_by( 'term_id', $term_id, $quad[1] );
if ( $author ) {
$names[] = $author->display_name;
}
}
break;
case 'author_name':
$names[] = $author_name;
break;
default:
foreach ( $item_ids as $term_id ) {
$term = get_term_by( 'term_id', $term_id, $quad[1] );
if ( $term ) {
$names[] = $term->name;
}
}
}
if ( $term ) {
$names[] = $term->name;
}
}
}
echo implode( ', ', $names );
echo implode( ', ', $names );
// Close wrapper
echo '</span>';
}
?>
// Close wrapper
echo '</span>';
}
?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<div class="search-form__advanced">
<div class="search-form__advanced">
<div class="search-form__select-group">
<div class="search-form__select-group">
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Type', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="post_type" class="search-form__select" autocomplete="off">
<option value="any" <?php echo $post_type == 'any' ? 'selected' : ''; ?>><?php _ex( 'Any', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="fcn_chapter" <?php echo $post_type == 'fcn_chapter' ? 'selected' : ''; ?>><?php _ex( 'Chapters', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="fcn_story" <?php echo $post_type == 'fcn_story' ? 'selected' : ''; ?>><?php _ex( 'Stories', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php if ( post_type_exists( 'fcn_recommendation' ) ) : ?>
<option value="fcn_recommendation" <?php echo $post_type == 'fcn_recommendation' ? 'selected' : ''; ?>><?php _ex( 'Recommendations', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php endif; ?>
<?php if ( post_type_exists( 'fcn_collection' ) ) : ?>
<option value="fcn_collection" <?php echo $post_type == 'fcn_collection' ? 'selected' : ''; ?>><?php _ex( 'Collections', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php endif; ?>
<option value="post" <?php echo $post_type == 'post' ? 'selected' : ''; ?>><?php _ex( 'Posts', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Type', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="post_type" class="search-form__select" autocomplete="off">
<option value="any" <?php echo $post_type == 'any' ? 'selected' : ''; ?>><?php _ex( 'Any', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="fcn_chapter" <?php echo $post_type == 'fcn_chapter' ? 'selected' : ''; ?>><?php _ex( 'Chapters', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="fcn_story" <?php echo $post_type == 'fcn_story' ? 'selected' : ''; ?>><?php _ex( 'Stories', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php if ( post_type_exists( 'fcn_recommendation' ) ) : ?>
<option value="fcn_recommendation" <?php echo $post_type == 'fcn_recommendation' ? 'selected' : ''; ?>><?php _ex( 'Recommendations', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php endif; ?>
<?php if ( post_type_exists( 'fcn_collection' ) ) : ?>
<option value="fcn_collection" <?php echo $post_type == 'fcn_collection' ? 'selected' : ''; ?>><?php _ex( 'Collections', 'Advanced search option.', 'fictioneer' ); ?></option>
<?php endif; ?>
<option value="post" <?php echo $post_type == 'post' ? 'selected' : ''; ?>><?php _ex( 'Posts', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Match', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="sentence" class="search-form__select" autocomplete="off">
<option value="0" <?php echo $sentence == '0' ? 'selected' : ''; ?>><?php _ex( 'Keywords', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="1" <?php echo $sentence == '1' ? 'selected' : ''; ?>><?php _ex( 'Phrase', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Match', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="sentence" class="search-form__select" autocomplete="off">
<option value="0" <?php echo $sentence == '0' ? 'selected' : ''; ?>><?php _ex( 'Keywords', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="1" <?php echo $sentence == '1' ? 'selected' : ''; ?>><?php _ex( 'Phrase', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Sort', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="orderby" class="search-form__select" autocomplete="off">
<option value="relevance" <?php echo $orderby == 'relevance' ? 'selected' : ''; ?>><?php _ex( 'Relevance', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="date" <?php echo $orderby == 'date' ? 'selected' : ''; ?>><?php _ex( 'Published', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="modified" <?php echo $orderby == 'modified' ? 'selected' : ''; ?>><?php _ex( 'Updated', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="title" <?php echo $orderby == 'title' ? 'selected' : ''; ?>><?php _ex( 'Title', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Sort', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="orderby" class="search-form__select" autocomplete="off">
<option value="relevance" <?php echo $orderby == 'relevance' ? 'selected' : ''; ?>><?php _ex( 'Relevance', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="date" <?php echo $orderby == 'date' ? 'selected' : ''; ?>><?php _ex( 'Published', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="modified" <?php echo $orderby == 'modified' ? 'selected' : ''; ?>><?php _ex( 'Updated', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="title" <?php echo $orderby == 'title' ? 'selected' : ''; ?>><?php _ex( 'Title', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Order', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="order" class="search-form__select" autocomplete="off">
<option value="desc" <?php echo $order == 'desc' ? 'selected' : ''; ?>><?php _ex( 'Descending', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="asc" <?php echo $order == 'asc' ? 'selected' : ''; ?>><?php _ex( 'Ascending', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
<div class="search-form__select-wrapper select-wrapper">
<div class="search-form__select-title"><?php _ex( 'Order', 'Advanced search heading.', 'fictioneer' ); ?></div>
<select name="order" class="search-form__select" autocomplete="off">
<option value="desc" <?php echo $order == 'desc' ? 'selected' : ''; ?>><?php _ex( 'Descending', 'Advanced search option.', 'fictioneer' ); ?></option>
<option value="asc" <?php echo $order == 'asc' ? 'selected' : ''; ?>><?php _ex( 'Ascending', 'Advanced search option.', 'fictioneer' ); ?></option>
</select>
</div>
</div>
</div>
<?php if ( count( $allow_list ) > 1 ) : ?><hr><?php endif; ?>
<?php if ( count( $allow_list ) > 1 ) : ?><hr><?php endif; ?>
<?php if ( ! empty( $all_genres ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Genres', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_genres, 'genres', 'genres_and', 'genre', 'genres' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_genres ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Genres', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_genres, 'genres', 'genres_and', 'genre', 'genres' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_fandoms ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Fandoms', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_fandoms, 'fandoms', 'fandoms_and', 'fandom', 'fandoms' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_fandoms ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Fandoms', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_fandoms, 'fandoms', 'fandoms_and', 'fandom', 'fandoms' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_characters ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Characters', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_characters, 'characters', 'characters_and', 'character', 'characters' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_characters ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Characters', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_characters, 'characters', 'characters_and', 'character', 'characters' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_tags ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Tags', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_tags, 'tags', 'tags_and', 'tag', 'tags' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_tags ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Tags', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_tags, 'tags', 'tags_and', 'tag', 'tags' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_warnings ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Warnings', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_warnings, 'warnings', 'warnings_and', 'warning', 'warnings' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_warnings ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Warnings', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_warnings, 'warnings', 'warnings_and', 'warning', 'warnings' ); ?>
<?php endif; ?>
<?php if ( count( $all_authors ) > 1 ) : ?>
<?php if ( $skip_author_keywords ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Author', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<input type="text" class="search-form__text-input" name="author_name" value="<?php echo esc_attr( $author_name ); ?>" placeholder="<?php echo esc_attr_x( 'Search for an author', 'Advanced search placeholder.', 'fictioneer' ); ?>">
<?php else : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Authors', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_authors_input( $all_authors, 'authors', 'author', 'authors' ); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ( count( $all_authors ) > 1 ) : ?>
<?php if ( $skip_author_keywords ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Author', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<input type="text" class="search-form__text-input" name="author_name" value="<?php echo esc_attr( $author_name ); ?>" placeholder="<?php echo esc_attr_x( 'Search for an author', 'Advanced search placeholder.', 'fictioneer' ); ?>">
<?php else : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Authors', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_authors_input( $all_authors, 'authors', 'author', 'authors' ); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ( count( $allow_list ) > 1 ) : ?><hr><?php endif; ?>
<?php if ( count( $allow_list ) > 1 ) : ?><hr><?php endif; ?>
<?php if ( ! empty( $all_genres ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Genres', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_genres, 'ex_genres', 'ex_genres_and', 'genre', 'genres' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_genres ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Genres', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_genres, 'ex_genres', 'ex_genres_and', 'genre', 'genres' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_fandoms ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Fandoms', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_fandoms, 'ex_fandoms', 'ex_fandoms_and', 'fandom', 'fandoms' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_fandoms ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Fandoms', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_fandoms, 'ex_fandoms', 'ex_fandoms_and', 'fandom', 'fandoms' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_characters ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Characters', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_characters, 'ex_characters', 'ex_characters_and', 'character', 'characters' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_characters ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Characters', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_characters, 'ex_characters', 'ex_characters_and', 'character', 'characters' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_tags ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Tags', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_tags, 'ex_tags', 'ex_tags_and', 'tag', 'tags' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_tags ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Tags', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_tags, 'ex_tags', 'ex_tags_and', 'tag', 'tags' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_warnings ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Warnings', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_warnings, 'ex_warnings', 'ex_warnings_and', 'warning', 'warnings' ); ?>
<?php endif; ?>
<?php if ( ! empty( $all_warnings ) ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Warnings', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_taxonomies_input( $all_warnings, 'ex_warnings', 'ex_warnings_and', 'warning', 'warnings' ); ?>
<?php endif; ?>
<?php if ( count( $all_authors ) > 1 && ! $skip_author_keywords ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Authors', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_authors_input( $all_authors, 'ex_authors', 'author', 'authors' ); ?>
<?php endif; ?>
<?php if ( count( $all_authors ) > 1 && ! $skip_author_keywords ) : ?>
<h6 class="search-form__option-headline"><?php _ex( 'Exclude Authors', 'Advanced search heading.', 'fictioneer' ); ?></h6>
<?php fcn_keyword_search_authors_input( $all_authors, 'ex_authors', 'author', 'authors' ); ?>
<?php endif; ?>
<div class="search-form__advanced-actions">
<div class="search-form__advanced-actions-left">
<button type="button" class="search-form__advanced-reset reset button _secondary" data-reset="<?php echo esc_attr_x( 'Search form reset.', 'Advanced search reset message.', 'fictioneer' ); ?>"><?php _ex( 'Reset', 'Advanced search reset button.', 'fictioneer' ); ?></button>
</div>
<div class="search-form__advanced-actions-right">
<button type="submit" class="search-form__advanced-submit submit button"><?php _ex( 'Search', 'Advanced search submit.', 'fictioneer' ); ?></button>
</div>
</div>
<div class="search-form__advanced-actions">
<div class="search-form__advanced-actions-left">
<button type="button" class="search-form__advanced-reset reset button _secondary" data-reset="<?php echo esc_attr_x( 'Search form reset.', 'Advanced search reset message.', 'fictioneer' ); ?>"><?php _ex( 'Reset', 'Advanced search reset button.', 'fictioneer' ); ?></button>
</div>
<div class="search-form__advanced-actions-right">
<button type="submit" class="search-form__advanced-submit submit button"><?php _ex( 'Search', 'Advanced search submit.', 'fictioneer' ); ?></button>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</form>

View File

@ -77,7 +77,7 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
'paged' => $current_page,
'posts_per_page' => get_option( 'posts_per_page', 8 ),
'update_post_meta_cache' => false, // Already updated in superset of raw query
'update_post_term_cache' => false // Already updated in superset of raw query
'update_post_term_cache' => false // Already updated in superset of raw query
);
// Query featured posts

View File

@ -16,32 +16,32 @@ article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video, button {
margin: 0;
padding: 0;
border: 0;
margin: 0;
padding: 0;
border: 0;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
display: block;
}
ol, ul {
list-style: none;
list-style: none;
}
blockquote, q {
quotes: none;
quotes: none;
}
blockquote::before, blockquote::after,
q::before, q::after {
content: '';
content: none;
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
border-collapse: collapse;
border-spacing: 0;
}

View File

@ -1,141 +1,141 @@
{
"version": 2,
"settings": {
"appearanceTools": true,
"typography": {
"dropCap": false,
"customFontSize": false,
"fontSizes": [
{
"size": "var(--fs-xxs)",
"name": "Extra Small",
"shortName": "XXS",
"slug": "extra-small"
},
{
"size": "var(--fs-xs)",
"name": "Small",
"shortName": "XS",
"slug": "small"
},
{
"size": "var(--fs-s)",
"name": "Normal",
"shortName": "S",
"slug": "normal"
},
{
"size": "var(--fs-m)",
"name": "Medium",
"shortName": "M",
"slug": "medium"
},
{
"size": "var(--fs-l)",
"name": "Large",
"shortName": "L",
"slug": "large"
},
{
"size": "var(--fs-xl)",
"name": "Extra Large",
"shortName": "XL",
"slug": "extra-large"
},
{
"size": "var(--fs-xxl)",
"name": "Huge",
"shortName": "XXL",
"slug": "huge"
},
{
"size": "var(--fs-xxxl)",
"name": "Gigantic",
"shortName": "XXXL",
"slug": "gigantic"
}
]
},
"blocks": {
"core/image": {
"lightbox": {
"enabled": false,
"allowEditing": false
}
},
"core/table": {
"color": {
"custom": false,
"background": false,
"customDuotone": false,
"customGradient": false,
"defaultGradients": false,
"defaultDuotone": false,
"defaultPalette": false,
"palette": [],
"gradients": [],
"duotone": []
"version": 2,
"settings": {
"appearanceTools": true,
"typography": {
"dropCap": false,
"customFontSize": false,
"fontSizes": [
{
"size": "var(--fs-xxs)",
"name": "Extra Small",
"shortName": "XXS",
"slug": "extra-small"
},
"spacing": {
"margin": false
}
},
"core/buttons": {
"typography": {
"dropCap": false,
"fontSizes": [],
"customFontSize": false,
"fontStyle": false,
"fontWeight": false,
"fluid": false,
"letterSpacing": false,
"lineHeight": false,
"textDecoration": false,
"textTransform": false,
"letterCase": false
},
"spacing": {
"padding": false,
"margin": false
}
},
"core/button": {
"color": {
"custom": false,
"background": false,
"customDuotone": false,
"customGradient": false,
"defaultGradients": false,
"defaultDuotone": false,
"defaultPalette": false,
"palette": [],
"gradients": [],
"duotone": []
{
"size": "var(--fs-xs)",
"name": "Small",
"shortName": "XS",
"slug": "small"
},
"border": {
"color": false,
"radius": false,
"style": false,
"width": false
},
"typography": {
"dropCap": false,
"fontSizes": [],
"customFontSize": false,
"fontStyle": false,
"fontWeight": false,
"fluid": false,
"letterSpacing": false,
"lineHeight": false,
"textDecoration": false,
"textTransform": false,
"letterCase": false
},
"spacing": {
"padding": false,
"margin": false
}
}
}
}
{
"size": "var(--fs-s)",
"name": "Normal",
"shortName": "S",
"slug": "normal"
},
{
"size": "var(--fs-m)",
"name": "Medium",
"shortName": "M",
"slug": "medium"
},
{
"size": "var(--fs-l)",
"name": "Large",
"shortName": "L",
"slug": "large"
},
{
"size": "var(--fs-xl)",
"name": "Extra Large",
"shortName": "XL",
"slug": "extra-large"
},
{
"size": "var(--fs-xxl)",
"name": "Huge",
"shortName": "XXL",
"slug": "huge"
},
{
"size": "var(--fs-xxxl)",
"name": "Gigantic",
"shortName": "XXXL",
"slug": "gigantic"
}
]
},
"blocks": {
"core/image": {
"lightbox": {
"enabled": false,
"allowEditing": false
}
},
"core/table": {
"color": {
"custom": false,
"background": false,
"customDuotone": false,
"customGradient": false,
"defaultGradients": false,
"defaultDuotone": false,
"defaultPalette": false,
"palette": [],
"gradients": [],
"duotone": []
},
"spacing": {
"margin": false
}
},
"core/buttons": {
"typography": {
"dropCap": false,
"fontSizes": [],
"customFontSize": false,
"fontStyle": false,
"fontWeight": false,
"fluid": false,
"letterSpacing": false,
"lineHeight": false,
"textDecoration": false,
"textTransform": false,
"letterCase": false
},
"spacing": {
"padding": false,
"margin": false
}
},
"core/button": {
"color": {
"custom": false,
"background": false,
"customDuotone": false,
"customGradient": false,
"defaultGradients": false,
"defaultDuotone": false,
"defaultPalette": false,
"palette": [],
"gradients": [],
"duotone": []
},
"border": {
"color": false,
"radius": false,
"style": false,
"width": false
},
"typography": {
"dropCap": false,
"fontSizes": [],
"customFontSize": false,
"fontStyle": false,
"fontWeight": false,
"fluid": false,
"letterSpacing": false,
"lineHeight": false,
"textDecoration": false,
"textTransform": false,
"letterCase": false
},
"spacing": {
"padding": false,
"margin": false
}
}
}
}
}