From 6fb9b61feba30b6110f6cc07aef9cbcd09602a2c Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Thu, 23 Apr 2026 16:29:34 +0100 Subject: [PATCH 1/3] [FEATURE] Fix WP Check warnings --- includes/class-ipquery-db.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/class-ipquery-db.php b/includes/class-ipquery-db.php index 4a92f97..9574d7d 100644 --- a/includes/class-ipquery-db.php +++ b/includes/class-ipquery-db.php @@ -264,12 +264,14 @@ public static function get_visitors( array $args = array() ): array { $query_values = array_merge( $values, array( (int) $args['per_page'], $offset ) ); // Table name and validated orderby/order are safe to interpolate; values use placeholders. - $rows_sql = "SELECT * FROM {$table} {$where_sql} ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared - $rows = $wpdb->get_results( $wpdb->prepare( $rows_sql, ...$query_values ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared + $rows_sql = "SELECT * FROM {$table} {$where_sql} ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $rows_prepared = $wpdb->prepare( $rows_sql, ...$query_values ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $rows = $wpdb->get_results( $rows_prepared, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching if ( $values ) { - $count_sql = "SELECT COUNT(*) FROM {$table} {$where_sql}"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared - $total = (int) $wpdb->get_var( $wpdb->prepare( $count_sql, ...$values ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared + $count_sql = "SELECT COUNT(*) FROM {$table} {$where_sql}"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $count_prepared = $wpdb->prepare( $count_sql, ...$values ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $total = (int) $wpdb->get_var( $count_prepared ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching } else { $total = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching } From d87b5d8b7206a2fd6565b84a48b45baa0c03f711 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Thu, 23 Apr 2026 16:33:44 +0100 Subject: [PATCH 2/3] Fix files --- includes/class-ipquery-db.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/class-ipquery-db.php b/includes/class-ipquery-db.php index 9574d7d..8c707d8 100644 --- a/includes/class-ipquery-db.php +++ b/includes/class-ipquery-db.php @@ -264,14 +264,12 @@ public static function get_visitors( array $args = array() ): array { $query_values = array_merge( $values, array( (int) $args['per_page'], $offset ) ); // Table name and validated orderby/order are safe to interpolate; values use placeholders. - $rows_sql = "SELECT * FROM {$table} {$where_sql} ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared - $rows_prepared = $wpdb->prepare( $rows_sql, ...$query_values ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared - $rows = $wpdb->get_results( $rows_prepared, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + $rows_sql = "SELECT * FROM {$table} {$where_sql} ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $rows = $wpdb->get_results( $wpdb->prepare( $rows_sql, ...$query_values ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter if ( $values ) { - $count_sql = "SELECT COUNT(*) FROM {$table} {$where_sql}"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared - $count_prepared = $wpdb->prepare( $count_sql, ...$values ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared - $total = (int) $wpdb->get_var( $count_prepared ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + $count_sql = "SELECT COUNT(*) FROM {$table} {$where_sql}"; // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared + $total = (int) $wpdb->get_var( $wpdb->prepare( $count_sql, ...$values ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter } else { $total = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching } From 3ccebb364f3b485f49ee67fe4fe3bb778f947344 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Thu, 23 Apr 2026 16:42:26 +0100 Subject: [PATCH 3/3] Fix WP Checks warnings --- admin/views/dashboard.php | 82 +++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index 2167ff8..328c4c1 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -15,11 +15,11 @@
@@ -27,21 +27,21 @@
- +
- +
- +
@@ -49,11 +49,11 @@
0 - ? round( ( ( $risk_counts['vpn'] + $risk_counts['proxy'] + $risk_counts['tor'] ) / $unique_ips ) * 100, 1 ) + $ipquery_risky_pct = $ipquery_unique_ips > 0 + ? round( ( ( $ipquery_risk_counts['vpn'] + $ipquery_risk_counts['proxy'] + $ipquery_risk_counts['tor'] ) / $ipquery_unique_ips ) * 100, 1 ) : 0; ?> - % + %
@@ -100,22 +100,22 @@ - + - + - - + <?php echo esc_attr( $row['country_code'] ); ?> - + - - 0 ? esc_html( round( ( $row['visits'] / $total_visits ) * 100, 1 ) ) . '%' : '—'; ?> + + 0 ? esc_html( round( ( $ipquery_row['visits'] / $ipquery_total_visits ) * 100, 1 ) ) . '%' : '—'; ?> @@ -139,23 +139,23 @@ - + - + - + - - + <?php echo esc_attr( $row['country_code'] ); ?> - + - - 0 ? esc_html( round( ( $row['visits'] / $total_visits ) * 100, 1 ) ) . '%' : '—'; ?> + + 0 ? esc_html( round( ( $ipquery_row['visits'] / $ipquery_total_visits ) * 100, 1 ) ) . '%' : '—'; ?> @@ -170,46 +170,46 @@

__( 'VPN', 'ipquery' ), - 'count' => $risk_counts['vpn'], + 'count' => $ipquery_risk_counts['vpn'], 'icon' => 'lock', 'class' => 'orange', ), array( 'label' => __( 'Proxy', 'ipquery' ), - 'count' => $risk_counts['proxy'], + 'count' => $ipquery_risk_counts['proxy'], 'icon' => 'update', 'class' => 'red', ), array( 'label' => __( 'Tor', 'ipquery' ), - 'count' => $risk_counts['tor'], + 'count' => $ipquery_risk_counts['tor'], 'icon' => 'hidden', 'class' => 'red', ), array( 'label' => __( 'Datacenter', 'ipquery' ), - 'count' => $risk_counts['datacenter'], + 'count' => $ipquery_risk_counts['datacenter'], 'icon' => 'cloud', 'class' => 'blue', ), array( 'label' => __( 'Mobile', 'ipquery' ), - 'count' => $risk_counts['mobile'], + 'count' => $ipquery_risk_counts['mobile'], 'icon' => 'smartphone', 'class' => 'green', ), ); - foreach ( $risk_items as $item ) : + foreach ( $ipquery_risk_items as $ipquery_item ) : ?> -
- - - - 0 ) : ?> - % +
+ + + + 0 ) : ?> + %