gglstmp_info_site

The Google Sitemap by BestWebSoft gglstmp info site function.

Description

gglstmp_info_site( $gglstmp_wmt, $gglstmp_sv ); 

Parameters (2)

0. $gglstmp_wmt
The gglstmp wmt.
1. $gglstmp_sv
The gglstmp sv.

Usage

  1. if ( !function_exists( 'gglstmp_info_site' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-sitemap-by-bestwebsoft/google-sitemap-plugin.php'; 
  3.  
  4. // The gglstmp wmt. 
  5. $gglstmp_wmt = null; 
  6.  
  7. // The gglstmp sv. 
  8. $gglstmp_sv = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = gglstmp_info_site($gglstmp_wmt, $gglstmp_sv); 
  12.  

Defined (1)

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

/google-sitemap-plugin.php  
  1. function gglstmp_info_site( $gglstmp_wmt, $gglstmp_sv ) { 
  2. global $gglstmp_settings; 
  3.  
  4. $gglstmp_url_home = home_url( '/' ); 
  5. $gglstmp_instruction_url = 'https://docs.google.com/document/d/1VOJx_OaasVskCqi9fsAbUmxfsckoagPU5Py97yjha9w/edit'; 
  6. $gglstmp_wmt_sites_arr = $gglstmp_wmt_sitemaps_arr = array(); 
  7.  
  8. echo '<h3 style="font-size: 1em;">' . sprintf( __( 'Site info for %s', 'google-sitemap-plugin' ), '<a href="' . $gglstmp_url_home . '" target="_blank">' . $gglstmp_url_home . '</a>' ) . ':</h3><div class="gglstmp_wmt_content">'; 
  9.  
  10. $gglstmp_wmt_sites = $gglstmp_wmt->sites->listSites()->getSiteEntry(); 
  11. foreach ( $gglstmp_wmt_sites as $gglstmp_wmt_site ) { 
  12. $gglstmp_wmt_sites_arr[ $gglstmp_wmt_site->siteUrl ] = $gglstmp_wmt_site->permissionLevel; 
  13.  
  14. if ( ! array_key_exists( $gglstmp_url_home, $gglstmp_wmt_sites_arr ) ) { 
  15. printf( '<div>%s.</div>', __( 'This site has not been added to Google Webmaster Tools', 'google-sitemap-plugin') ); 
  16. echo '</div><!-- .gglstmp_wmt_content -->'; 
  17. return; 
  18. } else { 
  19. printf( '<div>%s.</div>', __( 'This site has not been added to Google Webmaster Tools', 'google-sitemap-plugin' ) ); 
  20. printf( '<div><strong>%s:</strong> <a href="%s" target="_blank">%2$s</a>.</div>', __( 'Site URL', 'google-sitemap-plugin'), $gglstmp_url_home ); 
  21. printf( '<div><strong>%s:</strong> %s.</div>', __( 'Site verification', 'google-sitemap-plugin' ), ( $gglstmp_wmt_sites_arr[ $gglstmp_url_home ] == 'siteOwner' ) ? __( 'verified', 'google-sitemap-plugin' ) : __( 'not verified', 'google-sitemap-plugin' ) ); 
  22.  
  23. try { 
  24. $gglstmp_wmt_sitemaps = $gglstmp_wmt->sitemaps->listSitemaps( $gglstmp_url_home )->getSitemap(); 
  25. } catch ( Google_Service_Exception $e ) { 
  26. $getErrors = $e->getErrors(); 
  27. if ( isset( $getErrors[0]['message'] ) ) { 
  28. printf( '<div>%s</div>', $getErrors[0]['message'] ); 
  29. } else { 
  30. printf( '<div>%s.</div>', __( 'Failed to verify the site in Google Webmaster Tools', 'google-sitemap-plugin' ) ); 
  31. printf( '<div>%s - <a target="_blank" href="%s">%s</a>.</div>', __( "The site couldn't be verified. Please, verify the site manually", 'google-sitemap-plugin' ), $gglstmp_instruction_url, __( 'View the Instruction', 'google-sitemap-plugin' ) ); 
  32. echo '</div><!-- .gglstmp_wmt_content -->'; 
  33. return; 
  34.  
  35. $gglstmp_wmt_sitemaps = $gglstmp_wmt->sitemaps->listSitemaps( $gglstmp_url_home )->getSitemap(); 
  36. foreach ( $gglstmp_wmt_sitemaps as $gglstmp_wmt_sitemap ) { 
  37. $gglstmp_wmt_sitemaps_arr[ $gglstmp_wmt_sitemap->path ] = ( $gglstmp_wmt_sitemap->errors > 0 || $gglstmp_wmt_sitemap->warnings > 0 ) ? true : false; 
  38.  
  39. if ( isset( $gglstmp_settings['sitemap']['loc'] ) ) { 
  40. $gglstmp_url_sitemap = $gglstmp_settings['sitemap']['loc']; 
  41. if ( ! array_key_exists( $gglstmp_url_sitemap, $gglstmp_wmt_sitemaps_arr ) ) { 
  42. printf( '<div>%s.</div>', __( 'The sitemap file has not been added to Google Webmaster Tools', 'google-sitemap-plugin') ); 
  43. } else { 
  44. if( ! $gglstmp_wmt_sitemaps_arr[ $gglstmp_url_sitemap ] ) { 
  45. printf( '<div>%s.</div>', __( 'The sitemap file has not been added to Google Webmaster Tools', 'google-sitemap-plugin') ); 
  46. } else { 
  47. printf( '<div class="gglstmp_wmt_error">%s <a href="%s">%s</a>.</div>', __( 'The sitemap file has been added to Google Webmaster Tools, but has some errors or warnings', 'google-sitemap-plugin' ), sprintf( 'https://www.google.com/webmasters/tools/sitemap-details?hl=en&siteUrl=%s&sitemapUrl=%s#ISSUE_FILTER=-1', urlencode( $gglstmp_url_home ), urlencode( $gglstmp_url_sitemap ) ), __( 'Please, see them in Google Webmaster Tools', 'google-sitemap-plugin' ) ); 
  48. printf( '<div><strong>%s:</strong> <a href="%s" target="_blank">%2$s</a>.</div>', __( 'Sitemap URL', 'google-sitemap-plugin'), $gglstmp_url_sitemap ); 
  49. } else { 
  50. printf( '<div>%s - <a target="_blank" href="%s">%s</a>.</div>', __( 'When checking the sitemap file an unexpectederroroccurred. Please, check the sitemap file manually', 'google-sitemap-plugin' ), $gglstmp_instruction_url, __( 'View the Instruction', 'google-sitemap-plugin' ) ); 
  51. echo '</div><!-- .gglstmp_wmt_content -->';