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
if ( ! is_object( $site_active_plugins_cache ) ) {
[9000] Fix | Delete
$site_active_plugins_cache = (object) array(
[9001] Fix | Delete
'timestamp' => '',
[9002] Fix | Delete
'md5' => '',
[9003] Fix | Delete
'plugins' => array(),
[9004] Fix | Delete
);
[9005] Fix | Delete
}
[9006] Fix | Delete
[9007] Fix | Delete
$time = time();
[9008] Fix | Delete
[9009] Fix | Delete
if ( ! empty( $site_active_plugins_cache->timestamp ) &&
[9010] Fix | Delete
( $time - $site_active_plugins_cache->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
[9011] Fix | Delete
) {
[9012] Fix | Delete
// Don't send plugin updates if last update was in the past 5 min.
[9013] Fix | Delete
return false;
[9014] Fix | Delete
}
[9015] Fix | Delete
[9016] Fix | Delete
// Write timestamp to lock the logic.
[9017] Fix | Delete
$site_active_plugins_cache->timestamp = $time;
[9018] Fix | Delete
self::$_accounts->set_option( $site_active_plugins_option_name, $site_active_plugins_cache, true );
[9019] Fix | Delete
[9020] Fix | Delete
// Reload options from DB.
[9021] Fix | Delete
self::$_accounts->load( true );
[9022] Fix | Delete
$site_active_plugins_cache = self::$_accounts->get_option( $site_active_plugins_option_name );
[9023] Fix | Delete
[9024] Fix | Delete
if ( $time != $site_active_plugins_cache->timestamp ) {
[9025] Fix | Delete
// If timestamp is different, then another thread captured the lock.
[9026] Fix | Delete
return false;
[9027] Fix | Delete
}
[9028] Fix | Delete
[9029] Fix | Delete
/**
[9030] Fix | Delete
* Collection of all plugins (network level).
[9031] Fix | Delete
*/
[9032] Fix | Delete
$network_plugins_cache = self::$_accounts->get_option( $network_plugins_option_name );
[9033] Fix | Delete
[9034] Fix | Delete
if ( ! is_object( $network_plugins_cache ) ) {
[9035] Fix | Delete
$network_plugins_cache = (object) array(
[9036] Fix | Delete
'timestamp' => '',
[9037] Fix | Delete
'md5' => '',
[9038] Fix | Delete
'plugins' => array(),
[9039] Fix | Delete
);
[9040] Fix | Delete
}
[9041] Fix | Delete
[9042] Fix | Delete
// Check if there's a change in plugins.
[9043] Fix | Delete
$network_plugins = self::get_network_plugins();
[9044] Fix | Delete
$site_active_plugins = self::get_site_active_plugins();
[9045] Fix | Delete
[9046] Fix | Delete
$network_plugins_thumbprint = $this->get_plugins_thumbprint( $network_plugins );
[9047] Fix | Delete
$site_active_plugins_thumbprint = $this->get_plugins_thumbprint( $site_active_plugins );
[9048] Fix | Delete
[9049] Fix | Delete
// Check if plugins status changed (version or active/inactive).
[9050] Fix | Delete
$network_plugins_changed = ( $network_plugins_cache->md5 !== $network_plugins_thumbprint );
[9051] Fix | Delete
$site_active_plugins_changed = ( $site_active_plugins_cache->md5 !== $site_active_plugins_thumbprint );
[9052] Fix | Delete
[9053] Fix | Delete
if ( ! $network_plugins_changed &&
[9054] Fix | Delete
! $site_active_plugins_changed
[9055] Fix | Delete
) {
[9056] Fix | Delete
// No changes.
[9057] Fix | Delete
return array();
[9058] Fix | Delete
}
[9059] Fix | Delete
[9060] Fix | Delete
$plugins_update_data = array();
[9061] Fix | Delete
[9062] Fix | Delete
foreach ( $network_plugins_cache->plugins as $basename => $data ) {
[9063] Fix | Delete
if ( ! isset( $network_plugins[ $basename ] ) ) {
[9064] Fix | Delete
// Plugin uninstalled.
[9065] Fix | Delete
$uninstalled_plugin_data = $data;
[9066] Fix | Delete
$uninstalled_plugin_data['is_active'] = false;
[9067] Fix | Delete
$uninstalled_plugin_data['is_uninstalled'] = true;
[9068] Fix | Delete
$plugins_update_data[] = $uninstalled_plugin_data;
[9069] Fix | Delete
[9070] Fix | Delete
unset( $network_plugins[ $basename ] );
[9071] Fix | Delete
[9072] Fix | Delete
unset( $network_plugins_cache->plugins[ $basename ] );
[9073] Fix | Delete
unset( $site_active_plugins_cache->plugins[ $basename ] );
[9074] Fix | Delete
[9075] Fix | Delete
continue;
[9076] Fix | Delete
}
[9077] Fix | Delete
[9078] Fix | Delete
$was_active = $data['is_active'] ||
[9079] Fix | Delete
( isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
[9080] Fix | Delete
true === $site_active_plugins_cache->plugins[ $basename ]['is_active'] );
[9081] Fix | Delete
$is_active = $network_plugins[ $basename ]['is_active'] ||
[9082] Fix | Delete
( isset( $site_active_plugins[ $basename ] ) &&
[9083] Fix | Delete
$site_active_plugins[ $basename ]['is_active'] );
[9084] Fix | Delete
[9085] Fix | Delete
if ( ! isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
[9086] Fix | Delete
isset( $site_active_plugins[ $basename ] )
[9087] Fix | Delete
) {
[9088] Fix | Delete
// Plugin was site level activated.
[9089] Fix | Delete
$site_active_plugins_cache->plugins[ $basename ] = $network_plugins[ $basename ];
[9090] Fix | Delete
$site_active_plugins_cache->plugins[ $basename ]['is_active'] = true;
[9091] Fix | Delete
} else if ( isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
[9092] Fix | Delete
! isset( $site_active_plugins[ $basename ] )
[9093] Fix | Delete
) {
[9094] Fix | Delete
// Plugin was site level deactivated.
[9095] Fix | Delete
unset( $site_active_plugins_cache->plugins[ $basename ] );
[9096] Fix | Delete
}
[9097] Fix | Delete
[9098] Fix | Delete
$prev_version = $data['version'];
[9099] Fix | Delete
$current_version = $network_plugins[ $basename ]['Version'];
[9100] Fix | Delete
[9101] Fix | Delete
if ( $was_active !== $is_active || $prev_version !== $current_version ) {
[9102] Fix | Delete
// Plugin activated or deactivated, or version changed.
[9103] Fix | Delete
[9104] Fix | Delete
if ( $was_active !== $is_active ) {
[9105] Fix | Delete
if ( $data['is_active'] != $network_plugins[ $basename ]['is_active'] ) {
[9106] Fix | Delete
$network_plugins_cache->plugins[ $basename ]['is_active'] = $data['is_active'];
[9107] Fix | Delete
}
[9108] Fix | Delete
}
[9109] Fix | Delete
[9110] Fix | Delete
if ( $prev_version !== $current_version ) {
[9111] Fix | Delete
$network_plugins_cache->plugins[ $basename ]['Version'] = $current_version;
[9112] Fix | Delete
}
[9113] Fix | Delete
[9114] Fix | Delete
$updated_plugin_data = $data;
[9115] Fix | Delete
$updated_plugin_data['is_active'] = $is_active;
[9116] Fix | Delete
$updated_plugin_data['version'] = $current_version;
[9117] Fix | Delete
$updated_plugin_data['title'] = $network_plugins[ $basename ]['Name'];
[9118] Fix | Delete
$plugins_update_data[] = $updated_plugin_data;
[9119] Fix | Delete
}
[9120] Fix | Delete
}
[9121] Fix | Delete
[9122] Fix | Delete
// Find new plugins that weren't yet seen before.
[9123] Fix | Delete
foreach ( $network_plugins as $basename => $data ) {
[9124] Fix | Delete
if ( ! isset( $network_plugins_cache->plugins[ $basename ] ) ) {
[9125] Fix | Delete
// New plugin.
[9126] Fix | Delete
$new_plugin = array(
[9127] Fix | Delete
'slug' => $data['slug'],
[9128] Fix | Delete
'version' => $data['Version'],
[9129] Fix | Delete
'title' => $data['Name'],
[9130] Fix | Delete
'is_active' => $data['is_active'],
[9131] Fix | Delete
'is_uninstalled' => false,
[9132] Fix | Delete
);
[9133] Fix | Delete
[9134] Fix | Delete
$network_plugins_cache->plugins[ $basename ] = $new_plugin;
[9135] Fix | Delete
[9136] Fix | Delete
$is_site_level_active = (
[9137] Fix | Delete
isset( $site_active_plugins[ $basename ] ) &&
[9138] Fix | Delete
$site_active_plugins[ $basename ]['is_active']
[9139] Fix | Delete
);
[9140] Fix | Delete
[9141] Fix | Delete
/**
[9142] Fix | Delete
* If not network active, set the activity status based on the site-level plugin status.
[9143] Fix | Delete
*/
[9144] Fix | Delete
if ( ! $new_plugin['is_active'] ) {
[9145] Fix | Delete
$new_plugin['is_active'] = $is_site_level_active;
[9146] Fix | Delete
}
[9147] Fix | Delete
[9148] Fix | Delete
$plugins_update_data[] = $new_plugin;
[9149] Fix | Delete
[9150] Fix | Delete
if ( isset( $site_active_plugins[ $basename ] ) ) {
[9151] Fix | Delete
$site_active_plugins_cache->plugins[ $basename ] = $new_plugin;
[9152] Fix | Delete
$site_active_plugins_cache->plugins[ $basename ]['is_active'] = $is_site_level_active;
[9153] Fix | Delete
}
[9154] Fix | Delete
}
[9155] Fix | Delete
}
[9156] Fix | Delete
[9157] Fix | Delete
$site_active_plugins_cache->md5 = $site_active_plugins_thumbprint;
[9158] Fix | Delete
$site_active_plugins_cache->timestamp = $time;
[9159] Fix | Delete
self::$_accounts->set_option( $site_active_plugins_option_name, $site_active_plugins_cache, true );
[9160] Fix | Delete
[9161] Fix | Delete
$network_plugins_cache->md5 = $network_plugins_thumbprint;
[9162] Fix | Delete
$network_plugins_cache->timestamp = $time;
[9163] Fix | Delete
self::$_accounts->set_option( $network_plugins_option_name, $network_plugins_cache, true );
[9164] Fix | Delete
[9165] Fix | Delete
return $plugins_update_data;
[9166] Fix | Delete
}
[9167] Fix | Delete
[9168] Fix | Delete
/**
[9169] Fix | Delete
* Return a list of modified themes since the last sync.
[9170] Fix | Delete
*
[9171] Fix | Delete
* Note:
[9172] Fix | Delete
* There's no point to store a themes counter since even if the number of
[9173] Fix | Delete
* themes didn't change, we still need to check if the versions are all the
[9174] Fix | Delete
* same and the activity state is similar.
[9175] Fix | Delete
*
[9176] Fix | Delete
* @author Vova Feldman (@svovaf)
[9177] Fix | Delete
* @since 1.1.8
[9178] Fix | Delete
*
[9179] Fix | Delete
* @return array|false
[9180] Fix | Delete
*/
[9181] Fix | Delete
private function get_themes_data_for_api() {
[9182] Fix | Delete
// Alias.
[9183] Fix | Delete
$option_name = 'all_themes';
[9184] Fix | Delete
[9185] Fix | Delete
$all_cached_themes = self::$_accounts->get_option( $option_name );
[9186] Fix | Delete
[9187] Fix | Delete
if ( ! is_object( $all_cached_themes ) ) {
[9188] Fix | Delete
$all_cached_themes = (object) array(
[9189] Fix | Delete
'timestamp' => '',
[9190] Fix | Delete
'md5' => '',
[9191] Fix | Delete
'themes' => array(),
[9192] Fix | Delete
);
[9193] Fix | Delete
}
[9194] Fix | Delete
[9195] Fix | Delete
$time = time();
[9196] Fix | Delete
[9197] Fix | Delete
if ( ! empty( $all_cached_themes->timestamp ) &&
[9198] Fix | Delete
( $time - $all_cached_themes->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
[9199] Fix | Delete
) {
[9200] Fix | Delete
// Don't send theme updates if last update was in the past 5 min.
[9201] Fix | Delete
return false;
[9202] Fix | Delete
}
[9203] Fix | Delete
[9204] Fix | Delete
// Write timestamp to lock the logic.
[9205] Fix | Delete
$all_cached_themes->timestamp = $time;
[9206] Fix | Delete
self::$_accounts->set_option( $option_name, $all_cached_themes, true );
[9207] Fix | Delete
[9208] Fix | Delete
// Reload options from DB.
[9209] Fix | Delete
self::$_accounts->load( true );
[9210] Fix | Delete
$all_cached_themes = self::$_accounts->get_option( $option_name );
[9211] Fix | Delete
[9212] Fix | Delete
if ( $time != $all_cached_themes->timestamp ) {
[9213] Fix | Delete
// If timestamp is different, then another thread captured the lock.
[9214] Fix | Delete
return false;
[9215] Fix | Delete
}
[9216] Fix | Delete
[9217] Fix | Delete
// Get active theme.
[9218] Fix | Delete
$active_theme = wp_get_theme();
[9219] Fix | Delete
$active_theme_stylesheet = $active_theme->get_stylesheet();
[9220] Fix | Delete
[9221] Fix | Delete
// Check if there's a change in themes.
[9222] Fix | Delete
$all_themes = wp_get_themes();
[9223] Fix | Delete
[9224] Fix | Delete
// Check if themes changed.
[9225] Fix | Delete
ksort( $all_themes );
[9226] Fix | Delete
[9227] Fix | Delete
$themes_signature = '';
[9228] Fix | Delete
foreach ( $all_themes as $slug => $data ) {
[9229] Fix | Delete
$is_active = ( $slug === $active_theme_stylesheet );
[9230] Fix | Delete
$themes_signature .= $slug . ',' .
[9231] Fix | Delete
$data->version . ',' .
[9232] Fix | Delete
( $is_active ? '1' : '0' ) . ';';
[9233] Fix | Delete
}
[9234] Fix | Delete
[9235] Fix | Delete
// Check if themes status changed (version or active/inactive).
[9236] Fix | Delete
$themes_changed = ( $all_cached_themes->md5 !== md5( $themes_signature ) );
[9237] Fix | Delete
[9238] Fix | Delete
$themes_update_data = array();
[9239] Fix | Delete
[9240] Fix | Delete
if ( $themes_changed ) {
[9241] Fix | Delete
// Change in themes, report changes.
[9242] Fix | Delete
[9243] Fix | Delete
// Update existing themes info.
[9244] Fix | Delete
foreach ( $all_cached_themes->themes as $slug => $data ) {
[9245] Fix | Delete
$is_active = ( $slug === $active_theme_stylesheet );
[9246] Fix | Delete
[9247] Fix | Delete
if ( ! isset( $all_themes[ $slug ] ) ) {
[9248] Fix | Delete
// Plugin uninstalled.
[9249] Fix | Delete
$uninstalled_theme_data = $data;
[9250] Fix | Delete
$uninstalled_theme_data['is_active'] = false;
[9251] Fix | Delete
$uninstalled_theme_data['is_uninstalled'] = true;
[9252] Fix | Delete
$themes_update_data[] = $uninstalled_theme_data;
[9253] Fix | Delete
[9254] Fix | Delete
unset( $all_themes[ $slug ] );
[9255] Fix | Delete
unset( $all_cached_themes->themes[ $slug ] );
[9256] Fix | Delete
} else if ( $data['is_active'] !== $is_active ||
[9257] Fix | Delete
$data['version'] !== $all_themes[ $slug ]->version
[9258] Fix | Delete
) {
[9259] Fix | Delete
// Plugin activated or deactivated, or version changed.
[9260] Fix | Delete
[9261] Fix | Delete
$all_cached_themes->themes[ $slug ]['is_active'] = $is_active;
[9262] Fix | Delete
$all_cached_themes->themes[ $slug ]['version'] = $all_themes[ $slug ]->version;
[9263] Fix | Delete
[9264] Fix | Delete
$themes_update_data[] = $all_cached_themes->themes[ $slug ];
[9265] Fix | Delete
}
[9266] Fix | Delete
}
[9267] Fix | Delete
[9268] Fix | Delete
// Find new themes that weren't yet seen before.
[9269] Fix | Delete
foreach ( $all_themes as $slug => $data ) {
[9270] Fix | Delete
if ( ! isset( $all_cached_themes->themes[ $slug ] ) ) {
[9271] Fix | Delete
$is_active = ( $slug === $active_theme_stylesheet );
[9272] Fix | Delete
[9273] Fix | Delete
// New plugin.
[9274] Fix | Delete
$new_plugin = array(
[9275] Fix | Delete
'slug' => $slug,
[9276] Fix | Delete
'version' => $data->version,
[9277] Fix | Delete
'title' => $data->name,
[9278] Fix | Delete
'is_active' => $is_active,
[9279] Fix | Delete
'is_uninstalled' => false,
[9280] Fix | Delete
);
[9281] Fix | Delete
[9282] Fix | Delete
$themes_update_data[] = $new_plugin;
[9283] Fix | Delete
$all_cached_themes->themes[ $slug ] = $new_plugin;
[9284] Fix | Delete
}
[9285] Fix | Delete
}
[9286] Fix | Delete
[9287] Fix | Delete
$all_cached_themes->md5 = md5( $themes_signature );
[9288] Fix | Delete
$all_cached_themes->timestamp = time();
[9289] Fix | Delete
self::$_accounts->set_option( $option_name, $all_cached_themes, true );
[9290] Fix | Delete
}
[9291] Fix | Delete
[9292] Fix | Delete
return $themes_update_data;
[9293] Fix | Delete
}
[9294] Fix | Delete
[9295] Fix | Delete
/**
[9296] Fix | Delete
* Get site data for API install request.
[9297] Fix | Delete
*
[9298] Fix | Delete
* @author Vova Feldman (@svovaf)
[9299] Fix | Delete
* @since 1.1.2
[9300] Fix | Delete
*
[9301] Fix | Delete
* @param string[] $override
[9302] Fix | Delete
* @param bool $include_plugins Since 1.1.8 by default include plugin changes.
[9303] Fix | Delete
* @param bool $include_themes Since 1.1.8 by default include plugin changes.
[9304] Fix | Delete
* @param bool $include_blog_data Since 2.3.0 by default include the current blog's data (language, title, and URL).
[9305] Fix | Delete
*
[9306] Fix | Delete
* @return array
[9307] Fix | Delete
*/
[9308] Fix | Delete
private function get_install_data_for_api(
[9309] Fix | Delete
array $override,
[9310] Fix | Delete
$include_plugins = true,
[9311] Fix | Delete
$include_themes = true,
[9312] Fix | Delete
$include_blog_data = true
[9313] Fix | Delete
) {
[9314] Fix | Delete
// Alias.
[9315] Fix | Delete
$permissions = FS_Permission_Manager::instance( $this );
[9316] Fix | Delete
[9317] Fix | Delete
if ( $permissions->is_extensions_tracking_allowed() ) {
[9318] Fix | Delete
if ( ! defined( 'WP_FS__TRACK_PLUGINS' ) || false !== WP_FS__TRACK_PLUGINS ) {
[9319] Fix | Delete
/**
[9320] Fix | Delete
* @since 1.1.8 Also send plugin updates.
[9321] Fix | Delete
*/
[9322] Fix | Delete
if ( $include_plugins && ! isset( $override['plugins'] ) ) {
[9323] Fix | Delete
$plugins = $this->get_plugins_data_for_api();
[9324] Fix | Delete
if ( ! empty( $plugins ) ) {
[9325] Fix | Delete
$override['plugins'] = $plugins;
[9326] Fix | Delete
}
[9327] Fix | Delete
}
[9328] Fix | Delete
}
[9329] Fix | Delete
[9330] Fix | Delete
if ( ! defined( 'WP_FS__TRACK_THEMES' ) || false !== WP_FS__TRACK_THEMES ) {
[9331] Fix | Delete
/**
[9332] Fix | Delete
* @since 1.1.8 Also send themes updates.
[9333] Fix | Delete
*/
[9334] Fix | Delete
if ( $include_themes && ! isset( $override['themes'] ) ) {
[9335] Fix | Delete
$themes = $this->get_themes_data_for_api();
[9336] Fix | Delete
if ( ! empty( $themes ) ) {
[9337] Fix | Delete
$override['themes'] = $themes;
[9338] Fix | Delete
}
[9339] Fix | Delete
}
[9340] Fix | Delete
}
[9341] Fix | Delete
}
[9342] Fix | Delete
[9343] Fix | Delete
$versions = $this->get_versions();
[9344] Fix | Delete
[9345] Fix | Delete
$blog_data = array();
[9346] Fix | Delete
if ( $include_blog_data ) {
[9347] Fix | Delete
$blog_data['url'] = self::get_unfiltered_site_url();
[9348] Fix | Delete
[9349] Fix | Delete
if ( $permissions->is_diagnostic_tracking_allowed() ) {
[9350] Fix | Delete
$blog_data = array_merge( $blog_data, array(
[9351] Fix | Delete
'language' => self::get_sanitized_language(),
[9352] Fix | Delete
'title' => get_bloginfo( 'name' ),
[9353] Fix | Delete
) );
[9354] Fix | Delete
}
[9355] Fix | Delete
}
[9356] Fix | Delete
[9357] Fix | Delete
return array_merge( $versions, $blog_data, array(
[9358] Fix | Delete
'version' => $this->get_plugin_version(),
[9359] Fix | Delete
'is_premium' => $this->is_premium(),
[9360] Fix | Delete
// Special params.
[9361] Fix | Delete
'is_active' => true,
[9362] Fix | Delete
'is_uninstalled' => false,
[9363] Fix | Delete
), $override );
[9364] Fix | Delete
}
[9365] Fix | Delete
[9366] Fix | Delete
/**
[9367] Fix | Delete
* Update installs details.
[9368] Fix | Delete
*
[9369] Fix | Delete
* @todo V1 of multiste network support doesn't support plugin and theme data sending.
[9370] Fix | Delete
*
[9371] Fix | Delete
* @author Vova Feldman (@svovaf)
[9372] Fix | Delete
* @since 2.0.0
[9373] Fix | Delete
*
[9374] Fix | Delete
* @param string[] string $override
[9375] Fix | Delete
* @param bool $only_diff
[9376] Fix | Delete
* @param bool $is_keepalive
[9377] Fix | Delete
* @param bool $include_plugins Since 1.1.8 by default include plugin changes.
[9378] Fix | Delete
* @param bool $include_themes Since 1.1.8 by default include plugin changes.
[9379] Fix | Delete
*
[9380] Fix | Delete
* @return array
[9381] Fix | Delete
*/
[9382] Fix | Delete
private function get_installs_data_for_api(
[9383] Fix | Delete
array $override,
[9384] Fix | Delete
$only_diff = false,
[9385] Fix | Delete
$is_keepalive = false,
[9386] Fix | Delete
$include_plugins = true,
[9387] Fix | Delete
$include_themes = true
[9388] Fix | Delete
) {
[9389] Fix | Delete
/**
[9390] Fix | Delete
* @since 1.1.8 Also send plugin updates.
[9391] Fix | Delete
*/
[9392] Fix | Delete
// if ( $include_plugins && ! isset( $override['plugins'] ) ) {
[9393] Fix | Delete
// $plugins = $this->get_plugins_data_for_api();
[9394] Fix | Delete
// if ( ! empty( $plugins ) ) {
[9395] Fix | Delete
// $override['plugins'] = $plugins;
[9396] Fix | Delete
// }
[9397] Fix | Delete
// }
[9398] Fix | Delete
/**
[9399] Fix | Delete
* @since 1.1.8 Also send themes updates.
[9400] Fix | Delete
*/
[9401] Fix | Delete
// if ( $include_themes && ! isset( $override['themes'] ) ) {
[9402] Fix | Delete
// $themes = $this->get_themes_data_for_api();
[9403] Fix | Delete
// if ( ! empty( $themes ) ) {
[9404] Fix | Delete
// $override['themes'] = $themes;
[9405] Fix | Delete
// }
[9406] Fix | Delete
// }
[9407] Fix | Delete
[9408] Fix | Delete
// Common properties.
[9409] Fix | Delete
$versions = $this->get_versions();
[9410] Fix | Delete
$common = array_merge( $versions, array(
[9411] Fix | Delete
'version' => $this->get_plugin_version(),
[9412] Fix | Delete
'is_premium' => $this->is_premium(),
[9413] Fix | Delete
), $override );
[9414] Fix | Delete
[9415] Fix | Delete
[9416] Fix | Delete
$is_common_diff_for_any_site = false;
[9417] Fix | Delete
$common_diff_union = array();
[9418] Fix | Delete
[9419] Fix | Delete
$installs_data = array();
[9420] Fix | Delete
[9421] Fix | Delete
$sites = self::get_sites();
[9422] Fix | Delete
[9423] Fix | Delete
$subsite_data_for_api_by_install_id = array();
[9424] Fix | Delete
$install_url_by_install_id = array();
[9425] Fix | Delete
$subsite_registration_date_by_install_id = array();
[9426] Fix | Delete
[9427] Fix | Delete
foreach ( $sites as $site ) {
[9428] Fix | Delete
$blog_id = self::get_site_blog_id( $site );
[9429] Fix | Delete
[9430] Fix | Delete
$install = $this->get_install_by_blog_id( $blog_id );
[9431] Fix | Delete
[9432] Fix | Delete
if ( is_object( $install ) ) {
[9433] Fix | Delete
if ( $install->user_id != $this->_user->id ) {
[9434] Fix | Delete
// Install belongs to a different owner.
[9435] Fix | Delete
continue;
[9436] Fix | Delete
}
[9437] Fix | Delete
[9438] Fix | Delete
if ( ! $this->is_tracking_allowed( $blog_id, $install ) ) {
[9439] Fix | Delete
// Don't send updates regarding opted-out installs.
[9440] Fix | Delete
continue;
[9441] Fix | Delete
}
[9442] Fix | Delete
[9443] Fix | Delete
$install_data = $this->get_site_info( $site, true );
[9444] Fix | Delete
[9445] Fix | Delete
if ( FS_Clone_Manager::instance()->is_temporary_duplicate_by_blog_id( $install_data['blog_id'] ) ) {
[9446] Fix | Delete
continue;
[9447] Fix | Delete
}
[9448] Fix | Delete
[9449] Fix | Delete
$uid = $install_data['uid'];
[9450] Fix | Delete
$url = $install_data['url'];
[9451] Fix | Delete
$registration_date = $install_data['registration_date'];
[9452] Fix | Delete
[9453] Fix | Delete
if ( isset( $subsite_data_for_api_by_install_id[ $install->id ] ) ) {
[9454] Fix | Delete
$clone_subsite_data = $subsite_data_for_api_by_install_id[ $install->id ];
[9455] Fix | Delete
$clone_install_url = $install_url_by_install_id[ $install->id ];
[9456] Fix | Delete
$clone_subsite_registration_date = $subsite_registration_date_by_install_id[ $install->id ];
[9457] Fix | Delete
[9458] Fix | Delete
$skip = false;
[9459] Fix | Delete
[9460] Fix | Delete
if (
[9461] Fix | Delete
! empty( $install_data['registration_date'] ) &&
[9462] Fix | Delete
! empty( $clone_subsite_registration_date )
[9463] Fix | Delete
) {
[9464] Fix | Delete
/**
[9465] Fix | Delete
* If the current subsite was created after the other subsite that is also linked to the same install ID, we assume that it's a clone (not the original), and therefore, would skip its processing.
[9466] Fix | Delete
*
[9467] Fix | Delete
* @author Leo Fajardo (@leorw)
[9468] Fix | Delete
* @since 2.5.1
[9469] Fix | Delete
*/
[9470] Fix | Delete
$skip = ( strtotime( $install_data['registration_date'] ) > strtotime( $clone_subsite_registration_date ) );
[9471] Fix | Delete
} else if (
[9472] Fix | Delete
/**
[9473] Fix | Delete
* If we already have an install with the same URL as the subsite it's stored in, skip the current subsite. Otherwise, replace the existing install's data with the current subsite's install's data if the URLs match.
[9474] Fix | Delete
*
[9475] Fix | Delete
* @author Leo Fajardo (@leorw)
[9476] Fix | Delete
* @since 2.5.0
[9477] Fix | Delete
*/
[9478] Fix | Delete
fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_data['url'] ) ) ||
[9479] Fix | Delete
fs_strip_url_protocol( untrailingslashit( $install->url ) ) !== fs_strip_url_protocol( untrailingslashit( $url ) )
[9480] Fix | Delete
) {
[9481] Fix | Delete
$skip = true;
[9482] Fix | Delete
}
[9483] Fix | Delete
[9484] Fix | Delete
if ( $skip ) {
[9485] Fix | Delete
// Store the skipped subsite's ID so that the clone resolution manager can try to resolve the clone install that is stored in that subsite later on.
[9486] Fix | Delete
FS_Clone_Manager::instance()->store_blog_install_info( $blog_id );
[9487] Fix | Delete
continue;
[9488] Fix | Delete
}
[9489] Fix | Delete
}
[9490] Fix | Delete
[9491] Fix | Delete
unset( $install_data['blog_id'] );
[9492] Fix | Delete
unset( $install_data['uid'] );
[9493] Fix | Delete
unset( $install_data['url'] );
[9494] Fix | Delete
unset( $install_data['registration_date'] );
[9495] Fix | Delete
[9496] Fix | Delete
$install_data['is_active'] = $this->is_active_for_site( $blog_id );
[9497] Fix | Delete
$install_data['is_uninstalled'] = $install->is_uninstalled;
[9498] Fix | Delete
[9499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function