Changeset 3371971
- Timestamp:
- 10/02/2025 07:10:08 PM (5 months ago)
- Location:
- fw-integration-for-emailoctopus
- Files:
-
- 22 added
- 4 edited
-
tags/1.0.10 (added)
-
tags/1.0.10/LICENSE (added)
-
tags/1.0.10/assets (added)
-
tags/1.0.10/assets/admin.js (added)
-
tags/1.0.10/assets/adminstyle.css (added)
-
tags/1.0.10/form-actions (added)
-
tags/1.0.10/form-actions/emailoctopus.php (added)
-
tags/1.0.10/fw-integration-for-emailoctopus.php (added)
-
tags/1.0.10/include (added)
-
tags/1.0.10/include/class-woo-emailoctopus-integration.php (added)
-
tags/1.0.10/include/emailoctopus.js (added)
-
tags/1.0.10/include/form-shortcodes.php (added)
-
tags/1.0.10/include/loading.gif (added)
-
tags/1.0.10/include/options.php (added)
-
tags/1.0.10/include/style.css (added)
-
tags/1.0.10/include/tpl-options.php (added)
-
tags/1.0.10/languages (added)
-
tags/1.0.10/languages/fw-integration-for-emailoctopus-nl_NL.mo (added)
-
tags/1.0.10/languages/fw-integration-for-emailoctopus-nl_NL.po (added)
-
tags/1.0.10/languages/fw-integration-for-emailoctopus.pot (added)
-
tags/1.0.10/readme.txt (added)
-
tags/1.0.10/woo-emailoctopus-integration.php (added)
-
trunk/fw-integration-for-emailoctopus.php (modified) (6 diffs)
-
trunk/include/class-woo-emailoctopus-integration.php (modified) (1 diff)
-
trunk/include/emailoctopus.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fw-integration-for-emailoctopus/trunk/fw-integration-for-emailoctopus.php
r3260135 r3371971 2 2 /* 3 3 Plugin Name: EO4WP: EmailOctopus for WordPress 4 Version: 1.0. 8.64 Version: 1.0.10 5 5 Plugin URI: https://www.finalwebsites.com/emailoctopus-for-wordpress/ 6 6 Description: Increase the count of new subscribers for your blog or website by using EmailOctopus and this integration plugin. … … 31 31 32 32 define('FWEO_DIR', plugin_dir_path( __FILE__ )); 33 define('FW_EO_VER', '1.0. 8.6');33 define('FW_EO_VER', '1.0.10'); 34 34 35 35 include_once FWEO_DIR.'include/options.php'; … … 80 80 add_action( 'wp_ajax_nopriv_emailoctopus_subscribeform_action', array($this, 'subform_action_callback') ); 81 81 82 add_action( 'wp_ajax_eo_loadtime', array($this, 'subform_loadtime_callback' ));83 add_action( 'wp_ajax_nopriv_eo_loadtime', array($this, 'subform_loadtime_callback' ));84 85 82 if ( class_exists( 'WooCommerce') ) { 86 83 … … 97 94 } 98 95 } 96 97 98 99 99 100 100 public function load_admin_style() { … … 289 289 } 290 290 291 public function subform_loadtime_callback() {292 if (isset($_COOKIE['eosub_loadtime'])) {293 return;294 } else {295 if (isset($_SERVER['HTTP_HOST'])) {296 $host = sanitize_text_field( wp_unslash($_SERVER['HTTP_HOST']) );297 setcookie("eosub_loadtime", time(), 0, '/', $host);298 }299 }300 }301 302 303 291 public function subform_action_callback() { 304 292 $error = ''; … … 313 301 } else { 314 302 $valid_captcha = true; 303 315 304 if (empty($_COOKIE['eosub_loadtime']) || (int)$_COOKIE['eosub_loadtime'] > (time()-15)) { 305 316 306 $valid_captcha = false; 317 307 $error = __( 'Invalid form submission, please try again.', 'fw-integration-for-emailoctopus' ); -
fw-integration-for-emailoctopus/trunk/include/class-woo-emailoctopus-integration.php
r3260135 r3371971 160 160 public function add_subscriber_callback( $order_id, $old_status, $new_status ) { 161 161 162 $subscribed = get_post_meta($order_id, 'fweo_emailoctopus_subscribed', true); 163 if ($subscribed == 'subscribed') return; // don't subscribe again if the order status is changed 164 $order = wc_get_order( $order_id ); 165 if (!in_array($new_status, array('completed', 'processing'))) return; 166 167 $settings = get_option('woocommerce_fws-woo-emailoctopus_settings'); 168 $billing_email = $order->get_billing_email(); 169 $first_name = $order->get_billing_first_name(); 170 $last_name = $order->get_billing_last_name(); 171 172 if (function_exists('pll_get_post_language')) { 173 $language = pll_get_post_language($order_id); 174 } 175 176 $tags = array(); 177 if (isset($settings['em_store_categories']) && $settings['em_store_categories'] == 'yes') { 178 $categs = $this->get_product_categories($order); 179 $tags = $categs; 180 } 181 if (isset($settings['em_store_used_coupon']) && $settings['em_store_used_coupon'] == 'yes') { 182 $coupons = $order->get_coupon_codes(); 183 if (count($coupons) > 0) { 184 $tags[] = 'coupon'; 185 } 186 } 187 if ($subscribed == 'checked') { 188 $tags[] = 'newsletter'; 189 } 190 191 192 $fields = array('FirstName' => $first_name, 'LastName' => $last_name); 193 194 if (isset($settings['em_send_language']) && $settings['em_send_language'] == 'yes' && !empty($language)) { 195 $fields['Language'] = $language; 196 } 197 if (isset($settings['em_store_last_purchase']) && $settings['em_store_last_purchase'] == 'yes') { 198 $fields['LastPurchase'] = gmdate('Y-m-d'); 199 } 200 if (count($tags) > 0) $fields['tags'] = implode(',', $tags); 201 202 $handler = new FWEO_EmailOctopus_integration(); 203 204 $response = $handler->add_subscriber($billing_email, $settings['list'], $fields, true); 205 206 if (isset($response['error']['code'])) { 207 $order->add_order_note('EmailOctopus error: '. $response['error']['message']); 208 } else { 209 $order->add_order_note( $billing_email.' added to the mailing list'); 210 update_post_meta( $order_id, 'fweo_emailoctopus_subscribed', 'subscribed'); 162 if ($subscribed = get_post_meta($order_id, 'fweo_emailoctopus_subscribed', true)) { 163 if ($subscribed == 'subscribed') return; // don't subscribe again if the order status is changed 164 $order = wc_get_order( $order_id ); 165 if (!in_array($new_status, array('completed', 'processing'))) return; 166 167 $settings = get_option('woocommerce_fws-woo-emailoctopus_settings'); 168 $billing_email = $order->get_billing_email(); 169 $first_name = $order->get_billing_first_name(); 170 $last_name = $order->get_billing_last_name(); 171 172 if (function_exists('pll_get_post_language')) { 173 $language = pll_get_post_language($order_id); 174 } 175 176 $tags = array(); 177 if (isset($settings['em_store_categories']) && $settings['em_store_categories'] == 'yes') { 178 $categs = $this->get_product_categories($order); 179 $tags = $categs; 180 } 181 if (isset($settings['em_store_used_coupon']) && $settings['em_store_used_coupon'] == 'yes') { 182 $coupons = $order->get_coupon_codes(); 183 if (count($coupons) > 0) { 184 $tags[] = 'coupon'; 185 } 186 } 187 if ($subscribed == 'checked') { 188 $tags[] = 'newsletter'; 189 } 190 191 192 $fields = array('FirstName' => $first_name, 'LastName' => $last_name); 193 194 if (isset($settings['em_send_language']) && $settings['em_send_language'] == 'yes' && !empty($language)) { 195 $fields['Language'] = $language; 196 } 197 if (isset($settings['em_store_last_purchase']) && $settings['em_store_last_purchase'] == 'yes') { 198 $fields['LastPurchase'] = gmdate('Y-m-d'); 199 } 200 if (count($tags) > 0) $fields['tags'] = implode(',', $tags); 201 202 $handler = new FWEO_EmailOctopus_integration(); 203 204 $response = $handler->add_subscriber($billing_email, $settings['list'], $fields, true); 205 206 if (isset($response['error']['code'])) { 207 $order->add_order_note('EmailOctopus error: '. $response['error']['message']); 208 } else { 209 $order->add_order_note( $billing_email.' added to the mailing list'); 210 update_post_meta( $order_id, 'fweo_emailoctopus_subscribed', 'subscribed'); 211 } 211 212 } 212 213 } -
fw-integration-for-emailoctopus/trunk/include/emailoctopus.js
r3069613 r3371971 4 4 } 5 5 6 function setCookie(name,value,days) { 7 var expires = ""; 8 if (days) { 9 var date = new Date(); 10 date.setTime(date.getTime() + (days*24*60*60*1000)); 11 expires = "; expires=" + date.toUTCString(); 12 } 13 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 14 } 15 function getCookie(name) { 16 var nameEQ = name + "="; 17 var ca = document.cookie.split(';'); 18 for(var i=0;i < ca.length;i++) { 19 var c = ca[i]; 20 while (c.charAt(0)==' ') c = c.substring(1,c.length); 21 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 22 } 23 return null; 24 } 25 var timenow = Math.floor(Date.now() / 1000); 26 if (null == getCookie('eosub_loadtime')) { 27 setCookie('eosub_loadtime', timenow, 0); 28 } 29 6 30 7 31 jQuery(document).ready(function($) { 8 $.get( eo_ajax_object.ajax_url, { action: "eo_loadtime" } );9 32 $('.emailoctopus-optin form').each(function(i, obj) { 10 33 var curr_id = $(this).attr('id'); -
fw-integration-for-emailoctopus/trunk/readme.txt
r3260135 r3371971 7 7 Requires PHP: 7.4 8 8 Tested up to: 6.7 9 Stable tag: 1.0. 8.69 Stable tag: 1.0.10 10 10 11 11 Increase the subscribers for your website by using EmailOctopus and this professional integration plugin for WordPress, Elementor and WooCommerce. … … 107 107 == Changelog == 108 108 109 = 1.0.10 = 110 * Bug fixes 111 * Fixed an issue in the WooCommerce integration where a certain setting would sign up all customers for the newsletter. 112 * Improvements 113 * Replaced the cookie ajax request (in WordPress) with a simple JavaScript cookie script for load time improvements. 114 109 115 = 1.0.8.6 = 110 116 * Improvements
Note: See TracChangeset
for help on using the changeset viewer.