apgnsm_permissions

The Google News Sitemap apgnsm permissions function.

Description

apgnsm_permissions(); 

Usage

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

Defined (1)

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

/apgnsm.php  
  1. function apgnsm_permissions() { 
  2.  
  3. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  4.  
  5. $apgnsm_path = ABSPATH . get_option('apgnsm_path'); 
  6. $apgnsm_news_file_path = $apgnsm_path . "sitemap-news.xml"; 
  7.  
  8.  
  9. if ($apgnsm_news_active && is_file($apgnsm_news_file_path) && is_writable($apgnsm_news_file_path)) $apgnsm_permission += 0; 
  10. elseif ($apgnsm_news_active && !is_file($apgnsm_news_file_path) && is_writable($apgnsm_path)) { 
  11. $fp = fopen($apgnsm_news_file_path, 'w'); 
  12. fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:n=\"http://www.google.com/schemas/sitemap-news/0.9\" />"); 
  13. fclose($fp); 
  14. if (is_file($apgnsm_news_file_path) && is_writable($apgnsm_news_file_path)) $apgnsm_permission += 0; 
  15. else $apgnsm_permission += 2; 
  16. elseif ($apgnsm_news_active) $apgnsm_permission += 2; 
  17. else $apgnsm_permission += 0; 
  18.  
  19. return $apgnsm_permission;