Version Description
- Enhancement: Revised Gallery Templates for BFCM
- Fix: Improved security related to XSS and nonce validations [Thanks to Patchstack team]
- Fix: Secured Icegram from reflected XSS vulnerability [Thanks to WPScan team]
=
Download this release
Release Info
Developer | Icegram |
Plugin | Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- icegram.php +7 -3
- lite/about-icegram.php +6 -3
- lite/assets/images/bfcm2021.png +0 -0
- lite/assets/images/bfcm2021_lite.png +0 -0
- lite/assets/images/bfcm2021_pro.png +0 -0
- lite/assets/images/bfcm_2020.jpg +0 -0
- lite/assets/images/halloween2021.png +0 -0
- lite/assets/js/admin.js +6 -0
- lite/assets/js/admin.min.js +1 -1
- lite/class-icegram.php +40 -15
- lite/classes/class-icegram-activator.php +3 -3
- lite/classes/class-icegram-campaign-admin.php +71 -42
- lite/classes/class-icegram-message-admin.php +8 -5
- lite/classes/feedback.php +27 -0
- lite/classes/feedback/class-ig-feedback.php +4 -1
- lite/classes/feedback/class-ig-plugin-data-tracker.php +548 -0
- lite/classes/feedback/class-ig-tracker.php +40 -2
- lite/classes/ig-upsale-admin.php +4 -4
- lite/ig-offer.php +10 -2
- lite/settings.php +29 -3
- readme.txt +13 -5
icegram.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Icegram - Popups, Optins, CTAs & lot more...
|
4 |
* Plugin URI: https://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: 2.0.
|
7 |
* Tested up to: 5.8.1
|
8 |
* Author: icegram
|
9 |
* Author URI: https://www.icegram.com/
|
@@ -37,6 +37,7 @@ global $ig_tracker;
|
|
37 |
|
38 |
$ig_tracker = 'IG_Tracker_V_' . str_replace( '.', '_', IG_FEEDBACK_TRACKER_VERSION );
|
39 |
|
|
|
40 |
if ( ! function_exists( 'ig_show_upgrade_pro_notice' ) ) {
|
41 |
/**
|
42 |
* Show IG Premium Upgrade Notice
|
@@ -121,7 +122,11 @@ if ( ! defined( 'IG_PLUGIN_FILE' ) ) {
|
|
121 |
}
|
122 |
|
123 |
if ( ! defined( 'IG_PLUGIN_VERSION' ) ) {
|
124 |
-
define( 'IG_PLUGIN_VERSION', '2.0.
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
require plugin_dir_path( __FILE__ ) . 'lite/class-icegram.php';
|
@@ -137,7 +142,6 @@ if ( ! function_exists( 'activate_icegram' ) ) {
|
|
137 |
function activate_icegram( $network_wide ) {
|
138 |
|
139 |
global $wpdb;
|
140 |
-
|
141 |
require_once plugin_dir_path( __FILE__ ) . 'lite/classes/class-icegram-activator.php';
|
142 |
|
143 |
if ( is_multisite() && $network_wide ) {
|
3 |
* Plugin Name: Icegram - Popups, Optins, CTAs & lot more...
|
4 |
* Plugin URI: https://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: 2.0.5
|
7 |
* Tested up to: 5.8.1
|
8 |
* Author: icegram
|
9 |
* Author URI: https://www.icegram.com/
|
37 |
|
38 |
$ig_tracker = 'IG_Tracker_V_' . str_replace( '.', '_', IG_FEEDBACK_TRACKER_VERSION );
|
39 |
|
40 |
+
|
41 |
if ( ! function_exists( 'ig_show_upgrade_pro_notice' ) ) {
|
42 |
/**
|
43 |
* Show IG Premium Upgrade Notice
|
122 |
}
|
123 |
|
124 |
if ( ! defined( 'IG_PLUGIN_VERSION' ) ) {
|
125 |
+
define( 'IG_PLUGIN_VERSION', '2.0.5' );
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( ! defined( 'IG_PRODUCT_ID' ) ) {
|
129 |
+
define( 'IG_PRODUCT_ID', 1000 );
|
130 |
}
|
131 |
|
132 |
require plugin_dir_path( __FILE__ ) . 'lite/class-icegram.php';
|
142 |
function activate_icegram( $network_wide ) {
|
143 |
|
144 |
global $wpdb;
|
|
|
145 |
require_once plugin_dir_path( __FILE__ ) . 'lite/classes/class-icegram-activator.php';
|
146 |
|
147 |
if ( is_multisite() && $network_wide ) {
|
lite/about-icegram.php
CHANGED
@@ -28,9 +28,12 @@ function icegram_support_ticket_content() {
|
|
28 |
$headers .= str_replace('From: ', 'Reply-To: ', $from);
|
29 |
$headers .= 'MIME-Version: 1.0' . "\r\n";
|
30 |
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
34 |
|
35 |
}
|
36 |
?>
|
28 |
$headers .= str_replace('From: ', 'Reply-To: ', $from);
|
29 |
$headers .= 'MIME-Version: 1.0' . "\r\n";
|
30 |
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
|
31 |
+
|
32 |
+
$message = isset( $_POST['message'] ) ? $additional_info . '<br /><br />'.nl2br(sanitize_text_field($_POST['message'])) : '';
|
33 |
+
$subject = isset( $_POST['subject'] ) ? sanitize_text_field($_POST['subject']) : '';
|
34 |
+
$http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? sanitize_text_field( $_SERVER['HTTP_REFERER'] ) : '';
|
35 |
+
wp_mail( 'hello@icegram.com', $subject, $message, $headers );
|
36 |
+
header('Location: ' . $http_referer );
|
37 |
|
38 |
}
|
39 |
?>
|
lite/assets/images/bfcm2021.png
ADDED
Binary file
|
lite/assets/images/bfcm2021_lite.png
ADDED
Binary file
|
lite/assets/images/bfcm2021_pro.png
ADDED
Binary file
|
lite/assets/images/bfcm_2020.jpg
DELETED
Binary file
|
lite/assets/images/halloween2021.png
DELETED
Binary file
|
lite/assets/js/admin.js
CHANGED
@@ -338,6 +338,7 @@ jQuery(function() {
|
|
338 |
dataType: 'json',
|
339 |
data: {
|
340 |
action: 'get_message_action_row',
|
|
|
341 |
message_id: message_id,
|
342 |
row: message_rows
|
343 |
},
|
@@ -444,6 +445,11 @@ jQuery(function() {
|
|
444 |
params = jQuery("#post").serializeArray();
|
445 |
params.push( {name: 'action', value: 'save_campaign_preview' });
|
446 |
|
|
|
|
|
|
|
|
|
|
|
447 |
jQuery.ajax({
|
448 |
type: 'POST',
|
449 |
async: false,
|
338 |
dataType: 'json',
|
339 |
data: {
|
340 |
action: 'get_message_action_row',
|
341 |
+
security: icegram_writepanel_params.ig_nonce,
|
342 |
message_id: message_id,
|
343 |
row: message_rows
|
344 |
},
|
445 |
params = jQuery("#post").serializeArray();
|
446 |
params.push( {name: 'action', value: 'save_campaign_preview' });
|
447 |
|
448 |
+
// Add ajax security nonce.
|
449 |
+
params.push({
|
450 |
+
name: 'security',
|
451 |
+
value: icegram_writepanel_params.ig_nonce,
|
452 |
+
});
|
453 |
jQuery.ajax({
|
454 |
type: 'POST',
|
455 |
async: false,
|
lite/assets/js/admin.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/* Chosen v1.1.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
!function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b;return a.search_match||a.group_match?a.active_options>0?(b=document.createElement("li"),b.className="group-result",b.innerHTML=a.search_text,this.outerHTML(b)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;for(this.no_results_clear(),e=0,g=this.get_search_text(),a=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d=this.search_contains?"":"^",c=new RegExp(d+a,"i"),j=new RegExp(a,"i"),m=this.results_data,k=0,l=m.length;l>k;k++)b=m[k],b.search_match=!1,f=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(f=this.results_data[b.group_array_index],0===f.active_options&&f.search_match&&(e+=1),f.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.html,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(e+=1),b.search_match?(g.length&&(h=b.search_text.search(j),i=b.search_text.substr(0,h+g.length)+"</em>"+b.search_text.substr(h+g.length),b.search_text=i.substr(0,h)+"<em>"+i.substr(h)),null!=f&&(f.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>e&&g.length?(this.update_results_content(""),this.no_results(g)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d?d.destroy():d||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);;// Generated by CoffeeScript 1.3.1
|
3 |
-
(function(e){return e.fn.ajaxChosen=function(t,n){var r,i,s,o;t==null&&(t={});n==null&&(n=function(){});i={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};o=this;r=null;s=e.extend({},i,t);this.chosen();return this.each(function(){return e(this).next(".chosen-container").find(".search-field > input, .chosen-search > input").bind("keyup",function(){var t,i,u,a;a=e.trim(e(this).val() );i=a.length<s.minTermLength?"Keep typing...":"Looking for '"+a+"'";o.next(".chosen-container").find(".no-results").text(i);if(a===e(this).data("prevVal"))return!1;e(this).data("prevVal",a);this.timer&&clearTimeout(this.timer);if(a.length<s.minTermLength)return!1;t=e(this);s.data==null&&(s.data={});s.data[s.jsonTermKey]=a;s.dataCallback!=null&&(s.data=s.dataCallback(s.data));u=s.success;s.success=function(r){var i,s;if(r==null)return;s=[];o.find("option").each(function(){return e(this).is(":selected")?s.push(e(this).val()+"-"+e(this).text()):e(this).remove()});i=n(r);e.each(i,function(t,n){if(e.inArray(t+"-"+n,s)===-1)return e("<option />").attr("value",t).html(n).appendTo(o)});o.trigger("chosen:updated");u!=null&&u(r);t.attr("value",a);return t.css("width","auto")};return this.timer=setTimeout(function(){r&&r.abort();return r=e.ajax(s)},s.afterTypeDelay)})})}})(jQuery);;jQuery(function(){function a(a){var b=jQuery(a).find(".message_type").val();jQuery(a).closest(".message-edit-row").prev().find(".message_header_label").text(b).removeClass().addClass("message_header_label ig_"+b);var c=jQuery(a).find(".message_row.ig_"+b).find(".message_theme").val(),d=jQuery(a).find(".message_row.ig_"+b).find("#message_form_style").val(),e=jQuery(a).find("#message_theme_ig_"+b).find("."+c).attr("style"),f=jQuery(a).find("#message_form_style").find("."+d).attr("style");jQuery(a).find(".message_row, .location").hide(),jQuery(a).find(".ig_"+b).show(),jQuery(a).find(".message_row.ig_"+b).find(".message_theme").next().find(".chosen-single span").attr("style",e),jQuery(a).find(".message_row.ig_"+b).find("#message_form_style").next().find(".chosen-single span").attr("style",f).text(function(){return jQuery(this).text().substr(0,jQuery(this).text().indexOf(" "))||jQuery(this).text()}),"block"!==jQuery(a).find(".message_body").parent().css("display")?jQuery(a).find(".message_body").parent().next(".wp-editor-wrap").hide():jQuery(a).find(".message_body").parent().next(".wp-editor-wrap").show(),jQuery(a).find(".message_form_layout:checked").is(":visible")||jQuery(a).find(".message_form_layout:visible").first().prop("checked",!0),1==jQuery(a).find(".show_form_options").prop("checked")&&jQuery(a).find(".message_link").parent().hide(),jQuery(".message_form_layout").change()}function b(a,c,d){var e=Math.floor(Math.random()*(d-c+1))+c;return e==a?b(e,c,d):e}function c(){var a='<span><label class="options_header"><span id="valid-field"> </span></label> <input type="text" class="url_input_field" data-option="local_url" name="campaign_target_rules[local_urls][]" value="'+e+'*"/><span class="delete-url"></span></span>';return a}function d(){0==jQuery(".message-row").length?jQuery(".empty_campaign").show():jQuery(".empty_campaign").hide()}var e=icegram_writepanel_params.home_url;jQuery(document).ready(function(){jQuery('a[href="edit.php?post_type=ig_campaign&page=icegram-upgrade"]').attr("target","_blank").attr("href","https://www.icegram.com/pricing/?utm_source=in_app&utm_medium=ig_upgrade&utm_campaign=get_upgrade");var c=jQuery("#ig-admin-tabs");c.find(".ig-admin-nav-main").addClass("current"),c.find("#ig-admin-tab-main").show(),"post-new-php"===adminpage&&jQuery("#wpbody").on("click","#ig-add-new-campaign",function(){jQuery("#poststuff").css("position","static"),jQuery("#postbox-container-1 #side-sortables").removeClass("empty-container").addClass("gal-toggled"),jQuery(".gallery-heading, .ig-gallery-wrap").hide(),jQuery(".postbox-container").show(),jQuery(".wrap h1.wp-heading-inline").not(".gallery-heading").show(),jQuery(".ig-gallery-wrap").siblings().not(".gallery-heading").show(),jQuery(".postbox-container").siblings().show()}),jQuery("#ig-admin-tabs").on("click",'.ig-admin-tabs-nav li:not(".ig-admin-nav-upsale")',function(a){a.preventDefault(),jQuery(this).hasClass("ig-admin-nav-notab")||(c.find(".ig-admin-tabs-nav li").not(this).removeClass("current"),jQuery(".ig-admin-tab").fadeOut("fast"),jQuery(jQuery(this).addClass("current").find("a").attr("href")).fadeIn("fast"),jQuery(this).hasClass("new-variation")&&(jQuery(this).removeClass("current"),jQuery(".ig-admin-nav-variations").addClass("current")))});var e=window.send_to_editor,f=jQuery(".ig_preview_button");jQuery("#submitdiv .submitbox #minor-publishing-actions").after(f),f.fadeIn("fast"),jQuery(".color-field").wpColorPicker().each(function(a){var b=jQuery(this).data("color-label")||"";""!==b&&jQuery(this).closest(".wp-picker-container").find("a.wp-color-result").attr("title",b)}),jQuery(".campaign_data, #message-settings").on("change",".show_color_options",function(){jQuery(this).closest("p").next(".message_colors_options_container").toggle(!this.checked)}).change(),d(),jQuery(".message_edit:first").trigger("click"),this_data=jQuery(".message_type").closest(".message-setting-fields");for(var g=0;g<this_data.length;g++)a(this_data[g]);jQuery(".campaign_data, #message-settings").on("change",".message_theme",function(a){var b=jQuery(a.target).parents(".message-setting-fields"),c=jQuery(b).find(".message_type").val(),d=jQuery(b).find(".message_row.ig_"+c).find(".message_theme").val(),e=jQuery(b).find("#message_theme_ig_"+c).find("."+d).attr("style");jQuery(b).find(".message_row.ig_"+c).find(".message_theme").next().find(".chosen-single span").attr("style",e)}),jQuery(".campaign_data, #message-settings").on("change",".rainmaker_form_list",function(a){"null"!==(jQuery(a.target).val()||"null")&&jQuery(a.target).parent().siblings(".message_form_html_original").hide()}),jQuery(".campaign_data, #message-settings").on("click",".message_image_button",function(a){var b=this;return window.send_to_editor=function(a){imgurl=jQuery("img",a).attr("src"),jQuery(b).parent().find("#upload_image").val(imgurl),tb_remove(),window.send_to_editor=e},!1}),jQuery(".campaign_data, #message-settings").on("click",".message_headline_button",function(){var a=jQuery(this).prev().attr("data-headline"),c=icegram_writepanel_params.available_headlines.length,d=b(a,0,c),e=icegram_writepanel_params.available_headlines[d];jQuery(this).prev().val(e)}),jQuery(".tips, .help_tip").tipTip({attribute:"data-tip"}),jQuery("span.test_class").hover(function(){jQuery(this).next().show()},function(){jQuery(this).next().hide()}),jQuery(".campaign_data .handle, .campaign_data .handlediv").unbind("click"),jQuery(".campaign_data .handlediv").hide(),jQuery("#poststuff").on("click","#publish",function(a){jQuery(".campaign_data").find(".message_header_label.ig_unknown").length&&(alert("Please select Message type"),a.preventDefault())})}),jQuery(".campaign_data, #message-settings").on("click",".message_delete",function(){jQuery(this).parent().parent().next().remove(),jQuery(this).parent().parent().remove(),d()}),jQuery(".campaign_data, #message-settings").on("click",".message_edit",function(){jQuery(this).parent().parent().next().toggle(),jQuery(this).parent().parent().find(".message-title-text, .message-title-input").toggle()}),jQuery(".campaign_data, #message-settings").on("click",".embed_form_code_toggle",function(){jQuery(this).parent().parent().siblings(".message_form_html_original").toggle()}),jQuery(".campaign_data, #message-settings").on("change",".message-title-input",function(){jQuery(this).prev().text(jQuery(this).val())}),jQuery("select.ajax_chosen_select_messages").ajaxChosen({type:"GET",url:icegram_writepanel_params.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"icegram_json_search_messages",security:icegram_writepanel_params.search_message_nonce}},function(a){var b={};return jQuery.each(a,function(a,c){b[a]=c}),b}),jQuery(".campaign_data, #message-settings").on("change",".show_form_options",function(a){var b=jQuery(this).closest("p");if(jQuery(b).siblings(".message_form_options").slideToggle(this.checked),this.checked)jQuery(b).closest(".thickbox_edit_message").find(".message_link").parent().hide(),jQuery(b).siblings("p.cta-actions").find("select option").removeAttr("disabled"),jQuery(b).siblings("p.cta-actions").find("select").find('option[value="url"], option[value="hide"], option[value="cta_another_message"]').attr("disabled",!0).attr("selected",!1).end().find('option[value="form"]').attr("selected",!0).trigger("change"),jQuery(b).siblings(".message_form_options").find(".message_form_layout").change();else{jQuery(b).siblings("p.cta-actions").find("select option").removeAttr("disabled");var c=jQuery(b).siblings(".message_form_options").siblings(".wp-editor-wrap").find(".wp-editor-area"),d=jQuery(c).val().trim().replace("[ig_form]","");jQuery(c).val(d),jQuery(b).closest(".thickbox_edit_message").find(".message_link").parent().show()}}).change(),jQuery(".campaign_data, #message-settings").on("change",".message_form_style",function(a){var b=jQuery(a.target).parents(".message-setting-fields"),c=jQuery(b).find("#message_form_style").val(),d=jQuery(b).find("#message_form_style").find("."+c).attr("style");jQuery(b).find(".message_form_style").next().find(".chosen-single span").attr("style",d).text(function(){return jQuery(this).text().substr(0,jQuery(this).text().indexOf(" "))||jQuery(this).text()})}),jQuery(".campaign_data, #message-settings").on("change",".message_form_layout ",function(){if(jQuery(this).is(":visible")){var a=this,b=jQuery(this).closest(".message_form_options").siblings(".wp-editor-wrap").find(".wp-editor-area"),c=jQuery(b).val().trim();jQuery(a).closest(".form_radio_group").siblings(".form_inline_shortcode").hide(),jQuery(a).closest(".form_radio_group").siblings(".message_form_color").show(),jQuery(a).is(":checked")&&jQuery(a).closest(".message_form_options").prev("p.message_form_options_check").find(".show_form_options").is(":checked")&&("inline"==jQuery(a).val()?(-1==c.indexOf("[ig_form]")&&(c+="[ig_form]"),jQuery(a).closest(".form_radio_group").siblings(".message_form_color, .form_inline_shortcode").toggle()):"inline"!=jQuery(a).val()&&(c=c.replace("[ig_form]",""))),jQuery(b).val(c)}}),jQuery(".campaign_data, #message-settings").on("blur",".message_form_html_original",function(a){var b=this,c=jQuery("<div/>").html(jQuery(b).val()).find("input[type=submit], button, input[type=button]").not("*:disabled");if(c.length>0){var d=jQuery(c[c.length-1]),e=d.is("button")?d.not("br, span, div").text():d.val();jQuery(b).closest(".message_form_options").siblings("p").find("#message_label").val(e.trim())}}),jQuery(".campaign_data, #message-settings").on("change",".show_custom_code_options",function(a){var b=jQuery(this).closest("p");jQuery(b).siblings(".message_custom_code_options").slideToggle(this.checked)}),jQuery(".ajax_chosen_select_messages").chosen(),jQuery(".campaign_data, #message-settings").on("change",".ajax_chosen_select_messages",function(){var b={},c=jQuery("#ig-admin-tabs li.current").attr("variation_id");"undefined"!=typeof c&&jQuery.extend(b,{selected_tab:c});var e=jQuery.extend({},tinyMCEPreInit.mceInit.content),f=jQuery.extend({},tinyMCEPreInit.qtInit.content),g=jQuery(this).parent().siblings(".campaign_target_rules_panel");"undefined"!=typeof g&&(b.parent_campaign_box=g);var h=jQuery(g).find(".message-row").length,i=jQuery(this).val();return""==i?void jQuery(".ajax_chosen_select_messages").val("").trigger("chosen:updated"):(jQuery(".message-edit-row").hide(),jQuery(".message-title-text").show(),jQuery(".message-title-input").hide(),void jQuery.ajax({type:"POST",url:icegram_writepanel_params.ajax_url,dataType:"json",data:{action:"get_message_action_row",message_id:i,row:h},success:function(c){if(h++,jQuery(g).find(".messages-list .messages_list_table tbody").append(c.main),jQuery(".color-field").wpColorPicker().each(function(a){var b=jQuery(this).data("color-label")||"";""!==b&&jQuery(this).closest(".wp-picker-container").find("a.wp-color-result").attr("title",b)}),jQuery(".campaign_data, #message-settings").on("change",".show_color_options",function(){jQuery(this).closest("p").next(".message_colors_options_container").toggle(!this.checked)}).change(),a(jQuery("#"+c.id)),jQuery(".ajax_chosen_select_messages").val("").trigger("chosen:updated"),jQuery(".campaign_data, #message-settings").find(".message_theme").append('<option value="ig_get_more_theme" class="ig_get_more">Get more Themes</option>'),jQuery(".campaign_data, #message-settings").find(".message_animation").append('<option value="ig_get_more_animation" class="ig_get_more">Get more Animations</option>'),jQuery("select.icegram_chosen_page").chosen({disable_search_threshold:10}),d(),jQuery(".message-setting-fields").trigger("change"),jQuery(".tips, .help_tip").tipTip({attribute:"data-tip"}),"undefined"==typeof tinyMCEPreInit.mceInit["edit"+c.id]){for(_prop in e)"string"==typeof e[_prop]&&"content_css"!==_prop&&(e[_prop]=e[_prop].replace(new RegExp("content","g"),"edit"+c.id));tinyMCEPreInit.mceInit["edit"+c.id]=e}if("undefined"==typeof tinyMCEPreInit.qtInit["edit"+c.id]){for(_prop in f)"string"==typeof f[_prop]&&"content_css"!==_prop&&(f[_prop]=f[_prop].replace(new RegExp("content","g"),"edit"+c.id));tinyMCEPreInit.qtInit["edit"+c.id]=f}tinyMCE.init({id:tinyMCEPreInit.mceInit["edit"+c.id]}),quicktags({id:"edit"+c.id}),QTags._buttonsInit(),jQuery("#wp-edit"+c.id+"-wrap").hasClass("tmce-active")?jQuery("#edit"+c.id+"-tmce").click():jQuery("#edit"+c.id+"-html").click(),jQuery(window).trigger("icegram_message_added_ajax",[b])}}))}),jQuery(".campaign_target_rules").on("click","#add_local_url_row",function(a){a.preventDefault();var b=c();jQuery(".local_url").find(".url_input_field").length?jQuery(b).insertAfter(jQuery(".local_url").find(".url_input_field").last().parent("span")):jQuery(b).insertBefore(jQuery(".local_url").find("#add_local_url_row_label"))}),jQuery(".campaign_target_rules").on("click",".delete-url",function(a){jQuery(this).parent().remove()}),jQuery(document).on("click",".campaign_preview",function(a){a.preventDefault(),tinyMCE.triggerSave(),params=jQuery("#post").serializeArray(),params.push({name:"action",value:"save_campaign_preview"}),jQuery.ajax({type:"POST",async:!1,url:icegram_writepanel_params.ajax_url,data:params,success:function(a){""!=a&&window.open(a,"preview_window")}})}),jQuery(".campaign_data, #message-settings").find(".message_theme").append('<option value="ig_get_more_theme" class="ig_get_more">Get more themes</option>'),jQuery(".campaign_data, #message-settings").find(".message_animation").append('<option value="ig_get_more_animation" class="ig_get_more">Get more Animations</option>'),jQuery(".campaign_data, #message-settings").on("change",".message_theme, .message_animation",function(){"ig_get_more_theme"==jQuery(this).val()&&window.open("https://www.icegram.com/product-category/themes-addons/?utm_source=icegram&utm_medium=admin&utm_campaign=theme_packs"),"ig_get_more_animation"==jQuery(this).val()&&window.open("https://www.icegram.com/animation-effects/?utm_source=icegram&utm_medium=admin&utm_campaign=animation_pack")}),jQuery("select.icegram_chosen_page").chosen({disable_search_threshold:10}),jQuery("input#users_logged_in, input#users_all ,input#users_not_logged_in").on("change",function(){"logged_in"==jQuery(this).val()?(jQuery("select#users_roles").parent("p").show(),jQuery("#users_roles_chosen").find("input").trigger("click")):jQuery("select#users_roles").parent("p").hide()}),jQuery(".schedule_rule").on("change",function(){"when_schedule"==jQuery(this).attr("id")?jQuery("#date_picker").show():jQuery("#date_picker").hide()}),jQuery("input#where_other_page").on("change",function(){jQuery("select#where_page_id").parent("p").slideToggle(),jQuery(this).is(":checked")&&jQuery("#where_page_id_chosen").find("input").trigger("click")}),jQuery("input#where_sitewide").on("change",function(){jQuery("select#exclude_page_id").parent("p").slideToggle()}),jQuery("input#where_local_url").on("change",function(){jQuery(".local_url").slideToggle()}),jQuery(".date-picker").datepicker({dateFormat:"yy-mm-dd",defaultDate:0,showOtherMonths:!0,selectOtherMonths:!0,changeMonth:!0,changeYear:!0,showButtonPanel:!1,beforeShow:function(a,b){jQuery("#ui-datepicker-div").addClass("ig-date-picker")}}),jQuery(".campaign_target_rules").on("focusout","input.url_input_field",function(){var a=this;if(jQuery(a).parent().find("span#valid-field").removeClass("error"),"undefine"!==jQuery(a).data("option")&&"local_url"==jQuery(a).data("option")&&"*"!=jQuery(a).val()){var b=a.value;if(b.indexOf(e)<0)return void jQuery(a).val(e+b)}})});;/*
|
4 |
* TipTip
|
5 |
* Copyright 2010 Drew Wilson
|
6 |
* www.drewwilson.com
|
1 |
/* Chosen v1.1.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
!function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b;return a.search_match||a.group_match?a.active_options>0?(b=document.createElement("li"),b.className="group-result",b.innerHTML=a.search_text,this.outerHTML(b)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;for(this.no_results_clear(),e=0,g=this.get_search_text(),a=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d=this.search_contains?"":"^",c=new RegExp(d+a,"i"),j=new RegExp(a,"i"),m=this.results_data,k=0,l=m.length;l>k;k++)b=m[k],b.search_match=!1,f=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(f=this.results_data[b.group_array_index],0===f.active_options&&f.search_match&&(e+=1),f.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.html,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(e+=1),b.search_match?(g.length&&(h=b.search_text.search(j),i=b.search_text.substr(0,h+g.length)+"</em>"+b.search_text.substr(h+g.length),b.search_text=i.substr(0,h)+"<em>"+i.substr(h)),null!=f&&(f.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>e&&g.length?(this.update_results_content(""),this.no_results(g)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d?d.destroy():d||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);;// Generated by CoffeeScript 1.3.1
|
3 |
+
(function(e){return e.fn.ajaxChosen=function(t,n){var r,i,s,o;t==null&&(t={});n==null&&(n=function(){});i={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};o=this;r=null;s=e.extend({},i,t);this.chosen();return this.each(function(){return e(this).next(".chosen-container").find(".search-field > input, .chosen-search > input").bind("keyup",function(){var t,i,u,a;a=e.trim(e(this).val() );i=a.length<s.minTermLength?"Keep typing...":"Looking for '"+a+"'";o.next(".chosen-container").find(".no-results").text(i);if(a===e(this).data("prevVal"))return!1;e(this).data("prevVal",a);this.timer&&clearTimeout(this.timer);if(a.length<s.minTermLength)return!1;t=e(this);s.data==null&&(s.data={});s.data[s.jsonTermKey]=a;s.dataCallback!=null&&(s.data=s.dataCallback(s.data));u=s.success;s.success=function(r){var i,s;if(r==null)return;s=[];o.find("option").each(function(){return e(this).is(":selected")?s.push(e(this).val()+"-"+e(this).text()):e(this).remove()});i=n(r);e.each(i,function(t,n){if(e.inArray(t+"-"+n,s)===-1)return e("<option />").attr("value",t).html(n).appendTo(o)});o.trigger("chosen:updated");u!=null&&u(r);t.attr("value",a);return t.css("width","auto")};return this.timer=setTimeout(function(){r&&r.abort();return r=e.ajax(s)},s.afterTypeDelay)})})}})(jQuery);;jQuery(function(){function a(a){var b=jQuery(a).find(".message_type").val();jQuery(a).closest(".message-edit-row").prev().find(".message_header_label").text(b).removeClass().addClass("message_header_label ig_"+b);var c=jQuery(a).find(".message_row.ig_"+b).find(".message_theme").val(),d=jQuery(a).find(".message_row.ig_"+b).find("#message_form_style").val(),e=jQuery(a).find("#message_theme_ig_"+b).find("."+c).attr("style"),f=jQuery(a).find("#message_form_style").find("."+d).attr("style");jQuery(a).find(".message_row, .location").hide(),jQuery(a).find(".ig_"+b).show(),jQuery(a).find(".message_row.ig_"+b).find(".message_theme").next().find(".chosen-single span").attr("style",e),jQuery(a).find(".message_row.ig_"+b).find("#message_form_style").next().find(".chosen-single span").attr("style",f).text(function(){return jQuery(this).text().substr(0,jQuery(this).text().indexOf(" "))||jQuery(this).text()}),"block"!==jQuery(a).find(".message_body").parent().css("display")?jQuery(a).find(".message_body").parent().next(".wp-editor-wrap").hide():jQuery(a).find(".message_body").parent().next(".wp-editor-wrap").show(),jQuery(a).find(".message_form_layout:checked").is(":visible")||jQuery(a).find(".message_form_layout:visible").first().prop("checked",!0),1==jQuery(a).find(".show_form_options").prop("checked")&&jQuery(a).find(".message_link").parent().hide(),jQuery(".message_form_layout").change()}function b(a,c,d){var e=Math.floor(Math.random()*(d-c+1))+c;return e==a?b(e,c,d):e}function c(){var a='<span><label class="options_header"><span id="valid-field"> </span></label> <input type="text" class="url_input_field" data-option="local_url" name="campaign_target_rules[local_urls][]" value="'+e+'*"/><span class="delete-url"></span></span>';return a}function d(){0==jQuery(".message-row").length?jQuery(".empty_campaign").show():jQuery(".empty_campaign").hide()}var e=icegram_writepanel_params.home_url;jQuery(document).ready(function(){jQuery('a[href="edit.php?post_type=ig_campaign&page=icegram-upgrade"]').attr("target","_blank").attr("href","https://www.icegram.com/pricing/?utm_source=in_app&utm_medium=ig_upgrade&utm_campaign=get_upgrade");var c=jQuery("#ig-admin-tabs");c.find(".ig-admin-nav-main").addClass("current"),c.find("#ig-admin-tab-main").show(),"post-new-php"===adminpage&&jQuery("#wpbody").on("click","#ig-add-new-campaign",function(){jQuery("#poststuff").css("position","static"),jQuery("#postbox-container-1 #side-sortables").removeClass("empty-container").addClass("gal-toggled"),jQuery(".gallery-heading, .ig-gallery-wrap").hide(),jQuery(".postbox-container").show(),jQuery(".wrap h1.wp-heading-inline").not(".gallery-heading").show(),jQuery(".ig-gallery-wrap").siblings().not(".gallery-heading").show(),jQuery(".postbox-container").siblings().show()}),jQuery("#ig-admin-tabs").on("click",'.ig-admin-tabs-nav li:not(".ig-admin-nav-upsale")',function(a){a.preventDefault(),jQuery(this).hasClass("ig-admin-nav-notab")||(c.find(".ig-admin-tabs-nav li").not(this).removeClass("current"),jQuery(".ig-admin-tab").fadeOut("fast"),jQuery(jQuery(this).addClass("current").find("a").attr("href")).fadeIn("fast"),jQuery(this).hasClass("new-variation")&&(jQuery(this).removeClass("current"),jQuery(".ig-admin-nav-variations").addClass("current")))});var e=window.send_to_editor,f=jQuery(".ig_preview_button");jQuery("#submitdiv .submitbox #minor-publishing-actions").after(f),f.fadeIn("fast"),jQuery(".color-field").wpColorPicker().each(function(a){var b=jQuery(this).data("color-label")||"";""!==b&&jQuery(this).closest(".wp-picker-container").find("a.wp-color-result").attr("title",b)}),jQuery(".campaign_data, #message-settings").on("change",".show_color_options",function(){jQuery(this).closest("p").next(".message_colors_options_container").toggle(!this.checked)}).change(),d(),jQuery(".message_edit:first").trigger("click"),this_data=jQuery(".message_type").closest(".message-setting-fields");for(var g=0;g<this_data.length;g++)a(this_data[g]);jQuery(".campaign_data, #message-settings").on("change",".message_theme",function(a){var b=jQuery(a.target).parents(".message-setting-fields"),c=jQuery(b).find(".message_type").val(),d=jQuery(b).find(".message_row.ig_"+c).find(".message_theme").val(),e=jQuery(b).find("#message_theme_ig_"+c).find("."+d).attr("style");jQuery(b).find(".message_row.ig_"+c).find(".message_theme").next().find(".chosen-single span").attr("style",e)}),jQuery(".campaign_data, #message-settings").on("change",".rainmaker_form_list",function(a){"null"!==(jQuery(a.target).val()||"null")&&jQuery(a.target).parent().siblings(".message_form_html_original").hide()}),jQuery(".campaign_data, #message-settings").on("click",".message_image_button",function(a){var b=this;return window.send_to_editor=function(a){imgurl=jQuery("img",a).attr("src"),jQuery(b).parent().find("#upload_image").val(imgurl),tb_remove(),window.send_to_editor=e},!1}),jQuery(".campaign_data, #message-settings").on("click",".message_headline_button",function(){var a=jQuery(this).prev().attr("data-headline"),c=icegram_writepanel_params.available_headlines.length,d=b(a,0,c),e=icegram_writepanel_params.available_headlines[d];jQuery(this).prev().val(e)}),jQuery(".tips, .help_tip").tipTip({attribute:"data-tip"}),jQuery("span.test_class").hover(function(){jQuery(this).next().show()},function(){jQuery(this).next().hide()}),jQuery(".campaign_data .handle, .campaign_data .handlediv").unbind("click"),jQuery(".campaign_data .handlediv").hide(),jQuery("#poststuff").on("click","#publish",function(a){jQuery(".campaign_data").find(".message_header_label.ig_unknown").length&&(alert("Please select Message type"),a.preventDefault())})}),jQuery(".campaign_data, #message-settings").on("click",".message_delete",function(){jQuery(this).parent().parent().next().remove(),jQuery(this).parent().parent().remove(),d()}),jQuery(".campaign_data, #message-settings").on("click",".message_edit",function(){jQuery(this).parent().parent().next().toggle(),jQuery(this).parent().parent().find(".message-title-text, .message-title-input").toggle()}),jQuery(".campaign_data, #message-settings").on("click",".embed_form_code_toggle",function(){jQuery(this).parent().parent().siblings(".message_form_html_original").toggle()}),jQuery(".campaign_data, #message-settings").on("change",".message-title-input",function(){jQuery(this).prev().text(jQuery(this).val())}),jQuery("select.ajax_chosen_select_messages").ajaxChosen({type:"GET",url:icegram_writepanel_params.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"icegram_json_search_messages",security:icegram_writepanel_params.search_message_nonce}},function(a){var b={};return jQuery.each(a,function(a,c){b[a]=c}),b}),jQuery(".campaign_data, #message-settings").on("change",".show_form_options",function(a){var b=jQuery(this).closest("p");if(jQuery(b).siblings(".message_form_options").slideToggle(this.checked),this.checked)jQuery(b).closest(".thickbox_edit_message").find(".message_link").parent().hide(),jQuery(b).siblings("p.cta-actions").find("select option").removeAttr("disabled"),jQuery(b).siblings("p.cta-actions").find("select").find('option[value="url"], option[value="hide"], option[value="cta_another_message"]').attr("disabled",!0).attr("selected",!1).end().find('option[value="form"]').attr("selected",!0).trigger("change"),jQuery(b).siblings(".message_form_options").find(".message_form_layout").change();else{jQuery(b).siblings("p.cta-actions").find("select option").removeAttr("disabled");var c=jQuery(b).siblings(".message_form_options").siblings(".wp-editor-wrap").find(".wp-editor-area"),d=jQuery(c).val().trim().replace("[ig_form]","");jQuery(c).val(d),jQuery(b).closest(".thickbox_edit_message").find(".message_link").parent().show()}}).change(),jQuery(".campaign_data, #message-settings").on("change",".message_form_style",function(a){var b=jQuery(a.target).parents(".message-setting-fields"),c=jQuery(b).find("#message_form_style").val(),d=jQuery(b).find("#message_form_style").find("."+c).attr("style");jQuery(b).find(".message_form_style").next().find(".chosen-single span").attr("style",d).text(function(){return jQuery(this).text().substr(0,jQuery(this).text().indexOf(" "))||jQuery(this).text()})}),jQuery(".campaign_data, #message-settings").on("change",".message_form_layout ",function(){if(jQuery(this).is(":visible")){var a=this,b=jQuery(this).closest(".message_form_options").siblings(".wp-editor-wrap").find(".wp-editor-area"),c=jQuery(b).val().trim();jQuery(a).closest(".form_radio_group").siblings(".form_inline_shortcode").hide(),jQuery(a).closest(".form_radio_group").siblings(".message_form_color").show(),jQuery(a).is(":checked")&&jQuery(a).closest(".message_form_options").prev("p.message_form_options_check").find(".show_form_options").is(":checked")&&("inline"==jQuery(a).val()?(-1==c.indexOf("[ig_form]")&&(c+="[ig_form]"),jQuery(a).closest(".form_radio_group").siblings(".message_form_color, .form_inline_shortcode").toggle()):"inline"!=jQuery(a).val()&&(c=c.replace("[ig_form]",""))),jQuery(b).val(c)}}),jQuery(".campaign_data, #message-settings").on("blur",".message_form_html_original",function(a){var b=this,c=jQuery("<div/>").html(jQuery(b).val()).find("input[type=submit], button, input[type=button]").not("*:disabled");if(c.length>0){var d=jQuery(c[c.length-1]),e=d.is("button")?d.not("br, span, div").text():d.val();jQuery(b).closest(".message_form_options").siblings("p").find("#message_label").val(e.trim())}}),jQuery(".campaign_data, #message-settings").on("change",".show_custom_code_options",function(a){var b=jQuery(this).closest("p");jQuery(b).siblings(".message_custom_code_options").slideToggle(this.checked)}),jQuery(".ajax_chosen_select_messages").chosen(),jQuery(".campaign_data, #message-settings").on("change",".ajax_chosen_select_messages",function(){var b={},c=jQuery("#ig-admin-tabs li.current").attr("variation_id");"undefined"!=typeof c&&jQuery.extend(b,{selected_tab:c});var e=jQuery.extend({},tinyMCEPreInit.mceInit.content),f=jQuery.extend({},tinyMCEPreInit.qtInit.content),g=jQuery(this).parent().siblings(".campaign_target_rules_panel");"undefined"!=typeof g&&(b.parent_campaign_box=g);var h=jQuery(g).find(".message-row").length,i=jQuery(this).val();return""==i?void jQuery(".ajax_chosen_select_messages").val("").trigger("chosen:updated"):(jQuery(".message-edit-row").hide(),jQuery(".message-title-text").show(),jQuery(".message-title-input").hide(),void jQuery.ajax({type:"POST",url:icegram_writepanel_params.ajax_url,dataType:"json",data:{action:"get_message_action_row",security:icegram_writepanel_params.ig_nonce,message_id:i,row:h},success:function(c){if(h++,jQuery(g).find(".messages-list .messages_list_table tbody").append(c.main),jQuery(".color-field").wpColorPicker().each(function(a){var b=jQuery(this).data("color-label")||"";""!==b&&jQuery(this).closest(".wp-picker-container").find("a.wp-color-result").attr("title",b)}),jQuery(".campaign_data, #message-settings").on("change",".show_color_options",function(){jQuery(this).closest("p").next(".message_colors_options_container").toggle(!this.checked)}).change(),a(jQuery("#"+c.id)),jQuery(".ajax_chosen_select_messages").val("").trigger("chosen:updated"),jQuery(".campaign_data, #message-settings").find(".message_theme").append('<option value="ig_get_more_theme" class="ig_get_more">Get more Themes</option>'),jQuery(".campaign_data, #message-settings").find(".message_animation").append('<option value="ig_get_more_animation" class="ig_get_more">Get more Animations</option>'),jQuery("select.icegram_chosen_page").chosen({disable_search_threshold:10}),d(),jQuery(".message-setting-fields").trigger("change"),jQuery(".tips, .help_tip").tipTip({attribute:"data-tip"}),"undefined"==typeof tinyMCEPreInit.mceInit["edit"+c.id]){for(_prop in e)"string"==typeof e[_prop]&&"content_css"!==_prop&&(e[_prop]=e[_prop].replace(new RegExp("content","g"),"edit"+c.id));tinyMCEPreInit.mceInit["edit"+c.id]=e}if("undefined"==typeof tinyMCEPreInit.qtInit["edit"+c.id]){for(_prop in f)"string"==typeof f[_prop]&&"content_css"!==_prop&&(f[_prop]=f[_prop].replace(new RegExp("content","g"),"edit"+c.id));tinyMCEPreInit.qtInit["edit"+c.id]=f}tinyMCE.init({id:tinyMCEPreInit.mceInit["edit"+c.id]}),quicktags({id:"edit"+c.id}),QTags._buttonsInit(),jQuery("#wp-edit"+c.id+"-wrap").hasClass("tmce-active")?jQuery("#edit"+c.id+"-tmce").click():jQuery("#edit"+c.id+"-html").click(),jQuery(window).trigger("icegram_message_added_ajax",[b])}}))}),jQuery(".campaign_target_rules").on("click","#add_local_url_row",function(a){a.preventDefault();var b=c();jQuery(".local_url").find(".url_input_field").length?jQuery(b).insertAfter(jQuery(".local_url").find(".url_input_field").last().parent("span")):jQuery(b).insertBefore(jQuery(".local_url").find("#add_local_url_row_label"))}),jQuery(".campaign_target_rules").on("click",".delete-url",function(a){jQuery(this).parent().remove()}),jQuery(document).on("click",".campaign_preview",function(a){a.preventDefault(),tinyMCE.triggerSave(),params=jQuery("#post").serializeArray(),params.push({name:"action",value:"save_campaign_preview"}),params.push({name:"security",value:icegram_writepanel_params.ig_nonce}),jQuery.ajax({type:"POST",async:!1,url:icegram_writepanel_params.ajax_url,data:params,success:function(a){""!=a&&window.open(a,"preview_window")}})}),jQuery(".campaign_data, #message-settings").find(".message_theme").append('<option value="ig_get_more_theme" class="ig_get_more">Get more themes</option>'),jQuery(".campaign_data, #message-settings").find(".message_animation").append('<option value="ig_get_more_animation" class="ig_get_more">Get more Animations</option>'),jQuery(".campaign_data, #message-settings").on("change",".message_theme, .message_animation",function(){"ig_get_more_theme"==jQuery(this).val()&&window.open("https://www.icegram.com/product-category/themes-addons/?utm_source=icegram&utm_medium=admin&utm_campaign=theme_packs"),"ig_get_more_animation"==jQuery(this).val()&&window.open("https://www.icegram.com/animation-effects/?utm_source=icegram&utm_medium=admin&utm_campaign=animation_pack")}),jQuery("select.icegram_chosen_page").chosen({disable_search_threshold:10}),jQuery("input#users_logged_in, input#users_all ,input#users_not_logged_in").on("change",function(){"logged_in"==jQuery(this).val()?(jQuery("select#users_roles").parent("p").show(),jQuery("#users_roles_chosen").find("input").trigger("click")):jQuery("select#users_roles").parent("p").hide()}),jQuery(".schedule_rule").on("change",function(){"when_schedule"==jQuery(this).attr("id")?jQuery("#date_picker").show():jQuery("#date_picker").hide()}),jQuery("input#where_other_page").on("change",function(){jQuery("select#where_page_id").parent("p").slideToggle(),jQuery(this).is(":checked")&&jQuery("#where_page_id_chosen").find("input").trigger("click")}),jQuery("input#where_sitewide").on("change",function(){jQuery("select#exclude_page_id").parent("p").slideToggle()}),jQuery("input#where_local_url").on("change",function(){jQuery(".local_url").slideToggle()}),jQuery(".date-picker").datepicker({dateFormat:"yy-mm-dd",defaultDate:0,showOtherMonths:!0,selectOtherMonths:!0,changeMonth:!0,changeYear:!0,showButtonPanel:!1,beforeShow:function(a,b){jQuery("#ui-datepicker-div").addClass("ig-date-picker")}}),jQuery(".campaign_target_rules").on("focusout","input.url_input_field",function(){var a=this;if(jQuery(a).parent().find("span#valid-field").removeClass("error"),"undefine"!==jQuery(a).data("option")&&"local_url"==jQuery(a).data("option")&&"*"!=jQuery(a).val()){var b=a.value;if(b.indexOf(e)<0)return void jQuery(a).val(e+b)}})});;/*
|
4 |
* TipTip
|
5 |
* Copyright 2010 Drew Wilson
|
6 |
* www.drewwilson.com
|
lite/class-icegram.php
CHANGED
@@ -24,7 +24,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
24 |
public static $current_page_id;
|
25 |
|
26 |
public function __construct() {
|
27 |
-
global $ig_feedback, $ig_tracker;
|
28 |
|
29 |
$this->version = IG_PLUGIN_VERSION;
|
30 |
$this->shortcode_instances = array();
|
@@ -170,9 +170,9 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
170 |
$option_name = sanitize_text_field( $_GET['ig_option_name'] );
|
171 |
update_option( $option_name . '_icegram', 'yes', false );
|
172 |
|
173 |
-
//
|
174 |
-
if ( '
|
175 |
-
$url = "https://www.icegram.com/pricing/?utm_source=in_app&utm_medium=ig_banner&utm_campaign=
|
176 |
header( "Location: {$url}" );
|
177 |
exit();
|
178 |
} else {
|
@@ -220,7 +220,12 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
220 |
jQuery('#klawoo_response').html('');
|
221 |
params = jQuery("form[name=klawoo_subscribe]").serializeArray();
|
222 |
params.push({name: 'action', value: 'klawoo_subscribe'});
|
223 |
-
|
|
|
|
|
|
|
|
|
|
|
224 |
jQuery.ajax({
|
225 |
method: 'POST',
|
226 |
type: 'text',
|
@@ -242,6 +247,9 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
242 |
|
243 |
|
244 |
public function klawoo_subscribe() {
|
|
|
|
|
|
|
245 |
$url = 'http://app.klawoo.com/subscribe';
|
246 |
|
247 |
if ( ! empty( $_POST ) ) {
|
@@ -377,7 +385,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
377 |
|
378 |
public function icegram_event_track() {
|
379 |
if ( ! empty( $_POST['ig_local_url_cs'] ) && isset( $_SERVER['HTTP_ORIGIN'] ) ) {
|
380 |
-
$parts = parse_url( $_POST['ig_local_url_cs'] );
|
381 |
$base_url = $parts["scheme"] . "://" . $parts["host"];
|
382 |
header( 'Access-Control-Allow-Origin: ' . $base_url );
|
383 |
header( 'Access-Control-Allow-Credentials: true' );
|
@@ -848,7 +856,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
848 |
$icegram_data = apply_filters( 'icegram_data', array(
|
849 |
'messages' => array_values( $messages ),
|
850 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
851 |
-
'preview_id' => ! empty( $_GET['campaign_preview_id'] ) ? $_GET['campaign_preview_id'] : '',
|
852 |
'defaults' => $icegram_default
|
853 |
) );
|
854 |
if ( empty( $icegram_data['preview_id'] ) ) {
|
@@ -1037,7 +1045,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1037 |
|
1038 |
wp_enqueue_script( 'icegram_writepanel' );
|
1039 |
|
1040 |
-
$icegram_writepanel_params = array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'search_message_nonce' => wp_create_nonce( "search-messages" ), 'home_url' => home_url( '/' ) );
|
1041 |
$this->available_headlines = apply_filters( 'icegram_available_headlines', array() );
|
1042 |
$icegram_writepanel_params = array_merge( $icegram_writepanel_params, array( 'available_headlines' => $this->available_headlines ) );
|
1043 |
|
@@ -1176,7 +1184,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1176 |
}
|
1177 |
$message_data['delay_time'] = 0;
|
1178 |
$message_data['retargeting'] = '';
|
1179 |
-
$message_data['campaign_id'] = ( $preview_mode ) ? $_REQUEST['campaign_preview_id'] : '';
|
1180 |
|
1181 |
// Pull display time and retargeting rule from campaign if possible
|
1182 |
$message_id = ( ! empty( $message_data['original_message_id'] ) ) ? $message_data['original_message_id'] : $id;
|
@@ -1289,6 +1297,23 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1289 |
function include_classes( $feedback_version ) {
|
1290 |
global $ig_tracker, $ig_feedback;
|
1291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1292 |
$feedback_version_for_file = str_replace( '.', '-', $feedback_version );
|
1293 |
$f = 'classes/feedback/class-ig-feedback.php';
|
1294 |
require_once( $f );
|
@@ -1528,7 +1553,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1528 |
|
1529 |
function import_gallery_item() {
|
1530 |
if ( ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'fetch_messages' && ! empty( $_REQUEST['campaign_id'] ) && ! empty( $_REQUEST['gallery_item'] ) ) {
|
1531 |
-
$url = 'https://www.icegram.com/gallery/wp-admin/admin-ajax.php?utm_source=ig_inapp&utm_campaign=ig_gallery&utm_medium=' . $_REQUEST['campaign_id'];
|
1532 |
$params = $_REQUEST;
|
1533 |
$imported_gallery_items = array();
|
1534 |
$options = array(
|
@@ -1542,7 +1567,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1542 |
$new_campaign_ids = $this->import( json_decode( $response['body'], true ) );
|
1543 |
if ( ! empty( $new_campaign_ids ) ) {
|
1544 |
$imported_gallery_items = get_option( 'ig_imported_gallery_items' );
|
1545 |
-
$imported_gallery_items[] = $_REQUEST['campaign_id'];
|
1546 |
update_option( 'ig_imported_gallery_items', $imported_gallery_items );
|
1547 |
$location = admin_url( 'post.php?post=' . $new_campaign_ids[0] . '&action=edit' );
|
1548 |
header( 'Location:' . $location );
|
@@ -1715,7 +1740,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1715 |
static function get_current_page_id() {
|
1716 |
global $post;
|
1717 |
if ( ! empty( $_REQUEST['page_id'] ) && is_numeric( $_REQUEST['page_id'] ) ) {
|
1718 |
-
$post = get_post( $_REQUEST['page_id'] );
|
1719 |
setup_postdata( $post );
|
1720 |
// WPML check
|
1721 |
$id = apply_filters( 'icegram_identify_current_page', $post->ID );
|
@@ -1727,7 +1752,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1727 |
|
1728 |
static function get_current_page_url() {
|
1729 |
if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
|
1730 |
-
$pageURL = ( ! empty( $_REQUEST['referral_url'] ) ) ? $_REQUEST['referral_url'] : '';
|
1731 |
} else {
|
1732 |
$pageURL = 'http';
|
1733 |
if ( isset( $_SERVER["HTTPS"] ) ) {
|
@@ -1736,7 +1761,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1736 |
}
|
1737 |
}
|
1738 |
$pageURL .= "://";
|
1739 |
-
if ( $_SERVER["SERVER_PORT"]
|
1740 |
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
1741 |
} else {
|
1742 |
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
@@ -1896,7 +1921,7 @@ if ( ! class_exists( 'Icegram' ) ) {
|
|
1896 |
$duplicate_id = Icegram::duplicate_in_db( $original_id );
|
1897 |
$location = admin_url( 'post.php?post=' . $duplicate_id . '&action=edit' );
|
1898 |
header( 'Location:' . $location );
|
1899 |
-
exit;
|
1900 |
}
|
1901 |
|
1902 |
public static function form_submission_validate_request( $request_data ) {
|
24 |
public static $current_page_id;
|
25 |
|
26 |
public function __construct() {
|
27 |
+
global $ig_feedback, $ig_tracker, $ig_usage_tracker;
|
28 |
|
29 |
$this->version = IG_PLUGIN_VERSION;
|
30 |
$this->shortcode_instances = array();
|
170 |
$option_name = sanitize_text_field( $_GET['ig_option_name'] );
|
171 |
update_option( $option_name . '_icegram', 'yes', false );
|
172 |
|
173 |
+
//bfcm 2021 offer
|
174 |
+
if ( 'ig_offer_bfcm_2021' === $option_name ) {
|
175 |
+
$url = "https://www.icegram.com/pricing/?utm_source=in_app&utm_medium=ig_banner&utm_campaign=offer_bfcm_2021";
|
176 |
header( "Location: {$url}" );
|
177 |
exit();
|
178 |
} else {
|
220 |
jQuery('#klawoo_response').html('');
|
221 |
params = jQuery("form[name=klawoo_subscribe]").serializeArray();
|
222 |
params.push({name: 'action', value: 'klawoo_subscribe'});
|
223 |
+
|
224 |
+
// Add ajax security nonce.
|
225 |
+
params.push({
|
226 |
+
name: 'security',
|
227 |
+
value: '<?php echo wp_create_nonce( 'ig-klawoo-subscription-form' );?>',
|
228 |
+
});
|
229 |
jQuery.ajax({
|
230 |
method: 'POST',
|
231 |
type: 'text',
|
247 |
|
248 |
|
249 |
public function klawoo_subscribe() {
|
250 |
+
|
251 |
+
check_ajax_referer( 'ig-klawoo-subscription-form', 'security' );
|
252 |
+
|
253 |
$url = 'http://app.klawoo.com/subscribe';
|
254 |
|
255 |
if ( ! empty( $_POST ) ) {
|
385 |
|
386 |
public function icegram_event_track() {
|
387 |
if ( ! empty( $_POST['ig_local_url_cs'] ) && isset( $_SERVER['HTTP_ORIGIN'] ) ) {
|
388 |
+
$parts = parse_url( sanitize_text_field( $_POST['ig_local_url_cs'] ) );
|
389 |
$base_url = $parts["scheme"] . "://" . $parts["host"];
|
390 |
header( 'Access-Control-Allow-Origin: ' . $base_url );
|
391 |
header( 'Access-Control-Allow-Credentials: true' );
|
856 |
$icegram_data = apply_filters( 'icegram_data', array(
|
857 |
'messages' => array_values( $messages ),
|
858 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
859 |
+
'preview_id' => ! empty( $_GET['campaign_preview_id'] ) ? sanitize_text_field( $_GET['campaign_preview_id'] ) : '',
|
860 |
'defaults' => $icegram_default
|
861 |
) );
|
862 |
if ( empty( $icegram_data['preview_id'] ) ) {
|
1045 |
|
1046 |
wp_enqueue_script( 'icegram_writepanel' );
|
1047 |
|
1048 |
+
$icegram_writepanel_params = array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'search_message_nonce' => wp_create_nonce( "search-messages" ), 'ig_nonce' => wp_create_nonce( "ig-nonce" ), 'home_url' => home_url( '/' ) );
|
1049 |
$this->available_headlines = apply_filters( 'icegram_available_headlines', array() );
|
1050 |
$icegram_writepanel_params = array_merge( $icegram_writepanel_params, array( 'available_headlines' => $this->available_headlines ) );
|
1051 |
|
1184 |
}
|
1185 |
$message_data['delay_time'] = 0;
|
1186 |
$message_data['retargeting'] = '';
|
1187 |
+
$message_data['campaign_id'] = ( $preview_mode && ! empty( $_REQUEST['campaign_preview_id'] ) ) ? sanitize_text_field( $_REQUEST['campaign_preview_id'] ) : '';
|
1188 |
|
1189 |
// Pull display time and retargeting rule from campaign if possible
|
1190 |
$message_id = ( ! empty( $message_data['original_message_id'] ) ) ? $message_data['original_message_id'] : $id;
|
1297 |
function include_classes( $feedback_version ) {
|
1298 |
global $ig_tracker, $ig_feedback;
|
1299 |
|
1300 |
+
$name = 'Icegram';
|
1301 |
+
$text_domain = 'icegram';
|
1302 |
+
$plugin_prefix = 'ig';
|
1303 |
+
$plan = get_option( 'ig_engage_plan', 'lite' );
|
1304 |
+
$plugin_file_path = IG_PLUGIN_DIR . 'icegram.php';
|
1305 |
+
$allowed_by_default = ( 'lite' === $plan ) ? false : true;
|
1306 |
+
|
1307 |
+
// Usage tracker code begin
|
1308 |
+
require dirname(__FILE__) . '/classes/feedback/class-ig-plugin-data-tracker.php';
|
1309 |
+
|
1310 |
+
$ig_usage_tracker = 'Icegram_Plugin_Usage_Tracker_V_' . str_replace( '.', '_', IG_FEEDBACK_TRACKER_VERSION);
|
1311 |
+
if( class_exists( $ig_usage_tracker) ){
|
1312 |
+
new $ig_usage_tracker($name, $text_domain, $plugin_prefix, IG_PRODUCT_ID, $plan, $plugin_file_path, $ig_tracker, $allowed_by_default );
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
// Usage tracker code ends
|
1316 |
+
|
1317 |
$feedback_version_for_file = str_replace( '.', '-', $feedback_version );
|
1318 |
$f = 'classes/feedback/class-ig-feedback.php';
|
1319 |
require_once( $f );
|
1553 |
|
1554 |
function import_gallery_item() {
|
1555 |
if ( ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'fetch_messages' && ! empty( $_REQUEST['campaign_id'] ) && ! empty( $_REQUEST['gallery_item'] ) ) {
|
1556 |
+
$url = 'https://www.icegram.com/gallery/wp-admin/admin-ajax.php?utm_source=ig_inapp&utm_campaign=ig_gallery&utm_medium=' . sanitize_text_field( $_REQUEST['campaign_id'] );
|
1557 |
$params = $_REQUEST;
|
1558 |
$imported_gallery_items = array();
|
1559 |
$options = array(
|
1567 |
$new_campaign_ids = $this->import( json_decode( $response['body'], true ) );
|
1568 |
if ( ! empty( $new_campaign_ids ) ) {
|
1569 |
$imported_gallery_items = get_option( 'ig_imported_gallery_items' );
|
1570 |
+
$imported_gallery_items[] = sanitize_text_field( $_REQUEST['campaign_id'] );
|
1571 |
update_option( 'ig_imported_gallery_items', $imported_gallery_items );
|
1572 |
$location = admin_url( 'post.php?post=' . $new_campaign_ids[0] . '&action=edit' );
|
1573 |
header( 'Location:' . $location );
|
1740 |
static function get_current_page_id() {
|
1741 |
global $post;
|
1742 |
if ( ! empty( $_REQUEST['page_id'] ) && is_numeric( $_REQUEST['page_id'] ) ) {
|
1743 |
+
$post = get_post( sanitize_text_field( $_REQUEST['page_id'] ) );
|
1744 |
setup_postdata( $post );
|
1745 |
// WPML check
|
1746 |
$id = apply_filters( 'icegram_identify_current_page', $post->ID );
|
1752 |
|
1753 |
static function get_current_page_url() {
|
1754 |
if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
|
1755 |
+
$pageURL = ( ! empty( $_REQUEST['referral_url'] ) ) ? sanitize_text_field( $_REQUEST['referral_url'] ) : '';
|
1756 |
} else {
|
1757 |
$pageURL = 'http';
|
1758 |
if ( isset( $_SERVER["HTTPS"] ) ) {
|
1761 |
}
|
1762 |
}
|
1763 |
$pageURL .= "://";
|
1764 |
+
if ( isset( $_SERVER["SERVER_PORT"] ) && "80" != $_SERVER["SERVER_PORT"] ) {
|
1765 |
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
1766 |
} else {
|
1767 |
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
1921 |
$duplicate_id = Icegram::duplicate_in_db( $original_id );
|
1922 |
$location = admin_url( 'post.php?post=' . $duplicate_id . '&action=edit' );
|
1923 |
header( 'Location:' . $location );
|
1924 |
+
exit;
|
1925 |
}
|
1926 |
|
1927 |
public static function form_submission_validate_request( $request_data ) {
|
lite/classes/class-icegram-activator.php
CHANGED
@@ -27,9 +27,9 @@ class Icegram_Activator {
|
|
27 |
*/
|
28 |
public static function activate() {
|
29 |
// Redirect to welcome screen
|
30 |
-
delete_option( '_icegram_activation_redirect' );
|
31 |
-
add_option( '_icegram_activation_redirect', 'pending' );
|
32 |
-
|
33 |
do_action( 'ig_activated' );
|
34 |
}
|
35 |
}
|
27 |
*/
|
28 |
public static function activate() {
|
29 |
// Redirect to welcome screen
|
30 |
+
// delete_option( '_icegram_activation_redirect' );
|
31 |
+
// add_option( '_icegram_activation_redirect', 'pending' );
|
32 |
+
error_log('activated');
|
33 |
do_action( 'ig_activated' );
|
34 |
}
|
35 |
}
|
lite/classes/class-icegram-campaign-admin.php
CHANGED
@@ -491,7 +491,7 @@ public function campaign_data_tab_content($tabs) {
|
|
491 |
|
492 |
header( 'Content-Type: application/json; charset=utf-8' );
|
493 |
|
494 |
-
$term = ( string ) urldecode( stripslashes( strip_tags( $_GET['term'] ) ) );
|
495 |
$post_types = array('ig_message');
|
496 |
|
497 |
if ( empty( $term ) ) die();
|
@@ -565,6 +565,8 @@ public function campaign_data_tab_content($tabs) {
|
|
565 |
$ig_message_admin = Icegram_Message_Admin::getInstance();
|
566 |
$ig_message_admin->is_icegram_editor = true;
|
567 |
|
|
|
|
|
568 |
if ( empty( $_POST['message_id'] ) || !is_numeric( $_POST['message_id'] ) ) {
|
569 |
|
570 |
$my_post = array(
|
@@ -573,11 +575,11 @@ public function campaign_data_tab_content($tabs) {
|
|
573 |
);
|
574 |
$message_id = wp_insert_post( $my_post );
|
575 |
$message_title = '';
|
576 |
-
$message_type = $_POST['message_id'];
|
577 |
|
578 |
} else {
|
579 |
|
580 |
-
$message_id = $_POST['message_id'];
|
581 |
$message_title = get_the_title( $message_id );
|
582 |
$message_data = get_post_meta( $message_id, 'icegram_message_data', true );
|
583 |
$message_type = $message_data['type'];
|
@@ -586,25 +588,29 @@ public function campaign_data_tab_content($tabs) {
|
|
586 |
|
587 |
ob_start();
|
588 |
$icegram_message_meta_key = apply_filters('icegram_message_meta_key' , 'messages');
|
|
|
589 |
?>
|
590 |
-
<tr class="form-field message-row" value="<?php echo $message_id; ?>">
|
591 |
<td class="message_header">
|
592 |
-
<label class="message_header_label <?php echo "ig_"
|
593 |
</td>
|
594 |
<td class="message_title">
|
595 |
-
<div class="message-title-text" style="display:none;"><?php echo $message_title; ?></div>
|
596 |
-
<input type="text" class="message-title-input" name="message_data[<?php echo $message_id; ?>][post_title]" value="<?php echo $message_title; ?>" placeholder="<?php echo
|
597 |
</td>
|
598 |
<td class="message_seconds">
|
599 |
-
|
600 |
-
|
|
|
|
|
|
|
601 |
</td>
|
602 |
<td class="action_links">
|
603 |
-
<span class="actions message_edit" title="<?php
|
604 |
-
<span class="actions message_delete" title="<?php
|
605 |
</td>
|
606 |
</tr>
|
607 |
-
<tr id="message_row_<?php echo $message_id; ?>" class="message-edit-row">
|
608 |
<td colspan="4">
|
609 |
<?php
|
610 |
$ig_message_admin->message_form_fields( '', array( 'message_type' => $message_type, 'message_id' => $message_id, 'new_message_row' => true ) );
|
@@ -628,12 +634,16 @@ public function campaign_data_tab_content($tabs) {
|
|
628 |
if ( empty( $_POST['icegram_campaign_meta_nonce'] ) || ! wp_verify_nonce( $_POST['icegram_campaign_meta_nonce'], 'icegram_campaign_save_data' ) ) return;
|
629 |
if (! current_user_can( 'edit_post', $post_id )) return;
|
630 |
if ($post->post_type != 'ig_campaign') return;
|
631 |
-
|
632 |
-
$campaign_target_rules =
|
|
|
|
|
|
|
633 |
|
634 |
if(!empty($campaign_target_rules) && !empty($campaign_target_rules['local_urls'])){
|
635 |
foreach ($campaign_target_rules['local_urls'] as $key => $url) {
|
636 |
if( !empty( $url ) ){
|
|
|
637 |
if( $url == '*'){
|
638 |
$campaign_target_rules['local_urls'][$key] = $url;
|
639 |
}else{
|
@@ -646,7 +656,7 @@ public function campaign_data_tab_content($tabs) {
|
|
646 |
}
|
647 |
|
648 |
}
|
649 |
-
|
650 |
if ( isset( $_POST['page_id'] ) ) {
|
651 |
$campaign_target_rules['page_id'] = $_POST['page_id'];
|
652 |
update_post_meta( $post_id, 'icegram_campaign_target_pages', $_POST['page_id'] );
|
@@ -663,9 +673,15 @@ public function campaign_data_tab_content($tabs) {
|
|
663 |
if ( empty( $_POST['messages'] ) ) {
|
664 |
update_post_meta( $post_id, 'messages', array() );
|
665 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
|
667 |
-
update_post_meta( $post_id, 'messages', array_values( $
|
668 |
-
update_post_meta( $post_id, 'campaign_preview', array_values( $
|
669 |
|
670 |
// Saving $_POST to temp var before updating messages
|
671 |
// to avoid problems with action handlers that rely on
|
@@ -692,6 +708,14 @@ public function campaign_data_tab_content($tabs) {
|
|
692 |
$message_data['position'] = $message_data['position']['ig_default'];
|
693 |
}
|
694 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
if( isset( $message_data['title'] ) ) {
|
696 |
$message_data['title'] = wp_kses_post( $message_data['title'] );
|
697 |
}
|
@@ -724,48 +748,53 @@ public function campaign_data_tab_content($tabs) {
|
|
724 |
// On preview button click save campaign messages list
|
725 |
function save_campaign_preview() {
|
726 |
|
|
|
|
|
727 |
if ( empty($_POST['post_ID']) ) die();
|
728 |
-
|
|
|
729 |
|
730 |
$messages = apply_filters('campaign_preview_messages', $_POST['messages'], $_POST);
|
731 |
if( !empty( $messages ) ) {
|
732 |
-
update_post_meta( $
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
|
|
|
|
|
|
750 |
}
|
751 |
-
$message_data = apply_filters( 'icegram_update_message_preview_data', $message_data, $message_id );
|
752 |
-
update_post_meta( $message_id, 'icegram_message_preview_data', $message_data );
|
753 |
}
|
754 |
// Determine page url to preview on...
|
755 |
$page_url = '';
|
756 |
|
757 |
if ( !empty($_POST['campaign_target_rules']) && !empty($_POST['campaign_target_rules']['other_page']) && !empty($_POST['page_id']) && is_array($_POST['page_id'])) {
|
758 |
-
$page_url = get_permalink( $_POST['page_id'][0] );
|
759 |
}
|
760 |
if ($page_url == '') {
|
761 |
if(!empty($_POST['campaign_target_rules']['local_url']) && is_array($_POST['campaign_target_rules']['local_urls'])){
|
762 |
-
$
|
|
|
763 |
}else{
|
764 |
$page_url = home_url();
|
765 |
}
|
766 |
}
|
767 |
ob_clean();
|
768 |
-
echo esc_url(add_query_arg( 'campaign_preview_id', $
|
769 |
}
|
770 |
die();
|
771 |
|
@@ -782,7 +811,7 @@ public function campaign_data_tab_content($tabs) {
|
|
782 |
|
783 |
function duplicate_campaign(){
|
784 |
if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'duplicate-campaign' && !empty($_REQUEST['campaign_id'])){
|
785 |
-
Icegram::duplicate( $_REQUEST['campaign_id']);
|
786 |
}
|
787 |
}
|
788 |
|
491 |
|
492 |
header( 'Content-Type: application/json; charset=utf-8' );
|
493 |
|
494 |
+
$term = isset( $_GET['term'] ) ? ( string ) urldecode( stripslashes( strip_tags( sanitize_text_field( $_GET['term'] ) ) ) ) : '';
|
495 |
$post_types = array('ig_message');
|
496 |
|
497 |
if ( empty( $term ) ) die();
|
565 |
$ig_message_admin = Icegram_Message_Admin::getInstance();
|
566 |
$ig_message_admin->is_icegram_editor = true;
|
567 |
|
568 |
+
check_ajax_referer( 'ig-nonce', 'security' );
|
569 |
+
|
570 |
if ( empty( $_POST['message_id'] ) || !is_numeric( $_POST['message_id'] ) ) {
|
571 |
|
572 |
$my_post = array(
|
575 |
);
|
576 |
$message_id = wp_insert_post( $my_post );
|
577 |
$message_title = '';
|
578 |
+
$message_type = sanitize_text_field( $_POST['message_id'] );
|
579 |
|
580 |
} else {
|
581 |
|
582 |
+
$message_id = sanitize_text_field( $_POST['message_id'] );
|
583 |
$message_title = get_the_title( $message_id );
|
584 |
$message_data = get_post_meta( $message_id, 'icegram_message_data', true );
|
585 |
$message_type = $message_data['type'];
|
588 |
|
589 |
ob_start();
|
590 |
$icegram_message_meta_key = apply_filters('icegram_message_meta_key' , 'messages');
|
591 |
+
$message_header_label = ucwords( str_replace( "-", ' ', $message_type ) );
|
592 |
?>
|
593 |
+
<tr class="form-field message-row" value="<?php echo esc_attr( $message_id ); ?>">
|
594 |
<td class="message_header">
|
595 |
+
<label class="message_header_label <?php echo "ig_". esc_attr( $message_type ); ?>"><?php echo esc_html( $message_header_label ); ?></label>
|
596 |
</td>
|
597 |
<td class="message_title">
|
598 |
+
<div class="message-title-text" style="display:none;"><?php echo esc_html( $message_title ); ?></div>
|
599 |
+
<input type="text" class="message-title-input" name="message_data[<?php echo esc_html( $message_id ); ?>][post_title]" value="<?php echo esc_attr( $message_title ); ?>" placeholder="<?php echo esc_html__( 'Give this message a name for your own reference', 'icegram' ); ?>">
|
600 |
</td>
|
601 |
<td class="message_seconds">
|
602 |
+
<?php
|
603 |
+
$row = isset( $_POST['row'] ) ? sanitize_text_field( $_POST['row'] ) : '';
|
604 |
+
?>
|
605 |
+
<input type="hidden" name="<?php echo esc_attr( $icegram_message_meta_key ) .'['. esc_attr( $row ); ?>][id]" value="<?php echo esc_attr( $message_id ); ?>" />
|
606 |
+
<input type="number" class="seconds-text" name="<?php echo esc_attr( $icegram_message_meta_key ) .'['. esc_attr( $row ); ?>][time]" min="-1" value="0" size="3" /><?php esc_html_e( ' sec', 'icegram' )?>
|
607 |
</td>
|
608 |
<td class="action_links">
|
609 |
+
<span class="actions message_edit" title="<?php esc_html_e( 'Edit Message', 'icegram' ); ?>" ></span>
|
610 |
+
<span class="actions message_delete" title="<?php esc_html_e( 'Remove from Campaign', 'icegram' ); ?>" ></span>
|
611 |
</td>
|
612 |
</tr>
|
613 |
+
<tr id="message_row_<?php echo esc_attr($message_id); ?>" class="message-edit-row">
|
614 |
<td colspan="4">
|
615 |
<?php
|
616 |
$ig_message_admin->message_form_fields( '', array( 'message_type' => $message_type, 'message_id' => $message_id, 'new_message_row' => true ) );
|
634 |
if ( empty( $_POST['icegram_campaign_meta_nonce'] ) || ! wp_verify_nonce( $_POST['icegram_campaign_meta_nonce'], 'icegram_campaign_save_data' ) ) return;
|
635 |
if (! current_user_can( 'edit_post', $post_id )) return;
|
636 |
if ($post->post_type != 'ig_campaign') return;
|
637 |
+
|
638 |
+
$campaign_target_rules = '';
|
639 |
+
if ( isset( $_POST['campaign_target_rules'] ) ){
|
640 |
+
$campaign_target_rules = apply_filters( 'icegram_update_campaign_rules', $_POST['campaign_target_rules'], $post_id );
|
641 |
+
}
|
642 |
|
643 |
if(!empty($campaign_target_rules) && !empty($campaign_target_rules['local_urls'])){
|
644 |
foreach ($campaign_target_rules['local_urls'] as $key => $url) {
|
645 |
if( !empty( $url ) ){
|
646 |
+
$url = esc_url( $url );
|
647 |
if( $url == '*'){
|
648 |
$campaign_target_rules['local_urls'][$key] = $url;
|
649 |
}else{
|
656 |
}
|
657 |
|
658 |
}
|
659 |
+
|
660 |
if ( isset( $_POST['page_id'] ) ) {
|
661 |
$campaign_target_rules['page_id'] = $_POST['page_id'];
|
662 |
update_post_meta( $post_id, 'icegram_campaign_target_pages', $_POST['page_id'] );
|
673 |
if ( empty( $_POST['messages'] ) ) {
|
674 |
update_post_meta( $post_id, 'messages', array() );
|
675 |
} else {
|
676 |
+
$messages = $_POST['messages'];
|
677 |
+
foreach( $messages as $message => $data ) {
|
678 |
+
if( isset( $data['time'] ) ) {
|
679 |
+
$messages[ $message ]['time'] = sanitize_text_field( $data['time'] );
|
680 |
+
}
|
681 |
+
}
|
682 |
|
683 |
+
update_post_meta( $post_id, 'messages', array_values( $messages ) );
|
684 |
+
update_post_meta( $post_id, 'campaign_preview', array_values( $messages ) );
|
685 |
|
686 |
// Saving $_POST to temp var before updating messages
|
687 |
// to avoid problems with action handlers that rely on
|
708 |
$message_data['position'] = $message_data['position']['ig_default'];
|
709 |
}
|
710 |
|
711 |
+
$sanitizing_fields = array( 'bg_color', 'text_color', 'cta_bg_color', 'cta_text_color', 'alt_cta_bg_color', 'alt_cta_text_color' );
|
712 |
+
|
713 |
+
foreach ( $message_data as $index => $value ) {
|
714 |
+
if( in_array( $index, $sanitizing_fields) ) {
|
715 |
+
$message_data[ $index ] = sanitize_text_field( $message_data[ $index ] );
|
716 |
+
}
|
717 |
+
}
|
718 |
+
|
719 |
if( isset( $message_data['title'] ) ) {
|
720 |
$message_data['title'] = wp_kses_post( $message_data['title'] );
|
721 |
}
|
748 |
// On preview button click save campaign messages list
|
749 |
function save_campaign_preview() {
|
750 |
|
751 |
+
check_ajax_referer( 'ig-nonce', 'security' );
|
752 |
+
|
753 |
if ( empty($_POST['post_ID']) ) die();
|
754 |
+
$post_id = sanitize_text_field( $_POST['post_ID'] );
|
755 |
+
if ( !current_user_can( 'edit_post', $post_id ) ) die();
|
756 |
|
757 |
$messages = apply_filters('campaign_preview_messages', $_POST['messages'], $_POST);
|
758 |
if( !empty( $messages ) ) {
|
759 |
+
update_post_meta( $post_id, 'campaign_preview', $messages ) ;
|
760 |
+
if( isset( $_POST['message_data'] ) ) {
|
761 |
+
foreach ( (array) $_POST['message_data'] as $message_id => $message_data ) {
|
762 |
+
$type = $message_data['type'];
|
763 |
+
if( isset( $message_data['theme'][$type] ) ) {
|
764 |
+
$message_data['theme'] = $message_data['theme'][$type];
|
765 |
+
} else {
|
766 |
+
unset( $message_data['theme'] );
|
767 |
+
}
|
768 |
+
if( isset( $message_data['animation'][$type] ) ) {
|
769 |
+
$message_data['animation'] = $message_data['animation'][$type];
|
770 |
+
} else {
|
771 |
+
unset( $message_data['animation'] );
|
772 |
+
}
|
773 |
+
if( isset( $message_data['position'][$type] ) ) {
|
774 |
+
$message_data['position'] = $message_data['position'][$type];
|
775 |
+
} elseif( isset( $message_data['position']['ig_default'] ) ) {
|
776 |
+
$message_data['position'] = $message_data['position']['ig_default'];
|
777 |
+
}
|
778 |
+
$message_data = apply_filters( 'icegram_update_message_preview_data', $message_data, $message_id );
|
779 |
+
update_post_meta( $message_id, 'icegram_message_preview_data', $message_data );
|
780 |
}
|
|
|
|
|
781 |
}
|
782 |
// Determine page url to preview on...
|
783 |
$page_url = '';
|
784 |
|
785 |
if ( !empty($_POST['campaign_target_rules']) && !empty($_POST['campaign_target_rules']['other_page']) && !empty($_POST['page_id']) && is_array($_POST['page_id'])) {
|
786 |
+
$page_url = isset( $_POST['page_id'][0] ) ? get_permalink( sanitize_text_field( $_POST['page_id'][0] ) ) : '';
|
787 |
}
|
788 |
if ($page_url == '') {
|
789 |
if(!empty($_POST['campaign_target_rules']['local_url']) && is_array($_POST['campaign_target_rules']['local_urls'])){
|
790 |
+
$local_urls = sanitize_text_field( $_POST['campaign_target_rules']['local_urls'][0] );
|
791 |
+
$page_url = (strpos( $local_urls, '*') === false) ? $local_urls : home_url();
|
792 |
}else{
|
793 |
$page_url = home_url();
|
794 |
}
|
795 |
}
|
796 |
ob_clean();
|
797 |
+
echo esc_url(add_query_arg( 'campaign_preview_id', $post_id, $page_url ));
|
798 |
}
|
799 |
die();
|
800 |
|
811 |
|
812 |
function duplicate_campaign(){
|
813 |
if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'duplicate-campaign' && !empty($_REQUEST['campaign_id'])){
|
814 |
+
Icegram::duplicate( sanitize_text_field( $_REQUEST['campaign_id'] ) );
|
815 |
}
|
816 |
}
|
817 |
|
lite/classes/class-icegram-message-admin.php
CHANGED
@@ -645,16 +645,19 @@ if ( ! class_exists( 'Icegram_Message_Admin' ) ) {
|
|
645 |
// Additionally save message body content in post_content of post table
|
646 |
function save_message_in_post_content( $post_data ) {
|
647 |
|
|
|
|
|
|
|
648 |
if ( ! empty( $_POST['post_type'] ) && $_POST['post_type'] == 'ig_message' && ! empty( $_POST['message_data'] ) ) {
|
649 |
-
$message_id = $_POST['ID'];
|
650 |
-
$post_data['post_content'] = $_POST['message_data'][ $message_id ]['message'];
|
651 |
|
652 |
if ( isset( $_POST['message_data'][ $message_id ]['post_title'] ) ) {
|
653 |
|
654 |
if ( ! empty( $_POST['message_data'][ $message_id ]['post_title'] ) ) {
|
655 |
-
$post_data['post_title'] = $_POST['message_data'][ $message_id ]['post_title'];
|
656 |
} else {
|
657 |
-
$post_data['post_title'] = $_POST['message_data'][ $message_id ]['headline'];
|
658 |
}
|
659 |
|
660 |
}
|
@@ -885,7 +888,7 @@ if ( ! class_exists( 'Icegram_Message_Admin' ) ) {
|
|
885 |
|
886 |
function duplicate_message() {
|
887 |
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'duplicate-message' && ! empty( $_REQUEST['message_id'] ) ) {
|
888 |
-
Icegram::duplicate( $_REQUEST['message_id'] );
|
889 |
}
|
890 |
}
|
891 |
}
|
645 |
// Additionally save message body content in post_content of post table
|
646 |
function save_message_in_post_content( $post_data ) {
|
647 |
|
648 |
+
if ( empty( $_POST['icegram_message_meta_nonce'] ) || ! wp_verify_nonce( $_POST['icegram_message_meta_nonce'], 'icegram_message_save_data' ) ) {
|
649 |
+
return;
|
650 |
+
}
|
651 |
if ( ! empty( $_POST['post_type'] ) && $_POST['post_type'] == 'ig_message' && ! empty( $_POST['message_data'] ) ) {
|
652 |
+
$message_id = sanitize_text_field( $_POST['ID'] );
|
653 |
+
$post_data['post_content'] = isset( $_POST['message_data'][ $message_id ]['message'] ) ? $_POST['message_data'][ $message_id ]['message'] : '';
|
654 |
|
655 |
if ( isset( $_POST['message_data'][ $message_id ]['post_title'] ) ) {
|
656 |
|
657 |
if ( ! empty( $_POST['message_data'][ $message_id ]['post_title'] ) ) {
|
658 |
+
$post_data['post_title'] = sanitize_text_field( $_POST['message_data'][ $message_id ]['post_title'] );
|
659 |
} else {
|
660 |
+
$post_data['post_title'] = wp_kses_post( $_POST['message_data'][ $message_id ]['headline'] );
|
661 |
}
|
662 |
|
663 |
}
|
888 |
|
889 |
function duplicate_message() {
|
890 |
if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'duplicate-message' && ! empty( $_REQUEST['message_id'] ) ) {
|
891 |
+
Icegram::duplicate( sanitize_text_field( $_REQUEST['message_id'] ) );
|
892 |
}
|
893 |
}
|
894 |
}
|
lite/classes/feedback.php
CHANGED
@@ -183,3 +183,30 @@ function ig_can_load_sweetalert_js( $load = false ) {
|
|
183 |
}
|
184 |
|
185 |
add_filter( 'ig_can_load_sweetalert_js', 'ig_can_load_sweetalert_js', 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
add_filter( 'ig_can_load_sweetalert_js', 'ig_can_load_sweetalert_js', 10, 1 );
|
186 |
+
|
187 |
+
|
188 |
+
if ( ! function_exists( 'ig_show_plugin_usage_tracking_notice' ) ) {
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Can we show tracking usage optin notice?
|
192 |
+
*
|
193 |
+
* @return bool
|
194 |
+
*
|
195 |
+
*
|
196 |
+
*/
|
197 |
+
function ig_show_plugin_usage_tracking_notice( $enable ) {
|
198 |
+
|
199 |
+
// Show notice only to IG dashboard page.
|
200 |
+
|
201 |
+
$screen = get_current_screen() ;
|
202 |
+
$screen_id = $screen -> id ;
|
203 |
+
|
204 |
+
if( !empty( $screen_id ) && $screen_id === 'edit-ig_campaign') {
|
205 |
+
$enable = true;
|
206 |
+
}
|
207 |
+
|
208 |
+
return $enable;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
add_filter( 'ig_show_plugin_usage_tracking_notice', 'ig_show_plugin_usage_tracking_notice' );
|
lite/classes/feedback/class-ig-feedback.php
CHANGED
@@ -35,6 +35,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_2' ) ) {
|
|
35 |
* @var string
|
36 |
*/
|
37 |
public $api_url = 'https://api.icegram.com/store/feedback/'; // Production
|
|
|
38 |
|
39 |
/**
|
40 |
* Name for this plugin.
|
@@ -1112,7 +1113,9 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_2' ) ) {
|
|
1112 |
// Survey Skip & Deactivate.
|
1113 |
$form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
|
1114 |
event.preventDefault();
|
1115 |
-
|
|
|
|
|
1116 |
});
|
1117 |
|
1118 |
// Help Consent
|
35 |
* @var string
|
36 |
*/
|
37 |
public $api_url = 'https://api.icegram.com/store/feedback/'; // Production
|
38 |
+
|
39 |
|
40 |
/**
|
41 |
* Name for this plugin.
|
1113 |
// Survey Skip & Deactivate.
|
1114 |
$form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
|
1115 |
event.preventDefault();
|
1116 |
+
deactivationURL = $deactivateLink.attr('href');
|
1117 |
+
let skipSurveyURL = deactivationURL + '&survey_status=skipped';
|
1118 |
+
location.href = skipSurveyURL;
|
1119 |
});
|
1120 |
|
1121 |
// Help Consent
|
lite/classes/feedback/class-ig-plugin-data-tracker.php
ADDED
@@ -0,0 +1,548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
if ( ! class_exists( 'Icegram_Plugin_Usage_Tracker_V_1_2_2' ) ) {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Icegram_Plugin_Usage_Tracker_V_1_2_2
|
11 |
+
*
|
12 |
+
* Icegram tracker handler class is responsible for sending anonymous plugin
|
13 |
+
* data to Icegram servers for users that actively allowed data tracking.
|
14 |
+
*
|
15 |
+
* @class Icegram_Plugin_Usage_Tracker_V_1_2_2
|
16 |
+
* @since 1.0.0
|
17 |
+
*
|
18 |
+
* @package feedback
|
19 |
+
*/
|
20 |
+
class Icegram_Plugin_Usage_Tracker_V_1_2_2 {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* SDK version
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
public $sdk_version = '1.0.0';
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The API URL where we will send plugin tracking data.
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
public $api_url = 'https://api.icegram.com/track/'; //Production
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Name for this plugin.
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
public $name;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Unique slug for this plugin.
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
public $plugin;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Plugin Abbreviation
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
public $plugin_abbr;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Product ID
|
60 |
+
*
|
61 |
+
* @var int
|
62 |
+
*/
|
63 |
+
public $product_id;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Plugin plan
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
public $plugin_plan;
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* IG Tracker class name
|
75 |
+
*
|
76 |
+
* @var string
|
77 |
+
*/
|
78 |
+
public $tracker_class;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Is tracking allowed by default
|
82 |
+
*
|
83 |
+
* @var bool
|
84 |
+
*/
|
85 |
+
public $allowed_by_default;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Primary class constructor.
|
89 |
+
*
|
90 |
+
* @param string $name Plugin name.
|
91 |
+
* @param string $text_domain Text domain.
|
92 |
+
* @param string $plugin_abbr Plugin Abbreviation.
|
93 |
+
* @param int $product_id Product ID.
|
94 |
+
* @param string $plugin_plan Plugin Plan.
|
95 |
+
* @param string $plugin_file_path Main plugin file path.
|
96 |
+
* @param string $tracker_class Tracker class name used in the plugin.
|
97 |
+
* @param boolean $allowed_by_default Is tracking allowed by default.
|
98 |
+
* @param boolean $enable_on_dev Enable tracker on dev environments.
|
99 |
+
*/
|
100 |
+
public function __construct( $name, $text_domain, $plugin_abbr, $product_id, $plugin_plan, $plugin_file_path, $tracker_class, $allowed_by_default, $enable_on_dev = false ) {
|
101 |
+
$this->name = $name;
|
102 |
+
$this->text_domain = $text_domain;
|
103 |
+
$this->plugin_abbr = $plugin_abbr;
|
104 |
+
$this->product_id = $product_id;
|
105 |
+
$this->plugin_plan = $plugin_plan;
|
106 |
+
$this->tracker_class = $tracker_class;
|
107 |
+
$this->allowed_by_default = $allowed_by_default;
|
108 |
+
|
109 |
+
// Don't run usage tracker on dev environment if not enabled.
|
110 |
+
if ( ! $enable_on_dev ) {
|
111 |
+
return;
|
112 |
+
}
|
113 |
+
|
114 |
+
// Using icegram loaded hook instead of register activation hook
|
115 |
+
add_action( 'icegram_loaded', array( $this, 'do_activation_setup' ) , 9 );
|
116 |
+
|
117 |
+
|
118 |
+
// register_deactivation_hook( $plugin_file_path, array( $this, 'do_deactivation_cleanup' ) );
|
119 |
+
add_action( 'ig_deactivated', array( $this, 'do_deactivation_cleanup' ) );
|
120 |
+
|
121 |
+
$tracking_option_name = $this->get_tracking_option_name();
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Tracking consent add/update handler function.
|
125 |
+
* These action hooks are triggered by WordPress when we add/update tracking consent option in DB.
|
126 |
+
*/
|
127 |
+
|
128 |
+
add_action( 'add_option_' . $tracking_option_name, array( $this, 'handle_optin_add' ), 10, 2 );
|
129 |
+
|
130 |
+
add_action( 'update_option_' . $tracking_option_name, array( $this, 'handle_optin_update' ), 10, 3 );
|
131 |
+
|
132 |
+
add_action( 'admin_notices', array( $this, 'show_tracker_notice' ) );
|
133 |
+
add_action( 'admin_init', array( $this, 'handle_tracker_notice_actions' ) );
|
134 |
+
|
135 |
+
add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
|
136 |
+
add_action( $this->plugin_abbr . '_send_tracking_data', array( $this, 'send_tracking_data' ) );
|
137 |
+
|
138 |
+
add_filter( $this->plugin_abbr . '_allow_tracking', array( $this, 'is_tracking_allowed' ) );
|
139 |
+
add_filter( $this->plugin_abbr . '_tracking_data', array( $this, 'get_tracking_data' ) );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Handles when optin option is added in db
|
144 |
+
*
|
145 |
+
* @param string $option_name
|
146 |
+
* @param string $value
|
147 |
+
*/
|
148 |
+
public function handle_optin_add( $option_name, $value ) {
|
149 |
+
$this->handle_optin_change( $value );
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Handles when optin option is updated in db
|
154 |
+
*
|
155 |
+
* @param string $old_value
|
156 |
+
* @param string $new_value
|
157 |
+
* @param string $option_name
|
158 |
+
*/
|
159 |
+
public function handle_optin_update( $old_value, $new_value, $option_name ) {
|
160 |
+
$this->handle_optin_change( $new_value );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Common method to handle optin option add/update
|
165 |
+
*
|
166 |
+
* @param string $value
|
167 |
+
*/
|
168 |
+
public function handle_optin_change( $opted_in ) {
|
169 |
+
|
170 |
+
if ( 'yes' === $opted_in ) {
|
171 |
+
$this->schedule_cron();
|
172 |
+
$this->send_tracking_data( true );
|
173 |
+
} else {
|
174 |
+
$this->clear_scheduled_cron();
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Perform plugin activation related tasks.
|
180 |
+
*/
|
181 |
+
public function do_activation_setup() {
|
182 |
+
|
183 |
+
$tracker_activated_option = get_option( $this->plugin_abbr.'_tracker_activated', 'no' );
|
184 |
+
|
185 |
+
if( 'no' === $tracker_activated_option ) {
|
186 |
+
add_option( $this->plugin_abbr . '_installed_on', gmdate( 'Y-m-d H:i:s' ), '', false );
|
187 |
+
$this->schedule_cron();
|
188 |
+
|
189 |
+
$this->send_tracking_data( true );
|
190 |
+
update_option( $this->plugin_abbr.'_tracker_activated', 'yes', 'no' );
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Do deactivation cleanup
|
196 |
+
*/
|
197 |
+
public function do_deactivation_cleanup() {
|
198 |
+
$this->clear_scheduled_cron();
|
199 |
+
$survey_status = $_REQUEST['survey_status'];
|
200 |
+
|
201 |
+
if ( ! empty( $survey_status ) && 'skipped' === $survey_status ) {
|
202 |
+
|
203 |
+
$extra_params = array(
|
204 |
+
'is_deactivated' => 1
|
205 |
+
);
|
206 |
+
|
207 |
+
$this->send_tracking_data( true, $extra_params );
|
208 |
+
|
209 |
+
}
|
210 |
+
delete_option( $this->plugin_abbr.'_tracker_activated');
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Add weekly cron schedule
|
215 |
+
*
|
216 |
+
* @param array $schedules
|
217 |
+
*
|
218 |
+
* @return array $schedules
|
219 |
+
*/
|
220 |
+
public function add_weekly_schedule( $schedules = array() ) {
|
221 |
+
|
222 |
+
// Add weekly schedule if not exists already. From WP 5.4, it is added by default.
|
223 |
+
if ( empty( $schedules['weekly'] ) ) {
|
224 |
+
$schedules['weekly'] = array(
|
225 |
+
'interval' => DAY_IN_SECONDS * 7,
|
226 |
+
'display' => __( 'Once Weekly', $this->text_domain ),
|
227 |
+
);
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
return $schedules;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Schedule cron
|
236 |
+
*/
|
237 |
+
public function schedule_cron() {
|
238 |
+
// Schedule a weekly cron to send usage data.
|
239 |
+
|
240 |
+
$hook_name = $this->plugin_abbr . '_send_tracking_data';
|
241 |
+
|
242 |
+
if ( ! wp_next_scheduled( $hook_name ) ) {
|
243 |
+
wp_schedule_event( time(), 'weekly', $hook_name );
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Clear any scheduled cron
|
249 |
+
*/
|
250 |
+
public function clear_scheduled_cron() {
|
251 |
+
wp_clear_scheduled_hook( $this->plugin_abbr . '_send_tracking_data' );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Show tracking notice
|
256 |
+
*/
|
257 |
+
public function show_tracker_notice() {
|
258 |
+
|
259 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
260 |
+
return;
|
261 |
+
}
|
262 |
+
|
263 |
+
$show_tracking_notice = apply_filters( $this->plugin_abbr . '_show_plugin_usage_tracking_notice', false );
|
264 |
+
|
265 |
+
if ( false === $show_tracking_notice ) {
|
266 |
+
return;
|
267 |
+
}
|
268 |
+
|
269 |
+
$tracking_allowed = $this->is_tracking_allowed();
|
270 |
+
|
271 |
+
// Check if tracking option is set. Can be yes or no if set else empty.
|
272 |
+
// yes/no indicates the notice has already been shown and user has opted in/out. Don't show the notice in this case.
|
273 |
+
if ( ! empty( $tracking_allowed ) ) {
|
274 |
+
return;
|
275 |
+
}
|
276 |
+
|
277 |
+
$optin_url = wp_nonce_url( add_query_arg( $this->plugin_abbr . '_tracker', 'opt_into' ), $this->plugin_abbr . '_tracker_action' );
|
278 |
+
$optout_url = wp_nonce_url( add_query_arg( $this->plugin_abbr . '_tracker', 'opt_out' ), $this->plugin_abbr . '_tracker_action' );
|
279 |
+
|
280 |
+
?>
|
281 |
+
<style type="text/css">
|
282 |
+
#ig-plugin-usage-tracker-notice .button {
|
283 |
+
font-size: 13px;
|
284 |
+
line-height: 2;
|
285 |
+
}
|
286 |
+
|
287 |
+
#ig-plugin-usage-tracker-notice .button-primary {
|
288 |
+
color: #fff;
|
289 |
+
}
|
290 |
+
</style>
|
291 |
+
<div id="ig-plugin-usage-tracker-notice" class="notice notice-success" style="background: #ffefd5;">
|
292 |
+
<p>
|
293 |
+
<span class="dashicons dashicons-megaphone" style="color: #5850EC;"></span>
|
294 |
+
<?php
|
295 |
+
/* translators: %s. Plugin name. */
|
296 |
+
echo sprintf( esc_html__( 'Help us to improve %s by opting in to share non-sensitive plugin usage data. No personal data is tracked or stored.', $this->text_domain ), '<strong>' . esc_html( $this->name ) . '</strong>' );
|
297 |
+
?>
|
298 |
+
<a class="<?php echo esc_js( $this->plugin_abbr ); ?>-show-tracked-data-list" href="#">
|
299 |
+
<?php echo esc_html__( 'What we collect?', $this->text_domain ); ?>
|
300 |
+
</a>
|
301 |
+
</p>
|
302 |
+
|
303 |
+
<ul class="tracked-data-list my-3" style="display:none;">
|
304 |
+
<?php
|
305 |
+
$tracked_data_list = $this->get_tracked_data_list();
|
306 |
+
if ( ! empty( $tracked_data_list ) ) {
|
307 |
+
foreach ( $tracked_data_list as $tracked_data ) {
|
308 |
+
?>
|
309 |
+
<li>
|
310 |
+
⏺
|
311 |
+
<span class="ml-1">
|
312 |
+
<?php echo esc_html( $tracked_data ); ?>
|
313 |
+
</span>
|
314 |
+
</li>
|
315 |
+
<?php
|
316 |
+
}
|
317 |
+
}
|
318 |
+
?>
|
319 |
+
</ul>
|
320 |
+
<p class="ml-4">
|
321 |
+
<a href="<?php echo esc_url( $optin_url ); ?>" class="button button-primary">
|
322 |
+
<?php
|
323 |
+
echo esc_html__( 'Yes, count me in!', $this->text_domain );
|
324 |
+
?>
|
325 |
+
</a>
|
326 |
+
<a href="<?php echo esc_url( $optout_url ); ?>" class="text-gray-500 hover:text-gray-600 hover:underline ml-3">
|
327 |
+
<?php
|
328 |
+
echo esc_html__( 'No thanks', $this->text_domain );
|
329 |
+
?>
|
330 |
+
</a>
|
331 |
+
</p>
|
332 |
+
<script type='text/javascript'>
|
333 |
+
jQuery('.<?php echo esc_js( $this->plugin_abbr ); ?>-show-tracked-data-list').on('click', function(e) {
|
334 |
+
e.preventDefault();
|
335 |
+
jQuery(this).parents('.notice').find('.tracked-data-list').slideToggle('fast');
|
336 |
+
});
|
337 |
+
</script>
|
338 |
+
</div>
|
339 |
+
<?php
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Get list of tracked data
|
344 |
+
*
|
345 |
+
* @return array
|
346 |
+
*/
|
347 |
+
public function get_tracked_data_list() {
|
348 |
+
|
349 |
+
$data = apply_filters( $this->plugin_abbr . '_tracked_data_list', array(
|
350 |
+
__( 'Server environment details (PHP, MYSQL, Server name etc.)', $this->text_domain ),
|
351 |
+
__( 'WordPress environment details (Site URL, Site language, Timezone, WordPress version etc.)', $this->text_domain ),
|
352 |
+
__( 'Installed plugins details', $this->text_domain ),
|
353 |
+
__( 'Active theme details', $this->text_domain ),
|
354 |
+
__( 'Admin name and email address', $this->text_domain ),
|
355 |
+
) );
|
356 |
+
|
357 |
+
return $data;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Is allow track.
|
362 |
+
*
|
363 |
+
* Checks whether the site admin has opted-in for data tracking, or not.
|
364 |
+
*
|
365 |
+
* @return bool
|
366 |
+
*/
|
367 |
+
public function is_tracking_allowed() {
|
368 |
+
$tracking_option_name = $this->get_tracking_option_name();
|
369 |
+
$tracking_allowed = get_option( $tracking_option_name, '' );
|
370 |
+
|
371 |
+
// Enable tracking by default if allowed_by_default is true.
|
372 |
+
if ( empty( $tracking_allowed ) && $this->allowed_by_default ) {
|
373 |
+
$tracking_allowed = 'yes';
|
374 |
+
$this->set_opt_in( $tracking_allowed );
|
375 |
+
}
|
376 |
+
|
377 |
+
return $tracking_allowed;
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Get tracking option name
|
382 |
+
*
|
383 |
+
* @return string
|
384 |
+
*/
|
385 |
+
public function get_tracking_option_name() {
|
386 |
+
return $this->plugin_abbr . '_allow_tracking';
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Handle tracker actions.
|
391 |
+
*
|
392 |
+
* Check if the user opted-in or opted-out and update the database.
|
393 |
+
*
|
394 |
+
* Fired by `admin_init` action.
|
395 |
+
*/
|
396 |
+
public function handle_tracker_notice_actions() {
|
397 |
+
|
398 |
+
if ( ! isset( $_GET[$this->plugin_abbr . '_tracker'] ) ) {
|
399 |
+
return;
|
400 |
+
}
|
401 |
+
|
402 |
+
check_admin_referer( $this->plugin_abbr . '_tracker_action' );
|
403 |
+
|
404 |
+
$opted_in = 'no';
|
405 |
+
if ( 'opt_into' === $_GET[$this->plugin_abbr . '_tracker'] ) {
|
406 |
+
$opted_in = 'yes';
|
407 |
+
}
|
408 |
+
|
409 |
+
$this->set_opt_in( $opted_in );
|
410 |
+
|
411 |
+
wp_safe_redirect( remove_query_arg( array( $this->plugin_abbr . '_tracker', '_wpnonce' ) ) );
|
412 |
+
exit;
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Set tracking option
|
417 |
+
*
|
418 |
+
* @param string $opted_in yes/no
|
419 |
+
*/
|
420 |
+
public function set_opt_in( $opted_in ) {
|
421 |
+
$tracking_option_name = $this->get_tracking_option_name();
|
422 |
+
update_option( $tracking_option_name, $opted_in, false );
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Send tracking data.
|
427 |
+
*
|
428 |
+
* @param bool $ignore_last_send Whether to consider last sending time before sending a new request.
|
429 |
+
* @param array $extra_params Extra request params.
|
430 |
+
*/
|
431 |
+
public function send_tracking_data( $ignore_last_send = false, $extra_params = array() ) {
|
432 |
+
|
433 |
+
$tracking_allowed = $this->is_tracking_allowed();
|
434 |
+
|
435 |
+
// Return if tracking not allowed
|
436 |
+
if ( 'yes' !== $tracking_allowed ) {
|
437 |
+
return;
|
438 |
+
}
|
439 |
+
|
440 |
+
if ( ! $ignore_last_send ) {
|
441 |
+
$last_send = $this->get_last_send_time();
|
442 |
+
|
443 |
+
$last_send_interval = strtotime( '-1 week' );
|
444 |
+
|
445 |
+
// Send a maximum of once per week.
|
446 |
+
if ( $last_send && $last_send > $last_send_interval ) {
|
447 |
+
return;
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
// Update time first before sending to ensure it is set.
|
452 |
+
$this->update_last_send_time( time() );
|
453 |
+
|
454 |
+
$params = $this->get_tracking_data();
|
455 |
+
|
456 |
+
if ( ! empty( $extra_params ) ) {
|
457 |
+
$params = array_merge( $params, $extra_params );
|
458 |
+
}
|
459 |
+
|
460 |
+
if ( ! empty( $params ) && is_array( $params ) ) {
|
461 |
+
add_filter( 'https_ssl_verify', '__return_false' );
|
462 |
+
wp_remote_post(
|
463 |
+
$this->api_url,
|
464 |
+
array(
|
465 |
+
'timeout' => 25,
|
466 |
+
'blocking' => false,
|
467 |
+
'body' => array(
|
468 |
+
'data' => $params,
|
469 |
+
),
|
470 |
+
)
|
471 |
+
);
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Get last send time.
|
477 |
+
*
|
478 |
+
* Retrieve the last time tracking data was sent.
|
479 |
+
*
|
480 |
+
* @return int|false The last time tracking data was sent, or false if
|
481 |
+
* tracking data never sent.
|
482 |
+
*/
|
483 |
+
public function get_last_send_time() {
|
484 |
+
$last_send_time = get_option( $this->plugin_abbr . '_tracking_last_send', false );
|
485 |
+
|
486 |
+
return $last_send_time;
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Update last send time.
|
491 |
+
*
|
492 |
+
* @param int $send_time
|
493 |
+
*/
|
494 |
+
public function update_last_send_time( $send_time = 0 ) {
|
495 |
+
if ( empty( $send_time ) ) {
|
496 |
+
$send_time = time();
|
497 |
+
}
|
498 |
+
|
499 |
+
update_option( $this->plugin_abbr . '_tracking_last_send', $send_time );
|
500 |
+
}
|
501 |
+
|
502 |
+
/**
|
503 |
+
* Get tracker class name being used by the plugin
|
504 |
+
*
|
505 |
+
* @return string
|
506 |
+
*/
|
507 |
+
public function get_tracker_class() {
|
508 |
+
return $this->tracker_class;
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Get the tracking data
|
513 |
+
*
|
514 |
+
* Retrieve tracking data and apply filter
|
515 |
+
*
|
516 |
+
* @return array
|
517 |
+
*/
|
518 |
+
public function get_tracking_data() {
|
519 |
+
|
520 |
+
$tracker_class = $this->get_tracker_class();
|
521 |
+
|
522 |
+
$params = array(
|
523 |
+
'sdk_version' => $this->sdk_version,
|
524 |
+
'product_id' => $this->product_id,
|
525 |
+
'plan' => $this->plugin_plan,
|
526 |
+
'user_info' => $tracker_class::get_user_info(),
|
527 |
+
'plugins_info' => array(
|
528 |
+
'active_plugins' => $tracker_class::get_active_plugins( true ),
|
529 |
+
'inactive_plugins' => $tracker_class::get_inactive_plugins( true ),
|
530 |
+
),
|
531 |
+
'current_theme' => $tracker_class::get_current_theme_info(),
|
532 |
+
'wp_info' => $tracker_class::get_wp_info(),
|
533 |
+
'server_info' => $tracker_class::get_server_info(),
|
534 |
+
);
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Tracker send tracking data params.
|
538 |
+
*
|
539 |
+
* Filters the data parameters when sending tracking request.
|
540 |
+
*
|
541 |
+
* @param array $params Variable to encode as JSON.
|
542 |
+
*/
|
543 |
+
$params = apply_filters( $this->plugin_abbr . '_tracking_data_params', $params );
|
544 |
+
|
545 |
+
return $params;
|
546 |
+
}
|
547 |
+
}
|
548 |
+
}
|
lite/classes/feedback/class-ig-tracker.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
|
3 |
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
exit; // Exit if accessed directly.
|
@@ -22,6 +22,8 @@ if ( ! class_exists( 'IG_Tracker_V_1_2_2' ) ) {
|
|
22 |
*/
|
23 |
class IG_Tracker_V_1_2_2 {
|
24 |
|
|
|
|
|
25 |
/**
|
26 |
* Get Active, Inactive or all plugins info
|
27 |
*
|
@@ -250,10 +252,46 @@ if ( ! class_exists( 'IG_Tracker_V_1_2_2' ) ) {
|
|
250 |
'wp_db_charset_Collate' => $wpdb->get_charset_collate(),
|
251 |
'wp_memory_limit' => ( size_format( (int) WP_MEMORY_LIMIT * 1048576 ) ),
|
252 |
'wp_upload_size' => ( size_format( wp_max_upload_size() ) ),
|
253 |
-
'filesystem_method' => get_filesystem_method(),
|
254 |
);
|
255 |
|
256 |
return $wp_info;
|
257 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
259 |
}
|
1 |
+
<?php
|
2 |
|
3 |
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
exit; // Exit if accessed directly.
|
22 |
*/
|
23 |
class IG_Tracker_V_1_2_2 {
|
24 |
|
25 |
+
|
26 |
+
|
27 |
/**
|
28 |
* Get Active, Inactive or all plugins info
|
29 |
*
|
252 |
'wp_db_charset_Collate' => $wpdb->get_charset_collate(),
|
253 |
'wp_memory_limit' => ( size_format( (int) WP_MEMORY_LIMIT * 1048576 ) ),
|
254 |
'wp_upload_size' => ( size_format( wp_max_upload_size() ) ),
|
255 |
+
'filesystem_method' => function_exists('get_filesystem_method') ? get_filesystem_method() : '',
|
256 |
);
|
257 |
|
258 |
return $wp_info;
|
259 |
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Get User information
|
263 |
+
*
|
264 |
+
* @return array
|
265 |
+
*
|
266 |
+
*
|
267 |
+
*/
|
268 |
+
|
269 |
+
public static function get_user_info() {
|
270 |
+
|
271 |
+
$users = get_users( array(
|
272 |
+
'role' => 'administrator',
|
273 |
+
'orderby' => 'ID',
|
274 |
+
'order' => 'ASC',
|
275 |
+
'number' => 1,
|
276 |
+
'paged' => 1,
|
277 |
+
) );
|
278 |
+
|
279 |
+
$admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0]: false;
|
280 |
+
$first_name = '';
|
281 |
+
$last_name = '';
|
282 |
+
|
283 |
+
if ( $admin_user ) {
|
284 |
+
$first_name = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name;
|
285 |
+
$last_name = $admin_user->last_name;
|
286 |
+
}
|
287 |
+
|
288 |
+
$user_info = array(
|
289 |
+
'user_email' => get_option('admin_email'),
|
290 |
+
'first_name' => $first_name,
|
291 |
+
'last_name' => $last_name,
|
292 |
+
);
|
293 |
+
|
294 |
+
return $user_info;
|
295 |
+
}
|
296 |
}
|
297 |
}
|
lite/classes/ig-upsale-admin.php
CHANGED
@@ -9,7 +9,7 @@ if ( ! class_exists( 'Icegram_upsale' ) ) {
|
|
9 |
add_action( 'add_meta_boxes', array( &$this, 'add_campaigns_analytics_metaboxes' ), 0 );
|
10 |
|
11 |
// Add upsale metabox only if there isn't any other ongoing sale period.
|
12 |
-
if ( ! self::is_offer_period( '
|
13 |
add_action( 'add_meta_boxes', array( &$this, 'add_upsell_notice' ), 0 );
|
14 |
}
|
15 |
add_filter( 'icegram_campaign_tabs', array( &$this, 'add_upsale_tab' ), 10, 1 );
|
@@ -83,9 +83,9 @@ if ( ! class_exists( 'Icegram_upsale' ) ) {
|
|
83 |
$current_utc_time = time();
|
84 |
$current_ist_time = $current_utc_time + ( 5.5 * HOUR_IN_SECONDS ); // Add IST offset to get IST time
|
85 |
|
86 |
-
if ( '
|
87 |
-
$offer_start_time = strtotime( '2021-
|
88 |
-
$offer_end_time = strtotime( '2021-
|
89 |
}
|
90 |
|
91 |
$is_offer_period = $current_ist_time >= $offer_start_time && $current_ist_time <= $offer_end_time;
|
9 |
add_action( 'add_meta_boxes', array( &$this, 'add_campaigns_analytics_metaboxes' ), 0 );
|
10 |
|
11 |
// Add upsale metabox only if there isn't any other ongoing sale period.
|
12 |
+
if ( ! self::is_offer_period( 'bfcm' ) ) {
|
13 |
add_action( 'add_meta_boxes', array( &$this, 'add_upsell_notice' ), 0 );
|
14 |
}
|
15 |
add_filter( 'icegram_campaign_tabs', array( &$this, 'add_upsale_tab' ), 10, 1 );
|
83 |
$current_utc_time = time();
|
84 |
$current_ist_time = $current_utc_time + ( 5.5 * HOUR_IN_SECONDS ); // Add IST offset to get IST time
|
85 |
|
86 |
+
if ( 'bfcm' === $offer_name ) {
|
87 |
+
$offer_start_time = strtotime( '2021-11-15 12:00:00' ); // Offer start time in IST
|
88 |
+
$offer_end_time = strtotime( '2021-12-01 12:00:00' ); // Offer end time in IST
|
89 |
}
|
90 |
|
91 |
$is_offer_period = $current_ist_time >= $offer_start_time && $current_ist_time <= $offer_end_time;
|
lite/ig-offer.php
CHANGED
@@ -1,7 +1,15 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Halloween 2021 Campaign
|
4 |
-
if ( ( get_option( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
?>
|
6 |
<style type="text/css">
|
7 |
.ig_es_offer {
|
@@ -13,6 +21,6 @@ if ( ( get_option( 'ig_offer_halloween_2021_icegram' ) !== 'yes' ) && Icegram_up
|
|
13 |
|
14 |
</style>
|
15 |
<div class="ig_es_offer">
|
16 |
-
<a target="_blank" href="?ig_dismiss_admin_notice=1&ig_option_name=
|
17 |
</div>
|
18 |
<?php } ?>
|
1 |
<?php
|
2 |
|
3 |
// Halloween 2021 Campaign
|
4 |
+
if ( ( get_option( 'ig_offer_bfcm_2021_icegram' ) !== 'yes' ) && Icegram_upsale::is_offer_period( 'bfcm') ) {
|
5 |
+
$img_url = $this->plugin_url .'/assets/images/bfcm2021.png';
|
6 |
+
$ig_plan = get_option( 'ig_engage_plan', 'lite' );
|
7 |
+
if( 'lite' === $ig_plan ){
|
8 |
+
$img_url = $this->plugin_url .'/assets/images/bfcm2021_lite.png';
|
9 |
+
}elseif( 'plus' === $ig_plan || 'pro' === $ig_plan ){
|
10 |
+
$img_url = $this->plugin_url .'/assets/images/bfcm2021_pro.png';
|
11 |
+
}
|
12 |
+
|
13 |
?>
|
14 |
<style type="text/css">
|
15 |
.ig_es_offer {
|
21 |
|
22 |
</style>
|
23 |
<div class="ig_es_offer">
|
24 |
+
<a target="_blank" href="?ig_dismiss_admin_notice=1&ig_option_name=ig_offer_bfcm_2021"><img src="<?php echo $img_url; ?>"/></a>
|
25 |
</div>
|
26 |
<?php } ?>
|
lite/settings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
|
4 |
-
if( isset( $_POST['submit'] ) ) {
|
5 |
if( isset( $_POST['icegram_share_love'] ) ) {
|
6 |
update_option( 'icegram_share_love', sanitize_text_field($_POST['icegram_share_love']) );
|
7 |
} else {
|
@@ -12,6 +12,11 @@ if( isset( $_POST['submit'] ) ) {
|
|
12 |
} else {
|
13 |
update_option( 'icegram_cache_compatibility', 'no' );
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
|
17 |
?>
|
@@ -37,8 +42,29 @@ if( isset( $_POST['submit'] ) ) {
|
|
37 |
</label>
|
38 |
</td>
|
39 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</table>
|
41 |
-
<?php
|
|
|
|
|
|
|
|
|
42 |
</form>
|
43 |
</div>
|
44 |
-
<?php do_action( 'icegram_settings_after' );
|
|
1 |
<?php
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
|
4 |
+
if( isset( $_POST['submit'] ) && isset( $_POST['ig-settings-nonce'] ) && wp_verify_nonce( $_POST['ig-settings-nonce'], 'ig_settings' ) ) {
|
5 |
if( isset( $_POST['icegram_share_love'] ) ) {
|
6 |
update_option( 'icegram_share_love', sanitize_text_field($_POST['icegram_share_love']) );
|
7 |
} else {
|
12 |
} else {
|
13 |
update_option( 'icegram_cache_compatibility', 'no' );
|
14 |
}
|
15 |
+
if( isset( $_POST['icegram_track_usage_enable'] ) ) {
|
16 |
+
update_option( 'ig_allow_tracking', sanitize_text_field($_POST['icegram_track_usage_enable']) );
|
17 |
+
} else {
|
18 |
+
update_option( 'ig_allow_tracking', 'no' );
|
19 |
+
}
|
20 |
}
|
21 |
|
22 |
?>
|
42 |
</label>
|
43 |
</td>
|
44 |
</tr>
|
45 |
+
<?php
|
46 |
+
$product_plan = get_option( 'ig_engage_plan', 'lite' );
|
47 |
+
if( 'lite' === $product_plan ){
|
48 |
+
?>
|
49 |
+
<tr>
|
50 |
+
<th scope="row"><?php _e( 'Plugin Usage Tracking', 'icegram' ) ?></th>
|
51 |
+
<td>
|
52 |
+
<label for="icegram_track_usage_enable">
|
53 |
+
<input type="checkbox" name="icegram_track_usage_enable" id="icegram_track_usage_enable"/ value="yes" <?php checked('yes', get_option('ig_allow_tracking')); ?> />
|
54 |
+
<?php _e( 'Enable Tracking Usage - Help us to improve Email Subscribers by opting in to share non-sensitive plugin usage data.', 'icegram' ); ?>
|
55 |
+
</label>
|
56 |
+
</td>
|
57 |
+
</tr>
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
?>
|
61 |
</table>
|
62 |
+
<?php
|
63 |
+
wp_nonce_field( 'ig_settings', 'ig-settings-nonce' );
|
64 |
+
|
65 |
+
submit_button();
|
66 |
+
?>
|
67 |
</form>
|
68 |
</div>
|
69 |
+
<?php do_action( 'icegram_settings_after' );
|
70 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.icegram.com/
|
|
4 |
Tags: popup, optin, hellobar, lead capture, form, marketing, 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, promotion, popup message, leads, lists, builder, action bar, floating bar, footer bar, hellobar alternative, pop over, Popup plugin, aweber, campaign monitor, constant contact, email list, exit-intent, onclick popup, analytics, Hubspot, popup ads, pop-up, Mailing list pop-up, re-targeting, Animation, Popups with Animation, Responsive Popup, split testing, AB testing
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.8.1
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv3
|
9 |
|
10 |
The best WP popup plugin that lets you create a popup within seconds. Customize popup, target popups to show offers, email signups, social buttons, etc and instantly increase conversions on your website.
|
@@ -242,20 +242,28 @@ Contact Us, provide as much detail of the problem as you can. We will try to sol
|
|
242 |
|
243 |
== Upgrade Notice ==
|
244 |
|
245 |
-
= 2.0.
|
246 |
|
247 |
-
* Enhancement: Revised Gallery Templates for
|
|
|
|
|
248 |
|
249 |
== Changelog ==
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
**2.0.4 (21.10.2021)**
|
252 |
|
253 |
* Enhancement: Revised Gallery Templates for Halloween
|
254 |
|
255 |
**2.0.3 (17.08.2021)**
|
256 |
|
257 |
-
* Fix:
|
258 |
-
* Fix: Secured Icegram from Stored XSS vulnerability
|
259 |
|
260 |
**2.0.2 (27.07.2021)**
|
261 |
|
4 |
Tags: popup, optin, hellobar, lead capture, form, marketing, 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, promotion, popup message, leads, lists, builder, action bar, floating bar, footer bar, hellobar alternative, pop over, Popup plugin, aweber, campaign monitor, constant contact, email list, exit-intent, onclick popup, analytics, Hubspot, popup ads, pop-up, Mailing list pop-up, re-targeting, Animation, Popups with Animation, Responsive Popup, split testing, AB testing
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.8.1
|
7 |
+
Stable tag: 2.0.5
|
8 |
License: GPLv3
|
9 |
|
10 |
The best WP popup plugin that lets you create a popup within seconds. Customize popup, target popups to show offers, email signups, social buttons, etc and instantly increase conversions on your website.
|
242 |
|
243 |
== Upgrade Notice ==
|
244 |
|
245 |
+
= 2.0.5 =
|
246 |
|
247 |
+
* Enhancement: Revised Gallery Templates for BFCM
|
248 |
+
* Fix: Improved security related to XSS and nonce validations [Thanks to Patchstack team]
|
249 |
+
* Fix: Secured Icegram from reflected XSS vulnerability [Thanks to WPScan team]
|
250 |
|
251 |
== Changelog ==
|
252 |
|
253 |
+
**2.0.5 (18.11.2021)**
|
254 |
+
|
255 |
+
* Enhancement: Revised Gallery Templates for BFCM
|
256 |
+
* Fix: Improved security related to XSS and nonce validations [Thanks to Patchstack team]
|
257 |
+
* Fix: Secured Icegram from reflected XSS vulnerability [Thanks to WPScan team]
|
258 |
+
|
259 |
**2.0.4 (21.10.2021)**
|
260 |
|
261 |
* Enhancement: Revised Gallery Templates for Halloween
|
262 |
|
263 |
**2.0.3 (17.08.2021)**
|
264 |
|
265 |
+
* Fix: Improved security related to nonce in Settings and Subscription form
|
266 |
+
* Fix: Secured Icegram from Stored XSS vulnerability
|
267 |
|
268 |
**2.0.2 (27.07.2021)**
|
269 |
|