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/clone/wp-conte.../plugins/content-.../inc/freemius/includes
File: class-freemius.php
$this->setup_user( $user_id, $user_public_key, $user_secret_key );
[18000] Fix | Delete
[18001] Fix | Delete
if ( ! is_null( $is_marketing_allowed ) ) {
[18002] Fix | Delete
$this->disable_opt_in_notice_and_lock_user();
[18003] Fix | Delete
}
[18004] Fix | Delete
[18005] Fix | Delete
FS_Permission_Manager::instance( $this )->update_permissions_tracking_flag( array(
[18006] Fix | Delete
FS_Permission_Manager::PERMISSION_DIAGNOSTIC => $is_diagnostic_tracking_allowed,
[18007] Fix | Delete
FS_Permission_Manager::PERMISSION_EXTENSIONS => $is_extensions_tracking_allowed,
[18008] Fix | Delete
) );
[18009] Fix | Delete
[18010] Fix | Delete
$install_ids = array();
[18011] Fix | Delete
[18012] Fix | Delete
foreach ( $installs as $install ) {
[18013] Fix | Delete
$install_ids[] = $install->id;
[18014] Fix | Delete
}
[18015] Fix | Delete
[18016] Fix | Delete
$items_per_request = 25;
[18017] Fix | Delete
$left = count( $install_ids );
[18018] Fix | Delete
$offset = 0;
[18019] Fix | Delete
[18020] Fix | Delete
$installs = array();
[18021] Fix | Delete
while ( $left > 0 ) {
[18022] Fix | Delete
$result = $this->get_api_user_scope()->get( "/plugins/{$this->_module_id}/installs.json?ids=" . implode( ',', array_slice( $install_ids, $offset, $items_per_request ) ) );
[18023] Fix | Delete
[18024] Fix | Delete
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
[18025] Fix | Delete
// @todo Handle API error.
[18026] Fix | Delete
}
[18027] Fix | Delete
[18028] Fix | Delete
$installs = array_merge( $installs, $result->installs );
[18029] Fix | Delete
[18030] Fix | Delete
$left -= $items_per_request;
[18031] Fix | Delete
$offset += $items_per_request;
[18032] Fix | Delete
}
[18033] Fix | Delete
[18034] Fix | Delete
foreach ( $installs as &$install ) {
[18035] Fix | Delete
$install = new FS_Site( $install );
[18036] Fix | Delete
}
[18037] Fix | Delete
[18038] Fix | Delete
return $this->setup_network_account(
[18039] Fix | Delete
$this->_user,
[18040] Fix | Delete
$installs,
[18041] Fix | Delete
$redirect,
[18042] Fix | Delete
$auto_install
[18043] Fix | Delete
);
[18044] Fix | Delete
}
[18045] Fix | Delete
[18046] Fix | Delete
/**
[18047] Fix | Delete
* @author Vova Feldman (@svovaf)
[18048] Fix | Delete
* @since 1.1.7.4
[18049] Fix | Delete
*
[18050] Fix | Delete
* @param string|bool $email
[18051] Fix | Delete
* @param bool $redirect
[18052] Fix | Delete
* @param string|bool $license_key Since 1.2.1.5
[18053] Fix | Delete
* @param bool $is_pending_trial Since 1.2.1.5
[18054] Fix | Delete
* @param bool $is_suspicious_email Since 2.5.0
[18055] Fix | Delete
* @param bool $has_upgrade_context Since 2.5.3
[18056] Fix | Delete
* @param bool|string $support_email_address Since 2.5.3
[18057] Fix | Delete
*
[18058] Fix | Delete
* @return string Since 1.2.1.5 if $redirect is `false`, return the pending activation page.
[18059] Fix | Delete
*/
[18060] Fix | Delete
private function set_pending_confirmation(
[18061] Fix | Delete
$email = false,
[18062] Fix | Delete
$redirect = true,
[18063] Fix | Delete
$license_key = false,
[18064] Fix | Delete
$is_pending_trial = false,
[18065] Fix | Delete
$is_suspicious_email = false,
[18066] Fix | Delete
$has_upgrade_context = false,
[18067] Fix | Delete
$support_email_address = false
[18068] Fix | Delete
) {
[18069] Fix | Delete
$is_network_admin = fs_is_network_admin();
[18070] Fix | Delete
[18071] Fix | Delete
if ( $this->_ignore_pending_mode && ! $has_upgrade_context ) {
[18072] Fix | Delete
/**
[18073] Fix | Delete
* If explicitly asked to ignore pending mode, set to anonymous mode
[18074] Fix | Delete
* if require confirmation before finalizing the opt-in except after completing a purchase (otherwise, in this case, they wouldn't see any notice telling them that they should receive their license key via email).
[18075] Fix | Delete
*
[18076] Fix | Delete
* @author Vova Feldman
[18077] Fix | Delete
* @since 1.2.1.6
[18078] Fix | Delete
*/
[18079] Fix | Delete
$this->skip_connection( $is_network_admin );
[18080] Fix | Delete
} else {
[18081] Fix | Delete
// Install must be activated via email since
[18082] Fix | Delete
// user with the same email already exist.
[18083] Fix | Delete
$this->_storage->is_pending_activation = true;
[18084] Fix | Delete
$this->_add_pending_activation_notice(
[18085] Fix | Delete
$email,
[18086] Fix | Delete
$is_pending_trial,
[18087] Fix | Delete
$is_suspicious_email,
[18088] Fix | Delete
$has_upgrade_context,
[18089] Fix | Delete
$support_email_address
[18090] Fix | Delete
);
[18091] Fix | Delete
}
[18092] Fix | Delete
[18093] Fix | Delete
if ( ! empty( $license_key ) ) {
[18094] Fix | Delete
$this->_storage->pending_license_key = $license_key;
[18095] Fix | Delete
}
[18096] Fix | Delete
[18097] Fix | Delete
// Remove the opt-in sticky notice.
[18098] Fix | Delete
$this->_admin_notices->remove_sticky( array(
[18099] Fix | Delete
'connect_account',
[18100] Fix | Delete
'trial_promotion',
[18101] Fix | Delete
) );
[18102] Fix | Delete
[18103] Fix | Delete
$next_page = $this->get_after_activation_url( 'after_pending_connect_url' );
[18104] Fix | Delete
[18105] Fix | Delete
if ( $redirect ) {
[18106] Fix | Delete
// Reload the page with a pending activation message.
[18107] Fix | Delete
fs_redirect( $next_page );
[18108] Fix | Delete
}
[18109] Fix | Delete
[18110] Fix | Delete
return $next_page;
[18111] Fix | Delete
}
[18112] Fix | Delete
[18113] Fix | Delete
/**
[18114] Fix | Delete
* Install plugin with current logged WP user info.
[18115] Fix | Delete
*
[18116] Fix | Delete
* @author Vova Feldman (@svovaf)
[18117] Fix | Delete
* @since 1.0.7
[18118] Fix | Delete
*/
[18119] Fix | Delete
function _install_with_current_user() {
[18120] Fix | Delete
$this->_logger->entrance();
[18121] Fix | Delete
[18122] Fix | Delete
if ( $this->is_registered() ) {
[18123] Fix | Delete
return;
[18124] Fix | Delete
}
[18125] Fix | Delete
[18126] Fix | Delete
if ( fs_request_is_action( $this->get_unique_affix() . '_activate_existing' ) && fs_request_is_post() ) {
[18127] Fix | Delete
check_admin_referer( $this->get_unique_affix() . '_activate_existing' );
[18128] Fix | Delete
[18129] Fix | Delete
/**
[18130] Fix | Delete
* @author Vova Feldman (@svovaf)
[18131] Fix | Delete
* @since 1.1.9 Add license key if given.
[18132] Fix | Delete
*/
[18133] Fix | Delete
$license_key = fs_request_get_raw( 'license_secret_key' );
[18134] Fix | Delete
[18135] Fix | Delete
FS_Permission_Manager::instance( $this )->update_permissions_tracking_flag( array(
[18136] Fix | Delete
FS_Permission_Manager::PERMISSION_DIAGNOSTIC => fs_request_get_bool( 'is_diagnostic_tracking_allowed', null ),
[18137] Fix | Delete
FS_Permission_Manager::PERMISSION_EXTENSIONS => fs_request_get_bool( 'is_extensions_tracking_allowed', null ),
[18138] Fix | Delete
) );
[18139] Fix | Delete
[18140] Fix | Delete
$this->install_with_current_user( $license_key );
[18141] Fix | Delete
}
[18142] Fix | Delete
}
[18143] Fix | Delete
[18144] Fix | Delete
[18145] Fix | Delete
/**
[18146] Fix | Delete
* @author Vova Feldman (@svovaf)
[18147] Fix | Delete
* @since 1.1.7.4
[18148] Fix | Delete
*
[18149] Fix | Delete
* @param string|bool $license_key
[18150] Fix | Delete
* @param number|bool $trial_plan_id
[18151] Fix | Delete
* @param array $sites Since 2.0.0
[18152] Fix | Delete
* @param bool $redirect
[18153] Fix | Delete
*
[18154] Fix | Delete
* @return object|string If redirect is `false`, returns the next page the user should be redirected to, or the API error object if failed to install.
[18155] Fix | Delete
*/
[18156] Fix | Delete
function install_with_current_user(
[18157] Fix | Delete
$license_key = false,
[18158] Fix | Delete
$trial_plan_id = false,
[18159] Fix | Delete
$sites = array(),
[18160] Fix | Delete
$redirect = true
[18161] Fix | Delete
) {
[18162] Fix | Delete
// Get current logged WP user.
[18163] Fix | Delete
$current_user = self::_get_current_wp_user();
[18164] Fix | Delete
[18165] Fix | Delete
// Find the relevant FS user by the email.
[18166] Fix | Delete
$user = self::_get_user_by_email( $current_user->user_email );
[18167] Fix | Delete
[18168] Fix | Delete
return $this->install_with_user( $user, $license_key, $trial_plan_id, $redirect, true, $sites );
[18169] Fix | Delete
}
[18170] Fix | Delete
[18171] Fix | Delete
/**
[18172] Fix | Delete
* @author Vova Feldman (@svovaf)
[18173] Fix | Delete
* @since 2.0.0
[18174] Fix | Delete
*
[18175] Fix | Delete
* @param \FS_User $user
[18176] Fix | Delete
* @param string|bool $license_key
[18177] Fix | Delete
* @param number|bool $trial_plan_id
[18178] Fix | Delete
* @param bool $redirect
[18179] Fix | Delete
* @param bool $setup_account Since 2.0.0. When set to FALSE, executes a light installation without setting up the account as if it's the first opt-in.
[18180] Fix | Delete
* @param array $sites Since 2.0.0. If not empty, should be a collection of site details for the bulk install API request.
[18181] Fix | Delete
*
[18182] Fix | Delete
* @return \FS_Site|object|string If redirect is `false`, returns the next page the user should be redirected to, or the API error object if failed to install. If $setup_account is set to `false`, return the newly created install.
[18183] Fix | Delete
*/
[18184] Fix | Delete
function install_with_user(
[18185] Fix | Delete
FS_User $user,
[18186] Fix | Delete
$license_key = false,
[18187] Fix | Delete
$trial_plan_id = false,
[18188] Fix | Delete
$redirect = true,
[18189] Fix | Delete
$setup_account = true,
[18190] Fix | Delete
$sites = array()
[18191] Fix | Delete
) {
[18192] Fix | Delete
// We have to set the user before getting user scope API handler.
[18193] Fix | Delete
$this->_user = $user;
[18194] Fix | Delete
[18195] Fix | Delete
// Install the plugin.
[18196] Fix | Delete
$result = $this->create_installs_with_user(
[18197] Fix | Delete
$user,
[18198] Fix | Delete
$license_key,
[18199] Fix | Delete
$trial_plan_id,
[18200] Fix | Delete
$sites,
[18201] Fix | Delete
$redirect
[18202] Fix | Delete
);
[18203] Fix | Delete
[18204] Fix | Delete
if ( ! $this->is_api_result_entity( $result ) &&
[18205] Fix | Delete
! $this->is_api_result_object( $result, 'installs' )
[18206] Fix | Delete
) {
[18207] Fix | Delete
// @todo Handler potential API error of the $result
[18208] Fix | Delete
}
[18209] Fix | Delete
[18210] Fix | Delete
if ( empty( $sites ) ) {
[18211] Fix | Delete
$site = new FS_Site( $result );
[18212] Fix | Delete
$this->_site = $site;
[18213] Fix | Delete
[18214] Fix | Delete
if ( ! $setup_account ) {
[18215] Fix | Delete
$this->_store_site();
[18216] Fix | Delete
[18217] Fix | Delete
$this->sync_plan_if_not_exist( $site->plan_id );
[18218] Fix | Delete
[18219] Fix | Delete
if ( ! empty( $license_key ) && FS_Plugin_License::is_valid_id( $site->license_id ) ) {
[18220] Fix | Delete
$this->sync_license_if_not_exist( $site->license_id, $license_key );
[18221] Fix | Delete
}
[18222] Fix | Delete
[18223] Fix | Delete
$this->_admin_notices->remove_sticky( 'connect_account', false );
[18224] Fix | Delete
[18225] Fix | Delete
return $site;
[18226] Fix | Delete
}
[18227] Fix | Delete
[18228] Fix | Delete
return $this->setup_account( $this->_user, $this->_site, $redirect );
[18229] Fix | Delete
} else {
[18230] Fix | Delete
$installs = array();
[18231] Fix | Delete
foreach ( $result->installs as $install ) {
[18232] Fix | Delete
$installs[] = new FS_Site( $install );
[18233] Fix | Delete
}
[18234] Fix | Delete
[18235] Fix | Delete
return $this->setup_network_account(
[18236] Fix | Delete
$user,
[18237] Fix | Delete
$installs,
[18238] Fix | Delete
$redirect
[18239] Fix | Delete
);
[18240] Fix | Delete
}
[18241] Fix | Delete
}
[18242] Fix | Delete
[18243] Fix | Delete
/**
[18244] Fix | Delete
* Initiate an API request to create a collection of installs.
[18245] Fix | Delete
*
[18246] Fix | Delete
* @author Vova Feldman (@svovaf)
[18247] Fix | Delete
* @since 2.0.0
[18248] Fix | Delete
*
[18249] Fix | Delete
* @param \FS_User $user
[18250] Fix | Delete
* @param bool $license_key
[18251] Fix | Delete
* @param bool $trial_plan_id
[18252] Fix | Delete
* @param array $sites
[18253] Fix | Delete
* @param bool $redirect
[18254] Fix | Delete
* @param bool $silent
[18255] Fix | Delete
*
[18256] Fix | Delete
* @return object|mixed
[18257] Fix | Delete
*/
[18258] Fix | Delete
private function create_installs_with_user(
[18259] Fix | Delete
FS_User $user,
[18260] Fix | Delete
$license_key = false,
[18261] Fix | Delete
$trial_plan_id = false,
[18262] Fix | Delete
$sites = array(),
[18263] Fix | Delete
$redirect = false,
[18264] Fix | Delete
$silent = false
[18265] Fix | Delete
) {
[18266] Fix | Delete
$extra_install_params = array(
[18267] Fix | Delete
'uid' => $this->get_anonymous_id(),
[18268] Fix | Delete
'is_disconnected' => false,
[18269] Fix | Delete
);
[18270] Fix | Delete
[18271] Fix | Delete
if ( ! empty( $license_key ) ) {
[18272] Fix | Delete
$extra_install_params['license_key'] = $this->apply_filters( 'license_key', $license_key );
[18273] Fix | Delete
[18274] Fix | Delete
if ( $silent ) {
[18275] Fix | Delete
$extra_install_params['ignore_license_owner'] = true;
[18276] Fix | Delete
}
[18277] Fix | Delete
} else if ( FS_Plugin_Plan::is_valid_id( $trial_plan_id ) ) {
[18278] Fix | Delete
$extra_install_params['trial_plan_id'] = $trial_plan_id;
[18279] Fix | Delete
}
[18280] Fix | Delete
[18281] Fix | Delete
if ( ! empty( $sites ) ) {
[18282] Fix | Delete
$extra_install_params['sites'] = $sites;
[18283] Fix | Delete
}
[18284] Fix | Delete
[18285] Fix | Delete
$args = $this->get_install_data_for_api( $extra_install_params, false, false );
[18286] Fix | Delete
[18287] Fix | Delete
// Install the plugin.
[18288] Fix | Delete
$result = $this->get_api_user_scope_by_user( $user )->call(
[18289] Fix | Delete
"/plugins/{$this->get_id()}/installs.json",
[18290] Fix | Delete
'post',
[18291] Fix | Delete
$args
[18292] Fix | Delete
);
[18293] Fix | Delete
[18294] Fix | Delete
if ( ! $this->is_api_result_entity( $result ) &&
[18295] Fix | Delete
! $this->is_api_result_object( $result, 'installs' )
[18296] Fix | Delete
) {
[18297] Fix | Delete
if ( ! empty( $args['license_key'] ) ) {
[18298] Fix | Delete
// Pass the fully entered license key to the failure handler.
[18299] Fix | Delete
$args['license_key'] = $license_key;
[18300] Fix | Delete
}
[18301] Fix | Delete
[18302] Fix | Delete
$result = $this->apply_filters( 'after_install_failure', $result, $args );
[18303] Fix | Delete
[18304] Fix | Delete
if ( ! $silent ) {
[18305] Fix | Delete
$this->_admin_notices->add(
[18306] Fix | Delete
sprintf( $this->get_text_inline( 'Couldn\'t activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
[18307] Fix | Delete
$this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $result->error->message . '</b>',
[18308] Fix | Delete
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
[18309] Fix | Delete
'error'
[18310] Fix | Delete
);
[18311] Fix | Delete
}
[18312] Fix | Delete
[18313] Fix | Delete
if ( $redirect ) {
[18314] Fix | Delete
/**
[18315] Fix | Delete
* We set the user before getting the user scope API handler, so the user became temporarily
[18316] Fix | Delete
* registered (`is_registered() = true`). Since the API returned an error and we will redirect,
[18317] Fix | Delete
* we have to set the user to `null`, otherwise, the user will be redirected to the wrong
[18318] Fix | Delete
* activation page based on the return value of `is_registered()`. In addition, in case the
[18319] Fix | Delete
* context plugin doesn't have a settings menu and the default page is the `Plugins` page,
[18320] Fix | Delete
* misleading plugin activation errors will be shown on the `Plugins` page.
[18321] Fix | Delete
*
[18322] Fix | Delete
* @author Leo Fajardo (@leorw)
[18323] Fix | Delete
*/
[18324] Fix | Delete
$this->_user = null;
[18325] Fix | Delete
[18326] Fix | Delete
fs_redirect( $this->get_activation_url( array( 'error' => $result->error->message ) ) );
[18327] Fix | Delete
}
[18328] Fix | Delete
}
[18329] Fix | Delete
[18330] Fix | Delete
return $result;
[18331] Fix | Delete
}
[18332] Fix | Delete
[18333] Fix | Delete
/**
[18334] Fix | Delete
* Tries to activate add-on account based on parent plugin info.
[18335] Fix | Delete
*
[18336] Fix | Delete
* @author Vova Feldman (@svovaf)
[18337] Fix | Delete
* @since 1.0.6
[18338] Fix | Delete
*
[18339] Fix | Delete
* @param Freemius $parent_fs
[18340] Fix | Delete
* @param bool|int|null $network_level_or_blog_id True for network level opt-in and integer for opt-in for specified blog in the network.
[18341] Fix | Delete
* @param FS_Plugin_License $bundle_license Since 2.4.0. If provided, this license will be activated for the add-on.
[18342] Fix | Delete
*/
[18343] Fix | Delete
private function _activate_addon_account(
[18344] Fix | Delete
Freemius $parent_fs,
[18345] Fix | Delete
$network_level_or_blog_id = null,
[18346] Fix | Delete
FS_Plugin_License $bundle_license = null
[18347] Fix | Delete
) {
[18348] Fix | Delete
if ( $this->is_registered() ) {
[18349] Fix | Delete
// Already activated.
[18350] Fix | Delete
return;
[18351] Fix | Delete
}
[18352] Fix | Delete
[18353] Fix | Delete
$permission_ids = FS_Permission_Manager::get_all_permission_ids();
[18354] Fix | Delete
$permissions = array();
[18355] Fix | Delete
foreach ( $permission_ids as $permission_id ) {
[18356] Fix | Delete
$permissions[ $permission_id ] = FS_Permission_Manager::instance( $parent_fs )->is_permission( $permission_id, true );
[18357] Fix | Delete
}
[18358] Fix | Delete
[18359] Fix | Delete
FS_Permission_Manager::instance( $this )->update_permissions_tracking_flag( $permissions );
[18360] Fix | Delete
[18361] Fix | Delete
/**
[18362] Fix | Delete
* Do not override the `uid` if network-level opt-in since the call to `get_sites_for_network_level_optin()`
[18363] Fix | Delete
* already returns the data for the current blog.
[18364] Fix | Delete
*
[18365] Fix | Delete
* @author Leo Fajardo (@leorw)
[18366] Fix | Delete
* @since 2.3.0
[18367] Fix | Delete
*/
[18368] Fix | Delete
$uid_param_to_override = ( true === $network_level_or_blog_id ) ?
[18369] Fix | Delete
array() :
[18370] Fix | Delete
array( 'uid' => $this->get_anonymous_id() );
[18371] Fix | Delete
[18372] Fix | Delete
$params = $this->get_install_data_for_api(
[18373] Fix | Delete
$uid_param_to_override,
[18374] Fix | Delete
false,
[18375] Fix | Delete
false,
[18376] Fix | Delete
/**
[18377] Fix | Delete
* Do not include the data for the current blog if network-level opt-in since the call to `get_sites_for_network_level_optin`
[18378] Fix | Delete
* already includes the data for it.
[18379] Fix | Delete
*
[18380] Fix | Delete
* @author Leo Fajardo (@leorw)
[18381] Fix | Delete
* @since 2.3.0
[18382] Fix | Delete
*/
[18383] Fix | Delete
( true !== $network_level_or_blog_id )
[18384] Fix | Delete
);
[18385] Fix | Delete
[18386] Fix | Delete
if ( true === $network_level_or_blog_id ) {
[18387] Fix | Delete
$params['sites'] = $this->get_sites_for_network_level_optin();
[18388] Fix | Delete
[18389] Fix | Delete
if ( empty( $params['sites'] ) ) {
[18390] Fix | Delete
return;
[18391] Fix | Delete
}
[18392] Fix | Delete
}
[18393] Fix | Delete
[18394] Fix | Delete
if ( is_object( $bundle_license ) ) {
[18395] Fix | Delete
$params['license_key'] = $bundle_license->secret_key;
[18396] Fix | Delete
}
[18397] Fix | Delete
[18398] Fix | Delete
// Activate add-on with parent plugin credentials.
[18399] Fix | Delete
$result = $parent_fs->get_api_site_scope()->call(
[18400] Fix | Delete
"/addons/{$this->_plugin->id}/installs.json",
[18401] Fix | Delete
'post',
[18402] Fix | Delete
$params
[18403] Fix | Delete
);
[18404] Fix | Delete
[18405] Fix | Delete
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
[18406] Fix | Delete
if ( is_object( $bundle_license ) ) {
[18407] Fix | Delete
/**
[18408] Fix | Delete
* When a license object is provided, it's an attempt by the SDK to activate a bundle license and not a user-initiated action, therefore, do not show any admin notice to avoid confusion (e.g.: the notice will show up just above the opt-in link). If the license activation fails, the admin will see an opt-in link instead.
[18409] Fix | Delete
*
[18410] Fix | Delete
* @author Leo Fajardo (@leorw)
[18411] Fix | Delete
* @since 2.4.0
[18412] Fix | Delete
*/
[18413] Fix | Delete
} else {
[18414] Fix | Delete
$error_message = FS_Api::is_api_error_object( $result ) ?
[18415] Fix | Delete
$result->error->message :
[18416] Fix | Delete
$this->get_text_inline( 'An unknown error has occurred.', 'unknown-error' );
[18417] Fix | Delete
[18418] Fix | Delete
$this->_admin_notices->add(
[18419] Fix | Delete
sprintf( $this->get_text_inline( 'Couldn\'t activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
[18420] Fix | Delete
$this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $error_message . '</b>',
[18421] Fix | Delete
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
[18422] Fix | Delete
'error'
[18423] Fix | Delete
);
[18424] Fix | Delete
}
[18425] Fix | Delete
[18426] Fix | Delete
return;
[18427] Fix | Delete
}
[18428] Fix | Delete
[18429] Fix | Delete
$addon_installs = $result->installs;
[18430] Fix | Delete
foreach ( $addon_installs as $key => $addon_install ) {
[18431] Fix | Delete
$addon_installs[ $key ] = new FS_Site( $addon_install );
[18432] Fix | Delete
}
[18433] Fix | Delete
[18434] Fix | Delete
$first_install = $addon_installs[0];
[18435] Fix | Delete
[18436] Fix | Delete
// Get user information based on parent's plugin.
[18437] Fix | Delete
$user = $parent_fs->get_user();
[18438] Fix | Delete
[18439] Fix | Delete
// First of all, set site and user info - otherwise we won't
[18440] Fix | Delete
// be able to invoke API calls.
[18441] Fix | Delete
$this->_site = $first_install;
[18442] Fix | Delete
$this->_user = $user;
[18443] Fix | Delete
[18444] Fix | Delete
// Sync add-on plans.
[18445] Fix | Delete
$this->_sync_plans();
[18446] Fix | Delete
[18447] Fix | Delete
$this->handle_account_connection( $addon_installs, ! fs_is_network_admin() );
[18448] Fix | Delete
[18449] Fix | Delete
// Get site's current plan.
[18450] Fix | Delete
//$this->_site->plan = $this->_get_plan_by_id( $this->_site->plan->id );
[18451] Fix | Delete
[18452] Fix | Delete
// Sync licenses.
[18453] Fix | Delete
$this->_sync_licenses();
[18454] Fix | Delete
[18455] Fix | Delete
if ( ! fs_is_network_admin() ) {
[18456] Fix | Delete
// Try to activate premium license.
[18457] Fix | Delete
$this->_activate_license( true, $bundle_license );
[18458] Fix | Delete
[18459] Fix | Delete
if ( is_object( $bundle_license ) ) {
[18460] Fix | Delete
$this->maybe_activate_bundle_license( $bundle_license );
[18461] Fix | Delete
}
[18462] Fix | Delete
} else {
[18463] Fix | Delete
if ( is_object( $bundle_license ) ) {
[18464] Fix | Delete
$premium_license = $bundle_license;
[18465] Fix | Delete
} else {
[18466] Fix | Delete
$license_id = fs_request_get( 'license_id' );
[18467] Fix | Delete
[18468] Fix | Delete
if ( is_object( $this->_site ) &&
[18469] Fix | Delete
FS_Plugin_License::is_valid_id( $license_id ) &&
[18470] Fix | Delete
$license_id == $this->_site->license_id
[18471] Fix | Delete
) {
[18472] Fix | Delete
// License is already activated.
[18473] Fix | Delete
return;
[18474] Fix | Delete
}
[18475] Fix | Delete
[18476] Fix | Delete
$premium_license = FS_Plugin_License::is_valid_id( $license_id ) ?
[18477] Fix | Delete
$this->_get_license_by_id( $license_id ) :
[18478] Fix | Delete
$this->_get_available_premium_license();
[18479] Fix | Delete
}
[18480] Fix | Delete
[18481] Fix | Delete
if ( is_object( $premium_license ) ) {
[18482] Fix | Delete
$this->maybe_network_activate_addon_license( $premium_license );
[18483] Fix | Delete
}
[18484] Fix | Delete
}
[18485] Fix | Delete
}
[18486] Fix | Delete
[18487] Fix | Delete
/**
[18488] Fix | Delete
* @author Leo Fajardo (@leorw)
[18489] Fix | Delete
* @since 2.3.0
[18490] Fix | Delete
*
[18491] Fix | Delete
* @param FS_Site[] $installs
[18492] Fix | Delete
* @param bool $is_site_level
[18493] Fix | Delete
*/
[18494] Fix | Delete
private function handle_account_connection( $installs, $is_site_level ) {
[18495] Fix | Delete
$first_install = $installs[0];
[18496] Fix | Delete
[18497] Fix | Delete
if ( $is_site_level ) {
[18498] Fix | Delete
$this->_set_account( $this->_user, $first_install );
[18499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function