| @@ -12,41 +12,38 @@ | ||
| 12 | 12 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -function ife_uninstall_plugin() { | |
| 17 | - $ife_options = get_option( 'ife_facebook_options' ); | |
| 18 | - $delete_ifedata = isset( $ife_options['delete_ifedata'] ) ? $ife_options['delete_ifedata'] : 'no'; | |
| 19 | - if ( 'yes' === $delete_ifedata ) { | |
| 20 | - // Remove options. | |
| 21 | - delete_option( 'ife_facebook_options' ); | |
| 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' ); | |
| 22 | 21 | |
| 23 | - // Remove schduled Imports. | |
| 24 | - $scheduled_import_args = array( | |
| 25 | - 'post_type' => 'fb_scheduled_imports', | |
| 26 | - 'posts_per_page' => -1, // @codingStandardsIgnoreLine. | |
| 27 | - ); | |
| 28 | - $scheduled_imports = get_posts( $scheduled_import_args ); // @codingStandardsIgnoreLine. | |
| 29 | - if ( ! empty( $scheduled_imports ) ) { | |
| 30 | - foreach ( $scheduled_imports as $import ) { | |
| 31 | - if ( ! empty( $import->ID ) ) { | |
| 32 | - wp_delete_post( $import->ID, true ); | |
| 33 | - } | |
| 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 ); | |
| 34 | 32 | } |
| 35 | 33 | } |
| 34 | + } | |
| 36 | 35 | |
| 37 | - // Remove import History. | |
| 38 | - $ife_import_history_args = array( | |
| 39 | - 'post_type' => 'ife_import_history', | |
| 40 | - 'posts_per_page' => -1, // @codingStandardsIgnoreLine. | |
| 41 | - ); | |
| 42 | - $ife_import_history = get_posts( $ife_import_history_args ); // @codingStandardsIgnoreLine. | |
| 43 | - if ( ! empty( $ife_import_history ) ) { | |
| 44 | - foreach ( $ife_import_history as $history ) { | |
| 45 | - if ( ! empty( $history->ID ) ) { | |
| 46 | - wp_delete_post( $history->ID, true ); | |
| 47 | - } | |
| 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 ); | |
| 48 | 46 | } |
| 49 | 47 | } |
| 50 | 48 | } |
| 51 | 49 | } |
| 52 | -ife_uninstall_plugin(); | |