Version Description
Download this release
Release Info
Developer | tareq1988 |
Plugin | WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress |
Version | 3.1.16 |
Comparing to | |
See all releases |
Code changes from version 3.1.15 to 3.1.16
- admin/form-builder/class-wpuf-admin-form-builder-ajax.php +2 -2
- admin/form-handler.php +1 -1
- admin/installer.php +3 -3
- admin/posting.php +10 -7
- assets/js-templates/form-components.php +2 -2
- assets/js/wpuf-form-builder-components.js +41 -45
- assets/less/frontend-forms.less +9 -9
- class/subscription.php +1 -1
- includes/class-frontend-form-post.php +4 -3
- includes/class-frontend-render-form.php +10 -9
- includes/fields/class-field-html.php +1 -1
- includes/free/edit-profile.php +3 -4
- includes/free/edit-user.php +6 -2
- includes/free/loader.php +3 -1
- languages/wp-user-frontend.pot +73 -61
- readme.txt +8 -1
- templates/subscriptions/pack-details.php +1 -1
- vendor/appsero/client/.gitignore +0 -16
- vendor/appsero/client/composer.json +0 -21
- vendor/appsero/client/readme.md +0 -206
- vendor/appsero/client/src/Client.php +0 -210
- vendor/appsero/client/src/Insights.php +0 -962
- vendor/appsero/client/src/License.php +0 -701
- vendor/appsero/client/src/Updater.php +0 -247
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +4 -4
- vendor/composer/installed.json +0 -44
- wpuf-functions.php +10 -11
- wpuf.php +2 -2
admin/form-builder/class-wpuf-admin-form-builder-ajax.php
CHANGED
@@ -39,8 +39,8 @@ class WPUF_Admin_Form_Builder_Ajax {
|
|
39 |
wp_send_json_error( __( 'Invalid form id', 'wp-user-frontend' ) );
|
40 |
}
|
41 |
|
42 |
-
$form_fields = isset( $post_data['form_fields'] ) ?
|
43 |
-
$notifications = isset( $post_data['notifications'] ) ?
|
44 |
$settings = [];
|
45 |
$integrations = [];
|
46 |
|
39 |
wp_send_json_error( __( 'Invalid form id', 'wp-user-frontend' ) );
|
40 |
}
|
41 |
|
42 |
+
$form_fields = isset( $post_data['form_fields'] ) ? $post_data['form_fields'] : '';
|
43 |
+
$notifications = isset( $post_data['notifications'] ) ? $post_data['notifications'] : '';
|
44 |
$settings = [];
|
45 |
$integrations = [];
|
46 |
|
admin/form-handler.php
CHANGED
@@ -68,7 +68,7 @@ class WPUF_Admin_Form_Handler {
|
|
68 |
|
69 |
switch ( $action ) {
|
70 |
case 'post_form_search':
|
71 |
-
$redirect = remove_query_arg( [ 'post_form_search' ], $
|
72 |
|
73 |
break;
|
74 |
|
68 |
|
69 |
switch ( $action ) {
|
70 |
case 'post_form_search':
|
71 |
+
$redirect = remove_query_arg( [ 'post_form_search' ], $remove_query_args );
|
72 |
|
73 |
break;
|
74 |
|
admin/installer.php
CHANGED
@@ -62,9 +62,9 @@ class WPUF_Admin_Installer {
|
|
62 |
$this->init_pages();
|
63 |
}
|
64 |
|
65 |
-
if ( isset( $_POST['install_wpuf_pages'] ) && $_POST['install_wpuf_pages'] == '1' ) {
|
66 |
-
|
67 |
-
}
|
68 |
|
69 |
if ( isset( $_GET['wpuf_hide_page_nag'] ) && $_GET['wpuf_hide_page_nag'] == '1' ) {
|
70 |
update_option( '_wpuf_page_created', '1' );
|
62 |
$this->init_pages();
|
63 |
}
|
64 |
|
65 |
+
// if ( isset( $_POST['install_wpuf_pages'] ) && $_POST['install_wpuf_pages'] == '1' ) {
|
66 |
+
// $this->init_pages();
|
67 |
+
// }
|
68 |
|
69 |
if ( isset( $_GET['wpuf_hide_page_nag'] ) && $_GET['wpuf_hide_page_nag'] == '1' ) {
|
70 |
update_option( '_wpuf_page_created', '1' );
|
admin/posting.php
CHANGED
@@ -118,8 +118,8 @@ class WPUF_Admin_Posting {
|
|
118 |
$forms = get_posts( ['post_type' => 'wpuf_forms', 'numberposts' => '-1'] );
|
119 |
$selected = get_post_meta( $post->ID, '_wpuf_form_id', true ); ?>
|
120 |
|
121 |
-
<input type="hidden" name="wpuf_form_select_nonce" value="<?php echo
|
122 |
-
|
123 |
<select name="wpuf_form_select">
|
124 |
<option value="">--</option>
|
125 |
<?php foreach ( $forms as $form ) { ?>
|
@@ -210,8 +210,8 @@ class WPUF_Admin_Posting {
|
|
210 |
$msg = sprintf( __( 'Frontend edit access for this post will be automatically locked after %s, <a id="wpuf_clear_schedule_lock" data="%s" href="#">Clear Lock</a> Or,', 'wp-user-frontend' ), $local_time, $post->ID );
|
211 |
} ?>
|
212 |
|
213 |
-
<input type="hidden" name="wpuf_lock_editing_post_nonce" value="<?php echo
|
214 |
-
|
215 |
<p><?php echo esc_html( $msg ); ?></p>
|
216 |
|
217 |
<label>
|
@@ -331,7 +331,8 @@ class WPUF_Admin_Posting {
|
|
331 |
return;
|
332 |
} ?>
|
333 |
|
334 |
-
|
|
|
335 |
<input type="hidden" name="wpuf_cf_form_id" value="<?php echo esc_attr( $form_id ); ?>" />
|
336 |
|
337 |
<table class="form-table wpuf-cf-table">
|
@@ -353,7 +354,8 @@ class WPUF_Admin_Posting {
|
|
353 |
|
354 |
<?php
|
355 |
$atts = [];
|
356 |
-
wpuf()->fields->render_fields( $custom_fields, $form_id, $atts, $type = 'post', $post->ID );
|
|
|
357 |
</tbody>
|
358 |
</table>
|
359 |
<?php
|
@@ -399,7 +401,8 @@ class WPUF_Admin_Posting {
|
|
399 |
var data = {
|
400 |
action: 'wpuf_delete_avatar',
|
401 |
user_id : $('#profile-page').find('#user_id').val(),
|
402 |
-
_wpnonce: '<?php echo
|
|
|
403 |
};
|
404 |
|
405 |
if ( confirm( $(this).data('confirm') ) ) {
|
118 |
$forms = get_posts( ['post_type' => 'wpuf_forms', 'numberposts' => '-1'] );
|
119 |
$selected = get_post_meta( $post->ID, '_wpuf_form_id', true ); ?>
|
120 |
|
121 |
+
<!-- <input type="hidden" name="wpuf_form_select_nonce" value="<?php // echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" /> -->
|
122 |
+
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'wpuf_form_select_nonce' ); ?>
|
123 |
<select name="wpuf_form_select">
|
124 |
<option value="">--</option>
|
125 |
<?php foreach ( $forms as $form ) { ?>
|
210 |
$msg = sprintf( __( 'Frontend edit access for this post will be automatically locked after %s, <a id="wpuf_clear_schedule_lock" data="%s" href="#">Clear Lock</a> Or,', 'wp-user-frontend' ), $local_time, $post->ID );
|
211 |
} ?>
|
212 |
|
213 |
+
<!-- <input type="hidden" name="wpuf_lock_editing_post_nonce" value="<?php // echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" /> -->
|
214 |
+
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'wpuf_lock_editing_post_nonce' ); ?>
|
215 |
<p><?php echo esc_html( $msg ); ?></p>
|
216 |
|
217 |
<label>
|
331 |
return;
|
332 |
} ?>
|
333 |
|
334 |
+
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'wpuf_cf_update' ); ?>
|
335 |
+
<!-- <input type="hidden" name="wpuf_cf_update" value="<?php // echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" /> -->
|
336 |
<input type="hidden" name="wpuf_cf_form_id" value="<?php echo esc_attr( $form_id ); ?>" />
|
337 |
|
338 |
<table class="form-table wpuf-cf-table">
|
354 |
|
355 |
<?php
|
356 |
$atts = [];
|
357 |
+
wpuf()->fields->render_fields( $custom_fields, $form_id, $atts, $type = 'post', $post->ID );
|
358 |
+
// wp_nonce_field( 'wpuf_form_add' ); ?>
|
359 |
</tbody>
|
360 |
</table>
|
361 |
<?php
|
401 |
var data = {
|
402 |
action: 'wpuf_delete_avatar',
|
403 |
user_id : $('#profile-page').find('#user_id').val(),
|
404 |
+
// _wpnonce: '<?php // echo wp_create_nonce( 'wpuf_nonce' ); ?>'
|
405 |
+
_wpnonce: wpuf_admin_script.nonce
|
406 |
};
|
407 |
|
408 |
if ( confirm( $(this).data('confirm') ) ) {
|
assets/js-templates/form-components.php
CHANGED
@@ -51,14 +51,14 @@
|
|
51 |
</ul><!-- .wpuf-form -->
|
52 |
|
53 |
<div v-if="hidden_fields.length" class="hidden-field-list">
|
54 |
-
<h4><?php
|
55 |
|
56 |
<ul class="wpuf-form">
|
57 |
<li
|
58 |
v-for="(field, index) in hidden_fields"
|
59 |
:class="['field-items', parseInt(editing_form_id) === parseInt(field.id) ? 'current-editing' : '']"
|
60 |
>
|
61 |
-
<strong><?php
|
62 |
|
63 |
<div class="control-buttons">
|
64 |
<p>
|
51 |
</ul><!-- .wpuf-form -->
|
52 |
|
53 |
<div v-if="hidden_fields.length" class="hidden-field-list">
|
54 |
+
<h4><?php esc_html_e( 'Hidden Fields', 'wp-user-frontend' ); ?></h4>
|
55 |
|
56 |
<ul class="wpuf-form">
|
57 |
<li
|
58 |
v-for="(field, index) in hidden_fields"
|
59 |
:class="['field-items', parseInt(editing_form_id) === parseInt(field.id) ? 'current-editing' : '']"
|
60 |
>
|
61 |
+
<strong><?php esc_html_e( 'key', 'wp-user-frontend' ); ?></strong>: {{ field.name }} | <strong><?php esc_html_e( 'value', 'wp-user-frontend' ); ?></strong>: {{ field.meta_value }}
|
62 |
|
63 |
<div class="control-buttons">
|
64 |
<p>
|
assets/js/wpuf-form-builder-components.js
CHANGED
@@ -1069,60 +1069,56 @@ Vue.component('form-column_field', {
|
|
1069 |
});
|
1070 |
},
|
1071 |
|
1072 |
-
resizeColumns
|
1073 |
-
|
1074 |
|
1075 |
(function () {
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
Array.prototype.forEach.call(
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
|
|
|
|
|
|
1096 |
|
1097 |
-
|
1098 |
-
|
1099 |
|
1100 |
-
$(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mousemove(function
|
1101 |
if (columnElement) {
|
1102 |
-
|
1103 |
|
1104 |
-
|
1105 |
}
|
1106 |
});
|
1107 |
|
1108 |
-
$(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mouseup(function
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
colTwoWidth = 100/columnsNumber;
|
1120 |
-
colThreeWidth = 0;
|
1121 |
-
} else {
|
1122 |
-
colOneWidth = $(columnField).find(".column-1").width();
|
1123 |
-
colTwoWidth = $(columnField).find(".column-2").width();
|
1124 |
-
colThreeWidth = 0;
|
1125 |
-
}
|
1126 |
|
1127 |
self.field.inner_columns_size['column-1'] = colOneWidth + '%';
|
1128 |
self.field.inner_columns_size['column-2'] = colTwoWidth + '%';
|
1069 |
});
|
1070 |
},
|
1071 |
|
1072 |
+
resizeColumns(columnsNumber) {
|
1073 |
+
var self = this;
|
1074 |
|
1075 |
(function () {
|
1076 |
+
var columnElement;
|
1077 |
+
var startOffset;
|
1078 |
+
var columnField = $(self.$el).context.parentElement;
|
1079 |
+
var total_width = parseInt($(columnField).width());
|
1080 |
+
|
1081 |
+
Array.prototype.forEach.call(
|
1082 |
+
$(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields"),
|
1083 |
+
|
1084 |
+
function (column) {
|
1085 |
+
column.style.position = 'relative';
|
1086 |
+
|
1087 |
+
var grip = document.createElement('div');
|
1088 |
+
grip.innerHTML = " ";
|
1089 |
+
grip.style.top = 0;
|
1090 |
+
grip.style.right = 0;
|
1091 |
+
grip.style.bottom = 0;
|
1092 |
+
grip.style.width = '5px';
|
1093 |
+
grip.style.position = 'absolute';
|
1094 |
+
grip.style.cursor = 'col-resize';
|
1095 |
+
grip.addEventListener('mousedown', function (e) {
|
1096 |
+
columnElement = column;
|
1097 |
+
startOffset = column.offsetWidth - e.pageX;
|
1098 |
+
});
|
1099 |
|
1100 |
+
column.appendChild(grip);
|
1101 |
+
});
|
1102 |
|
1103 |
+
$(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mousemove(function( e ) {
|
1104 |
if (columnElement) {
|
1105 |
+
var currentColumnWidth = startOffset + e.pageX;
|
1106 |
|
1107 |
+
columnElement.style.width = (100*currentColumnWidth) / total_width + '%';
|
1108 |
}
|
1109 |
});
|
1110 |
|
1111 |
+
$(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mouseup(function() {
|
1112 |
+
var columnOneWidth = $(columnField).find(".column-1").width(),
|
1113 |
+
columnTwoWidth = $(columnField).find(".column-2").width(),
|
1114 |
+
colOneWidth = (100*columnOneWidth) / total_width,
|
1115 |
+
colTwoWidth = 100 - colOneWidth,
|
1116 |
+
colThreeWidth = 0;
|
1117 |
+
|
1118 |
+
if (columnsNumber === 3) {
|
1119 |
+
colTwoWidth = (100*columnTwoWidth) / total_width;
|
1120 |
+
colThreeWidth = 100 - (colOneWidth + colTwoWidth);
|
1121 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1122 |
|
1123 |
self.field.inner_columns_size['column-1'] = colOneWidth + '%';
|
1124 |
self.field.inner_columns_size['column-2'] = colTwoWidth + '%';
|
assets/less/frontend-forms.less
CHANGED
@@ -1371,7 +1371,7 @@ body.rtl{
|
|
1371 |
.wpuf-dashboard-navigation {
|
1372 |
width: 30%;
|
1373 |
float: left;
|
1374 |
-
|
1375 |
a {
|
1376 |
text-decoration: none;
|
1377 |
box-shadow: none;
|
@@ -1385,7 +1385,7 @@ body.rtl{
|
|
1385 |
padding-bottom: 2px;
|
1386 |
}
|
1387 |
}
|
1388 |
-
|
1389 |
@media (max-width: @mediaSM){
|
1390 |
width: 100%;
|
1391 |
margin-bottom: 30px;
|
@@ -1407,8 +1407,8 @@ body.rtl{
|
|
1407 |
width: 100%;
|
1408 |
}
|
1409 |
.wpuf-fields {
|
1410 |
-
select,
|
1411 |
-
textarea,
|
1412 |
input {
|
1413 |
&:not([type="submit"]),
|
1414 |
&:not([type="button"]),
|
@@ -1418,8 +1418,8 @@ body.rtl{
|
|
1418 |
&:not([type="reset"]){
|
1419 |
width: 100%;
|
1420 |
}
|
1421 |
-
}
|
1422 |
-
}
|
1423 |
|
1424 |
}
|
1425 |
|
@@ -1469,13 +1469,13 @@ body.rtl{
|
|
1469 |
padding: 0 15px;
|
1470 |
overflow: visible;
|
1471 |
}
|
1472 |
-
|
1473 |
@media(max-width: @mediaXS){
|
1474 |
.form-row-first,
|
1475 |
.form-row-last {
|
1476 |
float: none;
|
1477 |
width: 100%;
|
1478 |
-
}
|
1479 |
}
|
1480 |
}
|
1481 |
|
@@ -1922,4 +1922,4 @@ ul.wpuf-form{
|
|
1922 |
}
|
1923 |
}
|
1924 |
}
|
1925 |
-
}
|
1371 |
.wpuf-dashboard-navigation {
|
1372 |
width: 30%;
|
1373 |
float: left;
|
1374 |
+
|
1375 |
a {
|
1376 |
text-decoration: none;
|
1377 |
box-shadow: none;
|
1385 |
padding-bottom: 2px;
|
1386 |
}
|
1387 |
}
|
1388 |
+
|
1389 |
@media (max-width: @mediaSM){
|
1390 |
width: 100%;
|
1391 |
margin-bottom: 30px;
|
1407 |
width: 100%;
|
1408 |
}
|
1409 |
.wpuf-fields {
|
1410 |
+
select,
|
1411 |
+
textarea,
|
1412 |
input {
|
1413 |
&:not([type="submit"]),
|
1414 |
&:not([type="button"]),
|
1418 |
&:not([type="reset"]){
|
1419 |
width: 100%;
|
1420 |
}
|
1421 |
+
}
|
1422 |
+
}
|
1423 |
|
1424 |
}
|
1425 |
|
1469 |
padding: 0 15px;
|
1470 |
overflow: visible;
|
1471 |
}
|
1472 |
+
|
1473 |
@media(max-width: @mediaXS){
|
1474 |
.form-row-first,
|
1475 |
.form-row-last {
|
1476 |
float: none;
|
1477 |
width: 100%;
|
1478 |
+
}
|
1479 |
}
|
1480 |
}
|
1481 |
|
1922 |
}
|
1923 |
}
|
1924 |
}
|
1925 |
+
}
|
class/subscription.php
CHANGED
@@ -135,7 +135,7 @@ class WPUF_Subscription {
|
|
135 |
|
136 |
if ( $billing_amount !== false ) {
|
137 |
$pay_page = intval( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
|
138 |
-
$redirect = add_query_arg( ['action' => 'wpuf_pay', 'user_id' => $user_id, 'type' => 'pack', 'pack_id' => (int) $pack_id, get_permalink( $pay_page )
|
139 |
|
140 |
$response['redirect_to'] = $redirect;
|
141 |
$response['show_message'] = false;
|
135 |
|
136 |
if ( $billing_amount !== false ) {
|
137 |
$pay_page = intval( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
|
138 |
+
$redirect = add_query_arg( ['action' => 'wpuf_pay', 'user_id' => $user_id, 'type' => 'pack', 'pack_id' => (int) $pack_id ], get_permalink( $pay_page ) );
|
139 |
|
140 |
$response['redirect_to'] = $redirect;
|
141 |
$response['show_message'] = false;
|
includes/class-frontend-form-post.php
CHANGED
@@ -302,13 +302,14 @@ class WPUF_Frontend_Form extends WPUF_Frontend_Render_Form {
|
|
302 |
$default_post_author = wpuf_get_option( 'default_post_owner', 'wpuf_frontend_posting', 1 );
|
303 |
$post_author = $this->wpuf_get_post_user();
|
304 |
|
|
|
305 |
$postarr = [
|
306 |
'post_type' => $this->form_settings['post_type'],
|
307 |
'post_status' => isset( $this->form_settings['post_status'] ) ? $this->form_settings['post_status'] : 'publish',
|
308 |
'post_author' => $post_author,
|
309 |
'post_title' => isset( $_POST['post_title'] ) ? sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) : '',
|
310 |
-
'post_content' => isset( $_POST['post_content'] ) ?
|
311 |
-
'post_excerpt' => isset( $_POST['post_excerpt'] ) ?
|
312 |
];
|
313 |
|
314 |
// $charging_enabled = wpuf_get_option( 'charge_posting', 'wpuf_payment' );
|
@@ -610,7 +611,7 @@ class WPUF_Frontend_Form extends WPUF_Frontend_Render_Form {
|
|
610 |
}
|
611 |
|
612 |
public static function update_post_meta( $meta_vars, $post_id ) {
|
613 |
-
check_ajax_referer( 'wpuf_form_add' );
|
614 |
// prepare the meta vars
|
615 |
list( $meta_key_value, $multi_repeated, $files ) = self::prepare_meta_fields( $meta_vars );
|
616 |
// set featured image if there's any
|
302 |
$default_post_author = wpuf_get_option( 'default_post_owner', 'wpuf_frontend_posting', 1 );
|
303 |
$post_author = $this->wpuf_get_post_user();
|
304 |
|
305 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
306 |
$postarr = [
|
307 |
'post_type' => $this->form_settings['post_type'],
|
308 |
'post_status' => isset( $this->form_settings['post_status'] ) ? $this->form_settings['post_status'] : 'publish',
|
309 |
'post_author' => $post_author,
|
310 |
'post_title' => isset( $_POST['post_title'] ) ? sanitize_text_field( wp_unslash( $_POST['post_title'] ) ) : '',
|
311 |
+
'post_content' => isset( $_POST['post_content'] ) ? wp_kses( wp_unslash( $_POST['post_content'] ), $allowed_tags ) : '',
|
312 |
+
'post_excerpt' => isset( $_POST['post_excerpt'] ) ? wp_kses( wp_unslash( $_POST['post_excerpt'] ),$allowed_tags ) : '',
|
313 |
];
|
314 |
|
315 |
// $charging_enabled = wpuf_get_option( 'charge_posting', 'wpuf_payment' );
|
611 |
}
|
612 |
|
613 |
public static function update_post_meta( $meta_vars, $post_id ) {
|
614 |
+
// check_ajax_referer( 'wpuf_form_add' );
|
615 |
// prepare the meta vars
|
616 |
list( $meta_key_value, $multi_repeated, $files ) = self::prepare_meta_fields( $meta_vars );
|
617 |
// set featured image if there's any
|
includes/class-frontend-render-form.php
CHANGED
@@ -644,22 +644,23 @@ class WPUF_Frontend_Render_Form {
|
|
644 |
// skip files, put in a key => value paired array for later executation
|
645 |
// process repeatable fields separately
|
646 |
// if the input is array type, implode with separator in a field
|
647 |
-
check_ajax_referer( 'wpuf_form_add' );
|
648 |
-
|
649 |
$files = [];
|
650 |
$meta_key_value = [];
|
651 |
$multi_repeated = []; //multi repeated fields will in sotre duplicated meta key
|
652 |
|
653 |
foreach ( $meta_vars as $key => $value ) {
|
654 |
// $wpuf_files = isset( $_POST['wpuf_files'] ) ? wp_unslash( $_POST['wpuf_files'] ) : [];
|
655 |
-
if( isset( $
|
656 |
-
$value_name = isset( $
|
657 |
} else {
|
658 |
-
$value_name = isset( $
|
|
|
659 |
}
|
660 |
|
661 |
-
if ( isset( $
|
662 |
-
$wpuf_files = isset( $
|
663 |
} else {
|
664 |
$wpuf_files = [];
|
665 |
}
|
@@ -735,8 +736,8 @@ class WPUF_Frontend_Render_Form {
|
|
735 |
break;
|
736 |
|
737 |
case 'textarea':
|
738 |
-
|
739 |
-
$meta_key_value[$value['name']] =
|
740 |
|
741 |
break;
|
742 |
|
644 |
// skip files, put in a key => value paired array for later executation
|
645 |
// process repeatable fields separately
|
646 |
// if the input is array type, implode with separator in a field
|
647 |
+
// /check_ajax_referer( 'wpuf_form_add' );
|
648 |
+
$post_data = wp_unslash( $_POST );
|
649 |
$files = [];
|
650 |
$meta_key_value = [];
|
651 |
$multi_repeated = []; //multi repeated fields will in sotre duplicated meta key
|
652 |
|
653 |
foreach ( $meta_vars as $key => $value ) {
|
654 |
// $wpuf_files = isset( $_POST['wpuf_files'] ) ? wp_unslash( $_POST['wpuf_files'] ) : [];
|
655 |
+
if( isset( $post_data[$value['name']] ) && is_array( $post_data[$value['name']] ) ) {
|
656 |
+
$value_name = isset( $post_data[$value['name']] ) ? array_map( 'sanitize_text_field', wp_unslash( $post_data[$value['name']] ) ): '';
|
657 |
} else {
|
658 |
+
// $value_name = isset( $post_data[$value['name']] ) ? sanitize_text_field( wp_unslash( $post_data[$value['name']] ) ): '';
|
659 |
+
$value_name = isset( $post_data[$value['name']] ) ? wp_unslash( $post_data[$value['name']] ): '';
|
660 |
}
|
661 |
|
662 |
+
if ( isset( $post_data['wpuf_files'][$value['name']] ) ) {
|
663 |
+
$wpuf_files = isset( $post_data['wpuf_files'] ) ? array_map( 'sanitize_text_field', wp_unslash( $post_data['wpuf_files'][$value['name']] ) ) : [];
|
664 |
} else {
|
665 |
$wpuf_files = [];
|
666 |
}
|
736 |
break;
|
737 |
|
738 |
case 'textarea':
|
739 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
740 |
+
$meta_key_value[$value['name']] = wp_kses( $value_name, $allowed_tags );
|
741 |
|
742 |
break;
|
743 |
|
includes/fields/class-field-html.php
CHANGED
@@ -26,7 +26,7 @@ class WPUF_Form_Field_HTML extends WPUF_Field_Contract {
|
|
26 |
<li <?php $this->print_list_attributes( $field_settings ); ?>>
|
27 |
|
28 |
<div class="wpuf-fields <?php echo 'html_' . esc_attr( $form_id ); ?><?php echo ' wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>">
|
29 |
-
<?php echo
|
30 |
</div>
|
31 |
|
32 |
</li>
|
26 |
<li <?php $this->print_list_attributes( $field_settings ); ?>>
|
27 |
|
28 |
<div class="wpuf-fields <?php echo 'html_' . esc_attr( $form_id ); ?><?php echo ' wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>">
|
29 |
+
<?php echo wp_kses_post( $field_settings['html'] ); ?>
|
30 |
</div>
|
31 |
|
32 |
</li>
|
includes/free/edit-profile.php
CHANGED
@@ -144,7 +144,6 @@ class WPUF_Edit_Profile {
|
|
144 |
}
|
145 |
$public_display = array_map( 'trim', $public_display );
|
146 |
$public_display = array_unique( $public_display );
|
147 |
-
|
148 |
foreach ( $public_display as $id => $item ) {
|
149 |
?>
|
150 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $item ); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo esc_html( $item ); ?></option>
|
@@ -157,16 +156,16 @@ class WPUF_Edit_Profile {
|
|
157 |
</fieldset>
|
158 |
|
159 |
<fieldset>
|
160 |
-
<legend><?php
|
161 |
|
162 |
<table class="wpuf-table">
|
163 |
<tr>
|
164 |
-
<th><label for="email"><?php
|
165 |
<td><input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" /> </td>
|
166 |
</tr>
|
167 |
|
168 |
<tr>
|
169 |
-
<th><label for="url"><?php
|
170 |
<td><input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text code" /></td>
|
171 |
</tr>
|
172 |
|
144 |
}
|
145 |
$public_display = array_map( 'trim', $public_display );
|
146 |
$public_display = array_unique( $public_display );
|
|
|
147 |
foreach ( $public_display as $id => $item ) {
|
148 |
?>
|
149 |
<option id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $item ); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo esc_html( $item ); ?></option>
|
156 |
</fieldset>
|
157 |
|
158 |
<fieldset>
|
159 |
+
<legend><?php esc_html_e( 'Contact Info', 'wp-user-frontend' ); ?></legend>
|
160 |
|
161 |
<table class="wpuf-table">
|
162 |
<tr>
|
163 |
+
<th><label for="email"><?php esc_html_e( 'E-mail', 'wp-user-frontend' ); ?> <span class="description"><?php esc_html_e( '(required)', 'wp-user-frontend' ); ?></span></label></th>
|
164 |
<td><input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" /> </td>
|
165 |
</tr>
|
166 |
|
167 |
<tr>
|
168 |
+
<th><label for="url"><?php esc_html_e( 'Website', 'wp-user-frontend' ); ?></label></th>
|
169 |
<td><input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text code" /></td>
|
170 |
</tr>
|
171 |
|
includes/free/edit-user.php
CHANGED
@@ -17,7 +17,11 @@ function wpuf_edit_users() {
|
|
17 |
case 'edit':
|
18 |
//if user exists
|
19 |
if ( $user_id && $userdata ) {
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
} else {
|
22 |
printf( esc_html( __( "User doesn't exists", 'wp-user-frontend' ) ) );
|
23 |
}
|
@@ -127,7 +131,6 @@ function wpuf_add_user() {
|
|
127 |
if ( isset( $nonce ) && ! wp_verify_nonce( $nonce, 'wpuf_add_user' ) ) {
|
128 |
return ;
|
129 |
}
|
130 |
-
}
|
131 |
|
132 |
$errors = [];
|
133 |
|
@@ -200,6 +203,7 @@ function wpuf_add_user() {
|
|
200 |
<?php } ?>
|
201 |
|
202 |
<?php
|
|
|
203 |
|
204 |
/**
|
205 |
* Handles registering a new user.
|
17 |
case 'edit':
|
18 |
//if user exists
|
19 |
if ( $user_id && $userdata ) {
|
20 |
+
if ( ! empty( wpuf()->free_loader->edit_profile ) ) {
|
21 |
+
wpuf()->free_loader->edit_profile->show_form( $user_id );
|
22 |
+
} else {
|
23 |
+
printf( esc_html( __( "User doesn't exists", 'wp-user-frontend' ) ) );
|
24 |
+
}
|
25 |
} else {
|
26 |
printf( esc_html( __( "User doesn't exists", 'wp-user-frontend' ) ) );
|
27 |
}
|
131 |
if ( isset( $nonce ) && ! wp_verify_nonce( $nonce, 'wpuf_add_user' ) ) {
|
132 |
return ;
|
133 |
}
|
|
|
134 |
|
135 |
$errors = [];
|
136 |
|
203 |
<?php } ?>
|
204 |
|
205 |
<?php
|
206 |
+
}
|
207 |
|
208 |
/**
|
209 |
* Handles registering a new user.
|
includes/free/loader.php
CHANGED
@@ -4,6 +4,8 @@ require_once __DIR__ . '/prompt.php';
|
|
4 |
|
5 |
class WPUF_Free_Loader extends WPUF_Pro_Prompt {
|
6 |
|
|
|
|
|
7 |
public function __construct() {
|
8 |
$this->includes();
|
9 |
$this->instantiate();
|
@@ -51,7 +53,7 @@ class WPUF_Free_Loader extends WPUF_Pro_Prompt {
|
|
51 |
}
|
52 |
|
53 |
public function instantiate() {
|
54 |
-
new WPUF_Edit_Profile();
|
55 |
|
56 |
if ( is_admin() ) {
|
57 |
|
4 |
|
5 |
class WPUF_Free_Loader extends WPUF_Pro_Prompt {
|
6 |
|
7 |
+
public $edit_profile = null;
|
8 |
+
|
9 |
public function __construct() {
|
10 |
$this->includes();
|
11 |
$this->instantiate();
|
53 |
}
|
54 |
|
55 |
public function instantiate() {
|
56 |
+
$this->edit_profile = new WPUF_Edit_Profile();
|
57 |
|
58 |
if ( is_admin() ) {
|
59 |
|
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: 2020-01-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -342,7 +342,7 @@ msgstr ""
|
|
342 |
|
343 |
#: admin/class-tools.php:44 admin/class-tools.php:111
|
344 |
#: admin/post-forms-list-table.php:43 class/transactions-list-table.php:87
|
345 |
-
#: includes/class-list-table-subscribers.php:136 wpuf-functions.php:
|
346 |
msgid "All"
|
347 |
msgstr ""
|
348 |
|
@@ -718,7 +718,7 @@ msgstr ""
|
|
718 |
|
719 |
#: admin/form.php:71 admin/form.php:109 admin/installer.php:86
|
720 |
#: admin/post-forms-list-table.php:406 class/subscription.php:402
|
721 |
-
#: includes/free/admin/shortcode-button.php:87 includes/free/edit-user.php:
|
722 |
#: templates/dashboard/posts.php:163 templates/dashboard.php:254
|
723 |
msgid "Edit"
|
724 |
msgstr ""
|
@@ -755,7 +755,7 @@ msgstr ""
|
|
755 |
msgid "Registraton Forms"
|
756 |
msgstr ""
|
757 |
|
758 |
-
#: admin/form.php:106 includes/free/loader.php:
|
759 |
msgid "Registration Forms"
|
760 |
msgstr ""
|
761 |
|
@@ -1071,7 +1071,7 @@ msgstr ""
|
|
1071 |
|
1072 |
#: admin/html/form-submission-restriction.php:12 admin/html/support.php:223
|
1073 |
#: class/transactions-list-table.php:50 includes/class-privacy.php:361
|
1074 |
-
#: includes/free/edit-user.php:
|
1075 |
msgid "Email"
|
1076 |
msgstr ""
|
1077 |
|
@@ -3583,7 +3583,7 @@ msgstr ""
|
|
3583 |
msgid "Author Info"
|
3584 |
msgstr ""
|
3585 |
|
3586 |
-
#: class/frontend-dashboard.php:136 includes/free/edit-user.php:
|
3587 |
msgid "%s"
|
3588 |
msgstr ""
|
3589 |
|
@@ -3781,12 +3781,12 @@ msgstr ""
|
|
3781 |
msgid "Please make sure you've published your form."
|
3782 |
msgstr ""
|
3783 |
|
3784 |
-
#: class/render-form.php:1319 includes/free/edit-profile.php:
|
3785 |
#: templates/registration-form.php:68
|
3786 |
msgid "Confirm Password"
|
3787 |
msgstr ""
|
3788 |
|
3789 |
-
#: class/render-form.php:1341 includes/free/edit-profile.php:
|
3790 |
#: templates/dashboard/edit-profile.php:70
|
3791 |
msgid "Strength indicator"
|
3792 |
msgstr ""
|
@@ -3801,7 +3801,7 @@ msgid "This field is no longer available."
|
|
3801 |
msgstr ""
|
3802 |
|
3803 |
#: class/render-form.php:1676 class/transactions-list-table.php:119
|
3804 |
-
#: class/transactions-list-table.php:193 includes/free/edit-user.php:
|
3805 |
#: templates/dashboard/posts.php:172 templates/dashboard.php:263
|
3806 |
msgid "Delete"
|
3807 |
msgstr ""
|
@@ -4213,15 +4213,15 @@ msgstr ""
|
|
4213 |
msgid "You can't edit a post while in pending mode."
|
4214 |
msgstr ""
|
4215 |
|
4216 |
-
#: includes/class-frontend-form-post.php:
|
4217 |
msgid "Something went wrong"
|
4218 |
msgstr ""
|
4219 |
|
4220 |
-
#: includes/class-frontend-form-post.php:
|
4221 |
msgid "Invalid email address."
|
4222 |
msgstr ""
|
4223 |
|
4224 |
-
#: includes/class-frontend-form-post.php:
|
4225 |
msgid ""
|
4226 |
"You already have an account in our site. Please login to continue.\n"
|
4227 |
"\n"
|
@@ -4230,22 +4230,22 @@ msgid ""
|
|
4230 |
"Click 'Cancel' to stay at this page."
|
4231 |
msgstr ""
|
4232 |
|
4233 |
-
#: includes/class-frontend-form-post.php:
|
4234 |
msgid "You do not have sufficient permissions to access this form."
|
4235 |
msgstr ""
|
4236 |
|
4237 |
-
#: includes/class-frontend-form-post.php:
|
4238 |
msgid "Email successfully verified. Please Login."
|
4239 |
msgstr ""
|
4240 |
|
4241 |
-
#: includes/class-frontend-form-post.php:
|
4242 |
-
#: includes/class-frontend-form-post.php:
|
4243 |
msgid ""
|
4244 |
"Thank you for posting on our site. We have sent you an confirmation email. "
|
4245 |
"Please check your inbox!"
|
4246 |
msgstr ""
|
4247 |
|
4248 |
-
#: includes/class-frontend-render-form.php:
|
4249 |
#: includes/free/class-login.php:445
|
4250 |
msgid "Empty reCaptcha Field"
|
4251 |
msgstr ""
|
@@ -4379,7 +4379,7 @@ msgid ""
|
|
4379 |
msgstr ""
|
4380 |
|
4381 |
#: includes/class-login-widget.php:274 includes/free/edit-profile.php:102
|
4382 |
-
#: includes/free/edit-user.php:
|
4383 |
#: templates/registration-form.php:54
|
4384 |
msgid "Username"
|
4385 |
msgstr ""
|
@@ -5100,7 +5100,7 @@ msgstr ""
|
|
5100 |
msgid "Select a form to insert"
|
5101 |
msgstr ""
|
5102 |
|
5103 |
-
#: includes/free/admin/shortcode-builder.php:9 includes/free/loader.php:
|
5104 |
msgid "Registration Form"
|
5105 |
msgstr ""
|
5106 |
|
@@ -5313,7 +5313,7 @@ msgstr ""
|
|
5313 |
msgid "Hi, %s"
|
5314 |
msgstr ""
|
5315 |
|
5316 |
-
#: includes/free/edit-profile.php:32 includes/free/edit-user.php:
|
5317 |
#: templates/unauthorized.php:4
|
5318 |
msgid "This page is restricted. Please %s to view this page."
|
5319 |
msgstr ""
|
@@ -5330,7 +5330,7 @@ msgstr ""
|
|
5330 |
msgid "Nickname"
|
5331 |
msgstr ""
|
5332 |
|
5333 |
-
#: includes/free/edit-profile.php:116
|
5334 |
msgid "(required)"
|
5335 |
msgstr ""
|
5336 |
|
@@ -5338,128 +5338,140 @@ msgstr ""
|
|
5338 |
msgid "Display to Public as"
|
5339 |
msgstr ""
|
5340 |
|
5341 |
-
#: includes/free/edit-profile.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5342 |
msgid "About Yourself"
|
5343 |
msgstr ""
|
5344 |
|
5345 |
-
#: includes/free/edit-profile.php:
|
5346 |
msgid "Biographical Info"
|
5347 |
msgstr ""
|
5348 |
|
5349 |
-
#: includes/free/edit-profile.php:
|
5350 |
msgid ""
|
5351 |
"Share a little biographical information to fill out your profile. This may "
|
5352 |
"be shown publicly."
|
5353 |
msgstr ""
|
5354 |
|
5355 |
-
#: includes/free/edit-profile.php:
|
5356 |
msgid "New Password"
|
5357 |
msgstr ""
|
5358 |
|
5359 |
-
#: includes/free/edit-profile.php:
|
5360 |
msgid "Type your new password again."
|
5361 |
msgstr ""
|
5362 |
|
5363 |
-
#: includes/free/edit-profile.php:
|
5364 |
msgid "Password Strength"
|
5365 |
msgstr ""
|
5366 |
|
5367 |
-
#: includes/free/edit-profile.php:
|
5368 |
#: templates/dashboard/edit-profile.php:130
|
5369 |
msgid "Update Profile"
|
5370 |
msgstr ""
|
5371 |
|
5372 |
-
#: includes/free/edit-profile.php:
|
5373 |
msgid "WPUF Post Lock"
|
5374 |
msgstr ""
|
5375 |
|
5376 |
-
#: includes/free/edit-profile.php:
|
5377 |
msgid "Lock Post:"
|
5378 |
msgstr ""
|
5379 |
|
5380 |
-
#: includes/free/edit-profile.php:
|
5381 |
msgid "Lock user from creating new post."
|
5382 |
msgstr ""
|
5383 |
|
5384 |
-
#: includes/free/edit-profile.php:
|
5385 |
msgid "Lock Reason:"
|
5386 |
msgstr ""
|
5387 |
|
5388 |
-
#: includes/free/edit-profile.php:
|
5389 |
msgid "Lock Edit Post:"
|
5390 |
msgstr ""
|
5391 |
|
5392 |
-
#: includes/free/edit-profile.php:
|
5393 |
msgid "Lock user from editing post."
|
5394 |
msgstr ""
|
5395 |
|
5396 |
-
#: includes/free/edit-profile.php:
|
5397 |
msgid "Edit Post Lock Reason:"
|
5398 |
msgstr ""
|
5399 |
|
5400 |
-
#: includes/free/edit-user.php:
|
5401 |
msgid "User doesn't exists"
|
5402 |
msgstr ""
|
5403 |
|
5404 |
-
#: includes/free/edit-user.php:
|
5405 |
msgid "You don't have permission for this purpose"
|
5406 |
msgstr ""
|
5407 |
|
5408 |
-
#: includes/free/edit-user.php:
|
5409 |
msgid "User Deleted"
|
5410 |
msgstr ""
|
5411 |
|
5412 |
-
#: includes/free/edit-user.php:
|
5413 |
msgid "Are you sure to delete this user?"
|
5414 |
msgstr ""
|
5415 |
|
5416 |
-
#: includes/free/edit-user.php:
|
5417 |
msgid "Action"
|
5418 |
msgstr ""
|
5419 |
|
5420 |
-
#: includes/free/edit-user.php:
|
5421 |
msgid "Add New User"
|
5422 |
msgstr ""
|
5423 |
|
5424 |
-
#: includes/free/edit-user.php:
|
5425 |
msgid "User Added"
|
5426 |
msgstr ""
|
5427 |
|
5428 |
-
#: includes/free/edit-user.php:
|
5429 |
msgid "Role"
|
5430 |
msgstr ""
|
5431 |
|
5432 |
-
#: includes/free/edit-user.php:
|
5433 |
msgid "<strong>ERROR</strong>: Please enter a username"
|
5434 |
msgstr ""
|
5435 |
|
5436 |
-
#: includes/free/edit-user.php:
|
5437 |
msgid ""
|
5438 |
"<strong>ERROR</strong>: This username is invalid because it uses illegal "
|
5439 |
"characters. Please enter a valid username"
|
5440 |
msgstr ""
|
5441 |
|
5442 |
-
#: includes/free/edit-user.php:
|
5443 |
msgid ""
|
5444 |
"<strong>ERROR</strong>: This username is already registered, please choose "
|
5445 |
"another one"
|
5446 |
msgstr ""
|
5447 |
|
5448 |
-
#: includes/free/edit-user.php:
|
5449 |
msgid "<strong>ERROR</strong>: Please type your e-mail address"
|
5450 |
msgstr ""
|
5451 |
|
5452 |
-
#: includes/free/edit-user.php:
|
5453 |
msgid "<strong>ERROR</strong>: The email address isn’t correct"
|
5454 |
msgstr ""
|
5455 |
|
5456 |
-
#: includes/free/edit-user.php:
|
5457 |
msgid ""
|
5458 |
"<strong>ERROR</strong>: This email is already registered, please choose "
|
5459 |
"another one"
|
5460 |
msgstr ""
|
5461 |
|
5462 |
-
#: includes/free/edit-user.php:
|
5463 |
msgid ""
|
5464 |
"<strong>ERROR</strong>: Couldn’t register you... please contact the "
|
5465 |
"<a href=\"mailto:%s\">webmaster</a> !"
|
@@ -5581,43 +5593,43 @@ msgstr ""
|
|
5581 |
msgid "Update Button text"
|
5582 |
msgstr ""
|
5583 |
|
5584 |
-
#: includes/free/loader.php:
|
5585 |
msgid "Coupons"
|
5586 |
msgstr ""
|
5587 |
|
5588 |
-
#: includes/free/loader.php:
|
5589 |
msgid ""
|
5590 |
"Use the shortcode <code>[wpuf-registration]</code> for a simple and default "
|
5591 |
"WordPress registration form."
|
5592 |
msgstr ""
|
5593 |
|
5594 |
-
#: includes/free/loader.php:
|
5595 |
msgid ""
|
5596 |
"Registration form builder is a two way form which can be used both for "
|
5597 |
"<strong>user registration</strong> and <strong>profile editing</strong>."
|
5598 |
msgstr ""
|
5599 |
|
5600 |
-
#: includes/free/loader.php:
|
5601 |
msgid "Upgrade to Pro Version"
|
5602 |
msgstr ""
|
5603 |
|
5604 |
-
#: includes/free/loader.php:
|
5605 |
msgid "Learn More"
|
5606 |
msgstr ""
|
5607 |
|
5608 |
-
#: includes/free/loader.php:
|
5609 |
msgid "Use Coupon codes for subscription for discounts."
|
5610 |
msgstr ""
|
5611 |
|
5612 |
-
#: includes/free/loader.php:
|
5613 |
msgid "This feature is only available in the Pro Version."
|
5614 |
msgstr ""
|
5615 |
|
5616 |
-
#: includes/free/loader.php:
|
5617 |
msgid "Learn more about Coupons"
|
5618 |
msgstr ""
|
5619 |
|
5620 |
-
#: includes/free/loader.php:
|
5621 |
msgid "Upgrade to Pro"
|
5622 |
msgstr ""
|
5623 |
|
@@ -6301,7 +6313,7 @@ msgstr ""
|
|
6301 |
msgid "Egyptian Pound"
|
6302 |
msgstr ""
|
6303 |
|
6304 |
-
#: wpuf-functions.php:
|
6305 |
msgid "None"
|
6306 |
msgstr ""
|
6307 |
|
2 |
# This file is distributed under the GPL2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP User Frontend 3.1.16\n"
|
6 |
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
|
7 |
+
"POT-Creation-Date: 2020-01-17 13:10:46+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
342 |
|
343 |
#: admin/class-tools.php:44 admin/class-tools.php:111
|
344 |
#: admin/post-forms-list-table.php:43 class/transactions-list-table.php:87
|
345 |
+
#: includes/class-list-table-subscribers.php:136 wpuf-functions.php:2826
|
346 |
msgid "All"
|
347 |
msgstr ""
|
348 |
|
718 |
|
719 |
#: admin/form.php:71 admin/form.php:109 admin/installer.php:86
|
720 |
#: admin/post-forms-list-table.php:406 class/subscription.php:402
|
721 |
+
#: includes/free/admin/shortcode-button.php:87 includes/free/edit-user.php:104
|
722 |
#: templates/dashboard/posts.php:163 templates/dashboard.php:254
|
723 |
msgid "Edit"
|
724 |
msgstr ""
|
755 |
msgid "Registraton Forms"
|
756 |
msgstr ""
|
757 |
|
758 |
+
#: admin/form.php:106 includes/free/loader.php:78
|
759 |
msgid "Registration Forms"
|
760 |
msgstr ""
|
761 |
|
1071 |
|
1072 |
#: admin/html/form-submission-restriction.php:12 admin/html/support.php:223
|
1073 |
#: class/transactions-list-table.php:50 includes/class-privacy.php:361
|
1074 |
+
#: includes/free/edit-user.php:168 templates/registration-form.php:47
|
1075 |
msgid "Email"
|
1076 |
msgstr ""
|
1077 |
|
3583 |
msgid "Author Info"
|
3584 |
msgstr ""
|
3585 |
|
3586 |
+
#: class/frontend-dashboard.php:136 includes/free/edit-user.php:102
|
3587 |
msgid "%s"
|
3588 |
msgstr ""
|
3589 |
|
3781 |
msgid "Please make sure you've published your form."
|
3782 |
msgstr ""
|
3783 |
|
3784 |
+
#: class/render-form.php:1319 includes/free/edit-profile.php:200
|
3785 |
#: templates/registration-form.php:68
|
3786 |
msgid "Confirm Password"
|
3787 |
msgstr ""
|
3788 |
|
3789 |
+
#: class/render-form.php:1341 includes/free/edit-profile.php:209
|
3790 |
#: templates/dashboard/edit-profile.php:70
|
3791 |
msgid "Strength indicator"
|
3792 |
msgstr ""
|
3801 |
msgstr ""
|
3802 |
|
3803 |
#: class/render-form.php:1676 class/transactions-list-table.php:119
|
3804 |
+
#: class/transactions-list-table.php:193 includes/free/edit-user.php:105
|
3805 |
#: templates/dashboard/posts.php:172 templates/dashboard.php:263
|
3806 |
msgid "Delete"
|
3807 |
msgstr ""
|
4213 |
msgid "You can't edit a post while in pending mode."
|
4214 |
msgstr ""
|
4215 |
|
4216 |
+
#: includes/class-frontend-form-post.php:493
|
4217 |
msgid "Something went wrong"
|
4218 |
msgstr ""
|
4219 |
|
4220 |
+
#: includes/class-frontend-form-post.php:514
|
4221 |
msgid "Invalid email address."
|
4222 |
msgstr ""
|
4223 |
|
4224 |
+
#: includes/class-frontend-form-post.php:524
|
4225 |
msgid ""
|
4226 |
"You already have an account in our site. Please login to continue.\n"
|
4227 |
"\n"
|
4230 |
"Click 'Cancel' to stay at this page."
|
4231 |
msgstr ""
|
4232 |
|
4233 |
+
#: includes/class-frontend-form-post.php:575
|
4234 |
msgid "You do not have sufficient permissions to access this form."
|
4235 |
msgstr ""
|
4236 |
|
4237 |
+
#: includes/class-frontend-form-post.php:841
|
4238 |
msgid "Email successfully verified. Please Login."
|
4239 |
msgstr ""
|
4240 |
|
4241 |
+
#: includes/class-frontend-form-post.php:948
|
4242 |
+
#: includes/class-frontend-form-post.php:954
|
4243 |
msgid ""
|
4244 |
"Thank you for posting on our site. We have sent you an confirmation email. "
|
4245 |
"Please check your inbox!"
|
4246 |
msgstr ""
|
4247 |
|
4248 |
+
#: includes/class-frontend-render-form.php:802
|
4249 |
#: includes/free/class-login.php:445
|
4250 |
msgid "Empty reCaptcha Field"
|
4251 |
msgstr ""
|
4379 |
msgstr ""
|
4380 |
|
4381 |
#: includes/class-login-widget.php:274 includes/free/edit-profile.php:102
|
4382 |
+
#: includes/free/edit-user.php:97 includes/free/edit-user.php:157
|
4383 |
#: templates/registration-form.php:54
|
4384 |
msgid "Username"
|
4385 |
msgstr ""
|
5100 |
msgid "Select a form to insert"
|
5101 |
msgstr ""
|
5102 |
|
5103 |
+
#: includes/free/admin/shortcode-builder.php:9 includes/free/loader.php:90
|
5104 |
msgid "Registration Form"
|
5105 |
msgstr ""
|
5106 |
|
5313 |
msgid "Hi, %s"
|
5314 |
msgstr ""
|
5315 |
|
5316 |
+
#: includes/free/edit-profile.php:32 includes/free/edit-user.php:40
|
5317 |
#: templates/unauthorized.php:4
|
5318 |
msgid "This page is restricted. Please %s to view this page."
|
5319 |
msgstr ""
|
5330 |
msgid "Nickname"
|
5331 |
msgstr ""
|
5332 |
|
5333 |
+
#: includes/free/edit-profile.php:116 includes/free/edit-profile.php:163
|
5334 |
msgid "(required)"
|
5335 |
msgstr ""
|
5336 |
|
5338 |
msgid "Display to Public as"
|
5339 |
msgstr ""
|
5340 |
|
5341 |
+
#: includes/free/edit-profile.php:159
|
5342 |
+
msgid "Contact Info"
|
5343 |
+
msgstr ""
|
5344 |
+
|
5345 |
+
#: includes/free/edit-profile.php:163
|
5346 |
+
msgid "E-mail"
|
5347 |
+
msgstr ""
|
5348 |
+
|
5349 |
+
#: includes/free/edit-profile.php:168
|
5350 |
+
msgid "Website"
|
5351 |
+
msgstr ""
|
5352 |
+
|
5353 |
+
#: includes/free/edit-profile.php:185
|
5354 |
msgid "About Yourself"
|
5355 |
msgstr ""
|
5356 |
|
5357 |
+
#: includes/free/edit-profile.php:189
|
5358 |
msgid "Biographical Info"
|
5359 |
msgstr ""
|
5360 |
|
5361 |
+
#: includes/free/edit-profile.php:191
|
5362 |
msgid ""
|
5363 |
"Share a little biographical information to fill out your profile. This may "
|
5364 |
"be shown publicly."
|
5365 |
msgstr ""
|
5366 |
|
5367 |
+
#: includes/free/edit-profile.php:194 templates/dashboard/edit-profile.php:54
|
5368 |
msgid "New Password"
|
5369 |
msgstr ""
|
5370 |
|
5371 |
+
#: includes/free/edit-profile.php:202
|
5372 |
msgid "Type your new password again."
|
5373 |
msgstr ""
|
5374 |
|
5375 |
+
#: includes/free/edit-profile.php:207
|
5376 |
msgid "Password Strength"
|
5377 |
msgstr ""
|
5378 |
|
5379 |
+
#: includes/free/edit-profile.php:233 includes/free/form-element.php:333
|
5380 |
#: templates/dashboard/edit-profile.php:130
|
5381 |
msgid "Update Profile"
|
5382 |
msgstr ""
|
5383 |
|
5384 |
+
#: includes/free/edit-profile.php:257
|
5385 |
msgid "WPUF Post Lock"
|
5386 |
msgstr ""
|
5387 |
|
5388 |
+
#: includes/free/edit-profile.php:260
|
5389 |
msgid "Lock Post:"
|
5390 |
msgstr ""
|
5391 |
|
5392 |
+
#: includes/free/edit-profile.php:266
|
5393 |
msgid "Lock user from creating new post."
|
5394 |
msgstr ""
|
5395 |
|
5396 |
+
#: includes/free/edit-profile.php:270
|
5397 |
msgid "Lock Reason:"
|
5398 |
msgstr ""
|
5399 |
|
5400 |
+
#: includes/free/edit-profile.php:277
|
5401 |
msgid "Lock Edit Post:"
|
5402 |
msgstr ""
|
5403 |
|
5404 |
+
#: includes/free/edit-profile.php:283
|
5405 |
msgid "Lock user from editing post."
|
5406 |
msgstr ""
|
5407 |
|
5408 |
+
#: includes/free/edit-profile.php:287
|
5409 |
msgid "Edit Post Lock Reason:"
|
5410 |
msgstr ""
|
5411 |
|
5412 |
+
#: includes/free/edit-user.php:23 includes/free/edit-user.php:26
|
5413 |
msgid "User doesn't exists"
|
5414 |
msgstr ""
|
5415 |
|
5416 |
+
#: includes/free/edit-user.php:37
|
5417 |
msgid "You don't have permission for this purpose"
|
5418 |
msgstr ""
|
5419 |
|
5420 |
+
#: includes/free/edit-user.php:81
|
5421 |
msgid "User Deleted"
|
5422 |
msgstr ""
|
5423 |
|
5424 |
+
#: includes/free/edit-user.php:90
|
5425 |
msgid "Are you sure to delete this user?"
|
5426 |
msgstr ""
|
5427 |
|
5428 |
+
#: includes/free/edit-user.php:98
|
5429 |
msgid "Action"
|
5430 |
msgstr ""
|
5431 |
|
5432 |
+
#: includes/free/edit-user.php:123 includes/free/edit-user.php:196
|
5433 |
msgid "Add New User"
|
5434 |
msgstr ""
|
5435 |
|
5436 |
+
#: includes/free/edit-user.php:145
|
5437 |
msgid "User Added"
|
5438 |
msgstr ""
|
5439 |
|
5440 |
+
#: includes/free/edit-user.php:179
|
5441 |
msgid "Role"
|
5442 |
msgstr ""
|
5443 |
|
5444 |
+
#: includes/free/edit-user.php:224
|
5445 |
msgid "<strong>ERROR</strong>: Please enter a username"
|
5446 |
msgstr ""
|
5447 |
|
5448 |
+
#: includes/free/edit-user.php:226
|
5449 |
msgid ""
|
5450 |
"<strong>ERROR</strong>: This username is invalid because it uses illegal "
|
5451 |
"characters. Please enter a valid username"
|
5452 |
msgstr ""
|
5453 |
|
5454 |
+
#: includes/free/edit-user.php:229
|
5455 |
msgid ""
|
5456 |
"<strong>ERROR</strong>: This username is already registered, please choose "
|
5457 |
"another one"
|
5458 |
msgstr ""
|
5459 |
|
5460 |
+
#: includes/free/edit-user.php:234
|
5461 |
msgid "<strong>ERROR</strong>: Please type your e-mail address"
|
5462 |
msgstr ""
|
5463 |
|
5464 |
+
#: includes/free/edit-user.php:236
|
5465 |
msgid "<strong>ERROR</strong>: The email address isn’t correct"
|
5466 |
msgstr ""
|
5467 |
|
5468 |
+
#: includes/free/edit-user.php:239
|
5469 |
msgid ""
|
5470 |
"<strong>ERROR</strong>: This email is already registered, please choose "
|
5471 |
"another one"
|
5472 |
msgstr ""
|
5473 |
|
5474 |
+
#: includes/free/edit-user.php:263
|
5475 |
msgid ""
|
5476 |
"<strong>ERROR</strong>: Couldn’t register you... please contact the "
|
5477 |
"<a href=\"mailto:%s\">webmaster</a> !"
|
5593 |
msgid "Update Button text"
|
5594 |
msgstr ""
|
5595 |
|
5596 |
+
#: includes/free/loader.php:84 includes/free/loader.php:144
|
5597 |
msgid "Coupons"
|
5598 |
msgstr ""
|
5599 |
|
5600 |
+
#: includes/free/loader.php:93
|
5601 |
msgid ""
|
5602 |
"Use the shortcode <code>[wpuf-registration]</code> for a simple and default "
|
5603 |
"WordPress registration form."
|
5604 |
msgstr ""
|
5605 |
|
5606 |
+
#: includes/free/loader.php:107
|
5607 |
msgid ""
|
5608 |
"Registration form builder is a two way form which can be used both for "
|
5609 |
"<strong>user registration</strong> and <strong>profile editing</strong>."
|
5610 |
msgstr ""
|
5611 |
|
5612 |
+
#: includes/free/loader.php:126 includes/free/loader.php:156
|
5613 |
msgid "Upgrade to Pro Version"
|
5614 |
msgstr ""
|
5615 |
|
5616 |
+
#: includes/free/loader.php:127
|
5617 |
msgid "Learn More"
|
5618 |
msgstr ""
|
5619 |
|
5620 |
+
#: includes/free/loader.php:148
|
5621 |
msgid "Use Coupon codes for subscription for discounts."
|
5622 |
msgstr ""
|
5623 |
|
5624 |
+
#: includes/free/loader.php:152
|
5625 |
msgid "This feature is only available in the Pro Version."
|
5626 |
msgstr ""
|
5627 |
|
5628 |
+
#: includes/free/loader.php:157
|
5629 |
msgid "Learn more about Coupons"
|
5630 |
msgstr ""
|
5631 |
|
5632 |
+
#: includes/free/loader.php:198
|
5633 |
msgid "Upgrade to Pro"
|
5634 |
msgstr ""
|
5635 |
|
6313 |
msgid "Egyptian Pound"
|
6314 |
msgstr ""
|
6315 |
|
6316 |
+
#: wpuf-functions.php:2827
|
6317 |
msgid "None"
|
6318 |
msgstr ""
|
6319 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Forms, registration, profile-builder, login, membership
|
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.1.
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -264,6 +264,13 @@ redirected to the edit page with that post id. Then you'll see the edit post for
|
|
264 |
|
265 |
== Changelog ==
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
= v3.1.15 (14 January, 2020) =
|
268 |
* **Fix:** update url validation
|
269 |
* **Tweak:** Added privacy policy info in setup wizard for admin
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.1.16
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
264 |
|
265 |
== Changelog ==
|
266 |
|
267 |
+
= v3.1.16 (17 January, 2020) =
|
268 |
+
* **Fix:** Photo insert option in content editor
|
269 |
+
* **Fix:** Subscription page is not showing the content/package description as formatted content
|
270 |
+
* **Fix:** Predefined form is not saving on the WPUF form page's backend area
|
271 |
+
* **Fix:** WPUF Custom HTML field is not saving the data
|
272 |
+
* **Improve:** Improve Code Quality
|
273 |
+
|
274 |
= v3.1.15 (14 January, 2020) =
|
275 |
* **Fix:** update url validation
|
276 |
* **Tweak:** Added privacy policy info in setup wizard for admin
|
templates/subscriptions/pack-details.php
CHANGED
@@ -38,7 +38,7 @@
|
|
38 |
?>
|
39 |
</div>
|
40 |
<div class="wpuf-sub-desciption">
|
41 |
-
<?php echo
|
42 |
</div>
|
43 |
<?php
|
44 |
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
38 |
?>
|
39 |
</div>
|
40 |
<div class="wpuf-sub-desciption">
|
41 |
+
<?php echo wp_kses_post( wpautop( $pack->post_content ) ); ?>
|
42 |
</div>
|
43 |
<?php
|
44 |
$action = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
|
vendor/appsero/client/.gitignore
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
/node_modules
|
2 |
-
/public/hot
|
3 |
-
/public/storage
|
4 |
-
/storage/*.key
|
5 |
-
/vendor
|
6 |
-
/.idea
|
7 |
-
/.vscode
|
8 |
-
/nbproject
|
9 |
-
/.vagrant
|
10 |
-
Homestead.json
|
11 |
-
Homestead.yaml
|
12 |
-
npm-debug.log
|
13 |
-
yarn-error.log
|
14 |
-
.env
|
15 |
-
.phpunit.result.cache
|
16 |
-
.DS_Store
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/composer.json
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "appsero/client",
|
3 |
-
"description": "Appsero Client",
|
4 |
-
"keywords": ["analytics", "wordpress", "plugin", "theme"],
|
5 |
-
"type": "library",
|
6 |
-
"license": "MIT",
|
7 |
-
"authors": [
|
8 |
-
{
|
9 |
-
"name": "Tareq Hasan",
|
10 |
-
"email": "tareq@appsero.com"
|
11 |
-
}
|
12 |
-
],
|
13 |
-
"autoload": {
|
14 |
-
"psr-4": {
|
15 |
-
"Appsero\\": "src/"
|
16 |
-
}
|
17 |
-
},
|
18 |
-
"require": {
|
19 |
-
"php": ">=5.3"
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/readme.md
DELETED
@@ -1,206 +0,0 @@
|
|
1 |
-
# Appsero - Client
|
2 |
-
|
3 |
-
- [Installation](#installation)
|
4 |
-
- [Insights](#insights)
|
5 |
-
- [Dynamic Usage](#dynamic-usage)
|
6 |
-
|
7 |
-
|
8 |
-
## Installation
|
9 |
-
|
10 |
-
You can install AppSero Client in two ways, via composer and manually.
|
11 |
-
|
12 |
-
### 1. Composer Installation
|
13 |
-
|
14 |
-
Add dependency in your project (theme/plugin):
|
15 |
-
|
16 |
-
```
|
17 |
-
composer require appsero/client
|
18 |
-
```
|
19 |
-
|
20 |
-
Now add `autoload.php` in your file if you haven't done already.
|
21 |
-
|
22 |
-
```php
|
23 |
-
require __DIR__ . '/vendor/autoload.php';
|
24 |
-
```
|
25 |
-
|
26 |
-
### 2. Manual Installation
|
27 |
-
|
28 |
-
Clone the repository in your project.
|
29 |
-
|
30 |
-
```
|
31 |
-
cd /path/to/your/project/folder
|
32 |
-
git clone https://github.com/AppSero/client.git appsero
|
33 |
-
```
|
34 |
-
|
35 |
-
Now include the dependencies in your plugin/theme.
|
36 |
-
|
37 |
-
```php
|
38 |
-
require __DIR__ . '/appsero/src/Client.php';
|
39 |
-
```
|
40 |
-
|
41 |
-
## Insights
|
42 |
-
|
43 |
-
AppSero can be used in both themes and plugins.
|
44 |
-
|
45 |
-
The `Appsero\Client` class has *three* parameters:
|
46 |
-
|
47 |
-
```php
|
48 |
-
$client = new Appsero\Client( $hash, $name, $file );
|
49 |
-
```
|
50 |
-
|
51 |
-
- **hash** (*string*, *required*) - The unique identifier for a plugin or theme.
|
52 |
-
- **name** (*string*, *required*) - The name of the plugin or theme.
|
53 |
-
- **file** (*string*, *required*) - The **main file** path of the plugin. For theme, path to `functions.php`
|
54 |
-
|
55 |
-
### Usage Example
|
56 |
-
|
57 |
-
Please refer to the **installation** step before start using the class.
|
58 |
-
|
59 |
-
You can obtain the **hash** for your plugin for the [Appsero Dashboard](https://dashboard.appsero.com). The 3rd parameter **must** have to be the main file of the plugin.
|
60 |
-
|
61 |
-
```php
|
62 |
-
/**
|
63 |
-
* Initialize the tracker
|
64 |
-
*
|
65 |
-
* @return void
|
66 |
-
*/
|
67 |
-
function appsero_init_tracker_appsero_test() {
|
68 |
-
|
69 |
-
if ( ! class_exists( 'Appsero\Client' ) ) {
|
70 |
-
require_once __DIR__ . '/appsero/src/Client.php';
|
71 |
-
}
|
72 |
-
|
73 |
-
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044891', 'Akismet', __FILE__ );
|
74 |
-
|
75 |
-
// Active insights
|
76 |
-
$client->insights()->init();
|
77 |
-
|
78 |
-
// Active automatic updater
|
79 |
-
$client->updater();
|
80 |
-
|
81 |
-
// Active license page and checker
|
82 |
-
$args = array(
|
83 |
-
'type' => 'options',
|
84 |
-
'menu_title' => 'Akismet',
|
85 |
-
'page_title' => 'Akismet License Settings',
|
86 |
-
'menu_slug' => 'akismet_settings',
|
87 |
-
);
|
88 |
-
$client->license()->add_settings_page( $args );
|
89 |
-
}
|
90 |
-
|
91 |
-
appsero_init_tracker_appsero_test();
|
92 |
-
```
|
93 |
-
|
94 |
-
Make sure you call this function directly, never use any action hook to call this function.
|
95 |
-
|
96 |
-
> For plugins example code that needs to be used on your main plugin file.
|
97 |
-
> For themes example code that needs to be used on your themes `functions.php` file.
|
98 |
-
|
99 |
-
## More Usage
|
100 |
-
|
101 |
-
Sometimes you wouldn't want to show the notice, or want to customize the notice message. You can do that as well.
|
102 |
-
|
103 |
-
```php
|
104 |
-
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );
|
105 |
-
```
|
106 |
-
|
107 |
-
#### 1. Hiding the notice
|
108 |
-
|
109 |
-
```php
|
110 |
-
$client->insights()
|
111 |
-
->hide_notice()
|
112 |
-
->init();
|
113 |
-
```
|
114 |
-
|
115 |
-
#### 2. Customizing the notice message
|
116 |
-
|
117 |
-
```php
|
118 |
-
$client->insights()
|
119 |
-
->notice( 'My Custom Notice Message' )
|
120 |
-
->init();
|
121 |
-
```
|
122 |
-
|
123 |
-
#### 3. Adding extra data
|
124 |
-
|
125 |
-
You can add extra metadata from your theme or plugin. In that case, the **keys** has to be whitelisted from the Appsero dashboard.
|
126 |
-
`add_extra` method also support callback as parameter, If you need database call then callback is best for you.
|
127 |
-
|
128 |
-
```php
|
129 |
-
$metadata = array(
|
130 |
-
'key' => 'value',
|
131 |
-
'another' => 'another_value'
|
132 |
-
);
|
133 |
-
$client->insights()
|
134 |
-
->add_extra( $metadata )
|
135 |
-
->init();
|
136 |
-
```
|
137 |
-
|
138 |
-
or
|
139 |
-
|
140 |
-
```php
|
141 |
-
$metadata = function () {
|
142 |
-
return array(
|
143 |
-
'key' => 'value',
|
144 |
-
'another' => 'another_value'
|
145 |
-
);
|
146 |
-
};
|
147 |
-
$client->insights()
|
148 |
-
->add_extra( $metadata )
|
149 |
-
->init();
|
150 |
-
```
|
151 |
-
|
152 |
-
---
|
153 |
-
|
154 |
-
### Check License Validity
|
155 |
-
|
156 |
-
Check your plugin/theme is using with valid license or not, First create a global variable of `License` object then use it anywhere in your code.
|
157 |
-
If you are using it outside of same function make sure you global the variable before using the condition.
|
158 |
-
|
159 |
-
```php
|
160 |
-
$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );
|
161 |
-
|
162 |
-
$args = array(
|
163 |
-
'type' => 'submenu',
|
164 |
-
'menu_title' => 'Twenty Twelve License',
|
165 |
-
'page_title' => 'Twenty Twelve License Settings',
|
166 |
-
'menu_slug' => 'twenty_twelve_settings',
|
167 |
-
'parent_slug' => 'themes.php',
|
168 |
-
);
|
169 |
-
|
170 |
-
global $twenty_twelve_license;
|
171 |
-
$twenty_twelve_license = $client->license();
|
172 |
-
$twenty_twelve_license->add_settings_page( $args );
|
173 |
-
|
174 |
-
if ( $twenty_twelve_license->is_valid() ) {
|
175 |
-
// Your special code here
|
176 |
-
}
|
177 |
-
|
178 |
-
Or check by pricing plan title
|
179 |
-
|
180 |
-
if ( $twenty_twelve_license->is_valid_by( 'title', 'Business' ) ) {
|
181 |
-
// Your special code here
|
182 |
-
}
|
183 |
-
```
|
184 |
-
|
185 |
-
### Use your own license form
|
186 |
-
|
187 |
-
You can easily manage license by creating a form using HTTP request. Call `license_form_submit` method from License object.
|
188 |
-
|
189 |
-
```php
|
190 |
-
global $twenty_twelve_license; // License object
|
191 |
-
$twenty_twelve_license->license_form_submit([
|
192 |
-
'_nonce' => wp_create_nonce( 'Twenty Twelve' ), // create a nonce with name
|
193 |
-
'_action' => 'active', // active, deactive
|
194 |
-
'license_key' => 'random-license-key', // no need to provide if you want to deactive
|
195 |
-
]);
|
196 |
-
if ( ! $twenty_twelve_license->error ) {
|
197 |
-
// license activated
|
198 |
-
$twenty_twelve_license->success; // Success message is here
|
199 |
-
} else {
|
200 |
-
$twenty_twelve_license->error; // has error message here
|
201 |
-
}
|
202 |
-
```
|
203 |
-
|
204 |
-
## Credits
|
205 |
-
|
206 |
-
Created and maintained by [Appsero](https://appsero.com).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/src/Client.php
DELETED
@@ -1,210 +0,0 @@
|
|
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.1.9';
|
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 |
-
* textdomain
|
72 |
-
*
|
73 |
-
* @var string
|
74 |
-
*/
|
75 |
-
public $textdomain;
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Initialize the class
|
79 |
-
*
|
80 |
-
* @param string $hash hash of the plugin
|
81 |
-
* @param string $name readable name of the plugin
|
82 |
-
* @param string $file main plugin file path
|
83 |
-
*/
|
84 |
-
public function __construct( $hash, $name, $file ) {
|
85 |
-
$this->hash = $hash;
|
86 |
-
$this->name = $name;
|
87 |
-
$this->file = $file;
|
88 |
-
|
89 |
-
$this->set_basename_and_slug();
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Initialize insights class
|
94 |
-
*
|
95 |
-
* @return Appsero\Insights
|
96 |
-
*/
|
97 |
-
public function insights() {
|
98 |
-
|
99 |
-
if ( ! class_exists( __NAMESPACE__ . '\Insights') ) {
|
100 |
-
require_once __DIR__ . '/Insights.php';
|
101 |
-
}
|
102 |
-
|
103 |
-
return new Insights( $this );
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Initialize plugin/theme updater
|
108 |
-
*
|
109 |
-
* @return Appsero\Updater
|
110 |
-
*/
|
111 |
-
public function updater() {
|
112 |
-
|
113 |
-
if ( ! class_exists( __NAMESPACE__ . '\Updater') ) {
|
114 |
-
require_once __DIR__ . '/Updater.php';
|
115 |
-
}
|
116 |
-
|
117 |
-
return new Updater( $this );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Initialize license checker
|
122 |
-
*
|
123 |
-
* @return Appsero\License
|
124 |
-
*/
|
125 |
-
public function license() {
|
126 |
-
|
127 |
-
if ( ! class_exists( __NAMESPACE__ . '\License') ) {
|
128 |
-
require_once __DIR__ . '/License.php';
|
129 |
-
}
|
130 |
-
|
131 |
-
return new License( $this );
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* API Endpoint
|
136 |
-
*
|
137 |
-
* @return string
|
138 |
-
*/
|
139 |
-
public function endpoint() {
|
140 |
-
$endpoint = apply_filters( 'appsero_endpoint', 'https://api.appsero.com' );
|
141 |
-
|
142 |
-
return trailingslashit( $endpoint );
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Set project basename, slug and version
|
147 |
-
*
|
148 |
-
* @return void
|
149 |
-
*/
|
150 |
-
protected function set_basename_and_slug() {
|
151 |
-
|
152 |
-
if ( strpos( $this->file, WP_CONTENT_DIR . '/themes/' ) === false ) {
|
153 |
-
|
154 |
-
$this->basename = plugin_basename( $this->file );
|
155 |
-
|
156 |
-
list( $this->slug, $mainfile) = explode( '/', $this->basename );
|
157 |
-
|
158 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
159 |
-
|
160 |
-
$plugin_data = get_plugin_data( $this->file );
|
161 |
-
|
162 |
-
$this->project_version = $plugin_data['Version'];
|
163 |
-
$this->type = 'plugin';
|
164 |
-
$this->textdomain = $this->slug;
|
165 |
-
|
166 |
-
} else {
|
167 |
-
|
168 |
-
$this->basename = str_replace( WP_CONTENT_DIR . '/themes/', '', $this->file );
|
169 |
-
|
170 |
-
list( $this->slug, $mainfile) = explode( '/', $this->basename );
|
171 |
-
|
172 |
-
$theme = wp_get_theme( $this->slug );
|
173 |
-
|
174 |
-
$this->project_version = $theme->version;
|
175 |
-
$this->type = 'theme';
|
176 |
-
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Send request to remote endpoint
|
182 |
-
*
|
183 |
-
* @param array $params
|
184 |
-
* @param string $route
|
185 |
-
*
|
186 |
-
* @return array|WP_Error Array of results including HTTP headers or WP_Error if the request failed.
|
187 |
-
*/
|
188 |
-
public function send_request( $params, $route, $blocking = false ) {
|
189 |
-
$url = $this->endpoint() . $route;
|
190 |
-
|
191 |
-
$headers = array(
|
192 |
-
'user-agent' => 'Appsero/' . md5( esc_url( home_url() ) ) . ';',
|
193 |
-
'Accept' => 'application/json',
|
194 |
-
);
|
195 |
-
|
196 |
-
$response = wp_remote_post( $url, array(
|
197 |
-
'method' => 'POST',
|
198 |
-
'timeout' => 30,
|
199 |
-
'redirection' => 5,
|
200 |
-
'httpversion' => '1.0',
|
201 |
-
'blocking' => $blocking,
|
202 |
-
'headers' => $headers,
|
203 |
-
'body' => array_merge( $params, array( 'client' => $this->version ) ),
|
204 |
-
'cookies' => array()
|
205 |
-
) );
|
206 |
-
|
207 |
-
return $response;
|
208 |
-
}
|
209 |
-
|
210 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/src/Insights.php
DELETED
@@ -1,962 +0,0 @@
|
|
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, $name = null, $file = null ) {
|
47 |
-
|
48 |
-
if ( is_string( $client ) && ! empty( $name ) && ! empty( $file ) ) {
|
49 |
-
$client = new Client( $client, $name, $file );
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( is_object( $client ) && is_a( $client, 'Appsero\Client' ) ) {
|
53 |
-
$this->client = $client;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Don't show the notice
|
59 |
-
*
|
60 |
-
* @return \self
|
61 |
-
*/
|
62 |
-
public function hide_notice() {
|
63 |
-
$this->show_notice = false;
|
64 |
-
|
65 |
-
return $this;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Add extra data if needed
|
70 |
-
*
|
71 |
-
* @param array $data
|
72 |
-
*
|
73 |
-
* @return \self
|
74 |
-
*/
|
75 |
-
public function add_extra( $data = array() ) {
|
76 |
-
$this->extra_data = $data;
|
77 |
-
|
78 |
-
return $this;
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Set custom notice text
|
83 |
-
*
|
84 |
-
* @param string $text
|
85 |
-
*
|
86 |
-
* @return \self
|
87 |
-
*/
|
88 |
-
public function notice( $text ) {
|
89 |
-
$this->notice = $text;
|
90 |
-
|
91 |
-
return $this;
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Initialize insights
|
96 |
-
*
|
97 |
-
* @return void
|
98 |
-
*/
|
99 |
-
public function init() {
|
100 |
-
if ( $this->client->type == 'plugin' ) {
|
101 |
-
$this->init_plugin();
|
102 |
-
} else if ( $this->client->type == 'theme' ) {
|
103 |
-
$this->init_theme();
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Initialize theme hooks
|
109 |
-
*
|
110 |
-
* @return void
|
111 |
-
*/
|
112 |
-
public function init_theme() {
|
113 |
-
$this->init_common();
|
114 |
-
|
115 |
-
add_action( 'switch_theme', array( $this, 'deactivation_cleanup' ) );
|
116 |
-
add_action( 'switch_theme', array( $this, 'theme_deactivated' ), 12, 3 );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Initialize plugin hooks
|
121 |
-
*
|
122 |
-
* @return void
|
123 |
-
*/
|
124 |
-
public function init_plugin() {
|
125 |
-
// plugin deactivate popup
|
126 |
-
if ( ! $this->is_local_server() ) {
|
127 |
-
add_filter( 'plugin_action_links_' . $this->client->basename, array( $this, 'plugin_action_links' ) );
|
128 |
-
add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) );
|
129 |
-
}
|
130 |
-
|
131 |
-
$this->init_common();
|
132 |
-
|
133 |
-
register_activation_hook( $this->client->file, array( $this, 'activate_plugin' ) );
|
134 |
-
register_deactivation_hook( $this->client->file, array( $this, 'deactivation_cleanup' ) );
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Initialize common hooks
|
139 |
-
*
|
140 |
-
* @return void
|
141 |
-
*/
|
142 |
-
protected function init_common() {
|
143 |
-
|
144 |
-
if ( $this->show_notice ) {
|
145 |
-
// tracking notice
|
146 |
-
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
147 |
-
}
|
148 |
-
|
149 |
-
add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
|
150 |
-
|
151 |
-
// uninstall reason
|
152 |
-
add_action( 'wp_ajax_' . $this->client->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) );
|
153 |
-
|
154 |
-
// cron events
|
155 |
-
add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
|
156 |
-
add_action( $this->client->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) );
|
157 |
-
// add_action( 'admin_init', array( $this, 'send_tracking_data' ) ); // test
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Send tracking data to AppSero server
|
162 |
-
*
|
163 |
-
* @param boolean $override
|
164 |
-
*
|
165 |
-
* @return void
|
166 |
-
*/
|
167 |
-
public function send_tracking_data( $override = false ) {
|
168 |
-
// skip on AJAX Requests
|
169 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
170 |
-
return;
|
171 |
-
}
|
172 |
-
|
173 |
-
if ( ! $this->tracking_allowed() && ! $override ) {
|
174 |
-
return;
|
175 |
-
}
|
176 |
-
|
177 |
-
// Send a maximum of once per week
|
178 |
-
$last_send = $this->get_last_send();
|
179 |
-
|
180 |
-
if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
|
181 |
-
return;
|
182 |
-
}
|
183 |
-
|
184 |
-
$response = $this->client->send_request( $this->get_tracking_data(), 'track' );
|
185 |
-
|
186 |
-
update_option( $this->client->slug . '_tracking_last_send', time() );
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Get the tracking data points
|
191 |
-
*
|
192 |
-
* @return array
|
193 |
-
*/
|
194 |
-
protected function get_tracking_data() {
|
195 |
-
$all_plugins = $this->get_all_plugins();
|
196 |
-
|
197 |
-
$users = get_users( array(
|
198 |
-
'role' => 'administrator',
|
199 |
-
'orderby' => 'ID',
|
200 |
-
'order' => 'ASC',
|
201 |
-
'number' => 1,
|
202 |
-
'paged' => 1,
|
203 |
-
) );
|
204 |
-
|
205 |
-
$admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0] : false;
|
206 |
-
$first_name = $last_name = '';
|
207 |
-
|
208 |
-
if ( $admin_user ) {
|
209 |
-
$first_name = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name;
|
210 |
-
$last_name = $admin_user->last_name;
|
211 |
-
}
|
212 |
-
|
213 |
-
$data = array(
|
214 |
-
'version' => $this->client->project_version,
|
215 |
-
'url' => esc_url( home_url() ),
|
216 |
-
'site' => $this->get_site_name(),
|
217 |
-
'admin_email' => get_option( 'admin_email' ),
|
218 |
-
'first_name' => $first_name,
|
219 |
-
'last_name' => $last_name,
|
220 |
-
'hash' => $this->client->hash,
|
221 |
-
'server' => $this->get_server_info(),
|
222 |
-
'wp' => $this->get_wp_info(),
|
223 |
-
'users' => $this->get_user_counts(),
|
224 |
-
'active_plugins' => count( $all_plugins['active_plugins'] ),
|
225 |
-
'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
|
226 |
-
'ip_address' => $this->get_user_ip_address(),
|
227 |
-
'theme' => get_stylesheet(),
|
228 |
-
'version' => $this->client->project_version,
|
229 |
-
);
|
230 |
-
|
231 |
-
// Add metadata
|
232 |
-
if ( $extra = $this->get_extra_data() ) {
|
233 |
-
$data['extra'] = $extra;
|
234 |
-
}
|
235 |
-
|
236 |
-
return apply_filters( $this->client->slug . '_tracker_data', $data );
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* If a child class wants to send extra data
|
241 |
-
*
|
242 |
-
* @return mixed
|
243 |
-
*/
|
244 |
-
protected function get_extra_data() {
|
245 |
-
if ( is_callable( $this->extra_data ) ) {
|
246 |
-
return call_user_func( $this->extra_data );
|
247 |
-
}
|
248 |
-
|
249 |
-
if ( is_array( $this->extra_data ) ) {
|
250 |
-
return $this->extra_data;
|
251 |
-
}
|
252 |
-
|
253 |
-
return array();
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Explain the user which data we collect
|
258 |
-
*
|
259 |
-
* @return string
|
260 |
-
*/
|
261 |
-
protected function data_we_collect() {
|
262 |
-
$data = array(
|
263 |
-
'Server environment details (php, mysql, server, WordPress versions)',
|
264 |
-
'Number of users in your site',
|
265 |
-
'Site language',
|
266 |
-
'Number of active and inactive plugins',
|
267 |
-
'Site name and url',
|
268 |
-
'Your name and email address',
|
269 |
-
);
|
270 |
-
|
271 |
-
return $data;
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Check if the user has opted into tracking
|
276 |
-
*
|
277 |
-
* @return bool
|
278 |
-
*/
|
279 |
-
public function tracking_allowed() {
|
280 |
-
$allow_tracking = get_option( $this->client->slug . '_allow_tracking', 'no' );
|
281 |
-
|
282 |
-
return $allow_tracking == 'yes';
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Get the last time a tracking was sent
|
287 |
-
*
|
288 |
-
* @return false|string
|
289 |
-
*/
|
290 |
-
private function get_last_send() {
|
291 |
-
return get_option( $this->client->slug . '_tracking_last_send', false );
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* Check if the notice has been dismissed or enabled
|
296 |
-
*
|
297 |
-
* @return boolean
|
298 |
-
*/
|
299 |
-
private function notice_dismissed() {
|
300 |
-
$hide_notice = get_option( $this->client->slug . '_tracking_notice', null );
|
301 |
-
|
302 |
-
if ( 'hide' == $hide_notice ) {
|
303 |
-
return true;
|
304 |
-
}
|
305 |
-
|
306 |
-
return false;
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Check if the current server is localhost
|
311 |
-
*
|
312 |
-
* @return boolean
|
313 |
-
*/
|
314 |
-
private function is_local_server() {
|
315 |
-
return false;
|
316 |
-
|
317 |
-
$is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) );
|
318 |
-
|
319 |
-
return apply_filters( 'appsero_is_local', $is_local );
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Schedule the event weekly
|
324 |
-
*
|
325 |
-
* @return void
|
326 |
-
*/
|
327 |
-
private function schedule_event() {
|
328 |
-
$hook_name = $this->client->slug . '_tracker_send_event';
|
329 |
-
|
330 |
-
if ( ! wp_next_scheduled( $hook_name ) ) {
|
331 |
-
wp_schedule_event( time(), 'weekly', $hook_name );
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Clear any scheduled hook
|
337 |
-
*
|
338 |
-
* @return void
|
339 |
-
*/
|
340 |
-
private function clear_schedule_event() {
|
341 |
-
wp_clear_scheduled_hook( $this->client->slug . '_tracker_send_event' );
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Display the admin notice to users that have not opted-in or out
|
346 |
-
*
|
347 |
-
* @return void
|
348 |
-
*/
|
349 |
-
public function admin_notice() {
|
350 |
-
|
351 |
-
if ( $this->notice_dismissed() ) {
|
352 |
-
return;
|
353 |
-
}
|
354 |
-
|
355 |
-
if ( $this->tracking_allowed() ) {
|
356 |
-
return;
|
357 |
-
}
|
358 |
-
|
359 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
360 |
-
return;
|
361 |
-
}
|
362 |
-
|
363 |
-
// don't show tracking if a local server
|
364 |
-
if ( ! $this->is_local_server() ) {
|
365 |
-
$optin_url = add_query_arg( $this->client->slug . '_tracker_optin', 'true' );
|
366 |
-
$optout_url = add_query_arg( $this->client->slug . '_tracker_optout', 'true' );
|
367 |
-
|
368 |
-
if ( empty( $this->notice ) ) {
|
369 |
-
$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.', $this->client->textdomain ), $this->client->name );
|
370 |
-
} else {
|
371 |
-
$notice = $this->notice;
|
372 |
-
}
|
373 |
-
|
374 |
-
$notice .= ' (<a class="' . $this->client->slug . '-insights-data-we-collect" href="#">' . __( 'what we collect', $this->client->textdomain ) . '</a>)';
|
375 |
-
$notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked. ';
|
376 |
-
$notice .= 'We are using Appsero to collect your data. <a href="https://appsero.com/privacy-policy/">Learn more</a> about how Appsero collects and handle your data.</p>';
|
377 |
-
|
378 |
-
echo '<div class="updated"><p>';
|
379 |
-
echo $notice;
|
380 |
-
echo '</p><p class="submit">';
|
381 |
-
echo ' <a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . __( 'Allow', $this->client->textdomain ) . '</a>';
|
382 |
-
echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . __( 'No thanks', $this->client->textdomain ) . '</a>';
|
383 |
-
echo '</p></div>';
|
384 |
-
|
385 |
-
echo "<script type='text/javascript'>jQuery('." . $this->client->slug . "-insights-data-we-collect').on('click', function(e) {
|
386 |
-
e.preventDefault();
|
387 |
-
jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
|
388 |
-
});
|
389 |
-
</script>
|
390 |
-
";
|
391 |
-
}
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* handle the optin/optout
|
396 |
-
*
|
397 |
-
* @return void
|
398 |
-
*/
|
399 |
-
public function handle_optin_optout() {
|
400 |
-
|
401 |
-
if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && $_GET[ $this->client->slug . '_tracker_optin' ] == 'true' ) {
|
402 |
-
$this->optin();
|
403 |
-
|
404 |
-
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optin' ) );
|
405 |
-
exit;
|
406 |
-
}
|
407 |
-
|
408 |
-
if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && $_GET[ $this->client->slug . '_tracker_optout' ] == 'true' ) {
|
409 |
-
$this->optout();
|
410 |
-
|
411 |
-
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optout' ) );
|
412 |
-
exit;
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
/**
|
417 |
-
* Tracking optin
|
418 |
-
*
|
419 |
-
* @return void
|
420 |
-
*/
|
421 |
-
public function optin() {
|
422 |
-
update_option( $this->client->slug . '_allow_tracking', 'yes' );
|
423 |
-
update_option( $this->client->slug . '_tracking_notice', 'hide' );
|
424 |
-
|
425 |
-
$this->clear_schedule_event();
|
426 |
-
$this->schedule_event();
|
427 |
-
$this->send_tracking_data();
|
428 |
-
}
|
429 |
-
|
430 |
-
/**
|
431 |
-
* Optout from tracking
|
432 |
-
*
|
433 |
-
* @return void
|
434 |
-
*/
|
435 |
-
public function optout() {
|
436 |
-
update_option( $this->client->slug . '_allow_tracking', 'no' );
|
437 |
-
update_option( $this->client->slug . '_tracking_notice', 'hide' );
|
438 |
-
|
439 |
-
$this->clear_schedule_event();
|
440 |
-
}
|
441 |
-
|
442 |
-
/**
|
443 |
-
* Get the number of post counts
|
444 |
-
*
|
445 |
-
* @param string $post_type
|
446 |
-
*
|
447 |
-
* @return integer
|
448 |
-
*/
|
449 |
-
public function get_post_count( $post_type ) {
|
450 |
-
global $wpdb;
|
451 |
-
|
452 |
-
return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'");
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Get server related info.
|
457 |
-
*
|
458 |
-
* @return array
|
459 |
-
*/
|
460 |
-
private static function get_server_info() {
|
461 |
-
global $wpdb;
|
462 |
-
|
463 |
-
$server_data = array();
|
464 |
-
|
465 |
-
if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
|
466 |
-
$server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
|
467 |
-
}
|
468 |
-
|
469 |
-
if ( function_exists( 'phpversion' ) ) {
|
470 |
-
$server_data['php_version'] = phpversion();
|
471 |
-
}
|
472 |
-
|
473 |
-
$server_data['mysql_version'] = $wpdb->db_version();
|
474 |
-
|
475 |
-
$server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
|
476 |
-
$server_data['php_default_timezone'] = date_default_timezone_get();
|
477 |
-
$server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
|
478 |
-
$server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
|
479 |
-
$server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
|
480 |
-
|
481 |
-
return $server_data;
|
482 |
-
}
|
483 |
-
|
484 |
-
/**
|
485 |
-
* Get WordPress related data.
|
486 |
-
*
|
487 |
-
* @return array
|
488 |
-
*/
|
489 |
-
private function get_wp_info() {
|
490 |
-
$wp_data = array();
|
491 |
-
|
492 |
-
$wp_data['memory_limit'] = WP_MEMORY_LIMIT;
|
493 |
-
$wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
|
494 |
-
$wp_data['locale'] = get_locale();
|
495 |
-
$wp_data['version'] = get_bloginfo( 'version' );
|
496 |
-
$wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
|
497 |
-
|
498 |
-
return $wp_data;
|
499 |
-
}
|
500 |
-
|
501 |
-
/**
|
502 |
-
* Get the list of active and inactive plugins
|
503 |
-
*
|
504 |
-
* @return array
|
505 |
-
*/
|
506 |
-
private function get_all_plugins() {
|
507 |
-
// Ensure get_plugins function is loaded
|
508 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
509 |
-
include ABSPATH . '/wp-admin/includes/plugin.php';
|
510 |
-
}
|
511 |
-
|
512 |
-
$plugins = get_plugins();
|
513 |
-
$active_plugins_keys = get_option( 'active_plugins', array() );
|
514 |
-
$active_plugins = array();
|
515 |
-
|
516 |
-
foreach ( $plugins as $k => $v ) {
|
517 |
-
// Take care of formatting the data how we want it.
|
518 |
-
$formatted = array();
|
519 |
-
$formatted['name'] = strip_tags( $v['Name'] );
|
520 |
-
|
521 |
-
if ( isset( $v['Version'] ) ) {
|
522 |
-
$formatted['version'] = strip_tags( $v['Version'] );
|
523 |
-
}
|
524 |
-
|
525 |
-
if ( isset( $v['Author'] ) ) {
|
526 |
-
$formatted['author'] = strip_tags( $v['Author'] );
|
527 |
-
}
|
528 |
-
|
529 |
-
if ( isset( $v['Network'] ) ) {
|
530 |
-
$formatted['network'] = strip_tags( $v['Network'] );
|
531 |
-
}
|
532 |
-
|
533 |
-
if ( isset( $v['PluginURI'] ) ) {
|
534 |
-
$formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
|
535 |
-
}
|
536 |
-
|
537 |
-
if ( in_array( $k, $active_plugins_keys ) ) {
|
538 |
-
// Remove active plugins from list so we can show active and inactive separately
|
539 |
-
unset( $plugins[$k] );
|
540 |
-
$active_plugins[$k] = $formatted;
|
541 |
-
} else {
|
542 |
-
$plugins[$k] = $formatted;
|
543 |
-
}
|
544 |
-
}
|
545 |
-
|
546 |
-
return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
|
547 |
-
}
|
548 |
-
|
549 |
-
/**
|
550 |
-
* Get user totals based on user role.
|
551 |
-
*
|
552 |
-
* @return array
|
553 |
-
*/
|
554 |
-
public function get_user_counts() {
|
555 |
-
$user_count = array();
|
556 |
-
$user_count_data = count_users();
|
557 |
-
$user_count['total'] = $user_count_data['total_users'];
|
558 |
-
|
559 |
-
// Get user count based on user role
|
560 |
-
foreach ( $user_count_data['avail_roles'] as $role => $count ) {
|
561 |
-
$user_count[ $role ] = $count;
|
562 |
-
}
|
563 |
-
|
564 |
-
return $user_count;
|
565 |
-
}
|
566 |
-
|
567 |
-
/**
|
568 |
-
* Add weekly cron schedule
|
569 |
-
*
|
570 |
-
* @param array $schedules
|
571 |
-
*
|
572 |
-
* @return array
|
573 |
-
*/
|
574 |
-
public function add_weekly_schedule( $schedules ) {
|
575 |
-
|
576 |
-
$schedules['weekly'] = array(
|
577 |
-
'interval' => DAY_IN_SECONDS * 7,
|
578 |
-
'display' => 'Once Weekly',
|
579 |
-
);
|
580 |
-
|
581 |
-
return $schedules;
|
582 |
-
}
|
583 |
-
|
584 |
-
/**
|
585 |
-
* Plugin activation hook
|
586 |
-
*
|
587 |
-
* @return void
|
588 |
-
*/
|
589 |
-
public function activate_plugin() {
|
590 |
-
$allowed = get_option( $this->client->slug . '_allow_tracking', 'no' );
|
591 |
-
|
592 |
-
// if it wasn't allowed before, do nothing
|
593 |
-
if ( 'yes' !== $allowed ) {
|
594 |
-
return;
|
595 |
-
}
|
596 |
-
|
597 |
-
// re-schedule and delete the last sent time so we could force send again
|
598 |
-
$hook_name = $this->client->slug . '_tracker_send_event';
|
599 |
-
if ( ! wp_next_scheduled( $hook_name ) ) {
|
600 |
-
wp_schedule_event( time(), 'weekly', $hook_name );
|
601 |
-
}
|
602 |
-
|
603 |
-
delete_option( $this->client->slug . '_tracking_last_send' );
|
604 |
-
|
605 |
-
$this->send_tracking_data( true );
|
606 |
-
}
|
607 |
-
|
608 |
-
/**
|
609 |
-
* Clear our options upon deactivation
|
610 |
-
*
|
611 |
-
* @return void
|
612 |
-
*/
|
613 |
-
public function deactivation_cleanup() {
|
614 |
-
$this->clear_schedule_event();
|
615 |
-
|
616 |
-
if ( 'theme' == $this->client->type ) {
|
617 |
-
delete_option( $this->client->slug . '_tracking_last_send' );
|
618 |
-
delete_option( $this->client->slug . '_allow_tracking' );
|
619 |
-
}
|
620 |
-
|
621 |
-
delete_option( $this->client->slug . '_tracking_notice' );
|
622 |
-
}
|
623 |
-
|
624 |
-
/**
|
625 |
-
* Hook into action links and modify the deactivate link
|
626 |
-
*
|
627 |
-
* @param array $links
|
628 |
-
*
|
629 |
-
* @return array
|
630 |
-
*/
|
631 |
-
public function plugin_action_links( $links ) {
|
632 |
-
|
633 |
-
if ( array_key_exists( 'deactivate', $links ) ) {
|
634 |
-
$links['deactivate'] = str_replace( '<a', '<a class="' . $this->client->slug . '-deactivate-link"', $links['deactivate'] );
|
635 |
-
}
|
636 |
-
|
637 |
-
return $links;
|
638 |
-
}
|
639 |
-
|
640 |
-
private function get_uninstall_reasons() {
|
641 |
-
$reasons = array(
|
642 |
-
array(
|
643 |
-
'id' => 'could-not-understand',
|
644 |
-
'text' => 'I couldn\'t understand how to make it work',
|
645 |
-
'type' => 'textarea',
|
646 |
-
'placeholder' => 'Would you like us to assist you?'
|
647 |
-
),
|
648 |
-
array(
|
649 |
-
'id' => 'found-better-plugin',
|
650 |
-
'text' => 'I found a better plugin',
|
651 |
-
'type' => 'text',
|
652 |
-
'placeholder' => 'Which plugin?'
|
653 |
-
),
|
654 |
-
array(
|
655 |
-
'id' => 'not-have-that-feature',
|
656 |
-
'text' => 'The plugin is great, but I need specific feature that you don\'t support',
|
657 |
-
'type' => 'textarea',
|
658 |
-
'placeholder' => 'Could you tell us more about that feature?'
|
659 |
-
),
|
660 |
-
array(
|
661 |
-
'id' => 'is-not-working',
|
662 |
-
'text' => 'The plugin is not working',
|
663 |
-
'type' => 'textarea',
|
664 |
-
'placeholder' => 'Could you tell us a bit more whats not working?'
|
665 |
-
),
|
666 |
-
array(
|
667 |
-
'id' => 'looking-for-other',
|
668 |
-
'text' => 'It\'s not what I was looking for',
|
669 |
-
'type' => '',
|
670 |
-
'placeholder' => ''
|
671 |
-
),
|
672 |
-
array(
|
673 |
-
'id' => 'did-not-work-as-expected',
|
674 |
-
'text' => 'The plugin didn\'t work as expected',
|
675 |
-
'type' => 'textarea',
|
676 |
-
'placeholder' => 'What did you expect?'
|
677 |
-
),
|
678 |
-
array(
|
679 |
-
'id' => 'other',
|
680 |
-
'text' => 'Other',
|
681 |
-
'type' => 'textarea',
|
682 |
-
'placeholder' => 'Could you tell us a bit more?'
|
683 |
-
),
|
684 |
-
);
|
685 |
-
|
686 |
-
return $reasons;
|
687 |
-
}
|
688 |
-
|
689 |
-
/**
|
690 |
-
* Plugin deactivation uninstall reason submission
|
691 |
-
*
|
692 |
-
* @return void
|
693 |
-
*/
|
694 |
-
public function uninstall_reason_submission() {
|
695 |
-
|
696 |
-
if ( ! isset( $_POST['reason_id'] ) ) {
|
697 |
-
wp_send_json_error();
|
698 |
-
}
|
699 |
-
|
700 |
-
$current_user = wp_get_current_user();
|
701 |
-
|
702 |
-
$data = array(
|
703 |
-
'hash' => $this->client->hash,
|
704 |
-
'reason_id' => sanitize_text_field( $_POST['reason_id'] ),
|
705 |
-
'reason_info' => isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '',
|
706 |
-
'site' => $this->get_site_name(),
|
707 |
-
'url' => esc_url( home_url() ),
|
708 |
-
'admin_email' => get_option( 'admin_email' ),
|
709 |
-
'user_email' => $current_user->user_email,
|
710 |
-
'first_name' => $current_user->first_name,
|
711 |
-
'last_name' => $current_user->last_name,
|
712 |
-
'server' => $this->get_server_info(),
|
713 |
-
'wp' => $this->get_wp_info(),
|
714 |
-
'ip_address' => $this->get_user_ip_address(),
|
715 |
-
'theme' => get_stylesheet(),
|
716 |
-
'version' => $this->client->project_version,
|
717 |
-
);
|
718 |
-
|
719 |
-
// Add metadata
|
720 |
-
if ( $extra = $this->get_extra_data() ) {
|
721 |
-
$data['extra'] = $extra;
|
722 |
-
}
|
723 |
-
|
724 |
-
$this->client->send_request( $data, 'deactivate' );
|
725 |
-
|
726 |
-
wp_send_json_success();
|
727 |
-
}
|
728 |
-
|
729 |
-
/**
|
730 |
-
* Handle the plugin deactivation feedback
|
731 |
-
*
|
732 |
-
* @return void
|
733 |
-
*/
|
734 |
-
public function deactivate_scripts() {
|
735 |
-
global $pagenow;
|
736 |
-
|
737 |
-
if ( 'plugins.php' != $pagenow ) {
|
738 |
-
return;
|
739 |
-
}
|
740 |
-
|
741 |
-
$reasons = $this->get_uninstall_reasons();
|
742 |
-
?>
|
743 |
-
|
744 |
-
<div class="wd-dr-modal" id="<?php echo $this->client->slug; ?>-wd-dr-modal">
|
745 |
-
<div class="wd-dr-modal-wrap">
|
746 |
-
<div class="wd-dr-modal-header">
|
747 |
-
<h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', $this->client->textdomain ); ?></h3>
|
748 |
-
</div>
|
749 |
-
|
750 |
-
<div class="wd-dr-modal-body">
|
751 |
-
<ul class="reasons">
|
752 |
-
<?php foreach ($reasons as $reason) { ?>
|
753 |
-
<li data-type="<?php echo esc_attr( $reason['type'] ); ?>" data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
|
754 |
-
<label><input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>"> <?php echo $reason['text']; ?></label>
|
755 |
-
</li>
|
756 |
-
<?php } ?>
|
757 |
-
</ul>
|
758 |
-
<p class="wd-dr-modal-reasons-bottom">We share your data with <a href="https://appsero.com/">Appsero</a> to troubleshoot problems & make product improvements. <a href="https://appsero.com/privacy-policy/">Learn more</a> about how Appsero handles your data.</p>
|
759 |
-
</div>
|
760 |
-
|
761 |
-
<div class="wd-dr-modal-footer">
|
762 |
-
<a href="#" class="dont-bother-me"><?php _e( 'I rather wouldn\'t say', $this->client->textdomain ); ?></a>
|
763 |
-
<button class="button-secondary"><?php _e( 'Submit & Deactivate', $this->client->textdomain ); ?></button>
|
764 |
-
<button class="button-primary"><?php _e( 'Cancel', $this->client->textdomain ); ?></button>
|
765 |
-
</div>
|
766 |
-
</div>
|
767 |
-
</div>
|
768 |
-
|
769 |
-
<style type="text/css">
|
770 |
-
.wd-dr-modal {
|
771 |
-
position: fixed;
|
772 |
-
z-index: 99999;
|
773 |
-
top: 0;
|
774 |
-
right: 0;
|
775 |
-
bottom: 0;
|
776 |
-
left: 0;
|
777 |
-
background: rgba(0,0,0,0.5);
|
778 |
-
display: none;
|
779 |
-
}
|
780 |
-
|
781 |
-
.wd-dr-modal.modal-active {
|
782 |
-
display: block;
|
783 |
-
}
|
784 |
-
|
785 |
-
.wd-dr-modal-wrap {
|
786 |
-
width: 475px;
|
787 |
-
position: relative;
|
788 |
-
margin: 10% auto;
|
789 |
-
background: #fff;
|
790 |
-
}
|
791 |
-
|
792 |
-
.wd-dr-modal-header {
|
793 |
-
border-bottom: 1px solid #eee;
|
794 |
-
padding: 8px 20px;
|
795 |
-
}
|
796 |
-
|
797 |
-
.wd-dr-modal-header h3 {
|
798 |
-
line-height: 150%;
|
799 |
-
margin: 0;
|
800 |
-
}
|
801 |
-
|
802 |
-
.wd-dr-modal-body {
|
803 |
-
padding: 5px 20px 20px 20px;
|
804 |
-
}
|
805 |
-
|
806 |
-
.wd-dr-modal-body .reason-input {
|
807 |
-
margin-top: 5px;
|
808 |
-
margin-left: 20px;
|
809 |
-
}
|
810 |
-
.wd-dr-modal-footer {
|
811 |
-
border-top: 1px solid #eee;
|
812 |
-
padding: 12px 20px;
|
813 |
-
text-align: right;
|
814 |
-
}
|
815 |
-
.wd-dr-modal-reasons-bottom {
|
816 |
-
margin: 15px 0 0 0;
|
817 |
-
}
|
818 |
-
</style>
|
819 |
-
|
820 |
-
<script type="text/javascript">
|
821 |
-
(function($) {
|
822 |
-
$(function() {
|
823 |
-
var modal = $( '#<?php echo $this->client->slug; ?>-wd-dr-modal' );
|
824 |
-
var deactivateLink = '';
|
825 |
-
|
826 |
-
$( '#the-list' ).on('click', 'a.<?php echo $this->client->slug; ?>-deactivate-link', function(e) {
|
827 |
-
e.preventDefault();
|
828 |
-
|
829 |
-
modal.addClass('modal-active');
|
830 |
-
deactivateLink = $(this).attr('href');
|
831 |
-
modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
|
832 |
-
});
|
833 |
-
|
834 |
-
modal.on('click', 'button.button-primary', function(e) {
|
835 |
-
e.preventDefault();
|
836 |
-
|
837 |
-
modal.removeClass('modal-active');
|
838 |
-
});
|
839 |
-
|
840 |
-
modal.on('click', 'input[type="radio"]', function () {
|
841 |
-
var parent = $(this).parents('li:first');
|
842 |
-
|
843 |
-
modal.find('.reason-input').remove();
|
844 |
-
|
845 |
-
var inputType = parent.data('type'),
|
846 |
-
inputPlaceholder = parent.data('placeholder'),
|
847 |
-
reasonInputHtml = '<div class="reason-input">' + ( ( 'text' === inputType ) ? '<input type="text" size="40" />' : '<textarea rows="5" cols="45"></textarea>' ) + '</div>';
|
848 |
-
|
849 |
-
if ( inputType !== '' ) {
|
850 |
-
parent.append( $(reasonInputHtml) );
|
851 |
-
parent.find('input, textarea').attr('placeholder', inputPlaceholder).focus();
|
852 |
-
}
|
853 |
-
});
|
854 |
-
|
855 |
-
modal.on('click', 'button.button-secondary', function(e) {
|
856 |
-
e.preventDefault();
|
857 |
-
|
858 |
-
var button = $(this);
|
859 |
-
|
860 |
-
if ( button.hasClass('disabled') ) {
|
861 |
-
return;
|
862 |
-
}
|
863 |
-
|
864 |
-
var $radio = $( 'input[type="radio"]:checked', modal );
|
865 |
-
|
866 |
-
var $selected_reason = $radio.parents('li:first'),
|
867 |
-
$input = $selected_reason.find('textarea, input[type="text"]');
|
868 |
-
|
869 |
-
$.ajax({
|
870 |
-
url: ajaxurl,
|
871 |
-
type: 'POST',
|
872 |
-
data: {
|
873 |
-
action: '<?php echo $this->client->slug; ?>_submit-uninstall-reason',
|
874 |
-
reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
|
875 |
-
reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
|
876 |
-
},
|
877 |
-
beforeSend: function() {
|
878 |
-
button.addClass('disabled');
|
879 |
-
button.text('Processing...');
|
880 |
-
},
|
881 |
-
complete: function() {
|
882 |
-
window.location.href = deactivateLink;
|
883 |
-
}
|
884 |
-
});
|
885 |
-
});
|
886 |
-
});
|
887 |
-
}(jQuery));
|
888 |
-
</script>
|
889 |
-
|
890 |
-
<?php
|
891 |
-
}
|
892 |
-
|
893 |
-
/**
|
894 |
-
* Run after theme deactivated
|
895 |
-
* @param string $new_name
|
896 |
-
* @param object $new_theme
|
897 |
-
* @param object $old_theme
|
898 |
-
* @return void
|
899 |
-
*/
|
900 |
-
public function theme_deactivated( $new_name, $new_theme, $old_theme ) {
|
901 |
-
// Make sure this is appsero theme
|
902 |
-
if ( $old_theme->get_template() == $this->client->slug ) {
|
903 |
-
$current_user = wp_get_current_user();
|
904 |
-
|
905 |
-
$data = array(
|
906 |
-
'hash' => $this->client->hash,
|
907 |
-
'reason_id' => 'none',
|
908 |
-
'reason_info' => '',
|
909 |
-
'site' => $this->get_site_name(),
|
910 |
-
'url' => esc_url( home_url() ),
|
911 |
-
'admin_email' => get_option( 'admin_email' ),
|
912 |
-
'user_email' => $current_user->user_email,
|
913 |
-
'first_name' => $current_user->first_name,
|
914 |
-
'last_name' => $current_user->last_name,
|
915 |
-
'server' => $this->get_server_info(),
|
916 |
-
'wp' => $this->get_wp_info(),
|
917 |
-
'ip_address' => $this->get_user_ip_address(),
|
918 |
-
'theme' => get_stylesheet(),
|
919 |
-
'version' => $this->client->project_version,
|
920 |
-
);
|
921 |
-
|
922 |
-
$this->client->send_request( $data, 'deactivate' );
|
923 |
-
}
|
924 |
-
}
|
925 |
-
|
926 |
-
/**
|
927 |
-
* Get user IP Address
|
928 |
-
*/
|
929 |
-
private function get_user_ip_address() {
|
930 |
-
$response = wp_remote_get( 'https://icanhazip.com/' );
|
931 |
-
|
932 |
-
if ( is_wp_error( $response ) ) {
|
933 |
-
return '';
|
934 |
-
}
|
935 |
-
|
936 |
-
$ip = trim( wp_remote_retrieve_body( $response ) );
|
937 |
-
|
938 |
-
if ( ! filter_var( $ip, FILTER_VALIDATE_IP ) ) {
|
939 |
-
return '';
|
940 |
-
}
|
941 |
-
|
942 |
-
return $ip;
|
943 |
-
}
|
944 |
-
|
945 |
-
/**
|
946 |
-
* Get site name
|
947 |
-
*/
|
948 |
-
private function get_site_name() {
|
949 |
-
$site_name = get_bloginfo( 'name' );
|
950 |
-
|
951 |
-
if ( empty( $site_name ) ) {
|
952 |
-
$site_name = get_bloginfo( 'description' );
|
953 |
-
$site_name = wp_trim_words( $site_name, 3, '' );
|
954 |
-
}
|
955 |
-
|
956 |
-
if ( empty( $site_name ) ) {
|
957 |
-
$site_name = get_bloginfo( 'url' );
|
958 |
-
}
|
959 |
-
|
960 |
-
return $site_name;
|
961 |
-
}
|
962 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/src/License.php
DELETED
@@ -1,701 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Appsero;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Appsero License Checker
|
6 |
-
*
|
7 |
-
* This class will check, active and deactive license
|
8 |
-
*/
|
9 |
-
class License {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* AppSero\Client
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
*/
|
16 |
-
protected $client;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Arguments of create menu
|
20 |
-
*
|
21 |
-
* @var array
|
22 |
-
*/
|
23 |
-
protected $menu_args;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* `option_name` of `wp_options` table
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
protected $option_key;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Error message of HTTP request
|
34 |
-
*
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $error;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Success message on form submit
|
41 |
-
*
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
public $success;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Corn schedule hook name
|
48 |
-
*
|
49 |
-
* @var string
|
50 |
-
*/
|
51 |
-
protected $schedule_hook;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Set value for valid licnese
|
55 |
-
*
|
56 |
-
* @var boolean
|
57 |
-
*/
|
58 |
-
private $is_valid_licnese = null;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Initialize the class
|
62 |
-
*
|
63 |
-
* @param Appsero\Client
|
64 |
-
*/
|
65 |
-
public function __construct( Client $client ) {
|
66 |
-
$this->client = $client;
|
67 |
-
|
68 |
-
$this->option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license';
|
69 |
-
|
70 |
-
$this->schedule_hook = $this->client->slug . '_license_check_event';
|
71 |
-
|
72 |
-
// Run hook to check license status daily
|
73 |
-
add_action( $this->schedule_hook, array( $this, 'check_license_status' ) );
|
74 |
-
|
75 |
-
// Active/Deactive corn schedule
|
76 |
-
$this->run_schedule();
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Check license
|
81 |
-
*
|
82 |
-
* @return boolean
|
83 |
-
*/
|
84 |
-
public function check( $license_key ) {
|
85 |
-
$route = 'public/license/' . $this->client->hash . '/check';
|
86 |
-
|
87 |
-
return $this->send_request( $license_key, $route );
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Active a license
|
92 |
-
*
|
93 |
-
* @return boolean
|
94 |
-
*/
|
95 |
-
public function activate( $license_key ) {
|
96 |
-
$route = 'public/license/' . $this->client->hash . '/activate';
|
97 |
-
|
98 |
-
return $this->send_request( $license_key, $route );
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Deactivate a license
|
103 |
-
*
|
104 |
-
* @return boolean
|
105 |
-
*/
|
106 |
-
public function deactivate( $license_key ) {
|
107 |
-
$route = 'public/license/' . $this->client->hash . '/deactivate';
|
108 |
-
|
109 |
-
return $this->send_request( $license_key, $route );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Send common request
|
114 |
-
*
|
115 |
-
* @param $license_key
|
116 |
-
* @param $route
|
117 |
-
*
|
118 |
-
* @return array
|
119 |
-
*/
|
120 |
-
protected function send_request( $license_key, $route ) {
|
121 |
-
$params = array(
|
122 |
-
'license_key' => $license_key,
|
123 |
-
'url' => esc_url( home_url() ),
|
124 |
-
);
|
125 |
-
|
126 |
-
$response = $this->client->send_request( $params, $route, true );
|
127 |
-
|
128 |
-
if ( is_wp_error( $response ) ) {
|
129 |
-
return array(
|
130 |
-
'success' => false,
|
131 |
-
'error' => $response->get_error_message()
|
132 |
-
);
|
133 |
-
}
|
134 |
-
|
135 |
-
$response = json_decode( wp_remote_retrieve_body( $response ), true );
|
136 |
-
|
137 |
-
if ( empty( $response ) || isset( $response['exception'] )) {
|
138 |
-
return array(
|
139 |
-
'success' => false,
|
140 |
-
'error' => 'Unknown error occurred, Please try again.'
|
141 |
-
);
|
142 |
-
}
|
143 |
-
|
144 |
-
if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) {
|
145 |
-
$response = array(
|
146 |
-
'success' => false,
|
147 |
-
'error' => $response['errors']['license_key'][0]
|
148 |
-
);
|
149 |
-
}
|
150 |
-
|
151 |
-
return $response;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Add settings page for license
|
156 |
-
*
|
157 |
-
* @param array $args
|
158 |
-
*
|
159 |
-
* @return void
|
160 |
-
*/
|
161 |
-
public function add_settings_page( $args = array() ) {
|
162 |
-
$defaults = array(
|
163 |
-
'type' => 'menu', // Can be: menu, options, submenu
|
164 |
-
'page_title' => 'Manage License',
|
165 |
-
'menu_title' => 'Manage License',
|
166 |
-
'capability' => 'manage_options',
|
167 |
-
'menu_slug' => $this->client->slug . '-manage-license',
|
168 |
-
'icon_url' => '',
|
169 |
-
'position' => null,
|
170 |
-
'parent_slug' => '',
|
171 |
-
);
|
172 |
-
|
173 |
-
$this->menu_args = wp_parse_args( $args, $defaults );
|
174 |
-
|
175 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ), 99 );
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Admin Menu hook
|
180 |
-
*
|
181 |
-
* @return void
|
182 |
-
*/
|
183 |
-
public function admin_menu() {
|
184 |
-
switch ( $this->menu_args['type'] ) {
|
185 |
-
case 'menu':
|
186 |
-
$this->add_menu_page();
|
187 |
-
break;
|
188 |
-
|
189 |
-
case 'submenu':
|
190 |
-
$this->add_submenu_page();
|
191 |
-
break;
|
192 |
-
|
193 |
-
case 'options':
|
194 |
-
$this->add_options_page();
|
195 |
-
break;
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* License menu output
|
201 |
-
*/
|
202 |
-
public function menu_output() {
|
203 |
-
|
204 |
-
if ( isset( $_POST['submit'] ) ) {
|
205 |
-
$this->license_form_submit( $_POST );
|
206 |
-
}
|
207 |
-
|
208 |
-
$license = get_option( $this->option_key, null );
|
209 |
-
$action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'deactive' : 'active';
|
210 |
-
$this->licenses_style();
|
211 |
-
?>
|
212 |
-
|
213 |
-
<div class="wrap appsero-license-settings-wrapper">
|
214 |
-
<h1>License Settings</h1>
|
215 |
-
|
216 |
-
<?php
|
217 |
-
$this->show_license_page_notices();
|
218 |
-
do_action( 'before_appsero_license_section' );
|
219 |
-
?>
|
220 |
-
|
221 |
-
<div class="appsero-license-settings appsero-license-section">
|
222 |
-
<?php $this->show_license_page_card_header(); ?>
|
223 |
-
|
224 |
-
<div class="appsero-license-details">
|
225 |
-
<p>Active <strong><?php echo $this->client->name; ?></strong> by your license key to get professional support and automatic update from your WordPress dashboard.</p>
|
226 |
-
<form method="post" action="<?php $this->formActionUrl(); ?>" novalidate="novalidate" spellcheck="false">
|
227 |
-
<input type="hidden" name="_action" value="<?php echo $action; ?>">
|
228 |
-
<input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
|
229 |
-
<div class="license-input-fields">
|
230 |
-
<div class="license-input-key">
|
231 |
-
<svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
232 |
-
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
|
233 |
-
</svg>
|
234 |
-
<input type="text" value="<?php echo $this->get_input_license_value( $action, $license ); ?>"
|
235 |
-
placeholder="Enter your license key to activate" name="license_key"
|
236 |
-
<?php echo ( 'deactive' == $action ) ? 'readonly="readonly"' : ''; ?>
|
237 |
-
/>
|
238 |
-
</div>
|
239 |
-
<button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
|
240 |
-
<?php echo $action == 'active' ? 'Activate License' : 'Deactivate License' ; ?>
|
241 |
-
</button>
|
242 |
-
</div>
|
243 |
-
</form>
|
244 |
-
|
245 |
-
<?php
|
246 |
-
if ( 'deactive' == $action && isset( $license['remaining'] ) ) {
|
247 |
-
$this->show_active_license_info( $license );
|
248 |
-
}
|
249 |
-
?>
|
250 |
-
</div>
|
251 |
-
</div> <!-- /.appsero-license-settings -->
|
252 |
-
|
253 |
-
<?php do_action( 'after_appsero_license_section' ); ?>
|
254 |
-
</div>
|
255 |
-
<?php
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* License form submit
|
260 |
-
*/
|
261 |
-
public function license_form_submit( $form ) {
|
262 |
-
if ( ! isset( $form['_nonce'], $form['_action'] ) ) {
|
263 |
-
$this->error = "Please add all information";
|
264 |
-
return;
|
265 |
-
}
|
266 |
-
|
267 |
-
if ( ! wp_verify_nonce( $form['_nonce'], $this->client->name ) ) {
|
268 |
-
$this->error = "You don't have permission to manage license.";
|
269 |
-
return;
|
270 |
-
}
|
271 |
-
|
272 |
-
switch ( $form['_action'] ) {
|
273 |
-
case 'active':
|
274 |
-
$this->active_client_license( $form );
|
275 |
-
break;
|
276 |
-
|
277 |
-
case 'deactive':
|
278 |
-
$this->deactive_client_license( $form );
|
279 |
-
break;
|
280 |
-
}
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Check license status on schedule
|
285 |
-
*/
|
286 |
-
public function check_license_status() {
|
287 |
-
$license = get_option( $this->option_key, null );
|
288 |
-
|
289 |
-
if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
|
290 |
-
$response = $this->check( $license['key'] );
|
291 |
-
|
292 |
-
if ( isset( $response['success'] ) && $response['success'] ) {
|
293 |
-
$license['status'] = 'activate';
|
294 |
-
$license['remaining'] = $response['remaining'];
|
295 |
-
$license['activation_limit'] = $response['activation_limit'];
|
296 |
-
$license['expiry_days'] = $response['expiry_days'];
|
297 |
-
$license['title'] = $response['title'];
|
298 |
-
$license['source_id'] = $response['source_identifier'];
|
299 |
-
$license['recurring'] = $response['recurring'];
|
300 |
-
} else {
|
301 |
-
$license['status'] = 'deactivate';
|
302 |
-
$license['expiry_days'] = 0;
|
303 |
-
}
|
304 |
-
|
305 |
-
update_option( $this->option_key, $license, false );
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Check this is a valid license
|
311 |
-
*/
|
312 |
-
public function is_valid() {
|
313 |
-
if ( null !== $this->is_valid_licnese ) {
|
314 |
-
return $this->is_valid_licnese;
|
315 |
-
}
|
316 |
-
|
317 |
-
$license = get_option( $this->option_key, null );
|
318 |
-
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
|
319 |
-
$this->is_valid_licnese = true;
|
320 |
-
} else {
|
321 |
-
$this->is_valid_licnese = false;
|
322 |
-
}
|
323 |
-
|
324 |
-
return $this->is_valid_licnese;
|
325 |
-
}
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Check this is a valid license
|
329 |
-
*/
|
330 |
-
public function is_valid_by( $option, $value ) {
|
331 |
-
$license = get_option( $this->option_key, null );
|
332 |
-
|
333 |
-
if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
|
334 |
-
if ( isset( $license[ $option ] ) && $license[ $option ] == $value ) {
|
335 |
-
return true;
|
336 |
-
}
|
337 |
-
}
|
338 |
-
|
339 |
-
return false;
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Styles for licenses page
|
344 |
-
*/
|
345 |
-
private function licenses_style() {
|
346 |
-
?>
|
347 |
-
<style type="text/css">
|
348 |
-
.appsero-license-section {
|
349 |
-
width: 100%;
|
350 |
-
max-width: 1100px;
|
351 |
-
min-height: 1px;
|
352 |
-
box-sizing: border-box;
|
353 |
-
}
|
354 |
-
.appsero-license-settings {
|
355 |
-
background-color: #fff;
|
356 |
-
box-shadow: 0px 3px 10px rgba(16, 16, 16, 0.05);
|
357 |
-
}
|
358 |
-
.appsero-license-settings * {
|
359 |
-
box-sizing: border-box;
|
360 |
-
}
|
361 |
-
.appsero-license-title {
|
362 |
-
background-color: #F8FAFB;
|
363 |
-
border-bottom: 2px solid #EAEAEA;
|
364 |
-
display: flex;
|
365 |
-
align-items: center;
|
366 |
-
padding: 10px 20px;
|
367 |
-
}
|
368 |
-
.appsero-license-title svg {
|
369 |
-
width: 30px;
|
370 |
-
height: 30px;
|
371 |
-
fill: #0082BF;
|
372 |
-
}
|
373 |
-
.appsero-license-title span {
|
374 |
-
font-size: 17px;
|
375 |
-
color: #444444;
|
376 |
-
margin-left: 10px;
|
377 |
-
}
|
378 |
-
.appsero-license-details {
|
379 |
-
padding: 20px;
|
380 |
-
}
|
381 |
-
.appsero-license-details p {
|
382 |
-
font-size: 15px;
|
383 |
-
margin: 0 0 20px 0;
|
384 |
-
}
|
385 |
-
.license-input-key {
|
386 |
-
position: relative;
|
387 |
-
flex: 0 0 72%;
|
388 |
-
max-width: 72%;
|
389 |
-
}
|
390 |
-
.license-input-key input {
|
391 |
-
background-color: #F9F9F9;
|
392 |
-
padding: 10px 15px 10px 48px;
|
393 |
-
border: 1px solid #E8E5E5;
|
394 |
-
border-radius: 3px;
|
395 |
-
height: 45px;
|
396 |
-
font-size: 16px;
|
397 |
-
color: #71777D;
|
398 |
-
width: 100%;
|
399 |
-
box-shadow: 0 0 0 transparent;
|
400 |
-
}
|
401 |
-
.license-input-key input:focus {
|
402 |
-
outline: 0 none;
|
403 |
-
border: 1px solid #E8E5E5;
|
404 |
-
box-shadow: 0 0 0 transparent;
|
405 |
-
}
|
406 |
-
.license-input-key svg {
|
407 |
-
width: 22px;
|
408 |
-
height: 22px;
|
409 |
-
fill: #0082BF;
|
410 |
-
position: absolute;
|
411 |
-
left: 14px;
|
412 |
-
top: 13px;
|
413 |
-
}
|
414 |
-
.license-input-fields {
|
415 |
-
display: flex;
|
416 |
-
justify-content: space-between;
|
417 |
-
margin-bottom: 30px;
|
418 |
-
max-width: 850px;
|
419 |
-
width: 100%;
|
420 |
-
}
|
421 |
-
.license-input-fields button {
|
422 |
-
color: #fff;
|
423 |
-
font-size: 17px;
|
424 |
-
padding: 8px;
|
425 |
-
height: 46px;
|
426 |
-
background-color: #0082BF;
|
427 |
-
border-radius: 3px;
|
428 |
-
cursor: pointer;
|
429 |
-
flex: 0 0 25%;
|
430 |
-
max-width: 25%;
|
431 |
-
border: 1px solid #0082BF;
|
432 |
-
}
|
433 |
-
.license-input-fields button.deactive-button {
|
434 |
-
background-color: #E40055;
|
435 |
-
border-color: #E40055;
|
436 |
-
}
|
437 |
-
.license-input-fields button:focus {
|
438 |
-
outline: 0 none;
|
439 |
-
}
|
440 |
-
.active-license-info {
|
441 |
-
display: flex;
|
442 |
-
}
|
443 |
-
.single-license-info {
|
444 |
-
min-width: 220px;
|
445 |
-
flex: 0 0 30%;
|
446 |
-
}
|
447 |
-
.single-license-info h3 {
|
448 |
-
font-size: 18px;
|
449 |
-
margin: 0 0 12px 0;
|
450 |
-
}
|
451 |
-
.single-license-info p {
|
452 |
-
margin: 0;
|
453 |
-
color: #00C000;
|
454 |
-
}
|
455 |
-
.single-license-info p.occupied {
|
456 |
-
color: #E40055;
|
457 |
-
}
|
458 |
-
</style>
|
459 |
-
<?php
|
460 |
-
}
|
461 |
-
|
462 |
-
/**
|
463 |
-
* Show active license information
|
464 |
-
*/
|
465 |
-
private function show_active_license_info( $license ) {
|
466 |
-
?>
|
467 |
-
<div class="active-license-info">
|
468 |
-
<div class="single-license-info">
|
469 |
-
<h3>Activation Remaining</h3>
|
470 |
-
<?php if ( empty( $license['activation_limit'] ) ): ?>
|
471 |
-
<p>Unlimited</p>
|
472 |
-
<?php else: ?>
|
473 |
-
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
|
474 |
-
<?php echo $license['remaining']; ?> out of <?php echo $license['activation_limit']; ?>
|
475 |
-
</p>
|
476 |
-
<?php endif; ?>
|
477 |
-
</div>
|
478 |
-
<div class="single-license-info">
|
479 |
-
<h3>Expires in</h3>
|
480 |
-
<?php
|
481 |
-
if ( $license['recurring'] && false !== $license['expiry_days'] ) {
|
482 |
-
$occupied = $license['expiry_days'] > 10 ? '' : 'occupied';
|
483 |
-
echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
|
484 |
-
} else {
|
485 |
-
echo '<p>Never</p>';
|
486 |
-
}
|
487 |
-
?>
|
488 |
-
</div>
|
489 |
-
</div>
|
490 |
-
<?php
|
491 |
-
}
|
492 |
-
|
493 |
-
/**
|
494 |
-
* Show license settings page notices
|
495 |
-
*/
|
496 |
-
private function show_license_page_notices() {
|
497 |
-
if ( ! empty( $this->error ) ) :
|
498 |
-
?>
|
499 |
-
<div class="notice notice-error is-dismissible appsero-license-section">
|
500 |
-
<p><?php echo $this->error; ?></p>
|
501 |
-
</div>
|
502 |
-
<?php
|
503 |
-
endif;
|
504 |
-
if ( ! empty( $this->success ) ) :
|
505 |
-
?>
|
506 |
-
<div class="notice notice-success is-dismissible appsero-license-section">
|
507 |
-
<p><?php echo $this->success; ?></p>
|
508 |
-
</div>
|
509 |
-
<?php
|
510 |
-
endif;
|
511 |
-
echo '<br />';
|
512 |
-
}
|
513 |
-
|
514 |
-
/**
|
515 |
-
* Card header
|
516 |
-
*/
|
517 |
-
private function show_license_page_card_header() {
|
518 |
-
?>
|
519 |
-
<div class="appsero-license-title">
|
520 |
-
<svg enable-background="new 0 0 299.995 299.995" version="1.1" viewBox="0 0 300 300" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
521 |
-
<path d="m150 161.48c-8.613 0-15.598 6.982-15.598 15.598 0 5.776 3.149 10.807 7.817 13.505v17.341h15.562v-17.341c4.668-2.697 7.817-7.729 7.817-13.505 0-8.616-6.984-15.598-15.598-15.598z"/>
|
522 |
-
<path d="m150 85.849c-13.111 0-23.775 10.665-23.775 23.775v25.319h47.548v-25.319c-1e-3 -13.108-10.665-23.775-23.773-23.775z"/>
|
523 |
-
<path d="m150 1e-3c-82.839 0-150 67.158-150 150 0 82.837 67.156 150 150 150s150-67.161 150-150c0-82.839-67.161-150-150-150zm46.09 227.12h-92.173c-9.734 0-17.626-7.892-17.626-17.629v-56.919c0-8.491 6.007-15.582 14.003-17.25v-25.697c0-27.409 22.3-49.711 49.711-49.711 27.409 0 49.709 22.3 49.709 49.711v25.697c7.993 1.673 14 8.759 14 17.25v56.919h2e-3c0 9.736-7.892 17.629-17.626 17.629z"/>
|
524 |
-
</svg>
|
525 |
-
<span>Activate License</span>
|
526 |
-
</div>
|
527 |
-
<?php
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Active client license
|
532 |
-
*/
|
533 |
-
private function active_client_license( $form ) {
|
534 |
-
if ( empty( $form['license_key'] ) ) {
|
535 |
-
$this->error = 'The license key field is required.';
|
536 |
-
return;
|
537 |
-
}
|
538 |
-
|
539 |
-
$license_key = sanitize_text_field( $form['license_key'] );
|
540 |
-
$response = $this->activate( $license_key );
|
541 |
-
|
542 |
-
if ( ! $response['success'] ) {
|
543 |
-
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
544 |
-
return;
|
545 |
-
}
|
546 |
-
|
547 |
-
$data = array(
|
548 |
-
'key' => $license_key,
|
549 |
-
'status' => 'activate',
|
550 |
-
'remaining' => $response['remaining'],
|
551 |
-
'activation_limit' => $response['activation_limit'],
|
552 |
-
'expiry_days' => $response['expiry_days'],
|
553 |
-
'title' => $response['title'],
|
554 |
-
'source_id' => $response['source_identifier'],
|
555 |
-
'recurring' => $response['recurring'],
|
556 |
-
);
|
557 |
-
|
558 |
-
update_option( $this->option_key, $data, false );
|
559 |
-
|
560 |
-
$this->success = 'License activated successfully.';
|
561 |
-
}
|
562 |
-
|
563 |
-
/**
|
564 |
-
* Deactive client license
|
565 |
-
*/
|
566 |
-
private function deactive_client_license( $form ) {
|
567 |
-
$license = get_option( $this->option_key, null );
|
568 |
-
|
569 |
-
if ( empty( $license['key'] ) ) {
|
570 |
-
$this->error = 'License key not found.';
|
571 |
-
return;
|
572 |
-
}
|
573 |
-
|
574 |
-
$response = $this->deactivate( $license['key'] );
|
575 |
-
|
576 |
-
$data = array(
|
577 |
-
'key' => '',
|
578 |
-
'status' => 'deactivate',
|
579 |
-
);
|
580 |
-
|
581 |
-
update_option( $this->option_key, $data, false );
|
582 |
-
|
583 |
-
if ( ! $response['success'] ) {
|
584 |
-
$this->error = $response['error'] ? $response['error'] : 'Unknown error occurred.';
|
585 |
-
return;
|
586 |
-
}
|
587 |
-
|
588 |
-
$this->success = 'License deactivated successfully.';
|
589 |
-
}
|
590 |
-
|
591 |
-
/**
|
592 |
-
* Add license menu page
|
593 |
-
*/
|
594 |
-
private function add_menu_page() {
|
595 |
-
add_menu_page(
|
596 |
-
$this->menu_args['page_title'],
|
597 |
-
$this->menu_args['menu_title'],
|
598 |
-
$this->menu_args['capability'],
|
599 |
-
$this->menu_args['menu_slug'],
|
600 |
-
array( $this, 'menu_output' ),
|
601 |
-
$this->menu_args['icon_url'],
|
602 |
-
$this->menu_args['position']
|
603 |
-
);
|
604 |
-
}
|
605 |
-
|
606 |
-
/**
|
607 |
-
* Add submenu page
|
608 |
-
*/
|
609 |
-
private function add_submenu_page() {
|
610 |
-
add_submenu_page(
|
611 |
-
$this->menu_args['parent_slug'],
|
612 |
-
$this->menu_args['page_title'],
|
613 |
-
$this->menu_args['menu_title'],
|
614 |
-
$this->menu_args['capability'],
|
615 |
-
$this->menu_args['menu_slug'],
|
616 |
-
array( $this, 'menu_output' ),
|
617 |
-
$this->menu_args['position']
|
618 |
-
);
|
619 |
-
}
|
620 |
-
|
621 |
-
/**
|
622 |
-
* Add submenu page
|
623 |
-
*/
|
624 |
-
private function add_options_page() {
|
625 |
-
add_options_page(
|
626 |
-
$this->menu_args['page_title'],
|
627 |
-
$this->menu_args['menu_title'],
|
628 |
-
$this->menu_args['capability'],
|
629 |
-
$this->menu_args['menu_slug'],
|
630 |
-
array( $this, 'menu_output' ),
|
631 |
-
$this->menu_args['position']
|
632 |
-
);
|
633 |
-
}
|
634 |
-
|
635 |
-
/**
|
636 |
-
* Schedule daily sicense checker event
|
637 |
-
*/
|
638 |
-
public function schedule_cron_event() {
|
639 |
-
if ( ! wp_next_scheduled( $this->schedule_hook ) ) {
|
640 |
-
wp_schedule_event( time(), 'daily', $this->schedule_hook );
|
641 |
-
|
642 |
-
wp_schedule_single_event( time() + 20, $this->schedule_hook );
|
643 |
-
}
|
644 |
-
}
|
645 |
-
|
646 |
-
/**
|
647 |
-
* Clear any scheduled hook
|
648 |
-
*/
|
649 |
-
public function clear_scheduler() {
|
650 |
-
wp_clear_scheduled_hook( $this->schedule_hook );
|
651 |
-
}
|
652 |
-
|
653 |
-
/**
|
654 |
-
* Enable/Disable schedule
|
655 |
-
*/
|
656 |
-
private function run_schedule() {
|
657 |
-
switch ( $this->client->type ) {
|
658 |
-
case 'plugin':
|
659 |
-
register_activation_hook( $this->client->file, array( $this, 'schedule_cron_event' ) );
|
660 |
-
register_deactivation_hook( $this->client->file, array( $this, 'clear_scheduler' ) );
|
661 |
-
break;
|
662 |
-
|
663 |
-
case 'theme':
|
664 |
-
add_action( 'after_switch_theme', array( $this, 'schedule_cron_event' ) );
|
665 |
-
add_action( 'switch_theme', array( $this, 'clear_scheduler' ) );
|
666 |
-
break;
|
667 |
-
}
|
668 |
-
}
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Form action URL
|
672 |
-
*/
|
673 |
-
private function formActionUrl() {
|
674 |
-
echo add_query_arg(
|
675 |
-
array( 'page' => $_GET['page'] ),
|
676 |
-
admin_url( basename( $_SERVER['SCRIPT_NAME'] ) )
|
677 |
-
);
|
678 |
-
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Get input license key
|
682 |
-
* @param $action
|
683 |
-
* @return $license
|
684 |
-
*/
|
685 |
-
private function get_input_license_value( $action, $license ) {
|
686 |
-
if ( 'active' == $action ) {
|
687 |
-
return isset( $license['key'] ) ? $license['key'] : '';
|
688 |
-
}
|
689 |
-
|
690 |
-
if ( 'deactive' == $action ) {
|
691 |
-
$key_length = strlen( $license['key'] );
|
692 |
-
|
693 |
-
return str_pad(
|
694 |
-
substr( $license['key'], 0, $key_length / 2 ), $key_length, '*'
|
695 |
-
);
|
696 |
-
}
|
697 |
-
|
698 |
-
return '';
|
699 |
-
}
|
700 |
-
|
701 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/appsero/client/src/Updater.php
DELETED
@@ -1,247 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Appsero;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Appsero Updater
|
6 |
-
*
|
7 |
-
* This class will show new updates project
|
8 |
-
*/
|
9 |
-
class Updater {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Appsero\Client
|
13 |
-
*
|
14 |
-
* @var object
|
15 |
-
*/
|
16 |
-
protected $client;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Initialize the class
|
20 |
-
*
|
21 |
-
* @param Appsero\Client
|
22 |
-
*/
|
23 |
-
public function __construct( Client $client ) {
|
24 |
-
|
25 |
-
$this->client = $client;
|
26 |
-
$this->cache_key = 'appsero_' . md5( $this->client->slug ) . '_version_info';
|
27 |
-
|
28 |
-
// Run hooks.
|
29 |
-
if ( $this->client->type == 'plugin' ) {
|
30 |
-
$this->run_plugin_hooks();
|
31 |
-
} elseif ( $this->client->type == 'theme' ) {
|
32 |
-
$this->run_theme_hooks();
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Set up WordPress filter to hooks to get update.
|
38 |
-
*
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
public function run_plugin_hooks() {
|
42 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_plugin_update' ) );
|
43 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Set up WordPress filter to hooks to get update.
|
48 |
-
*
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
public function run_theme_hooks() {
|
52 |
-
add_filter( 'pre_set_site_transient_update_themes', array( $this, 'check_theme_update' ) );
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Check for Update for this specific project
|
57 |
-
*/
|
58 |
-
public function check_plugin_update( $transient_data ) {
|
59 |
-
global $pagenow;
|
60 |
-
|
61 |
-
if ( ! is_object( $transient_data ) ) {
|
62 |
-
$transient_data = new \stdClass;
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( 'plugins.php' == $pagenow && is_multisite() ) {
|
66 |
-
return $transient_data;
|
67 |
-
}
|
68 |
-
|
69 |
-
if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) {
|
70 |
-
return $transient_data;
|
71 |
-
}
|
72 |
-
|
73 |
-
$version_info = $this->get_cached_version_info();
|
74 |
-
|
75 |
-
if ( false === $version_info ) {
|
76 |
-
$version_info = $this->get_project_latest_version();
|
77 |
-
$this->set_cached_version_info( $version_info );
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
81 |
-
|
82 |
-
if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
|
83 |
-
unset( $version_info->sections );
|
84 |
-
$transient_data->response[ $this->client->basename ] = $version_info;
|
85 |
-
}
|
86 |
-
|
87 |
-
$transient_data->last_checked = time();
|
88 |
-
$transient_data->checked[ $this->client->basename ] = $this->client->project_version;
|
89 |
-
}
|
90 |
-
|
91 |
-
return $transient_data;
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Get version info from database
|
96 |
-
*
|
97 |
-
* @return Object or Boolean
|
98 |
-
*/
|
99 |
-
private function get_cached_version_info() {
|
100 |
-
|
101 |
-
$value = get_transient( $this->cache_key );
|
102 |
-
|
103 |
-
if( ! $value && ! isset( $value->name ) ) {
|
104 |
-
return false; // Cache is expired
|
105 |
-
}
|
106 |
-
|
107 |
-
// We need to turn the icons into an array
|
108 |
-
if ( isset( $value->icons ) ) {
|
109 |
-
$value->icons = (array) $value->icons;
|
110 |
-
}
|
111 |
-
|
112 |
-
// We need to turn the banners into an array
|
113 |
-
if ( isset( $value->banners ) ) {
|
114 |
-
$value->banners = (array) $value->banners;
|
115 |
-
}
|
116 |
-
|
117 |
-
if ( isset( $value->sections ) ) {
|
118 |
-
$value->sections = (array) $value->sections;
|
119 |
-
}
|
120 |
-
|
121 |
-
return $value;
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Set version info to database
|
126 |
-
*/
|
127 |
-
private function set_cached_version_info( $value ) {
|
128 |
-
if ( ! $value ) {
|
129 |
-
return;
|
130 |
-
}
|
131 |
-
|
132 |
-
set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS );
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Get plugin info from Appsero
|
137 |
-
*/
|
138 |
-
private function get_project_latest_version() {
|
139 |
-
|
140 |
-
$license_option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license';
|
141 |
-
$license = get_option( $license_option_key, null );
|
142 |
-
|
143 |
-
$params = array(
|
144 |
-
'version' => $this->client->project_version,
|
145 |
-
'name' => $this->client->name,
|
146 |
-
'slug' => $this->client->slug,
|
147 |
-
'basename' => $this->client->basename,
|
148 |
-
'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '',
|
149 |
-
);
|
150 |
-
|
151 |
-
$route = 'update/' . $this->client->hash . '/check';
|
152 |
-
|
153 |
-
$response = $this->client->send_request( $params, $route, true );
|
154 |
-
|
155 |
-
if ( is_wp_error( $response ) ) {
|
156 |
-
return false;
|
157 |
-
}
|
158 |
-
|
159 |
-
$response = json_decode( wp_remote_retrieve_body( $response ) );
|
160 |
-
|
161 |
-
if ( ! isset( $response->slug ) ) {
|
162 |
-
return false;
|
163 |
-
}
|
164 |
-
|
165 |
-
if ( isset( $response->icons ) ) {
|
166 |
-
$response->icons = (array) $response->icons;
|
167 |
-
}
|
168 |
-
|
169 |
-
if ( isset( $response->banners ) ) {
|
170 |
-
$response->banners = (array) $response->banners;
|
171 |
-
}
|
172 |
-
|
173 |
-
if ( isset( $response->sections ) ) {
|
174 |
-
$response->sections = (array) $response->sections;
|
175 |
-
}
|
176 |
-
|
177 |
-
return $response;
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Updates information on the "View version x.x details" page with custom data.
|
182 |
-
*
|
183 |
-
* @param mixed $data
|
184 |
-
* @param string $action
|
185 |
-
* @param object $args
|
186 |
-
*
|
187 |
-
* @return object $data
|
188 |
-
*/
|
189 |
-
public function plugins_api_filter( $data, $action = '', $args = null ) {
|
190 |
-
|
191 |
-
if ( $action != 'plugin_information' ) {
|
192 |
-
return $data;
|
193 |
-
}
|
194 |
-
|
195 |
-
if ( ! isset( $args->slug ) || ( $args->slug != $this->client->slug ) ) {
|
196 |
-
return $data;
|
197 |
-
}
|
198 |
-
|
199 |
-
$version_info = $this->get_cached_version_info();
|
200 |
-
|
201 |
-
if ( false === $version_info ) {
|
202 |
-
$version_info = $this->get_project_latest_version();
|
203 |
-
$this->set_cached_version_info( $version_info );
|
204 |
-
}
|
205 |
-
|
206 |
-
return $version_info;
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Check theme upate
|
211 |
-
*/
|
212 |
-
public function check_theme_update( $transient_data ) {
|
213 |
-
global $pagenow;
|
214 |
-
|
215 |
-
if ( ! is_object( $transient_data ) ) {
|
216 |
-
$transient_data = new \stdClass;
|
217 |
-
}
|
218 |
-
|
219 |
-
if ( 'themes.php' == $pagenow && is_multisite() ) {
|
220 |
-
return $transient_data;
|
221 |
-
}
|
222 |
-
|
223 |
-
if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) {
|
224 |
-
return $transient_data;
|
225 |
-
}
|
226 |
-
|
227 |
-
$version_info = $this->get_cached_version_info();
|
228 |
-
|
229 |
-
if ( false === $version_info ) {
|
230 |
-
$version_info = $this->get_project_latest_version();
|
231 |
-
$this->set_cached_version_info( $version_info );
|
232 |
-
}
|
233 |
-
|
234 |
-
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
235 |
-
|
236 |
-
if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
|
237 |
-
$transient_data->response[ $this->client->slug ] = (array) $version_info;
|
238 |
-
}
|
239 |
-
|
240 |
-
$transient_data->last_checked = time();
|
241 |
-
$transient_data->checked[ $this->client->slug ] = $this->client->project_version;
|
242 |
-
}
|
243 |
-
|
244 |
-
return $transient_data;
|
245 |
-
}
|
246 |
-
|
247 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInita0c7397a05fd573f204a5ee4ef5b2ba6::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit889bffc89538a4a7e49ae15e865a6aeb
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInita0c7397a05fd573f204a5ee4ef5b2ba6
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInita0c7397a05fd573f204a5ee4ef5b2ba6', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInita0c7397a05fd573f204a5ee4ef5b2ba6', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInita0c7397a05fd573f204a5ee4ef5b2ba6::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
@@ -121,9 +121,9 @@ class ComposerStaticInit889bffc89538a4a7e49ae15e865a6aeb
|
|
121 |
public static function getInitializer(ClassLoader $loader)
|
122 |
{
|
123 |
return \Closure::bind(function () use ($loader) {
|
124 |
-
$loader->prefixLengthsPsr4 =
|
125 |
-
$loader->prefixDirsPsr4 =
|
126 |
-
$loader->classMap =
|
127 |
|
128 |
}, null, ClassLoader::class);
|
129 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInita0c7397a05fd573f204a5ee4ef5b2ba6
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'C' =>
|
121 |
public static function getInitializer(ClassLoader $loader)
|
122 |
{
|
123 |
return \Closure::bind(function () use ($loader) {
|
124 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInita0c7397a05fd573f204a5ee4ef5b2ba6::$prefixLengthsPsr4;
|
125 |
+
$loader->prefixDirsPsr4 = ComposerStaticInita0c7397a05fd573f204a5ee4ef5b2ba6::$prefixDirsPsr4;
|
126 |
+
$loader->classMap = ComposerStaticInita0c7397a05fd573f204a5ee4ef5b2ba6::$classMap;
|
127 |
|
128 |
}, null, ClassLoader::class);
|
129 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,48 +1,4 @@
|
|
1 |
[
|
2 |
-
{
|
3 |
-
"name": "appsero/client",
|
4 |
-
"version": "dev-master",
|
5 |
-
"version_normalized": "9999999-dev",
|
6 |
-
"source": {
|
7 |
-
"type": "git",
|
8 |
-
"url": "https://github.com/AppSero/client.git",
|
9 |
-
"reference": "0b40040a22c46a7e101dec09a886f551a02b8737"
|
10 |
-
},
|
11 |
-
"dist": {
|
12 |
-
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/AppSero/client/zipball/0b40040a22c46a7e101dec09a886f551a02b8737",
|
14 |
-
"reference": "0b40040a22c46a7e101dec09a886f551a02b8737",
|
15 |
-
"shasum": ""
|
16 |
-
},
|
17 |
-
"require": {
|
18 |
-
"php": ">=5.3"
|
19 |
-
},
|
20 |
-
"time": "2019-12-19T09:55:46+00:00",
|
21 |
-
"type": "library",
|
22 |
-
"installation-source": "dist",
|
23 |
-
"autoload": {
|
24 |
-
"psr-4": {
|
25 |
-
"Appsero\\": "src/"
|
26 |
-
}
|
27 |
-
},
|
28 |
-
"notification-url": "https://packagist.org/downloads/",
|
29 |
-
"license": [
|
30 |
-
"MIT"
|
31 |
-
],
|
32 |
-
"authors": [
|
33 |
-
{
|
34 |
-
"name": "Tareq Hasan",
|
35 |
-
"email": "tareq@appsero.com"
|
36 |
-
}
|
37 |
-
],
|
38 |
-
"description": "Appsero Client",
|
39 |
-
"keywords": [
|
40 |
-
"analytics",
|
41 |
-
"plugin",
|
42 |
-
"theme",
|
43 |
-
"wordpress"
|
44 |
-
]
|
45 |
-
},
|
46 |
{
|
47 |
"name": "composer/installers",
|
48 |
"version": "dev-master",
|
1 |
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
{
|
3 |
"name": "composer/installers",
|
4 |
"version": "dev-master",
|
wpuf-functions.php
CHANGED
@@ -2341,14 +2341,15 @@ function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpu
|
|
2341 |
];
|
2342 |
|
2343 |
$settings = [
|
2344 |
-
'role'
|
2345 |
-
'
|
2346 |
-
'message'
|
2347 |
-
'update_message'
|
2348 |
-
'
|
2349 |
-
'
|
2350 |
-
'
|
2351 |
-
'
|
|
|
2352 |
];
|
2353 |
}
|
2354 |
|
@@ -2975,9 +2976,7 @@ function wpuf_text( $args = [] ) {
|
|
2975 |
* @return void
|
2976 |
*/
|
2977 |
function wpuf_descriptive_text( $args ) {
|
2978 |
-
|
2979 |
-
|
2980 |
-
echo $html;
|
2981 |
}
|
2982 |
|
2983 |
/**
|
2341 |
];
|
2342 |
|
2343 |
$settings = [
|
2344 |
+
'role' => 'subscriber',
|
2345 |
+
'reg_redirect_to' => 'same',
|
2346 |
+
'message' => 'Registration successful',
|
2347 |
+
'update_message' => 'Profile updated successfully',
|
2348 |
+
'reg_page_id' => '0',
|
2349 |
+
'registration_url' => '',
|
2350 |
+
'profile_url' => '',
|
2351 |
+
'submit_text' => 'Register',
|
2352 |
+
'update_text' => 'Update Profile',
|
2353 |
];
|
2354 |
}
|
2355 |
|
2976 |
* @return void
|
2977 |
*/
|
2978 |
function wpuf_descriptive_text( $args ) {
|
2979 |
+
echo wp_kses_post( $args['desc'] );
|
|
|
|
|
2980 |
}
|
2981 |
|
2982 |
/**
|
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', __DIR__ );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|
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.16
|
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.16' );
|
16 |
define( 'WPUF_FILE', __FILE__ );
|
17 |
define( 'WPUF_ROOT', __DIR__ );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|