Plugin Directory

Changeset 3279369


Ignore:
Timestamp:
04/22/2025 06:38:15 PM (11 months ago)
Author:
wpdever
Message:

fixed input

Location:
cart-tracking-for-woocommerce/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cart-tracking-for-woocommerce/trunk/admin/admin.php

    r3252296 r3279369  
    118118            $ids = ( isset( $cart ) ? $cart : array() );
    119119            if ( is_array( $ids ) ) {
    120                 $ids = implode( ',', $ids );
     120                // $ids = implode(',', $ids);
     121                // $id_array = array_filter(array_map('intval', explode(',', $raw_ids))); // sanitize IDs
     122                $ids = array_map( 'intval', $cart );
     123                // sanitize every element
     124            } else {
     125                // split string by comma, sanitize, and remove empty values
     126                $ids = array_filter( array_map( 'intval', explode( ',', $cart ) ) );
    121127            }
    122128            if ( !empty( $ids ) ) {
    123                 $ids = sanitize_text_field( $ids );
    124                 $wpdb->query( "DELETE FROM {$table_cart_name} WHERE id IN({$ids})" );
    125                 $wpdb->query( "DELETE FROM {$table_name} WHERE cart_number IN({$ids})" );
     129                //$ids = sanitize_text_field($ids);
     130                $placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
     131                $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_cart_name} WHERE id IN({$placeholders})", ...$ids ) );
     132                $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE cart_number IN({$placeholders})", ...$ids ) );
    126133            }
    127134            //wp_die('Items deleted!');
     
    190197                }
    191198            }
     199            if ( isset( $results[$key]['customer_id'] ) && is_string( $results[$key]['customer_id'] ) && filter_var( $results[$key]['customer_id'], FILTER_VALIDATE_IP ) && class_exists( '\\WC_Geolocation' ) ) {
     200                $geolocation = new \WC_Geolocation();
     201                $user_ip = filter_var( $results[$key]['customer_id'], FILTER_VALIDATE_IP );
     202                $location = $geolocation->geolocate_ip( $user_ip );
     203                // Get geolocation data
     204                $country = ( isset( $location['country'] ) ? $location['country'] : '' );
     205                if ( $country ) {
     206                    $results[$key]['customer_id'] = $results[$key]['customer_id'] . ' (Country: ' . $country . ')';
     207                }
     208            }
    192209        }
    193210        $total_items = $wpdb->get_var( "SELECT COUNT(*) FROM {$table_cart_name}" );
  • cart-tracking-for-woocommerce/trunk/cart-tracking.php

    r3252296 r3279369  
    55 * Plugin URI: https://wpsimpleplugins.wordpress.com/
    66 * Description: Keep track of what people are adding or removing from their cart. See top added/removed products.
    7  * Version: 1.0.17
     7 * Version: 1.0.18
    88 * Author: Simple Plugins
    99 * Author URI: https://wpsimpleplugins.wordpress.com/
  • cart-tracking-for-woocommerce/trunk/readme.txt

    r3252296 r3279369  
    44Requires at least: 4.0
    55Tested up to: 6.7
    6 Stable tag: 1.0.17
     6Stable tag: 1.0.18
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.