PluginProbe
Email Marketing by EmailOctopus / trunk
Email Marketing by EmailOctopus vtrunk
3.1.10 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 All 39 releases
emailoctopus / uninstall.php

uninstall.php in Email Marketing by EmailOctopus trunk, at uninstall.php

43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Uninstall script for EmailOctopus.
4 */
5
6 // Exit if accessed directly
7 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
8 {
9 exit;
10 }
11
12 global $wpdb;
13
14 // Delete options
15 $plugin_options = $wpdb->get_results(
16 "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'emailoctopus_%' OR option_name LIKE 'widget_emailoctopus_%'"
17 );
18 foreach( $plugin_options as $option ) {
19 delete_option( $option->option_name );
20 }
21
22 // Delete custom tables
23 $tables = [
24 $wpdb->prefix . 'emailoctopus_forms',
25 $wpdb->prefix . 'emailoctopus_forms_meta',
26 $wpdb->prefix . 'emailoctopus_custom_fields',
27 ];
28 foreach ( $tables as $table )
29 {
30 $wpdb->query("DROP TABLE IF EXISTS $table");
31 }
32
33 // Delete cache (should match logic in `Utils::clear_transients()`)
34 $transient_options = $wpdb->get_results(
35 "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '_transient_emailoctopus_%'"
36 );
37 foreach( $transient_options as $option ) {
38 // Remove `_transient_` from the beginning of the string to
39 // determine the transient name
40 $transient_name = preg_replace('/^_transient_/', '', $option->option_name);
41 delete_transient( $transient_name );
42 }
43