Rename function

This commit is contained in:
Tetrakern 2023-08-21 00:57:56 +02:00
parent 869c55741e
commit 6ede5b4da1
11 changed files with 19 additions and 19 deletions

View File

@ -109,7 +109,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $data['chapter_ids'] ),
'post__in' => fictioneer_rescue_array_zero( $data['chapter_ids'] ),
'ignore_sticky_posts' => true,
'orderby' => 'post__in',
'posts_per_page' => -1,

View File

@ -889,7 +889,7 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
$hide_icons = fictioneer_get_field( 'fictioneer_story_hide_chapter_icons', $story_id ) || get_option( 'fictioneer_hide_chapter_icons' );
$query_args = array(
'post__in' => fictioneer_save_array_zero( $data['chapter_ids'] ), // Only visible and published
'post__in' => fictioneer_rescue_array_zero( $data['chapter_ids'] ), // Only visible and published
'post_type' => 'fcn_chapter',
'orderby' => 'post__in',
'posts_per_page' => -1,

View File

@ -305,7 +305,7 @@ if ( ! function_exists( 'fictioneer_add_epub_chapters' ) ) {
$query_args = array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $chapters ),
'post__in' => fictioneer_rescue_array_zero( $chapters ),
'orderby' => 'post__in',
'posts_per_page' => -1,
'update_post_term_cache' => false, // Improve performance

View File

@ -207,7 +207,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $old_data['chapter_ids'] ),
'post__in' => fictioneer_rescue_array_zero( $old_data['chapter_ids'] ),
'posts_per_page' => -1,
'no_found_rows' => true, // Improve performance
'update_post_meta_cache' => false, // Improve performance
@ -233,7 +233,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
array(
'status' => 'approve',
'post_type' => 'fcn_chapter',
'post__in' => fictioneer_save_array_zero( $old_data['chapter_ids'] ),
'post__in' => fictioneer_rescue_array_zero( $old_data['chapter_ids'] ),
'count' => true,
'update_comment_meta_cache' => false
)
@ -297,7 +297,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $chapters ),
'post__in' => fictioneer_rescue_array_zero( $chapters ),
'ignore_sticky_posts' => true,
'orderby' => 'post__in', // Preserve order from meta box
'posts_per_page' => -1, // Get all chapters (this can be hundreds)
@ -1813,7 +1813,7 @@ function fictioneer_delete_my_account() {
}
// =============================================================================
// SAVE EMPTY ARRAY AS [0]
// RESCUE EMPTY ARRAY AS [0]
// =============================================================================
/**
@ -1829,7 +1829,7 @@ function fictioneer_delete_my_account() {
* @return array The original array or [0].
*/
function fictioneer_save_array_zero( $array ) {
function fictioneer_rescue_array_zero( $array ) {
return empty( $array ) ? [0] : $array;
}

View File

@ -124,7 +124,7 @@ function fictioneer_ajax_request_story_comments() {
array(
'status' => 'approve',
'post_type' => ['fcn_chapter'],
'post__in' => fictioneer_save_array_zero( $chapter_ids ),
'post__in' => fictioneer_rescue_array_zero( $chapter_ids ),
'number' => $comments_per_page,
'paged' => $page,
'meta_query' => array(

View File

@ -61,7 +61,7 @@ function fictioneer_post_featured_list( $post_id ) {
$query_args = array(
'post_type' => 'any',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $featured ),
'post__in' => fictioneer_rescue_array_zero( $featured ),
'ignore_sticky_posts' => 1,
'orderby' => 'post__in',
'posts_per_page' => -1,

View File

@ -58,7 +58,7 @@ if ( ! empty( $items ) ) {
array(
'post_type' => 'any',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $items ),
'post__in' => fictioneer_rescue_array_zero( $items ),
'ignore_sticky_posts' => true,
'orderby' => 'modified',
'posts_per_page' => -1,
@ -98,7 +98,7 @@ if ( ! empty( $items ) ) {
$chapter_query_args = array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $chapter_ids ),
'post__in' => fictioneer_rescue_array_zero( $chapter_ids ),
'posts_per_page' => -1,
'update_post_term_cache' => false, // Improve performance
'no_found_rows' => true // Improve performance
@ -132,7 +132,7 @@ if ( ! empty( $items ) ) {
$comment_args = array(
'post_type' => 'fcn_chapter',
'status' => 1,
'post__in' => fictioneer_save_array_zero( $processed_ids ),
'post__in' => fictioneer_rescue_array_zero( $processed_ids ),
'count' => true,
'update_comment_meta_cache' => false // Improve performance
);

View File

@ -105,7 +105,7 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
$chapter_query_args = array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $chapter_ids ),
'post__in' => fictioneer_rescue_array_zero( $chapter_ids ),
'posts_per_page' => -1,
'no_found_rows' => true, // Improve performance
'update_post_term_cache' => false // Improve performance

View File

@ -58,7 +58,7 @@ if ( ! empty( $args['featured_list'] ) ) {
$chapter_query_args = array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $query_chapter_ids ),
'post__in' => fictioneer_rescue_array_zero( $query_chapter_ids ),
'posts_per_page' => -1,
'update_post_term_cache' => false // Improve performance
);
@ -101,7 +101,7 @@ if ( ! empty( $args['featured_list'] ) ) {
get_comments(
array(
'post_type' => 'fcn_chapter',
'post__in' => fictioneer_save_array_zero( $query_chapter_ids ),
'post__in' => fictioneer_rescue_array_zero( $query_chapter_ids ),
'status' => 1,
'count' => true,
'update_comment_meta_cache' => false

View File

@ -154,7 +154,7 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
array(
'post_type' => 'fcn_chapter',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $chapters ),
'post__in' => fictioneer_rescue_array_zero( $chapters ),
'ignore_sticky_posts' => true,
'orderby' => 'post__in', // Preserve order from meta box
'posts_per_page' => -1, // Get all chapters (this can be hundreds)

View File

@ -43,7 +43,7 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
$raw_query_args = array (
'post_type' => 'any',
'post_status' => 'publish',
'post__in' => fictioneer_save_array_zero( $featured_list ),
'post__in' => fictioneer_rescue_array_zero( $featured_list ),
'ignore_sticky_posts' => 1,
'posts_per_page' => -1,
'no_found_rows' => true // Improve performance
@ -68,7 +68,7 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
// Prepare paginated featured query
$query_args = array (
'post_type' => 'any',
'post__in' => fictioneer_save_array_zero( $featured_list ),
'post__in' => fictioneer_rescue_array_zero( $featured_list ),
'ignore_sticky_posts' => 1,
'orderby' => 'modified',
'order' => 'DESC',