PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.1
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.1
8.8.1 8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 All 537 releases
← All changes | includes/admin/templates/email_subscription.php +24 -12 8.7.4 → 8.8.1 View file →
@@ -38,24 +38,36 @@
38 38
39 39 $current_user = wp_get_current_user();
40 40 $url = admin_url( 'edit.php?post_type=sld&page=qcsld_click_list' );
41 41 $customPagHTML = '';
42 - // Main Report Area
43 - $total = $wpdb->get_var(
44 - 'SELECT COUNT(*) FROM `' . $table_sql . '`' // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
45 - ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
42 + // Main Report Area — cache total count (invalidated when subscriptions change).
43 + $total_cache_key = 'wpbot_email_sub_total';
44 + $total = wp_cache_get( $total_cache_key, 'wpbot' );
45 + if ( false === $total ) {
46 + $total = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
47 + 'SELECT COUNT(*) FROM `' . $table_sql . '`' // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
48 + );
49 + wp_cache_set( $total_cache_key, $total, 'wpbot', 300 );
50 + }
46 51 $items_per_page = 50;
47 52
48 - $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;// phpcs:ignore WordPress.Security.NonceVerification.Missing
53 + $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Missing
49 54 $offset = ( $page * $items_per_page ) - $items_per_page;
50 55
51 - $rows = $wpdb->get_results(
52 - $wpdb->prepare(
53 - 'SELECT * FROM `' . $table_sql . '` ORDER BY id DESC LIMIT %d, %d', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
54 - $offset,
55 - $items_per_page
56 - )
57 - ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter
56 + // Cache paginated rows per page number.
57 + $rows_cache_key = 'wpbot_email_sub_rows_p' . $page;
58 + $rows = wp_cache_get( $rows_cache_key, 'wpbot' );
59 + if ( false === $rows ) {
60 + $rows = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
61 + $wpdb->prepare(
62 + 'SELECT * FROM `' . $table_sql . '` ORDER BY id DESC LIMIT %d, %d', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
63 + $offset,
64 + $items_per_page
65 + )
66 + );
67 + wp_cache_set( $rows_cache_key, $rows, 'wpbot', 300 );
68 + }
69 +
58 70 $totalPage = ceil( $total / $items_per_page );
59 71
60 72 if ( $totalPage > 1 ) {
61 73 $customPagHTML = '<div><span class="wpbot_pagination">Page ' . esc_html( $page ) . ' of ' . esc_html( $totalPage ) . '</span>' . paginate_links(