.... $content = preg_replace( '#]*>(.*?)#is', '', $content ); // Remove unclosed tags. $content = preg_replace( '##is', '', $content ); } return $content; } /** * Rander Eab_schema * * @param mixed $post_id selected block id. * @param mixed $schema_items_data schema data. * @return void */ public static function eab_schema( $post_id, $schema_items_data ) { $eap_schema_markup = true; $accordion_type = 'eab-block'; include SP_EA_PATH . '/public/partials/schema-markup.php'; } /** * Shortcode list. * * @return array */ public static function sp_easy_accordion_pro_post_list() { $shortcodes = get_posts( array( 'post_type' => 'sp_easy_accordion', 'post_status' => 'publish', 'posts_per_page' => 999, ) ); if ( count( $shortcodes ) < 1 ) { return array(); } // shortcode list. $shortcode_list = array(); foreach ( $shortcodes as $shortcode ) { $option = array( 'id' => absint( $shortcode->ID ), 'value' => absint( $shortcode->ID ), 'label' => esc_html( $shortcode->post_title ), ); $shortcode_list[] = $option; } return $shortcode_list; } /** * Verifies the current user has the required capability for admin AJAX actions. * Sends a 403 JSON error and halts execution if the check fails. */ public static function sp_eap_verify_capability() { if ( ! current_user_can( apply_filters( 'easy_accordion_access_capability', 'manage_options' ) ) ) { wp_send_json_error( __( 'Unauthorized access.', 'easy-accordion-free' ), 403 ); } } /** * Get saved template list for page builders. * * @return array Template list with ID as key and title as value. */ public static function get_save_template_list() { $templates = get_posts( array( 'post_type' => 'sp_eap_template', 'post_status' => 'publish', 'posts_per_page' => 9999, 'orderby' => 'title', 'order' => 'ASC', ) ); $template_list = array( '' => esc_html__( 'Select Template', 'easy-accordion-free' ), ); if ( ! empty( $templates ) ) { foreach ( $templates as $template ) { $template_list[ $template->ID ] = $template->post_title; } } return $template_list; } }