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
* @since 2.4.5
[5500] Fix | Delete
*/
[5501] Fix | Delete
if ( $this->is_network_active() && fs_is_network_admin() ) {
[5502] Fix | Delete
if ( isset( $plugin_info['menu_network'] ) &&
[5503] Fix | Delete
is_array( $plugin_info['menu_network'] ) &&
[5504] Fix | Delete
! empty( $plugin_info['menu_network'] )
[5505] Fix | Delete
) {
[5506] Fix | Delete
$plugin_info['menu'] = $plugin_info['menu_network'];
[5507] Fix | Delete
}
[5508] Fix | Delete
}
[5509] Fix | Delete
[5510] Fix | Delete
if ( ! isset( $plugin_info['menu'] ) ) {
[5511] Fix | Delete
$plugin_info['menu'] = array();
[5512] Fix | Delete
[5513] Fix | Delete
if ( ! empty( $this->_storage->sdk_last_version ) &&
[5514] Fix | Delete
version_compare( $this->_storage->sdk_last_version, '1.1.2', '<=' )
[5515] Fix | Delete
) {
[5516] Fix | Delete
// Backward compatibility to 1.1.2
[5517] Fix | Delete
$plugin_info['menu']['slug'] = isset( $plugin_info['menu_slug'] ) ?
[5518] Fix | Delete
$plugin_info['menu_slug'] :
[5519] Fix | Delete
$this->_slug;
[5520] Fix | Delete
}
[5521] Fix | Delete
}
[5522] Fix | Delete
[5523] Fix | Delete
$this->_menu = FS_Admin_Menu_Manager::instance(
[5524] Fix | Delete
$this->_module_id,
[5525] Fix | Delete
$this->_module_type,
[5526] Fix | Delete
$this->get_unique_affix()
[5527] Fix | Delete
);
[5528] Fix | Delete
[5529] Fix | Delete
$this->_menu->init( $plugin_info['menu'], $this->is_addon() );
[5530] Fix | Delete
[5531] Fix | Delete
$this->_has_addons = $this->get_bool_option( $plugin_info, 'has_addons', false );
[5532] Fix | Delete
$this->_has_paid_plans = $this->get_bool_option( $plugin_info, 'has_paid_plans', true );
[5533] Fix | Delete
$this->_has_premium_version = $this->get_bool_option( $plugin_info, 'has_premium_version', $this->_has_paid_plans );
[5534] Fix | Delete
$this->_ignore_pending_mode = $this->get_bool_option( $plugin_info, 'ignore_pending_mode', false );
[5535] Fix | Delete
$this->_is_org_compliant = $this->get_bool_option( $plugin_info, 'is_org_compliant', true );
[5536] Fix | Delete
$this->_is_premium_only = $this->get_bool_option( $plugin_info, 'is_premium_only', false );
[5537] Fix | Delete
if ( $this->_is_premium_only ) {
[5538] Fix | Delete
// If premium only plugin, disable anonymous mode.
[5539] Fix | Delete
$this->_enable_anonymous = false;
[5540] Fix | Delete
$this->_anonymous_mode = false;
[5541] Fix | Delete
} else {
[5542] Fix | Delete
$this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
[5543] Fix | Delete
$this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
[5544] Fix | Delete
}
[5545] Fix | Delete
$this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
[5546] Fix | Delete
$this->_is_bundle_license_auto_activation_enabled = $this->get_option( $plugin_info, 'bundle_license_auto_activation', false );
[5547] Fix | Delete
[5548] Fix | Delete
if ( ! empty( $plugin_info['trial'] ) ) {
[5549] Fix | Delete
$this->_trial_days = $this->get_numeric_option(
[5550] Fix | Delete
$plugin_info['trial'],
[5551] Fix | Delete
'days',
[5552] Fix | Delete
// Default to 0 - trial without days specification.
[5553] Fix | Delete
0
[5554] Fix | Delete
);
[5555] Fix | Delete
[5556] Fix | Delete
$this->_is_trial_require_payment = $this->get_bool_option( $plugin_info['trial'], 'is_require_payment', false );
[5557] Fix | Delete
}
[5558] Fix | Delete
[5559] Fix | Delete
$this->_navigation = $this->get_option(
[5560] Fix | Delete
$plugin_info,
[5561] Fix | Delete
'navigation',
[5562] Fix | Delete
$this->is_free_wp_org_theme() ?
[5563] Fix | Delete
self::NAVIGATION_TABS :
[5564] Fix | Delete
self::NAVIGATION_MENU
[5565] Fix | Delete
);
[5566] Fix | Delete
}
[5567] Fix | Delete
[5568] Fix | Delete
/**
[5569] Fix | Delete
* @param string[] $options
[5570] Fix | Delete
* @param string $key
[5571] Fix | Delete
* @param mixed $default
[5572] Fix | Delete
*
[5573] Fix | Delete
* @return bool
[5574] Fix | Delete
*/
[5575] Fix | Delete
private function get_option( &$options, $key, $default = false ) {
[5576] Fix | Delete
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
[5577] Fix | Delete
}
[5578] Fix | Delete
[5579] Fix | Delete
private function get_bool_option( &$options, $key, $default = false ) {
[5580] Fix | Delete
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
[5581] Fix | Delete
}
[5582] Fix | Delete
[5583] Fix | Delete
private function get_numeric_option( &$options, $key, $default = false ) {
[5584] Fix | Delete
return isset( $options[ $key ] ) && is_numeric( $options[ $key ] ) ? $options[ $key ] : $default;
[5585] Fix | Delete
}
[5586] Fix | Delete
[5587] Fix | Delete
/**
[5588] Fix | Delete
* Gate keeper.
[5589] Fix | Delete
*
[5590] Fix | Delete
* @author Vova Feldman (@svovaf)
[5591] Fix | Delete
* @since 1.1.7.3
[5592] Fix | Delete
*
[5593] Fix | Delete
* @return bool
[5594] Fix | Delete
*/
[5595] Fix | Delete
private function should_stop_execution() {
[5596] Fix | Delete
if ( empty( $this->_storage->was_plugin_loaded ) ) {
[5597] Fix | Delete
/**
[5598] Fix | Delete
* Don't execute Freemius until plugin was fully loaded at least once,
[5599] Fix | Delete
* to give the opportunity for the activation hook to run before pinging
[5600] Fix | Delete
* the API for connectivity test. This logic is relevant for the
[5601] Fix | Delete
* identification of new plugin install vs. plugin update.
[5602] Fix | Delete
*
[5603] Fix | Delete
* @author Vova Feldman (@svovaf)
[5604] Fix | Delete
* @since 1.1.9
[5605] Fix | Delete
*/
[5606] Fix | Delete
return true;
[5607] Fix | Delete
}
[5608] Fix | Delete
[5609] Fix | Delete
if ( $this->is_activation_mode() ) {
[5610] Fix | Delete
if ( ! is_admin() ) {
[5611] Fix | Delete
/**
[5612] Fix | Delete
* If in activation mode, don't execute Freemius outside the admin dashboard.
[5613] Fix | Delete
*
[5614] Fix | Delete
* @author Vova Feldman (@svovaf)
[5615] Fix | Delete
* @since 1.1.7.3
[5616] Fix | Delete
*/
[5617] Fix | Delete
return true;
[5618] Fix | Delete
}
[5619] Fix | Delete
[5620] Fix | Delete
if ( ! WP_FS__IS_HTTP_REQUEST ) {
[5621] Fix | Delete
/**
[5622] Fix | Delete
* If in activation and executed without HTTP context (e.g. CLI, Cronjob),
[5623] Fix | Delete
* then don't start Freemius.
[5624] Fix | Delete
*
[5625] Fix | Delete
* @author Vova Feldman (@svovaf)
[5626] Fix | Delete
* @since 1.1.6.3
[5627] Fix | Delete
*
[5628] Fix | Delete
* @link https://wordpress.org/support/topic/errors-in-the-freemius-class-when-running-in-wordpress-in-cli
[5629] Fix | Delete
*/
[5630] Fix | Delete
return true;
[5631] Fix | Delete
}
[5632] Fix | Delete
[5633] Fix | Delete
if ( self::is_cron() ) {
[5634] Fix | Delete
/**
[5635] Fix | Delete
* If in activation mode, don't execute Freemius during wp crons
[5636] Fix | Delete
* (wp crons have HTTP context - called as HTTP request).
[5637] Fix | Delete
*
[5638] Fix | Delete
* @author Vova Feldman (@svovaf)
[5639] Fix | Delete
* @since 1.1.7.3
[5640] Fix | Delete
*/
[5641] Fix | Delete
return true;
[5642] Fix | Delete
}
[5643] Fix | Delete
[5644] Fix | Delete
if ( self::is_ajax() ) {
[5645] Fix | Delete
/**
[5646] Fix | Delete
* During activation, if running in AJAX mode, unless there's a sticky
[5647] Fix | Delete
* connectivity issue notice, don't run Freemius.
[5648] Fix | Delete
*
[5649] Fix | Delete
* @author Vova Feldman (@svovaf)
[5650] Fix | Delete
* @since 1.1.7.3
[5651] Fix | Delete
*/
[5652] Fix | Delete
return true;
[5653] Fix | Delete
}
[5654] Fix | Delete
}
[5655] Fix | Delete
[5656] Fix | Delete
return false;
[5657] Fix | Delete
}
[5658] Fix | Delete
[5659] Fix | Delete
/**
[5660] Fix | Delete
* Triggered after code type has changed.
[5661] Fix | Delete
*
[5662] Fix | Delete
* @author Vova Feldman (@svovaf)
[5663] Fix | Delete
* @since 1.1.9.1
[5664] Fix | Delete
*/
[5665] Fix | Delete
function _after_code_type_change() {
[5666] Fix | Delete
$this->_logger->entrance();
[5667] Fix | Delete
[5668] Fix | Delete
if ( $this->is_theme() ) {
[5669] Fix | Delete
// Expire the cache of the previous tabs since the theme may
[5670] Fix | Delete
// have setting updates after code type has changed.
[5671] Fix | Delete
$this->_cache->expire( 'tabs' );
[5672] Fix | Delete
$this->_cache->expire( 'tabs_stylesheets' );
[5673] Fix | Delete
}
[5674] Fix | Delete
[5675] Fix | Delete
if ( ! $this->is_addon() ) {
[5676] Fix | Delete
add_action(
[5677] Fix | Delete
is_admin() ? 'admin_init' : 'init',
[5678] Fix | Delete
array( &$this, '_plugin_code_type_changed' )
[5679] Fix | Delete
);
[5680] Fix | Delete
}
[5681] Fix | Delete
[5682] Fix | Delete
if ( $this->is_registered() && $this->is_premium() ) {
[5683] Fix | Delete
// Purge cached payments after switching to the premium version.
[5684] Fix | Delete
// @todo This logic doesn't handle purging the cache for serviceware module upgrade.
[5685] Fix | Delete
$this->get_api_user_scope()->purge_cache( "/plugins/{$this->_module_id}/payments.json?include_addons=true" );
[5686] Fix | Delete
}
[5687] Fix | Delete
}
[5688] Fix | Delete
[5689] Fix | Delete
/**
[5690] Fix | Delete
* Handles plugin's code type change (free <--> premium).
[5691] Fix | Delete
*
[5692] Fix | Delete
* @author Vova Feldman (@svovaf)
[5693] Fix | Delete
* @since 1.0.9
[5694] Fix | Delete
*/
[5695] Fix | Delete
function _plugin_code_type_changed() {
[5696] Fix | Delete
$this->_logger->entrance();
[5697] Fix | Delete
[5698] Fix | Delete
if ( $this->is_premium() ) {
[5699] Fix | Delete
$this->reconnect_locally();
[5700] Fix | Delete
[5701] Fix | Delete
// Activated premium code.
[5702] Fix | Delete
$this->do_action( 'after_premium_version_activation' );
[5703] Fix | Delete
[5704] Fix | Delete
// Remove all sticky messages related to download of the premium version.
[5705] Fix | Delete
$this->_admin_notices->remove_sticky( array(
[5706] Fix | Delete
'trial_started',
[5707] Fix | Delete
'plan_upgraded',
[5708] Fix | Delete
'plan_changed',
[5709] Fix | Delete
'license_activated',
[5710] Fix | Delete
) );
[5711] Fix | Delete
[5712] Fix | Delete
$notice = '';
[5713] Fix | Delete
if ( ! $this->is_only_premium() ) {
[5714] Fix | Delete
$notice = sprintf( $this->get_text_inline( 'Premium %s version was successfully activated.', 'premium-activated-message' ), $this->_module_type );
[5715] Fix | Delete
}
[5716] Fix | Delete
[5717] Fix | Delete
$license_notice = $this->get_license_network_activation_notice();
[5718] Fix | Delete
if ( ! empty( $license_notice ) ) {
[5719] Fix | Delete
$notice .= ' ' . $license_notice;
[5720] Fix | Delete
}
[5721] Fix | Delete
[5722] Fix | Delete
if ( ! empty( $notice ) ) {
[5723] Fix | Delete
$this->_admin_notices->add_sticky(
[5724] Fix | Delete
trim( $notice ),
[5725] Fix | Delete
'premium_activated',
[5726] Fix | Delete
$this->get_text_x_inline( 'W00t',
[5727] Fix | Delete
'Used to express elation, enthusiasm, or triumph (especially in electronic communication).', 'woot' ) . '!'
[5728] Fix | Delete
);
[5729] Fix | Delete
}
[5730] Fix | Delete
} else {
[5731] Fix | Delete
// Remove sticky message related to premium code activation.
[5732] Fix | Delete
$this->_admin_notices->remove_sticky( 'premium_activated' );
[5733] Fix | Delete
[5734] Fix | Delete
// Activated free code (after had the premium before).
[5735] Fix | Delete
$this->do_action( 'after_free_version_reactivation' );
[5736] Fix | Delete
[5737] Fix | Delete
if ( $this->is_paying() && ! $this->is_premium() ) {
[5738] Fix | Delete
$this->add_complete_upgrade_instructions_notice(
[5739] Fix | Delete
sprintf(
[5740] Fix | Delete
/* translators: %s: License type (e.g. you have a professional license) */
[5741] Fix | Delete
$this->get_text_inline( 'You have a %s license.', 'you-have-x-license' ),
[5742] Fix | Delete
$this->get_plan_title()
[5743] Fix | Delete
),
[5744] Fix | Delete
'plan_upgraded'
[5745] Fix | Delete
);
[5746] Fix | Delete
}
[5747] Fix | Delete
}
[5748] Fix | Delete
[5749] Fix | Delete
if ( $this->is_registered() ) {
[5750] Fix | Delete
// Schedule code type changes event.
[5751] Fix | Delete
$this->schedule_install_sync();
[5752] Fix | Delete
}
[5753] Fix | Delete
[5754] Fix | Delete
/**
[5755] Fix | Delete
* Unregister the uninstall hook for the other version of the plugin (with different code type) to avoid
[5756] Fix | Delete
* triggering a fatal error when uninstalling that plugin. For example, after deactivating the "free" version
[5757] Fix | Delete
* of a specific plugin, its uninstall hook should be unregistered after the "premium" version has been
[5758] Fix | Delete
* activated. If we don't do that, a fatal error will occur when we try to uninstall the "free" version since
[5759] Fix | Delete
* the main file of the "free" version will be loaded first before calling the hooked callback. Since the
[5760] Fix | Delete
* free and premium versions are almost identical (same class or have same functions), a fatal error like
[5761] Fix | Delete
* "Cannot redeclare class MyClass" or "Cannot redeclare my_function()" will occur.
[5762] Fix | Delete
*/
[5763] Fix | Delete
$this->unregister_uninstall_hook();
[5764] Fix | Delete
[5765] Fix | Delete
$this->clear_module_main_file_cache();
[5766] Fix | Delete
[5767] Fix | Delete
// Update is_premium of latest version.
[5768] Fix | Delete
$this->_storage->prev_is_premium = $this->_plugin->is_premium;
[5769] Fix | Delete
}
[5770] Fix | Delete
[5771] Fix | Delete
#endregion
[5772] Fix | Delete
[5773] Fix | Delete
#----------------------------------------------------------------------------------
[5774] Fix | Delete
#region Add-ons
[5775] Fix | Delete
#----------------------------------------------------------------------------------
[5776] Fix | Delete
[5777] Fix | Delete
/**
[5778] Fix | Delete
* Check if add-on installed and activated on site.
[5779] Fix | Delete
*
[5780] Fix | Delete
* @author Vova Feldman (@svovaf)
[5781] Fix | Delete
* @since 1.0.6
[5782] Fix | Delete
*
[5783] Fix | Delete
* @param string|number $id_or_slug
[5784] Fix | Delete
* @param bool|null $is_premium Since 1.2.1.7 can check for specified add-on version.
[5785] Fix | Delete
*
[5786] Fix | Delete
* @return bool
[5787] Fix | Delete
*/
[5788] Fix | Delete
function is_addon_activated( $id_or_slug, $is_premium = null ) {
[5789] Fix | Delete
$this->_logger->entrance();
[5790] Fix | Delete
[5791] Fix | Delete
$addon_id = self::get_module_id( $id_or_slug );
[5792] Fix | Delete
$is_activated = self::has_instance( $addon_id );
[5793] Fix | Delete
[5794] Fix | Delete
if ( ! $is_activated ) {
[5795] Fix | Delete
return false;
[5796] Fix | Delete
}
[5797] Fix | Delete
[5798] Fix | Delete
if ( is_bool( $is_premium ) ) {
[5799] Fix | Delete
// Check if the specified code version is activate.
[5800] Fix | Delete
$addon = $this->get_addon_instance( $addon_id );
[5801] Fix | Delete
$is_activated = ( $is_premium === $addon->is_premium() );
[5802] Fix | Delete
}
[5803] Fix | Delete
[5804] Fix | Delete
return $is_activated;
[5805] Fix | Delete
}
[5806] Fix | Delete
[5807] Fix | Delete
/**
[5808] Fix | Delete
* Check if add-on was connected to install
[5809] Fix | Delete
*
[5810] Fix | Delete
* @author Vova Feldman (@svovaf)
[5811] Fix | Delete
* @since 1.1.7
[5812] Fix | Delete
*
[5813] Fix | Delete
* @param string|number $id_or_slug
[5814] Fix | Delete
*
[5815] Fix | Delete
* @return bool
[5816] Fix | Delete
*/
[5817] Fix | Delete
function is_addon_connected( $id_or_slug ) {
[5818] Fix | Delete
$this->_logger->entrance();
[5819] Fix | Delete
[5820] Fix | Delete
$sites = self::get_all_sites( WP_FS__MODULE_TYPE_PLUGIN );
[5821] Fix | Delete
[5822] Fix | Delete
$addon_id = self::get_module_id( $id_or_slug );
[5823] Fix | Delete
$addon = $this->get_addon( $addon_id );
[5824] Fix | Delete
$slug = $addon->slug;
[5825] Fix | Delete
if ( ! isset( $sites[ $slug ] ) ) {
[5826] Fix | Delete
return false;
[5827] Fix | Delete
}
[5828] Fix | Delete
[5829] Fix | Delete
$site = $sites[ $slug ];
[5830] Fix | Delete
[5831] Fix | Delete
$plugin = FS_Plugin_Manager::instance( $addon_id )->get();
[5832] Fix | Delete
[5833] Fix | Delete
if ( $plugin->parent_plugin_id != $this->_plugin->id ) {
[5834] Fix | Delete
// The given slug do NOT belong to any of the plugin's add-ons.
[5835] Fix | Delete
return false;
[5836] Fix | Delete
}
[5837] Fix | Delete
[5838] Fix | Delete
return ( is_object( $site ) &&
[5839] Fix | Delete
is_numeric( $site->id ) &&
[5840] Fix | Delete
is_numeric( $site->user_id ) &&
[5841] Fix | Delete
FS_Plugin_Plan::is_valid_id( $site->plan_id )
[5842] Fix | Delete
);
[5843] Fix | Delete
}
[5844] Fix | Delete
[5845] Fix | Delete
/**
[5846] Fix | Delete
* Determines if add-on installed.
[5847] Fix | Delete
*
[5848] Fix | Delete
* NOTE: This is a heuristic and only works if the folder/file named as the slug.
[5849] Fix | Delete
*
[5850] Fix | Delete
* @author Vova Feldman (@svovaf)
[5851] Fix | Delete
* @since 1.0.6
[5852] Fix | Delete
*
[5853] Fix | Delete
* @param string|number $id_or_slug
[5854] Fix | Delete
*
[5855] Fix | Delete
* @return bool
[5856] Fix | Delete
*/
[5857] Fix | Delete
function is_addon_installed( $id_or_slug ) {
[5858] Fix | Delete
$this->_logger->entrance();
[5859] Fix | Delete
[5860] Fix | Delete
$addon_id = self::get_module_id( $id_or_slug );
[5861] Fix | Delete
[5862] Fix | Delete
return file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this->get_addon_basename( $addon_id ) ) );
[5863] Fix | Delete
}
[5864] Fix | Delete
[5865] Fix | Delete
/**
[5866] Fix | Delete
* Get add-on basename.
[5867] Fix | Delete
*
[5868] Fix | Delete
* @author Vova Feldman (@svovaf)
[5869] Fix | Delete
* @since 1.0.6
[5870] Fix | Delete
*
[5871] Fix | Delete
* @param string|number $id_or_slug
[5872] Fix | Delete
*
[5873] Fix | Delete
* @return string
[5874] Fix | Delete
*/
[5875] Fix | Delete
function get_addon_basename( $id_or_slug ) {
[5876] Fix | Delete
$addon_id = self::get_module_id( $id_or_slug );
[5877] Fix | Delete
[5878] Fix | Delete
if ( $this->is_addon_activated( $addon_id ) ) {
[5879] Fix | Delete
return self::instance( $addon_id )->get_plugin_basename();
[5880] Fix | Delete
}
[5881] Fix | Delete
[5882] Fix | Delete
$addon = $this->get_addon( $addon_id );
[5883] Fix | Delete
$premium_basename = "{$addon->premium_slug}/{$addon->slug}.php";
[5884] Fix | Delete
[5885] Fix | Delete
if ( file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $premium_basename ) ) ) {
[5886] Fix | Delete
return $premium_basename;
[5887] Fix | Delete
}
[5888] Fix | Delete
[5889] Fix | Delete
$all_plugins = $this->get_all_plugins();
[5890] Fix | Delete
[5891] Fix | Delete
foreach ( $all_plugins as $basename => $data ) {
[5892] Fix | Delete
if ( $addon->slug === $data['slug'] ||
[5893] Fix | Delete
$addon->premium_slug === $data['slug']
[5894] Fix | Delete
) {
[5895] Fix | Delete
return $basename;
[5896] Fix | Delete
}
[5897] Fix | Delete
}
[5898] Fix | Delete
[5899] Fix | Delete
$free_basename = "{$addon->slug}/{$addon->slug}.php";
[5900] Fix | Delete
[5901] Fix | Delete
return $free_basename;
[5902] Fix | Delete
}
[5903] Fix | Delete
[5904] Fix | Delete
/**
[5905] Fix | Delete
* Get installed add-ons instances.
[5906] Fix | Delete
*
[5907] Fix | Delete
* @author Vova Feldman (@svovaf)
[5908] Fix | Delete
* @since 1.0.6
[5909] Fix | Delete
*
[5910] Fix | Delete
* @return Freemius[]
[5911] Fix | Delete
*/
[5912] Fix | Delete
function get_installed_addons() {
[5913] Fix | Delete
if ( $this->is_addon() ) {
[5914] Fix | Delete
// Add-on cannot have add-ons.
[5915] Fix | Delete
return array();
[5916] Fix | Delete
}
[5917] Fix | Delete
[5918] Fix | Delete
$installed_addons = array();
[5919] Fix | Delete
[5920] Fix | Delete
foreach ( self::$_instances as $instance ) {
[5921] Fix | Delete
if ( $instance->is_addon_of( $this->_plugin->id ) ) {
[5922] Fix | Delete
$installed_addons[] = $instance;
[5923] Fix | Delete
}
[5924] Fix | Delete
}
[5925] Fix | Delete
[5926] Fix | Delete
return $installed_addons;
[5927] Fix | Delete
}
[5928] Fix | Delete
[5929] Fix | Delete
/**
[5930] Fix | Delete
* Check if any add-ons of the plugin are installed.
[5931] Fix | Delete
*
[5932] Fix | Delete
* @author Leo Fajardo (@leorw)
[5933] Fix | Delete
* @since 1.1.1
[5934] Fix | Delete
*
[5935] Fix | Delete
* @return bool
[5936] Fix | Delete
*/
[5937] Fix | Delete
function has_installed_addons() {
[5938] Fix | Delete
if ( ! $this->has_addons() ) {
[5939] Fix | Delete
return false;
[5940] Fix | Delete
}
[5941] Fix | Delete
[5942] Fix | Delete
foreach ( self::$_instances as $instance ) {
[5943] Fix | Delete
if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
[5944] Fix | Delete
if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
[5945] Fix | Delete
return true;
[5946] Fix | Delete
}
[5947] Fix | Delete
}
[5948] Fix | Delete
}
[5949] Fix | Delete
[5950] Fix | Delete
return false;
[5951] Fix | Delete
}
[5952] Fix | Delete
[5953] Fix | Delete
/**
[5954] Fix | Delete
* Tell Freemius that the current plugin is an add-on.
[5955] Fix | Delete
*
[5956] Fix | Delete
* @author Vova Feldman (@svovaf)
[5957] Fix | Delete
* @since 1.0.6
[5958] Fix | Delete
*
[5959] Fix | Delete
* @param number $parent_plugin_id The parent plugin ID
[5960] Fix | Delete
*/
[5961] Fix | Delete
function init_addon( $parent_plugin_id ) {
[5962] Fix | Delete
$this->_plugin->parent_plugin_id = $parent_plugin_id;
[5963] Fix | Delete
}
[5964] Fix | Delete
[5965] Fix | Delete
/**
[5966] Fix | Delete
* @author Vova Feldman (@svovaf)
[5967] Fix | Delete
* @since 1.0.6
[5968] Fix | Delete
*
[5969] Fix | Delete
* @return bool
[5970] Fix | Delete
*/
[5971] Fix | Delete
function is_addon() {
[5972] Fix | Delete
return (
[5973] Fix | Delete
isset( $this->_plugin->parent_plugin_id ) &&
[5974] Fix | Delete
is_numeric( $this->_plugin->parent_plugin_id )
[5975] Fix | Delete
);
[5976] Fix | Delete
}
[5977] Fix | Delete
[5978] Fix | Delete
/**
[5979] Fix | Delete
* @author Vova Feldman (@svovaf)
[5980] Fix | Delete
* @since 2.3.2
[5981] Fix | Delete
*
[5982] Fix | Delete
* @param number $parent_product_id
[5983] Fix | Delete
*
[5984] Fix | Delete
* @return bool
[5985] Fix | Delete
*/
[5986] Fix | Delete
function is_addon_of( $parent_product_id ) {
[5987] Fix | Delete
return (
[5988] Fix | Delete
$this->is_addon() &&
[5989] Fix | Delete
$parent_product_id == $this->_plugin->parent_plugin_id
[5990] Fix | Delete
);
[5991] Fix | Delete
}
[5992] Fix | Delete
[5993] Fix | Delete
/**
[5994] Fix | Delete
* Deactivate add-on if it's premium only and the user does't have a valid license.
[5995] Fix | Delete
*
[5996] Fix | Delete
* @param bool $is_after_trial_cancel
[5997] Fix | Delete
*
[5998] Fix | Delete
* @return bool If add-on was deactivated.
[5999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function