Plugin Directory

Changeset 3331424


Ignore:
Timestamp:
07/21/2025 11:40:09 AM (8 months ago)
Author:
fromdoppler
Message:

update plugin version 1.5.0

Location:
doppler-for-woocommerce
Files:
91 added
4 edited

Legend:

Unmodified
Added
Removed
  • doppler-for-woocommerce/trunk/README.txt

    r3313208 r3331424  
    55Requires at least: 4.9
    66Tested up to: 6.8.1
    7 Stable tag: 1.4.0
     7Stable tag: 1.5.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313Submit your WooCommerce customers and buyers to a Doppler List.
    1414
    15 == Upgrade Notice ==
     15== Changelog ==
    1616
    17 = 1.4.0 =
    18 *Important:* This version improves the tracking performance of visited products. Updating is recommended.
    19 
    20 == Changelog ==
     17= 1.5.0 =
     18* Feat: Add date parameters in woocommerce client's endpoint.
    2119
    2220= 1.4.0 =
    2321* Feat: Add Open Graph metadata.
     22
    2423== 1.3.0 ==
    2524* Feat: Add consent checkbox in checkout.
    2625* Update: Add loading screen to wait for style library.
     26
    2727== 1.2.4 ==
    2828* Update: Add counter for synchronized contacts
     29
    2930== 1.2.3 ==
    3031* Update: Apply Doppler's style library
     32
    3133== 1.2.2 ==
    3234* Fix: Add translations for every spanish language.
     35
    3336== 1.2.1 ==
    3437* Fixes for php 8 version
     38
    3539== 1.2.0 ==
    3640* Mapping of last puchased products
     41
    3742== 1.1.7 ==
    3843* Fix abandoned cart's product price when using taxes
     44
    3945== 1.1.6 ==
    4046* Fix app synchronization in field mappings and list settings.
     47
    4148== 1.1.1 ==
    4249* Fix app couldnt connect on php cgi mode.
     50
    4351== 1.1.0 ==
    4452* New synch method with cron
     
    4654* Abandoned carts tracking
    4755* Visited product tracking
     56
    4857== 1.0.3 ==
    4958* Display message if Doppler Form is not active.
     59
    5060== 1.0.1 ==
    5161* Select existent list if suggested one already exists in Doppler.
  • doppler-for-woocommerce/trunk/doppler-for-woocommerce.php

    r3313208 r3331424  
    1717 * Plugin URI:        https://www.fromdoppler.com/
    1818 * Description:       Connect your WooCommerce customers with your Doppler Lists.
    19  * Version:           1.4.0
     19 * Version:           1.5.0
    2020 * Author:            Doppler LLC
    2121 * License:           GPL-2.0+
     
    3535 * Rename this for your plugin and update it as you release new versions.
    3636 */
    37 define('DOPPLER_FOR_WOOCOMMERCE_VERSION', '1.4.0');
     37define('DOPPLER_FOR_WOOCOMMERCE_VERSION', '1.5.0');
    3838define('DOPPLER_FOR_WOOCOMMERCE_URL', plugin_dir_url(__FILE__));
    3939define('DOPPLER_FOR_WOOCOMMERCE_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
  • doppler-for-woocommerce/trunk/includes/class-doppler-for-woocommerce.php

    r3313208 r3331424  
    239239            $this->loader->add_action('wp_head', $plugin_public, 'add_open_graph_meta_tags');
    240240        }
     241        $this->loader->add_filter('woocommerce_rest_customer_query', $plugin_public, 'add_date_filter_to_rest_api_endpoint', 10, 2);
    241242
    242243        if (get_option('dplr_wc_consent') == 1) {
  • doppler-for-woocommerce/trunk/public/class-doppler-for-woocommerce-public.php

    r3313208 r3331424  
    113113        }
    114114    }
     115
     116    public function add_date_filter_to_rest_api_endpoint( $prepared_args, $request ) {
     117        $created_after = $request->get_param('after');
     118        $created_before = $request->get_param('before');
     119        $updated_after = $request->get_param('modified_after');
     120        $updated_before = $request->get_param('modified_before');
     121        $date_query = [];
     122
     123        if ( $created_after && $this->is_valid_date($created_after) ) {
     124            $date_query['after'] = $this->to_mysql_date($created_after);
     125        }
     126
     127        if ( $created_before && $this->is_valid_date($created_before) ) {
     128            $date_query['before'] = $this->to_mysql_date($created_before);
     129        }
     130
     131        if ( ! empty($date_query) ) {
     132            $prepared_args['date_query'][] = $date_query;
     133        }
     134
     135        if ( $updated_after && $this->is_valid_date($updated_after) && $updated_before && $this->is_valid_date($updated_before) ) {
     136            $prepared_args['meta_query'][] = [
     137                'key'     => 'last_update',
     138                'value'   => [ (int) strtotime($updated_after), (int) strtotime($updated_before) ],
     139                'compare' => 'BETWEEN',
     140            ];
     141        } elseif ( $updated_after && $this->is_valid_date($updated_after) ) {
     142            $prepared_args['meta_query'][] = [
     143                'key'     => 'last_update',
     144                'value'   => (int) strtotime($updated_after),
     145                'compare' => '>=',
     146            ];
     147        } elseif ( $updated_before && $this->is_valid_date($updated_before) ) {
     148            $prepared_args['meta_query'][] = [
     149                'key'     => 'last_update',
     150                'value'   => (int) strtotime($updated_before),
     151                'compare' => '<=',
     152            ];
     153        }
     154
     155        return $prepared_args;
     156    }
     157
     158    private function is_valid_date($date) {
     159        $d = date_create($date);
     160        return $d !== false;
     161    }
     162
     163    private function to_mysql_date($date) {
     164        if (empty($date)) {
     165            return false;
     166        }
     167        // Convert date format from 'Y-m-d H:i:s' to 'Y-m-d+H:i:s'
     168        $date = preg_replace('/T(\d{2}:\d{2}:\d{2}) (\d{2}:\d{2})$/', 'T$1+$2', $date);
     169        $d = date_create($date);
     170        if (!$d) {
     171            return false;
     172        }
     173        return $d->format('Y-m-d H:i:s');
     174    }
    115175}
Note: See TracChangeset for help on using the changeset viewer.