Version Description
Added Christmas Gallery Items
Download this release
Release Info
Developer | Icegram |
Plugin | Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram |
Version | 1.10.36 |
Comparing to | |
See all releases |
Code changes from version 1.10.35 to 1.10.36
- assets/images/icon-64.png +0 -0
- classes/class-icegram-message-admin.php +2 -2
- classes/feedback.php +61 -0
- classes/feedback/class-ig-feedback.php +258 -23
- classes/feedback/class-ig-tracker.php +4 -4
- icegram.php +1870 -1833
- readme.txt +11 -4
assets/images/icon-64.png
ADDED
Binary file
|
classes/class-icegram-message-admin.php
CHANGED
@@ -258,7 +258,7 @@ if ( !class_exists( 'Icegram_Message_Admin' ) ) {
|
|
258 |
<input type="text" class="message_field color-field" data-color-label="'.__( 'Background Color', 'icegram' ).'" name="message_data['.$message_id.'][form_bg_color]" id="message_form_bg_color" value="'. $form_bg_color .'" />
|
259 |
<input type="text" class="message_field color-field" data-color-label="'.__( 'Text Color', 'icegram' ).'" name="message_data['.$message_id.'][form_text_color]" id="message_form_text_color" value="'.$form_text_color.'" style="margin-left:5em !important" />
|
260 |
</p>';
|
261 |
-
echo
|
262 |
$active_plugins = get_option( 'active_plugins', array() );
|
263 |
if (is_multisite()) {
|
264 |
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
|
@@ -626,7 +626,7 @@ if ( !class_exists( 'Icegram_Message_Admin' ) ) {
|
|
626 |
|
627 |
case 'message_thumbnail':
|
628 |
// echo "<img src='$bg_img' style='max-width: 200px; max-height: 100px;'>";
|
629 |
-
echo "<img src='$bg_img' style='max-width: 100%; max-height: 100px;'>";
|
630 |
break;
|
631 |
|
632 |
default:
|
258 |
<input type="text" class="message_field color-field" data-color-label="'.__( 'Background Color', 'icegram' ).'" name="message_data['.$message_id.'][form_bg_color]" id="message_form_bg_color" value="'. $form_bg_color .'" />
|
259 |
<input type="text" class="message_field color-field" data-color-label="'.__( 'Text Color', 'icegram' ).'" name="message_data['.$message_id.'][form_text_color]" id="message_form_text_color" value="'.$form_text_color.'" style="margin-left:5em !important" />
|
260 |
</p>';
|
261 |
+
echo $color_field_html ;
|
262 |
$active_plugins = get_option( 'active_plugins', array() );
|
263 |
if (is_multisite()) {
|
264 |
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
|
626 |
|
627 |
case 'message_thumbnail':
|
628 |
// echo "<img src='$bg_img' style='max-width: 200px; max-height: 100px;'>";
|
629 |
+
echo "<img src='".esc_attr($bg_img)."' style='max-width: 100%; max-height: 100px;'>";
|
630 |
break;
|
631 |
|
632 |
default:
|
classes/feedback.php
CHANGED
@@ -30,6 +30,7 @@ if ( ! function_exists( 'ig_get_additional_info' ) ) {
|
|
30 |
// IG Specific information
|
31 |
$additional_info['plugin_meta_info'] = Icegram::get_ig_meta_info();
|
32 |
}
|
|
|
33 |
return $additional_info;
|
34 |
|
35 |
}
|
@@ -37,3 +38,63 @@ if ( ! function_exists( 'ig_get_additional_info' ) ) {
|
|
37 |
}
|
38 |
|
39 |
add_filter( 'ig_additional_feedback_meta_info', 'ig_get_additional_info', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
// IG Specific information
|
31 |
$additional_info['plugin_meta_info'] = Icegram::get_ig_meta_info();
|
32 |
}
|
33 |
+
|
34 |
return $additional_info;
|
35 |
|
36 |
}
|
38 |
}
|
39 |
|
40 |
add_filter( 'ig_additional_feedback_meta_info', 'ig_get_additional_info', 10, 2 );
|
41 |
+
|
42 |
+
if ( ! function_exists( 'ig_review_message_data' ) ) {
|
43 |
+
/**
|
44 |
+
* Filter 5 star review data
|
45 |
+
*
|
46 |
+
* @param $review_data
|
47 |
+
*
|
48 |
+
* @return mixed
|
49 |
+
*
|
50 |
+
* @since 1.10.36
|
51 |
+
*/
|
52 |
+
function ig_review_message_data( $review_data ) {
|
53 |
+
|
54 |
+
$review_url = 'https://wordpress.org/support/plugin/icegram/reviews/';
|
55 |
+
$icon_url = IG_PLUGIN_URL . 'assets/images/icon-64.png';
|
56 |
+
|
57 |
+
$review_data['review_url'] = $review_url;
|
58 |
+
$review_data['icon_url'] = $icon_url;
|
59 |
+
|
60 |
+
return $review_data;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
add_filter( 'ig_review_message_data', 'ig_review_message_data', 10 );
|
65 |
+
|
66 |
+
if ( ! function_exists( 'ig_can_ask_user_for_review' ) ) {
|
67 |
+
/**
|
68 |
+
* Can we ask user for 5 star review?
|
69 |
+
*
|
70 |
+
* @return bool
|
71 |
+
*
|
72 |
+
* @since 1.10.36
|
73 |
+
*/
|
74 |
+
function ig_can_ask_user_for_review( $enable, $review_data ) {
|
75 |
+
|
76 |
+
if ( $enable ) {
|
77 |
+
|
78 |
+
$screen = get_current_screen();
|
79 |
+
if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
$total_campaigns = wp_count_posts( 'ig_campaign' );
|
88 |
+
$total_campaigns_publish = $total_campaigns->publish;
|
89 |
+
$total_campaigns_draft = $total_campaigns->draft;
|
90 |
+
|
91 |
+
if ( $total_campaigns_draft == 0 && $total_campaigns_publish == 0 ) {
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return $enable;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
add_filter( 'ig_can_ask_user_for_review', 'ig_can_ask_user_for_review', 50, 2 );
|
classes/feedback/class-ig-feedback.php
CHANGED
@@ -4,22 +4,30 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
-
if ( ! class_exists( '
|
8 |
/**
|
9 |
* IG Feedback
|
10 |
*
|
11 |
* The IG Feedback class adds functionality to get quick interactive feedback from users.
|
12 |
* There are different types of feedabck widget like Stars, Emoji, Thubms Up/ Down, Number etc.
|
13 |
*
|
14 |
-
* @class
|
15 |
-
* @
|
16 |
* @copyright Copyright (c) 2019, Icegram
|
17 |
* @license https://opensource.org/licenses/gpl-license GNU Public License
|
18 |
* @author Icegram
|
19 |
-
* @
|
20 |
*/
|
21 |
-
class
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* The API URL where we will send feedback data.
|
25 |
*
|
@@ -104,8 +112,229 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
104 |
|
105 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
106 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
109 |
public function render_deactivate_feedback() {
|
110 |
add_action( 'admin_print_scripts', array( $this, 'js' ), 20 );
|
111 |
add_action( 'admin_print_scripts', array( $this, 'css' ) );
|
@@ -127,19 +356,19 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
127 |
* @since 1.0.1
|
128 |
*/
|
129 |
public function enqueue_styles() {
|
130 |
-
wp_register_style( 'sweetalert', plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css' );
|
131 |
wp_enqueue_style( 'sweetalert' );
|
132 |
|
133 |
-
wp_register_style( 'animate', plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css' );
|
134 |
wp_enqueue_style( 'animate' );
|
135 |
|
136 |
-
wp_register_style( 'ig-feedback-star-rating', plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css' );
|
137 |
wp_enqueue_style( 'ig-feedback-star-rating' );
|
138 |
|
139 |
-
wp_register_style( 'ig-feedback-emoji', plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css' );
|
140 |
wp_enqueue_style( 'ig-feedback-emoji' );
|
141 |
|
142 |
-
wp_register_style( 'ig-feedback', plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css' );
|
143 |
wp_enqueue_style( 'ig-feedback' );
|
144 |
}
|
145 |
|
@@ -152,7 +381,6 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
152 |
*
|
153 |
* @since 1.0.3
|
154 |
*/
|
155 |
-
|
156 |
public function prepare_widget_params( $params = array() ) {
|
157 |
|
158 |
$default_params = array(
|
@@ -176,6 +404,13 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
176 |
return $params;
|
177 |
}
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
public function render_widget( $params = array() ) {
|
180 |
|
181 |
$params = $this->prepare_widget_params( $params );
|
@@ -729,7 +964,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
729 |
event.preventDefault();
|
730 |
loader(true);
|
731 |
if (!$form.find('input[type=radio]:checked').val()) {
|
732 |
-
$form.find('.ig-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js( __( 'Please select an option',
|
733 |
return;
|
734 |
}
|
735 |
|
@@ -924,34 +1159,34 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
924 |
|
925 |
$options = array(
|
926 |
1 => array(
|
927 |
-
'title' => esc_html__( 'I no longer need the plugin',
|
928 |
'slug' => 'i-no-longer-need-the-plugin'
|
929 |
),
|
930 |
2 => array(
|
931 |
-
'title' => esc_html__( 'I\'m switching to a different plugin',
|
932 |
'slug' => 'i-am-switching-to-a-different-plugin',
|
933 |
-
'details' => esc_html__( 'Please share which plugin',
|
934 |
),
|
935 |
3 => array(
|
936 |
-
'title' => esc_html__( 'I couldn\'t get the plugin to work',
|
937 |
'slug' => 'i-could-not-get-the-plugin-to-work'
|
938 |
),
|
939 |
4 => array(
|
940 |
-
'title' => esc_html__( 'It\'s a temporary deactivation',
|
941 |
'slug' => 'it-is-a-temporary-deactivation'
|
942 |
),
|
943 |
5 => array(
|
944 |
-
'title' => esc_html__( 'Other',
|
945 |
'slug' => 'other',
|
946 |
-
'details' => esc_html__( 'Please share the reason',
|
947 |
),
|
948 |
);
|
949 |
?>
|
950 |
<div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo $this->plugin; ?>">
|
951 |
<div class="ig-deactivate-survey-wrap">
|
952 |
<form class="ig-deactivate-survey" method="post">
|
953 |
-
<span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback',
|
954 |
-
<span class="ig-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:',
|
955 |
<div class="ig-deactivate-survey-options">
|
956 |
<?php foreach ( $options as $id => $option ) : ?>
|
957 |
<div class="ig-deactivate-survey-option">
|
@@ -974,9 +1209,9 @@ if ( ! class_exists( 'IG_Feedback_V_1_0_11' ) ) {
|
|
974 |
<input type="text" class="ig-deactivate-survey-info-email-address" id="ig-deactivate-survey-info-email-address" name="ig-deactivate-survey-info-email-address" value="<?php echo $email; ?>"/>
|
975 |
</div>
|
976 |
<div class="ig-deactivate-survey-footer">
|
977 |
-
<button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate',
|
978 |
<img class="ig-deactivate-survey-loader" id="ig-deactivate-survey-loader" src="<?php echo plugin_dir_url( __FILE__ ); ?>/assets/images/loading.gif"/>
|
979 |
-
<a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate',
|
980 |
</div>
|
981 |
</form>
|
982 |
</div>
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
+
if ( ! class_exists( 'IG_Feedback_V_1_0_15' ) ) {
|
8 |
/**
|
9 |
* IG Feedback
|
10 |
*
|
11 |
* The IG Feedback class adds functionality to get quick interactive feedback from users.
|
12 |
* There are different types of feedabck widget like Stars, Emoji, Thubms Up/ Down, Number etc.
|
13 |
*
|
14 |
+
* @class IG_Feedback_V_1_0_15
|
15 |
+
* @since 1.0.0
|
16 |
* @copyright Copyright (c) 2019, Icegram
|
17 |
* @license https://opensource.org/licenses/gpl-license GNU Public License
|
18 |
* @author Icegram
|
19 |
+
* @package feedback
|
20 |
*/
|
21 |
+
class IG_Feedback_V_1_0_15 {
|
22 |
|
23 |
+
/**
|
24 |
+
* Version of Feedback Library
|
25 |
+
*
|
26 |
+
* @since 1.0.13
|
27 |
+
* @var string
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
public $version = '1.0.15';
|
31 |
/**
|
32 |
* The API URL where we will send feedback data.
|
33 |
*
|
112 |
|
113 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
114 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Show 5 star review notice to user
|
118 |
+
*
|
119 |
+
* @since 1.0.12
|
120 |
+
*/
|
121 |
+
add_action( 'admin_notices', array( &$this, 'show_review_notice' ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Ask for user review
|
126 |
+
*
|
127 |
+
* @since 1.0.12
|
128 |
+
*/
|
129 |
+
public function show_review_notice() {
|
130 |
+
|
131 |
+
if ( ! defined( 'DOING_AJAX' ) && is_admin() ) {
|
132 |
+
|
133 |
+
$enable_review_notice = apply_filters( $this->plugin_abbr . '_enable_review_notice', true );
|
134 |
+
|
135 |
+
$can_ask_user_for_review = true;
|
136 |
+
|
137 |
+
if ( $enable_review_notice ) {
|
138 |
+
|
139 |
+
$current_user_id = get_current_user_id();
|
140 |
+
|
141 |
+
$review_done_option = $this->plugin_abbr . '_feedback_review_done';
|
142 |
+
$no_bug_option = $this->plugin_abbr . '_feedback_do_not_ask_again';
|
143 |
+
$already_did_option = $this->plugin_abbr . '_feedback_already_did';
|
144 |
+
$maybe_later_option = $this->plugin_abbr . '_feedback_maybe_later';
|
145 |
+
$review_done_time_option = $review_done_option . '_time';
|
146 |
+
$no_bug_time_option = $no_bug_option . '_time';
|
147 |
+
$already_did_time_option = $already_did_option . '_time';
|
148 |
+
$maybe_later_time_option = $maybe_later_option . '_time';
|
149 |
+
|
150 |
+
$no_bug_days_before = 1;
|
151 |
+
$no_bug_value = get_user_meta( $current_user_id, $no_bug_option, true );
|
152 |
+
$no_bug_time_value = get_user_meta( $current_user_id, $no_bug_time_option, true );
|
153 |
+
|
154 |
+
$review_done_value = get_user_meta( $current_user_id, $review_done_option, true );
|
155 |
+
$review_done_time_value = get_user_meta( $current_user_id, $review_done_time_option, true );
|
156 |
+
|
157 |
+
if ( ! empty( $no_bug_time_value ) && 0 !== $no_bug_time_value ) {
|
158 |
+
$no_bug_time_diff = time() - $no_bug_time_value;
|
159 |
+
$no_bug_days_before = floor( $no_bug_time_diff / 86400 ); // 86400 seconds == 1 day
|
160 |
+
}
|
161 |
+
|
162 |
+
$already_did_value = get_user_meta( $current_user_id, $already_did_option, true );
|
163 |
+
$already_did_time_value = get_user_meta( $current_user_id, $already_did_time_option, true );
|
164 |
+
|
165 |
+
$maybe_later_days_before = 1;
|
166 |
+
$maybe_later_value = get_user_meta( $current_user_id, $maybe_later_option, true );
|
167 |
+
$maybe_later_time_value = get_user_meta( $current_user_id, $maybe_later_time_option, true );
|
168 |
+
|
169 |
+
if ( $maybe_later_value && ! empty( $maybe_later_time_value ) && 0 !== $maybe_later_time_value ) {
|
170 |
+
$maybe_later_time_diff = time() - $maybe_later_time_value;
|
171 |
+
$maybe_later_days_before = floor( $maybe_later_time_diff / 86400 ); // 86400 seconds == 1 day
|
172 |
+
}
|
173 |
+
|
174 |
+
// Is user fall in love with our plugin in 15 days after when they said may be later?
|
175 |
+
// But, make sure we are asking user only after 15 days.
|
176 |
+
// We are good people. Respect the user decision.
|
177 |
+
if ( $review_done_value || $no_bug_value || $already_did_value || ( $maybe_later_value && $maybe_later_days_before < 15 ) || $already_did_value ) {
|
178 |
+
$can_ask_user_for_review = false;
|
179 |
+
}
|
180 |
+
|
181 |
+
$review_data = array(
|
182 |
+
'review_done_value' => $review_done_value,
|
183 |
+
'review_done_time_value' => $review_done_time_value,
|
184 |
+
'no_bug_value' => $no_bug_value,
|
185 |
+
'no_bug_time_value' => $no_bug_time_value,
|
186 |
+
'maybe_later_value' => $maybe_later_value,
|
187 |
+
'maybe_later_time_value' => $maybe_later_time_value,
|
188 |
+
'already_did_value' => $already_did_value,
|
189 |
+
'already_did_time_value' => $already_did_time_value,
|
190 |
+
);
|
191 |
+
|
192 |
+
$can_ask_user_for_review = apply_filters( $this->plugin_abbr . '_can_ask_user_for_review', $can_ask_user_for_review, $review_data );
|
193 |
+
|
194 |
+
if ( $can_ask_user_for_review ) {
|
195 |
+
|
196 |
+
$current_page_url = "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
197 |
+
|
198 |
+
$got_feedback = false;
|
199 |
+
/************** Update Review Status ********************/
|
200 |
+
$nonce = ! empty( $_GET['ig_feedback_nonce'] ) ? esc_attr( wp_unslash( $_GET['ig_feedback_nonce'] ) ) : '';
|
201 |
+
$nonce_verified = wp_verify_nonce( $nonce, 'review' );
|
202 |
+
|
203 |
+
$action = '';
|
204 |
+
if ( $nonce_verified ) {
|
205 |
+
$action = ! empty( $_GET['ig_feedback_action'] ) ? esc_attr( wp_unslash( $_GET['ig_feedback_action'] ) ) : '';
|
206 |
+
|
207 |
+
if ( ! empty( $action ) && $this->is_valid_action( $action ) ) {
|
208 |
+
update_user_meta( $current_user_id, $action, 1 );
|
209 |
+
update_user_meta( $current_user_id, $action . "_time", time() );
|
210 |
+
|
211 |
+
// Got the review request?
|
212 |
+
// Redirect them to review page
|
213 |
+
if ( $action === $review_done_option ) {
|
214 |
+
|
215 |
+
$url = ! empty( $_GET['review_url'] ) ? $_GET['review_url'] : '';
|
216 |
+
|
217 |
+
if ( ! empty( $url ) ) {
|
218 |
+
?>
|
219 |
+
|
220 |
+
<meta http-equiv="refresh" content="0; url=<?php echo $url; ?>"/>
|
221 |
+
|
222 |
+
<?php
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
$got_feedback = true;
|
228 |
+
}
|
229 |
+
/************** Update Review Status (End) ********************/
|
230 |
+
|
231 |
+
if ( ! $got_feedback ) {
|
232 |
+
|
233 |
+
$review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
|
234 |
+
$icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
|
235 |
+
$message = __( sprintf( "<span><p>We hope you're enjoying <b>%s</b> plugin! Could you please do us a BIG favor and give us a 5-star rating on WordPress to help us spread the word and boost our motivation?</p>", $this->name ), $this->plugin );
|
236 |
+
|
237 |
+
$message_data = array(
|
238 |
+
'review_url' => $review_url,
|
239 |
+
'icon_url' => $icon_url,
|
240 |
+
'message' => $message
|
241 |
+
);
|
242 |
+
|
243 |
+
$message_data = apply_filters( $this->plugin_abbr . '_review_message_data', $message_data );
|
244 |
+
|
245 |
+
$message = ! empty( $message_data['message'] ) ? $message_data['message'] : '';
|
246 |
+
$review_url = ! empty( $message_data['review_url'] ) ? $message_data['review_url'] : '';
|
247 |
+
$icon_url = ! empty( $message_data['icon_url'] ) ? $message_data['icon_url'] : '';
|
248 |
+
|
249 |
+
$nonce = wp_create_nonce( 'review' );
|
250 |
+
|
251 |
+
$review_url = add_query_arg( 'review_url', $review_url, add_query_arg( 'ig_feedback_nonce', $nonce, add_query_arg( 'ig_feedback_action', $review_done_option, $current_page_url ) ) );
|
252 |
+
$maybe_later_url = add_query_arg( 'ig_feedback_nonce', $nonce, add_query_arg( 'ig_feedback_action', $maybe_later_option, $current_page_url ) );
|
253 |
+
$already_did_url = add_query_arg( 'ig_feedback_nonce', $nonce, add_query_arg( 'ig_feedback_action', $already_did_option, $current_page_url ) );
|
254 |
+
$no_bug_url = add_query_arg( 'ig_feedback_nonce', $nonce, add_query_arg( 'ig_feedback_action', $no_bug_option, $current_page_url ) );
|
255 |
+
|
256 |
+
?>
|
257 |
+
|
258 |
+
<style type="text/css">
|
259 |
+
|
260 |
+
.ig-feedback-notice-links li {
|
261 |
+
display: inline-block;
|
262 |
+
margin-right: 15px;
|
263 |
+
}
|
264 |
+
|
265 |
+
.ig-feedback-notice-links li a {
|
266 |
+
display: inline-block;
|
267 |
+
color: #10738b;
|
268 |
+
text-decoration: none;
|
269 |
+
padding-left: 26px;
|
270 |
+
position: relative;
|
271 |
+
}
|
272 |
+
|
273 |
+
.ig-feedback-notice {
|
274 |
+
display: flex;
|
275 |
+
align-items: center;
|
276 |
+
}
|
277 |
+
|
278 |
+
.ig-feedback-plugin-icon {
|
279 |
+
style =
|
280 |
+
float: left;
|
281 |
+
margin-right: 0.5em;
|
282 |
+
}
|
283 |
+
|
284 |
+
</style>
|
285 |
+
|
286 |
+
<?php
|
287 |
+
|
288 |
+
echo '<div class="notice notice-success ig-feedback-notice">';
|
289 |
+
echo '<span class="ig-feedback-plugin-icon"> <img src="' . $icon_url . '" alt="Logo"/></span>';
|
290 |
+
echo $message;
|
291 |
+
echo "<ul class='ig-feedback-notice-links'>";
|
292 |
+
echo sprintf( '<li><a href="%s" class="button-primary" target="_blank" data-rated="' . esc_attr__( "Thank You :) ",
|
293 |
+
$this->plugin ) . '"><span class="dashicons dashicons-external"></span> Ok, you deserve it</a></li> <li><a href="%s"><span class="dashicons dashicons-calendar-alt"></span> Maybe later</a></li><li><a href="%s"><span class="dashicons dashicons-smiley"></span> I already did!</a></li><li><a href="%s"><span class="dashicons dashicons-no"></span> Don\'t ask me again</a></li>',
|
294 |
+
esc_url( $review_url ), esc_url( $maybe_later_url ), esc_url( $already_did_url ), esc_url( $no_bug_url ) );
|
295 |
+
echo "</ul></span>";
|
296 |
+
echo '</div>';
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Is valid action?
|
305 |
+
*
|
306 |
+
* @param string $action
|
307 |
+
*
|
308 |
+
* @return bool
|
309 |
+
*
|
310 |
+
* @since 1.0.14
|
311 |
+
*/
|
312 |
+
public function is_valid_action( $action = '' ) {
|
313 |
+
if ( empty( $action ) ) {
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
|
317 |
+
$available_actions = array(
|
318 |
+
'_feedback_review_done',
|
319 |
+
'_feedback_already_did',
|
320 |
+
'_feedback_maybe_later',
|
321 |
+
'_feedback_do_not_ask_again',
|
322 |
+
);
|
323 |
+
|
324 |
+
foreach ( $available_actions as $available_action ) {
|
325 |
+
if ( strpos( $action, $available_action ) !== false ) {
|
326 |
+
return true;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
return false;
|
331 |
}
|
332 |
|
333 |
+
/**
|
334 |
+
* Render Deactivation Feedback
|
335 |
+
*
|
336 |
+
* @since 1.0.0
|
337 |
+
*/
|
338 |
public function render_deactivate_feedback() {
|
339 |
add_action( 'admin_print_scripts', array( $this, 'js' ), 20 );
|
340 |
add_action( 'admin_print_scripts', array( $this, 'css' ) );
|
356 |
* @since 1.0.1
|
357 |
*/
|
358 |
public function enqueue_styles() {
|
359 |
+
wp_register_style( 'sweetalert', plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
|
360 |
wp_enqueue_style( 'sweetalert' );
|
361 |
|
362 |
+
wp_register_style( 'animate', plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css', array(), $this->version );
|
363 |
wp_enqueue_style( 'animate' );
|
364 |
|
365 |
+
wp_register_style( 'ig-feedback-star-rating', plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css', array(), $this->version );
|
366 |
wp_enqueue_style( 'ig-feedback-star-rating' );
|
367 |
|
368 |
+
wp_register_style( 'ig-feedback-emoji', plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css', array(), $this->version );
|
369 |
wp_enqueue_style( 'ig-feedback-emoji' );
|
370 |
|
371 |
+
wp_register_style( 'ig-feedback', plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
|
372 |
wp_enqueue_style( 'ig-feedback' );
|
373 |
}
|
374 |
|
381 |
*
|
382 |
* @since 1.0.3
|
383 |
*/
|
|
|
384 |
public function prepare_widget_params( $params = array() ) {
|
385 |
|
386 |
$default_params = array(
|
404 |
return $params;
|
405 |
}
|
406 |
|
407 |
+
/**
|
408 |
+
* Render Widget
|
409 |
+
*
|
410 |
+
* @param array $params
|
411 |
+
*
|
412 |
+
* @since 1.0.0
|
413 |
+
*/
|
414 |
public function render_widget( $params = array() ) {
|
415 |
|
416 |
$params = $this->prepare_widget_params( $params );
|
964 |
event.preventDefault();
|
965 |
loader(true);
|
966 |
if (!$form.find('input[type=radio]:checked').val()) {
|
967 |
+
$form.find('.ig-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js( __( 'Please select an option', $this->plugin ) ); ?></span>');
|
968 |
return;
|
969 |
}
|
970 |
|
1159 |
|
1160 |
$options = array(
|
1161 |
1 => array(
|
1162 |
+
'title' => esc_html__( 'I no longer need the plugin', $this->plugin ),
|
1163 |
'slug' => 'i-no-longer-need-the-plugin'
|
1164 |
),
|
1165 |
2 => array(
|
1166 |
+
'title' => esc_html__( 'I\'m switching to a different plugin', $this->plugin ),
|
1167 |
'slug' => 'i-am-switching-to-a-different-plugin',
|
1168 |
+
'details' => esc_html__( 'Please share which plugin', $this->plugin ),
|
1169 |
),
|
1170 |
3 => array(
|
1171 |
+
'title' => esc_html__( 'I couldn\'t get the plugin to work', $this->plugin ),
|
1172 |
'slug' => 'i-could-not-get-the-plugin-to-work'
|
1173 |
),
|
1174 |
4 => array(
|
1175 |
+
'title' => esc_html__( 'It\'s a temporary deactivation', $this->plugin ),
|
1176 |
'slug' => 'it-is-a-temporary-deactivation'
|
1177 |
),
|
1178 |
5 => array(
|
1179 |
+
'title' => esc_html__( 'Other', $this->plugin ),
|
1180 |
'slug' => 'other',
|
1181 |
+
'details' => esc_html__( 'Please share the reason', $this->plugin ),
|
1182 |
),
|
1183 |
);
|
1184 |
?>
|
1185 |
<div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo $this->plugin; ?>">
|
1186 |
<div class="ig-deactivate-survey-wrap">
|
1187 |
<form class="ig-deactivate-survey" method="post">
|
1188 |
+
<span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', $this->plugin ); ?></span>
|
1189 |
+
<span class="ig-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', $this->plugin ), $this->name ); ?></span>
|
1190 |
<div class="ig-deactivate-survey-options">
|
1191 |
<?php foreach ( $options as $id => $option ) : ?>
|
1192 |
<div class="ig-deactivate-survey-option">
|
1209 |
<input type="text" class="ig-deactivate-survey-info-email-address" id="ig-deactivate-survey-info-email-address" name="ig-deactivate-survey-info-email-address" value="<?php echo $email; ?>"/>
|
1210 |
</div>
|
1211 |
<div class="ig-deactivate-survey-footer">
|
1212 |
+
<button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', $this->plugin ), '&' ); ?></button>
|
1213 |
<img class="ig-deactivate-survey-loader" id="ig-deactivate-survey-loader" src="<?php echo plugin_dir_url( __FILE__ ); ?>/assets/images/loading.gif"/>
|
1214 |
+
<a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', $this->plugin ), '&' ); ?></a>
|
1215 |
</div>
|
1216 |
</form>
|
1217 |
</div>
|
classes/feedback/class-ig-tracker.php
CHANGED
@@ -4,15 +4,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
-
if ( ! class_exists( '
|
8 |
|
9 |
/**
|
10 |
-
* Class
|
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
|
16 |
* @since 1.0.0
|
17 |
*
|
18 |
* @copyright Copyright (c) 2019, Icegram
|
@@ -20,7 +20,7 @@ if ( ! class_exists( 'IG_Tracker_V_1_0_11' ) ) {
|
|
20 |
* @author Icegram
|
21 |
* @package feedback
|
22 |
*/
|
23 |
-
class
|
24 |
|
25 |
/**
|
26 |
* Get Active, Inactive or all plugins info
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
+
if ( ! class_exists( 'IG_Tracker_V_1_0_15' ) ) {
|
8 |
|
9 |
/**
|
10 |
+
* Class IG_Tracker_V_1_0_15
|
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 IG_Tracker_V_1_0_15
|
16 |
* @since 1.0.0
|
17 |
*
|
18 |
* @copyright Copyright (c) 2019, Icegram
|
20 |
* @author Icegram
|
21 |
* @package feedback
|
22 |
*/
|
23 |
+
class IG_Tracker_V_1_0_15 {
|
24 |
|
25 |
/**
|
26 |
* Get Active, Inactive or all plugins info
|
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: 1.10.
|
7 |
* Author: icegram
|
8 |
* Author URI: https://www.icegram.com/
|
9 |
* Copyright (c) 2014-19 Icegram
|
@@ -15,215 +15,215 @@
|
|
15 |
*/
|
16 |
|
17 |
/**
|
18 |
-
* Main class Icegram
|
19 |
-
*/
|
20 |
class Icegram {
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
<div class="wrap">
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
<table class="form-table">
|
216 |
-
|
217 |
<th scope="row"><?php _e( 'Get add-ons and tips...', 'icegram' ) ?></th>
|
218 |
<td>
|
219 |
<form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8">
|
220 |
-
<input class="ltr" type="text" name="name" id="name" placeholder="Name"
|
221 |
-
<input class="regular-text ltr" type="text" name="email" id="email" placeholder="Email" value="<?php echo $customer_email?>"
|
222 |
<input type="hidden" name="list" value="7I763v6Ldrs3YhJeee5EOgFA"/>
|
223 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="Subscribe">
|
224 |
<br><br>
|
225 |
-
<input type="checkbox" name="es-gdpr-agree" id
|
226 |
-
<label for="es-gdpr-agree"><?php echo sprintf(__( 'I have read and agreed to our %s.', 'icegram' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'icegram' ) . '</a>' ); ?></label>
|
227 |
<br>
|
228 |
</form>
|
229 |
<div id="klawoo_response"></div>
|
@@ -232,1365 +232,1384 @@ class Icegram {
|
|
232 |
</table>
|
233 |
</div>
|
234 |
<script type="text/javascript">
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
</script>
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
<div class="wrap">
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
</div>
|
330 |
<script type="text/javascript">
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
</script>
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
|
|
|
|
|
|
538 |
<script type="text/javascript">
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
</script>
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
</script>
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1202 |
FROM {$wpdb->prefix}posts AS p
|
1203 |
LEFT JOIN {$wpdb->prefix}postmeta AS pm ON ( pm.post_id = p.ID )
|
1204 |
WHERE p.post_status = 'publish' ";
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
|
|
1230 |
pm.meta_key = 'icegram_campaign_target_rules' AND (
|
1231 |
( pm.meta_value LIKE '%%%s%%' )
|
1232 |
OR ( pm.meta_value LIKE '%%%s%%' AND pm.meta_value LIKE '%%%s%%' AND pm.meta_value LIKE '%%%s%%' )
|
1233 |
";
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
|
|
|
|
|
|
1577 |
|
1578 |
Use coupon <code>LOYALTY20</code> during checkout.",
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
|
1595 |
<strong>Download my free kit to learn how I do this.</strong>
|
1596 |
|
@@ -1601,306 +1620,324 @@ class Icegram {
|
|
1601 |
<li>Resources and tips to get started quickly</li>
|
1602 |
<li>Private members club to connect with fellow owners</li>
|
1603 |
</ul>",
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
/*Remove add new campaign and message*/
|
1639 |
-
.page-title-action{
|
1640 |
-
display:none;
|
1641 |
-
}
|
1642 |
-
</style>
|
1643 |
-
<?php
|
1644 |
-
}
|
1645 |
-
}
|
1646 |
-
|
1647 |
-
|
1648 |
-
function remove_row_actions( $actions, $post ) {
|
1649 |
-
|
1650 |
-
if ( empty( $post->post_type ) || ( $post->post_type != 'ig_campaign' && $post->post_type != 'ig_message' ) ) return $actions;
|
1651 |
-
|
1652 |
-
unset( $actions['inline hide-if-no-js'] );
|
1653 |
-
unset( $actions['view'] );
|
1654 |
-
|
1655 |
-
return $actions;
|
1656 |
-
|
1657 |
-
}
|
1658 |
-
|
1659 |
-
function identify_current_page() {
|
1660 |
-
global $post, $wpdb;
|
1661 |
-
|
1662 |
-
$obj = get_queried_object();
|
1663 |
-
$id = 0;
|
1664 |
-
if( !empty( $obj->has_archive ) ) {
|
1665 |
-
$sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s ", array( $obj->has_archive, 'page') );
|
1666 |
-
$id = $wpdb->get_var( $sql );
|
1667 |
-
} elseif( is_object( $post ) && isset( $post->ID ) ) {
|
1668 |
-
$id = $post->ID;
|
1669 |
-
}
|
1670 |
-
$id = apply_filters('icegram_identify_current_page', $id );
|
1671 |
-
self::$current_page_id = $id;
|
1672 |
-
}
|
1673 |
-
|
1674 |
-
static function get_current_page_id() {
|
1675 |
-
global $post;
|
1676 |
-
if (!empty($_REQUEST['page_id']) && is_numeric($_REQUEST['page_id'])) {
|
1677 |
-
$post = get_post($_REQUEST['page_id']);
|
1678 |
-
setup_postdata( $post );
|
1679 |
-
// WPML check
|
1680 |
-
$id = apply_filters('icegram_identify_current_page', $post->ID );
|
1681 |
-
self::$current_page_id = $id;
|
1682 |
-
}
|
1683 |
-
return self::$current_page_id;
|
1684 |
-
}
|
1685 |
-
|
1686 |
-
static function get_current_page_url() {
|
1687 |
-
if(!empty($_REQUEST['cache_compatibility']) && $_REQUEST['cache_compatibility'] == 'yes'){
|
1688 |
-
$pageURL = (!empty($_REQUEST['referral_url'])) ? $_REQUEST['referral_url'] : '';
|
1689 |
-
}else{
|
1690 |
-
$pageURL = 'http';
|
1691 |
-
if( isset($_SERVER["HTTPS"]) ) {
|
1692 |
-
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
|
1693 |
-
}
|
1694 |
-
$pageURL .= "://";
|
1695 |
-
if ($_SERVER["SERVER_PORT"] != "80") {
|
1696 |
-
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
1697 |
-
} else {
|
1698 |
-
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
1699 |
-
}
|
1700 |
-
}
|
1701 |
-
return $pageURL;
|
1702 |
-
}
|
1703 |
-
|
1704 |
-
function wpml_get_parent_id( $id ) {
|
1705 |
-
global $post;
|
1706 |
-
if (function_exists('icl_object_id') && function_exists('icl_get_default_language') ) {
|
1707 |
-
$id = icl_object_id($id, $post->post_type, true, icl_get_default_language() );
|
1708 |
-
}
|
1709 |
-
return $id;
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
|
1713 |
-
/**
|
1714 |
-
* Our implementation of wpautop to preserve script and style tags
|
1715 |
-
*/
|
1716 |
-
function before_wpautop($pee) {
|
1717 |
-
if ( trim($pee) === '' ) {
|
1718 |
-
$this->_wpautop_tags = array();
|
1719 |
-
return '';
|
1720 |
-
}
|
1721 |
-
|
1722 |
-
$tags = array();
|
1723 |
-
// Pull out tags and add placeholders
|
1724 |
-
list( $pee, $tags['pre'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'pre' );
|
1725 |
-
list( $pee, $tags['script'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'script' );
|
1726 |
-
list( $pee, $tags['style'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'style' );
|
1727 |
-
$this->_wpautop_tags = $tags;
|
1728 |
-
|
1729 |
-
if( !empty( $pre_tags ) )
|
1730 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $pre_tags );
|
1731 |
-
if( !empty( $script_tags ) )
|
1732 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $script_tags );
|
1733 |
-
if( !empty( $style_tags ) )
|
1734 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $style_tags );
|
1735 |
-
|
1736 |
-
return $pee;
|
1737 |
-
}
|
1738 |
-
|
1739 |
-
function after_wpautop($pee) {
|
1740 |
-
if ( trim($pee) === '' || empty($this->_wpautop_tags) )
|
1741 |
-
return '';
|
1742 |
-
|
1743 |
-
// Replace placeholders with original content
|
1744 |
-
if (!empty($this->_wpautop_tags['pre'])) {
|
1745 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['pre'] );
|
1746 |
-
}
|
1747 |
-
if (!empty($this->_wpautop_tags['script'])) {
|
1748 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['script'] );
|
1749 |
-
}
|
1750 |
-
if (!empty($this->_wpautop_tags['style'])) {
|
1751 |
-
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['style'] );
|
1752 |
-
}
|
1753 |
-
|
1754 |
-
$this->_wpautop_tags = array();
|
1755 |
-
|
1756 |
-
return $pee;
|
1757 |
-
}
|
1758 |
-
|
1759 |
-
function _wpautop_add_tag_placeholders( $pee, $tag ) {
|
1760 |
-
$tags = array();
|
1761 |
-
|
1762 |
-
if ( false !== strpos( $pee, "<{$tag}" ) ) {
|
1763 |
-
$pee_parts = explode( "</{$tag}>", $pee );
|
1764 |
-
$last_pee = array_pop( $pee_parts );
|
1765 |
-
$pee = '';
|
1766 |
-
$i = 0;
|
1767 |
-
|
1768 |
-
foreach ( $pee_parts as $pee_part ) {
|
1769 |
-
$start = strpos( $pee_part, "<{$tag}" );
|
1770 |
-
|
1771 |
-
// Malformed html?
|
1772 |
-
if ( false === $start ) {
|
1773 |
-
$pee .= $pee_part;
|
1774 |
-
continue;
|
1775 |
-
}
|
1776 |
-
|
1777 |
-
$name = "<{$tag} wp-{$tag}-tag-$i></{$tag}>";
|
1778 |
-
$tags[ $name ] = substr( $pee_part, $start ) . "</{$tag}>";
|
1779 |
-
|
1780 |
-
$pee .= substr( $pee_part, 0, $start ) . $name;
|
1781 |
-
$i++;
|
1782 |
-
}
|
1783 |
-
|
1784 |
-
$pee .= $last_pee;
|
1785 |
-
}
|
1786 |
-
|
1787 |
-
return array( $pee, $tags );
|
1788 |
-
}
|
1789 |
-
|
1790 |
-
function _wpautop_replace_tag_placeholders( $pee, $tags ) {
|
1791 |
-
if ( ! empty( $tags ) ) {
|
1792 |
-
$pee = str_replace( array_keys( $tags ), array_values( $tags ), $pee );
|
1793 |
-
}
|
1794 |
-
|
1795 |
-
return $pee;
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
static function duplicate_in_db( $original_id){
|
1799 |
-
// Get access to the database
|
1800 |
-
global $wpdb;
|
1801 |
-
// Get the post as an array
|
1802 |
-
$duplicate = get_post( $original_id, 'ARRAY_A' );
|
1803 |
-
// Modify some of the elements
|
1804 |
-
$duplicate['post_title'] = $duplicate['post_title'].' '.__('Copy', 'icegram');
|
1805 |
-
$duplicate['post_status'] = 'draft';
|
1806 |
-
// Set the post date
|
1807 |
-
$timestamp = current_time('timestamp', 0);
|
1808 |
-
|
1809 |
-
$duplicate['post_date'] = date('Y-m-d H:i:s', $timestamp);
|
1810 |
-
|
1811 |
-
// Remove some of the keys
|
1812 |
-
unset( $duplicate['ID'] );
|
1813 |
-
unset( $duplicate['guid'] );
|
1814 |
-
unset( $duplicate['comment_count'] );
|
1815 |
-
|
1816 |
-
// Insert the post into the database
|
1817 |
-
$duplicate_id = wp_insert_post( $duplicate );
|
1818 |
-
|
1819 |
-
// Duplicate all taxonomies/terms
|
1820 |
-
$taxonomies = get_object_taxonomies( $duplicate['post_type'] );
|
1821 |
-
|
1822 |
-
foreach( $taxonomies as $taxonomy ) {
|
1823 |
-
$terms = wp_get_post_terms( $original_id, $taxonomy, array('fields' => 'names') );
|
1824 |
-
wp_set_object_terms( $duplicate_id, $terms, $taxonomy );
|
1825 |
-
}
|
1826 |
-
|
1827 |
-
// Duplicate all custom fields
|
1828 |
-
$custom_fields = get_post_custom( $original_id );
|
1829 |
-
foreach ( $custom_fields as $key => $value ) {
|
1830 |
-
if($key === 'messages'){
|
1831 |
-
$messages = unserialize($value[0]);
|
1832 |
-
foreach ($messages as &$message) {
|
1833 |
-
$clone_msg_id = Icegram::duplicate_in_db($message['id']);
|
1834 |
-
$message['id'] = $clone_msg_id;
|
1835 |
}
|
1836 |
-
$value[0] = serialize($messages);
|
1837 |
-
}
|
1838 |
-
add_post_meta( $duplicate_id, $key, maybe_unserialize($value[0]) );
|
1839 |
-
}
|
1840 |
-
return $duplicate_id;
|
1841 |
-
}
|
1842 |
-
|
1843 |
-
static function duplicate( $original_id){
|
1844 |
-
$duplicate_id = Icegram::duplicate_in_db($original_id);
|
1845 |
-
$location = admin_url( 'post.php?post='.$duplicate_id.'&action=edit');
|
1846 |
-
header('Location:'.$location);
|
1847 |
-
exit;
|
1848 |
-
}
|
1849 |
-
|
1850 |
-
public static function form_submission_validate_request($request_data){
|
1851 |
-
if(!empty($request_data)){
|
1852 |
-
// Check for Remote Rainmaker form submission request
|
1853 |
-
$request_data['ig_is_remote'] = false;
|
1854 |
-
$request_data['is_remote'] = false;
|
1855 |
-
if(!empty($request_data['ig_mode']) && $request_data['ig_mode'] === 'remote'){
|
1856 |
-
$ig_remote_url = $request_data['ig_remote_url'];
|
1857 |
-
if(!empty($request_data['ig_campaign_id'])){
|
1858 |
-
$rules = get_post_meta( $request_data['ig_campaign_id'], 'icegram_campaign_target_rules', true );
|
1859 |
-
if( !empty($rules['remote_urls']) && is_array($rules['remote_urls']) ){
|
1860 |
-
foreach ($rules['remote_urls'] as $remote_url_pattern) {
|
1861 |
-
$valid = Icegram_Campaign::is_valid_url($remote_url_pattern , $ig_remote_url);
|
1862 |
-
if( $valid ){
|
1863 |
-
$request_data['ig_is_remote'] = true;
|
1864 |
-
$request_data['is_remote'] = true;
|
1865 |
-
break;
|
1866 |
-
}
|
1867 |
-
}
|
1868 |
-
//TODO :: discard the the remote request and data
|
1869 |
-
// if($request_data['ig_is_remote'] == false){
|
1870 |
-
// return array();
|
1871 |
-
// }
|
1872 |
-
}
|
1873 |
|
|
|
|
|
1874 |
}
|
1875 |
-
}
|
1876 |
-
}
|
1877 |
-
return $request_data;
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
public static function get_ig_meta_info(){
|
1881 |
-
$total_campaigns = wp_count_posts('ig_campaign');
|
1882 |
-
$total_campaigns_publish = $total_campaigns->publish;
|
1883 |
-
$total_campaigns_draft = $total_campaigns->draft;
|
1884 |
-
|
1885 |
-
$meta_info = array(
|
1886 |
-
'total_campaigns_publish' => $total_campaigns_publish,
|
1887 |
-
'total_campaigns_draft' => $total_campaigns_draft,
|
1888 |
-
);
|
1889 |
-
|
1890 |
-
return $meta_info;
|
1891 |
-
}
|
1892 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1893 |
}
|
1894 |
|
1895 |
-
|
1896 |
function initialize_icegram() {
|
1897 |
-
|
|
|
|
|
1898 |
|
1899 |
-
|
1900 |
-
load_plugin_textdomain( 'icegram', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
|
1901 |
|
1902 |
-
|
1903 |
-
do_action('icegram_loaded');
|
1904 |
}
|
1905 |
|
1906 |
add_action( 'plugins_loaded', 'initialize_icegram' );
|
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: 1.10.36
|
7 |
* Author: icegram
|
8 |
* Author URI: https://www.icegram.com/
|
9 |
* Copyright (c) 2014-19 Icegram
|
15 |
*/
|
16 |
|
17 |
/**
|
18 |
+
* Main class Icegram
|
19 |
+
*/
|
20 |
class Icegram {
|
21 |
|
22 |
+
var $plugin_url;
|
23 |
+
var $plugin_path;
|
24 |
+
var $version;
|
25 |
+
var $_wpautop_tags;
|
26 |
+
var $message_types;
|
27 |
+
var $message_type_objs;
|
28 |
+
var $shortcode_instances;
|
29 |
+
var $available_headlines;
|
30 |
+
var $mode;
|
31 |
+
var $cache_compatibility;
|
32 |
+
|
33 |
+
public static $current_page_id;
|
34 |
+
|
35 |
+
function __construct() {
|
36 |
+
global $ig_feedback, $ig_tracker;
|
37 |
+
|
38 |
+
$feedback_version = '1.0.15';
|
39 |
+
$ig_tracker = 'IG_Tracker_V_' . str_replace( '.', '_', $feedback_version );
|
40 |
+
|
41 |
+
$this->version = "1.10.36";
|
42 |
+
$this->shortcode_instances = array();
|
43 |
+
$this->mode = 'local';
|
44 |
+
$this->plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
|
45 |
+
$this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
|
46 |
+
$this->define_constants();
|
47 |
+
$this->include_classes( $feedback_version );
|
48 |
+
$this->cache_compatibility = get_option( 'icegram_cache_compatibility', 'no' );
|
49 |
+
|
50 |
+
if ( is_admin() ) {
|
51 |
+
$ig_feedback->render_deactivate_feedback();
|
52 |
+
}
|
53 |
+
|
54 |
+
if ( is_admin() && current_user_can( 'edit_posts' ) ) {
|
55 |
+
$ig_campaign_admin = Icegram_Campaign_Admin::getInstance();
|
56 |
+
$ig_message_admin = Icegram_Message_Admin::getInstance();
|
57 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue_admin_styles_and_scripts' ) );
|
58 |
+
add_action( 'admin_print_styles', array( &$this, 'remove_preview_button' ) );
|
59 |
+
add_filter( 'post_row_actions', array( &$this, 'remove_row_actions' ), 10, 2 );
|
60 |
+
|
61 |
+
add_action( 'admin_menu', array( &$this, 'admin_menus' ) );
|
62 |
+
add_action( 'admin_init', array( &$this, 'welcome' ) );
|
63 |
+
add_action( 'admin_init', array( &$this, 'dismiss_admin_notice' ) );
|
64 |
+
|
65 |
+
add_action( 'admin_init', array( &$this, 'import_gallery_item' ) );
|
66 |
+
|
67 |
+
add_action( 'icegram_settings_after', array( &$this, 'klawoo_subscribe_form' ) );
|
68 |
+
add_action( 'icegram_about_changelog', array( &$this, 'klawoo_subscribe_form' ) );
|
69 |
+
add_action( 'icegram_settings_after', array( &$this, 'icegram_houskeeping' ) );
|
70 |
+
add_action( 'admin_notices', array( &$this, 'add_admin_notices' ) );
|
71 |
+
add_filter( 'plugin_action_links', array( $this, 'ig_plugin_settings_link' ), 10, 2 );
|
72 |
+
} else {
|
73 |
+
add_action( 'wp_footer', array( &$this, 'icegram_load_data' ) );
|
74 |
+
}
|
75 |
+
if ( $this->cache_compatibility === 'no' ) {
|
76 |
+
add_action( 'wp_footer', array( &$this, 'display_messages' ) );
|
77 |
+
}
|
78 |
+
add_shortcode( 'icegram', array( &$this, 'execute_shortcode' ) );
|
79 |
+
add_shortcode( 'ig_form', array( &$this, 'execute_form_shortcode' ) );
|
80 |
+
// WPML compatibility
|
81 |
+
add_filter( 'icegram_identify_current_page', array( &$this, 'wpml_get_parent_id' ), 10 );
|
82 |
+
|
83 |
+
add_filter( 'icegram_branding_data', array( &$this, 'branding_data_remove' ), 10 );
|
84 |
+
add_action( 'wp_enqueue_scripts', array( &$this, 'identify_current_page' ) );
|
85 |
+
add_filter( 'icegram_get_valid_campaigns_sql', array( &$this, 'append_to_valid_campaigns_sql' ), 10, 2 );
|
86 |
+
add_action( 'icegram_print_js_css_data', array( &$this, 'print_js_css_data' ), 10, 1 );
|
87 |
+
// common
|
88 |
+
add_action( 'init', array( &$this, 'register_campaign_post_type' ) );
|
89 |
+
add_action( 'init', array( &$this, 'register_message_post_type' ) );
|
90 |
+
|
91 |
+
add_action( 'icegram_loaded', array( &$this, 'load_compat_classes' ) );
|
92 |
+
|
93 |
+
// execute shortcode in sidebar
|
94 |
+
add_filter( 'widget_text', array( &$this, 'ig_widget_text_filter' ) );
|
95 |
+
|
96 |
+
add_filter( 'rainmaker_validate_request', array( &$this, 'form_submission_validate_request' ), 10, 2 );
|
97 |
+
add_filter( 'icegram_data', array( $this, 'two_step_mobile_popup' ), 100, 1 );
|
98 |
+
|
99 |
+
|
100 |
+
if ( defined( 'DOING_AJAX' ) ) {
|
101 |
+
if ( $this->cache_compatibility === 'yes' ) {
|
102 |
+
add_action( 'wp_ajax_display_messages', array( &$this, 'display_messages' ) );
|
103 |
+
add_action( 'wp_ajax_nopriv_display_messages', array( &$this, 'display_messages' ) );
|
104 |
+
}
|
105 |
+
add_action( 'wp_ajax_icegram_event_track', array( &$this, 'icegram_event_track' ) );
|
106 |
+
add_action( 'wp_ajax_nopriv_icegram_event_track', array( &$this, 'icegram_event_track' ) );
|
107 |
+
add_action( 'wp_ajax_klawoo_subscribe', array( &$this, 'klawoo_subscribe' ) );
|
108 |
+
add_action( 'wp_ajax_icegram_run_housekeeping', array( &$this, 'run_housekeeping' ) );
|
109 |
+
add_action( 'wp_ajax_save_gallery_data', array( &$this, 'save_gallery_data' ) );
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
function ig_plugin_settings_link( $links, $file ) {
|
116 |
+
if ( $file == plugin_basename( __FILE__ ) ) {
|
117 |
+
$settings_link = '<a href="edit.php?post_type=ig_campaign&page=icegram-settings">' . __( 'Settings', 'icegram' ) . '</a>';
|
118 |
+
$support_link = '<a href="edit.php?post_type=ig_campaign&page=icegram-support">' . __( 'Support', 'icegram' ) . '</a>';
|
119 |
+
array_unshift( $links, $support_link );
|
120 |
+
array_unshift( $links, $settings_link );
|
121 |
+
}
|
122 |
+
|
123 |
+
return $links;
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
public function define_constants() {
|
128 |
+
if ( ! defined( 'IG_PLUGIN_URL' ) ) {
|
129 |
+
define( 'IG_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
public function load_compat_classes() {
|
134 |
+
|
135 |
+
$compat_classes = (array) glob( $this->plugin_path . '/classes/compat/class-icegram-compat-*.php' );
|
136 |
+
if ( empty( $compat_classes ) ) {
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
|
140 |
+
$active_plugins = (array) get_option( 'active_plugins', array() );
|
141 |
+
if ( is_multisite() ) {
|
142 |
+
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
143 |
+
}
|
144 |
+
$active_plugins = array_unique( array_merge( array_values( $active_plugins ), array_keys( $active_plugins ) ) );
|
145 |
+
$active_plugins_with_slugs = array();
|
146 |
+
foreach ( $active_plugins as $key => $value ) {
|
147 |
+
$slug = dirname( $value );
|
148 |
+
if ( $slug == '.' ) {
|
149 |
+
unset( $active_plugins[ $key ] );
|
150 |
+
} else {
|
151 |
+
$active_plugins[ $key ] = $slug;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
foreach ( $compat_classes as $file ) {
|
156 |
+
if ( is_file( $file ) ) {
|
157 |
+
$slug = str_replace( 'class-icegram-compat-', '', str_replace( ".php", "", basename( $file ) ) );
|
158 |
+
if ( in_array( $slug, $active_plugins ) ) {
|
159 |
+
include_once( $file );
|
160 |
+
$class_name = 'Icegram_Compat_' . str_replace( '-', '_', $slug );
|
161 |
+
if ( class_exists( $class_name ) ) {
|
162 |
+
new $class_name();
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
public function add_admin_notices() {
|
170 |
+
|
171 |
+
global $ig_feedback;
|
172 |
+
|
173 |
+
$screen = get_current_screen();
|
174 |
+
if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
//bfcm 2019 :start
|
179 |
+
$timezone_format = _x( 'Y-m-d', 'timezone date format' );
|
180 |
+
$ig_current_date = strtotime( date_i18n( $timezone_format ) );
|
181 |
+
$ig_offer_start = strtotime( "2019-11-22" );
|
182 |
+
$ig_offer_end = strtotime( "2019-12-03" );
|
183 |
+
if ( ( $ig_current_date >= $ig_offer_start ) && ( $ig_current_date <= $ig_offer_end ) ) {
|
184 |
+
include_once( 'ig-offer.php' );
|
185 |
+
}
|
186 |
+
//bfcm 2019 :end
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
public function dismiss_admin_notice() {
|
191 |
+
if ( isset( $_GET['ig_dismiss_admin_notice'] ) && $_GET['ig_dismiss_admin_notice'] == '1' && isset( $_GET['ig_option_name'] ) ) {
|
192 |
+
$option_name = sanitize_text_field( $_GET['ig_option_name'] );
|
193 |
+
update_option( $option_name . '_icegram', true );
|
194 |
+
if ( $option_name === 'ig_offer_bfcm_done_2019' || $option_name === 'ig_offer_last_day_bfcm_done_2019' ) {
|
195 |
+
header( "Location: https://www.icegram.com/?utm_source=in_app&utm_medium=ig_banner&utm_campaign=ig-bfcm-2019" );
|
196 |
+
exit();
|
197 |
+
} else {
|
198 |
+
$referer = wp_get_referer();
|
199 |
+
wp_safe_redirect( $referer );
|
200 |
+
exit();
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
public function klawoo_subscribe_form() {
|
206 |
+
?>
|
207 |
<div class="wrap">
|
208 |
+
<?php
|
209 |
+
if ( stripos( get_current_screen()->base, 'settings' ) !== false ) {
|
210 |
+
echo "<h2>" . __( 'Free Add-ons, Proven Marketing Tricks and Updates', 'icegram' ) . "</h2>";
|
211 |
+
}
|
212 |
+
$current_user = wp_get_current_user();
|
213 |
+
$customer_email = $current_user->user_email;
|
214 |
+
?>
|
215 |
<table class="form-table">
|
216 |
+
<tr>
|
217 |
<th scope="row"><?php _e( 'Get add-ons and tips...', 'icegram' ) ?></th>
|
218 |
<td>
|
219 |
<form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8">
|
220 |
+
<input class="ltr" type="text" name="name" id="name" placeholder="Name"/>
|
221 |
+
<input class="regular-text ltr" type="text" name="email" id="email" placeholder="Email" value="<?php echo $customer_email ?>"/>
|
222 |
<input type="hidden" name="list" value="7I763v6Ldrs3YhJeee5EOgFA"/>
|
223 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="Subscribe">
|
224 |
<br><br>
|
225 |
+
<input type="checkbox" name="es-gdpr-agree" id="es-gdpr-agree" value="1" required="required">
|
226 |
+
<label for="es-gdpr-agree"><?php echo sprintf( __( 'I have read and agreed to our %s.', 'icegram' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'icegram' ) . '</a>' ); ?></label>
|
227 |
<br>
|
228 |
</form>
|
229 |
<div id="klawoo_response"></div>
|
232 |
</table>
|
233 |
</div>
|
234 |
<script type="text/javascript">
|
235 |
+
jQuery(function () {
|
236 |
+
jQuery("form[name=klawoo_subscribe]").submit(function (e) {
|
237 |
+
e.preventDefault();
|
238 |
+
|
239 |
+
jQuery('#klawoo_response').html('');
|
240 |
+
params = jQuery("form[name=klawoo_subscribe]").serializeArray();
|
241 |
+
params.push({name: 'action', value: 'klawoo_subscribe'});
|
242 |
+
|
243 |
+
jQuery.ajax({
|
244 |
+
method: 'POST',
|
245 |
+
type: 'text',
|
246 |
+
url: "<?php echo admin_url( 'admin-ajax.php' ); ?>",
|
247 |
+
data: params,
|
248 |
+
success: function (response) {
|
249 |
+
if (response != '') {
|
250 |
+
jQuery('#klawoo_response').html(response);
|
251 |
+
} else {
|
252 |
+
jQuery('#klawoo_response').html('error!');
|
253 |
+
}
|
254 |
+
}
|
255 |
+
});
|
256 |
+
});
|
257 |
+
});
|
258 |
</script>
|
259 |
+
<?php
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
public function klawoo_subscribe() {
|
264 |
+
$url = 'http://app.klawoo.com/subscribe';
|
265 |
+
|
266 |
+
if ( ! empty( $_POST ) ) {
|
267 |
+
$params = $_POST;
|
268 |
+
} else {
|
269 |
+
exit();
|
270 |
+
}
|
271 |
+
$method = 'POST';
|
272 |
+
$qs = http_build_query( $params );
|
273 |
+
|
274 |
+
$options = array(
|
275 |
+
'timeout' => 15,
|
276 |
+
'method' => $method
|
277 |
+
);
|
278 |
+
|
279 |
+
if ( $method == 'POST' ) {
|
280 |
+
$options['body'] = $qs;
|
281 |
+
} else {
|
282 |
+
if ( strpos( $url, '?' ) !== false ) {
|
283 |
+
$url .= '&' . $qs;
|
284 |
+
} else {
|
285 |
+
$url .= '?' . $qs;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
$response = wp_remote_request( $url, $options );
|
290 |
+
if ( wp_remote_retrieve_response_code( $response ) == 200 ) {
|
291 |
+
$data = $response['body'];
|
292 |
+
if ( $data != 'error' ) {
|
293 |
+
|
294 |
+
$message_start = substr( $data, strpos( $data, '<body>' ) + 6 );
|
295 |
+
$remove = substr( $message_start, strpos( $message_start, '</body>' ) );
|
296 |
+
$message = trim( str_replace( $remove, '', $message_start ) );
|
297 |
+
echo( $message );
|
298 |
+
exit();
|
299 |
+
}
|
300 |
+
}
|
301 |
+
exit();
|
302 |
+
}
|
303 |
+
|
304 |
+
public function icegram_houskeeping() {
|
305 |
+
?>
|
306 |
<div class="wrap">
|
307 |
+
<?php
|
308 |
+
if ( stripos( get_current_screen()->base, 'settings' ) !== false ) {
|
309 |
+
?>
|
310 |
+
<form name="icegram_housekeeping" action="#" method="POST" accept-charset="utf-8">
|
311 |
+
<h2><?php _e( 'Housekeeping', 'icegram' ) ?></h2>
|
312 |
+
<p class="ig_housekeeping">
|
313 |
+
<label for="icegram_remove_shortcodes">
|
314 |
+
<input type="checkbox" name="icegram_remove_shortcodes" value="yes"/>
|
315 |
+
<?php _e( 'Remove all Icegram shortcodes', 'icegram' ); ?>
|
316 |
+
</label>
|
317 |
+
<br/><br/>
|
318 |
+
<label for="icegram_remove_all_data">
|
319 |
+
<input type="checkbox" name="icegram_remove_all_data" value="yes"/>
|
320 |
+
<?php _e( 'Remove all Icegram campaigns and messages', 'icegram' ); ?>
|
321 |
+
</label>
|
322 |
+
<br/><br/>
|
323 |
+
<img alt="" src="<?php echo admin_url( 'images/wpspin_light.gif' ) ?>" class="ig_loader" style="vertical-align:middle;display:none"/>
|
324 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Clean Up', 'icegram' ); ?>">
|
325 |
+
<div id="icegram_housekeeping_response"></div>
|
326 |
+
</p>
|
327 |
+
</form>
|
328 |
+
|
329 |
</div>
|
330 |
<script type="text/javascript">
|
331 |
+
jQuery(function () {
|
332 |
+
jQuery("form[name=icegram_housekeeping]").submit(function (e) {
|
333 |
+
if (confirm("<?php _e( 'You won\'t be able to recover this data once you proceed. Do you really want to perform this action?', 'icegram' ); ?>") == true) {
|
334 |
+
e.preventDefault();
|
335 |
+
jQuery('.ig_loader').show();
|
336 |
+
jQuery('#icegram_housekeeping_response').text("");
|
337 |
+
params = jQuery("form[name=icegram_housekeeping]").serializeArray();
|
338 |
+
params.push({name: 'action', value: 'icegram_run_housekeeping'});
|
339 |
+
params.push({name: 'security', value: '<?php echo wp_create_nonce( 'ig_run_housekeeping' ); ?> '});
|
340 |
+
|
341 |
+
jQuery.ajax({
|
342 |
+
method: 'POST',
|
343 |
+
type: 'text',
|
344 |
+
url: "<?php echo admin_url( 'admin-ajax.php' ); ?>",
|
345 |
+
data: params,
|
346 |
+
success: function (response) {
|
347 |
+
jQuery('.ig_loader').hide();
|
348 |
+
jQuery('#icegram_housekeeping_response').text("<?php _e( 'Done!', 'icegram' ); ?>");
|
349 |
+
}
|
350 |
+
});
|
351 |
+
}
|
352 |
+
});
|
353 |
+
});
|
354 |
</script>
|
355 |
+
<?php
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
public function run_housekeeping() {
|
360 |
+
check_ajax_referer( 'ig_run_housekeeping', 'security' );
|
361 |
+
global $wpdb, $current_user;
|
362 |
+
$params = $_POST;
|
363 |
+
$_POST = array();
|
364 |
+
if ( current_user_can( 'manage_options' ) && ! empty( $params['icegram_remove_shortcodes'] ) && $params['icegram_remove_shortcodes'] == 'yes' ) {
|
365 |
+
// first get all posts with [icegram] shortcode in them
|
366 |
+
$sql = "SELECT * FROM `$wpdb->posts` WHERE `post_content` LIKE '%[icegram %]%' and `post_type` != 'revision' ";
|
367 |
+
$posts = $wpdb->get_results( $sql, OBJECT );
|
368 |
+
if ( ! empty( $posts ) && is_array( $posts ) ) {
|
369 |
+
foreach ( $posts as $post ) {
|
370 |
+
$post_content = $post->post_content;
|
371 |
+
// remove shortcode with regexp now
|
372 |
+
$re = "/\\[icegram(.)*\\]/i";
|
373 |
+
$post_content = preg_replace( $re, '', $post_content );
|
374 |
+
// save post content back
|
375 |
+
if ( $post_content && $post_content != $post->post_content ) {
|
376 |
+
wp_update_post( array(
|
377 |
+
'ID' => $post->ID,
|
378 |
+
'post_content' => $post_content
|
379 |
+
) );
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
}
|
384 |
+
|
385 |
+
if ( ! empty( $params['icegram_remove_all_data'] ) && $params['icegram_remove_all_data'] == 'yes' ) {
|
386 |
+
$posts = get_posts( array( 'post_type' => array( 'ig_campaign', 'ig_message' ) ) );
|
387 |
+
if ( ! empty( $posts ) && is_array( $posts ) ) {
|
388 |
+
foreach ( $posts as $post ) {
|
389 |
+
wp_delete_post( $post->ID, true );
|
390 |
+
}
|
391 |
+
}
|
392 |
+
do_action( 'icegram_remove_all_data' );
|
393 |
+
}
|
394 |
+
$_POST = $params;
|
395 |
+
}
|
396 |
+
|
397 |
+
public function icegram_event_track() {
|
398 |
+
if ( ! empty( $_POST['ig_local_url_cs'] ) && isset( $_SERVER['HTTP_ORIGIN'] ) ) {
|
399 |
+
$parts = parse_url( $_POST['ig_local_url_cs'] );
|
400 |
+
$base_url = $parts["scheme"] . "://" . $parts["host"];
|
401 |
+
header( 'Access-Control-Allow-Origin: ' . $base_url );
|
402 |
+
header( 'Access-Control-Allow-Credentials: true' );
|
403 |
+
}
|
404 |
+
|
405 |
+
if ( ! empty( $_POST['event_data'] ) ) {
|
406 |
+
foreach ( $_POST['event_data'] as $event ) {
|
407 |
+
switch ( $event['type'] ) {
|
408 |
+
case 'shown':
|
409 |
+
if ( is_array( $event['params'] ) && ! empty( $event['params']['message_id'] ) ) {
|
410 |
+
$messages_shown[] = $event['params']['message_id'];
|
411 |
+
if ( ! empty( $event['params']['expiry_time'] ) ) {
|
412 |
+
if ( $event['params']['expiry_time'] == 'today' ) {
|
413 |
+
$event['params']['expiry_time'] = strtotime( '+1 day', mktime( 0, 0, 0 ) );
|
414 |
+
} elseif ( $event['params']['expiry_time'] == 'current_session' ) {
|
415 |
+
$event['params']['expiry_time'] = 0;
|
416 |
+
} else {
|
417 |
+
$event['params']['expiry_time'] = strtotime( $event['params']['expiry_time'] );
|
418 |
+
}
|
419 |
+
|
420 |
+
$event['default'] = true;
|
421 |
+
$event = apply_filters( 'icegram_check_event_track', $event );
|
422 |
+
if ( $event['default'] ) {
|
423 |
+
setcookie( 'icegram_campaign_shown_' . floor( $event['params']['campaign_id'] ), true, $event['params']['expiry_time'], '/' );
|
424 |
+
}
|
425 |
+
}
|
426 |
+
}
|
427 |
+
break;
|
428 |
+
case 'clicked':
|
429 |
+
if ( is_array( $event['params'] ) && ! empty( $event['params']['message_id'] ) ) {
|
430 |
+
$messages_clicked[] = $event['params']['message_id'];
|
431 |
+
if ( ! empty( $event['params']['expiry_time_clicked'] ) ) {
|
432 |
+
if ( $event['params']['expiry_time_clicked'] == 'today' ) {
|
433 |
+
$event['params']['expiry_time_clicked'] = strtotime( '+1 day', mktime( 0, 0, 0 ) );
|
434 |
+
} elseif ( $event['params']['expiry_time_clicked'] == 'current_session' ) {
|
435 |
+
$event['params']['expiry_time_clicked'] = 0;
|
436 |
+
} else {
|
437 |
+
$event['params']['expiry_time_clicked'] = strtotime( $event['params']['expiry_time_clicked'] );
|
438 |
+
}
|
439 |
+
//setcookie('icegram_messages_clicked_'.$event['params']['message_id'],true , $event['params']['expiry_time_clicked'] , '/' );
|
440 |
+
setcookie( 'icegram_campaign_clicked_' . floor( $event['params']['campaign_id'] ), true, $event['params']['expiry_time_clicked'], '/' );
|
441 |
+
}
|
442 |
+
}
|
443 |
+
break;
|
444 |
+
|
445 |
+
default:
|
446 |
+
break;
|
447 |
+
}
|
448 |
+
|
449 |
+
// Emit event for other plugins to handle it
|
450 |
+
do_action( 'icegram_event_track', $event );
|
451 |
+
do_action( 'icegram_event_track_' . $event['type'], $event['params'] );
|
452 |
+
}
|
453 |
+
}
|
454 |
+
exit();
|
455 |
+
}
|
456 |
+
|
457 |
+
static function install() {
|
458 |
+
// Redirect to welcome screen
|
459 |
+
delete_option( '_icegram_activation_redirect' );
|
460 |
+
add_option( '_icegram_activation_redirect', 'pending' );
|
461 |
+
}
|
462 |
+
|
463 |
+
public function welcome() {
|
464 |
+
|
465 |
+
$this->db_update();
|
466 |
+
// Bail if no activation redirect transient is set
|
467 |
+
if ( false === get_option( '_icegram_activation_redirect' ) ) {
|
468 |
+
return;
|
469 |
+
}
|
470 |
+
|
471 |
+
// Delete the redirect transient
|
472 |
+
delete_option( '_icegram_activation_redirect' );
|
473 |
+
|
474 |
+
wp_redirect( admin_url( 'edit.php?post_type=ig_campaign&page=icegram-support' ) );
|
475 |
+
exit;
|
476 |
+
}
|
477 |
+
|
478 |
+
function db_update() {
|
479 |
+
$current_db_version = get_option( 'icegram_db_version' );
|
480 |
+
if ( ! $current_db_version || version_compare( $current_db_version, '1.2', '<' ) ) {
|
481 |
+
include( 'updates/icegram-update-1.2.php' );
|
482 |
+
}
|
483 |
+
}
|
484 |
+
|
485 |
+
public function admin_menus() {
|
486 |
+
|
487 |
+
$welcome_page_title = __( 'Welcome to Icegram', 'icegram' );
|
488 |
+
$gallery_page_title = '<span style="color:#f18500;font-weight:bolder;">' . __( 'Gallery', 'icegram' ) . '<span>';
|
489 |
+
$gallery = add_submenu_page( 'edit.php?post_type=ig_campaign', $gallery_page_title, $gallery_page_title, 'manage_options', 'icegram-gallery', array( $this, 'gallery_screen' ) );
|
490 |
+
$settings_page_title = __( 'Settings', 'icegram' );
|
491 |
+
$upgrade_page_title = '<span style="color:#f18500;font-weight:bolder;">' . __( 'Upgrade', 'icegram' ) . '</span>';
|
492 |
+
|
493 |
+
$menu_title = __( 'Docs & Support', 'icegram' );
|
494 |
+
$about = add_submenu_page( 'edit.php?post_type=ig_campaign', $welcome_page_title, $menu_title, 'manage_options', 'icegram-support', array( $this, 'about_screen' ) );
|
495 |
+
$settings = add_submenu_page( 'edit.php?post_type=ig_campaign', $settings_page_title, $settings_page_title, 'manage_options', 'icegram-settings', array( $this, 'settings_screen' ) );
|
496 |
+
$upgrade = add_submenu_page( 'edit.php?post_type=ig_campaign', $upgrade_page_title, $upgrade_page_title, 'manage_options', 'icegram-upgrade', array( $this, 'upgrade_screen' ) );
|
497 |
+
|
498 |
+
|
499 |
+
add_action( 'admin_print_styles-' . $about, array( $this, 'admin_css' ) );
|
500 |
+
add_action( 'admin_print_styles-' . $settings, array( $this, 'admin_css' ) );
|
501 |
+
add_action( 'admin_print_styles-' . $upgrade, array( $this, 'admin_css' ) );
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
public function admin_css() {
|
506 |
+
wp_enqueue_style( 'icegram-activation', $this->plugin_url . '/assets/css/admin.min.css' );
|
507 |
+
}
|
508 |
+
|
509 |
+
public function about_screen() {
|
510 |
+
|
511 |
+
// Import data if not done already
|
512 |
+
if ( false === get_option( 'icegram_sample_data_imported' ) ) {
|
513 |
+
$this->import_sample_data( $this->get_sample_data() );
|
514 |
+
}
|
515 |
+
|
516 |
+
include( 'about-icegram.php' );
|
517 |
+
}
|
518 |
+
|
519 |
+
public function settings_screen() {
|
520 |
+
include( 'settings.php' );
|
521 |
+
}
|
522 |
+
|
523 |
+
public function upgrade_screen() {
|
524 |
+
// include ( 'addons.php' );
|
525 |
+
}
|
526 |
+
|
527 |
+
public function check_for_gallery_items( $force_update = false ) {
|
528 |
+
global $icegram;
|
529 |
+
if ( $force_update === true || false === ( $ig_last_gallery_item_update = get_transient( 'ig_last_gallery_item_update' ) ) ) {
|
530 |
+
// $url_for_gallery_item = 'https://www.icegram.com/gallery/wp-json/wp/v2/galleryitem?per_page=200&page=1';
|
531 |
+
$url_for_gallery_item = 'https://www.icegram.com/gallery/wp-json/wp/v2/galleryitem?filter[posts_per_page]=200';
|
532 |
+
$ig_gallery_json = wp_remote_get( $url_for_gallery_item );
|
533 |
+
if ( ! is_wp_error( $ig_gallery_json ) ) {
|
534 |
+
$ig_gallery_json = ( wp_remote_retrieve_body( $ig_gallery_json ) );
|
535 |
+
if ( ! empty( $ig_gallery_json ) ) {
|
536 |
+
update_option( 'ig_last_gallery_items', $ig_gallery_json );
|
537 |
+
}
|
538 |
+
} else {
|
539 |
+
update_option( 'requested_gallery_item_with_ajax', 'yes' );
|
540 |
+
?>
|
541 |
<script type="text/javascript">
|
542 |
+
jQuery(document).ready(function () {
|
543 |
+
jQuery.ajax({
|
544 |
+
url: '<?php echo esc_url( $url_for_gallery_item ); ?>',
|
545 |
+
method: 'GET',
|
546 |
+
dataType: 'json',
|
547 |
+
success: function (response) {
|
548 |
+
if (response != undefined && response != '') {
|
549 |
+
//ajax to save data
|
550 |
+
jQuery.ajax({
|
551 |
+
url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
|
552 |
+
method: 'POST',
|
553 |
+
dataType: 'json',
|
554 |
+
data: {
|
555 |
+
action: 'save_gallery_data',
|
556 |
+
galleryitems: JSON.stringify(response),
|
557 |
+
security: '<?php echo wp_create_nonce( 'gallery-save-data' ); // WPCS: XSS ok. ?>'
|
558 |
+
},
|
559 |
+
success: function (res) {
|
560 |
+
if (res != undefined && res != '' && res.success != undefined && res.success == 'yes') {
|
561 |
+
// All done.
|
562 |
+
}
|
563 |
+
}
|
564 |
+
});
|
565 |
+
}
|
566 |
+
},
|
567 |
+
error: function (response) {
|
568 |
+
console.log(response, 'res');
|
569 |
+
|
570 |
+
}
|
571 |
+
});
|
572 |
+
});
|
573 |
</script>
|
574 |
+
<?php }
|
575 |
+
$url_for_categories = 'https://www.icegram.com/gallery/wp-json/wp/v2/custom_cat?filter[orderby]=parent&order=desc';
|
576 |
+
$options = array(
|
577 |
+
'timeout' => 15,
|
578 |
+
'method' => 'GET',
|
579 |
+
'body' => ''
|
580 |
+
);
|
581 |
+
$response = wp_remote_request( $url_for_categories, $options );
|
582 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
583 |
+
// $body = json_decode($response['body'] ,true);
|
584 |
+
if ( $response_code == 200 ) {
|
585 |
+
$categories = json_decode( $response['body'], true );
|
586 |
+
$cat_list = array();
|
587 |
+
foreach ( $categories as $category ) {
|
588 |
+
if ( $category['parent'] == 0 ) {
|
589 |
+
$cat_list[ $category['term_id'] ]['name'] = $category['name'];
|
590 |
+
$cat_list[ $category['term_id'] ]['slug'] = $category['slug'];
|
591 |
+
$cat_list[ $category['term_id'] ]['term_id'] = $category['term_id'];
|
592 |
+
} else {
|
593 |
+
$cat_list[ $category['parent'] ]['list'][] = $category;
|
594 |
+
}
|
595 |
+
}
|
596 |
+
$featured_cat = $cat_list[53];
|
597 |
+
unset( $cat_list[53] );
|
598 |
+
array_unshift( $cat_list, $featured_cat );
|
599 |
+
update_option( 'ig_cat_list', $cat_list );
|
600 |
+
} else {
|
601 |
+
?>
|
602 |
+
<script type="text/javascript">
|
603 |
+
jQuery(document).ready(function () {
|
604 |
+
jQuery.ajax({
|
605 |
+
url: '<?php echo esc_url( $url_for_categories ); ?>',
|
606 |
+
method: 'GET',
|
607 |
+
dataType: 'json',
|
608 |
+
success: function (response) {
|
609 |
+
|
610 |
+
if (response != undefined && response != '') {
|
611 |
+
//ajax to save data
|
612 |
+
jQuery.ajax({
|
613 |
+
url: '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>',
|
614 |
+
method: 'POST',
|
615 |
+
dataType: 'json',
|
616 |
+
data: {
|
617 |
+
action: 'save_gallery_data',
|
618 |
+
categories: response,
|
619 |
+
security: '<?php echo wp_create_nonce( 'gallery-save-data' ); // WPCS: XSS ok. ?>'
|
620 |
+
},
|
621 |
+
success: function (res) {
|
622 |
+
if (res != undefined && res != '' && res.success != undefined && res.success == 'yes') {
|
623 |
+
// All done.
|
624 |
+
}
|
625 |
+
}
|
626 |
+
});
|
627 |
+
}
|
628 |
+
},
|
629 |
+
error: function (response) {
|
630 |
+
console.log(response, 'res');
|
631 |
+
|
632 |
+
}
|
633 |
+
});
|
634 |
+
});
|
635 |
</script>
|
636 |
+
<?php
|
637 |
+
}
|
638 |
+
set_transient( 'ig_last_gallery_item_update', current_time( 'timestamp' ), 24 * HOUR_IN_SECONDS ); // 1 day
|
639 |
+
}
|
640 |
+
}
|
641 |
+
|
642 |
+
public function save_gallery_data() {
|
643 |
+
check_ajax_referer( 'gallery-save-data', 'security' );
|
644 |
+
if ( current_user_can( 'manage_options' ) ) {
|
645 |
+
if ( ! empty( $_REQUEST ) && ! empty( $_REQUEST['galleryitems'] ) ) {
|
646 |
+
$ig_gallery_json = stripslashes( $_REQUEST['galleryitems'] );
|
647 |
+
update_option( 'ig_last_gallery_items', $ig_gallery_json );
|
648 |
+
}
|
649 |
+
if ( ! empty( $_REQUEST ) && ! empty( $_REQUEST['categories'] ) ) {
|
650 |
+
$categories = $_REQUEST['categories'];
|
651 |
+
$cat_list = array();
|
652 |
+
foreach ( $categories as $category ) {
|
653 |
+
if ( $category['parent'] == 0 ) {
|
654 |
+
$cat_list[ $category['term_id'] ]['name'] = $category['name'];
|
655 |
+
$cat_list[ $category['term_id'] ]['slug'] = $category['slug'];
|
656 |
+
} else {
|
657 |
+
$cat_list[ $category['parent'] ]['list'][] = $category;
|
658 |
+
}
|
659 |
+
}
|
660 |
+
update_option( 'ig_cat_list', $cat_list );
|
661 |
+
}
|
662 |
+
}
|
663 |
+
|
664 |
+
}
|
665 |
+
|
666 |
+
public static function gallery_screen() {
|
667 |
+
global $icegram;
|
668 |
+
//check for new gallery item
|
669 |
+
$ig_last_gallery_item_update = get_transient( 'ig_last_gallery_item_update' );
|
670 |
+
|
671 |
+
if ( empty( $ig_last_gallery_item_update ) ) {
|
672 |
+
$icegram->check_for_gallery_items( true );
|
673 |
+
}
|
674 |
+
$ig_gallery_items = get_option( 'ig_last_gallery_items', true );
|
675 |
+
$cat_list = get_option( 'ig_cat_list', true );
|
676 |
+
include( 'gallery.php' );
|
677 |
+
wp_register_script( 'ig_gallery_js', $icegram->plugin_url . '/assets/js/gallery.min.js', array( 'jquery', 'backbone', 'wp-backbone', 'wp-a11y', 'wp-util' ), $icegram->version, true );
|
678 |
+
if ( ! wp_script_is( 'ig_gallery_js' ) ) {
|
679 |
+
wp_enqueue_script( 'ig_gallery_js' );
|
680 |
+
$imported_gallery_items = get_option( 'ig_imported_gallery_items', true );
|
681 |
+
$ig_plan = get_option( 'ig_engage_plan' );
|
682 |
+
$ig_plan = ( ! empty( $ig_plan ) ) ? ( ( $ig_plan == 'plus' ) ? 1 : ( ( $ig_plan == 'pro' ) ? 2 : ( ( $ig_plan == 'max' ) ? 3 : 0 ) ) ) : 0;
|
683 |
+
$ig_gallery_json =
|
684 |
+
wp_localize_script( 'ig_gallery_js', '_wpThemeSettings', array(
|
685 |
+
'themes' => json_decode( $ig_gallery_items, true ),
|
686 |
+
'settings' => array(
|
687 |
+
'canInstall' => ( ! is_multisite() && ( 'install_themes' ) ),
|
688 |
+
'isInstall' => true,
|
689 |
+
'installURI' => ( ! is_multisite() && ( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
|
690 |
+
'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete.", 'icegram' ),
|
691 |
+
'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ),
|
692 |
+
'ig_plan' => $ig_plan,
|
693 |
+
'cat_list' => $cat_list
|
694 |
+
),
|
695 |
+
'l10n' => array(
|
696 |
+
'addNew' => __( 'Add New Gallery Templates', 'icegram' ),
|
697 |
+
'search' => __( 'Search Gallery Templates', 'icegram' ),
|
698 |
+
'searchPlaceholder' => __( 'Search Design Templates', 'icegram' ), // placeholder (no ellipsis)
|
699 |
+
'themesFound' => __( 'Number of Gallery Templates found: %d', 'icegram' ),
|
700 |
+
'noThemesFound' => __( 'No Gallery Templates found. Try a different search.', 'icegram' ),
|
701 |
+
),
|
702 |
+
'installedThemes' => $imported_gallery_items
|
703 |
+
) );
|
704 |
+
}
|
705 |
+
}
|
706 |
+
|
707 |
+
public function branding_data_remove( $icegram_branding_data ) {
|
708 |
+
if ( ! empty( $icegram_branding_data ) && 'yes' != get_option( 'icegram_share_love', 'no' ) ) {
|
709 |
+
$icegram_branding_data['powered_by_logo'] = '';
|
710 |
+
$icegram_branding_data['powered_by_text'] = '';
|
711 |
+
}
|
712 |
+
|
713 |
+
return $icegram_branding_data;
|
714 |
+
}
|
715 |
+
|
716 |
+
//Execute Form shortcode
|
717 |
+
function execute_form_shortcode( $atts = array() ) {
|
718 |
+
return '<div class="ig_form_container layout_inline"></div>';
|
719 |
+
}
|
720 |
+
|
721 |
+
function execute_shortcode( $atts = array(), $content = null ) {
|
722 |
+
// When shortcode is called, it will only prepare an array with conditions
|
723 |
+
// And add a placeholder div
|
724 |
+
// Display will happen in footer via display_messages()
|
725 |
+
$i = count( $this->shortcode_instances );
|
726 |
+
$this->shortcode_instances[ $i ] = shortcode_atts( array(
|
727 |
+
'campaigns' => '',
|
728 |
+
'messages' => '',
|
729 |
+
'skip_others' => 'no'
|
730 |
+
), $atts );
|
731 |
+
|
732 |
+
$class[] = "ig_shortcode_container";
|
733 |
+
$html[] = "<div id='icegram_shortcode_{$i}'";
|
734 |
+
if ( ! empty( $atts['campaigns'] ) && ! empty( $content ) ) {
|
735 |
+
$this->shortcode_instances[ $i ]['with_content'] = true;
|
736 |
+
$class[] = "trigger_onclick";
|
737 |
+
}
|
738 |
+
foreach ( $atts as $key => $value ) {
|
739 |
+
$value = str_replace( ",", " ", $value );
|
740 |
+
$html[] = " data-{$key}=\"" . htmlentities( $value ) . "\" ";
|
741 |
+
}
|
742 |
+
$class = implode( " ", $class );
|
743 |
+
$html[] = "class='" . $class . "' >" . $content . "</div>";
|
744 |
+
|
745 |
+
return implode( " ", $html );
|
746 |
+
}
|
747 |
+
|
748 |
+
// Do not index Icegram campaigns / messages...
|
749 |
+
// Not using currently - made custom post types non public...
|
750 |
+
function icegram_load_data() {
|
751 |
+
global $post;
|
752 |
+
$icegram_pre_data['ajax_url'] = admin_url( 'admin-ajax.php' );
|
753 |
+
$icegram_pre_data['post_obj'] = $_GET;
|
754 |
+
$icegram_pre_data['post_obj']['is_home'] = ( is_home() || is_front_page() ) ? true : false;
|
755 |
+
$icegram_pre_data['post_obj']['page_id'] = is_object( $post ) && isset( $post->ID ) ? $post->ID : 0;
|
756 |
+
$icegram_pre_data['post_obj']['action'] = 'display_messages';
|
757 |
+
$icegram_pre_data['post_obj']['shortcodes'] = $this->shortcode_instances;
|
758 |
+
$icegram_pre_data['post_obj']['cache_compatibility'] = $this->cache_compatibility;
|
759 |
+
$icegram_pre_data['post_obj']['device'] = $this->get_platform();
|
760 |
+
wp_register_script( 'icegram_main_js', $this->plugin_url . '/assets/js/main.min.js', array( 'jquery' ), $this->version, true );
|
761 |
+
if ( ! wp_script_is( 'icegram_main_js' ) ) {
|
762 |
+
wp_enqueue_script( 'icegram_main_js' );
|
763 |
+
wp_localize_script( 'icegram_main_js', 'icegram_pre_data', $icegram_pre_data );
|
764 |
+
}
|
765 |
+
}
|
766 |
+
|
767 |
+
function display_messages() {
|
768 |
+
|
769 |
+
$skip_others = $preview_mode = false;
|
770 |
+
$campaign_ids = $message_ids = array();
|
771 |
+
$this->shortcode_instances = ( $this->cache_compatibility == 'yes' && ! empty( $_REQUEST['shortcodes'] ) ) ? $_REQUEST['shortcodes'] : $this->shortcode_instances;
|
772 |
+
// Pull in message and campaign IDs from shortcodes - if set
|
773 |
+
if ( ! empty( $this->shortcode_instances ) ) {
|
774 |
+
foreach ( $this->shortcode_instances as $i => $value ) {
|
775 |
+
$cids = array_map( 'trim', (array) explode( ',', intval( $value['campaigns'] ) ) );
|
776 |
+
$mids = array_map( 'trim', (array) explode( ',', intval( $value['messages'] ) ) );
|
777 |
+
if ( ! empty( $value['skip_others'] ) && $value['skip_others'] == 'yes' && ( ! empty( $cids ) || ! empty( $mids ) ) ) {
|
778 |
+
$skip_others = true;
|
779 |
+
}
|
780 |
+
$campaign_ids = array_merge( $campaign_ids, $cids );
|
781 |
+
$message_ids = array_merge( $message_ids, $mids );
|
782 |
+
}
|
783 |
+
}
|
784 |
+
if ( ! empty( $_REQUEST['campaign_preview_id'] ) && intval( $_REQUEST['campaign_preview_id'] ) && ( 'edit_posts' ) ) {
|
785 |
+
$campaign_ids = array( intval( $_REQUEST['campaign_preview_id'] ) );
|
786 |
+
$preview_mode = true;
|
787 |
+
}
|
788 |
+
|
789 |
+
|
790 |
+
$messages = $this->get_valid_messages( $message_ids, $campaign_ids, $preview_mode, $skip_others );
|
791 |
+
|
792 |
+
if ( empty( $messages ) ) {
|
793 |
+
//wp_die(0);
|
794 |
+
return;
|
795 |
+
}
|
796 |
+
|
797 |
+
$messages_to_show_ids = array();
|
798 |
+
foreach ( $messages as $key => $message_data ) {
|
799 |
+
|
800 |
+
if ( ! is_array( $message_data ) || empty( $message_data ) ) {
|
801 |
+
continue;
|
802 |
+
}
|
803 |
+
|
804 |
+
// Don't show a seen message again - if needed
|
805 |
+
// change to campaign targetting in v1.9.1
|
806 |
+
if ( ! empty( $message_data['id'] ) &&
|
807 |
+
empty( $_GET['campaign_preview_id'] ) &&
|
808 |
+
! empty( $message_data['retargeting'] ) &&
|
809 |
+
$message_data['retargeting'] == 'yes'
|
810 |
+
) {
|
811 |
+
if ( ! empty( $_COOKIE[ 'icegram_messages_shown_' . $message_data['id'] ] ) || ! empty( $_COOKIE[ 'icegram_campaign_shown_' . floor( $message_data['campaign_id'] ) ] ) ) {
|
812 |
+
unset( $messages[ $key ] );
|
813 |
+
continue;
|
814 |
+
}
|
815 |
+
}
|
816 |
+
if ( ! empty( $message_data['id'] ) &&
|
817 |
+
empty( $_GET['campaign_preview_id'] ) &&
|
818 |
+
! empty( $message_data['retargeting_clicked'] ) &&
|
819 |
+
$message_data['retargeting_clicked'] == 'yes'
|
820 |
+
) {
|
821 |
+
if ( ! empty( $_COOKIE[ 'icegram_messages_clicked_' . $message_data['id'] ] ) || ! empty( $_COOKIE[ 'icegram_campaign_clicked_' . floor( $message_data['campaign_id'] ) ] ) ) {
|
822 |
+
unset( $messages[ $key ] );
|
823 |
+
continue;
|
824 |
+
}
|
825 |
+
}
|
826 |
+
|
827 |
+
// Avoid showing the same message twice
|
828 |
+
if ( in_array( $message_data['id'], $messages_to_show_ids ) ) {
|
829 |
+
unset ( $messages[ $key ] );
|
830 |
+
continue;
|
831 |
+
} else {
|
832 |
+
$messages_to_show_ids[] = $message_data['id'];
|
833 |
+
}
|
834 |
+
|
835 |
+
$this->process_message_body( $messages[ $key ] );
|
836 |
+
}
|
837 |
+
if ( empty( $messages ) ) {
|
838 |
+
return;
|
839 |
+
}
|
840 |
+
$icegram_default = apply_filters( 'icegram_branding_data',
|
841 |
+
array(
|
842 |
+
'icon' => $this->plugin_url . '/assets/images/icegram-logo-branding-64-grey.png',
|
843 |
+
'powered_by_logo' => $this->plugin_url . '/assets/images/icegram-logo-branding-64-grey.png',
|
844 |
+
'powered_by_text' => __( 'Powered by Icegram', 'icegram' )
|
845 |
+
) );
|
846 |
+
$messages = apply_filters( 'icegram_messages_to_show', $messages );
|
847 |
+
$icegram_data = apply_filters( 'icegram_data', array(
|
848 |
+
'messages' => array_values( $messages ),
|
849 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
850 |
+
'preview_id' => ! empty( $_GET['campaign_preview_id'] ) ? $_GET['campaign_preview_id'] : '',
|
851 |
+
'defaults' => $icegram_default
|
852 |
+
) );
|
853 |
+
if ( empty( $icegram_data['preview_id'] ) ) {
|
854 |
+
unset( $icegram_data['preview_id'] );
|
855 |
+
}
|
856 |
+
|
857 |
+
do_action( 'icegram_print_js_css_data', $icegram_data );
|
858 |
+
|
859 |
+
do_action( 'icegram_data_printed' );
|
860 |
+
}
|
861 |
+
|
862 |
+
function two_step_mobile_popup( $icegram_data ) {
|
863 |
+
|
864 |
+
$temp = array();
|
865 |
+
foreach ( $icegram_data['messages'] as $message_id => $message ) {
|
866 |
+
|
867 |
+
if ( ! empty( $message['ig_mobile_popup'] ) && $message['ig_mobile_popup'] == true ) {
|
868 |
+
$action_bar = $message;
|
869 |
+
$action_bar['type'] = 'action-bar';
|
870 |
+
$action_bar['theme'] = 'hello';
|
871 |
+
$action_bar['position'] = '21';
|
872 |
+
$action_bar['message'] = '';
|
873 |
+
$action_bar['label'] = __( 'Show More', 'icegram' );
|
874 |
+
$action_bar['id'] = $action_bar['id'] . '_00';
|
875 |
+
$action_bar['use_custom_code'] = 'yes';
|
876 |
+
$action_bar['form_html'] = '';
|
877 |
+
$action_bar['form_html_original'] = '';
|
878 |
+
$action_bar['rainmaker_form_code'] = '';
|
879 |
+
$action_bar['link'] = '';
|
880 |
+
$action_bar['redirect_to_link'] = '';
|
881 |
+
$action_bar['cta'] = '';
|
882 |
+
$action_bar['alt_cta'] = '';
|
883 |
+
$action_bar['add_alt_cta'] = '';
|
884 |
+
$action_bar['custom_css'] = '#ig_this_message .ig_close{display:none;}';
|
885 |
+
$action_bar['custom_js'] = "<script type='text/javascript'>jQuery('#icegram_message_" . $action_bar['id'] . "').on('click', '.ig_button', function(){icegram.get_message_by_id('" . $action_bar['id'] . "').hide(); icegram.get_message_by_id('" . $message['id'] . "').show(); });</script>";
|
886 |
+
unset( $action_bar['ig_mobile_popup'] );
|
887 |
+
$temp[] = $action_bar;
|
888 |
+
}
|
889 |
+
}
|
890 |
+
$icegram_data['messages'] = array_merge( $icegram_data['messages'], $temp );
|
891 |
+
unset( $temp );
|
892 |
+
|
893 |
+
return $icegram_data;
|
894 |
+
}
|
895 |
+
|
896 |
+
|
897 |
+
function print_js_css_data( $icegram_data ) {
|
898 |
+
|
899 |
+
$this->collect_js_and_css( $icegram_data );
|
900 |
+
if ( $this->cache_compatibility === 'yes' ) {
|
901 |
+
echo json_encode( $icegram_data );
|
902 |
+
wp_die();
|
903 |
+
} else {
|
904 |
+
wp_localize_script( 'icegram_main_js', 'icegram_data', $icegram_data );
|
905 |
+
}
|
906 |
+
}
|
907 |
+
|
908 |
+
function collect_js_and_css( &$icegram_data ) {
|
909 |
+
|
910 |
+
$types_shown = array();
|
911 |
+
$scripts = array();
|
912 |
+
$css = array();
|
913 |
+
foreach ( $icegram_data['messages'] as $key => $message_data ) {
|
914 |
+
$types_shown[] = $message_data['type'];
|
915 |
+
}
|
916 |
+
|
917 |
+
$types_shown = array_unique( $types_shown );
|
918 |
+
$ver_prefix = '?var=' . $this->version;
|
919 |
+
|
920 |
+
$scripts[] = $this->plugin_url . "/assets/js/icegram.min.js" . $ver_prefix;
|
921 |
+
$css[] = $this->plugin_url . "/assets/css/frontend.min.css" . $ver_prefix;
|
922 |
+
//minify and combine only for default msg type
|
923 |
+
$ig_core_message_types = array( 'popup', 'action-bar', 'toast', 'messenger' );
|
924 |
+
// Load JS and default CSS
|
925 |
+
foreach ( $types_shown as $message_type ) {
|
926 |
+
if ( ! in_array( $message_type, $ig_core_message_types ) ) {
|
927 |
+
$scripts[] = $this->message_types[ $message_type ]['baseurl'] . "main.js" . $ver_prefix;
|
928 |
+
$css[] = $this->message_types[ $message_type ]['baseurl'] . "default.css" . $ver_prefix;
|
929 |
+
} else {
|
930 |
+
$css[] = $this->message_types[ $message_type ]['baseurl'] . 'themes/' . $message_type . ".min.css" . $ver_prefix;
|
931 |
+
}
|
932 |
+
}
|
933 |
+
|
934 |
+
//TODO :: add theme pack theme css files too.
|
935 |
+
// Load theme CSS
|
936 |
+
foreach ( $icegram_data['messages'] as $key => $message ) {
|
937 |
+
if ( ! empty( $this->message_types[ $message['type'] ]['themes'][ $message['theme'] ] ) ) {
|
938 |
+
$theme = $this->message_types[ $message['type'] ]['themes'][ $message['theme'] ]['baseurl'] . $message['theme'] . '.css' . $ver_prefix;
|
939 |
+
} else {
|
940 |
+
$theme_default = $this->message_types[ $message['type'] ] ['settings']['theme']['default'];
|
941 |
+
$theme = $this->message_types[ $message['type'] ]['themes'][ $theme_default ]['baseurl'] . $theme_default . '.css' . $ver_prefix;
|
942 |
+
$icegram_data['messages'][ $key ]['theme'] = $theme_default;
|
943 |
+
}
|
944 |
+
if ( ! preg_match( '/icegram\/message-types/i', $theme ) ) {
|
945 |
+
$css [] = $theme;
|
946 |
+
}
|
947 |
+
}
|
948 |
+
$css = array_unique( $css );
|
949 |
+
$icegram_data['scripts'] = apply_filters( 'add_icegram_script', $scripts );
|
950 |
+
$icegram_data['css'] = apply_filters( 'add_icegram_css', $css );
|
951 |
+
|
952 |
+
return $icegram_data;
|
953 |
+
}
|
954 |
+
|
955 |
+
// Process
|
956 |
+
function process_message_body( &$message_data ) {
|
957 |
+
global $wp_scripts;
|
958 |
+
global $wp_styles;
|
959 |
+
|
960 |
+
if ( $this->cache_compatibility == 'yes' ) {
|
961 |
+
$q_script = ! empty( $wp_scripts->queue ) ? $wp_scripts->queue : array();
|
962 |
+
$q_style = ! empty( $wp_styles->queue ) ? $wp_styles->queue : array();
|
963 |
+
}
|
964 |
+
$content = $message_data['message'];
|
965 |
+
$content = convert_chars( convert_smilies( wptexturize( $content ) ) );
|
966 |
+
if ( isset( $GLOBALS['wp_embed'] ) ) {
|
967 |
+
$content = $GLOBALS['wp_embed']->autoembed( $content );
|
968 |
+
}
|
969 |
+
$content = $this->after_wpautop( wpautop( $this->before_wpautop( $content ) ) );
|
970 |
+
$content = do_shortcode( shortcode_unautop( $content ) );
|
971 |
+
$message_data['message'] = $content;
|
972 |
+
|
973 |
+
//do_shortcode in headline
|
974 |
+
$message_data['headline'] = do_shortcode( shortcode_unautop( $message_data['headline'] ) );
|
975 |
+
//shortcode support for Third party forms and Rainmaker
|
976 |
+
$form_html_original = ! empty( $message_data["rainmaker_form_code"] )
|
977 |
+
? ( '[rainmaker_form id="' . $message_data["rainmaker_form_code"] . '"]' )
|
978 |
+
: ( ! empty( $message_data['form_html_original'] ) ? $message_data['form_html_original'] : '' );
|
979 |
+
$form_html_original = ! empty( $message_data["es_form_code"] )
|
980 |
+
? ( '[email-subscribers-form id="' . $message_data["es_form_code"] . '"]' )
|
981 |
+
: $form_html_original;
|
982 |
+
|
983 |
+
if ( ! empty( $form_html_original ) ) {
|
984 |
+
$message_data['form_html'] = do_shortcode( shortcode_unautop( $form_html_original ) );
|
985 |
+
}
|
986 |
+
//TODO :: Handle case for inline style and script
|
987 |
+
if ( $this->cache_compatibility == 'yes' ) {
|
988 |
+
$handles = ! empty( $wp_scripts->queue ) ? array_diff( $wp_scripts->queue, $q_script ) : array();
|
989 |
+
unset( $q_script );
|
990 |
+
if ( ! empty( $handles ) ) {
|
991 |
+
if ( empty( $message_data['assets'] ) ) {
|
992 |
+
$message_data['assets'] = array();
|
993 |
+
}
|
994 |
+
|
995 |
+
ob_start();
|
996 |
+
$wp_scripts->do_items( $handles );
|
997 |
+
$message_data['assets']['scripts'] = array_filter( explode( '<script', ob_get_clean() ) );
|
998 |
+
}
|
999 |
+
|
1000 |
+
//TODO :: do_items if required
|
1001 |
+
$handles = ! empty( $wp_styles->queue ) ? array_diff( $wp_styles->queue, $q_style ) : array();
|
1002 |
+
unset( $q_style );
|
1003 |
+
if ( ! empty( $handles ) ) {
|
1004 |
+
if ( empty( $message_data['assets'] ) ) {
|
1005 |
+
$message_data['assets'] = array();
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
foreach ( $handles as $handle ) {
|
1009 |
+
ob_start();
|
1010 |
+
$wp_styles->do_item( $handle );
|
1011 |
+
$message_data['assets']['styles'][ $handle ] = ob_get_clean();
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
}
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
function enqueue_admin_styles_and_scripts() {
|
1018 |
+
|
1019 |
+
$screen = get_current_screen();
|
1020 |
+
if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_campaign' ), true ) ) {
|
1021 |
+
return;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
// Register scripts
|
1025 |
+
wp_register_script( 'icegram_writepanel', $this->plugin_url . '/assets/js/admin.min.js', array( 'jquery', 'wp-color-picker' ), $this->version );
|
1026 |
+
|
1027 |
+
wp_enqueue_script( 'icegram_writepanel' );
|
1028 |
+
|
1029 |
+
$icegram_writepanel_params = array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'search_message_nonce' => wp_create_nonce( "search-messages" ), 'home_url' => home_url( '/' ) );
|
1030 |
+
$this->available_headlines = apply_filters( 'icegram_available_headlines', array() );
|
1031 |
+
$icegram_writepanel_params = array_merge( $icegram_writepanel_params, array( 'available_headlines' => $this->available_headlines ) );
|
1032 |
+
|
1033 |
+
wp_localize_script( 'icegram_writepanel', 'icegram_writepanel_params', $icegram_writepanel_params );
|
1034 |
+
|
1035 |
+
wp_enqueue_style( 'dashicons' );
|
1036 |
+
wp_enqueue_style( 'wp-color-picker' );
|
1037 |
+
wp_enqueue_style( 'icegram_admin_styles', $this->plugin_url . '/assets/css/admin.min.css', array(), $this->version );
|
1038 |
+
|
1039 |
+
if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
|
1040 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
//execute shortcode in text widget
|
1046 |
+
function ig_widget_text_filter( $content ) {
|
1047 |
+
if ( ! preg_match( '/\[[\r\n\t ]*icegram?[\r\n\t ].*?\]/', $content ) ) {
|
1048 |
+
return $content;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
$content = do_shortcode( $content );
|
1052 |
+
|
1053 |
+
return $content;
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
public static function get_platform() {
|
1057 |
+
$mobile_detect = new Ig_Mobile_Detect();
|
1058 |
+
$mobile_detect->setUserAgent();
|
1059 |
+
if ( $mobile_detect->isMobile() ) {
|
1060 |
+
return ( $mobile_detect->isTablet() ) ? 'tablet' : 'mobile';
|
1061 |
+
} elseif ( $mobile_detect->isTablet() ) {
|
1062 |
+
return 'tablet';
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
return 'laptop';
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
function get_message_data( $message_ids = array(), $preview = false ) {
|
1069 |
+
global $wpdb;
|
1070 |
+
$message_data = array();
|
1071 |
+
$original_message_id_map = array();
|
1072 |
+
$meta_key = $preview ? 'icegram_message_preview_data' : 'icegram_message_data';
|
1073 |
+
$message_data_query = "SELECT post_id, meta_value FROM {$wpdb->prefix}postmeta WHERE meta_key LIKE '$meta_key'";
|
1074 |
+
if ( ! empty( $message_ids ) && is_array( $message_ids ) ) {
|
1075 |
+
// For WPML compatibility
|
1076 |
+
if ( function_exists( 'icl_object_id' ) ) {
|
1077 |
+
$wpml_settings = get_option( 'icl_sitepress_settings' );
|
1078 |
+
$original_if_missing = ( is_array( $wpml_settings ) && array_key_exists( 'show_untranslated_blog_posts', $wpml_settings ) && ! empty( $wpml_settings['show_untranslated_blog_posts'] ) ) ? true : false;
|
1079 |
+
|
1080 |
+
foreach ( $message_ids as $i => $id ) {
|
1081 |
+
$translated = icl_object_id( $id, 'ig_message', $original_if_missing );
|
1082 |
+
$message_ids[ $i ] = $translated;
|
1083 |
+
$original_message_id_map[ $translated ] = $id;
|
1084 |
+
}
|
1085 |
+
}
|
1086 |
+
$message_ids = array_filter( array_unique( $message_ids ) );
|
1087 |
+
if ( ! empty( $message_ids ) ) {
|
1088 |
+
$message_data_query .= " AND post_id IN ( " . implode( ',', $message_ids ) . " )";
|
1089 |
+
$message_data_results = $wpdb->get_results( $message_data_query, 'ARRAY_A' );
|
1090 |
+
foreach ( $message_data_results as $message_data_result ) {
|
1091 |
+
$data = maybe_unserialize( $message_data_result['meta_value'] );
|
1092 |
+
if ( ! empty( $data ) ) {
|
1093 |
+
$message_data[ $message_data_result['post_id'] ] = $data;
|
1094 |
+
// For WPML compatibility
|
1095 |
+
if ( ! empty( $original_message_id_map[ $message_data_result['post_id'] ] ) ) {
|
1096 |
+
$message_data[ $message_data_result['post_id'] ]['original_message_id'] = $original_message_id_map[ $message_data_result['post_id'] ];
|
1097 |
+
}
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
return $message_data;
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
function get_valid_messages( $message_ids = array(), $campaign_ids = array(), $preview_mode = false, $skip_others = false ) {
|
1107 |
+
list( $message_ids, $campaign_ids, $preview_mode, $skip_others ) = apply_filters( 'icegram_get_valid_messages_params', array( $message_ids, $campaign_ids, $preview_mode, $skip_others ) );
|
1108 |
+
|
1109 |
+
$valid_messages = $valid_campaigns = $message_campaign_map = array();
|
1110 |
+
|
1111 |
+
$campaign_ids = array_filter( array_unique( (array) $campaign_ids ) );
|
1112 |
+
$message_ids = array_filter( array_unique( (array) $message_ids ) );
|
1113 |
+
if ( ! empty( $campaign_ids ) ) {
|
1114 |
+
$valid_campaigns = $this->get_valid_campaigns( $campaign_ids, true, $preview_mode );
|
1115 |
+
}
|
1116 |
+
|
1117 |
+
// When skip_others is true, we won't load campaigns / messages from db
|
1118 |
+
if ( ! $skip_others && ! $preview_mode ) {
|
1119 |
+
$campaigns = $this->get_valid_campaigns();
|
1120 |
+
if ( ! empty( $campaigns ) ) {
|
1121 |
+
foreach ( $campaigns as $id => $campaign ) {
|
1122 |
+
if ( ! array_key_exists( $id, $valid_campaigns ) ) {
|
1123 |
+
$valid_campaigns[ $id ] = $campaign;
|
1124 |
+
}
|
1125 |
+
}
|
1126 |
+
}
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
// Create a map to look up campaign id for a given message
|
1130 |
+
if ( ! empty( $valid_campaigns ) ) {
|
1131 |
+
foreach ( $valid_campaigns as $id => $campaign ) {
|
1132 |
+
if ( $preview_mode ) {
|
1133 |
+
$campaign->messages = get_post_meta( $id, 'campaign_preview', true );
|
1134 |
+
}
|
1135 |
+
if ( ! empty( $campaign->messages ) ) {
|
1136 |
+
foreach ( $campaign->messages as $msg ) {
|
1137 |
+
$message_ids[] = $msg['id'];
|
1138 |
+
if ( ! array_key_exists( $msg['id'], $message_campaign_map ) ) {
|
1139 |
+
$message_campaign_map[ $msg['id'] ] = $id;
|
1140 |
+
}
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
}
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
// We don't display same message twice...
|
1147 |
+
$message_ids = array_unique( $message_ids );
|
1148 |
+
|
1149 |
+
if ( empty( $message_ids ) ) {
|
1150 |
+
return array();
|
1151 |
+
}
|
1152 |
+
$valid_messages = $this->get_message_data( $message_ids, $preview_mode );
|
1153 |
+
|
1154 |
+
foreach ( $valid_messages as $id => $message_data ) {
|
1155 |
+
// Remove message if required fields are missing
|
1156 |
+
if ( empty( $message_data ) || empty( $message_data['type'] ) ) {
|
1157 |
+
unset( $valid_messages[ $id ] );
|
1158 |
+
continue;
|
1159 |
+
}
|
1160 |
+
// Remove message if message type is uninstalled
|
1161 |
+
$class_name = 'Icegram_Message_Type_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $message_data['type'] ) ) );
|
1162 |
+
if ( ! class_exists( $class_name ) ) {
|
1163 |
+
unset( $valid_messages[ $id ] );
|
1164 |
+
continue;
|
1165 |
+
}
|
1166 |
+
$message_data['delay_time'] = 0;
|
1167 |
+
$message_data['retargeting'] = '';
|
1168 |
+
$message_data['campaign_id'] = ( $preview_mode ) ? $_REQUEST['campaign_preview_id'] : '';
|
1169 |
+
|
1170 |
+
// Pull display time and retargeting rule from campaign if possible
|
1171 |
+
$message_id = ( ! empty( $message_data['original_message_id'] ) ) ? $message_data['original_message_id'] : $id;
|
1172 |
+
if ( ! empty( $message_campaign_map[ $message_id ] ) ) {
|
1173 |
+
//modify campaign id
|
1174 |
+
$message_data['campaign_id'] = apply_filters( 'modify_campaing_id', $message_campaign_map[ $message_id ], $message_id );
|
1175 |
+
$campaign = $valid_campaigns[ floor( $message_data['campaign_id'] ) ];
|
1176 |
+
if ( ! empty( $campaign ) && $campaign instanceof Icegram_Campaign ) {
|
1177 |
+
$message_meta_from_campaign = $campaign->get_message_meta_by_id( $message_id );
|
1178 |
+
if ( ! empty( $message_meta_from_campaign['time'] ) ) {
|
1179 |
+
$message_data['delay_time'] = $message_meta_from_campaign['time'];
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
//check if campaign is targeted to mobile at zero
|
1183 |
+
$device_rule = $campaign->get_rule_value( 'device' );
|
1184 |
+
if ( $this->get_platform() !== 'laptop' && ! empty( $device_rule['mobile'] ) && $device_rule['mobile'] == 'yes' && $message_data['delay_time'] == 0 && $message_data['type'] == 'popup' ) {
|
1185 |
+
$message_data['ig_mobile_popup'] = true;
|
1186 |
+
if ( ! empty( $message_data['triggers'] ) && ! empty( $message_data['triggers']['when_to_show'] ) ) {
|
1187 |
+
$message_data['ig_mobile_popup'] = ( $message_data['triggers']['when_to_show'] == 'duration_on_page' && $message_data['triggers']['duration_on_page'] == 0 ) ? true : false;
|
1188 |
+
}
|
1189 |
+
}
|
1190 |
+
//set delay time -1 if shortcode with content
|
1191 |
+
foreach ( $this->shortcode_instances as $i => $value ) {
|
1192 |
+
$campaign_ids = explode( ',', $value['campaigns'] );
|
1193 |
+
if ( ! empty( $value['with_content'] ) && in_array( $message_data['campaign_id'], $campaign_ids ) ) {
|
1194 |
+
$message_data['delay_time'] = - 1;
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
+
$rule_value = $campaign->get_rule_value( 'retargeting' );
|
1198 |
+
$message_data['retargeting'] = ! empty( $rule_value['retargeting'] ) ? $rule_value['retargeting'] : '';
|
1199 |
+
$message_data['expiry_time'] = ! empty( $rule_value['retargeting'] ) ? $rule_value['expiry_time'] : '';
|
1200 |
+
$rule_value_retargeting_clicked = $campaign->get_rule_value( 'retargeting_clicked' );
|
1201 |
+
$message_data['retargeting_clicked'] = ! empty( $rule_value_retargeting_clicked['retargeting_clicked'] ) ? $rule_value_retargeting_clicked['retargeting_clicked'] : '';
|
1202 |
+
$message_data['expiry_time_clicked'] = ! empty( $rule_value_retargeting_clicked['retargeting_clicked'] ) ? $rule_value_retargeting_clicked['expiry_time_clicked'] : '';
|
1203 |
+
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
+
$valid_messages[ $id ] = $message_data;
|
1207 |
+
}
|
1208 |
+
$valid_messages = apply_filters( 'icegram_valid_messages', $valid_messages );
|
1209 |
+
|
1210 |
+
return $valid_messages;
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
function get_valid_campaigns( $campaign_ids = array(), $skip_page_check = false, $preview_mode = false ) {
|
1214 |
+
global $wpdb;
|
1215 |
+
if ( empty( $campaign_ids ) ) {
|
1216 |
+
$sql = "SELECT pm.post_id
|
1217 |
FROM {$wpdb->prefix}posts AS p
|
1218 |
LEFT JOIN {$wpdb->prefix}postmeta AS pm ON ( pm.post_id = p.ID )
|
1219 |
WHERE p.post_status = 'publish' ";
|
1220 |
+
// Filter handler within this file (and possibly others) will append to this SQL
|
1221 |
+
// and provide arguments for wpdb->prepare if needed.
|
1222 |
+
// First element in the array is SQL, remaining are values for placeholders in SQL
|
1223 |
+
$sql_params = apply_filters( 'icegram_get_valid_campaigns_sql', array( $sql ), array() );
|
1224 |
+
$campaign_ids = $wpdb->get_col( $wpdb->prepare( array_shift( $sql_params ), $sql_params ) );
|
1225 |
+
}
|
1226 |
+
$valid_campaigns = array();
|
1227 |
+
foreach ( (array) $campaign_ids as $campaign_id ) {
|
1228 |
+
$campaign = new Icegram_Campaign( $campaign_id );
|
1229 |
+
if ( $preview_mode || $campaign->is_valid( array( 'skip_page_check' => $skip_page_check ) ) ) {
|
1230 |
+
$valid_campaigns[ $campaign_id ] = $campaign;
|
1231 |
+
} else {
|
1232 |
+
// Campgain is invalid!
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
}
|
1236 |
+
$valid_campaigns = apply_filters( 'icegram_valid_campaigns', $valid_campaigns );
|
1237 |
+
|
1238 |
+
return $valid_campaigns;
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
function append_to_valid_campaigns_sql( $sql_params = array(), $options = array() ) {
|
1242 |
+
// Page check conditions
|
1243 |
+
//$pid = $_GET['page_id'];
|
1244 |
+
$pid = Icegram::get_current_page_id();
|
1245 |
+
$sql = " AND (
|
1246 |
pm.meta_key = 'icegram_campaign_target_rules' AND (
|
1247 |
( pm.meta_value LIKE '%%%s%%' )
|
1248 |
OR ( pm.meta_value LIKE '%%%s%%' AND pm.meta_value LIKE '%%%s%%' AND pm.meta_value LIKE '%%%s%%' )
|
1249 |
";
|
1250 |
+
$sql_params[] = 's:8:"sitewide";s:3:"yes";';
|
1251 |
+
$sql_params[] = 's:10:"other_page";s:3:"yes";';
|
1252 |
+
$sql_params[] = 's:7:"page_id";a:';
|
1253 |
+
$sql_params[] = serialize( (string) $pid );
|
1254 |
+
//local url
|
1255 |
+
$sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
|
1256 |
+
$sql_params[] = 's:9:"local_url";s:3:"yes";';
|
1257 |
+
if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
|
1258 |
+
$is_home = ( ! empty( $_REQUEST['is_home'] ) && $_REQUEST['is_home'] === 'true' ) ? true : false;
|
1259 |
+
} else {
|
1260 |
+
$is_home = ( is_home() || is_front_page() ) ? true : false;
|
1261 |
+
}
|
1262 |
+
if ( $is_home === true ) {
|
1263 |
+
$sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
|
1264 |
+
$sql_params[] = 's:8:"homepage";s:3:"yes";';
|
1265 |
+
}
|
1266 |
+
$sql .= " ) )";
|
1267 |
+
|
1268 |
+
$sql_params[0] .= $sql;
|
1269 |
+
|
1270 |
+
//s:9:"logged_in";s:3:"all";
|
1271 |
+
|
1272 |
+
return $sql_params;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
// Include all classes required for Icegram plugin
|
1276 |
+
function include_classes( $feedback_version ) {
|
1277 |
+
global $ig_tracker, $ig_feedback;
|
1278 |
+
$feedback_version_for_file = str_replace( '.', '-', $feedback_version );
|
1279 |
+
$t = 'classes/feedback/class-ig-tracker.php';
|
1280 |
+
$f = 'classes/feedback/class-ig-feedback.php';
|
1281 |
+
require_once( $t );
|
1282 |
+
require_once( $f );
|
1283 |
+
require_once( 'classes/feedback.php' );
|
1284 |
+
|
1285 |
+
$ig_feedback_class = 'IG_Feedback_V_' . str_replace( '.', '_', $feedback_version );
|
1286 |
+
$ig_feedback = new $ig_feedback_class( 'Icegram', 'icegram', 'ig', 'igfree.', false );
|
1287 |
+
|
1288 |
+
$classes = glob( $this->plugin_path . '/classes/*.php' );
|
1289 |
+
foreach ( $classes as $file ) {
|
1290 |
+
// Files with 'admin' in their name are included only for admin section
|
1291 |
+
if ( is_file( $file ) && ( ( strpos( $file, '-admin' ) >= 0 && is_admin() ) ) ) {
|
1292 |
+
$all_active_plugins = $ig_tracker::get_plugins();
|
1293 |
+
if ( ( strpos( $file, 'ig-upsale-admin.php' ) !== false ) && in_array( 'icegram-engage/icegram-engage.php', $all_active_plugins ) ) {
|
1294 |
+
continue;
|
1295 |
+
}
|
1296 |
+
include_once $file;
|
1297 |
+
} elseif ( ! is_admin() ) {
|
1298 |
+
include_once $file;
|
1299 |
+
}
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
// Load built in message types
|
1303 |
+
$icegram_message_type_basedirs = glob( $this->plugin_path . '/message-types/*' );
|
1304 |
+
// Allow other plugins to add new message types
|
1305 |
+
$icegram_message_type_basedirs = apply_filters( 'icegram_message_type_basedirs', $icegram_message_type_basedirs );
|
1306 |
+
// Set up different message type classes
|
1307 |
+
foreach ( $icegram_message_type_basedirs as $dir ) {
|
1308 |
+
$type = basename( $dir );
|
1309 |
+
$class_file = $dir . "/main.php";
|
1310 |
+
if ( is_file( $class_file ) ) {
|
1311 |
+
include_once( $class_file );
|
1312 |
+
}
|
1313 |
+
$class_name = 'Icegram_Message_Type_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $type ) ) );
|
1314 |
+
if ( class_exists( $class_name ) ) {
|
1315 |
+
$this->message_type_objs[ $type ] = new $class_name();
|
1316 |
+
}
|
1317 |
+
}
|
1318 |
+
do_action( 'ig_file_include' );
|
1319 |
+
$this->message_types = apply_filters( 'icegram_message_types', array() );
|
1320 |
+
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
// Register Campaign post type
|
1324 |
+
function register_campaign_post_type() {
|
1325 |
+
$labels = array(
|
1326 |
+
'name' => __( 'Campaigns', 'icegram' ),
|
1327 |
+
'singular_name' => __( 'Campaign', 'icegram' ),
|
1328 |
+
'add_new' => __( 'Add New Campaign', 'icegram' ),
|
1329 |
+
'add_new_item' => __( 'Add New Campaign', 'icegram' ),
|
1330 |
+
'edit_item' => __( 'Edit Campaign', 'icegram' ),
|
1331 |
+
'new_item' => __( 'New Campaign', 'icegram' ),
|
1332 |
+
'all_items' => __( 'Campaigns', 'icegram' ),
|
1333 |
+
'view_item' => __( 'View Campaign', 'icegram' ),
|
1334 |
+
'search_items' => __( 'Search Campaigns', 'icegram' ),
|
1335 |
+
'not_found' => __( 'No campaigns found', 'icegram' ),
|
1336 |
+
'not_found_in_trash' => __( 'No campaigns found in Trash', 'icegram' ),
|
1337 |
+
'parent_item_colon' => __( '', 'icegram' ),
|
1338 |
+
'menu_name' => __( 'Icegram', 'icegram' )
|
1339 |
+
);
|
1340 |
+
|
1341 |
+
$args = array(
|
1342 |
+
'labels' => $labels,
|
1343 |
+
// 'menu_icon' => 'dashicons-info',
|
1344 |
+
'public' => false,
|
1345 |
+
'publicly_queryable' => false,
|
1346 |
+
'show_ui' => true,
|
1347 |
+
'show_in_menu' => true,
|
1348 |
+
'query_var' => true,
|
1349 |
+
'rewrite' => array( 'slug' => 'ig_campaign' ),
|
1350 |
+
'capability_type' => 'post',
|
1351 |
+
'has_archive' => false,
|
1352 |
+
'hierarchical' => false,
|
1353 |
+
'menu_position' => null,
|
1354 |
+
'menu_icon' => $this->plugin_url . '/assets/images/icegram-logo-branding-18-white.png',
|
1355 |
+
'supports' => array( 'title', 'editor' )
|
1356 |
+
);
|
1357 |
+
|
1358 |
+
register_post_type( 'ig_campaign', $args );
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
// Register Message post type
|
1362 |
+
function register_message_post_type() {
|
1363 |
+
$labels = array(
|
1364 |
+
'name' => __( 'Messages', 'icegram' ),
|
1365 |
+
'singular_name' => __( 'Message', 'icegram' ),
|
1366 |
+
'add_new' => __( 'Create New', 'icegram' ),
|
1367 |
+
'add_new_item' => __( 'Create New Message', 'icegram' ),
|
1368 |
+
'edit_item' => __( 'Edit Message', 'icegram' ),
|
1369 |
+
'new_item' => __( 'New Message', 'icegram' ),
|
1370 |
+
'all_items' => __( 'Messages', 'icegram' ),
|
1371 |
+
'view_item' => __( 'View Message', 'icegram' ),
|
1372 |
+
'search_items' => __( 'Search Messages', 'icegram' ),
|
1373 |
+
'not_found' => __( 'No messages found', 'icegram' ),
|
1374 |
+
'not_found_in_trash' => __( 'No messages found in Trash', 'icegram' ),
|
1375 |
+
'parent_item_colon' => __( '', 'icegram' ),
|
1376 |
+
'menu_name' => __( 'Messages', 'icegram' )
|
1377 |
+
);
|
1378 |
+
|
1379 |
+
$args = array(
|
1380 |
+
'labels' => $labels,
|
1381 |
+
'public' => false,
|
1382 |
+
'publicly_queryable' => false,
|
1383 |
+
'show_ui' => true,
|
1384 |
+
'show_in_menu' => 'edit.php?post_type=ig_campaign',
|
1385 |
+
'query_var' => true,
|
1386 |
+
'rewrite' => array( 'slug' => 'ig_message' ),
|
1387 |
+
'capability_type' => 'post',
|
1388 |
+
'has_archive' => false,
|
1389 |
+
'hierarchical' => false,
|
1390 |
+
'menu_position' => null,
|
1391 |
+
'supports' => array( 'title' )
|
1392 |
+
);
|
1393 |
+
|
1394 |
+
register_post_type( 'ig_message', $args );
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
|
1398 |
+
function import( $data = array() ) {
|
1399 |
+
if ( empty( $data['campaigns'] ) && empty( $data['messages'] ) ) {
|
1400 |
+
return;
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
$default_theme = $default_type = '';
|
1404 |
+
$first_message_type = current( $this->message_types );
|
1405 |
+
|
1406 |
+
if ( is_array( $first_message_type ) ) {
|
1407 |
+
$default_type = $first_message_type['type'];
|
1408 |
+
if ( ! empty( $first_message_type['themes'] ) ) {
|
1409 |
+
$default_theme = key( $first_message_type['themes'] );
|
1410 |
+
}
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
$new_campaign_ids = array();
|
1414 |
+
foreach ( (array) $data['campaigns'] as $campaign ) {
|
1415 |
+
|
1416 |
+
$args = array(
|
1417 |
+
'post_content' => ( ! empty( $campaign['post_content'] ) ) ? esc_attr( $campaign['post_content'] ) : '',
|
1418 |
+
'post_name' => ( ! empty( $campaign['post_title'] ) ) ? sanitize_title( $campaign['post_title'] ) : '',
|
1419 |
+
'post_title' => ( ! empty( $campaign['post_title'] ) ) ? $campaign['post_title'] : '',
|
1420 |
+
// 'post_status' => ( !empty( $campaign['post_status'] ) ) ? $campaign['post_status'] : 'draft',
|
1421 |
+
'post_status' => 'draft',
|
1422 |
+
'post_type' => 'ig_campaign'
|
1423 |
+
);
|
1424 |
+
|
1425 |
+
$new_campaign_id = wp_insert_post( $args );
|
1426 |
+
$new_campaign_ids[] = $new_campaign_id;
|
1427 |
+
|
1428 |
+
if ( ! empty( $campaign['target_rules'] ) ) {
|
1429 |
+
|
1430 |
+
$defaults = array(
|
1431 |
+
'homepage' => 'yes',
|
1432 |
+
'when' => 'always',
|
1433 |
+
'from' => '',
|
1434 |
+
'to' => '',
|
1435 |
+
'mobile' => 'yes',
|
1436 |
+
'tablet' => 'yes',
|
1437 |
+
'laptop' => 'yes',
|
1438 |
+
'logged_in' => 'all'
|
1439 |
+
);
|
1440 |
+
|
1441 |
+
$target_rules = wp_parse_args( $campaign['target_rules'], $defaults );
|
1442 |
+
update_post_meta( $new_campaign_id, 'icegram_campaign_target_rules', $target_rules );
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
if ( ! empty( $campaign['messages'] ) ) {
|
1446 |
+
|
1447 |
+
$messages = array();
|
1448 |
+
|
1449 |
+
foreach ( $campaign['messages'] as $message ) {
|
1450 |
+
|
1451 |
+
if ( ! is_array( $message ) ) {
|
1452 |
+
continue;
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
$args = array(
|
1456 |
+
'post_content' => ( ! empty( $message['message'] ) ) ? esc_attr( $message['message'] ) : '',
|
1457 |
+
'post_name' => ( ! empty( $message['post_title'] ) ) ? sanitize_title( $message['post_title'] ) : '',
|
1458 |
+
'post_title' => ( ! empty( $message['post_title'] ) ) ? $message['post_title'] : '',
|
1459 |
+
'post_status' => ( ! empty( $message['post_status'] ) ) ? $message['post_status'] : 'publish',
|
1460 |
+
'post_type' => 'ig_message'
|
1461 |
+
);
|
1462 |
+
|
1463 |
+
$new_message_id = wp_insert_post( $args );
|
1464 |
+
$new_message = array(
|
1465 |
+
'id' => $new_message_id,
|
1466 |
+
'time' => ( ! empty( $message['time'] ) ) ? $message['time'] : 0
|
1467 |
+
);
|
1468 |
+
//for gallery + CTA another message
|
1469 |
+
if ( ! empty( $message['cta'] ) && $message['cta'] == 'cta_another_message' && ! empty( $message['cta_linked_message_id'] ) && $message['cta_linked_message_id'] == 'auto' ) {
|
1470 |
+
$prev_message = end( $messages );
|
1471 |
+
$message['cta_linked_message_id'] = $prev_message['id'];
|
1472 |
+
array_pop( $messages );
|
1473 |
+
}
|
1474 |
+
$messages[] = $new_message;
|
1475 |
+
|
1476 |
+
unset( $message['post_content'] );
|
1477 |
+
unset( $message['time'] );
|
1478 |
+
|
1479 |
+
$message['id'] = $new_message_id;
|
1480 |
+
|
1481 |
+
$defaults = array(
|
1482 |
+
'post_title' => '',
|
1483 |
+
'type' => $default_type,
|
1484 |
+
'theme' => $default_theme,
|
1485 |
+
'animation' => '',
|
1486 |
+
'headline' => '',
|
1487 |
+
'label' => '',
|
1488 |
+
'link' => '',
|
1489 |
+
'icon' => '',
|
1490 |
+
'message' => '',
|
1491 |
+
'position' => '',
|
1492 |
+
'text_color' => '#000000',
|
1493 |
+
'bg_color' => '#ffffff',
|
1494 |
+
'custom_code' => '',
|
1495 |
+
'id' => ''
|
1496 |
+
);
|
1497 |
+
$icegram_message_data = wp_parse_args( $message, $defaults );
|
1498 |
+
if ( ! empty( $icegram_message_data ) ) {
|
1499 |
+
update_post_meta( $new_message_id, 'icegram_message_data', $icegram_message_data );
|
1500 |
+
update_post_meta( $new_message_id, 'icegram_message_preview_data', $icegram_message_data );
|
1501 |
+
}
|
1502 |
+
}//foreach
|
1503 |
+
|
1504 |
+
if ( ! empty( $campaign['messages'] ) ) {
|
1505 |
+
update_post_meta( $new_campaign_id, 'messages', $messages );
|
1506 |
+
update_post_meta( $new_campaign_id, 'campaign_preview', $messages );
|
1507 |
+
}
|
1508 |
+
}//if
|
1509 |
+
}
|
1510 |
+
|
1511 |
+
return $new_campaign_ids;
|
1512 |
+
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
function import_gallery_item() {
|
1516 |
+
if ( ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'fetch_messages' && ! empty( $_REQUEST['campaign_id'] ) && ! empty( $_REQUEST['gallery_item'] ) ) {
|
1517 |
+
$url = 'https://www.icegram.com/gallery/wp-admin/admin-ajax.php?utm_source=ig_inapp&utm_campaign=ig_gallery&utm_medium=' . $_REQUEST['campaign_id'];
|
1518 |
+
$params = $_REQUEST;
|
1519 |
+
$imported_gallery_items = array();
|
1520 |
+
$options = array(
|
1521 |
+
'timeout' => 15,
|
1522 |
+
'method' => 'POST',
|
1523 |
+
'body' => http_build_query( $params )
|
1524 |
+
);
|
1525 |
+
$response = wp_remote_request( $url, $options );
|
1526 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
1527 |
+
if ( $response_code == 200 ) {
|
1528 |
+
$new_campaign_ids = $this->import( json_decode( $response['body'], true ) );
|
1529 |
+
if ( ! empty( $new_campaign_ids ) ) {
|
1530 |
+
$imported_gallery_items = get_option( 'ig_imported_gallery_items' );
|
1531 |
+
$imported_gallery_items[] = $_REQUEST['campaign_id'];
|
1532 |
+
update_option( 'ig_imported_gallery_items', $imported_gallery_items );
|
1533 |
+
$location = admin_url( 'post.php?post=' . $new_campaign_ids[0] . '&action=edit' );
|
1534 |
+
header( 'Location:' . $location );
|
1535 |
+
exit;
|
1536 |
+
} else {
|
1537 |
+
wp_safe_redirect( $_SERVER['HTTP_REFERER'] );
|
1538 |
+
}
|
1539 |
+
}
|
1540 |
+
}
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
function import_sample_data( $data = array() ) {
|
1544 |
+
$new_campaign_ids = $this->import( $data );
|
1545 |
+
if ( ! empty( $new_campaign_ids ) ) {
|
1546 |
+
update_option( 'icegram_sample_data_imported', $new_campaign_ids );
|
1547 |
+
}
|
1548 |
+
}
|
1549 |
+
|
1550 |
+
|
1551 |
+
function get_sample_data() {
|
1552 |
+
|
1553 |
+
return array(
|
1554 |
+
'campaigns' => array(
|
1555 |
+
array(
|
1556 |
+
'post_name' => '',
|
1557 |
+
'post_title' => 'My First Icegram Campaign',
|
1558 |
+
'target_rules' => array(
|
1559 |
+
'homepage' => 'yes',
|
1560 |
+
'when' => 'always',
|
1561 |
+
'from' => '',
|
1562 |
+
'to' => '',
|
1563 |
+
'mobile' => 'yes',
|
1564 |
+
'tablet' => 'yes',
|
1565 |
+
'laptop' => 'yes',
|
1566 |
+
'logged_in' => 'all'
|
1567 |
+
),
|
1568 |
+
'messages' => array(
|
1569 |
+
array(
|
1570 |
+
'post_title' => 'Get 2x more Contacts with Your Website',
|
1571 |
+
'post_status' => 'publish',
|
1572 |
+
'time' => '0',
|
1573 |
+
'type' => 'action-bar',
|
1574 |
+
'theme' => 'hello',
|
1575 |
+
'headline' => 'Get 2x more Contacts with Your Website',
|
1576 |
+
'label' => 'Show Me How',
|
1577 |
+
'link' => '',
|
1578 |
+
'icon' => '',
|
1579 |
+
'message' => 'Instant Results Guaranteed',
|
1580 |
+
'position' => '01',
|
1581 |
+
'text_color' => '#000000',
|
1582 |
+
'bg_color' => '#eb593c'
|
1583 |
+
),
|
1584 |
+
array(
|
1585 |
+
'post_title' => '20% Off Coupon',
|
1586 |
+
'post_status' => 'publish',
|
1587 |
+
'time' => '4',
|
1588 |
+
'type' => 'messenger',
|
1589 |
+
'theme' => 'social',
|
1590 |
+
'animation' => 'slide',
|
1591 |
+
'headline' => '20% Off - for you',
|
1592 |
+
'label' => '',
|
1593 |
+
'link' => '',
|
1594 |
+
'icon' => '',
|
1595 |
+
'message' => "Hey there! We are running a <strong>special 20% off this week</strong> for registered users - like you.
|
1596 |
|
1597 |
Use coupon <code>LOYALTY20</code> during checkout.",
|
1598 |
+
'position' => '22',
|
1599 |
+
'text_color' => '#000000',
|
1600 |
+
'bg_color' => '#ffffff'
|
1601 |
+
),
|
1602 |
+
array(
|
1603 |
+
'post_title' => 'How this blog makes over $34,800 / month for FREE.',
|
1604 |
+
'post_status' => 'publish',
|
1605 |
+
'time' => '10',
|
1606 |
+
'type' => 'popup',
|
1607 |
+
'theme' => 'air-mail',
|
1608 |
+
'headline' => 'How this blog makes over $34,800 / month for FREE.',
|
1609 |
+
'label' => 'FREE INSTANT ACCESS',
|
1610 |
+
'link' => '',
|
1611 |
+
'icon' => '',
|
1612 |
+
'message' => "This website earns over $30,000 every month, every single month, almost on autopilot. I have 4 other sites with similar results. All I do is publish new regular content every week.
|
1613 |
|
1614 |
<strong>Download my free kit to learn how I do this.</strong>
|
1615 |
|
1620 |
<li>Resources and tips to get started quickly</li>
|
1621 |
<li>Private members club to connect with fellow owners</li>
|
1622 |
</ul>",
|
1623 |
+
'text_color' => '#000000',
|
1624 |
+
'bg_color' => '#ffffff'
|
1625 |
+
|
1626 |
+
),
|
1627 |
+
array(
|
1628 |
+
'post_title' => 'Exclusive Marketing Report',
|
1629 |
+
'post_status' => 'publish',
|
1630 |
+
'time' => '6',
|
1631 |
+
'type' => 'toast',
|
1632 |
+
'theme' => 'stand-out',
|
1633 |
+
'animation' => 'pop',
|
1634 |
+
'headline' => 'Exclusive Marketing Report',
|
1635 |
+
'label' => '',
|
1636 |
+
'link' => '',
|
1637 |
+
'icon' => '',
|
1638 |
+
'message' => 'FREE for every subscriber. Click here to download it.',
|
1639 |
+
'position' => '02',
|
1640 |
+
'text_color' => '#000000',
|
1641 |
+
'bg_color' => '#ffffff'
|
1642 |
+
)
|
1643 |
+
|
1644 |
+
)
|
1645 |
+
)
|
1646 |
+
)
|
1647 |
+
);
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
function remove_preview_button() {
|
1651 |
+
global $post_type;
|
1652 |
+
if ( $post_type == 'ig_message' || $post_type == 'ig_campaign' ) {
|
1653 |
+
?>
|
1654 |
+
<style type="text/css">
|
1655 |
+
#message.updated.below-h2 {
|
1656 |
+
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1657 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
|
1659 |
+
#preview-action {
|
1660 |
+
display: none;
|
1661 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1662 |
|
1663 |
+
/*Remove add new campaign and message*/
|
1664 |
+
.page-title-action {
|
1665 |
+
display: none;
|
1666 |
+
}
|
1667 |
+
</style>
|
1668 |
+
<?php
|
1669 |
+
}
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
|
1673 |
+
function remove_row_actions( $actions, $post ) {
|
1674 |
+
|
1675 |
+
if ( empty( $post->post_type ) || ( $post->post_type != 'ig_campaign' && $post->post_type != 'ig_message' ) ) {
|
1676 |
+
return $actions;
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
unset( $actions['inline hide-if-no-js'] );
|
1680 |
+
unset( $actions['view'] );
|
1681 |
+
|
1682 |
+
return $actions;
|
1683 |
+
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
function identify_current_page() {
|
1687 |
+
global $post, $wpdb;
|
1688 |
+
|
1689 |
+
$obj = get_queried_object();
|
1690 |
+
$id = 0;
|
1691 |
+
if ( ! empty( $obj->has_archive ) ) {
|
1692 |
+
$sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s ", array( $obj->has_archive, 'page' ) );
|
1693 |
+
$id = $wpdb->get_var( $sql );
|
1694 |
+
} elseif ( is_object( $post ) && isset( $post->ID ) ) {
|
1695 |
+
$id = $post->ID;
|
1696 |
+
}
|
1697 |
+
$id = apply_filters( 'icegram_identify_current_page', $id );
|
1698 |
+
self::$current_page_id = $id;
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
static function get_current_page_id() {
|
1702 |
+
global $post;
|
1703 |
+
if ( ! empty( $_REQUEST['page_id'] ) && is_numeric( $_REQUEST['page_id'] ) ) {
|
1704 |
+
$post = get_post( $_REQUEST['page_id'] );
|
1705 |
+
setup_postdata( $post );
|
1706 |
+
// WPML check
|
1707 |
+
$id = apply_filters( 'icegram_identify_current_page', $post->ID );
|
1708 |
+
self::$current_page_id = $id;
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
return self::$current_page_id;
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
static function get_current_page_url() {
|
1715 |
+
if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
|
1716 |
+
$pageURL = ( ! empty( $_REQUEST['referral_url'] ) ) ? $_REQUEST['referral_url'] : '';
|
1717 |
+
} else {
|
1718 |
+
$pageURL = 'http';
|
1719 |
+
if ( isset( $_SERVER["HTTPS"] ) ) {
|
1720 |
+
if ( $_SERVER["HTTPS"] == "on" ) {
|
1721 |
+
$pageURL .= "s";
|
1722 |
+
}
|
1723 |
+
}
|
1724 |
+
$pageURL .= "://";
|
1725 |
+
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
1726 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
1727 |
+
} else {
|
1728 |
+
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
return $pageURL;
|
1733 |
+
}
|
1734 |
+
|
1735 |
+
function wpml_get_parent_id( $id ) {
|
1736 |
+
global $post;
|
1737 |
+
if ( function_exists( 'icl_object_id' ) && function_exists( 'icl_get_default_language' ) ) {
|
1738 |
+
$id = icl_object_id( $id, $post->post_type, true, icl_get_default_language() );
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
return $id;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
|
1745 |
+
/**
|
1746 |
+
* Our implementation of wpautop to preserve script and style tags
|
1747 |
+
*/
|
1748 |
+
function before_wpautop( $pee ) {
|
1749 |
+
if ( trim( $pee ) === '' ) {
|
1750 |
+
$this->_wpautop_tags = array();
|
1751 |
+
|
1752 |
+
return '';
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
$tags = array();
|
1756 |
+
// Pull out tags and add placeholders
|
1757 |
+
list( $pee, $tags['pre'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'pre' );
|
1758 |
+
list( $pee, $tags['script'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'script' );
|
1759 |
+
list( $pee, $tags['style'] ) = $this->_wpautop_add_tag_placeholders( $pee, 'style' );
|
1760 |
+
$this->_wpautop_tags = $tags;
|
1761 |
+
|
1762 |
+
if ( ! empty( $pre_tags ) ) {
|
1763 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $pre_tags );
|
1764 |
+
}
|
1765 |
+
if ( ! empty( $script_tags ) ) {
|
1766 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $script_tags );
|
1767 |
+
}
|
1768 |
+
if ( ! empty( $style_tags ) ) {
|
1769 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $style_tags );
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
return $pee;
|
1773 |
+
}
|
1774 |
+
|
1775 |
+
function after_wpautop( $pee ) {
|
1776 |
+
if ( trim( $pee ) === '' || empty( $this->_wpautop_tags ) ) {
|
1777 |
+
return '';
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
// Replace placeholders with original content
|
1781 |
+
if ( ! empty( $this->_wpautop_tags['pre'] ) ) {
|
1782 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['pre'] );
|
1783 |
+
}
|
1784 |
+
if ( ! empty( $this->_wpautop_tags['script'] ) ) {
|
1785 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['script'] );
|
1786 |
+
}
|
1787 |
+
if ( ! empty( $this->_wpautop_tags['style'] ) ) {
|
1788 |
+
$pee = $this->_wpautop_replace_tag_placeholders( $pee, $this->_wpautop_tags['style'] );
|
1789 |
+
}
|
1790 |
+
|
1791 |
+
$this->_wpautop_tags = array();
|
1792 |
+
|
1793 |
+
return $pee;
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
function _wpautop_add_tag_placeholders( $pee, $tag ) {
|
1797 |
+
$tags = array();
|
1798 |
+
|
1799 |
+
if ( false !== strpos( $pee, "<{$tag}" ) ) {
|
1800 |
+
$pee_parts = explode( "</{$tag}>", $pee );
|
1801 |
+
$last_pee = array_pop( $pee_parts );
|
1802 |
+
$pee = '';
|
1803 |
+
$i = 0;
|
1804 |
+
|
1805 |
+
foreach ( $pee_parts as $pee_part ) {
|
1806 |
+
$start = strpos( $pee_part, "<{$tag}" );
|
1807 |
+
|
1808 |
+
// Malformed html?
|
1809 |
+
if ( false === $start ) {
|
1810 |
+
$pee .= $pee_part;
|
1811 |
+
continue;
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
$name = "<{$tag} wp-{$tag}-tag-$i></{$tag}>";
|
1815 |
+
$tags[ $name ] = substr( $pee_part, $start ) . "</{$tag}>";
|
1816 |
+
|
1817 |
+
$pee .= substr( $pee_part, 0, $start ) . $name;
|
1818 |
+
$i ++;
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
$pee .= $last_pee;
|
1822 |
+
}
|
1823 |
+
|
1824 |
+
return array( $pee, $tags );
|
1825 |
+
}
|
1826 |
+
|
1827 |
+
function _wpautop_replace_tag_placeholders( $pee, $tags ) {
|
1828 |
+
if ( ! empty( $tags ) ) {
|
1829 |
+
$pee = str_replace( array_keys( $tags ), array_values( $tags ), $pee );
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
return $pee;
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
static function duplicate_in_db( $original_id ) {
|
1836 |
+
// Get access to the database
|
1837 |
+
global $wpdb;
|
1838 |
+
// Get the post as an array
|
1839 |
+
$duplicate = get_post( $original_id, 'ARRAY_A' );
|
1840 |
+
// Modify some of the elements
|
1841 |
+
$duplicate['post_title'] = $duplicate['post_title'] . ' ' . __( 'Copy', 'icegram' );
|
1842 |
+
$duplicate['post_status'] = 'draft';
|
1843 |
+
// Set the post date
|
1844 |
+
$timestamp = current_time( 'timestamp', 0 );
|
1845 |
+
|
1846 |
+
$duplicate['post_date'] = date( 'Y-m-d H:i:s', $timestamp );
|
1847 |
+
|
1848 |
+
// Remove some of the keys
|
1849 |
+
unset( $duplicate['ID'] );
|
1850 |
+
unset( $duplicate['guid'] );
|
1851 |
+
unset( $duplicate['comment_count'] );
|
1852 |
+
|
1853 |
+
// Insert the post into the database
|
1854 |
+
$duplicate_id = wp_insert_post( $duplicate );
|
1855 |
+
|
1856 |
+
// Duplicate all taxonomies/terms
|
1857 |
+
$taxonomies = get_object_taxonomies( $duplicate['post_type'] );
|
1858 |
+
|
1859 |
+
foreach ( $taxonomies as $taxonomy ) {
|
1860 |
+
$terms = wp_get_post_terms( $original_id, $taxonomy, array( 'fields' => 'names' ) );
|
1861 |
+
wp_set_object_terms( $duplicate_id, $terms, $taxonomy );
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
// Duplicate all custom fields
|
1865 |
+
$custom_fields = get_post_custom( $original_id );
|
1866 |
+
foreach ( $custom_fields as $key => $value ) {
|
1867 |
+
if ( $key === 'messages' ) {
|
1868 |
+
$messages = unserialize( $value[0] );
|
1869 |
+
foreach ( $messages as &$message ) {
|
1870 |
+
$clone_msg_id = Icegram::duplicate_in_db( $message['id'] );
|
1871 |
+
$message['id'] = $clone_msg_id;
|
1872 |
+
}
|
1873 |
+
$value[0] = serialize( $messages );
|
1874 |
+
}
|
1875 |
+
add_post_meta( $duplicate_id, $key, maybe_unserialize( $value[0] ) );
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
return $duplicate_id;
|
1879 |
+
}
|
1880 |
+
|
1881 |
+
static function duplicate( $original_id ) {
|
1882 |
+
$duplicate_id = Icegram::duplicate_in_db( $original_id );
|
1883 |
+
$location = admin_url( 'post.php?post=' . $duplicate_id . '&action=edit' );
|
1884 |
+
header( 'Location:' . $location );
|
1885 |
+
exit;
|
1886 |
+
}
|
1887 |
+
|
1888 |
+
public static function form_submission_validate_request( $request_data ) {
|
1889 |
+
if ( ! empty( $request_data ) ) {
|
1890 |
+
// Check for Remote Rainmaker form submission request
|
1891 |
+
$request_data['ig_is_remote'] = false;
|
1892 |
+
$request_data['is_remote'] = false;
|
1893 |
+
if ( ! empty( $request_data['ig_mode'] ) && $request_data['ig_mode'] === 'remote' ) {
|
1894 |
+
$ig_remote_url = $request_data['ig_remote_url'];
|
1895 |
+
if ( ! empty( $request_data['ig_campaign_id'] ) ) {
|
1896 |
+
$rules = get_post_meta( $request_data['ig_campaign_id'], 'icegram_campaign_target_rules', true );
|
1897 |
+
if ( ! empty( $rules['remote_urls'] ) && is_array( $rules['remote_urls'] ) ) {
|
1898 |
+
foreach ( $rules['remote_urls'] as $remote_url_pattern ) {
|
1899 |
+
$valid = Icegram_Campaign::is_valid_url( $remote_url_pattern, $ig_remote_url );
|
1900 |
+
if ( $valid ) {
|
1901 |
+
$request_data['ig_is_remote'] = true;
|
1902 |
+
$request_data['is_remote'] = true;
|
1903 |
+
break;
|
1904 |
+
}
|
1905 |
+
}
|
1906 |
+
//TODO :: discard the the remote request and data
|
1907 |
+
// if($request_data['ig_is_remote'] == false){
|
1908 |
+
// return array();
|
1909 |
+
// }
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
}
|
1913 |
+
}
|
1914 |
+
}
|
1915 |
+
|
1916 |
+
return $request_data;
|
1917 |
+
}
|
1918 |
+
|
1919 |
+
public static function get_ig_meta_info() {
|
1920 |
+
$total_campaigns = wp_count_posts( 'ig_campaign' );
|
1921 |
+
$total_campaigns_publish = $total_campaigns->publish;
|
1922 |
+
$total_campaigns_draft = $total_campaigns->draft;
|
1923 |
+
|
1924 |
+
$meta_info = array(
|
1925 |
+
'total_campaigns_publish' => $total_campaigns_publish,
|
1926 |
+
'total_campaigns_draft' => $total_campaigns_draft,
|
1927 |
+
);
|
1928 |
+
|
1929 |
+
return $meta_info;
|
1930 |
+
}
|
1931 |
}
|
1932 |
|
|
|
1933 |
function initialize_icegram() {
|
1934 |
+
global $icegram;
|
1935 |
+
// i18n / l10n - load translations
|
1936 |
+
load_plugin_textdomain( 'icegram', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
|
1937 |
|
1938 |
+
$icegram = new Icegram();
|
|
|
1939 |
|
1940 |
+
do_action( 'icegram_loaded' );
|
|
|
1941 |
}
|
1942 |
|
1943 |
add_action( 'plugins_loaded', 'initialize_icegram' );
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Popups, Welcome Bar, Optins and Lead Generation Plugin - Icegram ===
|
2 |
-
Contributors: icegram, storeapps, niravmehta, sandhyam, putler
|
3 |
Donate link: https://www.icegram.com/
|
4 |
Tags: popup, wordpress popups,Exit-popup, optin-popup, popups, hellobar, optin, 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.3
|
7 |
-
Stable tag: 1.10.
|
8 |
License: GPLv3
|
9 |
|
10 |
The best WP popup plugin that let's 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.
|
@@ -217,6 +217,9 @@ Contact Us, provide as much detail of the problem as you can. We will try to sol
|
|
217 |
5. Target your Icegram message using these display rules
|
218 |
|
219 |
== Upgrade Notice ==
|
|
|
|
|
|
|
220 |
= 1.10.35 =
|
221 |
Security Fixes
|
222 |
|
@@ -483,14 +486,18 @@ Initial Release
|
|
483 |
|
484 |
|
485 |
== Changelog ==
|
|
|
|
|
|
|
|
|
486 |
= 1.10.35 =
|
487 |
* Fix: Security issues
|
488 |
|
489 |
= 1.10.34 =
|
490 |
-
Added Black Friday Cyber Monday Gallery Items
|
491 |
|
492 |
= 1.10.33 =
|
493 |
-
* Enhancement: Revised Gallery Templates for
|
494 |
|
495 |
= 1.10.32 =
|
496 |
* New: Added featured gallery items
|
1 |
=== Popups, Welcome Bar, Optins and Lead Generation Plugin - Icegram ===
|
2 |
+
Contributors: icegram, storeapps, niravmehta, sandhyam, malayladu, putler
|
3 |
Donate link: https://www.icegram.com/
|
4 |
Tags: popup, wordpress popups,Exit-popup, optin-popup, popups, hellobar, optin, 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.3
|
7 |
+
Stable tag: 1.10.36
|
8 |
License: GPLv3
|
9 |
|
10 |
The best WP popup plugin that let's 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.
|
217 |
5. Target your Icegram message using these display rules
|
218 |
|
219 |
== Upgrade Notice ==
|
220 |
+
= 1.10.36 =
|
221 |
+
Added Christmas Gallery Items
|
222 |
+
|
223 |
= 1.10.35 =
|
224 |
Security Fixes
|
225 |
|
486 |
|
487 |
|
488 |
== Changelog ==
|
489 |
+
= 1.10.36 =
|
490 |
+
* Fix: Form color field was not rendering properly
|
491 |
+
* Enhancement: Added Christmas Gallery Items
|
492 |
+
|
493 |
= 1.10.35 =
|
494 |
* Fix: Security issues
|
495 |
|
496 |
= 1.10.34 =
|
497 |
+
* Added Black Friday Cyber Monday Gallery Items
|
498 |
|
499 |
= 1.10.33 =
|
500 |
+
* Enhancement: Revised Gallery Templates for Halloween
|
501 |
|
502 |
= 1.10.32 =
|
503 |
* New: Added featured gallery items
|