siteguard
Last commit date
admin
3 years ago
classes
2 years ago
css
3 years ago
images
11 years ago
languages
5 years ago
really-simple-captcha
2 years ago
test
3 years ago
.htaccess
3 years ago
license.txt
11 years ago
readme.txt
1 year ago
siteguard.php
2 years ago
uninstall.php
3 years ago
uninstall.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 4 | exit(); |
| 5 | } |
| 6 | |
| 7 | function remove_directory( $dir ) { |
| 8 | $files = array_diff( scandir( $dir ), array( '.' ,'..' ) ); |
| 9 | foreach ( $files as $file ) { |
| 10 | if ( is_dir( "$dir/$file" ) ) { |
| 11 | remove_directory( "$dir/$file" ); |
| 12 | } else { |
| 13 | unlink( "$dir/$file" ); |
| 14 | } |
| 15 | } |
| 16 | return rmdir( $dir ); |
| 17 | } |
| 18 | |
| 19 | function delete_siteguard_plugin() { |
| 20 | global $wpdb; |
| 21 | |
| 22 | delete_option( 'siteguard_config' ); |
| 23 | |
| 24 | $table_name = $wpdb->prefix . 'siteguard_login'; |
| 25 | $wpdb->query( "DROP TABLE IF EXISTS $table_name;" ); |
| 26 | |
| 27 | $table_name = $wpdb->prefix . 'siteguard_history'; |
| 28 | $wpdb->query( "DROP TABLE IF EXISTS $table_name;" ); |
| 29 | |
| 30 | remove_directory( WP_CONTENT_DIR . '/siteguard' ); |
| 31 | } |
| 32 | |
| 33 | delete_siteguard_plugin(); |
| 34 |