Skip to content

Commit c049a44

Browse files
chore: updated Freemius SDK to 2.11.0
1 parent 1ce7b71 commit c049a44

File tree

10 files changed

+64
-44
lines changed

10 files changed

+64
-44
lines changed

freemius/assets/css/admin/common.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

freemius/assets/js/pricing/freemius-pricing.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

freemius/includes/class-freemius.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24000,13 +24000,15 @@ function _add_trial_notice() {
2400024000

2400124001
// Start trial button.
2400224002
$button = ' ' . sprintf(
24003-
'<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
24003+
'<div><a class="button button-primary" href="%s">%s &nbsp;&#10140;</a></div>',
2400424004
$trial_url,
2400524005
$this->get_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial' )
2400624006
);
2400724007

24008+
$message_text = $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string}" );
24009+
2400824010
$this->_admin_notices->add_sticky(
24009-
$this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
24011+
"<div class=\"fs-trial-message-container\"><div>{$message_text}</div> {$button}</div>",
2401024012
'trial_promotion',
2401124013
'',
2401224014
'promotion'
@@ -25476,7 +25478,7 @@ function get_local_icon_url() {
2547625478
$img_dir = WP_FS__DIR_IMG;
2547725479

2547825480
// Locate the main assets folder.
25479-
if ( 1 < count( $fs_active_plugins->plugins ) ) {
25481+
if ( ! empty( $fs_active_plugins->plugins ) ) {
2548025482
$plugin_or_theme_img_dir = ( $this->is_plugin() ? WP_PLUGIN_DIR : get_theme_root( get_stylesheet() ) );
2548125483

2548225484
foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {

freemius/includes/class-fs-plugin-updater.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -542,24 +542,8 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
542542

543543
global $wp_current_filter;
544544

545-
$current_plugin_version = $this->_fs->get_plugin_version();
546-
547-
if ( ! empty( $wp_current_filter ) && 'upgrader_process_complete' === $wp_current_filter[0] ) {
548-
if (
549-
is_null( $this->_update_details ) ||
550-
( is_object( $this->_update_details ) && $this->_update_details->new_version !== $current_plugin_version )
551-
) {
552-
/**
553-
* After an update, clear the stored update details and reparse the plugin's main file in order to get
554-
* the updated version's information and prevent the previous update information from showing up on the
555-
* updates page.
556-
*
557-
* @author Leo Fajardo (@leorw)
558-
* @since 2.3.1
559-
*/
560-
$this->_update_details = null;
561-
$current_plugin_version = $this->_fs->get_plugin_version( true );
562-
}
545+
if ( ! empty( $wp_current_filter ) && in_array( 'upgrader_process_complete', $wp_current_filter ) ) {
546+
return $transient_data;
563547
}
564548

565549
if ( ! isset( $this->_update_details ) ) {
@@ -568,7 +552,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
568552
false,
569553
fs_request_get_bool( 'force-check' ),
570554
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
571-
$current_plugin_version
555+
$this->_fs->get_plugin_version()
572556
);
573557

574558
$this->_update_details = false;

freemius/includes/entities/class-fs-plugin-plan.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/**
1414
* Class FS_Plugin_Plan
1515
*
16-
* @property FS_Pricing[] $pricing
1716
*/
1817
class FS_Plugin_Plan extends FS_Entity {
1918

freemius/includes/entities/class-fs-site.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
exit;
1111
}
1212

13-
/**
14-
* @property int $blog_id
15-
*/
16-
#[AllowDynamicProperties]
1713
class FS_Site extends FS_Scope_Entity {
1814
/**
1915
* @var number
2016
*/
2117
public $site_id;
18+
/**
19+
* @var int
20+
*/
21+
public $blog_id;
2222
/**
2323
* @var number
2424
*/

freemius/includes/entities/class-fs-user.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ class FS_User extends FS_Scope_Entity {
3838
* @var float
3939
*/
4040
public $gross;
41-
/**
42-
* @var bool
43-
*/
44-
public $is_beta;
4541

4642
#endregion Properties
4743

@@ -52,6 +48,19 @@ function __construct( $user = false ) {
5248
parent::__construct( $user );
5349
}
5450

51+
/**
52+
* This method removes the deprecated 'is_beta' property from the serialized data.
53+
* Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
54+
*
55+
* @return void
56+
*/
57+
function __wakeup() {
58+
if ( property_exists( $this, 'is_beta' ) ) {
59+
// If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution.
60+
unset( $this->is_beta );
61+
}
62+
}
63+
5564
function get_name() {
5665
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
5766
}

freemius/includes/managers/class-fs-admin-menu-manager.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,36 @@ function main_menu_url() {
699699
$menu = $this->find_main_submenu();
700700
}
701701

702+
$menu_slug = $menu['menu'][2];
702703
$parent_slug = isset( $menu['parent_slug'] ) ?
703-
$menu['parent_slug'] :
704-
'admin.php';
705-
706-
return admin_url(
707-
$parent_slug .
708-
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
709-
'page=' .
710-
$menu['menu'][2]
711-
);
704+
$menu['parent_slug'] :
705+
'admin.php';
706+
707+
if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) {
708+
$parent_slug = 'admin.php';
709+
710+
/**
711+
* This line and the `if` block below it are based on the `menu_page_url()` function of WordPress.
712+
*
713+
* @author Leo Fajardo (@leorw)
714+
* @since 2.10.2
715+
*/
716+
global $_parent_pages;
717+
718+
if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
719+
$_parent_slug = $_parent_pages[ $menu_slug ];
720+
$parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ?
721+
$parent_slug :
722+
$menu['parent_slug'];
723+
}
724+
}
725+
726+
return admin_url(
727+
$parent_slug .
728+
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
729+
'page=' .
730+
$menu_slug
731+
);
712732
}
713733

714734
/**

freemius/includes/managers/class-fs-admin-notice-manager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,14 @@ function dismiss_notice_ajax_callback() {
194194
* @since 1.0.7
195195
*/
196196
static function _add_sticky_dismiss_javascript() {
197+
$sticky_admin_notice_js_template_name = 'sticky-admin-notice-js.php';
198+
199+
if ( ! file_exists( fs_get_template_path( $sticky_admin_notice_js_template_name ) ) ) {
200+
return;
201+
}
202+
197203
$params = array();
198-
fs_require_once_template( 'sticky-admin-notice-js.php', $params );
204+
fs_require_once_template( $sticky_admin_notice_js_template_name, $params );
199205
}
200206

201207
private static $_added_sticky_javascript = false;

freemius/start.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @var string
1717
*/
18-
$this_sdk_version = '2.10.1';
18+
$this_sdk_version = '2.11.0';
1919

2020
#region SDK Selection Logic --------------------------------------------------------------------
2121

0 commit comments

Comments
 (0)