Popups – WordPress Popup - Version 1.2.2

Version Description

  • Fixed compability with events calendar
  • Fixed compability with mc4wp
  • Fixed bug with popup auto dissapearing by programatically clicks of themes/plugins
  • Fixed popup in mobile to let users scroll it
  • Fixed bug with contact form 7 plugin support
  • Small bugfixes
Download this release

Release Info

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

Code changes from version 1.2.1 to 1.2.2

README.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Popups - Wordpress Popups ===
2
  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.1
8
  Text Domain: spucpt
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,6 +13,11 @@ Increase your followers ratio 40% with the new Popups - Multiple popup options,
13
 
14
  == Description ==
15
 
 
 
 
 
 
16
  The new Popups plugin can display multiple popups. Is the perfect solution to increase your social followers, your mailing lists by adding a form like mailchimp or to display any important message in a simple popup.
17
 
18
 
@@ -97,6 +102,15 @@ Yes if you need to debug you can use uncompressed javascript by addings ([this c
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
 
 
100
  = 1.2.1 =
101
 
102
  * Added support for Contact Form 7, Gravity Forms and most of other generic forms
1
+ === Popups - WordPress Popup ===
2
  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
13
 
14
  == Description ==
15
 
16
+ > <strong>Black Friday Plus!</strong><br>
17
+ >
18
+ > Check our ([Black Friday Offer](https://wp.timersys.com/black-friday-plus/))
19
+ >
20
+
21
  The new Popups plugin can display multiple popups. Is the perfect solution to increase your social followers, your mailing lists by adding a form like mailchimp or to display any important message in a simple popup.
22
 
23
 
102
 
103
  == Changelog ==
104
 
105
+ = 1.2.2 =
106
+
107
+ * Fixed compability with events calendar
108
+ * Fixed compability with [mc4wp] (Mail chimp for WordPress)
109
+ * Fixed bug with popup auto dissapearing by programatically clicks of themes/plugins
110
+ * Fixed popup in mobile to let users scroll it
111
+ * Fixed bug with contact form 7 plugin support
112
+ * Small bugfixes
113
+
114
  = 1.2.1 =
115
 
116
  * Added support for Contact Form 7, Gravity Forms and most of other generic forms
admin/assets/css/admin.css CHANGED
@@ -1,4 +1,13 @@
1
  /* This stylesheet is used to style the admin option form of the plugin. */
 
 
 
 
 
 
 
 
 
2
  /*---------------------------------------------------------------------------------------------
3
  Tables
4
  ---------------------------------------------------------------------------------------------*/
1
  /* This stylesheet is used to style the admin option form of the plugin. */
2
+ /*----------
3
+ Alerts
4
+ ---------------*/
5
+ .alert-premium {
6
+ border: 4px solid #dd3d36;
7
+ padding: 10px;
8
+ text-align: center;
9
+ margin: 15px;
10
+ }
11
  /*---------------------------------------------------------------------------------------------
12
  Tables
13
  ---------------------------------------------------------------------------------------------*/
admin/class-social-popup-admin.php CHANGED
@@ -344,7 +344,10 @@ class SocialPopup_Admin {
344
  * @since 1.1
345
  */
346
  public function metabox_donate( $post, $metabox ) {
347
- include 'views/metabox-donate.php';
 
 
 
348
  }
349
  /**
350
  * Include the metabox view for support box
@@ -353,7 +356,10 @@ class SocialPopup_Admin {
353
  * @since 1.1
354
  */
355
  public function metabox_support( $post, $metabox ) {
356
- include 'views/metabox-support.php';
 
 
 
357
  }
358
 
359
  /**
@@ -363,7 +369,10 @@ class SocialPopup_Admin {
363
  * @since 1.1
364
  */
365
  public function metabox_links( $post, $metabox ) {
366
- include 'views/metabox-links.php';
 
 
 
367
  }
368
 
369
  /**
344
  * @since 1.1
345
  */
346
  public function metabox_donate( $post, $metabox ) {
347
+
348
+ $donate_metabox = apply_filters( 'spu/metaboxes/donate_metabox', dirname(__FILE__) . '/views/metabox-donate.php' );
349
+
350
+ include $donate_metabox;
351
  }
352
  /**
353
  * Include the metabox view for support box
356
  * @since 1.1
357
  */
358
  public function metabox_support( $post, $metabox ) {
359
+
360
+ $support_metabox = apply_filters( 'spu/metaboxes/support_metabox', dirname(__FILE__) . '/views/metabox-support.php' );
361
+
362
+ include $support_metabox;
363
  }
364
 
365
  /**
369
  * @since 1.1
370
  */
371
  public function metabox_links( $post, $metabox ) {
372
+
373
+ $links_metabox = apply_filters( 'spu/metaboxes/links_metabox', dirname(__FILE__) . '/views/metabox-links.php' );
374
+
375
+ include $links_metabox;
376
  }
377
 
378
  /**
admin/views/metabox-premium.php CHANGED
@@ -2,6 +2,17 @@
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
  ?>
 
 
 
 
 
 
 
 
 
 
 
5
  <p><?php _e( 'Take the best WordPress Popups plugin to the next level with Popups Premium extension.', $this->plugin_slug );?></p>
6
  <h2><?php _e( 'Popups Premium Features:', $this->plugin_slug );?></h2>
7
  <ul>
2
  // Exit if accessed directly
3
  if ( !defined( 'ABSPATH' ) ) exit;
4
  ?>
5
+ <?php
6
+
7
+ $today = strtotime(date("Y-m-d H:i:s"));
8
+ $blackbegin = strtotime("2014-11-28");
9
+ $blackend = strtotime("2014-12-02");
10
+ if($today > $blackbegin && $today < $blackend) : ?>
11
+ <div class="alert-premium">
12
+ <p><strong>Happy Black Friday!</strong> Get any Timersys Plugin with a 40% discount using the <code>BLACKFRIDAY</code> coupon code </p>
13
+ </div>
14
+ <?php endif;?>
15
+
16
  <p><?php _e( 'Take the best WordPress Popups plugin to the next level with Popups Premium extension.', $this->plugin_slug );?></p>
17
  <h2><?php _e( 'Popups Premium Features:', $this->plugin_slug );?></h2>
18
  <ul>
popups.php CHANGED
@@ -9,9 +9,9 @@
9
  * @copyright 2014 Damian Logghe
10
  *
11
  * @socialpopup
12
- * Plugin Name: Popups
13
  * Plugin URI: http://www.timersys.com/free-plugins/social-popup/
14
- * Version: 1.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
9
  * @copyright 2014 Damian Logghe
10
  *
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
public/assets/css/public.css CHANGED
@@ -108,5 +108,7 @@ body {
108
  @media only screen and (max-width: 620px) {
109
  .spu-box {
110
  left: 0 !important;
 
 
111
  }
112
  }
108
  @media only screen and (max-width: 620px) {
109
  .spu-box {
110
  left: 0 !important;
111
+ top: 100px !important;
112
+ position: absolute !important;
113
  }
114
  }
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)}}jQuery(window).load(function(){window.SPU=function($){function t(t){var i=a[t],e=$(window).width(),n=$(window).height(),o=i.height(),r=i.width();i.css({position:"fixed",top:n/2-o/2,left:e/2-r/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=a[i],o=$("#spu-bg-"+i),r=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&&r>0?o.fadeIn():o.fadeOut(),e}var n=$(window).height(),o=spuvar.is_admin,a=[];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),r=t.data("trigger"),s=0,d=1===parseInt(t.data("test-mode")),u=t.data("box-id"),f=1===parseInt(t.data("auto-hide")),c=parseInt(t.data("seconds-close")),p=parseInt(t.data("trigger-number"),10),l="percentage"==r?parseInt(t.data("trigger-number"),10)/100:.8,h=l*$(document).height();i(t),$(".spu-google").width($(".spu-google").width()-20),$(".spu-twitter").width($(".spu-twitter").width()-12);var g=0,w=0,m=$(this).find(".spu-content").width(),b=t.data("total");b&&!spuvar.disable_style&&($(this).find(".spu-shortcode").each(function(){g+=$(this).width()}),w=m-g),w>0&&($(this).find(".spu-shortcode").each(function(){3==b?$(this).css("margin-left",w/(b-1)):$(this).css("margin-left",w/2)}),2==b?$(this).find(".spu-shortcode").last().css("margin-left",0):3==b&&$(this).find(".spu-shortcode").first().css("margin-left",0)),$(document).keyup(function(t){27==t.keyCode&&e(u,!1)});var v=navigator.userAgent,y=v.match(/iPad/i)||v.match(/iPhone/i)?"touchstart":"click";$("body").on(y,function(t){console.log(y.target),e(u,!1)}),$("body").on(y,".spu-box",function(t){t.stopPropagation()}),t.hide().css("left",""),a[u]=t;var x=function(){s&&clearTimeout(s),s=window.setTimeout(function(){var t=$(window).scrollTop(),i=t+n>=h;i?(f||$(window).unbind("scroll",x),e(u,!0)):e(u,!1)},100)},k=function(){s&&clearTimeout(s),s=window.setTimeout(function(){e(u,!0)},1e3*p)},_=spuReadCookie("spu_box_"+u);if((void 0==_||o&&d)&&("seconds"==r?k():($(window).bind("scroll",x),x()),window.location.hash&&window.location.hash.length>0)){var T=window.location.hash,C;T.substring(1)===t.attr("id")&&setTimeout(function(){e(u,!0)},100)}t.find(".spu-close").click(function(){e(u,!1),"percentage"==r&&$(window).unbind("scroll",x)}),$('a[href="#'+t.attr("id")+'"]').click(function(){return e(u,!0),!1}),t.find('form:not(".wpcf7-form, .gravity-form")').submit(function(t){t.preventDefault();var i=!0;return e(u,!1),i}),$("body").on("mailsent.wpcf7",function(){e(u,!1)}),$(document).on("gform_confirmation_loaded",function(){e(u,!1)})}),{show:function(t){return e(t,!0)},hide:function(t){return e(t,!1)}}}(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)}}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)})});
public/assets/js/public.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(window).load(function() {
2
  window.SPU = (function($) {
3
 
4
  var windowHeight = $(window).height();
@@ -95,8 +95,12 @@ jQuery(window).load(function() {
95
  event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
96
 
97
  $('body').on(event, function (ev) {
98
- console.log(event.target);
99
- toggleBox( id, false );
 
 
 
 
100
  });
101
  //not on the box
102
  $('body' ).on(event,'.spu-box', function(event) {
@@ -194,11 +198,30 @@ jQuery(window).load(function() {
194
  toggleBox(id, true);
195
  return false;
196
  });
 
 
 
 
197
  // Add generic form tracking
198
  $box.find('form:not(".wpcf7-form, .gravity-form")').submit( function(e){
199
  e.preventDefault();
200
- var submit = true;
201
- toggleBox(id, false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
  return submit;
204
  });
@@ -305,19 +328,52 @@ jQuery(window).load(function() {
305
  }
306
  return show;
307
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
 
309
- return {
310
- show: function( box_id ) {
311
- return toggleBox( box_id, true );
312
- },
313
- hide: function( box_id ) {
314
- return toggleBox( box_id, false );
 
 
 
 
 
 
 
315
  }
316
- }
317
 
318
  })(window.jQuery);
319
 
320
- });
321
  /**
322
  * Cookie functions
323
  */
1
+
2
  window.SPU = (function($) {
3
 
4
  var windowHeight = $(window).height();
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) {
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
  });
328
  }
329
  return show;
330
  }
331
+ // AJAX REQUESTS
332
+ function request(data, url, success_cb, error_cb){
333
+ // Prepare variables.
334
+ var ajax = {
335
+ url: spuvar.ajax_url,
336
+ data: data,
337
+ cache: false,
338
+ type: 'POST',
339
+ dataType: 'json',
340
+ timeout: 30000
341
+ },
342
+ success_cb = success_cb || false,
343
+ error_cb = error_cb || false;
344
+
345
+ // Set ajax url is supplied
346
+ if ( url ) {
347
+ ajax.url = url;
348
+ }
349
+ // Set success callback if supplied.
350
+ if ( success_cb ) {
351
+ ajax.success = success_cb;
352
+ }
353
+
354
+ // Set error callback if supplied.
355
+ if ( error_cb ) {
356
+ ajax.error = error_cb;
357
+ }
358
 
359
+ // Make the ajax request.
360
+ $.ajax(ajax);
361
+ }
362
+ return {
363
+ show: function( box_id ) {
364
+ return toggleBox( box_id, true );
365
+ },
366
+ hide: function( box_id ) {
367
+ return toggleBox( box_id, false );
368
+ },
369
+ request: function( data, url, success_cb, error_cb ) {
370
+ return request( data, url, success_cb, error_cb );
371
+ }
372
  }
 
373
 
374
  })(window.jQuery);
375
 
376
+
377
  /**
378
  * Cookie functions
379
  */
public/class-social-popup.php CHANGED
@@ -407,9 +407,10 @@ class SocialPopup {
407
  wp_enqueue_style('spu-public-css');
408
  wp_localize_script( 'spu-public', 'spuvar',
409
  array(
410
- 'is_admin' => current_user_can( 'administrator' ),
411
- 'disable_style' => @$this->spu_settings['shortcodes_style'],
412
- 'safe_mode' => @$this->spu_settings['safe']
 
413
  )
414
  );
415
 
407
  wp_enqueue_style('spu-public-css');
408
  wp_localize_script( 'spu-public', 'spuvar',
409
  array(
410
+ 'is_admin' => current_user_can( 'administrator' ),
411
+ 'disable_style' => @$this->spu_settings['shortcodes_style'],
412
+ 'safe_mode' => @$this->spu_settings['safe'],
413
+ 'seconds_confirmation_close' => apply_filters( 'spu/spuvar/seconds_confirmation_close', 5 ),
414
  )
415
  );
416
 
public/includes/class-spu-rules.php CHANGED
@@ -250,7 +250,10 @@ class Spu_Rules
250
 
251
  function rule_match_post_type( $match, $rule )
252
  {
253
- $post_type = get_post_type( );
 
 
 
254
 
255
  if( $rule['operator'] == "==" )
256
  {
@@ -275,7 +278,7 @@ class Spu_Rules
275
  function rule_match_post( $match, $rule )
276
  {
277
  global $post;
278
- $post_id = $post->ID;
279
 
280
  if($rule['operator'] == "==")
281
  {
@@ -301,8 +304,12 @@ class Spu_Rules
301
  {
302
  global $post;
303
 
 
304
 
305
- $post = get_post( $post->ID );
 
 
 
306
 
307
  if( $rule['value'] == 'front_page') {
308
 
@@ -312,11 +319,11 @@ class Spu_Rules
312
 
313
  if($rule['operator'] == "==") {
314
 
315
- $match = ( $front_page == $post->ID );
316
 
317
  } elseif($rule['operator'] == "!=") {
318
 
319
- $match = ( $front_page != $post->ID );
320
 
321
  }
322
  } else {
@@ -341,11 +348,11 @@ class Spu_Rules
341
  if( $posts_page !== 0 ) {
342
  if($rule['operator'] == "==") {
343
 
344
- $match = ( $posts_page == $post->ID );
345
 
346
  } elseif($rule['operator'] == "!=") {
347
 
348
- $match = ( $posts_page != $post->ID );
349
 
350
  }
351
  } else {
@@ -364,7 +371,7 @@ class Spu_Rules
364
 
365
  }
366
  elseif( $rule['value'] == 'top_level') {
367
- $post_parent = $post->post_parent;
368
  if( $options['page_parent'] )
369
  {
370
  $post_parent = $options['page_parent'];
@@ -384,8 +391,8 @@ class Spu_Rules
384
  elseif( $rule['value'] == 'parent') {
385
 
386
  $children = get_pages(array(
387
- 'post_type' => $post->post_type,
388
- 'child_of' => $post->ID,
389
  ));
390
 
391
 
@@ -400,7 +407,7 @@ class Spu_Rules
400
  }
401
  elseif( $rule['value'] == 'child') {
402
 
403
- $post_parent = $post->post_parent;
404
  if( $options['page_parent'] )
405
  {
406
  $post_parent = $options['page_parent'];
@@ -523,7 +530,7 @@ class Spu_Rules
523
 
524
 
525
  // post type
526
- $post_type = get_post_type( $post->ID );
527
 
528
  // vars
529
  $taxonomies = get_object_taxonomies( $post_type );
@@ -638,7 +645,7 @@ class Spu_Rules
638
  return false;
639
  }
640
 
641
- $post_type = get_post_type( $post->ID );
642
 
643
 
644
  // does post_type support 'post-format'
@@ -734,7 +741,7 @@ class Spu_Rules
734
 
735
 
736
  // post type
737
- $post_type = get_post_type( $post->ID );
738
 
739
  // vars
740
  $taxonomies = get_object_taxonomies( $post_type );
@@ -798,7 +805,21 @@ class Spu_Rules
798
 
799
  }
800
 
801
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802
 
803
  }
804
 
250
 
251
  function rule_match_post_type( $match, $rule )
252
  {
253
+
254
+
255
+ $post_type = $this->get_post_type();
256
+
257
 
258
  if( $rule['operator'] == "==" )
259
  {
278
  function rule_match_post( $match, $rule )
279
  {
280
  global $post;
281
+ $post_id = isset( $post->ID ) ? $post->ID : '';
282
 
283
  if($rule['operator'] == "==")
284
  {
304
  {
305
  global $post;
306
 
307
+ $post_id = isset( $post->ID ) ? $post->ID : '';
308
 
309
+ $post = get_post( $post_id );
310
+
311
+ $post_parent = isset( $post->post_parent ) ? $post->post_parent : '';
312
+ $post_type = $this->get_post_type();
313
 
314
  if( $rule['value'] == 'front_page') {
315
 
319
 
320
  if($rule['operator'] == "==") {
321
 
322
+ $match = ( $front_page == $post_id );
323
 
324
  } elseif($rule['operator'] == "!=") {
325
 
326
+ $match = ( $front_page != $post_id );
327
 
328
  }
329
  } else {
348
  if( $posts_page !== 0 ) {
349
  if($rule['operator'] == "==") {
350
 
351
+ $match = ( $posts_page == $post_id );
352
 
353
  } elseif($rule['operator'] == "!=") {
354
 
355
+ $match = ( $posts_page != $post_id );
356
 
357
  }
358
  } else {
371
 
372
  }
373
  elseif( $rule['value'] == 'top_level') {
374
+ $post_parent = $post_parent;
375
  if( $options['page_parent'] )
376
  {
377
  $post_parent = $options['page_parent'];
391
  elseif( $rule['value'] == 'parent') {
392
 
393
  $children = get_pages(array(
394
+ 'post_type' => $post_type,
395
+ 'child_of' => $post_id,
396
  ));
397
 
398
 
407
  }
408
  elseif( $rule['value'] == 'child') {
409
 
410
+ $post_parent = $post_parent;
411
  if( $options['page_parent'] )
412
  {
413
  $post_parent = $options['page_parent'];
530
 
531
 
532
  // post type
533
+ $post_type = $this->get_post_type();
534
 
535
  // vars
536
  $taxonomies = get_object_taxonomies( $post_type );
645
  return false;
646
  }
647
 
648
+ $post_type = $this->get_post_type();
649
 
650
 
651
  // does post_type support 'post-format'
741
 
742
 
743
  // post type
744
+ $post_type = $this->get_post_type();
745
 
746
  // vars
747
  $taxonomies = get_object_taxonomies( $post_type );
805
 
806
  }
807
 
808
+ /**
809
+ * Helper function to get post type
810
+ * @since 1.2.3
811
+ * @return string
812
+ *
813
+ */
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
+ }
823
 
824
  }
825