apgnsm_admin_page

The Google News Sitemap apgnsm admin page function.

Description

apgnsm_admin_page(); 

Usage

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

Defined (1)

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

/apgnsm.php  
  1. function apgnsm_admin_page() { 
  2. $msg = ""; 
  3.  
  4. // Check form submission and update options 
  5. if ('apgnsm_submit' == $_POST['apgnsm_submit']) { 
  6. update_option('apgnsm_news_active', $_POST['apgnsm_news_active']); 
  7. update_option('apgnsm_n_name', $_POST['apgnsm_n_name']); 
  8. update_option('apgnsm_n_lang', $_POST['apgnsm_n_lang']); 
  9. update_option('apgnsm_n_access', $_POST['apgnsm_n_access']); 
  10. update_option('apgnsm_n_genres', $_POST['apgnsm_n_genres']); 
  11. update_option('apgnsm_n_excludecat', $_POST['apgnsm_n_excludecat']); 
  12. update_option('apgnsm_n_excludepostlist', $_POST['apgnsm_n_excludepostlist']); 
  13.  
  14. $newPath = trim($_POST['apgnsm_path']); 
  15. if ($newPath == "" || $newPath == "/") $newPath = "./"; 
  16. elseif ($newPath[strlen($newPath)-1] != "/") $newPath .= "/"; 
  17.  
  18. update_option('apgnsm_path', $newPath); 
  19.  
  20. if ( $_POST['apgnsm_n_genres_type']=="Blog"  
  21. || $_POST['apgnsm_n_genres_type']=="PressRelease" 
  22. || $_POST['apgnsm_n_genres_type']=="UserGenerated"  
  23. || $_POST['apgnsm_n_genres_type']=="Satire"  
  24. || $_POST['apgnsm_n_genres_type']=="OpEd"  
  25. || $_POST['apgnsm_n_genres_type']=="Opinion" ) { 
  26. update_option('apgnsm_n_genres_type', $_POST['apgnsm_n_genres_type']); 
  27. } else {  
  28. update_option('apgnsm_n_genres_type', "blog");  
  29.  
  30. if ($_POST['$apgnsm_n_access_type']=="Subscription" || $_POST['apgnsm_n_access_type']=="Registration" ) update_option('apgnsm_n_access_type', $_POST['apgnsm_n_access_type']); 
  31. else update_option('apgnsm_n_access_type', "Subscription"); 
  32.  
  33. // Excluded category 
  34. $exCats = array(); 
  35. if(isset($_POST["post_category"])) { 
  36. foreach((array) $_POST["post_category"] AS $vv) if(!empty($vv) && is_numeric($vv)) $exCats[] = intval($vv); 
  37. update_option('apgnsm_n_excludecatlist', $exCats);  
  38.  
  39. // Sitemap generation 
  40.  
  41. $apgnsm_news_active = get_option('apgnsm_news_active'); 
  42. $apgnsm_path = get_option('apgnsm_path'); 
  43. $apgnsm_n_name = get_option('apgnsm_n_name'); 
  44. $apgnsm_n_lang = get_option('apgnsm_n_lang'); 
  45. $apgnsm_n_genres = get_option('apgnsm_n_genres'); 
  46. $apgnsm_n_genres_type = get_option('apgnsm_n_genres_type'); 
  47. $apgnsm_n_access = get_option('apgnsm_n_access'); 
  48. $apgnsm_n_access_type = get_option('apgnsm_n_access_type'); 
  49. $apgnsm_n_excludepostlist = get_option('apgnsm_n_excludepostlist'); 
  50.  
  51. $apgnsm_permission = apgnsm_permissions(); 
  52.  
  53. 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>."; 
  54. 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>."; 
  55. 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>."; 
  56. ?> 
  57.  
  58. <style type="text/css"> 
  59. a.sm_button { 
  60. padding:4px; 
  61. display:block; 
  62. padding-left:25px; 
  63. background-repeat:no-repeat; 
  64. background-position:5px 50%; 
  65. text-decoration:none; 
  66. border:none; 
  67.  
  68. .sm-padded .inside { 
  69. margin:12px!important; 
  70. .sm-padded .inside ul { 
  71. margin:6px 0 12px 0; 
  72.  
  73. .sm-padded .inside input { 
  74. padding:1px; 
  75. margin:0; 
  76. </style>  
  77.  
  78.  
  79.  
  80. <div class="wrap" id="sm_div"> 
  81. <h2>Google News Sitemap</h2>  
  82. by <strong>Andrea Pernici</strong> 
  83. <p> 
  84.  <a target="_blank" title="Google News Sitemap Plugin Release History" href="http://andreapernici.com/wordpress/google-news-sitemap/">Changelog</a>  
  85. | <a target="_blank" title="Google News Sitemap Support" href="http://andreapernici.com/wordpress/google-news-sitemap/">Support</a> 
  86. </p> 
  87. <?php if ($msg) { ?> 
  88. <div id="message" class="error"><p><strong><?php echo $msg; ?></strong></p></div> 
  89. <?php } ?> 
  90.  
  91. <div style="width:824px;">  
  92. <div style="float:left;background-color:white;padding: 10px 10px 10px 10px;margin-right:15px;border: 1px solid #ddd;">  
  93. <div style="width:350px;height:130px;">  
  94. <h3>Donate</h3>  
  95. <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>  
  96. <p><em>Also, don't forget to follow me on <a href="http://twitter.com/andreapernici/" target="_blank"><strong>Twitter</strong></a>.</em></p>  
  97. </div>  
  98. </div>  
  99.  
  100. <div style="float:left;background-color:white;padding: 10px 10px 10px 10px;border: 1px solid #ddd;">  
  101. <div style="width:415px;height:130px;">  
  102. <h3>Google Guidelines and Credits</h3>  
  103. <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> 
  104. <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> 
  105. </div>  
  106. </div>  
  107. </div> 
  108. <div style="clear:both";></div>  
  109. </div> 
  110.  
  111.  
  112.  
  113. <div id="wpbody-content">  
  114.  
  115. <div class="wrap" id="sm_div"> 
  116.  
  117. <div id="poststuff" class="metabox-holder has-right-sidebar">  
  118. <div class="inner-sidebar">  
  119. <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">  
  120. <div id="sm_pnres" class="postbox">  
  121. <h3 class="hndle"><span>Info plugin:</span></h3>  
  122. <div class="inside">  
  123. <a class="sm_button sm_pluginHome" href="http://www.andreapernici.com/wordpress/google-news-sitemap/">Plugin Homepage</a>  
  124. <a class="sm_button sm_pluginList" href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=74288">Google News Guidelines</a>  
  125. <a class="sm_button sm_pluginSupport" href="http://wordpress.org/extend/plugins/google-news-sitemap/">Forum</a> 
  126. <a class="sm_button sm_donatePayPal" href="http://andreapernici.com/donazioni">Donations</a> 
  127. </div>  
  128. </div> 
  129. </div> 
  130. </div> 
  131.  
  132.  
  133.  
  134.  
  135. <div class="has-sidebar sm-padded" >  
  136.  
  137. <div id="post-body-content" class="has-sidebar-content">  
  138.  
  139. <div class="meta-box-sortabless">  
  140.  
  141. <div id="sm_rebuild" class="postbox">  
  142. <h3 class="hndle"><span>Google News Sitemap settings</span></h3> 
  143. <div class="inside">  
  144.  
  145. <form name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>&updated=true"> 
  146. <input type="hidden" name="apgnsm_submit" value="apgnsm_submit" /> 
  147. <ul> 
  148. <li> 
  149. <label for="apgnsm_news_active"> 
  150. <input name="apgnsm_news_active" type="checkbox" id="apgnsm_news_active" value="1" <?php echo $apgnsm_news_active?'checked="checked"':''; ?> /> 
  151. Create news sitemap. 
  152. </label> 
  153. </li> 
  154. <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> 
  155. <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> 
  156. <li> 
  157. <label for="apgnsm_n_genres"> 
  158. <input name="apgnsm_n_genres" type="checkbox" id="apgnsm_n_genres" value="1" <?php echo $apgnsm_n_genres?'checked="checked"':''; ?> /> 
  159. Show GENRES, if possible. 
  160. </label> 
  161. </li> 
  162. <li> 
  163. <label for="apgnsm_n_genres_type">If GENRES is defined then select the type of it:  
  164. <select name="apgnsm_n_genres_type"> 
  165. <option <?php echo $apgnsm_n_genres_type=="Blog"?'selected="selected"':'';?> value="Blog">Blog</option> 
  166. <option <?php echo $apgnsm_n_genres_type=="PressRelease"?'selected="selected"':'';?> value="PressRelease">PressRelease</option> 
  167. <option <?php echo $apgnsm_n_genres_type=="UserGenerated"?'selected="selected"':'';?> value="UserGenerated">UserGenerated</option> 
  168. <option <?php echo $apgnsm_n_genres_type=="Satire"?'selected="selected"':'';?> value="Satire">Satire</option> 
  169. <option <?php echo $apgnsm_n_genres_type=="OpEd"?'selected="selected"':'';?> value="OpEd">OpEd</option> 
  170. <option <?php echo $apgnsm_n_genres_type=="Opinion"?'selected="selected"':'';?> value="Opinion">Opinion</option> 
  171. </select> 
  172. </label> 
  173. </li> 
  174. <li> 
  175. <label for="apgnsm_n_access"> 
  176. <input name="apgnsm_n_access" type="checkbox" id="apgnsm_n_access" value="1" <?php echo $apgnsm_n_access?'checked="checked"':''; ?> /> 
  177. Enable limited access "Subscription" or "Registration". 
  178. </label> 
  179. </li> 
  180. <li> 
  181. <label for="apgnsm_n_access_type"> 
  182. If ACCESS is defined then select the type of it:  
  183. <select name="apgnsm_n_access_type"> 
  184. <option <?php echo $apgnsm_n_access_type=="Subscription"?'selected="selected"':'';?> value="Subscription">Subscription</option> 
  185. <option <?php echo $apgnsm_n_access_type=="Registration"?'selected="selected"':'';?> value="Registration">Registration</option>  
  186. </select> 
  187. </label> 
  188. </li> 
  189. </ul> 
  190. <b>Advanced settings - default sitemap will be generated in http://yourdomain.com/sitemap-news.xml</b> 
  191. <ul> 
  192. <li> 
  193. <label for="apgnsm_path"> 
  194. 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?>" /> 
  195. </label> 
  196. </li> 
  197. </ul>  
  198.  
  199. </div> 
  200. </div> 
  201. <!-- Excluded Items -->  
  202.  
  203. <div id="sm_excludes" class="postbox">  
  204. <h3 class="hndle"><span>Escludi elementi</span></h3>  
  205.  
  206. <div class="inside">  
  207.  
  208. <b>Exclude Category:</b>  
  209.  
  210. <?php  
  211. $excludedCats = get_option('apgnsm_n_excludecatlist'); 
  212. if (!is_array($excludedCats)) $excludedCats = array(); 
  213. ?> 
  214. <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;">  
  215. <ul>  
  216. <?php wp_category_checklist(0, 0, $excludedCats, false); ?>  
  217.  
  218. </ul>  
  219.  
  220. </div>  
  221.  
  222. <b>Exlclude Articles:</b>  
  223. <div style="margin:5px 0 13px 40px;">  
  224. <label for="apgnsm_n_excludepost">Exclude the following articles or pages: <small>put comma separated ID (ex. 1, 2, 3)</small><br />  
  225. <input name="apgnsm_n_excludepostlist" id="apgnsm_n_excludepostlist" type="text" style="width:400px;" value="<?php echo $apgnsm_n_excludepostlist;?>" /></label><br />  
  226. </div>  
  227.  
  228. </div>  
  229. </div>  
  230. <!-- Excluded --> 
  231. <p class="submit"> <input type="submit" value="Save & Rebuild" /></p> 
  232. </form> 
  233.  
  234.  
  235. </div> 
  236. </div> 
  237. </div> 
  238. </div> 
  239. </div>  
  240. </div> 
  241. <?php