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

Dev oe #15

Merged
merged 5 commits into from
Dec 17, 2020
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
17 changes: 14 additions & 3 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
== Changelog ==

= 1.6.8 =
- Fixed: MailChimp Widget: failed subscription error.
- Fixed: WC_Cart->taxes is deprecated since version 3.2 error when oceanwp_woo_free_shipping_left shortcode is in use.
- Fixed: Broken demo images.

= 1.6.7 =
- Updated: Freemius SDK version.

= 1.6.6 =
- Fixed: Security issue - If $_REQUEST['_wpnonce'] is not set, it won't be checked.
- Fixed: Remove filter for 5 star rating from review link.
- Fixed: Remove 5-star rating filter from review link.
- Fixed: PHP 7.4 notice - 'Trying to access array offset on value of type bool' in ocean-extra file.
- Fixed: jQuery notice - 'ready' function has been deprecated - metabox.js file.
- Updated: Freemius SDK version.

= 1.6.5 =
- Fixed: Data saving error - about me widget.
- Removed: All affiliate links has been removed.
- Fixed: Data saving error - About Me widget.
- Removed: All affiliate links have been removed.

= 1.6.4 =
- Fixed: Missing Dependencies script 'butterbean'
Expand Down
115 changes: 72 additions & 43 deletions includes/freemius/README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,99 @@
Freemius WordPress SDK
======================

[Monetization](https://freemius.com/wordpress/), [analytics](https://freemius.com/wordpress/insights/), and marketing automation platform for plugin & theme developers. Freemius empower developers to create prosperous subscription based businesses.
Welcome to the official repository for the Freemius SDK! Adding the SDK to your WordPress plugin, theme, or add-ons, enables all the benefits that come with using the [Freemius platform](https://freemius.com) such as:

You can see some of the WordPress.org plugins & themes that are utilizing the power of Freemius here:
* [Software Licensing](https://freemius.com/wordpress/software-licensing/)
* [Secure Checkout](https://freemius.com/wordpress/checkout/)
* [Subscriptions](https://freemius.com/wordpress/recurring-payments-subscriptions/)
* [Automatic Updates](https://freemius.com/wordpress/automatic-software-updates/)
* [Seamless EU VAT](https://freemius.com/wordpress/collecting-eu-vat-europe/)
* [Cart Abandonment Recovery](https://freemius.com/wordpress/cart-abandonment-recovery/)
* [Affiliate Platform](https://freemius.com/wordpress/affiliate-platform/)
* [Analytics & Usage Tracking](https://freemius.com/wordpress/insights/)
* [User Dashboard](https://freemius.com/wordpress/user-dashboard/)

https://includewp.com/freemius/#focus
* [Monetization](https://freemius.com/wordpress/)
* [Analytics](https://freemius.com/wordpress/insights/)
* [More...](https://freemius.com/wordpress/features-comparison/)

If you are a WordPress plugin or theme developer and you are interested to monetize with Freemius you can [sign-up here for free](https://dashboard.freemius.com/register/):
Freemius truly empowers developers to create prosperous subscription-based businesses.

If you're new to Freemius then we recommend taking a look at our [Getting Started](https://freemius.com/help/documentation/getting-started/) guide first.

If you're a WordPress plugin or theme developer and are interested in monetizing with Freemius then you can [sign-up for a FREE account](https://dashboard.freemius.com/register/):

https://dashboard.freemius.com/register/

**Below you'll find the integration instructions for our WordPress SDK.**
Once you have your account setup and are familiar with how it all works you're ready to begin [integrating Freemius](https://freemius.com/help/documentation/wordpress-sdk/integrating-freemius-sdk/) into your WordPress product

You can see some of the existing WordPress.org plugins & themes that are already utilizing the power of Freemius here:

* https://profiles.wordpress.org/freemius/#content-plugins
* https://includewp.com/freemius/#focus

## Code Documentation

You can find the SDK's documentation here:
https://freemius.com/help/documentation/wordpress-sdk/

## Initializing the SDK
## Integrating & Initializing the SDK

As part of the integration process, you'll need to [add the latest version](https://freemius.com/help/documentation/getting-started/#add_the_latest_wordpress_sdk_into_your_product) of the Freemius SDK into your WordPress project.

Then, when you've completed the [SDK integration form](https://freemius.com/help/documentation/getting-started/#fill_out_the_sdk_integration_form) a snippet of code is generated which you'll need to copy and paste into the top of your main plugin's PHP file, right after the plugin's header comment.

Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
Note: For themes, this will be in the root `functions.php` file instead.

A typical SDK snippet will look similar to the following (your particular snippet may differ slightly depending on your integration):

```php
<?php
if ( ! function_exists( 'my_prefix_fs' ) ) {
// Create a helper function for easy SDK access.
function my_prefix_fs() {
global $my_prefix_fs;

if ( ! isset( $my_prefix_fs ) ) {
// Include Freemius SDK.
require_once dirname(__FILE__) . '/freemius/start.php';

$my_prefix_fs = fs_dynamic_init( array(
'id' => '1234',
'slug' => 'my-plugin-slug',
'menu_slug' => 'my_menu_slug', // You can also use __FILE__
'public_key' => 'pk_MY_PUBLIC_KEY',
'is_live' => true,
'is_premium' => true,
'has_addons' => false,
'has_paid_plans' => false,
'id' => '1234',
'slug' => 'my-new-plugin',
'premium_slug' => 'my-new-plugin-premium',
'type' => 'plugin',
'public_key' => 'pk_bAEfta69seKymZzmf2xtqq8QXHz9y',
'is_premium' => true,
// If your plugin is a serviceware, set this option to false.
'has_premium_version' => true,
'has_paid_plans' => true,
'is_org_compliant' => true,
'menu' => array(
'slug' => 'my-new-plugin',
'parent' => array(
'slug' => 'options-general.php',
),
),
// Set the SDK to work in a sandbox mode (for development & testing).
// IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
'secret_key' => 'sk_MY_SECRET_KEY',
'secret_key' => 'sk_ubb4yN3mzqGR2x8#P7r5&@*xC$utE',
) );
}

return $my_prefix_fs;
}

// Init Freemius.
my_prefix_fs();
?>
```

- **1234** - Replace with your plugin's ID.
- **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
- **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
- **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
- **my_menu_slug** - Replace with your admin dashboard settings menu slug.
// Signal that SDK was initiated.
do_action( 'my_prefix_fs_loaded' );
}

```

## Usage example

You can call the SDK by using the shortcode function:
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):

```php
<?php my_prefix_fs()->get_upgrade_url(); ?>
Expand All @@ -78,6 +108,8 @@ Or when calling Freemius multiple times in a scope, it's recommended to use it w
?>
```

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.

## Adding license based logic examples

Add marketing content to encourage your users to upgrade for your paid version:
Expand Down Expand Up @@ -200,10 +232,10 @@ Add logic for specified paid plan:
```

## Excluding files and folders from the free plugin version
There are two ways to exclude files from your free version.
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.

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 type of files, not only PHP.
2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
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.
2. Add `@fs_premium_only` a special meta tag to the plugin's main PHP file header. Example:
```php
<?php
/**
Expand All @@ -227,27 +259,24 @@ There are two ways to exclude files from your free version.
// ... my code ...
?>
```
The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
In the example plugin header above, the file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.

# WordPress.org Compliance
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:
> 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.

Therefore, if you want to deploy your free plugin's version to WordPress.org, make sure you wrap all your premium code with `if ( my_prefix_fs()->{{ method }}__premium_only() )` or the other methods provided to exclude premium features & files from the free version.
Therefore, if you want to deploy your free plugin's version to WordPress.org, make sure you wrap all your premium code with `if ( my_prefix_fs()->{{ method }}__premium_only() )` or use [some of the other methods](https://freemius.com/help/documentation/wordpress-sdk/software-licensing/) provided by the SDK to exclude premium features & files from the free version.

## Deployment
Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
Zip your Freemius product’s root folder and [upload it in the Deployment section](https://freemius.com/help/documentation/selling-with-freemius/deployment/) in the *Freemius Developer's Dashboard*.
The plugin/theme will automatically be scanned and processed by a custom-developed *PHP Processor* which will auto-generate two versions of your plugin:

1. **Premium version**: Identical to your uploaded version, including all code (except your `secret_key`). Will be enabled for download ONLY for your paying or in trial customers.
2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).

The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org complaint and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.

## Reporting Bugs
Email dev [at] freemius [dot] com
The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org compliant and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.

## FAQ
## License
Copyright (c) Freemius®, Inc.

## Copyright
Freemius, Inc.
Licensed under the GNU general public license (version 3).
Loading