Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.11.0 #784

Merged
merged 12 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/admin/common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/pricing/freemius-pricing.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions assets/scss/admin/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ body.fs-loading {
{
margin: .5em 0;
padding: 2px;

.fs-trial-message-container
{
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 5px;
}
}

.fs-close
Expand Down
8 changes: 5 additions & 3 deletions includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -24000,13 +24000,15 @@ function _add_trial_notice() {

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

$message_text = $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string}" );

$this->_admin_notices->add_sticky(
$this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
"<div class=\"fs-trial-message-container\"><div>{$message_text}</div> {$button}</div>",
'trial_promotion',
'',
'promotion'
Expand Down Expand Up @@ -25476,7 +25478,7 @@ function get_local_icon_url() {
$img_dir = WP_FS__DIR_IMG;

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

foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
Expand Down
22 changes: 3 additions & 19 deletions includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,24 +542,8 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {

global $wp_current_filter;

$current_plugin_version = $this->_fs->get_plugin_version();

if ( ! empty( $wp_current_filter ) && 'upgrader_process_complete' === $wp_current_filter[0] ) {
if (
is_null( $this->_update_details ) ||
( is_object( $this->_update_details ) && $this->_update_details->new_version !== $current_plugin_version )
) {
/**
* After an update, clear the stored update details and reparse the plugin's main file in order to get
* the updated version's information and prevent the previous update information from showing up on the
* updates page.
*
* @author Leo Fajardo (@leorw)
* @since 2.3.1
*/
$this->_update_details = null;
$current_plugin_version = $this->_fs->get_plugin_version( true );
}
if ( ! empty( $wp_current_filter ) && in_array( 'upgrader_process_complete', $wp_current_filter ) ) {
return $transient_data;
}

if ( ! isset( $this->_update_details ) ) {
Expand All @@ -568,7 +552,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
false,
fs_request_get_bool( 'force-check' ),
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
$current_plugin_version
$this->_fs->get_plugin_version()
);

$this->_update_details = false;
Expand Down
1 change: 0 additions & 1 deletion includes/entities/class-fs-plugin-plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/**
* Class FS_Plugin_Plan
*
* @property FS_Pricing[] $pricing
*/
class FS_Plugin_Plan extends FS_Entity {

Expand Down
8 changes: 4 additions & 4 deletions includes/entities/class-fs-site.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
exit;
}

/**
* @property int $blog_id
*/
#[AllowDynamicProperties]
class FS_Site extends FS_Scope_Entity {
/**
* @var number
*/
public $site_id;
/**
* @var int
*/
public $blog_id;
/**
* @var number
*/
Expand Down
13 changes: 13 additions & 0 deletions includes/entities/class-fs-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ function __construct( $user = false ) {
parent::__construct( $user );
}

/**
* This method removes the deprecated 'is_beta' property from the serialized data.
* Should clean up the serialized data to avoid PHP 8.2 warning on next execution.
*
* @return void
*/
function __wakeup() {
if ( property_exists( $this, 'is_beta' ) ) {
// If we enter here, and we are running PHP 8.2, we already had the warning. But we sanitize data for next execution.
unset( $this->is_beta );
}
}

function get_name() {
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
}
Expand Down
38 changes: 29 additions & 9 deletions includes/managers/class-fs-admin-menu-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,36 @@ function main_menu_url() {
$menu = $this->find_main_submenu();
}

$menu_slug = $menu['menu'][2];
$parent_slug = isset( $menu['parent_slug'] ) ?
$menu['parent_slug'] :
'admin.php';

return admin_url(
$parent_slug .
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
'page=' .
$menu['menu'][2]
);
$menu['parent_slug'] :
'admin.php';

if ( fs_apply_filter( $this->_module_unique_affix, 'enable_cpt_advanced_menu_logic', false ) ) {
$parent_slug = 'admin.php';

/**
* This line and the `if` block below it are based on the `menu_page_url()` function of WordPress.
*
* @author Leo Fajardo (@leorw)
* @since 2.10.2
*/
global $_parent_pages;

if ( ! empty( $_parent_pages[ $menu_slug ] ) ) {
$_parent_slug = $_parent_pages[ $menu_slug ];
$parent_slug = isset( $_parent_pages[ $_parent_slug ] ) ?
$parent_slug :
$menu['parent_slug'];
}
}

return admin_url(
$parent_slug .
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
'page=' .
$menu_slug
);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion includes/managers/class-fs-admin-notice-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,14 @@ function dismiss_notice_ajax_callback() {
* @since 1.0.7
*/
static function _add_sticky_dismiss_javascript() {
$sticky_admin_notice_js_template_name = 'sticky-admin-notice-js.php';

if ( ! file_exists( fs_get_template_path( $sticky_admin_notice_js_template_name ) ) ) {
return;
}

$params = array();
fs_require_once_template( 'sticky-admin-notice-js.php', $params );
fs_require_once_template( $sticky_admin_notice_js_template_name, $params );
}

private static $_added_sticky_javascript = false;
Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.10.1';
$this_sdk_version = '2.11.0';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down