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;
[1000] Fix | Delete
}
[1001] Fix | Delete
[1002] Fix | Delete
if ( isset( $install->plan ) && is_object( $install->plan ) ) {
[1003] Fix | Delete
if ( isset( $install->plan->id ) && ! empty( $install->plan->id ) ) {
[1004] Fix | Delete
$install->plan_id = self::_decrypt( $install->plan->id );
[1005] Fix | Delete
}
[1006] Fix | Delete
[1007] Fix | Delete
unset( $install->plan );
[1008] Fix | Delete
[1009] Fix | Delete
$installs[ $module_slug ] = clone $install;
[1010] Fix | Delete
[1011] Fix | Delete
self::set_account_option_by_module(
[1012] Fix | Delete
$module_type,
[1013] Fix | Delete
'sites',
[1014] Fix | Delete
$installs,
[1015] Fix | Delete
true,
[1016] Fix | Delete
$blog_id
[1017] Fix | Delete
);
[1018] Fix | Delete
}
[1019] Fix | Delete
}
[1020] Fix | Delete
[1021] Fix | Delete
/**
[1022] Fix | Delete
* @author Vova Feldman (@svovaf)
[1023] Fix | Delete
* @since 1.2.2.7
[1024] Fix | Delete
*
[1025] Fix | Delete
* @param string $plugin_prev_version
[1026] Fix | Delete
* @param string $plugin_version
[1027] Fix | Delete
*/
[1028] Fix | Delete
function _after_version_update( $plugin_prev_version, $plugin_version ) {
[1029] Fix | Delete
if ( $this->is_theme() ) {
[1030] Fix | Delete
// Expire the cache of the previous tabs since the theme may
[1031] Fix | Delete
// have setting updates.
[1032] Fix | Delete
$this->_cache->expire( 'tabs' );
[1033] Fix | Delete
$this->_cache->expire( 'tabs_stylesheets' );
[1034] Fix | Delete
}
[1035] Fix | Delete
}
[1036] Fix | Delete
[1037] Fix | Delete
/**
[1038] Fix | Delete
* A special migration logic for the $_accounts, executed for all the plugins in the system:
[1039] Fix | Delete
* - Moves some data to the network level storage.
[1040] Fix | Delete
* - If the plugin's connection was skipped for all sites, set the plugin as if it was network skipped.
[1041] Fix | Delete
* - If the plugin's connection was ignored for all sites, don't do anything in terms of the network connection.
[1042] Fix | Delete
* - If the plugin was connected to all sites by the same super-admin, set the plugin as if was network opted-in for all sites.
[1043] Fix | Delete
* - If there's at least one site that was connected by a super-admin, find the "main super-admin" (the one that installed the majority of the plugin installs) and set the plugin as if was network activated with the main super-admin, set all the sites that were skipped or opted-in with a different user to delegated mode. Then, prompt the currently logged super-admin to choose what to do with the ignored sites.
[1044] Fix | Delete
* - If there are any sites in the network which the connection decision was not yet taken for, set this plugin into network activation mode so a super-admin can choose what to do with the rest of the sites.
[1045] Fix | Delete
*
[1046] Fix | Delete
* @author Vova Feldman (@svovaf)
[1047] Fix | Delete
* @since 2.0.0
[1048] Fix | Delete
*/
[1049] Fix | Delete
private static function migrate_accounts_to_network() {
[1050] Fix | Delete
$sites = self::get_sites();
[1051] Fix | Delete
$sites_count = count( $sites );
[1052] Fix | Delete
$connection_status = array();
[1053] Fix | Delete
$plugin_slugs = array();
[1054] Fix | Delete
foreach ( $sites as $site ) {
[1055] Fix | Delete
$blog_id = self::get_site_blog_id( $site );
[1056] Fix | Delete
[1057] Fix | Delete
self::$_accounts->migrate_to_network( $blog_id );
[1058] Fix | Delete
[1059] Fix | Delete
/**
[1060] Fix | Delete
* Build a list of all Freemius powered plugins slugs.
[1061] Fix | Delete
*/
[1062] Fix | Delete
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array(), $blog_id );
[1063] Fix | Delete
foreach ( $id_slug_type_path_map as $module_id => $data ) {
[1064] Fix | Delete
if ( WP_FS__MODULE_TYPE_PLUGIN === $data['type'] ) {
[1065] Fix | Delete
$plugin_slugs[ $data['slug'] ] = true;
[1066] Fix | Delete
}
[1067] Fix | Delete
}
[1068] Fix | Delete
[1069] Fix | Delete
$installs = self::get_account_option( 'sites', WP_FS__MODULE_TYPE_PLUGIN, $blog_id );
[1070] Fix | Delete
[1071] Fix | Delete
if ( is_array( $installs ) ) {
[1072] Fix | Delete
foreach ( $installs as $slug => $install ) {
[1073] Fix | Delete
if ( ! isset( $connection_status[ $slug ] ) ) {
[1074] Fix | Delete
$connection_status[ $slug ] = array();
[1075] Fix | Delete
}
[1076] Fix | Delete
[1077] Fix | Delete
if ( is_object( $install ) &&
[1078] Fix | Delete
FS_Site::is_valid_id( $install->id ) &&
[1079] Fix | Delete
FS_User::is_valid_id( $install->user_id )
[1080] Fix | Delete
) {
[1081] Fix | Delete
$connection_status[ $slug ][ $blog_id ] = $install->user_id;
[1082] Fix | Delete
}
[1083] Fix | Delete
}
[1084] Fix | Delete
}
[1085] Fix | Delete
}
[1086] Fix | Delete
[1087] Fix | Delete
foreach ( $plugin_slugs as $slug => $true ) {
[1088] Fix | Delete
if ( ! isset( $connection_status[ $slug ] ) ) {
[1089] Fix | Delete
$connection_status[ $slug ] = array();
[1090] Fix | Delete
}
[1091] Fix | Delete
[1092] Fix | Delete
foreach ( $sites as $site ) {
[1093] Fix | Delete
$blog_id = self::get_site_blog_id( $site );
[1094] Fix | Delete
[1095] Fix | Delete
if ( isset( $connection_status[ $slug ][ $blog_id ] ) ) {
[1096] Fix | Delete
continue;
[1097] Fix | Delete
}
[1098] Fix | Delete
[1099] Fix | Delete
$storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
[1100] Fix | Delete
[1101] Fix | Delete
$is_anonymous = $storage->get( 'is_anonymous', null, $blog_id );
[1102] Fix | Delete
[1103] Fix | Delete
if ( ! is_null( $is_anonymous ) ) {
[1104] Fix | Delete
// Since 1.1.3 is_anonymous is an array.
[1105] Fix | Delete
if ( is_array( $is_anonymous ) && isset( $is_anonymous['is'] ) ) {
[1106] Fix | Delete
$is_anonymous = $is_anonymous['is'];
[1107] Fix | Delete
}
[1108] Fix | Delete
[1109] Fix | Delete
if ( is_bool( $is_anonymous ) && true === $is_anonymous ) {
[1110] Fix | Delete
$connection_status[ $slug ][ $blog_id ] = 'skipped';
[1111] Fix | Delete
}
[1112] Fix | Delete
}
[1113] Fix | Delete
[1114] Fix | Delete
if ( ! isset( $connection_status[ $slug ][ $blog_id ] ) ) {
[1115] Fix | Delete
$connection_status[ $slug ][ $blog_id ] = 'ignored';
[1116] Fix | Delete
}
[1117] Fix | Delete
}
[1118] Fix | Delete
}
[1119] Fix | Delete
[1120] Fix | Delete
$super_admins = array();
[1121] Fix | Delete
[1122] Fix | Delete
foreach ( $connection_status as $slug => $blogs_status ) {
[1123] Fix | Delete
$skips = 0;
[1124] Fix | Delete
$ignores = 0;
[1125] Fix | Delete
$connections = 0;
[1126] Fix | Delete
$opted_in_users = array();
[1127] Fix | Delete
$opted_in_super_admins = array();
[1128] Fix | Delete
[1129] Fix | Delete
$storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
[1130] Fix | Delete
[1131] Fix | Delete
foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
[1132] Fix | Delete
if ( 'skipped' === $status_or_user_id ) {
[1133] Fix | Delete
$skips ++;
[1134] Fix | Delete
} else if ( 'ignored' === $status_or_user_id ) {
[1135] Fix | Delete
$ignores ++;
[1136] Fix | Delete
} else if ( FS_User::is_valid_id( $status_or_user_id ) ) {
[1137] Fix | Delete
$connections ++;
[1138] Fix | Delete
[1139] Fix | Delete
if ( ! isset( $opted_in_users[ $status_or_user_id ] ) ) {
[1140] Fix | Delete
$opted_in_users[ $status_or_user_id ] = array();
[1141] Fix | Delete
}
[1142] Fix | Delete
[1143] Fix | Delete
$opted_in_users[ $status_or_user_id ][] = $blog_id;
[1144] Fix | Delete
[1145] Fix | Delete
if ( isset( $super_admins[ $status_or_user_id ] ) ||
[1146] Fix | Delete
self::is_super_admin( $status_or_user_id )
[1147] Fix | Delete
) {
[1148] Fix | Delete
// Cache super-admin data.
[1149] Fix | Delete
$super_admins[ $status_or_user_id ] = true;
[1150] Fix | Delete
[1151] Fix | Delete
// Remember opted-in super-admins for the plugin.
[1152] Fix | Delete
$opted_in_super_admins[ $status_or_user_id ] = true;
[1153] Fix | Delete
}
[1154] Fix | Delete
}
[1155] Fix | Delete
}
[1156] Fix | Delete
[1157] Fix | Delete
$main_super_admin_user_id = null;
[1158] Fix | Delete
$all_migrated = false;
[1159] Fix | Delete
if ( $sites_count == $skips ) {
[1160] Fix | Delete
// All sites were skipped -> network skip by copying the anonymous mode from any of the sites.
[1161] Fix | Delete
$storage->is_anonymous_ms = $storage->is_anonymous;
[1162] Fix | Delete
[1163] Fix | Delete
$all_migrated = true;
[1164] Fix | Delete
} else if ( $sites_count == $ignores ) {
[1165] Fix | Delete
// Don't do anything, still in activation mode.
[1166] Fix | Delete
[1167] Fix | Delete
$all_migrated = true;
[1168] Fix | Delete
} else if ( 0 < count( $opted_in_super_admins ) ) {
[1169] Fix | Delete
// Find the super-admin with the majority of installs.
[1170] Fix | Delete
$max_installs_by_super_admin = 0;
[1171] Fix | Delete
foreach ( $opted_in_super_admins as $user_id => $true ) {
[1172] Fix | Delete
$installs_count = count( $opted_in_users[ $user_id ] );
[1173] Fix | Delete
[1174] Fix | Delete
if ( $installs_count > $max_installs_by_super_admin ) {
[1175] Fix | Delete
$max_installs_by_super_admin = $installs_count;
[1176] Fix | Delete
$main_super_admin_user_id = $user_id;
[1177] Fix | Delete
}
[1178] Fix | Delete
}
[1179] Fix | Delete
[1180] Fix | Delete
if ( $sites_count == $connections && 1 == count( $opted_in_super_admins ) ) {
[1181] Fix | Delete
// Super-admin opted-in for all sites in the network.
[1182] Fix | Delete
$storage->is_network_connected = true;
[1183] Fix | Delete
[1184] Fix | Delete
$all_migrated = true;
[1185] Fix | Delete
}
[1186] Fix | Delete
[1187] Fix | Delete
// Store network user.
[1188] Fix | Delete
$storage->network_user_id = $main_super_admin_user_id;
[1189] Fix | Delete
[1190] Fix | Delete
$storage->network_install_blog_id = ( $sites_count == $connections ) ?
[1191] Fix | Delete
// Since all sites are opted-in, associating with the main site.
[1192] Fix | Delete
get_current_blog_id() :
[1193] Fix | Delete
// Associating with the 1st found opted-in site.
[1194] Fix | Delete
$opted_in_users[ $main_super_admin_user_id ][0];
[1195] Fix | Delete
[1196] Fix | Delete
/**
[1197] Fix | Delete
* Make sure we migrate the plan ID of the network install, otherwise, if after the migration
[1198] Fix | Delete
* the 1st page that will be loaded is the network level WP Admin and $storage->network_install_blog_id
[1199] Fix | Delete
* is different than the main site of the network, the $this->_site will not be set since the plan_id
[1200] Fix | Delete
* will be empty.
[1201] Fix | Delete
*/
[1202] Fix | Delete
$storage->migrate_to_network();
[1203] Fix | Delete
self::migrate_install_plan_to_plan_id( $storage, $storage->network_install_blog_id );
[1204] Fix | Delete
} else {
[1205] Fix | Delete
// At least one opt-in. All the opt-in were created by a non-super-admin.
[1206] Fix | Delete
if ( 0 == $ignores ) {
[1207] Fix | Delete
// All sites were opted-in or skipped, all by non-super-admin. So delegate all.
[1208] Fix | Delete
$storage->store( 'is_delegated_connection', true, true );
[1209] Fix | Delete
[1210] Fix | Delete
$all_migrated = true;
[1211] Fix | Delete
}
[1212] Fix | Delete
}
[1213] Fix | Delete
[1214] Fix | Delete
if ( ! $all_migrated ) {
[1215] Fix | Delete
/**
[1216] Fix | Delete
* Delegate all sites that were:
[1217] Fix | Delete
* 1) Opted-in by a user that is NOT the main-super-admin.
[1218] Fix | Delete
* 2) Skipped and non of the sites was opted-in by a super-admin. If any site was opted-in by a super-admin, there will be a main-super-admin, and we consider the skip as if it was done by that user.
[1219] Fix | Delete
*/
[1220] Fix | Delete
foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
[1221] Fix | Delete
if ( $status_or_user_id == $main_super_admin_user_id ) {
[1222] Fix | Delete
continue;
[1223] Fix | Delete
}
[1224] Fix | Delete
[1225] Fix | Delete
if ( FS_User::is_valid_id( $status_or_user_id ) ||
[1226] Fix | Delete
( 'skipped' === $status_or_user_id && is_null( $main_super_admin_user_id ) )
[1227] Fix | Delete
) {
[1228] Fix | Delete
$storage->store( 'is_delegated_connection', true, $blog_id );
[1229] Fix | Delete
}
[1230] Fix | Delete
}
[1231] Fix | Delete
}
[1232] Fix | Delete
[1233] Fix | Delete
[1234] Fix | Delete
if ( ( $connections + $skips > 0 ) ) {
[1235] Fix | Delete
if ( $ignores > 0 ) {
[1236] Fix | Delete
/**
[1237] Fix | Delete
* If admin already opted-in or skipped in any of the network sites, and also
[1238] Fix | Delete
* have sites which the connection decision was not yet taken, set this plugin
[1239] Fix | Delete
* into network activation mode so the super-admin can choose what to do with
[1240] Fix | Delete
* the rest of the sites.
[1241] Fix | Delete
*/
[1242] Fix | Delete
self::set_network_upgrade_mode( $storage );
[1243] Fix | Delete
}
[1244] Fix | Delete
}
[1245] Fix | Delete
}
[1246] Fix | Delete
}
[1247] Fix | Delete
[1248] Fix | Delete
/**
[1249] Fix | Delete
* Set a module into network upgrade mode.
[1250] Fix | Delete
*
[1251] Fix | Delete
* @author Vova Feldman (@svovaf)
[1252] Fix | Delete
* @since 2.0.0
[1253] Fix | Delete
*
[1254] Fix | Delete
* @param \FS_Storage $storage
[1255] Fix | Delete
*
[1256] Fix | Delete
* @return bool
[1257] Fix | Delete
*/
[1258] Fix | Delete
private static function set_network_upgrade_mode( FS_Storage $storage ) {
[1259] Fix | Delete
return $storage->is_network_activation = true;
[1260] Fix | Delete
}
[1261] Fix | Delete
[1262] Fix | Delete
/**
[1263] Fix | Delete
* Will return true after upgrading to the SDK with the network level integration,
[1264] Fix | Delete
* when the super-admin involvement is required regarding the rest of the sites.
[1265] Fix | Delete
*
[1266] Fix | Delete
* @author Vova Feldman (@svovaf)
[1267] Fix | Delete
* @since 2.0.0
[1268] Fix | Delete
*
[1269] Fix | Delete
* @return bool
[1270] Fix | Delete
*/
[1271] Fix | Delete
function is_network_upgrade_mode() {
[1272] Fix | Delete
return $this->_storage->get( 'is_network_activation' );
[1273] Fix | Delete
}
[1274] Fix | Delete
[1275] Fix | Delete
/**
[1276] Fix | Delete
* Clear flag after the upgrade mode completion.
[1277] Fix | Delete
*
[1278] Fix | Delete
* @author Vova Feldman (@svovaf)
[1279] Fix | Delete
* @since 2.0.0
[1280] Fix | Delete
*
[1281] Fix | Delete
* @return bool True if network activation was on and now completed.
[1282] Fix | Delete
*/
[1283] Fix | Delete
private function network_upgrade_mode_completed() {
[1284] Fix | Delete
if ( fs_is_network_admin() && $this->is_network_upgrade_mode() ) {
[1285] Fix | Delete
$this->_storage->remove( 'is_network_activation' );
[1286] Fix | Delete
[1287] Fix | Delete
return true;
[1288] Fix | Delete
}
[1289] Fix | Delete
[1290] Fix | Delete
return false;
[1291] Fix | Delete
}
[1292] Fix | Delete
[1293] Fix | Delete
#endregion
[1294] Fix | Delete
[1295] Fix | Delete
/**
[1296] Fix | Delete
* This action is connected to the 'plugins_loaded' hook and helps to determine
[1297] Fix | Delete
* if this is a new plugin installation or a plugin update.
[1298] Fix | Delete
*
[1299] Fix | Delete
* There are 3 different use-cases:
[1300] Fix | Delete
* 1) New plugin installation right with Freemius:
[1301] Fix | Delete
* 1.1 _activate_plugin_event_hook() will be executed first
[1302] Fix | Delete
* 1.2 Since $this->_storage->is_plugin_new_install is not set,
[1303] Fix | Delete
* and $this->_storage->plugin_last_version is not set,
[1304] Fix | Delete
* $this->_storage->is_plugin_new_install will be set to TRUE.
[1305] Fix | Delete
* 1.3 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
[1306] Fix | Delete
* be already set to TRUE.
[1307] Fix | Delete
*
[1308] Fix | Delete
* 2) Plugin update, didn't have Freemius before, and now have the SDK:
[1309] Fix | Delete
* 2.1 _activate_plugin_event_hook() will not be executed, because
[1310] Fix | Delete
* the activation hook do NOT fires on updates since WP 3.1.
[1311] Fix | Delete
* 2.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
[1312] Fix | Delete
* be empty, therefore, it will be set to FALSE.
[1313] Fix | Delete
*
[1314] Fix | Delete
* 3) Plugin update, had Freemius in prev version as well:
[1315] Fix | Delete
* 3.1 _version_updates_handler() will be executed 1st, since FS was installed
[1316] Fix | Delete
* before, $this->_storage->plugin_last_version will NOT be empty,
[1317] Fix | Delete
* therefore, $this->_storage->is_plugin_new_install will be set to FALSE.
[1318] Fix | Delete
* 3.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install is
[1319] Fix | Delete
* already set, therefore, it will not be modified.
[1320] Fix | Delete
*
[1321] Fix | Delete
* Use-case #3 is backward compatible, #3.1 will be executed since 1.0.9.
[1322] Fix | Delete
*
[1323] Fix | Delete
* NOTE:
[1324] Fix | Delete
* The only fallback of this mechanism is if an admin updates a plugin based on use-case #2,
[1325] Fix | Delete
* and then, the next immediate PageView is the plugin's main settings page, it will not
[1326] Fix | Delete
* show the opt-in right away. The reason it will happen is because Freemius execution
[1327] Fix | Delete
* will be turned off till the plugin is fully loaded at least once
[1328] Fix | Delete
* (till $this->_storage->was_plugin_loaded is TRUE).
[1329] Fix | Delete
*
[1330] Fix | Delete
* @author Vova Feldman (@svovaf)
[1331] Fix | Delete
* @since 1.1.9
[1332] Fix | Delete
*
[1333] Fix | Delete
*/
[1334] Fix | Delete
function _plugins_loaded() {
[1335] Fix | Delete
// Update flag that plugin was loaded with Freemius at least once.
[1336] Fix | Delete
$this->_storage->was_plugin_loaded = true;
[1337] Fix | Delete
[1338] Fix | Delete
/**
[1339] Fix | Delete
* Bug fix - only set to false when it's a plugin, due to the
[1340] Fix | Delete
* execution sequence of the theme hooks and our methods, if
[1341] Fix | Delete
* this will be set for themes, Freemius will always assume
[1342] Fix | Delete
* it's a theme update.
[1343] Fix | Delete
*
[1344] Fix | Delete
* @author Vova Feldman (@svovaf)
[1345] Fix | Delete
* @since 1.2.2.2
[1346] Fix | Delete
*/
[1347] Fix | Delete
if ( $this->is_plugin() &&
[1348] Fix | Delete
! isset( $this->_storage->is_plugin_new_install )
[1349] Fix | Delete
) {
[1350] Fix | Delete
$this->_storage->is_plugin_new_install = (
[1351] Fix | Delete
! is_plugin_active( $this->_plugin_basename ) &&
[1352] Fix | Delete
empty( $this->_storage->plugin_last_version )
[1353] Fix | Delete
);
[1354] Fix | Delete
}
[1355] Fix | Delete
}
[1356] Fix | Delete
[1357] Fix | Delete
function _run_garbage_collector() {
[1358] Fix | Delete
if ( true !== fs_get_optional_constant( 'WP_FS__ENABLE_GARBAGE_COLLECTOR', true ) ) {
[1359] Fix | Delete
return;
[1360] Fix | Delete
}
[1361] Fix | Delete
[1362] Fix | Delete
if ( ! $this->is_user_in_admin() ) {
[1363] Fix | Delete
return;
[1364] Fix | Delete
}
[1365] Fix | Delete
[1366] Fix | Delete
require_once WP_FS__DIR_INCLUDES . '/class-fs-lock.php';
[1367] Fix | Delete
[1368] Fix | Delete
$lock = new FS_Lock( 'garbage_collection' );
[1369] Fix | Delete
[1370] Fix | Delete
if ( $lock->is_locked() ) {
[1371] Fix | Delete
return;
[1372] Fix | Delete
}
[1373] Fix | Delete
[1374] Fix | Delete
// Create a 1-day lock.
[1375] Fix | Delete
$lock->lock( WP_FS__TIME_24_HOURS_IN_SEC );
[1376] Fix | Delete
[1377] Fix | Delete
FS_Garbage_Collector::instance()->clean();
[1378] Fix | Delete
}
[1379] Fix | Delete
[1380] Fix | Delete
/**
[1381] Fix | Delete
* Opens the support forum subemenu item in a new browser page.
[1382] Fix | Delete
*
[1383] Fix | Delete
* @author Vova Feldman (@svovaf)
[1384] Fix | Delete
* @since 2.1.4
[1385] Fix | Delete
*/
[1386] Fix | Delete
static function _open_support_forum_in_new_page() {
[1387] Fix | Delete
?>
[1388] Fix | Delete
<script type="text/javascript">
[1389] Fix | Delete
(function ($) {
[1390] Fix | Delete
$('.fs-submenu-item.wp-support-forum').parent().attr( { target: '_blank', rel: 'noopener noreferrer' } );
[1391] Fix | Delete
})(jQuery);
[1392] Fix | Delete
</script>
[1393] Fix | Delete
<?php
[1394] Fix | Delete
}
[1395] Fix | Delete
[1396] Fix | Delete
/**
[1397] Fix | Delete
* @author Vova Feldman (@svovaf)
[1398] Fix | Delete
* @since 1.0.9
[1399] Fix | Delete
*/
[1400] Fix | Delete
private function register_constructor_hooks() {
[1401] Fix | Delete
$this->_logger->entrance();
[1402] Fix | Delete
[1403] Fix | Delete
if ( is_admin() ) {
[1404] Fix | Delete
add_action( 'admin_init', array( &$this, '_hook_action_links_and_register_account_hooks' ) );
[1405] Fix | Delete
[1406] Fix | Delete
if ( $this->is_plugin() ) {
[1407] Fix | Delete
if ( self::is_plugin_install_page() && true !== fs_request_get_bool( 'fs_allow_updater_and_dialog' ) ) {
[1408] Fix | Delete
/**
[1409] Fix | Delete
* Unless the `fs_allow_updater_and_dialog` URL param exists and its value is `true`, make
[1410] Fix | Delete
* Freemius-related updates unavailable on the "Add Plugins" admin page (/plugin-install.php)
[1411] Fix | Delete
* so that they won't interfere with the .org plugins' functionalities on that page (e.g.
[1412] Fix | Delete
* updating of a .org plugin).
[1413] Fix | Delete
*/
[1414] Fix | Delete
add_filter( 'site_transient_update_plugins', array( 'Freemius', '_remove_fs_updates_from_plugin_install_page' ), 10, 2 );
[1415] Fix | Delete
} else if ( self::is_plugins_page() || self::is_updates_page() ) {
[1416] Fix | Delete
/**
[1417] Fix | Delete
* On the "Plugins" and "Updates" admin pages, if there are premium or non–org-compliant plugins, modify their details dialog URLs (add a Freemius-specific param) so that the SDK can determine if the plugin information dialog should show information from Freemius.
[1418] Fix | Delete
*
[1419] Fix | Delete
* @author Leo Fajardo (@leorw)
[1420] Fix | Delete
* @since 2.2.3
[1421] Fix | Delete
*/
[1422] Fix | Delete
add_action( 'admin_footer', array( 'Freemius', '_prepend_fs_allow_updater_and_dialog_flag_url_param' ) );
[1423] Fix | Delete
}
[1424] Fix | Delete
[1425] Fix | Delete
$plugin_dir = dirname( $this->_plugin_dir_path ) . '/';
[1426] Fix | Delete
[1427] Fix | Delete
/**
[1428] Fix | Delete
* @since 1.2.2
[1429] Fix | Delete
*
[1430] Fix | Delete
* Hook to both free and premium version activations to support
[1431] Fix | Delete
* auto deactivation on the other version activation.
[1432] Fix | Delete
*/
[1433] Fix | Delete
register_activation_hook(
[1434] Fix | Delete
$plugin_dir . $this->_free_plugin_basename,
[1435] Fix | Delete
array( &$this, '_activate_plugin_event_hook' )
[1436] Fix | Delete
);
[1437] Fix | Delete
[1438] Fix | Delete
register_activation_hook(
[1439] Fix | Delete
$plugin_dir . $this->premium_plugin_basename(),
[1440] Fix | Delete
array( &$this, '_activate_plugin_event_hook' )
[1441] Fix | Delete
);
[1442] Fix | Delete
} else {
[1443] Fix | Delete
add_action( 'after_switch_theme', array( &$this, '_activate_theme_event_hook' ), 10, 2 );
[1444] Fix | Delete
[1445] Fix | Delete
add_action( 'admin_footer', array( &$this, '_style_premium_theme' ) );
[1446] Fix | Delete
}
[1447] Fix | Delete
[1448] Fix | Delete
/**
[1449] Fix | Delete
* Part of the mechanism to identify new plugin install vs. plugin update.
[1450] Fix | Delete
*
[1451] Fix | Delete
* @author Vova Feldman (@svovaf)
[1452] Fix | Delete
* @since 1.1.9
[1453] Fix | Delete
*/
[1454] Fix | Delete
if ( empty( $this->_storage->was_plugin_loaded ) ) {
[1455] Fix | Delete
/**
[1456] Fix | Delete
* During the plugin activation (not theme), 'plugins_loaded' will be already executed
[1457] Fix | Delete
* when the logic gets here since the activation logic first add the activate plugins,
[1458] Fix | Delete
* then triggers 'plugins_loaded', and only then include the code of the plugin that
[1459] Fix | Delete
* is activated. Which means that _plugins_loaded() will NOT be executed during the
[1460] Fix | Delete
* plugin activation, and that IS intentional.
[1461] Fix | Delete
*
[1462] Fix | Delete
* @author Vova Feldman (@svovaf)
[1463] Fix | Delete
*/
[1464] Fix | Delete
if ( $this->is_plugin() &&
[1465] Fix | Delete
$this->is_activation_mode( false ) &&
[1466] Fix | Delete
0 == did_action( 'plugins_loaded' )
[1467] Fix | Delete
) {
[1468] Fix | Delete
add_action( 'plugins_loaded', array( &$this, '_plugins_loaded' ) );
[1469] Fix | Delete
} else {
[1470] Fix | Delete
// If was activated before, then it was already loaded before.
[1471] Fix | Delete
$this->_plugins_loaded();
[1472] Fix | Delete
}
[1473] Fix | Delete
}
[1474] Fix | Delete
[1475] Fix | Delete
add_action( 'plugins_loaded', array( &$this, '_run_garbage_collector' ) );
[1476] Fix | Delete
[1477] Fix | Delete
if ( ! self::is_ajax() ) {
[1478] Fix | Delete
if ( ! $this->is_addon() ) {
[1479] Fix | Delete
add_action( 'init', array( &$this, '_add_default_submenu_items' ), WP_FS__LOWEST_PRIORITY );
[1480] Fix | Delete
}
[1481] Fix | Delete
}
[1482] Fix | Delete
[1483] Fix | Delete
if ( $this->_storage->handle_gdpr_admin_notice ) {
[1484] Fix | Delete
add_action( 'init', array( &$this, '_maybe_show_gdpr_admin_notice' ) );
[1485] Fix | Delete
}
[1486] Fix | Delete
[1487] Fix | Delete
add_action( 'init', array( &$this, '_maybe_add_gdpr_optin_ajax_handler') );
[1488] Fix | Delete
add_action( 'init', array( &$this, '_maybe_add_pricing_ajax_handler' ) );
[1489] Fix | Delete
}
[1490] Fix | Delete
[1491] Fix | Delete
if ( $this->is_plugin() ) {
[1492] Fix | Delete
if ( version_compare( $GLOBALS['wp_version'], '5.1', '<' ) ) {
[1493] Fix | Delete
add_action( 'wpmu_new_blog', array( $this, '_after_new_blog_callback' ), 10, 6 );
[1494] Fix | Delete
} else {
[1495] Fix | Delete
add_action( 'wp_initialize_site', array( $this, '_after_wp_initialize_site_callback' ), 11, 2 );
[1496] Fix | Delete
}
[1497] Fix | Delete
[1498] Fix | Delete
register_deactivation_hook( $this->_plugin_main_file_path, array( &$this, '_deactivate_plugin_hook' ) );
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function