/apgnsm.php

  1. <?php 
  2.  
  3. /** 
  4. Plugin Name: Google News Sitemap 
  5. Plugin URI: http://andreapernici.com/wordpress/google-news-sitemap/ 
  6. Description: Automatically generate sitemap for inclusion in Google News. Go to <a href="options-general.php?page=apgnsm.php">Settings -> Google News Sitemap</a> for setup. 
  7. Version: 1.0.9 
  8. Author: Andrea Pernici 
  9. Author URI: http://www.andreapernici.com/ 
  10.  
  11. Copyright 2009 Andrea Pernici (andreapernici@gmail.com) 
  12.  
  13. This program is free software; you can redistribute it and/or modify 
  14. it under the terms of the GNU General Public License as published by 
  15. the Free Software Foundation; either version 2 of the License, or 
  16. (at your option) any later version. 
  17.  
  18. This program is distributed in the hope that it will be useful,  
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of 
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
  21. GNU General Public License for more details. 
  22.  
  23. You should have received a copy of the GNU General Public License 
  24. along with this program; if not, write to the Free Software 
  25. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
  26.   
  27. */ 
  28.  
  29. $apgnsm_sitemap_version = "1.0.9"; 
  30.  
  31. // Aggiungiamo le opzioni di default 
  32. add_option('apgnsm_news_active', true); 
  33. add_option('apgnsm_tags', true); 
  34. add_option('apgnsm_path', "./"); 
  35. add_option('apgnsm_last_ping', 0); 
  36. //add_option('apgnsm_publication_name', '<publication_name>'); 
  37. add_option('apgnsm_n_name', 'Your Google News Name'); 
  38. add_option('apgnsm_n_lang', 'it'); 
  39. // Genere dei contenuti 
  40. add_option('apgnsm_n_genres', false); 
  41. add_option('apgnsm_n_genres_type', 'blog'); 
  42. // Tipo di accesso dell'articolo - Facoltativo 
  43. add_option('apgnsm_n_access', false); 
  44. add_option('apgnsm_n_access_type', 'Subscription'); 
  45. //add_option('apgnsm_n_access_type', 'Registration'); 
  46. //add_option('apgnsm_n_excludecat', false); 
  47. add_option('apgnsm_n_excludecatlist', ''); 
  48. add_option('apgnsm_n_excludepostlist', ''); 
  49. //Controllo eliminazione, pubblicazione pagine post per rebuild 
  50. add_action('delete_post', 'apgnsm_autobuild' , 9999, 1);  
  51. add_action('publish_post', 'apgnsm_autobuild' , 9999, 1);  
  52. add_action('publish_page', 'apgnsm_autobuild' , 9999, 1); 
  53. // Scheduled Posts fix by Elliot 
  54. add_action('apgnsm_scheduled', 'apgnsm_scheduled_build'); 
  55. // Carichiamo le opzioni 
  56. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  57. $apgnsm_path = get_option('apgnsm_path'); 
  58. //$apgnsm_publication_name = get_option('apgnsm_publication_name', '<publication_name>'); 
  59. $apgnsm_n_name = get_option('apgnsm_n_name', '<n:name>'); 
  60. $apgnsm_n_lang = get_option('apgnsm_n_lang', '<n:language>'); 
  61. $apgnsm_n_access = get_option('apgnsm_n_access', '<n:access>'); 
  62. $apgnsm_n_genres = get_option('apgnsm_n_genres', '<n:genres>'); 
  63.  
  64.  
  65. // Aggiungiamo la pagina delle opzioni 
  66. add_action('admin_menu', 'apgnsm_add_pages'); 
  67.  
  68. //Aggiungo la pagina della configurazione 
  69. function apgnsm_add_pages() { 
  70. add_options_page("Google News Sitemap", "Sitemap Google News", 8, basename(__FILE__), "apgnsm_admin_page"); 
  71.  
  72.  
  73. function apgnsm_escapexml($string) { 
  74. return str_replace ( array ( '&', '"', "'", '<', '>'), array ( '&' , '"', ''' , '<' , '>'), $string); 
  75.  
  76. function apgnsm_permissions() { 
  77.  
  78. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  79.  
  80. $apgnsm_path = ABSPATH . get_option('apgnsm_path'); 
  81. $apgnsm_news_file_path = $apgnsm_path . "sitemap-news.xml"; 
  82.  
  83.  
  84. if ($apgnsm_news_active && is_file($apgnsm_news_file_path) && is_writable($apgnsm_news_file_path)) $apgnsm_permission += 0; 
  85. elseif ($apgnsm_news_active && !is_file($apgnsm_news_file_path) && is_writable($apgnsm_path)) { 
  86. $fp = fopen($apgnsm_news_file_path, 'w'); 
  87. 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\" />"); 
  88. fclose($fp); 
  89. if (is_file($apgnsm_news_file_path) && is_writable($apgnsm_news_file_path)) $apgnsm_permission += 0; 
  90. else $apgnsm_permission += 2; 
  91. elseif ($apgnsm_news_active) $apgnsm_permission += 2; 
  92. else $apgnsm_permission += 0; 
  93.  
  94. return $apgnsm_permission; 
  95.  
  96. /** 
  97. Auto Build sitemap 
  98. */ 
  99. function apgnsm_autobuild($postID) { 
  100. global $wp_version; 
  101. $isScheduled = false; 
  102. $lastPostID = 0; 
  103. //Ricostruisce la sitemap una volta per post se non fa import 
  104. if($lastPostID != $postID && (!defined('WP_IMPORTING') || WP_IMPORTING != true)) { 
  105.  
  106. //Costruisce la sitemap direttamente oppure fa un cron 
  107. if(floatval($wp_version) >= 2.1) { 
  108. if(!$isScheduled) { 
  109. //Ogni 15 secondi. 
  110. //Pulisce tutti gli hooks. 
  111. wp_clear_scheduled_hook(apgnsm_generate_sitemap()); 
  112. wp_schedule_single_event(time()+15, apgnsm_generate_sitemap()); 
  113. // Elliot Fix for scheduled posts 
  114. wp_clear_scheduled_hook('apgnsm_scheduled'); 
  115. wp_schedule_single_event(time()+15, 'apgnsm_scheduled'); 
  116. $isScheduled = true; 
  117. } else { 
  118. //Costruisce la sitemap una volta sola e mai in bulk mode 
  119. if(!$lastPostID && (!isset($_GET["delete"]) || count((array) $_GET['delete'])<=0)) { 
  120. apgnsm_generate_sitemap(); 
  121. $lastPostID = $postID; 
  122. /** 
  123. Elliot Fix for scheduled posts 
  124. */  
  125. function apgnsm_scheduled_build() { 
  126. apgnsm_generate_sitemap(); 
  127. }  
  128.  
  129. function apgnsm_generate_sitemap() { 
  130. global $apgnsm_sitemap_version, $table_prefix; 
  131. global $wpdb; 
  132.  
  133. $t = $table_prefix; 
  134.  
  135. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  136. $apgnsm_path = get_option('apgnsm_path'); 
  137. //add_option('apgnsm_publication_name', '<publication_name>'); 
  138. $apgnsm_n_name = get_option('apgnsm_n_name'); 
  139. $apgnsm_n_lang = get_option('apgnsm_n_lang'); 
  140. // Genere dei contenuti 
  141. $apgnsm_n_genres = get_option('apgnsm_n_genres'); 
  142. $apgnsm_n_genres_type = get_option('apgnsm_n_genres_type'); 
  143. // Tipo di accesso dell'articolo - Facoltativo 
  144. $apgnsm_n_access = get_option('apgnsm_n_access'); 
  145. $apgnsm_n_access_type = get_option('apgnsm_n_access_type'); 
  146. //add_option('apgnsm_n_access_type', 'Registration'); 
  147. //$apgnsm_n_excludecat = get_option('apgnsm_n_excludecat'); 
  148. $apgnsm_n_excludecatlist = get_option('apgnsm_n_excludecatlist'); 
  149. $apgnsm_n_excludepostlist = get_option('apgnsm_n_excludepostlist'); 
  150.  
  151. $includeMe = ''; 
  152. $includeNoCat = ''; 
  153. $includeNoPost = ''; 
  154. if ( $apgnsm_n_excludecatlist <> NULL ) { 
  155. $exPosts = get_objects_in_term($apgnsm_n_excludecatlist, "category"); 
  156. $includeNoCat = ' AND `ID` NOT IN ('.implode(", ", $exPosts).')'; 
  157. if ($exPosts != WP_Error) { $ceck = implode(", ", $exPosts); } 
  158. if ($ceck == '' || $ceck == ' ') $includeNoCat = ''; 
  159. if ($apgnsm_n_excludepostlist != '') { 
  160. $includeNoPost = ' AND `ID` NOT IN ('.$apgnsm_n_excludepostlist.')'; 
  161. if ($exPosts != WP_Error) { $ceck = implode(", ", $exPosts); } 
  162. if ($apgnsm_n_excludepostlist == '' || $apgnsm_n_excludepostlist == ' ') $includeNoPost = ''; 
  163.  
  164. $apgnsm_permission = apgnsm_permissions(); 
  165. if ($apgnsm_permission > 2 || (!$apgnsm_active && !$apgnsm_news_active)) return; 
  166.  
  167. //mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 
  168. //mysql_query("SET NAMES '".DB_CHARSET."'"); 
  169. //mysql_select_db(DB_NAME); 
  170.  
  171. $home = get_option('home') . "/"; 
  172.  
  173. $xml_sitemap_google_news = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; 
  174. $xml_sitemap_google_news .= "\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:n=\"http://www.google.com/schemas/sitemap-news/0.9\"> 
  175. <!-- Generated by Google News Sitemap ".$apgnsm_sitemap_version." --> 
  176. <!-- plugin by Andrea Pernici --> 
  177. <!-- http://andreapernici.com/wordpress/google-news-sitemap/ --> 
  178. <!-- Created ".date("F d, Y, H:i")." -->"; 
  179.  
  180. $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->posts." WHERE `post_status`='publish'  
  181. AND (`post_type`='page' OR `post_type`='post') ". $includeNoCat . ' ' . $includeNoPost." GROUP BY `ID` ORDER BY `post_modified_gmt` DESC");  
  182.  
  183. $now = time(); 
  184. $twoDays = 2*24*60*60; 
  185.  
  186. foreach ($posts as $post) { 
  187. if ($apgnsm_news_active && $apgnsm_permission != 2) { 
  188. $postDate = strtotime($post->post_date); 
  189. if ($now - $postDate < $twoDays) { 
  190. $xml_sitemap_google_news .= " 
  191. <url> 
  192. <loc>".apgnsm_escapexml(get_permalink($post->ID))."</loc> 
  193. <n:news> 
  194. <n:publication> 
  195. <n:name>".$apgnsm_n_name."</n:name> 
  196. <n:language>".$apgnsm_n_lang."</n:language> 
  197. </n:publication>"; 
  198.  
  199. // Se selzionato il genere allora lo aggiungo 
  200. if ($apgnsm_n_genres == true) { 
  201. $xml_sitemap_google_news .= " 
  202. <n:genres>".$apgnsm_n_genres_type."</n:genres>"; 
  203. // Se selzionato il tipo di accesso allora lo aggiungo 
  204. if ($apgnsm_n_access == true) { 
  205. $xml_sitemap_google_news .= " 
  206. <n:access>".$apgnsm_n_access_type."</n:access>"; 
  207. }  
  208.  
  209. $xml_sitemap_google_news .= "  
  210. <n:publication_date>".str_replace(" ", "T", $post->post_date_gmt)."Z"."</n:publication_date> 
  211. <n:title>".htmlspecialchars($post->post_title)."</n:title> 
  212. </n:news> 
  213. </url>"; 
  214.  
  215. $xml_sitemap_google_news .= "\n</urlset>"; 
  216.  
  217.  
  218. if ($apgnsm_news_active && $apgnsm_permission != 2) { 
  219. $fp = fopen(ABSPATH . $apgnsm_path . "sitemap-news.xml", 'w'); 
  220. fwrite($fp, $xml_sitemap_google_news); 
  221. fclose($fp); 
  222.  
  223.  
  224. $apgnsm_last_ping = get_option('apgnsm_last_ping'); 
  225. if ((time() - $apgnsm_last_ping) > 60 * 60) { 
  226. //get_headers("http://www.google.com/webmasters/tools/ping?sitemap=" . urlencode($home . $apgnsm_path . "sitemap.xml")); //PHP5+ 
  227. $fp = @fopen("http://www.google.com/webmasters/tools/ping?sitemap=" . urlencode($home . $apgnsm_path . "sitemap-news.xml"), 80); 
  228. @fclose($fp); 
  229. update_option('apgnsm_last_ping', time()); 
  230.  
  231.  
  232.  
  233. //Config page 
  234. function apgnsm_admin_page() { 
  235. $msg = ""; 
  236.  
  237. // Check form submission and update options 
  238. if ('apgnsm_submit' == $_POST['apgnsm_submit']) { 
  239. update_option('apgnsm_news_active', $_POST['apgnsm_news_active']); 
  240. update_option('apgnsm_n_name', $_POST['apgnsm_n_name']); 
  241. update_option('apgnsm_n_lang', $_POST['apgnsm_n_lang']); 
  242. update_option('apgnsm_n_access', $_POST['apgnsm_n_access']); 
  243. update_option('apgnsm_n_genres', $_POST['apgnsm_n_genres']); 
  244. update_option('apgnsm_n_excludecat', $_POST['apgnsm_n_excludecat']); 
  245. update_option('apgnsm_n_excludepostlist', $_POST['apgnsm_n_excludepostlist']); 
  246.  
  247. $newPath = trim($_POST['apgnsm_path']); 
  248. if ($newPath == "" || $newPath == "/") $newPath = "./"; 
  249. elseif ($newPath[strlen($newPath)-1] != "/") $newPath .= "/"; 
  250.  
  251. update_option('apgnsm_path', $newPath); 
  252.  
  253. if ( $_POST['apgnsm_n_genres_type']=="Blog"  
  254. || $_POST['apgnsm_n_genres_type']=="PressRelease" 
  255. || $_POST['apgnsm_n_genres_type']=="UserGenerated"  
  256. || $_POST['apgnsm_n_genres_type']=="Satire"  
  257. || $_POST['apgnsm_n_genres_type']=="OpEd"  
  258. || $_POST['apgnsm_n_genres_type']=="Opinion" ) { 
  259. update_option('apgnsm_n_genres_type', $_POST['apgnsm_n_genres_type']); 
  260. } else {  
  261. update_option('apgnsm_n_genres_type', "blog");  
  262.  
  263. if ($_POST['$apgnsm_n_access_type']=="Subscription" || $_POST['apgnsm_n_access_type']=="Registration" ) update_option('apgnsm_n_access_type', $_POST['apgnsm_n_access_type']); 
  264. else update_option('apgnsm_n_access_type', "Subscription"); 
  265.  
  266. // Excluded category 
  267. $exCats = array(); 
  268. if(isset($_POST["post_category"])) { 
  269. foreach((array) $_POST["post_category"] AS $vv) if(!empty($vv) && is_numeric($vv)) $exCats[] = intval($vv); 
  270. update_option('apgnsm_n_excludecatlist', $exCats);  
  271.  
  272. // Sitemap generation 
  273. apgnsm_generate_sitemap(); 
  274.  
  275. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  276. $apgnsm_path = get_option('apgnsm_path'); 
  277. $apgnsm_n_name = get_option('apgnsm_n_name'); 
  278. $apgnsm_n_lang = get_option('apgnsm_n_lang'); 
  279. $apgnsm_n_genres = get_option('apgnsm_n_genres'); 
  280. $apgnsm_n_genres_type = get_option('apgnsm_n_genres_type'); 
  281. $apgnsm_n_access = get_option('apgnsm_n_access'); 
  282. $apgnsm_n_access_type = get_option('apgnsm_n_access_type'); 
  283. $apgnsm_n_excludepostlist = get_option('apgnsm_n_excludepostlist'); 
  284.  
  285. $apgnsm_permission = apgnsm_permissions(); 
  286.  
  287. if ($apgnsm_permission == 1) $msg = "Error: there is a problem with <em>sitemap-news.xml</em>. It doesn't exist or is not writable. <a href=\"http://www.andreapernici.com/wordpress/google-news-sitemap/\" target=\"_blank\" >For help see the plugin's homepage</a>."; 
  288. elseif ($apgnsm_permission == 2) $msg = "Error: there is a problem with <em>sitemap-news.xml</em>. It doesn't exist or is not writable. <a href=\"http://www.andreapernici.com/wordpress/google-news-sitemap/\" target=\"_blank\" >For help see the plugin's homepage</a>."; 
  289. elseif ($apgnsm_permission == 3) $msg = "Error: there is a problem with <em>sitemap-news.xml</em>. It doesn't exist or is not writable. <a href=\"http://www.andreapernici.com/wordpress/google-news-sitemap/\" target=\"_blank\" >For help see the plugin's homepage</a>."; 
  290. ?> 
  291.  
  292. <style type="text/css"> 
  293. a.sm_button { 
  294. padding:4px; 
  295. display:block; 
  296. padding-left:25px; 
  297. background-repeat:no-repeat; 
  298. background-position:5px 50%; 
  299. text-decoration:none; 
  300. border:none; 
  301.  
  302. .sm-padded .inside { 
  303. margin:12px!important; 
  304. .sm-padded .inside ul { 
  305. margin:6px 0 12px 0; 
  306.  
  307. .sm-padded .inside input { 
  308. padding:1px; 
  309. margin:0; 
  310. </style>  
  311.  
  312.  
  313.  
  314. <div class="wrap" id="sm_div"> 
  315. <h2>Google News Sitemap</h2>  
  316. by <strong>Andrea Pernici</strong> 
  317. <p> 
  318.  <a target="_blank" title="Google News Sitemap Plugin Release History" href="http://andreapernici.com/wordpress/google-news-sitemap/">Changelog</a>  
  319. | <a target="_blank" title="Google News Sitemap Support" href="http://andreapernici.com/wordpress/google-news-sitemap/">Support</a> 
  320. </p> 
  321. <?php if ($msg) { ?> 
  322. <div id="message" class="error"><p><strong><?php echo $msg; ?></strong></p></div> 
  323. <?php } ?> 
  324.  
  325. <div style="width:824px;">  
  326. <div style="float:left;background-color:white;padding: 10px 10px 10px 10px;margin-right:15px;border: 1px solid #ddd;">  
  327. <div style="width:350px;height:130px;">  
  328. <h3>Donate</h3>  
  329. <em>If you like this plugin and find it useful, help keep this plugin free and actively developed by going to the <a href="http://andreapernici.com/donazioni" target="_blank"><strong>donate</strong></a> page on my website.</em>  
  330. <p><em>Also, don't forget to follow me on <a href="http://twitter.com/andreapernici/" target="_blank"><strong>Twitter</strong></a>.</em></p>  
  331. </div>  
  332. </div>  
  333.  
  334. <div style="float:left;background-color:white;padding: 10px 10px 10px 10px;border: 1px solid #ddd;">  
  335. <div style="width:415px;height:130px;">  
  336. <h3>Google Guidelines and Credits</h3>  
  337. <p><em>For any doubt refer to google guidelines <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=74288">here</a>.</em></p> 
  338. <p><em>Plugin by <a href="http://www.andreapernici.com">Andrea Pernici</a> with support of <a href="http://www.ghenghe.com/">Ghenghe Social Bookmark</a> and <a href="http://www.ciakprestitiemutui.com/">Ciak Prestiti e Mutui</a>. We would also like to recommend <a href="http://www.convegnogt.it/">Convegno Gt</a> to discover new important tricks for Google News Ranking.</em> </p> 
  339. </div>  
  340. </div>  
  341. </div> 
  342. <div style="clear:both";></div>  
  343. </div> 
  344.  
  345.  
  346.  
  347. <div id="wpbody-content">  
  348.  
  349. <div class="wrap" id="sm_div"> 
  350.  
  351. <div id="poststuff" class="metabox-holder has-right-sidebar">  
  352. <div class="inner-sidebar">  
  353. <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">  
  354. <div id="sm_pnres" class="postbox">  
  355. <h3 class="hndle"><span>Info plugin:</span></h3>  
  356. <div class="inside">  
  357. <a class="sm_button sm_pluginHome" href="http://www.andreapernici.com/wordpress/google-news-sitemap/">Plugin Homepage</a>  
  358. <a class="sm_button sm_pluginList" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=74288">Google News Guidelines</a>  
  359. <a class="sm_button sm_pluginSupport" href="http://wordpress.org/extend/plugins/google-news-sitemap/">Forum</a> 
  360. <a class="sm_button sm_donatePayPal" href="http://andreapernici.com/donazioni">Donations</a> 
  361. </div>  
  362. </div> 
  363. </div> 
  364. </div> 
  365.  
  366.  
  367.  
  368.  
  369. <div class="has-sidebar sm-padded" >  
  370.  
  371. <div id="post-body-content" class="has-sidebar-content">  
  372.  
  373. <div class="meta-box-sortabless">  
  374.  
  375. <div id="sm_rebuild" class="postbox">  
  376. <h3 class="hndle"><span>Google News Sitemap settings</span></h3> 
  377. <div class="inside">  
  378.  
  379. <form name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>&updated=true"> 
  380. <input type="hidden" name="apgnsm_submit" value="apgnsm_submit" /> 
  381. <ul> 
  382. <li> 
  383. <label for="apgnsm_news_active"> 
  384. <input name="apgnsm_news_active" type="checkbox" id="apgnsm_news_active" value="1" <?php echo $apgnsm_news_active?'checked="checked"':''; ?> /> 
  385. Create news sitemap. 
  386. </label> 
  387. </li> 
  388. <li><label for="apgnsm_n_name">Your Google News Name: <input name="apgnsm_n_name" type="text" id="apgnsm_n_name" value="<?php echo $apgnsm_n_name?>" /></label></li> 
  389. <li><label for="apgnsm_n_lang">Your Article Language (it, en, es...): <input name="apgnsm_n_lang" type="text" id="apgnsm_n_lang" value="<?php echo $apgnsm_n_lang?>" /></label></li> 
  390. <li> 
  391. <label for="apgnsm_n_genres"> 
  392. <input name="apgnsm_n_genres" type="checkbox" id="apgnsm_n_genres" value="1" <?php echo $apgnsm_n_genres?'checked="checked"':''; ?> /> 
  393. Show GENRES, if possible. 
  394. </label> 
  395. </li> 
  396. <li> 
  397. <label for="apgnsm_n_genres_type">If GENRES is defined then select the type of it:  
  398. <select name="apgnsm_n_genres_type"> 
  399. <option <?php echo $apgnsm_n_genres_type=="Blog"?'selected="selected"':'';?> value="Blog">Blog</option> 
  400. <option <?php echo $apgnsm_n_genres_type=="PressRelease"?'selected="selected"':'';?> value="PressRelease">PressRelease</option> 
  401. <option <?php echo $apgnsm_n_genres_type=="UserGenerated"?'selected="selected"':'';?> value="UserGenerated">UserGenerated</option> 
  402. <option <?php echo $apgnsm_n_genres_type=="Satire"?'selected="selected"':'';?> value="Satire">Satire</option> 
  403. <option <?php echo $apgnsm_n_genres_type=="OpEd"?'selected="selected"':'';?> value="OpEd">OpEd</option> 
  404. <option <?php echo $apgnsm_n_genres_type=="Opinion"?'selected="selected"':'';?> value="Opinion">Opinion</option> 
  405. </select> 
  406. </label> 
  407. </li> 
  408. <li> 
  409. <label for="apgnsm_n_access"> 
  410. <input name="apgnsm_n_access" type="checkbox" id="apgnsm_n_access" value="1" <?php echo $apgnsm_n_access?'checked="checked"':''; ?> /> 
  411. Enable limited access "Subscription" or "Registration". 
  412. </label> 
  413. </li> 
  414. <li> 
  415. <label for="apgnsm_n_access_type"> 
  416. If ACCESS is defined then select the type of it:  
  417. <select name="apgnsm_n_access_type"> 
  418. <option <?php echo $apgnsm_n_access_type=="Subscription"?'selected="selected"':'';?> value="Subscription">Subscription</option> 
  419. <option <?php echo $apgnsm_n_access_type=="Registration"?'selected="selected"':'';?> value="Registration">Registration</option>  
  420. </select> 
  421. </label> 
  422. </li> 
  423. </ul> 
  424. <b>Advanced settings - default sitemap will be generated in http://yourdomain.com/sitemap-news.xml</b> 
  425. <ul> 
  426. <li> 
  427. <label for="apgnsm_path"> 
  428. Sitemap path (relatively to blog's home) (leave empty if not sure): <input name="apgnsm_path" type="text" id="apgnsm_path" value="<?php echo $apgnsm_path?>" /> 
  429. </label> 
  430. </li> 
  431. </ul>  
  432.  
  433. </div> 
  434. </div> 
  435. <!-- Excluded Items -->  
  436.  
  437. <div id="sm_excludes" class="postbox">  
  438. <h3 class="hndle"><span>Escludi elementi</span></h3>  
  439.  
  440. <div class="inside">  
  441.  
  442. <b>Exclude Category:</b>  
  443.  
  444. <?php  
  445. $excludedCats = get_option('apgnsm_n_excludecatlist'); 
  446. if (!is_array($excludedCats)) $excludedCats = array(); 
  447. ?> 
  448. <div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">  
  449. <ul>  
  450. <?php wp_category_checklist(0, 0, $excludedCats, false); ?>  
  451.  
  452. </ul>  
  453.  
  454. </div>  
  455.  
  456. <b>Exlclude Articles:</b>  
  457. <div style="margin:5px 0 13px 40px;">  
  458. <label for="apgnsm_n_excludepost">Exclude the following articles or pages: <small>put comma separated ID (ex. 1, 2, 3)</small><br />  
  459. <input name="apgnsm_n_excludepostlist" id="apgnsm_n_excludepostlist" type="text" style="width:400px;" value="<?php echo $apgnsm_n_excludepostlist;?>" /></label><br />  
  460. </div>  
  461.  
  462. </div>  
  463. </div>  
  464. <!-- Excluded --> 
  465. <p class="submit"> <input type="submit" value="Save & Rebuild" /></p> 
  466. </form> 
  467.  
  468.  
  469. </div> 
  470. </div> 
  471. </div> 
  472. </div> 
  473. </div>  
  474. </div> 
  475. <?php 
  476. ?> 
.