prefix . 'wpbot_subscription'; $table_sql = esc_sql( $table ); if ( isset( $_POST['wpbot_email_subscription_remove'] ) && '1' === $_POST['wpbot_email_subscription_remove'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing check_admin_referer( 'wpbot_email_subscription_delete', 'wpbot_email_subscription_nonce' ); if ( current_user_can( 'manage_options' ) && isset( $_POST['emails'] ) && is_array( $_POST['emails'] ) ) { $email_ids = array_map( 'absint', wp_unslash( $_POST['emails'] ) ); foreach ( $email_ids as $email_id ) { $wpdb->delete( $table, array( 'id' => $email_id ), array( '%d' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching } echo ''; exit; } } $current_user = wp_get_current_user(); $url = admin_url( 'edit.php?post_type=sld&page=qcsld_click_list' ); $customPagHTML = ''; // Main Report Area — cache total count (invalidated when subscriptions change). $total_cache_key = 'wpbot_email_sub_total'; $total = wp_cache_get( $total_cache_key, 'wpbot' ); if ( false === $total ) { $total = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 'SELECT COUNT(*) FROM `' . $table_sql . '`' // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared ); wp_cache_set( $total_cache_key, $total, 'wpbot', 300 ); } $items_per_page = 50; $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Missing $offset = ( $page * $items_per_page ) - $items_per_page; // Cache paginated rows per page number. $rows_cache_key = 'wpbot_email_sub_rows_p' . $page; $rows = wp_cache_get( $rows_cache_key, 'wpbot' ); if ( false === $rows ) { $rows = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $wpdb->prepare( 'SELECT * FROM `' . $table_sql . '` ORDER BY id DESC LIMIT %d, %d', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $offset, $items_per_page ) ); wp_cache_set( $rows_cache_key, $rows, 'wpbot', 300 ); } $totalPage = ceil( $total / $items_per_page ); if ( $totalPage > 1 ) { $customPagHTML = '