Popups – WordPress Popup - Version 1.2.2.1

Version Description

  • Fixed bug when images where used on popup
  • Fixed bug with size of popup not working fine
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.2.2.1

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: timersys
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
4
  Tags: twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, popup, facebook popup, scroll popups, popups, wordpress popup, wp popups
5
  Requires at least: 3.6
6
- Tested up to: 4.0
7
- Stable tag: 1.2.2
8
  Text Domain: spucpt
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -102,6 +102,11 @@ Yes if you need to debug you can use uncompressed javascript by addings ([this c
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
105
  = 1.2.2 =
106
 
107
  * Fixed compability with events calendar
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
4
  Tags: twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, popup, facebook popup, scroll popups, popups, wordpress popup, wp popups
5
  Requires at least: 3.6
6
+ Tested up to: 4.0.1
7
+ Stable tag: 1.2.2.1
8
  Text Domain: spucpt
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
102
 
103
  == Changelog ==
104
 
105
+ = 1.2.2.1 =
106
+
107
+ * Fixed bug when images where used on popup
108
+ * Fixed bug with size of popup not working fine
109
+
110
  = 1.2.2 =
111
 
112
  * Fixed compability with events calendar
admin/class-social-popup-admin.php CHANGED
@@ -213,7 +213,7 @@ class SocialPopup_Admin {
213
 
214
  if ( isset( $_POST['spu_nonce'] ) && wp_verify_nonce( $_POST['spu_nonce'], 'spu_save_settings' ) ) {
215
 
216
- update_option( 'spu_settings' , esc_sql( $_POST['spu_settings'] ) );
217
 
218
  }
219
  $opts = apply_filters('spu/settings_page/opts', get_option( 'spu_settings' ) );
213
 
214
  if ( isset( $_POST['spu_nonce'] ) && wp_verify_nonce( $_POST['spu_nonce'], 'spu_save_settings' ) ) {
215
 
216
+ update_option( 'spu_settings' , esc_sql( @$_POST['spu_settings'] ) );
217
 
218
  }
219
  $opts = apply_filters('spu/settings_page/opts', get_option( 'spu_settings' ) );
admin/views/settings-page.php CHANGED
@@ -12,7 +12,7 @@
12
  <tr valign="top" class="">
13
  <th><label for="debug"><?php _e( 'Enable Debug mode?', $this->plugin_slug ); ?></label></th>
14
  <td colspan="3">
15
- <label><input type="checkbox" id="debug" name="spu_settings[debug]" value="1" <?php checked($opts['debug'], 1); ?> />
16
  <p class="help"><?php _e( 'Will use uncompressed js', $this->plugin_slug ); ?></p>
17
  </td>
18
 
@@ -20,7 +20,7 @@
20
  <tr valign="top" class="">
21
  <th><label for="safe"><?php _e( 'Enable safe mode?', $this->plugin_slug ); ?></label></th>
22
  <td colspan="3">
23
- <label><input type="checkbox" id="safe" name="spu_settings[safe]" value="1" <?php checked($opts['safe'], 1); ?> />
24
  <p class="help"><?php _e( 'Will move all popups to top of the screen.', $this->plugin_slug ); ?></p>
25
  </td>
26
 
@@ -28,7 +28,7 @@
28
  <tr valign="top" class="">
29
  <th><label for="style"><?php _e( 'Remove shortcodes style', $this->plugin_slug ); ?></label></th>
30
  <td colspan="3">
31
- <label><input type="checkbox" id="style" name="spu_settings[shortcodes_style]" value="1" <?php checked($opts['shortcodes_style'], 1); ?> />
32
  <p class="help"><?php _e( 'By default the plugin will apply some style to shortcodes. Check here if you want to manually style them', $this->plugin_slug ); ?></p>
33
  </td>
34
 
@@ -36,7 +36,7 @@
36
  <tr valign="top" class="">
37
  <th><label for="style"><?php _e( 'Unload Facebook javascript', $this->plugin_slug ); ?></label></th>
38
  <td colspan="3">
39
- <label><input type="checkbox" id="style" name="spu_settings[facebook]" value="1" <?php checked($opts['facebook'], 1); ?> />
40
  <p class="help"><?php _e( 'If you use your own Facebook script, check this', $this->plugin_slug ); ?></p>
41
  </td>
42
 
@@ -44,7 +44,7 @@
44
  <tr valign="top" class="">
45
  <th><label for="style"><?php _e( 'Unload Google javascript', $this->plugin_slug ); ?></label></th>
46
  <td colspan="3">
47
- <label><input type="checkbox" id="style" name="spu_settings[google]" value="1" <?php checked($opts['google'], 1); ?> />
48
  <p class="help"><?php _e( 'If you use your own Google script, check this', $this->plugin_slug ); ?></p>
49
  </td>
50
 
@@ -52,7 +52,7 @@
52
  <tr valign="top" class="">
53
  <th><label for="style"><?php _e( 'Unload Twitter javascript', $this->plugin_slug ); ?></label></th>
54
  <td colspan="3">
55
- <label><input type="checkbox" id="style" name="spu_settings[twitter]" value="1" <?php checked($opts['twitter'], 1); ?> />
56
  <p class="help"><?php _e( 'If you use your own Twitter script, check this', $this->plugin_slug ); ?></p>
57
  </td>
58
 
12
  <tr valign="top" class="">
13
  <th><label for="debug"><?php _e( 'Enable Debug mode?', $this->plugin_slug ); ?></label></th>
14
  <td colspan="3">
15
+ <label><input type="checkbox" id="debug" name="spu_settings[debug]" value="1" <?php checked(@$opts['debug'], 1); ?> />
16
  <p class="help"><?php _e( 'Will use uncompressed js', $this->plugin_slug ); ?></p>
17
  </td>
18
 
20
  <tr valign="top" class="">
21
  <th><label for="safe"><?php _e( 'Enable safe mode?', $this->plugin_slug ); ?></label></th>
22
  <td colspan="3">
23
+ <label><input type="checkbox" id="safe" name="spu_settings[safe]" value="1" <?php checked(@$opts['safe'], 1); ?> />
24
  <p class="help"><?php _e( 'Will move all popups to top of the screen.', $this->plugin_slug ); ?></p>
25
  </td>
26
 
28
  <tr valign="top" class="">
29
  <th><label for="style"><?php _e( 'Remove shortcodes style', $this->plugin_slug ); ?></label></th>
30
  <td colspan="3">
31
+ <label><input type="checkbox" id="style" name="spu_settings[shortcodes_style]" value="1" <?php checked(@$opts['shortcodes_style'], 1); ?> />
32
  <p class="help"><?php _e( 'By default the plugin will apply some style to shortcodes. Check here if you want to manually style them', $this->plugin_slug ); ?></p>
33
  </td>
34
 
36
  <tr valign="top" class="">
37
  <th><label for="style"><?php _e( 'Unload Facebook javascript', $this->plugin_slug ); ?></label></th>
38
  <td colspan="3">
39
+ <label><input type="checkbox" id="style" name="spu_settings[facebook]" value="1" <?php checked(@$opts['facebook'], 1); ?> />
40
  <p class="help"><?php _e( 'If you use your own Facebook script, check this', $this->plugin_slug ); ?></p>
41
  </td>
42
 
44
  <tr valign="top" class="">
45
  <th><label for="style"><?php _e( 'Unload Google javascript', $this->plugin_slug ); ?></label></th>
46
  <td colspan="3">
47
+ <label><input type="checkbox" id="style" name="spu_settings[google]" value="1" <?php checked(@$opts['google'], 1); ?> />
48
  <p class="help"><?php _e( 'If you use your own Google script, check this', $this->plugin_slug ); ?></p>
49
  </td>
50
 
52
  <tr valign="top" class="">
53
  <th><label for="style"><?php _e( 'Unload Twitter javascript', $this->plugin_slug ); ?></label></th>
54
  <td colspan="3">
55
+ <label><input type="checkbox" id="style" name="spu_settings[twitter]" value="1" <?php checked(@$opts['twitter'], 1); ?> />
56
  <p class="help"><?php _e( 'If you use your own Twitter script, check this', $this->plugin_slug ); ?></p>
57
  </td>
58
 
popups.php CHANGED
@@ -11,7 +11,7 @@
11
  * @socialpopup
12
  * Plugin Name: Popups - WordPress Popup
13
  * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
- * Version: 1.2.2
15
  * Description: This plugin will display a popup or splash screen when a new user visit your site showing a Google+, twitter and facebook follow links. This will increase you followers ratio in a 40%. Popup will be close depending on your settings. Check readme.txt for full details.
16
  * Author: Damian Logghe
17
  * Author URI: http://wp.timersys.com
11
  * @socialpopup
12
  * Plugin Name: Popups - WordPress Popup
13
  * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
+ * Version: 1.2.2.1
15
  * Description: This plugin will display a popup or splash screen when a new user visit your site showing a Google+, twitter and facebook follow links. This will increase you followers ratio in a 40%. Popup will be close depending on your settings. Check readme.txt for full details.
16
  * Author: Damian Logghe
17
  * Author URI: http://wp.timersys.com
public/assets/js/min/public-min.js CHANGED
@@ -1 +1 @@
1
- function spuCreateCookie(t,i,e){if(e){var n=new Date;n.setTime(n.getTime()+24*e*60*60*1e3);var o="; expires="+n.toGMTString()}else var o="";document.cookie=t+"="+i+o+"; path=/"}function spuReadCookie(t){for(var i=t+"=",e=document.cookie.split(";"),n=0;n<e.length;n++){for(var o=e[n];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(i))return o.substring(i.length,o.length)}return null}function googleCB(t){if("on"==t.state){var i=jQuery(".spu-gogl").data("box-id");i&&SPU.hide(i)}}function closeGoogle(t){if("confirm"==t.type){var i=jQuery(".spu-gogl").data("box-id");i&&SPU.hide(i)}}window.SPU=function($){function t(t){var i=r[t],e=$(window).width(),n=$(window).height(),o=i.height(),a=i.width();i.css({position:"fixed",top:n/2-o/2,left:e/2-a/2})}function i(t){var i=$(t).find(".spu-facebook");if(i.length){var e=i.find(".fb-like > span").width();if(0==e){var n=i.find(".fb-like").data("layout");i.append("box_count"==n?'<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>":'<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 e(i,e){var n=r[i],o=$("#spu-bg-"+i),a=n.data("bgopa");if(n.is(":animated"))return!1;if(e===!0&&n.is(":visible")||e===!1&&n.is(":hidden"))return!1;if(e===!1){var s=parseInt(n.data("cookie"));s>0&&spuCreateCookie("spu_box_"+i,!0,s)}else n.hasClass("spu-centered")&&t(i);var d=n.data("spuanimation");return"fade"===d?n.fadeToggle("slow"):n.slideToggle("slow"),e===!0&&a>0?o.fadeIn():o.fadeOut(),e}function n(t,i,e,n){var o={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},e=e||!1,n=n||!1;i&&(o.url=i),e&&(o.success=e),n&&(o.error=n),$.ajax(o)}var o=$(window).height(),a=spuvar.is_admin,r=[];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 t=$(this),s=t.data("trigger"),d=0,u=1===parseInt(t.data("test-mode")),c=t.data("box-id"),f=1===parseInt(t.data("auto-hide")),p=parseInt(t.data("seconds-close")),l=parseInt(t.data("trigger-number"),10),h="percentage"==s?parseInt(t.data("trigger-number"),10)/100:.8,g=h*$(document).height();i(t),$(".spu-google").width($(".spu-google").width()-20),$(".spu-twitter").width($(".spu-twitter").width()-12);var w=0,m=0,b=$(this).find(".spu-content").width(),v=t.data("total");v&&!spuvar.disable_style&&($(this).find(".spu-shortcode").each(function(){w+=$(this).width()}),m=b-w),m>0&&($(this).find(".spu-shortcode").each(function(){3==v?$(this).css("margin-left",m/(v-1)):$(this).css("margin-left",m/2)}),2==v?$(this).find(".spu-shortcode").last().css("margin-left",0):3==v&&$(this).find(".spu-shortcode").first().css("margin-left",0)),$(document).keyup(function(t){27==t.keyCode&&e(c,!1)});var y=navigator.userAgent,x=y.match(/iPad/i)||y.match(/iPhone/i)?"touchstart":"click";$("body").on(x,function(t){t.which&&e(c,!1)}),$("body").on(x,".spu-box",function(t){t.stopPropagation()}),t.hide().css("left",""),r[c]=t;var _=function(){d&&clearTimeout(d),d=window.setTimeout(function(){var t=$(window).scrollTop(),i=t+o>=g;i?(f||$(window).unbind("scroll",_),e(c,!0)):e(c,!1)},100)},k=function(){d&&clearTimeout(d),d=window.setTimeout(function(){e(c,!0)},1e3*l)},T=spuReadCookie("spu_box_"+c);if((void 0==T||a&&u)&&("seconds"==s?k():($(window).bind("scroll",_),_()),window.location.hash&&window.location.hash.length>0)){var C=window.location.hash,P;C.substring(1)===t.attr("id")&&setTimeout(function(){e(c,!0)},100)}t.find(".spu-close").click(function(){e(c,!1),"percentage"==s&&$(window).unbind("scroll",_)}),$('a[href="#'+t.attr("id")+'"]').click(function(){return e(c,!0),!1}),t.find(".gform_wrapper form").addClass("gravity-form"),t.find('form:not(".wpcf7-form, .gravity-form")').submit(function(t){t.preventDefault();var i=!0,o=$(this),a=o.serialize(),r=o.attr("action"),s=function(t){var i=$(t).filter("#spu-"+c).html();$("#spu-"+c).html(i),setTimeout(function(){e(c,!1)},spuvar.seconds_confirmation_close)};return n(a,r,s,"","html"),i}),$("body").on("mailsent.wpcf7",function(){e(c,!1)}),$(document).on("gform_confirmation_loaded",function(){e(c,!1)})}),{show:function(t){return e(t,!0)},hide:function(t){return e(t,!1)},request:function(t,i,e,o){return n(t,i,e,o)}}}(window.jQuery),jQuery(function($){function t(){FB.Event.subscribe("edge.create",function(t,i){var e=$(i).parents(".spu-box").data("box-id");e&&(SPU.hide(e),SPU.track(e,!0))}),e=!0,clearInterval(n)}function i(t){var i=$(t.target).parents(".spu-box").data("box-id");i&&SPU.hide(i)}var e=!1,n=setInterval(function(){"undefined"==typeof FB||e||t()},1e3);"undefined"!=typeof twttr&&twttr.ready(function(t){t.events.bind("tweet",i),t.events.bind("follow",i)})});
1
+ function spuCreateCookie(t,i,e){if(e){var n=new Date;n.setTime(n.getTime()+24*e*60*60*1e3);var o="; expires="+n.toGMTString()}else var o="";document.cookie=t+"="+i+o+"; path=/"}function spuReadCookie(t){for(var i=t+"=",e=document.cookie.split(";"),n=0;n<e.length;n++){for(var o=e[n];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(i))return o.substring(i.length,o.length)}return null}function googleCB(t){if("on"==t.state){var i=jQuery(".spu-gogl").data("box-id");i&&SPU.hide(i)}}function closeGoogle(t){if("confirm"==t.type){var i=jQuery(".spu-gogl").data("box-id");i&&SPU.hide(i)}}jQuery(window).load(function(){window.SPU=function($){function t(t){var i=r[t],e=$(window).width(),n=$(window).height(),o=i.height(),a=i.width();i.css({position:"fixed",top:n/2-o/2,left:e/2-a/2})}function i(t){var i=$(t).find(".spu-facebook");if(i.length){var e=i.find(".fb-like > span").width();if(0==e){var n=i.find(".fb-like").data("layout");i.append("box_count"==n?'<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>":'<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 e(i,e){var n=r[i],o=$("#spu-bg-"+i),a=n.data("bgopa");if(n.is(":animated"))return!1;if(e===!0&&n.is(":visible")||e===!1&&n.is(":hidden"))return!1;if(e===!1){var s=parseInt(n.data("cookie"));s>0&&spuCreateCookie("spu_box_"+i,!0,s)}else n.hasClass("spu-centered")&&t(i);var d=n.data("spuanimation");return"fade"===d?n.fadeToggle("slow"):n.slideToggle("slow"),e===!0&&a>0?o.fadeIn():o.fadeOut(),e}function n(t,i,e,n){var o={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},e=e||!1,n=n||!1;i&&(o.url=i),e&&(o.success=e),n&&(o.error=n),$.ajax(o)}var o=$(window).height(),a=spuvar.is_admin,r=[];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 t=$(this),s=t.data("trigger"),d=0,u=1===parseInt(t.data("test-mode")),c=t.data("box-id"),f=1===parseInt(t.data("auto-hide")),p=parseInt(t.data("seconds-close")),l=parseInt(t.data("trigger-number"),10),h="percentage"==s?parseInt(t.data("trigger-number"),10)/100:.8,w=h*$(document).height();i(t),$(".spu-google").width($(".spu-google").width()-20),$(".spu-twitter").width($(".spu-twitter").width()-12);var g=0,m=0,b=t.width(),v=t.find(".spu-content").width(),y=t.data("total");y&&!spuvar.disable_style&&($(this).find(".spu-shortcode").each(function(){g+=$(this).width()}),m=v-g),m>0&&($(this).find(".spu-shortcode").each(function(){3==y?$(this).css("margin-left",m/(y-1)):$(this).css("margin-left",m/2)}),2==y?$(this).find(".spu-shortcode").last().css("margin-left",0):3==y&&$(this).find(".spu-shortcode").first().css("margin-left",0)),b>$(window).width()&&t.css("cssText","max-width:"+t.css("width")+";width:auto !important;"),$(document).keyup(function(t){27==t.keyCode&&e(c,!1)});var x=navigator.userAgent,_=x.match(/iPad/i)||x.match(/iPhone/i)?"touchstart":"click";$("body").on(_,function(t){t.which&&e(c,!1)}),$("body").on(_,".spu-box",function(t){t.stopPropagation()}),t.hide().css("left",""),r[c]=t;var k=function(){d&&clearTimeout(d),d=window.setTimeout(function(){var t=$(window).scrollTop(),i=t+o>=w;i?(f||$(window).unbind("scroll",k),e(c,!0)):e(c,!1)},100)},T=function(){d&&clearTimeout(d),d=window.setTimeout(function(){e(c,!0)},1e3*l)},C=spuReadCookie("spu_box_"+c);if((void 0==C||a&&u)&&("seconds"==s?T():($(window).bind("scroll",k),k()),window.location.hash&&window.location.hash.length>0)){var P=window.location.hash,I;P.substring(1)===t.attr("id")&&setTimeout(function(){e(c,!0)},100)}t.find(".spu-close").click(function(){e(c,!1),"percentage"==s&&$(window).unbind("scroll",k)}),$('a[href="#'+t.attr("id")+'"]').click(function(){return e(c,!0),!1}),t.find(".gform_wrapper form").addClass("gravity-form"),t.find('form:not(".wpcf7-form, .gravity-form")').submit(function(t){t.preventDefault();var i=!0,o=$(this),a=o.serialize(),r=o.attr("action"),s=function(t){var i=$(t).filter("#spu-"+c).html();$("#spu-"+c).html(i),setTimeout(function(){e(c,!1)},spuvar.seconds_confirmation_close)};return n(a,r,s,"","html"),i}),$("body").on("mailsent.wpcf7",function(){e(c,!1)}),$(document).on("gform_confirmation_loaded",function(){e(c,!1)})}),{show:function(t){return e(t,!0)},hide:function(t){return e(t,!1)},request:function(t,i,e,o){return n(t,i,e,o)}}}(window.jQuery)}),jQuery(function($){function t(){FB.Event.subscribe("edge.create",function(t,i){var e=$(i).parents(".spu-box").data("box-id");e&&(SPU.hide(e),SPU.track(e,!0))}),e=!0,clearInterval(n)}function i(t){var i=$(t.target).parents(".spu-box").data("box-id");i&&SPU.hide(i)}var e=!1,n=setInterval(function(){"undefined"==typeof FB||e||t()},1e3);"undefined"!=typeof twttr&&twttr.ready(function(t){t.events.bind("tweet",i),t.events.bind("follow",i)})});
public/assets/js/public.js CHANGED
@@ -1,3 +1,4 @@
 
1
 
2
  window.SPU = (function($) {
3
 
@@ -15,230 +16,236 @@
15
  'padding-bottom': 0
16
  });
17
 
18
- // loop through boxes
19
- $(".spu-box").each(function() {
20
 
21
- // move to parent in safe mode
22
- if( spuvar.safe_mode ){
23
 
24
- $(this).prependTo('body');
25
-
26
- }
27
 
28
- // vars
29
- var $box = $(this);
30
- var triggerMethod = $box.data('trigger');
31
- var timer = 0;
32
- var testMode = (parseInt($box.data('test-mode')) === 1);
33
- var id = $box.data('box-id');
34
- var autoHide = (parseInt($box.data('auto-hide')) === 1);
35
- var secondsClose = parseInt($box.data('seconds-close'));
36
- var triggerSeconds = parseInt( $box.data('trigger-number'), 10 );
37
- var triggerPercentage = ( triggerMethod == 'percentage' ) ? ( parseInt( $box.data('trigger-number'), 10 ) / 100 ) : 0.8;
38
- var triggerHeight = ( triggerPercentage * $(document).height() );
39
-
40
- facebookFix( $box );
41
- //correct widths of sharing icons
42
- $('.spu-google').width($('.spu-google').width()-20);
43
- $('.spu-twitter').width($('.spu-twitter').width()-12);
44
-
45
- //center spu-shortcodes
46
- var swidth = 0;
47
- var free_width = 0;
48
- var cwidth = $(this).find(".spu-content").width();
49
- var total = $box.data('total'); //total of shortcodes used
50
- if( total && ! spuvar.disable_style ){
51
-
52
- //calculate total width of shortcodes all togheter
53
- $(this).find(".spu-shortcode").each(function(){
54
- swidth = swidth + $(this).width();
55
- });
56
- //available space to split margins
57
- free_width = cwidth - swidth;
 
58
 
59
- }
60
- if( free_width > 0 ) {
61
- //leave some margin
62
- $(this).find(".spu-shortcode").each(function(){
63
- if( total == 3) {
64
 
65
- $(this).css('margin-left',(free_width / (total-1)));
66
-
67
- } else {
68
-
69
- $(this).css('margin-left',(free_width / 2 ));
70
-
71
- }
72
 
73
- });
74
- //remove margin when neccesary
75
- if( total == 2) {
76
 
77
- $(this).find(".spu-shortcode").last().css('margin-left',0);
78
 
79
- } else if( total == 3) {
80
 
81
- $(this).find(".spu-shortcode").first().css('margin-left',0);
82
-
 
83
  }
84
- }
85
 
86
-
87
- //close with esc
88
- $(document).keyup(function(e) {
89
- if (e.keyCode == 27) {
90
- toggleBox( id, false );
91
  }
92
- });
93
- //close on ipads // iphones
94
- var ua = navigator.userAgent,
95
- event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
96
-
97
- $('body').on(event, function (ev) {
98
- // test that event is user triggered and not programatically
99
- if( ev.which ) {
 
 
 
 
 
 
100
 
101
- toggleBox( id, false );
102
-
103
- }
104
- });
105
- //not on the box
106
- $('body' ).on(event,'.spu-box', function(event) {
107
- event.stopPropagation();
108
- });
109
 
110
- //hide boxes and remove left-99999px we cannot since beggining of facebook won't display
111
- $box.hide().css('left','');
112
 
113
- // add box to global boxes array
114
- $boxes[id] = $box;
115
 
116
- // functions that check % of height
117
- var triggerHeightCheck = function()
118
- {
119
- if(timer) {
120
- clearTimeout(timer);
121
- }
122
 
123
- timer = window.setTimeout(function() {
124
- var scrollY = $(window).scrollTop();
125
- var triggered = ((scrollY + windowHeight) >= triggerHeight);
126
 
127
- // show box when criteria for this box is matched
128
- if( triggered ) {
129
 
130
- // remove listen event if box shouldn't be hidden again
131
- if( ! autoHide ) {
132
- $(window).unbind('scroll', triggerHeightCheck);
 
 
 
 
 
133
  }
134
 
135
- toggleBox( id, true );
136
- } else {
137
- toggleBox( id, false );
 
 
 
 
138
  }
139
 
140
- }, 100);
141
- }
142
- // function that show popup after X secs
143
- var triggerSecondsCheck = function()
144
- {
145
- if(timer) {
146
- clearTimeout(timer);
147
  }
148
 
149
- timer = window.setTimeout(function() {
 
150
 
151
- toggleBox( id, true );
 
 
 
 
 
 
 
 
152
 
153
- }, triggerSeconds * 1000);
154
- }
155
 
156
- // show box if cookie not set or if in test mode
157
- var cookieValue = spuReadCookie( 'spu_box_' + id );
158
 
159
- if( cookieValue == undefined || ( isAdmin && testMode ) ) {
160
-
161
- if(triggerMethod == 'seconds') {
162
- triggerSecondsCheck();
163
- } else {
164
- $(window).bind( 'scroll', triggerHeightCheck );
165
- // init, check box criteria once
166
- triggerHeightCheck();
167
- }
168
-
169
- // shows the box when hash refers to a box
170
- if(window.location.hash && window.location.hash.length > 0) {
171
-
172
- var hash = window.location.hash;
173
- var $element;
174
-
175
- if( hash.substring(1) === $box.attr( 'id' ) ) {
176
- setTimeout(function() {
177
- toggleBox( id, true );
178
- }, 100);
179
  }
180
- }
181
- } /* end check cookie */
182
 
183
- $box.find(".spu-close").click(function() {
184
 
185
- // hide box
186
- toggleBox( id, false );
187
 
188
- if(triggerMethod == 'percentage') {
189
- // unbind
190
- $(window).unbind( 'scroll', triggerHeightCheck );
191
- }
192
-
193
- });
194
-
195
- // add link listener for this box
196
- $('a[href="#' + $box.attr('id') +'"]').click(function() {
197
 
198
- toggleBox(id, true);
199
- return false;
200
- });
 
 
 
201
 
202
- // add class to the gravity form if they exist within the box
203
- $box.find('.gform_wrapper form').addClass('gravity-form');
204
-
205
- // Add generic form tracking
206
- $box.find('form:not(".wpcf7-form, .gravity-form")').submit( function(e){
207
- e.preventDefault();
208
-
209
- var submit = true,
210
- form = $(this),
211
- data = form.serialize(),
212
- url = form.attr('action'),
213
- success_cb = function (data){
214
- var response = $(data).filter('#spu-'+ id ).html();
215
- $('#spu-' + id ).html(response);
216
- // give 2 seconds for response
217
- setTimeout( function(){
218
-
219
- toggleBox(id, false );
220
-
221
- }, spuvar.seconds_confirmation_close);
222
- }
223
- // Send form by ajax and replace popup with response
224
- request(data, url, success_cb, '', 'html');
225
-
226
- return submit;
227
- });
228
-
229
- // CF7 support
230
- $('body').on('mailsent.wpcf7', function(){
231
-
232
- toggleBox(id, false );
233
- });
234
-
235
- // Gravity forms support (only AJAX mode)
236
- $(document).on('gform_confirmation_loaded', function(){
237
-
238
- toggleBox(id, false );
239
- });
240
 
241
- });
 
242
 
243
  //function that center popup on screen
244
  function centerBox( id ) {
@@ -372,7 +379,7 @@
372
  }
373
 
374
  })(window.jQuery);
375
-
376
 
377
  /**
378
  * Cookie functions
1
+ jQuery(window).load(function() {
2
 
3
  window.SPU = (function($) {
4
 
16
  'padding-bottom': 0
17
  });
18
 
19
+ // loop through boxes
20
+ $(".spu-box").each(function() {
21
 
22
+ // move to parent in safe mode
23
+ if( spuvar.safe_mode ){
24
 
25
+ $(this).prependTo('body');
26
+
27
+ }
28
 
29
+ // vars
30
+ var $box = $(this);
31
+ var triggerMethod = $box.data('trigger');
32
+ var timer = 0;
33
+ var testMode = (parseInt($box.data('test-mode')) === 1);
34
+ var id = $box.data('box-id');
35
+ var autoHide = (parseInt($box.data('auto-hide')) === 1);
36
+ var secondsClose = parseInt($box.data('seconds-close'));
37
+ var triggerSeconds = parseInt( $box.data('trigger-number'), 10 );
38
+ var triggerPercentage = ( triggerMethod == 'percentage' ) ? ( parseInt( $box.data('trigger-number'), 10 ) / 100 ) : 0.8;
39
+ var triggerHeight = ( triggerPercentage * $(document).height() );
40
+
41
+ facebookFix( $box );
42
+ //correct widths of sharing icons
43
+ $('.spu-google').width($('.spu-google').width()-20);
44
+ $('.spu-twitter').width($('.spu-twitter').width()-12);
45
+
46
+ //center spu-shortcodes
47
+ var swidth = 0;
48
+ var free_width = 0;
49
+ var boxwidth = $box.width();
50
+ var cwidth = $box.find(".spu-content").width();
51
+ var total = $box.data('total'); //total of shortcodes used
52
+ if( total && ! spuvar.disable_style ){
53
+
54
+ //calculate total width of shortcodes all togheter
55
+ $(this).find(".spu-shortcode").each(function(){
56
+ swidth = swidth + $(this).width();
57
+ });
58
+ //available space to split margins
59
+ free_width = cwidth - swidth;
60
 
61
+ }
62
+ if( free_width > 0 ) {
63
+ //leave some margin
64
+ $(this).find(".spu-shortcode").each(function(){
65
+ if( total == 3) {
66
 
67
+ $(this).css('margin-left',(free_width / (total-1)));
68
+
69
+ } else {
70
+
71
+ $(this).css('margin-left',(free_width / 2 ));
72
+
73
+ }
74
 
75
+ });
76
+ //remove margin when neccesary
77
+ if( total == 2) {
78
 
79
+ $(this).find(".spu-shortcode").last().css('margin-left',0);
80
 
81
+ } else if( total == 3) {
82
 
83
+ $(this).find(".spu-shortcode").first().css('margin-left',0);
84
+
85
+ }
86
  }
 
87
 
88
+ // Check if box width is less that window
89
+ if( boxwidth > $(window).width() ){
90
+ $box.css('cssText', 'max-width:'+$box.css('width')+';width:auto !important;');
 
 
91
  }
92
+
93
+ //close with esc
94
+ $(document).keyup(function(e) {
95
+ if (e.keyCode == 27) {
96
+ toggleBox( id, false );
97
+ }
98
+ });
99
+ //close on ipads // iphones
100
+ var ua = navigator.userAgent,
101
+ event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
102
+
103
+ $('body').on(event, function (ev) {
104
+ // test that event is user triggered and not programatically
105
+ if( ev.which ) {
106
 
107
+ toggleBox( id, false );
108
+
109
+ }
110
+ });
111
+ //not on the box
112
+ $('body' ).on(event,'.spu-box', function(event) {
113
+ event.stopPropagation();
114
+ });
115
 
116
+ //hide boxes and remove left-99999px we cannot since beggining of facebook won't display
117
+ $box.hide().css('left','');
118
 
119
+ // add box to global boxes array
120
+ $boxes[id] = $box;
121
 
122
+ // functions that check % of height
123
+ var triggerHeightCheck = function()
124
+ {
125
+ if(timer) {
126
+ clearTimeout(timer);
127
+ }
128
 
129
+ timer = window.setTimeout(function() {
130
+ var scrollY = $(window).scrollTop();
131
+ var triggered = ((scrollY + windowHeight) >= triggerHeight);
132
 
133
+ // show box when criteria for this box is matched
134
+ if( triggered ) {
135
 
136
+ // remove listen event if box shouldn't be hidden again
137
+ if( ! autoHide ) {
138
+ $(window).unbind('scroll', triggerHeightCheck);
139
+ }
140
+
141
+ toggleBox( id, true );
142
+ } else {
143
+ toggleBox( id, false );
144
  }
145
 
146
+ }, 100);
147
+ }
148
+ // function that show popup after X secs
149
+ var triggerSecondsCheck = function()
150
+ {
151
+ if(timer) {
152
+ clearTimeout(timer);
153
  }
154
 
155
+ timer = window.setTimeout(function() {
156
+
157
+ toggleBox( id, true );
158
+
159
+ }, triggerSeconds * 1000);
 
 
160
  }
161
 
162
+ // show box if cookie not set or if in test mode
163
+ var cookieValue = spuReadCookie( 'spu_box_' + id );
164
 
165
+ if( cookieValue == undefined || ( isAdmin && testMode ) ) {
166
+
167
+ if(triggerMethod == 'seconds') {
168
+ triggerSecondsCheck();
169
+ } else {
170
+ $(window).bind( 'scroll', triggerHeightCheck );
171
+ // init, check box criteria once
172
+ triggerHeightCheck();
173
+ }
174
 
175
+ // shows the box when hash refers to a box
176
+ if(window.location.hash && window.location.hash.length > 0) {
177
 
178
+ var hash = window.location.hash;
179
+ var $element;
180
 
181
+ if( hash.substring(1) === $box.attr( 'id' ) ) {
182
+ setTimeout(function() {
183
+ toggleBox( id, true );
184
+ }, 100);
185
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
+ } /* end check cookie */
 
188
 
189
+ $box.find(".spu-close").click(function() {
190
 
191
+ // hide box
192
+ toggleBox( id, false );
193
 
194
+ if(triggerMethod == 'percentage') {
195
+ // unbind
196
+ $(window).unbind( 'scroll', triggerHeightCheck );
197
+ }
198
+
199
+ });
 
 
 
200
 
201
+ // add link listener for this box
202
+ $('a[href="#' + $box.attr('id') +'"]').click(function() {
203
+
204
+ toggleBox(id, true);
205
+ return false;
206
+ });
207
 
208
+ // add class to the gravity form if they exist within the box
209
+ $box.find('.gform_wrapper form').addClass('gravity-form');
210
+
211
+ // Add generic form tracking
212
+ $box.find('form:not(".wpcf7-form, .gravity-form")').submit( function(e){
213
+ e.preventDefault();
214
+
215
+ var submit = true,
216
+ form = $(this),
217
+ data = form.serialize(),
218
+ url = form.attr('action'),
219
+ success_cb = function (data){
220
+ var response = $(data).filter('#spu-'+ id ).html();
221
+ $('#spu-' + id ).html(response);
222
+ // give 2 seconds for response
223
+ setTimeout( function(){
224
+
225
+ toggleBox(id, false );
226
+
227
+ }, spuvar.seconds_confirmation_close);
228
+ }
229
+ // Send form by ajax and replace popup with response
230
+ request(data, url, success_cb, '', 'html');
231
+
232
+ return submit;
233
+ });
234
+
235
+ // CF7 support
236
+ $('body').on('mailsent.wpcf7', function(){
237
+
238
+ toggleBox(id, false );
239
+ });
240
+
241
+ // Gravity forms support (only AJAX mode)
242
+ $(document).on('gform_confirmation_loaded', function(){
243
+
244
+ toggleBox(id, false );
245
+ });
246
 
247
+ });
248
+
249
 
250
  //function that center popup on screen
251
  function centerBox( id ) {
379
  }
380
 
381
  })(window.jQuery);
382
+ });
383
 
384
  /**
385
  * Cookie functions
public/class-social-popup.php CHANGED
@@ -23,7 +23,7 @@ class SocialPopup {
23
  *
24
  * @var string
25
  */
26
- const VERSION = '1.2.1';
27
 
28
  /**
29
  * Popups to use acrros files
@@ -331,6 +331,8 @@ class SocialPopup {
331
  if( defined( 'SPU_DEBUG_MODE' ) || !empty( $opts['debug'] ) ) {
332
  $js_url = plugins_url( 'assets/js/public.js', __FILE__ );
333
  }
 
 
334
  wp_register_style( 'spu-public-css', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
335
 
336
  wp_register_script( 'spu-public', $js_url, array( 'jquery' ), self::VERSION, true );
23
  *
24
  * @var string
25
  */
26
+ const VERSION = '1.2.2.1';
27
 
28
  /**
29
  * Popups to use acrros files
331
  if( defined( 'SPU_DEBUG_MODE' ) || !empty( $opts['debug'] ) ) {
332
  $js_url = plugins_url( 'assets/js/public.js', __FILE__ );
333
  }
334
+
335
+
336
  wp_register_style( 'spu-public-css', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
337
 
338
  wp_register_script( 'spu-public', $js_url, array( 'jquery' ), self::VERSION, true );
public/includes/class-spu-rules.php CHANGED
@@ -814,9 +814,9 @@ class Spu_Rules
814
  function get_post_type(){
815
  global $wp_query;
816
 
817
- $post_type = get_post_type();
818
 
819
- $post_type = empty( $post_type ) ? $wp_query->query_vars['post_type'] : $post_type;
820
 
821
  return $post_type;
822
  }
814
  function get_post_type(){
815
  global $wp_query;
816
 
817
+ $post_type = $wp_query->query_vars['post_type'] ;
818
 
819
+ $post_type = empty( $post_type ) ? get_post_type() : $post_type;
820
 
821
  return $post_type;
822
  }
public/views/popup.php CHANGED
@@ -40,7 +40,7 @@ do_action( 'spu/popup/before_popup', $box, $opts, $css);
40
  background: <?php echo ( !empty( $css['background_color'] ) ) ? esc_attr($css['background_color']) : 'white'; ?>;
41
  <?php if ( !empty( $css['color'] ) ) { ?>color: <?php echo esc_attr($css['color']); ?>;<?php } ?>
42
  <?php if ( !empty( $css['border_color'] ) && !empty( $css['border_width'] ) ) { ?>border: <?php echo esc_attr($css['border_width']) . 'px' ?> solid <?php echo esc_attr($css['border_color']); ?>;<?php } ?>
43
- max-width: <?php echo ( !empty( $css['width'] ) ) ? esc_attr( $css['width'] ) : 'auto'; ?>;
44
  }
45
  #spu-bg-<?php echo $box->ID; ?> {
46
  opacity: <?php echo ( !empty( $css['bgopacity'] ) ) ? esc_attr($css['bgopacity']) : 0; ?>;
40
  background: <?php echo ( !empty( $css['background_color'] ) ) ? esc_attr($css['background_color']) : 'white'; ?>;
41
  <?php if ( !empty( $css['color'] ) ) { ?>color: <?php echo esc_attr($css['color']); ?>;<?php } ?>
42
  <?php if ( !empty( $css['border_color'] ) && !empty( $css['border_width'] ) ) { ?>border: <?php echo esc_attr($css['border_width']) . 'px' ?> solid <?php echo esc_attr($css['border_color']); ?>;<?php } ?>
43
+ width: <?php echo ( !empty( $css['width'] ) ) ? esc_attr( $css['width'] ) : 'auto'; ?>;
44
  }
45
  #spu-bg-<?php echo $box->ID; ?> {
46
  opacity: <?php echo ( !empty( $css['bgopacity'] ) ) ? esc_attr($css['bgopacity']) : 0; ?>;