bws_delete_plugin

The Google Sitemap by BestWebSoft bws delete plugin function.

Description

bws_delete_plugin( (string) $basename ); 

Parameters (1)

0. $basename (string)
The basename.

Usage

  1. if ( !function_exists( 'bws_delete_plugin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-sitemap-by-bestwebsoft/bws_menu/bws_functions.php'; 
  3.  
  4. // The basename. 
  5. $basename = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bws_delete_plugin($basename); 
  9.  

Defined (1)

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

/bws_menu/bws_functions.php  
  1. function bws_delete_plugin( $basename ) { 
  2. global $bstwbsftwppdtplgns_options; 
  3.  
  4. $is_multisite = is_multisite(); 
  5. if ( $is_multisite ) 
  6. $blog_id = get_current_blog_id(); 
  7.  
  8. if ( ! isset( $bstwbsftwppdtplgns_options ) ) 
  9. $bstwbsftwppdtplgns_options = ( $is_multisite ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' ); 
  10.  
  11. /** remove bws_menu versions */ 
  12. unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $basename ] ); 
  13. /** if empty ['bws_menu']['version'] - there is no other bws plugins - delete all */ 
  14. if ( empty( $bstwbsftwppdtplgns_options['bws_menu']['version'] ) ) { 
  15. /** remove options */ 
  16. if ( $is_multisite )  
  17. delete_site_option( 'bstwbsftwppdtplgns_options' ); 
  18. else 
  19. delete_option( 'bstwbsftwppdtplgns_options' ); 
  20.  
  21. /** remove custom_code */ 
  22. if ( $is_multisite ) { 
  23. global $wpdb; 
  24. $old_blog = $wpdb->blogid; 
  25. /** Get all blog ids */ 
  26. $blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" ); 
  27. foreach ( $blogids as $blog_id ) { 
  28. switch_to_blog( $blog_id ); 
  29. $upload_dir = wp_upload_dir(); 
  30. $folder = $upload_dir['basedir'] . '/bws-custom-code'; 
  31. if ( file_exists( $folder ) && is_dir( $folder ) ) { 
  32. array_map( 'unlink', glob( "$folder/*" ) ); 
  33. rmdir( $folder ); 
  34. switch_to_blog( $old_blog ); 
  35. } else { 
  36. $upload_dir = wp_upload_dir(); 
  37. $folder = $upload_dir['basedir'] . '/bws-custom-code'; 
  38. if ( file_exists( $folder ) && is_dir( $folder ) ) { 
  39. array_map( 'unlink', glob( "$folder/*" ) ); 
  40. rmdir( $folder ); 
  41. }