-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
46 lines (33 loc) · 892 Bytes
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
function ecicons_rrmdir( $dir ) {
if ( is_dir( $dir ) ) {
$objects = scandir( $dir );
foreach ( $objects as $object ) {
if ( $object != "." && $object != ".." ) {
if ( is_dir( $dir . "/" . $object ) ) {
ecicons_rrmdir( $dir . "/" . $object );
} else {
unlink( $dir . "/" . $object );
}
}
}
rmdir( $dir );
}
}
$upload = wp_upload_dir();
$upload_dir = $upload['basedir'] . '/cornerstone_icons_files';
$options = get_option( 'cc_icons_fonts' );
if ( !empty( $options ) && is_array($options) ) {
foreach ( $options as $key => $font ) {
if ( empty( $font['data'] ) ) {
continue;
}
$font_decode = json_decode($font['data'],true);
ecicons_rrmdir( $upload_dir . '/' . $font_decode['file_name'] );
}
}
unlink( $upload_dir . '/merged-icons-font.css');
delete_option('cc_icons_fonts');