| @@ -21,10 +21,10 @@ | ||
| 21 | 21 | /** |
| 22 | 22 | * @var FS_Plugin_Tag $update |
| 23 | 23 | */ |
| 24 | 24 | $update = $fs->has_release_on_freemius() ? |
| 25 | - $fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 ) : | |
| 26 | - null; | |
| 25 | + $fs->get_update( false, false ) : | |
| 26 | + null; | |
| 27 | 27 | |
| 28 | 28 | if ( is_object($update) ) { |
| 29 | 29 | /** |
| 30 | 30 | * This logic is particularly required for multisite environment. |
| @@ -45,8 +45,9 @@ | ||
| 45 | 45 | $user = $fs->get_user(); |
| 46 | 46 | $site = $fs->get_site(); |
| 47 | 47 | $name = $user->get_name(); |
| 48 | 48 | $license = $fs->_get_license(); |
| 49 | + $is_license_foreign = ( is_object( $license ) && $user->id != $license->user_id ); | |
| 49 | 50 | $is_data_debug_mode = $fs->is_data_debug_mode(); |
| 50 | 51 | $is_whitelabeled = $fs->is_whitelabeled(); |
| 51 | 52 | $subscription = ( is_object( $license ) ? |
| 52 | 53 | $fs->_get_subscription( $license->id ) : |
| @@ -57,12 +58,21 @@ | ||
| 57 | 58 | $has_paid_plan = $fs->apply_filters( 'has_paid_plan_account', $fs->has_paid_plan() ); |
| 58 | 59 | $show_upgrade = ( ! $is_whitelabeled && $has_paid_plan && ! $is_paying && ! $is_paid_trial ); |
| 59 | 60 | $trial_plan = $fs->get_trial_plan(); |
| 60 | 61 | |
| 62 | + $is_plan_change_supported = ( | |
| 63 | + ! $fs->is_single_plan() && | |
| 64 | + ! $fs->apply_filters( 'hide_plan_change', false ) | |
| 65 | + ); | |
| 66 | + | |
| 61 | 67 | if ( $has_paid_plan ) { |
| 62 | 68 | $fs->_add_license_activation_dialog_box(); |
| 63 | 69 | } |
| 64 | 70 | |
| 71 | + if ( $fs->should_handle_user_change() ) { | |
| 72 | + $fs->_add_email_address_update_dialog_box(); | |
| 73 | + } | |
| 74 | + | |
| 65 | 75 | $ids_of_installs_activated_with_foreign_licenses = $fs->should_handle_user_change() ? |
| 66 | 76 | $fs->get_installs_ids_with_foreign_licenses() : |
| 67 | 77 | array(); |
| 68 | 78 | |
| @@ -85,19 +95,18 @@ | ||
| 85 | 95 | '_open_license_activation_dialog_box' |
| 86 | 96 | ) ); |
| 87 | 97 | } |
| 88 | 98 | |
| 89 | - $payments = $fs->_fetch_payments(); | |
| 99 | + $show_billing = ( ! $is_whitelabeled && ! $fs->apply_filters( 'hide_billing_and_payments_info', false ) ); | |
| 100 | + if ( $show_billing ) { | |
| 101 | + $payments = $fs->_fetch_payments(); | |
| 90 | 102 | |
| 91 | - $show_billing = ( ! $is_whitelabeled && is_array( $payments ) && 0 < count( $payments ) ); | |
| 103 | + $show_billing = ( is_array( $payments ) && 0 < count( $payments ) ); | |
| 104 | + } | |
| 92 | 105 | |
| 93 | 106 | |
| 94 | - $has_tabs = $fs->_add_tabs_before_content(); | |
| 107 | + $has_tabs = $fs->_add_tabs_before_content(); | |
| 95 | 108 | |
| 96 | - if ( $has_tabs ) { | |
| 97 | - $query_params['tabs'] = 'true'; | |
| 98 | - } | |
| 99 | - | |
| 100 | 109 | // Aliases. |
| 101 | 110 | $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug ); |
| 102 | 111 | $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug ); |
| 103 | 112 | $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug ); |
| @@ -139,8 +148,9 @@ | ||
| 139 | 148 | $site_info = $fs->get_site_info( $s ); |
| 140 | 149 | $install = $fs->get_install_by_blog_id( $site_info['blog_id'] ); |
| 141 | 150 | $view_params = array( |
| 142 | 151 | 'freemius' => $fs, |
| 152 | + 'user' => $fs->get_user(), | |
| 143 | 153 | 'license' => $license, |
| 144 | 154 | 'site' => $site_info, |
| 145 | 155 | 'install' => $install, |
| 146 | 156 | ); |
| @@ -233,22 +243,32 @@ | ||
| 233 | 243 | |
| 234 | 244 | $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) ); |
| 235 | 245 | |
| 236 | 246 | $is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() ); |
| 247 | + | |
| 248 | + $available_license = ( $fs->is_free_plan() && ! fs_is_network_admin() ) ? | |
| 249 | + $fs->_get_available_premium_license( $site->is_localhost() ) : | |
| 250 | + null; | |
| 251 | + | |
| 252 | + $available_license_paid_plan = is_object( $available_license ) ? | |
| 253 | + $fs->_get_plan_by_id( $available_license->plan_id ) : | |
| 254 | + null; | |
| 255 | + | |
| 256 | + $is_dev_mode = ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ); | |
| 237 | 257 | ?> |
| 238 | 258 | <div class="wrap fs-section"> |
| 239 | 259 | <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?> |
| 240 | 260 | <h2 class="nav-tab-wrapper"> |
| 241 | - <a href="<?php echo $fs->get_account_url() ?>" | |
| 261 | + <a href="<?php echo esc_url( $fs->get_account_url() ) ?>" | |
| 242 | 262 | class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a> |
| 243 | 263 | <?php if ( $fs->has_addons() ) : ?> |
| 244 | - <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>" | |
| 264 | + <a href="<?php echo esc_url( $fs->_get_admin_page_url( 'addons' ) ) ?>" | |
| 245 | 265 | class="nav-tab"><?php echo esc_html( $addons_text ) ?></a> |
| 246 | 266 | <?php endif ?> |
| 247 | 267 | <?php if ( $show_upgrade ) : ?> |
| 248 | - <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a> | |
| 268 | + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a> | |
| 249 | 269 | <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?> |
| 250 | - <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a> | |
| 270 | + <a href="<?php echo esc_url( $fs->get_trial_url() ) ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a> | |
| 251 | 271 | <?php endif ?> |
| 252 | 272 | <?php endif ?> |
| 253 | 273 | </h2> |
| 254 | 274 | <?php endif ?> |
| @@ -273,26 +293,21 @@ | ||
| 273 | 293 | </li> |
| 274 | 294 | <li> • </li> |
| 275 | 295 | <?php endif ?> |
| 276 | 296 | <?php if ( $show_billing ) : ?> |
| 277 | - <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></li> | |
| 297 | + <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></a></li> | |
| 278 | 298 | <li> • </li> |
| 279 | 299 | <?php endif ?> |
| 280 | 300 | <?php if ( ! $is_whitelabeled ) : ?> |
| 281 | 301 | <?php if ( ! $is_paying ) : ?> |
| 282 | 302 | <li> |
| 283 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> | |
| 284 | - <input type="hidden" name="fs_action" value="delete_account"> | |
| 285 | - <?php wp_nonce_field( 'delete_account' ) ?> | |
| 286 | - <a class="fs-delete-account" href="#" onclick="if (confirm('<?php | |
| 287 | - if ( $is_active_subscription ) { | |
| 288 | - echo esc_attr( sprintf( fs_text_inline( 'Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the "Cancel" button, and first "Downgrade" your account. Are you sure you would like to continue with the deletion?', 'delete-account-x-confirm', $slug ), $plan->title ) ); | |
| 289 | - } else { | |
| 290 | - echo esc_attr( sprintf( fs_text_inline( 'Deletion is not temporary. Only delete if you no longer want to use this %s anymore. Are you sure you would like to continue with the deletion?', 'delete-account-confirm', $slug ), $fs->get_module_label( true ) ) ); | |
| 291 | - } | |
| 292 | - ?>')) this.parentNode.submit(); return false;"><i | |
| 293 | - class="dashicons dashicons-no"></i> <?php fs_esc_html_echo_inline( 'Delete Account', 'delete-account', $slug ) ?></a> | |
| 294 | - </form> | |
| 303 | + <?php | |
| 304 | + $view_params = array( | |
| 305 | + 'freemius' => $fs, | |
| 306 | + 'license' => $available_license, | |
| 307 | + 'license_paid_plan' => $available_license_paid_plan, | |
| 308 | + ); | |
| 309 | + fs_require_template( 'account/partials/disconnect-button.php', $view_params ); ?> | |
| 295 | 310 | </li> |
| 296 | 311 | <li> • </li> |
| 297 | 312 | <?php endif ?> |
| 298 | 313 | <?php if ( $is_paying ) : ?> |
| @@ -297,9 +312,9 @@ | ||
| 297 | 312 | <?php endif ?> |
| 298 | 313 | <?php if ( $is_paying ) : ?> |
| 299 | 314 | <?php if ( ! fs_is_network_admin() ) : ?> |
| 300 | 315 | <li> |
| 301 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> | |
| 316 | + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST"> | |
| 302 | 317 | <input type="hidden" name="fs_action" value="deactivate_license"> |
| 303 | 318 | <?php wp_nonce_field( 'deactivate_license' ) ?> |
| 304 | 319 | <a href="#" class="fs-deactivate-license"><i |
| 305 | 320 | class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?> |
| @@ -311,15 +326,15 @@ | ||
| 311 | 326 | <?php if ( ! $license->is_lifetime() && |
| 312 | 327 | $is_active_subscription |
| 313 | 328 | ) : ?> |
| 314 | 329 | <li> |
| 315 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> | |
| 330 | + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST"> | |
| 316 | 331 | <input type="hidden" name="fs_action" value="downgrade_account"> |
| 317 | 332 | <?php wp_nonce_field( 'downgrade_account' ) ?> |
| 318 | 333 | <a href="#" |
| 319 | 334 | onclick="if ( confirm('<?php echo esc_attr( sprintf( |
| 320 | 335 | $downgrade_x_confirm_text, |
| 321 | - ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ), | |
| 336 | + ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ), | |
| 322 | 337 | $plan->title, |
| 323 | 338 | human_time_diff( time(), strtotime( $license->expiration ) ) |
| 324 | 339 | ) ) ?> <?php if ( ! $license->is_block_features ) { |
| 325 | 340 | echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) ); |
| @@ -329,11 +344,11 @@ | ||
| 329 | 344 | </form> |
| 330 | 345 | </li> |
| 331 | 346 | <li> • </li> |
| 332 | 347 | <?php endif ?> |
| 333 | - <?php if ( ! $fs->is_single_plan() ) : ?> | |
| 348 | + <?php if ( $is_plan_change_supported ) : ?> | |
| 334 | 349 | <li> |
| 335 | - <a href="<?php echo $fs->get_upgrade_url() ?>"><i | |
| 350 | + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"><i | |
| 336 | 351 | class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a> |
| 337 | 352 | </li> |
| 338 | 353 | <li> • </li> |
| 339 | 354 | <?php endif ?> |
| @@ -338,9 +353,9 @@ | ||
| 338 | 353 | <li> • </li> |
| 339 | 354 | <?php endif ?> |
| 340 | 355 | <?php elseif ( $is_paid_trial ) : ?> |
| 341 | 356 | <li> |
| 342 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> | |
| 357 | + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST"> | |
| 343 | 358 | <input type="hidden" name="fs_action" value="cancel_trial"> |
| 344 | 359 | <?php wp_nonce_field( 'cancel_trial' ) ?> |
| 345 | 360 | <a href="#" class="fs-cancel-trial"><i |
| 346 | 361 | class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a> |
| @@ -349,10 +364,10 @@ | ||
| 349 | 364 | <li> • </li> |
| 350 | 365 | <?php endif ?> |
| 351 | 366 | <?php endif ?> |
| 352 | 367 | <li> |
| 353 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"> | |
| 354 | - <input type="hidden" name="fs_action" value="<?php echo $fs->get_unique_affix() ?>_sync_license"> | |
| 368 | + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST"> | |
| 369 | + <input type="hidden" name="fs_action" value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license"> | |
| 355 | 370 | <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?> |
| 356 | 371 | <a href="#" onclick="this.parentNode.submit(); return false;"><i |
| 357 | 372 | class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a> |
| 358 | 373 | </form> |
| @@ -365,9 +380,9 @@ | ||
| 365 | 380 | $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) ); |
| 366 | 381 | |
| 367 | 382 | $profile = array(); |
| 368 | 383 | |
| 369 | - if ( ! $is_whitelabeled ) { | |
| 384 | + if ( ! $is_whitelabeled ) { | |
| 370 | 385 | $profile[] = array( |
| 371 | 386 | 'id' => 'user_name', |
| 372 | 387 | 'title' => fs_text_inline( 'Name', 'name', $slug ), |
| 373 | 388 | 'value' => $name |
| @@ -434,9 +449,9 @@ | ||
| 434 | 449 | 'title' => $version_text, |
| 435 | 450 | 'value' => $fs->get_plugin_version() |
| 436 | 451 | ); |
| 437 | 452 | |
| 438 | - if ( ! fs_is_network_admin() && $is_premium && ! $is_whitelabeled ) { | |
| 453 | + if ( ! fs_is_network_admin() && $is_premium ) { | |
| 439 | 454 | $profile[] = array( |
| 440 | 455 | 'id' => 'beta_program', |
| 441 | 456 | 'title' => '', |
| 442 | 457 | 'value' => $site->is_beta |
| @@ -494,11 +509,11 @@ | ||
| 494 | 509 | // to show current plan. |
| 495 | 510 | continue; |
| 496 | 511 | } |
| 497 | 512 | ?> |
| 498 | - <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>"> | |
| 513 | + <tr class="fs-field-<?php echo esc_attr( $p['id'] ) ?><?php if ( $odd ) : ?> alternate<?php endif ?>"> | |
| 499 | 514 | <td> |
| 500 | - <nobr><?php echo $p['title'] ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr> | |
| 515 | + <nobr><?php echo esc_html( $p['title'] ) ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr> | |
| 501 | 516 | </td> |
| 502 | 517 | <td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>> |
| 503 | 518 | <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?> |
| 504 | 519 | <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $p['value'] ) ?></code> |
| @@ -536,17 +551,15 @@ | ||
| 536 | 551 | <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label> |
| 537 | 552 | <?php endif ?> |
| 538 | 553 | <?php if ( ! $is_whitelabeled ) : ?> |
| 539 | 554 | <div class="button-group"> |
| 540 | - <?php $available_license = $fs->is_free_plan() && ! fs_is_network_admin() ? $fs->_get_available_premium_license( $site->is_localhost() ) : false ?> | |
| 541 | 555 | <?php if ( is_object( $available_license ) ) : ?> |
| 542 | - <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?> | |
| 543 | 556 | <?php |
| 544 | 557 | $view_params = array( |
| 545 | 558 | 'freemius' => $fs, |
| 546 | 559 | 'slug' => $slug, |
| 547 | 560 | 'license' => $available_license, |
| 548 | - 'plan' => $premium_plan, | |
| 561 | + 'plan' => $available_license_paid_plan, | |
| 549 | 562 | 'is_localhost' => $site->is_localhost(), |
| 550 | 563 | 'install_id' => $site->id, |
| 551 | 564 | 'class' => 'button-primary', |
| 552 | 565 | ); |
| @@ -551,20 +564,20 @@ | ||
| 551 | 564 | 'class' => 'button-primary', |
| 552 | 565 | ); |
| 553 | 566 | fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?> |
| 554 | 567 | <?php else : ?> |
| 555 | - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" | |
| 568 | + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" | |
| 556 | 569 | method="POST" class="button-group"> |
| 557 | 570 | <?php if ( $show_upgrade && $is_premium ) : ?> |
| 558 | - <a class="button activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a> | |
| 571 | + <a class="button activate-license-trigger <?php echo esc_attr( $fs->get_unique_affix() ) ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a> | |
| 559 | 572 | <?php endif ?> |
| 560 | 573 | <input type="submit" class="button" |
| 561 | 574 | value="<?php echo esc_attr( $sync_license_text ) ?>"> |
| 562 | 575 | <input type="hidden" name="fs_action" |
| 563 | - value="<?php echo $fs->get_unique_affix() ?>_sync_license"> | |
| 576 | + value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license"> | |
| 564 | 577 | <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?> |
| 565 | - <?php if ( $show_upgrade || ! $fs->is_single_plan() ) : ?> | |
| 566 | - <a href="<?php echo $fs->get_upgrade_url() ?>" | |
| 578 | + <?php if ( $show_upgrade || $is_plan_change_supported ) : ?> | |
| 579 | + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>" | |
| 567 | 580 | class="button<?php |
| 568 | 581 | echo $show_upgrade ? |
| 569 | 582 | ' button-primary fs-upgrade' : |
| 570 | 583 | ' fs-change-plan'; ?> button-upgrade"><i |
| @@ -644,9 +657,9 @@ | ||
| 644 | 657 | </div> |
| 645 | 658 | <?php endif ?> |
| 646 | 659 | <?php |
| 647 | 660 | elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?> |
| 648 | - <?php if ( ! $is_whitelabeled ) : ?> | |
| 661 | + <?php if ( ! $is_whitelabeled && ( 'site_secret_key' === $p['id'] || ! $is_license_foreign ) ) : ?> | |
| 649 | 662 | <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button> |
| 650 | 663 | <?php endif ?> |
| 651 | 664 | <?php if ('license_key' === $p['id']) : ?> |
| 652 | 665 | <button class="button button-small activate-license-trigger <?php echo $fs->get_unique_affix() ?>"><?php fs_esc_html_echo_inline( 'Change License', 'change-license', $slug ) ?></button> |
| @@ -657,8 +670,9 @@ | ||
| 657 | 670 | 'email', |
| 658 | 671 | 'user_name' |
| 659 | 672 | ) ) ) |
| 660 | 673 | ) : ?> |
| 674 | + <?php if ( 'email' !== $p['id'] || ! fs_is_network_admin() ) : ?> | |
| 661 | 675 | <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST" |
| 662 | 676 | onsubmit="var val = prompt('<?php echo esc_attr( sprintf( |
| 663 | 677 | /* translators: %s: User's account property (e.g. name, email) */ |
| 664 | 678 | fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ), |
| @@ -667,11 +681,12 @@ | ||
| 667 | 681 | <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>"> |
| 668 | 682 | <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>" |
| 669 | 683 | value=""> |
| 670 | 684 | <?php wp_nonce_field( 'update_' . $p['id'] ) ?> |
| 671 | - <input type="submit" class="button button-small" | |
| 685 | + <input type="submit" class="button button-small <?php if ( 'email' === $p['id'] ) echo 'button-edit-email-address' ?>" | |
| 672 | 686 | value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>"> |
| 673 | 687 | </form> |
| 688 | + <?php endif ?> | |
| 674 | 689 | <?php elseif ( 'user_id' === $p['id'] && ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) : ?> |
| 675 | 690 | <input id="fs_change_user" type="submit" class="button button-small" |
| 676 | 691 | value="<?php echo fs_esc_attr_inline( 'Change User', 'change-user', $slug ) ?>"> |
| 677 | 692 | <?php endif ?> |
| @@ -729,14 +744,32 @@ | ||
| 729 | 744 | </div> |
| 730 | 745 | <div class="fs-table-body"> |
| 731 | 746 | <table class="widefat"> |
| 732 | 747 | <?php |
| 748 | + $current_blog_id = get_current_blog_id(); | |
| 749 | + | |
| 733 | 750 | foreach ( $site_view_params as $view_params ) { |
| 734 | 751 | fs_require_template( |
| 735 | 752 | 'account/partials/site.php', |
| 736 | 753 | $view_params |
| 737 | 754 | ); |
| 738 | - } ?> | |
| 755 | + } | |
| 756 | + | |
| 757 | + /** | |
| 758 | + * It's possible for the `Freemius::switch_to_blog()` method to be called within the `site.php` template and this changes the Freemius instance's context, so this check is for restoring the previous context based on the previously retrieved site. | |
| 759 | + * | |
| 760 | + * @author Leo Fajardo (@leorw) | |
| 761 | + * @since 2.5.0 | |
| 762 | + */ | |
| 763 | + $current_install = $fs->get_site(); | |
| 764 | + | |
| 765 | + if ( | |
| 766 | + is_object( $site ) && | |
| 767 | + ( ! is_object( $current_install ) || $current_install->id != $site->id ) | |
| 768 | + ) { | |
| 769 | + $fs->switch_to_blog( $current_blog_id, $site, true ); | |
| 770 | + } | |
| 771 | + ?> | |
| 739 | 772 | </table> |
| 740 | 773 | </div> |
| 741 | 774 | </div> |
| 742 | 775 | </div> |
| @@ -755,9 +788,9 @@ | ||
| 755 | 788 | <th><?php echo esc_html( $version_text ) ?></th> |
| 756 | 789 | <th><?php echo esc_html( $plan_text ) ?></th> |
| 757 | 790 | <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th> |
| 758 | 791 | <th></th> |
| 759 | - <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?> | |
| 792 | + <?php if ( $is_dev_mode ) : ?> | |
| 760 | 793 | <th></th> |
| 761 | 794 | <?php endif ?> |
| 762 | 795 | </tr> |
| 763 | 796 | </thead> |
| @@ -821,12 +854,22 @@ | ||
| 821 | 854 | $fs->_get_addon_info( $addon_id, $is_addon_installed ), |
| 822 | 855 | 'is_whitelabeled' => ( $is_whitelabeled && ! $is_data_debug_mode ) |
| 823 | 856 | ); |
| 824 | 857 | |
| 825 | - fs_require_template( | |
| 826 | - 'account/partials/addon.php', | |
| 827 | - $addon_view_params | |
| 828 | - ); | |
| 858 | + if ( ! empty($addon_view_params['addon_info'] ) ) { | |
| 859 | + fs_require_template( | |
| 860 | + 'account/partials/addon.php', | |
| 861 | + $addon_view_params | |
| 862 | + ); | |
| 863 | + } else { | |
| 864 | + // If we are here it means there is an activation of an unreleased add-on and yet the SDK is not in development mode. | |
| 865 | + echo '<tr>'; | |
| 866 | + echo '<td style="text-align: right;">' . esc_html( $addon_id ) . '</td>'; | |
| 867 | + echo '<td colspan="' . ( $is_dev_mode ? 6 : 5 ) . '" style="text-align: left;">'; | |
| 868 | + echo 'The add-on you have activated is no longer <a href="https://freemius.com/help/documentation/wordpress/selling-add-ons-extensions/#preparing-the-add-on-for-sale" rel="noreferrer noopener" target="_blank">listed</a> by the product owner, or the SDK is not running in <a href="https://freemius.com/help/documentation/wordpress-sdk/testing/" rel="noreferrer noopener" target="_blank">test mode</a>. Please <a href="' . esc_url( $fs->contact_url() ) . '">contact support</a> if you need further assistance.'; | |
| 869 | + echo '</td>'; | |
| 870 | + echo '</tr>'; | |
| 871 | + } | |
| 829 | 872 | |
| 830 | 873 | $odd = ! $odd; |
| 831 | 874 | } ?> |
| 832 | 875 | </tbody> |
| @@ -838,9 +881,9 @@ | ||
| 838 | 881 | <?php $fs->do_action( 'after_account_details' ) ?> |
| 839 | 882 | |
| 840 | 883 | <?php |
| 841 | 884 | if ( $show_billing ) { |
| 842 | - $view_params = array( 'id' => $VARS['id'] ); | |
| 885 | + $view_params = array( 'id' => $VARS['id'], 'payments' => $payments ); | |
| 843 | 886 | fs_require_once_template( 'account/billing.php', $view_params ); |
| 844 | 887 | fs_require_once_template( 'account/payments.php', $view_params ); |
| 845 | 888 | } |
| 846 | 889 | ?> |
| @@ -918,9 +961,9 @@ | ||
| 918 | 961 | isChecked = $checkbox.is( ':checked' ); |
| 919 | 962 | |
| 920 | 963 | if ( ! isChecked || confirm( '<?php echo $confirmation_message ?>' ) ) { |
| 921 | 964 | $.ajax( { |
| 922 | - url : ajaxurl, | |
| 965 | + url : <?php echo Freemius::ajax_url() ?>, | |
| 923 | 966 | method: 'POST', |
| 924 | 967 | data : { |
| 925 | 968 | action : '<?php echo $fs->get_ajax_action( 'set_beta_mode' ) ?>', |
| 926 | 969 | security : '<?php echo $fs->get_ajax_security( 'set_beta_mode' ) ?>', |
| @@ -1061,9 +1104,9 @@ | ||
| 1061 | 1104 | $( '.fs-toggle-whitelabel-mode' ).click( function () { |
| 1062 | 1105 | var $toggleLink = $( this ); |
| 1063 | 1106 | |
| 1064 | 1107 | $.ajax( { |
| 1065 | - url : ajaxurl, | |
| 1108 | + url : <?php echo Freemius::ajax_url() ?>, | |
| 1066 | 1109 | method: 'POST', |
| 1067 | 1110 | data : { |
| 1068 | 1111 | action : '<?php echo $fs->get_ajax_action( 'toggle_whitelabel_mode' ) ?>', |
| 1069 | 1112 | security : '<?php echo $fs->get_ajax_security( 'toggle_whitelabel_mode' ) ?>', |
| @@ -1086,13 +1129,4 @@ | ||
| 1086 | 1129 | <?php |
| 1087 | 1130 | if ( $has_tabs ) { |
| 1088 | 1131 | $fs->_add_tabs_after_content(); |
| 1089 | 1132 | } |
| 1090 | - | |
| 1091 | - $params = array( | |
| 1092 | - 'page' => 'account', | |
| 1093 | - 'module_id' => $fs->get_id(), | |
| 1094 | - 'module_type' => $fs->get_module_type(), | |
| 1095 | - 'module_slug' => $slug, | |
| 1096 | - 'module_version' => $fs->get_plugin_version(), | |
| 1097 | - ); | |
| 1098 | - fs_require_template( 'powered-by.php', $params ); | |