-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall.php
50 lines (37 loc) · 1.08 KB
/
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
47
48
49
50
<?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 {
wp_delete_file( $dir . "/" . $object );
}
}
}
global $wp_filesystem;
$wp_filesystem->rmdir( $dir, true );
}
}
$upload = wp_upload_dir();
$upload_dir = $upload['basedir'] . '/elementor_icons_files';
$options = get_option( 'ec_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'] );
if ( file_exists( $upload_dir . '/' . $font_decode['name'] . '.json' ) ) {
wp_delete_file( $upload_dir . '/' . $font_decode['name'] . '.json' );
}
}
}
wp_delete_file( $upload_dir . '/merged-icons-font.css');
delete_option('ec_icons_fonts');