| 1 |
<?php |
| 2 |
/** |
| 3 |
* Deactivator function |
| 4 |
* |
| 5 |
* @package Wow_Plugin |
| 6 |
* @subpackage |
| 7 |
* @copyright Copyright (c) 2018, Dmytro Lobov |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 13 |
|
| 14 |
if ( is_dir( $basedir ) ) { |
| 15 |
|
| 16 |
$is_empty = count( glob( $basedir . '*' ) ) ? true : false; |
| 17 |
if ( $is_empty === true ) { |
| 18 |
$handle = opendir( $basedir ); |
| 19 |
|
| 20 |
while ( false !== ($file = readdir( $handle )) ) { |
| 21 |
|
| 22 |
if ( $file != "." && $file != ".." ) { |
| 23 |
wp_delete_file( $basedir . $file ); |
| 24 |
} |
| 25 |
|
| 26 |
} |
| 27 |
closedir( $dir_handle ); |
| 28 |
} |
| 29 |
rmdir( $basedir ); |
| 30 |
} |