wp-mail-smtp
Last commit date
assets
7 years ago
languages
7 years ago
src
7 years ago
vendor
7 years ago
class-wpms-am-notification.php
7 years ago
readme.txt
7 years ago
uninstall.php
7 years ago
wp-mail-smtp.php
7 years ago
wp_mail_smtp.php
7 years ago
uninstall.php
62 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Uninstalls WP Mail SMTP. |
| 4 | * |
| 5 | * @since 1.3.0 |
| 6 | */ |
| 7 | |
| 8 | // Exit if accessed directly. |
| 9 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | // Confirm user has decided to remove all data, otherwise stop. |
| 14 | $settings = get_option( 'wp_mail_smtp', array() ); |
| 15 | if ( empty( $settings['general']['uninstall'] ) ) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | // Remove options. |
| 20 | $options = array( |
| 21 | 'wp_mail_smtp_initial_version', |
| 22 | 'wp_mail_smtp_version', |
| 23 | 'wp_mail_smtp_debug', |
| 24 | 'wp_mail_smtp', |
| 25 | '_amn_smtp_last_checked', |
| 26 | // Legacy options. |
| 27 | 'pepipost_ssl', |
| 28 | 'pepipost_port', |
| 29 | 'pepipost_pass', |
| 30 | 'pepipost_user', |
| 31 | 'smtp_pass', |
| 32 | 'smtp_user', |
| 33 | 'smtp_auth', |
| 34 | 'smtp_ssl', |
| 35 | 'smtp_port', |
| 36 | 'smtp_host', |
| 37 | 'mail_set_return_path', |
| 38 | 'mailer', |
| 39 | 'mail_from_name', |
| 40 | 'mail_from', |
| 41 | 'wp_mail_smtp_am_notifications_hidden', |
| 42 | ); |
| 43 | |
| 44 | foreach ( $options as $option ) { |
| 45 | delete_option( $option ); |
| 46 | } |
| 47 | |
| 48 | // Remove product announcements. |
| 49 | $annoucements = get_posts( |
| 50 | array( |
| 51 | 'post_type' => array( 'amn_smtp' ), |
| 52 | 'post_status' => 'any', |
| 53 | 'numberposts' => - 1, |
| 54 | 'fields' => 'ids', |
| 55 | ) |
| 56 | ); |
| 57 | if ( ! empty( $annoucements ) ) { |
| 58 | foreach ( $annoucements as $annoucement ) { |
| 59 | wp_delete_post( $annoucement, true ); |
| 60 | } |
| 61 | } |
| 62 |