| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | if ( !defined( 'WP_FS__PRODUCT_11230_MULTISITE' ) ) { |
| 21 | 21 | define( 'WP_FS__PRODUCT_11230_MULTISITE', true ); |
| 22 | 22 | } |
| 23 | 23 | // Include Freemius SDK. |
| 24 | - require_once dirname( __FILE__ ) . '/vendor/freemius/start.php'; | |
| 24 | + require_once __DIR__ . '/vendor/freemius/start.php'; | |
| 25 | 25 | $menu = array( |
| 26 | 26 | 'slug' => 'edit.php?post_type=boldblocks_block', |
| 27 | 27 | 'account' => true, |
| 28 | 28 | ); |
| @@ -29,17 +29,18 @@ | ||
| 29 | 29 | if ( !fs_is_network_admin() ) { |
| 30 | 30 | $menu['first-path'] = 'edit.php?post_type=boldblocks_block&page=cbb-settings'; |
| 31 | 31 | } |
| 32 | 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, | |
| 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 | + 'is_org_compliant' => true, | |
| 42 | 43 | ) ); |
| 43 | 44 | } |
| 44 | 45 | return $cbb_fs; |
| 45 | 46 | } |
| @@ -87,9 +88,10 @@ | ||
| 87 | 88 | $site_link, |
| 88 | 89 | $freemius_link |
| 89 | 90 | ) { |
| 90 | 91 | 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 | + // translators: %s: the first name of the current user. | |
| 93 | + __( 'Hey %1$s', 'content-blocks-builder' ) . ',<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 | 94 | $user_first_name, |
| 93 | 95 | '<b>' . $plugin_title . '</b>', |
| 94 | 96 | '<b>' . $user_login . '</b>', |
| 95 | 97 | $site_link, |
| @@ -103,4 +105,46 @@ | ||
| 103 | 105 | 10, |
| 104 | 106 | 6 |
| 105 | 107 | ); |
| 106 | 108 | } |
| 109 | +if ( !function_exists( 'cbb_uninstall_cleanup' ) ) { | |
| 110 | + /** | |
| 111 | + * Clean up the plugin data | |
| 112 | + * | |
| 113 | + * @return void | |
| 114 | + */ | |
| 115 | + function cbb_uninstall_cleanup() { | |
| 116 | + // Delete options. | |
| 117 | + delete_option( 'cbb_deployed_core_blocks' ); | |
| 118 | + delete_option( 'cbb_core_blocks_version' ); | |
| 119 | + delete_option( 'cbb_current_version' ); | |
| 120 | + delete_option( 'cbb_pattern_categories' ); | |
| 121 | + delete_option( 'cbb_pattern_categories_all_label' ); | |
| 122 | + delete_option( 'cbb_typography' ); | |
| 123 | + delete_option( 'cbb_enable_typography' ); | |
| 124 | + delete_option( 'cbb_use_bunny_fonts' ); | |
| 125 | + delete_option( 'cbb_breakpoints' ); | |
| 126 | + delete_option( 'cbb_is_maintenance' ); | |
| 127 | + delete_option( 'cbb_maintenance_ignore_slug' ); | |
| 128 | + delete_option( 'cbb_maintenance_enable_custom_page' ); | |
| 129 | + delete_option( 'cbb_maintenance_page_id' ); | |
| 130 | + // Legacy options. | |
| 131 | + delete_option( 'boldblocks_deployed_core_blocks' ); | |
| 132 | + delete_option( 'boldblocks_core_blocks_version' ); | |
| 133 | + // Keep CBB data. | |
| 134 | + $keep_data_setting = 'cbb_keep_data'; | |
| 135 | + if ( !get_option( $keep_data_setting ) ) { | |
| 136 | + // Delete all CBB posts. | |
| 137 | + $posts = get_posts( array( | |
| 138 | + 'posts_per_page' => -1, | |
| 139 | + 'post_type' => ['boldblocks_block', 'boldblocks_variation', 'boldblocks_pattern'], | |
| 140 | + 'post_status' => 'any', | |
| 141 | + ) ); | |
| 142 | + foreach ( $posts as $post ) { | |
| 143 | + wp_delete_post( $post->ID, true ); | |
| 144 | + } | |
| 145 | + delete_option( $keep_data_setting ); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | + cbb_fs()->add_action( 'after_uninstall', __NAMESPACE__ . '\\cbb_uninstall_cleanup' ); | |
| 150 | +} | |