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
* Also handle the case when an upgrade was made using the free version.
[13500] Fix | Delete
*
[13501] Fix | Delete
* @author Leo Fajardo (@leorw)
[13502] Fix | Delete
* @since 2.3.2
[13503] Fix | Delete
*/
[13504] Fix | Delete
! is_object( $this->_get_license() )
[13505] Fix | Delete
) {
[13506] Fix | Delete
// Only add license activation logic to the premium version, or in case of a serviceware plugin, also in the free version.
[13507] Fix | Delete
return;
[13508] Fix | Delete
}
[13509] Fix | Delete
[13510] Fix | Delete
// Add license activation link and AJAX request handler.
[13511] Fix | Delete
if ( self::is_plugins_page() ) {
[13512] Fix | Delete
$is_network_admin = fs_is_network_admin();
[13513] Fix | Delete
[13514] Fix | Delete
if (
[13515] Fix | Delete
( $is_network_admin && $this->is_network_active() && ! $this->is_network_delegated_connection() ) ||
[13516] Fix | Delete
( ! $is_network_admin && ( ! $this->is_network_active() || $this->is_delegated_connection() ) )
[13517] Fix | Delete
) {
[13518] Fix | Delete
if (
[13519] Fix | Delete
$this->is_premium() ||
[13520] Fix | Delete
( $this->has_paid_plan() && ! $this->has_premium_version() )
[13521] Fix | Delete
) {
[13522] Fix | Delete
/**
[13523] Fix | Delete
* @since 1.2.0 Add license action link only on plugins page.
[13524] Fix | Delete
*/
[13525] Fix | Delete
$this->_add_license_action_link();
[13526] Fix | Delete
}
[13527] Fix | Delete
}
[13528] Fix | Delete
}
[13529] Fix | Delete
[13530] Fix | Delete
// Add license activation AJAX callback.
[13531] Fix | Delete
$this->add_ajax_action( 'activate_license', array( &$this, '_activate_license_ajax_action' ) );
[13532] Fix | Delete
[13533] Fix | Delete
// Add resend license AJAX callback.
[13534] Fix | Delete
$this->add_ajax_action( 'resend_license_key', array( &$this, '_resend_license_key_ajax_action' ) );
[13535] Fix | Delete
}
[13536] Fix | Delete
[13537] Fix | Delete
/**
[13538] Fix | Delete
* Prepares page to include all required UI and logic for the "Change User" dialog.
[13539] Fix | Delete
*
[13540] Fix | Delete
* @author Leo Fajardo (@leorw)
[13541] Fix | Delete
* @since 2.3.2
[13542] Fix | Delete
*/
[13543] Fix | Delete
function _add_user_change_option() {
[13544] Fix | Delete
if ( ! $this->should_handle_user_change() ) {
[13545] Fix | Delete
return;
[13546] Fix | Delete
}
[13547] Fix | Delete
[13548] Fix | Delete
$installs_ids_with_foreign_licenses = $this->get_installs_ids_with_foreign_licenses();
[13549] Fix | Delete
[13550] Fix | Delete
if ( empty( $installs_ids_with_foreign_licenses ) ) {
[13551] Fix | Delete
// Handle user change only when the parent product or one of its add-ons is activated with a foreign license.
[13552] Fix | Delete
return;
[13553] Fix | Delete
}
[13554] Fix | Delete
[13555] Fix | Delete
// Add user change AJAX handler.
[13556] Fix | Delete
$this->add_ajax_action( 'change_user', array( &$this, '_user_change_ajax_action' ) );
[13557] Fix | Delete
}
[13558] Fix | Delete
[13559] Fix | Delete
/**
[13560] Fix | Delete
* @author Leo Fajardo (@leorw)
[13561] Fix | Delete
* @since 2.3.2
[13562] Fix | Delete
*/
[13563] Fix | Delete
function should_handle_user_change() {
[13564] Fix | Delete
if ( ! $this->is_user_admin() ) {
[13565] Fix | Delete
// Only admins can change user.
[13566] Fix | Delete
return false;
[13567] Fix | Delete
}
[13568] Fix | Delete
[13569] Fix | Delete
if ( $this->is_addon() ) {
[13570] Fix | Delete
return false;
[13571] Fix | Delete
}
[13572] Fix | Delete
[13573] Fix | Delete
if ( ! $this->is_registered() ) {
[13574] Fix | Delete
return false;
[13575] Fix | Delete
}
[13576] Fix | Delete
[13577] Fix | Delete
if (
[13578] Fix | Delete
$this->is_network_active() &&
[13579] Fix | Delete
( fs_is_network_admin() || ! $this->is_site_delegated_connection() )
[13580] Fix | Delete
) {
[13581] Fix | Delete
// Handle only on site-level "Account" section for now.
[13582] Fix | Delete
return false;
[13583] Fix | Delete
}
[13584] Fix | Delete
[13585] Fix | Delete
return true;
[13586] Fix | Delete
}
[13587] Fix | Delete
[13588] Fix | Delete
/**
[13589] Fix | Delete
* @author Leo Fajardo (@leorw)
[13590] Fix | Delete
* @since 2.0.2
[13591] Fix | Delete
*/
[13592] Fix | Delete
function _add_premium_version_upgrade_selection() {
[13593] Fix | Delete
if ( ! $this->is_user_admin() ) {
[13594] Fix | Delete
return;
[13595] Fix | Delete
}
[13596] Fix | Delete
[13597] Fix | Delete
if ( ! $this->is_premium() || $this->has_any_active_valid_license() ) {
[13598] Fix | Delete
// This is relevant only to the free versions and premium versions without an active license.
[13599] Fix | Delete
return;
[13600] Fix | Delete
}
[13601] Fix | Delete
[13602] Fix | Delete
if ( self::is_updates_page() || ( $this->is_plugin() && self::is_plugins_page() ) ) {
[13603] Fix | Delete
$this->_add_premium_version_upgrade_selection_action();
[13604] Fix | Delete
}
[13605] Fix | Delete
}
[13606] Fix | Delete
[13607] Fix | Delete
/**
[13608] Fix | Delete
* @author Edgar Melkonyan
[13609] Fix | Delete
* @since 2.4.1
[13610] Fix | Delete
*
[13611] Fix | Delete
* @throws Freemius_Exception
[13612] Fix | Delete
*/
[13613] Fix | Delete
function _toggle_whitelabel_mode_ajax_handler() {
[13614] Fix | Delete
$this->_logger->entrance();
[13615] Fix | Delete
[13616] Fix | Delete
$this->check_ajax_referer( 'toggle_whitelabel_mode' );
[13617] Fix | Delete
[13618] Fix | Delete
if ( ! $this->is_user_admin() ) {
[13619] Fix | Delete
// Only for admins.
[13620] Fix | Delete
self::shoot_ajax_failure();
[13621] Fix | Delete
}
[13622] Fix | Delete
[13623] Fix | Delete
$license = $this->get_api_user_scope()->call(
[13624] Fix | Delete
"/licenses/{$this->_site->license_id}.json",
[13625] Fix | Delete
'put',
[13626] Fix | Delete
array( 'is_whitelabeled' => ! $this->_license->is_whitelabeled )
[13627] Fix | Delete
);
[13628] Fix | Delete
[13629] Fix | Delete
if ( ! $this->is_api_result_entity( $license ) ) {
[13630] Fix | Delete
self::shoot_ajax_failure(
[13631] Fix | Delete
FS_Api::is_api_error_object( $license ) ?
[13632] Fix | Delete
$license->error->message :
[13633] Fix | Delete
fs_text_inline( "An unknown error has occurred while trying to toggle the license's white-label mode.", 'unknown-error-occurred', $this->get_slug() )
[13634] Fix | Delete
);
[13635] Fix | Delete
}
[13636] Fix | Delete
[13637] Fix | Delete
$this->_license->is_whitelabeled = $license->is_whitelabeled;
[13638] Fix | Delete
$this->_store_licenses();
[13639] Fix | Delete
[13640] Fix | Delete
$this->_sync_license();
[13641] Fix | Delete
[13642] Fix | Delete
if ( ! $license->is_whitelabeled ) {
[13643] Fix | Delete
$this->_admin_notices->remove_sticky( 'license_whitelabeled' );
[13644] Fix | Delete
} else {
[13645] Fix | Delete
$this->_admin_notices->add_sticky(
[13646] Fix | Delete
sprintf(
[13647] Fix | Delete
$this->get_text_inline(
[13648] Fix | Delete
'Your %s license was flagged as white-labeled to hide sensitive information from the WP Admin (e.g. your email, license key, prices, billing address & invoices). If you ever wish to revert it back, you can easily do it through your %s. If this was a mistake you can also %s.',
[13649] Fix | Delete
'license_whitelabeled'
[13650] Fix | Delete
),
[13651] Fix | Delete
"<strong>{$this->get_plugin_title()}</strong>",
[13652] Fix | Delete
sprintf( '<a href="https://users.freemius.com" target="_blank">%s</a>', $this->get_text_inline( 'User Dashboard', 'user-dashboard' ) ),
[13653] Fix | Delete
sprintf( '<a href="#" class="fs-toggle-whitelabel-mode">%s</a>', $this->get_text_inline( 'revert it now', 'revert-it-now' ) )
[13654] Fix | Delete
),
[13655] Fix | Delete
'license_whitelabeled'
[13656] Fix | Delete
);
[13657] Fix | Delete
}
[13658] Fix | Delete
[13659] Fix | Delete
self::shoot_ajax_response( array( 'success' => true ) );
[13660] Fix | Delete
}
[13661] Fix | Delete
[13662] Fix | Delete
/**
[13663] Fix | Delete
* @author Leo Fajardo (@leorw)
[13664] Fix | Delete
* @since 2.3.0
[13665] Fix | Delete
*/
[13666] Fix | Delete
function _add_beta_mode_update_handler() {
[13667] Fix | Delete
if ( ! $this->is_user_admin() ) {
[13668] Fix | Delete
return;
[13669] Fix | Delete
}
[13670] Fix | Delete
[13671] Fix | Delete
if ( ! $this->is_premium() ) {
[13672] Fix | Delete
return;
[13673] Fix | Delete
}
[13674] Fix | Delete
[13675] Fix | Delete
$this->add_ajax_action( 'set_beta_mode', array( &$this, '_set_beta_mode_ajax_handler' ) );
[13676] Fix | Delete
}
[13677] Fix | Delete
[13678] Fix | Delete
/**
[13679] Fix | Delete
* @author Leo Fajardo (@leorw)
[13680] Fix | Delete
* @since 2.3.0
[13681] Fix | Delete
*/
[13682] Fix | Delete
function _set_beta_mode_ajax_handler() {
[13683] Fix | Delete
$this->_logger->entrance();
[13684] Fix | Delete
[13685] Fix | Delete
$this->check_ajax_referer( 'set_beta_mode' );
[13686] Fix | Delete
[13687] Fix | Delete
if ( ! $this->is_user_admin() ) {
[13688] Fix | Delete
// Only for admins.
[13689] Fix | Delete
self::shoot_ajax_failure();
[13690] Fix | Delete
}
[13691] Fix | Delete
[13692] Fix | Delete
$is_beta = trim( fs_request_get( 'is_beta', '', 'post' ) );
[13693] Fix | Delete
[13694] Fix | Delete
if ( empty( $is_beta ) || ! in_array( $is_beta, array( 'true', 'false' ) ) ) {
[13695] Fix | Delete
self::shoot_ajax_failure();
[13696] Fix | Delete
}
[13697] Fix | Delete
[13698] Fix | Delete
$site = $this->api_site_call(
[13699] Fix | Delete
'',
[13700] Fix | Delete
'put',
[13701] Fix | Delete
array(
[13702] Fix | Delete
'is_beta' => ( 'true' == $is_beta ),
[13703] Fix | Delete
'fields' => 'is_beta'
[13704] Fix | Delete
)
[13705] Fix | Delete
);
[13706] Fix | Delete
[13707] Fix | Delete
if ( ! $this->is_api_result_entity( $site ) ) {
[13708] Fix | Delete
self::shoot_ajax_failure(
[13709] Fix | Delete
FS_Api::is_api_error_object( $site ) ?
[13710] Fix | Delete
$site->error->message :
[13711] Fix | Delete
fs_text_inline( "An unknown error has occurred while trying to set the user's beta mode.", 'unknown-error-occurred', $this->get_slug() )
[13712] Fix | Delete
);
[13713] Fix | Delete
}
[13714] Fix | Delete
[13715] Fix | Delete
$this->_site->is_beta = $site->is_beta;
[13716] Fix | Delete
$this->_store_site();
[13717] Fix | Delete
[13718] Fix | Delete
self::shoot_ajax_response( array( 'success' => true ) );
[13719] Fix | Delete
}
[13720] Fix | Delete
[13721] Fix | Delete
/**
[13722] Fix | Delete
* License activation WP AJAX handler.
[13723] Fix | Delete
*
[13724] Fix | Delete
* @author Leo Fajardo (@leorw)
[13725] Fix | Delete
* @since 1.1.9
[13726] Fix | Delete
*
[13727] Fix | Delete
* @uses Freemius::activate_license()
[13728] Fix | Delete
*/
[13729] Fix | Delete
function _activate_license_ajax_action() {
[13730] Fix | Delete
$this->_logger->entrance();
[13731] Fix | Delete
[13732] Fix | Delete
$this->check_ajax_referer( 'activate_license' );
[13733] Fix | Delete
[13734] Fix | Delete
$license_key = trim( fs_request_get_raw( 'license_key' ) );
[13735] Fix | Delete
[13736] Fix | Delete
if ( empty( $license_key ) ) {
[13737] Fix | Delete
exit;
[13738] Fix | Delete
}
[13739] Fix | Delete
[13740] Fix | Delete
$sites = fs_is_network_admin() ?
[13741] Fix | Delete
fs_request_get( 'sites', array(), 'post' ) :
[13742] Fix | Delete
array();
[13743] Fix | Delete
[13744] Fix | Delete
$result = $this->activate_license(
[13745] Fix | Delete
$license_key,
[13746] Fix | Delete
$sites,
[13747] Fix | Delete
fs_request_get_bool( 'is_marketing_allowed', null ),
[13748] Fix | Delete
fs_request_get( 'blog_id', null ),
[13749] Fix | Delete
fs_request_get( 'module_id', null, 'post' ),
[13750] Fix | Delete
fs_request_get( 'user_id', null ),
[13751] Fix | Delete
fs_request_get_bool( 'is_extensions_tracking_allowed', null ),
[13752] Fix | Delete
fs_request_get_bool( 'is_diagnostic_tracking_allowed', null )
[13753] Fix | Delete
);
[13754] Fix | Delete
[13755] Fix | Delete
if (
[13756] Fix | Delete
$result['success'] &&
[13757] Fix | Delete
$this->is_bundle_license_auto_activation_enabled()
[13758] Fix | Delete
) {
[13759] Fix | Delete
$license = new FS_Plugin_License();
[13760] Fix | Delete
$license->secret_key = $license_key;
[13761] Fix | Delete
[13762] Fix | Delete
$this->maybe_activate_bundle_license( $license, $sites );
[13763] Fix | Delete
}
[13764] Fix | Delete
[13765] Fix | Delete
echo json_encode( $result );
[13766] Fix | Delete
[13767] Fix | Delete
exit;
[13768] Fix | Delete
}
[13769] Fix | Delete
[13770] Fix | Delete
/**
[13771] Fix | Delete
* User change WP AJAX handler.
[13772] Fix | Delete
*
[13773] Fix | Delete
* @author Leo Fajardo (@leorw)
[13774] Fix | Delete
* @since 2.3.2
[13775] Fix | Delete
*/
[13776] Fix | Delete
function _user_change_ajax_action() {
[13777] Fix | Delete
$this->_logger->entrance();
[13778] Fix | Delete
[13779] Fix | Delete
$this->check_ajax_referer( 'change_user' );
[13780] Fix | Delete
[13781] Fix | Delete
$new_email_address = trim( fs_request_get( 'email_address', '' ) );
[13782] Fix | Delete
$new_user_id = fs_request_get( 'user_id' );
[13783] Fix | Delete
[13784] Fix | Delete
if ( empty( $new_email_address ) && ! FS_User::is_valid_id( $new_user_id ) ) {
[13785] Fix | Delete
self::shoot_ajax_failure( fs_text_inline( 'Invalid new user ID or email address.', 'invalid-new-user-id-or-email', $this->get_slug() ) );
[13786] Fix | Delete
}
[13787] Fix | Delete
[13788] Fix | Delete
$params = array();
[13789] Fix | Delete
[13790] Fix | Delete
if ( ! empty( $new_email_address ) ) {
[13791] Fix | Delete
$params['user_email'] = $new_email_address;
[13792] Fix | Delete
} else {
[13793] Fix | Delete
$params['user_id'] = $new_user_id;
[13794] Fix | Delete
}
[13795] Fix | Delete
[13796] Fix | Delete
$installs_info_by_slug_map = $this->get_parent_and_addons_installs_info();
[13797] Fix | Delete
$install_ids = array();
[13798] Fix | Delete
[13799] Fix | Delete
foreach ( $installs_info_by_slug_map as $slug => $install_info ) {
[13800] Fix | Delete
$install_ids[ $slug ] = $install_info['install']->id;
[13801] Fix | Delete
}
[13802] Fix | Delete
[13803] Fix | Delete
$params['install_ids'] = implode( ',', array_values( $install_ids ) );
[13804] Fix | Delete
[13805] Fix | Delete
$install = $this->get_api_site_scope()->call( $this->add_show_pending( '/' ), 'put', $params );
[13806] Fix | Delete
[13807] Fix | Delete
if ( FS_Api::is_api_error( $install ) ) {
[13808] Fix | Delete
$error = '';
[13809] Fix | Delete
[13810] Fix | Delete
if ( is_object( $install ) ) {
[13811] Fix | Delete
switch ( $install->error->code ) {
[13812] Fix | Delete
case 'user_exist':
[13813] Fix | Delete
$error = (
[13814] Fix | Delete
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...' .
[13815] Fix | Delete
$this->get_text_inline( 'Sorry, we could not complete the email update. Another user with the same email is already registered.', 'user-exist-message' ) . ' ' .
[13816] Fix | Delete
sprintf( $this->get_text_inline( 'If you would like to give up the ownership of the %s\'s account to %s click the Change Ownership button.', 'user-exist-message_ownership' ), $this->_module_type, '<b>' . $new_email_address . '</b>' ) .
[13817] Fix | Delete
sprintf(
[13818] Fix | Delete
'<a style="line-height: 40px;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
[13819] Fix | Delete
$this->get_account_url( 'change_owner', array(
[13820] Fix | Delete
'state' => 'init',
[13821] Fix | Delete
'candidate_email' => $new_email_address
[13822] Fix | Delete
) ),
[13823] Fix | Delete
$this->get_text_inline( 'Change Ownership', 'change-ownership' )
[13824] Fix | Delete
)
[13825] Fix | Delete
);
[13826] Fix | Delete
break;
[13827] Fix | Delete
}
[13828] Fix | Delete
}
[13829] Fix | Delete
[13830] Fix | Delete
if ( empty( $error ) ) {
[13831] Fix | Delete
$error = FS_Api::is_api_error_object( $install ) ?
[13832] Fix | Delete
$install->error->message :
[13833] Fix | Delete
var_export( $install->error, true );
[13834] Fix | Delete
}
[13835] Fix | Delete
[13836] Fix | Delete
self::shoot_ajax_failure( $error );
[13837] Fix | Delete
} else {
[13838] Fix | Delete
if (
[13839] Fix | Delete
// If successful ownership change.
[13840] Fix | Delete
$this->get_user()->id != $install->user_id ||
[13841] Fix | Delete
! empty( $new_email_address )
[13842] Fix | Delete
) {
[13843] Fix | Delete
$this->complete_ownership_change_by_license( $install->user_id, $install_ids );
[13844] Fix | Delete
}
[13845] Fix | Delete
}
[13846] Fix | Delete
[13847] Fix | Delete
self::shoot_ajax_success();
[13848] Fix | Delete
}
[13849] Fix | Delete
[13850] Fix | Delete
/**
[13851] Fix | Delete
* @author Leo Fajardo (@leorw)
[13852] Fix | Delete
* @since 2.3.2.14
[13853] Fix | Delete
*/
[13854] Fix | Delete
function starting_migration() {
[13855] Fix | Delete
if ( ! empty( $this->_storage->license_migration ) ) {
[13856] Fix | Delete
// Do not overwrite the data if already set.
[13857] Fix | Delete
return;
[13858] Fix | Delete
}
[13859] Fix | Delete
[13860] Fix | Delete
$this->_storage->license_migration = array(
[13861] Fix | Delete
'is_migrating' => true,
[13862] Fix | Delete
'start_timestamp' => time()
[13863] Fix | Delete
);
[13864] Fix | Delete
}
[13865] Fix | Delete
[13866] Fix | Delete
/**
[13867] Fix | Delete
* @author Leo Fajardo (@leorw)
[13868] Fix | Delete
* @since 2.3.2.14
[13869] Fix | Delete
*/
[13870] Fix | Delete
function is_migration() {
[13871] Fix | Delete
if ( $this->is_addon() ) {
[13872] Fix | Delete
return $this->get_parent_instance()->is_migration();
[13873] Fix | Delete
}
[13874] Fix | Delete
[13875] Fix | Delete
if ( empty( $this->_storage->license_migration ) ) {
[13876] Fix | Delete
return false;
[13877] Fix | Delete
}
[13878] Fix | Delete
[13879] Fix | Delete
if ( ! $this->_storage->license_migration['is_migrating'] ) {
[13880] Fix | Delete
return false;
[13881] Fix | Delete
}
[13882] Fix | Delete
[13883] Fix | Delete
return (
[13884] Fix | Delete
// Return `true` if the migration is within 5 minutes from the starting time.
[13885] Fix | Delete
( time() - $this->_storage->license_migration['start_timestamp'] ) <= WP_FS__TIME_5_MIN_IN_SEC
[13886] Fix | Delete
);
[13887] Fix | Delete
}
[13888] Fix | Delete
[13889] Fix | Delete
/**
[13890] Fix | Delete
*
[13891] Fix | Delete
* A helper method to activate migrated licenses. If the product is network activated and integrated, the method will network activate the license.
[13892] Fix | Delete
*
[13893] Fix | Delete
* @author Vova Feldman (@svovaf)
[13894] Fix | Delete
* @since 2.3.0
[13895] Fix | Delete
*
[13896] Fix | Delete
* @param string $license_key
[13897] Fix | Delete
* @param null|bool $is_marketing_allowed
[13898] Fix | Delete
* @param null|number $plugin_id
[13899] Fix | Delete
* @param array $sites
[13900] Fix | Delete
* @param int $blog_id
[13901] Fix | Delete
*
[13902] Fix | Delete
* @return array {
[13903] Fix | Delete
* @var bool $success
[13904] Fix | Delete
* @var string $error
[13905] Fix | Delete
* @var string $next_page
[13906] Fix | Delete
* }
[13907] Fix | Delete
*
[13908] Fix | Delete
* @uses Freemius::activate_license()
[13909] Fix | Delete
*/
[13910] Fix | Delete
function activate_migrated_license(
[13911] Fix | Delete
$license_key,
[13912] Fix | Delete
$is_marketing_allowed = null,
[13913] Fix | Delete
$plugin_id = null,
[13914] Fix | Delete
$sites = array(),
[13915] Fix | Delete
$blog_id = null
[13916] Fix | Delete
) {
[13917] Fix | Delete
$this->_logger->entrance();
[13918] Fix | Delete
[13919] Fix | Delete
$result = $this->activate_license(
[13920] Fix | Delete
$license_key,
[13921] Fix | Delete
( empty( $sites ) && is_null( $blog_id ) && $this->is_network_active() ) ?
[13922] Fix | Delete
$this->get_sites_for_network_level_optin() :
[13923] Fix | Delete
$sites,
[13924] Fix | Delete
$is_marketing_allowed,
[13925] Fix | Delete
$blog_id,
[13926] Fix | Delete
$plugin_id
[13927] Fix | Delete
);
[13928] Fix | Delete
[13929] Fix | Delete
// No need to show the sticky after license activation notice after migrating a license.
[13930] Fix | Delete
$this->_admin_notices->remove_sticky( 'plan_upgraded' );
[13931] Fix | Delete
[13932] Fix | Delete
return $result;
[13933] Fix | Delete
}
[13934] Fix | Delete
[13935] Fix | Delete
/**
[13936] Fix | Delete
* @author Leo Fajardo (@leorw)
[13937] Fix | Delete
* @since 2.3.1
[13938] Fix | Delete
*
[13939] Fix | Delete
* @return string
[13940] Fix | Delete
*/
[13941] Fix | Delete
function get_pricing_js_path() {
[13942] Fix | Delete
if ( ! isset( $this->_pricing_js_path ) ) {
[13943] Fix | Delete
$pricing_js_path = $this->apply_filters( 'freemius_pricing_js_path', '' );
[13944] Fix | Delete
[13945] Fix | Delete
if ( empty( $pricing_js_path ) ) {
[13946] Fix | Delete
global $fs_active_plugins;
[13947] Fix | Delete
[13948] Fix | Delete
foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
[13949] Fix | Delete
if ( $data->plugin_path == $this->get_plugin_basename() ) {
[13950] Fix | Delete
$plugin_or_theme_root_dir = ( $this->is_plugin() ? WP_PLUGIN_DIR : get_theme_root( get_stylesheet() ) );
[13951] Fix | Delete
[13952] Fix | Delete
$pricing_js_path = $plugin_or_theme_root_dir
[13953] Fix | Delete
. '/'
[13954] Fix | Delete
// The basename will be `plugins`, `themes`, or the basename of a custom plugins or themes directory.
[13955] Fix | Delete
. str_replace( '../' . basename( $plugin_or_theme_root_dir ) . '/', '', $sdk_path )
[13956] Fix | Delete
. '/includes/freemius-pricing/freemius-pricing.js';
[13957] Fix | Delete
[13958] Fix | Delete
break;
[13959] Fix | Delete
}
[13960] Fix | Delete
}
[13961] Fix | Delete
}
[13962] Fix | Delete
[13963] Fix | Delete
$this->_pricing_js_path = $pricing_js_path;
[13964] Fix | Delete
}
[13965] Fix | Delete
[13966] Fix | Delete
return $this->_pricing_js_path;
[13967] Fix | Delete
}
[13968] Fix | Delete
[13969] Fix | Delete
/**
[13970] Fix | Delete
* @author Leo Fajardo (@leorw)
[13971] Fix | Delete
* @since 2.3.1
[13972] Fix | Delete
*
[13973] Fix | Delete
* @return bool
[13974] Fix | Delete
*/
[13975] Fix | Delete
function should_use_external_pricing() {
[13976] Fix | Delete
if ( is_null( $this->_use_external_pricing ) ) {
[13977] Fix | Delete
$pricing_js_path = $this->get_pricing_js_path();
[13978] Fix | Delete
[13979] Fix | Delete
$this->_use_external_pricing = ( empty( $pricing_js_path ) || ! file_exists( $pricing_js_path ) );
[13980] Fix | Delete
}
[13981] Fix | Delete
[13982] Fix | Delete
return $this->_use_external_pricing;
[13983] Fix | Delete
}
[13984] Fix | Delete
[13985] Fix | Delete
/**
[13986] Fix | Delete
* The implementation of this method was previously in `_activate_license_ajax_action()`.
[13987] Fix | Delete
*
[13988] Fix | Delete
* @author Vova Feldman (@svovaf)
[13989] Fix | Delete
* @since 2.2.4
[13990] Fix | Delete
* @since 2.0.0 When a super-admin that hasn't connected before is network activating a license and excluding some of the sites for the license activation, go over the unselected sites in the network and if a site is not connected, skipped, nor delegated, if it's a freemium product then just skip the connection for the site, if it's a premium only product, delegate the connection and license activation to the site admin (Vova Feldman @svovaf).
[13991] Fix | Delete
* @param string $license_key
[13992] Fix | Delete
* @param array $sites
[13993] Fix | Delete
* @param null|bool $is_marketing_allowed
[13994] Fix | Delete
* @param null|int $blog_id
[13995] Fix | Delete
* @param null|number $plugin_id
[13996] Fix | Delete
* @param null|number $license_owner_id
[13997] Fix | Delete
* @param bool|null $is_extensions_tracking_allowed
[13998] Fix | Delete
* @param bool|null $is_diagnostic_tracking_allowed Since 2.5.0.2 to allow license activation with minimal data footprint.
[13999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function