PluginProbe
WANotifier for Forms and Actions / 2.5.3
WANotifier for Forms and Actions v2.5.3
3.1.1 3.1.0 3.0.4 2.7.10 2.7.11 2.7.12 2.7.13 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 3.0.0 3.0.1 3.0.2 3.0.3 trunk 0.1.0 0.1.1 1.0.0 1.0.1 1.0.2 All 67 releases
← All changes | includes/class-notifier.php +3 -61 2.7.42.5.3 View file →
@@ -22,15 +22,14 @@
22 22 /**
23 23 * Define Constants.
24 24 */
25 25 private function define_constants() {
26 - $this->define( 'NOTIFIER_VERSION', '2.7.4' );
26 + $this->define( 'NOTIFIER_VERSION', '2.5.3' );
27 27 $this->define( 'NOTIFIER_NAME', 'notifier' );
28 28 $this->define( 'NOTIFIER_PREFIX', 'notifier_' );
29 29 $this->define( 'NOTIFIER_URL', trailingslashit( plugins_url( '', dirname(__FILE__) ) ) );
30 30 $this->define( 'NOTIFIER_APP_API_URL', 'https://app.wanotifier.com/api/v1/' );
31 31 $this->define( 'NOTIFIER_ACTIVITY_TABLE_NAME', 'notifier_activity_log' );
32 - $this->define( 'NOTIFIER_CART_ABANDONMENT_TABLE', 'notifier_cart_abandonment' );
33 32 }
34 33
35 34 /**
36 35 * Define constant if not already set.
@@ -96,10 +95,8 @@
96 95 add_action( 'after_setup_theme', array( 'Notifier_Tools', 'init' ) );
97 96
98 97 add_action( 'wp_loaded', array( $this, 'setup_activity_log' ) );
99 98 add_action( 'notifier_clean_old_logs', array( $this, 'notifier_delete_old_activity_logs' ) );
100 -
101 - add_action( 'wp_loaded', array( $this, 'create_cart_abandonment_table' ) );
102 99 }
103 100
104 101 /**
105 102 * Setup during plugin activation
@@ -115,9 +112,8 @@
115 112 /**
116 113 * Setup during plugin deactivation
117 114 */
118 115 public function deactivate() {
119 - as_unschedule_action('notifier_check_cart_abandonment');
120 116 as_unschedule_action('notifier_clean_old_logs');
121 117 $notifier_plugin_data = get_option('notifier_meta', array());
122 118 $notifier_plugin_data['as_clear_log'] = 'yes';
123 119 update_option('notifier_meta', $notifier_plugin_data);
@@ -132,10 +128,9 @@
132 128 self::create_notifier_activity_log_table();
133 129 }
134 130
135 131 $args = array();
136 - $as_clear_log = isset($notifier_plugin_data['as_clear_log']) ? $notifier_plugin_data['as_clear_log'] : 'no';
137 - if ($as_clear_log !== 'yes') {
132 + if (!isset($notifier_plugin_data['as_clear_log']) || $notifier_plugin_data['as_clear_log'] !== 'yes') {
138 133 if (false === as_next_scheduled_action('notifier_clean_old_logs')) {
139 134 as_schedule_recurring_action(time(), DAY_IN_SECONDS, 'notifier_clean_old_logs', $args);
140 135 }
141 136 }
@@ -205,27 +200,8 @@
205 200 null,
206 201 NOTIFIER_VERSION
207 202 );
208 203 }
209 -
210 - if ('yes' === get_option('notifier_enable_abandonment_cart_tracking', 'no') && class_exists('WooCommerce') && is_checkout() ) {
211 - wp_enqueue_script(
212 - NOTIFIER_NAME . '-js',
213 - NOTIFIER_URL . 'assets/js/script.js',
214 - array('jquery'),
215 - NOTIFIER_VERSION,
216 - true
217 - );
218 -
219 - wp_localize_script(
220 - NOTIFIER_NAME . '-js',
221 - 'notifierFrontObj',
222 - array(
223 - 'ajaxurl' => admin_url( 'admin-ajax.php' ),
224 - 'security' => wp_create_nonce('notifier_save_cart_abandonment_data'),
225 - )
226 - );
227 - }
228 204 }
229 205
230 206 /**
231 207 * Set up a div for the header embed to render into.
@@ -270,9 +246,9 @@
270 246 'Content-Type' => 'application/json; charset=utf-8'
271 247 );
272 248 }
273 249
274 - $request_url = NOTIFIER_APP_API_URL . $endpoint . '?key=' . esc_attr($api_key);
250 + $request_url = NOTIFIER_APP_API_URL . $endpoint . '?key=' . $api_key;
275 251 $request_args = array(
276 252 'method' => $method,
277 253 'headers' => $headers,
278 254 'timeout' => 120,
@@ -397,40 +373,6 @@
397 373 $table_name = $wpdb->prefix . NOTIFIER_ACTIVITY_TABLE_NAME;
398 374 $retention_time = apply_filters( 'notifier_logs_retention_time', 7 );
399 375 $retention_time = intval($retention_time);
400 376 $wpdb->query( $wpdb->prepare( "DELETE FROM `$table_name` WHERE timestamp <= DATE_SUB(NOW(), INTERVAL %d DAY)", $retention_time ) );
401 - }
402 -
403 - /**
404 - * Create New db table-- notifier_cart_abandonment
405 - */
406 - public static function create_cart_abandonment_table() {
407 - $notifier_plugin_data = get_option('notifier_meta', array());
408 - if (!isset($notifier_plugin_data['cart_abandonment_table']) && $notifier_plugin_data['cart_abandonment_table'] !== 'yes') {
409 - global $wpdb;
410 - $table_name = $wpdb->prefix . NOTIFIER_CART_ABANDONMENT_TABLE;
411 - $charset_collate = $wpdb->get_charset_collate();
412 -
413 - // Updated CREATE TABLE query for notifier_cart_abandonment table
414 - $sql = "CREATE TABLE IF NOT EXISTS $table_name (
415 - session_id BIGINT(20) AUTO_INCREMENT PRIMARY KEY,
416 - session_key VARCHAR(16) NULL,
417 - phone_number VARCHAR(15) NULL,
418 - cart_data LONGTEXT NULL,
419 - cart_total DECIMAL(10,2) NULL,
420 - coupon_data LONGTEXT NULL,
421 - customer_data LONGTEXT NULL,
422 - order_id BIGINT(11) DEFAULT 0,
423 - triggered TINYINT(1) DEFAULT 0,
424 - created_time DATETIME NULL,
425 - updated_time DATETIME NULL,
426 - KEY session_key (session_key) -- Index for session_key
427 - ) $charset_collate;";
428 -
429 - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
430 - dbDelta( $sql );
431 -
432 - $notifier_plugin_data['cart_abandonment_table'] = 'yes';
433 - update_option('notifier_meta', $notifier_plugin_data);
434 - }
435 377 }
436 378 }