/wp-content/plugins/google-sitemap-generator/sitemap-ui.php

https://bitbucket.org/carloskikea/helpet · PHP · 1309 lines · 1070 code · 149 blank · 90 comment · 144 complexity · 4f86a5a75082d8fc6f3cceca2b0a7edf MD5 · raw file

Large files are truncated click here to view the full file

  1. <?php
  2. /*
  3. $Id: sitemap-ui.php 935247 2014-06-19 17:13:03Z arnee $
  4. */
  5. class GoogleSitemapGeneratorUI {
  6. /**
  7. * The Sitemap Generator Object
  8. *
  9. * @var GoogleSitemapGenerator
  10. */
  11. private $sg = null;
  12. public function __construct(GoogleSitemapGenerator $sitemapBuilder) {
  13. $this->sg = $sitemapBuilder;
  14. }
  15. private function HtmlPrintBoxHeader($id, $title) {
  16. ?>
  17. <div id="<?php echo $id; ?>" class="postbox">
  18. <h3 class="hndle"><span><?php echo $title ?></span></h3>
  19. <div class="inside">
  20. <?php
  21. }
  22. private function HtmlPrintBoxFooter() {
  23. ?>
  24. </div>
  25. </div>
  26. <?php
  27. }
  28. /**
  29. * Echos option fields for an select field containing the valid change frequencies
  30. *
  31. * @since 4.0
  32. * @param $currentVal mixed The value which should be selected
  33. */
  34. public function HtmlGetFreqNames($currentVal) {
  35. foreach($this->sg->GetFreqNames() AS $k=>$v) {
  36. echo "<option value=\"" . esc_attr($k) . "\" " . self::HtmlGetSelected($k,$currentVal) .">" . esc_attr($v) . "</option>";
  37. }
  38. }
  39. /**
  40. * Echos option fields for an select field containing the valid priorities (0- 1.0)
  41. *
  42. * @since 4.0
  43. * @param $currentVal string The value which should be selected
  44. * @return void
  45. */
  46. public static function HtmlGetPriorityValues($currentVal) {
  47. $currentVal=(float) $currentVal;
  48. for($i=0.0; $i<=1.0; $i+=0.1) {
  49. $v = number_format($i,1,".","");
  50. echo "<option value=\"" . esc_attr($v) . "\" " . self::HtmlGetSelected("$i","$currentVal") .">";
  51. echo esc_attr(number_format_i18n($i,1));
  52. echo "</option>";
  53. }
  54. }
  55. /**
  56. * Returns the checked attribute if the given values match
  57. *
  58. * @since 4.0
  59. * @param $val string The current value
  60. * @param $equals string The value to match
  61. * @return string The checked attribute if the given values match, an empty string if not
  62. */
  63. public static function HtmlGetChecked($val, $equals) {
  64. if($val==$equals) return self::HtmlGetAttribute("checked");
  65. else return "";
  66. }
  67. /**
  68. * Returns the selected attribute if the given values match
  69. *
  70. * @since 4.0
  71. * @param $val string The current value
  72. * @param $equals string The value to match
  73. * @return string The selected attribute if the given values match, an empty string if not
  74. */
  75. public static function HtmlGetSelected($val,$equals) {
  76. if($val==$equals) return self::HtmlGetAttribute("selected");
  77. else return "";
  78. }
  79. /**
  80. * Returns an formatted attribute. If the value is NULL, the name will be used.
  81. *
  82. * @since 4.0
  83. * @param $attr string The attribute name
  84. * @param $value string The attribute value
  85. * @return string The formatted attribute
  86. */
  87. public static function HtmlGetAttribute($attr,$value=NULL) {
  88. if($value==NULL) $value=$attr;
  89. return " " . $attr . "=\"" . esc_attr($value) . "\" ";
  90. }
  91. /**
  92. * Returns an array with GoogleSitemapGeneratorPage objects which is generated from POST values
  93. *
  94. * @since 4.0
  95. * @see GoogleSitemapGeneratorPage
  96. * @return array An array with GoogleSitemapGeneratorPage objects
  97. */
  98. public function HtmlApplyPages() {
  99. // Array with all page URLs
  100. $pages_ur=(!isset($_POST["sm_pages_ur"]) || !is_array($_POST["sm_pages_ur"])?array():$_POST["sm_pages_ur"]);
  101. //Array with all priorities
  102. $pages_pr=(!isset($_POST["sm_pages_pr"]) || !is_array($_POST["sm_pages_pr"])?array():$_POST["sm_pages_pr"]);
  103. //Array with all change frequencies
  104. $pages_cf=(!isset($_POST["sm_pages_cf"]) || !is_array($_POST["sm_pages_cf"])?array():$_POST["sm_pages_cf"]);
  105. //Array with all lastmods
  106. $pages_lm=(!isset($_POST["sm_pages_lm"]) || !is_array($_POST["sm_pages_lm"])?array():$_POST["sm_pages_lm"]);
  107. //Array where the new pages are stored
  108. $pages=array();
  109. //Loop through all defined pages and set their properties into an object
  110. if(isset($_POST["sm_pages_mark"]) && is_array($_POST["sm_pages_mark"])) {
  111. for($i=0; $i<count($_POST["sm_pages_mark"]); $i++) {
  112. //Create new object
  113. $p=new GoogleSitemapGeneratorPage();
  114. if(substr($pages_ur[$i],0,4)=="www.") $pages_ur[$i]="http://" . $pages_ur[$i];
  115. $p->SetUrl($pages_ur[$i]);
  116. $p->SetProprity($pages_pr[$i]);
  117. $p->SetChangeFreq($pages_cf[$i]);
  118. //Try to parse last modified, if -1 (note ===) automatic will be used (0)
  119. $lm=(!empty($pages_lm[$i])?strtotime($pages_lm[$i],time()):-1);
  120. if($lm===-1) $p->setLastMod(0);
  121. else $p->setLastMod($lm);
  122. //Add it to the array
  123. array_push($pages,$p);
  124. }
  125. }
  126. return $pages;
  127. }
  128. /**
  129. * Displays the option page
  130. *
  131. * @since 3.0
  132. * @access public
  133. * @author Arne Brachhold
  134. */
  135. public function HtmlShowOptionsPage() {
  136. global $wp_version;
  137. $snl = false; //SNL
  138. $this->sg->Initate();
  139. $message="";
  140. if(!empty($_REQUEST["sm_rebuild"])) { //Pressed Button: Rebuild Sitemap
  141. check_admin_referer('sitemap');
  142. if(isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"]=="true") {
  143. //Check again, just for the case that something went wrong before
  144. if(!current_user_can("administrator") || !is_super_admin()) {
  145. echo '<p>Please log in as admin</p>';
  146. return;
  147. }
  148. $oldErr = error_reporting(E_ALL);
  149. $oldIni = ini_set("display_errors",1);
  150. echo '<div class="wrap">';
  151. echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion(). '</h2>';
  152. echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>';
  153. echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
  154. echo "<h3>WordPress and PHP Information</h3>";
  155. echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>';
  156. echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->GetSvnVersion() . ')';
  157. echo '<h4>Environment</h4>';
  158. echo "<pre>";
  159. $sc = $_SERVER;
  160. unset($sc["HTTP_COOKIE"]);
  161. print_r($sc);
  162. echo "</pre>";
  163. echo "<h4>WordPress Config</h4>";
  164. echo "<pre>";
  165. $opts = array();
  166. if(function_exists('wp_load_alloptions')) {
  167. $opts = wp_load_alloptions();
  168. } else {
  169. /** @var $wpdb wpdb*/
  170. global $wpdb;
  171. $os = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options");
  172. foreach ( (array) $os as $o ) $opts[$o->option_name] = $o->option_value;
  173. }
  174. $popts = array();
  175. foreach($opts as $k=>$v) {
  176. //Try to filter out passwords etc...
  177. if(preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si",$k)) continue;
  178. $popts[$k] = htmlspecialchars($v);
  179. }
  180. print_r($popts);
  181. echo "</pre>";
  182. echo '<h4>Sitemap Config</h4>';
  183. echo "<pre>";
  184. print_r($this->sg->GetOptions());
  185. echo "</pre>";
  186. echo '<h3>Sitemap Content and Errors, Warnings, Notices</h3>';
  187. echo '<div>';
  188. $sitemaps = $this->sg->SimulateIndex();
  189. foreach($sitemaps AS $sitemap) {
  190. /** @var $s GoogleSitemapGeneratorSitemapEntry */
  191. $s = $sitemap["data"];
  192. echo "<h4>Sitemap: <a href=\"" . $s->GetUrl() . "\">" . $sitemap["type"] . "/" . ($sitemap["params"]?$sitemap["params"]:"(No parameters)") . "</a> by " . $sitemap["caller"]["class"] . "</h4>";
  193. $res = $this->sg->SimulateSitemap($sitemap["type"], $sitemap["params"]);
  194. echo "<ul style='padding-left:10px;'>";
  195. foreach($res AS $s) {
  196. /** @var $d GoogleSitemapGeneratorSitemapEntry */
  197. $d = $s["data"];
  198. echo "<li>" . $d->GetUrl() . "</li>";
  199. }
  200. echo "</ul>";
  201. }
  202. $status = GoogleSitemapGeneratorStatus::Load();
  203. echo '</div>';
  204. echo '<h3>MySQL Queries</h3>';
  205. if(defined('SAVEQUERIES') && SAVEQUERIES) {
  206. echo '<pre>';
  207. var_dump($GLOBALS['wpdb']->queries);
  208. echo '</pre>';
  209. $total = 0;
  210. foreach($GLOBALS['wpdb']->queries as $q) {
  211. $total+=$q[1];
  212. }
  213. echo '<h4>Total Query Time</h4>';
  214. echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total,2) . ' seconds.</pre>';
  215. } else {
  216. echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>';
  217. }
  218. echo "<h3>Build Process Results</h3>";
  219. echo "<pre>";
  220. print_r($status);
  221. echo "</pre>";
  222. echo '<p>Done. <a href="' . wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true",'sitemap') . '">Rebuild</a> or <a href="' . $this->sg->GetBackLink() . '">Return</a></p>';
  223. echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
  224. echo '</div>';
  225. @error_reporting($oldErr);
  226. @ini_set("display_errors",$oldIni);
  227. return;
  228. } else {
  229. $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true';
  230. //Redirect so the sm_rebuild GET parameter no longer exists.
  231. @header("location: " . $redirURL);
  232. //If there was already any other output, the header redirect will fail
  233. echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
  234. echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
  235. exit;
  236. }
  237. } else if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config
  238. check_admin_referer('sitemap');
  239. if(isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) {
  240. $_POST['sm_b_style_default'] = true;
  241. $_POST['sm_b_style'] = '';
  242. }
  243. foreach($this->sg->GetOptions() as $k=>$v) {
  244. //Skip some options if the user is not super admin...
  245. if(!is_super_admin() && in_array($k,array("sm_b_time","sm_b_memory","sm_b_style","sm_b_style_default"))) {
  246. continue;
  247. }
  248. //Check vor values and convert them into their types, based on the category they are in
  249. if(!isset($_POST[$k])) $_POST[$k]=""; // Empty string will get false on 2bool and 0 on 2float
  250. //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider
  251. if(substr($k,0,5)=="sm_b_") {
  252. if($k=="sm_b_prio_provider" || $k == "sm_b_style" || $k == "sm_b_memory" || $k == "sm_b_baseurl") {
  253. if($k=="sm_b_filename_manual" && strpos($_POST[$k],"\\")!==false){
  254. $_POST[$k]=stripslashes($_POST[$k]);
  255. } else if($k=="sm_b_baseurl") {
  256. $_POST[$k] = trim($_POST[$k]);
  257. if(!empty($_POST[$k])) $_POST[$k] = trailingslashit($_POST[$k]);
  258. }
  259. $this->sg->SetOption($k,(string) $_POST[$k]);
  260. } else if($k == "sm_b_time") {
  261. if($_POST[$k]=='') $_POST[$k] = -1;
  262. $this->sg->SetOption($k,intval($_POST[$k]));
  263. } else if($k== "sm_i_install_date") {
  264. if($this->sg->GetOption('i_install_date')<=0) $this->sg->SetOption($k,time());
  265. } else if($k=="sm_b_exclude") {
  266. $IDss = array();
  267. $IDs = explode(",",$_POST[$k]);
  268. for($x = 0; $x<count($IDs); $x++) {
  269. $ID = intval(trim($IDs[$x]));
  270. if($ID>0) $IDss[] = $ID;
  271. }
  272. $this->sg->SetOption($k,$IDss);
  273. } else if($k == "sm_b_exclude_cats") {
  274. $exCats = array();
  275. if(isset($_POST["post_category"])) {
  276. foreach((array) $_POST["post_category"] AS $vv) if(!empty($vv) && is_numeric($vv)) $exCats[] = intval($vv);
  277. }
  278. $this->sg->SetOption($k,$exCats);
  279. } else {
  280. $this->sg->SetOption($k,(bool) $_POST[$k]);
  281. }
  282. //Options of the category "Includes" are boolean
  283. } else if(substr($k,0,6)=="sm_in_") {
  284. if($k=='sm_in_tax') {
  285. $enabledTaxonomies = array();
  286. foreach(array_keys((array) $_POST[$k]) AS $taxName) {
  287. if(empty($taxName) || !taxonomy_exists($taxName)) continue;
  288. $enabledTaxonomies[] = $taxName;
  289. }
  290. $this->sg->SetOption($k,$enabledTaxonomies);
  291. } else if($k=='sm_in_customtypes') {
  292. $enabledPostTypes = array();
  293. foreach(array_keys((array) $_POST[$k]) AS $postTypeName) {
  294. if(empty($postTypeName) || !post_type_exists($postTypeName)) continue;
  295. $enabledPostTypes[] = $postTypeName;
  296. }
  297. $this->sg->SetOption($k, $enabledPostTypes);
  298. } else $this->sg->SetOption($k,(bool) $_POST[$k]);
  299. //Options of the category "Change frequencies" are string
  300. } else if(substr($k,0,6)=="sm_cf_") {
  301. $this->sg->SetOption($k,(string) $_POST[$k]);
  302. //Options of the category "Priorities" are float
  303. } else if(substr($k,0,6)=="sm_pr_") {
  304. $this->sg->SetOption($k,(float) $_POST[$k]);
  305. }
  306. }
  307. //Apply page changes from POST
  308. if(is_super_admin()) $this->sg->SetPages($this->HtmlApplyPages());
  309. if($this->sg->SaveOptions()) $message.=__('Configuration updated', 'sitemap') . "<br />";
  310. else $message.=__('Error while saving options', 'sitemap') . "<br />";
  311. if(is_super_admin()) {
  312. if($this->sg->SavePages()) $message.=__("Pages saved",'sitemap') . "<br />";
  313. else $message.=__('Error while saving pages', 'sitemap'). "<br />";
  314. }
  315. } else if(!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config
  316. check_admin_referer('sitemap');
  317. $this->sg->InitOptions();
  318. $this->sg->SaveOptions();
  319. $message.=__('The default configuration was restored.','sitemap');
  320. } else if(!empty($_GET["sm_delete_old"])) { //Delete old sitemap files
  321. check_admin_referer('sitemap');
  322. //Check again, just for the case that something went wrong before
  323. if(!current_user_can("administrator")) {
  324. echo '<p>Please log in as admin</p>';
  325. return;
  326. }
  327. if(!$this->sg->DeleteOldFiles()) {
  328. $message = __("The old files could NOT be deleted. Please use an FTP program and delete them by yourself.","sitemap");
  329. } else {
  330. $message = __("The old files were successfully deleted.","sitemap");
  331. }
  332. } else if(!empty($_GET["sm_ping_all"])) {
  333. check_admin_referer('sitemap');
  334. //Check again, just for the case that something went wrong before
  335. if(!current_user_can("administrator")) {
  336. echo '<p>Please log in as admin</p>';
  337. return;
  338. }
  339. echo <<<HTML
  340. <html>
  341. <head>
  342. <style type="text/css">
  343. html {
  344. background: #f1f1f1;
  345. }
  346. body {
  347. color: #444;
  348. font-family: "Open Sans", sans-serif;
  349. font-size: 13px;
  350. line-height: 1.4em;
  351. min-width: 600px;
  352. }
  353. h2 {
  354. font-size: 23px;
  355. font-weight: 400;
  356. padding: 9px 10px 4px 0;
  357. line-height: 29px;
  358. }
  359. </style>
  360. </head>
  361. <body>
  362. HTML;
  363. echo "<h2>" . __('Notify Search Engines about all sitemaps','sitemap') ."</h2>";
  364. echo "<p>" . __('The plugin is notifying the selected search engines about your main sitemap and all sub-sitemaps. This might take a minute or two.','sitemaps') . "</p>";
  365. flush();
  366. $results = $this->sg->SendPingAll();
  367. echo "<ul>";
  368. foreach($results AS $result) {
  369. $sitemapUrl = $result["sitemap"];
  370. /** @var $status GoogleSitemapGeneratorStatus */
  371. $status = $result["status"];
  372. echo "<li><a href=\"" . esc_url($sitemapUrl) . "\">" . $sitemapUrl . "</a><ul>";
  373. $services = $status->GetUsedPingServices();
  374. foreach($services AS $serviceId) {
  375. echo "<li>";
  376. echo $status->GetServiceName($serviceId) . ": " . ($status->GetPingResult($serviceId)==true?"OK":"ERROR");
  377. echo "</li>";
  378. }
  379. echo "</ul></li>";
  380. }
  381. echo "</ul>";
  382. echo "<p>" . __('All done!','sitemap') . "</p>";
  383. echo <<<HTML
  384. </body>
  385. HTML;
  386. exit;
  387. } else if(!empty($_GET["sm_ping_main"])) {
  388. check_admin_referer('sitemap');
  389. //Check again, just for the case that something went wrong before
  390. if(!current_user_can("administrator")) {
  391. echo '<p>Please log in as admin</p>';
  392. return;
  393. }
  394. $this->sg->SendPing();
  395. $message = __("Ping was executed, please see below for the result.","sitemap");
  396. }
  397. //Print out the message to the user, if any
  398. if($message!="") {
  399. ?>
  400. <div class="updated"><p><strong><?php
  401. echo $message;
  402. ?></strong></p></div><?php
  403. }
  404. if(!$snl) {
  405. if(isset($_GET['sm_hidedonate'])) {
  406. $this->sg->SetOption('i_hide_donated',true);
  407. $this->sg->SaveOptions();
  408. }
  409. if(isset($_GET['sm_donated'])) {
  410. $this->sg->SetOption('i_donated',true);
  411. $this->sg->SaveOptions();
  412. }
  413. if(isset($_GET['sm_hide_note'])) {
  414. $this->sg->SetOption('i_hide_note',true);
  415. $this->sg->SaveOptions();
  416. }
  417. if(isset($_GET['sm_hide_survey'])) {
  418. $this->sg->SetOption('i_hide_survey',true);
  419. $this->sg->SaveOptions();
  420. }
  421. if(isset($_GET['sm_hidedonors'])) {
  422. $this->sg->SetOption('i_hide_donors',true);
  423. $this->sg->SaveOptions();
  424. }
  425. if(isset($_GET['sm_hide_works'])) {
  426. $this->sg->SetOption('i_hide_works',true);
  427. $this->sg->SaveOptions();
  428. }
  429. if(isset($_GET['sm_disable_supportfeed'])) {
  430. $this->sg->SetOption('i_supportfeed',$_GET["sm_disable_supportfeed"]=="true"?false:true);
  431. $this->sg->SaveOptions();
  432. }
  433. if(isset($_GET['sm_donated']) || ($this->sg->GetOption('i_donated')===true && $this->sg->GetOption('i_hide_donated')!==true)) {
  434. ?>
  435. <!--
  436. <div class="updated">
  437. <strong><p><?php _e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!','sitemap'); ?> <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_hidedonate=true"; ?>"><small style="font-weight:normal;"><?php _e('Hide this notice', 'sitemap'); ?></small></a></p></strong>
  438. </div>
  439. -->
  440. <?php
  441. } else if($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date')>0 && $this->sg->GetOption('i_hide_note')!==true && time() > ($this->sg->GetOption('i_install_date') + (60*60*24*30))) {
  442. ?>
  443. <!--
  444. <div class="updated">
  445. <strong><p><?php echo str_replace("%s",$this->sg->GetRedirectLink("sitemap-donate-note"),__('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and you are satisfied with the results, isn\'t it worth at least a few dollar? <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-donate-note">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-donate-note">Sure, no problem!</a>','sitemap')); ?> <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_donated=true"; ?>" style="float:right; display:block; border:none; margin-left:10px;"><small style="font-weight:normal; "><?php _e('Sure, but I already did!', 'sitemap'); ?></small></a> <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_hide_note=true"; ?>" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php _e('No thanks, please don\'t bug me anymore!', 'sitemap'); ?></small></a></p></strong>
  446. <div style="clear:right;"></div>
  447. </div>
  448. -->
  449. <?php
  450. } else if($this->sg->GetOption('i_install_date')>0 && $this->sg->GetOption('i_hide_works')!==true && time() > ($this->sg->GetOption('i_install_date') + (60*60*24*15))) {
  451. ?>
  452. <div class="updated">
  453. <strong><p><?php echo str_replace("%s",$this->sg->GetRedirectLink("sitemap-works-note"),__('Thanks for using this plugin! You\'ve installed this plugin some time ago. If it works and your are satisfied, why not <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-works-note">rate it</a> and <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-works-note">recommend it</a> to others? :-)','sitemap')); ?> <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_hide_works=true"; ?>" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php _e('Don\'t show this anymore', 'sitemap'); ?></small></a></p></strong>
  454. <div style="clear:right;"></div>
  455. </div>
  456. <?php
  457. }
  458. if ($this->sg->ShowSurvey())
  459. $this->sg->HtmlSurvey();
  460. }
  461. ?>
  462. <style type="text/css">
  463. li.sm_hint {
  464. color:green;
  465. }
  466. li.sm_optimize {
  467. color:orange;
  468. }
  469. li.sm_error {
  470. color:red;
  471. }
  472. input.sm_warning:hover {
  473. background: #ce0000;
  474. color: #fff;
  475. }
  476. a.sm_button {
  477. padding:4px;
  478. display:block;
  479. padding-left:25px;
  480. background-repeat:no-repeat;
  481. background-position:5px 50%;
  482. text-decoration:none;
  483. border:none;
  484. }
  485. a.sm_button:hover {
  486. border-bottom-width:1px;
  487. }
  488. a.sm_donatePayPal {
  489. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-paypal.gif);
  490. }
  491. a.sm_donateAmazon {
  492. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-amazon.gif);
  493. }
  494. a.sm_pluginHome {
  495. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-arne.gif);
  496. }
  497. a.sm_pluginHelp {
  498. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-help.png);
  499. }
  500. a.sm_pluginList {
  501. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-email.gif);
  502. }
  503. a.sm_pluginSupport {
  504. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-wordpress.gif);
  505. }
  506. a.sm_pluginBugs {
  507. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-trac.gif);
  508. }
  509. a.sm_resGoogle {
  510. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-google.gif);
  511. }
  512. a.sm_resYahoo {
  513. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-yahoo.gif);
  514. }
  515. a.sm_resBing {
  516. background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-bing.gif);
  517. }
  518. div.sm-update-nag p {
  519. margin:5px;
  520. }
  521. .sm-padded .inside {
  522. margin: 12px !important;
  523. }
  524. .sm-padded .inside ul {
  525. margin: 6px 0 12px 0;
  526. }
  527. .sm-padded .inside input {
  528. padding: 1px;
  529. margin: 0;
  530. }
  531. .hndle {
  532. cursor:auto!important;
  533. -webkit-user-select:auto!important;
  534. -moz-user-select:auto!important;
  535. -ms-user-select:auto!important;
  536. user-select:auto!important;
  537. }
  538. <?php if (version_compare($wp_version, "3.4", "<")): //Fix style for WP 3.4 (dirty way for now..) ?>
  539. .inner-sidebar #side-sortables, .columns-2 .inner-sidebar #side-sortables {
  540. min-height: 300px;
  541. width: 280px;
  542. padding: 0;
  543. }
  544. .has-right-sidebar .inner-sidebar {
  545. display: block;
  546. }
  547. .inner-sidebar {
  548. float: right;
  549. clear: right;
  550. display: none;
  551. width: 281px;
  552. position: relative;
  553. }
  554. .has-right-sidebar #post-body-content {
  555. margin-right: 300px;
  556. }
  557. #post-body-content {
  558. width: auto !important;
  559. float: none !important;
  560. }
  561. <?php endif; ?>
  562. </style>
  563. <div class="wrap" id="sm_div">
  564. <form method="post" action="<?php echo $this->sg->GetBackLink() ?>">
  565. <h2><?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this->sg->GetVersion() ?> </h2>
  566. <?php
  567. if(get_option('blog_public')!=1) {
  568. ?><div class="error"><p><?php echo str_replace("%s","options-reading.php#blog_public",__('Your site is currently blocking search engines! Visit the <a href="%s">Reading Settings</a> to change this.','sitemap')); ?></p></div><?php
  569. }
  570. ?>
  571. <?php if(!$snl): ?>
  572. <div id="poststuff" class="metabox-holder has-right-sidebar">
  573. <div class="inner-sidebar">
  574. <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
  575. <?php else: ?>
  576. <div id="poststuff" class="metabox-holder">
  577. <?php endif; ?>
  578. <?php if(!$snl): ?>
  579. <?php $this->HtmlPrintBoxHeader('sm_pnres',__('About this Plugin:','sitemap'),true); ?>
  580. <a class="sm_button sm_pluginHome" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-home"><?php _e('Plugin Homepage','sitemap'); ?></a>
  581. <a class="sm_button sm_pluginHome" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-feedback"><?php _e('Suggest a Feature','sitemap'); ?></a>
  582. <a class="sm_button sm_pluginHelp" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-help"><?php _e('Help / FAQ','sitemap'); ?></a>
  583. <a class="sm_button sm_pluginList" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-list"><?php _e('Notify List','sitemap'); ?></a>
  584. <a class="sm_button sm_pluginSupport" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-support"><?php _e('Support Forum','sitemap'); ?></a>
  585. <a class="sm_button sm_pluginBugs" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-bugs"><?php _e('Report a Bug','sitemap'); ?></a>
  586. <?php if(__('translator_name','sitemap')!='translator_name') {?><a class="sm_button sm_pluginSupport" href="<?php _e('translator_url','sitemap'); ?>"><?php _e('translator_name','sitemap'); ?></a><?php } ?>
  587. <?php $this->HtmlPrintBoxFooter(true); ?>
  588. <?php $this->HtmlPrintBoxHeader('sm_smres',__('Sitemap Resources:','sitemap'),true); ?>
  589. <a class="sm_button sm_resGoogle" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-gwt"><?php _e('Webmaster Tools','sitemap'); ?></a>
  590. <a class="sm_button sm_resGoogle" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-gwb"><?php _e('Webmaster Blog','sitemap'); ?></a>
  591. <a class="sm_button sm_resYahoo" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-ywb"><?php _e('Search Blog','sitemap'); ?></a>
  592. <a class="sm_button sm_resBing" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-lwt"><?php _e('Webmaster Tools','sitemap'); ?></a>
  593. <a class="sm_button sm_resBing" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-lswcb"><?php _e('Webmaster Center Blog','sitemap'); ?></a>
  594. <br />
  595. <a class="sm_button sm_resGoogle" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-prot"><?php _e('Sitemaps Protocol','sitemap'); ?></a>
  596. <a class="sm_button sm_resGoogle" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-ofat"><?php _e('Official Sitemaps FAQ','sitemap'); ?></a>
  597. <a class="sm_button sm_pluginHome" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-afaq"><?php _e('My Sitemaps FAQ','sitemap'); ?></a>
  598. <?php $this->HtmlPrintBoxFooter(true); ?>
  599. </div>
  600. </div>
  601. <?php endif; ?>
  602. <div class="has-sidebar sm-padded" >
  603. <div id="post-body-content" class="<?php if(!$snl): ?>has-sidebar-content<?php endif; ?>">
  604. <div class="meta-box-sortabless">
  605. <!-- Rebuild Area -->
  606. <?php
  607. $status = GoogleSitemapGeneratorStatus::Load();
  608. $head = __('Search engines haven\'t been notified yet','sitemap');
  609. if($status != null && $status->GetStartTime() > 0) {
  610. $st=$status->GetStartTime() + (get_option( 'gmt_offset' ) * 3600);
  611. $head=str_replace("%date%",date_i18n(get_option('date_format'),$st) . " " . date_i18n(get_option('time_format'),$st),__('Result of the last ping, started on %date%.','sitemap'));
  612. }
  613. $this->HtmlPrintBoxHeader('sm_rebuild',$head); ?>
  614. <div style="border-left: 1px #DFDFDF solid; float:right; padding-left:15px; margin-left:10px; width:35%;">
  615. <strong><?php _e('Recent Support Topics / News','sitemap'); ?></strong>
  616. <?php
  617. if($this->sg->GetOption('i_supportfeed')) {
  618. echo "<small><a href=\"" . wp_nonce_url($this->sg->GetBackLink() . "&sm_disable_supportfeed=true") . "\">" . __('Disable','sitemap') . "</a></small>";
  619. $supportFeed = $this->sg->GetSupportFeed();
  620. if (!is_wp_error($supportFeed) && $supportFeed) {
  621. $supportItems = $supportFeed->get_items(0, $supportFeed->get_item_quantity(3));
  622. if(count($supportItems)>0) {
  623. echo "<ul>";
  624. foreach($supportItems AS $item) {
  625. $url = esc_url($item->get_permalink());
  626. $title = esc_html($item->get_title());
  627. echo "<li><a rel=\"external\" target=\"_blank\" href=\"{$url}\">{$title}</a></li>";
  628. }
  629. echo "</ul>";
  630. }
  631. } else {
  632. echo "<ul><li>" . __('No support topics available or an error occurred while fetching them.','sitemap') . "</li></ul>";
  633. }
  634. } else {
  635. echo "<ul><li>" . __('Support Topics have been disabled. Enable them to see useful information regarding this plugin. No Ads or Spam!','sitemap') . " " . "<a href=\"" . wp_nonce_url($this->sg->GetBackLink() . "&sm_disable_supportfeed=false") . "\">" . __('Enable','sitemap') . "</a>". "</li></ul>";
  636. }
  637. ?>
  638. </div>
  639. <div style="min-height:150px;">
  640. <ul>
  641. <?php
  642. if($this->sg->OldFileExists()) {
  643. echo "<li class=\"sm_error\">" . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_delete_old=true",'sitemap'),__('There is still a sitemap.xml or sitemap.xml.gz file in your site directory. Please delete them as no static files are used anymore or <a href="%s">try to delete them automatically</a>.','sitemap')) . "</li>";
  644. }
  645. echo "<li>" . str_replace("%s",$this->sg->getXmlUrl(),__('The URL to your sitemap index file is: <a href="%s">%s</a>.','sitemap')) . "</li>";
  646. if($status == null) {
  647. echo "<li>" . __('Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.','sitemap') . "</li>";
  648. } else {
  649. $services = $status->GetUsedPingServices();
  650. foreach($services AS $service) {
  651. $name = $status->GetServiceName($service);
  652. if($status->GetPingResult($service)) {
  653. echo "<li>" . sprintf(__("%s was <b>successfully notified</b> about changes.",'sitemap'),$name). "</li>";
  654. $dur = $status->GetPingDuration($service);
  655. if($dur > 4) {
  656. echo "<li class=\sm_optimize\">" . str_replace(array("%time%","%name%"),array($dur,$name),__("It took %time% seconds to notify %name%, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
  657. }
  658. } else {
  659. echo "<li class=\"sm_error\">" . str_replace(array("%s","%name%"),array(wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=" . $service . "&noheader=true",'sitemap'),$name),__('There was a problem while notifying %name%. <a href="%s" target="_blank">View result</a>','sitemap')) . "</li>";
  660. }
  661. }
  662. }
  663. ?>
  664. <?php if($this->sg->GetOption('b_ping') || $this->sg->GetOption('b_pingmsn')): ?>
  665. <li>
  666. Notify Search Engines about <a href="<?php echo wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_main=true",'sitemap'); ?>">your sitemap </a> or <a href="#" onclick="window.open('<?php echo wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_all=true&noheader=true",'sitemap'); ?>','','width=650, height=500, resizable=yes'); return false;">your main sitemap and all sub-sitemaps</a> now.
  667. </li>
  668. <?php endif; ?>
  669. <?php if(is_super_admin()) echo "<li>" . str_replace("%d",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true",'sitemap'),__('If you encounter any problems with your sitemap you can use the <a href="%d">debug function</a> to get more information.','sitemap')) . "</li>"; ?>
  670. </ul>
  671. <ul>
  672. <li>
  673. <?php echo sprintf(__('If you like the plugin, please <a target="_blank" href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-works-note">rate it 5 stars</a>! :)','sitemap'),$this->sg->GetRedirectLink('sitemap-works-note'),$this->sg->GetRedirectLink('sitemap-paypal')); ?>
  674. </li>
  675. </ul>
  676. </div>
  677. <?php $this->HtmlPrintBoxFooter(); ?>
  678. <?php if($this->sg->IsNginx() && $this->sg->IsUsingPermalinks()): ?>
  679. <?php $this->HtmlPrintBoxHeader('ngin_x',__('Webserver Configuration', 'sitemap')); ?>
  680. <?php _e('Since you are using Nginx as your web-server, please configure the following rewrite rules in case you get 404 Not Found errors for your sitemap:','sitemap'); ?>
  681. <p>
  682. <code style="display:block; overflow-x:auto; white-space: nowrap;">
  683. <?php
  684. $rules = GoogleSitemapGeneratorLoader::GetNginXRules();
  685. foreach($rules AS $rule) {
  686. echo $rule . "<br />";
  687. }
  688. ?>
  689. </code>
  690. </p>
  691. <?php $this->HtmlPrintBoxFooter(); ?>
  692. <?php endif; ?>
  693. <!-- Basic Options -->
  694. <?php $this->HtmlPrintBoxHeader('sm_basic_options',__('Basic Options', 'sitemap')); ?>
  695. <b><?php _e('Update notification:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-ping'); ?>"><?php _e('Learn more','sitemap'); ?></a>
  696. <ul>
  697. <li>
  698. <input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php echo ($this->sg->GetOption("b_ping")==true?"checked=\"checked\"":"") ?> />
  699. <label for="sm_b_ping"><?php _e('Notify Google about updates of your site', 'sitemap') ?></label><br />
  700. <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-gwt'),__('No registration required, but you can join the <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-gwt">Google Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
  701. </li>
  702. <li>
  703. <input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php echo ($this->sg->GetOption("b_pingmsn")==true?"checked=\"checked\"":"") ?> />
  704. <label for="sm_b_pingmsn"><?php _e('Notify Bing (formerly MSN Live Search) about updates of your site', 'sitemap') ?></label><br />
  705. <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-lwt'),__('No registration required, but you can join the <a href="https://8rkh4sskhh.execute-api.us-east-1.amazonaws.com/gsg/v1/sitemap-lwt">Bing Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
  706. </li>
  707. <li>
  708. <label for="sm_b_robots">
  709. <input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php echo ($this->sg->GetOption("b_robots")==true?"checked=\"checked\"":"") ?> />
  710. <?php _e("Add sitemap URL to the virtual robots.txt file.",'sitemap'); ?>
  711. </label>
  712. <br />
  713. <small><?php _e('The virtual robots.txt generated by WordPress is used. A real robots.txt file must NOT exist in the site directory!','sitemap'); ?></small>
  714. </li>
  715. </ul>
  716. <?php if(is_super_admin()): ?>
  717. <b><?php _e('Advanced options:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv'); ?>"><?php _e('Learn more','sitemap'); ?></a>
  718. <ul>
  719. <li>
  720. <label for="sm_b_memory"><?php _e('Try to increase the memory limit to:', 'sitemap') ?> <input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="<?php echo esc_attr($this->sg->GetOption("b_memory")); ?>" /></label> (<?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?>)
  721. </li>
  722. <li>
  723. <label for="sm_b_time"><?php _e('Try to increase the execution time limit to:', 'sitemap') ?> <input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="<?php echo esc_attr(($this->sg->GetOption("b_time")===-1?'':$this->sg->GetOption("b_time"))); ?>" /></label> (<?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')) ?>)
  724. </li>
  725. <li>
  726. <label for="sm_b_autozip">
  727. <input type="checkbox" id="sm_b_autozip" name="sm_b_autozip" <?php echo ($this->sg->GetOption("b_autozip")==true?"checked=\"checked\"":"") ?> />
  728. <?php _e('Try to automatically compress the sitemap if the requesting client supports it.', 'sitemap') ?>
  729. </label><br />
  730. <small><?php _e('Disable this option if you get garbled content or encoding errors in your sitemap.','sitemap'); ?></small>
  731. </li>
  732. <li>
  733. <?php $useDefStyle = ($this->sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default')===true); ?>
  734. <label for="sm_b_style"><?php _e('Include a XSLT stylesheet:', 'sitemap') ?> <input <?php echo ($useDefStyle?'disabled="disabled" ':'') ?> type="text" name="sm_b_style" id="sm_b_style" value="<?php echo esc_attr($this->sg->GetOption("b_style")); ?>" /></label>
  735. (<?php _e('Full or relative URL to your .xsl file', 'sitemap') ?>) <?php if($this->sg->GetDefaultStyle()): ?><label for="sm_b_style_default"><input <?php echo ($useDefStyle?'checked="checked" ':'') ?> type="checkbox" id="sm_b_style_default" name="sm_b_style_default" onclick="document.getElementById('sm_b_style').disabled = this.checked;" /> <?php _e('Use default', 'sitemap') ?></label> <?php endif; ?>
  736. </li>
  737. <li>
  738. <label for="sm_b_baseurl"><?php _e('Override the base URL of the sitemap:', 'sitemap') ?> <input type="text" name="sm_b_baseurl" id="sm_b_baseurl" value="<?php echo esc_attr($this->sg->GetOption("b_baseurl")); ?>" /></label><br />
  739. <small><?php _e('Use this if your site is in a sub-directory, but you want the sitemap be located in the root. Requires .htaccess modification.','sitemap'); ?> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv-baseurl'); ?>"><?php _e('Learn more','sitemap'); ?></a></small>
  740. </li>
  741. <li>
  742. <label for="sm_b_html">
  743. <input type="checkbox" id="sm_b_html" name="sm_b_html" <?php if(!$this->sg->IsXslEnabled()) echo 'disabled="disabled"'; ?> <?php echo ($this->sg->GetOption("b_html")==true && $this->sg->IsXslEnabled()?"checked=\"checked\"":"") ?> />
  744. <?php _e('Include sitemap in HTML format', 'sitemap') ?> <?php if(!$this->sg->IsXslEnabled()) _e('(The required PHP XSL Module is not installed)', 'sitemap') ?>
  745. </label>
  746. </li>
  747. <li>
  748. <label for="sm_b_stats">
  749. <input type="checkbox" id="sm_b_stats" name="sm_b_stats" <?php echo ($this->sg->GetOption("b_stats")==true?"checked=\"checked\"":"") ?> />
  750. <?php _e('Allow anonymous statistics (no personal information)', 'sitemap') ?>
  751. </label> <label><a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv-stats'); ?>"><?php _e('Learn more','sitemap'); ?></a></label>
  752. </li>
  753. </ul>
  754. <?php endif; ?>
  755. <?php $this->HtmlPrintBoxFooter(); ?>
  756. <?php if(is_super_admin()): ?>
  757. <?php $this->HtmlPrintBoxHeader('sm_pages',__('Additional Pages', 'sitemap')); ?>
  758. <?php
  759. _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Site/WordPress.<br />For example, if your domain is www.foo.com and your site is located on www.foo.com/site you might want to include your homepage at www.foo.com','sitemap');
  760. echo "<ul><li>";
  761. echo "<strong>" . __('Note','sitemap'). "</strong>: ";
  762. _e("If your site is in a subdirectory and you want to add pages which are NOT in the site directory or beneath, you MUST place your sitemap file in the root directory (Look at the &quot;Location of your sitemap file&quot; section on this page)!",'sitemap');
  763. echo "</li><li>";
  764. echo "<strong>" . __('URL to the page','sitemap'). "</strong>: ";
  765. _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ",'sitemap');
  766. echo "</li><li>";
  767. echo "<strong>" . __('Priority','sitemap') . "</strong>: ";
  768. _e("Choose the priority of the page relative to the other pages. For example, your homepage might have a higher priority than your imprint.",'sitemap');
  769. echo "</li><li>";
  770. echo "<strong>" . __('Last Changed','sitemap'). "</strong>: ";
  771. _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).",'sitemap');
  772. echo "</li></ul>";
  773. ?>
  774. <script type="text/javascript">
  775. //<![CDATA[
  776. <?php
  777. $freqVals = "'" . implode("','",array_keys($this->sg->GetFreqNames())). "'";
  778. $freqNames = "'" . implode("','",array_values($this->sg->GetFreqNames())). "'";
  779. ?>
  780. var changeFreqVals = [<?php echo $freqVals; ?>];
  781. var changeFreqNames = [ <?php echo $freqNames; ?>];
  782. var priorities= [0<?php for($i=0.1; $i<1; $i+=0.1) { echo "," . number_format($i,1,".",""); } ?>];
  783. var pages = [ <?php
  784. $pages = $this->sg->GetPages();
  785. $fd = false;
  786. foreach($pages AS $page) {
  787. if($page instanceof GoogleSitemapGeneratorPage) {
  788. if($fd) echo ",";
  789. else $fd = true;
  790. echo '{url:"' . esc_js($page->getUrl()) . '", priority:' . esc_js(number_format($page->getPriority(),1,".","")) . ', changeFreq:"' . esc_js($page->getChangeFreq()) . '", lastChanged:"' . esc_js(($page->getLastMod()>0?date("Y-m-d",$page->getLastMod()):"")) . '"}';
  791. }
  792. }
  793. ?> ];
  794. //]]>
  795. </script>
  796. <script type="text/javascript" src="<?php echo $this->sg->GetPluginUrl(); ?>img/sitemap.js"></script>
  797. <table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable">
  798. <tr>
  799. <th scope="col"><?php _e('URL to the page','sitemap'); ?></th>
  800. <th scope="col"><?php _e('Priority','sitemap'); ?></th>
  801. <th scope="col"><?php _e('Change Frequency','sitemap'); ?></th>
  802. <th scope="col"><?php _e('Last Changed','sitemap'); ?></th>
  803. <th scope="col"><?php _e('#','sitemap'); ?></th>
  804. </tr>
  805. <?php
  806. if(count($pages)<=0) { ?>
  807. <tr>
  808. <td colspan="5" align="center"><?php _e('No pages defined.','sitemap') ?></td>
  809. </tr><?php
  810. }
  811. ?>
  812. </table>
  813. <a href="javascript:void(0);" onclick="sm_addPage();"><?php _e("Add new page",'sitemap'); ?></a>
  814. <?php $this->HtmlPrintBoxFooter(); ?>
  815. <?php endif; ?>
  816. <!-- AutoPrio Options -->
  817. <?php $this->HtmlPrintBoxHeader('sm_postprio',__('Post Priority', 'sitemap')); ?>
  818. <p><?php _e('Please select how the priority of each post should be calculated:', 'sitemap') ?></p>
  819. <ul>
  820. <li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php echo $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"),"") ?> /> <label for="sm_b_prio_provider__0"><?php _e('Do not use automatic priority calculation', 'sitemap') ?></label><br /><?php _e('All posts will have the same priority which is defined in &quot;Priorities&quot;', 'sitemap') ?></p></li>
  821. <?php
  822. $provs = $this->sg->GetPrioProviders();
  823. for($i=0; $i<count($provs); $i++) {
  824. echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_$i\" name=\"sm_b_prio_provider\" value=\"" . $provs[$i] . "\" " . $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"),$provs[$i]) . " /> <label for=\"sm_b_prio_provider_$i\">" . call_user_func(array($provs[$i], 'getName')) . "</label><br />" . call_user_func(array($provs[$i], 'getDescription')) . "</p></li>";
  825. }
  826. ?>
  827. </ul>
  828. <?php $this->HtmlPrintBoxFooter(); ?>
  829. <!-- Includes -->
  830. <?php $this->HtmlPrintBoxHeader('sm_includes',__('Sitemap Content', 'sitemap')); ?>
  831. <b><?php _e('WordPress standard content', 'sitemap') ?>:</b>
  832. <ul>
  833. <li>
  834. <label for="sm_in_home">
  835. <input type="checkbox" id="sm_in_home" name="sm_in_home" <?php echo ($this->sg->GetOption("in_home")==true?"checked=\"checked\"":"") ?> />
  836. <?php _e('Include homepage', 'sitemap') ?>
  837. </label>
  838. </li>
  839. <li>
  840. <label for="sm_in_posts">
  841. <input type="checkbox" id="sm_in_posts" name="sm_in_posts" <?php echo ($this->sg->GetOption("in_posts")==true?"checked=\"checked\"":"") ?> />
  842. <?php _e('Include posts', 'sitemap') ?>
  843. </label>
  844. </li>
  845. <li>
  846. <label for="sm_in_pages">
  847. <input type="checkbox" id="sm_in_pages" name="sm_in_pages" <?php echo ($this->sg->GetOption("in_pages")==true?"checked=\"checked\"":"") ?> />
  848. <?php _e('Include static pages', 'sitemap') ?>
  849. </label>
  850. </li>
  851. <li>
  852. <label for="sm_in_cats">
  853. <input type="checkbox" id="sm_in_cats" name="sm_in_cats" <?php echo ($this->sg->GetOption("in_cats")==true?"checked=\"checked\"":"") ?> />
  854. <?php _e('Include categories', 'sitemap') ?>
  855. </label>
  856. </li>
  857. <li>
  858. <label for="sm_in_arch">
  859. <input type="checkbox" id="sm_in_arch" name="sm_in_arch" <?php echo ($this->sg->GetOption("in_arch")==true?"checked=\"checked\"":"") ?> />
  860. <?php _e('Include archives', 'sitemap') ?>
  861. </label>
  862. </li>
  863. <li>
  864. <label for="sm_in_auth">
  865. <input type="checkbox" id="sm_in_auth" name="sm_in_auth" <?php echo ($this->sg->GetOption("in_auth")==true?"checked=\"checked\"":"") ?> />
  866. <?php _e('Include author pages', 'sitemap') ?>
  867. </label>
  868. </li>
  869. <?php if($this->sg->IsTaxonomySupported()): ?>
  870. <li>
  871. <label for="sm_in_tags">
  872. <input type="checkbox" id="sm_in_tags" name="sm_in_tags" <?php echo ($this->sg->GetOption("in_tags")==true?"checked=\"checked\"":"") ?> />
  873. <?php _e('Include tag pages', 'sitemap') ?>
  874. </label>
  875. </li>
  876. <?php endif; ?>
  877. </ul>
  878. <?php
  879. if($this->sg->IsTaxonomySupported()) {
  880. $taxonomies = $this->sg->GetCustomTaxonomies();
  881. $enabledTaxonomies = $this->sg->GetOption('in_tax');
  882. if(count($taxonomies)>0) {
  883. ?><b><?php _e('Custom taxonomies', 'sitemap') ?>:</b><ul><?php
  884. foreach ($taxonomies as $taxName) {
  885. $taxonomy = get_taxonomy($taxName);
  886. $selected = in_array($taxonomy->name, $enabledTaxonomies);
  887. ?>
  888. <li>
  889. <label for="sm_in_tax[<?php echo $taxonomy->name; ?>]">
  890. <input type="checkbox" id="sm_in_tax[<?php echo $taxonomy->name; ?>]" name="sm_in_tax[<?php echo $taxonomy->name; ?>]" <?php echo $selected?"checked=\"checked\"":""; ?> />
  891. <?php echo str_replace('%s',$taxonomy->label,__('Include taxonomy pages for %s', 'sitemap')); ?>
  892. </label>
  893. </li>
  894. <?php
  895. }
  896. ?></ul><?php
  897. }
  898. }
  899. if($this->sg->IsCustomPostTypesSupported()) {
  900. $custom_post_types = $this->sg->GetCustomPostTypes();
  901. $enabledPostTypes = $this->sg->GetOption('in_customtypes');
  902. if(count($custom_post_types)>0) {
  903. ?><b><?php _e('Custom post types', 'sitemap') ?>:</b><ul><?php
  904. foreach ($custom_post_types as $post_type) {
  905. $post_type_object = get_post_type_object($post_type);
  906. if (is_array($enabledPostTypes)) $selected = in_array($post_type_object->name, $enabledPostTypes);
  907. ?>
  908. <li>
  909. <label for="sm_in_customtypes[<?php echo $post_type_object->name; ?>]">
  910. <input type="checkbox" id="sm_in_customtypes[<?php echo $post_type_object->name; ?>]" name="sm_in_customtypes[<?php echo $post_type_object->name; ?>]" <?php echo $selected?"checked=\"checked\"":""; ?> />
  911. <?php echo str_replace('%s',$post_type_object->label,__('Include custom post type %s', 'sitemap')); ?>
  912. </label>
  913. </li>
  914. <?php
  915. }
  916. ?></ul><?php
  917. }
  918. }
  919. ?>
  920. <b><?php _e('Further options', 'sitemap') ?>:</b>
  921. <ul>
  922. <li>
  923. <label for="sm_in_lastmod">
  924. <input type="checkbox" id="sm_in_lastmod" name="sm_in_lastmod" <?php echo ($this->sg->GetOption("in_lastmod")==true?"checked=\"checked\"":"") ?> />
  925. <?php _e('Include the last modification time.', 'sitemap') ?>
  926. </label><br />
  927. <small><?php _e('This is highly recommended and helps the search engines to know when your content has changed. This option affects <i>all</i> sitemap entries.', 'sitemap') ?></small>
  928. </li>
  929. </ul>
  930. <?php $this->HtmlPrintBoxFooter(); ?>
  931. <!-- Excluded Items -->
  932. <?php $this->HtmlPrintBoxHeader('sm_excludes',__('Excluded Items', 'sitemap')); ?>
  933. <b><?php _e('Excluded categories', 'sitemap') ?>:</b>
  934. <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;">
  935. <ul>
  936. <?php wp_category_checklist(0,0,$this->sg->GetOption("b_exclude_cats"),false); ?>
  937. </ul>
  938. </div>
  939. <b><?php _e("Exclude posts","sitemap"); ?>:</b>
  940. <div style="margin:5px 0 13px 40px;">
  941. <label for="sm_b_exclude"><?php _e('Exclude the following posts or pages:', 'sitemap') ?> <small><?php _e('List of IDs, separated by comma', 'sitemap') ?></small><br />
  942. <input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php echo esc_attr(implode(",",$this->sg->GetOption("b_exclude"))); ?>" /></label><br />
  943. <cite><?php _e("Note","sitemap") ?>: <?php _e("Child posts won't be excluded automatically!","sitemap"); ?></cite>
  944. </div>
  945. <?php $this->HtmlPrintBoxFooter(); ?>
  946. <!-- Change frequencies -->
  947. <?php $this->HtmlPrintBoxHeader('sm_change_frequencies',__('Change Frequencies', 'sitemap')); ?>
  948. <p>