Popups – WordPress Popup - Version 1.9.2

Version Description

  • Added support for Visual Form Builder
  • Added cookie name support, so users can reset cookies for popups
  • Fix for woocommerce follow up emails
  • Fix for popup showing for a milisecond on certain themes
  • updated ID rule to accept multiple values
  • Added vimeo, youtube auto play support
  • Removed debug mode and safe mode, to make it less complicate
Download this release

Release Info

Developer timersys
Plugin Icon 128x128 Popups – WordPress Popup
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1.1 to 1.9.2

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: popup,twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, postmatic, mailpoet, facebook popup, scroll popups, popups, wordpress popup, wp popups, cf7, gf, gravity forms, contact form 7, ifs, infusion soft, subscribe, login popup, ajax login popups, popupmaker
5
  Requires at least: 3.6
6
  Tested up to: 4.9.4
7
- Stable tag: 1.9.1.1
8
  Text Domain: popups
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -189,6 +189,15 @@ If you have cache be sure to enable AJAX mode in the plugin settings page
189
 
190
  == Changelog ==
191
 
 
 
 
 
 
 
 
 
 
192
  = 1.9.1.1 =
193
  * Hotfix for draft popups showing
194
  = 1.9.1 =
4
  Tags: popup,twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, postmatic, mailpoet, facebook popup, scroll popups, popups, wordpress popup, wp popups, cf7, gf, gravity forms, contact form 7, ifs, infusion soft, subscribe, login popup, ajax login popups, popupmaker
5
  Requires at least: 3.6
6
  Tested up to: 4.9.4
7
+ Stable tag: 1.9.2
8
  Text Domain: popups
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
189
 
190
  == Changelog ==
191
 
192
+ = 1.9.2 =
193
+ * Added support for Visual Form Builder
194
+ * Added cookie name support, so users can reset cookies for popups
195
+ * Fix for woocommerce follow up emails
196
+ * Fix for popup showing for a milisecond on certain themes
197
+ * updated ID rule to accept multiple values
198
+ * Added vimeo, youtube auto play support
199
+ * Removed debug mode and safe mode, to make it less complicate
200
+
201
  = 1.9.1.1 =
202
  * Hotfix for draft popups showing
203
  = 1.9.1 =
admin/class-social-popup-admin.php CHANGED
@@ -167,17 +167,15 @@ class SocialPopup_Admin {
167
  public function settings_page() {
168
 
169
  $defaults = apply_filters( 'spu/settings_page/defaults_opts', array(
170
- 'aff_link' => '',
171
- 'ajax_mode' => '0',
172
- 'debug' => '',
173
- 'safe' => '',
174
- 'shortcodes_style' => '',
175
- 'facebook' => '',
176
- 'google' => '',
177
- 'twitter' => '',
178
- 'spu_license_key' => '',
179
- 'ua_code' => '',
180
- 'mc_api' => '',
181
  ));
182
  $opts = apply_filters( 'spu/settings_page/opts', get_option( 'spu_settings', $defaults ) );
183
 
@@ -456,12 +454,21 @@ class SocialPopup_Admin {
456
  $opts['css']['close_hover_color'] = sanitize_text_field( $opts['css']['close_hover_color'] );
457
  $opts['css']['close_size'] = sanitize_text_field( $opts['css']['close_size'] );
458
  $opts['css']['close_position'] = sanitize_text_field( $opts['css']['close_position'] );
459
- $opts['css']['close_shadow_color'] = sanitize_text_field( $opts['css']['close_shadow_color'] );
460
  $opts['css']['position'] = sanitize_text_field( $opts['css']['position'] );
461
 
462
- $opts['cookie'] = absint( sanitize_text_field( $opts['cookie'] ) );
 
 
 
 
 
 
 
463
  $opts['trigger_number'] = absint( sanitize_text_field( $opts['trigger_number'] ) );
464
 
 
 
465
  // Check for social shortcodes and update post meta ( we check later if we need to enqueue any social js)
466
  $total_shortcodes =0;
467
  if( has_shortcode( $post->post_content, 'spu-facebook' ) || has_shortcode( $post->post_content, 'spu-facebook-page' ) ){
@@ -707,12 +714,34 @@ class SocialPopup_Admin {
707
  if( get_post_type() !== 'spucpt') {
708
  return $args;
709
  }
 
710
  // dirty hax, WPML replace our function so let's try to get theirs and add to ours
711
- if( strpos($args['setup'], 'function(ed)') !== false) {
712
- $func = rtrim( str_replace(array('function(ed) {','function(ed){'), '', $args['setup']),'}');
 
 
 
 
 
 
 
 
 
 
 
713
  }
714
 
715
- $args['setup'] = 'function(ed) { if(typeof SPU_ADMIN === \'undefined\') { return; } ed.onInit.add(SPU_ADMIN.onTinyMceInit);if(typeof SPUP_ADMIN === \'undefined\') { return; } ed.onInit.add(SPUP_ADMIN.onTinyMceInit);'.$func.' }';
 
 
 
 
 
 
 
 
 
 
716
 
717
  return $args;
718
  }
167
  public function settings_page() {
168
 
169
  $defaults = apply_filters( 'spu/settings_page/defaults_opts', array(
170
+ 'aff_link' => '',
171
+ 'ajax_mode' => '0',
172
+ 'shortcodes_style' => '',
173
+ 'facebook' => '',
174
+ 'google' => '',
175
+ 'twitter' => '',
176
+ 'spu_license_key' => '',
177
+ 'ua_code' => '',
178
+ 'mc_api' => '',
 
 
179
  ));
180
  $opts = apply_filters( 'spu/settings_page/opts', get_option( 'spu_settings', $defaults ) );
181
 
454
  $opts['css']['close_hover_color'] = sanitize_text_field( $opts['css']['close_hover_color'] );
455
  $opts['css']['close_size'] = sanitize_text_field( $opts['css']['close_size'] );
456
  $opts['css']['close_position'] = sanitize_text_field( $opts['css']['close_position'] );
457
+ $opts['css']['close_shadow_color'] = sanitize_text_field( $opts['css']['close_shadow_color'] );
458
  $opts['css']['position'] = sanitize_text_field( $opts['css']['position'] );
459
 
460
+ $opts['name-convert-cookie'] = sanitize_text_field( $opts['name-convert-cookie'] ) ;
461
+ $opts['name-close-cookie'] = sanitize_text_field( $opts['name-close-cookie'] );
462
+ $opts['duration-convert-cookie'] = absint( sanitize_text_field( $opts['duration-convert-cookie'] ) );
463
+ $opts['duration-close-cookie'] = absint( sanitize_text_field( $opts['duration-close-cookie'] ) );
464
+ // add popup ID to make the unique
465
+ $opts['name-convert-cookie'] = $opts['name-convert-cookie'] == 'spu_conversion' ? 'spu_conversion_'.$post_id : $opts['name-convert-cookie'] ;
466
+ $opts['name-close-cookie'] = $opts['name-close-cookie'] == 'spu_closing' ? 'spu_closing_'.$post_id : $opts['name-close-cookie'];
467
+
468
  $opts['trigger_number'] = absint( sanitize_text_field( $opts['trigger_number'] ) );
469
 
470
+
471
+
472
  // Check for social shortcodes and update post meta ( we check later if we need to enqueue any social js)
473
  $total_shortcodes =0;
474
  if( has_shortcode( $post->post_content, 'spu-facebook' ) || has_shortcode( $post->post_content, 'spu-facebook-page' ) ){
714
  if( get_post_type() !== 'spucpt') {
715
  return $args;
716
  }
717
+ $func = '';
718
  // dirty hax, WPML replace our function so let's try to get theirs and add to ours
719
+ // same with follow up emails by woocommerce
720
+ if( array_key_exists('setup', $args) && strpos($args['setup'], 'function(ed)') !== false) {
721
+ if( $pos = strpos($args['setup'], 'function(ed){') !== false ) {
722
+ if( $pos < 15 ){
723
+ $func .= rtrim(substr_replace($args['setup'],'',$pos,strlen('function(ed){')),'}');
724
+ }
725
+ }
726
+ if( $pos = strpos($args['setup'], 'function(ed) {') !== false ) {
727
+ if( $pos < 15 ){
728
+ $func .= rtrim(substr_replace($args['setup'],'',$pos,strlen('function(ed) {')),'}');
729
+ }
730
+ }
731
+
732
  }
733
 
734
+ $args['setup'] = 'function(ed) {
735
+ if(typeof SPU_ADMIN === \'undefined\') {
736
+ return;
737
+ }
738
+ ed.onInit.add(SPU_ADMIN.onTinyMceInit);
739
+ if(typeof SPUP_ADMIN === \'undefined\') {
740
+ return;
741
+ }
742
+ ed.onInit.add(SPUP_ADMIN.onTinyMceInit);
743
+ '.$func.'
744
+ }';
745
 
746
  return $args;
747
  }
admin/views/metaboxes/metabox-options.php CHANGED
@@ -52,16 +52,30 @@ if ( !defined( 'ABSPATH' ) ) exit;?>
52
  <p><?php _e( 'We use PHP cookies to prevent popups opening for users after they closed it.', 'popups');?></p>
53
  <table class="form-table">
54
  <tr valign="top">
55
- <th><label for="spu_cookie"><?php _e( 'Conversion cookie', 'popups' ); ?></label></th>
56
  <td colspan="3">
57
- <input type="number" id="spu_cookie" name="spu[cookie]" min="0" value="<?php echo esc_attr($opts['cookie']); ?>" />
 
 
 
 
 
 
 
58
  <p class="help"><?php _e( 'When a user do a conversion like for example a click or form submission, how many days should it stay hidden?', 'popups' ); ?></p>
59
  </td>
60
  </tr>
61
  <tr valign="top">
62
- <th><label for="spu_cookie"><?php _e( 'Closing cookie', 'popups' ); ?></label></th>
 
 
 
 
 
 
 
63
  <td colspan="3">
64
- <input type="number" id="spu_cookie" name="spu[close-cookie]" min="0" value="<?php echo isset( $opts['close-cookie'] ) ? esc_attr($opts['close-cookie']) : esc_attr($opts['cookie']); ?>" />
65
  <p class="help"><?php _e( 'After closing the popup, how many days should it stay hidden?', 'popups' ); ?></p>
66
  </td>
67
  </tr>
52
  <p><?php _e( 'We use PHP cookies to prevent popups opening for users after they closed it.', 'popups');?></p>
53
  <table class="form-table">
54
  <tr valign="top">
55
+ <th><label for="spu_name_conversion_cookie"><?php _e( 'Conversion cookie name', 'popups' ); ?></label></th>
56
  <td colspan="3">
57
+ <input type="text" id="spu_name_conversion_cookie" name="spu[name-convert-cookie]" value="<?php echo esc_attr($opts['name-convert-cookie']); ?>" />
58
+ <p class="help"><?php _e( 'The name that the popup will use for convertion cookie. Changing this name will reset the cookie, so all users will see popup again.', 'popups' ); ?></p>
59
+ </td>
60
+ </tr>
61
+ <tr valign="top">
62
+ <th><label for="spu_duration_conversion_cookie"><?php _e( 'Conversion cookie Duration', 'popups' ); ?></label></th>
63
+ <td colspan="3">
64
+ <input type="number" id="spu_duration_conversion_cookie" name="spu[duration-convert-cookie]" min="0" value="<?php echo esc_attr($opts['duration-convert-cookie']); ?>" />
65
  <p class="help"><?php _e( 'When a user do a conversion like for example a click or form submission, how many days should it stay hidden?', 'popups' ); ?></p>
66
  </td>
67
  </tr>
68
  <tr valign="top">
69
+ <th><label for="spu_name_closing_cookie"><?php _e( 'Closing cookie name', 'popups' ); ?></label></th>
70
+ <td colspan="3">
71
+ <input type="text" id="spu_name_closing_cookie" name="spu[name-close-cookie]" value="<?php echo esc_attr($opts['name-close-cookie']); ?>" />
72
+ <p class="help"><?php _e( 'The name that the popup will use for closing cookie. Changing this name will reset the cookie, so all users will see popup again.', 'popups' ); ?></p>
73
+ </td>
74
+ </tr>
75
+ <tr valign="top">
76
+ <th><label for="spu_duration_close_cookie"><?php _e( 'Closing cookie duration', 'popups' ); ?></label></th>
77
  <td colspan="3">
78
+ <input type="number" id="spu_duration_close_cookie" name="spu[duration-close-cookie]" min="0" value="<?php echo isset( $opts['duration-close-cookie'] ) ? esc_attr($opts['duration-close-cookie']) : esc_attr($opts['duration-convert-cookie']); ?>" />
79
  <p class="help"><?php _e( 'After closing the popup, how many days should it stay hidden?', 'popups' ); ?></p>
80
  </td>
81
  </tr>
admin/views/settings-page.php CHANGED
@@ -28,22 +28,6 @@
28
  </td>
29
  </tr>
30
 
31
- <tr valign="top" class="">
32
- <th><label for="debug"><?php _e( 'Enable Debug mode?', 'popups' ); ?></label></th>
33
- <td colspan="3">
34
- <label><input type="checkbox" id="debug" name="spu_settings[debug]" value="1" <?php isset($opts['debug']) && checked($opts['debug'], 1); ?> />
35
- <p class="help"><?php _e( 'Will use uncompressed js', 'popups' ); ?></p>
36
- </td>
37
-
38
- </tr>
39
- <tr valign="top" class="">
40
- <th><label for="safe"><?php _e( 'Enable safe mode?', 'popups' ); ?></label></th>
41
- <td colspan="3">
42
- <label><input type="checkbox" id="safe" name="spu_settings[safe]" value="1" <?php isset($opts['safe']) && checked($opts['safe'], 1); ?> />
43
- <p class="help"><?php _e( 'Will move all popups to top of the screen.', 'popups' ); ?></p>
44
- </td>
45
-
46
- </tr>
47
  <tr valign="top" class="">
48
  <th><label for="style"><?php _e( 'Remove shortcodes style', 'popups' ); ?></label></th>
49
  <td colspan="3">
28
  </td>
29
  </tr>
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  <tr valign="top" class="">
32
  <th><label for="style"><?php _e( 'Remove shortcodes style', 'popups' ); ?></label></th>
33
  <td colspan="3">
composer.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "minimum-stability": "dev",
3
+ "require": {
4
+ "jaybizzle/crawler-detect": "1.*",
5
+ "mobiledetect/mobiledetectlib": "^2.8",
6
+ "cbschuld/browser.php": "^1.95@dev"
7
+ }
8
+ }
composer.lock ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "fe7213eeccfa0dd003c369f624314b84",
8
+ "packages": [
9
+ {
10
+ "name": "cbschuld/browser.php",
11
+ "version": "dev-master",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/cbschuld/Browser.php.git",
15
+ "reference": "6bde9efb0b14a4917affe741500c29149419e491"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/cbschuld/Browser.php/zipball/6bde9efb0b14a4917affe741500c29149419e491",
20
+ "reference": "6bde9efb0b14a4917affe741500c29149419e491",
21
+ "shasum": ""
22
+ },
23
+ "type": "library",
24
+ "extra": {
25
+ "branch-alias": {
26
+ "dev-master": "1.95-dev"
27
+ }
28
+ },
29
+ "autoload": {
30
+ "files": [
31
+ "lib/Browser.php"
32
+ ]
33
+ },
34
+ "notification-url": "https://packagist.org/downloads/",
35
+ "license": [
36
+ "MIT"
37
+ ],
38
+ "authors": [
39
+ {
40
+ "name": "Chris Schuld",
41
+ "email": "chris@chrisschuld.com",
42
+ "homepage": "http://chrisschuld.com"
43
+ }
44
+ ],
45
+ "description": "A PHP Class to detect a user's Browser",
46
+ "homepage": "http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php.html",
47
+ "keywords": [
48
+ "browser",
49
+ "detection",
50
+ "user agent"
51
+ ],
52
+ "time": "2017-07-31 23:43:17"
53
+ },
54
+ {
55
+ "name": "jaybizzle/crawler-detect",
56
+ "version": "v1.2.15",
57
+ "source": {
58
+ "type": "git",
59
+ "url": "https://github.com/JayBizzle/Crawler-Detect.git",
60
+ "reference": "82fa7ac8598d9791a14c29fc4bb9174108300787"
61
+ },
62
+ "dist": {
63
+ "type": "zip",
64
+ "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/82fa7ac8598d9791a14c29fc4bb9174108300787",
65
+ "reference": "82fa7ac8598d9791a14c29fc4bb9174108300787",
66
+ "shasum": ""
67
+ },
68
+ "require": {
69
+ "php": ">=5.3.0"
70
+ },
71
+ "require-dev": {
72
+ "phpunit/phpunit": "*"
73
+ },
74
+ "type": "library",
75
+ "autoload": {
76
+ "psr-4": {
77
+ "Jaybizzle\\CrawlerDetect\\": "src/"
78
+ }
79
+ },
80
+ "notification-url": "https://packagist.org/downloads/",
81
+ "license": [
82
+ "MIT"
83
+ ],
84
+ "authors": [
85
+ {
86
+ "name": "Mark Beech",
87
+ "email": "m@rkbee.ch",
88
+ "role": "Developer"
89
+ }
90
+ ],
91
+ "description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent",
92
+ "homepage": "https://github.com/JayBizzle/Crawler-Detect/",
93
+ "keywords": [
94
+ "crawler",
95
+ "crawler detect",
96
+ "crawler detector",
97
+ "crawlerdetect",
98
+ "php crawler detect"
99
+ ],
100
+ "time": "2016-08-19T20:27:52+00:00"
101
+ },
102
+ {
103
+ "name": "mobiledetect/mobiledetectlib",
104
+ "version": "2.8.22",
105
+ "source": {
106
+ "type": "git",
107
+ "url": "https://github.com/serbanghita/Mobile-Detect.git",
108
+ "reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6"
109
+ },
110
+ "dist": {
111
+ "type": "zip",
112
+ "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/53cddae0c272a478b24a4b5fb60d0f838caf70b6",
113
+ "reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6",
114
+ "shasum": ""
115
+ },
116
+ "require": {
117
+ "php": ">=5.0.0"
118
+ },
119
+ "require-dev": {
120
+ "codeclimate/php-test-reporter": "dev-master",
121
+ "johnkary/phpunit-speedtrap": "~1.0@dev",
122
+ "phpunit/phpunit": "*"
123
+ },
124
+ "type": "library",
125
+ "autoload": {
126
+ "classmap": [
127
+ "Mobile_Detect.php"
128
+ ],
129
+ "psr-0": {
130
+ "Detection": "namespaced/"
131
+ }
132
+ },
133
+ "notification-url": "https://packagist.org/downloads/",
134
+ "license": [
135
+ "MIT"
136
+ ],
137
+ "authors": [
138
+ {
139
+ "name": "Serban Ghita",
140
+ "email": "serbanghita@gmail.com",
141
+ "homepage": "http://mobiledetect.net",
142
+ "role": "Developer"
143
+ }
144
+ ],
145
+ "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
146
+ "homepage": "https://github.com/serbanghita/Mobile-Detect",
147
+ "keywords": [
148
+ "detect mobile devices",
149
+ "mobile",
150
+ "mobile detect",
151
+ "mobile detector",
152
+ "php mobile detect"
153
+ ],
154
+ "time": "2016-04-24T09:47:16+00:00"
155
+ }
156
+ ],
157
+ "packages-dev": [],
158
+ "aliases": [],
159
+ "minimum-stability": "dev",
160
+ "stability-flags": {
161
+ "cbschuld/browser.php": 20
162
+ },
163
+ "prefer-stable": false,
164
+ "prefer-lowest": false,
165
+ "platform": [],
166
+ "platform-dev": []
167
+ }
includes/class-spu-helper.php CHANGED
@@ -456,8 +456,10 @@ class Spu_Helper {
456
  'trigger' => 'seconds',
457
  'trigger_number' => '5',
458
  'animation' => 'fade',
459
- 'cookie' => '999',
460
- 'close-cookie' => '30',
 
 
461
  'auto_hide' => 0,
462
  'test_mode' => 0,
463
  'conversion_close' => '1',
456
  'trigger' => 'seconds',
457
  'trigger_number' => '5',
458
  'animation' => 'fade',
459
+ 'duration-convert-cookie' => '999',
460
+ 'duration-close-cookie' => '30',
461
+ 'name-convert-cookie' => 'spu_conversion',
462
+ 'name-close-cookie' => 'spu_closing',
463
  'auto_hide' => 0,
464
  'test_mode' => 0,
465
  'conversion_close' => '1',
popups.php CHANGED
@@ -11,9 +11,9 @@
11
  * @socialpopup
12
  * Plugin Name: Popups - WordPress Popup
13
  * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
- * Version: 1.9.1.1
15
  * Description: Most complete free Popups plugin, scroll triggered popups, compatible with social networks, Gravity Forms, Ninja Forms, Contact form 7, Mailpoet, Mailchimp for WP, Postmatic, etc
16
- * Author: Damian Logghe
17
  * Author URI: https://timersys.com
18
  * Text Domain: popups
19
  * License: GPL-2.0+
@@ -30,7 +30,7 @@ if ( ! defined( 'WPINC' ) ) {
30
  * Public-Facing Functionality
31
  *----------------------------------------------------------------------------*/
32
 
33
- define( 'SPU_VERSION' , '1.9.1.1' );
34
  define( 'SPU_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
35
  define( 'SPU_PLUGIN_URL' , plugin_dir_url(__FILE__) );
36
  define( 'SPU_PLUGIN_HOOK' , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
11
  * @socialpopup
12
  * Plugin Name: Popups - WordPress Popup
13
  * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
+ * Version: 1.9.2
15
  * Description: Most complete free Popups plugin, scroll triggered popups, compatible with social networks, Gravity Forms, Ninja Forms, Contact form 7, Mailpoet, Mailchimp for WP, Postmatic, etc
16
+ * Author: timersys
17
  * Author URI: https://timersys.com
18
  * Text Domain: popups
19
  * License: GPL-2.0+
30
  * Public-Facing Functionality
31
  *----------------------------------------------------------------------------*/
32
 
33
+ define( 'SPU_VERSION' , '1.9.2' );
34
  define( 'SPU_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
35
  define( 'SPU_PLUGIN_URL' , plugin_dir_url(__FILE__) );
36
  define( 'SPU_PLUGIN_HOOK' , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
public/assets/js/min/public-min.js DELETED
@@ -1 +0,0 @@
1
- (function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype,r=this,o=r.EventEmitter;i.getListeners=function(t){var e,n,i=this._getEvents();if("object"==typeof t){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;t.length>e;e+=1)n.push(t[e].listener);return n},i.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&(e={},e[t]=n),e||n},i.addListener=function(t,n){var i,r=this.getListenersAsObject(t),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===e(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,n){var i,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&(i=e(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,n){var i,r,o=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)o.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(r=e[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"===n)delete i[t];else if("object"===n)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(t,e){var n,i,r,o,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(t,n.listener),o=n.listener.apply(this,e||[]),o===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},i.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return r.EventEmitter=o,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}).call(this),function(t){function e(e){var n=t.event;return n.target=n.target||n.srcElement||e,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(t,e,n){t.addEventListener(e,n,!1)}:n.attachEvent&&(i=function(t,n,i){t[n+i]=i.handleEvent?function(){var n=e(t);i.handleEvent.call(i,n)}:function(){var n=e(t);i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var r=function(){};n.removeEventListener?r=function(t,e,n){t.removeEventListener(e,n,!1)}:n.detachEvent&&(r=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(i){t[e+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):t.eventie=o}(this),function(t,e){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return e(t,n,i)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.imagesLoaded=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,n){function i(t,e){for(var n in e)t[n]=e[n];return t}function r(t){return"[object Array]"===p.call(t)}function o(t){var e=[];if(r(t))e=t;else if("number"==typeof t.length)for(var n=0,i=t.length;i>n;n++)e.push(t[n]);else e.push(t);return e}function s(t,e,n){if(!(this instanceof s))return new s(t,e);"string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=o(t),this.options=i({},this.options),"function"==typeof e?n=e:i(this.options,e),n&&this.on("always",n),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var r=this;setTimeout(function(){r.check()})}function a(t){this.img=t}function u(t){this.src=t,l[t]=this}var f=t.jQuery,c=t.console,d=void 0!==c,p=Object.prototype.toString;s.prototype=new e,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var t=0,e=this.elements.length;e>t;t++){var n=this.elements[t];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var a=r[o];this.addImage(a)}}},s.prototype.addImage=function(t){var e=new a(t);this.images.push(e)},s.prototype.check=function(){function t(t,r){return e.options.debug&&d&&c.log("confirm",t,r),e.progress(t),n++,n===i&&e.complete(),!0}var e=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return void this.complete();for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",t),o.check()}},s.prototype.progress=function(t){this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded;var e=this;setTimeout(function(){e.emit("progress",e,t),e.jqDeferred&&e.jqDeferred.notify&&e.jqDeferred.notify(e,t)})},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var e=this;setTimeout(function(){if(e.emit(t,e),e.emit("always",e),e.jqDeferred){var n=e.hasAnyBroken?"reject":"resolve";e.jqDeferred[n](e)}})},f&&(f.fn.imagesLoaded=function(t,e){var n=new s(this,t,e);return n.jqDeferred.promise(f(this))}),a.prototype=new e,a.prototype.check=function(){var t=l[this.img.src]||new u(this.img.src);if(t.isConfirmed)return void this.confirm(t.isLoaded,"cached was confirmed");if(this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var e=this;t.on("confirm",function(t,n){return e.confirm(t.isLoaded,n),!0}),t.check()},a.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("confirm",this,e)};var l={};return u.prototype=new e,u.prototype.check=function(){if(!this.isChecked){var t=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.src,this.isChecked=!0}},u.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},u.prototype.onload=function(t){this.confirm(!0,"onload"),this.unbindProxyEvents(t)},u.prototype.onerror=function(t){this.confirm(!1,"onerror"),this.unbindProxyEvents(t)},u.prototype.confirm=function(t,e){this.isConfirmed=!0,this.isLoaded=t,this.emit("confirm",this,e)},u.prototype.unbindProxyEvents=function(t){n.unbind(t.target,"load",this),n.unbind(t.target,"error",this)},s}),function($){"use strict";function t(t,e,n,i,r){var o={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},r=r||!1,n=n||!1,i=i||!1;e&&(o.url=e),n&&(o.success=n),i&&(o.error=i),r&&(o.dataType=r),$.ajax(o)}function e(t,e,n){if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3);var r="; expires="+i.toGMTString()}else var r="";document.cookie=t+"="+e+r+"; path=/"}function n(t){for(var e=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(e))return r.substring(e.length,r.length)}return null}function i(){try{FB.Event.subscribe("edge.create",function(t,e){var n=$(e).parents(".spu-box").data("box-id");n&&SPU.hide(n,!1,!0)})}catch(t){}l=!0,clearInterval(h)}function r(t){var e=$(t.target).parents(".spu-box").data("box-id");e&&SPU.hide(e,!1,!0)}function o(t){if("on"==t.state){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function s(t){if("confirm"==t.type){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function a(){if("undefined"!=typeof spuvar_social&&spuvar_social.facebook)try{FB.XFBML.parse()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.google)try{gapi.plusone.go()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.twitter)try{twttr.widgets.load()}catch(t){}}function u(){$(".spu-box form").each(function(){var t=$(this).attr("action");t&&$(this).attr("action",t.replace("?spu_action=spu_load",""))}),$.fn.wpcf7InitForm&&$(".spu-box div.wpcf7 > form").wpcf7InitForm()}var f=function(){function i(t){var e=d[t],n=$(window).width(),i=$(window).height(),r=e.outerHeight(),o=e.outerWidth(),s=e.data("width"),a=0,u=i/2-r/2,f="fixed",c=$(document).scrollTop();e.hasClass("spu-centered")&&(s<n&&(a=n/2-o/2),e.css({left:a,position:f,top:u})),r+50>i&&(f="absolute",u=c,e.css({position:f,top:u,bottom:"auto"}))}function r(t){var e=$(t).find(".spu-facebook");if(e.length){var n=e.find(".fb-like > span").width();if(0==n){var i=e.find(".fb-like").data("layout");"box_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>"):"button_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;min-width: 120px !important;}</style>"):e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;width: 80px !important;}</style>")}}}function o(t){var e=t,n=e.data("total");if(n){a();var i=0,r=0,o=e.outerWidth(),s=e.find(".spu-content").width();!spuvar.disable_style&&$(window).width()>o&&(e.find(".spu-shortcode").wrapAll('<div class="spu_shortcodes"/>'),e.find(".spu-shortcode").each(function(){i+=$(this).outerWidth()}),r=s-i-20*n),r>0&&(e.find(".spu-shortcode").each(function(){$(this).css("margin-left",r/2)}),2==n?e.find(".spu-shortcode").last().css("margin-left",0):3==n&&e.find(".spu-shortcode").first().css("margin-left",0))}}function s(t,n,r){var s=d[t],a=$("#spu-bg-"+t),u=s.data("bgopa");if(s.is(":animated"))return!1;if(n===!0&&s.is(":visible")||n===!1&&s.is(":hidden"))return!1;if(n===!1){var f=parseFloat(s.data("close-cookie"));r===!0&&(f=parseFloat(s.data("cookie"))),f>0&&e("spu_box_"+t,!0,f),s.trigger("spu.box_close",[t]);var c=s.find('iframe[src*="vimeo"],iframe[src*="youtube"]');c&&c.length&&s.remove()}else setTimeout(function(){o(s)},1500),s.trigger("spu.box_open",[t]),$(window).resize(function(){i(t)}),i(t);var p=s.data("spuanimation"),l=s.data("close-on-conversion");return"fade"===p?n===!0?s.fadeIn("slow"):n===!1&&(l&&r||!r)&&s.fadeOut("slow"):"disable"===p?n===!0?s.show():n===!1&&(l&&r||!r)&&s.hide():n===!0?s.slideDown("slow"):n===!1&&(l&&r||!r)&&s.slideUp("slow"),n===!0&&u>0?"disable"===p?a.show():a.fadeIn():n===!1&&(l&&r||!r)&&("disable"===p?a.hide():a.fadeOut()),n}var u=$(window).height(),f=spuvar.is_admin,c=spuvar.is_preview,d=[];return $(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({"margin-bottom":0,"padding-bottom":0}),$(".spu-box").each(function(){spuvar.safe_mode&&$(this).prependTo("body");var e=$(this),i=e.data("trigger"),o=0,a=1===parseInt(e.data("test-mode")),p=e.data("box-id"),l=1===parseInt(e.data("auto-hide")),h=parseInt(e.data("seconds-close")),m=parseInt(e.data("trigger-number"),10),v="percentage"==i?parseInt(e.data("trigger-number"),10)/100:.8,g=v*$(document).height();r(e),e.on("click",'a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close, .spu-not-close a")',function(){s(p,!1,!0)}),$(document).keyup(function(t){27==t.keyCode&&s(p,!1,!1)});var w=navigator.userAgent,y=w.match(/iPad/i)||w.match(/iPhone/i)?"touchstart":"click";$("body").on(y,function(t){void 0!==t.originalEvent&&s(p,!1,!1)}),$("body").on(y,".spu-box,.spu-clickable",function(t){t.stopPropagation()}),e.hide().css("left",""),d[p]=e;var b=function(){o&&clearTimeout(o),o=window.setTimeout(function(){var t=$(window).scrollTop(),e=t+u>=g;e?(l||$(window).unbind("scroll",b),s(p,!0,!1)):s(p,!1,!1)},100)},_=function(){o&&clearTimeout(o),o=window.setTimeout(function(){var t=$(window).scrollTop(),e=t>=m;e?(l||$(window).unbind("scroll",_),s(p,!0,!1)):s(p,!1,!1)},100)},x=function(){o&&clearTimeout(o),o=window.setTimeout(function(){s(p,!0,!1)},1e3*m)},E=n("spu_box_"+p);if((void 0==E||""==E||f&&a||c)&&("seconds"==i&&x(),"percentage"==i&&($(window).bind("scroll",b),b()),"pixels"==i&&($(window).bind("scroll",_),_()),window.location.hash&&window.location.hash.length>0)){var L=window.location.hash,j;L.substring(1)===e.attr("id")&&setTimeout(function(){s(p,!0,!1)},100)}e.on("click",".spu-close-popup",function(){s(p,!1,!1),"percentage"==i&&$(window).unbind("scroll",b)}),$(document.body).on("click",'a[href="#spu-'+p+'"], .spu-open-'+p,function(t){t.preventDefault(),s(p,!0,!1)}),$('a[href="#spu-'+p+'"], .spu-open-'+p).css("cursor","pointer").addClass("spu-clickable"),e.find(".gform_wrapper form").addClass("gravity-form"),e.find(".mc4wp-form form").addClass("mc4wp-form"),e.find(".newsletter form").addClass("newsletter-form");var k=e.find("form");if(k.length){if(!k.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form")){var T=k.attr("action"),O=new RegExp(spuvar.site_url,"i");T&&T.length&&(O.test(T)||k.addClass("spu-disable-ajax"))}$(".spu-disable-ajax form").length&&$(".spu-disable-ajax form").addClass("spu-disable-ajax"),e.on("submit",'form.spu-disable-ajax:not(".flp_form")',function(){e.trigger("spu.form_submitted",[p]),s(p,!1,!0)}),e.on("submit",'form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")',function(n){n.preventDefault();var i=!0,r=$(this),o=r.serialize(),a=r.hasClass("mc4wp-form")?spuvar.site_url+"/":r.attr("action"),u=function(t,e,n){console.log("Spu Form error: "+e+" - "+n)},f=function(t){var e=$(t).filter("#spu-"+p).html();$("#spu-"+p).html(e),$("#spu-"+p).find(".mc4wp-alert").length||setTimeout(function(){s(p,!1,!0)},1e3*spuvar.seconds_confirmation_close)};return t(o,a,f,u,"html"),e.trigger("spu.form_submitted",[p]),i}),$(document).on("wpcf7mailsent",function(){e.trigger("spu.form_submitted",[p]),s(p,!1,!0)}),k.hasClass("gravity-form")&&k.attr("action",window.location.href),$(document).on("gform_confirmation_loaded",function(){e.trigger("spu.form_submitted",[p]),s(p,!1,!0)}),e.on("submit",".infusion-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[p]),s(p,!1,!0),this.submit()}),e.on("submit",".newsletter-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[p]),s(p,!1,!0),this.submit()}),$("body").on("submitResponse.default",function(){e.trigger("spu.form_submitted",[p]),s(p,!1,!0)})}}),{show:function(t){return s(t,!0,!1)},hide:function(t,e,n){return s(t,!1,n)},request:function(e,n,i,r){return t(e,n,i,r)}}};if(spuvar.ajax_mode){var c={pid:spuvar.pid,referrer:document.referrer,query_string:document.location.search,is_category:spuvar.is_category,is_archive:spuvar.is_archive,is_preview:spuvar.is_preview},d=function(t){$("body").append(t),$(".spu-box").imagesLoaded(function(){window.SPU=f(),u()})},p=function(t,e,n){console.log("Problem loading popups - error: "+e+" - "+n)};t(c,spuvar.ajax_mode_url,d,p,"html")}else $(".spu-box").imagesLoaded(function(){window.SPU=f()});var l=!1,h=setInterval(function(){"undefined"==typeof FB||l||i()},1e3);if("undefined"!=typeof twttr)try{twttr.ready(function(t){t.events.bind("tweet",r),t.events.bind("follow",r)})}catch(t){}}(jQuery);
 
public/assets/js/public.js CHANGED
@@ -6,7 +6,7 @@
6
  (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
7
 
8
  (function($){
9
- "use strict";
10
 
11
  var SPU_master = function() {
12
 
@@ -27,13 +27,6 @@ var SPU_master = function() {
27
  // loop through boxes
28
  $(".spu-box").each(function() {
29
 
30
- // move to parent in safe mode
31
- if( spuvar.safe_mode ){
32
-
33
- $(this).prependTo('body');
34
-
35
- }
36
-
37
  // vars
38
  var $box = $(this);
39
  var triggerMethod = $box.data('trigger');
@@ -47,7 +40,15 @@ var SPU_master = function() {
47
  var triggerHeight = ( triggerPercentage * $(document).height() );
48
 
49
  facebookFix( $box );
50
-
 
 
 
 
 
 
 
 
51
  // Custom links conversion
52
  $box.on('click', 'a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close, .spu-not-close a")', function(){
53
  // hide the popup and track conversion
@@ -79,7 +80,7 @@ var SPU_master = function() {
79
  });
80
 
81
  //hide boxes and remove left-99999px we cannot since beggining of facebook won't display
82
- $box.hide().css('left','');
83
 
84
  // add box to global boxes array
85
  $boxes[id] = $box;
@@ -151,20 +152,32 @@ var SPU_master = function() {
151
  }, triggerSeconds * 1000);
152
  }
153
 
 
 
 
154
  // show box if cookie not set or if in test mode
155
- var cookieValue = spuReadCookie( 'spu_box_' + id );
 
 
 
 
 
 
156
 
157
- if( ( cookieValue == undefined || cookieValue == '' ) || ( isAdmin && testMode ) || isPreview ) {
 
 
 
158
 
159
  if(triggerMethod == 'seconds') {
160
  triggerSecondsCheck();
161
  }
162
- if(triggerMethod == 'percentage'){
163
  $(window).bind( 'scroll', triggerHeightCheck );
164
  // init, check box criteria once
165
  triggerHeightCheck();
166
  }
167
- if(triggerMethod == 'pixels'){
168
  $(window).bind( 'scroll', triggerPixelsCheck );
169
  // init, check box criteria once
170
  triggerPixelsCheck();
@@ -183,8 +196,8 @@ var SPU_master = function() {
183
  }
184
  }
185
  } /* end check cookie */
186
- //close popup
187
- $box.on('click','.spu-close-popup',function() {
188
 
189
  // hide box
190
  toggleBox( id, false, false );
@@ -198,7 +211,7 @@ var SPU_master = function() {
198
 
199
  // add link listener for this box
200
  $(document.body).on('click','a[href="#spu-' + id +'"], .spu-open-' + id ,function(e) {
201
- e.preventDefault();
202
  toggleBox(id, true, false);
203
  });
204
  $('a[href="#spu-' + id +'"], .spu-open-' + id).css('cursor','pointer').addClass('spu-clickable');
@@ -210,101 +223,107 @@ var SPU_master = function() {
210
  // same for newsletter plugin
211
  $box.find('.newsletter form').addClass('newsletter-form');
212
 
213
- // check if we have forms and perform different actions
214
- var box_form = $box.find('form');
215
- if( box_form.length ) {
216
- // Only if form is not a known one disable ajax
217
- if( ! box_form.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form") ) {
218
- var action = box_form.attr('action'),
219
- pattern = new RegExp(spuvar.site_url, "i");
220
- if (action && action.length) {
221
- if (!pattern.test(action))
222
- box_form.addClass('spu-disable-ajax');
223
- }
224
- }
225
- // if spu-disable-ajax is on container add it to form (usp forms for example)
226
- if( $('.spu-disable-ajax form').length ) {
227
- $('.spu-disable-ajax form').addClass('spu-disable-ajax');
228
- }
229
- // Disable ajax on form by adding .spu-disable-ajax class to it
230
- $box.on('submit','form.spu-disable-ajax:not(".flp_form")', function(){
231
 
232
- $box.trigger('spu.form_submitted', [id]);
233
- toggleBox(id, false, true );
234
- });
235
 
236
- // Add generic form tracking
237
- $box.on('submit','form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")', function(e){
238
- e.preventDefault();
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
- var submit = true,
242
- form = $(this),
243
- data = form.serialize(),
244
- url = form.hasClass('mc4wp-form') ? spuvar.site_url +'/' : form.attr('action'),
245
- error_cb = function (data, error, errorThrown){
246
- console.log('Spu Form error: ' + error + ' - ' + errorThrown);
247
- },
248
- success_cb = function (data){
249
 
250
- var response = $(data).filter('#spu-'+ id ).html();
251
- $('#spu-' + id ).html(response);
252
 
253
- // check if an error was returned for m4wp
254
- if( ! $('#spu-' + id ).find('.mc4wp-alert').length ) {
255
 
256
- // give 2 seconds for response
257
- setTimeout( function(){
258
 
259
- toggleBox(id, false, true );
260
 
261
- }, spuvar.seconds_confirmation_close * 1000);
 
262
 
263
- }
264
- };
265
- // Send form by ajax and replace popup with response
266
- request(data, url, success_cb, error_cb, 'html');
267
 
268
- $box.trigger('spu.form_submitted', [id]);
269
 
270
- return submit;
271
- });
272
 
273
- // CF7 support
274
- $(document).on('wpcf7mailsent', function(){
275
- $box.trigger('spu.form_submitted', [id]);
276
- toggleBox(id, false, true );
277
- });
278
 
279
- // Gravity forms support (only AJAX mode)
280
- if( box_form.hasClass('gravity-form') ) {
281
- box_form.attr('action', window.location.href)
282
  }
283
- $(document).on('gform_confirmation_loaded', function(){
284
- $box.trigger('spu.form_submitted', [id]);
285
- toggleBox(id, false, true );
286
- });
287
-
288
- // Infusion Software - not ajax
289
- $box.on('submit','.infusion-form', function(e){
290
- e.preventDefault();
291
- $box.trigger('spu.form_submitted', [id]);
292
- toggleBox(id, false, true );
293
- this.submit();
294
- });
295
- // The newsletter plugin - not ajax
296
- $box.on('submit','.newsletter-form', function(e){
297
- e.preventDefault();
298
- $box.trigger('spu.form_submitted', [id]);
299
- toggleBox(id, false, true );
300
- this.submit();
301
- });
302
  // Ninja form - popup not ajax, ajax on ninja form
303
  $('body').on('submitResponse.default', function(){
304
  $box.trigger('spu.form_submitted', [id]);
305
  toggleBox(id, false, true );
306
  });
307
- }
308
 
309
  // Ninja Forms 3 does not use a form element
310
  var box_nf3 = $box.find('.nf-form-cont');
@@ -316,11 +335,11 @@ var SPU_master = function() {
316
  // should this delay be a config option?
317
  setTimeout( function(){
318
  toggleBox(id, false, true );
319
- }, spuvar.seconds_confirmation_close * 1000);
320
  });
321
  }
322
 
323
- });
324
 
325
 
326
 
@@ -376,7 +395,7 @@ var SPU_master = function() {
376
  var $fblayout = $fbbox.find('.fb-like').data('layout');
377
  if( $fblayout == 'box_count' ) {
378
 
379
- $fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>');
380
 
381
  } else if( $fblayout == 'button_count' ) {
382
 
@@ -391,60 +410,60 @@ var SPU_master = function() {
391
  }
392
  }
393
 
394
- /**
395
- * Check all shortcodes and automatically center them
396
- * @param box
397
- */
398
- function centerShortcodes( box ){
399
- var $box = box;
400
- var total = $box.data('total'); //total of shortcodes used
401
- if( total ) { //if we have shortcodes
402
- SPU_reload_socials();
403
-
404
- //wrap them all
405
- //center spu-shortcodes
406
- var swidth = 0;
407
- var free_width = 0;
408
- var boxwidth = $box.outerWidth();
409
- var cwidth = $box.find(".spu-content").width();
410
- if (!spuvar.disable_style && $(window).width() > boxwidth) {
411
- $box.find(".spu-shortcode").wrapAll('<div class="spu_shortcodes"/>');
412
- //calculate total width of shortcodes all togheter
413
- $box.find(".spu-shortcode").each(function () {
414
- swidth = swidth + $(this).outerWidth();
415
- });
416
- //available space to split margins
417
- free_width = cwidth - swidth - (total*20);
418
 
419
- }
420
- if (free_width > 0) {
421
- //leave some margin
422
- $box.find(".spu-shortcode").each(function () {
423
 
424
- $(this).css('margin-left', (free_width / 2 ));
425
 
426
- });
427
- //remove margin when neccesary
428
- if (total == 2) {
429
 
430
- $box.find(".spu-shortcode").last().css('margin-left', 0);
431
 
432
- } else if (total == 3) {
433
 
434
- $box.find(".spu-shortcode").first().css('margin-left', 0);
435
 
436
- }
437
- }
438
- }
439
- }
440
- /**
441
- * Main function to show or hide the popup
442
- * @param id int box id
443
- * @param show boolean it's hiding or showing?
444
- * @param conversion boolean - Its a conversion or we are just closing
445
- * @returns {*}
446
- */
447
- function toggleBox( id, show, conversion ) {
448
  var $box = $boxes[id];
449
  var $bg = $('#spu-bg-'+id);
450
  var $bgopa = $box.data('bgopa');
@@ -462,24 +481,31 @@ var SPU_master = function() {
462
  //if we are closing , set cookie
463
  if( show === false) {
464
  // set cookie
465
- var days = parseFloat( $box.data('close-cookie') );
466
- if( conversion === true )
467
- days = parseFloat( $box.data('cookie') );
468
-
 
 
 
 
 
469
  if( days > 0 ) {
470
- spuCreateCookie( 'spu_box_' + id, true, days );
471
  }
472
- $box.trigger('spu.box_close', [id]);
473
  // check for videos inside and destroy it
474
- var iframe = $box.find('iframe[src*="vimeo"],iframe[src*="youtube"]');
475
  if( iframe && iframe.length ){
476
- $box.remove();
 
 
477
  }
478
  } else {
479
- setTimeout(function(){
480
- centerShortcodes($box);
481
- },1500);
482
- $box.trigger('spu.box_open', [id]);
483
  //bind for resize
484
  $(window).resize(function(){
485
 
@@ -487,48 +513,55 @@ var SPU_master = function() {
487
 
488
  });
489
  fixSize( id );
 
 
 
 
 
 
 
490
 
491
  }
492
 
493
  // show box
494
  var animation = $box.data('spuanimation'),
495
- conversion_close = $box.data('close-on-conversion');
496
 
497
 
498
- if (animation === 'fade') {
499
- if (show === true) {
500
- $box.fadeIn('slow');
501
- } else if (show === false && ( (conversion_close && conversion ) || !conversion )) {
502
- $box.fadeOut('slow');
503
- }
504
- }else if (animation === 'disable') {
505
- if (show === true ) {
506
- $box.show();
507
- } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
508
- $box.hide();
509
- }
510
- } else {
511
- if (show === true ) {
512
- $box.slideDown('slow');
513
- } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
514
- $box.slideUp('slow');
515
- }
516
- }
517
-
518
- //background
519
- if (show === true && $bgopa > 0) {
520
- if (animation === 'disable') {
521
- $bg.show();
522
- } else {
523
- $bg.fadeIn();
524
- }
525
- } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
526
- if (animation === 'disable') {
527
- $bg.hide();
528
- } else {
529
- $bg.fadeOut();
530
- }
531
- }
532
 
533
  return show;
534
  }
@@ -540,6 +573,9 @@ var SPU_master = function() {
540
  hide: function( box_id, show, conversion ) {
541
  return toggleBox( box_id, false, conversion );
542
  },
 
 
 
543
  request: function( data, url, success_cb, error_cb ) {
544
  return request( data, url, success_cb, error_cb );
545
  }
@@ -548,76 +584,76 @@ var SPU_master = function() {
548
  }
549
  if( spuvar.ajax_mode ) {
550
 
551
- var data = {
552
- pid : spuvar.pid,
553
- referrer : document.referrer,
554
- query_string : document.location.search,
555
- is_category : spuvar.is_category,
556
- is_archive : spuvar.is_archive,
557
  is_preview: spuvar.is_preview
558
- }
559
- ,success_cb = function(response) {
560
 
561
- $('body').append(response);
562
- $(".spu-box").imagesLoaded( function() {
563
- window.SPU = SPU_master();
564
- SPU_reload_forms(); //remove spu_Action from forms
565
- });
566
- },
567
- error_cb = function (data, error, errorThrown){
568
- console.log('Problem loading popups - error: ' + error + ' - ' + errorThrown);
569
- }
570
- request(data, spuvar.ajax_mode_url , success_cb, error_cb, 'html');
571
  } else {
572
  $(".spu-box").imagesLoaded( function(){
573
- window.SPU = SPU_master();
574
- });
575
  }
576
 
577
- /**
578
- * Ajax requests
579
- * @param data
580
- * @param url
581
- * @param success_cb
582
- * @param error_cb
583
- * @param dataType
584
- */
585
- function request(data, url, success_cb, error_cb, dataType){
586
- // Prepare variables.
587
- var ajax = {
588
- url: spuvar.ajax_url,
589
- data: data,
590
- cache: false,
591
- type: 'POST',
592
- dataType: 'json',
593
- timeout: 30000
594
- },
595
- dataType = dataType || false,
596
- success_cb = success_cb || false,
597
- error_cb = error_cb || false;
598
-
599
- // Set ajax url is supplied
600
- if ( url ) {
601
- ajax.url = url;
602
- }
603
- // Set success callback if supplied.
604
- if ( success_cb ) {
605
- ajax.success = success_cb;
606
- }
607
-
608
- // Set error callback if supplied.
609
- if ( error_cb ) {
610
- ajax.error = error_cb;
611
- }
612
-
613
- // Change dataType if supplied.
614
- if ( dataType ) {
615
- ajax.dataType = dataType;
616
- }
617
- // Make the ajax request.
618
- $.ajax(ajax);
619
-
620
- }
621
  /**
622
  * Cookie functions
623
  */
@@ -654,24 +690,24 @@ var FbTimer = setInterval(function(){
654
  },1000);
655
 
656
  if ( typeof twttr !== 'undefined') {
657
- try{
658
- twttr.ready(function(twttr) {
659
- twttr.events.bind('tweet', twitterCB);
660
- twttr.events.bind('follow', twitterCB);
661
- });
662
- }catch(ex){}
663
  }
664
 
665
 
666
  function subscribeFbEvent(){
667
- try {
668
- FB.Event.subscribe('edge.create', function (href, html_element) {
669
- var box_id = $(html_element).parents('.spu-box').data('box-id');
670
- if (box_id) {
671
- SPU.hide(box_id, false, true);
672
- }
673
- });
674
- }catch(ex){}
675
  SPUfb = true;
676
  clearInterval(FbTimer);
677
  }
@@ -712,25 +748,25 @@ function SPU_reload_socials(){
712
  }catch(ex){}
713
  }
714
  if( typeof spuvar_social != 'undefined' && spuvar_social.google){
715
- try {
716
- // reload google
717
- gapi.plusone.go();
718
- }catch(ex){}
719
  }
720
  if( typeof spuvar_social != 'undefined' && spuvar_social.twitter ) {
721
- try {
722
- //reload twitter
723
- twttr.widgets.load();
724
- }catch(ex){}
725
  }
726
  }
727
  function SPU_reload_forms(){
728
  // Clear actions
729
  $('.spu-box form').each( function(){
730
  var action = $(this).attr('action');
731
- if( action ){
732
- $(this).attr('action' , action.replace('?spu_action=spu_load',''));
733
- }
734
  });
735
  if ($.fn.wpcf7InitForm) {
736
  $('.spu-box div.wpcf7 > form').wpcf7InitForm();
6
  (function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
7
 
8
  (function($){
9
+ "use strict";
10
 
11
  var SPU_master = function() {
12
 
27
  // loop through boxes
28
  $(".spu-box").each(function() {
29
 
 
 
 
 
 
 
 
30
  // vars
31
  var $box = $(this);
32
  var triggerMethod = $box.data('trigger');
40
  var triggerHeight = ( triggerPercentage * $(document).height() );
41
 
42
  facebookFix( $box );
43
+
44
+ // search for youtube, vimeo videos
45
+ var iframe = $box.find('iframe[src*="vimeo"],iframe[src*="youtube"],iframe[src*="youtu.be"]');
46
+ if( iframe && iframe.length) {
47
+ iframe.each(function () {
48
+ $(this).attr('spusrc',$(this).attr('src'));
49
+ $(this).attr('src','http://#');
50
+ })
51
+ }
52
  // Custom links conversion
53
  $box.on('click', 'a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close, .spu-not-close a")', function(){
54
  // hide the popup and track conversion
80
  });
81
 
82
  //hide boxes and remove left-99999px we cannot since beggining of facebook won't display
83
+ $box.hide().css('left','').css('right','');
84
 
85
  // add box to global boxes array
86
  $boxes[id] = $box;
152
  }, triggerSeconds * 1000);
153
  }
154
 
155
+
156
+
157
+
158
  // show box if cookie not set or if in test mode
159
+ //var cookieValue = spuReadCookie( 'spu_box_' + id );
160
+
161
+ var nclose_cookie = $box.data('nclose-cookie');
162
+ var nconvert_cookie = $box.data('nconvert-cookie');
163
+
164
+ var cookieValue1 = spuReadCookie( nclose_cookie );
165
+ var cookieValue2 = spuReadCookie( nconvert_cookie );
166
 
167
+ if( (
168
+ ( cookieValue1 == undefined || cookieValue1 == '' ) &&
169
+ ( cookieValue2 == undefined || cookieValue2 == '' )
170
+ ) || ( isAdmin && testMode ) || isPreview ) {
171
 
172
  if(triggerMethod == 'seconds') {
173
  triggerSecondsCheck();
174
  }
175
+ if(triggerMethod == 'percentage'){
176
  $(window).bind( 'scroll', triggerHeightCheck );
177
  // init, check box criteria once
178
  triggerHeightCheck();
179
  }
180
+ if(triggerMethod == 'pixels'){
181
  $(window).bind( 'scroll', triggerPixelsCheck );
182
  // init, check box criteria once
183
  triggerPixelsCheck();
196
  }
197
  }
198
  } /* end check cookie */
199
+ //close popup
200
+ $box.on('click','.spu-close-popup',function() {
201
 
202
  // hide box
203
  toggleBox( id, false, false );
211
 
212
  // add link listener for this box
213
  $(document.body).on('click','a[href="#spu-' + id +'"], .spu-open-' + id ,function(e) {
214
+ e.preventDefault();
215
  toggleBox(id, true, false);
216
  });
217
  $('a[href="#spu-' + id +'"], .spu-open-' + id).css('cursor','pointer').addClass('spu-clickable');
223
  // same for newsletter plugin
224
  $box.find('.newsletter form').addClass('newsletter-form');
225
 
226
+ // check if we have forms and perform different actions
227
+ var box_form = $box.find('form');
228
+ if( box_form.length ) {
229
+ // Only if form is not a known one disable ajax
230
+ if( ! box_form.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form") ) {
231
+ var action = box_form.attr('action'),
232
+ pattern = new RegExp(spuvar.site_url, "i");
233
+ if (action && action.length) {
234
+ if (!pattern.test(action))
235
+ box_form.addClass('spu-disable-ajax');
236
+ }
237
+ }
238
+ // if spu-disable-ajax is on container add it to form (usp forms for example)
239
+ if( $('.spu-disable-ajax form').length ) {
240
+ $('.spu-disable-ajax form').addClass('spu-disable-ajax');
241
+ }
242
+ // Disable ajax on form by adding .spu-disable-ajax class to it
243
+ $box.on('submit','form.spu-disable-ajax:not(".flp_form")', function(){
244
 
245
+ $box.trigger('spu.form_submitted', [id]);
246
+ toggleBox(id, false, true );
247
+ });
248
 
249
+ // Add generic form tracking
250
+ $box.on('submit','form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")', function(e){
251
+ e.preventDefault();
252
 
253
+ var submit = true,
254
+ form = $(this),
255
+ button = form.find('input[type="submit"]'),
256
+ tail = button ? button.attr('name')+'='+button.val() : 'button=send',
257
+ data = form.serialize()+"&"+tail,
258
+ referer = form.find('input[name="_wp_http_referer"]'),
259
+ urlref = referer ? spuvar.site_url+referer.val() : window.location.href,
260
+ action = form.attr('action') ? form.attr('action') : urlref,
261
+ url = form.hasClass('mc4wp-form') ? spuvar.site_url +'/' : action,
262
+ error_cb = function (data, error, errorThrown){
263
+ console.log('Spu Form error: ' + error + ' - ' + errorThrown);
264
+ //console.log(data);
265
+ },
266
+ success_cb = function (data){
267
 
268
+ var response = $(data).filter('#spu-'+ id ).html();
269
+ $('#spu-' + id ).html(response);
 
 
 
 
 
 
270
 
271
+ // check if an error was returned for m4wp
272
+ if( ! $('#spu-' + id ).find('.mc4wp-alert').length ) {
273
 
274
+ // give 2 seconds for response
275
+ setTimeout( function(){
276
 
277
+ toggleBox(id, false, true );
 
278
 
279
+ }, spuvar.seconds_confirmation_close * 1000);
280
 
281
+ }
282
+ };
283
 
284
+ // Send form by ajax and replace popup with response
285
+ request(data, url, success_cb, error_cb, 'html');
 
 
286
 
287
+ $box.trigger('spu.form_submitted', [id]);
288
 
289
+ return submit;
290
+ });
291
 
292
+ // CF7 support
293
+ $(document).on('wpcf7mailsent', function(){
294
+ $box.trigger('spu.form_submitted', [id]);
295
+ toggleBox(id, false, true );
296
+ });
297
 
298
+ // Gravity forms support (only AJAX mode)
299
+ if( box_form.hasClass('gravity-form') ) {
300
+ box_form.attr('action', window.location.href)
301
  }
302
+ $(document).on('gform_confirmation_loaded', function(){
303
+ $box.trigger('spu.form_submitted', [id]);
304
+ toggleBox(id, false, true );
305
+ });
306
+
307
+ // Infusion Software - not ajax
308
+ $box.on('submit','.infusion-form', function(e){
309
+ e.preventDefault();
310
+ $box.trigger('spu.form_submitted', [id]);
311
+ toggleBox(id, false, true );
312
+ this.submit();
313
+ });
314
+ // The newsletter plugin - not ajax
315
+ $box.on('submit','.newsletter-form', function(e){
316
+ e.preventDefault();
317
+ $box.trigger('spu.form_submitted', [id]);
318
+ toggleBox(id, false, true );
319
+ this.submit();
320
+ });
321
  // Ninja form - popup not ajax, ajax on ninja form
322
  $('body').on('submitResponse.default', function(){
323
  $box.trigger('spu.form_submitted', [id]);
324
  toggleBox(id, false, true );
325
  });
326
+ }
327
 
328
  // Ninja Forms 3 does not use a form element
329
  var box_nf3 = $box.find('.nf-form-cont');
335
  // should this delay be a config option?
336
  setTimeout( function(){
337
  toggleBox(id, false, true );
338
+ }, spuvar.seconds_confirmation_close * 1000);
339
  });
340
  }
341
 
342
+ });
343
 
344
 
345
 
395
  var $fblayout = $fbbox.find('.fb-like').data('layout');
396
  if( $fblayout == 'box_count' ) {
397
 
398
+ $fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>');
399
 
400
  } else if( $fblayout == 'button_count' ) {
401
 
410
  }
411
  }
412
 
413
+ /**
414
+ * Check all shortcodes and automatically center them
415
+ * @param box
416
+ */
417
+ function centerShortcodes( box ){
418
+ var $box = box;
419
+ var total = $box.data('total'); //total of shortcodes used
420
+ if( total ) { //if we have shortcodes
421
+ SPU_reload_socials();
422
+
423
+ //wrap them all
424
+ //center spu-shortcodes
425
+ var swidth = 0;
426
+ var free_width = 0;
427
+ var boxwidth = $box.outerWidth();
428
+ var cwidth = $box.find(".spu-content").width();
429
+ if (!spuvar.disable_style && $(window).width() > boxwidth) {
430
+ $box.find(".spu-shortcode").wrapAll('<div class="spu_shortcodes"/>');
431
+ //calculate total width of shortcodes all togheter
432
+ $box.find(".spu-shortcode").each(function () {
433
+ swidth = swidth + $(this).outerWidth();
434
+ });
435
+ //available space to split margins
436
+ free_width = cwidth - swidth - (total*20);
437
 
438
+ }
439
+ if (free_width > 0) {
440
+ //leave some margin
441
+ $box.find(".spu-shortcode").each(function () {
442
 
443
+ $(this).css('margin-left', (free_width / 2 ));
444
 
445
+ });
446
+ //remove margin when neccesary
447
+ if (total == 2) {
448
 
449
+ $box.find(".spu-shortcode").last().css('margin-left', 0);
450
 
451
+ } else if (total == 3) {
452
 
453
+ $box.find(".spu-shortcode").first().css('margin-left', 0);
454
 
455
+ }
456
+ }
457
+ }
458
+ }
459
+ /**
460
+ * Main function to show or hide the popup
461
+ * @param id int box id
462
+ * @param show boolean it's hiding or showing?
463
+ * @param conversion boolean - Its a conversion or we are just closing
464
+ * @returns {*}
465
+ */
466
+ function toggleBox( id, show, conversion ) {
467
  var $box = $boxes[id];
468
  var $bg = $('#spu-bg-'+id);
469
  var $bgopa = $box.data('bgopa');
481
  //if we are closing , set cookie
482
  if( show === false) {
483
  // set cookie
484
+ //var days = parseFloat( $box.data('close-cookie') );
485
+ var days = parseFloat( $box.data('dclose-cookie') );
486
+ var ncookie = $box.data('nclose-cookie');
487
+
488
+ if( conversion === true ) {
489
+ days = parseFloat( $box.data('dconvert-cookie') );
490
+ ncookie = $box.data('nconvert-cookie');
491
+ }
492
+
493
  if( days > 0 ) {
494
+ spuCreateCookie( ncookie, true, days );
495
  }
496
+ $box.trigger('spu.box_close', [id]);
497
  // check for videos inside and destroy it
498
+ var iframe = $box.find('iframe[src*="vimeo"],iframe[src*="youtube"],iframe[src*="youtu.be"]');
499
  if( iframe && iframe.length ){
500
+ iframe.each(function () {
501
+ $(this).attr('src','http://#');
502
+ });
503
  }
504
  } else {
505
+ setTimeout(function(){
506
+ centerShortcodes($box);
507
+ },1500);
508
+ $box.trigger('spu.box_open', [id]);
509
  //bind for resize
510
  $(window).resize(function(){
511
 
513
 
514
  });
515
  fixSize( id );
516
+ var iframe = $box.find('iframe');
517
+ if( iframe && iframe.length ){
518
+ iframe.each(function () {
519
+ if( $(this).attr('spusrc') )
520
+ $(this).attr('src',$(this).attr('spusrc'));
521
+ });
522
+ }
523
 
524
  }
525
 
526
  // show box
527
  var animation = $box.data('spuanimation'),
528
+ conversion_close = $box.data('close-on-conversion');
529
 
530
 
531
+ if (animation === 'fade') {
532
+ if (show === true) {
533
+ $box.fadeIn('slow');
534
+ } else if (show === false && ( (conversion_close && conversion ) || !conversion )) {
535
+ $box.fadeOut('slow');
536
+ }
537
+ }else if (animation === 'disable') {
538
+ if (show === true ) {
539
+ $box.show();
540
+ } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
541
+ $box.hide();
542
+ }
543
+ } else {
544
+ if (show === true ) {
545
+ $box.slideDown('slow');
546
+ } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
547
+ $box.slideUp('slow');
548
+ }
549
+ }
550
+
551
+ //background
552
+ if (show === true && $bgopa > 0) {
553
+ if (animation === 'disable') {
554
+ $bg.show();
555
+ } else {
556
+ $bg.fadeIn();
557
+ }
558
+ } else if (show === false && ( (conversion_close && conversion ) || !conversion ) ) {
559
+ if (animation === 'disable') {
560
+ $bg.hide();
561
+ } else {
562
+ $bg.fadeOut();
563
+ }
564
+ }
565
 
566
  return show;
567
  }
573
  hide: function( box_id, show, conversion ) {
574
  return toggleBox( box_id, false, conversion );
575
  },
576
+ resize: function (box_id) {
577
+ return fixSize( box_id );
578
+ },
579
  request: function( data, url, success_cb, error_cb ) {
580
  return request( data, url, success_cb, error_cb );
581
  }
584
  }
585
  if( spuvar.ajax_mode ) {
586
 
587
+ var data = {
588
+ pid : spuvar.pid,
589
+ referrer : document.referrer,
590
+ query_string : document.location.search,
591
+ is_category : spuvar.is_category,
592
+ is_archive : spuvar.is_archive,
593
  is_preview: spuvar.is_preview
594
+ }
595
+ ,success_cb = function(response) {
596
 
597
+ $('body').append(response);
598
+ $(".spu-box").imagesLoaded( function() {
599
+ window.SPU = SPU_master();
600
+ SPU_reload_forms(); //remove spu_Action from forms
601
+ });
602
+ },
603
+ error_cb = function (data, error, errorThrown){
604
+ console.log('Problem loading popups - error: ' + error + ' - ' + errorThrown);
605
+ }
606
+ request(data, spuvar.ajax_mode_url , success_cb, error_cb, 'html');
607
  } else {
608
  $(".spu-box").imagesLoaded( function(){
609
+ window.SPU = SPU_master();
610
+ });
611
  }
612
 
613
+ /**
614
+ * Ajax requests
615
+ * @param data
616
+ * @param url
617
+ * @param success_cb
618
+ * @param error_cb
619
+ * @param dataType
620
+ */
621
+ function request(data, url, success_cb, error_cb, dataType){
622
+ // Prepare variables.
623
+ var ajax = {
624
+ url: spuvar.ajax_url,
625
+ data: data,
626
+ cache: false,
627
+ type: 'POST',
628
+ dataType: 'json',
629
+ timeout: 30000
630
+ },
631
+ dataType = dataType || false,
632
+ success_cb = success_cb || false,
633
+ error_cb = error_cb || false;
634
+
635
+ // Set ajax url is supplied
636
+ if ( url ) {
637
+ ajax.url = url;
638
+ }
639
+ // Set success callback if supplied.
640
+ if ( success_cb ) {
641
+ ajax.success = success_cb;
642
+ }
643
+
644
+ // Set error callback if supplied.
645
+ if ( error_cb ) {
646
+ ajax.error = error_cb;
647
+ }
648
+
649
+ // Change dataType if supplied.
650
+ if ( dataType ) {
651
+ ajax.dataType = dataType;
652
+ }
653
+ // Make the ajax request.
654
+ $.ajax(ajax);
655
+
656
+ }
657
  /**
658
  * Cookie functions
659
  */
690
  },1000);
691
 
692
  if ( typeof twttr !== 'undefined') {
693
+ try{
694
+ twttr.ready(function(twttr) {
695
+ twttr.events.bind('tweet', twitterCB);
696
+ twttr.events.bind('follow', twitterCB);
697
+ });
698
+ }catch(ex){}
699
  }
700
 
701
 
702
  function subscribeFbEvent(){
703
+ try {
704
+ FB.Event.subscribe('edge.create', function (href, html_element) {
705
+ var box_id = $(html_element).parents('.spu-box').data('box-id');
706
+ if (box_id) {
707
+ SPU.hide(box_id, false, true);
708
+ }
709
+ });
710
+ }catch(ex){}
711
  SPUfb = true;
712
  clearInterval(FbTimer);
713
  }
748
  }catch(ex){}
749
  }
750
  if( typeof spuvar_social != 'undefined' && spuvar_social.google){
751
+ try {
752
+ // reload google
753
+ gapi.plusone.go();
754
+ }catch(ex){}
755
  }
756
  if( typeof spuvar_social != 'undefined' && spuvar_social.twitter ) {
757
+ try {
758
+ //reload twitter
759
+ twttr.widgets.load();
760
+ }catch(ex){}
761
  }
762
  }
763
  function SPU_reload_forms(){
764
  // Clear actions
765
  $('.spu-box form').each( function(){
766
  var action = $(this).attr('action');
767
+ if( action ){
768
+ $(this).attr('action' , action.replace('?spu_action=spu_load',''));
769
+ }
770
  });
771
  if ($.fn.wpcf7InitForm) {
772
  $('.spu-box div.wpcf7 > form').wpcf7InitForm();
public/class-social-popup.php CHANGED
@@ -395,16 +395,11 @@ class SocialPopup {
395
  */
396
  public function register_scripts() {
397
 
398
- $js_url = plugins_url( 'assets/js/min/public-min.js', __FILE__ );
399
  $handle = 'spu-public';
400
 
401
  $opts = $this->spu_settings;
402
 
403
- if( defined( 'SPU_DEBUG_MODE' ) || !empty( $opts['debug'] ) ) {
404
- $js_url = plugins_url( 'assets/js/public.js', __FILE__ );
405
- $handle = 'spu-public-debug';
406
- }
407
-
408
  wp_register_style( 'spu-public-css', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
409
 
410
  wp_register_script( $handle, $js_url, array( 'jquery' ), self::VERSION, true );
@@ -485,16 +480,12 @@ class SocialPopup {
485
 
486
  $opts = $this->spu_settings;
487
 
488
- if( defined( 'SPU_DEBUG_MODE' ) || !empty( $opts['debug'] ) ) {
489
- $handle = 'spu-public-debug';
490
- }
491
  wp_enqueue_script($handle);
492
  wp_enqueue_style('spu-public-css');
493
  wp_localize_script( $handle, 'spuvar',
494
  array(
495
  'is_admin' => current_user_can( apply_filters( 'spu/capabilities/testmode', 'administrator' ) ),
496
  'disable_style' => isset( $this->spu_settings['shortcodes_style'] ) ? esc_attr( $this->spu_settings['shortcodes_style'] ) : '',
497
- 'safe_mode' => isset( $this->spu_settings['safe'] ) ? esc_attr( $this->spu_settings['safe'] ) : '',
498
  'ajax_mode' => isset( $this->spu_settings['ajax_mode'] ) ? esc_attr( $this->spu_settings['ajax_mode'] ) :'',
499
  'ajax_url' => admin_url('admin-ajax.php'),
500
  'ajax_mode_url' => site_url('/?spu_action=spu_load&lang='.$this->info['wpml_lang']),
@@ -523,10 +514,6 @@ class SocialPopup {
523
 
524
  $handle = 'spu-public';
525
 
526
- if( defined( 'SPU_DEBUG_MODE' ) || !empty( $opts['debug'] ) ) {
527
- $handle = 'spu-public-debug';
528
- }
529
-
530
  // Check if any popup have facebook, then enqueue js
531
  if( $fb = $wpdb->get_var( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'spu_fb' " ) ) {
532
  // Check if defined or remove js in options
395
  */
396
  public function register_scripts() {
397
 
398
+ $js_url = plugins_url( 'assets/js/public.js', __FILE__ );
399
  $handle = 'spu-public';
400
 
401
  $opts = $this->spu_settings;
402
 
 
 
 
 
 
403
  wp_register_style( 'spu-public-css', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
404
 
405
  wp_register_script( $handle, $js_url, array( 'jquery' ), self::VERSION, true );
480
 
481
  $opts = $this->spu_settings;
482
 
 
 
 
483
  wp_enqueue_script($handle);
484
  wp_enqueue_style('spu-public-css');
485
  wp_localize_script( $handle, 'spuvar',
486
  array(
487
  'is_admin' => current_user_can( apply_filters( 'spu/capabilities/testmode', 'administrator' ) ),
488
  'disable_style' => isset( $this->spu_settings['shortcodes_style'] ) ? esc_attr( $this->spu_settings['shortcodes_style'] ) : '',
 
489
  'ajax_mode' => isset( $this->spu_settings['ajax_mode'] ) ? esc_attr( $this->spu_settings['ajax_mode'] ) :'',
490
  'ajax_url' => admin_url('admin-ajax.php'),
491
  'ajax_mode_url' => site_url('/?spu_action=spu_load&lang='.$this->info['wpml_lang']),
514
 
515
  $handle = 'spu-public';
516
 
 
 
 
 
517
  // Check if any popup have facebook, then enqueue js
518
  if( $fb = $wpdb->get_var( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'spu_fb' " ) ) {
519
  // Check if defined or remove js in options
public/includes/class-spu-rules.php CHANGED
@@ -431,14 +431,16 @@ class Spu_Rules
431
  {
432
 
433
  $post_id = $this->post_id;
 
 
434
 
435
  if($rule['operator'] == "==")
436
  {
437
- $match = ( $post_id == $rule['value'] );
438
  }
439
  elseif($rule['operator'] == "!=")
440
  {
441
- $match = ( $post_id != $rule['value'] );
442
  }
443
 
444
  return $match;
431
  {
432
 
433
  $post_id = $this->post_id;
434
+ // in case multiple ids are passed
435
+ $ids = array_map('trim',explode(',',$rule['value']));
436
 
437
  if($rule['operator'] == "==")
438
  {
439
+ $match = in_array($post_id, $ids );
440
  }
441
  elseif($rule['operator'] == "!=")
442
  {
443
+ $match = ! in_array($post_id, $ids );
444
  }
445
 
446
  return $match;
public/views/popup.php CHANGED
@@ -76,9 +76,9 @@ do_action( 'spu/popup/before_popup', $box, $opts, $css);
76
  <div class="spu-box <?php echo apply_filters( 'spu/popup/box_class', $box_class, $opts, $css, $box );?> spu-<?php echo esc_attr( $opts['css']['position'] ); ?> spu-total-<?php echo get_post_meta($box->ID, 'spu_social',true);?> <?php echo get_post_meta($box->ID, 'spu_google',true) ? 'spu-gogl' : '';?>" id="spu-<?php echo $box->ID; ?>"
77
  data-box-id="<?php echo $box->ID ; ?>" data-trigger="<?php echo esc_attr( $opts['trigger'] ); ?>"
78
  data-trigger-number="<?php echo esc_attr( absint( $opts['trigger_number'] ) ); ?>"
79
- data-spuanimation="<?php echo esc_attr($opts['animation']); ?>" data-cookie="<?php echo esc_attr( absint ( $opts['cookie'] ) ); ?>" data-close-cookie="<?php echo esc_attr( absint ( $opts['close-cookie'] ) ); ?>" data-test-mode="<?php echo esc_attr($opts['test_mode']); ?>"
80
  data-auto-hide="<?php echo esc_attr($opts['auto_hide']); ?>" data-close-on-conversion="<?php echo $opts['conversion_close'] == 1 ?'1':''; ?>" data-bgopa="<?php echo esc_attr($css['bgopacity']);?>" data-total="<?php echo get_post_meta($box->ID, 'spu_social',true);?>"
81
- style="left:-99999px !important;" data-width="<?php echo esc_attr(str_replace('px', '', $width)); ?>" <?php echo apply_filters( 'spu/popup/data_attrs', $data_attrs, $opts, $box );?>>
82
  <div class="spu-content"><?php echo $content; ?></div>
83
  <span class="spu-close spu-close-popup <?php echo esc_attr($css['close_position']); ?>"><i class="spu-icon spu-icon-close"></i></span>
84
  <span class="spu-timer"></span>
76
  <div class="spu-box <?php echo apply_filters( 'spu/popup/box_class', $box_class, $opts, $css, $box );?> spu-<?php echo esc_attr( $opts['css']['position'] ); ?> spu-total-<?php echo get_post_meta($box->ID, 'spu_social',true);?> <?php echo get_post_meta($box->ID, 'spu_google',true) ? 'spu-gogl' : '';?>" id="spu-<?php echo $box->ID; ?>"
77
  data-box-id="<?php echo $box->ID ; ?>" data-trigger="<?php echo esc_attr( $opts['trigger'] ); ?>"
78
  data-trigger-number="<?php echo esc_attr( absint( $opts['trigger_number'] ) ); ?>"
79
+ data-spuanimation="<?php echo esc_attr($opts['animation']); ?>" data-dconvert-cookie="<?php echo esc_attr( absint ( $opts['duration-convert-cookie'] ) ); ?>" data-dclose-cookie="<?php echo esc_attr( absint ( $opts['duration-close-cookie'] ) ); ?>" data-nconvert-cookie="<?php echo esc_attr( $opts['name-convert-cookie'] ); ?>" data-nclose-cookie="<?php echo esc_attr( $opts['name-close-cookie'] ); ?>" data-test-mode="<?php echo esc_attr($opts['test_mode']); ?>"
80
  data-auto-hide="<?php echo esc_attr($opts['auto_hide']); ?>" data-close-on-conversion="<?php echo $opts['conversion_close'] == 1 ?'1':''; ?>" data-bgopa="<?php echo esc_attr($css['bgopacity']);?>" data-total="<?php echo get_post_meta($box->ID, 'spu_social',true);?>"
81
+ style="left:-99999px !important;right:auto;" data-width="<?php echo esc_attr(str_replace('px', '', $width)); ?>" <?php echo apply_filters( 'spu/popup/data_attrs', $data_attrs, $opts, $box );?>>
82
  <div class="spu-content"><?php echo $content; ?></div>
83
  <span class="spu-close spu-close-popup <?php echo esc_attr($css['close_position']); ?>"><i class="spu-icon spu-icon-close"></i></span>
84
  <span class="spu-timer"></span>