Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/content-.../inc/freemius/includes
File: class-freemius.php
return false;
[21000] Fix | Delete
}
[21001] Fix | Delete
[21002] Fix | Delete
return FS_Plugin_License::is_valid_id( $this->_license->parent_license_id );
[21003] Fix | Delete
}
[21004] Fix | Delete
[21005] Fix | Delete
/**
[21006] Fix | Delete
* Check if user is a trial or have feature enabled license.
[21007] Fix | Delete
*
[21008] Fix | Delete
* @author Vova Feldman (@svovaf)
[21009] Fix | Delete
* @since 1.1.7
[21010] Fix | Delete
*
[21011] Fix | Delete
* @return bool
[21012] Fix | Delete
*/
[21013] Fix | Delete
function can_use_premium_code() {
[21014] Fix | Delete
return $this->is_trial() || $this->has_features_enabled_license();
[21015] Fix | Delete
}
[21016] Fix | Delete
[21017] Fix | Delete
/**
[21018] Fix | Delete
* Checks if the current user can activate plugins or switch themes. Note that this method should only be used
[21019] Fix | Delete
* after the `init` action is triggered because it is using `current_user_can()` which is only functional after
[21020] Fix | Delete
* the context user is authenticated.
[21021] Fix | Delete
*
[21022] Fix | Delete
* @author Leo Fajardo (@leorw)
[21023] Fix | Delete
* @since 1.2.2
[21024] Fix | Delete
*
[21025] Fix | Delete
* @return bool
[21026] Fix | Delete
*/
[21027] Fix | Delete
function is_user_admin() {
[21028] Fix | Delete
/**
[21029] Fix | Delete
* Require a super-admin when network activated, running from the network level OR if
[21030] Fix | Delete
* running from the site level but not delegated the opt-in.
[21031] Fix | Delete
*
[21032] Fix | Delete
* @author Vova Feldman (@svovaf)
[21033] Fix | Delete
* @since 2.0.0
[21034] Fix | Delete
*/
[21035] Fix | Delete
if ( $this->_is_network_active &&
[21036] Fix | Delete
( fs_is_network_admin() || ! $this->is_delegated_connection() )
[21037] Fix | Delete
) {
[21038] Fix | Delete
return is_super_admin();
[21039] Fix | Delete
}
[21040] Fix | Delete
[21041] Fix | Delete
return ( $this->is_plugin() && current_user_can( is_multisite() ? 'manage_options' : 'activate_plugins' ) )
[21042] Fix | Delete
|| ( $this->is_theme() && current_user_can( 'switch_themes' ) );
[21043] Fix | Delete
}
[21044] Fix | Delete
[21045] Fix | Delete
/**
[21046] Fix | Delete
* Sync site's plan.
[21047] Fix | Delete
*
[21048] Fix | Delete
* @author Vova Feldman (@svovaf)
[21049] Fix | Delete
* @since 1.0.3
[21050] Fix | Delete
*
[21051] Fix | Delete
* @uses FS_Api
[21052] Fix | Delete
*
[21053] Fix | Delete
* @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by
[21054] Fix | Delete
* the admin.
[21055] Fix | Delete
* @param bool $is_context_single_site @since 2.0.0. This is used when syncing a license for a single install from the
[21056] Fix | Delete
* network-level "Account" page.
[21057] Fix | Delete
* @param int|null $current_blog_id @since 2.2.3. This is passed from the `execute_cron` method and used by the
[21058] Fix | Delete
* `_sync_plugin_license` method in order to switch to the previous blog when sending
[21059] Fix | Delete
* updates for a single site in case `execute_cron` has switched to a different blog.
[21060] Fix | Delete
*/
[21061] Fix | Delete
private function _sync_license( $background = false, $is_context_single_site = false, $current_blog_id = null ) {
[21062] Fix | Delete
$this->_logger->entrance();
[21063] Fix | Delete
[21064] Fix | Delete
$plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
[21065] Fix | Delete
[21066] Fix | Delete
$is_addon_sync = ( ! $this->_plugin->is_addon() && $plugin_id != $this->get_id() );
[21067] Fix | Delete
[21068] Fix | Delete
if ( $is_addon_sync ) {
[21069] Fix | Delete
$this->_sync_addon_license( $plugin_id, $background );
[21070] Fix | Delete
} else {
[21071] Fix | Delete
$this->_sync_plugin_license( $background, true, $is_context_single_site, $current_blog_id );
[21072] Fix | Delete
}
[21073] Fix | Delete
[21074] Fix | Delete
$this->do_action( 'after_account_plan_sync', $this->get_plan_name() );
[21075] Fix | Delete
}
[21076] Fix | Delete
[21077] Fix | Delete
/**
[21078] Fix | Delete
* Sync plugin's add-on license.
[21079] Fix | Delete
*
[21080] Fix | Delete
* @author Vova Feldman (@svovaf)
[21081] Fix | Delete
* @since 1.0.6
[21082] Fix | Delete
* @uses FS_Api
[21083] Fix | Delete
*
[21084] Fix | Delete
* @param number $addon_id
[21085] Fix | Delete
* @param bool $background
[21086] Fix | Delete
*/
[21087] Fix | Delete
private function _sync_addon_license( $addon_id, $background ) {
[21088] Fix | Delete
$this->_logger->entrance();
[21089] Fix | Delete
[21090] Fix | Delete
if ( $this->is_addon_activated( $addon_id ) ) {
[21091] Fix | Delete
// If already installed, use add-on sync.
[21092] Fix | Delete
$fs_addon = self::get_instance_by_id( $addon_id );
[21093] Fix | Delete
[21094] Fix | Delete
if (
[21095] Fix | Delete
// Add-on is network activated and network integrated.
[21096] Fix | Delete
$fs_addon->is_network_active() ||
[21097] Fix | Delete
// Background sync cron.
[21098] Fix | Delete
self::is_cron() ||
[21099] Fix | Delete
// Add-on is not network activated or not network integrated.
[21100] Fix | Delete
! fs_is_network_admin()
[21101] Fix | Delete
) {
[21102] Fix | Delete
$fs_addon->_sync_license( $background );
[21103] Fix | Delete
[21104] Fix | Delete
return;
[21105] Fix | Delete
}
[21106] Fix | Delete
}
[21107] Fix | Delete
[21108] Fix | Delete
// Validate add-on exists.
[21109] Fix | Delete
$addon = $this->get_addon( $addon_id );
[21110] Fix | Delete
[21111] Fix | Delete
if ( ! is_object( $addon ) ) {
[21112] Fix | Delete
return;
[21113] Fix | Delete
}
[21114] Fix | Delete
[21115] Fix | Delete
// Add add-on into account add-ons.
[21116] Fix | Delete
$account_addons = $this->get_account_addons();
[21117] Fix | Delete
if ( ! is_array( $account_addons ) ) {
[21118] Fix | Delete
$account_addons = array();
[21119] Fix | Delete
}
[21120] Fix | Delete
$account_addons[] = $addon->id;
[21121] Fix | Delete
$account_addons = array_unique( $account_addons );
[21122] Fix | Delete
$this->_store_account_addons( $account_addons );
[21123] Fix | Delete
[21124] Fix | Delete
// Load add-on licenses.
[21125] Fix | Delete
$licenses = $this->_fetch_licenses( $addon->id );
[21126] Fix | Delete
[21127] Fix | Delete
// Sync add-on licenses.
[21128] Fix | Delete
if ( $this->is_array_instanceof( $licenses, 'FS_Plugin_License' ) ) {
[21129] Fix | Delete
$this->_update_licenses( $licenses, $addon->id );
[21130] Fix | Delete
[21131] Fix | Delete
if ( ! $this->is_addon_installed( $addon->id ) && FS_License_Manager::has_premium_license( $licenses ) ) {
[21132] Fix | Delete
$plans_result = $this->get_api_site_or_plugin_scope()->get( $this->add_show_pending( "/addons/{$addon_id}/plans.json" ) );
[21133] Fix | Delete
[21134] Fix | Delete
if ( ! isset( $plans_result->error ) ) {
[21135] Fix | Delete
$plans = array();
[21136] Fix | Delete
foreach ( $plans_result->plans as $plan ) {
[21137] Fix | Delete
$plans[] = new FS_Plugin_Plan( $plan );
[21138] Fix | Delete
}
[21139] Fix | Delete
[21140] Fix | Delete
$this->_admin_notices->add_sticky(
[21141] Fix | Delete
sprintf(
[21142] Fix | Delete
( FS_Plan_Manager::instance()->has_free_plan( $plans ) ?
[21143] Fix | Delete
$this->get_text_inline( 'Your %s Add-on plan was successfully upgraded.', 'addon-successfully-upgraded-message' ) :
[21144] Fix | Delete
/* translators: %s:product name, e.g. Facebook add-on was successfully... */
[21145] Fix | Delete
$this->get_text_inline( '%s Add-on was successfully purchased.', 'addon-successfully-purchased-message' ) ),
[21146] Fix | Delete
$addon->title
[21147] Fix | Delete
) . ' ' . $this->get_latest_download_link(
[21148] Fix | Delete
$this->get_text_inline( 'Download the latest version', 'download-latest-version' ),
[21149] Fix | Delete
$addon_id
[21150] Fix | Delete
),
[21151] Fix | Delete
'addon_plan_upgraded_' . $addon->slug,
[21152] Fix | Delete
$this->get_text_x_inline( 'Yee-haw', 'interjection expressing joy or exuberance', 'yee-haw' ) . '!'
[21153] Fix | Delete
);
[21154] Fix | Delete
}
[21155] Fix | Delete
}
[21156] Fix | Delete
}
[21157] Fix | Delete
}
[21158] Fix | Delete
[21159] Fix | Delete
/**
[21160] Fix | Delete
* Sync site's plugin plan.
[21161] Fix | Delete
*
[21162] Fix | Delete
* @author Vova Feldman (@svovaf)
[21163] Fix | Delete
* @since 1.0.6
[21164] Fix | Delete
* @uses FS_Api
[21165] Fix | Delete
*
[21166] Fix | Delete
* @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by the admin.
[21167] Fix | Delete
* @param bool $send_installs_update Since 2.0.0
[21168] Fix | Delete
* @param bool $is_context_single_site Since 2.0.0. This is used when sending an update for a single install and
[21169] Fix | Delete
* syncing its license from the network-level "Account" page (e.g.: after
[21170] Fix | Delete
* activating a license only for the single install).
[21171] Fix | Delete
* @param int|null $current_blog_id Since 2.2.3. This is passed from the `execute_cron` method so that it
[21172] Fix | Delete
* can be used here to switch to the previous blog in case `execute_cron`
[21173] Fix | Delete
* has switched to a different blog.
[21174] Fix | Delete
*/
[21175] Fix | Delete
private function _sync_plugin_license(
[21176] Fix | Delete
$background = false,
[21177] Fix | Delete
$send_installs_update = true,
[21178] Fix | Delete
$is_context_single_site = false,
[21179] Fix | Delete
$current_blog_id = null
[21180] Fix | Delete
) {
[21181] Fix | Delete
$this->_logger->entrance();
[21182] Fix | Delete
[21183] Fix | Delete
$plan_change = 'none';
[21184] Fix | Delete
[21185] Fix | Delete
$is_site_level_sync = ( $is_context_single_site || fs_is_blog_admin() || ! $this->_is_network_active );
[21186] Fix | Delete
[21187] Fix | Delete
if ( ! $send_installs_update ) {
[21188] Fix | Delete
$site = $this->_site;
[21189] Fix | Delete
} else {
[21190] Fix | Delete
/**
[21191] Fix | Delete
* Sync site info.
[21192] Fix | Delete
*
[21193] Fix | Delete
* @todo This line will execute install sync on a daily basis, even if running the free version (for opted-in users). The reason we want to keep it that way is for cases when the user was a paying customer, then there was a failure in subscription payment, and then after some time the payment was successful. This could be heavily optimized. For example, we can skip the $flush if the current install was never associated with a paid version.
[21194] Fix | Delete
*/
[21195] Fix | Delete
if ( $is_site_level_sync ) {
[21196] Fix | Delete
/**
[21197] Fix | Delete
* Switch to the previous blog since `execute_cron` may have switched to a different blog.
[21198] Fix | Delete
*
[21199] Fix | Delete
* @author Leo Fajardo (@leorw)
[21200] Fix | Delete
* @since 2.2.3
[21201] Fix | Delete
*/
[21202] Fix | Delete
if ( is_numeric( $current_blog_id ) ) {
[21203] Fix | Delete
$this->switch_to_blog( $current_blog_id );
[21204] Fix | Delete
}
[21205] Fix | Delete
[21206] Fix | Delete
$result = $this->send_install_update( array(), true, true );
[21207] Fix | Delete
$is_valid = $this->is_api_result_entity( $result );
[21208] Fix | Delete
} else {
[21209] Fix | Delete
$result = $this->send_installs_update( array(), true, true );
[21210] Fix | Delete
$is_valid = $this->is_api_result_object( $result, 'installs' );
[21211] Fix | Delete
}
[21212] Fix | Delete
[21213] Fix | Delete
if ( ! $is_valid ) {
[21214] Fix | Delete
if ( $is_context_single_site ) {
[21215] Fix | Delete
// Switch back to the main blog so that the following logic will have the right entities.
[21216] Fix | Delete
$this->switch_to_blog( $this->_storage->network_install_blog_id );
[21217] Fix | Delete
}
[21218] Fix | Delete
[21219] Fix | Delete
// Show API message only if not background sync or if paying customer.
[21220] Fix | Delete
if ( ! $background || $this->is_paying() ) {
[21221] Fix | Delete
// Try to ping API to see if not blocked.
[21222] Fix | Delete
if ( FS_Api::is_blocked( $result ) ) {
[21223] Fix | Delete
/**
[21224] Fix | Delete
* @author Vova Feldman (@svovaf)
[21225] Fix | Delete
* @since 1.1.6 Only show message related to one of the Freemius powered plugins. Once it will be resolved it will fix the issue for all plugins anyways. There's no point to scare users with multiple error messages.
[21226] Fix | Delete
*/
[21227] Fix | Delete
if ( ! self::$_global_admin_notices->has_sticky( 'api_blocked' ) ) {
[21228] Fix | Delete
// Add notice immediately if not a background sync.
[21229] Fix | Delete
$add_notice = ( ! $background );
[21230] Fix | Delete
[21231] Fix | Delete
if ( ! $add_notice ) {
[21232] Fix | Delete
$counter = (int) get_transient( '_fs_api_connection_retry_counter' );
[21233] Fix | Delete
[21234] Fix | Delete
// We only want to add the notice after 3 consecutive failures.
[21235] Fix | Delete
$add_notice = ( 3 <= $counter );
[21236] Fix | Delete
[21237] Fix | Delete
if ( ! $add_notice ) {
[21238] Fix | Delete
/**
[21239] Fix | Delete
* Update counter transient only if notice shouldn't be added. If it is added the transient will be reset anyway, because the retries mechanism should only start counting if the admin isn't aware of the connectivity issue.
[21240] Fix | Delete
*
[21241] Fix | Delete
* Also, since the background sync happens once a day, setting the transient expiration for a week should be enough to count 3 failures, if there's an actual connectivity issue.
[21242] Fix | Delete
*/
[21243] Fix | Delete
set_transient( '_fs_api_connection_retry_counter', $counter + 1, WP_FS__TIME_WEEK_IN_SEC );
[21244] Fix | Delete
}
[21245] Fix | Delete
}
[21246] Fix | Delete
[21247] Fix | Delete
// Add notice instantly for not-background sync and only after 3 failed attempts for background sync.
[21248] Fix | Delete
if ( $add_notice ) {
[21249] Fix | Delete
self::$_global_admin_notices->add(
[21250] Fix | Delete
$this->generate_api_blocked_notice_message_from_result( $result ),
[21251] Fix | Delete
'',
[21252] Fix | Delete
'error',
[21253] Fix | Delete
$background,
[21254] Fix | Delete
'api_blocked'
[21255] Fix | Delete
);
[21256] Fix | Delete
[21257] Fix | Delete
add_action( 'admin_footer', array( 'Freemius', '_add_api_connectivity_notice_handler_js' ) );
[21258] Fix | Delete
[21259] Fix | Delete
// Notice was just shown, reset connectivity counter.
[21260] Fix | Delete
delete_transient( '_fs_api_connection_retry_counter' );
[21261] Fix | Delete
}
[21262] Fix | Delete
}
[21263] Fix | Delete
} else if ( is_object( $result ) ) {
[21264] Fix | Delete
// Authentication params are broken.
[21265] Fix | Delete
$this->_admin_notices->add(
[21266] Fix | Delete
$this->get_text_inline( 'It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again.', 'wrong-authentication-param-message' ) . '<br> ' . $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . var_export( $result->error, true ),
[21267] Fix | Delete
'',
[21268] Fix | Delete
'error'
[21269] Fix | Delete
);
[21270] Fix | Delete
}
[21271] Fix | Delete
}
[21272] Fix | Delete
[21273] Fix | Delete
// No reason to continue with license sync while there are API issues.
[21274] Fix | Delete
return;
[21275] Fix | Delete
}
[21276] Fix | Delete
[21277] Fix | Delete
// API is working now. Delete the transient and start afresh.
[21278] Fix | Delete
delete_transient('_fs_api_connection_retry_counter');
[21279] Fix | Delete
[21280] Fix | Delete
if ( $is_site_level_sync ) {
[21281] Fix | Delete
$site = new FS_Site( $result );
[21282] Fix | Delete
} else {
[21283] Fix | Delete
// Map site addresses to their blog IDs.
[21284] Fix | Delete
$address_to_blog_map = $this->get_address_to_blog_map();
[21285] Fix | Delete
[21286] Fix | Delete
// Find the current context install.
[21287] Fix | Delete
$site = null;
[21288] Fix | Delete
foreach ( $result->installs as $install ) {
[21289] Fix | Delete
if ( $install->id == $this->_site->id ) {
[21290] Fix | Delete
$site = new FS_Site( $install );
[21291] Fix | Delete
} else {
[21292] Fix | Delete
$address = trailingslashit( fs_strip_url_protocol( $install->url ) );
[21293] Fix | Delete
$blog_id = $address_to_blog_map[ $address ];
[21294] Fix | Delete
[21295] Fix | Delete
$this->_store_site( true, $blog_id, new FS_Site( $install ) );
[21296] Fix | Delete
}
[21297] Fix | Delete
}
[21298] Fix | Delete
}
[21299] Fix | Delete
[21300] Fix | Delete
// Sync plans.
[21301] Fix | Delete
$this->_sync_plans();
[21302] Fix | Delete
}
[21303] Fix | Delete
[21304] Fix | Delete
// Remove sticky API connectivity message.
[21305] Fix | Delete
self::$_global_admin_notices->remove_sticky( 'api_blocked' );
[21306] Fix | Delete
[21307] Fix | Delete
if ( ! $this->has_paid_plan() ) {
[21308] Fix | Delete
$this->_site = $site;
[21309] Fix | Delete
$this->_store_site(
[21310] Fix | Delete
true,
[21311] Fix | Delete
$is_site_level_sync ?
[21312] Fix | Delete
null :
[21313] Fix | Delete
$this->get_network_install_blog_id()
[21314] Fix | Delete
);
[21315] Fix | Delete
} else {
[21316] Fix | Delete
$context_blog_id = 0;
[21317] Fix | Delete
[21318] Fix | Delete
if ( $is_context_single_site ) {
[21319] Fix | Delete
$context_blog_id = get_current_blog_id();
[21320] Fix | Delete
[21321] Fix | Delete
// Switch back to the main blog in order to properly sync the license.
[21322] Fix | Delete
$this->switch_to_blog( $this->_storage->network_install_blog_id );
[21323] Fix | Delete
}
[21324] Fix | Delete
[21325] Fix | Delete
/**
[21326] Fix | Delete
* Sync licenses. Pass the site's license ID so that the foreign licenses will be fetched if the license
[21327] Fix | Delete
* associated with that ID is not included in the user's licenses collection.
[21328] Fix | Delete
*/
[21329] Fix | Delete
$this->_sync_licenses(
[21330] Fix | Delete
$site->license_id,
[21331] Fix | Delete
( $is_context_single_site ?
[21332] Fix | Delete
$context_blog_id :
[21333] Fix | Delete
null
[21334] Fix | Delete
)
[21335] Fix | Delete
);
[21336] Fix | Delete
[21337] Fix | Delete
if ( $is_context_single_site ) {
[21338] Fix | Delete
$this->switch_to_blog( $context_blog_id );
[21339] Fix | Delete
}
[21340] Fix | Delete
[21341] Fix | Delete
// Check if plan / license changed.
[21342] Fix | Delete
if ( $site->plan_id != $this->_site->plan_id ||
[21343] Fix | Delete
// Check if trial started.
[21344] Fix | Delete
$site->trial_plan_id != $this->_site->trial_plan_id ||
[21345] Fix | Delete
$site->trial_ends != $this->_site->trial_ends ||
[21346] Fix | Delete
// Check if license changed.
[21347] Fix | Delete
$site->license_id != $this->_site->license_id
[21348] Fix | Delete
) {
[21349] Fix | Delete
if ( $site->is_trial() && ( ! $this->_site->is_trial() || $site->trial_ends != $this->_site->trial_ends ) ) {
[21350] Fix | Delete
// New trial started.
[21351] Fix | Delete
$this->_site = $site;
[21352] Fix | Delete
$plan_change = 'trial_started';
[21353] Fix | Delete
[21354] Fix | Delete
// For trial with subscription use-case.
[21355] Fix | Delete
$new_license = is_null( $site->license_id ) ? null : $this->_get_license_by_id( $site->license_id );
[21356] Fix | Delete
[21357] Fix | Delete
if ( is_object( $new_license ) && $new_license->is_valid() ) {
[21358] Fix | Delete
$this->_site = $site;
[21359] Fix | Delete
$this->_update_site_license( $new_license );
[21360] Fix | Delete
$this->_store_licenses();
[21361] Fix | Delete
[21362] Fix | Delete
$this->_sync_site_subscription( $this->_license );
[21363] Fix | Delete
}
[21364] Fix | Delete
} else if ( $this->_site->is_trial() && ! $site->is_trial() && ! is_numeric( $site->license_id ) ) {
[21365] Fix | Delete
// Was in trial, but now trial expired and no license ID.
[21366] Fix | Delete
// New trial started.
[21367] Fix | Delete
$this->_site = $site;
[21368] Fix | Delete
$plan_change = 'trial_expired';
[21369] Fix | Delete
} else {
[21370] Fix | Delete
$is_free = $this->is_free_plan();
[21371] Fix | Delete
[21372] Fix | Delete
// Make sure license exist and not expired.
[21373] Fix | Delete
$new_license = is_null( $site->license_id ) ?
[21374] Fix | Delete
null :
[21375] Fix | Delete
$this->_get_license_by_id( $site->license_id );
[21376] Fix | Delete
[21377] Fix | Delete
if ( $is_free && is_null( $new_license ) && $this->has_any_license() && $this->_license->is_cancelled ) {
[21378] Fix | Delete
// License cancelled.
[21379] Fix | Delete
$this->_site = $site;
[21380] Fix | Delete
$this->_update_site_license( $new_license );
[21381] Fix | Delete
$this->_store_licenses();
[21382] Fix | Delete
[21383] Fix | Delete
$plan_change = 'cancelled';
[21384] Fix | Delete
} else if ( $is_free && ( ( ! is_object( $new_license ) || $new_license->is_expired() ) ) ) {
[21385] Fix | Delete
// The license is expired, so ignore upgrade method.
[21386] Fix | Delete
$this->_site = $site;
[21387] Fix | Delete
} else {
[21388] Fix | Delete
// License changed.
[21389] Fix | Delete
$this->_site = $site;
[21390] Fix | Delete
[21391] Fix | Delete
/**
[21392] Fix | Delete
* IMPORTANT:
[21393] Fix | Delete
* The line below should be executed before trying to activate the license on the rest of the network, otherwise, the license' activation counters may be out of sync + there's no need to activate the license on the context site since it's already activated on it.
[21394] Fix | Delete
*
[21395] Fix | Delete
* @author Vova Feldman (@svovaf)
[21396] Fix | Delete
* @since 2.0.0
[21397] Fix | Delete
*/
[21398] Fix | Delete
$this->_update_site_license( $new_license );
[21399] Fix | Delete
[21400] Fix | Delete
if ( ! $is_context_single_site &&
[21401] Fix | Delete
fs_is_network_admin() &&
[21402] Fix | Delete
$this->_is_network_active &&
[21403] Fix | Delete
$new_license->quota > 1 &&
[21404] Fix | Delete
get_blog_count() > 1
[21405] Fix | Delete
) {
[21406] Fix | Delete
// See if license can activated on all sites.
[21407] Fix | Delete
if ( ! $this->try_activate_license_on_network( $this->_user, $new_license ) ) {
[21408] Fix | Delete
if ( ! fs_request_get_bool( 'auto_install' ) ) {
[21409] Fix | Delete
// Open the license activation dialog box on the account page.
[21410] Fix | Delete
add_action( 'admin_footer', array(
[21411] Fix | Delete
&$this,
[21412] Fix | Delete
'_open_license_activation_dialog_box'
[21413] Fix | Delete
) );
[21414] Fix | Delete
}
[21415] Fix | Delete
}
[21416] Fix | Delete
}
[21417] Fix | Delete
[21418] Fix | Delete
$this->_store_licenses();
[21419] Fix | Delete
[21420] Fix | Delete
$plan_change = $is_free ?
[21421] Fix | Delete
( $this->is_only_premium() ? 'activated' : 'upgraded' ) :
[21422] Fix | Delete
( is_object( $new_license ) ?
[21423] Fix | Delete
'changed' :
[21424] Fix | Delete
'downgraded' );
[21425] Fix | Delete
}
[21426] Fix | Delete
}
[21427] Fix | Delete
[21428] Fix | Delete
// Store updated site info.
[21429] Fix | Delete
$this->_store_site(
[21430] Fix | Delete
true,
[21431] Fix | Delete
$is_site_level_sync ?
[21432] Fix | Delete
null :
[21433] Fix | Delete
$this->get_network_install_blog_id()
[21434] Fix | Delete
);
[21435] Fix | Delete
} else {
[21436] Fix | Delete
if ( ! is_object( $this->_license ) ) {
[21437] Fix | Delete
$this->maybe_update_whitelabel_flag(
[21438] Fix | Delete
FS_Plugin_License::is_valid_id( $site->license_id ) ?
[21439] Fix | Delete
$this->get_license_by_id( $site->license_id ) :
[21440] Fix | Delete
null
[21441] Fix | Delete
);
[21442] Fix | Delete
} else {
[21443] Fix | Delete
$this->maybe_update_whitelabel_flag( $this->_license );
[21444] Fix | Delete
[21445] Fix | Delete
if ( $this->_license->is_expired() ) {
[21446] Fix | Delete
if ( ! $this->has_features_enabled_license() ) {
[21447] Fix | Delete
$this->_deactivate_license();
[21448] Fix | Delete
$plan_change = 'downgraded';
[21449] Fix | Delete
} else {
[21450] Fix | Delete
$last_time_expired_license_notice_was_shown = $this->_storage->get( 'expired_license_notice_shown', 0 );
[21451] Fix | Delete
[21452] Fix | Delete
if ( time() - ( 14 * WP_FS__TIME_24_HOURS_IN_SEC ) >= $last_time_expired_license_notice_was_shown ) {
[21453] Fix | Delete
/**
[21454] Fix | Delete
* Show the expired license notice every 14 days.
[21455] Fix | Delete
*
[21456] Fix | Delete
* @author Leo Fajardo (@leorw)
[21457] Fix | Delete
* @since 2.3.1
[21458] Fix | Delete
*/
[21459] Fix | Delete
$plan_change = 'expired';
[21460] Fix | Delete
}
[21461] Fix | Delete
}
[21462] Fix | Delete
}
[21463] Fix | Delete
}
[21464] Fix | Delete
[21465] Fix | Delete
if ( is_numeric( $site->license_id ) && is_object( $this->_license ) ) {
[21466] Fix | Delete
$this->_sync_site_subscription( $this->_license );
[21467] Fix | Delete
}
[21468] Fix | Delete
}
[21469] Fix | Delete
[21470] Fix | Delete
if ( ! $this->is_addon() &&
[21471] Fix | Delete
$this->_site->is_beta() !== $site->is_beta()
[21472] Fix | Delete
) {
[21473] Fix | Delete
// Beta flag updated.
[21474] Fix | Delete
$this->_site = $site;
[21475] Fix | Delete
[21476] Fix | Delete
$this->_store_site(
[21477] Fix | Delete
true,
[21478] Fix | Delete
$is_site_level_sync ?
[21479] Fix | Delete
null :
[21480] Fix | Delete
$this->get_network_install_blog_id()
[21481] Fix | Delete
);
[21482] Fix | Delete
}
[21483] Fix | Delete
[21484] Fix | Delete
if ( $this->is_addon() || $this->has_addons() ) {
[21485] Fix | Delete
/**
[21486] Fix | Delete
* Purge the valid user licenses cache so that when the "Account" or the "Add-Ons" page is loaded,
[21487] Fix | Delete
* an updated valid user licenses collection will be fetched from the server which is used to also
[21488] Fix | Delete
* update the account add-ons (add-ons the user has licenses for).
[21489] Fix | Delete
*
[21490] Fix | Delete
* @author Leo Fajardo (@leorw)
[21491] Fix | Delete
* @since 2.2.4
[21492] Fix | Delete
*/
[21493] Fix | Delete
$this->purge_valid_user_licenses_cache();
[21494] Fix | Delete
}
[21495] Fix | Delete
}
[21496] Fix | Delete
[21497] Fix | Delete
$hmm_text = $this->get_text_x_inline( 'Hmm', 'something somebody says when they are thinking about what you have just said.', 'hmm' ) . '...';
[21498] Fix | Delete
[21499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function