Changeset 1889063
- Timestamp:
- 06/07/2018 04:40:13 PM (8 years ago)
- Location:
- referralcandy-for-woocommerce/trunk
- Files:
-
- 3 edited
-
includes/class-wc-referralcandy-integration.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
woocommerce-referralcandy.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
referralcandy-for-woocommerce/trunk/includes/class-wc-referralcandy-integration.php
r1860982 r1889063 50 50 'desc_tip' => false, 51 51 'default' => '' 52 ], 53 'popup' => [ 54 'title' => __('Post-purchase Popup', 'woocommerce-referralcandy'), 55 'label' => __('Enable post-purchase Popup', 'woocommerce-referralcandy'), 56 'type' => 'checkbox', 57 'desc_tip' => false, 58 'default' => '' 59 ], 60 'popup_quickfix' => [ 61 'title' => __('Post-purchase Popup Quickfix', 'woocommerce-referralcandy'), 62 'label' => __('Popup is breaking the checkout page?'.' 63 Try enabling this option to apply the quickfix!', 64 'woocommerce-referralcandy'), 65 'type' => 'checkbox', 66 'desc_tip' => false, 67 'default' => '' 52 68 ] 53 69 ]; … … 56 72 public function sanitize_settings($settings) { 57 73 return $settings; 74 } 75 76 public function is_option_enabled($option_name) { 77 return $this->get_option($option_name) == 'yes'? true : false; 58 78 } 59 79 … … 76 96 $billing_last_name = $wc_pre_30? $order->billing_last_name : $order->get_billing_last_name(); 77 97 $billing_email = $wc_pre_30? $order->billing_email : $order->get_billing_email(); 98 $encoded_email = urlencode($billing_email); 78 99 $order_total = $order->get_total(); 79 100 $order_currency = $wc_pre_30? $order->get_order_currency() : $order->get_currency(); … … 81 102 82 103 $divData = [ 83 'id' => 'refcandy-mint',104 'id' => $this->is_option_enabled('popup')? 'refcandy-popsicle' : 'refcandy-mint', 84 105 'data-app-id' => $this->get_option('app_id'), 85 106 'data-fname' => urlencode($billing_first_name), 86 107 'data-lname' => urlencode($billing_last_name), 87 'data-email' => urlencode($billing_email),108 'data-email' => $this->is_option_enabled('popup')? $billing_email : $encoded_email, 88 109 'data-amount' => $order_total, 89 110 'data-currency' => $order_currency, 90 111 'data-timestamp' => $timestamp, 91 'data- signature' => md5($billing_email.','.$billing_first_name.','.$order_total.','.$timestamp.','.$this->get_option('secret_key')),92 'data- external-reference-id' => $order_number112 'data-external-reference-id' => $order_number, 113 'data-signature' => md5($billing_email.','.$billing_first_name.','.$order_total.','.$timestamp.','.$this->get_option('secret_key')) 93 114 ]; 94 115 116 $popsicle_script = '<script>(function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;z="script";l="refcandy-purchase-js";c="refcandy-popsicle";p="go.referralcandy.com/purchase/";t="data-app-id";r={email:"a",fname:"b",lname:"c",amount:"d",currency:"e","accepts-marketing":"f",timestamp:"g","referral-code":"h",locale:"i","external-reference-id":"k",signature:"ab"};i=e.getElementsByTagName(z)[0];s=function(e,t){if(t){return""+e+"="+encodeURIComponent(t)}else{return""}};d=function(e){return""+p+h.getAttribute(t)+".js?lightbox=1&aa=75&"};if(!e.getElementById(l)){h=e.getElementById(c);if(h){o=e.createElement(z);o.id=l;a=function(){var e;e=[];for(n in r){u=r[n];v=h.getAttribute("data-"+n);e.push(s(u,v))}return e}();o.src="//"+d(h.getAttribute(t))+a.join("&");return i.parentNode.insertBefore(o,i)}}})(document);</script>'; 117 118 $mint_script = '<script>(function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;z="script";l="refcandy-purchase-js";c="refcandy-mint";p="go.referralcandy.com/purchase/";t="data-app-id";r={email:"a",fname:"b",lname:"c",amount:"d",currency:"e","accepts-marketing":"f",timestamp:"g","referral-code":"h",locale:"i","external-reference-id":"k",signature:"ab"};i=e.getElementsByTagName(z)[0];s=function(e,t){if(t){return""+e+"="+t}else{return""}};d=function(e){return""+p+h.getAttribute(t)+".js?aa=75&"};if(!e.getElementById(l)){h=e.getElementById(c);if(h){o=e.createElement(z);o.id=l;a=function(){var e;e=[];for(n in r){u=r[n];v=h.getAttribute("data-"+n);e.push(s(u,v))}return e}();o.src=""+e.location.protocol+"//"+d(h.getAttribute(t))+a.join("&");return i.parentNode.insertBefore(o,i)}}})(document);</script>'; 119 120 $quickfix = ''; 121 if ($this->is_option_enabled('popup') && $this->is_option_enabled('popup_quickfix')) { 122 $quickfix = '<style>html { position: relative !important; }</style>'; 123 } 124 95 125 $div = '<div '.implode(' ', array_map(function ($v, $k) { return $k . '="'.addslashes($v).'"'; }, $divData, array_keys($divData))).'></div>'; 96 $script = '<script>(function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;z="script";l="refcandy-purchase-js";c="refcandy-mint";p="go.referralcandy.com/purchase/";t="data-app-id";r={email:"a",fname:"b",lname:"c",amount:"d",currency:"e","accepts-marketing":"f",timestamp:"g","referral-code":"h",locale:"i","external-reference-id":"k",signature:"ab"};i=e.getElementsByTagName(z)[0];s=function(e,t){if(t){return""+e+"="+t}else{return""}};d=function(e){return""+p+h.getAttribute(t)+".js?aa=75&"};if(!e.getElementById(l)){h=e.getElementById(c);if(h){o=e.createElement(z);o.id=l;a=function(){var e;e=[];for(n in r){u=r[n];v=h.getAttribute("data-"+n);e.push(s(u,v))}return e}();o.src=""+e.location.protocol+"//"+d(h.getAttribute(t))+a.join("&");return i.parentNode.insertBefore(o,i)}}})(document);</script>'; 97 echo $div.$script; 126 127 $script = $this->is_option_enabled('popup')? $popsicle_script : $mint_script; 128 129 echo $div.$script.$quickfix; 98 130 } 99 131 } -
referralcandy-for-woocommerce/trunk/readme.txt
r1880231 r1889063 71 71 == Changelog == 72 72 73 = 1.3.6 = 74 * Added an option to enable the post-purchase popup widget on the checkout completed / thank you page = 75 73 76 = 1.3.5 = 74 77 * Fixed whitescreen of death issue when the Woocommerce plugin is deactivated while the ReferralCandy plugin is active -
referralcandy-for-woocommerce/trunk/woocommerce-referralcandy.php
r1880231 r1889063 7 7 * Author URI: http://www.referralcandy.com 8 8 * Text Domain: woocommerce-referralcandy 9 * Version: 1.3. 59 * Version: 1.3.6 10 10 * 11 11 * This program is free software: you can redistribute it and/or modify
Note: See TracChangeset
for help on using the changeset viewer.