Version Description
Download this release
Release Info
Developer | rabbii |
Plugin | WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress |
Version | 3.1.4 |
Comparing to | |
See all releases |
Code changes from version 3.1.3 to 3.1.4
- includes/class-frontend-render-form.php +8 -6
- includes/fields/class-abstract-fields.php +2 -2
- includes/fields/class-field-checkbox.php +0 -1
- includes/fields/class-field-dropdown.php +1 -1
- includes/fields/class-field-multidropdown.php +1 -1
- languages/wp-user-frontend.pot +43 -43
- lib/appsero/Client.php +174 -0
- lib/appsero/Insights.php +932 -0
- lib/class-wedevs-insights.php +6 -765
- readme.txt +9 -2
- templates/dashboard/edit-profile.php +56 -17
- wpuf.php +5 -3
includes/class-frontend-render-form.php
CHANGED
@@ -598,13 +598,16 @@ class WPUF_Frontend_Render_Form{
|
|
598 |
|
599 |
else {
|
600 |
|
601 |
-
if (
|
602 |
|
603 |
-
|
604 |
-
|
605 |
-
|
|
|
|
|
|
|
|
|
606 |
}
|
607 |
-
// wp_set_post_terms( $post_id, $form_settings['default_cat'], $taxonomy['name'] );
|
608 |
}
|
609 |
}
|
610 |
}
|
@@ -742,7 +745,6 @@ class WPUF_Frontend_Render_Form{
|
|
742 |
}
|
743 |
|
744 |
} //end foreach
|
745 |
-
|
746 |
return array($meta_key_value, $multi_repeated, $files);
|
747 |
}
|
748 |
|
598 |
|
599 |
else {
|
600 |
|
601 |
+
if ( isset( $taxonomy['woo_attr'] ) && $taxonomy['woo_attr'] == 'no' && !empty( $_POST[$taxonomy['name']] ) ) {
|
602 |
|
603 |
+
if ( is_object_in_taxonomy( $this->form_settings['post_type'], $taxonomy['name'] ) ) {
|
604 |
+
|
605 |
+
foreach ($this->form_settings['default_cat'] as $value) {
|
606 |
+
$term = get_term( $value );
|
607 |
+
wp_set_post_terms( $post_id, $value , $term->taxonomy);
|
608 |
+
}
|
609 |
+
// wp_set_post_terms( $post_id, $form_settings['default_cat'], $taxonomy['name'] );
|
610 |
}
|
|
|
611 |
}
|
612 |
}
|
613 |
}
|
745 |
}
|
746 |
|
747 |
} //end foreach
|
|
|
748 |
return array($meta_key_value, $multi_repeated, $files);
|
749 |
}
|
750 |
|
includes/fields/class-abstract-fields.php
CHANGED
@@ -795,8 +795,8 @@ abstract class WPUF_Field_Contract {
|
|
795 |
$cond_inputs['condition_status'] = isset( $cond_inputs['condition_status'] ) ? $cond_inputs['condition_status'] : '';
|
796 |
|
797 |
if ( $cond_inputs['condition_status'] == 'yes') {
|
798 |
-
$cond_inputs['type'] = $form_field['input_type'];
|
799 |
-
$cond_inputs['name'] = $form_field['name'];
|
800 |
$cond_inputs['form_id'] = $form_id;
|
801 |
$condition = json_encode( $cond_inputs );
|
802 |
|
795 |
$cond_inputs['condition_status'] = isset( $cond_inputs['condition_status'] ) ? $cond_inputs['condition_status'] : '';
|
796 |
|
797 |
if ( $cond_inputs['condition_status'] == 'yes') {
|
798 |
+
$cond_inputs['type'] = isset($form_field['input_type']) ? $form_field['input_type']:'';
|
799 |
+
$cond_inputs['name'] = isset($form_field['name'])? $form_field['name']:'';
|
800 |
$cond_inputs['form_id'] = $form_id;
|
801 |
$condition = json_encode( $cond_inputs );
|
802 |
|
includes/fields/class-field-checkbox.php
CHANGED
@@ -45,7 +45,6 @@ class WPUF_Form_Field_Checkbox extends WPUF_Field_Contract {
|
|
45 |
}
|
46 |
}
|
47 |
}
|
48 |
-
|
49 |
$this->field_print_label($field_settings, $form_id );
|
50 |
|
51 |
?>
|
45 |
}
|
46 |
}
|
47 |
}
|
|
|
48 |
$this->field_print_label($field_settings, $form_id );
|
49 |
|
50 |
?>
|
includes/fields/class-field-dropdown.php
CHANGED
@@ -44,7 +44,7 @@ class WPUF_Form_Field_Dropdown extends WPUF_Field_Contract {
|
|
44 |
data-type="select">
|
45 |
|
46 |
<?php if ( !empty( $field_settings['first'] ) ) { ?>
|
47 |
-
<option value=""><?php echo $field_settings['first']; ?></option>
|
48 |
<?php } ?>
|
49 |
|
50 |
<?php
|
44 |
data-type="select">
|
45 |
|
46 |
<?php if ( !empty( $field_settings['first'] ) ) { ?>
|
47 |
+
<option value="-1"><?php echo $field_settings['first']; ?></option>
|
48 |
<?php } ?>
|
49 |
|
50 |
<?php
|
includes/fields/class-field-multidropdown.php
CHANGED
@@ -55,7 +55,7 @@ class WPUF_Form_Field_MultiDropdown extends WPUF_Form_Field_Dropdown {
|
|
55 |
<select multiple="multiple" class="multiselect <?php echo 'wpuf_'. $field_settings['name'] .'_'. $form_id; ?>" id="<?php echo $field_settings['name'] . '_' . $form_id; ?>" name="<?php echo $name; ?>" mulitple="multiple" data-required="<?php echo $field_settings['required'] ?>" data-type="multiselect">
|
56 |
|
57 |
<?php if ( !empty( $field_settings['first'] ) ) { ?>
|
58 |
-
<option value=""><?php echo $field_settings['first']; ?></option>
|
59 |
<?php } ?>
|
60 |
|
61 |
<?php
|
55 |
<select multiple="multiple" class="multiselect <?php echo 'wpuf_'. $field_settings['name'] .'_'. $form_id; ?>" id="<?php echo $field_settings['name'] . '_' . $form_id; ?>" name="<?php echo $name; ?>" mulitple="multiple" data-required="<?php echo $field_settings['required'] ?>" data-type="multiselect">
|
56 |
|
57 |
<?php if ( !empty( $field_settings['first'] ) ) { ?>
|
58 |
+
<option value="-1"><?php echo $field_settings['first']; ?></option>
|
59 |
<?php } ?>
|
60 |
|
61 |
<?php
|
languages/wp-user-frontend.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WP User Frontend 3.1.
|
6 |
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
|
7 |
-
"POT-Creation-Date: 2019-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -156,9 +156,9 @@ msgstr ""
|
|
156 |
#: includes/fields/class-abstract-fields.php:344
|
157 |
#: includes/fields/class-abstract-fields.php:358
|
158 |
#: includes/fields/class-abstract-fields.php:426
|
159 |
-
#: includes/fields/class-field-checkbox.php:
|
160 |
#: includes/fields/class-field-radio.php:89 includes/free/form-element.php:477
|
161 |
-
#: wpuf.php:
|
162 |
msgid "Yes"
|
163 |
msgstr ""
|
164 |
|
@@ -171,9 +171,9 @@ msgstr ""
|
|
171 |
#: includes/fields/class-abstract-fields.php:345
|
172 |
#: includes/fields/class-abstract-fields.php:359
|
173 |
#: includes/fields/class-abstract-fields.php:427
|
174 |
-
#: includes/fields/class-field-checkbox.php:
|
175 |
#: includes/fields/class-field-radio.php:90 includes/free/form-element.php:478
|
176 |
-
#: wpuf.php:
|
177 |
msgid "No"
|
178 |
msgstr ""
|
179 |
|
@@ -305,8 +305,8 @@ msgstr ""
|
|
305 |
#: admin/class-admin-subscription.php:754
|
306 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:265
|
307 |
#: class/payment.php:199 class/subscription.php:780
|
308 |
-
#: includes/class-list-table-subscribers.php:128
|
309 |
-
#:
|
310 |
msgid "Cancel"
|
311 |
msgstr ""
|
312 |
|
@@ -558,12 +558,12 @@ msgid "Are you sure you want to delete this field?"
|
|
558 |
msgstr ""
|
559 |
|
560 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:262
|
561 |
-
#: admin/posting.php:70 class/asset-loader.php:55 wpuf.php:
|
562 |
msgid "Yes, delete it"
|
563 |
msgstr ""
|
564 |
|
565 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:263
|
566 |
-
#: admin/posting.php:71 class/asset-loader.php:56 wpuf.php:
|
567 |
msgid "No, cancel it"
|
568 |
msgstr ""
|
569 |
|
@@ -581,7 +581,7 @@ msgid "This field must contain at least one choice"
|
|
581 |
msgstr ""
|
582 |
|
583 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:268
|
584 |
-
#: includes/fields/class-field-checkbox.php:
|
585 |
#: includes/fields/class-field-dropdown.php:101
|
586 |
#: includes/fields/class-field-multidropdown.php:93
|
587 |
#: includes/fields/class-field-radio.php:117
|
@@ -2183,23 +2183,23 @@ msgid "Draft"
|
|
2183 |
msgstr ""
|
2184 |
|
2185 |
#: admin/posting.php:69 class/asset-loader.php:54 class/render-form.php:1700
|
2186 |
-
#: wpuf.php:
|
2187 |
msgid "Are you sure?"
|
2188 |
msgstr ""
|
2189 |
|
2190 |
-
#: admin/posting.php:77 class/asset-loader.php:62 wpuf.php:
|
2191 |
msgid "Allowed Files"
|
2192 |
msgstr ""
|
2193 |
|
2194 |
-
#: admin/posting.php:80 class/asset-loader.php:65 wpuf.php:
|
2195 |
msgid "Maximum number of files reached!"
|
2196 |
msgstr ""
|
2197 |
|
2198 |
-
#: admin/posting.php:81 class/asset-loader.php:66 wpuf.php:
|
2199 |
msgid "The file you have uploaded exceeds the file size limit. Please try again."
|
2200 |
msgstr ""
|
2201 |
|
2202 |
-
#: admin/posting.php:82 class/asset-loader.php:67 wpuf.php:
|
2203 |
msgid "You have uploaded an incorrect file type. Please try again."
|
2204 |
msgstr ""
|
2205 |
|
@@ -3390,27 +3390,27 @@ msgstr ""
|
|
3390 |
msgid "Install Now"
|
3391 |
msgstr ""
|
3392 |
|
3393 |
-
#: class/asset-loader.php:31 wpuf.php:
|
3394 |
msgid "is required"
|
3395 |
msgstr ""
|
3396 |
|
3397 |
-
#: class/asset-loader.php:32 wpuf.php:
|
3398 |
msgid "does not match"
|
3399 |
msgstr ""
|
3400 |
|
3401 |
-
#: class/asset-loader.php:33 wpuf.php:
|
3402 |
msgid "is not valid"
|
3403 |
msgstr ""
|
3404 |
|
3405 |
-
#: class/asset-loader.php:45 wpuf.php:
|
3406 |
msgid "Please fix the errors to proceed"
|
3407 |
msgstr ""
|
3408 |
|
3409 |
-
#: class/asset-loader.php:47 wpuf.php:
|
3410 |
msgid "Word limit reached"
|
3411 |
msgstr ""
|
3412 |
|
3413 |
-
#: class/asset-loader.php:48 wpuf.php:
|
3414 |
msgid "Are you sure you want to cancel your current subscription ?"
|
3415 |
msgstr ""
|
3416 |
|
@@ -3554,7 +3554,7 @@ msgstr ""
|
|
3554 |
msgid "You can't edit a post while in pending mode."
|
3555 |
msgstr ""
|
3556 |
|
3557 |
-
#: class/frontend-form-post.php:304 includes/class-frontend-render-form.php:
|
3558 |
#: includes/free/class-login.php:394
|
3559 |
msgid "Empty reCaptcha Field"
|
3560 |
msgstr ""
|
@@ -3788,7 +3788,7 @@ msgid "Confirm Password"
|
|
3788 |
msgstr ""
|
3789 |
|
3790 |
#: class/render-form.php:1355 includes/free/edit-profile.php:203
|
3791 |
-
#: templates/dashboard/edit-profile.php:
|
3792 |
msgid "Strength indicator"
|
3793 |
msgstr ""
|
3794 |
|
@@ -4787,13 +4787,13 @@ msgid "Select Yes if you want to hide the field label in single post."
|
|
4787 |
msgstr ""
|
4788 |
|
4789 |
#: includes/fields/class-abstract-fields.php:423
|
4790 |
-
#: includes/fields/class-field-checkbox.php:
|
4791 |
#: includes/fields/class-field-radio.php:86
|
4792 |
msgid "Show in inline list"
|
4793 |
msgstr ""
|
4794 |
|
4795 |
#: includes/fields/class-abstract-fields.php:433
|
4796 |
-
#: includes/fields/class-field-checkbox.php:
|
4797 |
#: includes/fields/class-field-radio.php:96
|
4798 |
msgid "Show this option in an inline list"
|
4799 |
msgstr ""
|
@@ -5274,7 +5274,7 @@ msgid "Password Strength"
|
|
5274 |
msgstr ""
|
5275 |
|
5276 |
#: includes/free/edit-profile.php:227 includes/free/form-element.php:346
|
5277 |
-
#: templates/dashboard/edit-profile.php:
|
5278 |
msgid "Update Profile"
|
5279 |
msgstr ""
|
5280 |
|
@@ -5686,37 +5686,37 @@ msgstr ""
|
|
5686 |
msgid "Go to Full Settings"
|
5687 |
msgstr ""
|
5688 |
|
5689 |
-
#: lib/
|
5690 |
msgid ""
|
5691 |
-
"Want to help make <strong>%s</strong> even more awesome? Allow
|
5692 |
"collect non-sensitive diagnostic data and usage information."
|
5693 |
msgstr ""
|
5694 |
|
5695 |
-
#: lib/
|
5696 |
msgid "what we collect"
|
5697 |
msgstr ""
|
5698 |
|
5699 |
-
#: lib/
|
5700 |
msgid "Allow"
|
5701 |
msgstr ""
|
5702 |
|
5703 |
-
#: lib/
|
5704 |
msgid "No thanks"
|
5705 |
msgstr ""
|
5706 |
|
5707 |
-
#: lib/
|
5708 |
msgid "Once Weekly"
|
5709 |
msgstr ""
|
5710 |
|
5711 |
-
#: lib/
|
5712 |
msgid "If you have a moment, please let us know why you are deactivating:"
|
5713 |
msgstr ""
|
5714 |
|
5715 |
-
#: lib/
|
5716 |
msgid "I rather wouldn't say"
|
5717 |
msgstr ""
|
5718 |
|
5719 |
-
#: lib/
|
5720 |
msgid "Submit & Deactivate"
|
5721 |
msgstr ""
|
5722 |
|
@@ -5820,7 +5820,7 @@ msgstr ""
|
|
5820 |
msgid "Leave this field empty to keep your password unchanged."
|
5821 |
msgstr ""
|
5822 |
|
5823 |
-
#: templates/dashboard/edit-profile.php:
|
5824 |
msgid "Confirm New Password"
|
5825 |
msgstr ""
|
5826 |
|
@@ -6222,11 +6222,11 @@ msgstr ""
|
|
6222 |
msgid "</strong> or greater."
|
6223 |
msgstr ""
|
6224 |
|
6225 |
-
#: wpuf.php:
|
6226 |
msgid "Your Post Has Been Expired"
|
6227 |
msgstr ""
|
6228 |
|
6229 |
-
#: wpuf.php:
|
6230 |
msgid ""
|
6231 |
"<p style=\"font-size: 13px\">\n"
|
6232 |
" <strong class=\"highlight-text\" "
|
@@ -6239,19 +6239,19 @@ msgid ""
|
|
6239 |
" </p>"
|
6240 |
msgstr ""
|
6241 |
|
6242 |
-
#: wpuf.php:
|
6243 |
msgid "Update WP User Frontend Pro Now"
|
6244 |
msgstr ""
|
6245 |
|
6246 |
-
#: wpuf.php:
|
6247 |
msgid "Update WP User Frontend Pro NOW"
|
6248 |
msgstr ""
|
6249 |
|
6250 |
-
#: wpuf.php:
|
6251 |
msgid "Please Cancel Your Currently Active Pack first!"
|
6252 |
msgstr ""
|
6253 |
|
6254 |
-
#: wpuf.php:
|
6255 |
msgid "Error: Nonce verification failed"
|
6256 |
msgstr ""
|
6257 |
|
2 |
# This file is distributed under the GPL2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP User Frontend 3.1.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
|
7 |
+
"POT-Creation-Date: 2019-05-02 04:42:14+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
156 |
#: includes/fields/class-abstract-fields.php:344
|
157 |
#: includes/fields/class-abstract-fields.php:358
|
158 |
#: includes/fields/class-abstract-fields.php:426
|
159 |
+
#: includes/fields/class-field-checkbox.php:94
|
160 |
#: includes/fields/class-field-radio.php:89 includes/free/form-element.php:477
|
161 |
+
#: wpuf.php:708
|
162 |
msgid "Yes"
|
163 |
msgstr ""
|
164 |
|
171 |
#: includes/fields/class-abstract-fields.php:345
|
172 |
#: includes/fields/class-abstract-fields.php:359
|
173 |
#: includes/fields/class-abstract-fields.php:427
|
174 |
+
#: includes/fields/class-field-checkbox.php:95
|
175 |
#: includes/fields/class-field-radio.php:90 includes/free/form-element.php:478
|
176 |
+
#: wpuf.php:709
|
177 |
msgid "No"
|
178 |
msgstr ""
|
179 |
|
305 |
#: admin/class-admin-subscription.php:754
|
306 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:265
|
307 |
#: class/payment.php:199 class/subscription.php:780
|
308 |
+
#: includes/class-list-table-subscribers.php:128 lib/appsero/Insights.php:738
|
309 |
+
#: templates/dashboard/subscription.php:61
|
310 |
msgid "Cancel"
|
311 |
msgstr ""
|
312 |
|
558 |
msgstr ""
|
559 |
|
560 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:262
|
561 |
+
#: admin/posting.php:70 class/asset-loader.php:55 wpuf.php:718
|
562 |
msgid "Yes, delete it"
|
563 |
msgstr ""
|
564 |
|
565 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:263
|
566 |
+
#: admin/posting.php:71 class/asset-loader.php:56 wpuf.php:719
|
567 |
msgid "No, cancel it"
|
568 |
msgstr ""
|
569 |
|
581 |
msgstr ""
|
582 |
|
583 |
#: admin/form-builder/class-wpuf-admin-form-builder.php:268
|
584 |
+
#: includes/fields/class-field-checkbox.php:123
|
585 |
#: includes/fields/class-field-dropdown.php:101
|
586 |
#: includes/fields/class-field-multidropdown.php:93
|
587 |
#: includes/fields/class-field-radio.php:117
|
2183 |
msgstr ""
|
2184 |
|
2185 |
#: admin/posting.php:69 class/asset-loader.php:54 class/render-form.php:1700
|
2186 |
+
#: wpuf.php:717
|
2187 |
msgid "Are you sure?"
|
2188 |
msgstr ""
|
2189 |
|
2190 |
+
#: admin/posting.php:77 class/asset-loader.php:62 wpuf.php:727
|
2191 |
msgid "Allowed Files"
|
2192 |
msgstr ""
|
2193 |
|
2194 |
+
#: admin/posting.php:80 class/asset-loader.php:65 wpuf.php:733
|
2195 |
msgid "Maximum number of files reached!"
|
2196 |
msgstr ""
|
2197 |
|
2198 |
+
#: admin/posting.php:81 class/asset-loader.php:66 wpuf.php:734
|
2199 |
msgid "The file you have uploaded exceeds the file size limit. Please try again."
|
2200 |
msgstr ""
|
2201 |
|
2202 |
+
#: admin/posting.php:82 class/asset-loader.php:67 wpuf.php:735
|
2203 |
msgid "You have uploaded an incorrect file type. Please try again."
|
2204 |
msgstr ""
|
2205 |
|
3390 |
msgid "Install Now"
|
3391 |
msgstr ""
|
3392 |
|
3393 |
+
#: class/asset-loader.php:31 wpuf.php:625
|
3394 |
msgid "is required"
|
3395 |
msgstr ""
|
3396 |
|
3397 |
+
#: class/asset-loader.php:32 wpuf.php:626
|
3398 |
msgid "does not match"
|
3399 |
msgstr ""
|
3400 |
|
3401 |
+
#: class/asset-loader.php:33 wpuf.php:627
|
3402 |
msgid "is not valid"
|
3403 |
msgstr ""
|
3404 |
|
3405 |
+
#: class/asset-loader.php:45 wpuf.php:704
|
3406 |
msgid "Please fix the errors to proceed"
|
3407 |
msgstr ""
|
3408 |
|
3409 |
+
#: class/asset-loader.php:47 wpuf.php:706
|
3410 |
msgid "Word limit reached"
|
3411 |
msgstr ""
|
3412 |
|
3413 |
+
#: class/asset-loader.php:48 wpuf.php:707
|
3414 |
msgid "Are you sure you want to cancel your current subscription ?"
|
3415 |
msgstr ""
|
3416 |
|
3554 |
msgid "You can't edit a post while in pending mode."
|
3555 |
msgstr ""
|
3556 |
|
3557 |
+
#: class/frontend-form-post.php:304 includes/class-frontend-render-form.php:771
|
3558 |
#: includes/free/class-login.php:394
|
3559 |
msgid "Empty reCaptcha Field"
|
3560 |
msgstr ""
|
3788 |
msgstr ""
|
3789 |
|
3790 |
#: class/render-form.php:1355 includes/free/edit-profile.php:203
|
3791 |
+
#: templates/dashboard/edit-profile.php:70
|
3792 |
msgid "Strength indicator"
|
3793 |
msgstr ""
|
3794 |
|
4787 |
msgstr ""
|
4788 |
|
4789 |
#: includes/fields/class-abstract-fields.php:423
|
4790 |
+
#: includes/fields/class-field-checkbox.php:91
|
4791 |
#: includes/fields/class-field-radio.php:86
|
4792 |
msgid "Show in inline list"
|
4793 |
msgstr ""
|
4794 |
|
4795 |
#: includes/fields/class-abstract-fields.php:433
|
4796 |
+
#: includes/fields/class-field-checkbox.php:101
|
4797 |
#: includes/fields/class-field-radio.php:96
|
4798 |
msgid "Show this option in an inline list"
|
4799 |
msgstr ""
|
5274 |
msgstr ""
|
5275 |
|
5276 |
#: includes/free/edit-profile.php:227 includes/free/form-element.php:346
|
5277 |
+
#: templates/dashboard/edit-profile.php:130
|
5278 |
msgid "Update Profile"
|
5279 |
msgstr ""
|
5280 |
|
5686 |
msgid "Go to Full Settings"
|
5687 |
msgstr ""
|
5688 |
|
5689 |
+
#: lib/appsero/Insights.php:352
|
5690 |
msgid ""
|
5691 |
+
"Want to help make <strong>%1$s</strong> even more awesome? Allow %1$s to "
|
5692 |
"collect non-sensitive diagnostic data and usage information."
|
5693 |
msgstr ""
|
5694 |
|
5695 |
+
#: lib/appsero/Insights.php:357
|
5696 |
msgid "what we collect"
|
5697 |
msgstr ""
|
5698 |
|
5699 |
+
#: lib/appsero/Insights.php:363
|
5700 |
msgid "Allow"
|
5701 |
msgstr ""
|
5702 |
|
5703 |
+
#: lib/appsero/Insights.php:364
|
5704 |
msgid "No thanks"
|
5705 |
msgstr ""
|
5706 |
|
5707 |
+
#: lib/appsero/Insights.php:563
|
5708 |
msgid "Once Weekly"
|
5709 |
msgstr ""
|
5710 |
|
5711 |
+
#: lib/appsero/Insights.php:722
|
5712 |
msgid "If you have a moment, please let us know why you are deactivating:"
|
5713 |
msgstr ""
|
5714 |
|
5715 |
+
#: lib/appsero/Insights.php:736
|
5716 |
msgid "I rather wouldn't say"
|
5717 |
msgstr ""
|
5718 |
|
5719 |
+
#: lib/appsero/Insights.php:737
|
5720 |
msgid "Submit & Deactivate"
|
5721 |
msgstr ""
|
5722 |
|
5820 |
msgid "Leave this field empty to keep your password unchanged."
|
5821 |
msgstr ""
|
5822 |
|
5823 |
+
#: templates/dashboard/edit-profile.php:64
|
5824 |
msgid "Confirm New Password"
|
5825 |
msgstr ""
|
5826 |
|
6222 |
msgid "</strong> or greater."
|
6223 |
msgstr ""
|
6224 |
|
6225 |
+
#: wpuf.php:199
|
6226 |
msgid "Your Post Has Been Expired"
|
6227 |
msgstr ""
|
6228 |
|
6229 |
+
#: wpuf.php:446
|
6230 |
msgid ""
|
6231 |
"<p style=\"font-size: 13px\">\n"
|
6232 |
" <strong class=\"highlight-text\" "
|
6239 |
" </p>"
|
6240 |
msgstr ""
|
6241 |
|
6242 |
+
#: wpuf.php:462
|
6243 |
msgid "Update WP User Frontend Pro Now"
|
6244 |
msgstr ""
|
6245 |
|
6246 |
+
#: wpuf.php:466
|
6247 |
msgid "Update WP User Frontend Pro NOW"
|
6248 |
msgstr ""
|
6249 |
|
6250 |
+
#: wpuf.php:713
|
6251 |
msgid "Please Cancel Your Currently Active Pack first!"
|
6252 |
msgstr ""
|
6253 |
|
6254 |
+
#: wpuf.php:873
|
6255 |
msgid "Error: Nonce verification failed"
|
6256 |
msgstr ""
|
6257 |
|
lib/appsero/Client.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Appsero;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* AppSero Client
|
6 |
+
*
|
7 |
+
* This class is necessary to set project data
|
8 |
+
*/
|
9 |
+
class Client {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* The client version
|
13 |
+
*
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
public $version = '1.0.1';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Hash identifier of the plugin
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
public $hash;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Name of the plugin
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $name;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The plugin/theme file path
|
34 |
+
* @example .../wp-content/plugins/test-slug/test-slug.php
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $file;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Main plugin file
|
42 |
+
* @example test-slug/test-slug.php
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
public $basename;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Slug of the plugin
|
50 |
+
* @example test-slug
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
public $slug;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* The project version
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
public $project_version;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* The project type
|
65 |
+
*
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
public $type;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Initialize the class
|
72 |
+
*
|
73 |
+
* @param string $hash hash of the plugin
|
74 |
+
* @param string $name readable name of the plugin
|
75 |
+
* @param string $file main plugin file path
|
76 |
+
*/
|
77 |
+
public function __construct( $hash, $name, $file ) {
|
78 |
+
$this->hash = $hash;
|
79 |
+
$this->name = $name;
|
80 |
+
$this->file = $file;
|
81 |
+
|
82 |
+
$this->set_basename_and_slug();
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Initialize insights class
|
87 |
+
*
|
88 |
+
* @return Appsero\Insights
|
89 |
+
*/
|
90 |
+
public function insights() {
|
91 |
+
|
92 |
+
if ( ! class_exists( __NAMESPACE__ . '\Insights') ) {
|
93 |
+
require_once __DIR__ . '/Insights.php';
|
94 |
+
}
|
95 |
+
|
96 |
+
return new Insights( $this );
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* API Endpoint
|
101 |
+
*
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
public function endpoint() {
|
105 |
+
$endpoint = apply_filters( 'appsero_endpoint', 'https://api.appsero.com' );
|
106 |
+
|
107 |
+
return trailingslashit( $endpoint );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Set project basename, slug and version
|
112 |
+
*
|
113 |
+
* @return void
|
114 |
+
*/
|
115 |
+
protected function set_basename_and_slug() {
|
116 |
+
|
117 |
+
if ( strpos( $this->file, WP_CONTENT_DIR . '/themes/' ) === false ) {
|
118 |
+
|
119 |
+
$this->basename = plugin_basename( $this->file );
|
120 |
+
|
121 |
+
list( $this->slug, $mainfile) = explode( '/', $this->basename );
|
122 |
+
|
123 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
124 |
+
|
125 |
+
$plugin_data = get_plugin_data( $this->file );
|
126 |
+
|
127 |
+
$this->project_version = $plugin_data['Version'];
|
128 |
+
$this->type = 'plugin';
|
129 |
+
|
130 |
+
} else {
|
131 |
+
|
132 |
+
$this->basename = str_replace( WP_CONTENT_DIR . '/themes/', '', $this->file );
|
133 |
+
|
134 |
+
list( $this->slug, $mainfile) = explode( '/', $this->basename );
|
135 |
+
|
136 |
+
$theme = wp_get_theme( $this->slug );
|
137 |
+
|
138 |
+
$this->project_version = $theme->version;
|
139 |
+
$this->type = 'theme';
|
140 |
+
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Send request to remote endpoint
|
146 |
+
*
|
147 |
+
* @param array $params
|
148 |
+
* @param string $route
|
149 |
+
*
|
150 |
+
* @return array|WP_Error Array of results including HTTP headers or WP_Error if the request failed.
|
151 |
+
*/
|
152 |
+
public function send_request( $params, $route, $blocking = false ) {
|
153 |
+
$url = $this->endpoint() . $route;
|
154 |
+
|
155 |
+
$headers = array(
|
156 |
+
'user-agent' => 'Appsero/' . md5( esc_url( home_url() ) ) . ';',
|
157 |
+
'Accept' => 'application/json',
|
158 |
+
);
|
159 |
+
|
160 |
+
$response = wp_remote_post( $url, array(
|
161 |
+
'method' => 'POST',
|
162 |
+
'timeout' => 30,
|
163 |
+
'redirection' => 5,
|
164 |
+
'httpversion' => '1.0',
|
165 |
+
'blocking' => $blocking,
|
166 |
+
'headers' => $headers,
|
167 |
+
'body' => array_merge( $params, array( 'client' => $this->version ) ),
|
168 |
+
'cookies' => array()
|
169 |
+
) );
|
170 |
+
|
171 |
+
return $response;
|
172 |
+
}
|
173 |
+
|
174 |
+
}
|
lib/appsero/Insights.php
ADDED
@@ -0,0 +1,932 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace Appsero;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Appsero Insights
|
6 |
+
*
|
7 |
+
* This is a tracker class to track plugin usage based on if the customer has opted in.
|
8 |
+
* No personal information is being tracked by this class, only general settings, active plugins, environment details
|
9 |
+
* and admin email.
|
10 |
+
*/
|
11 |
+
class Insights {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The notice text
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
public $notice;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Wheather to the notice or not
|
22 |
+
*
|
23 |
+
* @var boolean
|
24 |
+
*/
|
25 |
+
protected $show_notice = true;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* If extra data needs to be sent
|
29 |
+
*
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
protected $extra_data = array();
|
33 |
+
|
34 |
+
/**
|
35 |
+
* AppSero\Client
|
36 |
+
*
|
37 |
+
* @var object
|
38 |
+
*/
|
39 |
+
protected $client;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Initialize the class
|
43 |
+
*
|
44 |
+
* @param AppSero\Client
|
45 |
+
*/
|
46 |
+
public function __construct( Client $client ) {
|
47 |
+
|
48 |
+
$this->client = $client;
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Don't show the notice
|
54 |
+
*
|
55 |
+
* @return \self
|
56 |
+
*/
|
57 |
+
public function hide_notice() {
|
58 |
+
$this->show_notice = false;
|
59 |
+
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Add extra data if needed
|
65 |
+
*
|
66 |
+
* @param array $data
|
67 |
+
*
|
68 |
+
* @return \self
|
69 |
+
*/
|
70 |
+
public function add_extra( $data = array() ) {
|
71 |
+
$this->extra_data = $data;
|
72 |
+
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Set custom notice text
|
78 |
+
*
|
79 |
+
* @param string $text
|
80 |
+
*
|
81 |
+
* @return \self
|
82 |
+
*/
|
83 |
+
public function notice( $text ) {
|
84 |
+
$this->notice = $text;
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Initialize insights
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
public function init() {
|
95 |
+
if ( $this->client->type == 'plugin' ) {
|
96 |
+
$this->init_plugin();
|
97 |
+
} else if ( $this->client->type == 'theme' ) {
|
98 |
+
$this->init_theme();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Initialize theme hooks
|
104 |
+
*
|
105 |
+
* @return void
|
106 |
+
*/
|
107 |
+
public function init_theme() {
|
108 |
+
$this->init_common();
|
109 |
+
|
110 |
+
add_action( 'switch_theme', array( $this, 'deactivation_cleanup' ) );
|
111 |
+
add_action( 'switch_theme', array( $this, 'theme_deactivated' ), 12, 3 );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Initialize plugin hooks
|
116 |
+
*
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
public function init_plugin() {
|
120 |
+
// plugin deactivate popup
|
121 |
+
if ( ! $this->is_local_server() ) {
|
122 |
+
add_action( 'plugin_action_links_' . $this->client->basename, array( $this, 'plugin_action_links' ) );
|
123 |
+
add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) );
|
124 |
+
}
|
125 |
+
|
126 |
+
$this->init_common();
|
127 |
+
|
128 |
+
register_activation_hook( $this->client->file, array( $this, 'activate_plugin' ) );
|
129 |
+
register_deactivation_hook( $this->client->file, array( $this, 'deactivation_cleanup' ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Initialize common hooks
|
134 |
+
*
|
135 |
+
* @return void
|
136 |
+
*/
|
137 |
+
protected function init_common() {
|
138 |
+
|
139 |
+
if ( $this->show_notice ) {
|
140 |
+
// tracking notice
|
141 |
+
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
142 |
+
}
|
143 |
+
|
144 |
+
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
145 |
+
|
146 |
+
// uninstall reason
|
147 |
+
add_action( 'wp_ajax_' . $this->client->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) );
|
148 |
+
|
149 |
+
// cron events
|
150 |
+
add_action( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
|
151 |
+
add_action( $this->client->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) );
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Send tracking data to AppSero server
|
156 |
+
*
|
157 |
+
* @param boolean $override
|
158 |
+
*
|
159 |
+
* @return void
|
160 |
+
*/
|
161 |
+
public function send_tracking_data( $override = false ) {
|
162 |
+
// skip on AJAX Requests
|
163 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( ! $this->tracking_allowed() && ! $override ) {
|
168 |
+
return;
|
169 |
+
}
|
170 |
+
|
171 |
+
// Send a maximum of once per week
|
172 |
+
$last_send = $this->get_last_send();
|
173 |
+
|
174 |
+
if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
$this->client->send_request( $this->get_tracking_data(), 'track' );
|
179 |
+
|
180 |
+
update_option( $this->client->slug . '_tracking_last_send', time() );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Get the tracking data points
|
185 |
+
*
|
186 |
+
* @return array
|
187 |
+
*/
|
188 |
+
protected function get_tracking_data() {
|
189 |
+
$all_plugins = $this->get_all_plugins();
|
190 |
+
|
191 |
+
$users = get_users( array(
|
192 |
+
'role' => 'administrator',
|
193 |
+
'orderby' => 'ID',
|
194 |
+
'order' => 'ASC',
|
195 |
+
'number' => 1,
|
196 |
+
'paged' => 1,
|
197 |
+
) );
|
198 |
+
|
199 |
+
$admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0] : false;
|
200 |
+
$first_name = $last_name = '';
|
201 |
+
|
202 |
+
if ( $admin_user ) {
|
203 |
+
$first_name = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name;
|
204 |
+
$last_name = $admin_user->last_name;
|
205 |
+
}
|
206 |
+
|
207 |
+
$data = array(
|
208 |
+
'version' => $this->client->project_version,
|
209 |
+
'url' => esc_url( home_url() ),
|
210 |
+
'site' => $this->get_site_name(),
|
211 |
+
'admin_email' => get_option( 'admin_email' ),
|
212 |
+
'first_name' => $first_name,
|
213 |
+
'last_name' => $last_name,
|
214 |
+
'hash' => $this->client->hash,
|
215 |
+
'server' => $this->get_server_info(),
|
216 |
+
'wp' => $this->get_wp_info(),
|
217 |
+
'users' => $this->get_user_counts(),
|
218 |
+
'active_plugins' => count( $all_plugins['active_plugins'] ),
|
219 |
+
'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
|
220 |
+
'ip_address' => $this->get_user_ip_address(),
|
221 |
+
'theme' => get_stylesheet(),
|
222 |
+
);
|
223 |
+
|
224 |
+
// for child classes
|
225 |
+
if ( $extra = $this->get_extra_data() ) {
|
226 |
+
$data['extra'] = $extra;
|
227 |
+
}
|
228 |
+
|
229 |
+
return apply_filters( $this->client->slug . '_tracker_data', $data );
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* If a child class wants to send extra data
|
234 |
+
*
|
235 |
+
* @return mixed
|
236 |
+
*/
|
237 |
+
protected function get_extra_data() {
|
238 |
+
return $this->extra_data;
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Explain the user which data we collect
|
243 |
+
*
|
244 |
+
* @return string
|
245 |
+
*/
|
246 |
+
protected function data_we_collect() {
|
247 |
+
$data = array(
|
248 |
+
'Server environment details (php, mysql, server, WordPress versions)',
|
249 |
+
'Number of users in your site',
|
250 |
+
'Site language',
|
251 |
+
'Number of active and inactive plugins',
|
252 |
+
'Site name and url',
|
253 |
+
'Your name and email address',
|
254 |
+
);
|
255 |
+
|
256 |
+
return $data;
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Check if the user has opted into tracking
|
261 |
+
*
|
262 |
+
* @return bool
|
263 |
+
*/
|
264 |
+
private function tracking_allowed() {
|
265 |
+
$allow_tracking = get_option( $this->client->slug . '_allow_tracking', 'no' );
|
266 |
+
|
267 |
+
return $allow_tracking == 'yes';
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Get the last time a tracking was sent
|
272 |
+
*
|
273 |
+
* @return false|string
|
274 |
+
*/
|
275 |
+
private function get_last_send() {
|
276 |
+
return get_option( $this->client->slug . '_tracking_last_send', false );
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Check if the notice has been dismissed or enabled
|
281 |
+
*
|
282 |
+
* @return boolean
|
283 |
+
*/
|
284 |
+
private function notice_dismissed() {
|
285 |
+
$hide_notice = get_option( $this->client->slug . '_tracking_notice', 'no' );
|
286 |
+
|
287 |
+
if ( 'hide' == $hide_notice ) {
|
288 |
+
return true;
|
289 |
+
}
|
290 |
+
|
291 |
+
return false;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Check if the current server is localhost
|
296 |
+
*
|
297 |
+
* @return boolean
|
298 |
+
*/
|
299 |
+
private function is_local_server() {
|
300 |
+
return false;
|
301 |
+
|
302 |
+
$is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) );
|
303 |
+
|
304 |
+
return apply_filters( 'appsero_is_local', $is_local );
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Schedule the event weekly
|
309 |
+
*
|
310 |
+
* @return void
|
311 |
+
*/
|
312 |
+
private function schedule_event() {
|
313 |
+
wp_schedule_event( time(), 'weekly', $this->client->slug . '_tracker_send_event' );
|
314 |
+
wp_schedule_event( time(), 'daily', $this->client->slug . '_license_check_event' );
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Clear any scheduled hook
|
319 |
+
*
|
320 |
+
* @return void
|
321 |
+
*/
|
322 |
+
private function clear_schedule_event() {
|
323 |
+
wp_clear_scheduled_hook( $this->client->slug . '_tracker_send_event' );
|
324 |
+
wp_clear_scheduled_hook( $this->client->slug . '_license_check_event' );
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Display the admin notice to users that have not opted-in or out
|
329 |
+
*
|
330 |
+
* @return void
|
331 |
+
*/
|
332 |
+
public function admin_notice() {
|
333 |
+
|
334 |
+
if ( $this->notice_dismissed() ) {
|
335 |
+
return;
|
336 |
+
}
|
337 |
+
|
338 |
+
if ( $this->tracking_allowed() ) {
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
343 |
+
return;
|
344 |
+
}
|
345 |
+
|
346 |
+
// don't show tracking if a local server
|
347 |
+
if ( ! $this->is_local_server() ) {
|
348 |
+
$optin_url = add_query_arg( $this->client->slug . '_tracker_optin', 'true' );
|
349 |
+
$optout_url = add_query_arg( $this->client->slug . '_tracker_optout', 'true' );
|
350 |
+
|
351 |
+
if ( empty( $this->notice ) ) {
|
352 |
+
$notice = sprintf( __( 'Want to help make <strong>%1$s</strong> even more awesome? Allow %1$s to collect non-sensitive diagnostic data and usage information.', 'textdomain' ), $this->client->name );
|
353 |
+
} else {
|
354 |
+
$notice = $this->notice;
|
355 |
+
}
|
356 |
+
|
357 |
+
$notice .= ' (<a class="' . $this->client->slug . '-insights-data-we-collect" href="#">' . __( 'what we collect', 'textdomain' ) . '</a>)';
|
358 |
+
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked.</p>';
|
359 |
+
|
360 |
+
echo '<div class="updated"><p>';
|
361 |
+
echo $notice;
|
362 |
+
echo '</p><p class="submit">';
|
363 |
+
echo ' <a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . __( 'Allow', 'textdomain' ) . '</a>';
|
364 |
+
echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . __( 'No thanks', 'textdomain' ) . '</a>';
|
365 |
+
echo '</p></div>';
|
366 |
+
|
367 |
+
echo "<script type='text/javascript'>jQuery('." . $this->client->slug . "-insights-data-we-collect').on('click', function(e) {
|
368 |
+
e.preventDefault();
|
369 |
+
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
|
370 |
+
});
|
371 |
+
jQuery.getJSON('https://api.ipify.org?format=jsonp&callback=?', function(json) {
|
372 |
+
json.ip;
|
373 |
+
} );
|
374 |
+
</script>
|
375 |
+
";
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* handle the optin/optout
|
381 |
+
*
|
382 |
+
* @return void
|
383 |
+
*/
|
384 |
+
public function handle_optin_optout() {
|
385 |
+
|
386 |
+
if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && $_GET[ $this->client->slug . '_tracker_optin' ] == 'true' ) {
|
387 |
+
$this->optin();
|
388 |
+
|
389 |
+
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optin' ) );
|
390 |
+
exit;
|
391 |
+
}
|
392 |
+
|
393 |
+
if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && $_GET[ $this->client->slug . '_tracker_optout' ] == 'true' ) {
|
394 |
+
$this->optout();
|
395 |
+
|
396 |
+
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optout' ) );
|
397 |
+
exit;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Tracking optin
|
403 |
+
*
|
404 |
+
* @return void
|
405 |
+
*/
|
406 |
+
public function optin() {
|
407 |
+
update_option( $this->client->slug . '_allow_tracking', 'yes' );
|
408 |
+
update_option( $this->client->slug . '_tracking_notice', 'hide' );
|
409 |
+
|
410 |
+
$this->clear_schedule_event();
|
411 |
+
$this->schedule_event();
|
412 |
+
$this->send_tracking_data();
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Optout from tracking
|
417 |
+
*
|
418 |
+
* @return void
|
419 |
+
*/
|
420 |
+
public function optout() {
|
421 |
+
update_option( $this->client->slug . '_allow_tracking', 'no' );
|
422 |
+
update_option( $this->client->slug . '_tracking_notice', 'hide' );
|
423 |
+
|
424 |
+
$this->clear_schedule_event();
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Get the number of post counts
|
429 |
+
*
|
430 |
+
* @param string $post_type
|
431 |
+
*
|
432 |
+
* @return integer
|
433 |
+
*/
|
434 |
+
public function get_post_count( $post_type ) {
|
435 |
+
global $wpdb;
|
436 |
+
|
437 |
+
return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'");
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Get server related info.
|
442 |
+
*
|
443 |
+
* @return array
|
444 |
+
*/
|
445 |
+
private static function get_server_info() {
|
446 |
+
global $wpdb;
|
447 |
+
|
448 |
+
$server_data = array();
|
449 |
+
|
450 |
+
if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
|
451 |
+
$server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
|
452 |
+
}
|
453 |
+
|
454 |
+
if ( function_exists( 'phpversion' ) ) {
|
455 |
+
$server_data['php_version'] = phpversion();
|
456 |
+
}
|
457 |
+
|
458 |
+
$server_data['mysql_version'] = $wpdb->db_version();
|
459 |
+
|
460 |
+
$server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
|
461 |
+
$server_data['php_default_timezone'] = date_default_timezone_get();
|
462 |
+
$server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
|
463 |
+
$server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
|
464 |
+
$server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
|
465 |
+
|
466 |
+
return $server_data;
|
467 |
+
}
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Get WordPress related data.
|
471 |
+
*
|
472 |
+
* @return array
|
473 |
+
*/
|
474 |
+
private function get_wp_info() {
|
475 |
+
$wp_data = array();
|
476 |
+
|
477 |
+
$wp_data['memory_limit'] = WP_MEMORY_LIMIT;
|
478 |
+
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
|
479 |
+
$wp_data['locale'] = get_locale();
|
480 |
+
$wp_data['version'] = get_bloginfo( 'version' );
|
481 |
+
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
|
482 |
+
|
483 |
+
return $wp_data;
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Get the list of active and inactive plugins
|
488 |
+
*
|
489 |
+
* @return array
|
490 |
+
*/
|
491 |
+
private function get_all_plugins() {
|
492 |
+
// Ensure get_plugins function is loaded
|
493 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
494 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
495 |
+
}
|
496 |
+
|
497 |
+
$plugins = get_plugins();
|
498 |
+
$active_plugins_keys = get_option( 'active_plugins', array() );
|
499 |
+
$active_plugins = array();
|
500 |
+
|
501 |
+
foreach ( $plugins as $k => $v ) {
|
502 |
+
// Take care of formatting the data how we want it.
|
503 |
+
$formatted = array();
|
504 |
+
$formatted['name'] = strip_tags( $v['Name'] );
|
505 |
+
|
506 |
+
if ( isset( $v['Version'] ) ) {
|
507 |
+
$formatted['version'] = strip_tags( $v['Version'] );
|
508 |
+
}
|
509 |
+
|
510 |
+
if ( isset( $v['Author'] ) ) {
|
511 |
+
$formatted['author'] = strip_tags( $v['Author'] );
|
512 |
+
}
|
513 |
+
|
514 |
+
if ( isset( $v['Network'] ) ) {
|
515 |
+
$formatted['network'] = strip_tags( $v['Network'] );
|
516 |
+
}
|
517 |
+
|
518 |
+
if ( isset( $v['PluginURI'] ) ) {
|
519 |
+
$formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
|
520 |
+
}
|
521 |
+
|
522 |
+
if ( in_array( $k, $active_plugins_keys ) ) {
|
523 |
+
// Remove active plugins from list so we can show active and inactive separately
|
524 |
+
unset( $plugins[$k] );
|
525 |
+
$active_plugins[$k] = $formatted;
|
526 |
+
} else {
|
527 |
+
$plugins[$k] = $formatted;
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Get user totals based on user role.
|
536 |
+
*
|
537 |
+
* @return array
|
538 |
+
*/
|
539 |
+
public function get_user_counts() {
|
540 |
+
$user_count = array();
|
541 |
+
$user_count_data = count_users();
|
542 |
+
$user_count['total'] = $user_count_data['total_users'];
|
543 |
+
|
544 |
+
// Get user count based on user role
|
545 |
+
foreach ( $user_count_data['avail_roles'] as $role => $count ) {
|
546 |
+
$user_count[ $role ] = $count;
|
547 |
+
}
|
548 |
+
|
549 |
+
return $user_count;
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Add weekly cron schedule
|
554 |
+
*
|
555 |
+
* @param array $schedules
|
556 |
+
*
|
557 |
+
* @return array
|
558 |
+
*/
|
559 |
+
public function add_weekly_schedule( $schedules ) {
|
560 |
+
|
561 |
+
$schedules['weekly'] = array(
|
562 |
+
'interval' => DAY_IN_SECONDS * 7,
|
563 |
+
'display' => __( 'Once Weekly', 'textdomain' )
|
564 |
+
);
|
565 |
+
|
566 |
+
return $schedules;
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Plugin activation hook
|
571 |
+
*
|
572 |
+
* @return void
|
573 |
+
*/
|
574 |
+
public function activate_plugin() {
|
575 |
+
$allowed = get_option( $this->client->slug . '_allow_tracking', 'no' );
|
576 |
+
|
577 |
+
// if it wasn't allowed before, do nothing
|
578 |
+
if ( 'yes' !== $allowed ) {
|
579 |
+
return;
|
580 |
+
}
|
581 |
+
|
582 |
+
// re-schedule and delete the last sent time so we could force send again
|
583 |
+
wp_schedule_event( time(), 'weekly', $this->client->slug . '_tracker_send_event' );
|
584 |
+
delete_option( $this->client->slug . '_tracking_last_send' );
|
585 |
+
|
586 |
+
$this->send_tracking_data( true );
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* Clear our options upon deactivation
|
591 |
+
*
|
592 |
+
* @return void
|
593 |
+
*/
|
594 |
+
public function deactivation_cleanup() {
|
595 |
+
$this->clear_schedule_event();
|
596 |
+
|
597 |
+
if ( 'theme' == $this->client->type ) {
|
598 |
+
delete_option( $this->client->slug . '_tracking_last_send' );
|
599 |
+
delete_option( $this->client->slug . '_allow_tracking' );
|
600 |
+
}
|
601 |
+
|
602 |
+
delete_option( $this->client->slug . '_tracking_notice' );
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Hook into action links and modify the deactivate link
|
607 |
+
*
|
608 |
+
* @param array $links
|
609 |
+
*
|
610 |
+
* @return array
|
611 |
+
*/
|
612 |
+
public function plugin_action_links( $links ) {
|
613 |
+
|
614 |
+
if ( array_key_exists( 'deactivate', $links ) ) {
|
615 |
+
$links['deactivate'] = str_replace( '<a', '<a class="' . $this->client->slug . '-deactivate-link"', $links['deactivate'] );
|
616 |
+
}
|
617 |
+
|
618 |
+
return $links;
|
619 |
+
}
|
620 |
+
|
621 |
+
private function get_uninstall_reasons() {
|
622 |
+
$reasons = array(
|
623 |
+
array(
|
624 |
+
'id' => 'could-not-understand',
|
625 |
+
'text' => 'I couldn\'t understand how to make it work',
|
626 |
+
'type' => 'textarea',
|
627 |
+
'placeholder' => 'Would you like us to assist you?'
|
628 |
+
),
|
629 |
+
array(
|
630 |
+
'id' => 'found-better-plugin',
|
631 |
+
'text' => 'I found a better plugin',
|
632 |
+
'type' => 'text',
|
633 |
+
'placeholder' => 'Which plugin?'
|
634 |
+
),
|
635 |
+
array(
|
636 |
+
'id' => 'not-have-that-feature',
|
637 |
+
'text' => 'The plugin is great, but I need specific feature that you don\'t support',
|
638 |
+
'type' => 'textarea',
|
639 |
+
'placeholder' => 'Could you tell us more about that feature?'
|
640 |
+
),
|
641 |
+
array(
|
642 |
+
'id' => 'is-not-working',
|
643 |
+
'text' => 'The plugin is not working',
|
644 |
+
'type' => 'textarea',
|
645 |
+
'placeholder' => 'Could you tell us a bit more whats not working?'
|
646 |
+
),
|
647 |
+
array(
|
648 |
+
'id' => 'looking-for-other',
|
649 |
+
'text' => 'It\'s not what I was looking for',
|
650 |
+
'type' => '',
|
651 |
+
'placeholder' => ''
|
652 |
+
),
|
653 |
+
array(
|
654 |
+
'id' => 'did-not-work-as-expected',
|
655 |
+
'text' => 'The plugin didn\'t work as expected',
|
656 |
+
'type' => 'textarea',
|
657 |
+
'placeholder' => 'What did you expect?'
|
658 |
+
),
|
659 |
+
array(
|
660 |
+
'id' => 'other',
|
661 |
+
'text' => 'Other',
|
662 |
+
'type' => 'textarea',
|
663 |
+
'placeholder' => 'Could you tell us a bit more?'
|
664 |
+
),
|
665 |
+
);
|
666 |
+
|
667 |
+
return $reasons;
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Plugin deactivation uninstall reason submission
|
672 |
+
*
|
673 |
+
* @return void
|
674 |
+
*/
|
675 |
+
public function uninstall_reason_submission() {
|
676 |
+
|
677 |
+
if ( ! isset( $_POST['reason_id'] ) ) {
|
678 |
+
wp_send_json_error();
|
679 |
+
}
|
680 |
+
|
681 |
+
$current_user = wp_get_current_user();
|
682 |
+
|
683 |
+
$data = array(
|
684 |
+
'hash' => $this->client->hash,
|
685 |
+
'reason_id' => sanitize_text_field( $_POST['reason_id'] ),
|
686 |
+
'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
|
687 |
+
'site' => $this->get_site_name(),
|
688 |
+
'url' => esc_url( home_url() ),
|
689 |
+
'admin_email' => get_option( 'admin_email' ),
|
690 |
+
'user_email' => $current_user->user_email,
|
691 |
+
'first_name' => $current_user->first_name,
|
692 |
+
'last_name' => $current_user->last_name,
|
693 |
+
'server' => $this->get_server_info(),
|
694 |
+
'wp' => $this->get_wp_info(),
|
695 |
+
'ip_address' => $this->get_user_ip_address(),
|
696 |
+
'version' => $this->client->project_version,
|
697 |
+
);
|
698 |
+
|
699 |
+
$this->client->send_request( $data, 'deactivate' );
|
700 |
+
|
701 |
+
wp_send_json_success();
|
702 |
+
}
|
703 |
+
|
704 |
+
/**
|
705 |
+
* Handle the plugin deactivation feedback
|
706 |
+
*
|
707 |
+
* @return void
|
708 |
+
*/
|
709 |
+
public function deactivate_scripts() {
|
710 |
+
global $pagenow;
|
711 |
+
|
712 |
+
if ( 'plugins.php' != $pagenow ) {
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
|
716 |
+
$reasons = $this->get_uninstall_reasons();
|
717 |
+
?>
|
718 |
+
|
719 |
+
<div class="wd-dr-modal" id="<?php echo $this->client->slug; ?>-wd-dr-modal">
|
720 |
+
<div class="wd-dr-modal-wrap">
|
721 |
+
<div class="wd-dr-modal-header">
|
722 |
+
<h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'domain' ); ?></h3>
|
723 |
+
</div>
|
724 |
+
|
725 |
+
<div class="wd-dr-modal-body">
|
726 |
+
<ul class="reasons">
|
727 |
+
<?php foreach ($reasons as $reason) { ?>
|
728 |
+
<li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
|
729 |
+
<label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
|
730 |
+
</li>
|
731 |
+
<?php } ?>
|
732 |
+
</ul>
|
733 |
+
</div>
|
734 |
+
|
735 |
+
<div class="wd-dr-modal-footer">
|
736 |
+
<a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', 'domain' ); ?></a>
|
737 |
+
<button class="button-secondary"><?php _e( 'Submit & Deactivate', 'domain' ); ?></button>
|
738 |
+
<button class="button-primary"><?php _e( 'Cancel', 'domain' ); ?></button>
|
739 |
+
</div>
|
740 |
+
</div>
|
741 |
+
</div>
|
742 |
+
|
743 |
+
<style type="text/css">
|
744 |
+
.wd-dr-modal {
|
745 |
+
position: fixed;
|
746 |
+
z-index: 99999;
|
747 |
+
top: 0;
|
748 |
+
right: 0;
|
749 |
+
bottom: 0;
|
750 |
+
left: 0;
|
751 |
+
background: rgba(0,0,0,0.5);
|
752 |
+
display: none;
|
753 |
+
}
|
754 |
+
|
755 |
+
.wd-dr-modal.modal-active {
|
756 |
+
display: block;
|
757 |
+
}
|
758 |
+
|
759 |
+
.wd-dr-modal-wrap {
|
760 |
+
width: 475px;
|
761 |
+
position: relative;
|
762 |
+
margin: 10% auto;
|
763 |
+
background: #fff;
|
764 |
+
}
|
765 |
+
|
766 |
+
.wd-dr-modal-header {
|
767 |
+
border-bottom: 1px solid #eee;
|
768 |
+
padding: 8px 20px;
|
769 |
+
}
|
770 |
+
|
771 |
+
.wd-dr-modal-header h3 {
|
772 |
+
line-height: 150%;
|
773 |
+
margin: 0;
|
774 |
+
}
|
775 |
+
|
776 |
+
.wd-dr-modal-body {
|
777 |
+
padding: 5px 20px 20px 20px;
|
778 |
+
}
|
779 |
+
|
780 |
+
.wd-dr-modal-body .reason-input {
|
781 |
+
margin-top: 5px;
|
782 |
+
margin-left: 20px;
|
783 |
+
}
|
784 |
+
.wd-dr-modal-footer {
|
785 |
+
border-top: 1px solid #eee;
|
786 |
+
padding: 12px 20px;
|
787 |
+
text-align: right;
|
788 |
+
}
|
789 |
+
</style>
|
790 |
+
|
791 |
+
<script type="text/javascript">
|
792 |
+
(function($) {
|
793 |
+
$(function() {
|
794 |
+
var modal = $( '#<?php echo $this->client->slug; ?>-wd-dr-modal' );
|
795 |
+
var deactivateLink = '';
|
796 |
+
|
797 |
+
$( '#the-list' ).on('click', 'a.<?php echo $this->client->slug; ?>-deactivate-link', function(e) {
|
798 |
+
e.preventDefault();
|
799 |
+
|
800 |
+
modal.addClass('modal-active');
|
801 |
+
deactivateLink = $(this).attr('href');
|
802 |
+
modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
|
803 |
+
});
|
804 |
+
|
805 |
+
modal.on('click', 'button.button-primary', function(e) {
|
806 |
+
e.preventDefault();
|
807 |
+
|
808 |
+
modal.removeClass('modal-active');
|
809 |
+
});
|
810 |
+
|
811 |
+
modal.on('click', 'input[type="radio"]', function () {
|
812 |
+
var parent = $(this).parents('li:first');
|
813 |
+
|
814 |
+
modal.find('.reason-input').remove();
|
815 |
+
|
816 |
+
var inputType = parent.data('type'),
|
817 |
+
inputPlaceholder = parent.data('placeholder'),
|
818 |
+
reasonInputHtml = '<div class="reason-input">' + ( ( 'text' === inputType ) ? '<input type="text" size="40" />' : '<textarea rows="5" cols="45"></textarea>' ) + '</div>';
|
819 |
+
|
820 |
+
if ( inputType !== '' ) {
|
821 |
+
parent.append( $(reasonInputHtml) );
|
822 |
+
parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
823 |
+
}
|
824 |
+
});
|
825 |
+
|
826 |
+
modal.on('click', 'button.button-secondary', function(e) {
|
827 |
+
e.preventDefault();
|
828 |
+
|
829 |
+
var button = $(this);
|
830 |
+
|
831 |
+
if ( button.hasClass('disabled') ) {
|
832 |
+
return;
|
833 |
+
}
|
834 |
+
|
835 |
+
var $radio = $( 'input[type="radio"]:checked', modal );
|
836 |
+
|
837 |
+
var $selected_reason = $radio.parents('li:first'),
|
838 |
+
$input = $selected_reason.find('textarea, input[type="text"]');
|
839 |
+
|
840 |
+
$.ajax({
|
841 |
+
url: ajaxurl,
|
842 |
+
type: 'POST',
|
843 |
+
data: {
|
844 |
+
action: '<?php echo $this->client->slug; ?>_submit-uninstall-reason',
|
845 |
+
reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
|
846 |
+
reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
|
847 |
+
},
|
848 |
+
beforeSend: function() {
|
849 |
+
button.addClass('disabled');
|
850 |
+
button.text('Processing...');
|
851 |
+
},
|
852 |
+
complete: function() {
|
853 |
+
window.location.href = deactivateLink;
|
854 |
+
}
|
855 |
+
});
|
856 |
+
});
|
857 |
+
});
|
858 |
+
}(jQuery));
|
859 |
+
</script>
|
860 |
+
|
861 |
+
<?php
|
862 |
+
}
|
863 |
+
|
864 |
+
/**
|
865 |
+
* Run after theme deactivated
|
866 |
+
* @param string $new_name
|
867 |
+
* @param object $new_theme
|
868 |
+
* @param object $old_theme
|
869 |
+
* @return void
|
870 |
+
*/
|
871 |
+
public function theme_deactivated( $new_name, $new_theme, $old_theme ) {
|
872 |
+
// Make sure this is appsero theme
|
873 |
+
if ( $old_theme->get_template() == $this->client->slug ) {
|
874 |
+
$current_user = wp_get_current_user();
|
875 |
+
|
876 |
+
$data = array(
|
877 |
+
'hash' => $this->client->hash,
|
878 |
+
'reason_id' => 'none',
|
879 |
+
'reason_info' => '',
|
880 |
+
'site' => $this->get_site_name(),
|
881 |
+
'url' => esc_url( home_url() ),
|
882 |
+
'admin_email' => get_option( 'admin_email' ),
|
883 |
+
'user_email' => $current_user->user_email,
|
884 |
+
'first_name' => $current_user->first_name,
|
885 |
+
'last_name' => $current_user->last_name,
|
886 |
+
'server' => $this->get_server_info(),
|
887 |
+
'wp' => $this->get_wp_info(),
|
888 |
+
'ip_address' => $this->get_user_ip_address(),
|
889 |
+
'version' => $this->client->project_version,
|
890 |
+
);
|
891 |
+
|
892 |
+
$this->client->send_request( $data, 'deactivate' );
|
893 |
+
}
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Get user IP Address
|
898 |
+
*/
|
899 |
+
private function get_user_ip_address() {
|
900 |
+
$response = wp_remote_get( 'https://icanhazip.com/' );
|
901 |
+
|
902 |
+
if ( is_wp_error( $response ) ) {
|
903 |
+
return '';
|
904 |
+
}
|
905 |
+
|
906 |
+
$ip = trim( wp_remote_retrieve_body( $response ) );
|
907 |
+
|
908 |
+
if ( ! filter_var( $ip, FILTER_VALIDATE_IP ) ) {
|
909 |
+
return '';
|
910 |
+
}
|
911 |
+
|
912 |
+
return $ip;
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Get site name
|
917 |
+
*/
|
918 |
+
private function get_site_name() {
|
919 |
+
$site_name = get_bloginfo( 'name' );
|
920 |
+
|
921 |
+
if ( empty( $site_name ) ) {
|
922 |
+
$site_name = get_bloginfo( 'description' );
|
923 |
+
$site_name = wp_trim_words( $site_name, 3, '' );
|
924 |
+
}
|
925 |
+
|
926 |
+
if ( empty( $site_name ) ) {
|
927 |
+
$site_name = get_bloginfo( 'url' );
|
928 |
+
}
|
929 |
+
|
930 |
+
return $site_name;
|
931 |
+
}
|
932 |
+
}
|
lib/class-wedevs-insights.php
CHANGED
@@ -15,780 +15,21 @@ if ( ! class_exists( 'WPUF_WeDevs_Insights' ) ) :
|
|
15 |
*/
|
16 |
class WPUF_WeDevs_Insights {
|
17 |
|
18 |
-
/**
|
19 |
-
* Slug of the plugin
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
public $slug;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Name of the plugin
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
public $name;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Main plugin file
|
34 |
-
*
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $basename;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* The notice text
|
41 |
-
*
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
public $notice;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* URL to the API endpoint
|
48 |
-
*
|
49 |
-
* @var string
|
50 |
-
*/
|
51 |
-
private static $api_url = 'https://tracking.wedevs.com/';
|
52 |
-
|
53 |
/**
|
54 |
* Initialize the class
|
55 |
-
*
|
56 |
-
* @param string $slug slug of the plugin
|
57 |
-
* @param string $name readable name of the plugin
|
58 |
-
* @param string $file main plugin file path
|
59 |
-
* @param string $notice the notice texts if needs customizing
|
60 |
-
*/
|
61 |
-
public function __construct( $slug, $name, $file, $notice = '' ) {
|
62 |
-
$this->slug = $slug;
|
63 |
-
$this->name = $name;
|
64 |
-
$this->basename = plugin_basename( $file );
|
65 |
-
$this->notice = $notice;
|
66 |
-
|
67 |
-
// tracking notice
|
68 |
-
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
69 |
-
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
70 |
-
|
71 |
-
// plugin deactivate actions
|
72 |
-
add_action( 'plugin_action_links_' . $this->basename, array( $this, 'plugin_action_links' ) );
|
73 |
-
add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) );
|
74 |
-
|
75 |
-
// clean events and options on deactivation
|
76 |
-
register_deactivation_hook( $file, array( $this, 'deactivate_plugin' ) );
|
77 |
-
|
78 |
-
// uninstall reason
|
79 |
-
add_action( 'wp_ajax_' . $this->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) );
|
80 |
-
|
81 |
-
// cron events
|
82 |
-
add_action( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
|
83 |
-
add_action( $this->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) );
|
84 |
-
// add_action( 'admin_init', array( $this, 'send_tracking_data' ) ); // test
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Send tracking data to weDevs server
|
89 |
-
*
|
90 |
-
* @param boolean $override
|
91 |
-
*
|
92 |
-
* @return void
|
93 |
-
*/
|
94 |
-
public function send_tracking_data( $override = false ) {
|
95 |
-
// skip on AJAX Requests
|
96 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
97 |
-
return;
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( ! $this->tracking_allowed() && ! $override ) {
|
101 |
-
return;
|
102 |
-
}
|
103 |
-
|
104 |
-
// Send a maximum of once per week
|
105 |
-
$last_send = $this->get_last_send();
|
106 |
-
if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
|
107 |
-
return;
|
108 |
-
}
|
109 |
-
|
110 |
-
$this->send_request( $this->get_tracking_data(), 'track' );
|
111 |
-
|
112 |
-
update_option( $this->slug . '_tracking_last_send', time() );
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Send request to remote endpoint
|
117 |
-
*
|
118 |
-
* @param array $params
|
119 |
-
* @param string $route
|
120 |
-
*
|
121 |
-
* @return void
|
122 |
*/
|
123 |
-
|
124 |
-
$resp = wp_remote_post( self::$api_url . $route, array(
|
125 |
-
'method' => 'POST',
|
126 |
-
'timeout' => 45,
|
127 |
-
'redirection' => 5,
|
128 |
-
'httpversion' => '1.0',
|
129 |
-
'blocking' => false,
|
130 |
-
'headers' => array( 'user-agent' => 'WeDevsTracker/' . md5( esc_url( home_url() ) ) . ';' ),
|
131 |
-
'body' => $params,
|
132 |
-
'cookies' => array()
|
133 |
-
)
|
134 |
-
);
|
135 |
-
}
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
*
|
140 |
-
* @return array
|
141 |
-
*/
|
142 |
-
protected function get_tracking_data() {
|
143 |
-
$all_plugins = $this->get_all_plugins();
|
144 |
-
$admin_user = get_user_by( 'id', 1 );
|
145 |
-
|
146 |
-
$data = array(
|
147 |
-
'url' => home_url(),
|
148 |
-
'site' => get_bloginfo( 'name' ),
|
149 |
-
'admin_email' => get_option( 'admin_email' ),
|
150 |
-
'user_name' => $admin_user->display_name,
|
151 |
-
'user_email' => $admin_user->user_email,
|
152 |
-
'plugin' => $this->slug,
|
153 |
-
'server' => $this->get_server_info(),
|
154 |
-
'wp' => $this->get_wp_info(),
|
155 |
-
'users' => $this->get_user_counts(),
|
156 |
-
'active_plugins' => count( $all_plugins['active_plugins'] ),
|
157 |
-
'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
|
158 |
-
);
|
159 |
-
|
160 |
-
// for child classes
|
161 |
-
if ( $extra = $this->get_extra_data() ) {
|
162 |
-
$data['extra'] = $extra;
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
}
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
*
|
171 |
-
* @return mixed
|
172 |
-
*/
|
173 |
-
protected function get_extra_data() {
|
174 |
-
return false;
|
175 |
}
|
176 |
|
177 |
-
/**
|
178 |
-
* Explain the user which data we collect
|
179 |
-
*
|
180 |
-
* @return string
|
181 |
-
*/
|
182 |
-
protected function data_we_collect() {
|
183 |
-
$data = array(
|
184 |
-
'Server environment details (php, mysql, server, WordPress versions)',
|
185 |
-
'Number of users in your site',
|
186 |
-
'Site language',
|
187 |
-
'Number of active and inactive plugins',
|
188 |
-
'Site name and url',
|
189 |
-
'Your name and email address',
|
190 |
-
);
|
191 |
-
|
192 |
-
return $data;
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Check if the user has opted into tracking
|
197 |
-
*
|
198 |
-
* @return bool
|
199 |
-
*/
|
200 |
-
private function tracking_allowed() {
|
201 |
-
$allow_tracking = get_option( $this->slug . '_allow_tracking', 'no' );
|
202 |
-
|
203 |
-
return $allow_tracking == 'yes';
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Get the last time a tracking was sent
|
208 |
-
*
|
209 |
-
* @return false|string
|
210 |
-
*/
|
211 |
-
private function get_last_send() {
|
212 |
-
return get_option( $this->slug . '_tracking_last_send', false );
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Check if the notice has been dismissed or enabled
|
217 |
-
*
|
218 |
-
* @return boolean
|
219 |
-
*/
|
220 |
-
private function notice_dismissed() {
|
221 |
-
$hide_notice = get_option( $this->slug . '_tracking_notice', 'no' );
|
222 |
-
|
223 |
-
if ( 'hide' == $hide_notice ) {
|
224 |
-
return true;
|
225 |
-
}
|
226 |
-
|
227 |
-
return false;
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Check if the current server is localhost
|
232 |
-
*
|
233 |
-
* @return boolean
|
234 |
-
*/
|
235 |
-
private function is_local_server() {
|
236 |
-
|
237 |
-
if ( $_SERVER['HTTP_HOST'] == 'localhost'
|
238 |
-
|| substr( $_SERVER['REMOTE_ADDR'], 0, 3 ) == '10.'
|
239 |
-
|| substr( $_SERVER['REMOTE_ADDR'], 0, 7 ) == '192.168' ) {
|
240 |
-
|
241 |
-
return true;
|
242 |
-
}
|
243 |
-
|
244 |
-
if ( in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) ) ) {
|
245 |
-
return true;
|
246 |
-
}
|
247 |
-
|
248 |
-
$fragments = explode( '.', site_url() );
|
249 |
-
|
250 |
-
if ( in_array( end( $fragments ), array( 'dev', 'local', 'localhost', 'test' ) ) ) {
|
251 |
-
return true;
|
252 |
-
}
|
253 |
-
|
254 |
-
return false;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Schedule the event weekly
|
259 |
-
*
|
260 |
-
* @return void
|
261 |
-
*/
|
262 |
-
private function schedule_event() {
|
263 |
-
wp_schedule_event( time(), 'weekly', $this->slug . '_tracker_send_event' );
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Clear any scheduled hook
|
268 |
-
*
|
269 |
-
* @return void
|
270 |
-
*/
|
271 |
-
private function clear_schedule_event() {
|
272 |
-
wp_clear_scheduled_hook( $this->slug . '_tracker_send_event' );
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* If the admin notice should be shown
|
277 |
-
*
|
278 |
-
* Show the notice after X days
|
279 |
-
*
|
280 |
-
* @return boolean
|
281 |
-
*/
|
282 |
-
public function should_display_notice( $days = 7 ) {
|
283 |
-
$installed = get_option( 'wpuf_installed' );
|
284 |
-
|
285 |
-
if ( $installed ) {
|
286 |
-
$diff = time() - $installed;
|
287 |
-
|
288 |
-
// if installed 7 days ago
|
289 |
-
if ( floor( $diff / DAY_IN_SECONDS ) > $days ) {
|
290 |
-
return true;
|
291 |
-
}
|
292 |
-
}
|
293 |
-
|
294 |
-
return false;
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* Display the admin notice to users that have not opted-in or out
|
299 |
-
*
|
300 |
-
* @return void
|
301 |
-
*/
|
302 |
-
public function admin_notice() {
|
303 |
-
|
304 |
-
if ( $this->notice_dismissed() ) {
|
305 |
-
return;
|
306 |
-
}
|
307 |
-
|
308 |
-
if ( $this->tracking_allowed() ) {
|
309 |
-
return;
|
310 |
-
}
|
311 |
-
|
312 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
313 |
-
return;
|
314 |
-
}
|
315 |
-
|
316 |
-
if ( ! $this->should_display_notice() ) {
|
317 |
-
return;
|
318 |
-
}
|
319 |
-
|
320 |
-
// don't show tracking if a local server
|
321 |
-
if ( ! $this->is_local_server() ) {
|
322 |
-
$optin_url = add_query_arg( $this->slug . '_tracker_optin', 'true' );
|
323 |
-
$optout_url = add_query_arg( $this->slug . '_tracker_optout', 'true' );
|
324 |
-
|
325 |
-
if ( empty( $this->notice ) ) {
|
326 |
-
$notice = sprintf( __( 'Want to help make <strong>%s</strong> even more awesome? Allow weDevs to collect non-sensitive diagnostic data and usage information.', 'wp-user-frontend' ), $this->name );
|
327 |
-
} else {
|
328 |
-
$notice = $this->notice;
|
329 |
-
}
|
330 |
-
|
331 |
-
$notice .= ' (<a class="insights-data-we-collect" href="#">' . __( 'what we collect', 'wp-user-frontend' ) . '</a>)';
|
332 |
-
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked.</p>';
|
333 |
-
|
334 |
-
echo '<div class="updated"><p>';
|
335 |
-
echo $notice;
|
336 |
-
echo '</p><p class="submit">';
|
337 |
-
echo ' <a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . __( 'Allow', 'wp-user-frontend' ) . '</a>';
|
338 |
-
echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . __( 'No thanks', 'wp-user-frontend' ) . '</a>';
|
339 |
-
echo '</p></div>';
|
340 |
-
|
341 |
-
echo "<script type='text/javascript'>jQuery('.insights-data-we-collect').on('click', function(e) {
|
342 |
-
e.preventDefault();
|
343 |
-
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
|
344 |
-
});
|
345 |
-
</script>
|
346 |
-
";
|
347 |
-
}
|
348 |
-
}
|
349 |
-
|
350 |
-
/**
|
351 |
-
* handle the optin/optout
|
352 |
-
*
|
353 |
-
* @return void
|
354 |
-
*/
|
355 |
-
public function handle_optin_optout() {
|
356 |
-
if ( isset( $_GET[ $this->slug . '_tracker_optin' ] ) && $_GET[ $this->slug . '_tracker_optin' ] == 'true' ) {
|
357 |
-
update_option( $this->slug . '_allow_tracking', 'yes' );
|
358 |
-
update_option( $this->slug . '_tracking_notice', 'hide' );
|
359 |
-
|
360 |
-
$this->clear_schedule_event();
|
361 |
-
$this->schedule_event();
|
362 |
-
$this->send_tracking_data();
|
363 |
-
|
364 |
-
wp_redirect( remove_query_arg( $this->slug . '_tracker_optin' ) );
|
365 |
-
exit;
|
366 |
-
}
|
367 |
-
|
368 |
-
if ( isset( $_GET[ $this->slug . '_tracker_optout' ] ) && $_GET[ $this->slug . '_tracker_optout' ] == 'true' ) {
|
369 |
-
update_option( $this->slug . '_allow_tracking', 'no' );
|
370 |
-
update_option( $this->slug . '_tracking_notice', 'hide' );
|
371 |
-
|
372 |
-
$this->clear_schedule_event();
|
373 |
-
|
374 |
-
wp_redirect( remove_query_arg( $this->slug . '_tracker_optout' ) );
|
375 |
-
exit;
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Get the number of post counts
|
381 |
-
*
|
382 |
-
* @param string $post_type
|
383 |
-
*
|
384 |
-
* @return integer
|
385 |
-
*/
|
386 |
-
protected function get_post_count( $post_type ) {
|
387 |
-
global $wpdb;
|
388 |
-
|
389 |
-
return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'");
|
390 |
-
}
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Get server related info.
|
394 |
-
*
|
395 |
-
* @return array
|
396 |
-
*/
|
397 |
-
private static function get_server_info() {
|
398 |
-
global $wpdb;
|
399 |
-
|
400 |
-
$server_data = array();
|
401 |
-
|
402 |
-
if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
|
403 |
-
$server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
|
404 |
-
}
|
405 |
-
|
406 |
-
if ( function_exists( 'phpversion' ) ) {
|
407 |
-
$server_data['php_version'] = phpversion();
|
408 |
-
}
|
409 |
-
|
410 |
-
$server_data['mysql_version'] = $wpdb->db_version();
|
411 |
-
|
412 |
-
$server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
|
413 |
-
$server_data['php_default_timezone'] = date_default_timezone_get();
|
414 |
-
$server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
|
415 |
-
$server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
|
416 |
-
$server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
|
417 |
-
|
418 |
-
return $server_data;
|
419 |
-
}
|
420 |
-
|
421 |
-
/**
|
422 |
-
* Get WordPress related data.
|
423 |
-
*
|
424 |
-
* @return array
|
425 |
-
*/
|
426 |
-
private function get_wp_info() {
|
427 |
-
$wp_data = array();
|
428 |
-
|
429 |
-
$wp_data['memory_limit'] = WP_MEMORY_LIMIT;
|
430 |
-
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
|
431 |
-
$wp_data['locale'] = get_locale();
|
432 |
-
$wp_data['version'] = get_bloginfo( 'version' );
|
433 |
-
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
|
434 |
-
|
435 |
-
return $wp_data;
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Get the list of active and inactive plugins
|
440 |
-
*
|
441 |
-
* @return array
|
442 |
-
*/
|
443 |
-
private function get_all_plugins() {
|
444 |
-
// Ensure get_plugins function is loaded
|
445 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
446 |
-
include ABSPATH . '/wp-admin/includes/plugin.php';
|
447 |
-
}
|
448 |
-
|
449 |
-
$plugins = get_plugins();
|
450 |
-
$active_plugins_keys = get_option( 'active_plugins', array() );
|
451 |
-
$active_plugins = array();
|
452 |
-
|
453 |
-
foreach ( $plugins as $k => $v ) {
|
454 |
-
// Take care of formatting the data how we want it.
|
455 |
-
$formatted = array();
|
456 |
-
$formatted['name'] = strip_tags( $v['Name'] );
|
457 |
-
|
458 |
-
if ( isset( $v['Version'] ) ) {
|
459 |
-
$formatted['version'] = strip_tags( $v['Version'] );
|
460 |
-
}
|
461 |
-
|
462 |
-
if ( isset( $v['Author'] ) ) {
|
463 |
-
$formatted['author'] = strip_tags( $v['Author'] );
|
464 |
-
}
|
465 |
-
|
466 |
-
if ( isset( $v['Network'] ) ) {
|
467 |
-
$formatted['network'] = strip_tags( $v['Network'] );
|
468 |
-
}
|
469 |
-
|
470 |
-
if ( isset( $v['PluginURI'] ) ) {
|
471 |
-
$formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
|
472 |
-
}
|
473 |
-
|
474 |
-
if ( in_array( $k, $active_plugins_keys ) ) {
|
475 |
-
// Remove active plugins from list so we can show active and inactive separately
|
476 |
-
unset( $plugins[$k] );
|
477 |
-
$active_plugins[$k] = $formatted;
|
478 |
-
} else {
|
479 |
-
$plugins[$k] = $formatted;
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
|
484 |
-
}
|
485 |
-
|
486 |
-
/**
|
487 |
-
* Get user totals based on user role.
|
488 |
-
*
|
489 |
-
* @return array
|
490 |
-
*/
|
491 |
-
private function get_user_counts() {
|
492 |
-
$user_count = array();
|
493 |
-
$user_count_data = count_users();
|
494 |
-
$user_count['total'] = $user_count_data['total_users'];
|
495 |
-
|
496 |
-
// Get user count based on user role
|
497 |
-
foreach ( $user_count_data['avail_roles'] as $role => $count ) {
|
498 |
-
$user_count[ $role ] = $count;
|
499 |
-
}
|
500 |
-
|
501 |
-
return $user_count;
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Add weekly cron schedule
|
506 |
-
*
|
507 |
-
* @param array $schedules
|
508 |
-
*
|
509 |
-
* @return array
|
510 |
-
*/
|
511 |
-
public function add_weekly_schedule( $schedules ) {
|
512 |
-
|
513 |
-
$schedules['weekly'] = array(
|
514 |
-
'interval' => DAY_IN_SECONDS * 7,
|
515 |
-
'display' => __( 'Once Weekly', 'wp-user-frontend' )
|
516 |
-
);
|
517 |
-
|
518 |
-
return $schedules;
|
519 |
-
}
|
520 |
-
|
521 |
-
/**
|
522 |
-
* Clear our options upon deactivation
|
523 |
-
*
|
524 |
-
* @return void
|
525 |
-
*/
|
526 |
-
public function deactivate_plugin() {
|
527 |
-
$this->clear_schedule_event();
|
528 |
-
|
529 |
-
delete_option( $this->slug . '_allow_tracking' );
|
530 |
-
delete_option( $this->slug . '_tracking_notice' );
|
531 |
-
delete_option( $this->slug . '_tracking_last_send' );
|
532 |
-
}
|
533 |
-
|
534 |
-
/**
|
535 |
-
* Hook into action links and modify the deactivate link
|
536 |
-
*
|
537 |
-
* @param array $links
|
538 |
-
*
|
539 |
-
* @return array
|
540 |
-
*/
|
541 |
-
public function plugin_action_links( $links ) {
|
542 |
-
|
543 |
-
if ( array_key_exists( 'deactivate', $links ) ) {
|
544 |
-
$links['deactivate'] = str_replace( '<a', '<a class="' . $this->slug . '-deactivate-link"', $links['deactivate'] );
|
545 |
-
}
|
546 |
-
|
547 |
-
return $links;
|
548 |
-
}
|
549 |
-
|
550 |
-
private function get_uninstall_reasons() {
|
551 |
-
$reasons = array(
|
552 |
-
array(
|
553 |
-
'id' => 'could-not-understand',
|
554 |
-
'text' => 'I couldn\'t understand how to make it work',
|
555 |
-
'type' => 'textarea',
|
556 |
-
'placeholder' => 'Would you like us to assist you?'
|
557 |
-
),
|
558 |
-
array(
|
559 |
-
'id' => 'found-better-plugin',
|
560 |
-
'text' => 'I found a better plugin',
|
561 |
-
'type' => 'text',
|
562 |
-
'placeholder' => 'Which plugin?'
|
563 |
-
),
|
564 |
-
array(
|
565 |
-
'id' => 'not-have-that-feature',
|
566 |
-
'text' => 'The plugin is great, but I need specific feature that you don\'t support',
|
567 |
-
'type' => 'textarea',
|
568 |
-
'placeholder' => 'Could you tell us more about that feature?'
|
569 |
-
),
|
570 |
-
array(
|
571 |
-
'id' => 'is-not-working',
|
572 |
-
'text' => 'The plugin is not working',
|
573 |
-
'type' => 'textarea',
|
574 |
-
'placeholder' => 'Could you tell us a bit more whats not working?'
|
575 |
-
),
|
576 |
-
array(
|
577 |
-
'id' => 'looking-for-other',
|
578 |
-
'text' => 'It\'s not what I was looking for',
|
579 |
-
'type' => '',
|
580 |
-
'placeholder' => ''
|
581 |
-
),
|
582 |
-
array(
|
583 |
-
'id' => 'did-not-work-as-expected',
|
584 |
-
'text' => 'The plugin didn\'t work as expected',
|
585 |
-
'type' => 'textarea',
|
586 |
-
'placeholder' => 'What did you expect?'
|
587 |
-
),
|
588 |
-
array(
|
589 |
-
'id' => 'other',
|
590 |
-
'text' => 'Other',
|
591 |
-
'type' => 'textarea',
|
592 |
-
'placeholder' => 'Could you tell us a bit more?'
|
593 |
-
),
|
594 |
-
);
|
595 |
-
|
596 |
-
return $reasons;
|
597 |
-
}
|
598 |
-
|
599 |
-
/**
|
600 |
-
* Plugin deactivation uninstall reason submission
|
601 |
-
*
|
602 |
-
* @return void
|
603 |
-
*/
|
604 |
-
public function uninstall_reason_submission() {
|
605 |
-
global $wpdb;
|
606 |
-
|
607 |
-
if ( ! isset( $_POST['reason_id'] ) ) {
|
608 |
-
wp_send_json_error();
|
609 |
-
}
|
610 |
-
|
611 |
-
$current_user = wp_get_current_user();
|
612 |
-
|
613 |
-
$data = array(
|
614 |
-
'reason_id' => sanitize_text_field( $_POST['reason_id'] ),
|
615 |
-
'plugin' => $this->slug,
|
616 |
-
'url' => home_url(),
|
617 |
-
'user_email' => $current_user->user_email,
|
618 |
-
'user_name' => $current_user->display_name,
|
619 |
-
'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
|
620 |
-
'software' => $_SERVER['SERVER_SOFTWARE'],
|
621 |
-
'php_version' => phpversion(),
|
622 |
-
'mysql_version' => $wpdb->db_version(),
|
623 |
-
'wp_version' => get_bloginfo( 'version' ),
|
624 |
-
'locale' => get_locale(),
|
625 |
-
'multisite' => is_multisite() ? 'Yes' : 'No'
|
626 |
-
);
|
627 |
-
|
628 |
-
$this->send_request( $data, 'uninstall_reason' );
|
629 |
-
|
630 |
-
wp_send_json_success();
|
631 |
-
}
|
632 |
-
|
633 |
-
/**
|
634 |
-
* Handle the plugin deactivation feedback
|
635 |
-
*
|
636 |
-
* @return void
|
637 |
-
*/
|
638 |
-
public function deactivate_scripts() {
|
639 |
-
global $pagenow;
|
640 |
-
|
641 |
-
if ( 'plugins.php' != $pagenow ) {
|
642 |
-
return;
|
643 |
-
}
|
644 |
-
|
645 |
-
$reasons = $this->get_uninstall_reasons();
|
646 |
-
?>
|
647 |
-
|
648 |
-
<div class="wd-dr-modal" id="<?php echo $this->slug; ?>-wd-dr-modal">
|
649 |
-
<div class="wd-dr-modal-wrap">
|
650 |
-
<div class="wd-dr-modal-header">
|
651 |
-
<h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'wp-user-frontend' ); ?></h3>
|
652 |
-
</div>
|
653 |
-
|
654 |
-
<div class="wd-dr-modal-body">
|
655 |
-
<ul class="reasons">
|
656 |
-
<?php foreach ($reasons as $reason) { ?>
|
657 |
-
<li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
|
658 |
-
<label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
|
659 |
-
</li>
|
660 |
-
<?php } ?>
|
661 |
-
</ul>
|
662 |
-
</div>
|
663 |
-
|
664 |
-
<div class="wd-dr-modal-footer">
|
665 |
-
<a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', 'wp-user-frontend' ); ?></a>
|
666 |
-
<button class="button-secondary"><?php _e( 'Submit & Deactivate', 'wp-user-frontend' ); ?></button>
|
667 |
-
<button class="button-primary"><?php _e( 'Cancel', 'wp-user-frontend' ); ?></button>
|
668 |
-
</div>
|
669 |
-
</div>
|
670 |
-
</div>
|
671 |
-
|
672 |
-
<style type="text/css">
|
673 |
-
.wd-dr-modal {
|
674 |
-
position: fixed;
|
675 |
-
z-index: 99999;
|
676 |
-
top: 0;
|
677 |
-
right: 0;
|
678 |
-
bottom: 0;
|
679 |
-
left: 0;
|
680 |
-
background: rgba(0,0,0,0.5);
|
681 |
-
display: none;
|
682 |
-
}
|
683 |
-
|
684 |
-
.wd-dr-modal.modal-active {
|
685 |
-
display: block;
|
686 |
-
}
|
687 |
-
|
688 |
-
.wd-dr-modal-wrap {
|
689 |
-
width: 475px;
|
690 |
-
position: relative;
|
691 |
-
margin: 10% auto;
|
692 |
-
background: #fff;
|
693 |
-
}
|
694 |
-
|
695 |
-
.wd-dr-modal-header {
|
696 |
-
border-bottom: 1px solid #eee;
|
697 |
-
padding: 8px 20px;
|
698 |
-
}
|
699 |
-
|
700 |
-
.wd-dr-modal-header h3 {
|
701 |
-
line-height: 150%;
|
702 |
-
margin: 0;
|
703 |
-
}
|
704 |
-
|
705 |
-
.wd-dr-modal-body {
|
706 |
-
padding: 5px 20px 20px 20px;
|
707 |
-
}
|
708 |
-
|
709 |
-
.wd-dr-modal-body .reason-input {
|
710 |
-
margin-top: 5px;
|
711 |
-
margin-left: 20px;
|
712 |
-
}
|
713 |
-
.wd-dr-modal-footer {
|
714 |
-
border-top: 1px solid #eee;
|
715 |
-
padding: 12px 20px;
|
716 |
-
text-align: right;
|
717 |
-
}
|
718 |
-
</style>
|
719 |
-
|
720 |
-
<script type="text/javascript">
|
721 |
-
(function($) {
|
722 |
-
$(function() {
|
723 |
-
var modal = $( '#<?php echo $this->slug; ?>-wd-dr-modal' );
|
724 |
-
var deactivateLink = '';
|
725 |
-
|
726 |
-
$( '#the-list' ).on('click', 'a.<?php echo $this->slug; ?>-deactivate-link', function(e) {
|
727 |
-
e.preventDefault();
|
728 |
-
|
729 |
-
modal.addClass('modal-active');
|
730 |
-
deactivateLink = $(this).attr('href');
|
731 |
-
modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
|
732 |
-
});
|
733 |
-
|
734 |
-
modal.on('click', 'button.button-primary', function(e) {
|
735 |
-
e.preventDefault();
|
736 |
-
|
737 |
-
modal.removeClass('modal-active');
|
738 |
-
});
|
739 |
-
|
740 |
-
modal.on('click', 'input[type="radio"]', function () {
|
741 |
-
var parent = $(this).parents('li:first');
|
742 |
-
|
743 |
-
modal.find('.reason-input').remove();
|
744 |
-
|
745 |
-
var inputType = parent.data('type'),
|
746 |
-
inputPlaceholder = parent.data('placeholder'),
|
747 |
-
reasonInputHtml = '<div class="reason-input">' + ( ( 'text' === inputType ) ? '<input type="text" size="40" />' : '<textarea rows="5" cols="45"></textarea>' ) + '</div>';
|
748 |
-
|
749 |
-
if ( inputType !== '' ) {
|
750 |
-
parent.append( $(reasonInputHtml) );
|
751 |
-
parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
752 |
-
}
|
753 |
-
});
|
754 |
-
|
755 |
-
modal.on('click', 'button.button-secondary', function(e) {
|
756 |
-
e.preventDefault();
|
757 |
-
|
758 |
-
var button = $(this);
|
759 |
-
|
760 |
-
if ( button.hasClass('disabled') ) {
|
761 |
-
return;
|
762 |
-
}
|
763 |
-
|
764 |
-
var $radio = $( 'input[type="radio"]:checked', modal );
|
765 |
-
|
766 |
-
var $selected_reason = $radio.parents('li:first'),
|
767 |
-
$input = $selected_reason.find('textarea, input[type="text"]');
|
768 |
-
|
769 |
-
$.ajax({
|
770 |
-
url: ajaxurl,
|
771 |
-
type: 'POST',
|
772 |
-
data: {
|
773 |
-
action: '<?php echo $this->slug; ?>_submit-uninstall-reason',
|
774 |
-
reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
|
775 |
-
reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
|
776 |
-
},
|
777 |
-
beforeSend: function() {
|
778 |
-
button.addClass('disabled');
|
779 |
-
button.text('Processing...');
|
780 |
-
},
|
781 |
-
complete: function() {
|
782 |
-
window.location.href = deactivateLink;
|
783 |
-
}
|
784 |
-
});
|
785 |
-
});
|
786 |
-
});
|
787 |
-
}(jQuery));
|
788 |
-
</script>
|
789 |
-
|
790 |
-
<?php
|
791 |
-
}
|
792 |
}
|
793 |
|
794 |
endif;
|
15 |
*/
|
16 |
class WPUF_WeDevs_Insights {
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Initialize the class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
+
public function __construct( $file ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
if ( ! class_exists( 'Appsero\Client' ) ) {
|
24 |
+
require_once __DIR__ . '/appsero/Client.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
+
$client = new Appsero\Client( '958afc63-99f8-4b98-b321-fcbc5cf95694', 'WP User Frontend', $file );
|
|
|
28 |
|
29 |
+
// Active insights
|
30 |
+
$client->insights()->init();
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
endif;
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== WP User Frontend - Membership, Profile, Registration & Post Submission Plugin for WordPress ===
|
2 |
-
Contributors: tareq1988, sk.shaikat, rabbii,
|
3 |
Donate link: https://tareq.co/donate/
|
4 |
Tags: Forms, registration, profile-builder, login, membership
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.1.1
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 3.1.
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -257,6 +257,13 @@ redirected to the edit page with that post id. Then you'll see the edit post for
|
|
257 |
|
258 |
== Changelog ==
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
= v3.1.3 (15 April, 2019) =
|
261 |
|
262 |
* **Fix:** Required option of checkbox field was not validating on the frontend.
|
1 |
=== WP User Frontend - Membership, Profile, Registration & Post Submission Plugin for WordPress ===
|
2 |
+
Contributors: tareq1988, nizamuddinbabu, sk.shaikat, rabbii, itowhid06, wedevs
|
3 |
Donate link: https://tareq.co/donate/
|
4 |
Tags: Forms, registration, profile-builder, login, membership
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.1.1
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 3.1.4
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
257 |
|
258 |
== Changelog ==
|
259 |
|
260 |
+
= v3.1.4 (02 May, 2019) =
|
261 |
+
|
262 |
+
* **Fix:** Category field data were not being saved when conditional logic is applied to custom taxonomy fields based on category field.
|
263 |
+
* **Fix:** While editing the checkbox values from the backend user profile page, the values were not being saved.
|
264 |
+
* **Fix:** While editing profile, using the default profile form, the password strength indicator didn't respond.
|
265 |
+
* **Fix:** Insights data were not being sent.
|
266 |
+
|
267 |
= v3.1.3 (15 April, 2019) =
|
268 |
|
269 |
* **Fix:** Required option of checkbox field was not validating on the frontend.
|
templates/dashboard/edit-profile.php
CHANGED
@@ -56,22 +56,6 @@ ob_start();
|
|
56 |
<div class="wpuf-fields" >
|
57 |
<input type="password" class="input-text" name="pass1" id="pass1" size="16" value="" autocomplete="off" />
|
58 |
</div>
|
59 |
-
<span style="width: 100%;" id="pass-strength-result"><?php _e( 'Strength indicator', 'wp-user-frontend' ); ?></span>
|
60 |
-
<script src="<?php echo site_url(); ?>/wp-includes/js/zxcvbn.min.js"></script>
|
61 |
-
<script src="<?php echo admin_url(); ?>/js/password-strength-meter.js"></script>
|
62 |
-
<script type="text/javascript">
|
63 |
-
var pwsL10n = {
|
64 |
-
empty: "Strength indicator",
|
65 |
-
short: "Very weak",
|
66 |
-
bad: "Weak",
|
67 |
-
good: "Medium",
|
68 |
-
strong: "Strong",
|
69 |
-
mismatch: "Mismatch"
|
70 |
-
};
|
71 |
-
try {
|
72 |
-
convertEntities(pwsL10n);
|
73 |
-
} catch (e) {};
|
74 |
-
</script>
|
75 |
</li>
|
76 |
<div class="clear"></div>
|
77 |
|
@@ -82,6 +66,61 @@ ob_start();
|
|
82 |
<div class="wpuf-fields" >
|
83 |
<input type="password" class="input-text" name="pass2" id="pass2" size="16" value="" autocomplete="off" />
|
84 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
</li>
|
86 |
<div class="clear"></div>
|
87 |
|
@@ -98,4 +137,4 @@ ob_start();
|
|
98 |
$output = ob_get_clean();
|
99 |
|
100 |
echo apply_filters( 'wpuf_account_edit_profile_content', $output );
|
101 |
-
?>
|
56 |
<div class="wpuf-fields" >
|
57 |
<input type="password" class="input-text" name="pass1" id="pass1" size="16" value="" autocomplete="off" />
|
58 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
</li>
|
60 |
<div class="clear"></div>
|
61 |
|
66 |
<div class="wpuf-fields" >
|
67 |
<input type="password" class="input-text" name="pass2" id="pass2" size="16" value="" autocomplete="off" />
|
68 |
</div>
|
69 |
+
|
70 |
+
<span style="display: block; margin-top:20px" class="pass-strength-result" id="pass-strength-result"><?php _e( 'Strength indicator', 'wp-user-frontend' ); ?></span>
|
71 |
+
<script src="<?php echo includes_url(); ?>/js/zxcvbn.min.js"></script>
|
72 |
+
<script src="<?php echo admin_url(); ?>/js/password-strength-meter.js"></script>
|
73 |
+
<script type="text/javascript">
|
74 |
+
jQuery(function($) {
|
75 |
+
function check_pass_strength() {
|
76 |
+
var pass1 = $("#pass1").val(),
|
77 |
+
pass2 = $("#pass2").val(),
|
78 |
+
strength;
|
79 |
+
|
80 |
+
if ( typeof pass2 === undefined ) {
|
81 |
+
pass2 = pass1;
|
82 |
+
}
|
83 |
+
|
84 |
+
var pwsL10n = {
|
85 |
+
empty: "Strength indicator",
|
86 |
+
short: "Very weak",
|
87 |
+
bad: "Weak",
|
88 |
+
good: "Medium",
|
89 |
+
strong: "Strong",
|
90 |
+
mismatch: "Mismatch"
|
91 |
+
};
|
92 |
+
|
93 |
+
$("#pass-strength-result").removeClass('short bad good strong');
|
94 |
+
if (!pass1) {
|
95 |
+
$("#pass-strength-result").html(pwsL10n.empty);
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
strength = wp.passwordStrength.meter(pass1, wp.passwordStrength.userInputBlacklist(), pass2);
|
100 |
+
|
101 |
+
switch (strength) {
|
102 |
+
case 2:
|
103 |
+
$("#pass-strength-result").addClass('bad').html(pwsL10n.bad);
|
104 |
+
break;
|
105 |
+
case 3:
|
106 |
+
$("#pass-strength-result").addClass('good').html(pwsL10n.good);
|
107 |
+
break;
|
108 |
+
case 4:
|
109 |
+
$("#pass-strength-result").addClass('strong').html(pwsL10n.strong);
|
110 |
+
break;
|
111 |
+
case 5:
|
112 |
+
$("#pass-strength-result").addClass('short').html(pwsL10n.mismatch);
|
113 |
+
break;
|
114 |
+
default:
|
115 |
+
$("#pass-strength-result").addClass('short').html(pwsL10n['short']);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
$("#pass1").val('').keyup(check_pass_strength);
|
120 |
+
$("#pass2").val('').keyup(check_pass_strength);
|
121 |
+
$("#pass-strength-result").show();
|
122 |
+
});
|
123 |
+
</script>
|
124 |
</li>
|
125 |
<div class="clear"></div>
|
126 |
|
137 |
$output = ob_get_clean();
|
138 |
|
139 |
echo apply_filters( 'wpuf_account_edit_profile_content', $output );
|
140 |
+
?>
|
wpuf.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP User Frontend
|
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
|
5 |
Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
|
6 |
Author: Tareq Hasan
|
7 |
-
Version: 3.1.
|
8 |
Author URI: https://tareq.co
|
9 |
License: GPL2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -12,7 +12,7 @@ Text Domain: wp-user-frontend
|
|
12 |
Domain Path: /languages
|
13 |
*/
|
14 |
|
15 |
-
define( 'WPUF_VERSION', '3.1.
|
16 |
define( 'WPUF_FILE', __FILE__ );
|
17 |
define( 'WPUF_ROOT', dirname( __FILE__ ) );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|
@@ -150,6 +150,9 @@ final class WP_User_Frontend {
|
|
150 |
// set schedule event
|
151 |
add_action( 'wpuf_remove_expired_post_hook', array( $this, 'action_to_remove_exipred_post' ) );
|
152 |
add_action( 'wp_ajax_wpuf_weforms_install', array( $this, 'install_weforms' ) );
|
|
|
|
|
|
|
153 |
}
|
154 |
|
155 |
/**
|
@@ -328,7 +331,6 @@ final class WP_User_Frontend {
|
|
328 |
$this->container['subscription'] = WPUF_Subscription::init();
|
329 |
$this->container['frontend_post'] = WPUF_Frontend_Form_Post::init();
|
330 |
$this->container['account'] = new WPUF_Frontend_Account();
|
331 |
-
$this->container['insights'] = new WPUF_WeDevs_Insights( 'wp-user-frontend', 'WP User Frontend', __FILE__ );
|
332 |
$this->container['billing_address'] = new WPUF_Ajax_Address_Form();
|
333 |
$this->container['forms'] = new WPUF_Form_Manager();
|
334 |
$this->container['preview'] = new WPUF_Form_Preview();
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
|
5 |
Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
|
6 |
Author: Tareq Hasan
|
7 |
+
Version: 3.1.4
|
8 |
Author URI: https://tareq.co
|
9 |
License: GPL2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
Domain Path: /languages
|
13 |
*/
|
14 |
|
15 |
+
define( 'WPUF_VERSION', '3.1.4' );
|
16 |
define( 'WPUF_FILE', __FILE__ );
|
17 |
define( 'WPUF_ROOT', dirname( __FILE__ ) );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|
150 |
// set schedule event
|
151 |
add_action( 'wpuf_remove_expired_post_hook', array( $this, 'action_to_remove_exipred_post' ) );
|
152 |
add_action( 'wp_ajax_wpuf_weforms_install', array( $this, 'install_weforms' ) );
|
153 |
+
|
154 |
+
// Insight class instentiate
|
155 |
+
$this->container['insights'] = new WPUF_WeDevs_Insights( __FILE__ );
|
156 |
}
|
157 |
|
158 |
/**
|
331 |
$this->container['subscription'] = WPUF_Subscription::init();
|
332 |
$this->container['frontend_post'] = WPUF_Frontend_Form_Post::init();
|
333 |
$this->container['account'] = new WPUF_Frontend_Account();
|
|
|
334 |
$this->container['billing_address'] = new WPUF_Ajax_Address_Form();
|
335 |
$this->container['forms'] = new WPUF_Form_Manager();
|
336 |
$this->container['preview'] = new WPUF_Form_Preview();
|