Plugin Directory

Changeset 1970919


Ignore:
Timestamp:
11/08/2018 12:39:32 PM (7 years ago)
Author:
ghostmonitor
Message:

AUTOMATED COMMIT, PLUGIN VERSION: 1.12.0

Location:
ghostmonitor
Files:
78 added
6 edited

Legend:

Unmodified
Added
Removed
  • ghostmonitor/trunk/config.json

    r1944763 r1970919  
    44    "settingsUrl": "https://api.recart.com/tracking/v2/settings/",
    55    "cdnUrl": "https://cdn.ghostmonitor.com",
    6     "version": "v1.11.0",
     6    "version": "v1.12.0",
    77    "logentriesToken": "d3695c56-67af-4c86-8c7d-26c6c252987b",
    88    "env": "production"
  • ghostmonitor/trunk/includes/class-wc-ghostmonitor.php

    r1944763 r1970919  
    7474        // Add content below add to cart button on single product page
    7575        add_action('woocommerce_after_add_to_cart_button', array($this, 'output_messenger_widget_html'));
     76
     77        //Apply discount code based on URL pattern /discount/discountcode
     78        add_action('wp_loaded', array($this, 'attempt_apply_saved_discount_code'));
     79        add_action('wp_loaded', array($this, 'handle_url_discount_code'));
    7680
    7781        // wc-ajax is only available from WC 2.4
     
    253257        }
    254258
    255         $cart_url = $woocommerce->cart->get_checkout_url();
     259        $cart_url = wc_get_checkout_url();
    256260
    257261        unset($_GET['gm_cart']);
     
    372376            $product = $product->get_product($i['variation_id'] == '0' ? $i['product_id'] : $i['variation_id']);
    373377
    374             $thumb_id = get_post_thumbnail_id($product->post->ID);
     378            $thumb_id = get_post_thumbnail_id($product->get_id());
    375379            $thumb_url = wp_get_attachment_image_src($thumb_id, 'shop_thumbnail', true);
    376380
     
    447451
    448452            if ($_product && $_product->exists() && $cart_item_data['quantity'] > 0) {
    449                 $thumb_id = get_post_thumbnail_id($_product->post->ID);
     453                $thumb_id = get_post_thumbnail_id($_product->get_id());
    450454                $thumb_url = wp_get_attachment_image_src($thumb_id, 'shop_thumbnail', true);
    451455
     
    475479                    }
    476480
    477                     $gm_cart_item['productId'] = $_product->post->ID . '-' . $variation_data['variation_id'];
     481                    $gm_cart_item['productId'] = $_product-> get_id() . '-' . $variation_data['variation_id'];
    478482                    $gm_cart_item['productAttributeId'] = $variation_data;
    479483                } else {
    480                     $gm_cart_item['productId'] = $_product->post->ID;
     484                    $gm_cart_item['productId'] = $_product-> get_id();
    481485                }
    482486            }
     
    485489        }
    486490
    487         $return_url = add_query_arg('gm_cart', $gm_session_id, WC()->cart->get_checkout_url());
     491        $return_url = add_query_arg('gm_cart', $gm_session_id, wc_get_checkout_url());
    488492        $setCartData = array(
    489493            'returnUrl' => $return_url,
     
    684688        return $default;
    685689    }
     690
     691    public function handle_url_discount_code() {
     692      preg_match("/\/discount\/(\w+)/", $_SERVER['REQUEST_URI'], $url_subitems);
     693     
     694      // Only proceed if url matched /discount/somediscountcode
     695      if (count($url_subitems) < 1) return;
     696      if (!isset($url_subitems[1])) return;
     697 
     698      $discount_code = $url_subitems[1];
     699 
     700      if (!WC()->cart->is_empty() && !WC()->cart->has_discount($discount_code)) {
     701          WC()->cart->add_discount($discount_code);
     702      } else {
     703          setcookie("recart_saved_discount_code", $discount_code, time() + (86400 * 7), "/");
     704      }
     705 
     706      $this->handle_redirect_parameter();
     707  }
     708   
     709    private function handle_redirect_parameter() {
     710        $requested_url = $_SERVER['REQUEST_URI'];
     711        $discount_code_pattern_in_url;
     712        $redirection_pattern_in_url;
     713        preg_match("/\/discount\/\w+/", $requested_url , $discount_code_pattern_in_url);
     714        preg_match("/\?redirect=/", $requested_url , $redirection_pattern_in_url);
     715        if (empty($discount_code_pattern_in_url) && empty($redirection_pattern_in_url)) {
     716            return;
     717        }
     718        $redirect_url = $requested_url;
     719        if (isset($discount_code_pattern_in_url[0])) {
     720            $redirect_url = str_replace($discount_code_pattern_in_url[0],'', $redirect_url);
     721        }
     722        if (isset($redirection_pattern_in_url[0])) {
     723            $replace_char = '/';
     724            if (strpos($redirect_url, '=/') !== false) {
     725                $replace_char = '';
     726            }
     727            $redirect_url = str_replace($redirection_pattern_in_url[0], $replace_char, $redirect_url);
     728        }
     729        if (empty($redirect_url)) {
     730            $redirect_url = '/';
     731        }
     732        $this->redirect_client_to_url($redirect_url);
     733    }
     734           
     735    function attempt_apply_saved_discount_code() {
     736        // Can apply discount code only if cart exists & not empty
     737        if (is_null(WC()->cart) || WC()->cart->is_empty()) return;
     738
     739        if (key_exists("recart_saved_discount_code", $_COOKIE)) {
     740            $discount_code_in_cookie = $_COOKIE["recart_saved_discount_code"];
     741            if (!empty($discount_code_in_cookie)) {
     742                if (! WC()->cart->has_discount($discount_code_in_cookie)) {
     743                    WC()->cart->add_discount($discount_code_in_cookie);
     744                    setcookie("recart_saved_discount_code", "", time() - 3600);
     745                }
     746            }
     747        }
     748    }
     749   
     750    function redirect_client_to_url($redirect_url) {
     751        echo '<script type="text/javascript">' .
     752        'window.location.replace("' . $redirect_url . '");' .
     753        '</script>';
     754    }
    686755}
  • ghostmonitor/trunk/includes/ghostmonitor_helper/vendor/autoload.php

    r1944763 r1970919  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderInit9a6560dde374de692410468a5a9cbbff::getLoader();
     7return ComposerAutoloaderInitf967499b5214ba75f256ccf0ec9738a3::getLoader();
  • ghostmonitor/trunk/includes/ghostmonitor_helper/vendor/composer/autoload_real.php

    r1944763 r1970919  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit9a6560dde374de692410468a5a9cbbff
     5class ComposerAutoloaderInitf967499b5214ba75f256ccf0ec9738a3
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit9a6560dde374de692410468a5a9cbbff', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitf967499b5214ba75f256ccf0ec9738a3', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit9a6560dde374de692410468a5a9cbbff', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitf967499b5214ba75f256ccf0ec9738a3', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4343        $includeFiles = require __DIR__ . '/autoload_files.php';
    4444        foreach ($includeFiles as $fileIdentifier => $file) {
    45             composerRequire9a6560dde374de692410468a5a9cbbff($fileIdentifier, $file);
     45            composerRequiref967499b5214ba75f256ccf0ec9738a3($fileIdentifier, $file);
    4646        }
    4747
     
    5050}
    5151
    52 function composerRequire9a6560dde374de692410468a5a9cbbff($fileIdentifier, $file)
     52function composerRequiref967499b5214ba75f256ccf0ec9738a3($fileIdentifier, $file)
    5353{
    5454    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • ghostmonitor/trunk/readme.txt

    r1944763 r1970919  
    33Tags: recart, add to cart popup, atc popup, push notification, cart abandonment, cart recovery, cart abandonment campaign, cart recovery campaign, shopping cart abandonment, shopping cart recovery, shopping cart abandonment campaign, cart abandonment email, cart recovery email, cart abandonment emails, cart recovery emails, abandon, bounce rate, conversion optimization, grow, revenue grow, abandon cart, abandoned cart, shopping cart abandonment, woocommerce cart abandon, woocommerce cart abandonment, woocommerce cart recovery, woocommerce cart abandonment emails,  cart recovery emails, cart abandonment emails, woocommerce cart abandonment solution, wordpress cart abandonment, wordpress cart recovery, wordpress cart recovery emails, cart abandonment, cart recovery, make money from cart recovery, push notifications, popup, add to cart, autofill, email capture, subscriber capture, login capture, subscription, subscription tracking, add cart popup, woocommerce popup, checkout autofill, checkout auto fill,
    44Requires at least: 3.9
    5 Tested up to: 4.8.3
    6 Stable tag: 1.11.0
     5Tested up to: 4.9.8
     6Stable tag: 1.12.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    264264
    265265= 1.10.0 =
    266 * Added Messenger wdiget
     266* Added Facebook Messenger features
    267267
    268268= 1.9.2 =
    269 * Query var hotfix
     269* Minor changes and fixes
    270270
    271271= 1.9.1 =
    272 * recart_info notice fix
     272* Minor changes and fixes
    273273
    274274= 1.9.0 =
    275 * Add diagnostic endpoint
     275* Minor changes and fixes
    276276
    277277= 1.8.2 =
    278 * Minor fixes
     278* Minor changes and fixes
    279279
    280280= 1.8.1 =
    281 * JSON escape fix
     281* Minor changes and fixes
    282282
    283283= 1.8.0 =
    284 * Compatibility update: WordPress 4.6.1, WooCommerce 2.6.4
     284* Improved support for WordPress 4.6.1 and WooCommerce 2.6.4
    285285
    286286= 1.7.0 =
    287 * WooCommerce 2.6 compatibility
     287* Added support for WooCommerce version 2.6
    288288
    289289= 1.6.4 =
    290 * Shipping price fix
     290* Minor changes and fixes
    291291
    292292= 1.6.2 =
    293 * HTML charcodes in product name fix
     293* Minor changes and fixes
    294294
    295295= 1.6.1 =
    296 * WooCommerce compatibility fix
     296* Minor changes and fixes
    297297
    298298= 1.6.0 =
    299 * Better performance
    300 * Client side HTTP
    301 * Security fix
     299* Minor changes and fixes
    302300
    303301= 1.5.0 =
    304 * Email first feature
    305 * Logging changes
    306 * Minor fixes
     302* Minor changes and fixes
    307303
    308304= 1.4.0 =
    309 * Better support for payment gateways
     305* Improved payment gateways support
    310306
    311307= 1.3.0 =
    312 * Logging fixes
     308* Minor changes and fixes
    313309
    314310= 1.2.1 =
    315 * Compatibility fix
     311* Minor changes and fixes
    316312
    317313= 1.2.0 =
    318 * Logging
     314* Minor changes and fixes
    319315
    320316= 1.1.2 =
    321 * Cookie fix
     317* Minor changes and fixes
    322318
    323319= 1.1.1 =
    324 * Request fix
     320* Minor changes and fixes
    325321
    326322= 1.1.0 =
    327 * Faster API
     323* API speed improvements
    328324
    329325= 1.0.2 =
     
    334330
    335331= 0.2.0 =
    336 * Ui changes
     332* UI updates
    337333
    338334= 0.1.4 =
     
    349345
    350346= 0.1.0 =
    351 * Fist stable version
     347* Welcome to the Recart WooCommerce Plugin. To start using Recart on your WooCommerce store, please create an account on recart.com and install this plugin.
  • ghostmonitor/trunk/woocommerce-ghostmonitor.php

    r1944763 r1970919  
    66 * Author: Ghostmonitor INC
    77 * Author URI: http://www.recart.com
    8  * Version: v1.11.0
     8 * Version: v1.12.0
    99 */
    1010
     
    4444        global $wp_version;
    4545
    46         $version = 'v1.11.0';
     46        $version = 'v1.12.0';
    4747
    4848        $discount_enabled = get_option('woocommerce_enable_coupons') === 'yes' ? 'true' : 'false';
Note: See TracChangeset for help on using the changeset viewer.