post_table( $filter_args ); ?>
';print_r($filter_args);echo ''; $status = $filter_args['status'] ?? ''; if ( empty( $status ) || $status == 'all' ) { $status = [ 'publish', 'draft', 'private', 'trash' ]; } $page_number = absint( $filter_args['page_number'] ?? 1 ) ?: 1; $limit = absint( ( $filter_args['page_item'] ?? 0 ) ?: ABPET_Function::get_option( 'abpet_per_page_item', 20 ) ); $count = ( $page_number - 1 ) * $limit + 1; $cpt = ABPET_Function::get_cpt(); $filters['status'] = $status; $filters['posts_per_page'] = $limit; $filters['paged'] = $page_number; //echo '
';print_r($filters);echo '
'; $post_ids = ABPET_Query::get_post_id( $filters ); if ( ! empty( $post_ids ) && sizeof( $post_ids ) > 0 ) { $total_post = sizeof( ABPET_Query::get_post_id( [ 'status' => $status ] ) ); $new_post_url = admin_url( 'post-new.php?post_type=' . $cpt ); ?> $post_id, '_abpet_nonce' => wp_create_nonce( 'abpet_copy_post_action' ), ), $new_post_url ); ?>
.
[abpet-post post_id=""]
$limit, 'page_number' => $page_number, 'total' => $total_post, 'style' => 'ajax' ] ); } else { ABPET_Layout::layout_warning_info( 'not_found' ); } } public function configuration_notice(): void { $errors = get_transient( 'abpet_event_configuration_errors_' . get_current_user_id() ); if ( empty( $errors ) || ! is_array( $errors ) ) { return; } delete_transient( 'abpet_event_configuration_errors_' . get_current_user_id() ); echo '

' . esc_html__( 'Event was saved as draft because its configuration is incomplete:', 'abp-event-ticket' ) . '

'; } public function post_permanent_remove(): void { if ( ! check_ajax_referer( 'abpet_admin_ajax_nonce', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'msg' => __( 'Invalid security token or Insufficient permissions.', 'abp-event-ticket' ), 'type' => 'warn' ], 403 ); } $post_id = isset( $_POST['post_id'] ) ? absint( wp_unslash( $_POST['post_id'] ) ) : 0; if ( $post_id <= 0 ) { wp_send_json_error( [ 'html' => '', 'msg' => __( 'Invalid ID ..... !! ', 'abp-event-ticket' ), 'type' => 'warn' ], 400 ); } $title = get_the_title( $post_id ); $link_wc_id = absint( ABPET_Function::get_post_info( $post_id, 'link_wc_id' ) ); if ( $link_wc_id > 0 ) { wp_delete_post( $link_wc_id, true ); } wp_delete_post( $post_id, true ); wp_send_json_success( [ 'html' => '', 'msg' => $title . ' : ' . __( 'Permanently removed. ..... !! ', 'abp-event-ticket' ), 'type' => 'error' ] ); } public function post_move_trash(): void { if ( ! check_ajax_referer( 'abpet_admin_ajax_nonce', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'msg' => __( 'Invalid security token or Insufficient permissions.', 'abp-event-ticket' ), 'type' => 'warn' ], 403 ); } $post_id = isset( $_POST['post_id'] ) ? absint( wp_unslash( $_POST['post_id'] ) ) : 0; if ( $post_id > 0 ) { $title = get_the_title( $post_id ); $link_wc_id = absint( ABPET_Function::get_post_info( $post_id, 'link_wc_id' ) ); if ( $link_wc_id > 0 ) { wp_trash_post( $link_wc_id ); } wp_trash_post( $post_id ); wp_send_json_success( [ 'html' => '', 'msg' => $title . ' : ' . __( 'Moved to trash successfully...... !! ', 'abp-event-ticket' ), 'type' => 'warn' ] ); } wp_send_json_error( [ 'html' => '', 'msg' => __( 'Invalid ID ..... !! ', 'abp-event-ticket' ), 'type' => 'warn' ], 400 ); } public function post_restore(): void { if ( ! check_ajax_referer( 'abpet_admin_ajax_nonce', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'msg' => __( 'Invalid security token or Insufficient permissions.', 'abp-event-ticket' ), 'type' => 'warn' ], 403 ); } $post_id = isset( $_POST['post_id'] ) ? absint( wp_unslash( $_POST['post_id'] ) ) : 0; if ( $post_id > 0 ) { $link_wc_id = absint( ABPET_Function::get_post_info( $post_id, 'link_wc_id' ) ); if ( $link_wc_id > 0 ) { wp_untrash_post( $link_wc_id ); } wp_untrash_post( $post_id ); $updated_post = [ 'ID' => $post_id, 'post_status' => 'publish', ]; wp_update_post( $updated_post ); $title = get_the_title( $post_id ); wp_send_json_success( [ 'html' => '', 'msg' => $title . ' : ' . __( 'Restored successfully...... !! ', 'abp-event-ticket' ), 'type' => 'success' ] ); } wp_send_json_error( [ 'html' => '', 'msg' => __( 'Invalid ID ..... !! ', 'abp-event-ticket' ), 'type' => 'warn' ], 400 ); } public function reload_post_list(): void { if ( ! check_ajax_referer( 'abpet_admin_ajax_nonce', 'nonce', false ) || ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ 'msg' => __( 'Invalid security token or Insufficient permissions.', 'abp-event-ticket' ), 'type' => 'warn' ], 403 ); } $post_array = fn( $key ) => ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ) : []; $filter_args = $post_array( 'filter_args' ); ob_start(); $this->post_table( $filter_args ); $table_html = ob_get_clean(); wp_send_json_success( [ 'html' => $table_html, 'type' => 'success', 'msg' => __( 'Post List Loaded successfully...... !! ', 'abp-event-ticket' ) ] ); } } new ABPET_Post(); }