PluginProbe
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts / 2.7.7
Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts v2.7.7
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 / freemius.php

freemius.php in Content Blocks Builder – Create blocks, repeater blocks with carousel, grid, popup layouts 2.7.7, at freemius.php

107 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Freemius functions
5 *
6 * @package BoldBlocks
7 * @author Phi Phan <mrphipv@gmail.com>
8 * @copyright Copyright (c) 2022, Phi Phan
9 */
10 namespace BoldBlocks;
11
12 // Exit if accessed directly.
13 defined( 'ABSPATH' ) || exit;
14 if ( !function_exists( 'cbb_fs' ) ) {
15 // Create a helper function for easy SDK access.
16 function cbb_fs() {
17 global $cbb_fs;
18 if ( !isset( $cbb_fs ) ) {
19 // Activate multisite network integration.
20 if ( !defined( 'WP_FS__PRODUCT_11230_MULTISITE' ) ) {
21 define( 'WP_FS__PRODUCT_11230_MULTISITE', true );
22 }
23 // Include Freemius SDK.
24 require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
25 $menu = array(
26 'slug' => 'edit.php?post_type=boldblocks_block',
27 'account' => true,
28 );
29 if ( !fs_is_network_admin() ) {
30 $menu['first-path'] = 'edit.php?post_type=boldblocks_block&page=cbb-settings';
31 }
32 $cbb_fs = fs_dynamic_init( array(
33 'id' => '11230',
34 'slug' => 'content-blocks-builder',
35 'type' => 'plugin',
36 'public_key' => 'pk_3cf9ea74cc57ecea98583ead30a34',
37 'is_premium' => false,
38 'has_addons' => false,
39 'has_paid_plans' => true,
40 'menu' => $menu,
41 'is_live' => true,
42 ) );
43 }
44 return $cbb_fs;
45 }
46
47 // Init Freemius.
48 cbb_fs();
49 // Disable some Freemius features.
50 cbb_fs()->add_filter( 'show_deactivation_feedback_form', '__return_false' );
51 cbb_fs()->add_filter( 'hide_freemius_powered_by', '__return_true' );
52 // Disable opt-in option by default.
53 cbb_fs()->add_filter( 'permission_diagnostic_default', '__return_false' );
54 cbb_fs()->add_filter( 'permission_extensions_default', '__return_false' );
55 // Hide annoying notices.
56 cbb_fs()->add_filter(
57 'show_admin_notice',
58 function ( $show, $message ) {
59 if ( in_array( $message['id'], array('license_activated', 'premium_activated', 'connect_account') ) ) {
60 return false;
61 }
62 return $show;
63 },
64 10,
65 2
66 );
67 // Signal that SDK was initiated.
68 do_action( 'cbb_fs_loaded' );
69 }
70 if ( !function_exists( 'cbb_fs_custom_connect_message_on_update' ) ) {
71 /**
72 * Customize the opt-in messages
73 *
74 * @param string $message
75 * @param string $user_first_name
76 * @param string $plugin_title
77 * @param string $user_login
78 * @param string $site_link
79 * @param string $freemius_link
80 * @return string
81 */
82 function cbb_fs_custom_connect_message_on_update(
83 $message,
84 $user_first_name,
85 $plugin_title,
86 $user_login,
87 $site_link,
88 $freemius_link
89 ) {
90 return sprintf(
91 __( 'Hey %1$s' ) . ',<br>' . __( 'Thank you for using %2$s. We invite you to help the %2$s community by opting in to share some data about your usage of %2$s with us. This will help us make this plugin more compatible with your site and better at doing what you need it to. You can opt out at any time. And if you skip this, that\'s okay! %2$s will still work just fine.', 'content-blocks-builder' ),
92 $user_first_name,
93 '<b>' . $plugin_title . '</b>',
94 '<b>' . $user_login . '</b>',
95 $site_link,
96 $freemius_link
97 );
98 }
99
100 cbb_fs()->add_filter(
101 'connect_message_on_update',
102 __NAMESPACE__ . '\\cbb_fs_custom_connect_message_on_update',
103 10,
104 6
105 );
106 }
107