PluginProbe
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts / 2.7.5
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts v2.7.5
2.8.14 2.8.13 2.8.12 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.10 2.8.11 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 trunk 1.0.1 1.0.2 1.1.0 1.1.1 All 147 releases
content-blocks-builder / vendor / freemius / start.php

start.php in Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts 2.7.5, at vendor/freemius/start.php

607 lines 22.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Freemius SDK Version.
15 *
16 * @var string
17 */
18 $this_sdk_version = '2.10.0';
19
20 #region SDK Selection Logic --------------------------------------------------------------------
21
22 /**
23 * Special logic added on 1.1.6 to make sure that every Freemius powered plugin
24 * will ALWAYS be loaded with the newest SDK from the active Freemius powered plugins.
25 *
26 * Since Freemius SDK is backward compatible, this will make sure that all Freemius powered
27 * plugins will run correctly.
28 *
29 * @since 1.1.6
30 */
31
32 global $fs_active_plugins;
33
34 if ( ! function_exists( 'fs_find_caller_plugin_file' ) ) {
35 // Require SDK essentials.
36 require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
37 }
38
39 /**
40 * We updated the logic to support SDK loading from a subfolder of a theme as well as from a parent theme
41 * If the SDK is found in the active theme, it sets the relative path accordingly.
42 * If not, it checks the parent theme and sets the relative path if found there.
43 * This allows the SDK to be loaded from composer dependencies or from a custom `vendor/freemius` folder.
44 *
45 * @author Daniele Alessandra (@DanieleAlessandra)
46 * @since 2.9.0.5
47 *
48 *
49 * This complex logic fixes symlink issues (e.g. with Vargant). The logic assumes
50 * that if it's a file from an SDK running in a theme, the location of the SDK
51 * is in the main theme's folder.
52 *
53 * @author Vova Feldman (@svovaf)
54 * @since 1.2.2.6
55 */
56 $file_path = fs_normalize_path( __FILE__ );
57 $fs_root_path = dirname( $file_path );
58
59 // @todo: Remove this code after a few months when WP 6.3 usage is low enough.
60 global $wp_version;
61
62 if (
63 ! function_exists( 'wp_get_current_user' ) &&
64 /**
65 * `get_stylesheet()` will rely on `wp_get_current_user()` when it is being filtered by `theme-previews.php`. That happens only when the site editor is loaded or when the site editor is sending REST requests.
66 * @see theme-previews.php:wp_get_theme_preview_path()
67 *
68 * @todo This behavior is already fixed in the core (WP 6.3.2+), and this code can be removed after a few months when WP 6.3 usage is low enough.
69 * @since WP 6.3.0
70 */
71 version_compare( $wp_version, '6.3', '>=' ) &&
72 version_compare( $wp_version, '6.3.1', '<=' ) &&
73 (
74 'site-editor.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ||
75 (
76 function_exists( 'wp_is_json_request' ) &&
77 wp_is_json_request() &&
78 ! empty( $_GET['wp_theme_preview'] )
79 )
80 )
81 ) {
82 // Requiring this file since the call to get_stylesheet() below can trigger a call to wp_get_current_user() when previewing a theme.
83 require_once ABSPATH . 'wp-includes/pluggable.php';
84 }
85
86 /**
87 * Get the themes directory where the active theme is located (not passing the stylesheet will make WordPress
88 * assume that the themes directory is inside `wp-content`.
89 *
90 * @author Leo Fajardo (@leorw)
91 * @since 2.2.3
92 */
93 $themes_directory = get_theme_root( get_stylesheet() );
94 $themes_directory_name = basename( $themes_directory );
95
96 // This change ensures that the condition works even if the SDK is located in a subdirectory (e.g., vendor)
97 $theme_candidate_sdk_basename = str_replace( $themes_directory . '/' . get_stylesheet() . '/', '', $fs_root_path );
98
99 // Check if the current file is part of the active theme.
100 $is_current_sdk_from_active_theme = $file_path == $themes_directory . '/' . get_stylesheet() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
101 $is_current_sdk_from_parent_theme = false;
102
103 // Check if the current file is part of the parent theme.
104 if ( ! $is_current_sdk_from_active_theme ) {
105 $theme_candidate_sdk_basename = str_replace( $themes_directory . '/' . get_template() . '/',
106 '',
107 $fs_root_path );
108 $is_current_sdk_from_parent_theme = $file_path == $themes_directory . '/' . get_template() . '/' . $theme_candidate_sdk_basename . '/' . basename( $file_path );
109 }
110
111 if ( $is_current_sdk_from_active_theme ) {
112 $this_sdk_relative_path = '../' . $themes_directory_name . '/' . get_stylesheet() . '/' . $theme_candidate_sdk_basename;
113 $is_theme = true;
114 } else if ( $is_current_sdk_from_parent_theme ) {
115 $this_sdk_relative_path = '../' . $themes_directory_name . '/' . get_template() . '/' . $theme_candidate_sdk_basename;
116 $is_theme = true;
117 } else {
118 $this_sdk_relative_path = plugin_basename( $fs_root_path );
119 $is_theme = false;
120 }
121
122 if ( ! isset( $fs_active_plugins ) ) {
123 // Load all Freemius powered active plugins.
124 $fs_active_plugins = get_option( 'fs_active_plugins' );
125
126 if ( ! is_object( $fs_active_plugins ) ) {
127 $fs_active_plugins = new stdClass();
128 }
129
130 if ( ! isset( $fs_active_plugins->plugins ) ) {
131 $fs_active_plugins->plugins = array();
132 }
133 }
134
135 if ( empty( $fs_active_plugins->abspath ) ) {
136 /**
137 * Store the WP install absolute path reference to identify environment change
138 * while replicating the storage.
139 *
140 * @author Vova Feldman (@svovaf)
141 * @since 1.2.1.7
142 */
143 $fs_active_plugins->abspath = ABSPATH;
144 } else {
145 if ( ABSPATH !== $fs_active_plugins->abspath ) {
146 /**
147 * WordPress path has changed, cleanup the SDK references cache.
148 * This resolves issues triggered when spinning a staging environments
149 * while replicating the database.
150 *
151 * @author Vova Feldman (@svovaf)
152 * @since 1.2.1.7
153 */
154 $fs_active_plugins->abspath = ABSPATH;
155 $fs_active_plugins->plugins = array();
156 unset( $fs_active_plugins->newest );
157 } else {
158 /**
159 * Make sure SDK references are still valid. This resolves
160 * issues when users hard delete modules via FTP.
161 *
162 * @author Vova Feldman (@svovaf)
163 * @since 1.2.1.7
164 */
165 $has_changes = false;
166 foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
167 if ( ! file_exists( ( isset( $data->type ) && 'theme' === $data->type ? $themes_directory : WP_PLUGIN_DIR ) . '/' . $sdk_path ) ) {
168 unset( $fs_active_plugins->plugins[ $sdk_path ] );
169
170 if (
171 ! empty( $fs_active_plugins->newest ) &&
172 $sdk_path === $fs_active_plugins->newest->sdk_path
173 ) {
174 unset( $fs_active_plugins->newest );
175 }
176
177 $has_changes = true;
178 }
179 }
180
181 if ( $has_changes ) {
182 if ( empty( $fs_active_plugins->plugins ) ) {
183 unset( $fs_active_plugins->newest );
184 }
185
186 update_option( 'fs_active_plugins', $fs_active_plugins );
187 }
188 }
189 }
190
191 if ( ! function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
192 require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-1.1.7.1.php';
193 }
194
195 if ( ! function_exists( 'fs_get_plugins' ) ) {
196 require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-2.2.1.php';
197 }
198
199 // Update current SDK info based on the SDK path.
200 if ( ! isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) ||
201 $this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
202 ) {
203 if ( $is_theme ) {
204 // Saving relative path and not only directory name as it could be a subfolder
205 $plugin_path = $this_sdk_relative_path;
206 } else {
207 $plugin_path = plugin_basename( fs_find_direct_caller_plugin_file( $file_path ) );
208 }
209
210 $fs_active_plugins->plugins[ $this_sdk_relative_path ] = (object) array(
211 'version' => $this_sdk_version,
212 'type' => ( $is_theme ? 'theme' : 'plugin' ),
213 'timestamp' => time(),
214 'plugin_path' => $plugin_path,
215 );
216 }
217
218 $is_current_sdk_newest = isset( $fs_active_plugins->newest ) && ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path );
219
220 if ( ! isset( $fs_active_plugins->newest ) ) {
221 /**
222 * This will be executed only once, for the first time a Freemius powered plugin is activated.
223 */
224 fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
225
226 $is_current_sdk_newest = true;
227 } else if ( version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '<' ) ) {
228 /**
229 * Current SDK is newer than the newest stored SDK.
230 */
231 fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
232
233 if ( class_exists( 'Freemius' ) ) {
234 // Older SDK version was already loaded.
235
236 if ( ! $fs_active_plugins->newest->in_activation ) {
237 // Re-order plugins to load this plugin first.
238 fs_newest_sdk_plugin_first();
239 }
240
241 // Refresh page.
242 fs_redirect( $_SERVER['REQUEST_URI'] );
243 }
244 } else {
245 if ( ! function_exists( 'get_plugins' ) ) {
246 require_once ABSPATH . 'wp-admin/includes/plugin.php';
247 }
248
249 $fs_newest_sdk = $fs_active_plugins->newest;
250 $fs_newest_sdk = $fs_active_plugins->plugins[ $fs_newest_sdk->sdk_path ];
251
252 $is_newest_sdk_type_theme = ( isset( $fs_newest_sdk->type ) && 'theme' === $fs_newest_sdk->type );
253
254 /**
255 * @var bool $is_newest_sdk_module_active
256 * True if the plugin with the newest SDK is active.
257 * True if the newest SDK is part of the current theme or current theme's parent.
258 * False otherwise.
259 */
260 if ( ! $is_newest_sdk_type_theme ) {
261 $is_newest_sdk_module_active = is_plugin_active( $fs_newest_sdk->plugin_path );
262 } else {
263 $current_theme = wp_get_theme();
264 // Detect if current theme is the one registered as newer SDK
265 $is_newest_sdk_module_active = (
266 strpos(
267 $fs_newest_sdk->plugin_path,
268 '../' . $themes_directory_name . '/' . $current_theme->get_stylesheet() . '/'
269 ) === 0
270 );
271
272 $current_theme_parent = $current_theme->parent();
273
274 /**
275 * If the current theme is a child of the theme that has the newest SDK, this prevents a redirects loop
276 * from happening by keeping the SDK info stored in the `fs_active_plugins` option.
277 */
278 if ( ! $is_newest_sdk_module_active && $current_theme_parent instanceof WP_Theme ) {
279 // Detect if current theme parent is the one registered as newer SDK
280 $is_newest_sdk_module_active = (
281 strpos(
282 $fs_newest_sdk->plugin_path,
283 '../' . $themes_directory_name . '/' . $current_theme_parent->get_stylesheet() . '/'
284 ) === 0
285 );
286 }
287 }
288
289 if ( $is_current_sdk_newest &&
290 ! $is_newest_sdk_module_active &&
291 ! $fs_active_plugins->newest->in_activation
292 ) {
293 // If current SDK is the newest and the plugin is NOT active, it means
294 // that the current plugin in activation mode.
295 $fs_active_plugins->newest->in_activation = true;
296 update_option( 'fs_active_plugins', $fs_active_plugins );
297 }
298
299 if ( ! $is_theme ) {
300 $sdk_starter_path = fs_normalize_path( WP_PLUGIN_DIR . '/' . $this_sdk_relative_path . '/start.php' );
301 } else {
302 $sdk_starter_path = fs_normalize_path(
303 $themes_directory
304 . '/'
305 . str_replace( "../{$themes_directory_name}/", '', $this_sdk_relative_path )
306 . '/start.php' );
307 }
308
309 $is_newest_sdk_path_valid = ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) && file_exists( $sdk_starter_path );
310
311 if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
312 // Plugin with newest SDK is no longer active, or SDK was moved to a different location.
313 unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
314 }
315
316 if ( ! ( $is_newest_sdk_module_active || $fs_active_plugins->newest->in_activation ) ||
317 ! $is_newest_sdk_path_valid ||
318 // Is newest SDK downgraded.
319 ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
320 version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '>' ) )
321 ) {
322 /**
323 * Plugin with newest SDK is no longer active.
324 * OR
325 * The newest SDK was in the current plugin. BUT, seems like the version of
326 * the SDK was downgraded to a lower SDK.
327 */
328 // Find the active plugin with the newest SDK version and update the newest reference.
329 fs_fallback_to_newest_active_sdk();
330 } else {
331 if ( $is_newest_sdk_module_active &&
332 $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
333 ( $fs_active_plugins->newest->in_activation ||
334 ( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
335 )
336
337 ) {
338 if ( $fs_active_plugins->newest->in_activation && ! $is_newest_sdk_type_theme ) {
339 // Plugin no more in activation.
340 $fs_active_plugins->newest->in_activation = false;
341 update_option( 'fs_active_plugins', $fs_active_plugins );
342 }
343
344 // Reorder plugins to load plugin with newest SDK first.
345 if ( fs_newest_sdk_plugin_first() ) {
346 // Refresh page after re-order to make sure activated plugin loads newest SDK.
347 if ( class_exists( 'Freemius' ) ) {
348 fs_redirect( $_SERVER['REQUEST_URI'] );
349 }
350 }
351 }
352 }
353 }
354
355 if ( class_exists( 'Freemius' ) ) {
356 // SDK was already loaded.
357 return;
358 }
359
360 if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
361 $newest_sdk = $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ];
362
363 $plugins_or_theme_dir_path = ( ! isset( $newest_sdk->type ) || 'theme' !== $newest_sdk->type ) ?
364 WP_PLUGIN_DIR :
365 $themes_directory;
366
367 $newest_sdk_starter = fs_normalize_path(
368 $plugins_or_theme_dir_path
369 . '/'
370 . str_replace( "../{$themes_directory_name}/", '', $fs_active_plugins->newest->sdk_path )
371 . '/start.php' );
372
373 if ( file_exists( $newest_sdk_starter ) ) {
374 // Reorder plugins to load plugin with newest SDK first.
375 fs_newest_sdk_plugin_first();
376
377 // There's a newer SDK version, load it instead of the current one!
378 require_once $newest_sdk_starter;
379
380 return;
381 }
382 }
383
384 #endregion SDK Selection Logic --------------------------------------------------------------------
385
386 #region Hooks & Filters Collection --------------------------------------------------------------------
387
388 /**
389 * Freemius hooks (actions & filters) tags structure:
390 *
391 * fs_{filter/action_name}_{plugin_slug}
392 *
393 * --------------------------------------------------------
394 *
395 * Usage with WordPress' add_action() / add_filter():
396 *
397 * add_action('fs_{filter/action_name}_{plugin_slug}', $callable);
398 *
399 * --------------------------------------------------------
400 *
401 * Usage with Freemius' instance add_action() / add_filter():
402 *
403 * // No need to add 'fs_' prefix nor '_{plugin_slug}' suffix.
404 * my_freemius()->add_action('{action_name}', $callable);
405 *
406 * --------------------------------------------------------
407 *
408 * Freemius filters collection:
409 *
410 * fs_connect_url_{plugin_slug}
411 * fs_trial_promotion_message_{plugin_slug}
412 * fs_is_long_term_user_{plugin_slug}
413 * fs_uninstall_reasons_{plugin_slug}
414 * fs_is_plugin_update_{plugin_slug}
415 * fs_api_domains_{plugin_slug}
416 * fs_email_template_sections_{plugin_slug}
417 * fs_support_forum_submenu_{plugin_slug}
418 * fs_support_forum_url_{plugin_slug}
419 * fs_connect_message_{plugin_slug}
420 * fs_connect_message_on_update_{plugin_slug}
421 * fs_uninstall_confirmation_message_{plugin_slug}
422 * fs_pending_activation_message_{plugin_slug}
423 * fs_is_submenu_visible_{plugin_slug}
424 * fs_plugin_icon_{plugin_slug}
425 * fs_show_trial_{plugin_slug}
426 *
427 * --------------------------------------------------------
428 *
429 * Freemius actions collection:
430 *
431 * fs_after_license_loaded_{plugin_slug}
432 * fs_after_license_change_{plugin_slug}
433 * fs_after_plans_sync_{plugin_slug}
434 *
435 * fs_after_account_details_{plugin_slug}
436 * fs_after_account_user_sync_{plugin_slug}
437 * fs_after_account_plan_sync_{plugin_slug}
438 * fs_before_account_load_{plugin_slug}
439 * fs_after_account_connection_{plugin_slug}
440 * fs_account_property_edit_{plugin_slug}
441 * fs_account_email_verified_{plugin_slug}
442 * fs_account_page_load_before_departure_{plugin_slug}
443 * fs_before_account_delete_{plugin_slug}
444 * fs_after_account_delete_{plugin_slug}
445 *
446 * fs_sdk_version_update_{plugin_slug}
447 * fs_plugin_version_update_{plugin_slug}
448 *
449 * fs_initiated_{plugin_slug}
450 * fs_after_init_plugin_registered_{plugin_slug}
451 * fs_after_init_plugin_anonymous_{plugin_slug}
452 * fs_after_init_plugin_pending_activations_{plugin_slug}
453 * fs_after_init_addon_registered_{plugin_slug}
454 * fs_after_init_addon_anonymous_{plugin_slug}
455 * fs_after_init_addon_pending_activations_{plugin_slug}
456 *
457 * fs_after_premium_version_activation_{plugin_slug}
458 * fs_after_free_version_reactivation_{plugin_slug}
459 *
460 * fs_after_uninstall_{plugin_slug}
461 * fs_before_admin_menu_init_{plugin_slug}
462 */
463
464 #endregion Hooks & Filters Collection --------------------------------------------------------------------
465
466 if ( ! class_exists( 'Freemius' ) ) {
467
468 if ( ! defined( 'WP_FS__SDK_VERSION' ) ) {
469 define( 'WP_FS__SDK_VERSION', $this_sdk_version );
470 }
471
472 $plugins_or_theme_dir_path = fs_normalize_path( trailingslashit( $is_theme ?
473 $themes_directory :
474 WP_PLUGIN_DIR ) );
475
476 if ( 0 === strpos( $file_path, $plugins_or_theme_dir_path ) ) {
477 // No symlinks
478 } else {
479 /**
480 * This logic finds the SDK symlink and set WP_FS__DIR to use it.
481 *
482 * @author Vova Feldman (@svovaf)
483 * @since 1.2.2.5
484 */
485 $sdk_symlink = null;
486
487 // Try to load SDK's symlink from cache.
488 if ( isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
489 is_object( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
490 ! empty( $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink )
491 ) {
492 $sdk_symlink = $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink;
493 if ( 0 === strpos( $sdk_symlink, $plugins_or_theme_dir_path ) ) {
494 /**
495 * Make the symlink path relative.
496 *
497 * @author Leo Fajardo (@leorw)
498 */
499 $sdk_symlink = substr( $sdk_symlink, strlen( $plugins_or_theme_dir_path ) );
500
501 $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink = $sdk_symlink;
502 update_option( 'fs_active_plugins', $fs_active_plugins );
503 }
504
505 $realpath = realpath( $plugins_or_theme_dir_path . $sdk_symlink );
506 if ( ! is_string( $realpath ) || ! file_exists( $realpath ) ) {
507 $sdk_symlink = null;
508 }
509 }
510
511 if ( empty( $sdk_symlink ) ) // Has symlinks, therefore, we need to configure WP_FS__DIR based on the symlink.
512 {
513 $partial_path_right = basename( $file_path );
514 $partial_path_left = dirname( $file_path );
515 $realpath = realpath( $plugins_or_theme_dir_path . $partial_path_right );
516
517 while ( '/' !== $partial_path_left &&
518 ( false === $realpath || $file_path !== fs_normalize_path( $realpath ) )
519 ) {
520 $partial_path_right = trailingslashit( basename( $partial_path_left ) ) . $partial_path_right;
521 $partial_path_left_prev = $partial_path_left;
522 $partial_path_left = dirname( $partial_path_left_prev );
523
524 /**
525 * Avoid infinite loop if for example `$partial_path_left_prev` is `C:/`, in this case,
526 * `dirname( 'C:/' )` will return `C:/`.
527 *
528 * @author Leo Fajardo (@leorw)
529 */
530 if ( $partial_path_left === $partial_path_left_prev ) {
531 $partial_path_left = '';
532 break;
533 }
534
535 $realpath = realpath( $plugins_or_theme_dir_path . $partial_path_right );
536 }
537
538 if ( ! empty( $partial_path_left ) && '/' !== $partial_path_left ) {
539 $sdk_symlink = fs_normalize_path( dirname( $partial_path_right ) );
540
541 // Cache value.
542 if ( isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) &&
543 is_object( $fs_active_plugins->plugins[ $this_sdk_relative_path ] )
544 ) {
545 $fs_active_plugins->plugins[ $this_sdk_relative_path ]->sdk_symlink = $sdk_symlink;
546 update_option( 'fs_active_plugins', $fs_active_plugins );
547 }
548 }
549 }
550
551 if ( ! empty( $sdk_symlink ) ) {
552 // Set SDK dir to the symlink path.
553 define( 'WP_FS__DIR', $plugins_or_theme_dir_path . $sdk_symlink );
554 }
555 }
556
557 // Load SDK files.
558 require_once dirname( __FILE__ ) . '/require.php';
559
560 /**
561 * Quick shortcut to get Freemius for specified plugin.
562 * Used by various templates.
563 *
564 * @param number $module_id
565 *
566 * @return Freemius
567 */
568 function freemius( $module_id ) {
569 return Freemius::instance( $module_id );
570 }
571
572 /**
573 * @param string $slug
574 * @param number $plugin_id
575 * @param string $public_key
576 * @param bool $is_live Is live or test plugin.
577 * @param bool $is_premium Hints freemius if running the premium plugin or not.
578 *
579 * @return Freemius
580 *
581 * @deprecated Please use fs_dynamic_init().
582 */
583 function fs_init( $slug, $plugin_id, $public_key, $is_live = true, $is_premium = true ) {
584 $fs = Freemius::instance( $plugin_id, $slug, true );
585 $fs->init( $plugin_id, $public_key, $is_live, $is_premium );
586
587 return $fs;
588 }
589
590 /**
591 * @param array <string,string|bool|array> $module Plugin or Theme details.
592 *
593 * @return Freemius
594 * @throws Freemius_Exception
595 */
596 function fs_dynamic_init( $module ) {
597 $fs = Freemius::instance( $module['id'], $module['slug'], true );
598 $fs->dynamic_init( $module );
599
600 return $fs;
601 }
602
603 function fs_dump_log() {
604 FS_Logger::dump();
605 }
606 }
607