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
$this->_logger->entrance( 'slug = ' . $this->_slug );
[10000] Fix | Delete
[10001] Fix | Delete
if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
[10002] Fix | Delete
return;
[10003] Fix | Delete
}
[10004] Fix | Delete
[10005] Fix | Delete
$params = array();
[10006] Fix | Delete
$uninstall_reason = null;
[10007] Fix | Delete
if ( isset( $this->_storage->uninstall_reason ) ) {
[10008] Fix | Delete
$uninstall_reason = $this->_storage->uninstall_reason;
[10009] Fix | Delete
$params['reason_id'] = $uninstall_reason->id;
[10010] Fix | Delete
$params['reason_info'] = $uninstall_reason->info;
[10011] Fix | Delete
}
[10012] Fix | Delete
[10013] Fix | Delete
if ( ! $this->is_registered() ) {
[10014] Fix | Delete
// Send anonymous uninstall event only if user submitted a feedback.
[10015] Fix | Delete
if ( isset( $uninstall_reason ) ) {
[10016] Fix | Delete
if ( isset( $uninstall_reason->is_anonymous ) && ! $uninstall_reason->is_anonymous ) {
[10017] Fix | Delete
$this->opt_in( false, false, false, false, true );
[10018] Fix | Delete
} else {
[10019] Fix | Delete
$params['uid'] = $this->get_anonymous_id();
[10020] Fix | Delete
$this->get_api_plugin_scope()->call( 'uninstall.json', 'put', $params );
[10021] Fix | Delete
}
[10022] Fix | Delete
}
[10023] Fix | Delete
} else {
[10024] Fix | Delete
$params = array_merge( $params, array(
[10025] Fix | Delete
'is_active' => false,
[10026] Fix | Delete
'is_uninstalled' => true,
[10027] Fix | Delete
) );
[10028] Fix | Delete
[10029] Fix | Delete
if ( $this->_is_network_active ) {
[10030] Fix | Delete
// Send uninstall event.
[10031] Fix | Delete
$this->send_installs_update( $params );
[10032] Fix | Delete
} else {
[10033] Fix | Delete
// Send uninstall event and handle the result.
[10034] Fix | Delete
$this->sync_install( $params );
[10035] Fix | Delete
}
[10036] Fix | Delete
}
[10037] Fix | Delete
[10038] Fix | Delete
// @todo Decide if we want to delete plugin information from db.
[10039] Fix | Delete
}
[10040] Fix | Delete
[10041] Fix | Delete
/**
[10042] Fix | Delete
* Set the basename of the current product and hook _activate_plugin_event_hook() to the activation action.
[10043] Fix | Delete
*
[10044] Fix | Delete
* @author Vova Feldman (@svovaf)
[10045] Fix | Delete
* @since 2.2.1
[10046] Fix | Delete
*
[10047] Fix | Delete
* @param string $is_premium
[10048] Fix | Delete
* @param string $caller
[10049] Fix | Delete
*
[10050] Fix | Delete
* @return void
[10051] Fix | Delete
*/
[10052] Fix | Delete
function set_basename( $is_premium, $caller ) {
[10053] Fix | Delete
$basename = plugin_basename( $caller );
[10054] Fix | Delete
[10055] Fix | Delete
$current_basename = $is_premium ?
[10056] Fix | Delete
$this->_premium_plugin_basename :
[10057] Fix | Delete
$this->_free_plugin_basename;
[10058] Fix | Delete
[10059] Fix | Delete
if ( $current_basename == $basename ) {
[10060] Fix | Delete
// Basename value set correctly.
[10061] Fix | Delete
return;
[10062] Fix | Delete
}
[10063] Fix | Delete
[10064] Fix | Delete
if ( $is_premium ) {
[10065] Fix | Delete
$this->_premium_plugin_basename = $basename;
[10066] Fix | Delete
} else {
[10067] Fix | Delete
$this->_free_plugin_basename = $basename;
[10068] Fix | Delete
}
[10069] Fix | Delete
[10070] Fix | Delete
$plugin_dir = dirname( $this->_plugin_dir_path ) . '/';
[10071] Fix | Delete
[10072] Fix | Delete
register_activation_hook(
[10073] Fix | Delete
$plugin_dir . $basename,
[10074] Fix | Delete
array( &$this, '_activate_plugin_event_hook' )
[10075] Fix | Delete
);
[10076] Fix | Delete
}
[10077] Fix | Delete
[10078] Fix | Delete
/**
[10079] Fix | Delete
* @author Vova Feldman (@svovaf)
[10080] Fix | Delete
* @since 1.1.1
[10081] Fix | Delete
* @since 2.2.1 If the context product is in its premium version, use the current module's basename, even if it was renamed.
[10082] Fix | Delete
*
[10083] Fix | Delete
* @return string
[10084] Fix | Delete
*/
[10085] Fix | Delete
function premium_plugin_basename() {
[10086] Fix | Delete
if ( ! isset( $this->_premium_plugin_basename ) ) {
[10087] Fix | Delete
$this->_premium_plugin_basename = $this->is_premium() ?
[10088] Fix | Delete
// The product is premium, so use the current basename.
[10089] Fix | Delete
$this->_plugin_basename :
[10090] Fix | Delete
$this->get_premium_slug() . '/' . basename( $this->_free_plugin_basename );
[10091] Fix | Delete
}
[10092] Fix | Delete
[10093] Fix | Delete
return $this->_premium_plugin_basename;
[10094] Fix | Delete
}
[10095] Fix | Delete
[10096] Fix | Delete
/**
[10097] Fix | Delete
* Uninstall plugin hook. Called only when connected his account with Freemius for active sites tracking.
[10098] Fix | Delete
*
[10099] Fix | Delete
* @author Vova Feldman (@svovaf)
[10100] Fix | Delete
* @since 1.0.2
[10101] Fix | Delete
*/
[10102] Fix | Delete
public static function _uninstall_plugin_hook() {
[10103] Fix | Delete
self::_load_required_static();
[10104] Fix | Delete
[10105] Fix | Delete
self::$_static_logger->entrance();
[10106] Fix | Delete
[10107] Fix | Delete
if ( ! current_user_can( 'activate_plugins' ) ) {
[10108] Fix | Delete
return;
[10109] Fix | Delete
}
[10110] Fix | Delete
[10111] Fix | Delete
$plugin_file = substr( current_filter(), strlen( 'uninstall_' ) );
[10112] Fix | Delete
[10113] Fix | Delete
self::$_static_logger->info( 'plugin = ' . $plugin_file );
[10114] Fix | Delete
[10115] Fix | Delete
define( 'WP_FS__UNINSTALL_MODE', true );
[10116] Fix | Delete
[10117] Fix | Delete
$fs = self::get_instance_by_file( $plugin_file );
[10118] Fix | Delete
[10119] Fix | Delete
if ( is_object( $fs ) ) {
[10120] Fix | Delete
$fs->remove_sdk_reference();
[10121] Fix | Delete
[10122] Fix | Delete
self::require_plugin_essentials();
[10123] Fix | Delete
[10124] Fix | Delete
if ( is_plugin_active( $fs->_free_plugin_basename ) ||
[10125] Fix | Delete
is_plugin_active( $fs->premium_plugin_basename() )
[10126] Fix | Delete
) {
[10127] Fix | Delete
// Deleting Free or Premium plugin version while the other version still installed.
[10128] Fix | Delete
return;
[10129] Fix | Delete
}
[10130] Fix | Delete
[10131] Fix | Delete
if (
[10132] Fix | Delete
! $fs->is_clone() &&
[10133] Fix | Delete
/**
[10134] Fix | Delete
* If there's a context install, run this method only when there's also a context user (e.g., when cloning a subsite of a multisite network into a single-site installation, it's possible for an install to be associated with a non-existing user entity; we want Freemius to be off in this case, while we are trying to recover the user).
[10135] Fix | Delete
*
[10136] Fix | Delete
* @author Leo Fajardo
[10137] Fix | Delete
*/
[10138] Fix | Delete
( ! is_object( $fs->_site ) || $fs->is_registered() )
[10139] Fix | Delete
) {
[10140] Fix | Delete
$fs->_uninstall_plugin_event();
[10141] Fix | Delete
}
[10142] Fix | Delete
[10143] Fix | Delete
$fs->do_action( 'after_uninstall' );
[10144] Fix | Delete
}
[10145] Fix | Delete
}
[10146] Fix | Delete
[10147] Fix | Delete
#----------------------------------------------------------------------------------
[10148] Fix | Delete
#region Plugin Information
[10149] Fix | Delete
#----------------------------------------------------------------------------------
[10150] Fix | Delete
[10151] Fix | Delete
/**
[10152] Fix | Delete
* Load WordPress core plugin.php essential module.
[10153] Fix | Delete
*
[10154] Fix | Delete
* @author Vova Feldman (@svovaf)
[10155] Fix | Delete
* @since 1.1.1
[10156] Fix | Delete
*/
[10157] Fix | Delete
private static function require_plugin_essentials() {
[10158] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[10159] Fix | Delete
self::$_static_logger->log( 'Including wp-admin/includes/plugin.php...' );
[10160] Fix | Delete
[10161] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[10162] Fix | Delete
}
[10163] Fix | Delete
}
[10164] Fix | Delete
[10165] Fix | Delete
/**
[10166] Fix | Delete
* Load WordPress core pluggable.php module.
[10167] Fix | Delete
*
[10168] Fix | Delete
* @author Vova Feldman (@svovaf)
[10169] Fix | Delete
* @since 1.1.2
[10170] Fix | Delete
*/
[10171] Fix | Delete
private static function require_pluggable_essentials() {
[10172] Fix | Delete
if ( ! function_exists( 'wp_get_current_user' ) ) {
[10173] Fix | Delete
require_once ABSPATH . 'wp-includes/pluggable.php';
[10174] Fix | Delete
}
[10175] Fix | Delete
}
[10176] Fix | Delete
[10177] Fix | Delete
/**
[10178] Fix | Delete
* Return plugin data.
[10179] Fix | Delete
*
[10180] Fix | Delete
* @author Vova Feldman (@svovaf)
[10181] Fix | Delete
* @since 1.0.1
[10182] Fix | Delete
*
[10183] Fix | Delete
* @param bool $reparse_plugin_metadata
[10184] Fix | Delete
*
[10185] Fix | Delete
* @return array
[10186] Fix | Delete
*/
[10187] Fix | Delete
function get_plugin_data( $reparse_plugin_metadata = false ) {
[10188] Fix | Delete
if ( ! isset( $this->_plugin_data ) || $reparse_plugin_metadata ) {
[10189] Fix | Delete
self::require_plugin_essentials();
[10190] Fix | Delete
[10191] Fix | Delete
if ( $this->is_plugin() ) {
[10192] Fix | Delete
/**
[10193] Fix | Delete
* @author Vova Feldman (@svovaf)
[10194] Fix | Delete
* @since 1.2.0 When using get_plugin_data() do NOT translate plugin data.
[10195] Fix | Delete
*
[10196] Fix | Delete
* @link https://github.com/Freemius/wordpress-sdk/issues/77
[10197] Fix | Delete
*/
[10198] Fix | Delete
$plugin_data = get_plugin_data(
[10199] Fix | Delete
$this->_plugin_main_file_path,
[10200] Fix | Delete
false,
[10201] Fix | Delete
false
[10202] Fix | Delete
);
[10203] Fix | Delete
} else {
[10204] Fix | Delete
$theme_data = wp_get_theme();
[10205] Fix | Delete
[10206] Fix | Delete
if ( $this->_plugin_basename !== $theme_data->get_stylesheet() && is_child_theme() ) {
[10207] Fix | Delete
$parent_theme = $theme_data->parent();
[10208] Fix | Delete
[10209] Fix | Delete
if ( ( $parent_theme instanceof WP_Theme ) && $this->_plugin_basename === $parent_theme->get_stylesheet() ) {
[10210] Fix | Delete
$theme_data = $parent_theme;
[10211] Fix | Delete
}
[10212] Fix | Delete
}
[10213] Fix | Delete
[10214] Fix | Delete
$plugin_data = array(
[10215] Fix | Delete
'Name' => $theme_data->get( 'Name' ),
[10216] Fix | Delete
'Version' => $theme_data->get( 'Version' ),
[10217] Fix | Delete
'Author' => $theme_data->get( 'Author' ),
[10218] Fix | Delete
'Description' => $theme_data->get( 'Description' ),
[10219] Fix | Delete
'PluginURI' => $theme_data->get( 'ThemeURI' ),
[10220] Fix | Delete
);
[10221] Fix | Delete
}
[10222] Fix | Delete
[10223] Fix | Delete
$this->_plugin_data = $plugin_data;
[10224] Fix | Delete
}
[10225] Fix | Delete
[10226] Fix | Delete
return $this->_plugin_data;
[10227] Fix | Delete
}
[10228] Fix | Delete
[10229] Fix | Delete
/**
[10230] Fix | Delete
* @author Vova Feldman (@svovaf)
[10231] Fix | Delete
* @since 1.0.1
[10232] Fix | Delete
* @since 1.2.2.5 If slug not set load slug by module ID.
[10233] Fix | Delete
*
[10234] Fix | Delete
* @return string Plugin slug.
[10235] Fix | Delete
*/
[10236] Fix | Delete
function get_slug() {
[10237] Fix | Delete
if ( ! isset( $this->_slug ) ) {
[10238] Fix | Delete
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
[10239] Fix | Delete
$this->_slug = $id_slug_type_path_map[ $this->_module_id ]['slug'];
[10240] Fix | Delete
}
[10241] Fix | Delete
[10242] Fix | Delete
return $this->_slug;
[10243] Fix | Delete
}
[10244] Fix | Delete
[10245] Fix | Delete
/**
[10246] Fix | Delete
* @author Leo Fajardo (@leorw)
[10247] Fix | Delete
* @since 2.2.1
[10248] Fix | Delete
*
[10249] Fix | Delete
* @return string
[10250] Fix | Delete
*/
[10251] Fix | Delete
function get_premium_slug() {
[10252] Fix | Delete
return ( is_object( $this->_plugin ) && ! empty( $this->_plugin->premium_slug ) ) ?
[10253] Fix | Delete
$this->_plugin->premium_slug :
[10254] Fix | Delete
"{$this->_slug}-premium";
[10255] Fix | Delete
}
[10256] Fix | Delete
[10257] Fix | Delete
/**
[10258] Fix | Delete
* Retrieve the desired folder name for the product.
[10259] Fix | Delete
*
[10260] Fix | Delete
* @author Vova Feldman (@svovaf)
[10261] Fix | Delete
* @since 1.2.1.7
[10262] Fix | Delete
*
[10263] Fix | Delete
* @return string Plugin slug.
[10264] Fix | Delete
*/
[10265] Fix | Delete
function get_target_folder_name() {
[10266] Fix | Delete
return $this->can_use_premium_code() ?
[10267] Fix | Delete
$this->_plugin->premium_slug :
[10268] Fix | Delete
$this->_slug;
[10269] Fix | Delete
}
[10270] Fix | Delete
[10271] Fix | Delete
/**
[10272] Fix | Delete
* @author Vova Feldman (@svovaf)
[10273] Fix | Delete
* @since 1.0.1
[10274] Fix | Delete
*
[10275] Fix | Delete
* @return number Plugin ID.
[10276] Fix | Delete
*/
[10277] Fix | Delete
function get_id() {
[10278] Fix | Delete
return $this->_plugin->id;
[10279] Fix | Delete
}
[10280] Fix | Delete
[10281] Fix | Delete
/**
[10282] Fix | Delete
* @author Leo Fajardo (@leorw)
[10283] Fix | Delete
* @since 2.2.4
[10284] Fix | Delete
*
[10285] Fix | Delete
* @return number|null Bundle ID.
[10286] Fix | Delete
*/
[10287] Fix | Delete
function get_bundle_id() {
[10288] Fix | Delete
return ( isset( $this->_plugin->bundle_id ) && FS_Plugin::is_valid_id( $this->_plugin->bundle_id ) ) ?
[10289] Fix | Delete
$this->_plugin->bundle_id :
[10290] Fix | Delete
null;
[10291] Fix | Delete
}
[10292] Fix | Delete
[10293] Fix | Delete
/**
[10294] Fix | Delete
* @author Vova Feldman (@svovaf)
[10295] Fix | Delete
* @since 2.3.1
[10296] Fix | Delete
*
[10297] Fix | Delete
* @return string|null Bundle public key.
[10298] Fix | Delete
*/
[10299] Fix | Delete
function get_bundle_public_key() {
[10300] Fix | Delete
return isset( $this->_plugin->bundle_public_key ) ?
[10301] Fix | Delete
$this->_plugin->bundle_public_key :
[10302] Fix | Delete
null;
[10303] Fix | Delete
}
[10304] Fix | Delete
[10305] Fix | Delete
/**
[10306] Fix | Delete
* Get whether the SDK has been initiated in the context of a Bundle.
[10307] Fix | Delete
*
[10308] Fix | Delete
* This will return true, if `bundle_id` is present in the SDK init parameters.
[10309] Fix | Delete
*
[10310] Fix | Delete
* ```php
[10311] Fix | Delete
* $my_fs = fs_dynamic_init( array(
[10312] Fix | Delete
* // ...
[10313] Fix | Delete
* 'bundle_id' => 'XXXX', // Will return true since we have bundle id.
[10314] Fix | Delete
* 'bundle_public_key' => 'pk_XXXX',
[10315] Fix | Delete
* ) );
[10316] Fix | Delete
* ```
[10317] Fix | Delete
*
[10318] Fix | Delete
* @author Swashata Ghosh (@swashata)
[10319] Fix | Delete
* @since 2.5.0
[10320] Fix | Delete
*
[10321] Fix | Delete
* @return bool True if we are running in bundle context, false otherwise.
[10322] Fix | Delete
*/
[10323] Fix | Delete
private function has_bundle_context() {
[10324] Fix | Delete
return ! is_null( $this->get_bundle_id() );
[10325] Fix | Delete
}
[10326] Fix | Delete
[10327] Fix | Delete
/**
[10328] Fix | Delete
* @author Vova Feldman (@svovaf)
[10329] Fix | Delete
* @since 1.2.1.5
[10330] Fix | Delete
*
[10331] Fix | Delete
* @return string Freemius SDK version
[10332] Fix | Delete
*/
[10333] Fix | Delete
function get_sdk_version() {
[10334] Fix | Delete
return $this->version;
[10335] Fix | Delete
}
[10336] Fix | Delete
[10337] Fix | Delete
/**
[10338] Fix | Delete
* @author Vova Feldman (@svovaf)
[10339] Fix | Delete
* @since 1.2.1.5
[10340] Fix | Delete
*
[10341] Fix | Delete
* @return number Parent plugin ID (if parent exist).
[10342] Fix | Delete
*/
[10343] Fix | Delete
function get_parent_id() {
[10344] Fix | Delete
return $this->is_addon() ?
[10345] Fix | Delete
$this->get_parent_instance()->get_id() :
[10346] Fix | Delete
$this->_plugin->id;
[10347] Fix | Delete
}
[10348] Fix | Delete
[10349] Fix | Delete
/**
[10350] Fix | Delete
* @author Vova Feldman (@svovaf)
[10351] Fix | Delete
* @since 2.3.1
[10352] Fix | Delete
*
[10353] Fix | Delete
* @return string
[10354] Fix | Delete
*/
[10355] Fix | Delete
function get_usage_tracking_terms_url() {
[10356] Fix | Delete
return $this->apply_filters(
[10357] Fix | Delete
'usage_tracking_terms_url',
[10358] Fix | Delete
"https://freemius.com/product/opt-in/{$this->_plugin->id}/{$this->_slug}/"
[10359] Fix | Delete
);
[10360] Fix | Delete
}
[10361] Fix | Delete
[10362] Fix | Delete
/**
[10363] Fix | Delete
* @todo (For LiteSDK) We can refactor this and other related functions giving links to several landing pages on freemius.com to come from a separate class like `FS_Terms_Pages`. This would get a `FS_WP_Hook` (hypothetical) instance as a dependency and use it to hook into the `license_activation_terms_url` or related filters. The entry level instance from `ms_fs()` would hold a public read-only variable `my_fs()->terms_pages` which would be an instance of `FS_Terms_Pages` and would hold all the links to the terms pages.
[10364] Fix | Delete
* @since 2.5.8
[10365] Fix | Delete
*
[10366] Fix | Delete
* @return string
[10367] Fix | Delete
*/
[10368] Fix | Delete
function get_license_activation_terms_url() {
[10369] Fix | Delete
return $this->apply_filters(
[10370] Fix | Delete
'license_activation_terms_url',
[10371] Fix | Delete
"https://freemius.com/product/license-activation/{$this->_plugin->id}/{$this->_slug}/"
[10372] Fix | Delete
);
[10373] Fix | Delete
}
[10374] Fix | Delete
[10375] Fix | Delete
/**
[10376] Fix | Delete
* @author Vova Feldman (@svovaf)
[10377] Fix | Delete
* @since 2.3.1
[10378] Fix | Delete
*
[10379] Fix | Delete
* @return string
[10380] Fix | Delete
*/
[10381] Fix | Delete
function get_eula_url() {
[10382] Fix | Delete
return $this->apply_filters(
[10383] Fix | Delete
'eula_url',
[10384] Fix | Delete
"https://freemius.com/product/{$this->_plugin->id}/{$this->_slug}/legal/eula/"
[10385] Fix | Delete
);
[10386] Fix | Delete
}
[10387] Fix | Delete
[10388] Fix | Delete
/**
[10389] Fix | Delete
* @author Vova Feldman (@svovaf)
[10390] Fix | Delete
* @since 1.0.1
[10391] Fix | Delete
*
[10392] Fix | Delete
* @return string Plugin public key.
[10393] Fix | Delete
*/
[10394] Fix | Delete
function get_public_key() {
[10395] Fix | Delete
return $this->_plugin->public_key;
[10396] Fix | Delete
}
[10397] Fix | Delete
[10398] Fix | Delete
/**
[10399] Fix | Delete
* Will be available only on sandbox mode.
[10400] Fix | Delete
*
[10401] Fix | Delete
* @author Vova Feldman (@svovaf)
[10402] Fix | Delete
* @since 1.0.4
[10403] Fix | Delete
*
[10404] Fix | Delete
* @return mixed Plugin secret key.
[10405] Fix | Delete
*/
[10406] Fix | Delete
function get_secret_key() {
[10407] Fix | Delete
return $this->_plugin->secret_key;
[10408] Fix | Delete
}
[10409] Fix | Delete
[10410] Fix | Delete
/**
[10411] Fix | Delete
* @author Vova Feldman (@svovaf)
[10412] Fix | Delete
* @since 1.1.1
[10413] Fix | Delete
*
[10414] Fix | Delete
* @return bool
[10415] Fix | Delete
*/
[10416] Fix | Delete
function has_secret_key() {
[10417] Fix | Delete
return ! empty( $this->_plugin->secret_key );
[10418] Fix | Delete
}
[10419] Fix | Delete
[10420] Fix | Delete
/**
[10421] Fix | Delete
* @author Vova Feldman (@svovaf)
[10422] Fix | Delete
* @since 1.0.9
[10423] Fix | Delete
*
[10424] Fix | Delete
* @param string|bool $premium_suffix
[10425] Fix | Delete
*
[10426] Fix | Delete
* @return string
[10427] Fix | Delete
*/
[10428] Fix | Delete
function get_plugin_name( $premium_suffix = false ) {
[10429] Fix | Delete
$this->_logger->entrance();
[10430] Fix | Delete
[10431] Fix | Delete
/**
[10432] Fix | Delete
* This `if-else` can be squeezed into a single `if` but I intentionally split it for code readability.
[10433] Fix | Delete
*
[10434] Fix | Delete
* @author Vova Feldman
[10435] Fix | Delete
*/
[10436] Fix | Delete
if ( ! isset( $this->_plugin_name ) ) {
[10437] Fix | Delete
// Name is not yet set.
[10438] Fix | Delete
$this->set_name( $premium_suffix );
[10439] Fix | Delete
} else if (
[10440] Fix | Delete
! empty( $premium_suffix ) &&
[10441] Fix | Delete
( ! is_object( $this->_plugin ) || $this->_plugin->premium_suffix !== $premium_suffix )
[10442] Fix | Delete
) {
[10443] Fix | Delete
// Name is already set, but there's a change in the premium suffix.
[10444] Fix | Delete
$this->set_name( $premium_suffix );
[10445] Fix | Delete
}
[10446] Fix | Delete
[10447] Fix | Delete
return $this->_plugin_name;
[10448] Fix | Delete
}
[10449] Fix | Delete
[10450] Fix | Delete
/**
[10451] Fix | Delete
* Calculates and stores the product's name. This helper function was created specifically for get_plugin_name() just to make the code clearer.
[10452] Fix | Delete
*
[10453] Fix | Delete
* @author Vova Feldman (@svovaf)
[10454] Fix | Delete
* @since 2.2.1
[10455] Fix | Delete
*
[10456] Fix | Delete
* @param string $premium_suffix
[10457] Fix | Delete
*/
[10458] Fix | Delete
private function set_name( $premium_suffix = '' ) {
[10459] Fix | Delete
$plugin_data = $this->get_plugin_data();
[10460] Fix | Delete
[10461] Fix | Delete
// Get name.
[10462] Fix | Delete
$this->_plugin_name = $plugin_data['Name'];
[10463] Fix | Delete
[10464] Fix | Delete
if ( is_string( $premium_suffix ) ) {
[10465] Fix | Delete
$premium_suffix = trim( $premium_suffix );
[10466] Fix | Delete
[10467] Fix | Delete
if ( ! empty( $premium_suffix ) ) {
[10468] Fix | Delete
// Check if plugin name contains " (premium)" or a custom suffix and remove it.
[10469] Fix | Delete
$suffix = ( ' ' . strtolower( $premium_suffix ) );
[10470] Fix | Delete
$suffix_len = strlen( $suffix );
[10471] Fix | Delete
[10472] Fix | Delete
if ( strlen( $plugin_data['Name'] ) > $suffix_len &&
[10473] Fix | Delete
$suffix === substr( strtolower( $plugin_data['Name'] ), - $suffix_len )
[10474] Fix | Delete
) {
[10475] Fix | Delete
$this->_plugin_name = substr( $plugin_data['Name'], 0, - $suffix_len );
[10476] Fix | Delete
}
[10477] Fix | Delete
}
[10478] Fix | Delete
}
[10479] Fix | Delete
[10480] Fix | Delete
$this->_logger->departure( 'Name = ' . $this->_plugin_name );
[10481] Fix | Delete
}
[10482] Fix | Delete
[10483] Fix | Delete
/**
[10484] Fix | Delete
* @author Vova Feldman (@svovaf)
[10485] Fix | Delete
* @since 1.0.0
[10486] Fix | Delete
*
[10487] Fix | Delete
* @param bool $reparse_plugin_metadata
[10488] Fix | Delete
*
[10489] Fix | Delete
* @return string
[10490] Fix | Delete
*/
[10491] Fix | Delete
function get_plugin_version( $reparse_plugin_metadata = false ) {
[10492] Fix | Delete
$this->_logger->entrance();
[10493] Fix | Delete
[10494] Fix | Delete
$plugin_data = $this->get_plugin_data( $reparse_plugin_metadata );
[10495] Fix | Delete
[10496] Fix | Delete
$this->_logger->departure( 'Version = ' . $plugin_data['Version'] );
[10497] Fix | Delete
[10498] Fix | Delete
return $this->apply_filters( 'plugin_version', $plugin_data['Version'] );
[10499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function