PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 3.2.0
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v3.2.0
3.2.0 3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 All 57 releases
← All changes | uninstall.php +39 -3 2.11.1 → 3.2.0 View file →
@@ -1,17 +1,53 @@
1 1 <?php
2 2 /**
3 - * Uninstall script for GutSliderBlocks
3 + * Uninstall script for GutSliderBlocks.
4 4 *
5 + * Generated stylesheets are always removed. Stored options are only
6 + * removed when "Delete data on uninstall" is enabled in the settings.
7 + *
5 8 * @package GutSliderBlocks
6 9 */
7 10
8 11 // If uninstall not called from WordPress, then exit.
9 12 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
10 - exit;
13 + exit;
11 14 }
12 15
16 +$gutslider_settings = get_option( 'gutslider_settings', array() );
17 +$gutslider_remove_data = is_array( $gutslider_settings ) && ! empty( $gutslider_settings['remove_data'] );
18 +
13 19 // Load the main plugin file to access the cleanup method.
14 20 require_once plugin_dir_path( __FILE__ ) . 'slider-blocks.php';
15 21
16 -// Cleanup the plugin data.
22 +// Remove generated stylesheets.
17 23 GutSlider\Plugin::cleanup();
24 +
25 +if ( ! $gutslider_remove_data ) {
26 + return;
27 +}
28 +
29 +// Remove the plugin's own options.
30 +$gutslider_options = array(
31 + 'gutslider_settings',
32 + 'gutslider_blocks',
33 + 'gutslider_blocks_version',
34 + 'gutsliderblocks_do_activation_redirect',
35 +);
36 +
37 +$gutslider_blocks_file = plugin_dir_path( __FILE__ ) . 'includes/Api/blocks.php';
38 +
39 +if ( file_exists( $gutslider_blocks_file ) ) {
40 + $gutslider_block_list = include $gutslider_blocks_file;
41 +
42 + if ( is_array( $gutslider_block_list ) ) {
43 + foreach ( $gutslider_block_list as $gutslider_block ) {
44 + if ( isset( $gutslider_block['name'] ) ) {
45 + $gutslider_options[] = 'gut_' . str_replace( '-', '_', $gutslider_block['name'] );
46 + }
47 + }
48 + }
49 +}
50 +
51 +foreach ( array_unique( $gutslider_options ) as $gutslider_option ) {
52 + delete_option( $gutslider_option );
53 +}