Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram - Version 1.9.9

Version Description

Compatibility with Contact Form 7.

Download this release

Release Info

Developer Icegram
Plugin Icon 128x128 Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram
Version 1.9.9
Comparing to
See all releases

Code changes from version 1.9.8.1 to 1.9.9

assets/js/icegram.js CHANGED
@@ -1 +1 @@
1
- function Icegram(){}function Icegram_Message_Type(e){var e;this.root_container="#icegram_messages_container",this.data=e,this.type=e.type,this.data.delay_time=parseInt(this.data.delay_time),"string"!=typeof this.data.link||""==this.data.link||/^tel:/i.test(this.data.link)||/^https?:\/\//i.test(this.data.link)||(this.data.link="http://"+this.data.link),this.set_template(this.get_template_default()),this.init()}Icegram.prototype.init=function(e){if(void 0!=e){jQuery(window).trigger("preinit.icegram",[e]),this.data=e,this.defaults=jQuery.extend({},e.defaults),this.message_data=e.messages,this.messages,this.tracking_data=[],this.message_template_cache={},this.map_id_to_index={},this.map_type_to_index={},this.mode=void 0==window.ig_mode?"local":window.ig_mode,this.powered_by={link:"http://www.icegram.com/?utm_source=inapp&utm_campaign=poweredby&utm_medium="},this.powered_by.text=this.defaults.powered_by_text,this.powered_by.logo=this.defaults.powered_by_logo,jQuery("body").append('<div id="icegram_messages_container"></div>');this.messages=[];var t=this;this.message_data.length>0&&jQuery.each(this.message_data,function(e,i){try{if(-1==window.location.href.indexOf("campaign_preview_id")){if("yes"==i.retargeting&&1==jQuery.cookie("icegram_campaign_shown_"+i.id))return;if("yes"==i.retargeting_clicked&&1==jQuery.cookie("icegram_campaign_clicked_"+i.id))return}var a=null,r=i.type.split("-").join(" ").ucwords().split(" ").join("_");a="function"==typeof window["Icegram_Message_Type_"+r]?new window["Icegram_Message_Type_"+r](i):new Icegram_Message_Type(i),t.messages.push(a),t.map_id_to_index["_"+i.id]=e,t.map_type_to_index[i.type]=jQuery.isArray(t.map_type_to_index[i.type])?t.map_type_to_index[i.type]:new Array,t.map_type_to_index[i.type].push(e)}catch(o){}}),jQuery(window).unload(function(){"function"==typeof window.icegram.submit_tracking_data&&window.icegram.submit_tracking_data(!1)}),setInterval(function(){"function"==typeof window.icegram.submit_tracking_data&&window.icegram.submit_tracking_data(!0)},5e3),jQuery(window).trigger("init.icegram",[this])}},Icegram.prototype.timer_tick=function(){},Icegram.prototype.get_template_fn=function(e){return this.message_template_cache[e]},Icegram.prototype.set_template_fn=function(e,t){this.message_template_cache[e]=t},Icegram.prototype.get_message=function(e){return this.messages.length>e?this.messages[e]:void 0},Icegram.prototype.get_message_by_id=function(e){if(this.map_id_to_index.hasOwnProperty("_"+e)){var t=this.map_id_to_index["_"+e];return this.get_message(t)}return void 0},Icegram.prototype.get_messages_by_type=function(e){if(this.map_type_to_index.hasOwnProperty(e)){var t=this.map_type_to_index[e],i=[];if(jQuery.isArray(t)){var a=this;jQuery.each(t,function(e,t){i.push(a.get_message(t))})}return i}return void 0},Icegram.prototype.get_powered_by=function(e){var t=jQuery.extend({},this.powered_by);return t.link=t.link+(e||""),t},Icegram.prototype.track=function(e,t){"object"==typeof t&&t.hasOwnProperty("message_id")&&t.hasOwnProperty("campaign_id")&&(jQuery(window).trigger("track.icegram",[e,t]),this.tracking_data.push({type:e,params:t}))},Icegram.prototype.submit_tracking_data=function(e){var t=window.location.protocol.split(":"),i=t[0],a=this.data.ajax_url.split("://"),r=a[0];if(this.tracking_data.length>0&&-1==window.location.href.indexOf("campaign_preview_id")){var o={type:"POST",url:this.data.ajax_url,async:e||!1,data:{action:"icegram_event_track",event_data:JSON.parse(JSON.stringify(this.tracking_data)),ig_remote_url:"remote"==this.mode?window.location.href:void 0},success:function(e,t,i){},error:function(e,t,i){}};"remote"==this.mode?(o.xhrFields={withCredentials:!0},o.crossDomain=!0,o.async=!0):i!=r&&(o.xhrFields={withCredentials:!0},jQuery.extend(o.data,{ig_local_url_cs:window.location.href})),jQuery.ajax(o),this.tracking_data=[]}},Icegram.prototype.hide_all_messages=function(){this.messages.length>0&&jQuery.each(this.messages,function(e,t){t.hide()})},Icegram_Message_Type.prototype.init=function(){this.render(),this.add_event_handlers()},Icegram_Message_Type.prototype.add_event_handlers=function(){this.el.on("click",{self:this},this.on_click),jQuery(window).on("resize",{self:this},this.on_resize)},Icegram_Message_Type.prototype.animations={},Icegram_Message_Type.prototype.embed_form=function(){if(-1===jQuery.inArray(this.data.type,["toast","badge","ribbon","exit-redirect"])){var e=null,t=this.data.form_layout,i=this.data.form_has_label,a=this.data.form_style||"none",r=this.data.label||void 0;if(a=a.toLowerCase().replace(" ","_"),void 0!=this.data.use_form&&"yes"==this.data.use_form&&(e=this.data.form_html),this.el.find("form.ig_embed_form").length>0){var o=this.el.find("form.ig_embed_form");t="inline",-1===jQuery.inArray(this.data.type,["messenger","tab","sidebar","interstitial","sticky"])&&(o.hasClass("ig_left")?t="left":o.hasClass("ig_right")&&(t="right")),"inline"==t&&this.el.find("form.ig_embed_form").replaceWith('<div class="ig_form_container layout_inline"></div>'),i=o.find(".ig_form_el_group label").length>0?"yes":void 0,0==o.find(".ig_button").length&&0==o.find("button[type=submit]").length&&(r=r||"Submit",o.append('<input class="ig_button" type="submit" value="'+r+'">')),e=jQuery("<div/>").append(o).html()}if(null==e)this.el.find(".ig_form_container").remove();else{var s=window.icegram.formProcess(this,e);if(s){var n=void 0!=this.data.form_header&&""!=this.data.form_header?'<div class="ig_form_header">'+this.data.form_header+"</div>":"",_=void 0!=this.data.form_footer&&""!=this.data.form_footer?'<div class="ig_form_footer">'+this.data.form_footer+"</div>":"";this.el.find(".ig_form_container").append(n).append(s).append(_),void 0==i?this.el.find(".ig_el_label").not("span.ig_el_label").remove():(this.el.find("input, textarea").removeAttr("placeholder"),this.el.find("select option.ig_el_placeholder").remove()),this.el.find(".ig_form_container .ig_button").length>0&&(this.el.find(".ig_button").not(".ig_form_container .ig_button").hide(),r=r||this.el.find(".ig_button").val()||"Submit",this.el.find(".ig_button").val(r)),this.el.addClass("ig_form_"+t);var d="";void 0!=this.data.form_bg_color&&""!=this.data.form_bg_color?(this.el.find(".ig_form_container").css("background-color",this.data.form_bg_color),d+=".ig_form_"+t+".ig_form_"+a+" .ig_form_container:before{ background-color:"+this.data.form_bg_color+"; border-color:"+this.data.form_bg_color+";}"):d+=".ig_form_"+t+".ig_form_"+a+" .ig_form_container:before{ display:none;}",void 0!=this.data.form_text_color&&""!=this.data.form_text_color&&this.el.find(".ig_form_container").css("color",this.data.form_text_color),this.el.addClass("ig_form_"+a).find(".ig_form_container").prepend('<style type="text/css">'+d+"</style>"),this.el.find(".ig_form_container.layout_"+t+" .ig_form_els").first().addClass("ig_form_els_first").end().last().addClass("ig_form_els_last")}}}},Icegram_Message_Type.prototype.render=function(){this.pre_render();var e=this.render_template();try{jQuery(this.root_container).append(e)}catch(t){}this.dom_id="icegram_message_"+this.data.id,this.el=jQuery("#"+this.dom_id),this.set_position();var i=window.icegram.get_powered_by(this.type);if(i.hasOwnProperty("link")&&i.hasOwnProperty("text")&&""!=i.text&&this.add_powered_by(i),(void 0==this.data.headline||""==this.data.headline)&&this.el.find(".ig_headline").hide(),(void 0==this.data.icon||""==this.data.icon)&&this.el.addClass("ig_no_icon").find(".ig_icon").remove(),(void 0==this.data.message||""==this.data.message)&&this.el.find(".ig_message").hide(),(void 0==this.data.label||""==this.data.label)&&this.el.find(".ig_button").hide(),this.embed_form(),void 0==this.data.use_theme_defaults||"yes"!=this.data.use_theme_defaults){if(void 0!=this.data.text_color&&""!=this.data.text_color&&(this.el.css("color",this.data.text_color),this.el.find(".ig_container").css("color",this.data.text_color)),void 0!=this.data.bg_color&&""!=this.data.bg_color&&(this.el.css("background-color",this.data.bg_color),this.el.find(".ig_container").css("background-color",this.data.bg_color)),void 0!=this.data.cta_bg_color&&""!=this.data.cta_bg_color){this.el.find('.ig_button, form input[type="submit"]').css("background-color",this.data.cta_bg_color);var a=window.icegram.hexToHsl(this.data.cta_bg_color);this.el.find('.ig_button, form input[type="submit"]').css("border-color","hsl("+a.h+","+(a.s-5)+"%,"+(a.l-8)+"%)")}void 0!=this.data.cta_text_color&&""!=this.data.cta_text_color&&this.el.find('.ig_button, form input[type="submit"]').css("color",this.data.cta_text_color)}"string"==typeof this.data.link&&""!=this.data.link&&this.el.parent().find(".ig_cta, .ig_button").css("cursor","pointer"),this.post_render(),this.hide({},!0),this.set_up_show_trigger()},Icegram.prototype.formProcess=function(e,t){var i=jQuery("<div/>").html(t).find(".gform_validation_container input").data("required_field",!0).end().find("input, label, select, textarea, button").not("br");if(i.length>0){var a=jQuery('<div class="ig_embed_form_container ig_clear_fix"></div>'),r=jQuery("<div/>").html(t).find("form").removeAttr("class").removeAttr("style").addClass("ig_clear_fix").empty(),o=".",s=0;jQuery.each(i,function(e,t){var i=jQuery(t),r=jQuery('<div class="ig_form_els"></div>');if(i.removeAttr("class").removeAttr("style"),(-1==i.attr("tabindex")||i.is('*[name*="[abs]"]')||i.data("required_field")||"_mc4wp_required_but_not_really"==i.attr("name"))&&(i.addClass("ig_form_required_field").removeData("required_field"),s--),("hidden"==i.attr("type")||1==i.prop("disabled"))&&(i.addClass("ig_form_hidden_field"),s--),i.is("label"))o=i.not("input, select, textarea, button, span, br").text().replace(/\s+/g," ")||".";else if((i.is("input")||i.is("button")||i.is("textarea")||i.is("select"))&&!i.is("input[type=radio]")){if(i.removeAttr("id"),i.is("button")){var n=i.not("br, span, div").text().trim()||"";i.remove(),i=jQuery('<input type="submit" value="'+n+'">')}!i.is("input[type=submit]")&&!i.is("input[type=button]")||i.is(".ig_form_hidden_field, .ig_form_required_field")||i.addClass("ig_button"),(i.is("input[type=text]")||i.is("input[type=email]"))&&i.attr("size",25),label_class="ig_el_label ig_button_label","."!=o&&(label_class="ig_el_label",i.is("select")?jQuery('<option class="ig_el_placeholder">'+o+"</option>").prependTo(i):i.attr("placeholder",o)),jQuery('<label class="'+label_class+'">'+o+"</label>").appendTo(r),o=".",r.append(i),a.append(r),s++}else i.is("input[type=radio]")&&(label_class="ig_el_label ig_button_label","."!=o&&(label_class="ig_el_label"),jQuery('<label><span class="'+label_class+'">'+o+"</span></label>").prepend(i).appendTo(r),o=".",r.addClass("ig_form_el_radio"),a.append(r),s++)});var n=["","ig_full","ig_half","ig_third","ig_quater"];return s=4>s?s:4,a.find(".ig_form_required_field").length<=0&&a.append('<div class="ig_form_els"><input class="ig_form_required_field" type="text" tabindex="-1"></input></div>'),a.addClass(n[s]).find(".ig_form_required_field").parent().removeClass("ig_form_els").css({position:"absolute",left:"-5000px"}).end().end().find(".ig_form_hidden_field").parent().removeClass("ig_form_els").css({display:"none"}),r.append(a),jQuery("<div/>").append(r).html()}return null},Icegram_Message_Type.prototype.render_template=function(){return"function"!=typeof window.icegram.get_template_fn(this.type)&&window.icegram.set_template_fn(this.type,new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+this.template.replace(/[\r\t\n]/g," ").split("{{").join(" ").replace(/((^|\}\})[^\t]*)'/g,"$1\r").replace(/\t=(.*?)\}\}/g,"',$1,'").split(" ").join("');").split("}}").join("p.push('").split("\r").join("\\'")+"');}return p.join('');")),window.icegram.get_template_fn(this.type)(this.data)},Icegram_Message_Type.prototype.pre_render=function(){},Icegram_Message_Type.prototype.post_render=function(){},Icegram_Message_Type.prototype.set_up_show_trigger=function(){if(isNaN(this.data.delay_time))this.show();else if(this.data.delay_time>=0){var e=this;this.timer=setTimeout(function(){e.show()},1e3*this.data.delay_time)}},Icegram_Message_Type.prototype.set_template=function(e){this.template=e},Icegram_Message_Type.prototype.get_template_default=function(){return'<div id="icegram_message_{{=id}}" class="icegram"><div class="ig_headline">{{=headline}}</div></div>'},Icegram_Message_Type.prototype.show=function(e,t){this.is_visible()||(this.animate("in"),this.pre_show(),this.el.show(e),this.el.addClass("ig_show").removeClass("ig_hide"),t!==!0&&this.track("shown"),this.post_show());var i=this;window.icegram.adjustFormContainerHeight(i)},Icegram_Message_Type.prototype.hide=function(e,t){if(this.is_visible()){var i=this;this.animate("out"),this.pre_hide(),setTimeout(function(){i.el.hasClass("ig_no_hide")||i.el.hide(e),i.el.addClass("ig_hide").removeClass("ig_show")},500),t!==!0&&this.track("closed"),this.post_hide()}},Icegram_Message_Type.prototype.set_position=function(){},Icegram_Message_Type.prototype.add_powered_by=function(e){},Icegram_Message_Type.prototype.pre_show=function(){},Icegram_Message_Type.prototype.post_show=function(){},Icegram_Message_Type.prototype.pre_hide=function(){},Icegram_Message_Type.prototype.post_hide=function(){},Icegram_Message_Type.prototype.track=function(e,t){"function"==typeof window.icegram.track&&(t=t||{},jQuery.extend(t,{message_id:this.data.id,campaign_id:this.data.campaign_id,expiry_time:this.data.expiry_time,expiry_time_clicked:this.data.expiry_time_clicked}),window.icegram.track(e,t))},Icegram_Message_Type.prototype.is_visible=function(){return this.el.hasClass("ig_show")},Icegram_Message_Type.prototype.toggle=function(e){this.is_visible()?this.hide(e):this.show(e)},Icegram_Message_Type.prototype.on_click=function(e){if(e.data=e.data||{self:this},jQuery(e.target).filter(".ig_close").length)return void e.data.self.hide();var t=jQuery(e.target).closest(".icegram").find("form:visible").first();(jQuery(e.target).filter(".ig_button, .ig_cta ,:submit").length||jQuery(e.target).parents(".ig_button, .ig_cta ").length&&!(t.find("ig_button").length>0||t.find("input[type=button]").length>0||t.find("input[type=submit]").length>0))&&e.data.self.on_cta_click(e)},Icegram_Message_Type.prototype.on_resize=function(e){},Icegram_Message_Type.prototype.on_cta_click=function(e){e.data=e.data||{self:this},e.data.self.track("clicked");var t=jQuery(e.target).closest(".icegram").find("form:visible").first();return jQuery(t).length&&jQuery(t).find(".ig_form_required_field").length&&""!==jQuery(t).find(".ig_form_required_field").val()?(e.preventDefault(),void e.data.self.hide()):void(jQuery(t).length?jQuery(t).submit():"string"==typeof e.data.self.data.link&&""!=e.data.self.data.link?window.location.href=e.data.self.data.link:e.data.self.data.hide!==!1&&e.data.self.hide())},Icegram_Message_Type.prototype.animate=function(e){if("undefined"!=typeof this.data.animation){var t=this.data.animation,i=this;"in"==e?"function"==typeof this.animations[t+"_in"]?this.animations[t+"_in"](i):this.el.hasClass("ig_anim_"+t+"_in")||(this.el.removeClass("ig_anim_"+t+"_out"),setTimeout(function(){i.el.addClass("ig_anim_"+t+"_in")},1)):"out"==e&&("function"==typeof this.animations[t+"_out"]?this.animations[t+"_out"](i):(this.el.removeClass("ig_anim_"+t+"_in"),setTimeout(function(){i.el.addClass("ig_anim_"+t+"_out")},1)))}},String.prototype.ucwords=function(){return this.toLowerCase().replace(/\b[a-z]/g,function(e){return e.toUpperCase()})},Icegram.prototype.adjustFormContainerHeight=function(e){var t="";if(e.el.hasClass("ig_form_left")||e.el.hasClass("ig_form_right")){t=e.el.hasClass("ig_form_left")?"left":"right";var i=e.el.find(".ig_data").outerHeight()>e.el.find(".ig_form_container.layout_"+t).outerHeight()?e.el.find(".ig_data").outerHeight():e.el.find(".ig_form_container.layout_"+t).outerHeight();e.el.find(".ig_form_container").outerHeight(i)}},Icegram.prototype.hexToRgb=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},Icegram.prototype.rgbToHsl=function(e,t,i){e/=255,t/=255,i/=255;var a,r,o=Math.max(e,t,i),s=Math.min(e,t,i),n=(o+s)/2;if(o==s)a=r=0;else{var _=o-s;switch(r=n>.5?_/(2-o-s):_/(o+s),o){case e:a=(t-i)/_;break;case t:a=(i-e)/_+2;break;case i:a=(e-t)/_+4}n=Math.floor(100*n),r=Math.floor(100*r),a=Math.floor(60*a),0>a&&(a+=360)}return{h:a,s:r,l:n}},Icegram.prototype.hexToHsl=function(e){var t=window.icegram.hexToRgb(e);return window.icegram.rgbToHsl(t.r,t.g,t.b)},"function"!=typeof Object.create&&!function(){var e=function(){};Object.create=function(t){if(arguments.length>1)throw Error("Second argument not supported");if(null===t)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof t)throw TypeError("Argument must be an object");return e.prototype=t,new e}}(),void 0!==typeof jQuery.cookie&&!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function t(e){return n.raw?e:encodeURIComponent(e)}function i(e){return n.raw?e:decodeURIComponent(e)}function a(e){return t(n.json?JSON.stringify(e):String(e))}function r(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(s," ")),n.json?JSON.parse(e):e}catch(t){}}function o(t,i){var a=n.raw?t:r(t);return e.isFunction(i)?i(a):a}var s=/\+/g,n=e.cookie=function(r,s,_){if(void 0!==s&&!e.isFunction(s)){if(_=e.extend({},n.defaults,_),"number"==typeof _.expires){var d=_.expires,l=_.expires=new Date;l.setTime(+l+864e5*d)}return document.cookie=[t(r),"=",a(s),_.expires?"; expires="+_.expires.toUTCString():"",_.path?"; path="+_.path:"",_.domain?"; domain="+_.domain:"",_.secure?"; secure":""].join("")}for(var c=r?void 0:{},p=document.cookie?document.cookie.split("; "):[],g=0,h=p.length;h>g;g++){var m=p[g].split("="),f=i(m.shift()),u=m.join("=");if(r&&r===f){c=o(u,s);break}r||void 0===(u=o(u))||(c[f]=u)}return c};n.defaults={},e.removeCookie=function(t,i){return void 0===e.cookie(t)?!1:(e.cookie(t,"",e.extend({},i,{expires:-1})),!e.cookie(t))}});
1
+ function Icegram(){}function Icegram_Message_Type(e){var e;this.root_container="#icegram_messages_container",this.data=e,this.type=e.type,this.data.delay_time=parseInt(this.data.delay_time),"string"!=typeof this.data.link||""==this.data.link||/^tel:/i.test(this.data.link)||/^https?:\/\//i.test(this.data.link)||(this.data.link="http://"+this.data.link),this.set_template(this.get_template_default()),this.init()}Icegram.prototype.init=function(e){if(void 0!=e){jQuery(window).trigger("preinit.icegram",[e]),this.data=e,this.defaults=jQuery.extend({},e.defaults),this.message_data=e.messages,this.messages,this.tracking_data=[],this.message_template_cache={},this.map_id_to_index={},this.map_type_to_index={},this.mode=void 0==window.ig_mode?"local":window.ig_mode,this.powered_by={link:"http://www.icegram.com/?utm_source=inapp&utm_campaign=poweredby&utm_medium="},this.powered_by.text=this.defaults.powered_by_text,this.powered_by.logo=this.defaults.powered_by_logo,jQuery("body").append('<div id="icegram_messages_container"></div>');this.messages=[];var t=this;this.message_data.length>0&&jQuery.each(this.message_data,function(e,i){try{if(-1==window.location.href.indexOf("campaign_preview_id")){if("yes"==i.retargeting&&1==jQuery.cookie("icegram_campaign_shown_"+i.id))return;if("yes"==i.retargeting_clicked&&1==jQuery.cookie("icegram_campaign_clicked_"+i.id))return}var a=null,r=i.type.split("-").join(" ").ucwords().split(" ").join("_");a="function"==typeof window["Icegram_Message_Type_"+r]?new window["Icegram_Message_Type_"+r](i):new Icegram_Message_Type(i),t.messages.push(a),t.map_id_to_index["_"+i.id]=e,t.map_type_to_index[i.type]=jQuery.isArray(t.map_type_to_index[i.type])?t.map_type_to_index[i.type]:new Array,t.map_type_to_index[i.type].push(e)}catch(o){}}),jQuery(window).unload(function(){"function"==typeof window.icegram.submit_tracking_data&&window.icegram.submit_tracking_data(!1)}),setInterval(function(){"function"==typeof window.icegram.submit_tracking_data&&window.icegram.submit_tracking_data(!0)},5e3),jQuery(window).trigger("init.icegram",[this])}},Icegram.prototype.timer_tick=function(){},Icegram.prototype.get_template_fn=function(e){return this.message_template_cache[e]},Icegram.prototype.set_template_fn=function(e,t){this.message_template_cache[e]=t},Icegram.prototype.get_message=function(e){return this.messages.length>e?this.messages[e]:void 0},Icegram.prototype.get_message_by_id=function(e){if(this.map_id_to_index.hasOwnProperty("_"+e)){var t=this.map_id_to_index["_"+e];return this.get_message(t)}return void 0},Icegram.prototype.get_messages_by_type=function(e){if(this.map_type_to_index.hasOwnProperty(e)){var t=this.map_type_to_index[e],i=[];if(jQuery.isArray(t)){var a=this;jQuery.each(t,function(e,t){i.push(a.get_message(t))})}return i}return void 0},Icegram.prototype.get_powered_by=function(e){var t=jQuery.extend({},this.powered_by);return t.link=t.link+(e||""),t},Icegram.prototype.track=function(e,t){"object"==typeof t&&t.hasOwnProperty("message_id")&&t.hasOwnProperty("campaign_id")&&(jQuery(window).trigger("track.icegram",[e,t]),this.tracking_data.push({type:e,params:t}))},Icegram.prototype.submit_tracking_data=function(e){var t=window.location.protocol.split(":"),i=t[0],a=this.data.ajax_url.split("://"),r=a[0];if(this.tracking_data.length>0&&-1==window.location.href.indexOf("campaign_preview_id")){var o={type:"POST",url:this.data.ajax_url,async:e||!1,data:{action:"icegram_event_track",event_data:JSON.parse(JSON.stringify(this.tracking_data)),ig_remote_url:"remote"==this.mode?window.location.href:void 0},success:function(e,t,i){},error:function(e,t,i){}};"remote"==this.mode?(o.xhrFields={withCredentials:!0},o.crossDomain=!0,o.async=!0):i!=r&&(o.xhrFields={withCredentials:!0},jQuery.extend(o.data,{ig_local_url_cs:window.location.href})),jQuery.ajax(o),this.tracking_data=[]}},Icegram.prototype.hide_all_messages=function(){this.messages.length>0&&jQuery.each(this.messages,function(e,t){t.hide()})},Icegram_Message_Type.prototype.init=function(){this.render(),this.add_event_handlers()},Icegram_Message_Type.prototype.add_event_handlers=function(){this.el.on("click",{self:this},this.on_click),jQuery(window).on("resize",{self:this},this.on_resize)},Icegram_Message_Type.prototype.animations={},Icegram_Message_Type.prototype.embed_form=function(){if(-1===jQuery.inArray(this.data.type,["toast","badge","ribbon","exit-redirect"])){var e=null,t=this.data.form_layout,i=this.data.form_has_label,a=this.data.form_style||"none",r=this.data.label||void 0;if(a=a.toLowerCase().replace(" ","_"),void 0!=this.data.use_form&&"yes"==this.data.use_form&&(e=this.data.form_html),this.el.find("form.ig_embed_form").length>0){var o=this.el.find("form.ig_embed_form");t="inline",-1===jQuery.inArray(this.data.type,["messenger","tab","sidebar","interstitial","sticky"])&&(o.hasClass("ig_left")?t="left":o.hasClass("ig_right")&&(t="right")),"inline"==t&&this.el.find("form.ig_embed_form").replaceWith('<div class="ig_form_container layout_inline"></div>'),i=o.find(".ig_form_el_group label").length>0?"yes":void 0,0==o.find(".ig_button").length&&0==o.find("button[type=submit]").length&&(r=r||"Submit",o.append('<input class="ig_button" type="submit" value="'+r+'">')),e=jQuery("<div/>").append(o).html()}if(null==e)this.el.find(".ig_form_container").remove();else{var s=window.icegram.formProcess(this,e);if(s){var n=void 0!=this.data.form_header&&""!=this.data.form_header?'<div class="ig_form_header">'+this.data.form_header+"</div>":"",_=void 0!=this.data.form_footer&&""!=this.data.form_footer?'<div class="ig_form_footer">'+this.data.form_footer+"</div>":"";this.el.find(".ig_form_container").append(n).append(s).append(_),void 0==i?this.el.find(".ig_el_label").not("span.ig_el_label").remove():(this.el.find("input, textarea").removeAttr("placeholder"),this.el.find("select option.ig_el_placeholder").remove()),this.el.find(".ig_form_container .ig_button").length>0&&(this.el.find(".ig_button").not(".ig_form_container .ig_button").hide(),r=r||this.el.find(".ig_button").val()||"Submit",this.el.find(".ig_button").val(r)),this.el.addClass("ig_form_"+t);var d="";void 0!=this.data.form_bg_color&&""!=this.data.form_bg_color?(this.el.find(".ig_form_container").css("background-color",this.data.form_bg_color),d+=".ig_form_"+t+".ig_form_"+a+" .ig_form_container:before{ background-color:"+this.data.form_bg_color+"; border-color:"+this.data.form_bg_color+";}"):d+=".ig_form_"+t+".ig_form_"+a+" .ig_form_container:before{ display:none;}",void 0!=this.data.form_text_color&&""!=this.data.form_text_color&&this.el.find(".ig_form_container").css("color",this.data.form_text_color),this.el.addClass("ig_form_"+a).find(".ig_form_container").prepend('<style type="text/css">'+d+"</style>"),this.el.find(".ig_form_container.layout_"+t+" .ig_form_els").first().addClass("ig_form_els_first").end().last().addClass("ig_form_els_last")}}}},Icegram_Message_Type.prototype.render=function(){this.pre_render();var e=this.render_template();try{jQuery(this.root_container).append(e)}catch(t){}this.dom_id="icegram_message_"+this.data.id,this.el=jQuery("#"+this.dom_id),this.set_position();var i=window.icegram.get_powered_by(this.type);if(i.hasOwnProperty("link")&&i.hasOwnProperty("text")&&""!=i.text&&this.add_powered_by(i),(void 0==this.data.headline||""==this.data.headline)&&this.el.find(".ig_headline").hide(),(void 0==this.data.icon||""==this.data.icon)&&this.el.addClass("ig_no_icon").find(".ig_icon").remove(),(void 0==this.data.message||""==this.data.message)&&this.el.find(".ig_message").hide(),(void 0==this.data.label||""==this.data.label)&&this.el.find(".ig_button").hide(),this.embed_form(),void 0==this.data.use_theme_defaults||"yes"!=this.data.use_theme_defaults){if(void 0!=this.data.text_color&&""!=this.data.text_color&&(this.el.css("color",this.data.text_color),this.el.find(".ig_container").css("color",this.data.text_color)),void 0!=this.data.bg_color&&""!=this.data.bg_color&&(this.el.css("background-color",this.data.bg_color),this.el.find(".ig_container").css("background-color",this.data.bg_color)),void 0!=this.data.cta_bg_color&&""!=this.data.cta_bg_color){this.el.find('.ig_button, form input[type="submit"]').css("background-color",this.data.cta_bg_color);var a=window.icegram.hexToHsl(this.data.cta_bg_color);this.el.find('.ig_button, form input[type="submit"]').css("border-color","hsl("+a.h+","+(a.s-5)+"%,"+(a.l-8)+"%)")}void 0!=this.data.cta_text_color&&""!=this.data.cta_text_color&&this.el.find('.ig_button, form input[type="submit"]').css("color",this.data.cta_text_color)}"string"==typeof this.data.link&&""!=this.data.link&&this.el.parent().find(".ig_cta, .ig_button").css("cursor","pointer"),this.post_render(),this.hide({},!0),this.set_up_show_trigger()},Icegram.prototype.formProcess=function(e,t){var i=jQuery("<div/>").html(t).find(".gform_validation_container input").data("required_field",!0).end().find(".required_field").data("required_field",!0).end().find("input, label, select, textarea, button").not("br");if(i.length>0){var a=jQuery('<div class="ig_embed_form_container ig_clear_fix"></div>'),r=jQuery("<div/>").html(t).find("form").removeAttr("class").removeAttr("style").addClass("ig_clear_fix").empty(),o=".",s=0;jQuery.each(i,function(e,t){var i=jQuery(t),r=jQuery('<div class="ig_form_els"></div>');if(i.removeAttr("class").removeAttr("style"),(-1==i.attr("tabindex")||i.is('*[name*="[abs]"]')||i.data("required_field")||"_mc4wp_required_but_not_really"==i.attr("name"))&&(i.addClass("ig_form_required_field").removeData("required_field"),s--),("hidden"==i.attr("type")||1==i.prop("disabled"))&&(i.addClass("ig_form_hidden_field"),s--),i.is("label"))o=i.not("input, select, textarea, button, span, br").text().replace(/\s+/g," ")||".";else if((i.is("input")||i.is("button")||i.is("textarea")||i.is("select"))&&!i.is("input[type=radio]")){if(i.removeAttr("id"),i.is("button")){var n=i.not("br, span, div").text().trim()||"";i.remove(),i=jQuery('<input type="submit" value="'+n+'">')}!i.is("input[type=submit]")&&!i.is("input[type=button]")||i.is(".ig_form_hidden_field, .ig_form_required_field")||i.addClass("ig_button"),(i.is("input[type=text]")||i.is("input[type=email]"))&&i.attr("size",25),label_class="ig_el_label ig_button_label","."!=o&&(label_class="ig_el_label",i.is("select")?jQuery('<option class="ig_el_placeholder">'+o+"</option>").prependTo(i):i.attr("placeholder",o)),jQuery('<label class="'+label_class+'">'+o+"</label>").appendTo(r),o=".",r.append(i),a.append(r),s++}else i.is("input[type=radio]")&&(label_class="ig_el_label ig_button_label","."!=o&&(label_class="ig_el_label"),jQuery('<label><span class="'+label_class+'">'+o+"</span></label>").prepend(i).appendTo(r),o=".",r.addClass("ig_form_el_radio"),a.append(r),s++)});var n=["","ig_full","ig_half","ig_third","ig_quater"];return s=4>s?s:4,a.find(".ig_form_required_field").length<=0&&a.append('<div class="ig_form_els"><input class="ig_form_required_field" type="text" tabindex="-1"></input></div>'),a.addClass(n[s]).find(".ig_form_required_field").parent().removeClass("ig_form_els").css({position:"absolute",left:"-5000px"}).end().end().find(".ig_form_hidden_field").parent().removeClass("ig_form_els").css({display:"none"}),r.append(a),jQuery("<div/>").append(r).html()}return null},Icegram_Message_Type.prototype.render_template=function(){return"function"!=typeof window.icegram.get_template_fn(this.type)&&window.icegram.set_template_fn(this.type,new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+this.template.replace(/[\r\t\n]/g," ").split("{{").join(" ").replace(/((^|\}\})[^\t]*)'/g,"$1\r").replace(/\t=(.*?)\}\}/g,"',$1,'").split(" ").join("');").split("}}").join("p.push('").split("\r").join("\\'")+"');}return p.join('');")),window.icegram.get_template_fn(this.type)(this.data)},Icegram_Message_Type.prototype.pre_render=function(){},Icegram_Message_Type.prototype.post_render=function(){},Icegram_Message_Type.prototype.set_up_show_trigger=function(){if(isNaN(this.data.delay_time))this.show();else if(this.data.delay_time>=0){var e=this;this.timer=setTimeout(function(){e.show()},1e3*this.data.delay_time)}},Icegram_Message_Type.prototype.set_template=function(e){this.template=e},Icegram_Message_Type.prototype.get_template_default=function(){return'<div id="icegram_message_{{=id}}" class="icegram"><div class="ig_headline">{{=headline}}</div></div>'},Icegram_Message_Type.prototype.show=function(e,t){this.is_visible()||(this.animate("in"),this.pre_show(),this.el.show(e),this.el.addClass("ig_show").removeClass("ig_hide"),t!==!0&&this.track("shown"),this.post_show());var i=this;window.icegram.adjustFormContainerHeight(i)},Icegram_Message_Type.prototype.hide=function(e,t){if(this.is_visible()){var i=this;this.animate("out"),this.pre_hide(),setTimeout(function(){i.el.hasClass("ig_no_hide")||i.el.hide(e),i.el.addClass("ig_hide").removeClass("ig_show")},500),t!==!0&&this.track("closed"),this.post_hide()}},Icegram_Message_Type.prototype.set_position=function(){},Icegram_Message_Type.prototype.add_powered_by=function(e){},Icegram_Message_Type.prototype.pre_show=function(){},Icegram_Message_Type.prototype.post_show=function(){},Icegram_Message_Type.prototype.pre_hide=function(){},Icegram_Message_Type.prototype.post_hide=function(){},Icegram_Message_Type.prototype.track=function(e,t){"function"==typeof window.icegram.track&&(t=t||{},jQuery.extend(t,{message_id:this.data.id,campaign_id:this.data.campaign_id,expiry_time:this.data.expiry_time,expiry_time_clicked:this.data.expiry_time_clicked}),window.icegram.track(e,t))},Icegram_Message_Type.prototype.is_visible=function(){return this.el.hasClass("ig_show")},Icegram_Message_Type.prototype.toggle=function(e){this.is_visible()?this.hide(e):this.show(e)},Icegram_Message_Type.prototype.on_click=function(e){if(e.data=e.data||{self:this},jQuery(e.target).filter(".ig_close").length)return void e.data.self.hide();var t=jQuery(e.target).closest(".icegram").find("form:visible").first();(jQuery(e.target).filter(".ig_button, .ig_cta ,:submit").length||jQuery(e.target).parents(".ig_button, .ig_cta ").length&&!(t.find(".ig_button, input[type=button], input[type=submit], button[type=submit]").length>0))&&e.data.self.on_cta_click(e)},Icegram_Message_Type.prototype.on_resize=function(e){},Icegram_Message_Type.prototype.on_cta_click=function(e){e.data=e.data||{self:this},e.data.self.track("clicked");var t=jQuery(e.target).closest(".icegram").find("form:visible").first();return jQuery(t).length&&jQuery(t).find(".ig_form_required_field").length&&""!==jQuery(t).find(".ig_form_required_field").val()?(e.preventDefault(),void e.data.self.hide()):void(jQuery(t).length?jQuery(t).submit(function(e){jQuery(t).hasClass("ig_form_init_done")&&e.preventDefault()}):"string"==typeof e.data.self.data.link&&""!=e.data.self.data.link?window.location.href=e.data.self.data.link:e.data.self.data.hide!==!1&&e.data.self.hide())},Icegram_Message_Type.prototype.animate=function(e){if("undefined"!=typeof this.data.animation){var t=this.data.animation,i=this;"in"==e?"function"==typeof this.animations[t+"_in"]?this.animations[t+"_in"](i):this.el.hasClass("ig_anim_"+t+"_in")||(this.el.removeClass("ig_anim_"+t+"_out"),setTimeout(function(){i.el.addClass("ig_anim_"+t+"_in")},1)):"out"==e&&("function"==typeof this.animations[t+"_out"]?this.animations[t+"_out"](i):(this.el.removeClass("ig_anim_"+t+"_in"),setTimeout(function(){i.el.addClass("ig_anim_"+t+"_out")},1)))}},String.prototype.ucwords=function(){return this.toLowerCase().replace(/\b[a-z]/g,function(e){return e.toUpperCase()})},Icegram.prototype.adjustFormContainerHeight=function(e){var t="";if(e.el.hasClass("ig_form_left")||e.el.hasClass("ig_form_right")){t=e.el.hasClass("ig_form_left")?"left":"right";var i=e.el.find(".ig_data").outerHeight()>e.el.find(".ig_form_container.layout_"+t).outerHeight()?e.el.find(".ig_data").outerHeight():e.el.find(".ig_form_container.layout_"+t).outerHeight();e.el.find(".ig_form_container").outerHeight(i)}},Icegram.prototype.hexToRgb=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},Icegram.prototype.rgbToHsl=function(e,t,i){e/=255,t/=255,i/=255;var a,r,o=Math.max(e,t,i),s=Math.min(e,t,i),n=(o+s)/2;if(o==s)a=r=0;else{var _=o-s;switch(r=n>.5?_/(2-o-s):_/(o+s),o){case e:a=(t-i)/_;break;case t:a=(i-e)/_+2;break;case i:a=(e-t)/_+4}n=Math.floor(100*n),r=Math.floor(100*r),a=Math.floor(60*a),0>a&&(a+=360)}return{h:a,s:r,l:n}},Icegram.prototype.hexToHsl=function(e){var t=window.icegram.hexToRgb(e);return window.icegram.rgbToHsl(t.r,t.g,t.b)},"function"!=typeof Object.create&&!function(){var e=function(){};Object.create=function(t){if(arguments.length>1)throw Error("Second argument not supported");if(null===t)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof t)throw TypeError("Argument must be an object");return e.prototype=t,new e}}(),void 0!==typeof jQuery.cookie&&!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function t(e){return n.raw?e:encodeURIComponent(e)}function i(e){return n.raw?e:decodeURIComponent(e)}function a(e){return t(n.json?JSON.stringify(e):String(e))}function r(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(s," ")),n.json?JSON.parse(e):e}catch(t){}}function o(t,i){var a=n.raw?t:r(t);return e.isFunction(i)?i(a):a}var s=/\+/g,n=e.cookie=function(r,s,_){if(void 0!==s&&!e.isFunction(s)){if(_=e.extend({},n.defaults,_),"number"==typeof _.expires){var d=_.expires,l=_.expires=new Date;l.setTime(+l+864e5*d)}return document.cookie=[t(r),"=",a(s),_.expires?"; expires="+_.expires.toUTCString():"",_.path?"; path="+_.path:"",_.domain?"; domain="+_.domain:"",_.secure?"; secure":""].join("")}for(var c=r?void 0:{},p=document.cookie?document.cookie.split("; "):[],g=0,h=p.length;h>g;g++){var m=p[g].split("="),f=i(m.shift()),u=m.join("=");if(r&&r===f){c=o(u,s);break}r||void 0===(u=o(u))||(c[f]=u)}return c};n.defaults={},e.removeCookie=function(t,i){return void 0===e.cookie(t)?!1:(e.cookie(t,"",e.extend({},i,{expires:-1})),!e.cookie(t))}});
assets/js/main.js CHANGED
@@ -1 +1 @@
1
- function load_scripts_and_css(t){var a={};jQuery.each(t.css,function(t,e){a["ig_css_"+t]=1}),jQuery.each(t.scripts,function(t,e){a["ig_script_"+t]=1});var e=function(e){var r=e.target.id||"";""!=r&&a.hasOwnProperty(r)&&delete a[r],jQuery.isEmptyObject(a)&&(jQuery(window).trigger("scripts_loaded.icegram"),jQuery(function(){window.icegram=new Icegram,window.icegram.init(t),icegram_timing.end=Date.now()}))};jQuery.each(t.css,function(t,a){jQuery("<link>").attr("type","text/css").attr("rel","stylesheet").attr("id","ig_css_"+t).attr("media","all").appendTo("head").on("load",e).attr("href",a)});var r=t.scripts.shift();jQuery("<script>").attr("type","text/javascript").attr("id","ig_script_0").appendTo("body").on("load",function(a){e(a),jQuery.each(t.scripts,function(t,a){jQuery("<script>").attr("type","text/javascript").attr("id","ig_script_"+(t+1)).appendTo("body").on("load",e).attr("src",a)})}).attr("src",r)}try{var icegram_data,icegram_timing={};icegram_pre_data.post_obj.referral_url=window.location.href,icegram_timing.start=Date.now(),"yes"===icegram_pre_data.post_obj.cache_compatibility?jQuery.ajax({url:icegram_pre_data.ajax_url,type:"POST",async:!0,cache:!1,data:icegram_pre_data.post_obj,dataType:"json",success:function(t){t?(icegram_data=t,load_scripts_and_css(icegram_data)):jQuery(".ig_inline_container:empty").remove()},error:function(t){}}):"undefined"!=typeof icegram_data&&load_scripts_and_css(icegram_data)}catch(e){console.log(e)}
1
+ function load_scripts_and_css(a){var t={};jQuery.each(a.css,function(a,e){t["ig_css_"+a]=1}),jQuery.each(a.scripts,function(a,e){t["ig_script_"+a]=1});var e=function(e){var r=e.target.id||"";""!=r&&t.hasOwnProperty(r)&&delete t[r],jQuery.isEmptyObject(t)&&(jQuery(window).trigger("scripts_loaded.icegram"),jQuery(function(){window.icegram=new Icegram,window.icegram.init(a),jQuery("body").addClass("ig_"+icegram_pre_data.post_obj.device),icegram_timing.end=Date.now()}))};jQuery.each(a.css,function(a,t){jQuery("<link>").attr("type","text/css").attr("rel","stylesheet").attr("id","ig_css_"+a).attr("media","all").appendTo("head").on("load",e).attr("href",t)});var r=a.scripts.shift();jQuery("<script>").attr("type","text/javascript").attr("id","ig_script_0").appendTo("body").on("load",function(t){e(t),jQuery.each(a.scripts,function(a,t){jQuery("<script>").attr("type","text/javascript").attr("id","ig_script_"+(a+1)).appendTo("body").on("load",e).attr("src",t)})}).attr("src",r)}try{var icegram_data,icegram_timing={};icegram_pre_data.post_obj.referral_url=window.location.href,icegram_timing.start=Date.now(),"yes"===icegram_pre_data.post_obj.cache_compatibility?jQuery.ajax({url:icegram_pre_data.ajax_url,type:"POST",async:!0,cache:!1,data:icegram_pre_data.post_obj,dataType:"json",success:function(a){a?(icegram_data=a,load_scripts_and_css(icegram_data)):jQuery(".ig_inline_container:empty").remove()},error:function(a){}}):"undefined"!=typeof icegram_data&&load_scripts_and_css(icegram_data)}catch(e){console.log(e)}
classes/class-icegram-campaign-admin.php CHANGED
@@ -21,6 +21,7 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
21
  //duplicate campaign
22
  add_filter( 'post_row_actions', array(&$this , 'add_campaign_action'), 10, 2 );
23
  add_action('admin_init', array(&$this ,'duplicate_campaign') ,10, 1);
 
24
  $this->site_url = home_url().'/';
25
 
26
  $this->default_target_rules = apply_filters( 'icegram_campaign_default_rules',
@@ -667,5 +668,6 @@ if ( !class_exists( 'Icegram_Campaign_Admin' ) ) {
667
  Icegram::duplicate( $_REQUEST['campaign_id'] );
668
  }
669
  }
 
670
  }
671
  }
21
  //duplicate campaign
22
  add_filter( 'post_row_actions', array(&$this , 'add_campaign_action'), 10, 2 );
23
  add_action('admin_init', array(&$this ,'duplicate_campaign') ,10, 1);
24
+
25
  $this->site_url = home_url().'/';
26
 
27
  $this->default_target_rules = apply_filters( 'icegram_campaign_default_rules',
668
  Icegram::duplicate( $_REQUEST['campaign_id'] );
669
  }
670
  }
671
+
672
  }
673
  }
classes/class-icegram-campaign.php CHANGED
@@ -106,13 +106,13 @@ if ( !class_exists( 'Icegram_Campaign' ) ) {
106
  }
107
 
108
  function _is_valid_time( $campaign_valid, $campaign, $options ) {
 
109
  if( !$campaign_valid ) {
110
  return $campaign_valid;
111
  }
112
  if ( !empty( $campaign->rules_summary['when']['when'] ) && $campaign->rules_summary['when']['when'] == 'always' ) {
113
  return true;
114
  }
115
-
116
  if ( ( !empty( $campaign->rules_summary['when']['from'] ) && time() > strtotime( $campaign->rules_summary['when']['from'] . " 00:00:00") ) && ( !empty( $campaign->rules_summary['when']['to'] ) && strtotime( $campaign->rules_summary['when']['to'] . " 23:59:59") > time() ) ) {
117
  return true;
118
  }
106
  }
107
 
108
  function _is_valid_time( $campaign_valid, $campaign, $options ) {
109
+
110
  if( !$campaign_valid ) {
111
  return $campaign_valid;
112
  }
113
  if ( !empty( $campaign->rules_summary['when']['when'] ) && $campaign->rules_summary['when']['when'] == 'always' ) {
114
  return true;
115
  }
 
116
  if ( ( !empty( $campaign->rules_summary['when']['from'] ) && time() > strtotime( $campaign->rules_summary['when']['from'] . " 00:00:00") ) && ( !empty( $campaign->rules_summary['when']['to'] ) && strtotime( $campaign->rules_summary['when']['to'] . " 23:59:59") > time() ) ) {
117
  return true;
118
  }
classes/class-icegram-compat.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Icegram Compatibility class with other plugins
5
+ */
6
+ if ( !class_exists( 'Icegram_Compat_Base' ) ) {
7
+ class Icegram_Compat_Base {
8
+
9
+ // Sets up printing compatibility code
10
+ function __construct() {
11
+ global $icegram;
12
+
13
+ if($icegram->cache_compatibility === 'yes'){
14
+ add_action( 'wp_footer', array( &$this, 'render_js' ) );
15
+ } else {
16
+ add_action( 'icegram_data_printed', array( &$this, 'render_js' ) );
17
+ }
18
+ }
19
+
20
+ // This will be overridden in child classes
21
+ function render_js() {
22
+
23
+ }
24
+ }
25
+ }
classes/compat/class-icegram-compat-contact-form-7.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'ABSPATH' ) ) exit;
3
+ /**
4
+ * Icegram Campaign Admin class
5
+ */
6
+ if ( !class_exists( 'Icegram_Compat_contact_form_7' ) ) {
7
+ class Icegram_Compat_contact_form_7 extends Icegram_Compat_Base {
8
+
9
+ function __construct() {
10
+ global $icegram;
11
+ parent::__construct();
12
+
13
+ if($icegram->cache_compatibility === 'yes') {
14
+ add_filter('wpcf7_form_action_url', array( &$this, 'change_form_action_url') );
15
+ }
16
+ }
17
+
18
+ function change_form_action_url($url) {
19
+ return Icegram::get_current_page_url();
20
+ }
21
+
22
+
23
+ function render_js() {
24
+ ?>
25
+
26
+ <style type="text/css">
27
+ .ig_hide .wpcf7-response-output,
28
+ .ig_form_container .screen-reader-response{
29
+ display: none !important;
30
+ }
31
+ .ig_show .ig_form_container.layout_bottom .wpcf7-response-output,
32
+ .ig_show .ig_form_container.layout_right .wpcf7-response-output,
33
+ .ig_show .ig_form_container.layout_left .wpcf7-response-output{
34
+ background-color: #FFF;
35
+ color: #444;
36
+ position: absolute;
37
+ }
38
+ .ig_sidebar .ig_form_bottom.ig_show .ig_form_container.layout_bottom .wpcf7-response-output{
39
+ bottom: 0;
40
+ }
41
+ .ig_overlay.ig_form_bottom.ig_show .ig_form_container.layout_bottom .wpcf7-response-output,
42
+ .ig_action_bar.ig_bottom.ig_show .ig_form_container.layout_right .wpcf7-response-output,
43
+ .ig_action_bar.ig_bottom.ig_show .ig_form_container.layout_left .wpcf7-response-output{
44
+ bottom: 100%;
45
+ }
46
+ </style>
47
+
48
+ <script type="text/javascript">
49
+ jQuery(function() {
50
+ jQuery( window ).on( "init.icegram", function(e, ig) {
51
+ // Find and init all CF7 forms within Icegram messages/divs and init them
52
+ if(ig){
53
+ jQuery.each(ig.messages, function(i, msg){
54
+
55
+ jQuery(msg.el).find('form input[name=_wpcf7]').each(function(){
56
+ var form = jQuery(this).closest('form');
57
+ if(form && !form.hasClass('ig_form_init_done')){
58
+ if(form.closest('.ig_form_container').length > 0){
59
+ if(form.parent().find('.screen-reader-response').length == 0){
60
+ form.before('<div class="screen-reader-response"></div>')
61
+ }
62
+ if(form.find('wpcf7-response-output').length == 0){
63
+ form.append('<div class="wpcf7-response-output wpcf7-display-none"></div>')
64
+ }
65
+ form.closest('.ig_form_container').attr('id', form.find('input[name=_wpcf7_unit_tag]').val()); //_wpcf7_unit_tag
66
+ }
67
+ form.wpcf7InitForm();
68
+ form.addClass('ig_form_init_done');
69
+ }
70
+ });
71
+
72
+ });
73
+ }
74
+
75
+ }); // init.icegram
76
+
77
+ // Dismiss response text/div when shown within icegram form container
78
+ jQuery('body').on('click', '.ig_form_container .wpcf7-response-output', function(e) {
79
+ jQuery(e.target).slideUp();
80
+ });
81
+ // Handle CTA function(s) after successful submission of form
82
+ jQuery( window ).on('wpcf7:mailsent', function(e) {
83
+ var msg_id = (jQuery(e.target.closest('[id^=icegram_message_]')).attr('id') || '').split('_').pop() || 0 ;
84
+ var ig_msg = icegram.get_message_by_id(msg_id) || undefined;
85
+ if(ig_msg && ig_msg.data.cta === 'form_via_ajax' && ig_msg.data.cta_option_form_via_ajax == 'hide_on_success'){
86
+ ig_msg.hide();
87
+ }
88
+ });
89
+
90
+ });
91
+ </script>
92
+
93
+ <?php
94
+ }
95
+ }
96
+ }
icegram.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Icegram
4
  * Plugin URI: http://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
- * Version: 1.9.8.1
7
  * Author: icegram
8
  * Author URI: http://www.icegram.com/
9
  *
@@ -35,7 +35,7 @@ class Icegram {
35
 
36
  function __construct() {
37
 
38
- $this->version = "1.9.8.1";
39
  $this->shortcode_instances = array();
40
  $this->mode = 'local';
41
  $this->plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
@@ -58,6 +58,7 @@ class Icegram {
58
  add_action( 'icegram_about_changelog', array( &$this, 'klawoo_subscribe_form' ) );
59
  add_action( 'icegram_settings_after', array( &$this, 'icegram_houskeeping' ) );
60
  add_action( 'admin_notices', array( &$this,'add_admin_notices'));
 
61
  } else {
62
  add_action( 'wp_footer', array( &$this, 'icegram_load_data' ));
63
  }
@@ -77,6 +78,7 @@ class Icegram {
77
  add_action( 'init', array( &$this, 'register_campaign_post_type' ) );
78
  add_action( 'init', array( &$this, 'register_message_post_type' ) );
79
 
 
80
 
81
  // execute shortcode in sidebar
82
  add_filter( 'widget_text', array(&$this , 'ig_widget_text_filter') );
@@ -93,17 +95,53 @@ class Icegram {
93
  }
94
 
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  public function add_admin_notices(){
97
  $active_plugins = get_option( 'active_plugins', array() );
98
  ?>
99
  <style>
100
- p.icegram_notice {
101
  border-left: 4px solid hsl(94, 61%, 52%);
102
- padding: 10px 12px;
103
  background-color: hsl(0, 100%, 100%);
104
  -webkit-box-shadow: 0 1px 1px 0 hsla(0, 0%, 0%, 0.1);
105
  box-shadow: 0 1px 1px 0 hsla(0, 0%, 0%, 0.1);
106
- margin-right: 20px;
107
  }
108
  a.ig-admin-btn{
109
  margin-left: 10px;
@@ -136,11 +174,28 @@ class Icegram {
136
  if(!in_array('ig-analytics/ig-analytics.php', $active_plugins)){
137
  //analytics
138
  $admin_notice_text = "Measure performance of your Icegram messages with the <b>free Analytics addon</b>. <a class='ig-admin-btn' href='http://www.icegram.com/addons/analytics/?utm_source=inapp&utm_campaign=freebonus&utm_medium=notices' target='_blank'>Cool, Let's begin</a>";
 
 
 
 
 
 
 
 
 
139
  }
140
- if ($admin_notice_text != '') {
141
- echo "<p class='icegram_notice'>".$admin_notice_text." <a class='ig-admin-btn ig-admin-btn-secondary' href='?dismiss_admin_notice=1'>No, I don't like free bonuses...</a></p>";
 
 
 
 
 
 
142
  }
143
  }
 
 
144
  }
145
  public function dismiss_admin_notice(){
146
  if(isset($_GET['dismiss_admin_notice']) && $_GET['dismiss_admin_notice'] == '1'){
@@ -149,6 +204,44 @@ class Icegram {
149
  exit();
150
  }
151
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  public function klawoo_subscribe_form() {
153
  ?>
154
  <div class="wrap">
@@ -528,6 +621,7 @@ class Icegram {
528
  $icegram_pre_data['post_obj']['action'] = 'display_messages';
529
  $icegram_pre_data['post_obj']['shortcodes'] = $this->shortcode_instances;
530
  $icegram_pre_data['post_obj']['cache_compatibility'] = $this->cache_compatibility;
 
531
  wp_register_script('icegram_main_js' ,$this->plugin_url . '/assets/js/main.js', array ( 'jquery' ), $this->version,true);
532
  if( !wp_script_is( 'icegram_main_js' ) ) {
533
  wp_enqueue_script( 'icegram_main_js' );
@@ -635,6 +729,8 @@ class Icegram {
635
  }
636
 
637
  do_action('icegram_print_js_css_data', $icegram_data);
 
 
638
  }
639
 
640
  function print_js_css_data( $icegram_data ) {
@@ -848,7 +944,7 @@ class Icegram {
848
  unset( $valid_messages[$id] );
849
  continue;
850
  }
851
- // Remove message if message type is uninstalled
852
  $class_name = 'Icegram_Message_Type_' . str_replace(' ', '_', ucwords(str_replace('-', ' ', $message_data['type'])));
853
  if( !class_exists( $class_name ) ) {
854
  unset( $valid_messages[$id] );
3
  * Plugin Name: Icegram
4
  * Plugin URI: http://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
+ * Version: 1.9.9
7
  * Author: icegram
8
  * Author URI: http://www.icegram.com/
9
  *
35
 
36
  function __construct() {
37
 
38
+ $this->version = "1.9.9";
39
  $this->shortcode_instances = array();
40
  $this->mode = 'local';
41
  $this->plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
58
  add_action( 'icegram_about_changelog', array( &$this, 'klawoo_subscribe_form' ) );
59
  add_action( 'icegram_settings_after', array( &$this, 'icegram_houskeeping' ) );
60
  add_action( 'admin_notices', array( &$this,'add_admin_notices'));
61
+ add_filter( 'ig_in_app_offers', array( &$this , 'add_in_app_offer' ) );
62
  } else {
63
  add_action( 'wp_footer', array( &$this, 'icegram_load_data' ));
64
  }
78
  add_action( 'init', array( &$this, 'register_campaign_post_type' ) );
79
  add_action( 'init', array( &$this, 'register_message_post_type' ) );
80
 
81
+ add_action( 'icegram_loaded', array( &$this, 'load_compat_classes') );
82
 
83
  // execute shortcode in sidebar
84
  add_filter( 'widget_text', array(&$this , 'ig_widget_text_filter') );
95
  }
96
 
97
  }
98
+
99
+ public function load_compat_classes() {
100
+
101
+ $compat_classes = (array) glob( $this->plugin_path . '/classes/compat/class-icegram-compat-*.php' );
102
+ if (empty($compat_classes)) {
103
+ return;
104
+ }
105
+
106
+ $active_plugins = (array) get_option('active_plugins', array());
107
+ if (is_multisite()) {
108
+ $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
109
+ }
110
+ $active_plugins = array_unique( array_merge( array_values($active_plugins), array_keys($active_plugins)) );
111
+ $active_plugins_with_slugs = array();
112
+ foreach ($active_plugins as $key => $value) {
113
+ $slug = dirname( $value );
114
+ if ($slug == '.') {
115
+ unset($active_plugins[$key]);
116
+ } else {
117
+ $active_plugins[ $key ] = $slug;
118
+ }
119
+ }
120
+
121
+ foreach ($compat_classes as $file) {
122
+ if (is_file ( $file )) {
123
+ $slug = str_replace('class-icegram-compat-', '', str_replace(".php", "", basename( $file )) );
124
+ if ( in_array($slug, $active_plugins)) {
125
+ include_once( $file );
126
+ $class_name = 'Icegram_Compat_'. str_replace('-', '_', $slug);
127
+ if ( class_exists( $class_name ) ) {
128
+ new $class_name();
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
  public function add_admin_notices(){
135
  $active_plugins = get_option( 'active_plugins', array() );
136
  ?>
137
  <style>
138
+ div.icegram_notice {
139
  border-left: 4px solid hsl(94, 61%, 52%);
140
+ padding: 1px 12px;
141
  background-color: hsl(0, 100%, 100%);
142
  -webkit-box-shadow: 0 1px 1px 0 hsla(0, 0%, 0%, 0.1);
143
  box-shadow: 0 1px 1px 0 hsla(0, 0%, 0%, 0.1);
144
+ margin: 15px 20px 10px 6px;
145
  }
146
  a.ig-admin-btn{
147
  margin-left: 10px;
174
  if(!in_array('ig-analytics/ig-analytics.php', $active_plugins)){
175
  //analytics
176
  $admin_notice_text = "Measure performance of your Icegram messages with the <b>free Analytics addon</b>. <a class='ig-admin-btn' href='http://www.icegram.com/addons/analytics/?utm_source=inapp&utm_campaign=freebonus&utm_medium=notices' target='_blank'>Cool, Let's begin</a>";
177
+ $no_offer_text = "No, I don\'t like offers...";
178
+ }else{
179
+ $admin_notice_text = apply_filters('ig_in_app_offers',$admin_notice_text);
180
+ $no_offer_text_set = array('save_money' => __('No, I don\'t want to save money ','icegram'),
181
+ 'full_price' => __('No, I will buy at full price later','icegram'),
182
+ 'insider_deals' => __('No, I don\'t like insider deals','icegram'),
183
+ );
184
+ $key = array_rand($no_offer_text_set);
185
+ $no_offer_text = $no_offer_text_set[$key];
186
  }
187
+ if($admin_notice_text != ''){
188
+ echo '<div class="icegram_notice">
189
+ <table><tbody><tr>
190
+ <td><span class="dashicons dashicons-awards" style="font-size:3em;color:#b32727;margin-left: -0.2em;margin-right: 0.4em;margin-bottom: 0.45em;"></span></td>
191
+ <td style="width:70%;padding:0.5em;">'.$admin_notice_text.'</td>
192
+ <td style="text-align:right;"><a class="ig-admin-btn ig-admin-btn-secondary" href="?dismiss_admin_notice=1">'.$no_offer_text.'</a></td>
193
+ </tr></tbody></table>
194
+ </div>';
195
  }
196
  }
197
+
198
+
199
  }
200
  public function dismiss_admin_notice(){
201
  if(isset($_GET['dismiss_admin_notice']) && $_GET['dismiss_admin_notice'] == '1'){
204
  exit();
205
  }
206
  }
207
+
208
+ //add in app promotion offers here
209
+ public function add_in_app_offer($admin_notice_text){
210
+ $screen = get_current_screen();
211
+ if ( !in_array( $screen->id, array( 'ig_campaign', 'ig_message','edit-ig_message','edit-ig_campaign' ), true ) ) return '';
212
+ //set offer according to day
213
+ $timezone_format = _x('Y-m-d', 'timezone date format');
214
+ $current_wp_date = date_create(date_i18n($timezone_format));
215
+
216
+ //offer 1 4th-20th Nov
217
+ $date_start = date_create('2015-11-6');
218
+ $date_finish = date_create('2015-11-20');
219
+
220
+ $last_day_text_set = array('last' => __('Last Day Today!!!') ,'offer_end' => __('Offer Ends Today!!!'),'valid_till'=>__('Valid Only Till Midnight'));
221
+ $key = array_rand($last_day_text_set);
222
+ $last_day_text = $last_day_text_set[$key];
223
+ if($current_wp_date == $date_finish ){
224
+ $admin_notice_text = '<b>'. $last_day_text .' </b> - <a href="http://www.icegram.com/big-offer?utm_source=ig_promo&utm_medium=banner&utm_term='.$key.'&utm_campaign=big-offer", target="_icegram_offer">'. '<b> ' . __('80% Off On Top Selling Add-ons', 'icegram') . ' </b></a> - '. __('Icegram\'s Best Deal Ever' ,'icegram');
225
+ }else if ( ( $current_wp_date >= $date_start ) && ( $current_wp_date <= $date_finish )) {
226
+ $admin_notice_text = '<a href="http://www.icegram.com/big-offer?utm_source=ig_promo&utm_medium=banner&utm_term=big&utm_campaign=big-offer", target="_icegram_offer">'. '<b> ' . __('80% Off On Top Selling Add-ons', 'icegram') . ' </b></a> - '. __('Icegram\'s Best Deal Ever' ,'icegram');
227
+ }
228
+
229
+ //offer 2 26th-30th Nov
230
+ $date_start1 = date_create('2015-11-26');
231
+ $date_finish1 = date_create('2015-11-30');
232
+ if($current_wp_date == $date_finish1 ){
233
+ $admin_notice_text = '<b>'. $last_day_text .' </b> - <a href="http://www.icegram.com/big-offer?utm_source=ig_sale&utm_medium=banner&utm_term='.$key.'&utm_campaign=big-offer", target="_icegram_offer">'. '<b>' . __('20% Off Storewide', 'icegram') . ' </b></a>';
234
+ }else if ( ( $current_wp_date >= $date_start1 ) && ( $current_wp_date <= $date_finish1 )) {
235
+ $admin_notice_text = '<b>'.__('Special Holiday Season - ').'</b><a href="http://www.icegram.com/big-offer?utm_source=ig_sale&utm_medium=banner&utm_term=holiday&utm_campaign=big-offer", target="_icegram_offer">'. '<b>' . __('20% Off Storewide', 'icegram') . ' </b></a>';
236
+ }
237
+
238
+ if ( !empty($admin_notice_text) ) {
239
+ return $admin_notice_text;
240
+ }
241
+
242
+ return $admin_notice_text;
243
+ }
244
+
245
  public function klawoo_subscribe_form() {
246
  ?>
247
  <div class="wrap">
621
  $icegram_pre_data['post_obj']['action'] = 'display_messages';
622
  $icegram_pre_data['post_obj']['shortcodes'] = $this->shortcode_instances;
623
  $icegram_pre_data['post_obj']['cache_compatibility'] = $this->cache_compatibility;
624
+ $icegram_pre_data['post_obj']['device'] = $this->get_platform();
625
  wp_register_script('icegram_main_js' ,$this->plugin_url . '/assets/js/main.js', array ( 'jquery' ), $this->version,true);
626
  if( !wp_script_is( 'icegram_main_js' ) ) {
627
  wp_enqueue_script( 'icegram_main_js' );
729
  }
730
 
731
  do_action('icegram_print_js_css_data', $icegram_data);
732
+
733
+ do_action('icegram_data_printed');
734
  }
735
 
736
  function print_js_css_data( $icegram_data ) {
944
  unset( $valid_messages[$id] );
945
  continue;
946
  }
947
+ // Remove message if message type is uninstalled
948
  $class_name = 'Icegram_Message_Type_' . str_replace(' ', '_', ucwords(str_replace('-', ' ', $message_data['type'])));
949
  if( !class_exists( $class_name ) ) {
950
  unset( $valid_messages[$id] );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.icegram.com/
4
  Tags: popup, window, hellobar, optin, lead capture, marketing, form, notification, messenger, targeting, monster, ninja ,wordpress lead generation, wordpress lightbox optin, wordpress lightbox optin form, wordpress lightbox optins, wordpress mobile optin forms, wordpress mobile popup, wordpress mobile popups, wordpress optin form, wordpress overlay popup, wordpress popup, wordpress popup form, wordpress popup plugin, wordpress popup solution, wordpress popups , popups, subscribe, wp popups, optin bars, action grabber, constant contact, toast notifications, leads, lists, builder, action bar, floating bar, footer bar, hellobar alternative, pop over, Popup plugin, aweber, campaign monitor, constant contact, email list, exit-intent, getresponse, analytics, Hubspot, icontact, infusionsoft, newsletter, Mailing list pop-up, retargeting, Animation,Popups with Animation ,Responsive Popup, split testing, AB testing
5
  Requires at least: 3.9
6
  Tested up to: 4.3.1
7
- Stable tag: 1.9.8.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -153,6 +153,9 @@ Contact Us, provide as much detail of the problem as you can. We will try to sol
153
  3. Editing an Icegram campaign - add multiple messages, edit them, targeting rules, full HTML editor, themes and more
154
 
155
  == Upgrade Notice ==
 
 
 
156
  = 1.9.8.1 =
157
  Added sprite image for close buttons and other fixes.
158
 
@@ -251,10 +254,14 @@ Initial Release
251
 
252
 
253
  == Changelog ==
 
 
 
 
 
254
  = 1.9.8.1 =
255
- Enhancement: Added sprite image for close buttons
256
- Fix: Retargeting issues with HTTP and HTTPS
257
- Fix: Close button of Airmail and Compel theme was not visible in popup
258
 
259
  = 1.9.8 =
260
  * New: Added translation for Italian
4
  Tags: popup, window, hellobar, optin, lead capture, marketing, form, notification, messenger, targeting, monster, ninja ,wordpress lead generation, wordpress lightbox optin, wordpress lightbox optin form, wordpress lightbox optins, wordpress mobile optin forms, wordpress mobile popup, wordpress mobile popups, wordpress optin form, wordpress overlay popup, wordpress popup, wordpress popup form, wordpress popup plugin, wordpress popup solution, wordpress popups , popups, subscribe, wp popups, optin bars, action grabber, constant contact, toast notifications, leads, lists, builder, action bar, floating bar, footer bar, hellobar alternative, pop over, Popup plugin, aweber, campaign monitor, constant contact, email list, exit-intent, getresponse, analytics, Hubspot, icontact, infusionsoft, newsletter, Mailing list pop-up, retargeting, Animation,Popups with Animation ,Responsive Popup, split testing, AB testing
5
  Requires at least: 3.9
6
  Tested up to: 4.3.1
7
+ Stable tag: 1.9.9
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
153
  3. Editing an Icegram campaign - add multiple messages, edit them, targeting rules, full HTML editor, themes and more
154
 
155
  == Upgrade Notice ==
156
+ = 1.9.9 =
157
+ Compatibility with Contact Form 7.
158
+
159
  = 1.9.8.1 =
160
  Added sprite image for close buttons and other fixes.
161
 
254
 
255
 
256
  == Changelog ==
257
+ = 1.9.9 =
258
+ * Fix: CF7(Contact Form 7) Ajax submission was not working
259
+ * Fix: CF7 redirection was not working
260
+ * Fix: CF7 was changing URL after form submission
261
+
262
  = 1.9.8.1 =
263
+ * Enhancement: Added sprite image for close buttons
264
+ * Fix: Retargeting issues with HTTP and HTTPS
 
265
 
266
  = 1.9.8 =
267
  * New: Added translation for Italian