true, ] ); unset( $post_types['attachment'] ); unset( $post_types['elementor_library'] ); /* translators: icon */ add_meta_box( 'wp-faq-schema', sprintf( __( 'FAQ Schema For Pages And Posts %s', 'wp-faq-schema' ), ' ' ), [ $this, 'view' ], array_keys( $post_types ) ); } /** * Metabox view * * @param WP_Post $post Post Object. * * @since 1.0.0 * @access public * * @return void */ public function view( $post ) { $faqs = get_post_meta( $post->ID, '_wp_faq_schema', true ); if ( empty( $faqs ) ) { $faqs = [ [ 'q' => '', 'a' => '', ], ]; } ?>
$faq ) : ?>

sanitize( $_POST['wp-faq-schema'] ) ); // phpcs:ignore } /** * Metabox assets * * @since 1.0.0 * @access public * * @return void */ public function assets() { wp_enqueue_style( 'wp-faq-schema-style', WP_FAQ_SCHEMA_URL . '/css/wp-faq-schema.css', false, '1.0.0' ); wp_enqueue_script( 'sweetalert2', WP_FAQ_SCHEMA_URL . '/js/sweetalert2.all.min.js', [ 'jquery' ], '1.0.0', true ); wp_enqueue_script( 'papaparse', WP_FAQ_SCHEMA_URL . '/js/papaparse.min.js', [ 'jquery' ], '1.0.0', true ); wp_enqueue_script( 'wp-faq-schema-scripts', WP_FAQ_SCHEMA_URL . '/js/wp-faq-schema.js', [ 'jquery', 'papaparse', 'sweetalert2' ], '1.0.0', true ); $data = 'var wfs_ajax="' . admin_url( 'admin-ajax.php' ) . '";'; wp_add_inline_script( 'wp-faq-schema-scripts', $data, 'before' ); } /** * Sanitize full array * * @param array $faqs Array. * * @since 1.0.0 * @access public * * @return array */ public function sanitize( $faqs ) { $new_faqs = []; if ( ! empty( $faqs ) && is_array( $faqs ) ) { foreach ( $faqs as $faq ) { $new_faq = []; if ( ! empty( $faq['q'] ) ) { $new_faq['q'] = sanitize_text_field( $faq['q'] ); } if ( ! empty( $faq['a'] ) ) { $new_faq['a'] = wp_kses_post( $faq['a'] ); } if ( ! empty( $new_faq ) ) { $new_faqs[] = $new_faq; } } } return $new_faqs; } public function taxonomy_meta() { $taxonomies = get_taxonomies( ['publicly_queryable' => true] ); $taxonomies = array_keys( $taxonomies ); foreach( $taxonomies as $taxonomy ) { add_filter( $taxonomy . '_add_form_fields', array( $this, 'tax_meta' ) ); add_filter( $taxonomy . '_edit_form_fields', array( $this, 'tax_meta_edit' ) ); add_action( 'edit_' . $taxonomy, array( $this, 'save_tax_meta' ) ); add_action( 'create_' . $taxonomy, array( $this, 'save_tax_meta' ) ); } } public function tax_meta() { ?>
tax_meta_label(); ?> tax_meta_view( false ); ?>
tax_meta_label(); ?>
tax_meta_view( $term->term_id ); ?>
'', 'a' => '', ], ]; } ?>
$faq ) : ?>

sanitize( $_POST['wp-faq-schema'] ) ); // phpcs:ignore } }