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
[20500] Fix | Delete
return $this->is_api_result_entity( $result ) ?
[20501] Fix | Delete
new FS_Plugin_Plan( $result ) :
[20502] Fix | Delete
$result;
[20503] Fix | Delete
}
[20504] Fix | Delete
[20505] Fix | Delete
/**
[20506] Fix | Delete
* @author Vova Feldman (@svovaf)
[20507] Fix | Delete
* @since 1.0.5
[20508] Fix | Delete
* @uses FS_Api
[20509] Fix | Delete
*
[20510] Fix | Delete
* @param number|bool $plugin_id
[20511] Fix | Delete
* @param number|bool $site_license_id
[20512] Fix | Delete
* @param array $foreign_licenses @since 2.0.0. This is used by network-activated plugins.
[20513] Fix | Delete
* @param number|null $blog_id
[20514] Fix | Delete
*
[20515] Fix | Delete
* @return FS_Plugin_License[]|object
[20516] Fix | Delete
*/
[20517] Fix | Delete
private function _fetch_licenses(
[20518] Fix | Delete
$plugin_id = false,
[20519] Fix | Delete
$site_license_id = false,
[20520] Fix | Delete
$foreign_licenses = array(),
[20521] Fix | Delete
$blog_id = null
[20522] Fix | Delete
) {
[20523] Fix | Delete
$this->_logger->entrance();
[20524] Fix | Delete
[20525] Fix | Delete
$api = $this->get_api_user_scope();
[20526] Fix | Delete
[20527] Fix | Delete
if ( ! is_numeric( $plugin_id ) ) {
[20528] Fix | Delete
$plugin_id = $this->_plugin->id;
[20529] Fix | Delete
}
[20530] Fix | Delete
[20531] Fix | Delete
$user_licenses_endpoint = "/plugins/{$plugin_id}/licenses.json?is_enriched=true";
[20532] Fix | Delete
if ( ! empty ( $foreign_licenses ) ) {
[20533] Fix | Delete
$foreign_licenses = array(
[20534] Fix | Delete
// Prefix with `+` to tell the server to include foreign licenses in the licenses collection.
[20535] Fix | Delete
'ids' => ( urlencode( '+' ) . implode( ',', $foreign_licenses['ids'] ) ),
[20536] Fix | Delete
'license_keys' => implode( ',', array_map( 'urlencode', $foreign_licenses['license_keys'] ) )
[20537] Fix | Delete
);
[20538] Fix | Delete
[20539] Fix | Delete
$user_licenses_endpoint = add_query_arg( $foreign_licenses, $user_licenses_endpoint );
[20540] Fix | Delete
}
[20541] Fix | Delete
[20542] Fix | Delete
$result = $api->get( $user_licenses_endpoint, true );
[20543] Fix | Delete
[20544] Fix | Delete
$is_site_license_synced = false;
[20545] Fix | Delete
[20546] Fix | Delete
$api_errors = array();
[20547] Fix | Delete
[20548] Fix | Delete
if ( $this->is_api_result_object( $result, 'licenses' ) &&
[20549] Fix | Delete
is_array( $result->licenses )
[20550] Fix | Delete
) {
[20551] Fix | Delete
for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
[20552] Fix | Delete
$result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
[20553] Fix | Delete
[20554] Fix | Delete
if ( ( ! $is_site_license_synced ) && is_numeric( $site_license_id ) ) {
[20555] Fix | Delete
$is_site_license_synced = ( $site_license_id == $result->licenses[ $i ]->id );
[20556] Fix | Delete
}
[20557] Fix | Delete
}
[20558] Fix | Delete
[20559] Fix | Delete
$result = $result->licenses;
[20560] Fix | Delete
} else {
[20561] Fix | Delete
$api_errors[] = $result;
[20562] Fix | Delete
$result = array();
[20563] Fix | Delete
}
[20564] Fix | Delete
[20565] Fix | Delete
if ( ! $is_site_license_synced ) {
[20566] Fix | Delete
if ( ! is_null( $blog_id ) ) {
[20567] Fix | Delete
/**
[20568] Fix | Delete
* If blog ID is not null, the request is for syncing of the license of a single site via the
[20569] Fix | Delete
* network-level "Account" page.
[20570] Fix | Delete
*
[20571] Fix | Delete
* @author Leo Fajardo (@leorw)
[20572] Fix | Delete
*/
[20573] Fix | Delete
$this->switch_to_blog( $blog_id );
[20574] Fix | Delete
}
[20575] Fix | Delete
[20576] Fix | Delete
$api = $this->get_api_site_scope();
[20577] Fix | Delete
[20578] Fix | Delete
if ( is_numeric( $site_license_id ) ) {
[20579] Fix | Delete
// Try to retrieve a foreign license that is linked to the install.
[20580] Fix | Delete
$api_result = $api->call( '/licenses.json?is_enriched=true' );
[20581] Fix | Delete
[20582] Fix | Delete
if ( $this->is_api_result_object( $api_result, 'licenses' ) &&
[20583] Fix | Delete
is_array( $api_result->licenses )
[20584] Fix | Delete
) {
[20585] Fix | Delete
$licenses = $api_result->licenses;
[20586] Fix | Delete
[20587] Fix | Delete
if ( ! empty( $licenses ) ) {
[20588] Fix | Delete
$result[] = new FS_Plugin_License( $licenses[0] );
[20589] Fix | Delete
}
[20590] Fix | Delete
} else {
[20591] Fix | Delete
$api_errors[] = $api_result;
[20592] Fix | Delete
}
[20593] Fix | Delete
} else if (
[20594] Fix | Delete
is_object( $this->_license ) &&
[20595] Fix | Delete
/**
[20596] Fix | Delete
* Sync only if the license belongs to the context plugin. `$plugin_id` can be an add-on ID while
[20597] Fix | Delete
* the FS instance that does the syncing is the parent FS instance.
[20598] Fix | Delete
*
[20599] Fix | Delete
* @author Leo Fajardo (@leorw)
[20600] Fix | Delete
* @since 2.3.0
[20601] Fix | Delete
*/
[20602] Fix | Delete
$this->_license->plugin_id == $plugin_id
[20603] Fix | Delete
) {
[20604] Fix | Delete
$is_license_in_result = false;
[20605] Fix | Delete
if ( ! empty( $result ) ) {
[20606] Fix | Delete
foreach ( $result as $license ) {
[20607] Fix | Delete
if ( $license->id == $this->_license->id ) {
[20608] Fix | Delete
$is_license_in_result = true;
[20609] Fix | Delete
break;
[20610] Fix | Delete
}
[20611] Fix | Delete
}
[20612] Fix | Delete
}
[20613] Fix | Delete
[20614] Fix | Delete
if ( ! $is_license_in_result ) {
[20615] Fix | Delete
// Fetch foreign license by ID and license key.
[20616] Fix | Delete
$license = $api->get( "/licenses/{$this->_license->id}.json?license_key=" .
[20617] Fix | Delete
urlencode( $this->_license->secret_key ) . '&is_enriched=true' );
[20618] Fix | Delete
[20619] Fix | Delete
if ( $this->is_api_result_entity( $license ) ) {
[20620] Fix | Delete
$result[] = new FS_Plugin_License( $license );
[20621] Fix | Delete
} else {
[20622] Fix | Delete
$api_errors[] = $license;
[20623] Fix | Delete
}
[20624] Fix | Delete
}
[20625] Fix | Delete
}
[20626] Fix | Delete
[20627] Fix | Delete
if ( ! is_null( $blog_id ) ) {
[20628] Fix | Delete
$this->switch_to_blog( $this->_storage->network_install_blog_id );
[20629] Fix | Delete
}
[20630] Fix | Delete
}
[20631] Fix | Delete
[20632] Fix | Delete
if ( is_array( $result ) && 0 < count( $result ) ) {
[20633] Fix | Delete
// If found at least one license, return license collection even if there are errors.
[20634] Fix | Delete
return $result;
[20635] Fix | Delete
}
[20636] Fix | Delete
[20637] Fix | Delete
if ( ! empty( $api_errors ) ) {
[20638] Fix | Delete
// If found any errors and no licenses, return first error.
[20639] Fix | Delete
return $api_errors[0];
[20640] Fix | Delete
}
[20641] Fix | Delete
[20642] Fix | Delete
// Fallback to empty licenses list.
[20643] Fix | Delete
return $result;
[20644] Fix | Delete
}
[20645] Fix | Delete
[20646] Fix | Delete
/**
[20647] Fix | Delete
* @author Vova Feldman (@svovaf)
[20648] Fix | Delete
* @since 2.0.0
[20649] Fix | Delete
*
[20650] Fix | Delete
* @param number $license_id
[20651] Fix | Delete
* @param string $license_key
[20652] Fix | Delete
*
[20653] Fix | Delete
* @return \FS_Plugin_License|object
[20654] Fix | Delete
*/
[20655] Fix | Delete
private function fetch_license_by_key( $license_id, $license_key ) {
[20656] Fix | Delete
$this->_logger->entrance();
[20657] Fix | Delete
[20658] Fix | Delete
$api = $this->get_current_or_network_user_api_scope();
[20659] Fix | Delete
[20660] Fix | Delete
$result = $api->get( "/licenses/{$license_id}.json?license_key=" . urlencode( $license_key ) );
[20661] Fix | Delete
[20662] Fix | Delete
return $this->is_api_result_entity( $result ) ?
[20663] Fix | Delete
new FS_Plugin_License( $result ) :
[20664] Fix | Delete
$result;
[20665] Fix | Delete
}
[20666] Fix | Delete
[20667] Fix | Delete
/**
[20668] Fix | Delete
* @author Vova Feldman (@svovaf)
[20669] Fix | Delete
* @since 1.2.0
[20670] Fix | Delete
* @uses FS_Api
[20671] Fix | Delete
*
[20672] Fix | Delete
* @param number|bool $plugin_id
[20673] Fix | Delete
* @param bool $flush
[20674] Fix | Delete
*
[20675] Fix | Delete
* @return FS_Payment[]|object
[20676] Fix | Delete
*/
[20677] Fix | Delete
function _fetch_payments( $plugin_id = false, $flush = false ) {
[20678] Fix | Delete
$this->_logger->entrance();
[20679] Fix | Delete
[20680] Fix | Delete
$api = $this->get_api_user_scope();
[20681] Fix | Delete
[20682] Fix | Delete
if ( ! is_numeric( $plugin_id ) ) {
[20683] Fix | Delete
$plugin_id = $this->_plugin->id;
[20684] Fix | Delete
}
[20685] Fix | Delete
[20686] Fix | Delete
$include_bundles = (
[20687] Fix | Delete
is_object( $this->_plugin ) &&
[20688] Fix | Delete
FS_Plugin::is_valid_id( $this->_plugin->bundle_id )
[20689] Fix | Delete
);
[20690] Fix | Delete
[20691] Fix | Delete
$result = $api->get(
[20692] Fix | Delete
"/plugins/{$plugin_id}/payments.json?include_addons=true" . ($include_bundles ? '&include_bundles=true' : ''),
[20693] Fix | Delete
$flush
[20694] Fix | Delete
);
[20695] Fix | Delete
[20696] Fix | Delete
if ( ! isset( $result->error ) ) {
[20697] Fix | Delete
for ( $i = 0, $len = count( $result->payments ); $i < $len; $i ++ ) {
[20698] Fix | Delete
$result->payments[ $i ] = new FS_Payment( $result->payments[ $i ] );
[20699] Fix | Delete
}
[20700] Fix | Delete
$result = $result->payments;
[20701] Fix | Delete
}
[20702] Fix | Delete
[20703] Fix | Delete
return $result;
[20704] Fix | Delete
}
[20705] Fix | Delete
[20706] Fix | Delete
/**
[20707] Fix | Delete
* @author Vova Feldman (@svovaf)
[20708] Fix | Delete
* @since 1.2.1.5
[20709] Fix | Delete
* @uses FS_Api
[20710] Fix | Delete
*
[20711] Fix | Delete
* @param bool $flush
[20712] Fix | Delete
*
[20713] Fix | Delete
* @return \FS_Billing|mixed
[20714] Fix | Delete
*/
[20715] Fix | Delete
function _fetch_billing( $flush = false ) {
[20716] Fix | Delete
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-billing.php';
[20717] Fix | Delete
[20718] Fix | Delete
$billing = $this->get_api_user_scope()->get( 'billing.json', $flush );
[20719] Fix | Delete
[20720] Fix | Delete
if ( $this->is_api_result_entity( $billing ) ) {
[20721] Fix | Delete
$billing = new FS_Billing( $billing );
[20722] Fix | Delete
}
[20723] Fix | Delete
[20724] Fix | Delete
return $billing;
[20725] Fix | Delete
}
[20726] Fix | Delete
[20727] Fix | Delete
/**
[20728] Fix | Delete
* @author Vova Feldman (@svovaf)
[20729] Fix | Delete
* @since 1.0.5
[20730] Fix | Delete
*
[20731] Fix | Delete
* @param FS_Plugin_License[] $licenses
[20732] Fix | Delete
* @param number $module_id
[20733] Fix | Delete
*/
[20734] Fix | Delete
private function _update_licenses( $licenses, $module_id ) {
[20735] Fix | Delete
$this->_logger->entrance();
[20736] Fix | Delete
[20737] Fix | Delete
if ( is_array( $licenses ) ) {
[20738] Fix | Delete
for ( $i = 0, $len = count( $licenses ); $i < $len; $i ++ ) {
[20739] Fix | Delete
$licenses[ $i ]->updated = time();
[20740] Fix | Delete
}
[20741] Fix | Delete
}
[20742] Fix | Delete
[20743] Fix | Delete
$this->_store_licenses( true, $module_id, $licenses );
[20744] Fix | Delete
}
[20745] Fix | Delete
[20746] Fix | Delete
/**
[20747] Fix | Delete
* @author Vova Feldman (@svovaf)
[20748] Fix | Delete
* @since 1.0.4
[20749] Fix | Delete
*
[20750] Fix | Delete
* @param bool|number $plugin_id
[20751] Fix | Delete
* @param bool $flush Since 1.1.7.3
[20752] Fix | Delete
* @param int $expiration Since 1.2.2.7
[20753] Fix | Delete
* @param bool|string $newer_than Since 2.2.1
[20754] Fix | Delete
*
[20755] Fix | Delete
* @return object|false New plugin tag info if exist.
[20756] Fix | Delete
*/
[20757] Fix | Delete
private function _fetch_newer_version( $plugin_id = false, $flush = true, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $newer_than = false ) {
[20758] Fix | Delete
$latest_tag = $this->_fetch_latest_version( $plugin_id, $flush, $expiration, $newer_than );
[20759] Fix | Delete
[20760] Fix | Delete
if ( ! is_object( $latest_tag ) ) {
[20761] Fix | Delete
return false;
[20762] Fix | Delete
}
[20763] Fix | Delete
[20764] Fix | Delete
$plugin_version = $this->get_plugin_version();
[20765] Fix | Delete
[20766] Fix | Delete
// Check if version is actually newer.
[20767] Fix | Delete
$has_new_version =
[20768] Fix | Delete
// If it's an non-installed add-on then always return latest.
[20769] Fix | Delete
( $this->_is_addon_id( $plugin_id ) && ! $this->is_addon_activated( $plugin_id ) ) ||
[20770] Fix | Delete
// Compare versions.
[20771] Fix | Delete
version_compare( $plugin_version, $latest_tag->version, '<' );
[20772] Fix | Delete
[20773] Fix | Delete
$this->_logger->departure( $has_new_version ? 'Found newer plugin version ' . $latest_tag->version : 'No new version' );
[20774] Fix | Delete
[20775] Fix | Delete
$is_latest_version_beta = ( 'beta' === $latest_tag->release_mode );
[20776] Fix | Delete
[20777] Fix | Delete
$this->_storage->beta_data = array(
[20778] Fix | Delete
'is_beta' => $is_latest_version_beta,
[20779] Fix | Delete
'version' => $latest_tag->version
[20780] Fix | Delete
);
[20781] Fix | Delete
[20782] Fix | Delete
return $has_new_version ? $latest_tag : false;
[20783] Fix | Delete
}
[20784] Fix | Delete
[20785] Fix | Delete
/**
[20786] Fix | Delete
* @author Vova Feldman (@svovaf)
[20787] Fix | Delete
* @since 1.0.5
[20788] Fix | Delete
*
[20789] Fix | Delete
* @param bool|number $plugin_id
[20790] Fix | Delete
* @param bool $flush Since 1.1.7.3
[20791] Fix | Delete
* @param int $expiration Since 1.2.2.7
[20792] Fix | Delete
* @param bool|string $newer_than Since 2.2.1
[20793] Fix | Delete
*
[20794] Fix | Delete
* @return bool|FS_Plugin_Tag
[20795] Fix | Delete
*/
[20796] Fix | Delete
function get_update( $plugin_id = false, $flush = true, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $newer_than = false ) {
[20797] Fix | Delete
$this->_logger->entrance();
[20798] Fix | Delete
[20799] Fix | Delete
if ( ! is_numeric( $plugin_id ) ) {
[20800] Fix | Delete
$plugin_id = $this->_plugin->id;
[20801] Fix | Delete
}
[20802] Fix | Delete
[20803] Fix | Delete
$this->check_updates( true, $plugin_id, $flush, $expiration, $newer_than );
[20804] Fix | Delete
$updates = $this->get_all_updates();
[20805] Fix | Delete
[20806] Fix | Delete
return isset( $updates[ $plugin_id ] ) && is_object( $updates[ $plugin_id ] ) ? $updates[ $plugin_id ] : false;
[20807] Fix | Delete
}
[20808] Fix | Delete
[20809] Fix | Delete
/**
[20810] Fix | Delete
* Check if site assigned with active license.
[20811] Fix | Delete
*
[20812] Fix | Delete
* @author Vova Feldman (@svovaf)
[20813] Fix | Delete
* @since 1.0.6
[20814] Fix | Delete
*
[20815] Fix | Delete
* @deprecated Please use has_active_valid_license() instead because license can be cancelled.
[20816] Fix | Delete
*/
[20817] Fix | Delete
function has_active_license() {
[20818] Fix | Delete
return (
[20819] Fix | Delete
is_object( $this->_license ) &&
[20820] Fix | Delete
is_numeric( $this->_license->id ) &&
[20821] Fix | Delete
! $this->_license->is_expired()
[20822] Fix | Delete
);
[20823] Fix | Delete
}
[20824] Fix | Delete
[20825] Fix | Delete
/**
[20826] Fix | Delete
* Check if site assigned with active & valid (not expired) license.
[20827] Fix | Delete
*
[20828] Fix | Delete
* @author Vova Feldman (@svovaf)
[20829] Fix | Delete
* @since 1.2.1
[20830] Fix | Delete
*
[20831] Fix | Delete
* @param bool $check_expiration
[20832] Fix | Delete
*/
[20833] Fix | Delete
function has_active_valid_license( $check_expiration = true ) {
[20834] Fix | Delete
return self::is_active_valid_license( $this->_license, $check_expiration );
[20835] Fix | Delete
}
[20836] Fix | Delete
[20837] Fix | Delete
/**
[20838] Fix | Delete
* @author Leo Fajardo (@leorw)
[20839] Fix | Delete
* @since 2.3.1
[20840] Fix | Delete
*/
[20841] Fix | Delete
function is_data_debug_mode() {
[20842] Fix | Delete
if ( is_null( $this->is_whitelabeled ) || ! $this->is_whitelabeled ) {
[20843] Fix | Delete
return false;
[20844] Fix | Delete
}
[20845] Fix | Delete
[20846] Fix | Delete
$fs = $this->is_addon() ?
[20847] Fix | Delete
$this->get_parent_instance() :
[20848] Fix | Delete
$this;
[20849] Fix | Delete
[20850] Fix | Delete
if ( $fs->is_network_active() && fs_is_network_admin() ) {
[20851] Fix | Delete
$is_developer_license_debug_mode = get_site_transient( "fs_{$this->get_id()}_data_debug_mode" );
[20852] Fix | Delete
} else {
[20853] Fix | Delete
$is_developer_license_debug_mode = get_transient( "fs_{$this->get_id()}_data_debug_mode" );
[20854] Fix | Delete
}
[20855] Fix | Delete
[20856] Fix | Delete
return ( 'true' === $is_developer_license_debug_mode );
[20857] Fix | Delete
}
[20858] Fix | Delete
[20859] Fix | Delete
/**
[20860] Fix | Delete
* @author Leo Fajardo (@leorw)
[20861] Fix | Delete
* @since 2.3.1
[20862] Fix | Delete
*/
[20863] Fix | Delete
function _set_data_debug_mode() {
[20864] Fix | Delete
if ( ! $this->is_whitelabeled( true ) ) {
[20865] Fix | Delete
return;
[20866] Fix | Delete
}
[20867] Fix | Delete
[20868] Fix | Delete
$license_or_user_key = fs_request_get_raw( 'license_or_user_key' );
[20869] Fix | Delete
[20870] Fix | Delete
$transient_value = ( ! empty( $license_or_user_key ) ) ?
[20871] Fix | Delete
'true' :
[20872] Fix | Delete
'false';
[20873] Fix | Delete
[20874] Fix | Delete
if ( 'true' === $transient_value ) {
[20875] Fix | Delete
$stored_key = $this->_storage->get( ! FS_User::is_valid_id( $this->_storage->last_license_user_id ) ?
[20876] Fix | Delete
'last_license_key' :
[20877] Fix | Delete
'last_license_user_key'
[20878] Fix | Delete
);
[20879] Fix | Delete
[20880] Fix | Delete
if ( md5( $license_or_user_key ) !== $stored_key ) {
[20881] Fix | Delete
$this->shoot_ajax_failure( sprintf(
[20882] Fix | Delete
'%s... %s',
[20883] Fix | Delete
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ),
[20884] Fix | Delete
$this->get_text_inline(
[20885] Fix | Delete
'seems like the key you entered doesn\'t match our records.',
[20886] Fix | Delete
'developer-or-license-not-found'
[20887] Fix | Delete
)
[20888] Fix | Delete
) );
[20889] Fix | Delete
}
[20890] Fix | Delete
}
[20891] Fix | Delete
[20892] Fix | Delete
if ( $this->is_network_active() && fs_is_network_admin() ) {
[20893] Fix | Delete
set_site_transient(
[20894] Fix | Delete
"fs_{$this->get_id()}_data_debug_mode",
[20895] Fix | Delete
$transient_value,
[20896] Fix | Delete
WP_FS__TIME_24_HOURS_IN_SEC / 24
[20897] Fix | Delete
);
[20898] Fix | Delete
} else {
[20899] Fix | Delete
set_transient(
[20900] Fix | Delete
"fs_{$this->get_id()}_data_debug_mode",
[20901] Fix | Delete
$transient_value,
[20902] Fix | Delete
WP_FS__TIME_24_HOURS_IN_SEC / 24
[20903] Fix | Delete
);
[20904] Fix | Delete
}
[20905] Fix | Delete
[20906] Fix | Delete
if ( 'true' === $transient_value ) {
[20907] Fix | Delete
$this->_admin_notices->add_sticky(
[20908] Fix | Delete
$this->get_text_inline(
[20909] Fix | Delete
'Debug mode was successfully enabled and will be automatically disabled in 60 min. You can also disable it earlier by clicking the "Stop Debug" link.',
[20910] Fix | Delete
'data_debug_mode_enabled'
[20911] Fix | Delete
),
[20912] Fix | Delete
'data_debug_mode_enabled'
[20913] Fix | Delete
);
[20914] Fix | Delete
}
[20915] Fix | Delete
[20916] Fix | Delete
$this->shoot_ajax_success();
[20917] Fix | Delete
}
[20918] Fix | Delete
[20919] Fix | Delete
/**
[20920] Fix | Delete
* Check if a given license is active & valid (not expired).
[20921] Fix | Delete
*
[20922] Fix | Delete
* @author Vova Feldman (@svovaf)
[20923] Fix | Delete
* @since 2.1.3
[20924] Fix | Delete
*
[20925] Fix | Delete
* @param FS_Plugin_License $license
[20926] Fix | Delete
* @param bool $check_expiration
[20927] Fix | Delete
*
[20928] Fix | Delete
* @return bool
[20929] Fix | Delete
*/
[20930] Fix | Delete
private static function is_active_valid_license( $license, $check_expiration = true ) {
[20931] Fix | Delete
return (
[20932] Fix | Delete
is_object( $license ) &&
[20933] Fix | Delete
FS_Plugin_License::is_valid_id( $license->id ) &&
[20934] Fix | Delete
$license->is_active() &&
[20935] Fix | Delete
( ! $check_expiration || $license->is_valid() )
[20936] Fix | Delete
);
[20937] Fix | Delete
}
[20938] Fix | Delete
[20939] Fix | Delete
/**
[20940] Fix | Delete
* Checks if there's any site that is associated with an active & valid license.
[20941] Fix | Delete
* This logic is used to determine if the admin can download the premium code base from a network level admin.
[20942] Fix | Delete
*
[20943] Fix | Delete
* @author Vova Feldman (@svovaf)
[20944] Fix | Delete
* @since 2.1.3
[20945] Fix | Delete
*
[20946] Fix | Delete
* @return bool
[20947] Fix | Delete
*/
[20948] Fix | Delete
function has_any_active_valid_license() {
[20949] Fix | Delete
if ( ! fs_is_network_admin() ) {
[20950] Fix | Delete
return $this->has_active_valid_license();
[20951] Fix | Delete
}
[20952] Fix | Delete
[20953] Fix | Delete
$installs = $this->get_blog_install_map();
[20954] Fix | Delete
$all_plugin_licenses = self::get_all_licenses( $this->_module_id );
[20955] Fix | Delete
[20956] Fix | Delete
foreach ( $installs as $blog_id => $install ) {
[20957] Fix | Delete
if ( ! FS_Plugin_License::is_valid_id( $install->license_id ) ) {
[20958] Fix | Delete
continue;
[20959] Fix | Delete
}
[20960] Fix | Delete
[20961] Fix | Delete
foreach ( $all_plugin_licenses as $license ) {
[20962] Fix | Delete
if ( $license->id == $install->license_id ) {
[20963] Fix | Delete
if ( self::is_active_valid_license( $license ) ) {
[20964] Fix | Delete
return true;
[20965] Fix | Delete
}
[20966] Fix | Delete
}
[20967] Fix | Delete
}
[20968] Fix | Delete
}
[20969] Fix | Delete
[20970] Fix | Delete
return false;
[20971] Fix | Delete
}
[20972] Fix | Delete
[20973] Fix | Delete
/**
[20974] Fix | Delete
* Check if site assigned with license with enabled features.
[20975] Fix | Delete
*
[20976] Fix | Delete
* @author Vova Feldman (@svovaf)
[20977] Fix | Delete
* @since 1.0.6
[20978] Fix | Delete
*
[20979] Fix | Delete
* @return bool
[20980] Fix | Delete
*/
[20981] Fix | Delete
function has_features_enabled_license() {
[20982] Fix | Delete
return (
[20983] Fix | Delete
is_object( $this->_license ) &&
[20984] Fix | Delete
is_numeric( $this->_license->id ) &&
[20985] Fix | Delete
$this->_license->is_features_enabled()
[20986] Fix | Delete
);
[20987] Fix | Delete
}
[20988] Fix | Delete
[20989] Fix | Delete
/**
[20990] Fix | Delete
* Checks if the product is activated with a bundle license.
[20991] Fix | Delete
*
[20992] Fix | Delete
* @author Leo Fajardo (@leorw)
[20993] Fix | Delete
* @since 2.4.0
[20994] Fix | Delete
*
[20995] Fix | Delete
* @return bool
[20996] Fix | Delete
*/
[20997] Fix | Delete
function is_activated_with_bundle_license() {
[20998] Fix | Delete
if ( ! $this->has_features_enabled_license() ) {
[20999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function