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 ) : ?> + %
diff --git a/includes/class-ipquery-db.php b/includes/class-ipquery-db.php index 4a92f97..8c707d8 100644 --- a/includes/class-ipquery-db.php +++ b/includes/class-ipquery-db.php @@ -265,11 +265,11 @@ public static function get_visitors( array $args = array() ): array { // 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 = $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 - $total = (int) $wpdb->get_var( $wpdb->prepare( $count_sql, ...$values ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared + $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 }