Skip to content

Commit

Permalink
Merge pull request #600 from Freemius/develop
Browse files Browse the repository at this point in the history
Develop - Version 2.5.3
  • Loading branch information
vovafeldman authored Dec 5, 2022
2 parents 35782eb + ce7d812 commit 2e56d68
Show file tree
Hide file tree
Showing 39 changed files with 2,271 additions and 1,999 deletions.
2 changes: 1 addition & 1 deletion assets/css/admin/add-ons.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/admin/add-ons.css.map

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

1 change: 1 addition & 0 deletions assets/scss/admin/add-ons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@

#section-holder {
margin-right: 299px;
clear: none;
}

#section-description
Expand Down
12 changes: 6 additions & 6 deletions includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -3648,7 +3648,7 @@ static function _add_debug_section() {
} else {
// Add hidden debug page.
$hook = FS_Admin_Menu_Manager::add_subpage(
null,
'',
$title,
$title,
'manage_options',
Expand Down Expand Up @@ -7315,12 +7315,12 @@ function _add_pending_activation_notice(

$this->_admin_notices->add_sticky(
sprintf(
$this->get_text_inline( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s.', 'pending-activation-message' ),
$this->get_text_inline( 'You should receive a confirmation email for %s to your mailbox at %s. Please make sure you click the button in that email to %s.', 'pending-activation-message' ),
'<b>' . $this->get_plugin_name() . '</b>',
'<b>' . $email . '</b>',
( $is_pending_trial ?
$this->get_text_inline( 'start the trial', 'start-the-trial' ) :
$this->get_text_inline( 'complete the install', 'complete-the-install' ) )
$this->get_text_inline( 'complete the opt-in', 'complete-the-opt-in' ) )
),
'activation_pending',
'Thanks!'
Expand Down Expand Up @@ -18975,7 +18975,7 @@ private function override_plugin_menu_with_activation() {
if ( ! $this->has_settings_menu() ) {
// Add the opt-in page without a menu item.
$hook = FS_Admin_Menu_Manager::add_subpage(
null,
'',
$this->get_plugin_name(),
$this->get_plugin_name(),
'manage_options',
Expand Down Expand Up @@ -19407,7 +19407,7 @@ private function embed_submenu_items() {
$hook = FS_Admin_Menu_Manager::add_subpage(
$item['show_submenu'] ?
$top_level_menu_slug :
null,
'',
$item['page_title'],
$menu_item,
$capability,
Expand All @@ -19422,7 +19422,7 @@ private function embed_submenu_items() {
FS_Admin_Menu_Manager::add_subpage(
$item['show_submenu'] ?
$top_level_menu_slug :
null,
'',
$item['page_title'],
$menu_item,
$capability,
Expand Down
43 changes: 32 additions & 11 deletions includes/class-fs-plugin-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function change_theme_update_info_html( $prepared_themes ) {

$themes_update = get_site_transient( 'update_themes' );
if ( ! isset( $themes_update->response[ $theme_basename ] ) ||
empty( $themes_update->response[ $theme_basename ]['package'] )
empty( $themes_update->response[ $theme_basename ]['package'] )
) {
return $prepared_themes;
}
Expand Down Expand Up @@ -636,7 +636,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
foreach ( $this->_translation_updates as $translation_update ) {
$lang = $translation_update['language'];
if ( ! isset( $current_plugin_translation_updates_map[ $lang ] ) ||
version_compare( $translation_update['version'], $current_plugin_translation_updates_map[ $lang ]['version'], '>' )
version_compare( $translation_update['version'], $current_plugin_translation_updates_map[ $lang ]['version'], '>' )
) {
$current_plugin_translation_updates_map[ $lang ] = $translation_update;
}
Expand All @@ -660,13 +660,14 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
* @return object
*/
function get_update_details( FS_Plugin_Tag $new_version ) {
$update = new stdClass();
$update->slug = $this->_fs->get_slug();
$update->new_version = $new_version->version;
$update->url = WP_FS__ADDRESS;
$update->package = $new_version->url;
$update->tested = $new_version->tested_up_to_version;
$update->requires = $new_version->requires_platform_version;
$update = new stdClass();
$update->slug = $this->_fs->get_slug();
$update->new_version = $new_version->version;
$update->url = WP_FS__ADDRESS;
$update->package = $new_version->url;
$update->tested = self::get_tested_wp_version( $new_version->tested_up_to_version );
$update->requires = $new_version->requires_platform_version;
$update->requires_php = $new_version->requires_programming_language_version;

$icon = $this->_fs->get_local_icon_url();

Expand Down Expand Up @@ -808,9 +809,9 @@ function delete_update_data() {
$basename = $this->_fs->get_plugin_basename();

if ( ! is_object( $transient_data ) ||
! isset( $transient_data->response ) ||
! isset( $transient_data->response ) ||
! is_array( $transient_data->response ) ||
empty( $transient_data->response[ $basename ] )
empty( $transient_data->response[ $basename ] )
) {
return;
}
Expand Down Expand Up @@ -1095,6 +1096,7 @@ function plugins_api_filter( $data, $action = '', $args = null ) {
if ( ! $plugin_in_repo ) {
$data->last_updated = ! is_null( $new_version->updated ) ? $new_version->updated : $new_version->created;
$data->requires = $new_version->requires_platform_version;
$data->requires_php = $new_version->requires_programming_language_version;
$data->tested = $new_version->tested_up_to_version;
}

Expand Down Expand Up @@ -1148,9 +1150,28 @@ function plugins_api_filter( $data, $action = '', $args = null ) {
}
}

if ( ! empty( $data->tested ) ) {
$data->tested = self::get_tested_wp_version( $data->tested );
}

return $data;
}

/**
* @since 2.5.3 If the current WordPress version is a patch of the tested version (e.g., 6.1.2 is a patch of 6.1), then override the tested version with the patch so developers won't need to release a new version just to bump the latest supported WP version.
*
* @param string|null $tested_up_to
*
* @return string|null
*/
private static function get_tested_wp_version( $tested_up_to ) {
$current_wp_version = get_bloginfo( 'version' );

return ( ! empty($tested_up_to) && fs_starts_with( $current_wp_version, $tested_up_to . '.' ) ) ?
$current_wp_version :
$tested_up_to;
}

/**
* @author Vova Feldman (@svovaf)
* @since 1.2.1.7
Expand Down
4 changes: 4 additions & 0 deletions includes/entities/class-fs-plugin-tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class FS_Plugin_Tag extends FS_Entity {
* @var string
*/
public $requires_platform_version;
/**
* @var string
*/
public $requires_programming_language_version;
/**
* @var string
*/
Expand Down
57 changes: 54 additions & 3 deletions includes/fs-plugin-info-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ function _get_addon_info_filter( $data, $action = '', $args = null ) {
$data->version = $latest->version;
$data->last_updated = $latest->created;
$data->requires = $latest->requires_platform_version;
$data->requires_php = $latest->requires_programming_language_version;
$data->tested = $latest->tested_up_to_version;
} else if ( ! empty( $current_addon_version ) ) {
$data->version = $current_addon_version;
Expand Down Expand Up @@ -1344,7 +1345,10 @@ class="fs-annual-discount"><?php printf(
?>
<li>
<strong><?php fs_esc_html_echo_inline( 'Requires WordPress Version', 'requires-wordpress-version', $api->slug ) ?>
:</strong> <?php echo esc_html( sprintf( fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires ) ) ?>
:</strong> <?php echo esc_html( sprintf(
/* translators: %s: Version number. */
fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires )
) ?>
</li>
<?php
}
Expand All @@ -1356,6 +1360,19 @@ class="fs-annual-discount"><?php printf(
</li>
<?php
}
if ( ! empty( $api->requires_php ) ) {
?>
<li>
<strong><?php fs_esc_html_echo_inline( 'Requires PHP Version', 'requires-php-version', $api->slug ); ?>:</strong>
<?php
echo esc_html( sprintf(
/* translators: %s: Version number. */
fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires_php )
);
?>
</li>
<?php
}
if ( ! empty( $api->downloaded ) ) {
?>
<li>
Expand Down Expand Up @@ -1485,9 +1502,43 @@ class="fs-annual-discount"><?php printf(
</div>
<div id="section-holder" class="wrap">
<?php
if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
$requires_php = isset( $api->requires_php ) ? $api->requires_php : null;
$requires_wp = isset( $api->requires ) ? $api->requires : null;

$compatible_php = empty( $requires_php ) || version_compare( PHP_VERSION, $requires_php, '>=' );

// Strip off any -alpha, -RC, -beta, -src suffixes.
list( $wp_version ) = explode( '-', $GLOBALS['wp_version'] );

$compatible_wp = empty( $requires_wp ) || version_compare( $wp_version, $requires_wp, '>=' );
$tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) );

if ( ! $compatible_php ) {
echo '<div class="notice notice-error notice-alt"><p><strong>' . fs_text_inline( 'Error', 'error', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin requires a newer version of PHP.', 'newer-php-required-error', $api->slug );

if ( current_user_can( 'update_php' ) ) {
$wp_get_update_php_url = function_exists( 'wp_get_update_php_url' ) ?
wp_get_update_php_url() :
'https://wordpress.org/support/update-php/';

printf(
/* translators: %s: URL to Update PHP page. */
' ' . fs_text_inline( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.', 'php-update-learn-more-link', $api->slug ),
esc_url( $wp_get_update_php_url )
);

if ( function_exists( 'wp_update_php_annotation' ) ) {
wp_update_php_annotation( '</p><p><em>', '</em>' );
}
} else {
echo '</p>';
}
echo '</div>';
}

if ( ! $tested_wp ) {
echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been tested with your current version of WordPress.', 'not-tested-warning', $api->slug ) . '</p></div>';
} else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
} else if ( ! $compatible_wp ) {
echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been marked as compatible with your version of WordPress.', 'not-compatible-warning', $api->slug ) . '</p></div>';
}

Expand Down
Binary file modified languages/freemius-cs_CZ.mo
Binary file not shown.
Loading

0 comments on commit 2e56d68

Please sign in to comment.