wpcf7_rmdir_p

The Contact Form 7 wpcf7 rmdir p function.

Description

wpcf7_rmdir_p( $dir ); 

Parameters (1)

0. $dir
The dir.

Usage

  1. if ( !function_exists( 'wpcf7_rmdir_p' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/functions.php'; 
  3.  
  4. // The dir. 
  5. $dir = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_rmdir_p($dir); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function wpcf7_rmdir_p( $dir ) { 
  2. if ( is_file( $dir ) ) { 
  3. if ( ! $result = @unlink( $dir ) ) { 
  4. $stat = @stat( $dir ); 
  5. $perms = $stat['mode']; 
  6. @chmod( $dir, $perms | 0200 ); // add write for owner 
  7.  
  8. if ( ! $result = @unlink( $dir ) ) { 
  9. @chmod( $dir, $perms ); 
  10.  
  11. return $result; 
  12.  
  13. if ( ! is_dir( $dir ) ) { 
  14. return false; 
  15.  
  16. if ( $handle = @opendir( $dir ) ) { 
  17. while ( false !== ( $file = readdir( $handle ) ) ) { 
  18. if ( $file == "." || $file == ".." ) { 
  19. continue; 
  20.  
  21. wpcf7_rmdir_p( path_join( $dir, $file ) ); 
  22.  
  23. closedir( $handle ); 
  24.  
  25. return @rmdir( $dir );