Version Description
- Update: WordPress 6.0.2 compatibility check
=
Download this release
Release Info
Developer | storeapps |
Plugin | Temporary Login Without Password |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5 to 1.7.6
- admin/class-wp-temporary-login-without-password-admin.php +2 -1
- includes/class-wp-temporary-login-without-password.php +1 -1
- includes/feedback.php +223 -1
- includes/feedback/class-ig-feedback.php +704 -421
- includes/feedback/class-ig-tracker.php +1 -1
- readme.txt +8 -4
- temporary-login-without-password.php +5 -4
admin/class-wp-temporary-login-without-password-admin.php
CHANGED
@@ -633,7 +633,8 @@ class Wp_Temporary_Login_Without_Password_Admin {
|
|
633 |
|
634 |
$allow_display_notices = array(
|
635 |
'show_review_notice',
|
636 |
-
'tlwp_display_admin_notices'
|
|
|
637 |
);
|
638 |
|
639 |
$filters = array(
|
633 |
|
634 |
$allow_display_notices = array(
|
635 |
'show_review_notice',
|
636 |
+
'tlwp_display_admin_notices',
|
637 |
+
'tlwp_show_feature_survey',
|
638 |
);
|
639 |
|
640 |
$filters = array(
|
includes/class-wp-temporary-login-without-password.php
CHANGED
@@ -47,7 +47,7 @@ class Wp_Temporary_Login_Without_Password {
|
|
47 |
$this->define_admin_hooks();
|
48 |
$this->define_public_hooks();
|
49 |
|
50 |
-
$tlwp_tracker = 'IG_Tracker_V_' . str_replace( '.', '_',
|
51 |
if ( is_admin() ) {
|
52 |
$ig_feedback_class = 'IG_Feedback_V_' . str_replace( '.', '_', WTLWP_FEEDBACK_VERSION );
|
53 |
$tlwp_feedback = new $ig_feedback_class( 'Temporary Login Without Password', 'temporary-login-without-password', 'tlwp', 'tlwp.', false );
|
47 |
$this->define_admin_hooks();
|
48 |
$this->define_public_hooks();
|
49 |
|
50 |
+
$tlwp_tracker = 'IG_Tracker_V_' . str_replace( '.', '_', WTLWP_TRACKER_VERSION );
|
51 |
if ( is_admin() ) {
|
52 |
$ig_feedback_class = 'IG_Feedback_V_' . str_replace( '.', '_', WTLWP_FEEDBACK_VERSION );
|
53 |
$tlwp_feedback = new $ig_feedback_class( 'Temporary Login Without Password', 'temporary-login-without-password', 'tlwp', 'tlwp.', false );
|
includes/feedback.php
CHANGED
@@ -147,4 +147,226 @@ if ( ! function_exists('tlwp_can_load_sweetalert_css') ) {
|
|
147 |
}
|
148 |
}
|
149 |
|
150 |
-
add_filter( 'tlwp_can_load_sweetalert_css', 'tlwp_can_load_sweetalert_css', 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
|
150 |
+
add_filter( 'tlwp_can_load_sweetalert_css', 'tlwp_can_load_sweetalert_css', 10, 1 );
|
151 |
+
|
152 |
+
if ( ! function_exists( 'tlwp_add_escape_allowed_tags') ) {
|
153 |
+
/**
|
154 |
+
* Add HTML tags to be excluded while escaping
|
155 |
+
*
|
156 |
+
* @return array $allowedtags
|
157 |
+
*/
|
158 |
+
function tlwp_add_escape_allowed_tags() {
|
159 |
+
$context_allowed_tags = wp_kses_allowed_html( 'post' );
|
160 |
+
$custom_allowed_tags = array(
|
161 |
+
'div' => array(
|
162 |
+
'x-data' => true,
|
163 |
+
'x-show' => true,
|
164 |
+
),
|
165 |
+
'select' => array(
|
166 |
+
'class' => true,
|
167 |
+
'name' => true,
|
168 |
+
'id' => true,
|
169 |
+
'style' => true,
|
170 |
+
'title' => true,
|
171 |
+
'role' => true,
|
172 |
+
'data-*' => true,
|
173 |
+
'tab-*' => true,
|
174 |
+
'multiple' => true,
|
175 |
+
'aria-*' => true,
|
176 |
+
'disabled' => true,
|
177 |
+
'required' => 'required',
|
178 |
+
),
|
179 |
+
'optgroup' => array(
|
180 |
+
'label' => true,
|
181 |
+
),
|
182 |
+
'option' => array(
|
183 |
+
'class' => true,
|
184 |
+
'value' => true,
|
185 |
+
'selected' => true,
|
186 |
+
'name' => true,
|
187 |
+
'id' => true,
|
188 |
+
'style' => true,
|
189 |
+
'title' => true,
|
190 |
+
'data-*' => true,
|
191 |
+
),
|
192 |
+
'input' => array(
|
193 |
+
'class' => true,
|
194 |
+
'name' => true,
|
195 |
+
'type' => true,
|
196 |
+
'value' => true,
|
197 |
+
'id' => true,
|
198 |
+
'checked' => true,
|
199 |
+
'disabled' => true,
|
200 |
+
'selected' => true,
|
201 |
+
'style' => true,
|
202 |
+
'required' => 'required',
|
203 |
+
'min' => true,
|
204 |
+
'max' => true,
|
205 |
+
'maxlength' => true,
|
206 |
+
'size' => true,
|
207 |
+
'placeholder' => true,
|
208 |
+
'autocomplete' => true,
|
209 |
+
'autocapitalize' => true,
|
210 |
+
'autocorrect' => true,
|
211 |
+
'tabindex' => true,
|
212 |
+
'role' => true,
|
213 |
+
'aria-*' => true,
|
214 |
+
'data-*' => true,
|
215 |
+
),
|
216 |
+
'label' => array(
|
217 |
+
'class' => true,
|
218 |
+
'name' => true,
|
219 |
+
'type' => true,
|
220 |
+
'value' => true,
|
221 |
+
'id' => true,
|
222 |
+
'for' => true,
|
223 |
+
'style' => true,
|
224 |
+
),
|
225 |
+
'form' => array(
|
226 |
+
'class' => true,
|
227 |
+
'name' => true,
|
228 |
+
'value' => true,
|
229 |
+
'id' => true,
|
230 |
+
'style' => true,
|
231 |
+
'action' => true,
|
232 |
+
'method' => true,
|
233 |
+
'data-*' => true,
|
234 |
+
),
|
235 |
+
'svg' => array(
|
236 |
+
'width' => true,
|
237 |
+
'height' => true,
|
238 |
+
'viewbox' => true,
|
239 |
+
'xmlns' => true,
|
240 |
+
'class' => true,
|
241 |
+
'stroke-*' => true,
|
242 |
+
'fill' => true,
|
243 |
+
'stroke' => true,
|
244 |
+
),
|
245 |
+
'path' => array(
|
246 |
+
'd' => true,
|
247 |
+
'fill' => true,
|
248 |
+
'class' => true,
|
249 |
+
'fill-*' => true,
|
250 |
+
'clip-*' => true,
|
251 |
+
'stroke-linecap' => true,
|
252 |
+
'stroke-linejoin' => true,
|
253 |
+
'stroke-width' => true,
|
254 |
+
'fill-rule' => true,
|
255 |
+
),
|
256 |
+
|
257 |
+
'main' => array(
|
258 |
+
'align' => true,
|
259 |
+
'dir' => true,
|
260 |
+
'lang' => true,
|
261 |
+
'xml:lang' => true,
|
262 |
+
'aria-*' => true,
|
263 |
+
'class' => true,
|
264 |
+
'id' => true,
|
265 |
+
'style' => true,
|
266 |
+
'title' => true,
|
267 |
+
'role' => true,
|
268 |
+
'data-*' => true,
|
269 |
+
),
|
270 |
+
'textarea' => array(
|
271 |
+
'id' => true,
|
272 |
+
'autocomplete' => true,
|
273 |
+
'required' => 'required',
|
274 |
+
'placeholder' => true,
|
275 |
+
'class' => true,
|
276 |
+
),
|
277 |
+
'style' => array(),
|
278 |
+
'link' => array(
|
279 |
+
'rel' => true,
|
280 |
+
'id' => true,
|
281 |
+
'href' => true,
|
282 |
+
'media' => true,
|
283 |
+
),
|
284 |
+
'a' => array(
|
285 |
+
'x-on:click' => true,
|
286 |
+
),
|
287 |
+
'polygon' => array(
|
288 |
+
'class' => true,
|
289 |
+
'points' => true,
|
290 |
+
),
|
291 |
+
);
|
292 |
+
|
293 |
+
$allowedtags = array_merge_recursive( $context_allowed_tags, $custom_allowed_tags );
|
294 |
+
|
295 |
+
return $allowedtags;
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
add_filter( 'tlwp_escape_allowed_tags', 'tlwp_add_escape_allowed_tags' );
|
300 |
+
|
301 |
+
if ( ! function_exists( 'tlwp_show_feature_survey' ) ) {
|
302 |
+
function tlwp_show_feature_survey() {
|
303 |
+
|
304 |
+
if ( ! Wp_Temporary_Login_Without_Password_Common::is_tlwp_admin_page() ) {
|
305 |
+
return;
|
306 |
+
}
|
307 |
+
|
308 |
+
$can_ask_user_for_review = false;
|
309 |
+
|
310 |
+
$temporary_logins = Wp_Temporary_Login_Without_Password_Common::get_temporary_logins();
|
311 |
+
$temporary_logins_exists = count( $temporary_logins ) > 0;
|
312 |
+
|
313 |
+
if ( $temporary_logins_exists ) {
|
314 |
+
$can_ask_user_for_review = true;
|
315 |
+
} else {
|
316 |
+
$plugin_activation_time = get_option( 'tlwp_plugin_activation_time', 0 );
|
317 |
+
$feedback_wait_period = 10 * DAY_IN_SECONDS;
|
318 |
+
$feedback_time = $plugin_activation_time + $feedback_wait_period;
|
319 |
+
$current_time = time();
|
320 |
+
$can_ask_user_for_review = $current_time > $feedback_time;
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( ! $can_ask_user_for_review ) {
|
324 |
+
return;
|
325 |
+
}
|
326 |
+
|
327 |
+
global $tlwp_feedback;
|
328 |
+
|
329 |
+
$survey_title = __( '📣 Quick survey: Tell us what feature you want in the Temporary Login plugin?', 'temporary-login-without-password' );
|
330 |
+
$survey_slug = 'tlwp-feature-survey';
|
331 |
+
$survey_questions = array(
|
332 |
+
'generate_bulk_logins_via_csv' => __( 'Generation of bulk login links when users are uploaded via CSV', 'temporary-login-without-password' ),
|
333 |
+
'create_temp_login_on_user_register' => __( 'Create a temporary login link whenever a user registers', 'temporary-login-without-password' ),
|
334 |
+
'notify_admin_on_temp_user_login' => __( 'Send an email notification to the admin when a temporary user logs in.', 'temporary-login-without-password' ),
|
335 |
+
'log_temp_user_activity' => __( 'Log every activity performed by a temporary login user', 'temporary-login-without-password' ),
|
336 |
+
'limit_login_for_temp_user' => __( 'Limit the number of times a temporary user can log in to your site', 'temporary-login-without-password' ),
|
337 |
+
'other' => __( 'Other - Mention the exact feature', 'temporary-login-without-password' ),
|
338 |
+
);
|
339 |
+
|
340 |
+
$survey_fields = array();
|
341 |
+
foreach ( $survey_questions as $question_slug => $question_text ) {
|
342 |
+
$survey_fields[] = array(
|
343 |
+
'type' => 'radio',
|
344 |
+
'name' => 'feature',
|
345 |
+
'label' => $question_text,
|
346 |
+
'value' => $question_slug,
|
347 |
+
);
|
348 |
+
}
|
349 |
+
|
350 |
+
// Store default values in field_name => default_value format.
|
351 |
+
$default_values = array(
|
352 |
+
'feature' => 'generate_bulk_logins_via_csv',
|
353 |
+
);
|
354 |
+
|
355 |
+
$feedback_data = array(
|
356 |
+
'event' => 'feature_survey',
|
357 |
+
'title' => $survey_title,
|
358 |
+
'slug' => $survey_slug,
|
359 |
+
'logo_img_url' => WTLWP_PLUGIN_URL . 'admin/assets/images/icon-64.png',
|
360 |
+
'fields' => $survey_fields,
|
361 |
+
'default_values' => $default_values,
|
362 |
+
'type' => 'poll',
|
363 |
+
'system_info' => false,
|
364 |
+
);
|
365 |
+
|
366 |
+
$tlwp_feedback->render_feedback_widget( $feedback_data );
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
add_action( 'admin_notices', 'tlwp_show_feature_survey' );
|
371 |
+
|
372 |
+
|
includes/feedback/class-ig-feedback.php
CHANGED
@@ -4,30 +4,28 @@ 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 |
* @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
|
22 |
|
23 |
/**
|
24 |
* Version of Feedback Library
|
25 |
*
|
26 |
* @since 1.0.13
|
27 |
* @var string
|
28 |
-
*
|
29 |
*/
|
30 |
-
public $version = '1.2.
|
31 |
/**
|
32 |
* The API URL where we will send feedback data.
|
33 |
*
|
@@ -70,6 +68,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
70 |
|
71 |
/**
|
72 |
* Enable/Disable Dev Mode
|
|
|
73 |
* @var bool
|
74 |
*/
|
75 |
public $is_dev_mode = true;
|
@@ -82,7 +81,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
82 |
public $event_prefix;
|
83 |
|
84 |
/**
|
85 |
-
*
|
86 |
*/
|
87 |
public $footer = '<span class="ig-powered-by">Made With 💜 by <a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
|
88 |
|
@@ -95,6 +94,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
95 |
* @since 1.0.0
|
96 |
*/
|
97 |
public function __construct( $name = '', $plugin = '', $plugin_abbr = 'ig_fb', $event_prefix = 'igfb.', $is_dev_mode = false ) {
|
|
|
98 |
$this->name = $name;
|
99 |
$this->plugin = $plugin;
|
100 |
$this->plugin_abbr = $plugin_abbr;
|
@@ -192,31 +192,34 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
192 |
|
193 |
if ( $can_ask_user_for_review ) {
|
194 |
|
195 |
-
$current_page_url =
|
|
|
|
|
|
|
196 |
|
197 |
$got_feedback = false;
|
198 |
-
/************** Update Review Status
|
199 |
-
$nonce = ! empty( $_GET['ig_feedback_nonce'] ) ?
|
200 |
$nonce_verified = wp_verify_nonce( $nonce, 'review' );
|
201 |
|
202 |
$action = '';
|
203 |
if ( $nonce_verified ) {
|
204 |
-
$action = ! empty( $_GET['ig_feedback_action'] ) ?
|
205 |
|
206 |
if ( ! empty( $action ) && $this->is_valid_action( $action ) ) {
|
207 |
update_user_meta( $current_user_id, $action, 1 );
|
208 |
-
update_user_meta( $current_user_id, $action .
|
209 |
|
210 |
// Got the review request?
|
211 |
// Redirect them to review page
|
212 |
if ( $action === $review_done_option ) {
|
213 |
|
214 |
-
$url = ! empty( $_GET['review_url'] ) ? $_GET['review_url'] : '';
|
215 |
|
216 |
if ( ! empty( $url ) ) {
|
217 |
?>
|
218 |
|
219 |
-
|
220 |
|
221 |
<?php
|
222 |
}
|
@@ -225,18 +228,19 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
225 |
|
226 |
$got_feedback = true;
|
227 |
}
|
228 |
-
/************** Update Review Status (End)
|
229 |
|
230 |
if ( ! $got_feedback ) {
|
231 |
|
232 |
$review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
|
233 |
$icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
|
234 |
-
|
|
|
235 |
|
236 |
$message_data = array(
|
237 |
'review_url' => $review_url,
|
238 |
'icon_url' => $icon_url,
|
239 |
-
'message' => $message
|
240 |
);
|
241 |
|
242 |
$message_data = apply_filters( $this->plugin_abbr . '_review_message_data', $message_data );
|
@@ -254,47 +258,50 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
254 |
|
255 |
?>
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
.ig-feedback-notice-links li {
|
260 |
-
display: inline-block;
|
261 |
-
margin-right: 15px;
|
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 |
<?php
|
289 |
|
290 |
echo '<div class="notice notice-success ig-feedback-notice">';
|
291 |
-
echo '<span class="ig-feedback-plugin-icon"> <img src="' . $icon_url . '" alt="Logo"/></span>';
|
292 |
-
echo $message;
|
293 |
echo "<ul class='ig-feedback-notice-links'>";
|
294 |
-
echo sprintf(
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
echo '</div>';
|
299 |
}
|
300 |
}
|
@@ -365,9 +372,10 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
365 |
* @since 1.0.1
|
366 |
*/
|
367 |
public function enqueue_styles() {
|
|
|
368 |
$can_load = apply_filters( $this->plugin_abbr . '_can_load_sweetalert_css', false );
|
369 |
|
370 |
-
if( $can_load ){
|
371 |
wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
|
372 |
wp_enqueue_style( "sweetalert_{$this->version}" );
|
373 |
|
@@ -383,10 +391,8 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
383 |
wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
|
384 |
wp_enqueue_style( "ig-feedback_{$this->version}" );
|
385 |
}
|
386 |
-
|
387 |
}
|
388 |
|
389 |
-
|
390 |
/**
|
391 |
* Prepare Widget Params
|
392 |
*
|
@@ -413,7 +419,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
413 |
'consent_text' => 'You are agree to our terms and condition',
|
414 |
'email' => $this->get_contact_email(),
|
415 |
'name' => '',
|
416 |
-
'consent'
|
417 |
);
|
418 |
|
419 |
$params = wp_parse_args( $params, $default_params );
|
@@ -439,28 +445,28 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
439 |
|
440 |
?>
|
441 |
|
442 |
-
|
443 |
|
444 |
function doSend(rating, details) {
|
445 |
|
446 |
var data = {
|
447 |
-
action: '<?php echo $this->ajax_action; ?>',
|
448 |
feedback: {
|
449 |
-
type: '<?php echo $params['type']; ?>',
|
450 |
-
slug: '<?php echo $slug; ?>',
|
451 |
title: '<?php echo esc_js( $title ); ?>',
|
452 |
value: rating,
|
453 |
details: details
|
454 |
},
|
455 |
|
456 |
-
event: '<?php echo $event; ?>',
|
457 |
|
458 |
// Add additional information
|
459 |
misc: {
|
460 |
-
plugin: '<?php echo $this->plugin; ?>',
|
461 |
-
plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
|
462 |
-
is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
|
463 |
-
set_transient: '<?php echo $params['set_transient']; ?>'
|
464 |
//system_info: enable_system_info
|
465 |
},
|
466 |
security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
|
@@ -474,21 +480,21 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
474 |
setTimeout(function () {
|
475 |
|
476 |
Swal.mixin({
|
477 |
-
footer: '<?php echo $this->footer; ?>',
|
478 |
-
position: '<?php echo $params['position']; ?>',
|
479 |
-
width: <?php echo $params['width']; ?>,
|
480 |
animation: false,
|
481 |
focusConfirm: false,
|
482 |
-
allowEscapeKey: '<?php echo $params['allowEscapeKey']; ?>',
|
483 |
-
showCloseButton: '<?php echo $params['showCloseButton']; ?>',
|
484 |
-
allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
|
485 |
showLoaderOnConfirm: true,
|
486 |
-
confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
|
487 |
-
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
488 |
}).queue([
|
489 |
{
|
490 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
491 |
-
html: '<?php echo $html; ?>',
|
492 |
customClass: {
|
493 |
popup: 'animated fadeInUpBig'
|
494 |
},
|
@@ -534,10 +540,10 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
534 |
|
535 |
Swal.fire({
|
536 |
type: 'success',
|
537 |
-
width: <?php echo $params['width']; ?>,
|
538 |
-
title:
|
539 |
showConfirmButton: false,
|
540 |
-
position: '<?php echo $params['position']; ?>',
|
541 |
timer: 1500,
|
542 |
animation: false
|
543 |
});
|
@@ -548,11 +554,11 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
548 |
}, delay * 1000);
|
549 |
}
|
550 |
|
551 |
-
var delay = <?php echo $params['delay']; ?>;
|
552 |
showWidget(delay);
|
553 |
|
554 |
|
555 |
-
|
556 |
<?php
|
557 |
}
|
558 |
|
@@ -569,14 +575,14 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
569 |
|
570 |
?>
|
571 |
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
|
581 |
<?php
|
582 |
|
@@ -600,15 +606,15 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
600 |
|
601 |
?>
|
602 |
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
|
613 |
<?php
|
614 |
|
@@ -633,27 +639,27 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
633 |
|
634 |
?>
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
<?php if ( isset( $params['consent'] ) && $params['consent']
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
<?php } ?>
|
655 |
-
|
656 |
-
|
657 |
|
658 |
<?php
|
659 |
|
@@ -666,32 +672,34 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
666 |
$event = $this->event_prefix . $params['event'];
|
667 |
$html = ! empty( $params['html'] ) ? $params['html'] : '';
|
668 |
|
|
|
|
|
669 |
ob_start();
|
670 |
?>
|
671 |
|
672 |
-
|
673 |
|
674 |
jQuery(document).ready(function ($) {
|
675 |
|
676 |
function doSend(details, meta, system_info) {
|
677 |
|
678 |
var data = {
|
679 |
-
action: '<?php echo $this->ajax_action; ?>',
|
680 |
feedback: {
|
681 |
-
type: '<?php echo $params['type']; ?>',
|
682 |
-
slug: '<?php echo $slug; ?>',
|
683 |
title: '<?php echo esc_js( $title ); ?>',
|
684 |
details: details
|
685 |
},
|
686 |
|
687 |
-
event: '<?php echo $event; ?>',
|
688 |
|
689 |
// Add additional information
|
690 |
misc: {
|
691 |
-
plugin: '<?php echo $this->plugin; ?>',
|
692 |
-
plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
|
693 |
-
is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
|
694 |
-
set_transient: '<?php echo $params['set_transient']; ?>',
|
695 |
meta_info: meta,
|
696 |
system_info: system_info
|
697 |
},
|
@@ -710,27 +718,27 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
710 |
}
|
711 |
}
|
712 |
|
713 |
-
var feedbackButtonClass = 'ig-feedback-button-<?php echo $this->plugin; ?>';
|
714 |
|
715 |
$('#wpwrap').append('<div class="ig-es-feedback-button ' + feedbackButtonClass + '">Feedback</div>');
|
716 |
|
717 |
$('.' + feedbackButtonClass).on('click', function () {
|
718 |
Swal.mixin({
|
719 |
-
footer: '<?php echo $this->footer; ?>',
|
720 |
-
position: '<?php echo $params['position']; ?>',
|
721 |
-
width: <?php echo $params['width']; ?>,
|
722 |
animation: false,
|
723 |
focusConfirm: false,
|
724 |
allowEscapeKey: true,
|
725 |
-
showCloseButton: '<?php echo $params['showCloseButton']; ?>',
|
726 |
-
allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
|
727 |
showLoaderOnConfirm: true,
|
728 |
-
confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
|
729 |
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
730 |
}).queue([
|
731 |
{
|
732 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
733 |
-
html: '<?php echo $html; ?>',
|
734 |
customClass: {
|
735 |
popup: 'animated fadeInUpBig'
|
736 |
},
|
@@ -739,7 +747,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
739 |
|
740 |
},
|
741 |
preConfirm: () => {
|
742 |
-
var $overlay = $('#ig-general-feedback-<?php echo $this->plugin; ?>');
|
743 |
var $form = $overlay.find('form');
|
744 |
|
745 |
var email = $form.find('#ig-feedback-data-email').val();
|
@@ -777,10 +785,10 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
777 |
|
778 |
Swal.fire({
|
779 |
type: 'success',
|
780 |
-
width: <?php echo $params['width']; ?>,
|
781 |
-
title:
|
782 |
showConfirmButton: false,
|
783 |
-
position: '<?php echo $params['position']; ?>',
|
784 |
timer: 1500,
|
785 |
animation: false
|
786 |
});
|
@@ -792,7 +800,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
792 |
});
|
793 |
});
|
794 |
|
795 |
-
|
796 |
|
797 |
|
798 |
<?php
|
@@ -808,74 +816,73 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
808 |
|
809 |
$params = $this->prepare_widget_params( $params );
|
810 |
|
811 |
-
$title
|
812 |
-
$widget_tyoe
|
813 |
-
$slug
|
814 |
-
$event
|
815 |
-
$html
|
816 |
$confirm_button_link = ! empty( $params['confirmButtonLink'] ) ? $params['confirmButtonLink'] : '';
|
817 |
-
$cancel_button_link
|
818 |
-
$show_cancel_button
|
819 |
-
$cancel_button_text
|
820 |
|
821 |
?>
|
822 |
|
823 |
-
|
824 |
|
825 |
Swal.mixin({
|
826 |
-
type: '<?php echo $widget_tyoe; ?>',
|
827 |
-
position: '<?php echo $params['position']; ?>',
|
828 |
-
width: <?php echo $params['width']; ?>,
|
829 |
animation: false,
|
830 |
focusConfirm: true,
|
831 |
allowEscapeKey: true,
|
832 |
-
showCancelButton: <?php echo $show_cancel_button; ?>,
|
833 |
confirmButtonColor: '#0e9f6e',
|
834 |
cancelButtonColor: '#5850ec',
|
835 |
-
cancelButtonText: '<?php echo $cancel_button_text; ?>',
|
836 |
-
showCloseButton: '<?php echo $params['showCloseButton']; ?>',
|
837 |
-
allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
|
838 |
showLoaderOnConfirm: true,
|
839 |
-
confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
|
840 |
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
841 |
}).queue([
|
842 |
{
|
843 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
844 |
-
html: '<?php echo $html; ?>',
|
845 |
customClass: {
|
846 |
popup: 'animated fadeInUpBig'
|
847 |
},
|
848 |
|
849 |
preConfirm: () => {
|
850 |
window.open(
|
851 |
-
'<?php echo $confirm_button_link; ?>',
|
852 |
'_blank' // <- This is what makes it open in a new window.
|
853 |
);
|
854 |
}
|
855 |
}
|
856 |
]).then(response => {
|
857 |
|
858 |
-
console.log(response);
|
859 |
if (response.hasOwnProperty('value')) {
|
860 |
|
861 |
Swal.fire({
|
862 |
type: 'success',
|
863 |
-
width: <?php echo $params['width']; ?>,
|
864 |
title: "Thank You!",
|
865 |
showConfirmButton: false,
|
866 |
-
position: '<?php echo $params['position']; ?>',
|
867 |
timer: 1500,
|
868 |
animation: false
|
869 |
});
|
870 |
} else if(response.dismiss == 'cancel') {
|
871 |
window.open(
|
872 |
-
'<?php echo $cancel_button_link; ?>',
|
873 |
'_blank' // <- This is what makes it open in a new window.
|
874 |
);
|
875 |
}
|
876 |
});
|
877 |
|
878 |
-
|
879 |
|
880 |
<?php
|
881 |
}
|
@@ -890,155 +897,348 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
890 |
public function render_poll_widget( $params = array() ) {
|
891 |
$params = $this->prepare_widget_params( $params );
|
892 |
|
893 |
-
$
|
894 |
-
|
895 |
-
if ( empty( $poll_options ) ) {
|
896 |
return;
|
897 |
}
|
|
|
898 |
|
899 |
$allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
|
900 |
|
901 |
$title = $params['title'];
|
902 |
-
|
903 |
-
|
904 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
905 |
|
906 |
ob_start();
|
907 |
|
908 |
?>
|
909 |
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
924 |
|
925 |
<?php
|
926 |
|
927 |
$html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
|
928 |
|
929 |
-
$params['html'] = $html;
|
930 |
-
|
931 |
-
$title = $params['title'];
|
932 |
-
$slug = sanitize_title( $title );
|
933 |
$event = $this->event_prefix . $params['event'];
|
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 |
-
width: <?php echo $params['width']; ?>,
|
974 |
-
animation: false,
|
975 |
-
focusConfirm: false,
|
976 |
-
allowEscapeKey: true,
|
977 |
-
showCloseButton: '<?php echo $params['showCloseButton']; ?>',
|
978 |
-
allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
|
979 |
-
showLoaderOnConfirm: true,
|
980 |
-
confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
|
981 |
-
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
982 |
-
}).queue([
|
983 |
-
{
|
984 |
-
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
985 |
-
html: '<?php echo $html; ?>',
|
986 |
-
customClass: {
|
987 |
-
popup: 'animated fadeInUpBig'
|
988 |
-
},
|
989 |
-
onOpen: () => {
|
990 |
|
991 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
992 |
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
998 |
|
999 |
-
|
1000 |
-
Swal.showValidationMessage('Please select option');
|
1001 |
-
return;
|
1002 |
-
}
|
1003 |
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1008 |
|
1009 |
-
|
1010 |
|
1011 |
-
|
|
|
|
|
|
|
|
|
|
|
1012 |
}
|
1013 |
-
},
|
1014 |
|
1015 |
-
|
|
|
1016 |
|
1017 |
-
|
|
|
|
|
|
|
1018 |
|
1019 |
-
|
1020 |
-
type: 'success',
|
1021 |
-
width: <?php echo $params['width']; ?>,
|
1022 |
-
title: "Thank You!",
|
1023 |
-
showConfirmButton: false,
|
1024 |
-
position: '<?php echo $params['position']; ?>',
|
1025 |
-
timer: 1500,
|
1026 |
-
animation: false
|
1027 |
-
});
|
1028 |
|
|
|
1029 |
}
|
1030 |
-
}
|
1031 |
|
|
|
1032 |
|
1033 |
-
|
1034 |
|
1035 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1036 |
|
|
|
|
|
|
|
1037 |
|
|
|
1038 |
<?php
|
1039 |
}
|
1040 |
-
|
1041 |
-
|
1042 |
/**
|
1043 |
* Get Feedback API url
|
1044 |
*
|
@@ -1071,15 +1271,15 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1071 |
$title = 'Why are you deactivating ' . $this->name . '?';
|
1072 |
$slug = sanitize_title( $title );
|
1073 |
$event = $this->event_prefix . 'plugin.deactivation';
|
1074 |
-
|
1075 |
?>
|
1076 |
-
|
1077 |
jQuery(function ($) {
|
1078 |
-
var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
|
1079 |
-
$overlay = $('#ig-deactivate-survey-<?php echo $this->plugin; ?>'),
|
1080 |
$form = $overlay.find('form'),
|
1081 |
formOpen = false,
|
1082 |
-
consent = $('#ig-deactivate-survey-help-consent-<?php echo $this->plugin; ?>');
|
1083 |
|
1084 |
function togglePersonalInfoFields(show) {
|
1085 |
|
@@ -1136,7 +1336,9 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1136 |
// Survey Skip & Deactivate.
|
1137 |
$form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
|
1138 |
event.preventDefault();
|
1139 |
-
|
|
|
|
|
1140 |
});
|
1141 |
|
1142 |
// Help Consent
|
@@ -1179,22 +1381,22 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1179 |
};
|
1180 |
|
1181 |
var data = {
|
1182 |
-
action: '<?php echo $this->ajax_action; ?>',
|
1183 |
feedback: {
|
1184 |
type: 'radio',
|
1185 |
-
title: '<?php echo $title; ?>',
|
1186 |
-
slug: '<?php echo $slug; ?>',
|
1187 |
value: $form.find('.selected input[type=radio]').attr('data-option-slug'),
|
1188 |
details: $form.find('.selected input[type=text]').val()
|
1189 |
},
|
1190 |
|
1191 |
-
event: '<?php echo $event; ?>',
|
1192 |
|
1193 |
// Add additional information
|
1194 |
misc: {
|
1195 |
-
plugin: '<?php echo $this->plugin; ?>',
|
1196 |
-
plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
|
1197 |
-
is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
|
1198 |
set_cookie: '',
|
1199 |
meta_info: meta,
|
1200 |
system_info: system_info
|
@@ -1216,7 +1418,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1216 |
}
|
1217 |
});
|
1218 |
});
|
1219 |
-
|
1220 |
<?php
|
1221 |
}
|
1222 |
|
@@ -1231,108 +1433,108 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1231 |
return;
|
1232 |
}
|
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 |
<?php
|
1337 |
}
|
1338 |
|
@@ -1352,7 +1554,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1352 |
$options = array(
|
1353 |
1 => array(
|
1354 |
'title' => esc_html__( 'I no longer need the plugin', $this->plugin ),
|
1355 |
-
'slug' => 'i-no-longer-need-the-plugin'
|
1356 |
),
|
1357 |
2 => array(
|
1358 |
'title' => esc_html__( 'I\'m switching to a different plugin', $this->plugin ),
|
@@ -1361,11 +1563,11 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1361 |
),
|
1362 |
3 => array(
|
1363 |
'title' => esc_html__( 'I couldn\'t get the plugin to work', $this->plugin ),
|
1364 |
-
'slug' => 'i-could-not-get-the-plugin-to-work'
|
1365 |
),
|
1366 |
4 => array(
|
1367 |
'title' => esc_html__( 'It\'s a temporary deactivation', $this->plugin ),
|
1368 |
-
'slug' => 'it-is-a-temporary-deactivation'
|
1369 |
),
|
1370 |
5 => array(
|
1371 |
'title' => esc_html__( 'Other', $this->plugin ),
|
@@ -1374,40 +1576,40 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1374 |
),
|
1375 |
);
|
1376 |
?>
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
<?php foreach ( $options as $id => $option ) : ?>
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
<?php if ( ! empty( $option['details'] ) ) : ?>
|
1390 |
-
|
1391 |
<?php endif; ?>
|
1392 |
-
|
1393 |
<?php endforeach; ?>
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
<?php
|
1412 |
}
|
1413 |
|
@@ -1491,7 +1693,6 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1491 |
$is_local_url = true;
|
1492 |
continue;
|
1493 |
}
|
1494 |
-
|
1495 |
}
|
1496 |
if ( substr_count( $host, '.' ) > 1 ) {
|
1497 |
$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
|
@@ -1592,7 +1793,6 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1592 |
return true;
|
1593 |
}
|
1594 |
}
|
1595 |
-
|
1596 |
}
|
1597 |
|
1598 |
return false;
|
@@ -1603,7 +1803,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1603 |
* Set event into transient
|
1604 |
*
|
1605 |
* @param $event
|
1606 |
-
* @param int
|
1607 |
*/
|
1608 |
public function set_event_transient( $event, $expiry = 45 ) {
|
1609 |
set_transient( $event, 1, time() + ( 86400 * $expiry ) );
|
@@ -1652,7 +1852,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1652 |
*
|
1653 |
* Send feedback to server
|
1654 |
*/
|
1655 |
-
function submit_feedback() {
|
1656 |
|
1657 |
check_ajax_referer( $this->plugin_abbr . '-admin-ajax-nonce', 'security' );
|
1658 |
|
@@ -1673,7 +1873,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1673 |
'plugin' => sanitize_key( $plugin ),
|
1674 |
'locale' => get_locale(),
|
1675 |
'wp_version' => get_bloginfo( 'version' ),
|
1676 |
-
'php_version' => PHP_VERSION
|
1677 |
);
|
1678 |
|
1679 |
$meta_info = wp_parse_args( $meta_info, $default_meta_info );
|
@@ -1693,7 +1893,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1693 |
'timeout' => 15,
|
1694 |
'sslverify' => false,
|
1695 |
'body' => $data,
|
1696 |
-
'blocking' => false
|
1697 |
);
|
1698 |
|
1699 |
$this->set_feedback_data( $plugin_abbr, $data['event'], $data['feedback'] );
|
@@ -1703,8 +1903,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1703 |
$this->set_event_transient( $data['event'] );
|
1704 |
}
|
1705 |
|
1706 |
-
$response
|
1707 |
-
|
1708 |
$result['status'] = 'success';
|
1709 |
if ( $response instanceof WP_Error ) {
|
1710 |
$error_message = $response->get_error_message();
|
@@ -1714,5 +1913,89 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_5' ) ) {
|
|
1714 |
|
1715 |
die( json_encode( $result ) );
|
1716 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1717 |
}
|
1718 |
-
} // End if().
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
+
if ( ! class_exists( 'IG_Feedback_V_1_2_8' ) ) {
|
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_2_8
|
15 |
* @since 1.0.0
|
16 |
* @copyright Copyright (c) 2019, Icegram
|
17 |
* @license https://opensource.org/licenses/gpl-license GNU Public License
|
|
|
18 |
* @package feedback
|
19 |
*/
|
20 |
+
class IG_Feedback_V_1_2_8 {
|
21 |
|
22 |
/**
|
23 |
* Version of Feedback Library
|
24 |
*
|
25 |
* @since 1.0.13
|
26 |
* @var string
|
|
|
27 |
*/
|
28 |
+
public $version = '1.2.8';
|
29 |
/**
|
30 |
* The API URL where we will send feedback data.
|
31 |
*
|
68 |
|
69 |
/**
|
70 |
* Enable/Disable Dev Mode
|
71 |
+
*
|
72 |
* @var bool
|
73 |
*/
|
74 |
public $is_dev_mode = true;
|
81 |
public $event_prefix;
|
82 |
|
83 |
/**
|
84 |
+
* Footer HTML
|
85 |
*/
|
86 |
public $footer = '<span class="ig-powered-by">Made With 💜 by <a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
|
87 |
|
94 |
* @since 1.0.0
|
95 |
*/
|
96 |
public function __construct( $name = '', $plugin = '', $plugin_abbr = 'ig_fb', $event_prefix = 'igfb.', $is_dev_mode = false ) {
|
97 |
+
|
98 |
$this->name = $name;
|
99 |
$this->plugin = $plugin;
|
100 |
$this->plugin_abbr = $plugin_abbr;
|
192 |
|
193 |
if ( $can_ask_user_for_review ) {
|
194 |
|
195 |
+
$current_page_url = '';
|
196 |
+
if ( ! empty( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
197 |
+
$current_page_url = esc_url_raw( '//' . wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
198 |
+
}
|
199 |
|
200 |
$got_feedback = false;
|
201 |
+
/************** Update Review Status */
|
202 |
+
$nonce = ! empty( $_GET['ig_feedback_nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['ig_feedback_nonce'] ) ) : '';
|
203 |
$nonce_verified = wp_verify_nonce( $nonce, 'review' );
|
204 |
|
205 |
$action = '';
|
206 |
if ( $nonce_verified ) {
|
207 |
+
$action = ! empty( $_GET['ig_feedback_action'] ) ? sanitize_text_field( wp_unslash( $_GET['ig_feedback_action'] ) ) : '';
|
208 |
|
209 |
if ( ! empty( $action ) && $this->is_valid_action( $action ) ) {
|
210 |
update_user_meta( $current_user_id, $action, 1 );
|
211 |
+
update_user_meta( $current_user_id, $action . '_time', time() );
|
212 |
|
213 |
// Got the review request?
|
214 |
// Redirect them to review page
|
215 |
if ( $action === $review_done_option ) {
|
216 |
|
217 |
+
$url = ! empty( $_GET['review_url'] ) ? esc_url_raw( wp_unslash( $_GET['review_url'] ) ) : '';
|
218 |
|
219 |
if ( ! empty( $url ) ) {
|
220 |
?>
|
221 |
|
222 |
+
<meta http-equiv="refresh" content="0; url=<?php echo esc_url( $url ); ?>"/>
|
223 |
|
224 |
<?php
|
225 |
}
|
228 |
|
229 |
$got_feedback = true;
|
230 |
}
|
231 |
+
/************** Update Review Status (End) */
|
232 |
|
233 |
if ( ! $got_feedback ) {
|
234 |
|
235 |
$review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
|
236 |
$icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
|
237 |
+
/* translators: %s: Plugin name */
|
238 |
+
$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 );
|
239 |
|
240 |
$message_data = array(
|
241 |
'review_url' => $review_url,
|
242 |
'icon_url' => $icon_url,
|
243 |
+
'message' => $message,
|
244 |
);
|
245 |
|
246 |
$message_data = apply_filters( $this->plugin_abbr . '_review_message_data', $message_data );
|
258 |
|
259 |
?>
|
260 |
|
261 |
+
<style type="text/css">
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
+
.ig-feedback-notice-links li {
|
264 |
+
display: inline-block;
|
265 |
+
margin-right: 15px;
|
266 |
+
}
|
267 |
|
268 |
+
.ig-feedback-notice-links li a {
|
269 |
+
display: inline-block;
|
270 |
+
color: #5850EC;
|
271 |
+
text-decoration: none;
|
272 |
+
padding-left: 26px;
|
273 |
+
position: relative;
|
274 |
+
}
|
275 |
|
276 |
+
.ig-feedback-notice {
|
277 |
+
display: flex;
|
278 |
+
align-items: center;
|
279 |
+
}
|
280 |
|
281 |
+
.ig-feedback-plugin-icon {
|
282 |
+
float: left;
|
283 |
+
margin-right: 0.5em;
|
284 |
+
}
|
285 |
|
286 |
+
</style>
|
287 |
|
288 |
<?php
|
289 |
|
290 |
echo '<div class="notice notice-success ig-feedback-notice">';
|
291 |
+
echo '<span class="ig-feedback-plugin-icon"> <img src="' . esc_url( $icon_url ) . '" alt="Logo"/></span>';
|
292 |
+
echo wp_kses_post( $message );
|
293 |
echo "<ul class='ig-feedback-notice-links'>";
|
294 |
+
echo sprintf(
|
295 |
+
'<li><a href="%s" class="px-4 py-2 ml-6 mr-2 align-middle cursor-pointer button button-primary bg-indigo-600" target="_blank" data-rated="' . esc_attr__(
|
296 |
+
'Thank You :) ',
|
297 |
+
$this->plugin
|
298 |
+
) . '"><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>',
|
299 |
+
esc_url( $review_url ),
|
300 |
+
esc_url( $maybe_later_url ),
|
301 |
+
esc_url( $already_did_url ),
|
302 |
+
esc_url( $no_bug_url )
|
303 |
+
);
|
304 |
+
echo '</ul></span>';
|
305 |
echo '</div>';
|
306 |
}
|
307 |
}
|
372 |
* @since 1.0.1
|
373 |
*/
|
374 |
public function enqueue_styles() {
|
375 |
+
|
376 |
$can_load = apply_filters( $this->plugin_abbr . '_can_load_sweetalert_css', false );
|
377 |
|
378 |
+
if ( $can_load ) {
|
379 |
wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
|
380 |
wp_enqueue_style( "sweetalert_{$this->version}" );
|
381 |
|
391 |
wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
|
392 |
wp_enqueue_style( "ig-feedback_{$this->version}" );
|
393 |
}
|
|
|
394 |
}
|
395 |
|
|
|
396 |
/**
|
397 |
* Prepare Widget Params
|
398 |
*
|
419 |
'consent_text' => 'You are agree to our terms and condition',
|
420 |
'email' => $this->get_contact_email(),
|
421 |
'name' => '',
|
422 |
+
'consent' => false,
|
423 |
);
|
424 |
|
425 |
$params = wp_parse_args( $params, $default_params );
|
445 |
|
446 |
?>
|
447 |
|
448 |
+
<script>
|
449 |
|
450 |
function doSend(rating, details) {
|
451 |
|
452 |
var data = {
|
453 |
+
action: '<?php echo esc_js( $this->ajax_action ); ?>',
|
454 |
feedback: {
|
455 |
+
type: '<?php echo esc_js( $params['type'] ); ?>',
|
456 |
+
slug: '<?php echo esc_js( $slug ); ?>',
|
457 |
title: '<?php echo esc_js( $title ); ?>',
|
458 |
value: rating,
|
459 |
details: details
|
460 |
},
|
461 |
|
462 |
+
event: '<?php echo esc_js( $event ); ?>',
|
463 |
|
464 |
// Add additional information
|
465 |
misc: {
|
466 |
+
plugin: '<?php echo esc_js( $this->plugin ); ?>',
|
467 |
+
plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
|
468 |
+
is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
|
469 |
+
set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>'
|
470 |
//system_info: enable_system_info
|
471 |
},
|
472 |
security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
|
480 |
setTimeout(function () {
|
481 |
|
482 |
Swal.mixin({
|
483 |
+
footer: '<?php echo wp_kses_post( $this->footer ); ?>',
|
484 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
485 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
486 |
animation: false,
|
487 |
focusConfirm: false,
|
488 |
+
allowEscapeKey: '<?php echo esc_js( $params['allowEscapeKey'] ); ?>',
|
489 |
+
showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
|
490 |
+
allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
|
491 |
showLoaderOnConfirm: true,
|
492 |
+
confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
|
493 |
+
backdrop: '<?php echo (int) esc_js( $params['backdrop'] ); ?>'
|
494 |
}).queue([
|
495 |
{
|
496 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
497 |
+
html: '<?php echo wp_kses_post( $html ); ?>',
|
498 |
customClass: {
|
499 |
popup: 'animated fadeInUpBig'
|
500 |
},
|
540 |
|
541 |
Swal.fire({
|
542 |
type: 'success',
|
543 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
544 |
+
title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
|
545 |
showConfirmButton: false,
|
546 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
547 |
timer: 1500,
|
548 |
animation: false
|
549 |
});
|
554 |
}, delay * 1000);
|
555 |
}
|
556 |
|
557 |
+
var delay = <?php echo esc_js( $params['delay'] ); ?>;
|
558 |
showWidget(delay);
|
559 |
|
560 |
|
561 |
+
</script>
|
562 |
<?php
|
563 |
}
|
564 |
|
575 |
|
576 |
?>
|
577 |
|
578 |
+
<div class="rating">
|
579 |
+
<!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
|
580 |
+
<input class="ratings" type="radio" name="rating" value="5" id="5"><label for="5">☆</label>
|
581 |
+
<input class="ratings" type="radio" name="rating" value="4" id="4"><label for="4">☆</label>
|
582 |
+
<input class="ratings" type="radio" name="rating" value="3" id="3"><label for="3">☆</label>
|
583 |
+
<input class="ratings" type="radio" name="rating" value="2" id="2"><label for="2">☆</label>
|
584 |
+
<input class="ratings" type="radio" name="rating" value="1" id="1"><label for="1">☆</label>
|
585 |
+
</div>
|
586 |
|
587 |
<?php
|
588 |
|
606 |
|
607 |
?>
|
608 |
|
609 |
+
<div class="emoji">
|
610 |
+
<!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
|
611 |
+
<input class="emojis" type="radio" name="rating" value="love" id="5"/><label for="5" class="ig-emoji" data-reaction="Love">😍</label>
|
612 |
+
<input class="emojis" type="radio" name="rating" value="smile" id="4"/><label for="4" class="ig-emoji" data-reaction="Smile">😊</label>
|
613 |
+
<input class="emojis" type="radio" name="rating" value="neutral" id="3"/><label for="3" class="ig-emoji" data-reaction="Neutral">😐</label>
|
614 |
+
<input class="emojis" type="radio" name="rating" value="sad" id="1"/><label for="2" class="ig-emoji" data-reaction="Sad">😠</label>
|
615 |
+
<input class="emojis" type="radio" name="rating" value="angry" id="1"/><label for="1" class="ig-emoji" data-reaction="Angry">😡</label>
|
616 |
+
</div>
|
617 |
+
<div id="emoji-info"></div>
|
618 |
|
619 |
<?php
|
620 |
|
639 |
|
640 |
?>
|
641 |
|
642 |
+
<div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
|
643 |
+
<form class="ig-general-feedback" id="ig-general-feedback">
|
644 |
+
<p class="ig-feedback-data-name">
|
645 |
+
<label class="ig-label">Name</label><br/>
|
646 |
+
<input type="text" name="feedback_data[name]" id="ig-feedback-data-name" value="<?php echo esc_attr( $params['name'] ); ?>"/>
|
647 |
+
</p>
|
648 |
+
<p class="ig-feedback-data-email">
|
649 |
+
<label class="ig-label"">Email</label><br/>
|
650 |
+
<input type="email" name="feedback_data[email]" id="ig-feedback-data-email" value="<?php echo esc_attr( $params['email'] ); ?>"/>
|
651 |
+
</p>
|
652 |
+
<p class="ig-feedback-data-message">
|
653 |
+
<label class="ig-label"">Feedback</label><br/>
|
654 |
+
<textarea name="feedback_data[details]" id="ig-feedback-data-message"></textarea>
|
655 |
+
</p>
|
656 |
+
<?php if ( isset( $params['consent'] ) && true === $params['consent'] ) { ?>
|
657 |
+
<p>
|
658 |
+
<input type="checkbox" name="feedback_data[collect_system_info]" checked="checked" id="ig-feedback-data-consent"/><?php echo esc_html( $params['consent_text'] ); ?>
|
659 |
+
</p>
|
660 |
<?php } ?>
|
661 |
+
</form>
|
662 |
+
</div>
|
663 |
|
664 |
<?php
|
665 |
|
672 |
$event = $this->event_prefix . $params['event'];
|
673 |
$html = ! empty( $params['html'] ) ? $params['html'] : '';
|
674 |
|
675 |
+
$escape_allowed_tags = $this->get_escape_allowed_tags();
|
676 |
+
|
677 |
ob_start();
|
678 |
?>
|
679 |
|
680 |
+
<script type="text/javascript">
|
681 |
|
682 |
jQuery(document).ready(function ($) {
|
683 |
|
684 |
function doSend(details, meta, system_info) {
|
685 |
|
686 |
var data = {
|
687 |
+
action: '<?php echo esc_js( $this->ajax_action ); ?>',
|
688 |
feedback: {
|
689 |
+
type: '<?php echo esc_js( $params['type'] ); ?>',
|
690 |
+
slug: '<?php echo esc_js( $slug ); ?>',
|
691 |
title: '<?php echo esc_js( $title ); ?>',
|
692 |
details: details
|
693 |
},
|
694 |
|
695 |
+
event: '<?php echo esc_js( $event ); ?>',
|
696 |
|
697 |
// Add additional information
|
698 |
misc: {
|
699 |
+
plugin: '<?php echo esc_js( $this->plugin ); ?>',
|
700 |
+
plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
|
701 |
+
is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
|
702 |
+
set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
|
703 |
meta_info: meta,
|
704 |
system_info: system_info
|
705 |
},
|
718 |
}
|
719 |
}
|
720 |
|
721 |
+
var feedbackButtonClass = 'ig-feedback-button-<?php echo esc_js( $this->plugin ); ?>';
|
722 |
|
723 |
$('#wpwrap').append('<div class="ig-es-feedback-button ' + feedbackButtonClass + '">Feedback</div>');
|
724 |
|
725 |
$('.' + feedbackButtonClass).on('click', function () {
|
726 |
Swal.mixin({
|
727 |
+
footer: '<?php echo wp_kses_post( $this->footer ); ?>',
|
728 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
729 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
730 |
animation: false,
|
731 |
focusConfirm: false,
|
732 |
allowEscapeKey: true,
|
733 |
+
showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
|
734 |
+
allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
|
735 |
showLoaderOnConfirm: true,
|
736 |
+
confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
|
737 |
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
738 |
}).queue([
|
739 |
{
|
740 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
741 |
+
html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
|
742 |
customClass: {
|
743 |
popup: 'animated fadeInUpBig'
|
744 |
},
|
747 |
|
748 |
},
|
749 |
preConfirm: () => {
|
750 |
+
var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
|
751 |
var $form = $overlay.find('form');
|
752 |
|
753 |
var email = $form.find('#ig-feedback-data-email').val();
|
785 |
|
786 |
Swal.fire({
|
787 |
type: 'success',
|
788 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
789 |
+
title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
|
790 |
showConfirmButton: false,
|
791 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
792 |
timer: 1500,
|
793 |
animation: false
|
794 |
});
|
800 |
});
|
801 |
});
|
802 |
|
803 |
+
</script>
|
804 |
|
805 |
|
806 |
<?php
|
816 |
|
817 |
$params = $this->prepare_widget_params( $params );
|
818 |
|
819 |
+
$title = $params['title'];
|
820 |
+
$widget_tyoe = ! empty( $params['widget_tyoe'] ) ? $params['widget_tyoe'] : 'question';
|
821 |
+
$slug = sanitize_title( $title );
|
822 |
+
$event = $this->event_prefix . $params['event'];
|
823 |
+
$html = ! empty( $params['html'] ) ? $params['html'] : '';
|
824 |
$confirm_button_link = ! empty( $params['confirmButtonLink'] ) ? $params['confirmButtonLink'] : '';
|
825 |
+
$cancel_button_link = ! empty( $params['cancelButtonLink'] ) ? $params['cancelButtonLink'] : '';
|
826 |
+
$show_cancel_button = ! empty( $params['showCancelButton'] ) ? 'true' : 'false';
|
827 |
+
$cancel_button_text = ! empty( $params['cancelButtonText'] ) ? $params['cancelButtonText'] : 'Cancel';
|
828 |
|
829 |
?>
|
830 |
|
831 |
+
<script>
|
832 |
|
833 |
Swal.mixin({
|
834 |
+
type: '<?php echo esc_js( $widget_tyoe ); ?>',
|
835 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
836 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
837 |
animation: false,
|
838 |
focusConfirm: true,
|
839 |
allowEscapeKey: true,
|
840 |
+
showCancelButton: <?php echo esc_js( $show_cancel_button ); ?>,
|
841 |
confirmButtonColor: '#0e9f6e',
|
842 |
cancelButtonColor: '#5850ec',
|
843 |
+
cancelButtonText: '<?php echo wp_kses_post( $cancel_button_text ); ?>',
|
844 |
+
showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
|
845 |
+
allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
|
846 |
showLoaderOnConfirm: true,
|
847 |
+
confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
|
848 |
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
849 |
}).queue([
|
850 |
{
|
851 |
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
852 |
+
html: '<?php echo wp_kses_post( $html ); ?>',
|
853 |
customClass: {
|
854 |
popup: 'animated fadeInUpBig'
|
855 |
},
|
856 |
|
857 |
preConfirm: () => {
|
858 |
window.open(
|
859 |
+
'<?php echo esc_url( $confirm_button_link ); ?>',
|
860 |
'_blank' // <- This is what makes it open in a new window.
|
861 |
);
|
862 |
}
|
863 |
}
|
864 |
]).then(response => {
|
865 |
|
|
|
866 |
if (response.hasOwnProperty('value')) {
|
867 |
|
868 |
Swal.fire({
|
869 |
type: 'success',
|
870 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
871 |
title: "Thank You!",
|
872 |
showConfirmButton: false,
|
873 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
874 |
timer: 1500,
|
875 |
animation: false
|
876 |
});
|
877 |
} else if(response.dismiss == 'cancel') {
|
878 |
window.open(
|
879 |
+
'<?php echo esc_url( $cancel_button_link ); ?>',
|
880 |
'_blank' // <- This is what makes it open in a new window.
|
881 |
);
|
882 |
}
|
883 |
});
|
884 |
|
885 |
+
</script>
|
886 |
|
887 |
<?php
|
888 |
}
|
897 |
public function render_poll_widget( $params = array() ) {
|
898 |
$params = $this->prepare_widget_params( $params );
|
899 |
|
900 |
+
$fields = ! empty( $params['fields'] ) ? $params['fields'] : array();
|
901 |
+
if ( empty( $fields ) ) {
|
|
|
902 |
return;
|
903 |
}
|
904 |
+
$default_values = ! empty( $params['default_values'] ) ? $params['default_values'] : array();
|
905 |
|
906 |
$allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
|
907 |
|
908 |
$title = $params['title'];
|
909 |
+
if ( ! empty( $params['slug'] ) ) {
|
910 |
+
$slug = $params['slug'];
|
911 |
+
} else {
|
912 |
+
$slug = sanitize_title( $title );
|
913 |
+
}
|
914 |
+
$event = $this->event_prefix . $params['event'];
|
915 |
+
$desc = ! empty( $params['desc'] ) ? $params['desc'] : '';
|
916 |
+
$display_as = ! empty( $params['display_as'] ) ? $params['display_as'] : 'inline';
|
917 |
+
$system_info = isset( $params['system_info'] ) ? $params['system_info'] : true;
|
918 |
|
919 |
ob_start();
|
920 |
|
921 |
?>
|
922 |
|
923 |
+
<div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
|
924 |
+
<form class="ig-general-feedback" id="ig-general-feedback">
|
925 |
+
<?php
|
926 |
+
if ( ! empty( $title ) ) {
|
927 |
+
?>
|
928 |
+
<h2><?php echo wp_kses_post( $title ); ?></h2>
|
929 |
+
<?php
|
930 |
+
}
|
931 |
+
?>
|
932 |
+
<?php
|
933 |
+
if ( ! empty( $desc ) ) {
|
934 |
+
?>
|
935 |
+
<p><?php echo wp_kses_post( $desc ); ?></p>
|
936 |
+
<?php
|
937 |
+
}
|
938 |
+
?>
|
939 |
+
<p class="ig-general-feedback mb-3">
|
940 |
+
<?php
|
941 |
+
foreach ( $fields as $index => $field ) {
|
942 |
+
$field_type = $field['type'];
|
943 |
+
$field_name = $field['name'];
|
944 |
+
$field_value = ! empty( $field['value'] ) ? $field['value'] : '';
|
945 |
+
$field_placeholder = ! empty( $field['placeholder'] ) ? $field['placeholder'] : '';
|
946 |
+
$field_required = isset ( $field['required'] ) ? $field['required'] : false;
|
947 |
+
switch ( $field_type ) {
|
948 |
+
case 'textarea':
|
949 |
+
?>
|
950 |
+
<p class="ig-feedback-data-poll-message mb-3" id="ig-feedback-data-poll-message">
|
951 |
+
<textarea name="feedback_data[<?php echo esc_attr( $field_name ); ?>]" id="ig-feedback-data-poll-additional-message" placeholder="<?php echo esc_attr( $field_placeholder ); ?>"></textarea>
|
952 |
+
</p>
|
953 |
+
<br/>
|
954 |
+
<?php
|
955 |
+
break;
|
956 |
+
case 'radio':
|
957 |
+
case 'checkbox':
|
958 |
+
?>
|
959 |
+
<label>
|
960 |
+
<input
|
961 |
+
type="<?php echo esc_attr( $field_type ); ?>"
|
962 |
+
name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
|
963 |
+
value="<?php echo esc_attr( $field_value ); ?>"
|
964 |
+
<?php echo ( ! empty( $default_values[ $field_name ] ) && $field_value === $default_values[ $field_name ] ) ? 'checked' : ''; ?>
|
965 |
+
class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field"
|
966 |
+
<?php echo $field_required ? 'required' : ''; ?>>
|
967 |
+
<?php echo wp_kses_post( $field['label'] ); ?>
|
968 |
+
</label>
|
969 |
+
<br/>
|
970 |
+
<?php
|
971 |
+
break;
|
972 |
+
default:
|
973 |
+
?>
|
974 |
+
<label>
|
975 |
+
<input
|
976 |
+
type="<?php echo esc_attr( $field_type ); ?>"
|
977 |
+
name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
|
978 |
+
value="<?php echo esc_attr( $field['value'] ); ?>"
|
979 |
+
class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field">
|
980 |
+
<?php echo wp_kses_post( $field['label'] ); ?>
|
981 |
+
</label>
|
982 |
+
<br/>
|
983 |
+
<?php
|
984 |
+
}
|
985 |
+
?>
|
986 |
+
<?php
|
987 |
+
if ( 'other' === $field['value'] ) {
|
988 |
+
?>
|
989 |
+
<div class="ig_feedback_text_wrapper">
|
990 |
+
<textarea
|
991 |
+
id="feedback_text"
|
992 |
+
name="feedback[feedback_text]"
|
993 |
+
class="form-textarea text-sm w-2/3 mt-3 mb-1 border-gray-400 w-3/5 hidden"
|
994 |
+
placeholder="<?php echo esc_attr__( 'Tell us more about your desired feature', $this->plugin ); ?>"></textarea>
|
995 |
+
</div>
|
996 |
+
<?php
|
997 |
+
}
|
998 |
+
}
|
999 |
+
?>
|
1000 |
+
</p>
|
1001 |
+
<?php
|
1002 |
+
if ( 'inline' === $display_as ) {
|
1003 |
+
?>
|
1004 |
+
<button type="submit" class="button">
|
1005 |
+
<?php
|
1006 |
+
echo esc_html__( 'Submit your feedback', $this->plugin );
|
1007 |
+
?>
|
1008 |
+
</button>
|
1009 |
+
<br/>
|
1010 |
+
<br/>
|
1011 |
+
<?php
|
1012 |
+
}
|
1013 |
+
?>
|
1014 |
+
</form>
|
1015 |
+
</div>
|
1016 |
|
1017 |
<?php
|
1018 |
|
1019 |
$html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
|
1020 |
|
|
|
|
|
|
|
|
|
1021 |
$event = $this->event_prefix . $params['event'];
|
1022 |
+
|
1023 |
+
if ( 'inline' === $display_as ) {
|
1024 |
+
$this->render_inline_feedback_widget( $html, $params );
|
1025 |
+
} elseif ( 'popup' === $display_as ) {
|
1026 |
+
$this->render_popup_feedback_widget( $html, $params );
|
1027 |
+
}
|
1028 |
?>
|
1029 |
+
<script type="text/javascript">
|
1030 |
|
1031 |
+
function doSend(data) {
|
1032 |
+
var system_info = <?php echo $system_info ? 'true' : 'false'; ?>;
|
1033 |
+
var requestData = {
|
1034 |
+
action: '<?php echo esc_js( $this->ajax_action ); ?>',
|
1035 |
+
feedback: {
|
1036 |
+
type: '<?php echo esc_js( $params['type'] ); ?>',
|
1037 |
+
slug: '<?php echo esc_js( $slug ); ?>',
|
1038 |
+
data: data
|
1039 |
+
},
|
1040 |
|
1041 |
+
event: '<?php echo esc_js( $event ); ?>',
|
1042 |
|
1043 |
+
// Add additional information
|
1044 |
+
misc: {
|
1045 |
+
plugin: '<?php echo esc_js( $this->plugin ); ?>',
|
1046 |
+
plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
|
1047 |
+
is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
|
1048 |
+
set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
|
1049 |
+
system_info: system_info
|
1050 |
+
},
|
1051 |
+
security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
|
1052 |
+
};
|
1053 |
|
1054 |
+
return jQuery.post(ajaxurl, requestData, null, 'json');
|
1055 |
+
}
|
1056 |
+
</script>
|
1057 |
+
<?php
|
1058 |
+
}
|
1059 |
|
1060 |
+
/**
|
1061 |
+
* Render inline feedback widget
|
1062 |
+
*
|
1063 |
+
* @since 1.2.7
|
1064 |
+
*
|
1065 |
+
* @param string $html
|
1066 |
+
* @param array $params
|
1067 |
+
* @return void
|
1068 |
+
*/
|
1069 |
+
public function render_inline_feedback_widget( $html, $params ) {
|
1070 |
+
$escape_allowed_tags = $this->get_escape_allowed_tags();
|
1071 |
+
?>
|
1072 |
+
<style type="text/css">
|
1073 |
+
.ig-feedback-inline h2{
|
1074 |
+
font-size:2em;
|
1075 |
+
padding: 0.5em 0;
|
1076 |
+
}
|
1077 |
+
.ig-feedback-inline{
|
1078 |
+
border:none;
|
1079 |
+
width:80%;
|
1080 |
+
margin: 1em auto !important;
|
1081 |
+
/* background:#fbe2597d; */
|
1082 |
+
}
|
1083 |
+
.ig-feedback-inline button{
|
1084 |
+
background: green !important;
|
1085 |
+
color: #FFF !important;
|
1086 |
+
}
|
1087 |
+
.ig-feedback-inline radio{
|
1088 |
+
line-height:1em;
|
1089 |
+
}
|
1090 |
+
.ig-feedback-logo{
|
1091 |
+
float:right;
|
1092 |
+
}
|
1093 |
+
.ig-feedback-inline label{
|
1094 |
+
font-size: 1.2em;
|
1095 |
+
padding-bottom: 0.1em;
|
1096 |
+
}
|
1097 |
+
.ig-feedback-inline .button{
|
1098 |
+
padding: 0.7em;
|
1099 |
+
font-size: 1.2em;
|
1100 |
+
border-radius: 0;
|
1101 |
+
}
|
1102 |
+
</style>
|
1103 |
+
<div class="notice ig-feedback-notice ig-feedback-inline">
|
1104 |
+
<?php
|
1105 |
+
if ( $params['logo_img_url'] ) {
|
1106 |
+
?>
|
1107 |
+
<div class="ig-feedback-logo">
|
1108 |
+
<img src="<?php echo esc_url( $params['logo_img_url'] ); ?>">
|
1109 |
+
</div>
|
1110 |
+
<?php
|
1111 |
+
}
|
1112 |
+
?>
|
1113 |
+
<?php echo wp_kses( $html, $escape_allowed_tags ); ?>
|
1114 |
+
</div>
|
1115 |
+
<script type="text/javascript">
|
1116 |
+
jQuery(document).ready(function ($) {
|
1117 |
+
$('.<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field').on('change', function(){
|
1118 |
+
let value = $(this).val();
|
1119 |
+
if ( 'other' === value ) {
|
1120 |
+
$('#feedback_text').removeClass('hidden');
|
1121 |
+
} else {
|
1122 |
+
$('#feedback_text').addClass('hidden');
|
1123 |
+
}
|
1124 |
+
});
|
1125 |
|
1126 |
+
var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
|
1127 |
+
var $form = $overlay.find('form');
|
1128 |
+
$($form).on('submit', function(e){
|
1129 |
+
e.preventDefault();
|
1130 |
+
let selected_feature = $form.find("input[name='feedback_data[feature]']:checked").val();
|
1131 |
+
let form_data = {
|
1132 |
+
questions_response : {
|
1133 |
+
selected_feature: selected_feature
|
1134 |
+
}
|
1135 |
+
}
|
1136 |
|
1137 |
+
if ( selected_feature === 'other' ) {
|
1138 |
+
form_data.other_feature = $form.find('textarea[name="feedback[feedback_text]"]').val();
|
1139 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1140 |
|
1141 |
+
var request = doSend( form_data );
|
1142 |
+
request.done(response => {
|
1143 |
+
if (response.status && response.status === 'success') {
|
1144 |
+
let success_text = '<?php echo esc_html__( 'Your feedback submitted successfully.', $this->plugin ); ?>';
|
1145 |
+
$('.ig-feedback-notice').html('<p>' + success_text + '</p>');
|
1146 |
+
} else {
|
1147 |
+
let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
|
1148 |
+
$('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
|
1149 |
+
}
|
1150 |
+
}).fail( response => {
|
1151 |
+
let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
|
1152 |
+
$('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
|
1153 |
+
});
|
1154 |
+
});
|
1155 |
+
});
|
1156 |
+
</script>
|
1157 |
+
<?php
|
1158 |
+
}
|
1159 |
|
1160 |
+
/**
|
1161 |
+
* Render popup feedback widget
|
1162 |
+
*
|
1163 |
+
* @since 1.2.7
|
1164 |
+
*
|
1165 |
+
* @param string $html
|
1166 |
+
* @param array $params
|
1167 |
+
* @return void
|
1168 |
+
*/
|
1169 |
+
public function render_popup_feedback_widget( $html, $params ) {
|
1170 |
+
$escape_allowed_tags = $this->get_escape_allowed_tags();
|
1171 |
+
?>
|
1172 |
+
<script type="text/javascript">
|
1173 |
|
1174 |
+
jQuery(document).ready(function ($) {
|
|
|
|
|
|
|
1175 |
|
1176 |
+
Swal.mixin({
|
1177 |
+
footer: '',
|
1178 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
1179 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
1180 |
+
animation: false,
|
1181 |
+
focusConfirm: false,
|
1182 |
+
allowEscapeKey: true,
|
1183 |
+
showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
|
1184 |
+
allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
|
1185 |
+
showLoaderOnConfirm: true,
|
1186 |
+
confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
|
1187 |
+
backdrop: '<?php echo (int) $params['backdrop']; ?>'
|
1188 |
+
}).queue([
|
1189 |
+
{
|
1190 |
+
title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
|
1191 |
+
html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
|
1192 |
+
customClass: {
|
1193 |
+
popup: 'animated fadeInUpBig'
|
1194 |
+
},
|
1195 |
+
onOpen: () => {
|
1196 |
|
1197 |
+
},
|
1198 |
|
1199 |
+
preConfirm: () => {
|
1200 |
+
var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
|
1201 |
+
var $form = $overlay.find('form');
|
1202 |
+
if ( ! jQuery($form)[0].checkValidity()) {
|
1203 |
+
Swal.showValidationMessage('<?php echo esc_html__( 'Please select option', $this->plugin ); ?>');
|
1204 |
+
return;
|
1205 |
}
|
|
|
1206 |
|
1207 |
+
var poll_options = $form.find("input[name='feedback_data[poll_options]']:checked").val();
|
1208 |
+
var message = $form.find("#ig-feedback-data-poll-additional-message").val();
|
1209 |
|
1210 |
+
var data = {
|
1211 |
+
poll_option: poll_options,
|
1212 |
+
additional_feedback: message
|
1213 |
+
};
|
1214 |
|
1215 |
+
var meta = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1216 |
|
1217 |
+
return doSend(data);
|
1218 |
}
|
1219 |
+
},
|
1220 |
|
1221 |
+
]).then(response => {
|
1222 |
|
1223 |
+
if (response.hasOwnProperty('value')) {
|
1224 |
|
1225 |
+
Swal.fire({
|
1226 |
+
type: 'success',
|
1227 |
+
width: <?php echo esc_js( $params['width'] ); ?>,
|
1228 |
+
title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
|
1229 |
+
showConfirmButton: false,
|
1230 |
+
position: '<?php echo esc_js( $params['position'] ); ?>',
|
1231 |
+
timer: 1500,
|
1232 |
+
animation: false
|
1233 |
+
});
|
1234 |
|
1235 |
+
}
|
1236 |
+
});
|
1237 |
+
});
|
1238 |
|
1239 |
+
</script>
|
1240 |
<?php
|
1241 |
}
|
|
|
|
|
1242 |
/**
|
1243 |
* Get Feedback API url
|
1244 |
*
|
1271 |
$title = 'Why are you deactivating ' . $this->name . '?';
|
1272 |
$slug = sanitize_title( $title );
|
1273 |
$event = $this->event_prefix . 'plugin.deactivation';
|
1274 |
+
|
1275 |
?>
|
1276 |
+
<script type="text/javascript">
|
1277 |
jQuery(function ($) {
|
1278 |
+
var $deactivateLink = $('#the-list').find('[data-slug="<?php echo esc_js( $this->plugin ); ?>"] span.deactivate a'),
|
1279 |
+
$overlay = $('#ig-deactivate-survey-<?php echo esc_js( $this->plugin ); ?>'),
|
1280 |
$form = $overlay.find('form'),
|
1281 |
formOpen = false,
|
1282 |
+
consent = $('#ig-deactivate-survey-help-consent-<?php echo esc_js( $this->plugin ); ?>');
|
1283 |
|
1284 |
function togglePersonalInfoFields(show) {
|
1285 |
|
1336 |
// Survey Skip & Deactivate.
|
1337 |
$form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
|
1338 |
event.preventDefault();
|
1339 |
+
let deactivationURL = $deactivateLink.attr('href');
|
1340 |
+
let skipSurveyURL = deactivationURL + '&survey_status=skipped';
|
1341 |
+
location.href = skipSurveyURL;
|
1342 |
});
|
1343 |
|
1344 |
// Help Consent
|
1381 |
};
|
1382 |
|
1383 |
var data = {
|
1384 |
+
action: '<?php echo esc_js( $this->ajax_action ); ?>',
|
1385 |
feedback: {
|
1386 |
type: 'radio',
|
1387 |
+
title: '<?php echo esc_js( $title ); ?>',
|
1388 |
+
slug: '<?php echo esc_js( $slug ); ?>',
|
1389 |
value: $form.find('.selected input[type=radio]').attr('data-option-slug'),
|
1390 |
details: $form.find('.selected input[type=text]').val()
|
1391 |
},
|
1392 |
|
1393 |
+
event: '<?php echo esc_js( $event ); ?>',
|
1394 |
|
1395 |
// Add additional information
|
1396 |
misc: {
|
1397 |
+
plugin: '<?php echo esc_js( $this->plugin ); ?>',
|
1398 |
+
plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
|
1399 |
+
is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
|
1400 |
set_cookie: '',
|
1401 |
meta_info: meta,
|
1402 |
system_info: system_info
|
1418 |
}
|
1419 |
});
|
1420 |
});
|
1421 |
+
</script>
|
1422 |
<?php
|
1423 |
}
|
1424 |
|
1433 |
return;
|
1434 |
}
|
1435 |
?>
|
1436 |
+
<style type="text/css">
|
1437 |
+
.ig-deactivate-survey-modal {
|
1438 |
+
display: none;
|
1439 |
+
table-layout: fixed;
|
1440 |
+
position: fixed;
|
1441 |
+
z-index: 9999;
|
1442 |
+
width: 100%;
|
1443 |
+
height: 100%;
|
1444 |
+
text-align: center;
|
1445 |
+
font-size: 14px;
|
1446 |
+
top: 0;
|
1447 |
+
left: 0;
|
1448 |
+
background: rgba(0, 0, 0, 0.8);
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
.ig-deactivate-survey-wrap {
|
1452 |
+
display: table-cell;
|
1453 |
+
vertical-align: middle;
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
.ig-deactivate-survey {
|
1457 |
+
background-color: #fff;
|
1458 |
+
max-width: 550px;
|
1459 |
+
margin: 0 auto;
|
1460 |
+
padding: 30px;
|
1461 |
+
text-align: left;
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
.ig-deactivate-survey .error {
|
1465 |
+
display: block;
|
1466 |
+
color: red;
|
1467 |
+
margin: 0 0 10px 0;
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
.ig-deactivate-survey-title {
|
1471 |
+
display: block;
|
1472 |
+
font-size: 18px;
|
1473 |
+
font-weight: 700;
|
1474 |
+
text-transform: uppercase;
|
1475 |
+
border-bottom: 1px solid #ddd;
|
1476 |
+
padding: 0 0 18px 0;
|
1477 |
+
margin: 0 0 18px 0;
|
1478 |
+
}
|
1479 |
+
|
1480 |
+
.ig-deactivate-survey-options {
|
1481 |
+
border-bottom: 1px solid #ddd;
|
1482 |
+
padding: 0 0 18px 0;
|
1483 |
+
margin: 0 0 18px 0;
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
.ig-deactivate-survey-info-data {
|
1487 |
+
padding: 0 0 18px 0;
|
1488 |
+
margin: 10px 10px 10px 30px;
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
.ig-deactivate-survey-info-name, .ig-deactivate-survey-info-email-address {
|
1492 |
+
width: 230px;
|
1493 |
+
margin: 10px;
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
.ig-deactivate-survey-title span {
|
1497 |
+
color: #999;
|
1498 |
+
margin-right: 10px;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
.ig-deactivate-survey-desc {
|
1502 |
+
display: block;
|
1503 |
+
font-weight: 600;
|
1504 |
+
margin: 0 0 18px 0;
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
.ig-deactivate-survey-option {
|
1508 |
+
margin: 0 0 10px 0;
|
1509 |
+
}
|
1510 |
+
|
1511 |
+
.ig-deactivate-survey-option-input {
|
1512 |
+
margin-right: 10px !important;
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
.ig-deactivate-survey-option-details {
|
1516 |
+
display: none;
|
1517 |
+
width: 90%;
|
1518 |
+
margin: 10px 0 0 30px;
|
1519 |
+
}
|
1520 |
+
|
1521 |
+
.ig-deactivate-survey-footer {
|
1522 |
+
margin-top: 18px;
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
.ig-deactivate-survey-deactivate {
|
1526 |
+
float: right;
|
1527 |
+
font-size: 13px;
|
1528 |
+
color: #ccc;
|
1529 |
+
text-decoration: none;
|
1530 |
+
padding-top: 7px;
|
1531 |
+
}
|
1532 |
+
|
1533 |
+
.ig-deactivate-survey-loader {
|
1534 |
+
vertical-align: middle;
|
1535 |
+
padding: 10px;
|
1536 |
+
}
|
1537 |
+
</style>
|
1538 |
<?php
|
1539 |
}
|
1540 |
|
1554 |
$options = array(
|
1555 |
1 => array(
|
1556 |
'title' => esc_html__( 'I no longer need the plugin', $this->plugin ),
|
1557 |
+
'slug' => 'i-no-longer-need-the-plugin',
|
1558 |
),
|
1559 |
2 => array(
|
1560 |
'title' => esc_html__( 'I\'m switching to a different plugin', $this->plugin ),
|
1563 |
),
|
1564 |
3 => array(
|
1565 |
'title' => esc_html__( 'I couldn\'t get the plugin to work', $this->plugin ),
|
1566 |
+
'slug' => 'i-could-not-get-the-plugin-to-work',
|
1567 |
),
|
1568 |
4 => array(
|
1569 |
'title' => esc_html__( 'It\'s a temporary deactivation', $this->plugin ),
|
1570 |
+
'slug' => 'it-is-a-temporary-deactivation',
|
1571 |
),
|
1572 |
5 => array(
|
1573 |
'title' => esc_html__( 'Other', $this->plugin ),
|
1576 |
),
|
1577 |
);
|
1578 |
?>
|
1579 |
+
<div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo esc_js( $this->plugin ); ?>">
|
1580 |
+
<div class="ig-deactivate-survey-wrap">
|
1581 |
+
<form class="ig-deactivate-survey" method="post">
|
1582 |
+
<span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', $this->plugin ); ?></span>
|
1583 |
+
<span class="ig-deactivate-survey-desc"><?php echo esc_html__( sprintf( 'If you have a moment, please share why you are deactivating %s:', $this->name ), $this->plugin ); ?></span>
|
1584 |
+
<div class="ig-deactivate-survey-options">
|
1585 |
<?php foreach ( $options as $id => $option ) : ?>
|
1586 |
+
<div class="ig-deactivate-survey-option">
|
1587 |
+
<label for="ig-deactivate-survey-option-<?php echo esc_attr( $this->plugin ); ?>-<?php echo esc_attr( $id ); ?>" class="ig-deactivate-survey-option-label">
|
1588 |
+
<input id="ig-deactivate-survey-option-<?php echo esc_attr( $this->plugin ); ?>-<?php echo esc_attr( $id ); ?>" class="ig-deactivate-survey-option-input" type="radio" name="code" value="<?php echo esc_attr( $id ); ?>" data-option-slug="<?php echo esc_attr( $option['slug'] ); ?>"/>
|
1589 |
+
<span class="ig-deactivate-survey-option-reason"><?php echo esc_attr( $option['title'] ); ?></span>
|
1590 |
+
</label>
|
1591 |
<?php if ( ! empty( $option['details'] ) ) : ?>
|
1592 |
+
<input class="ig-deactivate-survey-option-details" type="text" placeholder="<?php echo esc_attr( $option['details'] ); ?>"/>
|
1593 |
<?php endif; ?>
|
1594 |
+
</div>
|
1595 |
<?php endforeach; ?>
|
1596 |
+
</div>
|
1597 |
+
<div class="ig-deactivate-survey-help-consent">
|
1598 |
+
<input id="ig-deactivate-survey-help-consent-<?php echo esc_attr( $this->plugin ); ?>" class="ig-deactivate-survey-option-input" type="checkbox" name="code" data-option-slug="<?php echo esc_attr( $option['slug'] ); ?>"/><b><?php echo esc_html__( 'Yes, I give my consent to track plugin usage and contact me back to make this plugin works!', $this->plugin ); ?></b>
|
1599 |
+
</div>
|
1600 |
+
<div class="ig-deactivate-survey-info-data">
|
1601 |
+
|
1602 |
+
<input type="text" class="ig-deactivate-survey-info-name" id="ig-deactivate-survey-info-name" placeholder="Enter Name" name="ig-deactivate-survey-info-name" value=""/>
|
1603 |
+
<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 esc_js( $email ); ?>"/>
|
1604 |
+
</div>
|
1605 |
+
<div class="ig-deactivate-survey-footer">
|
1606 |
+
<button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', $this->plugin ), '&' ); ?></button>
|
1607 |
+
<img class="ig-deactivate-survey-loader" id="ig-deactivate-survey-loader" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>/assets/images/loading.gif"/>
|
1608 |
+
<a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', $this->plugin ), '&' ); ?></a>
|
1609 |
+
</div>
|
1610 |
+
</form>
|
1611 |
+
</div>
|
1612 |
+
</div>
|
1613 |
<?php
|
1614 |
}
|
1615 |
|
1693 |
$is_local_url = true;
|
1694 |
continue;
|
1695 |
}
|
|
|
1696 |
}
|
1697 |
if ( substr_count( $host, '.' ) > 1 ) {
|
1698 |
$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
|
1793 |
return true;
|
1794 |
}
|
1795 |
}
|
|
|
1796 |
}
|
1797 |
|
1798 |
return false;
|
1803 |
* Set event into transient
|
1804 |
*
|
1805 |
* @param $event
|
1806 |
+
* @param int $expiry in days
|
1807 |
*/
|
1808 |
public function set_event_transient( $event, $expiry = 45 ) {
|
1809 |
set_transient( $event, 1, time() + ( 86400 * $expiry ) );
|
1852 |
*
|
1853 |
* Send feedback to server
|
1854 |
*/
|
1855 |
+
public function submit_feedback() {
|
1856 |
|
1857 |
check_ajax_referer( $this->plugin_abbr . '-admin-ajax-nonce', 'security' );
|
1858 |
|
1873 |
'plugin' => sanitize_key( $plugin ),
|
1874 |
'locale' => get_locale(),
|
1875 |
'wp_version' => get_bloginfo( 'version' ),
|
1876 |
+
'php_version' => PHP_VERSION,
|
1877 |
);
|
1878 |
|
1879 |
$meta_info = wp_parse_args( $meta_info, $default_meta_info );
|
1893 |
'timeout' => 15,
|
1894 |
'sslverify' => false,
|
1895 |
'body' => $data,
|
1896 |
+
'blocking' => false,
|
1897 |
);
|
1898 |
|
1899 |
$this->set_feedback_data( $plugin_abbr, $data['event'], $data['feedback'] );
|
1903 |
$this->set_event_transient( $data['event'] );
|
1904 |
}
|
1905 |
|
1906 |
+
$response = wp_remote_post( $this->get_api_url( $is_dev_mode ), $args );
|
|
|
1907 |
$result['status'] = 'success';
|
1908 |
if ( $response instanceof WP_Error ) {
|
1909 |
$error_message = $response->get_error_message();
|
1913 |
|
1914 |
die( json_encode( $result ) );
|
1915 |
}
|
1916 |
+
|
1917 |
+
/**
|
1918 |
+
* Get list of tags allowed in escaping
|
1919 |
+
*
|
1920 |
+
* @return array $ig_es_escape_allowed_tags
|
1921 |
+
*/
|
1922 |
+
public function get_escape_allowed_tags() {
|
1923 |
+
$ig_es_escape_allowed_tags = apply_filters( $this->plugin_abbr . '_escape_allowed_tags', array() );
|
1924 |
+
return $ig_es_escape_allowed_tags;
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
/**
|
1928 |
+
* Render Quick Feedback Widget
|
1929 |
+
*
|
1930 |
+
* @param $params
|
1931 |
+
*
|
1932 |
+
* @since 4.1.0
|
1933 |
+
*/
|
1934 |
+
public function render_feedback_widget( $params ) {
|
1935 |
+
|
1936 |
+
if ( ! $this->can_show_feedback_widget() ) {
|
1937 |
+
return;
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
$default_params = array(
|
1941 |
+
'set_transient' => true,
|
1942 |
+
'force' => false,
|
1943 |
+
'show_once' => false,
|
1944 |
+
);
|
1945 |
+
|
1946 |
+
$params = wp_parse_args( $params, $default_params );
|
1947 |
+
|
1948 |
+
if ( ! empty( $params['event'] ) ) {
|
1949 |
+
|
1950 |
+
$event = $this->event_prefix . $params['event'];
|
1951 |
+
$force = ! empty( $params['force'] ) ? $params['force'] : false;
|
1952 |
+
|
1953 |
+
$can_show = false;
|
1954 |
+
|
1955 |
+
if ( $force ) {
|
1956 |
+
$can_show = true;
|
1957 |
+
} else {
|
1958 |
+
if ( ! $this->is_event_transient_set( $event ) ) {
|
1959 |
+
$can_show = true;
|
1960 |
+
|
1961 |
+
$feedback_data = $this->get_event_feedback_data( $this->plugin_abbr, $event );
|
1962 |
+
if ( count( $feedback_data ) > 0 ) {
|
1963 |
+
$show_once = $params['show_once'];
|
1964 |
+
$feedback_data = array_reverse( $feedback_data );
|
1965 |
+
$last_feedback_given_on = $feedback_data[0]['created_on'];
|
1966 |
+
|
1967 |
+
// If event feedback given within 45 days or show event only once?
|
1968 |
+
// Don't show now
|
1969 |
+
if ( $show_once || ( strtotime( $last_feedback_given_on ) > strtotime( '-45 days' ) ) ) {
|
1970 |
+
$can_show = false;
|
1971 |
+
}
|
1972 |
+
}
|
1973 |
+
}
|
1974 |
+
}
|
1975 |
+
|
1976 |
+
if ( $can_show ) {
|
1977 |
+
if ( 'star' === $params['type'] ) {
|
1978 |
+
$this->render_stars( $params );
|
1979 |
+
} elseif ( 'emoji' === $params['type'] ) {
|
1980 |
+
$this->render_emoji( $params );
|
1981 |
+
} elseif ( 'feedback' === $params['type'] ) {
|
1982 |
+
$this->render_general_feedback( $params );
|
1983 |
+
} elseif ( 'fb' === $params['type'] ) {
|
1984 |
+
/**
|
1985 |
+
* We are not calling home for this event and we want to show
|
1986 |
+
* this Widget only once. So, we are storing feedback data now.
|
1987 |
+
*/
|
1988 |
+
$this->set_feedback_data( $this->plugin_abbr, $event );
|
1989 |
+
$this->render_fb_widget( $params );
|
1990 |
+
} elseif ( 'poll' === $params['type'] ) {
|
1991 |
+
if ( $params['show_once'] ) {
|
1992 |
+
$this->set_feedback_data( $this->plugin_abbr, $event );
|
1993 |
+
}
|
1994 |
+
$this->render_poll_widget( $params );
|
1995 |
+
}
|
1996 |
+
}
|
1997 |
+
}
|
1998 |
+
|
1999 |
+
}
|
2000 |
}
|
2001 |
+
} // End if().
|
includes/feedback/class-ig-tracker.php
CHANGED
@@ -246,4 +246,4 @@ if ( ! class_exists( 'IG_Tracker_V_1_2_5' ) ) {
|
|
246 |
return $wp_info;
|
247 |
}
|
248 |
}
|
249 |
-
}
|
246 |
return $wp_info;
|
247 |
}
|
248 |
}
|
249 |
+
}
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: temporary access, developer access, passwordless login, magic pin, secure login
|
5 |
Requires at least: 3.0.1
|
6 |
Requires PHP: 5.3
|
7 |
-
Tested up to: 6.0.
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -171,12 +171,16 @@ Yes. There is no limit to create temporary logins. You can create as many tempor
|
|
171 |
|
172 |
== Upgrade Notice ==
|
173 |
|
174 |
-
= 1.7.
|
175 |
|
176 |
-
* Update:
|
177 |
|
178 |
== Changelog ==
|
179 |
|
|
|
|
|
|
|
|
|
180 |
**1.7.5 [2022-08-16]**
|
181 |
|
182 |
* Fix: Fatal error: Uncaught Error: Class 'IG_Tracker_V_1_2_5' not found
|
4 |
Tags: temporary access, developer access, passwordless login, magic pin, secure login
|
5 |
Requires at least: 3.0.1
|
6 |
Requires PHP: 5.3
|
7 |
+
Tested up to: 6.0.2
|
8 |
+
Stable tag: 1.7.6
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
171 |
|
172 |
== Upgrade Notice ==
|
173 |
|
174 |
+
= 1.7.6 =
|
175 |
|
176 |
+
* Update: WordPress 6.0.2 compatibility check
|
177 |
|
178 |
== Changelog ==
|
179 |
|
180 |
+
**1.7.6 [2022-09-14]**
|
181 |
+
|
182 |
+
* Update: WordPress 6.0.2 compatibility check
|
183 |
+
|
184 |
**1.7.5 [2022-08-16]**
|
185 |
|
186 |
* Fix: Fatal error: Uncaught Error: Class 'IG_Tracker_V_1_2_5' not found
|
temporary-login-without-password.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
6 |
-
* Version: 1.7.
|
7 |
* Author: StoreApps
|
8 |
* Author URI: https://www.storeapps.org
|
9 |
* Requires at least: 3.0.1
|
10 |
-
* Tested up to: 6.0.
|
11 |
* License: GPLv3
|
12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
* Text Domain: temporary-login-without-password
|
@@ -25,8 +25,9 @@ if ( ! defined( 'WPINC' ) ) {
|
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
-
define( 'WTLWP_PLUGIN_VERSION', '1.7.
|
29 |
-
define( 'WTLWP_FEEDBACK_VERSION', '1.2.
|
|
|
30 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
31 |
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
32 |
define( 'WTLWP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
3 |
* Plugin Name: Temporary Login Without Password
|
4 |
* Plugin URI: http://www.storeapps.org/create-secure-login-without-password-for-wordpress/
|
5 |
* Description: Create a temporary login link with any role using which one can access to your sytem without username and password for limited period of time.
|
6 |
+
* Version: 1.7.6
|
7 |
* Author: StoreApps
|
8 |
* Author URI: https://www.storeapps.org
|
9 |
* Requires at least: 3.0.1
|
10 |
+
* Tested up to: 6.0.2
|
11 |
* License: GPLv3
|
12 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
* Text Domain: temporary-login-without-password
|
25 |
/**
|
26 |
* Define constants
|
27 |
*/
|
28 |
+
define( 'WTLWP_PLUGIN_VERSION', '1.7.6' );
|
29 |
+
define( 'WTLWP_FEEDBACK_VERSION', '1.2.8' );
|
30 |
+
define( 'WTLWP_TRACKER_VERSION', '1.2.5' );
|
31 |
define( 'WTLWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
32 |
define( 'WTLWP_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
33 |
define( 'WTLWP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|