gglstmp_delete_settings

The Google Sitemap by BestWebSoft gglstmp delete settings function.

Description

gglstmp_delete_settings(); 

Usage

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

Defined (1)

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

/google-sitemap-plugin.php  
  1. function gglstmp_delete_settings() { 
  2. global $wpdb; 
  3. if ( ! function_exists( 'get_plugins' ) ) 
  4. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  5. $all_plugins = get_plugins(); 
  6.  
  7. if ( ! array_key_exists( 'google-sitemap-pro/google-sitemap-pro.php', $all_plugins ) ) { 
  8. if ( is_multisite() ) { 
  9. /** Get all blog ids */ 
  10. $blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" ); 
  11. foreach ( $blogids as $blog_id ) { 
  12. delete_blog_option( $blog_id, 'gglstmp_options' ); 
  13. delete_blog_option( $blog_id, 'gglstmp_robots' ); 
  14. $site_url = preg_replace( "/[^a-zA-Z*-**-*0-9\s]/", '_', str_replace( 'http://', '', str_replace( 'https://', '', get_site_url( $blog_id ) ) ) ); 
  15. $file = ABSPATH . "sitemap_{$site_url}.xml"; 
  16. if ( file_exists( $file ) ) 
  17. unlink( $file ); 
  18. } else { 
  19. delete_option( 'gglstmp_options' ); 
  20. delete_option( 'gglstmp_robots' ); 
  21. $sitemap_path = ABSPATH . "sitemap.xml"; 
  22. $sitemap_url = site_url( '/sitemap.xml' ); 
  23. $robots_path = ABSPATH . "robots.txt"; 
  24.  
  25. if ( file_exists( $sitemap_path ) ) 
  26. unlink( $sitemap_path ); 
  27.  
  28. if ( file_exists( $robots_path ) ) { 
  29. if ( ! is_writable( $robots_path ) ) 
  30. @chmod( $robots_path, 0755 ); 
  31. if ( is_writable( $robots_path ) ) { 
  32. $content = file_get_contents( $robots_path ); 
  33. $content = preg_replace( "|\nSitemap: {$sitemap_url}|", '', $content ); 
  34. file_put_contents( $robots_path, $content ); 
  35.  
  36. require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' ); 
  37. bws_include_init( plugin_basename( __FILE__ ) ); 
  38. bws_delete_plugin( plugin_basename( __FILE__ ) );