| @@ -1,49 +1,49 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Fired when the plugin is uninstalled. | |
| 4 | - * | |
| 5 | - * @link http://xylusthemes.com | |
| 6 | - * @since 1.0.0 | |
| 7 | - * | |
| 8 | - * @package Import_Facebook_Events | |
| 9 | - */ | |
| 10 | - | |
| 11 | -// If uninstall not called from WordPress, then exit. | |
| 12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { | |
| 13 | - exit; | |
| 14 | -} | |
| 15 | - | |
| 16 | -$ife_options = get_option( 'ife_facebook_options' ); | |
| 17 | -$delete_ifedata = isset( $ife_options['delete_ifedata'] )? $ife_options['delete_ifedata'] : 'no'; | |
| 18 | -if( $delete_ifedata == 'yes' ){ | |
| 19 | - // Remove options | |
| 20 | - delete_option( 'ife_facebook_options' ); | |
| 21 | - | |
| 22 | - // Remove schduled Imports | |
| 23 | - $scheduled_import_args = array( | |
| 24 | - 'post_type' => 'fb_scheduled_imports', | |
| 25 | - 'posts_per_page' => -1, | |
| 26 | - ); | |
| 27 | - $scheduled_imports = get_posts( $scheduled_import_args ); | |
| 28 | - if( !empty( $scheduled_imports ) ){ | |
| 29 | - foreach ( $scheduled_imports as $import ) { | |
| 30 | - if( $import->ID != '' ){ | |
| 31 | - wp_delete_post( $import->ID, true ); | |
| 32 | - } | |
| 33 | - } | |
| 34 | - } | |
| 35 | - | |
| 36 | - // Remove import History | |
| 37 | - $ife_import_history_args = array( | |
| 38 | - 'post_type' => 'ife_import_history', | |
| 39 | - 'posts_per_page' => -1, | |
| 40 | - ); | |
| 41 | - $ife_import_history = get_posts( $ife_import_history_args ); | |
| 42 | - if( !empty( $ife_import_history ) ){ | |
| 43 | - foreach ( $ife_import_history as $history ) { | |
| 44 | - if( $history->ID != '' ){ | |
| 45 | - wp_delete_post( $history->ID, true ); | |
| 46 | - } | |
| 47 | - } | |
| 48 | - } | |
| 49 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Fired when the plugin is uninstalled. | |
| 4 | + * | |
| 5 | + * @link http://xylusthemes.com | |
| 6 | + * @since 1.0.0 | |
| 7 | + * | |
| 8 | + * @package Import_Facebook_Events | |
| 9 | + */ | |
| 10 | + | |
| 11 | +// If uninstall not called from WordPress, then exit. | |
| 12 | +if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { | |
| 13 | + exit; | |
| 14 | +} | |
| 15 | + | |
| 16 | +$ife_options = get_option( 'ife_facebook_options' ); | |
| 17 | +$delete_ifedata = isset( $ife_options['delete_ifedata'] ) ? $ife_options['delete_ifedata'] : 'no'; | |
| 18 | +if ( 'yes' === $delete_ifedata ) { | |
| 19 | + // Remove options. | |
| 20 | + delete_option( 'ife_facebook_options' ); | |
| 21 | + | |
| 22 | + // Remove schduled Imports. | |
| 23 | + $scheduled_import_args = array( | |
| 24 | + 'post_type' => 'fb_scheduled_imports', | |
| 25 | + 'posts_per_page' => -1, // @codingStandardsIgnoreLine. | |
| 26 | + ); | |
| 27 | + $scheduled_imports = get_posts( $scheduled_import_args ); // @codingStandardsIgnoreLine. | |
| 28 | + if ( ! empty( $scheduled_imports ) ) { | |
| 29 | + foreach ( $scheduled_imports as $import ) { | |
| 30 | + if ( ! empty( $import->ID ) ) { | |
| 31 | + wp_delete_post( $import->ID, true ); | |
| 32 | + } | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + // Remove import History. | |
| 37 | + $ife_import_history_args = array( | |
| 38 | + 'post_type' => 'ife_import_history', | |
| 39 | + 'posts_per_page' => -1, // @codingStandardsIgnoreLine. | |
| 40 | + ); | |
| 41 | + $ife_import_history = get_posts( $ife_import_history_args ); // @codingStandardsIgnoreLine. | |
| 42 | + if ( ! empty( $ife_import_history ) ) { | |
| 43 | + foreach ( $ife_import_history as $history ) { | |
| 44 | + if ( ! empty( $history->ID ) ) { | |
| 45 | + wp_delete_post( $history->ID, true ); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + } | |
| 49 | +} | |