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