| @@ -8,17 +8,31 @@ | ||
| 8 | 8 | $table_name1 = $wpdb->prefix . "mwcode_snippets"; |
| 9 | 9 | $sql = "DROP TABLE IF EXISTS $table_name1"; |
| 10 | 10 | $wpdb->query( $sql ); |
| 11 | 11 | |
| 12 | + | |
| 13 | +} | |
| 14 | + | |
| 15 | +function mwcode_remove_options() { | |
| 16 | + | |
| 12 | 17 | // Delete the options |
| 13 | 18 | $option_functions = 'mwcode_functions'; |
| 14 | 19 | $option_intervals = 'mwcode_intervals'; |
| 20 | + $options = 'mwcode_options'; | |
| 15 | 21 | |
| 22 | + delete_option( $options ); | |
| 16 | 23 | delete_option( $option_functions ); |
| 17 | 24 | delete_option( $option_intervals ); |
| 18 | 25 | } |
| 19 | 26 | |
| 20 | 27 | function mwcode_uninstall () { |
| 21 | - mwcode_remove_database(); | |
| 28 | + $options = get_option( 'mwcode_options' ); | |
| 29 | + $cleanUninstall = array_key_exists( 'clean_uninstall', $options ) ? $options['clean_uninstall'] : false; | |
| 30 | + | |
| 31 | + if ( $cleanUninstall ) { | |
| 32 | + mwcode_remove_options(); | |
| 33 | + mwcode_remove_database(); | |
| 34 | + } | |
| 35 | + | |
| 22 | 36 | } |
| 23 | 37 | |
| 24 | -mwcode_uninstall(); | |
| 38 | +mwcode_uninstall(); | |