User registration & user profile – Profile Builder - Version 3.7.8

Version Description

  • Fix: issue regarding unique display names and email confirmation
  • Misc: improved description message for Redirect users to a page if they have empty required fields option
  • Changes regarding how paid version updates are handled
Download this release

Release Info

Developer raster02
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 3.7.8
Comparing to
See all releases

Code changes from version 3.7.7 to 3.7.8

admin/advanced-settings/includes/fields/unique-display-name.php CHANGED
@@ -27,7 +27,11 @@ function wppb_toolbox_unique_display_name_edit_profile( $message, $field, $reque
27
  add_filter( 'wppb_check_form_field_default-display-name-publicly-as', 'wppb_toolbox_unique_display_name_edit_profile', 20, 4 );
28
 
29
  function wppb_toolbox_unique_display_name_register( $display_name ){
30
- if ( isset( $_POST['action'] ) && $_POST['action'] === 'register' ) {
 
 
 
 
31
  if (isset($display_name)) {
32
  if (wppb_toolbox_unique_display_name_check($display_name)) {
33
  $i = 1;
27
  add_filter( 'wppb_check_form_field_default-display-name-publicly-as', 'wppb_toolbox_unique_display_name_edit_profile', 20, 4 );
28
 
29
  function wppb_toolbox_unique_display_name_register( $display_name ){
30
+ if ( isset( $_POST['action'] ) &&
31
+ ( ( $_POST['action'] === 'register' ) ||
32
+ ( isset( $_POST['todo'] ) && $_POST['action'] === 'wppb_handle_email_confirmation_cases' && $_POST['todo'] === 'confirm' )
33
+ )
34
+ ) {
35
  if (isset($display_name)) {
36
  if (wppb_toolbox_unique_display_name_check($display_name)) {
37
  $i = 1;
admin/advanced-settings/includes/views/view-fields.php CHANGED
@@ -93,6 +93,9 @@
93
  <li class="description">
94
  <?php esc_html_e( 'For example, you can redirect these users to the Edit Profile form so they can add the missing info.', 'profile-builder' ); ?>
95
  </li>
 
 
 
96
  </ul>
97
  </td>
98
  </tr>
93
  <li class="description">
94
  <?php esc_html_e( 'For example, you can redirect these users to the Edit Profile form so they can add the missing info.', 'profile-builder' ); ?>
95
  </li>
96
+ <li class="description">
97
+ <?php esc_html_e( 'This option will not work if you have conditional logic implemented in the form.', 'profile-builder' ); ?>
98
+ </li>
99
  </ul>
100
  </td>
101
  </tr>
admin/register-version.php CHANGED
@@ -31,136 +31,99 @@ if( !is_multisite() ){
31
  * @return string
32
  */
33
  function wppb_register_your_version_content() {
34
-
35
  ?>
36
  <div class="wrap wppb-wrap">
37
- <?php
38
- $versions = array( 'Profile Builder Pro', 'Profile Builder Elite', 'Profile Builder Unlimited', 'Profile Builder Dev' );
39
-
40
- if( in_array( PROFILE_BUILDER, $versions ) ) {
41
- wppb_serial_form('pro');
42
- } elseif ( PROFILE_BUILDER == 'Profile Builder Hobbyist' || PROFILE_BUILDER == 'Profile Builder Basic' ){
43
- wppb_serial_form('hobbyist');
44
- }
45
- ?>
46
-
47
  </div>
48
  <?php
49
  }
50
 
51
  /**
52
- * Function that creates the "Register your version" form depending on Pro or Hobbyist version
53
  *
54
  * @since v.2.0
55
  *
56
  * @return void
57
  */
58
- function wppb_serial_form($version){
 
 
59
  ?>
 
 
60
 
61
- <h2><?php printf( esc_html__( "Register your version of %s", 'profile-builder' ), esc_html( PROFILE_BUILDER ) ); ?></h2>
62
-
63
- <form method="post" action="<?php echo esc_url( get_admin_url( 1, 'options.php' ) ) ?>">
64
-
65
- <?php $wppb_profile_builder_serial = get_option( 'wppb_profile_builder_'.$version.'_serial' ); ?>
66
- <?php $wppb_profile_builder_serial_status = get_option( 'wppb_profile_builder_'.$version.'_serial_status' ); ?>
67
- <?php settings_fields( 'wppb_profile_builder_'.$version.'_serial' ); ?>
68
-
69
- <p><?php printf( esc_html__( "Now that you acquired a copy of %s, you should take the time and register it with the serial number you received", 'profile-builder'), esc_html( PROFILE_BUILDER ));?></p>
70
- <p><?php esc_html_e( "If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support.", 'profile-builder' );?></p>
71
- <p class="wppb-serial-wrap">
72
- <label for="wppb_profile_builder_<?php echo esc_attr( $version ); ?>_serial"><?php esc_html_e(' Serial Number:', 'profile-builder' );?></label>
73
- <input type="password" size="50" name="wppb_profile_builder_<?php echo esc_attr( $version ); ?>_serial" id="wppb_profile_builder_<?php echo esc_attr( $version ); ?>_serial" class="regular-text" <?php if ( $wppb_profile_builder_serial != ''){ echo ' value="'.esc_attr( $wppb_profile_builder_serial ).'"';} ?>/>
74
-
75
- <?php
76
- if( $wppb_profile_builder_serial_status == 'found' )
77
- echo '<span class="validateStatus"><img src="'.esc_url( WPPB_PLUGIN_URL ).'/assets/images/accept.png" title="'.esc_html__( 'The serial number was successfully validated!', 'profile-builder' ).'"/></span>';
78
- elseif ( $wppb_profile_builder_serial_status == 'notFound' )
79
- echo '<span class="validateStatus"><img src="'.esc_url( WPPB_PLUGIN_URL ).'/assets/images/icon_error.png" title="'.esc_html__( 'The serial number entered couldn\'t be validated!','profile-builder' ).'"/></span>';
80
- elseif ( strpos( $wppb_profile_builder_serial_status, 'aboutToExpire') !== false )//instead of aboutToExpire if the client has autobbiling on then he will receive 'found' instead
81
- echo '<span class="validateStatus"><img src="' . esc_url( WPPB_PLUGIN_URL ) . '/assets/images/icon_error.png" title="' . esc_html__('The serial number is about to expire soon!', 'profile-builder') . '"/>'. sprintf( esc_html__(' Your serial number is about to expire, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
82
- elseif ( $wppb_profile_builder_serial_status == 'expired' )
83
- echo '<span class="validateStatus"><img src="'.esc_url( WPPB_PLUGIN_URL ).'/assets/images/icon_error.png" title="'.esc_html__( 'The serial number couldn\'t be validated because it expired!','profile-builder' ).'"/>'. sprintf( esc_html__(' Your serial number is expired, please %1$s Renew Your License%2$s.','profile-builder'), "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' >", "</a>").'</span>';
84
- elseif ( $wppb_profile_builder_serial_status == 'serverDown' )
85
- echo '<span class="validateStatus"><img src="'.esc_url( WPPB_PLUGIN_URL ).'/assets/images/icon_error.png" title="'.esc_html__( 'The serial number couldn\'t be validated because process timed out. This is possible due to the server being down. Please try again later!','profile-builder' ).'"/></span>';
86
- ?>
87
- <span class="wppb-serialnumber-descr"><?php esc_html_e( '(e.g. CLPB-15-SN-253a55baa4fbe7bf595b2aabb8d72985)', 'profile-builder' );?></span>
88
- </p>
89
-
90
-
91
- <div id="wppb_submit_button_div">
92
- <input type="hidden" name="action" value="update" />
93
- <p class="submit">
94
- <?php wp_nonce_field( 'wppb_register_version_nonce', 'wppb_register_version_nonce' ); ?>
95
- <input type="submit" name="wppb_serial_number_activate" class="button-primary" value="<?php esc_html_e( 'Save Changes', 'profile-builder' ) ?>" />
96
- </p>
97
- </div>
98
 
99
- </form>
100
- <?php
101
- }
102
 
 
 
 
103
 
104
- //the function to check the validity of the serial number and save a variable in the DB; purely visual
105
- function wppb_check_serial_number($oldVal, $newVal, $resetCron = false){
106
 
107
- $serial_number_set = $newVal;
 
 
108
 
109
- $response = wp_remote_get( 'http://updatemetadata.cozmoslabs.com/checkserial/?serialNumberSent='.$serial_number_set );
110
-
111
- $versions = array( 'Profile Builder Pro', 'Profile Builder Elite', 'Profile Builder Unlimited', 'Profile Builder Dev' );
112
 
113
- if( in_array( PROFILE_BUILDER, $versions ) ) {
114
- wppb_update_serial_status($response, 'pro');
 
 
115
 
116
- if( $resetCron === true )
117
- wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-pro-update" );
 
 
 
 
 
 
 
 
118
 
119
- } else {
120
- wppb_update_serial_status($response, 'hobbyist');
121
 
122
- if( $resetCron === true )
123
- wp_clear_scheduled_hook( "check_plugin_updates-profile-builder-hobbyist-update" );
124
- }
 
125
 
126
- $user_ID = get_current_user_id();
127
- delete_user_meta( $user_ID, 'wppb_dismiss_notification' );
128
 
129
- }
 
 
130
 
131
- add_action( 'update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
132
- add_action( 'update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
 
 
133
 
134
- add_action( 'add_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number', 10, 2 );
135
- add_action( 'add_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number', 10, 2 );
136
 
137
- /**
138
- * @param $response
139
- */
140
- function wppb_update_serial_status($response, $version)
141
- {
142
- if (is_wp_error($response)) {
143
- update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //server down
144
- } elseif ((trim($response['body']) != 'notFound') && (trim($response['body']) != 'found') && (trim($response['body']) != 'expired') && (strpos( $response['body'], 'aboutToExpire' ) === false)) {
145
- update_option('wppb_profile_builder_'.$version.'_serial_status', 'serverDown'); //unknown response parameter
146
- update_option('wppb_profile_builder_'.$version.'_serial', ''); //reset the entered password, since the user will need to try again later
147
-
148
- } else {
149
- update_option('wppb_profile_builder_'.$version.'_serial_status', trim($response['body'])); //either found, notFound or expired
150
- }
151
- }
152
 
153
- //the update didn't work when the old value = new value, so we need to apply a filter on get_option (that is run before update_option), that resets the old value
154
- function wppb_check_serial_number_fix($newvalue, $oldvalue){
155
 
156
- if ( $newvalue == $oldvalue )
157
- wppb_check_serial_number( $oldvalue, $newvalue, true );
158
 
159
- return $newvalue;
160
  }
161
- add_filter( 'pre_update_option_wppb_profile_builder_pro_serial', 'wppb_check_serial_number_fix', 10, 2 );
162
- add_filter( 'pre_update_option_wppb_profile_builder_hobbyist_serial', 'wppb_check_serial_number_fix', 10, 2 );
163
 
 
 
 
 
 
 
164
 
165
  /**
166
  * Class that adds a notice when either the serial number wasn't found, or it has expired
@@ -238,7 +201,6 @@ class WPPB_add_notices{
238
  }
239
  }
240
 
241
-
242
  if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
243
 
244
  // Switch to the main site
@@ -246,39 +208,43 @@ if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
246
  && function_exists( 'get_main_site_id' ))
247
  switch_to_blog( get_main_site_id() );
248
 
249
- if ( file_exists(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php') ){
250
- $wppb_profile_builder_pro_hobbyist_serial_status = get_option('wppb_profile_builder_pro_serial');
251
- $version = 'pro';
252
- } else {
253
- $wppb_profile_builder_pro_hobbyist_serial_status = get_option('wppb_profile_builder_hobbyist_serial');
254
- $version = 'hobbyist';
255
- }
256
 
257
  if( is_multisite() && function_exists( 'restore_current_blog' ) )
258
  restore_current_blog();
259
 
260
- if ( $wppb_profile_builder_pro_hobbyist_serial_status == 'notFound' || $wppb_profile_builder_pro_hobbyist_serial_status == 'empty' ){
 
261
  if( !is_multisite() )
262
  $register_url = 'admin.php?page=profile-builder-register';
263
  else
264
  $register_url = network_admin_url( 'admin.php?page=profile-builder-register' );
265
 
266
- new WPPB_add_notices( 'wppb', 'profile_builder_pro', sprintf( '<p>' . __( 'Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s', 'profile-builder') . '</p>', "<a href='". esc_url( $register_url ) ."'>", "</a>", "<a href='https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-SN-Purchase' target='_blank' class='button-primary'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
 
267
  }
268
- elseif ( $wppb_profile_builder_pro_hobbyist_serial_status == 'expired' ){
269
- /* on our plugin pages do not add the dismiss button for the expired notification*/
270
- $notification_instance = WPPB_Plugin_Notifications::get_instance();
271
- if( $notification_instance->is_plugin_page() )
272
- $message = '<p>' . __( 'Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s', 'profile-builder') . '</p>';
273
- else
274
- $message = '<p>' . __( 'Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s', 'profile-builder') . '</p>';
275
-
276
- new WPPB_add_notices( 'wppb_expired', 'profile_builder_pro', sprintf( $message, "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", "<a href='". esc_url( add_query_arg( 'wppb_expired_dismiss_notification', '0' ) ) ."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
277
  }
278
- elseif( strpos( $wppb_profile_builder_pro_hobbyist_serial_status, 'aboutToExpire' ) === 0 ){
279
- $serial_status_parts = explode( '#', $wppb_profile_builder_pro_hobbyist_serial_status );
280
- $date = $serial_status_parts[1];
281
- new WPPB_add_notices( 'wppb_about_to_expire', 'profile_builder_pro', sprintf( '<p>' . __( 'Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s', 'profile-builder') . '</p>', "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", $date, "<a href='". esc_url( add_query_arg( 'wppb_about_to_expire_dismiss_notification', '0' ) )."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_profile_builder_pro_serial_status' );
 
 
 
 
 
 
 
282
  }
283
 
284
  }
31
  * @return string
32
  */
33
  function wppb_register_your_version_content() {
 
34
  ?>
35
  <div class="wrap wppb-wrap">
36
+ <?php wppb_serial_form(); ?>
 
 
 
 
 
 
 
 
 
37
  </div>
38
  <?php
39
  }
40
 
41
  /**
42
+ * Function that creates the "Register your version" form
43
  *
44
  * @since v.2.0
45
  *
46
  * @return void
47
  */
48
+ function wppb_serial_form(){
49
+ $status = wppb_get_serial_number_status();
50
+ $license = wppb_get_serial_number();
51
  ?>
52
+ <div id="wppb-register-version-page" class="wrap">
53
+ <h2><?php esc_html_e( "Register your version of Profile Builder", 'profile-builder' ); ?></h2>
54
 
55
+ <p><?php esc_html_e( 'Now that you acquired a copy of Profile Builder Pro, you should take the time and register it with the serial number you received.', 'profile-builder' ) ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ <p><?php esc_html_e( 'If you register this version of Profile Builder, you\'ll receive information regarding upgrades, patches, and technical support.', 'profile-builder' ) ?></p>
 
 
58
 
59
+ <div class="wppb-serial-wrap">
60
+ <form method="post" action="options.php">
61
+ <?php settings_fields( 'wppb_license_key' ); ?>
62
 
63
+ <label for="wppb_license_key"><?php esc_html_e( 'License key', 'profile-builder' ); ?></label>
 
64
 
65
+ <div class="wppb-serial-wrap__holder">
66
+ <input id="wppb_license_key" name="wppb_license_key" type="password" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
67
+ <?php wp_nonce_field( 'wppb_license_nonce', 'wppb_license_nonce' ); ?>
68
 
69
+ <?php if( $status !== false && $status == 'valid' ) {
70
+ $button_name = 'wppb_edd_license_deactivate';
71
+ $button_value = __('Deactivate License', 'profile-builder' );
72
 
73
+ if( empty( $details['invalid'] ) )
74
+ echo '<span title="'. esc_html__( 'Active on this site', 'profile-builder' ) .'" class="wppb-active-license dashicons dashicons-yes"></span>';
75
+ else
76
+ echo '<span title="'. esc_html__( 'Your license is invalid', 'profile-builder' ) .'" class="wppb-invalid-license dashicons dashicons-warning"></span>';
77
 
78
+ } else {
79
+ $button_name = 'wppb_edd_license_activate';
80
+ $button_value = __('Activate License', 'profile-builder');
81
+ }
82
+ ?>
83
+ <input type="submit" class="button-secondary" name="<?php echo esc_attr( $button_name ); ?>" value="<?php echo esc_attr( $button_value ); ?>"/>
84
+ </div>
85
+ </form>
86
+ </div>
87
+ </div>
88
 
89
+ <?php
90
+ }
91
 
92
+ /**
93
+ * Retrieve saved license key
94
+ */
95
+ function wppb_get_serial_number(){
96
 
97
+ $license = get_option( 'wppb_license_key', false );
 
98
 
99
+ // try to grab the license from the old options if it's not available
100
+ if( empty( $license ) ){
101
+ $versions = array( 'Profile Builder Pro', 'Profile Builder Elite', 'Profile Builder Unlimited', 'Profile Builder Dev' );
102
 
103
+ if( in_array( PROFILE_BUILDER, $versions ) )
104
+ $version = 'pro';
105
+ elseif ( PROFILE_BUILDER == 'Profile Builder Hobbyist' || PROFILE_BUILDER == 'Profile Builder Basic' )
106
+ $version = 'hobbyist';
107
 
108
+ $old_license = get_option( 'wppb_profile_builder_'.$version.'_serial' );
 
109
 
110
+ if( !empty( $old_license ) ){
111
+ update_option( 'wppb_license_key', $old_license );
112
+ $license = $old_license;
113
+ }
 
 
 
 
 
 
 
 
 
 
 
114
 
115
+ }
 
116
 
117
+ return $license;
 
118
 
 
119
  }
 
 
120
 
121
+ /**
122
+ * Retrieve license key status
123
+ */
124
+ function wppb_get_serial_number_status(){
125
+ return get_option( 'wppb_license_status' );
126
+ }
127
 
128
  /**
129
  * Class that adds a notice when either the serial number wasn't found, or it has expired
201
  }
202
  }
203
 
 
204
  if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
205
 
206
  // Switch to the main site
208
  && function_exists( 'get_main_site_id' ))
209
  switch_to_blog( get_main_site_id() );
210
 
211
+ $wppb_serial_number = wppb_get_serial_number();
212
+ $wppb_serial_status = wppb_get_serial_number_status();
 
 
 
 
 
213
 
214
  if( is_multisite() && function_exists( 'restore_current_blog' ) )
215
  restore_current_blog();
216
 
217
+ if( empty( $wppb_serial_number ) || $wppb_serial_status == 'missing' ) {
218
+
219
  if( !is_multisite() )
220
  $register_url = 'admin.php?page=profile-builder-register';
221
  else
222
  $register_url = network_admin_url( 'admin.php?page=profile-builder-register' );
223
 
224
+ new WPPB_add_notices( 'wppb', 'profile_builder_pro', sprintf( '<p>' . __( 'Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s', 'profile-builder') . '</p>', "<a href='". esc_url( $register_url ) ."'>", "</a>", "<a href='https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-SN-Purchase' target='_blank' class='button-primary'>", "</a>" ), 'wppb_license_status' );
225
+
226
  }
227
+ elseif ( $wppb_serial_status == 'expired' ){
228
+ /* on our plugin pages do not add the dismiss button for the expired notification*/
229
+ $notification_instance = WPPB_Plugin_Notifications::get_instance();
230
+ if( $notification_instance->is_plugin_page() )
231
+ $message = '<p>' . __( 'Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s', 'profile-builder') . '</p>';
232
+ else
233
+ $message = '<p>' . __( 'Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s', 'profile-builder') . '</p>';
234
+
235
+ new WPPB_add_notices( 'wppb_expired', 'profile_builder_pro', sprintf( $message, "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", "<a href='". esc_url( add_query_arg( 'wppb_expired_dismiss_notification', '0' ) ) ."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_license_status' );
236
  }
237
+ else {
238
+ // Maybe add about to expire notice
239
+ $license_details = get_option( 'wppb_license_details', false );
240
+
241
+ if( !empty( $license_details ) && !empty( $license_details->expires ) ){
242
+
243
+ if( strtotime( $license_details->expires ) < strtotime( '+14 days' ) ){
244
+ new WPPB_add_notices( 'wppb_about_to_expire', 'profile_builder_pro', sprintf( '<p>' . __( 'Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s', 'profile-builder') . '</p>', "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank'>", "</a>", "<a href='https://www.cozmoslabs.com/account/?utm_source=PB&utm_medium=dashboard&utm_campaign=PB-Renewal' target='_blank' class='button-primary'>", "</a>", date_i18n( get_option( 'date_format' ), strtotime( $license_details->expires ) ), "<a href='". esc_url( add_query_arg( 'wppb_about_to_expire_dismiss_notification', '0' ) )."' class='wppb-dismiss-notification'>", "</a>" ), 'wppb_license_status' );
245
+ }
246
+ }
247
+
248
  }
249
 
250
  }
assets/css/style-back-end.css CHANGED
@@ -433,23 +433,28 @@
433
  display:none;
434
  }
435
 
436
- .wppb-wrap #serial_number{
437
- font-weight: 600;
438
- line-height: 1.3;
439
- padding: 20px 10px 20px 0;
440
- text-align: left;
441
- color: #222222;
442
- font-size:14px;
443
  }
444
 
445
- #wppb_profile_builder_pro_serial{
446
- width:460px;
447
- padding: 5px;
448
  }
449
 
450
- .wppb-wrap .wppb-serialnumber-descr{
451
- display: block;
452
- padding: 0px 0px 0px 95px
 
 
 
 
 
 
 
 
 
453
  }
454
 
455
  .wppb-backend-notice{
433
  display:none;
434
  }
435
 
436
+ .wppb-serial-wrap form, .wppb-serial-wrap__holder {
437
+ display: flex;
438
+ align-items: center;
 
 
 
 
439
  }
440
 
441
+ .wppb-serial-wrap label {
442
+ margin-right: 12px;
443
+ font-weight: bold;
444
  }
445
 
446
+ .wppb-serial-wrap input {
447
+ margin-right: 8px;
448
+ }
449
+
450
+ .wppb-active-license {
451
+ margin-right: 8px;
452
+ color: #008000;
453
+ }
454
+
455
+ .wppb-invalid-license {
456
+ margin-right: 8px;
457
+ color: #ca4a1f;
458
  }
459
 
460
  .wppb-backend-notice{
index.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Profile Builder
4
  * Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  * Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
- * Version: 3.7.7
7
  * Author: Cozmoslabs
8
  * Author URI: https://www.cozmoslabs.com/
9
  * Text Domain: profile-builder
@@ -134,8 +134,8 @@ function wppb_plugin_init() {
134
  new WPPB_Two_Factor_Authenticator();
135
  }
136
 
137
- if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
138
- include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
139
  include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
140
  }
141
 
@@ -307,32 +307,48 @@ function wppb_plugin_init() {
307
 
308
 
309
  /**
310
- * Check for updates
311
- *
312
  *
313
  */
314
- if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php') ) {
315
 
316
- if ( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) )
317
- $localSerial = get_option('wppb_profile_builder_pro_serial');
318
- else
319
- $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
320
-
321
- if( PROFILE_BUILDER == 'Profile Builder Pro' )
322
- $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-pro-update');
323
- else if( PROFILE_BUILDER == 'Profile Builder Basic' )
324
- $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-hobbyist-update');
325
- else if( PROFILE_BUILDER == 'Profile Builder Elite' )
326
- $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBE', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-elite-update');
327
- else if( PROFILE_BUILDER == 'Profile Builder Unlimited' )
328
- $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBL', WPPB_PAID_PLUGIN_DIR . '/index.php', 'profile-builder-unlimited-update');
329
-
330
- function wppb_plugin_update_message( $plugin_data, $new_data ) {
331
 
332
- $wppb_version = file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ? 'pro' : 'hobbyist';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
- $wppb_profile_builder_serial = get_option( 'wppb_profile_builder_'.$wppb_version.'_serial' );
335
- $wppb_profile_builder_serial_status = get_option( 'wppb_profile_builder_'.$wppb_version.'_serial_status' );
336
 
337
  if( empty( $wppb_profile_builder_serial ) ){
338
 
@@ -362,7 +378,7 @@ add_action( 'plugins_loaded', 'wppb_plugin_init' );
362
  *
363
  *
364
  */
365
- define('PROFILE_BUILDER_VERSION', '3.7.7' );
366
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
367
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
368
  define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
3
  * Plugin Name: Profile Builder
4
  * Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5
  * Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
+ * Version: 3.7.8
7
  * Author: Cozmoslabs
8
  * Author URI: https://www.cozmoslabs.com/
9
  * Text Domain: profile-builder
134
  new WPPB_Two_Factor_Authenticator();
135
  }
136
 
137
+ if (file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php')) {
138
+ include_once(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php');
139
  include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
140
  }
141
 
307
 
308
 
309
  /**
310
+ * Add explanatory message on the plugins page when updates are not available
 
311
  *
312
  */
313
+ if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php') ) {
314
 
315
+ if ( class_exists('WPPB_EDD_SL_Plugin_Updater') ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
 
317
+ $serial = wppb_get_serial_number();
318
+
319
+ if( ! function_exists('get_plugin_data') ){
320
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
321
+ }
322
+
323
+ $plugin_data = get_plugin_data( WPPB_PAID_PLUGIN_DIR . '/index.php', false );
324
+ $pb_plugin_version = ( $plugin_data && $plugin_data['Version'] ) ? $plugin_data['Version'] : '3.7.6' ;
325
+
326
+ if( PROFILE_BUILDER == 'Profile Builder Pro' )
327
+ $pb_cl_plugin_id = '30695';
328
+ else if( PROFILE_BUILDER == 'Profile Builder Basic' )
329
+ $pb_cl_plugin_id = '30697';
330
+ else if( PROFILE_BUILDER == 'Profile Builder Elite' )
331
+ $pb_cl_plugin_id = '416191';
332
+ else if( PROFILE_BUILDER == 'Profile Builder Unlimited' )
333
+ $pb_cl_plugin_id = '30699';
334
+
335
+ // setup the updater
336
+ $wppb_edd_updater = new WPPB_EDD_SL_Plugin_Updater('https://cozmoslabs.com', WPPB_PAID_PLUGIN_DIR . '/index.php', array(
337
+ 'version' => $pb_plugin_version, // current version number
338
+ 'license' => $serial,
339
+ 'item_name' => PROFILE_BUILDER, // name of this plugin
340
+ 'item_id' => $pb_cl_plugin_id,
341
+ 'author' => 'Cozmoslabs', // author of this plugin
342
+ 'beta' => false
343
+ )
344
+ );
345
+
346
+ }
347
+
348
+ function wppb_plugin_update_message( $plugin_data, $new_data ) {
349
 
350
+ $wppb_profile_builder_serial = wppb_get_serial_number();
351
+ $wppb_profile_builder_serial_status = wppb_get_serial_number_status();
352
 
353
  if( empty( $wppb_profile_builder_serial ) ){
354
 
378
  *
379
  *
380
  */
381
+ define('PROFILE_BUILDER_VERSION', '3.7.8' );
382
  define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
383
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
384
  define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.cozmoslabs.com/wordpress-profile-builder/
4
  Tags: user registration, user profile, registration, profile, user registration form, user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
5
  Requires at least: 3.1
6
  Tested up to: 6.0
7
- Stable tag: 3.7.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -177,6 +177,11 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
177
  15. Edit or Add New User Role
178
 
179
  == Changelog ==
 
 
 
 
 
180
  = 3.7.7 =
181
  * Fix: fix some issues regarding the unique display name option
182
  * Fix: more multisite compatibility changes
4
  Tags: user registration, user profile, registration, profile, user registration form, user fields, edit profile, user custom fields, front-end login, front-end edit profile, front-end user registration, email confirmation, login form, content restriction, restrict content
5
  Requires at least: 3.1
6
  Tested up to: 6.0
7
+ Stable tag: 3.7.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
177
  15. Edit or Add New User Role
178
 
179
  == Changelog ==
180
+ = 3.7.8 =
181
+ * Fix: issue regarding unique display names and email confirmation
182
+ * Misc: improved description message for `Redirect users to a page if they have empty required fields` option
183
+ * Changes regarding how paid version updates are handled
184
+
185
  = 3.7.7 =
186
  * Fix: fix some issues regarding the unique display name option
187
  * Fix: more multisite compatibility changes
translation/profile-builder.catalog.php CHANGED
@@ -803,18 +803,14 @@
803
  <?php __("Profile Builder Register", "profile-builder"); ?>
804
  <?php __("Register Your Version", "profile-builder"); ?>
805
  <?php __("Register Version", "profile-builder"); ?>
806
- <?php __("Register your version of %s", "profile-builder"); ?>
807
- <?php __("Now that you acquired a copy of %s, you should take the time and register it with the serial number you received", "profile-builder"); ?>
808
  <?php __("If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support.", "profile-builder"); ?>
809
- <?php __(" Serial Number:", "profile-builder"); ?>
810
- <?php __("The serial number couldn't be validated because process timed out. This is possible due to the server being down. Please try again later!", "profile-builder"); ?>
811
- <?php __("The serial number couldn't be validated because it expired!", "profile-builder"); ?>
812
- <?php __(' Your serial number is expired, please %1$s Renew Your License%2$s.', 'profile-builder' ); ?>
813
- <?php __("The serial number is about to expire soon!", "profile-builder"); ?>
814
- <?php __(' Your serial number is about to expire, please %1$s Renew Your License%2$s.', 'profile-builder' ); ?>
815
- <?php __("The serial number entered couldn't be validated!", "profile-builder"); ?>
816
- <?php __("The serial number was successfully validated!", "profile-builder"); ?>
817
- <?php __("(e.g. CLPB-15-SN-253a55baa4fbe7bf595b2aabb8d72985)", "profile-builder"); ?>
818
  <?php __('Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s', 'profile-builder' ); ?>
819
  <?php __('Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s', 'profile-builder' ); ?>
820
  <?php __('Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s', 'profile-builder' ); ?>
@@ -1882,6 +1878,7 @@
1882
  <?php __("Redirect Page:", "profile-builder"); ?>
1883
  <?php __("By activating this option, logged in users which have empty required fields on their profile will be redirected to the page you added above.", "profile-builder"); ?>
1884
  <?php __("For example, you can redirect these users to the Edit Profile form so they can add the missing info.", "profile-builder"); ?>
 
1885
  <?php __("Ban certain words from being used in fields", "profile-builder"); ?>
1886
  <?php __("On", "profile-builder"); ?>
1887
  <?php __("Affected fields:", "profile-builder"); ?>
803
  <?php __("Profile Builder Register", "profile-builder"); ?>
804
  <?php __("Register Your Version", "profile-builder"); ?>
805
  <?php __("Register Version", "profile-builder"); ?>
806
+ <?php __("Register your version of Profile Builder", "profile-builder"); ?>
807
+ <?php __("Now that you acquired a copy of Profile Builder Pro, you should take the time and register it with the serial number you received.", "profile-builder"); ?>
808
  <?php __("If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support.", "profile-builder"); ?>
809
+ <?php __("License key", "profile-builder"); ?>
810
+ <?php __("Activate License", "profile-builder"); ?>
811
+ <?php __("Deactivate License", "profile-builder"); ?>
812
+ <?php __("Your license is invalid", "profile-builder"); ?>
813
+ <?php __("Active on this site", "profile-builder"); ?>
 
 
 
 
814
  <?php __('Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s', 'profile-builder' ); ?>
815
  <?php __('Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s', 'profile-builder' ); ?>
816
  <?php __('Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s', 'profile-builder' ); ?>
1878
  <?php __("Redirect Page:", "profile-builder"); ?>
1879
  <?php __("By activating this option, logged in users which have empty required fields on their profile will be redirected to the page you added above.", "profile-builder"); ?>
1880
  <?php __("For example, you can redirect these users to the Edit Profile form so they can add the missing info.", "profile-builder"); ?>
1881
+ <?php __("This option will not work if you have conditional logic implemented in the form.", "profile-builder"); ?>
1882
  <?php __("Ban certain words from being used in fields", "profile-builder"); ?>
1883
  <?php __("On", "profile-builder"); ?>
1884
  <?php __("Affected fields:", "profile-builder"); ?>
translation/profile-builder.pot CHANGED
@@ -13,11 +13,11 @@ msgstr ""
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
 
16
- #: index.php:343
17
  msgid "To enable updates, your licence needs to be renewed. Please go to the <a href=\"%s\">Cozmoslabs Account</a> page and login to renew."
18
  msgstr ""
19
 
20
- #: index.php:339
21
  msgid "To enable updates, please enter your serial number on the <a href=\"%s\">Register Version</a> page. If you don't have a serial number, please see <a href=\"%s\" target=\"_blank\">details & pricing</a>."
22
  msgstr ""
23
 
@@ -321,7 +321,7 @@ msgstr ""
321
  msgid "Hide"
322
  msgstr ""
323
 
324
- #: admin/admin-bar.php:92, admin/general-settings.php:348, admin/private-website.php:162, admin/register-version.php:95, features/functions.php:1045, add-ons-advanced/woocommerce/woosync-page.php:149, features/content-restriction/content-restriction.php:162, features/two-factor-authentication/class-two-factor-authentication.php:156, assets/lib/class-mustache-templates/class-mustache-templates.php:392, assets/lib/wck-api/wordpress-creation-kit.php:405, admin/advanced-settings/includes/views/view-admin.php:112, admin/advanced-settings/includes/views/view-fields.php:309, admin/advanced-settings/includes/views/view-forms.php:407, admin/advanced-settings/includes/views/view-shortcodes.php:77, admin/advanced-settings/includes/views/view-userlisting.php:91
325
  msgid "Save Changes"
326
  msgstr ""
327
 
@@ -781,7 +781,7 @@ msgstr ""
781
  msgid "Load Profile Builder's own CSS file in the front-end:"
782
  msgstr ""
783
 
784
- #: admin/general-settings.php:151, admin/general-settings.php:164, admin/general-settings.php:179, admin/general-settings.php:228, admin/general-settings.php:275, admin/manage-fields.php:193, admin/private-website.php:70, admin/private-website.php:137, admin/private-website.php:150, add-ons/multiple-forms/edit-profile-forms.php:206, add-ons/multiple-forms/register-forms.php:229, add-ons/multiple-forms/register-forms.php:230, add-ons/user-listing/userlisting.php:2598, add-ons-advanced/bbpress/bbpress-page.php:161, add-ons-advanced/social-connect/index.php:347, add-ons-advanced/social-connect/index.php:406, features/content-restriction/content-restriction.php:89, features/two-factor-authentication/class-two-factor-authentication.php:125, admin/advanced-settings/includes/forms/placeholder-labels.php:135, admin/advanced-settings/includes/views/view-admin.php:18, admin/advanced-settings/includes/views/view-admin.php:34, admin/advanced-settings/includes/views/view-admin.php:50, admin/advanced-settings/includes/views/view-admin.php:69, admin/advanced-settings/includes/views/view-admin.php:100, admin/advanced-settings/includes/views/view-fields.php:18, admin/advanced-settings/includes/views/view-fields.php:66, admin/advanced-settings/includes/views/view-fields.php:181, admin/advanced-settings/includes/views/view-fields.php:197, admin/advanced-settings/includes/views/view-fields.php:217, admin/advanced-settings/includes/views/view-fields.php:240, admin/advanced-settings/includes/views/view-fields.php:260, admin/advanced-settings/includes/views/view-fields.php:277, admin/advanced-settings/includes/views/view-fields.php:295, admin/advanced-settings/includes/views/view-forms.php:19, admin/advanced-settings/includes/views/view-forms.php:148, admin/advanced-settings/includes/views/view-forms.php:166, admin/advanced-settings/includes/views/view-forms.php:183, admin/advanced-settings/includes/views/view-forms.php:198, admin/advanced-settings/includes/views/view-forms.php:213, admin/advanced-settings/includes/views/view-forms.php:233, admin/advanced-settings/includes/views/view-forms.php:250, admin/advanced-settings/includes/views/view-forms.php:286, admin/advanced-settings/includes/views/view-forms.php:307, admin/advanced-settings/includes/views/view-forms.php:327, admin/advanced-settings/includes/views/view-forms.php:349, admin/advanced-settings/includes/views/view-forms.php:371, admin/advanced-settings/includes/views/view-forms.php:391, admin/advanced-settings/includes/views/view-shortcodes.php:16, admin/advanced-settings/includes/views/view-shortcodes.php:32, admin/advanced-settings/includes/views/view-shortcodes.php:48, admin/advanced-settings/includes/views/view-shortcodes.php:64, admin/advanced-settings/includes/views/view-userlisting.php:53, admin/advanced-settings/includes/views/view-userlisting.php:75, assets/misc/elementor/widgets/class-pb-widget-l.php:75, assets/misc/elementor/widgets/class-pb-widget-rf-epf.php:183, assets/misc/elementor/widgets/class-pb-widget-ul.php:109
785
  msgid "Yes"
786
  msgstr ""
787
 
@@ -865,7 +865,7 @@ msgstr ""
865
  msgid "Username and Email"
866
  msgstr ""
867
 
868
- #: admin/general-settings.php:304, admin/manage-fields.php:333, front-end/login.php:341, front-end/login.php:355, front-end/login.php:543, add-ons/custom-redirects/custom_redirects_admin.php:61, add-ons/email-customizer/email-customizer.php:28, add-ons/user-listing/userlisting.php:113, add-ons/user-listing/userlisting.php:336, add-ons/user-listing/userlisting.php:878, add-ons/user-listing/userlisting.php:2551, features/admin-approval/class-admin-approval.php:174, features/email-confirmation/class-email-confirmation.php:168, admin/advanced-settings/includes/views/view-fields.php:121
869
  msgid "Username"
870
  msgstr ""
871
 
@@ -1397,11 +1397,11 @@ msgstr ""
1397
  msgid "Usernames cannot be changed."
1398
  msgstr ""
1399
 
1400
- #: admin/manage-fields.php:334, add-ons/user-listing/userlisting.php:890, add-ons-advanced/woocommerce/billing-fields.php:6, add-ons-advanced/woocommerce/shipping-fields.php:6, admin/advanced-settings/includes/views/view-fields.php:127
1401
  msgid "First Name"
1402
  msgstr ""
1403
 
1404
- #: admin/manage-fields.php:335, add-ons/user-listing/userlisting.php:893, add-ons-advanced/woocommerce/billing-fields.php:7, add-ons-advanced/woocommerce/shipping-fields.php:7, admin/advanced-settings/includes/views/view-fields.php:133
1405
  msgid "Last Name"
1406
  msgstr ""
1407
 
@@ -3269,67 +3269,51 @@ msgstr ""
3269
  msgid "Register Version"
3270
  msgstr ""
3271
 
3272
- #: admin/register-version.php:61
3273
- msgid "Register your version of %s"
3274
  msgstr ""
3275
 
3276
- #: admin/register-version.php:69
3277
- msgid "Now that you acquired a copy of %s, you should take the time and register it with the serial number you received"
3278
  msgstr ""
3279
 
3280
- #: admin/register-version.php:70
3281
  msgid "If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support."
3282
  msgstr ""
3283
 
3284
- #: admin/register-version.php:72
3285
- msgid " Serial Number:"
3286
  msgstr ""
3287
 
3288
- #: admin/register-version.php:85
3289
- msgid "The serial number couldn't be validated because process timed out. This is possible due to the server being down. Please try again later!"
3290
  msgstr ""
3291
 
3292
- #: admin/register-version.php:83
3293
- msgid "The serial number couldn't be validated because it expired!"
3294
  msgstr ""
3295
 
3296
- #: admin/register-version.php:83
3297
- msgid " Your serial number is expired, please %1$s Renew Your License%2$s."
3298
  msgstr ""
3299
 
3300
- #: admin/register-version.php:81
3301
- msgid "The serial number is about to expire soon!"
3302
  msgstr ""
3303
 
3304
- #: admin/register-version.php:81
3305
- msgid " Your serial number is about to expire, please %1$s Renew Your License%2$s."
3306
- msgstr ""
3307
-
3308
- #: admin/register-version.php:79
3309
- msgid "The serial number entered couldn't be validated!"
3310
- msgstr ""
3311
-
3312
- #: admin/register-version.php:77
3313
- msgid "The serial number was successfully validated!"
3314
- msgstr ""
3315
-
3316
- #: admin/register-version.php:87
3317
- msgid "(e.g. CLPB-15-SN-253a55baa4fbe7bf595b2aabb8d72985)"
3318
- msgstr ""
3319
-
3320
- #: admin/register-version.php:281
3321
  msgid "Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s"
3322
  msgstr ""
3323
 
3324
- #: admin/register-version.php:274
3325
  msgid "Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s"
3326
  msgstr ""
3327
 
3328
- #: admin/register-version.php:272
3329
  msgid "Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
3330
  msgstr ""
3331
 
3332
- #: admin/register-version.php:266
3333
  msgid "Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
3334
  msgstr ""
3335
 
@@ -7659,91 +7643,95 @@ msgstr ""
7659
  msgid "For example, you can redirect these users to the Edit Profile form so they can add the missing info."
7660
  msgstr ""
7661
 
7662
- #: admin/advanced-settings/includes/views/view-fields.php:101
 
 
 
 
7663
  msgid "Ban certain words from being used in fields"
7664
  msgstr ""
7665
 
7666
- #: admin/advanced-settings/includes/views/view-fields.php:108, admin/advanced-settings/includes/views/view-forms.php:37
7667
  msgid "On"
7668
  msgstr ""
7669
 
7670
- #: admin/advanced-settings/includes/views/view-fields.php:116
7671
  msgid "Affected fields:"
7672
  msgstr ""
7673
 
7674
- #: admin/advanced-settings/includes/views/view-fields.php:140
7675
  msgid "Banned words:"
7676
  msgstr ""
7677
 
7678
- #: admin/advanced-settings/includes/views/view-fields.php:159, admin/advanced-settings/includes/views/view-forms.php:82
7679
  msgid "Error message:"
7680
  msgstr ""
7681
 
7682
- #: admin/advanced-settings/includes/views/view-fields.php:170
7683
  msgid "Allows you to define some words which users cannot use in their Username, First Name or Last Name when registering."
7684
  msgstr ""
7685
 
7686
- #: admin/advanced-settings/includes/views/view-fields.php:177
7687
  msgid "Unique 'Display Name' for users"
7688
  msgstr ""
7689
 
7690
- #: admin/advanced-settings/includes/views/view-fields.php:186
7691
  msgid "By checking this option, users will not be able to choose a <strong>Display Name</strong> that is already used by another account."
7692
  msgstr ""
7693
 
7694
- #: admin/advanced-settings/includes/views/view-fields.php:193
7695
  msgid "Always capitalize 'First Name' and 'Last Name' default fields"
7696
  msgstr ""
7697
 
7698
- #: admin/advanced-settings/includes/views/view-fields.php:202
7699
  msgid "If you have these fields in your forms, they will be always saved with the first letter as uppercase."
7700
  msgstr ""
7701
 
7702
- #: admin/advanced-settings/includes/views/view-fields.php:205
7703
  msgid "eg.: <strong>John Doe</strong> instead of <strong>john doe</strong>"
7704
  msgstr ""
7705
 
7706
- #: admin/advanced-settings/includes/views/view-fields.php:213
7707
  msgid "Datepicker starts on Monday"
7708
  msgstr ""
7709
 
7710
- #: admin/advanced-settings/includes/views/view-fields.php:222
7711
  msgid "Will make all Datepickers use Monday as the first day of the week."
7712
  msgstr ""
7713
 
7714
- #: admin/advanced-settings/includes/views/view-fields.php:236
7715
  msgid "Hide Repeater Fields from the back-end profile page"
7716
  msgstr ""
7717
 
7718
- #: admin/advanced-settings/includes/views/view-fields.php:245
7719
  msgid "Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option."
7720
  msgstr ""
7721
 
7722
- #: admin/advanced-settings/includes/views/view-fields.php:248
7723
  msgid "You will still be able to use them from a front-end edit profile form."
7724
  msgstr ""
7725
 
7726
- #: admin/advanced-settings/includes/views/view-fields.php:256
7727
  msgid "Show the Password field visibility toggle"
7728
  msgstr ""
7729
 
7730
- #: admin/advanced-settings/includes/views/view-fields.php:265
7731
  msgid "Activating this option will show a visibility toggle button for all Password fields."
7732
  msgstr ""
7733
 
7734
- #: admin/advanced-settings/includes/views/view-fields.php:273
7735
  msgid "Remove All Extra Fields from Backend edit profile page."
7736
  msgstr ""
7737
 
7738
- #: admin/advanced-settings/includes/views/view-fields.php:282
7739
  msgid "If you activate this option, it will remove all custom fields from the backend profile page created with Profile Builder."
7740
  msgstr ""
7741
 
7742
- #: admin/advanced-settings/includes/views/view-fields.php:291
7743
  msgid "Update database entries when changing meta key"
7744
  msgstr ""
7745
 
7746
- #: admin/advanced-settings/includes/views/view-fields.php:300
7747
  msgid "If you activate this option, when changing the meta key of a field, existing entries from the database will be updated as well."
7748
  msgstr ""
7749
 
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
 
16
+ #: index.php:359
17
  msgid "To enable updates, your licence needs to be renewed. Please go to the <a href=\"%s\">Cozmoslabs Account</a> page and login to renew."
18
  msgstr ""
19
 
20
+ #: index.php:355
21
  msgid "To enable updates, please enter your serial number on the <a href=\"%s\">Register Version</a> page. If you don't have a serial number, please see <a href=\"%s\" target=\"_blank\">details & pricing</a>."
22
  msgstr ""
23
 
321
  msgid "Hide"
322
  msgstr ""
323
 
324
+ #: admin/admin-bar.php:92, admin/general-settings.php:348, admin/private-website.php:162, features/functions.php:1045, add-ons-advanced/woocommerce/woosync-page.php:149, features/content-restriction/content-restriction.php:162, features/two-factor-authentication/class-two-factor-authentication.php:156, assets/lib/class-mustache-templates/class-mustache-templates.php:392, assets/lib/wck-api/wordpress-creation-kit.php:405, admin/advanced-settings/includes/views/view-admin.php:112, admin/advanced-settings/includes/views/view-fields.php:312, admin/advanced-settings/includes/views/view-forms.php:407, admin/advanced-settings/includes/views/view-shortcodes.php:77, admin/advanced-settings/includes/views/view-userlisting.php:91
325
  msgid "Save Changes"
326
  msgstr ""
327
 
781
  msgid "Load Profile Builder's own CSS file in the front-end:"
782
  msgstr ""
783
 
784
+ #: admin/general-settings.php:151, admin/general-settings.php:164, admin/general-settings.php:179, admin/general-settings.php:228, admin/general-settings.php:275, admin/manage-fields.php:193, admin/private-website.php:70, admin/private-website.php:137, admin/private-website.php:150, add-ons/multiple-forms/edit-profile-forms.php:206, add-ons/multiple-forms/register-forms.php:229, add-ons/multiple-forms/register-forms.php:230, add-ons/user-listing/userlisting.php:2598, add-ons-advanced/bbpress/bbpress-page.php:161, add-ons-advanced/social-connect/index.php:347, add-ons-advanced/social-connect/index.php:406, features/content-restriction/content-restriction.php:89, features/two-factor-authentication/class-two-factor-authentication.php:125, admin/advanced-settings/includes/forms/placeholder-labels.php:135, admin/advanced-settings/includes/views/view-admin.php:18, admin/advanced-settings/includes/views/view-admin.php:34, admin/advanced-settings/includes/views/view-admin.php:50, admin/advanced-settings/includes/views/view-admin.php:69, admin/advanced-settings/includes/views/view-admin.php:100, admin/advanced-settings/includes/views/view-fields.php:18, admin/advanced-settings/includes/views/view-fields.php:66, admin/advanced-settings/includes/views/view-fields.php:184, admin/advanced-settings/includes/views/view-fields.php:200, admin/advanced-settings/includes/views/view-fields.php:220, admin/advanced-settings/includes/views/view-fields.php:243, admin/advanced-settings/includes/views/view-fields.php:263, admin/advanced-settings/includes/views/view-fields.php:280, admin/advanced-settings/includes/views/view-fields.php:298, admin/advanced-settings/includes/views/view-forms.php:19, admin/advanced-settings/includes/views/view-forms.php:148, admin/advanced-settings/includes/views/view-forms.php:166, admin/advanced-settings/includes/views/view-forms.php:183, admin/advanced-settings/includes/views/view-forms.php:198, admin/advanced-settings/includes/views/view-forms.php:213, admin/advanced-settings/includes/views/view-forms.php:233, admin/advanced-settings/includes/views/view-forms.php:250, admin/advanced-settings/includes/views/view-forms.php:286, admin/advanced-settings/includes/views/view-forms.php:307, admin/advanced-settings/includes/views/view-forms.php:327, admin/advanced-settings/includes/views/view-forms.php:349, admin/advanced-settings/includes/views/view-forms.php:371, admin/advanced-settings/includes/views/view-forms.php:391, admin/advanced-settings/includes/views/view-shortcodes.php:16, admin/advanced-settings/includes/views/view-shortcodes.php:32, admin/advanced-settings/includes/views/view-shortcodes.php:48, admin/advanced-settings/includes/views/view-shortcodes.php:64, admin/advanced-settings/includes/views/view-userlisting.php:53, admin/advanced-settings/includes/views/view-userlisting.php:75, assets/misc/elementor/widgets/class-pb-widget-l.php:75, assets/misc/elementor/widgets/class-pb-widget-rf-epf.php:183, assets/misc/elementor/widgets/class-pb-widget-ul.php:109
785
  msgid "Yes"
786
  msgstr ""
787
 
865
  msgid "Username and Email"
866
  msgstr ""
867
 
868
+ #: admin/general-settings.php:304, admin/manage-fields.php:333, front-end/login.php:341, front-end/login.php:355, front-end/login.php:543, add-ons/custom-redirects/custom_redirects_admin.php:61, add-ons/email-customizer/email-customizer.php:28, add-ons/user-listing/userlisting.php:113, add-ons/user-listing/userlisting.php:336, add-ons/user-listing/userlisting.php:878, add-ons/user-listing/userlisting.php:2551, features/admin-approval/class-admin-approval.php:174, features/email-confirmation/class-email-confirmation.php:168, admin/advanced-settings/includes/views/view-fields.php:124
869
  msgid "Username"
870
  msgstr ""
871
 
1397
  msgid "Usernames cannot be changed."
1398
  msgstr ""
1399
 
1400
+ #: admin/manage-fields.php:334, add-ons/user-listing/userlisting.php:890, add-ons-advanced/woocommerce/billing-fields.php:6, add-ons-advanced/woocommerce/shipping-fields.php:6, admin/advanced-settings/includes/views/view-fields.php:130
1401
  msgid "First Name"
1402
  msgstr ""
1403
 
1404
+ #: admin/manage-fields.php:335, add-ons/user-listing/userlisting.php:893, add-ons-advanced/woocommerce/billing-fields.php:7, add-ons-advanced/woocommerce/shipping-fields.php:7, admin/advanced-settings/includes/views/view-fields.php:136
1405
  msgid "Last Name"
1406
  msgstr ""
1407
 
3269
  msgid "Register Version"
3270
  msgstr ""
3271
 
3272
+ #: admin/register-version.php:53
3273
+ msgid "Register your version of Profile Builder"
3274
  msgstr ""
3275
 
3276
+ #: admin/register-version.php:55
3277
+ msgid "Now that you acquired a copy of Profile Builder Pro, you should take the time and register it with the serial number you received."
3278
  msgstr ""
3279
 
3280
+ #: admin/register-version.php:57
3281
  msgid "If you register this version of Profile Builder, you'll receive information regarding upgrades, patches, and technical support."
3282
  msgstr ""
3283
 
3284
+ #: admin/register-version.php:63
3285
+ msgid "License key"
3286
  msgstr ""
3287
 
3288
+ #: admin/register-version.php:80
3289
+ msgid "Activate License"
3290
  msgstr ""
3291
 
3292
+ #: admin/register-version.php:71
3293
+ msgid "Deactivate License"
3294
  msgstr ""
3295
 
3296
+ #: admin/register-version.php:76
3297
+ msgid "Your license is invalid"
3298
  msgstr ""
3299
 
3300
+ #: admin/register-version.php:74
3301
+ msgid "Active on this site"
3302
  msgstr ""
3303
 
3304
+ #: admin/register-version.php:244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3305
  msgid "Your <strong>Profile Builder</strong> license is about to expire on %5$s. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %6$sDismiss%7$s"
3306
  msgstr ""
3307
 
3308
+ #: admin/register-version.php:233
3309
  msgid "Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s %5$sDismiss%6$s"
3310
  msgstr ""
3311
 
3312
+ #: admin/register-version.php:231
3313
  msgid "Your <strong>Profile Builder</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s"
3314
  msgstr ""
3315
 
3316
+ #: admin/register-version.php:224
3317
  msgid "Your <strong>Profile Builder</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s"
3318
  msgstr ""
3319
 
7643
  msgid "For example, you can redirect these users to the Edit Profile form so they can add the missing info."
7644
  msgstr ""
7645
 
7646
+ #: admin/advanced-settings/includes/views/view-fields.php:97
7647
+ msgid "This option will not work if you have conditional logic implemented in the form."
7648
+ msgstr ""
7649
+
7650
+ #: admin/advanced-settings/includes/views/view-fields.php:104
7651
  msgid "Ban certain words from being used in fields"
7652
  msgstr ""
7653
 
7654
+ #: admin/advanced-settings/includes/views/view-fields.php:111, admin/advanced-settings/includes/views/view-forms.php:37
7655
  msgid "On"
7656
  msgstr ""
7657
 
7658
+ #: admin/advanced-settings/includes/views/view-fields.php:119
7659
  msgid "Affected fields:"
7660
  msgstr ""
7661
 
7662
+ #: admin/advanced-settings/includes/views/view-fields.php:143
7663
  msgid "Banned words:"
7664
  msgstr ""
7665
 
7666
+ #: admin/advanced-settings/includes/views/view-fields.php:162, admin/advanced-settings/includes/views/view-forms.php:82
7667
  msgid "Error message:"
7668
  msgstr ""
7669
 
7670
+ #: admin/advanced-settings/includes/views/view-fields.php:173
7671
  msgid "Allows you to define some words which users cannot use in their Username, First Name or Last Name when registering."
7672
  msgstr ""
7673
 
7674
+ #: admin/advanced-settings/includes/views/view-fields.php:180
7675
  msgid "Unique 'Display Name' for users"
7676
  msgstr ""
7677
 
7678
+ #: admin/advanced-settings/includes/views/view-fields.php:189
7679
  msgid "By checking this option, users will not be able to choose a <strong>Display Name</strong> that is already used by another account."
7680
  msgstr ""
7681
 
7682
+ #: admin/advanced-settings/includes/views/view-fields.php:196
7683
  msgid "Always capitalize 'First Name' and 'Last Name' default fields"
7684
  msgstr ""
7685
 
7686
+ #: admin/advanced-settings/includes/views/view-fields.php:205
7687
  msgid "If you have these fields in your forms, they will be always saved with the first letter as uppercase."
7688
  msgstr ""
7689
 
7690
+ #: admin/advanced-settings/includes/views/view-fields.php:208
7691
  msgid "eg.: <strong>John Doe</strong> instead of <strong>john doe</strong>"
7692
  msgstr ""
7693
 
7694
+ #: admin/advanced-settings/includes/views/view-fields.php:216
7695
  msgid "Datepicker starts on Monday"
7696
  msgstr ""
7697
 
7698
+ #: admin/advanced-settings/includes/views/view-fields.php:225
7699
  msgid "Will make all Datepickers use Monday as the first day of the week."
7700
  msgstr ""
7701
 
7702
+ #: admin/advanced-settings/includes/views/view-fields.php:239
7703
  msgid "Hide Repeater Fields from the back-end profile page"
7704
  msgstr ""
7705
 
7706
+ #: admin/advanced-settings/includes/views/view-fields.php:248
7707
  msgid "Repeater Fields from Profile Builder do not work on the back-end user profile page, they are just displayed. If you want to remove them completely, you can use this option."
7708
  msgstr ""
7709
 
7710
+ #: admin/advanced-settings/includes/views/view-fields.php:251
7711
  msgid "You will still be able to use them from a front-end edit profile form."
7712
  msgstr ""
7713
 
7714
+ #: admin/advanced-settings/includes/views/view-fields.php:259
7715
  msgid "Show the Password field visibility toggle"
7716
  msgstr ""
7717
 
7718
+ #: admin/advanced-settings/includes/views/view-fields.php:268
7719
  msgid "Activating this option will show a visibility toggle button for all Password fields."
7720
  msgstr ""
7721
 
7722
+ #: admin/advanced-settings/includes/views/view-fields.php:276
7723
  msgid "Remove All Extra Fields from Backend edit profile page."
7724
  msgstr ""
7725
 
7726
+ #: admin/advanced-settings/includes/views/view-fields.php:285
7727
  msgid "If you activate this option, it will remove all custom fields from the backend profile page created with Profile Builder."
7728
  msgstr ""
7729
 
7730
+ #: admin/advanced-settings/includes/views/view-fields.php:294
7731
  msgid "Update database entries when changing meta key"
7732
  msgstr ""
7733
 
7734
+ #: admin/advanced-settings/includes/views/view-fields.php:303
7735
  msgid "If you activate this option, when changing the meta key of a field, existing entries from the database will be updated as well."
7736
  msgstr ""
7737
 
update/class-edd-sl-plugin-updater.php ADDED
@@ -0,0 +1,844 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Allows plugins to use their own update API.
8
+ *
9
+ * @author Easy Digital Downloads
10
+ * @version 1.6.13
11
+ */
12
+ if( !class_exists('WPPB_EDD_SL_Plugin_Updater') ) {
13
+ class WPPB_EDD_SL_Plugin_Updater {
14
+
15
+ private $api_url = '';
16
+ private $api_data = array();
17
+ private $name = '';
18
+ private $slug = '';
19
+ private $version = '';
20
+ private $wp_override = false;
21
+ private $cache_key = '';
22
+
23
+ /**
24
+ * Class constructor.
25
+ *
26
+ * @uses plugin_basename()
27
+ * @uses hook()
28
+ *
29
+ * @param string $_api_url The URL pointing to the custom API endpoint.
30
+ * @param string $_plugin_file Path to the plugin file.
31
+ * @param array $_api_data Optional data to send with API calls.
32
+ */
33
+ public function __construct($_api_url, $_plugin_file, $_api_data = null)
34
+ {
35
+
36
+ global $edd_plugin_data;
37
+
38
+ $this->api_url = trailingslashit($_api_url);
39
+ $this->api_data = $_api_data;
40
+ $this->name = plugin_basename($_plugin_file);
41
+ $this->slug = basename($_plugin_file, '.php');
42
+
43
+ // IMPORTANT TranslatePress modification.
44
+ // if ( $this->slug === 'index') {
45
+ // // $this->slug is the add-on file name. For Deepl and Translator accounts the file name is 'index' causing a conflict.
46
+ // $this->slug = dirname( plugin_basename( $_plugin_file ) );
47
+ // }
48
+ // end modification
49
+
50
+ $this->version = $_api_data['version'];
51
+ $this->wp_override = isset($_api_data['wp_override']) ? (bool)$_api_data['wp_override'] : false;
52
+ $this->beta = !empty($this->api_data['beta']) ? true : false;
53
+ $this->cache_key = md5(serialize($this->slug . $this->api_data['license'] . $this->beta));
54
+
55
+ $edd_plugin_data[$this->slug] = $this->api_data;
56
+
57
+ // Set up hooks.
58
+ $this->init();
59
+
60
+ }
61
+
62
+ /**
63
+ * Set up WordPress filters to hook into WP's update process.
64
+ *
65
+ * @uses add_filter()
66
+ *
67
+ * @return void
68
+ */
69
+ public function init()
70
+ {
71
+
72
+ add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
73
+ add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
74
+ remove_action('after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10);
75
+ add_action('after_plugin_row_' . $this->name, array($this, 'show_update_notification'), 10, 2);
76
+ add_action('admin_init', array($this, 'show_changelog'));
77
+
78
+ }
79
+
80
+ /**
81
+ * Check for Updates at the defined API endpoint and modify the update array.
82
+ *
83
+ * This function dives into the update API just when WordPress creates its update array,
84
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
85
+ * It is reassembled from parts of the native WordPress plugin update code.
86
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
87
+ *
88
+ * @uses api_request()
89
+ *
90
+ * @param array $_transient_data Update array build by WordPress.
91
+ * @return array Modified update array with custom plugin data.
92
+ */
93
+ public function check_update($_transient_data)
94
+ {
95
+
96
+ global $pagenow;
97
+
98
+ if (!is_object($_transient_data)) {
99
+ $_transient_data = new stdClass;
100
+ }
101
+
102
+ if ('plugins.php' == $pagenow && is_multisite()) {
103
+ return $_transient_data;
104
+ }
105
+
106
+ if (!empty($_transient_data->response) && !empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
107
+ return $_transient_data;
108
+ }
109
+
110
+ $version_info = $this->get_cached_version_info();
111
+
112
+ if (false === $version_info) {
113
+ $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
114
+
115
+ $this->set_version_info_cache($version_info);
116
+
117
+ }
118
+
119
+ if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
120
+
121
+ if (version_compare($this->version, $version_info->new_version, '<')) {
122
+
123
+ $_transient_data->response[$this->name] = $version_info;
124
+
125
+ }
126
+
127
+ $_transient_data->last_checked = current_time('timestamp');
128
+ $_transient_data->checked[$this->name] = $this->version;
129
+
130
+ }
131
+
132
+ return $_transient_data;
133
+ }
134
+
135
+ /**
136
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
137
+ *
138
+ * @param string $file
139
+ * @param array $plugin
140
+ */
141
+ public function show_update_notification($file, $plugin)
142
+ {
143
+
144
+ if (is_network_admin()) {
145
+ return;
146
+ }
147
+
148
+ if (!current_user_can('update_plugins')) {
149
+ return;
150
+ }
151
+
152
+ if (!is_multisite()) {
153
+ return;
154
+ }
155
+
156
+ if ($this->name != $file) {
157
+ return;
158
+ }
159
+
160
+ // Remove our filter on the site transient
161
+ remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
162
+
163
+ $update_cache = get_site_transient('update_plugins');
164
+
165
+ $update_cache = is_object($update_cache) ? $update_cache : new stdClass();
166
+
167
+ if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
168
+
169
+ $version_info = $this->get_cached_version_info();
170
+
171
+ if (false === $version_info) {
172
+ $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
173
+
174
+ $this->set_version_info_cache($version_info);
175
+ }
176
+
177
+ if (!is_object($version_info)) {
178
+ return;
179
+ }
180
+
181
+ if (version_compare($this->version, $version_info->new_version, '<')) {
182
+
183
+ $update_cache->response[$this->name] = $version_info;
184
+
185
+ }
186
+
187
+ $update_cache->last_checked = current_time('timestamp');
188
+ $update_cache->checked[$this->name] = $this->version;
189
+
190
+ set_site_transient('update_plugins', $update_cache);
191
+
192
+ } else {
193
+
194
+ $version_info = $update_cache->response[$this->name];
195
+
196
+ }
197
+
198
+ // Restore our filter
199
+ add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
200
+
201
+ if (!empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
202
+
203
+ // build a plugin list row, with update notification
204
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
205
+ # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
206
+ echo '<tr class="plugin-update-tr" id="' . esc_attr( $this->slug ) . '-update" data-slug="' . esc_attr( $this->slug ) . '" data-plugin="' . esc_attr( $this->slug ) . '/' . esc_attr( $file ) . '">';
207
+ echo '<td colspan="3" class="plugin-update colspanchange">';
208
+ echo '<div class="update-message notice inline notice-warning notice-alt">';
209
+
210
+ $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911');
211
+
212
+ if (empty($version_info->download_link)) {
213
+ printf(
214
+ __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'profile-builder'), //phpcs:ignore
215
+ esc_html($version_info->name),
216
+ '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
217
+ esc_html($version_info->new_version),
218
+ '</a>'
219
+ );
220
+ } else {
221
+ printf(
222
+ __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'profile-builder'), //phpcs:ignore
223
+ esc_html($version_info->name),
224
+ '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
225
+ esc_html($version_info->new_version),
226
+ '</a>',
227
+ '<a href="' . esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $this->name, 'upgrade-plugin_' . $this->name)) . '">',
228
+ '</a>'
229
+ );
230
+ }
231
+
232
+ do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
233
+
234
+ echo '</div></td></tr>';
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Updates information on the "View version x.x details" page with custom data.
240
+ *
241
+ * @uses api_request()
242
+ *
243
+ * @param mixed $_data
244
+ * @param string $_action
245
+ * @param object $_args
246
+ * @return object $_data
247
+ */
248
+ public function plugins_api_filter($_data, $_action = '', $_args = null)
249
+ {
250
+
251
+ if ($_action != 'plugin_information') {
252
+
253
+ return $_data;
254
+
255
+ }
256
+
257
+ if (!isset($_args->slug) || ($_args->slug != $this->slug)) {
258
+
259
+ return $_data;
260
+
261
+ }
262
+
263
+ $to_send = array(
264
+ 'slug' => $this->slug,
265
+ 'is_ssl' => is_ssl(),
266
+ 'fields' => array(
267
+ 'banners' => array(),
268
+ 'reviews' => false
269
+ )
270
+ );
271
+
272
+ $cache_key = 'edd_api_request_' . md5(serialize($this->slug . $this->api_data['license'] . $this->beta));
273
+
274
+ // Get the transient where we store the api request for this plugin for 24 hours
275
+ $edd_api_request_transient = $this->get_cached_version_info($cache_key);
276
+
277
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
278
+ if (empty($edd_api_request_transient)) {
279
+
280
+ $api_response = $this->api_request('plugin_information', $to_send);
281
+
282
+ // Expires in 3 hours
283
+ $this->set_version_info_cache($api_response, $cache_key);
284
+
285
+ if (false !== $api_response) {
286
+ $_data = $api_response;
287
+ }
288
+
289
+ } else {
290
+ $_data = $edd_api_request_transient;
291
+ }
292
+
293
+ // Convert sections into an associative array, since we're getting an object, but Core expects an array.
294
+ if (isset($_data->sections) && !is_array($_data->sections)) {
295
+ $new_sections = array();
296
+ foreach ($_data->sections as $key => $value) {
297
+ $new_sections[$key] = $value;
298
+ }
299
+
300
+ $_data->sections = $new_sections;
301
+ }
302
+
303
+ // Convert banners into an associative array, since we're getting an object, but Core expects an array.
304
+ if (isset($_data->banners) && !is_array($_data->banners)) {
305
+ $new_banners = array();
306
+ foreach ($_data->banners as $key => $value) {
307
+ $new_banners[$key] = $value;
308
+ }
309
+
310
+ $_data->banners = $new_banners;
311
+ }
312
+
313
+ return $_data;
314
+ }
315
+
316
+ /**
317
+ * Disable SSL verification in order to prevent download update failures
318
+ *
319
+ * @param array $args
320
+ * @param string $url
321
+ * @return object $array
322
+ */
323
+ public function http_request_args($args, $url)
324
+ {
325
+
326
+ $verify_ssl = $this->verify_ssl();
327
+ if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
328
+ $args['sslverify'] = $verify_ssl;
329
+ }
330
+ return $args;
331
+
332
+ }
333
+
334
+ /**
335
+ * Calls the API and, if successfull, returns the object delivered by the API.
336
+ *
337
+ * @uses get_bloginfo()
338
+ * @uses wp_remote_post()
339
+ * @uses is_wp_error()
340
+ *
341
+ * @param string $_action The requested action.
342
+ * @param array $_data Parameters for the API action.
343
+ * @return false|object
344
+ */
345
+ private function api_request($_action, $_data)
346
+ {
347
+
348
+ global $wp_version;
349
+
350
+ $data = array_merge($this->api_data, $_data);
351
+
352
+ if ($data['slug'] != $this->slug) {
353
+ return;
354
+ }
355
+
356
+ if ($this->api_url == trailingslashit(home_url())) {
357
+ return false; // Don't allow a plugin to ping itself
358
+ }
359
+
360
+ $api_params = array(
361
+ 'edd_action' => 'get_version',
362
+ 'license' => !empty($data['license']) ? $data['license'] : '',
363
+ 'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
364
+ 'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
365
+ 'version' => isset($data['version']) ? $data['version'] : false,
366
+ 'slug' => $data['slug'],
367
+ 'author' => $data['author'],
368
+ 'url' => home_url(),
369
+ 'beta' => !empty($data['beta']),
370
+ );
371
+
372
+ $verify_ssl = $this->verify_ssl();
373
+ $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
374
+
375
+ if (!is_wp_error($request)) {
376
+ $request = json_decode(wp_remote_retrieve_body($request));
377
+ }
378
+
379
+ if ($request && isset($request->sections)) {
380
+ $request->sections = maybe_unserialize($request->sections);
381
+ } else {
382
+ $request = false;
383
+ }
384
+
385
+ if ($request && isset($request->banners)) {
386
+ $request->banners = maybe_unserialize($request->banners);
387
+ }
388
+
389
+ if (!empty($request->sections)) {
390
+ foreach ($request->sections as $key => $section) {
391
+ $request->$key = (array)$section;
392
+ }
393
+ }
394
+
395
+ return $request;
396
+ }
397
+
398
+ public function show_changelog()
399
+ {
400
+
401
+ global $edd_plugin_data;
402
+
403
+ if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
404
+ return;
405
+ }
406
+
407
+ if (empty($_REQUEST['plugin'])) {
408
+ return;
409
+ }
410
+
411
+ if (empty($_REQUEST['slug'])) {
412
+ return;
413
+ }
414
+
415
+ if (!current_user_can('update_plugins')) {
416
+ wp_die( esc_html__('You do not have permission to install plugin updates', 'profile-builder'), esc_html__('Error', 'profile-builder'), array('response' => 403));
417
+ }
418
+
419
+ $data = $edd_plugin_data[sanitize_text_field( $_REQUEST['slug'] )];
420
+ $beta = !empty($data['beta']) ? true : false;
421
+ $cache_key = md5('edd_plugin_' . sanitize_key($_REQUEST['plugin']) . '_' . $beta . '_version_info');
422
+ $version_info = $this->get_cached_version_info($cache_key);
423
+
424
+ if (false === $version_info) {
425
+
426
+ $api_params = array(
427
+ 'edd_action' => 'get_version',
428
+ 'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
429
+ 'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
430
+ 'slug' => sanitize_text_field( $_REQUEST['slug'] ),
431
+ 'author' => $data['author'],
432
+ 'url' => home_url(),
433
+ 'beta' => !empty($data['beta'])
434
+ );
435
+
436
+ $verify_ssl = $this->verify_ssl();
437
+ $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
438
+
439
+ if (!is_wp_error($request)) {
440
+ $version_info = json_decode(wp_remote_retrieve_body($request));
441
+ }
442
+
443
+
444
+ if (!empty($version_info) && isset($version_info->sections)) {
445
+ $version_info->sections = maybe_unserialize($version_info->sections);
446
+ } else {
447
+ $version_info = false;
448
+ }
449
+
450
+ if (!empty($version_info)) {
451
+ foreach ($version_info->sections as $key => $section) {
452
+ $version_info->$key = (array)$section;
453
+ }
454
+ }
455
+
456
+ $this->set_version_info_cache($version_info, $cache_key);
457
+
458
+ }
459
+
460
+ if (!empty($version_info) && isset($version_info->sections['changelog'])) {
461
+ echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $version_info->sections['changelog'] ) . '</div>';
462
+ }
463
+
464
+ exit;
465
+ }
466
+
467
+ public function get_cached_version_info($cache_key = '')
468
+ {
469
+
470
+ if (empty($cache_key)) {
471
+ $cache_key = $this->cache_key;
472
+ }
473
+
474
+ $cache = get_option($cache_key);
475
+
476
+ if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) {
477
+ return false; // Cache is expired
478
+ }
479
+
480
+ return json_decode($cache['value']);
481
+
482
+ }
483
+
484
+ public function set_version_info_cache($value = '', $cache_key = '')
485
+ {
486
+
487
+ if (empty($cache_key)) {
488
+ $cache_key = $this->cache_key;
489
+ }
490
+
491
+ $data = array(
492
+ 'timeout' => strtotime('+3 hours', current_time('timestamp')),
493
+ 'value' => json_encode($value)
494
+ );
495
+
496
+ update_option($cache_key, $data);
497
+
498
+ }
499
+
500
+ /**
501
+ * Returns if the SSL of the store should be verified.
502
+ *
503
+ * @since 1.6.13
504
+ * @return bool
505
+ */
506
+ private function verify_ssl()
507
+ {
508
+ return (bool)apply_filters('edd_sl_api_request_verify_ssl', true, $this);
509
+ }
510
+
511
+ }
512
+ }
513
+
514
+ class WPPB_Plugin_Updater {
515
+
516
+ private $store_url = "https://www.cozmoslabs.com";
517
+
518
+ public function __construct(){
519
+
520
+ if( defined( 'WPPB_PAID_PLUGIN_DIR' ) ){
521
+ add_action('admin_init', array( $this, 'activate_license' ) );
522
+ add_action('admin_init', array( $this, 'deactivate_license' ) );
523
+ add_action('admin_notices', array( $this, 'admin_activation_notices' ) );
524
+
525
+ add_filter('pre_set_site_transient_update_plugins', array( $this, 'check_license' ) );
526
+
527
+ // Activate current site if license is correct
528
+ add_action('admin_init', array( $this, 'initial_site_activation' ) );
529
+ }
530
+
531
+ }
532
+
533
+ protected function get_option( $license_key_option ){
534
+ return get_option( $license_key_option );
535
+ }
536
+
537
+ protected function delete_option( $license_key_option ){
538
+ delete_option( $license_key_option );
539
+ }
540
+
541
+ protected function update_option( $license_key_option, $value ){
542
+ update_option( $license_key_option, $value );
543
+ }
544
+
545
+ protected function license_page_url( ){
546
+ return admin_url( 'admin.php?page=profile-builder-register' );
547
+ }
548
+
549
+ public function edd_sanitize_license( $new ) {
550
+ $new = sanitize_text_field($new);
551
+ $old = wppb_get_serial_number();
552
+ if( $old && $old != $new ) {
553
+ $this->delete_option( 'wppb_license_status' ); // new license has been entered, so must reactivate
554
+ }
555
+ return $new;
556
+ }
557
+
558
+ /**
559
+ * This function is run when wordpress checks for updates ( twice a day I believe )
560
+ * @param $transient_data
561
+ * @return mixed
562
+ */
563
+ public function check_license( $transient_data ){
564
+
565
+ if( empty( $transient_data->response ) )
566
+ return $transient_data;
567
+
568
+ if ( false === ( $wppb_check_license = get_transient( 'wppb_checked_licence' ) ) ) {
569
+
570
+ $license = trim( wppb_get_serial_number() );
571
+ $license_details = array();
572
+
573
+ // data to send in our API request
574
+ $api_params = array(
575
+ 'edd_action' => 'activate_license', //as the license is already activated this does not do anything. We could use check_license action but it gives different results so we can't use it consistently with the result we get from the moment we activate it
576
+ 'license' => $license,
577
+ 'item_name' => urlencode( $this->get_edd_product_name() ), // the name of our product in EDD
578
+ 'url' => home_url()
579
+ );
580
+
581
+ // Call the custom API.
582
+ $response = wp_remote_post( $this->store_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
583
+
584
+ // make sure the response came back okay
585
+ if ( !is_wp_error($response) ) {
586
+
587
+ $license_data = json_decode(wp_remote_retrieve_body($response));
588
+
589
+ if ( false === $license_data->success )
590
+ $license_details = $license_data;
591
+ else
592
+ $license_details = $license_data;
593
+
594
+ }
595
+
596
+ $this->update_option('wppb_license_details', $license_details);
597
+
598
+ if( !$license ){
599
+ //we need to throw a notice if we have a pro addon active and no license entered
600
+ $license_details = (object) array( 'error' => 'missing' );
601
+ $this->update_option('wppb_license_details', $license_details);
602
+ }
603
+
604
+
605
+ set_transient( 'wppb_checked_licence', 'yes', DAY_IN_SECONDS );
606
+
607
+ }
608
+
609
+ return $transient_data;
610
+ }
611
+
612
+ public function admin_activation_notices() {
613
+ if ( isset( $_GET['wppb_sl_activation'] ) && ! empty( $_GET['message'] ) ) {
614
+
615
+ switch( $_GET['wppb_sl_activation'] ) {
616
+ case 'false':
617
+ $class ="error";
618
+ break;
619
+ case 'true':
620
+ default:
621
+ $class ="updated";
622
+ break;
623
+ }
624
+
625
+ ?>
626
+ <div class="<?php echo esc_attr( $class ); ?>">
627
+ <p><?php echo wp_kses_post( urldecode( $_GET['message'] ) );//phpcs:ignore ?></p>
628
+ </div>
629
+ <?php
630
+ }
631
+ }
632
+
633
+ public function activate_license() {
634
+
635
+ // listen for our activate button to be clicked
636
+ if( isset( $_POST['wppb_edd_license_activate'] ) ) {
637
+ // run a quick security check
638
+ if( ! check_admin_referer( 'wppb_license_nonce', 'wppb_license_nonce' ) )
639
+ return; // get out if we didn't click the Activate button
640
+
641
+
642
+ if ( isset( $_POST['wppb_license_key'] ) && preg_match('/^[*]+$/', $_POST['wppb_license_key']) && strlen( $_POST['wppb_license_key'] ) > 5 ) { //phpcs:ignore
643
+ // pressed submit without altering the existing license key (containing only * as outputted by default)
644
+ // useful for Deactivating/Activating valid license back
645
+ $license = wppb_get_serial_number();
646
+ } else {
647
+ // save the license
648
+ $license = $this->edd_sanitize_license( trim( $_POST['wppb_license_key'] ) );//phpcs:ignore
649
+ $this->update_option( 'wppb_license_key', $license );
650
+ }
651
+
652
+ $message = array();
653
+ $license_details = array();
654
+
655
+ // data to send in our API request
656
+ $api_params = array(
657
+ 'edd_action' => 'activate_license',
658
+ 'license' => $license,
659
+ 'item_name' => urlencode( $this->get_edd_product_name() ), // the name of our product in EDD
660
+ 'url' => home_url()
661
+ );
662
+
663
+ // Call the custom API.
664
+ $response = wp_remote_post( $this->store_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
665
+
666
+ // make sure the response came back okay
667
+ if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
668
+
669
+ $response_error_message = $response->get_error_message();
670
+ $message[] = ( is_wp_error( $response ) && ! empty( $response_error_message ) ) ? $response->get_error_message() : __( 'An error occurred, please try again.', 'profile-builder' );
671
+
672
+ } else {
673
+
674
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
675
+
676
+ if ( false === $license_data->success ) {
677
+
678
+ switch( $license_data->error ) {
679
+ case 'expired' :
680
+ $message[] = sprintf(
681
+ __( 'Your license key expired on %s.', 'profile-builder' ),
682
+ date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
683
+ );
684
+ break;
685
+ case 'revoked' :
686
+ $message[] = __( 'Your license key has been disabled.', 'profile-builder' );
687
+ break;
688
+ case 'missing' :
689
+ $message[] = __( 'Invalid license.', 'profile-builder' );
690
+ break;
691
+ case 'invalid' :
692
+ case 'site_inactive' :
693
+ $message[] = __( 'Your license is not active for this URL.', 'profile-builder' );
694
+ break;
695
+ case 'item_name_mismatch' :
696
+ $message[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'profile-builder' ), $this->get_edd_product_name() );
697
+ break;
698
+ case 'no_activations_left':
699
+ $message[] = __( 'Your license key has reached its activation limit.', 'profile-builder' );
700
+ break;
701
+ default :
702
+ $message[] = __( 'An error occurred, please try again.', 'profile-builder' );
703
+ break;
704
+ }
705
+
706
+ $license_details = $license_data;
707
+
708
+ } else {
709
+ $license_details = $license_data;
710
+ }
711
+
712
+ }
713
+
714
+ //store the license reponse for each addon in the database
715
+ $this->update_option( 'wppb_license_details', $license_details );
716
+
717
+
718
+ // Check if anything passed on a message constituting a failure
719
+ if ( ! empty( $message ) ) {
720
+ $message = implode( "<br/>", array_unique($message) );//if we got the same message for multiple addons show just one, and add a br in case we show multiple messages
721
+ $redirect = add_query_arg( array( 'wppb_sl_activation' => 'false', 'message' => urlencode( $message ) ), $this->license_page_url() );
722
+
723
+ $this->update_option( 'wppb_license_status', isset( $license_data->error ) ? $license_data->error : $license_data->license );
724
+
725
+ wp_redirect( $redirect );
726
+ exit();
727
+ }
728
+
729
+ // $license_data->license will be either "valid" or "invalid"
730
+ $this->update_option( 'wppb_license_status', isset( $license_data->error ) ? $license_data->error : $license_data->license );
731
+
732
+ wp_redirect( add_query_arg( array( 'wppb_sl_activation' => 'true', 'message' => urlencode( __( 'You have successfully activated your license.', 'profile-builder' ) ) ), $this->license_page_url() ) );
733
+ exit();
734
+ }
735
+ }
736
+
737
+
738
+ public function initial_site_activation(){
739
+
740
+ if( is_multisite() )
741
+ $edd_sl_initial_activation = get_network_option( null, 'wppb_edd_sl_initial_activation', false );
742
+ else
743
+ $edd_sl_initial_activation = get_option( 'wppb_edd_sl_initial_activation', false );
744
+
745
+ if( $edd_sl_initial_activation != false )
746
+ return;
747
+
748
+ $license = wppb_get_serial_number();
749
+
750
+ if( empty( $license ) )
751
+ return;
752
+
753
+ // data to send in our API request
754
+ $api_params = array(
755
+ 'edd_action' => 'activate_license',
756
+ 'license' => $license,
757
+ 'item_name' => urlencode( $this->get_edd_product_name() ), // the name of our product in EDD
758
+ 'url' => home_url()
759
+ );
760
+
761
+ // Call the custom API.
762
+ $response = wp_remote_post( $this->store_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
763
+
764
+ if ( !is_wp_error($response) ) {
765
+
766
+ $license_data = json_decode(wp_remote_retrieve_body($response));
767
+
768
+ if ( false === $license_data->success )
769
+ $license_details = $license_data;
770
+ else
771
+ $license_details = $license_data;
772
+
773
+ }
774
+
775
+ $this->update_option('wppb_license_details', $license_details);
776
+
777
+ if( is_multisite() )
778
+ update_network_option( null, 'wppb_edd_sl_initial_activation', 'yes' );
779
+ else
780
+ update_option( 'wppb_edd_sl_initial_activation', 'yes', false );
781
+
782
+ }
783
+
784
+ function deactivate_license() {
785
+
786
+ // listen for our activate button to be clicked
787
+ if( isset( $_POST['wppb_edd_license_deactivate'] ) ) {
788
+
789
+ // run a quick security check
790
+ if( ! check_admin_referer( 'wppb_license_nonce', 'wppb_license_nonce' ) )
791
+ return; // get out if we didn't click the Activate button
792
+
793
+ // retrieve the license from the database
794
+ $license = trim( wppb_get_serial_number() );
795
+
796
+ // data to send in our API request
797
+ $api_params = array(
798
+ 'edd_action' => 'deactivate_license',
799
+ 'license' => $license,
800
+ 'item_name' => urlencode( $this->get_edd_product_name() ), // the name of our product in EDD
801
+ 'url' => home_url()
802
+ );
803
+
804
+ // Call the custom API.
805
+ $response = wp_remote_post( $this->store_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
806
+
807
+ // make sure the response came back okay
808
+ if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
809
+
810
+ if ( is_wp_error( $response ) )
811
+ $message = $response->get_error_message();
812
+ else
813
+ $message = __( 'An error occurred, please try again.', 'profile-builder' );
814
+
815
+ wp_redirect( add_query_arg( array( 'wppb_sl_activation' => 'false', 'message' => urlencode( $message ) ), $this->license_page_url() ) );
816
+ exit();
817
+ }
818
+
819
+ // decode the license data
820
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
821
+
822
+ // $license_data->license will be either "deactivated" or "failed"
823
+ // regardless, we delete the record in the client website. Otherwise, if he tries to add a new license, he can't.
824
+ if( $license_data->license == 'deactivated' || $license_data->license == 'failed'){
825
+ delete_option( 'wppb_license_status' );
826
+ delete_option( 'wppb_license_details' );
827
+ }
828
+
829
+ wp_redirect( $this->license_page_url() );
830
+ exit();
831
+
832
+ }
833
+
834
+ }
835
+
836
+ function get_edd_product_name(){
837
+
838
+ return PROFILE_BUILDER;
839
+
840
+ }
841
+
842
+ }
843
+
844
+ new WPPB_Plugin_Updater();
update/update-checker.php DELETED
@@ -1,516 +0,0 @@
1
- <?php
2
- if ( !class_exists( 'wppb_PluginUpdateChecker' ) ):
3
-
4
- /**
5
- * A custom plugin update checker.
6
- *
7
- * @author Janis Elsts
8
- * @copyright 2010
9
- * @version 1.0
10
- * @access public
11
- */
12
- class wppb_PluginUpdateChecker {
13
- public $metadataUrl = ''; //The URL of the plugin's metadata file.
14
- public $pluginFile = ''; //Plugin filename relative to the plugins directory.
15
- public $slug = ''; //Plugin slug.
16
- public $checkPeriod = 12; //How often to check for updates (in hours).
17
- public $optionName = ''; //Where to store the update info.
18
-
19
- /**
20
- * Class constructor.
21
- *
22
- * @param string $metadataUrl The URL of the plugin's metadata file.
23
- * @param string $pluginFile Fully qualified path to the main plugin file.
24
- * @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
25
- * @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
26
- * @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
27
- * @return void
28
- */
29
- function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = ''){
30
- $this->metadataUrl = $metadataUrl;
31
- $this->pluginFile = plugin_basename($pluginFile);
32
- $this->checkPeriod = $checkPeriod;
33
- $this->slug = $slug;
34
- $this->optionName = $optionName;
35
-
36
- //If no slug is specified, use the name of the main plugin file as the slug.
37
- //For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'.
38
- if ( empty($this->slug) ){
39
- $this->slug = basename($this->pluginFile, '.php');
40
- }
41
-
42
- if ( empty($this->optionName) ){
43
- $this->optionName = 'external_updates-' . $this->slug;
44
- }
45
-
46
- $this->installHooks();
47
- }
48
-
49
- /**
50
- * Install the hooks required to run periodic update checks and inject update info
51
- * into WP data structures.
52
- *
53
- * @return void
54
- */
55
- function installHooks(){
56
- //Override requests for plugin information
57
- add_filter('plugins_api', array(&$this, 'injectInfo'), 10, 3);
58
-
59
- //Insert our update info into the update array maintained by WP
60
- add_filter('site_transient_update_plugins', array(&$this,'injectUpdate')); //WP 3.0+
61
- add_filter('transient_update_plugins', array(&$this,'injectUpdate')); //WP 2.8+
62
-
63
- //Set up the periodic update checks
64
- $cronHook = 'check_plugin_updates-' . $this->slug;
65
- if ( $this->checkPeriod > 0 ){
66
-
67
- //Trigger the check via Cron
68
- add_filter('cron_schedules', array(&$this, '_addCustomSchedule'));
69
- if ( !wp_next_scheduled($cronHook) && !defined('WP_INSTALLING') ) {
70
- $scheduleName = 'every' . $this->checkPeriod . 'hours';
71
- wp_schedule_event(time(), $scheduleName, $cronHook);
72
- }
73
- add_action($cronHook, array(&$this, 'checkForUpdates'));
74
-
75
- //In case Cron is disabled or unreliable, we also manually trigger
76
- //the periodic checks while the user is browsing the Dashboard.
77
- //add_action( 'admin_init', array(&$this, 'maybeCheckForUpdates') );
78
-
79
- } else {
80
- //Periodic checks are disabled.
81
- wp_clear_scheduled_hook($cronHook);
82
- }
83
- }
84
-
85
- /**
86
- * Add our custom schedule to the array of Cron schedules used by WP.
87
- *
88
- * @param array $schedules
89
- * @return array
90
- */
91
- function _addCustomSchedule($schedules){
92
- if ( $this->checkPeriod && ($this->checkPeriod > 0) ){
93
- $scheduleName = 'every' . $this->checkPeriod . 'hours';
94
- $schedules[$scheduleName] = array(
95
- 'interval' => $this->checkPeriod * 3600,
96
- 'display' => sprintf('Every %d hours', $this->checkPeriod),
97
- );
98
- }
99
- return $schedules;
100
- }
101
-
102
- /**
103
- * Retrieve plugin info from the configured API endpoint.
104
- *
105
- * @uses wp_remote_get()
106
- *
107
- * @param array $queryArgs Additional query arguments to append to the request. Optional.
108
- * @return PluginInfo
109
- */
110
- function requestInfo($queryArgs = array()){
111
- //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()).
112
- $queryArgs['installed_version'] = $this->getInstalledVersion();
113
- $queryArgs = apply_filters('puc_request_info_query_args-'.$this->slug, $queryArgs);
114
-
115
- //Various options for the wp_remote_get() call. Plugins can filter these, too.
116
- $options = array(
117
- 'timeout' => 10, //seconds
118
- 'headers' => array(
119
- 'Accept' => 'application/json'
120
- ),
121
- );
122
- $options = apply_filters('puc_request_info_options-'.$this->slug, array());
123
-
124
- //The plugin info should be at 'http://your-api.com/url/here/$slug/info.json'
125
- $url = $this->metadataUrl;
126
- if ( !empty($queryArgs) ){
127
- $url = add_query_arg($queryArgs, $url);
128
- }
129
-
130
- $result = wp_remote_get(
131
- $url,
132
- $options
133
- );
134
-
135
- //Try to parse the response
136
- $pluginInfo = null;
137
- if ( !is_wp_error($result) && isset($result['response']['code']) && ($result['response']['code'] == 200) && !empty($result['body']) ){
138
- $pluginInfo = PluginInfo::fromJson($result['body']);
139
- }
140
- $pluginInfo = apply_filters('puc_request_info_result-'.$this->slug, $pluginInfo, $result);
141
- return $pluginInfo;
142
- }
143
-
144
- /**
145
- * Retrieve the latest update (if any) from the configured API endpoint.
146
- *
147
- * @uses PluginUpdateChecker::requestInfo()
148
- *
149
- * @return PluginUpdate An instance of PluginUpdate, or NULL when no updates are available.
150
- */
151
- function requestUpdate(){
152
- //For the sake of simplicity, this function just calls requestInfo()
153
- //and transforms the result accordingly.
154
- $pluginInfo = $this->requestInfo(array('checking_for_updates' => '1'));
155
- if ( $pluginInfo == null ){
156
- return null;
157
- }
158
-
159
- /* I've added this in version 2.8.8 so we update the serial number on the updatecheck cron and not only on update option of the serial */
160
- //$response = json_decode( $pluginInfo );
161
- if( function_exists('wppb_check_serial_number') ){
162
- $parts = parse_url( $this->metadataUrl );
163
- parse_str($parts['query'], $query);
164
- wppb_check_serial_number( '', $query['localSerialNumber'] );
165
- }
166
-
167
-
168
- return PluginUpdate::fromPluginInfo($pluginInfo);
169
- }
170
-
171
- /**
172
- * Get the currently installed version of the plugin.
173
- *
174
- * @return string Version number.
175
- */
176
- function getInstalledVersion(){
177
- if ( !function_exists('get_plugins') ){
178
- require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
179
- }
180
- $allPlugins = get_plugins();
181
- if ( array_key_exists($this->pluginFile, $allPlugins) && array_key_exists('Version', $allPlugins[$this->pluginFile]) ){
182
- return $allPlugins[$this->pluginFile]['Version'];
183
- } else {
184
- return ''; //This should never happen.
185
- };
186
- }
187
-
188
- /**
189
- * Check for plugin updates.
190
- * The results are stored in the DB option specified in $optionName.
191
- *
192
- * @return void
193
- */
194
- function checkForUpdates(){
195
- $state = get_option($this->optionName);
196
- if ( empty($state) ){
197
- $state = new StdClass;
198
- $state->lastCheck = 0;
199
- $state->checkedVersion = '';
200
- $state->update = null;
201
- }
202
-
203
- $state->lastCheck = time();
204
- $state->checkedVersion = $this->getInstalledVersion();
205
- update_option($this->optionName, $state); //Save before checking in case something goes wrong
206
-
207
- $state->update = $this->requestUpdate();
208
- update_option($this->optionName, $state);
209
- }
210
-
211
- /**
212
- * Check for updates only if the configured check interval has already elapsed.
213
- *
214
- * @return void
215
- */
216
- function maybeCheckForUpdates(){
217
- if ( empty($this->checkPeriod) ){
218
- return;
219
- }
220
-
221
- $state = get_option($this->optionName);
222
-
223
- $shouldCheck =
224
- empty($state) ||
225
- !isset($state->lastCheck) ||
226
- ( (time() - $state->lastCheck) >= $this->checkPeriod*3600 );
227
-
228
- if ( $shouldCheck ){
229
- $this->checkForUpdates();
230
- }
231
- }
232
-
233
- /**
234
- * Intercept plugins_api() calls that request information about our plugin and
235
- * use the configured API endpoint to satisfy them.
236
- *
237
- * @see plugins_api()
238
- *
239
- * @param mixed $result
240
- * @param string $action
241
- * @param array|object $args
242
- * @return mixed
243
- */
244
- function injectInfo($result, $action = null, $args = null){
245
- $relevant = ($action == 'plugin_information') && isset($args->slug) && ($args->slug == $this->slug);
246
- if ( !$relevant ){
247
- return $result;
248
- }
249
-
250
- $pluginInfo = $this->requestInfo();
251
- if ($pluginInfo){
252
- return $pluginInfo->toWpFormat();
253
- }
254
-
255
- return $result;
256
- }
257
-
258
- /**
259
- * Insert the latest update (if any) into the update list maintained by WP.
260
- *
261
- * @param array $updates Update list.
262
- * @return array Modified update list.
263
- */
264
- function injectUpdate($updates){
265
-
266
- if( !is_object( $updates ) )
267
- return $updates;
268
-
269
- $state = get_option($this->optionName);
270
-
271
- //Is there an update to insert?
272
- if ( !empty($state) && isset($state->update) && !empty($state->update) ){
273
- //Only insert updates that are actually newer than the currently installed version.
274
- if ( version_compare($state->update->version, $this->getInstalledVersion(), '>') ){
275
- $updates->response[$this->pluginFile] = $state->update->toWpFormat();
276
- }
277
- }
278
-
279
- return $updates;
280
- }
281
-
282
- /**
283
- * Register a callback for filtering query arguments.
284
- *
285
- * The callback function should take one argument - an associative array of query arguments.
286
- * It should return a modified array of query arguments.
287
- *
288
- * @uses add_filter() This method is a convenience wrapper for add_filter().
289
- *
290
- * @param callback $callback
291
- * @return void
292
- */
293
- function addQueryArgFilter($callback){
294
- add_filter('puc_request_info_query_args-'.$this->slug, $callback);
295
- }
296
-
297
- /**
298
- * Register a callback for filtering arguments passed to wp_remote_get().
299
- *
300
- * The callback function should take one argument - an associative array of arguments -
301
- * and return a modified array or arguments. See the WP documentation on wp_remote_get()
302
- * for details on what arguments are available and how they work.
303
- *
304
- * @uses add_filter() This method is a convenience wrapper for add_filter().
305
- *
306
- * @param callback $callback
307
- * @return void
308
- */
309
- function addHttpRequestArgFilter($callback){
310
- add_filter('puc_request_info_options-'.$this->slug, $callback);
311
- }
312
-
313
- /**
314
- * Register a callback for filtering the plugin info retrieved from the external API.
315
- *
316
- * The callback function should take two arguments. If the plugin info was retrieved
317
- * successfully, the first argument passed will be an instance of PluginInfo. Otherwise,
318
- * it will be NULL. The second argument will be the corresponding return value of
319
- * wp_remote_get (see WP docs for details).
320
- *
321
- * The callback function should return a new or modified instance of PluginInfo or NULL.
322
- *
323
- * @uses add_filter() This method is a convenience wrapper for add_filter().
324
- *
325
- * @param callback $callback
326
- * @return void
327
- */
328
- function addResultFilter($callback){
329
- add_filter('puc_request_info_result-'.$this->slug, $callback, 10, 2);
330
- }
331
- }
332
-
333
- endif;
334
-
335
- if ( !class_exists('PluginInfo') ):
336
-
337
- /**
338
- * A container class for holding and transforming various plugin metadata.
339
- *
340
- * @author Janis Elsts
341
- * @copyright 2010
342
- * @version 1.0
343
- * @access public
344
- */
345
- class PluginInfo {
346
- //Most fields map directly to the contents of the plugin's info.json file.
347
- //See the relevant docs for a description of their meaning.
348
- public $name;
349
- public $slug;
350
- public $version;
351
- public $homepage;
352
- public $sections;
353
- public $download_url;
354
-
355
- public $author;
356
- public $author_homepage;
357
-
358
- public $requires;
359
- public $tested;
360
- public $upgrade_notice;
361
-
362
- public $rating;
363
- public $num_ratings;
364
- public $downloaded;
365
- public $last_updated;
366
-
367
- public $id = 0; //The native WP.org API returns numeric plugin IDs, but they're not used for anything.
368
-
369
- /**
370
- * Create a new instance of PluginInfo from JSON-encoded plugin info
371
- * returned by an external update API.
372
- *
373
- * @param string $json Valid JSON string representing plugin info.
374
- * @return PluginInfo New instance of PluginInfo, or NULL on error.
375
- */
376
- public static function fromJson($json){
377
- $apiResponse = json_decode($json);
378
- if ( empty($apiResponse) || !is_object($apiResponse) ){
379
- return null;
380
- }
381
-
382
- //Very, very basic validation.
383
- $valid = isset($apiResponse->name) && !empty($apiResponse->name) && isset($apiResponse->version) && !empty($apiResponse->version);
384
- if ( !$valid ){
385
- return null;
386
- }
387
-
388
- $info = new PluginInfo();
389
- foreach(get_object_vars($apiResponse) as $key => $value){
390
- $info->$key = $value;
391
- }
392
-
393
- return $info;
394
- }
395
-
396
- /**
397
- * Transform plugin info into the format used by the native WordPress.org API
398
- *
399
- * @return object
400
- */
401
- public function toWpFormat(){
402
- $info = new StdClass;
403
-
404
- //The custom update API is built so that many fields have the same name and format
405
- //as those returned by the native WordPress.org API. These can be assigned directly.
406
- $sameFormat = array(
407
- 'name', 'slug', 'version', 'requires', 'tested', 'rating', 'upgrade_notice',
408
- 'num_ratings', 'downloaded', 'homepage', 'last_updated',
409
- );
410
- foreach($sameFormat as $field){
411
- if ( isset($this->$field) ) {
412
- $info->$field = $this->$field;
413
- }
414
- }
415
-
416
- //Other fields need to be renamed and/or transformed.
417
- $info->download_link = $this->download_url;
418
-
419
- if ( !empty($this->author_homepage) ){
420
- $info->author = sprintf('<a href="%s">%s</a>', $this->author_homepage, $this->author);
421
- } else {
422
- $info->author = $this->author;
423
- }
424
-
425
- if ( is_object($this->sections) ){
426
- $info->sections = get_object_vars($this->sections);
427
- } elseif ( is_array($this->sections) ) {
428
- $info->sections = $this->sections;
429
- } else {
430
- $info->sections = array('description' => '');
431
- }
432
-
433
- return $info;
434
- }
435
- }
436
-
437
- endif;
438
-
439
- if ( !class_exists('PluginUpdate') ):
440
-
441
- /**
442
- * A simple container class for holding information about an available update.
443
- *
444
- * @author Janis Elsts
445
- * @copyright 2010
446
- * @version 1.0
447
- * @access public
448
- */
449
- class PluginUpdate {
450
- public $id = 0;
451
- public $slug;
452
- public $version;
453
- public $homepage;
454
- public $download_url;
455
- public $upgrade_notice;
456
-
457
- /**
458
- * Create a new instance of PluginUpdate from its JSON-encoded representation.
459
- *
460
- * @param string $json
461
- * @return PluginUpdate
462
- */
463
- public static function fromJson($json){
464
- //Since update-related information is simply a subset of the full plugin info,
465
- //we can parse the update JSON as if it was a plugin info string, then copy over
466
- //the parts that we care about.
467
- $pluginInfo = PluginInfo::fromJson($json);
468
- if ( $pluginInfo != null ) {
469
- return PluginUpdate::fromPluginInfo($pluginInfo);
470
- } else {
471
- return null;
472
- }
473
- }
474
-
475
- /**
476
- * Create a new instance of PluginUpdate based on an instance of PluginInfo.
477
- * Basically, this just copies a subset of fields from one object to another.
478
- *
479
- * @param PluginInfo $info
480
- * @return PluginUpdate
481
- */
482
- public static function fromPluginInfo($info){
483
- $update = new PluginUpdate();
484
- $copyFields = array('id', 'slug', 'version', 'homepage', 'download_url', 'upgrade_notice');
485
- foreach($copyFields as $field){
486
- $update->$field = $info->$field;
487
- }
488
- return $update;
489
- }
490
-
491
- /**
492
- * Transform the update into the format used by WordPress native plugin API.
493
- *
494
- * @return object
495
- */
496
- public function toWpFormat(){
497
- $update = new StdClass;
498
-
499
- $update->id = $this->id;
500
- $update->slug = $this->slug;
501
- $update->new_version = $this->version;
502
- $update->url = $this->homepage;
503
- $update->package = $this->download_url;
504
- if ( !empty($this->upgrade_notice) ){
505
- $update->upgrade_notice = $this->upgrade_notice;
506
- }
507
-
508
- //add an icon to the update screen for the pro version (this is specific to PB, don't have a good solution for making it global)
509
- $update->icons = array( "2x" =>"https://ps.w.org/profile-builder/assets/icon-256x256.png?rev=1077372");
510
-
511
- return $update;
512
- }
513
- }
514
-
515
- endif;
516
- ?>