Version Description
- minor improvement
Download this release
Release Info
Developer | fullworks |
Plugin | Stop User Enumeration |
Version | 1.3.20 |
Comparing to | |
See all releases |
Code changes from version 1.3.19 to 1.3.20
- bootstrap.php +1 -1
- includes/vendor/freemius/wordpress-sdk/includes/class-freemius.php +22 -1
- includes/vendor/freemius/wordpress-sdk/start.php +1 -1
- includes/vendor/freemius/wordpress-sdk/templates/debug.php +2 -0
- includes/vendor/freemius/wordpress-sdk/templates/forms/deactivation/form.php +497 -497
- readme.txt +4 -1
- stop-user-enumeration.php +1 -1
bootstrap.php
CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
9 |
die;
|
10 |
}
|
11 |
define( 'STOP_USER_ENUMERATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
12 |
-
define( 'STOP_USER_ENUMERATION_PLUGIN_VERSION', '1.3.
|
13 |
|
14 |
// Include the autoloader so we can dynamically include the classes.
|
15 |
require_once( STOP_USER_ENUMERATION_PLUGIN_DIR . 'includes/autoloader.php' );
|
9 |
die;
|
10 |
}
|
11 |
define( 'STOP_USER_ENUMERATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
12 |
+
define( 'STOP_USER_ENUMERATION_PLUGIN_VERSION', '1.3.20' );
|
13 |
|
14 |
// Include the autoloader so we can dynamically include the classes.
|
15 |
require_once( STOP_USER_ENUMERATION_PLUGIN_DIR . 'includes/autoloader.php' );
|
includes/vendor/freemius/wordpress-sdk/includes/class-freemius.php
CHANGED
@@ -2977,6 +2977,10 @@
|
|
2977 |
* @since 1.1.7.3
|
2978 |
*/
|
2979 |
static function _toggle_debug_mode() {
|
|
|
|
|
|
|
|
|
2980 |
$is_on = fs_request_get( 'is_on', false, 'post' );
|
2981 |
|
2982 |
if ( fs_request_is_post() && in_array( $is_on, array( 0, 1 ) ) ) {
|
@@ -3008,8 +3012,16 @@
|
|
3008 |
* @since 1.2.1.7
|
3009 |
*/
|
3010 |
static function _get_db_option() {
|
|
|
|
|
3011 |
$option_name = fs_request_get( 'option_name' );
|
3012 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3013 |
$value = get_option( $option_name );
|
3014 |
|
3015 |
$result = array(
|
@@ -3032,7 +3044,16 @@
|
|
3032 |
* @since 1.2.1.7
|
3033 |
*/
|
3034 |
static function _set_db_option() {
|
3035 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3036 |
$option_value = fs_request_get( 'option_value' );
|
3037 |
|
3038 |
if ( ! empty( $option_value ) ) {
|
2977 |
* @since 1.1.7.3
|
2978 |
*/
|
2979 |
static function _toggle_debug_mode() {
|
2980 |
+
if ( ! is_super_admin() ) {
|
2981 |
+
return;
|
2982 |
+
}
|
2983 |
+
|
2984 |
$is_on = fs_request_get( 'is_on', false, 'post' );
|
2985 |
|
2986 |
if ( fs_request_is_post() && in_array( $is_on, array( 0, 1 ) ) ) {
|
3012 |
* @since 1.2.1.7
|
3013 |
*/
|
3014 |
static function _get_db_option() {
|
3015 |
+
check_admin_referer( 'fs_get_db_option' );
|
3016 |
+
|
3017 |
$option_name = fs_request_get( 'option_name' );
|
3018 |
|
3019 |
+
if ( ! is_super_admin() ||
|
3020 |
+
! fs_starts_with( $option_name, 'fs_' )
|
3021 |
+
) {
|
3022 |
+
self::shoot_ajax_failure();
|
3023 |
+
}
|
3024 |
+
|
3025 |
$value = get_option( $option_name );
|
3026 |
|
3027 |
$result = array(
|
3044 |
* @since 1.2.1.7
|
3045 |
*/
|
3046 |
static function _set_db_option() {
|
3047 |
+
check_admin_referer( 'fs_set_db_option' );
|
3048 |
+
|
3049 |
+
$option_name = fs_request_get( 'option_name' );
|
3050 |
+
|
3051 |
+
if ( ! is_super_admin() ||
|
3052 |
+
! fs_starts_with( $option_name, 'fs_' )
|
3053 |
+
) {
|
3054 |
+
self::shoot_ajax_failure();
|
3055 |
+
}
|
3056 |
+
|
3057 |
$option_value = fs_request_get( 'option_value' );
|
3058 |
|
3059 |
if ( ! empty( $option_value ) ) {
|
includes/vendor/freemius/wordpress-sdk/start.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
-
$this_sdk_version = '2.2.
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
+
$this_sdk_version = '2.2.4';
|
19 |
|
20 |
#region SDK Selection Logic --------------------------------------------------------------------
|
21 |
|
includes/vendor/freemius/wordpress-sdk/templates/debug.php
CHANGED
@@ -113,6 +113,7 @@
|
|
113 |
if (optionName) {
|
114 |
$.post(ajaxurl, {
|
115 |
action : 'fs_get_db_option',
|
|
|
116 |
option_name: optionName
|
117 |
}, function (response) {
|
118 |
if (response.data.value)
|
@@ -132,6 +133,7 @@
|
|
132 |
if (optionValue) {
|
133 |
$.post(ajaxurl, {
|
134 |
action : 'fs_set_db_option',
|
|
|
135 |
option_name : optionName,
|
136 |
option_value: optionValue
|
137 |
}, function () {
|
113 |
if (optionName) {
|
114 |
$.post(ajaxurl, {
|
115 |
action : 'fs_get_db_option',
|
116 |
+
_wpnonce : '<?php echo wp_create_nonce( 'fs_get_db_option' ) ?>',
|
117 |
option_name: optionName
|
118 |
}, function (response) {
|
119 |
if (response.data.value)
|
133 |
if (optionValue) {
|
134 |
$.post(ajaxurl, {
|
135 |
action : 'fs_set_db_option',
|
136 |
+
_wpnonce : '<?php echo wp_create_nonce( 'fs_set_db_option' ) ?>',
|
137 |
option_name : optionName,
|
138 |
option_value: optionValue
|
139 |
}, function () {
|
includes/vendor/freemius/wordpress-sdk/templates/forms/deactivation/form.php
CHANGED
@@ -1,497 +1,497 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.2
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
$slug = $fs->get_slug();
|
18 |
-
|
19 |
-
$confirmation_message = $fs->apply_filters( 'uninstall_confirmation_message', '' );
|
20 |
-
|
21 |
-
$reasons = $VARS['reasons'];
|
22 |
-
|
23 |
-
$reasons_list_items_html = '';
|
24 |
-
|
25 |
-
foreach ( $reasons as $reason ) {
|
26 |
-
$list_item_classes = 'reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
|
27 |
-
|
28 |
-
if ( isset( $reason['internal_message'] ) && ! empty( $reason['internal_message'] ) ) {
|
29 |
-
$list_item_classes .= ' has-internal-message';
|
30 |
-
$reason_internal_message = $reason['internal_message'];
|
31 |
-
} else {
|
32 |
-
$reason_internal_message = '';
|
33 |
-
}
|
34 |
-
|
35 |
-
$reason_input_type = ( ! empty( $reason['input_type'] ) ? $reason['input_type'] : '' );
|
36 |
-
$reason_input_placeholder = ( ! empty( $reason['input_placeholder'] ) ? $reason['input_placeholder'] : '' );
|
37 |
-
|
38 |
-
$reason_list_item_html = <<< HTML
|
39 |
-
<li class="{$list_item_classes}"
|
40 |
-
data-input-type="{$reason_input_type}"
|
41 |
-
data-input-placeholder="{$reason_input_placeholder}">
|
42 |
-
<label>
|
43 |
-
<span>
|
44 |
-
<input type="radio" name="selected-reason" value="{$reason['id']}"/>
|
45 |
-
</span>
|
46 |
-
<span>{$reason['text']}</span>
|
47 |
-
</label>
|
48 |
-
<div class="internal-message">{$reason_internal_message}</div>
|
49 |
-
</li>
|
50 |
-
HTML;
|
51 |
-
|
52 |
-
$reasons_list_items_html .= $reason_list_item_html;
|
53 |
-
}
|
54 |
-
|
55 |
-
$is_anonymous = ( ! $fs->is_registered() );
|
56 |
-
if ( $is_anonymous ) {
|
57 |
-
$anonymous_feedback_checkbox_html = sprintf(
|
58 |
-
'<label class="anonymous-feedback-label"><input type="checkbox" class="anonymous-feedback-checkbox"> %s</label>',
|
59 |
-
fs_esc_html_inline( 'Anonymous feedback', 'anonymous-feedback', $slug )
|
60 |
-
);
|
61 |
-
} else {
|
62 |
-
$anonymous_feedback_checkbox_html = '';
|
63 |
-
}
|
64 |
-
|
65 |
-
// Aliases.
|
66 |
-
$deactivate_text = fs_text_inline( 'Deactivate', 'deactivate', $slug );
|
67 |
-
$theme_text = fs_text_inline( 'Theme', 'theme', $slug );
|
68 |
-
$activate_x_text = fs_text_inline( 'Activate %s', 'activate-x', $slug );
|
69 |
-
|
70 |
-
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
71 |
-
?>
|
72 |
-
<?php $fs->_maybe_add_subscription_cancellation_dialog_box() ?>
|
73 |
-
<script type="text/javascript">
|
74 |
-
(function ($) {
|
75 |
-
var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ) ?>,
|
76 |
-
modalHtml =
|
77 |
-
'<div class="fs-modal fs-modal-deactivation-feedback<?php echo empty( $confirmation_message ) ? ' no-confirmation-message' : ''; ?>">'
|
78 |
-
+ ' <div class="fs-modal-dialog">'
|
79 |
-
+ ' <div class="fs-modal-header">'
|
80 |
-
+ ' <h4><?php fs_esc_attr_echo_inline( 'Quick Feedback', 'quick-feedback' , $slug ) ?></h4>'
|
81 |
-
+ ' </div>'
|
82 |
-
+ ' <div class="fs-modal-body">'
|
83 |
-
+ ' <div class="fs-modal-panel" data-panel-id="confirm"><p><?php echo $confirmation_message; ?></p></div>'
|
84 |
-
+ ' <div class="fs-modal-panel active" data-panel-id="reasons"><h3><strong><?php echo esc_js( sprintf( fs_text_inline( 'If you have a moment, please let us know why you are %s', 'deactivation-share-reason' , $slug ), ( $fs->is_plugin() ? fs_text_inline( 'deactivating', 'deactivating', $slug ) : fs_text_inline( 'switching', 'switching', $slug ) ) ) ) ?>:</strong></h3><ul id="reasons-list">' + reasonsHtml + '</ul></div>'
|
85 |
-
+ ' </div>'
|
86 |
-
+ ' <div class="fs-modal-footer">'
|
87 |
-
+ ' <?php echo $anonymous_feedback_checkbox_html ?>'
|
88 |
-
+ ' <a href="#" class="button button-secondary button-deactivate"></a>'
|
89 |
-
+ ' <a href="#" class="button button-primary button-close"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>'
|
90 |
-
+ ' </div>'
|
91 |
-
+ ' </div>'
|
92 |
-
+ '</div>',
|
93 |
-
$modal = $(modalHtml),
|
94 |
-
$deactivateLink = $('#the-list .deactivate > [data-module-id=<?php echo $fs->get_id() ?>].fs-module-id').prev(),
|
95 |
-
selectedReasonID = false,
|
96 |
-
redirectLink = '',
|
97 |
-
$anonymousFeedback = $modal.find( '.anonymous-feedback-label' ),
|
98 |
-
isAnonymous = <?php echo ( $is_anonymous ? 'true' : 'false' ); ?>,
|
99 |
-
otherReasonID = <?php echo Freemius::REASON_OTHER; ?>,
|
100 |
-
dontShareDataReasonID = <?php echo Freemius::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION; ?>,
|
101 |
-
deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_any_active_valid_license() ? 'true' : 'false' ?>,
|
102 |
-
$subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' );
|
103 |
-
|
104 |
-
$modal.appendTo($('body'));
|
105 |
-
|
106 |
-
if ( 0 !== $subscriptionCancellationModal.length ) {
|
107 |
-
$subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
|
108 |
-
if ( false === cancelSubscription ) {
|
109 |
-
showModal();
|
110 |
-
|
111 |
-
$subscriptionCancellationModal.trigger( 'closeModal' );
|
112 |
-
} else {
|
113 |
-
var $errorMessage = $subscriptionCancellationModal.find( '.notice-error' );
|
114 |
-
|
115 |
-
<?php
|
116 |
-
$subscription_cancellation_context = $fs->is_paid_trial() ?
|
117 |
-
fs_text_inline( 'trial', 'trial', $slug ) :
|
118 |
-
fs_text_inline( 'subscription', 'subscription', $slug );
|
119 |
-
?>
|
120 |
-
|
121 |
-
$.ajax({
|
122 |
-
url : ajaxurl,
|
123 |
-
method : 'POST',
|
124 |
-
data : {
|
125 |
-
action : '<?php echo $fs->get_ajax_action( 'cancel_subscription_or_trial' ) ?>',
|
126 |
-
security : '<?php echo $fs->get_ajax_security( 'cancel_subscription_or_trial' ) ?>',
|
127 |
-
module_id: '<?php echo $fs->get_id() ?>'
|
128 |
-
},
|
129 |
-
beforeSend: function() {
|
130 |
-
$errorMessage.hide();
|
131 |
-
|
132 |
-
$subscriptionCancellationModal.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
|
133 |
-
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( '<?php echo esc_js(
|
134 |
-
sprintf( fs_text_inline( 'Cancelling %s...', 'cancelling-x' , $slug ), $subscription_cancellation_context )
|
135 |
-
) ?>' );
|
136 |
-
},
|
137 |
-
success: function( result ) {
|
138 |
-
if ( result.success ) {
|
139 |
-
$subscriptionCancellationModal.removeClass( 'has-subscription-actions' );
|
140 |
-
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).removeClass( 'warn' );
|
141 |
-
|
142 |
-
$subscriptionCancellationModal.remove();
|
143 |
-
showModal();
|
144 |
-
} else {
|
145 |
-
$errorMessage.find( '> p' ).html( result.error );
|
146 |
-
$errorMessage.show();
|
147 |
-
|
148 |
-
$subscriptionCancellationModal.find( '.fs-modal-footer .button' ).removeClass( 'disabled' );
|
149 |
-
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).html( <?php echo json_encode( sprintf(
|
150 |
-
fs_text_inline( 'Cancel %s & Proceed', 'cancel-x-and-proceed', $slug ),
|
151 |
-
ucfirst( $subscription_cancellation_context )
|
152 |
-
) ) ?> );
|
153 |
-
}
|
154 |
-
}
|
155 |
-
});
|
156 |
-
}
|
157 |
-
});
|
158 |
-
}
|
159 |
-
|
160 |
-
registerEventHandlers();
|
161 |
-
|
162 |
-
function registerEventHandlers() {
|
163 |
-
$deactivateLink.click(function (evt) {
|
164 |
-
evt.preventDefault();
|
165 |
-
|
166 |
-
redirectLink = $(this).attr('href');
|
167 |
-
|
168 |
-
if ( 0 == $subscriptionCancellationModal.length ) {
|
169 |
-
showModal();
|
170 |
-
} else {
|
171 |
-
$subscriptionCancellationModal.trigger( 'showModal' );
|
172 |
-
}
|
173 |
-
});
|
174 |
-
|
175 |
-
<?php
|
176 |
-
if ( ! $fs->is_plugin() ) {
|
177 |
-
/**
|
178 |
-
* For "theme" module type, the modal is shown when the current user clicks on
|
179 |
-
* the "Activate" button of any other theme. The "Activate" button is actually
|
180 |
-
* a link to the "Themes" page (/wp-admin/themes.php) containing query params
|
181 |
-
* that tell WordPress to deactivate the current theme and activate a different theme.
|
182 |
-
*
|
183 |
-
* @author Leo Fajardo (@leorw)
|
184 |
-
* @since 1.2.2
|
185 |
-
*
|
186 |
-
* @since 1.2.2.7 Don't trigger the deactivation feedback form if activating the premium version of the theme.
|
187 |
-
*/
|
188 |
-
?>
|
189 |
-
$('body').on('click', '.theme-browser .theme:not([data-slug=<?php echo $fs->get_premium_slug() ?>]) .theme-actions .button.activate', function (evt) {
|
190 |
-
evt.preventDefault();
|
191 |
-
|
192 |
-
redirectLink = $(this).attr('href');
|
193 |
-
|
194 |
-
showModal();
|
195 |
-
});
|
196 |
-
<?php
|
197 |
-
} ?>
|
198 |
-
|
199 |
-
$modal.on('input propertychange', '.reason-input input', function () {
|
200 |
-
if (!isOtherReasonSelected()) {
|
201 |
-
return;
|
202 |
-
}
|
203 |
-
|
204 |
-
var reason = $(this).val().trim();
|
205 |
-
|
206 |
-
/**
|
207 |
-
* If reason is not empty, remove the error-message class of the message container
|
208 |
-
* to change the message color back to default.
|
209 |
-
*/
|
210 |
-
if (reason.length > 0) {
|
211 |
-
$('.message').removeClass('error-message');
|
212 |
-
enableDeactivateButton();
|
213 |
-
}
|
214 |
-
});
|
215 |
-
|
216 |
-
$modal.on('blur', '.reason-input input', function () {
|
217 |
-
var $userReason = $(this);
|
218 |
-
|
219 |
-
setTimeout(function () {
|
220 |
-
if (!isOtherReasonSelected()) {
|
221 |
-
return;
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* If reason is empty, add the error-message class to the message container
|
226 |
-
* to change the message color to red.
|
227 |
-
*/
|
228 |
-
if (0 === $userReason.val().trim().length) {
|
229 |
-
$('.message').addClass('error-message');
|
230 |
-
disableDeactivateButton();
|
231 |
-
}
|
232 |
-
}, 150);
|
233 |
-
});
|
234 |
-
|
235 |
-
$modal.on('click', '.fs-modal-footer .button', function (evt) {
|
236 |
-
evt.preventDefault();
|
237 |
-
|
238 |
-
if ($(this).hasClass('disabled')) {
|
239 |
-
return;
|
240 |
-
}
|
241 |
-
|
242 |
-
var _parent = $(this).parents('.fs-modal:first');
|
243 |
-
var _this = $(this);
|
244 |
-
|
245 |
-
if (_this.hasClass('allow-deactivate')) {
|
246 |
-
var $radio = $('input[type="radio"]:checked');
|
247 |
-
|
248 |
-
if (0 === $radio.length) {
|
249 |
-
if ( ! deleteThemeUpdateData ) {
|
250 |
-
// If no selected reason, just deactivate the plugin.
|
251 |
-
window.location.href = redirectLink;
|
252 |
-
} else {
|
253 |
-
$.ajax({
|
254 |
-
url : ajaxurl,
|
255 |
-
method : 'POST',
|
256 |
-
data : {
|
257 |
-
action : '<?php echo $fs->get_ajax_action( 'delete_theme_update_data' ) ?>',
|
258 |
-
security : '<?php echo $fs->get_ajax_security( 'delete_theme_update_data' ) ?>',
|
259 |
-
module_id: '<?php echo $fs->get_id() ?>'
|
260 |
-
},
|
261 |
-
beforeSend: function() {
|
262 |
-
_parent.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
|
263 |
-
_parent.find( '.fs-modal-footer .button-secondary' ).text( 'Processing...' );
|
264 |
-
},
|
265 |
-
complete : function() {
|
266 |
-
window.location.href = redirectLink;
|
267 |
-
}
|
268 |
-
});
|
269 |
-
}
|
270 |
-
|
271 |
-
return;
|
272 |
-
}
|
273 |
-
|
274 |
-
var $selected_reason = $radio.parents('li:first'),
|
275 |
-
$input = $selected_reason.find('textarea, input[type="text"]'),
|
276 |
-
userReason = ( 0 !== $input.length ) ? $input.val().trim() : '';
|
277 |
-
|
278 |
-
if (isOtherReasonSelected() && ( '' === userReason )) {
|
279 |
-
return;
|
280 |
-
}
|
281 |
-
|
282 |
-
$.ajax({
|
283 |
-
url : ajaxurl,
|
284 |
-
method : 'POST',
|
285 |
-
data : {
|
286 |
-
action : '<?php echo $fs->get_ajax_action( 'submit_uninstall_reason' ) ?>',
|
287 |
-
security : '<?php echo $fs->get_ajax_security( 'submit_uninstall_reason' ) ?>',
|
288 |
-
module_id : '<?php echo $fs->get_id() ?>',
|
289 |
-
reason_id : $radio.val(),
|
290 |
-
reason_info : userReason,
|
291 |
-
is_anonymous: isAnonymousFeedback()
|
292 |
-
},
|
293 |
-
beforeSend: function () {
|
294 |
-
_parent.find('.fs-modal-footer .button').addClass('disabled');
|
295 |
-
_parent.find('.fs-modal-footer .button-secondary').text('Processing...');
|
296 |
-
},
|
297 |
-
complete : function () {
|
298 |
-
// Do not show the dialog box, deactivate the plugin.
|
299 |
-
window.location.href = redirectLink;
|
300 |
-
}
|
301 |
-
});
|
302 |
-
} else if (_this.hasClass('button-deactivate')) {
|
303 |
-
// Change the Deactivate button's text and show the reasons panel.
|
304 |
-
_parent.find('.button-deactivate').addClass('allow-deactivate');
|
305 |
-
|
306 |
-
showPanel('reasons');
|
307 |
-
}
|
308 |
-
});
|
309 |
-
|
310 |
-
$modal.on('click', 'input[type="radio"]', function () {
|
311 |
-
var $selectedReasonOption = $( this );
|
312 |
-
|
313 |
-
// If the selection has not changed, do not proceed.
|
314 |
-
if (selectedReasonID === $selectedReasonOption.val())
|
315 |
-
return;
|
316 |
-
|
317 |
-
selectedReasonID = $selectedReasonOption.val();
|
318 |
-
|
319 |
-
if ( isAnonymous ) {
|
320 |
-
if ( isReasonSelected( dontShareDataReasonID ) ) {
|
321 |
-
$anonymousFeedback.hide();
|
322 |
-
} else {
|
323 |
-
$anonymousFeedback.show();
|
324 |
-
}
|
325 |
-
}
|
326 |
-
|
327 |
-
var _parent = $(this).parents('li:first');
|
328 |
-
|
329 |
-
$modal.find('.reason-input').remove();
|
330 |
-
$modal.find( '.internal-message' ).hide();
|
331 |
-
$modal.find('.button-deactivate').html('<?php echo esc_js( sprintf(
|
332 |
-
fs_text_inline( 'Submit & %s', 'deactivation-modal-button-submit' , $slug ),
|
333 |
-
$fs->is_plugin() ?
|
334 |
-
$deactivate_text :
|
335 |
-
sprintf( $activate_x_text, $theme_text )
|
336 |
-
) ) ?>');
|
337 |
-
|
338 |
-
enableDeactivateButton();
|
339 |
-
|
340 |
-
if ( _parent.hasClass( 'has-internal-message' ) ) {
|
341 |
-
_parent.find( '.internal-message' ).show();
|
342 |
-
}
|
343 |
-
|
344 |
-
if (_parent.hasClass('has-input')) {
|
345 |
-
var inputType = _parent.data('input-type'),
|
346 |
-
inputPlaceholder = _parent.data('input-placeholder'),
|
347 |
-
reasonInputHtml = '<div class="reason-input"><span class="message"></span>' + ( ( 'textfield' === inputType ) ? '<input type="text" />' : '<textarea rows="5"></textarea>' ) + '</div>';
|
348 |
-
|
349 |
-
_parent.append($(reasonInputHtml));
|
350 |
-
_parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
351 |
-
|
352 |
-
if (isOtherReasonSelected()) {
|
353 |
-
showMessage('<?php echo esc_js( fs_text_inline( 'Kindly tell us the reason so we can improve.', 'ask-for-reason-message' , $slug ) ); ?>');
|
354 |
-
disableDeactivateButton();
|
355 |
-
}
|
356 |
-
}
|
357 |
-
});
|
358 |
-
|
359 |
-
// If the user has clicked outside the window, cancel it.
|
360 |
-
$modal.on('click', function (evt) {
|
361 |
-
var $target = $(evt.target);
|
362 |
-
|
363 |
-
// If the user has clicked anywhere in the modal dialog, just return.
|
364 |
-
if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
|
365 |
-
return;
|
366 |
-
}
|
367 |
-
|
368 |
-
// If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
|
369 |
-
if (
|
370 |
-
! $target.hasClass( 'button-close' ) &&
|
371 |
-
( $target.parents( '.fs-modal-body' ).length > 0 || $target.parents( '.fs-modal-footer' ).length > 0 )
|
372 |
-
) {
|
373 |
-
return;
|
374 |
-
}
|
375 |
-
|
376 |
-
closeModal();
|
377 |
-
|
378 |
-
return false;
|
379 |
-
});
|
380 |
-
}
|
381 |
-
|
382 |
-
function isAnonymousFeedback() {
|
383 |
-
if ( ! isAnonymous ) {
|
384 |
-
return false;
|
385 |
-
}
|
386 |
-
|
387 |
-
return ( isReasonSelected( dontShareDataReasonID ) || $anonymousFeedback.find( 'input' ).prop( 'checked' ) );
|
388 |
-
}
|
389 |
-
|
390 |
-
function isReasonSelected( reasonID ) {
|
391 |
-
// Get the selected radio input element.
|
392 |
-
var $selectedReasonOption = $modal.find('input[type="radio"]:checked');
|
393 |
-
|
394 |
-
return ( reasonID == $selectedReasonOption.val() );
|
395 |
-
}
|
396 |
-
|
397 |
-
function isOtherReasonSelected() {
|
398 |
-
return isReasonSelected( otherReasonID );
|
399 |
-
}
|
400 |
-
|
401 |
-
function showModal() {
|
402 |
-
resetModal();
|
403 |
-
|
404 |
-
// Display the dialog box.
|
405 |
-
$modal.addClass('active');
|
406 |
-
|
407 |
-
$('body').addClass('has-fs-modal');
|
408 |
-
}
|
409 |
-
|
410 |
-
function closeModal() {
|
411 |
-
$modal.removeClass('active');
|
412 |
-
|
413 |
-
$('body').removeClass('has-fs-modal');
|
414 |
-
}
|
415 |
-
|
416 |
-
function resetModal() {
|
417 |
-
selectedReasonID = false;
|
418 |
-
|
419 |
-
enableDeactivateButton();
|
420 |
-
|
421 |
-
// Uncheck all radio buttons.
|
422 |
-
$modal.find('input[type="radio"]').prop('checked', false);
|
423 |
-
|
424 |
-
// Remove all input fields ( textfield, textarea ).
|
425 |
-
$modal.find('.reason-input').remove();
|
426 |
-
|
427 |
-
$modal.find('.message').hide();
|
428 |
-
|
429 |
-
if ( isAnonymous ) {
|
430 |
-
$anonymousFeedback.find( 'input' ).prop( 'checked', false );
|
431 |
-
|
432 |
-
// Hide, since by default there is no selected reason.
|
433 |
-
$anonymousFeedback.hide();
|
434 |
-
}
|
435 |
-
|
436 |
-
var $deactivateButton = $modal.find('.button-deactivate');
|
437 |
-
|
438 |
-
/*
|
439 |
-
* If the modal dialog has no confirmation message, that is, it has only one panel, then ensure
|
440 |
-
* that clicking the deactivate button will actually deactivate the plugin.
|
441 |
-
*/
|
442 |
-
if ( $modal.hasClass( 'no-confirmation-message' ) ) {
|
443 |
-
$deactivateButton.addClass( 'allow-deactivate' );
|
444 |
-
|
445 |
-
showPanel( 'reasons' );
|
446 |
-
} else {
|
447 |
-
$deactivateButton.removeClass( 'allow-deactivate' );
|
448 |
-
|
449 |
-
showPanel( 'confirm' );
|
450 |
-
}
|
451 |
-
}
|
452 |
-
|
453 |
-
function showMessage(message) {
|
454 |
-
$modal.find('.message').text(message).show();
|
455 |
-
}
|
456 |
-
|
457 |
-
function enableDeactivateButton() {
|
458 |
-
$modal.find('.button-deactivate').removeClass('disabled');
|
459 |
-
}
|
460 |
-
|
461 |
-
function disableDeactivateButton() {
|
462 |
-
$modal.find('.button-deactivate').addClass('disabled');
|
463 |
-
}
|
464 |
-
|
465 |
-
function showPanel(panelType) {
|
466 |
-
$modal.find( '.fs-modal-panel' ).removeClass( 'active' );
|
467 |
-
$modal.find( '[data-panel-id="' + panelType + '"]' ).addClass( 'active' );
|
468 |
-
|
469 |
-
updateButtonLabels();
|
470 |
-
}
|
471 |
-
|
472 |
-
function updateButtonLabels() {
|
473 |
-
var $deactivateButton = $modal.find( '.button-deactivate' );
|
474 |
-
|
475 |
-
// Reset the deactivate button's text.
|
476 |
-
if ( 'confirm' === getCurrentPanel() ) {
|
477 |
-
$deactivateButton.text( <?php echo json_encode( sprintf(
|
478 |
-
fs_text_inline( 'Yes - %s', 'deactivation-modal-button-confirm', $slug ),
|
479 |
-
$fs->is_plugin() ?
|
480 |
-
$deactivate_text :
|
481 |
-
sprintf( $activate_x_text, $theme_text )
|
482 |
-
) ) ?> );
|
483 |
-
} else {
|
484 |
-
$deactivateButton.html( <?php echo json_encode( sprintf(
|
485 |
-
fs_text_inline('Skip & %s', 'skip-and-x', $slug ),
|
486 |
-
$fs->is_plugin() ?
|
487 |
-
$deactivate_text :
|
488 |
-
sprintf( $activate_x_text, $theme_text )
|
489 |
-
) ) ?> );
|
490 |
-
}
|
491 |
-
}
|
492 |
-
|
493 |
-
function getCurrentPanel() {
|
494 |
-
return $modal.find('.fs-modal-panel.active').attr('data-panel-id');
|
495 |
-
}
|
496 |
-
})(jQuery);
|
497 |
-
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.2
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
$slug = $fs->get_slug();
|
18 |
+
|
19 |
+
$confirmation_message = $fs->apply_filters( 'uninstall_confirmation_message', '' );
|
20 |
+
|
21 |
+
$reasons = $VARS['reasons'];
|
22 |
+
|
23 |
+
$reasons_list_items_html = '';
|
24 |
+
|
25 |
+
foreach ( $reasons as $reason ) {
|
26 |
+
$list_item_classes = 'reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
|
27 |
+
|
28 |
+
if ( isset( $reason['internal_message'] ) && ! empty( $reason['internal_message'] ) ) {
|
29 |
+
$list_item_classes .= ' has-internal-message';
|
30 |
+
$reason_internal_message = $reason['internal_message'];
|
31 |
+
} else {
|
32 |
+
$reason_internal_message = '';
|
33 |
+
}
|
34 |
+
|
35 |
+
$reason_input_type = ( ! empty( $reason['input_type'] ) ? $reason['input_type'] : '' );
|
36 |
+
$reason_input_placeholder = ( ! empty( $reason['input_placeholder'] ) ? $reason['input_placeholder'] : '' );
|
37 |
+
|
38 |
+
$reason_list_item_html = <<< HTML
|
39 |
+
<li class="{$list_item_classes}"
|
40 |
+
data-input-type="{$reason_input_type}"
|
41 |
+
data-input-placeholder="{$reason_input_placeholder}">
|
42 |
+
<label>
|
43 |
+
<span>
|
44 |
+
<input type="radio" name="selected-reason" value="{$reason['id']}"/>
|
45 |
+
</span>
|
46 |
+
<span>{$reason['text']}</span>
|
47 |
+
</label>
|
48 |
+
<div class="internal-message">{$reason_internal_message}</div>
|
49 |
+
</li>
|
50 |
+
HTML;
|
51 |
+
|
52 |
+
$reasons_list_items_html .= $reason_list_item_html;
|
53 |
+
}
|
54 |
+
|
55 |
+
$is_anonymous = ( ! $fs->is_registered() );
|
56 |
+
if ( $is_anonymous ) {
|
57 |
+
$anonymous_feedback_checkbox_html = sprintf(
|
58 |
+
'<label class="anonymous-feedback-label"><input type="checkbox" class="anonymous-feedback-checkbox"> %s</label>',
|
59 |
+
fs_esc_html_inline( 'Anonymous feedback', 'anonymous-feedback', $slug )
|
60 |
+
);
|
61 |
+
} else {
|
62 |
+
$anonymous_feedback_checkbox_html = '';
|
63 |
+
}
|
64 |
+
|
65 |
+
// Aliases.
|
66 |
+
$deactivate_text = fs_text_inline( 'Deactivate', 'deactivate', $slug );
|
67 |
+
$theme_text = fs_text_inline( 'Theme', 'theme', $slug );
|
68 |
+
$activate_x_text = fs_text_inline( 'Activate %s', 'activate-x', $slug );
|
69 |
+
|
70 |
+
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
71 |
+
?>
|
72 |
+
<?php $fs->_maybe_add_subscription_cancellation_dialog_box() ?>
|
73 |
+
<script type="text/javascript">
|
74 |
+
(function ($) {
|
75 |
+
var reasonsHtml = <?php echo json_encode( $reasons_list_items_html ) ?>,
|
76 |
+
modalHtml =
|
77 |
+
'<div class="fs-modal fs-modal-deactivation-feedback<?php echo empty( $confirmation_message ) ? ' no-confirmation-message' : ''; ?>">'
|
78 |
+
+ ' <div class="fs-modal-dialog">'
|
79 |
+
+ ' <div class="fs-modal-header">'
|
80 |
+
+ ' <h4><?php fs_esc_attr_echo_inline( 'Quick Feedback', 'quick-feedback' , $slug ) ?></h4>'
|
81 |
+
+ ' </div>'
|
82 |
+
+ ' <div class="fs-modal-body">'
|
83 |
+
+ ' <div class="fs-modal-panel" data-panel-id="confirm"><p><?php echo $confirmation_message; ?></p></div>'
|
84 |
+
+ ' <div class="fs-modal-panel active" data-panel-id="reasons"><h3><strong><?php echo esc_js( sprintf( fs_text_inline( 'If you have a moment, please let us know why you are %s', 'deactivation-share-reason' , $slug ), ( $fs->is_plugin() ? fs_text_inline( 'deactivating', 'deactivating', $slug ) : fs_text_inline( 'switching', 'switching', $slug ) ) ) ) ?>:</strong></h3><ul id="reasons-list">' + reasonsHtml + '</ul></div>'
|
85 |
+
+ ' </div>'
|
86 |
+
+ ' <div class="fs-modal-footer">'
|
87 |
+
+ ' <?php echo $anonymous_feedback_checkbox_html ?>'
|
88 |
+
+ ' <a href="#" class="button button-secondary button-deactivate"></a>'
|
89 |
+
+ ' <a href="#" class="button button-primary button-close"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>'
|
90 |
+
+ ' </div>'
|
91 |
+
+ ' </div>'
|
92 |
+
+ '</div>',
|
93 |
+
$modal = $(modalHtml),
|
94 |
+
$deactivateLink = $('#the-list .deactivate > [data-module-id=<?php echo $fs->get_id() ?>].fs-module-id').prev(),
|
95 |
+
selectedReasonID = false,
|
96 |
+
redirectLink = '',
|
97 |
+
$anonymousFeedback = $modal.find( '.anonymous-feedback-label' ),
|
98 |
+
isAnonymous = <?php echo ( $is_anonymous ? 'true' : 'false' ); ?>,
|
99 |
+
otherReasonID = <?php echo Freemius::REASON_OTHER; ?>,
|
100 |
+
dontShareDataReasonID = <?php echo Freemius::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION; ?>,
|
101 |
+
deleteThemeUpdateData = <?php echo $fs->is_theme() && $fs->is_premium() && ! $fs->has_any_active_valid_license() ? 'true' : 'false' ?>,
|
102 |
+
$subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' );
|
103 |
+
|
104 |
+
$modal.appendTo($('body'));
|
105 |
+
|
106 |
+
if ( 0 !== $subscriptionCancellationModal.length ) {
|
107 |
+
$subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
|
108 |
+
if ( false === cancelSubscription ) {
|
109 |
+
showModal();
|
110 |
+
|
111 |
+
$subscriptionCancellationModal.trigger( 'closeModal' );
|
112 |
+
} else {
|
113 |
+
var $errorMessage = $subscriptionCancellationModal.find( '.notice-error' );
|
114 |
+
|
115 |
+
<?php
|
116 |
+
$subscription_cancellation_context = $fs->is_paid_trial() ?
|
117 |
+
fs_text_inline( 'trial', 'trial', $slug ) :
|
118 |
+
fs_text_inline( 'subscription', 'subscription', $slug );
|
119 |
+
?>
|
120 |
+
|
121 |
+
$.ajax({
|
122 |
+
url : ajaxurl,
|
123 |
+
method : 'POST',
|
124 |
+
data : {
|
125 |
+
action : '<?php echo $fs->get_ajax_action( 'cancel_subscription_or_trial' ) ?>',
|
126 |
+
security : '<?php echo $fs->get_ajax_security( 'cancel_subscription_or_trial' ) ?>',
|
127 |
+
module_id: '<?php echo $fs->get_id() ?>'
|
128 |
+
},
|
129 |
+
beforeSend: function() {
|
130 |
+
$errorMessage.hide();
|
131 |
+
|
132 |
+
$subscriptionCancellationModal.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
|
133 |
+
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( '<?php echo esc_js(
|
134 |
+
sprintf( fs_text_inline( 'Cancelling %s...', 'cancelling-x' , $slug ), $subscription_cancellation_context )
|
135 |
+
) ?>' );
|
136 |
+
},
|
137 |
+
success: function( result ) {
|
138 |
+
if ( result.success ) {
|
139 |
+
$subscriptionCancellationModal.removeClass( 'has-subscription-actions' );
|
140 |
+
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).removeClass( 'warn' );
|
141 |
+
|
142 |
+
$subscriptionCancellationModal.remove();
|
143 |
+
showModal();
|
144 |
+
} else {
|
145 |
+
$errorMessage.find( '> p' ).html( result.error );
|
146 |
+
$errorMessage.show();
|
147 |
+
|
148 |
+
$subscriptionCancellationModal.find( '.fs-modal-footer .button' ).removeClass( 'disabled' );
|
149 |
+
$subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).html( <?php echo json_encode( sprintf(
|
150 |
+
fs_text_inline( 'Cancel %s & Proceed', 'cancel-x-and-proceed', $slug ),
|
151 |
+
ucfirst( $subscription_cancellation_context )
|
152 |
+
) ) ?> );
|
153 |
+
}
|
154 |
+
}
|
155 |
+
});
|
156 |
+
}
|
157 |
+
});
|
158 |
+
}
|
159 |
+
|
160 |
+
registerEventHandlers();
|
161 |
+
|
162 |
+
function registerEventHandlers() {
|
163 |
+
$deactivateLink.click(function (evt) {
|
164 |
+
evt.preventDefault();
|
165 |
+
|
166 |
+
redirectLink = $(this).attr('href');
|
167 |
+
|
168 |
+
if ( 0 == $subscriptionCancellationModal.length ) {
|
169 |
+
showModal();
|
170 |
+
} else {
|
171 |
+
$subscriptionCancellationModal.trigger( 'showModal' );
|
172 |
+
}
|
173 |
+
});
|
174 |
+
|
175 |
+
<?php
|
176 |
+
if ( ! $fs->is_plugin() ) {
|
177 |
+
/**
|
178 |
+
* For "theme" module type, the modal is shown when the current user clicks on
|
179 |
+
* the "Activate" button of any other theme. The "Activate" button is actually
|
180 |
+
* a link to the "Themes" page (/wp-admin/themes.php) containing query params
|
181 |
+
* that tell WordPress to deactivate the current theme and activate a different theme.
|
182 |
+
*
|
183 |
+
* @author Leo Fajardo (@leorw)
|
184 |
+
* @since 1.2.2
|
185 |
+
*
|
186 |
+
* @since 1.2.2.7 Don't trigger the deactivation feedback form if activating the premium version of the theme.
|
187 |
+
*/
|
188 |
+
?>
|
189 |
+
$('body').on('click', '.theme-browser .theme:not([data-slug=<?php echo $fs->get_premium_slug() ?>]) .theme-actions .button.activate', function (evt) {
|
190 |
+
evt.preventDefault();
|
191 |
+
|
192 |
+
redirectLink = $(this).attr('href');
|
193 |
+
|
194 |
+
showModal();
|
195 |
+
});
|
196 |
+
<?php
|
197 |
+
} ?>
|
198 |
+
|
199 |
+
$modal.on('input propertychange', '.reason-input input', function () {
|
200 |
+
if (!isOtherReasonSelected()) {
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
|
204 |
+
var reason = $(this).val().trim();
|
205 |
+
|
206 |
+
/**
|
207 |
+
* If reason is not empty, remove the error-message class of the message container
|
208 |
+
* to change the message color back to default.
|
209 |
+
*/
|
210 |
+
if (reason.length > 0) {
|
211 |
+
$('.message').removeClass('error-message');
|
212 |
+
enableDeactivateButton();
|
213 |
+
}
|
214 |
+
});
|
215 |
+
|
216 |
+
$modal.on('blur', '.reason-input input', function () {
|
217 |
+
var $userReason = $(this);
|
218 |
+
|
219 |
+
setTimeout(function () {
|
220 |
+
if (!isOtherReasonSelected()) {
|
221 |
+
return;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* If reason is empty, add the error-message class to the message container
|
226 |
+
* to change the message color to red.
|
227 |
+
*/
|
228 |
+
if (0 === $userReason.val().trim().length) {
|
229 |
+
$('.message').addClass('error-message');
|
230 |
+
disableDeactivateButton();
|
231 |
+
}
|
232 |
+
}, 150);
|
233 |
+
});
|
234 |
+
|
235 |
+
$modal.on('click', '.fs-modal-footer .button', function (evt) {
|
236 |
+
evt.preventDefault();
|
237 |
+
|
238 |
+
if ($(this).hasClass('disabled')) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
+
var _parent = $(this).parents('.fs-modal:first');
|
243 |
+
var _this = $(this);
|
244 |
+
|
245 |
+
if (_this.hasClass('allow-deactivate')) {
|
246 |
+
var $radio = $('input[type="radio"]:checked');
|
247 |
+
|
248 |
+
if (0 === $radio.length) {
|
249 |
+
if ( ! deleteThemeUpdateData ) {
|
250 |
+
// If no selected reason, just deactivate the plugin.
|
251 |
+
window.location.href = redirectLink;
|
252 |
+
} else {
|
253 |
+
$.ajax({
|
254 |
+
url : ajaxurl,
|
255 |
+
method : 'POST',
|
256 |
+
data : {
|
257 |
+
action : '<?php echo $fs->get_ajax_action( 'delete_theme_update_data' ) ?>',
|
258 |
+
security : '<?php echo $fs->get_ajax_security( 'delete_theme_update_data' ) ?>',
|
259 |
+
module_id: '<?php echo $fs->get_id() ?>'
|
260 |
+
},
|
261 |
+
beforeSend: function() {
|
262 |
+
_parent.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
|
263 |
+
_parent.find( '.fs-modal-footer .button-secondary' ).text( 'Processing...' );
|
264 |
+
},
|
265 |
+
complete : function() {
|
266 |
+
window.location.href = redirectLink;
|
267 |
+
}
|
268 |
+
});
|
269 |
+
}
|
270 |
+
|
271 |
+
return;
|
272 |
+
}
|
273 |
+
|
274 |
+
var $selected_reason = $radio.parents('li:first'),
|
275 |
+
$input = $selected_reason.find('textarea, input[type="text"]'),
|
276 |
+
userReason = ( 0 !== $input.length ) ? $input.val().trim() : '';
|
277 |
+
|
278 |
+
if (isOtherReasonSelected() && ( '' === userReason )) {
|
279 |
+
return;
|
280 |
+
}
|
281 |
+
|
282 |
+
$.ajax({
|
283 |
+
url : ajaxurl,
|
284 |
+
method : 'POST',
|
285 |
+
data : {
|
286 |
+
action : '<?php echo $fs->get_ajax_action( 'submit_uninstall_reason' ) ?>',
|
287 |
+
security : '<?php echo $fs->get_ajax_security( 'submit_uninstall_reason' ) ?>',
|
288 |
+
module_id : '<?php echo $fs->get_id() ?>',
|
289 |
+
reason_id : $radio.val(),
|
290 |
+
reason_info : userReason,
|
291 |
+
is_anonymous: isAnonymousFeedback()
|
292 |
+
},
|
293 |
+
beforeSend: function () {
|
294 |
+
_parent.find('.fs-modal-footer .button').addClass('disabled');
|
295 |
+
_parent.find('.fs-modal-footer .button-secondary').text('Processing...');
|
296 |
+
},
|
297 |
+
complete : function () {
|
298 |
+
// Do not show the dialog box, deactivate the plugin.
|
299 |
+
window.location.href = redirectLink;
|
300 |
+
}
|
301 |
+
});
|
302 |
+
} else if (_this.hasClass('button-deactivate')) {
|
303 |
+
// Change the Deactivate button's text and show the reasons panel.
|
304 |
+
_parent.find('.button-deactivate').addClass('allow-deactivate');
|
305 |
+
|
306 |
+
showPanel('reasons');
|
307 |
+
}
|
308 |
+
});
|
309 |
+
|
310 |
+
$modal.on('click', 'input[type="radio"]', function () {
|
311 |
+
var $selectedReasonOption = $( this );
|
312 |
+
|
313 |
+
// If the selection has not changed, do not proceed.
|
314 |
+
if (selectedReasonID === $selectedReasonOption.val())
|
315 |
+
return;
|
316 |
+
|
317 |
+
selectedReasonID = $selectedReasonOption.val();
|
318 |
+
|
319 |
+
if ( isAnonymous ) {
|
320 |
+
if ( isReasonSelected( dontShareDataReasonID ) ) {
|
321 |
+
$anonymousFeedback.hide();
|
322 |
+
} else {
|
323 |
+
$anonymousFeedback.show();
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
var _parent = $(this).parents('li:first');
|
328 |
+
|
329 |
+
$modal.find('.reason-input').remove();
|
330 |
+
$modal.find( '.internal-message' ).hide();
|
331 |
+
$modal.find('.button-deactivate').html('<?php echo esc_js( sprintf(
|
332 |
+
fs_text_inline( 'Submit & %s', 'deactivation-modal-button-submit' , $slug ),
|
333 |
+
$fs->is_plugin() ?
|
334 |
+
$deactivate_text :
|
335 |
+
sprintf( $activate_x_text, $theme_text )
|
336 |
+
) ) ?>');
|
337 |
+
|
338 |
+
enableDeactivateButton();
|
339 |
+
|
340 |
+
if ( _parent.hasClass( 'has-internal-message' ) ) {
|
341 |
+
_parent.find( '.internal-message' ).show();
|
342 |
+
}
|
343 |
+
|
344 |
+
if (_parent.hasClass('has-input')) {
|
345 |
+
var inputType = _parent.data('input-type'),
|
346 |
+
inputPlaceholder = _parent.data('input-placeholder'),
|
347 |
+
reasonInputHtml = '<div class="reason-input"><span class="message"></span>' + ( ( 'textfield' === inputType ) ? '<input type="text" />' : '<textarea rows="5"></textarea>' ) + '</div>';
|
348 |
+
|
349 |
+
_parent.append($(reasonInputHtml));
|
350 |
+
_parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
351 |
+
|
352 |
+
if (isOtherReasonSelected()) {
|
353 |
+
showMessage('<?php echo esc_js( fs_text_inline( 'Kindly tell us the reason so we can improve.', 'ask-for-reason-message' , $slug ) ); ?>');
|
354 |
+
disableDeactivateButton();
|
355 |
+
}
|
356 |
+
}
|
357 |
+
});
|
358 |
+
|
359 |
+
// If the user has clicked outside the window, cancel it.
|
360 |
+
$modal.on('click', function (evt) {
|
361 |
+
var $target = $(evt.target);
|
362 |
+
|
363 |
+
// If the user has clicked anywhere in the modal dialog, just return.
|
364 |
+
if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
|
365 |
+
return;
|
366 |
+
}
|
367 |
+
|
368 |
+
// If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
|
369 |
+
if (
|
370 |
+
! $target.hasClass( 'button-close' ) &&
|
371 |
+
( $target.parents( '.fs-modal-body' ).length > 0 || $target.parents( '.fs-modal-footer' ).length > 0 )
|
372 |
+
) {
|
373 |
+
return;
|
374 |
+
}
|
375 |
+
|
376 |
+
closeModal();
|
377 |
+
|
378 |
+
return false;
|
379 |
+
});
|
380 |
+
}
|
381 |
+
|
382 |
+
function isAnonymousFeedback() {
|
383 |
+
if ( ! isAnonymous ) {
|
384 |
+
return false;
|
385 |
+
}
|
386 |
+
|
387 |
+
return ( isReasonSelected( dontShareDataReasonID ) || $anonymousFeedback.find( 'input' ).prop( 'checked' ) );
|
388 |
+
}
|
389 |
+
|
390 |
+
function isReasonSelected( reasonID ) {
|
391 |
+
// Get the selected radio input element.
|
392 |
+
var $selectedReasonOption = $modal.find('input[type="radio"]:checked');
|
393 |
+
|
394 |
+
return ( reasonID == $selectedReasonOption.val() );
|
395 |
+
}
|
396 |
+
|
397 |
+
function isOtherReasonSelected() {
|
398 |
+
return isReasonSelected( otherReasonID );
|
399 |
+
}
|
400 |
+
|
401 |
+
function showModal() {
|
402 |
+
resetModal();
|
403 |
+
|
404 |
+
// Display the dialog box.
|
405 |
+
$modal.addClass('active');
|
406 |
+
|
407 |
+
$('body').addClass('has-fs-modal');
|
408 |
+
}
|
409 |
+
|
410 |
+
function closeModal() {
|
411 |
+
$modal.removeClass('active');
|
412 |
+
|
413 |
+
$('body').removeClass('has-fs-modal');
|
414 |
+
}
|
415 |
+
|
416 |
+
function resetModal() {
|
417 |
+
selectedReasonID = false;
|
418 |
+
|
419 |
+
enableDeactivateButton();
|
420 |
+
|
421 |
+
// Uncheck all radio buttons.
|
422 |
+
$modal.find('input[type="radio"]').prop('checked', false);
|
423 |
+
|
424 |
+
// Remove all input fields ( textfield, textarea ).
|
425 |
+
$modal.find('.reason-input').remove();
|
426 |
+
|
427 |
+
$modal.find('.message').hide();
|
428 |
+
|
429 |
+
if ( isAnonymous ) {
|
430 |
+
$anonymousFeedback.find( 'input' ).prop( 'checked', false );
|
431 |
+
|
432 |
+
// Hide, since by default there is no selected reason.
|
433 |
+
$anonymousFeedback.hide();
|
434 |
+
}
|
435 |
+
|
436 |
+
var $deactivateButton = $modal.find('.button-deactivate');
|
437 |
+
|
438 |
+
/*
|
439 |
+
* If the modal dialog has no confirmation message, that is, it has only one panel, then ensure
|
440 |
+
* that clicking the deactivate button will actually deactivate the plugin.
|
441 |
+
*/
|
442 |
+
if ( $modal.hasClass( 'no-confirmation-message' ) ) {
|
443 |
+
$deactivateButton.addClass( 'allow-deactivate' );
|
444 |
+
|
445 |
+
showPanel( 'reasons' );
|
446 |
+
} else {
|
447 |
+
$deactivateButton.removeClass( 'allow-deactivate' );
|
448 |
+
|
449 |
+
showPanel( 'confirm' );
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
function showMessage(message) {
|
454 |
+
$modal.find('.message').text(message).show();
|
455 |
+
}
|
456 |
+
|
457 |
+
function enableDeactivateButton() {
|
458 |
+
$modal.find('.button-deactivate').removeClass('disabled');
|
459 |
+
}
|
460 |
+
|
461 |
+
function disableDeactivateButton() {
|
462 |
+
$modal.find('.button-deactivate').addClass('disabled');
|
463 |
+
}
|
464 |
+
|
465 |
+
function showPanel(panelType) {
|
466 |
+
$modal.find( '.fs-modal-panel' ).removeClass( 'active' );
|
467 |
+
$modal.find( '[data-panel-id="' + panelType + '"]' ).addClass( 'active' );
|
468 |
+
|
469 |
+
updateButtonLabels();
|
470 |
+
}
|
471 |
+
|
472 |
+
function updateButtonLabels() {
|
473 |
+
var $deactivateButton = $modal.find( '.button-deactivate' );
|
474 |
+
|
475 |
+
// Reset the deactivate button's text.
|
476 |
+
if ( 'confirm' === getCurrentPanel() ) {
|
477 |
+
$deactivateButton.text( <?php echo json_encode( sprintf(
|
478 |
+
fs_text_inline( 'Yes - %s', 'deactivation-modal-button-confirm', $slug ),
|
479 |
+
$fs->is_plugin() ?
|
480 |
+
$deactivate_text :
|
481 |
+
sprintf( $activate_x_text, $theme_text )
|
482 |
+
) ) ?> );
|
483 |
+
} else {
|
484 |
+
$deactivateButton.html( <?php echo json_encode( sprintf(
|
485 |
+
fs_text_inline('Skip & %s', 'skip-and-x', $slug ),
|
486 |
+
$fs->is_plugin() ?
|
487 |
+
$deactivate_text :
|
488 |
+
sprintf( $activate_x_text, $theme_text )
|
489 |
+
) ) ?> );
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
function getCurrentPanel() {
|
494 |
+
return $modal.find('.fs-modal-panel.active').attr('data-panel-id');
|
495 |
+
}
|
496 |
+
})(jQuery);
|
497 |
+
</script>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
5 |
Requires at least: 3.4
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.1
|
8 |
-
Stable tag: 1.3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -58,6 +58,9 @@ No, the plugin automatically detects [Fullworks Firewall](https://wordpress.org/
|
|
58 |
|
59 |
|
60 |
== Changelog ==
|
|
|
|
|
|
|
61 |
= 1.3.19 =
|
62 |
* minor improvement
|
63 |
|
5 |
Requires at least: 3.4
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.1
|
8 |
+
Stable tag: 1.3.20
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
58 |
|
59 |
|
60 |
== Changelog ==
|
61 |
+
= 1.3.20 =
|
62 |
+
* minor improvement
|
63 |
+
|
64 |
= 1.3.19 =
|
65 |
* minor improvement
|
66 |
|
stop-user-enumeration.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Stop User Enumeration
|
4 |
Plugin URI: https://fullworks.net/products/stop-user-enumeration/
|
5 |
Description: User enumeration is a technique used by hackers to get your login name if you are using permalinks. This plugin stops that.
|
6 |
-
Version: 1.3.
|
7 |
Author: Fullworks
|
8 |
Text Domain: stop-user-enumeration
|
9 |
Domain Path: /languages
|
3 |
Plugin Name: Stop User Enumeration
|
4 |
Plugin URI: https://fullworks.net/products/stop-user-enumeration/
|
5 |
Description: User enumeration is a technique used by hackers to get your login name if you are using permalinks. This plugin stops that.
|
6 |
+
Version: 1.3.20
|
7 |
Author: Fullworks
|
8 |
Text Domain: stop-user-enumeration
|
9 |
Domain Path: /languages
|