| @@ -1,53 +1,17 @@ | ||
| 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 | - * | |
| 8 | 5 | * @package GutSliderBlocks |
| 9 | 6 | */ |
| 10 | 7 | |
| 11 | 8 | // If uninstall not called from WordPress, then exit. |
| 12 | 9 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 13 | - exit; | |
| 10 | + exit; | |
| 14 | 11 | } |
| 15 | 12 | |
| 16 | -$gutslider_settings = get_option( 'gutslider_settings', array() ); | |
| 17 | -$gutslider_remove_data = is_array( $gutslider_settings ) && ! empty( $gutslider_settings['remove_data'] ); | |
| 18 | - | |
| 19 | 13 | // Load the main plugin file to access the cleanup method. |
| 20 | 14 | require_once plugin_dir_path( __FILE__ ) . 'slider-blocks.php'; |
| 21 | 15 | |
| 22 | -// Remove generated stylesheets. | |
| 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 | -} | |
| 16 | +// Cleanup the plugin data. | |
| 17 | +GutSliderBlocks::cleanup(); | |