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
/home/sportsfe.../httpdocs/wp-conte.../plugins/content-.../inc/freemius
File: start.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @package Freemius
[2] Fix | Delete
* @copyright Copyright (c) 2015, Freemius, Inc.
[3] Fix | Delete
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
[4] Fix | Delete
* @since 1.0.3
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Freemius SDK Version.
[13] Fix | Delete
*
[14] Fix | Delete
* @var string
[15] Fix | Delete
*/
[16] Fix | Delete
$this_sdk_version = '2.6.2';
[17] Fix | Delete
[18] Fix | Delete
#region SDK Selection Logic --------------------------------------------------------------------
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Special logic added on 1.1.6 to make sure that every Freemius powered plugin
[22] Fix | Delete
* will ALWAYS be loaded with the newest SDK from the active Freemius powered plugins.
[23] Fix | Delete
*
[24] Fix | Delete
* Since Freemius SDK is backward compatible, this will make sure that all Freemius powered
[25] Fix | Delete
* plugins will run correctly.
[26] Fix | Delete
*
[27] Fix | Delete
* @since 1.1.6
[28] Fix | Delete
*/
[29] Fix | Delete
[30] Fix | Delete
global $fs_active_plugins;
[31] Fix | Delete
[32] Fix | Delete
if ( ! function_exists( 'fs_find_caller_plugin_file' ) ) {
[33] Fix | Delete
// Require SDK essentials.
[34] Fix | Delete
require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* This complex logic fixes symlink issues (e.g. with Vargant). The logic assumes
[39] Fix | Delete
* that if it's a file from an SDK running in a theme, the location of the SDK
[40] Fix | Delete
* is in the main theme's folder.
[41] Fix | Delete
*
[42] Fix | Delete
* @author Vova Feldman (@svovaf)
[43] Fix | Delete
* @since 1.2.2.6
[44] Fix | Delete
*/
[45] Fix | Delete
$file_path = fs_normalize_path( __FILE__ );
[46] Fix | Delete
$fs_root_path = dirname( $file_path );
[47] Fix | Delete
[48] Fix | Delete
// @todo: Remove this code after a few months when WP 6.3 usage is low enough.
[49] Fix | Delete
global $wp_version;
[50] Fix | Delete
[51] Fix | Delete
if (
[52] Fix | Delete
! function_exists( 'wp_get_current_user' ) &&
[53] Fix | Delete
/**
[54] Fix | Delete
* `get_stylesheet()` will rely on `wp_get_current_user()` when it is being filtered by `theme-previews.php`. That happens only when the site editor is loaded or when the site editor is sending REST requests.
[55] Fix | Delete
* @see theme-previews.php:wp_get_theme_preview_path()
[56] Fix | Delete
*
[57] Fix | Delete
* @todo This behavior is already fixed in the core (WP 6.3.2+), and this code can be removed after a few months when WP 6.3 usage is low enough.
[58] Fix | Delete
* @since WP 6.3.0
[59] Fix | Delete
*/
[60] Fix | Delete
version_compare( $wp_version, '6.3', '>=' ) &&
[61] Fix | Delete
version_compare( $wp_version, '6.3.1', '<=' ) &&
[62] Fix | Delete
(
[63] Fix | Delete
'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ||
[64] Fix | Delete
(
[65] Fix | Delete
function_exists( 'wp_is_json_request' ) &&
[66] Fix | Delete
wp_is_json_request() &&
[67] Fix | Delete
! empty( $_GET['wp_theme_preview'] )
[68] Fix | Delete
)
[69] Fix | Delete
)
[70] Fix | Delete
) {
[71] Fix | Delete
// Requiring this file since the call to get_stylesheet() below can trigger a call to wp_get_current_user() when previewing a theme.
[72] Fix | Delete
require_once ABSPATH . 'wp-includes/pluggable.php';
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
/**
[76] Fix | Delete
* Get the themes directory where the active theme is located (not passing the stylesheet will make WordPress
[77] Fix | Delete
* assume that the themes directory is inside `wp-content`.
[78] Fix | Delete
*
[79] Fix | Delete
* @author Leo Fajardo (@leorw)
[80] Fix | Delete
* @since 2.2.3
[81] Fix | Delete
*/
[82] Fix | Delete
$themes_directory = get_theme_root( get_stylesheet() );
[83] Fix | Delete
$themes_directory_name = basename( $themes_directory );
[84] Fix | Delete
$theme_candidate_basename = basename( dirname( $fs_root_path ) ) . '/' . basename( $fs_root_path );
[85] Fix | Delete
[86] Fix | Delete
if ( $file_path == fs_normalize_path( realpath( trailingslashit( $themes_directory ) . $theme_candidate_basename . '/' . basename( $file_path ) ) )
[87] Fix | Delete
) {
[88] Fix | Delete
$this_sdk_relative_path = '../' . $themes_directory_name . '/' . $theme_candidate_basename;
[89] Fix | Delete
$is_theme = true;
[90] Fix | Delete
} else {
[91] Fix | Delete
$this_sdk_relative_path = plugin_basename( $fs_root_path );
[92] Fix | Delete
$is_theme = false;
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
if ( ! isset( $fs_active_plugins ) ) {
[96] Fix | Delete
// Load all Freemius powered active plugins.
[97] Fix | Delete
$fs_active_plugins = get_option( 'fs_active_plugins' );
[98] Fix | Delete
[99] Fix | Delete
if ( ! is_object( $fs_active_plugins ) ) {
[100] Fix | Delete
$fs_active_plugins = new stdClass();
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
if ( ! isset( $fs_active_plugins->plugins ) ) {
[104] Fix | Delete
$fs_active_plugins->plugins = array();
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
if ( empty( $fs_active_plugins->abspath ) ) {
[109] Fix | Delete
/**
[110] Fix | Delete
* Store the WP install absolute path reference to identify environment change
[111] Fix | Delete
* while replicating the storage.
[112] Fix | Delete
*
[113] Fix | Delete
* @author Vova Feldman (@svovaf)
[114] Fix | Delete
* @since 1.2.1.7
[115] Fix | Delete
*/
[116] Fix | Delete
$fs_active_plugins->abspath = ABSPATH;
[117] Fix | Delete
} else {
[118] Fix | Delete
if ( ABSPATH !== $fs_active_plugins->abspath ) {
[119] Fix | Delete
/**
[120] Fix | Delete
* WordPress path has changed, cleanup the SDK references cache.
[121] Fix | Delete
* This resolves issues triggered when spinning a staging environments
[122] Fix | Delete
* while replicating the database.
[123] Fix | Delete
*
[124] Fix | Delete
* @author Vova Feldman (@svovaf)
[125] Fix | Delete
* @since 1.2.1.7
[126] Fix | Delete
*/
[127] Fix | Delete
$fs_active_plugins->abspath = ABSPATH;
[128] Fix | Delete
$fs_active_plugins->plugins = array();
[129] Fix | Delete
unset( $fs_active_plugins->newest );
[130] Fix | Delete
} else {
[131] Fix | Delete
/**
[132] Fix | Delete
* Make sure SDK references are still valid. This resolves
[133] Fix | Delete
* issues when users hard delete modules via FTP.
[134] Fix | Delete
*
[135] Fix | Delete
* @author Vova Feldman (@svovaf)
[136] Fix | Delete
* @since 1.2.1.7
[137] Fix | Delete
*/
[138] Fix | Delete
$has_changes = false;
[139] Fix | Delete
foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
[140] Fix | Delete
if ( ! file_exists( ( isset( $data->type ) && 'theme' === $data->type ? $themes_directory : WP_PLUGIN_DIR ) . '/' . $sdk_path ) ) {
[141] Fix | Delete
unset( $fs_active_plugins->plugins[ $sdk_path ] );
[142] Fix | Delete
[143] Fix | Delete
if (
[144] Fix | Delete
! empty( $fs_active_plugins->newest ) &&
[145] Fix | Delete
$sdk_path === $fs_active_plugins->newest->sdk_path
[146] Fix | Delete
) {
[147] Fix | Delete
unset( $fs_active_plugins->newest );
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
$has_changes = true;
[151] Fix | Delete
}
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
if ( $has_changes ) {
[155] Fix | Delete
if ( empty( $fs_active_plugins->plugins ) ) {
[156] Fix | Delete
unset( $fs_active_plugins->newest );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
update_option( 'fs_active_plugins', $fs_active_plugins );
[160] Fix | Delete
}
[161] Fix | Delete
}
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
if ( ! function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
[165] Fix | Delete
require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-1.1.7.1.php';
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
if ( ! function_exists( 'fs_get_plugins' ) ) {
[169] Fix | Delete
require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-2.2.1.php';
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
// Update current SDK info based on the SDK path.
[173] Fix | Delete
if ( ! isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) ||
[174] Fix | Delete
$this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
[175] Fix | Delete
) {
[176] Fix | Delete
if ( $is_theme ) {
[177] Fix | Delete
$plugin_path = basename( dirname( $this_sdk_relative_path ) );
[178] Fix | Delete
} else {
[179] Fix | Delete
$plugin_path = plugin_basename( fs_find_direct_caller_plugin_file( $file_path ) );
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
$fs_active_plugins->plugins[ $this_sdk_relative_path ] = (object) array(
[183] Fix | Delete
'version' => $this_sdk_version,
[184] Fix | Delete
'type' => ( $is_theme ? 'theme' : 'plugin' ),
[185] Fix | Delete
'timestamp' => time(),
[186] Fix | Delete
'plugin_path' => $plugin_path,
[187] Fix | Delete
);
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
$is_current_sdk_newest = isset( $fs_active_plugins->newest ) && ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path );
[191] Fix | Delete
[192] Fix | Delete
if ( ! isset( $fs_active_plugins->newest ) ) {
[193] Fix | Delete
/**
[194] Fix | Delete
* This will be executed only once, for the first time a Freemius powered plugin is activated.
[195] Fix | Delete
*/
[196] Fix | Delete
fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
[197] Fix | Delete
[198] Fix | Delete
$is_current_sdk_newest = true;
[199] Fix | Delete
} else if ( version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '<' ) ) {
[200] Fix | Delete
/**
[201] Fix | Delete
* Current SDK is newer than the newest stored SDK.
[202] Fix | Delete
*/
[203] Fix | Delete
fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
[204] Fix | Delete
[205] Fix | Delete
if ( class_exists( 'Freemius' ) ) {
[206] Fix | Delete
// Older SDK version was already loaded.
[207] Fix | Delete
[208] Fix | Delete
if ( ! $fs_active_plugins->newest->in_activation ) {
[209] Fix | Delete
// Re-order plugins to load this plugin first.
[210] Fix | Delete
fs_newest_sdk_plugin_first();
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
// Refresh page.
[214] Fix | Delete
fs_redirect( $_SERVER['REQUEST_URI'] );
[215] Fix | Delete
}
[216] Fix | Delete
} else {
[217] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[218] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[219] Fix | Delete
}
[220] Fix | Delete
[221] Fix | Delete
$fs_newest_sdk = $fs_active_plugins->newest;
[222] Fix | Delete
$fs_newest_sdk = $fs_active_plugins->plugins[ $fs_newest_sdk->sdk_path ];
[223] Fix | Delete
[224] Fix | Delete
$is_newest_sdk_type_theme = ( isset( $fs_newest_sdk->type ) && 'theme' === $fs_newest_sdk->type );
[225] Fix | Delete
[226] Fix | Delete
if ( ! $is_newest_sdk_type_theme ) {
[227] Fix | Delete
$is_newest_sdk_plugin_active = is_plugin_active( $fs_newest_sdk->plugin_path );
[228] Fix | Delete
} else {
[229] Fix | Delete
$current_theme = wp_get_theme();
[230] Fix | Delete
$is_newest_sdk_plugin_active = ( $current_theme->stylesheet === $fs_newest_sdk->plugin_path );
[231] Fix | Delete
[232] Fix | Delete
$current_theme_parent = $current_theme->parent();
[233] Fix | Delete
[234] Fix | Delete
/**
[235] Fix | Delete
* If the current theme is a child of the theme that has the newest SDK, this prevents a redirects loop
[236] Fix | Delete
* from happening by keeping the SDK info stored in the `fs_active_plugins` option.
[237] Fix | Delete
*/
[238] Fix | Delete
if ( ! $is_newest_sdk_plugin_active && $current_theme_parent instanceof WP_Theme ) {
[239] Fix | Delete
$is_newest_sdk_plugin_active = ( $fs_newest_sdk->plugin_path === $current_theme_parent->stylesheet );
[240] Fix | Delete
}
[241] Fix | Delete
}
[242] Fix | Delete
[243] Fix | Delete
if ( $is_current_sdk_newest &&
[244] Fix | Delete
! $is_newest_sdk_plugin_active &&
[245] Fix | Delete
! $fs_active_plugins->newest->in_activation
[246] Fix | Delete
) {
[247] Fix | Delete
// If current SDK is the newest and the plugin is NOT active, it means
[248] Fix | Delete
// that the current plugin in activation mode.
[249] Fix | Delete
$fs_active_plugins->newest->in_activation = true;
[250] Fix | Delete
update_option( 'fs_active_plugins', $fs_active_plugins );
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
if ( ! $is_theme ) {
[254] Fix | Delete
$sdk_starter_path = fs_normalize_path( WP_PLUGIN_DIR . '/' . $this_sdk_relative_path . '/start.php' );
[255] Fix | Delete
} else {
[256] Fix | Delete
$sdk_starter_path = fs_normalize_path(
[257] Fix | Delete
$themes_directory
[258] Fix | Delete
. '/'
[259] Fix | Delete
. str_replace( "../{$themes_directory_name}/", '', $this_sdk_relative_path )
[260] Fix | Delete
. '/start.php' );
[261] Fix | Delete
}
[262] Fix | Delete
[263] Fix | Delete
$is_newest_sdk_path_valid = ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );
[264] Fix | Delete
[265] Fix | Delete
if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
[266] Fix | Delete
// Plugin with newest SDK is no longer active, or SDK was moved to a different location.
[267] Fix | Delete
unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
if ( ! ( $is_newest_sdk_plugin_active || $fs_active_plugins->newest->in_activation ) ||
[271] Fix | Delete
! $is_newest_sdk_path_valid ||
[272] Fix | Delete
// Is newest SDK downgraded.
[273] Fix | Delete
( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
[274] Fix | Delete
version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '>' ) )
[275] Fix | Delete
) {
[276] Fix | Delete
/**
[277] Fix | Delete
* Plugin with newest SDK is no longer active.
[278] Fix | Delete
* OR
[279] Fix | Delete
* The newest SDK was in the current plugin. BUT, seems like the version of
[280] Fix | Delete
* the SDK was downgraded to a lower SDK.
[281] Fix | Delete
*/
[282] Fix | Delete
// Find the active plugin with the newest SDK version and update the newest reference.
[283] Fix | Delete
fs_fallback_to_newest_active_sdk();
[284] Fix | Delete
} else {
[285] Fix | Delete
if ( $is_newest_sdk_plugin_active &&
[286] Fix | Delete
$this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
[287] Fix | Delete
( $fs_active_plugins->newest->in_activation ||
[288] Fix | Delete
( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
[289] Fix | Delete
)
[290] Fix | Delete
[291] Fix | Delete
) {
[292] Fix | Delete
if ( $fs_active_plugins->newest->in_activation && ! $is_newest_sdk_type_theme ) {
[293] Fix | Delete
// Plugin no more in activation.
[294] Fix | Delete
$fs_active_plugins->newest->in_activation = false;
[295] Fix | Delete
update_option( 'fs_active_plugins', $fs_active_plugins );
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
// Reorder plugins to load plugin with newest SDK first.
[299] Fix | Delete
if ( fs_newest_sdk_plugin_first() ) {
[300] Fix | Delete
// Refresh page after re-order to make sure activated plugin loads newest SDK.
[301] Fix | Delete
if ( class_exists( 'Freemius' ) ) {
[302] Fix | Delete
fs_redirect( $_SERVER['REQUEST_URI'] );
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
}
[307] Fix | Delete
}
[308] Fix | Delete
[309] Fix | Delete
if ( class_exists( 'Freemius' ) ) {
[310] Fix | Delete
// SDK was already loaded.
[311] Fix | Delete
return;
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
[315] Fix | Delete
$newest_sdk = $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ];
[316] Fix | Delete
[317] Fix | Delete
$plugins_or_theme_dir_path = ( ! isset( $newest_sdk->type ) || 'theme' !== $newest_sdk->type ) ?
[318] Fix | Delete
WP_PLUGIN_DIR :
[319] Fix | Delete
$themes_directory;
[320] Fix | Delete
[321] Fix | Delete
$newest_sdk_starter = fs_normalize_path(
[322] Fix | Delete
$plugins_or_theme_dir_path
[323] Fix | Delete
. '/'
[324] Fix | Delete
. str_replace( "../{$themes_directory_name}/", '', $fs_active_plugins->newest->sdk_path )
[325] Fix | Delete
. '/start.php' );
[326] Fix | Delete
[327] Fix | Delete
if ( file_exists( $newest_sdk_starter ) ) {
[328] Fix | Delete
// Reorder plugins to load plugin with newest SDK first.
[329] Fix | Delete
fs_newest_sdk_plugin_first();
[330] Fix | Delete
[331] Fix | Delete
// There's a newer SDK version, load it instead of the current one!
[332] Fix | Delete
require_once $newest_sdk_starter;
[333] Fix | Delete
[334] Fix | Delete
return;
[335] Fix | Delete
}
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
#endregion SDK Selection Logic --------------------------------------------------------------------
[339] Fix | Delete
[340] Fix | Delete
#region Hooks & Filters Collection --------------------------------------------------------------------
[341] Fix | Delete
[342] Fix | Delete
/**
[343] Fix | Delete
* Freemius hooks (actions & filters) tags structure:
[344] Fix | Delete
*
[345] Fix | Delete
* fs_{filter/action_name}_{plugin_slug}
[346] Fix | Delete
*
[347] Fix | Delete
* --------------------------------------------------------
[348] Fix | Delete
*
[349] Fix | Delete
* Usage with WordPress' add_action() / add_filter():
[350] Fix | Delete
*
[351] Fix | Delete
* add_action('fs_{filter/action_name}_{plugin_slug}', $callable);
[352] Fix | Delete
*
[353] Fix | Delete
* --------------------------------------------------------
[354] Fix | Delete
*
[355] Fix | Delete
* Usage with Freemius' instance add_action() / add_filter():
[356] Fix | Delete
*
[357] Fix | Delete
* // No need to add 'fs_' prefix nor '_{plugin_slug}' suffix.
[358] Fix | Delete
* my_freemius()->add_action('{action_name}', $callable);
[359] Fix | Delete
*
[360] Fix | Delete
* --------------------------------------------------------
[361] Fix | Delete
*
[362] Fix | Delete
* Freemius filters collection:
[363] Fix | Delete
*
[364] Fix | Delete
* fs_connect_url_{plugin_slug}
[365] Fix | Delete
* fs_trial_promotion_message_{plugin_slug}
[366] Fix | Delete
* fs_is_long_term_user_{plugin_slug}
[367] Fix | Delete
* fs_uninstall_reasons_{plugin_slug}
[368] Fix | Delete
* fs_is_plugin_update_{plugin_slug}
[369] Fix | Delete
* fs_api_domains_{plugin_slug}
[370] Fix | Delete
* fs_email_template_sections_{plugin_slug}
[371] Fix | Delete
* fs_support_forum_submenu_{plugin_slug}
[372] Fix | Delete
* fs_support_forum_url_{plugin_slug}
[373] Fix | Delete
* fs_connect_message_{plugin_slug}
[374] Fix | Delete
* fs_connect_message_on_update_{plugin_slug}
[375] Fix | Delete
* fs_uninstall_confirmation_message_{plugin_slug}
[376] Fix | Delete
* fs_pending_activation_message_{plugin_slug}
[377] Fix | Delete
* fs_is_submenu_visible_{plugin_slug}
[378] Fix | Delete
* fs_plugin_icon_{plugin_slug}
[379] Fix | Delete
* fs_show_trial_{plugin_slug}
[380] Fix | Delete
*
[381] Fix | Delete
* --------------------------------------------------------
[382] Fix | Delete
*
[383] Fix | Delete
* Freemius actions collection:
[384] Fix | Delete
*
[385] Fix | Delete
* fs_after_license_loaded_{plugin_slug}
[386] Fix | Delete
* fs_after_license_change_{plugin_slug}
[387] Fix | Delete
* fs_after_plans_sync_{plugin_slug}
[388] Fix | Delete
*
[389] Fix | Delete
* fs_after_account_details_{plugin_slug}
[390] Fix | Delete
* fs_after_account_user_sync_{plugin_slug}
[391] Fix | Delete
* fs_after_account_plan_sync_{plugin_slug}
[392] Fix | Delete
* fs_before_account_load_{plugin_slug}
[393] Fix | Delete
* fs_after_account_connection_{plugin_slug}
[394] Fix | Delete
* fs_account_property_edit_{plugin_slug}
[395] Fix | Delete
* fs_account_email_verified_{plugin_slug}
[396] Fix | Delete
* fs_account_page_load_before_departure_{plugin_slug}
[397] Fix | Delete
* fs_before_account_delete_{plugin_slug}
[398] Fix | Delete
* fs_after_account_delete_{plugin_slug}
[399] Fix | Delete
*
[400] Fix | Delete
* fs_sdk_version_update_{plugin_slug}
[401] Fix | Delete
* fs_plugin_version_update_{plugin_slug}
[402] Fix | Delete
*
[403] Fix | Delete
* fs_initiated_{plugin_slug}
[404] Fix | Delete
* fs_after_init_plugin_registered_{plugin_slug}
[405] Fix | Delete
* fs_after_init_plugin_anonymous_{plugin_slug}
[406] Fix | Delete
* fs_after_init_plugin_pending_activations_{plugin_slug}
[407] Fix | Delete
* fs_after_init_addon_registered_{plugin_slug}
[408] Fix | Delete
* fs_after_init_addon_anonymous_{plugin_slug}
[409] Fix | Delete
* fs_after_init_addon_pending_activations_{plugin_slug}
[410] Fix | Delete
*
[411] Fix | Delete
* fs_after_premium_version_activation_{plugin_slug}
[412] Fix | Delete
* fs_after_free_version_reactivation_{plugin_slug}
[413] Fix | Delete
*
[414] Fix | Delete
* fs_after_uninstall_{plugin_slug}
[415] Fix | Delete
* fs_before_admin_menu_init_{plugin_slug}
[416] Fix | Delete
*/
[417] Fix | Delete
[418] Fix | Delete
#endregion Hooks & Filters Collection --------------------------------------------------------------------
[419] Fix | Delete
[420] Fix | Delete
if ( ! class_exists( 'Freemius' ) ) {
[421] Fix | Delete
[422] Fix | Delete
if ( ! defined( 'WP_FS__SDK_VERSION' ) ) {
[423] Fix | Delete
define( 'WP_FS__SDK_VERSION', $this_sdk_version );
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
$plugins_or_theme_dir_path = fs_normalize_path( trailingslashit( $is_theme ?
[427] Fix | Delete
$themes_directory :
[428] Fix | Delete
WP_PLUGIN_DIR ) );
[429] Fix | Delete
[430] Fix | Delete
if ( 0 === strpos( $file_path, $plugins_or_theme_dir_path ) ) {
[431] Fix | Delete
// No symlinks
[432] Fix | Delete
} else {
[433] Fix | Delete
/**
[434] Fix | Delete
* This logic finds the SDK symlink and set WP_FS__DIR to use it.
[435] Fix | Delete
*
[436] Fix | Delete
* @author Vova Feldman (@svovaf)
[437] Fix | Delete
* @since 1.2.2.5
[438] Fix | Delete
*/
[439] Fix | Delete
$sdk_symlink = null;
[440] Fix | Delete
[441] Fix | Delete
// Try to load SDK's symlink from cache.
[442] Fix | Delete
if ( isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
[443] Fix | Delete
is_object( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
[444] Fix | Delete
! empty( $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink )
[445] Fix | Delete
) {
[446] Fix | Delete
$sdk_symlink = $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink;
[447] Fix | Delete
if ( 0 === strpos( $sdk_symlink, $plugins_or_theme_dir_path ) ) {
[448] Fix | Delete
/**
[449] Fix | Delete
* Make the symlink path relative.
[450] Fix | Delete
*
[451] Fix | Delete
* @author Leo Fajardo (@leorw)
[452] Fix | Delete
*/
[453] Fix | Delete
$sdk_symlink = substr( $sdk_symlink, strlen( $plugins_or_theme_dir_path ) );
[454] Fix | Delete
[455] Fix | Delete
$fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink = $sdk_symlink;
[456] Fix | Delete
update_option( 'fs_active_plugins', $fs_active_plugins );
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
$realpath = realpath( $plugins_or_theme_dir_path . $sdk_symlink );
[460] Fix | Delete
if ( ! is_string( $realpath ) || ! file_exists( $realpath ) ) {
[461] Fix | Delete
$sdk_symlink = null;
[462] Fix | Delete
}
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
if ( empty( $sdk_symlink ) ) // Has symlinks, therefore, we need to configure WP_FS__DIR based on the symlink.
[466] Fix | Delete
{
[467] Fix | Delete
$partial_path_right = basename( $file_path );
[468] Fix | Delete
$partial_path_left = dirname( $file_path );
[469] Fix | Delete
$realpath = realpath( $plugins_or_theme_dir_path . $partial_path_right );
[470] Fix | Delete
[471] Fix | Delete
while ( '/' !== $partial_path_left &&
[472] Fix | Delete
( false === $realpath || $file_path !== fs_normalize_path( $realpath ) )
[473] Fix | Delete
) {
[474] Fix | Delete
$partial_path_right = trailingslashit( basename( $partial_path_left ) ) . $partial_path_right;
[475] Fix | Delete
$partial_path_left_prev = $partial_path_left;
[476] Fix | Delete
$partial_path_left = dirname( $partial_path_left_prev );
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* Avoid infinite loop if for example `$partial_path_left_prev` is `C:/`, in this case,
[480] Fix | Delete
* `dirname( 'C:/' )` will return `C:/`.
[481] Fix | Delete
*
[482] Fix | Delete
* @author Leo Fajardo (@leorw)
[483] Fix | Delete
*/
[484] Fix | Delete
if ( $partial_path_left === $partial_path_left_prev ) {
[485] Fix | Delete
$partial_path_left = '';
[486] Fix | Delete
break;
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
$realpath = realpath( $plugins_or_theme_dir_path . $partial_path_right );
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
if ( ! empty( $partial_path_left ) && '/' !== $partial_path_left ) {
[493] Fix | Delete
$sdk_symlink = fs_normalize_path( dirname( $partial_path_right ) );
[494] Fix | Delete
[495] Fix | Delete
// Cache value.
[496] Fix | Delete
if ( isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
[497] Fix | Delete
is_object( $fs_active_plugins->plugins[ $this_sdk_relative_path ] )
[498] Fix | Delete
) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function