Skip to content

Commit 5475ede

Browse files
Merge branch 'develop' into feat/block-styles
# Conflicts: # src/plugins/global-settings/color-schemes/index.js # src/plugins/global-settings/editor-loader.js
2 parents 6a250cb + 37f4935 commit 5475ede

File tree

53 files changed

+6596
-4611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6596
-4611
lines changed

freemius/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if ( ! function_exists( 'my_prefix_fs' ) ) {
9393

9494
## Usage example
9595

96-
You can call anySDK methods by prefixing them with the shortcode function for your particular plugin/theme (specified when completing the SDK integration form in the Developer Dashboard):
96+
You can call any SDK methods by prefixing them with the shortcode function for your particular plugin/theme (specified when completing the SDK integration form in the Developer Dashboard):
9797

9898
```php
9999
<?php my_prefix_fs()->get_upgrade_url(); ?>
@@ -110,9 +110,9 @@ Or when calling Freemius multiple times in a scope, it's recommended to use it w
110110

111111
There are many other SDK methods available that you can use to enhance the functionality of your WordPress product. Some of the more common use-cases are covered in the [Freemius SDK Gists](https://freemius.com/help/documentation/wordpress-sdk/gists/) documentation.
112112

113-
## Adding license based logic examples
113+
## Adding license-based logic examples
114114

115-
Add marketing content to encourage your users to upgrade for your paid version:
115+
Add marketing content that encourages your users to upgrade to a paid version:
116116

117117
```php
118118
<?php
@@ -139,7 +139,7 @@ Add logic which will only be available in your premium plugin version:
139139
?>
140140
```
141141

142-
To add a function which will only be available in your premium plugin version, simply add __premium_only as the suffix of the function name. Just make sure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:
142+
To add a function which will only be available in your premium plugin version, add `__premium_only` as the suffix of the function name. Ensure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:
143143

144144
```php
145145
<?php
@@ -234,7 +234,7 @@ Add logic for specified paid plan:
234234
## Excluding files and folders from the free plugin version
235235
There are [two ways](https://freemius.com/help/documentation/wordpress-sdk/software-licensing/#excluding_files_and_folders_from_the_free_plugin_version) to exclude files from your free version.
236236

237-
1. Add `__premium_only` just before the file extension. For example, functions__premium_only.php will be only included in the premium plugin version. This works for all types of files, not only PHP.
237+
1. Add `__premium_only` just before the file extension. For example, functions__premium_only.php will be included only in the premium plugin version. This works for all types of files, not only PHP.
238238
2. Add `@fs_premium_only` a special meta tag to the plugin's main PHP file header. Example:
239239
```php
240240
<?php
@@ -261,7 +261,10 @@ There are [two ways](https://freemius.com/help/documentation/wordpress-sdk/softw
261261
```
262262
In the example plugin header above, the file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
263263

264-
# WordPress.org Compliance
264+
## Hooks: Actions and Filters
265+
Similar to WordPress’ filters and actions hooks, the Freemius WordPress SDK provides a [collection of filters and actions](https://freemius.com/help/documentation/wordpress-sdk/filters-actions-hooks/) that enable you to customize and extend its functionality in your WordPress plugins or themes.
266+
267+
## WordPress.org Compliance
265268
Based on [WordPress.org Guidelines](https://wordpress.org/plugins/about/guidelines/) you are not allowed to submit a plugin that has premium code in it:
266269
> All code hosted by WordPress.org servers must be free and fully-functional. If you want to sell advanced features for a plugin (such as a "pro" version), then you must sell and serve that code from your own site, we will not host it on our servers.
267270

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/assets/js/pricing/freemius-pricing.js.LICENSE.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ object-assign
1212
*/
1313

1414
/*!
15-
* Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com
15+
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
1616
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
17-
* Copyright 2022 Fonticons, Inc.
1817
*/
1918

2019
/** @license React v0.20.2

freemius/includes/class-freemius.php

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4495,33 +4495,31 @@ function dynamic_init( array $plugin_info ) {
44954495
return;
44964496
}
44974497

4498-
if ( $this->has_api_connectivity() ) {
4499-
if ( self::is_cron() ) {
4500-
$this->hook_callback_to_sync_cron();
4501-
} else if ( $this->is_user_in_admin() ) {
4502-
/**
4503-
* Schedule daily data sync cron if:
4504-
*
4505-
* 1. User opted-in (for tracking).
4506-
* 2. If skipped, but later upgraded (opted-in via upgrade).
4507-
*
4508-
* @author Vova Feldman (@svovaf)
4509-
* @since 1.1.7.3
4510-
*
4511-
*/
4512-
if ( $this->is_registered() && $this->is_tracking_allowed() ) {
4513-
$this->maybe_schedule_sync_cron();
4514-
}
4498+
$this->hook_callback_to_sync_cron();
45154499

4516-
/**
4517-
* Check if requested for manual blocking background sync.
4518-
*/
4519-
if ( fs_request_has( 'background_sync' ) ) {
4520-
self::require_pluggable_essentials();
4521-
self::wp_cookie_constants();
4500+
if ( $this->has_api_connectivity() && ! self::is_cron() && $this->is_user_in_admin() ) {
4501+
/**
4502+
* Schedule daily data sync cron if:
4503+
*
4504+
* 1. User opted-in (for tracking).
4505+
* 2. If skipped, but later upgraded (opted-in via upgrade).
4506+
*
4507+
* @author Vova Feldman (@svovaf)
4508+
* @since 1.1.7.3
4509+
*
4510+
*/
4511+
if ( $this->is_registered() && $this->is_tracking_allowed() ) {
4512+
$this->maybe_schedule_sync_cron();
4513+
}
45224514

4523-
$this->run_manual_sync();
4524-
}
4515+
/**
4516+
* Check if requested for manual blocking background sync.
4517+
*/
4518+
if ( fs_request_has( 'background_sync' ) ) {
4519+
self::require_pluggable_essentials();
4520+
self::wp_cookie_constants();
4521+
4522+
$this->run_manual_sync();
45254523
}
45264524
}
45274525

@@ -20605,11 +20603,18 @@ private function _update_licenses( $licenses, $module_id ) {
2060520603
* @param bool $flush Since 1.1.7.3
2060620604
* @param int $expiration Since 1.2.2.7
2060720605
* @param bool|string $newer_than Since 2.2.1
20606+
* @param bool $fetch_upgrade_notice Since 2.12.1
2060820607
*
2060920608
* @return object|false New plugin tag info if exist.
2061020609
*/
20611-
private function _fetch_newer_version( $plugin_id = false, $flush = true, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $newer_than = false ) {
20612-
$latest_tag = $this->_fetch_latest_version( $plugin_id, $flush, $expiration, $newer_than );
20610+
private function _fetch_newer_version(
20611+
$plugin_id = false,
20612+
$flush = true,
20613+
$expiration = WP_FS__TIME_24_HOURS_IN_SEC,
20614+
$newer_than = false,
20615+
$fetch_upgrade_notice = true
20616+
) {
20617+
$latest_tag = $this->_fetch_latest_version( $plugin_id, $flush, $expiration, $newer_than, false, $fetch_upgrade_notice );
2061320618

2061420619
if ( ! is_object( $latest_tag ) ) {
2061520620
return false;
@@ -20642,19 +20647,18 @@ private function _fetch_newer_version( $plugin_id = false, $flush = true, $expir
2064220647
*
2064320648
* @param bool|number $plugin_id
2064420649
* @param bool $flush Since 1.1.7.3
20645-
* @param int $expiration Since 1.2.2.7
20646-
* @param bool|string $newer_than Since 2.2.1
2064720650
*
2064820651
* @return bool|FS_Plugin_Tag
2064920652
*/
20650-
function get_update( $plugin_id = false, $flush = true, $expiration = FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION, $newer_than = false ) {
20653+
function get_update( $plugin_id = false, $flush = true ) {
2065120654
$this->_logger->entrance();
2065220655

2065320656
if ( ! is_numeric( $plugin_id ) ) {
2065420657
$plugin_id = $this->_plugin->id;
2065520658
}
2065620659

20657-
$this->check_updates( true, $plugin_id, $flush, $expiration, $newer_than );
20660+
$this->check_updates( true, $plugin_id, $flush );
20661+
2065820662
$updates = $this->get_all_updates();
2065920663

2066020664
return isset( $updates[ $plugin_id ] ) && is_object( $updates[ $plugin_id ] ) ? $updates[ $plugin_id ] : false;
@@ -22111,6 +22115,7 @@ private function _get_latest_version_endpoint( $addon_id = false, $type = 'json'
2211122115
* @param int $expiration Since 1.2.2.7
2211222116
* @param bool|string $newer_than Since 2.2.1
2211322117
* @param bool|string $fetch_readme Since 2.2.1
22118+
* @param bool $fetch_upgrade_notice Since 2.12.1
2211422119
*
2211522120
* @return object|false Plugin latest tag info.
2211622121
*/
@@ -22119,7 +22124,8 @@ function _fetch_latest_version(
2211922124
$flush = true,
2212022125
$expiration = WP_FS__TIME_24_HOURS_IN_SEC,
2212122126
$newer_than = false,
22122-
$fetch_readme = true
22127+
$fetch_readme = true,
22128+
$fetch_upgrade_notice = false
2212322129
) {
2212422130
$this->_logger->entrance();
2212522131

@@ -22192,6 +22198,10 @@ function _fetch_latest_version(
2219222198
$expiration = null;
2219322199
}
2219422200

22201+
if ( true === $fetch_upgrade_notice ) {
22202+
$latest_version_endpoint = add_query_arg( 'include_upgrade_notice', 'true', $latest_version_endpoint );
22203+
}
22204+
2219522205
$tag = $this->get_api_site_or_plugin_scope()->get(
2219622206
$latest_version_endpoint,
2219722207
$flush,
@@ -22337,20 +22347,20 @@ function _get_latest_download_local_url( $plugin_id = false ) {
2233722347
* was initiated by the admin.
2233822348
* @param bool|number $plugin_id
2233922349
* @param bool $flush Since 1.1.7.3
22340-
* @param int $expiration Since 1.2.2.7
22341-
* @param bool|string $newer_than Since 2.2.1
2234222350
*/
22343-
private function check_updates(
22344-
$background = false,
22345-
$plugin_id = false,
22346-
$flush = true,
22347-
$expiration = FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
22348-
$newer_than = false
22349-
) {
22351+
private function check_updates( $background = false, $plugin_id = false, $flush = true ) {
2235022352
$this->_logger->entrance();
2235122353

22354+
$newer_than = ( $this->is_premium() ? $this->get_plugin_version() : false );
22355+
2235222356
// Check if there's a newer version for download.
22353-
$new_version = $this->_fetch_newer_version( $plugin_id, $flush, $expiration, $newer_than );
22357+
$new_version = $this->_fetch_newer_version(
22358+
$plugin_id,
22359+
$flush,
22360+
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
22361+
$newer_than,
22362+
( false !== $newer_than )
22363+
);
2235422364

2235522365
$update = null;
2235622366
if ( is_object( $new_version ) ) {

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,7 @@ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
548548

549549
if ( ! isset( $this->_update_details ) ) {
550550
// Get plugin's newest update.
551-
$new_version = $this->_fs->get_update(
552-
false,
553-
fs_request_get_bool( 'force-check' ),
554-
FS_Plugin_Updater::UPDATES_CHECK_CACHE_EXPIRATION,
555-
$this->_fs->get_plugin_version()
556-
);
551+
$new_version = $this->_fs->get_update( false, fs_request_get_bool( 'force-check' ) );
557552

558553
$this->_update_details = false;
559554

@@ -704,16 +699,8 @@ function get_update_details( FS_Plugin_Tag $new_version ) {
704699
);
705700
}
706701

707-
if ( $this->_fs->is_premium() ) {
708-
$latest_tag = $this->_fs->_fetch_latest_version( $this->_fs->get_id(), false );
709-
710-
if (
711-
isset( $latest_tag->readme ) &&
712-
isset( $latest_tag->readme->upgrade_notice ) &&
713-
! empty( $latest_tag->readme->upgrade_notice )
714-
) {
715-
$update->upgrade_notice = $latest_tag->readme->upgrade_notice;
716-
}
702+
if ( $this->_fs->is_premium() && ! empty( $new_version->upgrade_notice ) ) {
703+
$update->upgrade_notice = $new_version->upgrade_notice;
717704
}
718705

719706
$update->{$this->_fs->get_module_type()} = $this->_fs->get_plugin_basename();

freemius/includes/customizer/class-fs-customizer-upsell-control.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function to_json() {
7373
'forum' => 'Support Forum',
7474
'email' => 'Priority Email Support',
7575
'phone' => 'Phone Support',
76-
'skype' => 'Skype Support',
7776
'is_success_manager' => 'Personal Success Manager',
7877
);
7978

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ class FS_Plugin_Plan extends FS_Entity {
7575
* @var string Support phone.
7676
*/
7777
public $support_phone;
78-
/**
79-
* @var string Support skype username.
80-
*/
81-
public $support_skype;
8278
/**
8379
* @var bool Is personal success manager supported with the plan.
8480
*/
@@ -137,7 +133,6 @@ function is_free() {
137133
*/
138134
function has_technical_support() {
139135
return ( ! empty( $this->support_email ) ||
140-
! empty( $this->support_skype ) ||
141136
! empty( $this->support_phone ) ||
142137
! empty( $this->is_success_manager )
143138
);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ class FS_Plugin_Tag extends FS_Entity {
4343
* @var string One of the following: `pending`, `beta`, `unreleased`.
4444
*/
4545
public $release_mode;
46+
/**
47+
* @var string
48+
*/
49+
public $upgrade_notice;
4650

4751
function __construct( $tag = false ) {
4852
parent::__construct( $tag );

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.12.0';
18+
$this_sdk_version = '2.12.1';
1919

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

freemius/templates/plugin-info/features.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
// Add support as a feature.
3535
if ( ! empty( $plan->support_email ) ||
36-
! empty( $plan->support_skype ) ||
3736
! empty( $plan->support_phone ) ||
3837
true === $plan->is_success_manager
3938
) {

0 commit comments

Comments
 (0)