Version Description
- Added ninja forms 3 compatibility (thanks https://github.com/cr0ybot)
- Fixed compatibility with latest WPML version
- Fixed preview mode when post is draft
- Fixed issue with gravity forms and language sites
Download this release
Release Info
Developer | timersys |
Plugin | Popups – WordPress Popup |
Version | 1.9.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.0.1 to 1.9.1
- README.txt +8 -2
- admin/class-social-popup-admin.php +6 -2
- popups.php +2 -2
- public/assets/js/min/public-min.js +1 -1
- public/assets/js/public.js +5 -1
- public/class-social-popup.php +8 -6
- public/views/popup.php +2 -2
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: 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.
|
7 |
-
Stable tag: 1.9.
|
8 |
Text Domain: popups
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -189,6 +189,12 @@ If you have cache be sure to enable AJAX mode in the plugin settings page
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
= 1.9.0.1 =
|
193 |
* Fixed problem with popup being removed on close
|
194 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
|
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
|
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.1 =
|
193 |
+
* Added ninja forms 3 compatibility (thanks https://github.com/cr0ybot)
|
194 |
+
* Fixed compatibility with latest WPML version
|
195 |
+
* Fixed preview mode when post is draft
|
196 |
+
* Fixed issue with gravity forms and language sites
|
197 |
+
|
198 |
= 1.9.0.1 =
|
199 |
* Fixed problem with popup being removed on close
|
200 |
|
admin/class-social-popup-admin.php
CHANGED
@@ -113,7 +113,7 @@ class SocialPopup_Admin {
|
|
113 |
add_action('wp_ajax_spu_enable_ajax_notice_handler', array( $this, 'ajax_notice_handler' ) );
|
114 |
|
115 |
//Tinymce
|
116 |
-
add_filter( 'tiny_mce_before_init', array($this, 'tinymce_init') );
|
117 |
add_action( 'admin_init', array( $this, 'editor_styles' ) );
|
118 |
add_action( 'init', array( $this, 'register_tiny_buttons' ) );
|
119 |
|
@@ -707,8 +707,12 @@ class SocialPopup_Admin {
|
|
707 |
if( get_post_type() !== 'spucpt') {
|
708 |
return $args;
|
709 |
}
|
|
|
|
|
|
|
|
|
710 |
|
711 |
-
$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); }';
|
712 |
|
713 |
return $args;
|
714 |
}
|
113 |
add_action('wp_ajax_spu_enable_ajax_notice_handler', array( $this, 'ajax_notice_handler' ) );
|
114 |
|
115 |
//Tinymce
|
116 |
+
add_filter( 'tiny_mce_before_init', array($this, 'tinymce_init'), 9999 );
|
117 |
add_action( 'admin_init', array( $this, 'editor_styles' ) );
|
118 |
add_action( 'init', array( $this, 'register_tiny_buttons' ) );
|
119 |
|
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 |
}
|
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.9.
|
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
|
@@ -30,7 +30,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
30 |
* Public-Facing Functionality
|
31 |
*----------------------------------------------------------------------------*/
|
32 |
|
33 |
-
define( 'SPU_VERSION' , '1.9.
|
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.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
|
30 |
* Public-Facing Functionality
|
31 |
*----------------------------------------------------------------------------*/
|
32 |
|
33 |
+
define( 'SPU_VERSION' , '1.9.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__ ) );
|
public/assets/js/min/public-min.js
CHANGED
@@ -1 +1 @@
|
|
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,b=w.match(/iPad/i)||w.match(/iPhone/i)?"touchstart":"click";$("body").on(b,function(t){void 0!==t.originalEvent&&s(p,!1,!1)}),$("body").on(b,".spu-box,.spu-clickable",function(t){t.stopPropagation()}),e.hide().css("left",""),d[p]=e;var y=function(){o&&clearTimeout(o),o=window.setTimeout(function(){var t=$(window).scrollTop(),e=t+u>=g;e?(l||$(window).unbind("scroll",y),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",y),y()),"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",y)}),$(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)}),$(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},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);
|
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
@@ -275,6 +275,9 @@ var SPU_master = function() {
|
|
275 |
});
|
276 |
|
277 |
// Gravity forms support (only AJAX mode)
|
|
|
|
|
|
|
278 |
$(document).on('gform_confirmation_loaded', function(){
|
279 |
$box.trigger('spu.form_submitted', [id]);
|
280 |
toggleBox(id, false, true );
|
@@ -536,7 +539,8 @@ if( spuvar.ajax_mode ) {
|
|
536 |
referrer : document.referrer,
|
537 |
query_string : document.location.search,
|
538 |
is_category : spuvar.is_category,
|
539 |
-
is_archive : spuvar.is_archive
|
|
|
540 |
}
|
541 |
,success_cb = function(response) {
|
542 |
|
275 |
});
|
276 |
|
277 |
// Gravity forms support (only AJAX mode)
|
278 |
+
if( box_form.hasClass('gravity-form') ) {
|
279 |
+
box_form.attr('action', window.location.href)
|
280 |
+
}
|
281 |
$(document).on('gform_confirmation_loaded', function(){
|
282 |
$box.trigger('spu.form_submitted', [id]);
|
283 |
toggleBox(id, false, true );
|
539 |
referrer : document.referrer,
|
540 |
query_string : document.location.search,
|
541 |
is_category : spuvar.is_category,
|
542 |
+
is_archive : spuvar.is_archive,
|
543 |
+
is_preview: spuvar.is_preview
|
544 |
}
|
545 |
,success_cb = function(response) {
|
546 |
|
public/class-social-popup.php
CHANGED
@@ -470,9 +470,10 @@ class SocialPopup {
|
|
470 |
return $spu_ids;
|
471 |
}
|
472 |
}
|
|
|
473 |
return $wpdb->get_results( "SELECT ID, post_content, MAX(CASE WHEN pm1.meta_key = 'spu_rules' then pm1.meta_value ELSE NULL END) as spu_rules,
|
474 |
MAX(CASE WHEN pm1.meta_key = 'spu_ab_parent' then pm1.meta_value ELSE NULL END) as spu_ab_parent
|
475 |
-
FROM $wpdb->posts p LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID) WHERE post_type='spucpt'
|
476 |
}
|
477 |
|
478 |
/**
|
@@ -778,12 +779,13 @@ class SocialPopup {
|
|
778 |
*/
|
779 |
protected function get_polylang_ids( ) {
|
780 |
global $wpdb;
|
|
|
781 |
|
782 |
-
|
783 |
FROM $wpdb->posts p
|
784 |
LEFT JOIN $wpdb->term_relationships as tr ON p.ID = tr.object_id
|
785 |
LEFT JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
|
786 |
-
WHERE post_type='spucpt'
|
787 |
GROUP BY p.ID";
|
788 |
|
789 |
$ids = array();
|
@@ -804,7 +806,7 @@ class SocialPopup {
|
|
804 |
MAX(CASE WHEN pm1.meta_key = 'spu_ab_parent' then pm1.meta_value ELSE NULL END) as spu_ab_parent
|
805 |
FROM $wpdb->posts p
|
806 |
LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID)
|
807 |
-
WHERE post_type='spucpt'
|
808 |
GROUP BY p.ID";
|
809 |
return $wpdb->get_results( $sql );
|
810 |
}
|
@@ -820,7 +822,7 @@ class SocialPopup {
|
|
820 |
$wpml_settings = get_option( 'icl_sitepress_settings', true);
|
821 |
|
822 |
if ( ! empty( $wpml_settings['custom_posts_sync_option']['spucpt'] ) ) {
|
823 |
-
|
824 |
$lang_code = isset( $_GET['lang'] ) ? $_GET['lang'] : ICL_LANGUAGE_CODE;
|
825 |
$sql = "SELECT DISTINCT ID, post_content,
|
826 |
MAX(CASE WHEN pm1.meta_key = 'spu_rules' then pm1.meta_value ELSE NULL END) as spu_rules,
|
@@ -828,7 +830,7 @@ class SocialPopup {
|
|
828 |
FROM $wpdb->posts p
|
829 |
LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID)
|
830 |
LEFT JOIN {$wpdb->prefix}icl_translations as b ON p.ID = b.element_id
|
831 |
-
WHERE post_type='spucpt'
|
832 |
GROUP BY p.ID";
|
833 |
|
834 |
$ids = $wpdb->get_results( $sql );
|
470 |
return $spu_ids;
|
471 |
}
|
472 |
}
|
473 |
+
$post_status = isset( $_REQUEST['is_preview'] ) ? "AND (post_status='publish' OR post_status='draft')" : "AND post_status='publish'";
|
474 |
return $wpdb->get_results( "SELECT ID, post_content, MAX(CASE WHEN pm1.meta_key = 'spu_rules' then pm1.meta_value ELSE NULL END) as spu_rules,
|
475 |
MAX(CASE WHEN pm1.meta_key = 'spu_ab_parent' then pm1.meta_value ELSE NULL END) as spu_ab_parent
|
476 |
+
FROM $wpdb->posts p LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID) WHERE post_type='spucpt' {$post_status} GROUP BY p.ID");
|
477 |
}
|
478 |
|
479 |
/**
|
779 |
*/
|
780 |
protected function get_polylang_ids( ) {
|
781 |
global $wpdb;
|
782 |
+
$post_status = isset( $_REQUEST['is_preview'] ) ? "AND (post_status='publish' OR post_status='draft')" : "AND post_status='publish'";
|
783 |
|
784 |
+
$sql = "SELECT description
|
785 |
FROM $wpdb->posts p
|
786 |
LEFT JOIN $wpdb->term_relationships as tr ON p.ID = tr.object_id
|
787 |
LEFT JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
|
788 |
+
WHERE post_type='spucpt' {$post_status} AND tt.taxonomy = 'post_translations'
|
789 |
GROUP BY p.ID";
|
790 |
|
791 |
$ids = array();
|
806 |
MAX(CASE WHEN pm1.meta_key = 'spu_ab_parent' then pm1.meta_value ELSE NULL END) as spu_ab_parent
|
807 |
FROM $wpdb->posts p
|
808 |
LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID)
|
809 |
+
WHERE post_type='spucpt' {$post_status} AND ID IN (".implode(',',array_unique($ids)).")
|
810 |
GROUP BY p.ID";
|
811 |
return $wpdb->get_results( $sql );
|
812 |
}
|
822 |
$wpml_settings = get_option( 'icl_sitepress_settings', true);
|
823 |
|
824 |
if ( ! empty( $wpml_settings['custom_posts_sync_option']['spucpt'] ) ) {
|
825 |
+
$post_status = isset( $_REQUEST['is_preview'] ) ? "AND (post_status='publish' OR post_status='draft')" : "AND post_status='publish'";
|
826 |
$lang_code = isset( $_GET['lang'] ) ? $_GET['lang'] : ICL_LANGUAGE_CODE;
|
827 |
$sql = "SELECT DISTINCT ID, post_content,
|
828 |
MAX(CASE WHEN pm1.meta_key = 'spu_rules' then pm1.meta_value ELSE NULL END) as spu_rules,
|
830 |
FROM $wpdb->posts p
|
831 |
LEFT JOIN $wpdb->postmeta pm1 ON ( pm1.post_id = p.ID)
|
832 |
LEFT JOIN {$wpdb->prefix}icl_translations as b ON p.ID = b.element_id
|
833 |
+
WHERE post_type='spucpt' {$post_status} AND b.language_code = '" . esc_sql( $lang_code ) . "'
|
834 |
GROUP BY p.ID";
|
835 |
|
836 |
$ids = $wpdb->get_results( $sql );
|
public/views/popup.php
CHANGED
@@ -9,12 +9,12 @@
|
|
9 |
* @copyright 2014 Timersys
|
10 |
*/
|
11 |
|
12 |
-
?><!-- Popups v<?php echo self::VERSION; ?> - https://wordpress.org/plugins/
|
13 |
$box = get_post( $spu_id );
|
14 |
$helper = new Spu_Helper;
|
15 |
|
16 |
// has box with this id been found?
|
17 |
-
if ( ! $box instanceof WP_Post
|
18 |
return;
|
19 |
}
|
20 |
|
9 |
* @copyright 2014 Timersys
|
10 |
*/
|
11 |
|
12 |
+
?><!-- Popups v<?php echo self::VERSION; ?> - https://wordpress.org/plugins/popups/ --><?php
|
13 |
$box = get_post( $spu_id );
|
14 |
$helper = new Spu_Helper;
|
15 |
|
16 |
// has box with this id been found?
|
17 |
+
if ( ! $box instanceof WP_Post ) {
|
18 |
return;
|
19 |
}
|
20 |
|