: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
if ( ! defined( 'ABSPATH' ) ) {
$fs = freemius( $VARS['id'] );
* @var FS_Plugin_Tag $update
$update = $fs->has_release_on_freemius() ?
$fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 ) :
if ( is_object($update) ) {
* This logic is particularly required for multisite environment.
* If a module is site activated (not network) and not on the main site,
* the module will NOT be executed on the network level, therefore, the
* custom updates logic will not be executed as well, so unless we force
* the injection of the update into the updates transient, premium updates
* @author Vova Feldman (@svovaf)
$updater = FS_Plugin_Updater::instance( $fs );
$updater->set_update_data( $update );
$is_paying = $fs->is_paying();
$name = $user->get_name();
$license = $fs->_get_license();
$is_license_foreign = ( is_object( $license ) && $user->id != $license->user_id );
$is_data_debug_mode = $fs->is_data_debug_mode();
$is_whitelabeled = $fs->is_whitelabeled();
$subscription = ( is_object( $license ) ?
$fs->_get_subscription( $license->id ) :
$is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
$is_paid_trial = $fs->is_paid_trial();
$has_paid_plan = $fs->apply_filters( 'has_paid_plan_account', $fs->has_paid_plan() );
$show_upgrade = ( ! $is_whitelabeled && $has_paid_plan && ! $is_paying && ! $is_paid_trial );
$trial_plan = $fs->get_trial_plan();
$is_plan_change_supported = (
! $fs->is_single_plan() &&
! $fs->apply_filters( 'hide_plan_change', false )
$fs->_add_license_activation_dialog_box();
if ( $fs->should_handle_user_change() ) {
$fs->_add_email_address_update_dialog_box();
$ids_of_installs_activated_with_foreign_licenses = $fs->should_handle_user_change() ?
$fs->get_installs_ids_with_foreign_licenses() :
if ( ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) {
$fs->_add_user_change_dialog_box( $ids_of_installs_activated_with_foreign_licenses );
if ( $fs->is_whitelabeled( true ) || $fs->is_data_debug_mode() ) {
$fs->_add_data_debug_mode_dialog_box();
if ( fs_request_get_bool( 'auto_install' ) ) {
$fs->_add_auto_installation_dialog_box();
if ( fs_request_get_bool( 'activate_license' ) ) {
// Open the license activation dialog box on the account page.
add_action( 'admin_footer', array(
'_open_license_activation_dialog_box'
$show_billing = ( ! $is_whitelabeled && ! $fs->apply_filters( 'hide_billing_and_payments_info', false ) );
$payments = $fs->_fetch_payments();
$show_billing = ( is_array( $payments ) && 0 < count( $payments ) );
$has_tabs = $fs->_add_tabs_before_content();
$download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
$downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
$cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
/* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
$downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
$prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
$cancel_trial_confirm_text = fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug );
$after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
$after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
/* translators: %s: Plan title (e.g. "Professional") */
$activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
$version_text = fs_text_x_inline( 'Version', 'product version', 'version', $slug );
/* translators: %s: Time period (e.g. Auto renews in "2 months") */
$renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
/* translators: %s: Time period (e.g. Expires in "2 months") */
$expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
$sync_license_text = fs_text_x_inline( 'Sync License', 'as synchronize license', 'sync-license', $slug );
$cancel_trial_text = fs_text_inline( 'Cancel Trial', 'cancel-trial', $slug );
$change_plan_text = fs_text_inline( 'Change Plan', 'change-plan', $slug );
$upgrade_text = fs_text_x_inline( 'Upgrade', 'verb', 'upgrade', $slug );
$addons_text = fs_text_inline( 'Add-Ons', 'add-ons', $slug );
$downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
$trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
$free_text = fs_text_inline( 'Free', 'free', $slug );
$activate_text = fs_text_inline( 'Activate', 'activate', $slug );
$plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
$bundle_plan_text = fs_text_inline( 'Bundle Plan', 'bundle-plan', $slug );
$show_license_row = is_object( $license );
$site_view_params = array();
if ( fs_is_network_admin() ) {
$sites = Freemius::get_sites();
$all_installs_plan_id = null;
$all_installs_license_id = ( $show_license_row ? $license->id : null );
foreach ( $sites as $s ) {
$site_info = $fs->get_site_info( $s );
$install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
'user' => $fs->get_user(),
$site_view_params[] = $view_params;
if ( empty( $install ) ) {
if ( is_null( $all_installs_plan_id ) ) {
$all_installs_plan_id = $install->plan_id;
} else if ( $all_installs_plan_id != $install->plan_id ) {
if ( $show_license_row && $all_installs_license_id != $install->license_id ) {
$show_license_row = false;
$has_bundle_license = false;
if ( is_object( $license ) &&
FS_Plugin_License::is_valid_id( $license->parent_license_id )
// Context license has a parent license, therefore, the account has a bundle license.
$has_bundle_license = true;
$bundle_subscription = null;
$is_bundle_first_payment_pending = false;
$bundle_plan_title = strtoupper( $license->parent_plan_title );
$bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
$is_bundle_first_payment_pending = $license->is_first_payment_pending();
$fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
$active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
$is_premium = $fs->is_premium();
$account_addons = $fs->get_updated_account_addons();
$installed_addons = $fs->get_installed_addons();
$installed_addons_ids = array();
* Store the installed add-ons' IDs into a collection which will be used in determining the add-ons to show on the "Account" page, and at the same time try to find an add-on that is activated with a bundle license if the core product is not.
foreach ( $installed_addons as $fs_addon ) {
$installed_addons_ids[] = $fs_addon->get_id();
if ( $has_bundle_license ) {
// We already have the context bundle license details, skip.
$fs_addon->has_active_valid_license()
$addon_license = $fs_addon->_get_license();
if ( FS_Plugin_License::is_valid_id( $addon_license->parent_license_id ) ) {
// Add-on's license is associated with a parent/bundle license.
$has_bundle_license = true;
$bundle_plan_title = strtoupper( $addon_license->parent_plan_title );
$bundle_subscription = $fs_addon->_get_subscription( $addon_license->parent_license_id );
$is_bundle_first_payment_pending = $addon_license->is_first_payment_pending();
$addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
$is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
$available_license = ( $fs->is_free_plan() && ! fs_is_network_admin() ) ?
$fs->_get_available_premium_license( $site->is_localhost() ) :
$available_license_paid_plan = is_object( $available_license ) ?
$fs->_get_plan_by_id( $available_license->plan_id ) :
<div class="wrap fs-section">
<?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
<h2 class="nav-tab-wrapper">
<a href="<?php echo esc_url( $fs->get_account_url() ) ?>"
class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
<?php if ( $fs->has_addons() ) : ?>
<a href="<?php echo esc_url( $fs->_get_admin_page_url( 'addons' ) ) ?>"
class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
<?php if ( $show_upgrade ) : ?>
<a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
<?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
<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>
<div class="has-sidebar has-right-sidebar">
<div class="has-sidebar-content">
<h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
<div class="fs-header-actions">
<?php if ( $fs->is_whitelabeled( true ) ) : ?>
<a href="#" class="debug-license-trigger"><i class="dashicons dashicons-<?php echo $is_whitelabeled ? 'editor-code' : 'controls-pause' ?>"></i> <span><?php
if ( $is_whitelabeled ) {
fs_esc_html_echo_inline( 'Start Debug', 'start-debug-license', $slug );
fs_esc_html_echo_inline( 'Stop Debug', 'stop-debug-license', $slug );
<li> • </li>
<?php if ( $show_billing ) : ?>
<li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></a></li>
<li> • </li>
<?php if ( ! $is_whitelabeled ) : ?>
<?php if ( ! $is_paying ) : ?>
'license' => $available_license,
'license_paid_plan' => $available_license_paid_plan,
fs_require_template( 'account/partials/disconnect-button.php', $view_params ); ?>
<li> • </li>
<?php if ( $is_paying ) : ?>
<?php if ( ! fs_is_network_admin() ) : ?>
<form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
<input type="hidden" name="fs_action" value="deactivate_license">
<?php wp_nonce_field( 'deactivate_license' ) ?>
<a href="#" class="fs-deactivate-license"><i
class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
<li> • </li>
<?php if ( ! $license->is_lifetime() &&
<form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
<input type="hidden" name="fs_action" value="downgrade_account">
<?php wp_nonce_field( 'downgrade_account' ) ?>
onclick="if ( confirm('<?php echo esc_attr( sprintf(
$downgrade_x_confirm_text,
( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
human_time_diff( time(), strtotime( $license->expiration ) )
) ) ?> <?php if ( ! $license->is_block_features ) {
echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
}?> <?php echo esc_attr( $prices_increase_text ) ?> <?php fs_esc_attr_echo_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug ) ?>') ) this.parentNode.submit(); return false;"><i class="dashicons dashicons-download"></i> <?php echo esc_html( $fs->is_only_premium() ? fs_text_inline( 'Cancel Subscription', 'cancel-subscription', $slug ) : $downgrade_text ) ?></a>
<li> • </li>
<?php if ( $is_plan_change_supported ) : ?>
<a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"><i
class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
<li> • </li>
<?php elseif ( $is_paid_trial ) : ?>
<form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
<input type="hidden" name="fs_action" value="cancel_trial">
<?php wp_nonce_field( 'cancel_trial' ) ?>
<a href="#" class="fs-cancel-trial"><i
class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
<li> • </li>
<form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
<input type="hidden" name="fs_action" value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license">
<?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
<a href="#" onclick="this.parentNode.submit(); return false;"><i
class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
<table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
$hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
if ( ! $is_whitelabeled ) {
'title' => fs_text_inline( 'Name', 'name', $slug ),
// if (isset($user->email) && false !== strpos($user->email, '@'))
'title' => fs_text_inline( 'Email', 'email', $slug ),
if ( is_numeric( $user->id ) ) {
'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
'title' => ( $fs->is_plugin() ?
fs_text_inline( 'Plugin', 'plugin', $slug ) :
fs_text_inline( 'Theme', 'theme', $slug ) ),
'value' => $fs->get_plugin_title()
'title' => ( $fs->is_plugin() ?
fs_text_inline( 'Plugin', 'plugin', $slug ) :
fs_text_inline( 'Theme', 'theme', $slug ) ) . ' ' . fs_text_inline( 'ID', 'id', $slug ),
if ( ! fs_is_network_admin()) {
'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
'value' => is_string( $site->id ) ?
fs_text_inline( 'No ID', 'no-id', $slug )
'id' => 'site_public_key',
'title' => fs_text_inline( 'Public Key', 'public-key', $slug ),
'value' => $site->public_key
'id' => 'site_secret_key',
'title' => fs_text_inline( 'Secret Key', 'secret-key', $slug ),
'value' => ( ( is_string( $site->secret_key ) ) ?
fs_text_x_inline( 'No Secret', 'as secret encryption key missing', 'no-secret', $slug )
'title' => $version_text,
'value' => $fs->get_plugin_version()
if ( ! fs_is_network_admin() && $is_premium ) {
'value' => $site->is_beta
if ( $has_paid_plan || $has_bundle_license ) {
'value' => ( is_string( $trial_plan->name ) ?
strtoupper( $trial_plan->title ) :
fs_text_inline( 'Trial', 'trial', $slug ) )
'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
'value' => strtoupper( is_string( $plan->name ) ?
if ( $has_bundle_license ) {
'title' => $bundle_plan_text,
'value' => $bundle_plan_title
if ( is_object( $license ) ) {
if ( ! $hide_license_key ) {
'title' => fs_text_inline( 'License Key', $slug ),
'value' => $license->secret_key,