PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 1.7.3
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v1.7.3
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / freemius / README.md
embedpress / freemius Last commit date
assets 9 years ago includes 9 years ago languages 9 years ago templates 9 years ago LICENSE.txt 9 years ago README.md 9 years ago config.php 9 years ago index.php 9 years ago package.json 9 years ago require.php 9 years ago start.php 9 years ago
README.md
254 lines
1 Freemius WordPress SDK
2 ======================
3
4 [](https://freemius.com/wordpress/Monetization](https://freemius.com/wordpress/](https://freemius.com/wordpress/), [](https://freemius.com/wordpress/insights/analytics](https://freemius.com/wordpress/insights/](https://freemius.com/wordpress/insights/), and marketing automation platform for plugin & theme developers. Freemius empower developers to create prosperous subscription based businesses.
5
6 You can see some of the WordPress.org plugins & themes that are utilizing the power of Freemius here:
7
8 https://includewp.com/freemius/#focus
9
10 If you are a WordPress plugin or theme developer and you are interested to monetize with Freemius you can [](https://dashboard.freemius.com/register/sign-up here for free](https://dashboard.freemius.com/register/](https://dashboard.freemius.com/register/):
11
12 https://dashboard.freemius.com/register/
13
14 **Below you'll find the integration instructions for our WordPress SDK.**
15
16 ## Code Documentation
17
18 You can find the SDK's PHP-Doc documentation here:
19 https://codedoc.pub/freemius/wordpress-sdk/master/
20
21 ## Initializing the SDK
22
23 Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
24
25 ```php
26 <?php
27 // Create a helper function for easy SDK access.
28 function my_prefix_fs() {
29 global $my_prefix_fs;
30 if ( ! isset( $my_prefix_fs ) ) {
31 // Include Freemius SDK.
32 require_once dirname(__FILE__) . '/freemius/start.php';
33
34 $my_prefix_fs = fs_dynamic_init( array(
35 'id' => '1234',
36 'slug' => 'my-plugin-slug',
37 'menu_slug' => 'my_menu_slug', // You can also use __FILE__
38 'public_key' => 'pk_MY_PUBLIC_KEY',
39 'is_live' => true,
40 'is_premium' => true,
41 'has_addons' => false,
42 'has_paid_plans' => false,
43 // Set the SDK to work in a sandbox mode (for development & testing).
44 // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
45 'secret_key' => 'sk_MY_SECRET_KEY',
46 ) );
47 }
48
49 return $my_prefix_fs;
50 }
51
52 // Init Freemius.
53 my_prefix_fs();
54 ?>
55 ```
56
57 - **1234** - Replace with your plugin's ID.
58 - **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
59 - **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
60 - **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
61 - **my_menu_slug** - Replace with your admin dashboard settings menu slug.
62
63
64 ## Usage example
65
66 You can call the SDK by using the shortcode function:
67
68 ```php
69 <?php my_prefix_fs()->get_upgrade_url(); ?>
70 ```
71
72 Or when calling Freemius multiple times in a scope, it's recommended to use it with the global variable:
73
74 ```php
75 <?php
76 global $my_prefix_fs;
77 $my_prefix_fs->get_account_url();
78 ?>
79 ```
80
81 ## Adding license based logic examples
82
83 Add marketing content to encourage your users to upgrade for your paid version:
84
85 ```php
86 <?php
87 if ( my_prefix_fs()->is_not_paying() ) {
88 echo '<section><h1>' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '</h1>';
89 echo '<a href="' . my_prefix_fs()->get_upgrade_url() . '">' .
90 esc_html__('Upgrade Now!', 'my-plugin-slug') .
91 '</a>';
92 echo '</section>';
93 }
94 ?>
95 ```
96
97 Add logic which will only be available in your premium plugin version:
98
99 ```php
100 <?php
101 // This "if" block will be auto removed from the Free version.
102 if ( my_prefix_fs()->is__premium_only() ) {
103
104 // ... premium only logic ...
105
106 }
107 ?>
108 ```
109
110 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:
111
112 ```php
113 <?php
114 class My_Plugin {
115 function init() {
116 ...
117
118 // This "if" block will be auto removed from the free version.
119 if ( my_prefix_fs()->is__premium_only() ) {
120 // Init premium version.
121 $this->admin_init__premium_only();
122
123 add_action( 'admin_init', array( &$this, 'admin_init_hook__premium_only' );
124 }
125
126 ...
127 }
128
129 // This method will be only included in the premium version.
130 function admin_init__premium_only() {
131 ...
132 }
133
134 // This method will be only included in the premium version.
135 function admin_init_hook__premium_only() {
136 ...
137 }
138 }
139 ?>
140 ```
141
142 Add logic which will only be executed for customers in your 'professional' plan:
143
144 ```php
145 <?php
146 if ( my_prefix_fs()->is_plan('professional', true) ) {
147 // .. logic related to Professional plan only ...
148 }
149 ?>
150 ```
151
152 Add logic which will only be executed for customers in your 'professional' plan or higher plans:
153
154 ```php
155 <?php
156 if ( my_prefix_fs()->is_plan('professional') ) {
157 // ... logic related to Professional plan and higher plans ...
158 }
159 ?>
160 ```
161
162 Add logic which will only be available in your premium plugin version AND will only be executed for customers in your 'professional' plan (and higher plans):
163
164 ```php
165 <?php
166 // This "if" block will be auto removed from the Free version.
167 if ( my_prefix_fs()->is_plan__premium_only('professional') ) {
168 // ... logic related to Professional plan and higher plans ...
169 }
170 ?>
171 ```
172
173 Add logic only for users in trial:
174
175 ```php
176 <?php
177 if ( my_prefix_fs()->is_trial() ) {
178 // ... logic for users in trial ...
179 }
180 ?>
181 ```
182
183 Add logic for specified paid plan:
184
185 ```php
186 <?php
187 // This "if" block will be auto removed from the Free version.
188 if ( my_prefix_fs()->is__premium_only() ) {
189 if ( my_prefix_fs()->is_plan( 'professional', true ) ) {
190
191 // ... logic related to Professional plan only ...
192
193 } else if ( my_prefix_fs()->is_plan( 'business' ) ) {
194
195 // ... logic related to Business plan and higher plans ...
196
197 }
198 }
199 ?>
200 ```
201
202 ## Excluding files and folders from the free plugin version
203 There are two ways to exclude files from your free version.
204
205 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.
206 2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
207 ```php
208 <?php
209 /**
210 * Plugin Name: My Very Awesome Plugin
211 * Plugin URI: http://my-awesome-plugin.com
212 * Description: Create and manage Awesomeness right in WordPress.
213 * Version: 1.0.0
214 * Author: Awesomattic
215 * Author URI: http://my-awesome-plugin.com/me/
216 * License: GPLv2
217 * Text Domain: myplugin
218 * Domain Path: /langs
219 *
220 * @fs_premium_only /lib/functions.php, /premium-files/
221 */
222
223 if ( ! defined( 'ABSPATH' ) ) {
224 exit;
225 }
226
227 // ... my code ...
228 ?>
229 ```
230 The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
231
232 # WordPress.org Compliance
233 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:
234 > 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.
235
236 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.
237
238 ## Deployment
239 Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
240 The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
241
242 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.
243 2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).
244
245 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.
246
247 ## Reporting Bugs
248 Email dev [at] freemius [dot] com
249
250 ## FAQ
251
252 ## Copyright
253 Freemius, Inc.
254