PluginProbe
Icegram Engage – Popups, Optins, CTAs & Lead Generation / 3.1.34
Icegram Engage – Popups, Optins, CTAs & Lead Generation v3.1.34
3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.1.34 3.1.35 3.1.36 3.1.37 3.1.38 3.1.39 3.1.4 3.1.40 3.1.41 3.1.42 3.1.43 trunk 1.1 1.1.1 1.1.2 1.10 1.10.1 1.10.10 1.10.11 1.10.12 All 180 releases
icegram / lite / classes / feedback.php

feedback.php in Icegram Engage – Popups, Optins, CTAs & Lead Generation 3.1.34, at lite/classes/feedback.php

280 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Get additional system & plugin specific information for feedback
5
6 */
7 if ( ! function_exists( 'ig_get_additional_info' ) ) {
8
9
10 function ig_get_additional_info( $additional_info, $system_info = false ) {
11 global $icegram, $ig_tracker;
12 $additional_info['version'] = $icegram->version;
13 if ( $system_info ) {
14
15 $additional_info['active_plugins'] = implode( ', ', $ig_tracker::get_active_plugins() );
16 $additional_info['inactive_plugins'] = implode( ', ', $ig_tracker::get_inactive_plugins() );
17 $additional_info['current_theme'] = $ig_tracker::get_current_theme_info();
18 $additional_info['wp_info'] = $ig_tracker::get_wp_info();
19 $additional_info['server_info'] = $ig_tracker::get_server_info();
20
21 // IG Specific information
22 $additional_info['plugin_meta_info'] = Icegram::get_ig_meta_info();
23 }
24
25 return $additional_info;
26
27 }
28
29 }
30
31 add_filter( 'ig_additional_feedback_meta_info', 'ig_get_additional_info', 10, 2 );
32
33 if ( ! function_exists( 'ig_review_message_data' ) ) {
34 /**
35 * Filter 5 star review data
36 *
37 * @param $review_data
38 *
39 * @return mixed
40 *
41 * @since 1.10.36
42 */
43 function ig_review_message_data( $review_data ) {
44
45 $review_url = 'https://wordpress.org/support/plugin/icegram/reviews/';
46 $icon_url = IG_PLUGIN_URL . 'lite/assets/images/icon-64.png';
47
48 $review_data['review_url'] = $review_url;
49 $review_data['icon_url'] = $icon_url;
50
51 return $review_data;
52 }
53 }
54
55 add_filter( 'ig_review_message_data', 'ig_review_message_data', 10 );
56
57 if ( ! function_exists( 'ig_can_ask_user_for_review' ) ) {
58 /**
59 * Can we ask user for 5 star review?
60 *
61 * @return bool
62 *
63 * @since 1.10.36
64 */
65 function ig_can_ask_user_for_review( $enable, $review_data ) {
66
67 if ( $enable ) {
68
69 $screen = get_current_screen();
70 if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
71 return false;
72 }
73
74 if ( ! current_user_can( 'manage_options' ) ) {
75 return false;
76 }
77
78 $total_campaigns = wp_count_posts( 'ig_campaign' );
79 $total_campaigns_publish = $total_campaigns->publish;
80
81 if ( $total_campaigns_publish == 0 ) {
82 return false;
83 }
84 }
85
86 return $enable;
87 }
88 }
89
90 add_filter( 'ig_can_ask_user_for_review', 'ig_can_ask_user_for_review', 50, 2 );
91
92 /**
93 * Render Icegram-Email Subscribers merge feedback widget.
94 *
95 * @since 1.10.38
96 */
97 function ig_render_iges_merge_feedback() {
98
99 global $ig_feedback, $icegram;
100
101 if ( is_admin() ) {
102
103 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
104 return;
105 }
106
107 $screen = get_current_screen();
108 if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
109 return false;
110 }
111
112 if ( ! current_user_can( 'manage_options' ) ) {
113 return false;
114 }
115
116 $total_campaigns = wp_count_posts( 'ig_campaign' );
117
118 $total_campaigns_publish = $total_campaigns->publish;
119
120 if ( $total_campaigns_publish >= 1 ) {
121
122 $event = 'poll.merge_iges';
123
124 // If user has already given feedback on Email Subscribers page, don't ask them again
125 $is_event_tracked = $ig_feedback->is_event_tracked( 'ig_es', $event );
126
127 if ( $is_event_tracked ) {
128 return;
129 }
130
131 $params = array(
132 'type' => 'poll',
133 'title' => __( 'Subscription forms and CTAs??', 'email-subscribers' ),
134 'event' => $event,
135 'desc' => '<div><p>You use <a href="https://wordpress.org/plugins/icegram" target="_blank"><b>Icegram</b></a> to show onsite campaigns like popups and action bars.</p> <p>Would you like us to include email campaigns in the plugin as well? This way you can <b>convert visitors to subscribers, drive traffic and run email marketing from a single plugin</b>.</p> <p>Why do we ask?</p> <p>Our <a href="https://wordpress.org/plugins/email-subscribers" target="_blank"><b>Email Subscribers</b></a> plugin already does email campaigns. We are thinking of merging Icegram & Email Subscribers into a single plugin.</p> <p><b>Will a comprehensive ConvertKit / MailChimp like email + onsite campaign plugin be useful to you?</b></p> </div>',
136 'fields' => array(
137 array(
138 'type' => 'radio',
139 'name' => 'poll_options',
140 'label' => __( 'Yes', 'email-subscribers' ),
141 'value' => 'yes',
142 'required' => true,
143 ),
144 array(
145 'type' => 'radio',
146 'name' => 'poll_options',
147 'label' => __( 'No', 'email-subscribers' ),
148 'value' => 'no',
149 ),
150 array(
151 'type' => 'textarea',
152 'name' => 'details',
153 'placeholder' => __( 'Additional feedback', 'email-subscribers' ),
154 'value' => '',
155 ),
156 ),
157 'allow_multiple' => false,
158 'position' => 'bottom-center',
159 'width' => 400,
160 'delay' => 2, // seconds
161 'display_as' => 'popup',
162 'confirmButtonText' => __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
163 'show_once' => true,
164 );
165
166 $icegram->render_feedback_widget( $params );
167 }
168
169 }
170 }
171
172 add_action( 'admin_footer', 'ig_render_iges_merge_feedback' );
173
174 /**
175 * Can load sweetalert js file
176 *
177 * @param bool $load
178 *
179 * @return bool
180 *
181 * @since 1.10.38
182 */
183 function ig_can_load_sweetalert_js( $load = false ) {
184
185 $screen = get_current_screen();
186 if ( in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
187 return true;
188 }
189
190 return $load;
191 }
192
193 add_filter( 'ig_can_load_sweetalert_js', 'ig_can_load_sweetalert_js', 10, 1 );
194
195 if ( ! function_exists('ig_can_load_sweetalert_css') ) {
196 /**
197 * Can load sweetalert css
198 *
199 * @param bool $load
200 *
201 * @return bool
202 *
203 * @since
204 */
205 function ig_can_load_sweetalert_css( $load = false ) {
206
207 $screen = get_current_screen();
208 if ( in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
209 return true;
210 }
211
212 return $load;
213 }
214 }
215
216 add_filter( 'ig_can_load_sweetalert_css', 'ig_can_load_sweetalert_css', 10, 1 );
217
218 if ( ! function_exists( 'ig_show_plugin_usage_tracking_notice' ) ) {
219
220 /**
221 * Can we show tracking usage optin notice?
222 *
223 * @return bool
224 *
225 *
226 */
227 function ig_show_plugin_usage_tracking_notice( $enable ) {
228
229 // Show notice only to IG dashboard page.
230
231 $screen = get_current_screen() ;
232 $screen_id = $screen -> id ;
233
234 if( !empty( $screen_id ) && $screen_id === 'edit-ig_campaign') {
235 $enable = true;
236 }
237
238 return $enable;
239 }
240 }
241
242 add_filter( 'ig_show_plugin_usage_tracking_notice', 'ig_show_plugin_usage_tracking_notice' );
243
244 /**
245 * Render general feedback on click of "Feedback" button from IG sidebar
246 */
247 function ig_render_general_feedback_widget() {
248 global $icegram;
249 if ( is_admin() ) {
250
251 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
252 return;
253 }
254
255 $screen = get_current_screen();
256 if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign', 'ig_campaign_page_icegram-dashboard', 'ig_campaign_page_icegram-support', 'ig_campaign_page_icegram-reports', 'ig_campaign_page_icegram-gallery', 'ig_campaign_page_icegram-settings' ), true ) ) {
257 return false;
258 }
259
260 $event = 'plugin.feedback';
261
262 $params = array(
263 'type' => 'feedback',
264 'event' => $event,
265 'title' => 'Have feedback or question for us?',
266 'position' => 'center',
267 'width' => 700,
268 'force' => true,
269 'confirmButtonText' => __( 'Send', 'icegram' ),
270 'consent_text' => __( 'Allow Icegram Engage to track plugin usage. It will help us to understand your issue better. We guarantee no sensitive data is collected.', 'icegram' ),
271 'name' => '',
272 );
273
274 $icegram->render_feedback_widget( $params );
275 }
276 }
277
278 add_action( 'admin_footer', 'ig_render_general_feedback_widget' );
279
280