manager->get_control( $bloglog_setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $bloglog_input, $choices ) ? $bloglog_input : $bloglog_setting->default ); } endif; if ( ! function_exists( 'bloglog_sanitize_repeater' ) ) : /** * Sanitise Repeater Field */ function bloglog_sanitize_repeater($input){ $input_decoded = json_decode( $input, true ); if(!empty($input_decoded)) { foreach ($input_decoded as $boxes => $box ){ foreach ($box as $key => $value){ if( $key == 'category_color' ){ $input_decoded[$boxes][$key] = sanitize_hex_color( $value ); }else{ $input_decoded[$boxes][$key] = sanitize_text_field( $value ); } } } return json_encode($input_decoded); } return $input; } endif; if ( ! function_exists( 'bloglog_sanitize_dropdown_pages' ) ) : /** * Sanitize dropdown pages. * * @since 1.0.0 * * @param int $page_id Page ID. * @param WP_Customize_Setting $setting WP_Customize_Setting instance. * @return int|string Page ID if the page is published; otherwise, the setting default. */ function bloglog_sanitize_dropdown_pages( $page_id, $setting ) { // Ensure $input is an absolute integer. $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' === get_post_status( $page_id ) ? $page_id : $setting->default ); } endif;