Google XML Sitemaps - Version 3.1.1

Version Description

Download this release

Release Info

Developer arnee
Plugin Icon 128x128 Google XML Sitemaps
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0.1 to 3.1.1

Files changed (5) hide show
  1. documentation.txt +5 -0
  2. readme.txt +1 -1
  3. sitemap-core.php +321 -260
  4. sitemap-ui.php +753 -710
  5. sitemap.php +42 -22
documentation.txt CHANGED
@@ -180,6 +180,11 @@
180
  2008-05-27 3.1.0.1 Extracted UI JS to external file
181
  Enabled the option to include following pages of multi-page posts
182
  Script tries to raise memory and time limit if active
 
 
 
 
 
183
 
184
 
185
 
180
  2008-05-27 3.1.0.1 Extracted UI JS to external file
181
  Enabled the option to include following pages of multi-page posts
182
  Script tries to raise memory and time limit if active
183
+ 2008-12-21 3.1.1 Fixed redirect issue if wp-admin is rewritten via mod_rewrite, thanks to macjoost
184
+ Fixed wrong path to assets, thanks PozHonks
185
+ Fixed wrong plugin URL if wp-content was renamed / redirected, thanks to wnorris
186
+ Updated WP User Interface for 2.7
187
+ Various other small things
188
 
189
 
190
 
readme.txt CHANGED
@@ -11,7 +11,7 @@ This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPres
11
 
12
  This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog. It supports all of the WordPress generated pages as well as custom ones. Everytime you edit or create a post, your sitemap is updated and all major search engines that support the sitemap protocol, like ASK.com, Google, MSN Search and YAHOO, are notified about the update.
13
 
14
- Plugin related Links:
15
 
16
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" title="Google XML Sitemaps Plugin for WordPress">Plugin Homepage</a>
17
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/changelog/" title="Changelog of the Google XML Sitemaps Plugin for WordPress">Changelog</a>
11
 
12
  This plugin will create a Google sitemaps compliant XML-Sitemap of your WordPress blog. It supports all of the WordPress generated pages as well as custom ones. Everytime you edit or create a post, your sitemap is updated and all major search engines that support the sitemap protocol, like ASK.com, Google, MSN Search and YAHOO, are notified about the update.
13
 
14
+ Related Links:
15
 
16
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" title="Google XML Sitemaps Plugin for WordPress">Plugin Homepage</a>
17
  * <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/changelog/" title="Changelog of the Google XML Sitemaps Plugin for WordPress">Changelog</a>
sitemap-core.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
  /*
3
 
4
- $Id: sitemap-core.php 48034 2008-05-27 14:36:18Z arnee $
5
 
6
  */
7
 
@@ -9,7 +9,6 @@
9
  //error_reporting(E_ALL);
10
  //ini_set("display_errors",1);
11
 
12
-
13
  #region PHP5 compat functions
14
  if (!function_exists('file_get_contents')) {
15
  /**
@@ -41,7 +40,7 @@ if (!function_exists('file_get_contents')) {
41
 
42
  fclose($fh);
43
  return $data;
44
- }
45
  }
46
 
47
 
@@ -151,13 +150,13 @@ class GoogleSitemapGeneratorStatus {
151
  }
152
 
153
  function Save() {
154
- update_option("sm_status",$this);
155
  }
156
 
157
  function Load() {
158
  $status = @get_option("sm_status");
159
  if(is_a($status,"GoogleSitemapGeneratorStatus")) return $status;
160
- else return null;
161
  }
162
 
163
  /**
@@ -182,7 +181,7 @@ class GoogleSitemapGeneratorStatus {
182
  * @var int $_memoryUsage The amount of memory used in bytes
183
  * @access private
184
  */
185
- var $_memoryUsage = 0;
186
 
187
  /**
188
  * @var int $_lastPost The number of posts processed. This value is updated every 50 posts.
@@ -211,11 +210,11 @@ class GoogleSitemapGeneratorStatus {
211
  $this->_memoryUsage = memory_get_peak_usage(true);
212
  } else if(function_exists("memory_get_usage")) {
213
  $this->_memoryUsage = memory_get_usage(true);
214
- }
215
  }
216
 
217
  function GetMemoryUsage() {
218
- return round($this->_memoryUsage / 1024 / 1024,2);
219
  }
220
 
221
  function SaveStep($postCount) {
@@ -223,23 +222,23 @@ class GoogleSitemapGeneratorStatus {
223
  $this->_lastPost = $postCount;
224
  $this->_lastTime = $this->GetMicrotimeFloat();
225
 
226
- $this->Save();
227
  }
228
 
229
  function GetTime() {
230
- return round($this->_endTime - $this->_startTime,2);
231
  }
232
 
233
  function GetStartTime() {
234
- return round($this->_startTime, 2);
235
  }
236
 
237
  function GetLastTime() {
238
- return round($this->_lastTime - $this->_startTime,2);
239
  }
240
 
241
  function GetLastPost() {
242
- return $this->_lastPost;
243
  }
244
 
245
  var $_usedXml = false;
@@ -252,11 +251,11 @@ class GoogleSitemapGeneratorStatus {
252
  $this->_xmlPath = $path;
253
  $this->_xmlUrl = $url;
254
 
255
- $this->Save();
256
  }
257
 
258
  function EndXml($success) {
259
- $this->_xmlSuccess = $success;
260
 
261
  $this->Save();
262
  }
@@ -270,7 +269,7 @@ class GoogleSitemapGeneratorStatus {
270
  function StartZip($path,$url) {
271
  $this->_usedZip = true;
272
  $this->_zipPath = $path;
273
- $this->_zipUrl = $url;
274
 
275
  $this->Save();
276
  }
@@ -278,7 +277,7 @@ class GoogleSitemapGeneratorStatus {
278
  function EndZip($success) {
279
  $this->_zipSuccess = $success;
280
 
281
- $this->Save();
282
  }
283
 
284
  var $_usedGoogle = false;
@@ -290,20 +289,20 @@ class GoogleSitemapGeneratorStatus {
290
  function StartGooglePing($url) {
291
  $this->_googleUrl = true;
292
  $this->_usedGoogle = true;
293
- $this->_googleStartTime = $this->GetMicrotimeFloat();
294
 
295
  $this->Save();
296
  }
297
 
298
  function EndGooglePing($success) {
299
  $this->_googleEndTime = $this->GetMicrotimeFloat();
300
- $this->_gooogleSuccess = $success;
301
 
302
- $this->Save();
303
  }
304
 
305
  function GetGoogleTime() {
306
- return round($this->_googleEndTime - $this->_googleStartTime,2);
307
  }
308
 
309
  var $_usedYahoo = false;
@@ -317,18 +316,18 @@ class GoogleSitemapGeneratorStatus {
317
  $this->_usedYahoo = true;
318
  $this->_yahooStartTime = $this->GetMicrotimeFloat();
319
 
320
- $this->Save();
321
  }
322
 
323
  function EndYahooPing($success) {
324
  $this->_yahooEndTime = $this->GetMicrotimeFloat();
325
- $this->_yahooSuccess = $success;
326
 
327
- $this->Save();
328
  }
329
 
330
  function GetYahooTime() {
331
- return round($this->_yahooEndTime - $this->_yahooStartTime,2);
332
  }
333
 
334
  var $_usedAsk = false;
@@ -342,18 +341,18 @@ class GoogleSitemapGeneratorStatus {
342
  $this->_askUrl = $url;
343
  $this->_askStartTime = $this->GetMicrotimeFloat();
344
 
345
- $this->Save();
346
  }
347
 
348
  function EndAskPing($success) {
349
  $this->_askEndTime = $this->GetMicrotimeFloat();
350
- $this->_askSuccess = $success;
351
 
352
- $this->Save();
353
  }
354
 
355
  function GetAskTime() {
356
- return round($this->_askEndTime - $this->_askStartTime,2);
357
  }
358
 
359
  var $_usedMsn = false;
@@ -367,18 +366,18 @@ class GoogleSitemapGeneratorStatus {
367
  $this->_msnUrl = $url;
368
  $this->_msnStartTime = $this->GetMicrotimeFloat();
369
 
370
- $this->Save();
371
  }
372
 
373
  function EndMsnPing($success) {
374
  $this->_msnEndTime = $this->GetMicrotimeFloat();
375
- $this->_msnSuccess = $success;
376
 
377
- $this->Save();
378
  }
379
 
380
  function GetMsnTime() {
381
- return round($this->_msnEndTime - $this->_msnStartTime,2);
382
  }
383
 
384
  function GetMicrotimeFloat() {
@@ -414,14 +413,14 @@ class GoogleSitemapGeneratorPage {
414
  var $_changeFreq;
415
 
416
  /**
417
- * @var int $_lastMod Sets the lastMod date as a UNIX timestamp.
418
  * @access private
419
  */
420
- var $_lastMod;
421
 
422
  /**
423
  * Initialize a new page object
424
- *
425
  * @since 3.0
426
  * @access public
427
  * @author Arne Brachhold
@@ -444,7 +443,7 @@ class GoogleSitemapGeneratorPage {
444
  * @return string The URL
445
  */
446
  function GetUrl() {
447
- return $this->_url;
448
  }
449
 
450
  /**
@@ -453,7 +452,7 @@ class GoogleSitemapGeneratorPage {
453
  * @param string $url The new URL
454
  */
455
  function SetUrl($url) {
456
- $this->_url=(string) $url;
457
  }
458
 
459
  /**
@@ -462,7 +461,7 @@ class GoogleSitemapGeneratorPage {
462
  * @return float the priority, from 0.0 to 1.0
463
  */
464
  function GetPriority() {
465
- return $this->_priority;
466
  }
467
 
468
  /**
@@ -471,7 +470,7 @@ class GoogleSitemapGeneratorPage {
471
  * @param float $priority The new priority from 0.1 to 1.0
472
  */
473
  function SetProprity($priority) {
474
- $this->_priority=floatval($priority);
475
  }
476
 
477
  /**
@@ -480,7 +479,7 @@ class GoogleSitemapGeneratorPage {
480
  * @return string The change frequncy like hourly, weekly, monthly etc.
481
  */
482
  function GetChangeFreq() {
483
- return $this->_changeFreq;
484
  }
485
 
486
  /**
@@ -489,7 +488,7 @@ class GoogleSitemapGeneratorPage {
489
  * @param string $changeFreq The new change frequency
490
  */
491
  function SetChangeFreq($changeFreq) {
492
- $this->_changeFreq=(string) $changeFreq;
493
  }
494
 
495
  /**
@@ -498,7 +497,7 @@ class GoogleSitemapGeneratorPage {
498
  * @return int The lastmod value in seconds
499
  */
500
  function GetLastMod() {
501
- return $this->_lastMod;
502
  }
503
 
504
  /**
@@ -508,7 +507,7 @@ class GoogleSitemapGeneratorPage {
508
  */
509
  function SetLastMod($lastMod) {
510
  $this->_lastMod=intval($lastMod);
511
- }
512
 
513
  function Render() {
514
 
@@ -518,15 +517,15 @@ class GoogleSitemapGeneratorPage {
518
  $r.= "\t<url>\n";
519
  $r.= "\t\t<loc>" . $this->EscapeXML($this->_url) . "</loc>\n";
520
  if($this->_lastMod>0) $r.= "\t\t<lastmod>" . date('Y-m-d\TH:i:s+00:00',$this->_lastMod) . "</lastmod>\n";
521
- if(!empty($this->_changeFreq)) $r.= "\t\t<changefreq>" . $this->_changeFreq . "</changefreq>\n";
522
  if($this->_priority!==false && $this->_priority!=="") $r.= "\t\t<priority>" . number_format($this->_priority,1) . "</priority>\n";
523
- $r.= "\t</url>\n";
524
  return $r;
525
- }
526
 
527
  function EscapeXML($string) {
528
  return str_replace ( array ( '&', '"', "'", '<', '>'), array ( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;'), $string);
529
- }
530
  }
531
 
532
  class GoogleSitemapGeneratorXmlEntry {
@@ -534,19 +533,19 @@ class GoogleSitemapGeneratorXmlEntry {
534
  var $_xml;
535
 
536
  function GoogleSitemapGeneratorXmlEntry($xml) {
537
- $this->_xml = $xml;
538
  }
539
 
540
  function Render() {
541
- return $this->_xml;
542
- }
543
  }
544
 
545
  class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {
546
 
547
  function Render() {
548
- return "<!-- " . $this->_xml . " -->";
549
- }
550
  }
551
 
552
  /**
@@ -554,7 +553,7 @@ class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {
554
  * @author Arne Brachhold
555
  * @package sitemap
556
  * @since 3.0
557
- */
558
  class GoogleSitemapGeneratorPrioProviderBase {
559
 
560
  /**
@@ -590,14 +589,14 @@ class GoogleSitemapGeneratorPrioProviderBase {
590
  * @return string The translated description
591
  */
592
  function GetDescription() {
593
- return "";
594
  }
595
 
596
  /**
597
  * Initializes a new priority provider
598
  *
599
  * @param $totalComments int The total number of comments of all posts
600
- * @param $totalPosts int The total number of posts
601
  * @since 3.0
602
  * @access public
603
  * @author Arne Brachhold
@@ -606,7 +605,7 @@ class GoogleSitemapGeneratorPrioProviderBase {
606
  $this->_totalComments=$totalComments;
607
  $this->_totalPosts=$totalPosts;
608
 
609
- }
610
 
611
  /**
612
  * Returns the priority for a specified post
@@ -620,7 +619,7 @@ class GoogleSitemapGeneratorPrioProviderBase {
620
  */
621
  function GetPostPriority($postID,$commentCount) {
622
  return 0;
623
- }
624
  }
625
 
626
  /**
@@ -628,7 +627,7 @@ class GoogleSitemapGeneratorPrioProviderBase {
628
  * @author Arne Brachhold
629
  * @package sitemap
630
  * @since 3.0
631
- */
632
  class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPrioProviderBase {
633
 
634
  /**
@@ -652,20 +651,20 @@ class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPr
652
  * @return string The translated description
653
  */
654
  function GetDescription() {
655
- return __("Uses the number of comments of the post to calculate the priority",'sitemap');
656
  }
657
 
658
  /**
659
  * Initializes a new priority provider which calculates the post priority based on the number of comments
660
  *
661
  * @param $totalComments int The total number of comments of all posts
662
- * @param $totalPosts int The total number of posts
663
  * @since 3.0
664
  * @access public
665
  * @author Arne Brachhold
666
  */
667
  function GoogleSitemapGeneratorPrioByCountProvider($totalComments,$totalPosts) {
668
- parent::GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts);
669
  }
670
 
671
  /**
@@ -681,12 +680,12 @@ class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPr
681
  function GetPostPriority($postID,$commentCount) {
682
  $prio=0;
683
  if($this->_totalComments>0 && $commentCount>0) {
684
- $prio = round(($commentCount*100/$this->_totalComments)/100,1);
685
  } else {
686
- $prio = 0;
687
  }
688
  return $prio;
689
- }
690
  }
691
 
692
  /**
@@ -694,7 +693,7 @@ class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPr
694
  * @author Arne Brachhold
695
  * @package sitemap
696
  * @since 3.0
697
- */
698
  class GoogleSitemapGeneratorPrioByAverageProvider extends GoogleSitemapGeneratorPrioProviderBase {
699
 
700
  /**
@@ -724,14 +723,14 @@ class GoogleSitemapGeneratorPrioByAverageProvider extends GoogleSitemapGenerator
724
  * @return string The translated description
725
  */
726
  function GetDescription() {
727
- return __("Uses the average comment count to calculate the priority",'sitemap');
728
  }
729
 
730
  /**
731
  * Initializes a new priority provider which calculates the post priority based on the average number of comments
732
  *
733
  * @param $totalComments int The total number of comments of all posts
734
- * @param $totalPosts int The total number of posts
735
  * @since 3.0
736
  * @access public
737
  * @author Arne Brachhold
@@ -758,24 +757,24 @@ class GoogleSitemapGeneratorPrioByAverageProvider extends GoogleSitemapGenerator
758
  $prio = 0;
759
  //Do not divide by zero!
760
  if($this->_average==0) {
761
- if($commentCount>0) $prio = 1;
762
  else $prio = 0;
763
  } else {
764
- $prio = $commentCount/$this->_average;
765
  if($prio>1) $prio = 1;
766
  else if($prio<0) $prio = 0;
767
  }
768
 
769
  return round($prio,1);
770
  }
771
- }
772
 
773
  /**
774
  * Priority Provider which calculates the priority based on the popularity by the PopularityContest Plugin
775
  * @author Arne Brachhold
776
  * @package sitemap
777
  * @since 3.0
778
- */
779
  class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitemapGeneratorPrioProviderBase {
780
 
781
  /**
@@ -787,7 +786,7 @@ class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitema
787
  * @return string The translated name
788
  */
789
  function GetName() {
790
- return __("Popularity Contest",'sitemap');
791
  }
792
 
793
  /**
@@ -806,7 +805,7 @@ class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitema
806
  * Initializes a new priority provider which calculates the post priority based on the popularity by the PopularityContest Plugin
807
  *
808
  * @param $totalComments int The total number of comments of all posts
809
- * @param $totalPosts int The total number of posts
810
  * @since 3.0
811
  * @access public
812
  * @author Arne Brachhold
@@ -844,27 +843,27 @@ class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitema
844
  preg_match("/([0-9]{1,3})\%/si",$popresult,$matches);
845
  if(!empty($matches) && is_array($matches) && count($matches)==2) {
846
  //Divide it so 100% = 1, 10% = 0.1
847
- $res=round(intval($matches[1])/100,1);
848
  }
849
  }
850
  }
851
  }
852
  return $res;
853
- }
854
  }
855
 
856
  /**
857
  * Class to generate a sitemaps.org Sitemaps compliant sitemap of a WordPress blog.
858
- *
859
  * @package sitemap
860
  * @author Arne Brachhold
861
  * @since 3.0
862
  */
863
- class GoogleSitemapGenerator {
864
  /**
865
  * @var Version of the generator in SVN
866
  */
867
- var $_svnVersion = '$Id: sitemap-core.php 48034 2008-05-27 14:36:18Z arnee $';
868
 
869
  /**
870
  * @var array The unserialized array with the stored options
@@ -893,37 +892,37 @@ class GoogleSitemapGenerator {
893
 
894
  /**
895
  * @var string Holds the last error if one occurs when writing the files
896
- */
897
  var $_lastError=null;
898
 
899
  /**
900
  * @var int The last handled post ID
901
- */
902
  var $_lastPostID = 0;
903
 
904
  /**
905
  * @var bool Defines if the sitemap building process is active at the moment
906
- */
907
  var $_isActive = false;
908
 
909
  /**
910
  * @var bool Defines if the sitemap building process has been scheduled via Wp cron
911
- */
912
  var $_isScheduled = false;
913
 
914
  /**
915
  * @var object The file handle which is used to write the sitemap file
916
- */
917
  var $_fileHandle = null;
918
 
919
  /**
920
  * @var object The file handle which is used to write the zipped sitemap file
921
- */
922
  var $_fileZipHandle = null;
923
 
924
  /**
925
  * Returns the path to the blog directory
926
- *
927
  * @since 3.0
928
  * @access private
929
  * @author Arne Brachhold
@@ -934,7 +933,7 @@ class GoogleSitemapGenerator {
934
  $res="";
935
  //Check if we are in the admin area -> get_home_path() is avaiable
936
  if(function_exists("get_home_path")) {
937
- $res = get_home_path();
938
  } else {
939
  //get_home_path() is not available, but we can't include the admin
940
  //libraries because many plugins check for the "check_admin_referer"
@@ -975,11 +974,14 @@ class GoogleSitemapGenerator {
975
  * @return string The URL to the plugin directory
976
  */
977
  function GetPluginUrl() {
 
 
 
978
  $path = dirname(__FILE__);
979
  $path = str_replace("\\","/",$path);
980
  $path = trailingslashit(get_bloginfo('wpurl')) . trailingslashit(substr($path,strpos($path,"wp-content/")));
981
  return $path;
982
- }
983
 
984
  /**
985
  * Returns the URL to default XSLT style if it exists
@@ -991,33 +993,33 @@ class GoogleSitemapGenerator {
991
  function GetDefaultStyle() {
992
  $p = $this->GetPluginPath();
993
  if(file_exists($p . "sitemap.xsl")) {
994
- return $this->GetPluginUrl() . 'sitemap.xsl';
995
  }
996
  return '';
997
  }
998
 
999
  /**
1000
  * Returns the path to the robots.txt file in the blog root
1001
- *
1002
  * @since 3.0b8
1003
  * @access private
1004
  * @author Arne Brachhold
1005
  * @return The full path to the robots.txt file
1006
  */
1007
  function GetRobotsFilePath() {
1008
- return trailingslashit($this->GetHomePath()) . 'robots.txt';
1009
  }
1010
 
1011
  /**
1012
  * Returns the URL to the robots.txt file in the blog root
1013
- *
1014
  * @since 3.0b8
1015
  * @access private
1016
  * @author Arne Brachhold
1017
  * @return The full URL to the robots.txt file
1018
  */
1019
  function GetRobotsFileUrl() {
1020
- return trailingslashit(get_bloginfo('siteurl')) . 'robots.txt';
1021
  }
1022
 
1023
  /**
@@ -1051,6 +1053,7 @@ class GoogleSitemapGenerator {
1051
  $this->_options["sm_b_style"] = $this->GetDefaultStyle(); //Include a stylesheet in the XML
1052
  $this->_options["sm_b_robots"] = false; //Modify or create robots.txt file in blog root which contains the sitemap location
1053
  $this->_options["sm_b_exclude"] = array(); //List of post / page IDs to exclude
 
1054
  $this->_options["sm_b_location_mode"]="auto"; //Mode of location, auto or manual
1055
  $this->_options["sm_b_filename_manual"]=""; //Manuel filename
1056
  $this->_options["sm_b_fileurl_manual"]=""; //Manuel fileurl
@@ -1078,9 +1081,9 @@ class GoogleSitemapGenerator {
1078
  $this->_options["sm_pr_posts_min"]=0.2; //Minimum Priority of posts, even if autocalc is enabled
1079
  $this->_options["sm_pr_pages"]=0.6; //Priority of static pages
1080
  $this->_options["sm_pr_cats"]=0.3; //Priority of categories
1081
- $this->_options["sm_pr_arch"]=0.3; //Priority of archives
1082
  $this->_options["sm_pr_auth"]=0.3; //Priority of author pages
1083
- $this->_options["sm_pr_tags"]=0.3; //Priority of tags
1084
 
1085
  $this->_options["sm_i_donated"]=false; //Did you donate? Thank you! :)
1086
  $this->_options["sm_i_hide_donated"]=false; //And hide the thank you..
@@ -1105,7 +1108,7 @@ class GoogleSitemapGenerator {
1105
  $storedoptions=get_option("sm_options");
1106
  if($storedoptions && is_array($storedoptions)) {
1107
  foreach($storedoptions AS $k=>$v) {
1108
- $this->_options[$k]=$v;
1109
  }
1110
  } else update_option("sm_options",$this->_options); //First time use, store default values
1111
  }
@@ -1176,7 +1179,7 @@ class GoogleSitemapGenerator {
1176
 
1177
  $parents=$this->GetParentClasses($className);
1178
 
1179
- return in_array($parentName,$parents);
1180
  }
1181
 
1182
  /**
@@ -1222,7 +1225,7 @@ class GoogleSitemapGenerator {
1222
  $r = apply_filters("sm_add_prio_provider",$this->_prioProviders);
1223
 
1224
  //Check if no plugin return null
1225
- if($r != null) $this->_prioProviders = $r;
1226
 
1227
  $this->ValidatePrioProviders();
1228
 
@@ -1235,7 +1238,7 @@ class GoogleSitemapGenerator {
1235
  *
1236
  * @since 3.0
1237
  * @access public
1238
- * @return GoogleSitemapGenerator The instance or null if not available.
1239
  * @author Arne Brachhold
1240
  */
1241
  function &GetInstance() {
@@ -1259,7 +1262,7 @@ class GoogleSitemapGenerator {
1259
 
1260
  /**
1261
  * Returns if the compressed sitemap was activated
1262
- *
1263
  * @since 3.0b8
1264
  * @access private
1265
  * @author Arne Brachhold
@@ -1271,7 +1274,7 @@ class GoogleSitemapGenerator {
1271
 
1272
  /**
1273
  * Returns if this version of WordPress supports the new taxonomy system
1274
- *
1275
  * @since 3.0b8
1276
  * @access private
1277
  * @author Arne Brachhold
@@ -1289,7 +1292,7 @@ class GoogleSitemapGenerator {
1289
  * @author Arne Brachhold
1290
  */
1291
  function Enable() {
1292
- if(!isset($GLOBALS["sm_instance"])) {
1293
  $GLOBALS["sm_instance"]=new GoogleSitemapGenerator();
1294
  }
1295
  }
@@ -1306,7 +1309,6 @@ class GoogleSitemapGenerator {
1306
  $this->Initate();
1307
  //Build one time per post and if not importing.
1308
  if($this->GetOption("b_auto_enabled")===true && $this->_lastPostID != $postID && (!defined('WP_IMPORTING') || WP_IMPORTING != true)) {
1309
- $this->_lastPostID = $postID;
1310
 
1311
  //Build the sitemap directly or schedule it with WP cron
1312
  if($this->GetOption("b_auto_delay")==true) {
@@ -1314,12 +1316,16 @@ class GoogleSitemapGenerator {
1314
  //Schedule in 15 seconds, this should be enough to catch all changes.
1315
  //Clear all other existing hooks, so the sitemap is only built once.
1316
  wp_clear_scheduled_hook('sm_build_cron');
1317
- wp_schedule_single_event(time()+15,'sm_build_cron');
1318
  $this->_isScheduled = true;
1319
  }
1320
  } else {
1321
- $this->BuildSitemap();
 
 
 
1322
  }
 
1323
  }
1324
  }
1325
 
@@ -1334,10 +1340,10 @@ class GoogleSitemapGenerator {
1334
  if(!empty($_GET["sm_command"]) && !empty($_GET["sm_key"])) {
1335
  $this->Initate();
1336
  if($this->GetOption("b_manual_enabled")===true && $_GET["sm_command"]=="build" && $_GET["sm_key"]==$this->GetOption("b_manual_key")) {
1337
- $this->BuildSitemap();
1338
  echo "DONE";
1339
  exit;
1340
- }
1341
  }
1342
  }
1343
 
@@ -1362,7 +1368,7 @@ class GoogleSitemapGenerator {
1362
 
1363
  if(!$this->GetOption("b_prio_provider")) {
1364
  if(!in_array($this->GetOption("b_prio_provider"),$this->_prioProviders,true)) {
1365
- $this->SetOption("b_prio_provider","");
1366
  }
1367
  }
1368
  }
@@ -1378,9 +1384,9 @@ class GoogleSitemapGenerator {
1378
  array_push($providers,"GoogleSitemapGeneratorPrioByCountProvider");
1379
  array_push($providers,"GoogleSitemapGeneratorPrioByAverageProvider");
1380
  if(class_exists("ak_popularity_contest")) {
1381
- array_push($providers,"GoogleSitemapGeneratorPrioByPopularityContestProvider");
1382
  }
1383
- return $providers;
1384
  }
1385
 
1386
  /**
@@ -1408,7 +1414,7 @@ class GoogleSitemapGenerator {
1408
  $this->_pages=$storedpages;
1409
  } else {
1410
  $this->_pages=array();
1411
- }
1412
 
1413
  if($needsUpdate) $this->SavePages();
1414
  }
@@ -1462,7 +1468,7 @@ class GoogleSitemapGenerator {
1462
  * @return The URL to the gzipped Sitemap file
1463
  */
1464
  function GetZipUrl($forceAuto=false) {
1465
- return $this->GetXmlUrl($forceAuto) . ".gz";
1466
  }
1467
 
1468
  /**
@@ -1474,9 +1480,9 @@ class GoogleSitemapGenerator {
1474
  * @param bool $forceAuto Force the return value to the autodetected value.
1475
  * @return The file system path;
1476
  */
1477
- function GetXmlPath($forceAuto=false) {
1478
  if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") {
1479
- return $this->GetOption("b_filename_manual");
1480
  } else {
1481
  return $this->GetHomePath() . $this->GetOption("b_filename");
1482
  }
@@ -1492,7 +1498,7 @@ class GoogleSitemapGenerator {
1492
  * @return The file system path;
1493
  */
1494
  function GetZipPath($forceAuto=false) {
1495
- return $this->GetXmlPath($forceAuto) . ".gz";
1496
  }
1497
 
1498
  /**
@@ -1521,7 +1527,7 @@ class GoogleSitemapGenerator {
1521
  function GetOption($key) {
1522
  if(strpos($key,"sm_")!==0) $key="sm_" . $key;
1523
  if(array_key_exists($key,$this->_options)) {
1524
- return $this->_options[$key];
1525
  } else return null;
1526
  }
1527
 
@@ -1537,7 +1543,7 @@ class GoogleSitemapGenerator {
1537
  function SetOption($key,$value) {
1538
  if(strstr($key,"sm_")!==0) $key="sm_" . $key;
1539
 
1540
- $this->_options[$key]=$value;
1541
  }
1542
 
1543
  /**
@@ -1551,8 +1557,8 @@ class GoogleSitemapGenerator {
1551
  function SaveOptions() {
1552
  $oldvalue = get_option("sm_options");
1553
  if($oldvalue == $this->_options) {
1554
- return true;
1555
- } else return update_option("sm_options",$this->_options);
1556
  }
1557
 
1558
  /**
@@ -1573,26 +1579,26 @@ class GoogleSitemapGenerator {
1573
  if($commentRes) {
1574
  foreach($commentRes as $comment) {
1575
  $comments[$comment->post_id]=$comment->comment_count;
1576
- }
1577
  }
1578
  return $comments;
1579
  }
1580
 
1581
  /**
1582
  * Calculates the full number of comments from an sm_getComments() generated array
1583
- *
1584
  * @since 3.0
1585
  * @access private
1586
- * @author Arne Brachhold
1587
  * @param $comments array The Array with posts and c0mment count
1588
  * @see sm_getComments
1589
  * @return The full number of comments
1590
- */
1591
  function GetCommentCount($comments) {
1592
  $commentCount=0;
1593
  foreach($comments AS $k=>$v) {
1594
- $commentCount+=$v;
1595
- }
1596
  return $commentCount;
1597
  }
1598
 
@@ -1601,7 +1607,7 @@ class GoogleSitemapGenerator {
1601
  *
1602
  * @since 3.0
1603
  * @access public
1604
- * @author Arne Brachhold
1605
  * @param $loc string The location (url) of the page
1606
  * @param $lastMod int The last Modification time as a UNIX timestamp
1607
  * @param $changeFreq string The change frequenty of the page, Valid values are "always", "hourly", "daily", "weekly", "monthly", "yearly" and "never".
@@ -1617,7 +1623,7 @@ class GoogleSitemapGenerator {
1617
 
1618
  /**
1619
  * Adds an element to the sitemap
1620
- *
1621
  * @since 3.0
1622
  * @access private
1623
  * @author Arne Brachhold
@@ -1639,13 +1645,13 @@ class GoogleSitemapGenerator {
1639
 
1640
  /**
1641
  * Checks if a file is writable and tries to make it if not.
1642
- *
1643
  * @since 3.05b
1644
  * @access private
1645
  * @author VJTD3 <http://www.VJTD3.com>
1646
  * @return bool true if writable
1647
  */
1648
- function IsFileWritable($filename) {
1649
  //can we write?
1650
  if(!is_writable($filename)) {
1651
  //no we can't.
@@ -1658,7 +1664,7 @@ class GoogleSitemapGenerator {
1658
  //darn couldn't fix up parrent directory this hosting is foobar.
1659
  //Lets error because of the permissions problems.
1660
  return false;
1661
- }
1662
  }
1663
  }
1664
  }
@@ -1668,7 +1674,7 @@ class GoogleSitemapGenerator {
1668
 
1669
  /**
1670
  * Creates or opens the robots.txt in blog root and inserts the sitemap location
1671
- *
1672
  * @since 3.0b8
1673
  * @access private
1674
  * @author Arne Brachhold
@@ -1684,7 +1690,7 @@ class GoogleSitemapGenerator {
1684
 
1685
  $smUrl = $this->GetXmlUrl();
1686
  if($this->IsGzipEnabled()) {
1687
- $smUrl = $this->GetZipUrl();
1688
  }
1689
 
1690
  $new = "Sitemap: " . $smUrl;
@@ -1693,28 +1699,28 @@ class GoogleSitemapGenerator {
1693
  if($this->IsFileWritable($file)) return insert_with_markers($file,$marker,array($new));
1694
  else return false;
1695
  }
1696
- return true;
1697
  }
1698
 
1699
  /**
1700
  * Builds the sitemap and writes it into a xml file.
1701
- *
1702
  * @since 3.0
1703
  * @access public
1704
  * @author Arne Brachhold <himself [at] arnebrachhold [dot] de>
1705
  * @return array An array with messages such as failed writes etc.
1706
  */
1707
  function BuildSitemap() {
1708
- global $wpdb, $posts, $wp_version;
1709
  $this->Initate();
1710
 
1711
  if($this->GetOption("b_memory")!='') {
1712
- @ini_set("memory_limit",$this->GetOption("b_memory"));
1713
  }
1714
 
1715
  if($this->GetOption("sm_b_time")!=-1) {
1716
- @set_time_limit($this->GetOption("sm_b_time"));
1717
- }
1718
 
1719
  //This object saves the status information of the script directly to the database
1720
  $status = new GoogleSitemapGeneratorStatus();
@@ -1750,20 +1756,20 @@ class GoogleSitemapGenerator {
1750
  $this->_fileZipHandle = gzopen($fileName,"w1");
1751
  if(!$this->_fileZipHandle) $status->EndZip(false,"Not openable");
1752
 
1753
- } else $status->EndZip(false,"not writable");
1754
- }
1755
 
1756
  if(!$this->_fileHandle && !$this->_fileZipHandle) {
1757
  $status->End();
1758
  return;
1759
- }
1760
 
1761
 
1762
  //Content of the XML file
1763
  $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<?xml version="1.0" encoding="UTF-8"' . '?' . '>'));
1764
 
1765
  if($this->GetOption("b_style")!='') {
1766
- $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<' . '?xml-stylesheet type="text/xsl" href="' . $this->GetOption("b_style") . '"?' . '>'));
1767
  }
1768
 
1769
  $this->AddElement(new GoogleSitemapGeneratorDebugEntry("generator=\"wordpress/" . get_bloginfo('version') . "\""));
@@ -1777,7 +1783,7 @@ class GoogleSitemapGenerator {
1777
  $commentCount=(count($comments)>0?$this->GetCommentCount($comments):0);
1778
 
1779
  if($debug && $this->GetOption("b_prio_provider")!="") {
1780
- $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Total comment count: " . $commentCount));
1781
  }
1782
 
1783
  //Go XML!
@@ -1798,21 +1804,41 @@ class GoogleSitemapGenerator {
1798
  //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date
1799
  $wpCompat = (floatval($wp_version) < 2.1);
1800
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1801
  $postPageStmt = '';
1802
 
1803
  $inSubPages = ($this->GetOption('sm_in_posts_sub')===true);
1804
 
1805
  if($inSubPages && $this->GetOption('in_posts')===true) {
1806
  $pageDivider='<!--nextpage-->';
1807
- $postPageStmt = ", (character_length(`post_content`) - character_length(REPLACE(`post_content`, '$pageDivider', ''))) / " . strlen($pageDivider) . " as postPages";
1808
  }
1809
 
1810
- $sql="SELECT `ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` $postPageStmt FROM `" . $wpdb->posts . "` WHERE ";
1811
 
1812
  $where = '(';
1813
 
1814
  if($this->GetOption('in_posts')) {
1815
- //WP < 2.1: posts are post_status = publish
1816
  //WP >= 2.1: post_type must be 'post', no date check required because future posts are post_status='future'
1817
  if($wpCompat) $where.="(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')";
1818
  else $where.=" (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) ";
@@ -1820,23 +1846,22 @@ class GoogleSitemapGenerator {
1820
 
1821
  if($this->GetOption('in_pages')) {
1822
  if($this->GetOption('in_posts')) {
1823
- $where.=" OR ";
1824
  }
1825
  if($wpCompat) {
1826
  //WP < 2.1: posts have post_status = published, pages have post_status = static
1827
  $where.=" post_status='static' ";
1828
  } else {
1829
- //WP >= 2.1: posts have post_type = 'post' and pages have post_type = 'page'. Both must be published.
1830
  $where.=" (post_status = 'publish' AND post_type = 'page') ";
1831
  }
1832
  }
1833
 
1834
  $where.=") ";
1835
 
1836
- $excludes = $this->GetOption('b_exclude');
1837
 
1838
  if(is_array($excludes) && count($excludes)>0) {
1839
- $where.=" AND ID NOT IN ('" . implode("','",$excludes) . "')";
1840
  }
1841
 
1842
  $where.=" AND post_password='' ORDER BY post_modified DESC";
@@ -1844,8 +1869,8 @@ class GoogleSitemapGenerator {
1844
  $sql .= $where;
1845
 
1846
  if($this->GetOption("sm_b_max_posts")>0) {
1847
- $sql.=" LIMIT 0," . $this->GetOption("sm_b_max_posts");
1848
- }
1849
 
1850
  $postCount = intval($wpdb->get_var("SELECT COUNT(*) AS cnt FROM `" . $wpdb->posts . "` WHERE ". $where,0,0));
1851
 
@@ -1853,10 +1878,10 @@ class GoogleSitemapGenerator {
1853
  //Safe Mode for other plugins which use mysql_query() without a connection handler and will destroy our resultset :(
1854
  $con = $postRes = null;
1855
  if($this->GetOption("b_safemode")===true) {
1856
- $postRes = mysql_query($sql,$wpdb->dbh);
1857
  if(!$postRes) {
1858
  trigger_error("MySQL query failed: " . mysql_error(),E_USER_NOTICE); //E_NOTE will be displayed on our debug mode
1859
- return;
1860
  }
1861
  } else {
1862
  $con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD,true);
@@ -1872,7 +1897,7 @@ class GoogleSitemapGenerator {
1872
 
1873
  if(!$postRes) {
1874
  trigger_error("MySQL unbuffered query failed: " . mysql_error(),E_USER_NOTICE);
1875
- return;
1876
  }
1877
  }
1878
 
@@ -1888,7 +1913,7 @@ class GoogleSitemapGenerator {
1888
 
1889
  //$posts is used by Alex King's Popularity Contest plugin
1890
  //if($posts == null || !is_array($posts)) {
1891
- // $posts = &$postRes;
1892
  //}
1893
 
1894
  $z = 1;
@@ -1904,7 +1929,6 @@ class GoogleSitemapGenerator {
1904
 
1905
  $minPrio=$this->GetOption('pr_posts_min');
1906
 
1907
- $useQTransLate = false; //function_exists('qtrans_convertURL'); Not ready yet
1908
 
1909
  //Cycle through all posts and add them
1910
  while($post = mysql_fetch_object($postRes)) {
@@ -1920,7 +1944,7 @@ class GoogleSitemapGenerator {
1920
  if($wpCompat) {
1921
  $isPage = ($post->post_status == 'static');
1922
  } else {
1923
- $isPage = ($post->post_type == 'page');
1924
  }
1925
 
1926
  //Set the current working post
@@ -1945,7 +1969,7 @@ class GoogleSitemapGenerator {
1945
  $prio = $prioProvider->GetPostPriority($post->ID,$cmtcnt);
1946
 
1947
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry('Debug: Priority report of postID ' . $post->ID . ': Comments: ' . $cmtcnt . ' of ' . $commentCount . ' = ' . $prio . ' points'));
1948
- }
1949
 
1950
  if(!$isPage && $minPrio>0 && $prio<$minPrio) {
1951
  $prio = $minPrio;
@@ -1961,30 +1985,29 @@ class GoogleSitemapGenerator {
1961
  $subPage = $permalink . '&amp;page=' . $p;
1962
  } else {
1963
  $subPage = trailingslashit($permalink) . user_trailingslashit($p, 'single_paged');
1964
- }
1965
 
1966
  $this->AddUrl($subPage,$this->GetTimestampFromMySql(($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
1967
  }
1968
  }
1969
 
1970
-
1971
- // Multilingual Support with qTranslate, thanks to Qian Qin
1972
- if($useQTransLate) {
1973
- global $q_config;
1974
- foreach($q_config['enabled_languages'] as $language) {
1975
- if($language != $q_config['default_language']) {
1976
- $this->AddUrl(qtrans_convertURL($permalink,$language),$this->GetTimestampFromMySql(($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
1977
- }
1978
- }
1979
- }
1980
  }
1981
 
1982
- //Update the status every 100 posts and at the end.
1983
- //If the script breaks because of memory or time limit,
1984
  //we have a "last reponded" value which can be compared to the server settings
1985
  if($zz==100 || $z == $postCount) {
1986
  $status->SaveStep($z);
1987
- $zz=0;
1988
  } else $zz++;
1989
 
1990
  $z++;
@@ -1992,7 +2015,7 @@ class GoogleSitemapGenerator {
1992
  //Clean cache because it's incomplete
1993
  if(version_compare($wp_version,"2.5",">=")) {
1994
  //WP 2.5 makes a mysql query for every clean_post_cache to clear the child cache
1995
- //so I've vopied the function here until a patch arrives...
1996
  wp_cache_delete($post->ID, 'posts');
1997
  wp_cache_delete($post->ID, 'post_meta');
1998
  clean_object_term_cache($post->ID, 'post');
@@ -2015,10 +2038,10 @@ class GoogleSitemapGenerator {
2015
  if(!$this->IsTaxonomySupported()) {
2016
 
2017
  $catsRes=$wpdb->get_results("
2018
- SELECT
2019
- c.cat_ID AS ID,
2020
- MAX(p.post_modified_gmt) AS last_mod
2021
- FROM
2022
  `" . $wpdb->categories . "` c,
2023
  `" . $wpdb->post2cat . "` pc,
2024
  `" . $wpdb->posts . "` p
@@ -2029,24 +2052,24 @@ class GoogleSitemapGenerator {
2029
  AND p.post_type='post'
2030
  GROUP
2031
  BY c.cat_id
2032
- ");
2033
  if($catsRes) {
2034
  foreach($catsRes as $cat) {
2035
  if($cat && $cat->ID && $cat->ID>0) {
2036
- if($debug) if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Cat-ID:" . $cat->ID));
2037
  $this->AddUrl(get_category_link($cat->ID),$this->GetTimestampFromMySql($cat->last_mod),$this->GetOption("cf_cats"),$this->GetOption("pr_cats"));
2038
  }
2039
- }
2040
  }
2041
  } else {
2042
  $cats = get_terms("category",array("hide_empty"=>true,"hierarchical"=>false));
2043
  if($cats && is_array($cats) && count($cats)>0) {
2044
  foreach($cats AS $cat) {
2045
- $this->AddUrl(get_category_link($cat->term_id),0,$this->GetOption("cf_cats"),$this->GetOption("pr_cats"));
2046
- }
2047
- }
2048
  }
2049
- if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Cats"));
2050
  }
2051
 
2052
  //Add the archives
@@ -2056,22 +2079,22 @@ class GoogleSitemapGenerator {
2056
 
2057
  //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
2058
  $arcresults = $wpdb->get_results("
2059
- SELECT DISTINCT
2060
- YEAR(post_date_gmt) AS `year`,
2061
- MONTH(post_date_gmt) AS `month`,
2062
- MAX(post_date_gmt) as last_mod,
2063
- count(ID) as posts
2064
- FROM
2065
- $wpdb->posts
2066
- WHERE
2067
- post_date < '$now'
2068
- AND post_status = 'publish'
2069
  AND post_type = 'post'
2070
  " . (floatval($wp_version) < 2.1?"AND {$wpdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
2071
- GROUP BY
2072
- YEAR(post_date_gmt),
2073
- MONTH(post_date_gmt)
2074
- ORDER BY
2075
  post_date_gmt DESC");
2076
  if ($arcresults) {
2077
  foreach ($arcresults as $arcresult) {
@@ -2081,15 +2104,15 @@ class GoogleSitemapGenerator {
2081
 
2082
  //Archive is the current one
2083
  if($arcresult->month==date("n") && $arcresult->year==date("Y")) {
2084
- $changeFreq=$this->GetOption("cf_arch_curr");
2085
  } else { // Archive is older
2086
- $changeFreq=$this->GetOption("cf_arch_old");
2087
  }
2088
 
2089
- $this->AddUrl($url,$this->GetTimestampFromMySql($arcresult->last_mod),$changeFreq,$this->GetOption("pr_arch"));
2090
  }
2091
  }
2092
- if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Archive"));
2093
  }
2094
 
2095
  //Add the author pages
@@ -2098,50 +2121,50 @@ class GoogleSitemapGenerator {
2098
 
2099
  $linkFunc = null;
2100
 
2101
- //get_author_link is deprecated in WP 2.1, try to use get_author_posts_url first.
2102
  if(function_exists('get_author_posts_url')) {
2103
- $linkFunc = 'get_author_posts_url';
2104
  } else if(function_exists('get_author_link')) {
2105
- $linkFunc = 'get_author_link';
2106
- }
2107
 
2108
  //Who knows what happens in later WP versions, so check again if it worked
2109
  if($linkFunc !== null) {
2110
  //Unfortunately there is no API function to get all authors, so we have to do it the dirty way...
2111
  //We retrieve only users with published and not password protected posts (and not pages)
2112
  //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
2113
- $sql = "SELECT DISTINCT
2114
- {$wpdb->users}.ID,
2115
- {$wpdb->users}.user_nicename,
2116
- MAX({$wpdb->posts}.post_modified_gmt) AS last_post
2117
- FROM
2118
- {$wpdb->users},
2119
- {$wpdb->posts}
2120
- WHERE
2121
- {$wpdb->posts}.post_author = {$wpdb->users}.ID
2122
  AND {$wpdb->posts}.post_status = 'publish'
2123
- AND {$wpdb->posts}.post_type = 'post'
2124
- AND {$wpdb->posts}.post_password = ''
2125
  " . (floatval($wp_version) < 2.1?"AND {$wpdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
2126
- GROUP BY
2127
- {$wpdb->users}.ID,
2128
  {$wpdb->users}.user_nicename";
2129
 
2130
  $authors = $wpdb->get_results($sql);
2131
 
2132
  if($authors && is_array($authors)) {
2133
  foreach($authors as $author) {
2134
- if($debug) if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Author-ID:" . $author->ID));
2135
  $url = ($linkFunc=='get_author_posts_url'?get_author_posts_url($author->ID,$author->user_nicename):get_author_link(false,$author->ID,$author->user_nicename));
2136
  $this->AddUrl($url,$this->GetTimestampFromMySql($author->last_post),$this->GetOption("cf_auth"),$this->GetOption("pr_auth"));
2137
  }
2138
  }
2139
  } else {
2140
  //Too bad, no author pages for you :(
2141
- if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: No valid author link function found"));
2142
  }
2143
 
2144
- if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Author pages"));
2145
  }
2146
 
2147
  //Add tag pages
@@ -2150,10 +2173,10 @@ class GoogleSitemapGenerator {
2150
  $tags = get_terms("post_tag",array("hide_empty"=>true,"hierarchical"=>false));
2151
  if($tags && is_array($tags) && count($tags)>0) {
2152
  foreach($tags AS $tag) {
2153
- $this->AddUrl(get_tag_link($tag->term_id),0,$this->GetOption("cf_tags"),$this->GetOption("pr_tags"));
2154
- }
2155
- }
2156
- if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags"));
2157
  }
2158
 
2159
  //Add the custom pages
@@ -2162,7 +2185,7 @@ class GoogleSitemapGenerator {
2162
  //#type $page GoogleSitemapGeneratorPage
2163
  foreach($this->_pages AS $page) {
2164
  $this->AddUrl($page->GetUrl(),$page->getLastMod(),$page->getChangeFreq(),$page->getPriority());
2165
- }
2166
  }
2167
 
2168
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Custom Pages"));
@@ -2205,7 +2228,7 @@ class GoogleSitemapGenerator {
2205
  } else {
2206
  $status->EndGooglePing(true);
2207
  }
2208
- }
2209
 
2210
  //Ping Ask.com
2211
  if($this->GetOption("b_pingask") && !empty($pingUrl)) {
@@ -2230,8 +2253,8 @@ class GoogleSitemapGenerator {
2230
  $status->EndYahooPing(false,$this->_lastError);
2231
  } else {
2232
  $status->EndYahooPing(true);
2233
- }
2234
- }
2235
 
2236
  //Ping MSN
2237
  if($this->GetOption("b_pingmsn") && !empty($pingUrl)) {
@@ -2239,17 +2262,17 @@ class GoogleSitemapGenerator {
2239
  $status->StartMsnPing($sPingUrl);
2240
  $pingres=$this->RemoteOpen($sPingUrl);
2241
 
2242
- if($pingres==NULL || $pingres===false || strpos($pingres,"Thanks for submitting your sitemap")===false) {
2243
  $status->EndMsnPing(false,$this->_lastError);
2244
  } else {
2245
  $status->EndMsnPing(true);
2246
  }
2247
  }
2248
 
2249
- $status->End();
2250
 
2251
 
2252
- $this->_isActive = false;
2253
 
2254
  //done...
2255
  return $status;
@@ -2262,13 +2285,13 @@ class GoogleSitemapGenerator {
2262
  require_once( ABSPATH . 'wp-includes/class-snoopy.php');
2263
 
2264
  $s = new Snoopy();
2265
- $s->fetch($url);
2266
 
2267
  if($s->status == 200) {
2268
- $res = $s->results;
2269
  }
2270
  } else {
2271
- $res = wp_remote_fopen($url);
2272
  }
2273
  return $res;
2274
  }
@@ -2281,22 +2304,22 @@ class GoogleSitemapGenerator {
2281
  * @author Arne Brachhold
2282
  */
2283
  function TrackError($log_level, $log_text, $error_file, $error_line) {
2284
- $this->_lastError = $log_text;
2285
  }
2286
 
2287
  /**
2288
  * Echos option fields for an select field containing the valid change frequencies
2289
- *
2290
  * @since 3.0
2291
  * @access private
2292
  * @author Arne Brachhold
2293
  * @param $currentVal The value which should be selected
2294
- * @return all valid change frequencies as html option fields
2295
  */
2296
  function HtmlGetFreqNames($currentVal) {
2297
 
2298
  foreach($this->_freqNames AS $k=>$v) {
2299
- echo "<option value=\"$k\" " . $this->HtmlGetSelected($k,$currentVal) .">" . $v . "</option>";
2300
  }
2301
  }
2302
 
@@ -2307,15 +2330,15 @@ class GoogleSitemapGenerator {
2307
  * @access private
2308
  * @author Arne Brachhold
2309
  * @param $currentVal string The value which should be selected
2310
- * @return 0.0 - 1.0 as html option fields
2311
  */
2312
  function HtmlGetPriorityValues($currentVal) {
2313
  $currentVal=(float) $currentVal;
2314
  for($i=0.0; $i<=1.0; $i+=0.1) {
2315
  echo "<option value=\"$i\" " . $this->HtmlGetSelected("$i","$currentVal") .">";
2316
  _e(strval($i));
2317
- echo "</option>";
2318
- }
2319
  }
2320
 
2321
  /**
@@ -2330,7 +2353,7 @@ class GoogleSitemapGenerator {
2330
  */
2331
  function HtmlGetChecked($val,$equals) {
2332
  if($val==$equals) return $this->HtmlGetAttribute("checked");
2333
- else return "";
2334
  }
2335
 
2336
  /**
@@ -2345,7 +2368,7 @@ class GoogleSitemapGenerator {
2345
  */
2346
  function HtmlGetSelected($val,$equals) {
2347
  if($val==$equals) return $this->HtmlGetAttribute("selected");
2348
- else return "";
2349
  }
2350
 
2351
  /**
@@ -2360,7 +2383,7 @@ class GoogleSitemapGenerator {
2360
  */
2361
  function HtmlGetAttribute($attr,$value=NULL) {
2362
  if($value==NULL) $value=$attr;
2363
- return " " . $attr . "=\"" . $value . "\" ";
2364
  }
2365
 
2366
  /**
@@ -2404,8 +2427,8 @@ class GoogleSitemapGenerator {
2404
 
2405
  //Add it to the array
2406
  array_push($pages,$p);
2407
- }
2408
- }
2409
  return $pages;
2410
  }
2411
 
@@ -2430,20 +2453,58 @@ class GoogleSitemapGenerator {
2430
  if(isset($_GET['page']) && !empty($_GET['page'])) {
2431
  $page = preg_replace('[^a-zA-Z0-9\.\_\-]','',$_GET['page']);
2432
  }
2433
- return $_SERVER['PHP_SELF'] . "?page=" . $page;
 
 
 
 
 
 
 
 
 
 
2434
  }
2435
 
2436
  function HtmlShowOptionsPage() {
2437
- if(!class_exists("GoogleSitemapGeneratorUI")) {
2438
-
2439
- $path = trailingslashit(dirname(__FILE__));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2440
 
2441
- if(!file_exists( $path . 'sitemap-ui.php')) return false;
2442
- require_once($path. 'sitemap-ui.php');
2443
- }
2444
 
2445
- $ui = new GoogleSitemapGeneratorUI($this);
2446
- $ui->HtmlShowOptionsPage();
2447
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2448
  }
2449
  }
1
+ <?php
2
  /*
3
 
4
+ $Id: sitemap-core.php 81061 2008-12-19 03:19:01Z arnee $
5
 
6
  */
7
 
9
  //error_reporting(E_ALL);
10
  //ini_set("display_errors",1);
11
 
 
12
  #region PHP5 compat functions
13
  if (!function_exists('file_get_contents')) {
14
  /**
40
 
41
  fclose($fh);
42
  return $data;
43
+ }
44
  }
45
 
46
 
150
  }
151
 
152
  function Save() {
153
+ update_option("sm_status",$this);
154
  }
155
 
156
  function Load() {
157
  $status = @get_option("sm_status");
158
  if(is_a($status,"GoogleSitemapGeneratorStatus")) return $status;
159
+ else return null;
160
  }
161
 
162
  /**
181
  * @var int $_memoryUsage The amount of memory used in bytes
182
  * @access private
183
  */
184
+ var $_memoryUsage = 0;
185
 
186
  /**
187
  * @var int $_lastPost The number of posts processed. This value is updated every 50 posts.
210
  $this->_memoryUsage = memory_get_peak_usage(true);
211
  } else if(function_exists("memory_get_usage")) {
212
  $this->_memoryUsage = memory_get_usage(true);
213
+ }
214
  }
215
 
216
  function GetMemoryUsage() {
217
+ return round($this->_memoryUsage / 1024 / 1024,2);
218
  }
219
 
220
  function SaveStep($postCount) {
222
  $this->_lastPost = $postCount;
223
  $this->_lastTime = $this->GetMicrotimeFloat();
224
 
225
+ $this->Save();
226
  }
227
 
228
  function GetTime() {
229
+ return round($this->_endTime - $this->_startTime,2);
230
  }
231
 
232
  function GetStartTime() {
233
+ return round($this->_startTime, 2);
234
  }
235
 
236
  function GetLastTime() {
237
+ return round($this->_lastTime - $this->_startTime,2);
238
  }
239
 
240
  function GetLastPost() {
241
+ return $this->_lastPost;
242
  }
243
 
244
  var $_usedXml = false;
251
  $this->_xmlPath = $path;
252
  $this->_xmlUrl = $url;
253
 
254
+ $this->Save();
255
  }
256
 
257
  function EndXml($success) {
258
+ $this->_xmlSuccess = $success;
259
 
260
  $this->Save();
261
  }
269
  function StartZip($path,$url) {
270
  $this->_usedZip = true;
271
  $this->_zipPath = $path;
272
+ $this->_zipUrl = $url;
273
 
274
  $this->Save();
275
  }
277
  function EndZip($success) {
278
  $this->_zipSuccess = $success;
279
 
280
+ $this->Save();
281
  }
282
 
283
  var $_usedGoogle = false;
289
  function StartGooglePing($url) {
290
  $this->_googleUrl = true;
291
  $this->_usedGoogle = true;
292
+ $this->_googleStartTime = $this->GetMicrotimeFloat();
293
 
294
  $this->Save();
295
  }
296
 
297
  function EndGooglePing($success) {
298
  $this->_googleEndTime = $this->GetMicrotimeFloat();
299
+ $this->_gooogleSuccess = $success;
300
 
301
+ $this->Save();
302
  }
303
 
304
  function GetGoogleTime() {
305
+ return round($this->_googleEndTime - $this->_googleStartTime,2);
306
  }
307
 
308
  var $_usedYahoo = false;
316
  $this->_usedYahoo = true;
317
  $this->_yahooStartTime = $this->GetMicrotimeFloat();
318
 
319
+ $this->Save();
320
  }
321
 
322
  function EndYahooPing($success) {
323
  $this->_yahooEndTime = $this->GetMicrotimeFloat();
324
+ $this->_yahooSuccess = $success;
325
 
326
+ $this->Save();
327
  }
328
 
329
  function GetYahooTime() {
330
+ return round($this->_yahooEndTime - $this->_yahooStartTime,2);
331
  }
332
 
333
  var $_usedAsk = false;
341
  $this->_askUrl = $url;
342
  $this->_askStartTime = $this->GetMicrotimeFloat();
343
 
344
+ $this->Save();
345
  }
346
 
347
  function EndAskPing($success) {
348
  $this->_askEndTime = $this->GetMicrotimeFloat();
349
+ $this->_askSuccess = $success;
350
 
351
+ $this->Save();
352
  }
353
 
354
  function GetAskTime() {
355
+ return round($this->_askEndTime - $this->_askStartTime,2);
356
  }
357
 
358
  var $_usedMsn = false;
366
  $this->_msnUrl = $url;
367
  $this->_msnStartTime = $this->GetMicrotimeFloat();
368
 
369
+ $this->Save();
370
  }
371
 
372
  function EndMsnPing($success) {
373
  $this->_msnEndTime = $this->GetMicrotimeFloat();
374
+ $this->_msnSuccess = $success;
375
 
376
+ $this->Save();
377
  }
378
 
379
  function GetMsnTime() {
380
+ return round($this->_msnEndTime - $this->_msnStartTime,2);
381
  }
382
 
383
  function GetMicrotimeFloat() {
413
  var $_changeFreq;
414
 
415
  /**
416
+ * @var int $_lastMod Sets the lastMod date as a UNIX timestamp.
417
  * @access private
418
  */
419
+ var $_lastMod;
420
 
421
  /**
422
  * Initialize a new page object
423
+ *
424
  * @since 3.0
425
  * @access public
426
  * @author Arne Brachhold
443
  * @return string The URL
444
  */
445
  function GetUrl() {
446
+ return $this->_url;
447
  }
448
 
449
  /**
452
  * @param string $url The new URL
453
  */
454
  function SetUrl($url) {
455
+ $this->_url=(string) $url;
456
  }
457
 
458
  /**
461
  * @return float the priority, from 0.0 to 1.0
462
  */
463
  function GetPriority() {
464
+ return $this->_priority;
465
  }
466
 
467
  /**
470
  * @param float $priority The new priority from 0.1 to 1.0
471
  */
472
  function SetProprity($priority) {
473
+ $this->_priority=floatval($priority);
474
  }
475
 
476
  /**
479
  * @return string The change frequncy like hourly, weekly, monthly etc.
480
  */
481
  function GetChangeFreq() {
482
+ return $this->_changeFreq;
483
  }
484
 
485
  /**
488
  * @param string $changeFreq The new change frequency
489
  */
490
  function SetChangeFreq($changeFreq) {
491
+ $this->_changeFreq=(string) $changeFreq;
492
  }
493
 
494
  /**
497
  * @return int The lastmod value in seconds
498
  */
499
  function GetLastMod() {
500
+ return $this->_lastMod;
501
  }
502
 
503
  /**
507
  */
508
  function SetLastMod($lastMod) {
509
  $this->_lastMod=intval($lastMod);
510
+ }
511
 
512
  function Render() {
513
 
517
  $r.= "\t<url>\n";
518
  $r.= "\t\t<loc>" . $this->EscapeXML($this->_url) . "</loc>\n";
519
  if($this->_lastMod>0) $r.= "\t\t<lastmod>" . date('Y-m-d\TH:i:s+00:00',$this->_lastMod) . "</lastmod>\n";
520
+ if(!empty($this->_changeFreq)) $r.= "\t\t<changefreq>" . $this->_changeFreq . "</changefreq>\n";
521
  if($this->_priority!==false && $this->_priority!=="") $r.= "\t\t<priority>" . number_format($this->_priority,1) . "</priority>\n";
522
+ $r.= "\t</url>\n";
523
  return $r;
524
+ }
525
 
526
  function EscapeXML($string) {
527
  return str_replace ( array ( '&', '"', "'", '<', '>'), array ( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;'), $string);
528
+ }
529
  }
530
 
531
  class GoogleSitemapGeneratorXmlEntry {
533
  var $_xml;
534
 
535
  function GoogleSitemapGeneratorXmlEntry($xml) {
536
+ $this->_xml = $xml;
537
  }
538
 
539
  function Render() {
540
+ return $this->_xml;
541
+ }
542
  }
543
 
544
  class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {
545
 
546
  function Render() {
547
+ return "<!-- " . $this->_xml . " -->";
548
+ }
549
  }
550
 
551
  /**
553
  * @author Arne Brachhold
554
  * @package sitemap
555
  * @since 3.0
556
+ */
557
  class GoogleSitemapGeneratorPrioProviderBase {
558
 
559
  /**
589
  * @return string The translated description
590
  */
591
  function GetDescription() {
592
+ return "";
593
  }
594
 
595
  /**
596
  * Initializes a new priority provider
597
  *
598
  * @param $totalComments int The total number of comments of all posts
599
+ * @param $totalPosts int The total number of posts
600
  * @since 3.0
601
  * @access public
602
  * @author Arne Brachhold
605
  $this->_totalComments=$totalComments;
606
  $this->_totalPosts=$totalPosts;
607
 
608
+ }
609
 
610
  /**
611
  * Returns the priority for a specified post
619
  */
620
  function GetPostPriority($postID,$commentCount) {
621
  return 0;
622
+ }
623
  }
624
 
625
  /**
627
  * @author Arne Brachhold
628
  * @package sitemap
629
  * @since 3.0
630
+ */
631
  class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPrioProviderBase {
632
 
633
  /**
651
  * @return string The translated description
652
  */
653
  function GetDescription() {
654
+ return __("Uses the number of comments of the post to calculate the priority",'sitemap');
655
  }
656
 
657
  /**
658
  * Initializes a new priority provider which calculates the post priority based on the number of comments
659
  *
660
  * @param $totalComments int The total number of comments of all posts
661
+ * @param $totalPosts int The total number of posts
662
  * @since 3.0
663
  * @access public
664
  * @author Arne Brachhold
665
  */
666
  function GoogleSitemapGeneratorPrioByCountProvider($totalComments,$totalPosts) {
667
+ parent::GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts);
668
  }
669
 
670
  /**
680
  function GetPostPriority($postID,$commentCount) {
681
  $prio=0;
682
  if($this->_totalComments>0 && $commentCount>0) {
683
+ $prio = round(($commentCount*100/$this->_totalComments)/100,1);
684
  } else {
685
+ $prio = 0;
686
  }
687
  return $prio;
688
+ }
689
  }
690
 
691
  /**
693
  * @author Arne Brachhold
694
  * @package sitemap
695
  * @since 3.0
696
+ */
697
  class GoogleSitemapGeneratorPrioByAverageProvider extends GoogleSitemapGeneratorPrioProviderBase {
698
 
699
  /**
723
  * @return string The translated description
724
  */
725
  function GetDescription() {
726
+ return __("Uses the average comment count to calculate the priority",'sitemap');
727
  }
728
 
729
  /**
730
  * Initializes a new priority provider which calculates the post priority based on the average number of comments
731
  *
732
  * @param $totalComments int The total number of comments of all posts
733
+ * @param $totalPosts int The total number of posts
734
  * @since 3.0
735
  * @access public
736
  * @author Arne Brachhold
757
  $prio = 0;
758
  //Do not divide by zero!
759
  if($this->_average==0) {
760
+ if($commentCount>0) $prio = 1;
761
  else $prio = 0;
762
  } else {
763
+ $prio = $commentCount/$this->_average;
764
  if($prio>1) $prio = 1;
765
  else if($prio<0) $prio = 0;
766
  }
767
 
768
  return round($prio,1);
769
  }
770
+ }
771
 
772
  /**
773
  * Priority Provider which calculates the priority based on the popularity by the PopularityContest Plugin
774
  * @author Arne Brachhold
775
  * @package sitemap
776
  * @since 3.0
777
+ */
778
  class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitemapGeneratorPrioProviderBase {
779
 
780
  /**
786
  * @return string The translated name
787
  */
788
  function GetName() {
789
+ return __("Popularity Contest",'sitemap');
790
  }
791
 
792
  /**
805
  * Initializes a new priority provider which calculates the post priority based on the popularity by the PopularityContest Plugin
806
  *
807
  * @param $totalComments int The total number of comments of all posts
808
+ * @param $totalPosts int The total number of posts
809
  * @since 3.0
810
  * @access public
811
  * @author Arne Brachhold
843
  preg_match("/([0-9]{1,3})\%/si",$popresult,$matches);
844
  if(!empty($matches) && is_array($matches) && count($matches)==2) {
845
  //Divide it so 100% = 1, 10% = 0.1
846
+ $res=round(intval($matches[1])/100,1);
847
  }
848
  }
849
  }
850
  }
851
  return $res;
852
+ }
853
  }
854
 
855
  /**
856
  * Class to generate a sitemaps.org Sitemaps compliant sitemap of a WordPress blog.
857
+ *
858
  * @package sitemap
859
  * @author Arne Brachhold
860
  * @since 3.0
861
  */
862
+ class GoogleSitemapGenerator {
863
  /**
864
  * @var Version of the generator in SVN
865
  */
866
+ var $_svnVersion = '$Id: sitemap-core.php 81061 2008-12-19 03:19:01Z arnee $';
867
 
868
  /**
869
  * @var array The unserialized array with the stored options
892
 
893
  /**
894
  * @var string Holds the last error if one occurs when writing the files
895
+ */
896
  var $_lastError=null;
897
 
898
  /**
899
  * @var int The last handled post ID
900
+ */
901
  var $_lastPostID = 0;
902
 
903
  /**
904
  * @var bool Defines if the sitemap building process is active at the moment
905
+ */
906
  var $_isActive = false;
907
 
908
  /**
909
  * @var bool Defines if the sitemap building process has been scheduled via Wp cron
910
+ */
911
  var $_isScheduled = false;
912
 
913
  /**
914
  * @var object The file handle which is used to write the sitemap file
915
+ */
916
  var $_fileHandle = null;
917
 
918
  /**
919
  * @var object The file handle which is used to write the zipped sitemap file
920
+ */
921
  var $_fileZipHandle = null;
922
 
923
  /**
924
  * Returns the path to the blog directory
925
+ *
926
  * @since 3.0
927
  * @access private
928
  * @author Arne Brachhold
933
  $res="";
934
  //Check if we are in the admin area -> get_home_path() is avaiable
935
  if(function_exists("get_home_path")) {
936
+ $res = get_home_path();
937
  } else {
938
  //get_home_path() is not available, but we can't include the admin
939
  //libraries because many plugins check for the "check_admin_referer"
974
  * @return string The URL to the plugin directory
975
  */
976
  function GetPluginUrl() {
977
+
978
+ if (function_exists('plugins_url')) return trailingslashit(plugins_url(basename(dirname(__FILE__))));
979
+
980
  $path = dirname(__FILE__);
981
  $path = str_replace("\\","/",$path);
982
  $path = trailingslashit(get_bloginfo('wpurl')) . trailingslashit(substr($path,strpos($path,"wp-content/")));
983
  return $path;
984
+ }
985
 
986
  /**
987
  * Returns the URL to default XSLT style if it exists
993
  function GetDefaultStyle() {
994
  $p = $this->GetPluginPath();
995
  if(file_exists($p . "sitemap.xsl")) {
996
+ return $this->GetPluginUrl() . 'sitemap.xsl';
997
  }
998
  return '';
999
  }
1000
 
1001
  /**
1002
  * Returns the path to the robots.txt file in the blog root
1003
+ *
1004
  * @since 3.0b8
1005
  * @access private
1006
  * @author Arne Brachhold
1007
  * @return The full path to the robots.txt file
1008
  */
1009
  function GetRobotsFilePath() {
1010
+ return trailingslashit($this->GetHomePath()) . 'robots.txt';
1011
  }
1012
 
1013
  /**
1014
  * Returns the URL to the robots.txt file in the blog root
1015
+ *
1016
  * @since 3.0b8
1017
  * @access private
1018
  * @author Arne Brachhold
1019
  * @return The full URL to the robots.txt file
1020
  */
1021
  function GetRobotsFileUrl() {
1022
+ return trailingslashit(get_bloginfo('siteurl')) . 'robots.txt';
1023
  }
1024
 
1025
  /**
1053
  $this->_options["sm_b_style"] = $this->GetDefaultStyle(); //Include a stylesheet in the XML
1054
  $this->_options["sm_b_robots"] = false; //Modify or create robots.txt file in blog root which contains the sitemap location
1055
  $this->_options["sm_b_exclude"] = array(); //List of post / page IDs to exclude
1056
+ $this->_options["sm_b_exclude_cats"] = array(); //List of post / page IDs to exclude
1057
  $this->_options["sm_b_location_mode"]="auto"; //Mode of location, auto or manual
1058
  $this->_options["sm_b_filename_manual"]=""; //Manuel filename
1059
  $this->_options["sm_b_fileurl_manual"]=""; //Manuel fileurl
1081
  $this->_options["sm_pr_posts_min"]=0.2; //Minimum Priority of posts, even if autocalc is enabled
1082
  $this->_options["sm_pr_pages"]=0.6; //Priority of static pages
1083
  $this->_options["sm_pr_cats"]=0.3; //Priority of categories
1084
+ $this->_options["sm_pr_arch"]=0.3; //Priority of archives
1085
  $this->_options["sm_pr_auth"]=0.3; //Priority of author pages
1086
+ $this->_options["sm_pr_tags"]=0.3; //Priority of tags
1087
 
1088
  $this->_options["sm_i_donated"]=false; //Did you donate? Thank you! :)
1089
  $this->_options["sm_i_hide_donated"]=false; //And hide the thank you..
1108
  $storedoptions=get_option("sm_options");
1109
  if($storedoptions && is_array($storedoptions)) {
1110
  foreach($storedoptions AS $k=>$v) {
1111
+ $this->_options[$k]=$v;
1112
  }
1113
  } else update_option("sm_options",$this->_options); //First time use, store default values
1114
  }
1179
 
1180
  $parents=$this->GetParentClasses($className);
1181
 
1182
+ return in_array($parentName,$parents);
1183
  }
1184
 
1185
  /**
1225
  $r = apply_filters("sm_add_prio_provider",$this->_prioProviders);
1226
 
1227
  //Check if no plugin return null
1228
+ if($r != null) $this->_prioProviders = $r;
1229
 
1230
  $this->ValidatePrioProviders();
1231
 
1238
  *
1239
  * @since 3.0
1240
  * @access public
1241
+ * @return GoogleSitemapGenerator The instance or null if not available.
1242
  * @author Arne Brachhold
1243
  */
1244
  function &GetInstance() {
1262
 
1263
  /**
1264
  * Returns if the compressed sitemap was activated
1265
+ *
1266
  * @since 3.0b8
1267
  * @access private
1268
  * @author Arne Brachhold
1274
 
1275
  /**
1276
  * Returns if this version of WordPress supports the new taxonomy system
1277
+ *
1278
  * @since 3.0b8
1279
  * @access private
1280
  * @author Arne Brachhold
1292
  * @author Arne Brachhold
1293
  */
1294
  function Enable() {
1295
+ if(!isset($GLOBALS["sm_instance"])) {
1296
  $GLOBALS["sm_instance"]=new GoogleSitemapGenerator();
1297
  }
1298
  }
1309
  $this->Initate();
1310
  //Build one time per post and if not importing.
1311
  if($this->GetOption("b_auto_enabled")===true && $this->_lastPostID != $postID && (!defined('WP_IMPORTING') || WP_IMPORTING != true)) {
 
1312
 
1313
  //Build the sitemap directly or schedule it with WP cron
1314
  if($this->GetOption("b_auto_delay")==true) {
1316
  //Schedule in 15 seconds, this should be enough to catch all changes.
1317
  //Clear all other existing hooks, so the sitemap is only built once.
1318
  wp_clear_scheduled_hook('sm_build_cron');
1319
+ wp_schedule_single_event(time()+15,'sm_build_cron');
1320
  $this->_isScheduled = true;
1321
  }
1322
  } else {
1323
+ //Build sitemap only once and never in bulk mode
1324
+ if(!$this->_lastPostID && (!isset($_GET["delete"]) || count((array) $_GET['delete'])<=0)) {
1325
+ $this->BuildSitemap();
1326
+ }
1327
  }
1328
+ $this->_lastPostID = $postID;
1329
  }
1330
  }
1331
 
1340
  if(!empty($_GET["sm_command"]) && !empty($_GET["sm_key"])) {
1341
  $this->Initate();
1342
  if($this->GetOption("b_manual_enabled")===true && $_GET["sm_command"]=="build" && $_GET["sm_key"]==$this->GetOption("b_manual_key")) {
1343
+ $this->BuildSitemap();
1344
  echo "DONE";
1345
  exit;
1346
+ }
1347
  }
1348
  }
1349
 
1368
 
1369
  if(!$this->GetOption("b_prio_provider")) {
1370
  if(!in_array($this->GetOption("b_prio_provider"),$this->_prioProviders,true)) {
1371
+ $this->SetOption("b_prio_provider","");
1372
  }
1373
  }
1374
  }
1384
  array_push($providers,"GoogleSitemapGeneratorPrioByCountProvider");
1385
  array_push($providers,"GoogleSitemapGeneratorPrioByAverageProvider");
1386
  if(class_exists("ak_popularity_contest")) {
1387
+ array_push($providers,"GoogleSitemapGeneratorPrioByPopularityContestProvider");
1388
  }
1389
+ return $providers;
1390
  }
1391
 
1392
  /**
1414
  $this->_pages=$storedpages;
1415
  } else {
1416
  $this->_pages=array();
1417
+ }
1418
 
1419
  if($needsUpdate) $this->SavePages();
1420
  }
1468
  * @return The URL to the gzipped Sitemap file
1469
  */
1470
  function GetZipUrl($forceAuto=false) {
1471
+ return $this->GetXmlUrl($forceAuto) . ".gz";
1472
  }
1473
 
1474
  /**
1480
  * @param bool $forceAuto Force the return value to the autodetected value.
1481
  * @return The file system path;
1482
  */
1483
+ function GetXmlPath($forceAuto=false) {
1484
  if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") {
1485
+ return $this->GetOption("b_filename_manual");
1486
  } else {
1487
  return $this->GetHomePath() . $this->GetOption("b_filename");
1488
  }
1498
  * @return The file system path;
1499
  */
1500
  function GetZipPath($forceAuto=false) {
1501
+ return $this->GetXmlPath($forceAuto) . ".gz";
1502
  }
1503
 
1504
  /**
1527
  function GetOption($key) {
1528
  if(strpos($key,"sm_")!==0) $key="sm_" . $key;
1529
  if(array_key_exists($key,$this->_options)) {
1530
+ return $this->_options[$key];
1531
  } else return null;
1532
  }
1533
 
1543
  function SetOption($key,$value) {
1544
  if(strstr($key,"sm_")!==0) $key="sm_" . $key;
1545
 
1546
+ $this->_options[$key]=$value;
1547
  }
1548
 
1549
  /**
1557
  function SaveOptions() {
1558
  $oldvalue = get_option("sm_options");
1559
  if($oldvalue == $this->_options) {
1560
+ return true;
1561
+ } else return update_option("sm_options",$this->_options);
1562
  }
1563
 
1564
  /**
1579
  if($commentRes) {
1580
  foreach($commentRes as $comment) {
1581
  $comments[$comment->post_id]=$comment->comment_count;
1582
+ }
1583
  }
1584
  return $comments;
1585
  }
1586
 
1587
  /**
1588
  * Calculates the full number of comments from an sm_getComments() generated array
1589
+ *
1590
  * @since 3.0
1591
  * @access private
1592
+ * @author Arne Brachhold
1593
  * @param $comments array The Array with posts and c0mment count
1594
  * @see sm_getComments
1595
  * @return The full number of comments
1596
+ */
1597
  function GetCommentCount($comments) {
1598
  $commentCount=0;
1599
  foreach($comments AS $k=>$v) {
1600
+ $commentCount+=$v;
1601
+ }
1602
  return $commentCount;
1603
  }
1604
 
1607
  *
1608
  * @since 3.0
1609
  * @access public
1610
+ * @author Arne Brachhold
1611
  * @param $loc string The location (url) of the page
1612
  * @param $lastMod int The last Modification time as a UNIX timestamp
1613
  * @param $changeFreq string The change frequenty of the page, Valid values are "always", "hourly", "daily", "weekly", "monthly", "yearly" and "never".
1623
 
1624
  /**
1625
  * Adds an element to the sitemap
1626
+ *
1627
  * @since 3.0
1628
  * @access private
1629
  * @author Arne Brachhold
1645
 
1646
  /**
1647
  * Checks if a file is writable and tries to make it if not.
1648
+ *
1649
  * @since 3.05b
1650
  * @access private
1651
  * @author VJTD3 <http://www.VJTD3.com>
1652
  * @return bool true if writable
1653
  */
1654
+ function IsFileWritable($filename) {
1655
  //can we write?
1656
  if(!is_writable($filename)) {
1657
  //no we can't.
1664
  //darn couldn't fix up parrent directory this hosting is foobar.
1665
  //Lets error because of the permissions problems.
1666
  return false;
1667
+ }
1668
  }
1669
  }
1670
  }
1674
 
1675
  /**
1676
  * Creates or opens the robots.txt in blog root and inserts the sitemap location
1677
+ *
1678
  * @since 3.0b8
1679
  * @access private
1680
  * @author Arne Brachhold
1690
 
1691
  $smUrl = $this->GetXmlUrl();
1692
  if($this->IsGzipEnabled()) {
1693
+ $smUrl = $this->GetZipUrl();
1694
  }
1695
 
1696
  $new = "Sitemap: " . $smUrl;
1699
  if($this->IsFileWritable($file)) return insert_with_markers($file,$marker,array($new));
1700
  else return false;
1701
  }
1702
+ return true;
1703
  }
1704
 
1705
  /**
1706
  * Builds the sitemap and writes it into a xml file.
1707
+ *
1708
  * @since 3.0
1709
  * @access public
1710
  * @author Arne Brachhold <himself [at] arnebrachhold [dot] de>
1711
  * @return array An array with messages such as failed writes etc.
1712
  */
1713
  function BuildSitemap() {
1714
+ global $wpdb, $posts, $wp_version;
1715
  $this->Initate();
1716
 
1717
  if($this->GetOption("b_memory")!='') {
1718
+ @ini_set("memory_limit",$this->GetOption("b_memory"));
1719
  }
1720
 
1721
  if($this->GetOption("sm_b_time")!=-1) {
1722
+ @set_time_limit($this->GetOption("sm_b_time"));
1723
+ }
1724
 
1725
  //This object saves the status information of the script directly to the database
1726
  $status = new GoogleSitemapGeneratorStatus();
1756
  $this->_fileZipHandle = gzopen($fileName,"w1");
1757
  if(!$this->_fileZipHandle) $status->EndZip(false,"Not openable");
1758
 
1759
+ } else $status->EndZip(false,"not writable");
1760
+ }
1761
 
1762
  if(!$this->_fileHandle && !$this->_fileZipHandle) {
1763
  $status->End();
1764
  return;
1765
+ }
1766
 
1767
 
1768
  //Content of the XML file
1769
  $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<?xml version="1.0" encoding="UTF-8"' . '?' . '>'));
1770
 
1771
  if($this->GetOption("b_style")!='') {
1772
+ $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<' . '?xml-stylesheet type="text/xsl" href="' . $this->GetOption("b_style") . '"?' . '>'));
1773
  }
1774
 
1775
  $this->AddElement(new GoogleSitemapGeneratorDebugEntry("generator=\"wordpress/" . get_bloginfo('version') . "\""));
1783
  $commentCount=(count($comments)>0?$this->GetCommentCount($comments):0);
1784
 
1785
  if($debug && $this->GetOption("b_prio_provider")!="") {
1786
+ $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Total comment count: " . $commentCount));
1787
  }
1788
 
1789
  //Go XML!
1804
  //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date
1805
  $wpCompat = (floatval($wp_version) < 2.1);
1806
 
1807
+ $excludes = $this->GetOption('b_exclude'); //Excluded posts
1808
+
1809
+ $exclCats = $this->GetOption("b_exclude_cats"); // Excluded cats
1810
+
1811
+ if($exclCats && count($exclCats)>0 && $this->IsTaxonomySupported()) {
1812
+
1813
+ $exPosts = get_objects_in_term($exclCats,"category"); // Get all posts in excl. cats
1814
+
1815
+ if(is_array($exPosts) && count($exPosts) > 0) { //Merge it with the list of user excluded posts
1816
+ $excludes = array_merge($excludes, $exPosts);
1817
+ }
1818
+ }
1819
+
1820
+ $useQTransLate = false; //function_exists('qtrans_convertURL') && function_exists('qtrans_getEnabledLanguages'); Not ready yet
1821
+
1822
+ $contentStmt = '';
1823
+ if($useQTransLate) {
1824
+ $contentStmt.=', post_content ';
1825
+ }
1826
+
1827
  $postPageStmt = '';
1828
 
1829
  $inSubPages = ($this->GetOption('sm_in_posts_sub')===true);
1830
 
1831
  if($inSubPages && $this->GetOption('in_posts')===true) {
1832
  $pageDivider='<!--nextpage-->';
1833
+ $postPageStmt = ", (character_length(`post_content`) - character_length(REPLACE(`post_content`, '$pageDivider', ''))) / " . strlen($pageDivider) . " as postPages";
1834
  }
1835
 
1836
+ $sql="SELECT `ID`, `post_author`, `post_date`, `post_date_gmt`, `post_status`, `post_name`, `post_modified`, `post_modified_gmt`, `post_parent`, `post_type` $postPageStmt $contentStmt FROM `" . $wpdb->posts . "` WHERE ";
1837
 
1838
  $where = '(';
1839
 
1840
  if($this->GetOption('in_posts')) {
1841
+ //WP < 2.1: posts are post_status = publish
1842
  //WP >= 2.1: post_type must be 'post', no date check required because future posts are post_status='future'
1843
  if($wpCompat) $where.="(post_status = 'publish' AND post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "')";
1844
  else $where.=" (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) ";
1846
 
1847
  if($this->GetOption('in_pages')) {
1848
  if($this->GetOption('in_posts')) {
1849
+ $where.=" OR ";
1850
  }
1851
  if($wpCompat) {
1852
  //WP < 2.1: posts have post_status = published, pages have post_status = static
1853
  $where.=" post_status='static' ";
1854
  } else {
1855
+ //WP >= 2.1: posts have post_type = 'post' and pages have post_type = 'page'. Both must be published.
1856
  $where.=" (post_status = 'publish' AND post_type = 'page') ";
1857
  }
1858
  }
1859
 
1860
  $where.=") ";
1861
 
 
1862
 
1863
  if(is_array($excludes) && count($excludes)>0) {
1864
+ $where.=" AND ID NOT IN ('" . implode("','",$excludes) . "')";
1865
  }
1866
 
1867
  $where.=" AND post_password='' ORDER BY post_modified DESC";
1869
  $sql .= $where;
1870
 
1871
  if($this->GetOption("sm_b_max_posts")>0) {
1872
+ $sql.=" LIMIT 0," . $this->GetOption("sm_b_max_posts");
1873
+ }
1874
 
1875
  $postCount = intval($wpdb->get_var("SELECT COUNT(*) AS cnt FROM `" . $wpdb->posts . "` WHERE ". $where,0,0));
1876
 
1878
  //Safe Mode for other plugins which use mysql_query() without a connection handler and will destroy our resultset :(
1879
  $con = $postRes = null;
1880
  if($this->GetOption("b_safemode")===true) {
1881
+ $postRes = mysql_query($sql,$wpdb->dbh);
1882
  if(!$postRes) {
1883
  trigger_error("MySQL query failed: " . mysql_error(),E_USER_NOTICE); //E_NOTE will be displayed on our debug mode
1884
+ return;
1885
  }
1886
  } else {
1887
  $con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD,true);
1897
 
1898
  if(!$postRes) {
1899
  trigger_error("MySQL unbuffered query failed: " . mysql_error(),E_USER_NOTICE);
1900
+ return;
1901
  }
1902
  }
1903
 
1913
 
1914
  //$posts is used by Alex King's Popularity Contest plugin
1915
  //if($posts == null || !is_array($posts)) {
1916
+ // $posts = &$postRes;
1917
  //}
1918
 
1919
  $z = 1;
1929
 
1930
  $minPrio=$this->GetOption('pr_posts_min');
1931
 
 
1932
 
1933
  //Cycle through all posts and add them
1934
  while($post = mysql_fetch_object($postRes)) {
1944
  if($wpCompat) {
1945
  $isPage = ($post->post_status == 'static');
1946
  } else {
1947
+ $isPage = ($post->post_type == 'page');
1948
  }
1949
 
1950
  //Set the current working post
1969
  $prio = $prioProvider->GetPostPriority($post->ID,$cmtcnt);
1970
 
1971
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry('Debug: Priority report of postID ' . $post->ID . ': Comments: ' . $cmtcnt . ' of ' . $commentCount . ' = ' . $prio . ' points'));
1972
+ }
1973
 
1974
  if(!$isPage && $minPrio>0 && $prio<$minPrio) {
1975
  $prio = $minPrio;
1985
  $subPage = $permalink . '&amp;page=' . $p;
1986
  } else {
1987
  $subPage = trailingslashit($permalink) . user_trailingslashit($p, 'single_paged');
1988
+ }
1989
 
1990
  $this->AddUrl($subPage,$this->GetTimestampFromMySql(($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
1991
  }
1992
  }
1993
 
1994
+ // Multilingual Support with qTranslate, thanks to Qian Qin
1995
+ if($useQTransLate) {
1996
+ global $q_config;
1997
+ foreach(qtrans_getEnabledLanguages($post->post_content) as $language) {
1998
+ if($language!=$q_config['default_language']) {
1999
+ $this->AddUrl(qtrans_convertURL($permalink,$language),$this->GetTimestampFromMySql(($post->post_modified_gmt && $post->post_modified_gmt!='0000-00-00 00:00:00'?$post->post_modified_gmt:$post->post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
2000
+ }
2001
+ }
2002
+ }
 
2003
  }
2004
 
2005
+ //Update the status every 100 posts and at the end.
2006
+ //If the script breaks because of memory or time limit,
2007
  //we have a "last reponded" value which can be compared to the server settings
2008
  if($zz==100 || $z == $postCount) {
2009
  $status->SaveStep($z);
2010
+ $zz=0;
2011
  } else $zz++;
2012
 
2013
  $z++;
2015
  //Clean cache because it's incomplete
2016
  if(version_compare($wp_version,"2.5",">=")) {
2017
  //WP 2.5 makes a mysql query for every clean_post_cache to clear the child cache
2018
+ //so I've vopied the function here until a patch arrives...
2019
  wp_cache_delete($post->ID, 'posts');
2020
  wp_cache_delete($post->ID, 'post_meta');
2021
  clean_object_term_cache($post->ID, 'post');
2038
  if(!$this->IsTaxonomySupported()) {
2039
 
2040
  $catsRes=$wpdb->get_results("
2041
+ SELECT
2042
+ c.cat_ID AS ID,
2043
+ MAX(p.post_modified_gmt) AS last_mod
2044
+ FROM
2045
  `" . $wpdb->categories . "` c,
2046
  `" . $wpdb->post2cat . "` pc,
2047
  `" . $wpdb->posts . "` p
2052
  AND p.post_type='post'
2053
  GROUP
2054
  BY c.cat_id
2055
+ ");
2056
  if($catsRes) {
2057
  foreach($catsRes as $cat) {
2058
  if($cat && $cat->ID && $cat->ID>0) {
2059
+ if($debug) if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Cat-ID:" . $cat->ID));
2060
  $this->AddUrl(get_category_link($cat->ID),$this->GetTimestampFromMySql($cat->last_mod),$this->GetOption("cf_cats"),$this->GetOption("pr_cats"));
2061
  }
2062
+ }
2063
  }
2064
  } else {
2065
  $cats = get_terms("category",array("hide_empty"=>true,"hierarchical"=>false));
2066
  if($cats && is_array($cats) && count($cats)>0) {
2067
  foreach($cats AS $cat) {
2068
+ $this->AddUrl(get_category_link($cat->term_id),0,$this->GetOption("cf_cats"),$this->GetOption("pr_cats"));
2069
+ }
2070
+ }
2071
  }
2072
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Cats"));
2073
  }
2074
 
2075
  //Add the archives
2079
 
2080
  //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
2081
  $arcresults = $wpdb->get_results("
2082
+ SELECT DISTINCT
2083
+ YEAR(post_date_gmt) AS `year`,
2084
+ MONTH(post_date_gmt) AS `month`,
2085
+ MAX(post_date_gmt) as last_mod,
2086
+ count(ID) as posts
2087
+ FROM
2088
+ $wpdb->posts
2089
+ WHERE
2090
+ post_date < '$now'
2091
+ AND post_status = 'publish'
2092
  AND post_type = 'post'
2093
  " . (floatval($wp_version) < 2.1?"AND {$wpdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
2094
+ GROUP BY
2095
+ YEAR(post_date_gmt),
2096
+ MONTH(post_date_gmt)
2097
+ ORDER BY
2098
  post_date_gmt DESC");
2099
  if ($arcresults) {
2100
  foreach ($arcresults as $arcresult) {
2104
 
2105
  //Archive is the current one
2106
  if($arcresult->month==date("n") && $arcresult->year==date("Y")) {
2107
+ $changeFreq=$this->GetOption("cf_arch_curr");
2108
  } else { // Archive is older
2109
+ $changeFreq=$this->GetOption("cf_arch_old");
2110
  }
2111
 
2112
+ $this->AddUrl($url,$this->GetTimestampFromMySql($arcresult->last_mod),$changeFreq,$this->GetOption("pr_arch"));
2113
  }
2114
  }
2115
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Archive"));
2116
  }
2117
 
2118
  //Add the author pages
2121
 
2122
  $linkFunc = null;
2123
 
2124
+ //get_author_link is deprecated in WP 2.1, try to use get_author_posts_url first.
2125
  if(function_exists('get_author_posts_url')) {
2126
+ $linkFunc = 'get_author_posts_url';
2127
  } else if(function_exists('get_author_link')) {
2128
+ $linkFunc = 'get_author_link';
2129
+ }
2130
 
2131
  //Who knows what happens in later WP versions, so check again if it worked
2132
  if($linkFunc !== null) {
2133
  //Unfortunately there is no API function to get all authors, so we have to do it the dirty way...
2134
  //We retrieve only users with published and not password protected posts (and not pages)
2135
  //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
2136
+ $sql = "SELECT DISTINCT
2137
+ {$wpdb->users}.ID,
2138
+ {$wpdb->users}.user_nicename,
2139
+ MAX({$wpdb->posts}.post_modified_gmt) AS last_post
2140
+ FROM
2141
+ {$wpdb->users},
2142
+ {$wpdb->posts}
2143
+ WHERE
2144
+ {$wpdb->posts}.post_author = {$wpdb->users}.ID
2145
  AND {$wpdb->posts}.post_status = 'publish'
2146
+ AND {$wpdb->posts}.post_type = 'post'
2147
+ AND {$wpdb->posts}.post_password = ''
2148
  " . (floatval($wp_version) < 2.1?"AND {$wpdb->posts}.post_date_gmt <= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
2149
+ GROUP BY
2150
+ {$wpdb->users}.ID,
2151
  {$wpdb->users}.user_nicename";
2152
 
2153
  $authors = $wpdb->get_results($sql);
2154
 
2155
  if($authors && is_array($authors)) {
2156
  foreach($authors as $author) {
2157
+ if($debug) if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Author-ID:" . $author->ID));
2158
  $url = ($linkFunc=='get_author_posts_url'?get_author_posts_url($author->ID,$author->user_nicename):get_author_link(false,$author->ID,$author->user_nicename));
2159
  $this->AddUrl($url,$this->GetTimestampFromMySql($author->last_post),$this->GetOption("cf_auth"),$this->GetOption("pr_auth"));
2160
  }
2161
  }
2162
  } else {
2163
  //Too bad, no author pages for you :(
2164
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: No valid author link function found"));
2165
  }
2166
 
2167
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Author pages"));
2168
  }
2169
 
2170
  //Add tag pages
2173
  $tags = get_terms("post_tag",array("hide_empty"=>true,"hierarchical"=>false));
2174
  if($tags && is_array($tags) && count($tags)>0) {
2175
  foreach($tags AS $tag) {
2176
+ $this->AddUrl(get_tag_link($tag->term_id),0,$this->GetOption("cf_tags"),$this->GetOption("pr_tags"));
2177
+ }
2178
+ }
2179
+ if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags"));
2180
  }
2181
 
2182
  //Add the custom pages
2185
  //#type $page GoogleSitemapGeneratorPage
2186
  foreach($this->_pages AS $page) {
2187
  $this->AddUrl($page->GetUrl(),$page->getLastMod(),$page->getChangeFreq(),$page->getPriority());
2188
+ }
2189
  }
2190
 
2191
  if($debug) $this->AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Custom Pages"));
2228
  } else {
2229
  $status->EndGooglePing(true);
2230
  }
2231
+ }
2232
 
2233
  //Ping Ask.com
2234
  if($this->GetOption("b_pingask") && !empty($pingUrl)) {
2253
  $status->EndYahooPing(false,$this->_lastError);
2254
  } else {
2255
  $status->EndYahooPing(true);
2256
+ }
2257
+ }
2258
 
2259
  //Ping MSN
2260
  if($this->GetOption("b_pingmsn") && !empty($pingUrl)) {
2262
  $status->StartMsnPing($sPingUrl);
2263
  $pingres=$this->RemoteOpen($sPingUrl);
2264
 
2265
+ if($pingres==NULL || $pingres===false || strpos($pingres,"Thanks for submitting your sitemap")===false) {
2266
  $status->EndMsnPing(false,$this->_lastError);
2267
  } else {
2268
  $status->EndMsnPing(true);
2269
  }
2270
  }
2271
 
2272
+ $status->End();
2273
 
2274
 
2275
+ $this->_isActive = false;
2276
 
2277
  //done...
2278
  return $status;
2285
  require_once( ABSPATH . 'wp-includes/class-snoopy.php');
2286
 
2287
  $s = new Snoopy();
2288
+ $s->fetch($url);
2289
 
2290
  if($s->status == 200) {
2291
+ $res = $s->results;
2292
  }
2293
  } else {
2294
+ $res = wp_remote_fopen($url);
2295
  }
2296
  return $res;
2297
  }
2304
  * @author Arne Brachhold
2305
  */
2306
  function TrackError($log_level, $log_text, $error_file, $error_line) {
2307
+ $this->_lastError = $log_text;
2308
  }
2309
 
2310
  /**
2311
  * Echos option fields for an select field containing the valid change frequencies
2312
+ *
2313
  * @since 3.0
2314
  * @access private
2315
  * @author Arne Brachhold
2316
  * @param $currentVal The value which should be selected
2317
+ * @return all valid change frequencies as html option fields
2318
  */
2319
  function HtmlGetFreqNames($currentVal) {
2320
 
2321
  foreach($this->_freqNames AS $k=>$v) {
2322
+ echo "<option value=\"$k\" " . $this->HtmlGetSelected($k,$currentVal) .">" . $v . "</option>";
2323
  }
2324
  }
2325
 
2330
  * @access private
2331
  * @author Arne Brachhold
2332
  * @param $currentVal string The value which should be selected
2333
+ * @return 0.0 - 1.0 as html option fields
2334
  */
2335
  function HtmlGetPriorityValues($currentVal) {
2336
  $currentVal=(float) $currentVal;
2337
  for($i=0.0; $i<=1.0; $i+=0.1) {
2338
  echo "<option value=\"$i\" " . $this->HtmlGetSelected("$i","$currentVal") .">";
2339
  _e(strval($i));
2340
+ echo "</option>";
2341
+ }
2342
  }
2343
 
2344
  /**
2353
  */
2354
  function HtmlGetChecked($val,$equals) {
2355
  if($val==$equals) return $this->HtmlGetAttribute("checked");
2356
+ else return "";
2357
  }
2358
 
2359
  /**
2368
  */
2369
  function HtmlGetSelected($val,$equals) {
2370
  if($val==$equals) return $this->HtmlGetAttribute("selected");
2371
+ else return "";
2372
  }
2373
 
2374
  /**
2383
  */
2384
  function HtmlGetAttribute($attr,$value=NULL) {
2385
  if($value==NULL) $value=$attr;
2386
+ return " " . $attr . "=\"" . $value . "\" ";
2387
  }
2388
 
2389
  /**
2427
 
2428
  //Add it to the array
2429
  array_push($pages,$p);
2430
+ }
2431
+ }
2432
  return $pages;
2433
  }
2434
 
2453
  if(isset($_GET['page']) && !empty($_GET['page'])) {
2454
  $page = preg_replace('[^a-zA-Z0-9\.\_\-]','',$_GET['page']);
2455
  }
2456
+
2457
+ if(function_exists("admin_url")) return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
2458
+ else return $_SERVER['PHP_SELF'] . "?page=" . $page;
2459
+ }
2460
+
2461
+ function HtmlRegScripts() {
2462
+ $ui = $this->GetUI();
2463
+ if($ui) {
2464
+ $ui->HtmlRegScripts();
2465
+ return true;
2466
+ }
2467
  }
2468
 
2469
  function HtmlShowOptionsPage() {
2470
+
2471
+ $ui = $this->GetUI();
2472
+ if($ui) {
2473
+ $ui->HtmlShowOptionsPage();
2474
+ return true;
2475
+ }
2476
+
2477
+ return false;
2478
+ }
2479
+
2480
+ var $_ui = null;
2481
+
2482
+ function GetUI() {
2483
+
2484
+ global $wp_version;
2485
+
2486
+ if($this->_ui === null) {
2487
 
2488
+ $className='GoogleSitemapGeneratorUI';
2489
+ $fileName='sitemap-ui.php';
 
2490
 
2491
+ if(!class_exists($className)) {
2492
+
2493
+ $path = trailingslashit(dirname(__FILE__));
2494
+
2495
+ if(!file_exists( $path . $fileName)) return false;
2496
+ require_once($path. $fileName);
2497
+ }
2498
+
2499
+ $this->_ui = new $className($this);
2500
+
2501
+ }
2502
+
2503
+ return $this->_ui;
2504
+ }
2505
+
2506
+ function HtmlShowHelp() {
2507
+
2508
+
2509
  }
2510
  }
sitemap-ui.php CHANGED
@@ -1,16 +1,63 @@
1
  <?php
2
  /*
3
 
4
- $Id: sitemap-ui.php 48028 2008-05-27 14:29:50Z arnee $
5
 
6
  */
7
 
8
  class GoogleSitemapGeneratorUI {
9
 
10
  var $sg = null;
 
 
11
 
12
  function GoogleSitemapGeneratorUI($sitemapBuilder) {
13
- $this->sg = $sitemapBuilder;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
  /**
@@ -29,19 +76,19 @@ class GoogleSitemapGeneratorUI {
29
 
30
  if(isset($_GET['sm_hidedonate'])) {
31
  $this->sg->SetOption('i_hide_donated',true);
32
- $this->sg->SaveOptions();
33
  }
34
  if(isset($_GET['sm_donated'])) {
35
  $this->sg->SetOption('i_donated',true);
36
- $this->sg->SaveOptions();
37
  }
38
  if(isset($_GET['sm_hide_note'])) {
39
  $this->sg->SetOption('i_hide_note',true);
40
- $this->sg->SaveOptions();
41
  }
42
  if(isset($_GET['sm_hidedonors'])) {
43
  $this->sg->SetOption('i_hide_donors',true);
44
- $this->sg->SaveOptions();
45
  }
46
 
47
  if(isset($_GET['sm_donated']) || ($this->sg->GetOption('i_donated')===true && $this->sg->GetOption('i_hide_donated')!==true)) {
@@ -49,15 +96,15 @@ class GoogleSitemapGeneratorUI {
49
  <div class="updated">
50
  <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>
51
  </div>
52
- <?php
53
  } 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))) {
54
  ?>
55
  <div class="updated">
56
  <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 your are satisfied with the results, isn\'t it worth at least one dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>','sitemap')); ?> <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>
57
  <div style="clear:right;"></div>
58
  </div>
59
- <?php
60
- }
61
 
62
  if(function_exists("wp_next_scheduled")) {
63
  $next = wp_next_scheduled('sm_build_cron');
@@ -66,14 +113,14 @@ class GoogleSitemapGeneratorUI {
66
  if($diff <= 0) {
67
  $diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!','sitemap');
68
  } else {
69
- $diffMsg = str_replace("%s",$diff,__('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!','sitemap'));
70
  }
71
  ?>
72
  <div class="updated">
73
  <strong><p><?php echo $diffMsg ?></p></strong>
74
  <div style="clear:right;"></div>
75
  </div>
76
- <?php
77
  }
78
  }
79
 
@@ -83,7 +130,7 @@ class GoogleSitemapGeneratorUI {
83
 
84
  //Check again, just for the case that something went wrong before
85
  if(!current_user_can("administrator")) {
86
- echo '<p>Please log in as admin</p>';
87
  return;
88
  }
89
 
@@ -118,7 +165,7 @@ class GoogleSitemapGeneratorUI {
118
  echo "<pre>";
119
  print_r($this->sg->_options);
120
  echo "</pre>";
121
- echo '<h3>Errors, Warnings, Notices</h3>';
122
  echo '<div>';
123
  $status = $this->sg->BuildSitemap();
124
  echo '</div>';
@@ -130,12 +177,12 @@ class GoogleSitemapGeneratorUI {
130
 
131
  $total = 0;
132
  foreach($GLOBALS['wpdb']->queries as $q) {
133
- $total+=$q[1];
134
  }
135
  echo '<h4>Total Query Time</h4>';
136
  echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total,2) . ' seconds.</pre>';
137
  } else {
138
- echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>';
139
  }
140
  echo "<h3>Build Process Results</h3>";
141
  echo "<pre>";
@@ -156,7 +203,7 @@ class GoogleSitemapGeneratorUI {
156
  echo '<noscript><a href="' . $this->sg->GetBackLink() . '">Click here to continue</a></noscript>';
157
  exit;
158
  }
159
- } else if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config
160
  check_admin_referer('sitemap');
161
  foreach($this->sg->_options as $k=>$v) {
162
  //Check vor values and convert them into their types, based on the category they are in
@@ -167,6 +214,7 @@ class GoogleSitemapGeneratorUI {
167
  if($k=="sm_b_filename_manual" && strpos($_POST[$k],"\\")!==false){
168
  $_POST[$k]=stripslashes($_POST[$k]);
169
  }
 
170
  $this->sg->_options[$k]=(string) $_POST[$k];
171
  } else if($k=="sm_b_location_mode") {
172
  $tmp=(string) $_POST[$k];
@@ -182,22 +230,34 @@ class GoogleSitemapGeneratorUI {
182
  $IDss = array();
183
  $IDs = explode(",",$_POST[$k]);
184
  for($x = 0; $x<count($IDs); $x++) {
185
- $ID = intval(trim($IDs[$x]));
186
  if($ID>0) $IDss[] = $ID;
187
  }
188
  $this->sg->_options[$k] = $IDss;
 
 
 
 
 
 
 
189
  } else {
190
- $this->sg->_options[$k]=(bool) $_POST[$k];
 
 
 
 
 
191
  }
192
  //Options of the category "Includes" are boolean
193
  } else if(substr($k,0,6)=="sm_in_") {
194
- $this->sg->_options[$k]=(bool) $_POST[$k];
195
  //Options of the category "Change frequencies" are string
196
  } else if(substr($k,0,6)=="sm_cf_") {
197
- $this->sg->_options[$k]=(string) $_POST[$k];
198
  //Options of the category "Priorities" are float
199
  } else if(substr($k,0,6)=="sm_pr_") {
200
- $this->sg->_options[$k]=(float) $_POST[$k];
201
  }
202
  }
203
 
@@ -212,10 +272,10 @@ class GoogleSitemapGeneratorUI {
212
 
213
  if($this->sg->GetOption('sm_b_robots')===true) {
214
  if($this->sg->WriteRobotsFile()) {
215
- $message.=str_replace("%s",$this->sg->GetRobotsFileUrl(),__("<a href=\"%s\">Robots.txt</a> file saved",'sitemap')) . "<br />";
216
  } else {
217
- $message.=__("Error while saving Robots.txt file",'sitemap') . "<br />";
218
- }
219
  }
220
 
221
  } else if(!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config
@@ -259,7 +319,7 @@ class GoogleSitemapGeneratorUI {
259
  display:block;
260
  padding-left:25px;
261
  background-repeat:no-repeat;
262
- background-position:5px 50%;
263
  text-decoration:none;
264
  border:none;
265
  }
@@ -269,97 +329,106 @@ class GoogleSitemapGeneratorUI {
269
  }
270
 
271
  a.sm_donatePayPal {
272
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-paypal.gif);
273
  }
274
 
275
  a.sm_donateAmazon {
276
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-amazon.gif);
277
  }
278
 
279
  a.sm_pluginHome {
280
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-arne.gif);
281
  }
282
 
283
  a.sm_pluginList {
284
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-email.gif);
285
  }
286
 
287
  a.sm_pluginSupport {
288
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-wordpress.gif);
289
  }
290
 
291
  a.sm_pluginBugs {
292
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-trac.gif);
293
  }
294
 
295
  a.sm_resGoogle {
296
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-google.gif);
297
  }
298
 
299
  a.sm_resYahoo {
300
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-yahoo.gif);
301
  }
302
 
303
  a.sm_resLive {
304
- background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-live.gif);
305
  }
306
 
307
  div.sm-update-nag p {
308
  margin:5px;
309
- }
310
 
311
  </style>
312
 
313
  <?php
314
- if(version_compare($wp_version,"2.5",">=")) {
315
- ?>
316
  <style type="text/css">
317
- div#moremeta {
318
- float:right;
319
- width:200px;
320
- margin-left:10px;
321
- }
322
- div#advancedstuff {
323
- width:770px;
324
- }
325
- div#poststuff {
326
- margin-top:10px;
327
- }
328
- fieldset.dbx-box {
329
- margin-bottom:5px;
330
- }
331
-
332
- div.sm-update-nag {
333
- margin-top:10px!important;
334
- }
335
-
336
- </style>
337
- <!--[if lt IE 7]>
338
- <style type="text/css">
339
- div#advancedstuff {
340
- width:735px;
341
- }
342
- </style>
343
- <![endif]-->
344
-
345
- <?php
346
- } else { ?>
347
- <style type="text/css">
348
- div.updated-message {
349
- margin-left:0; margin-right:0;
350
- }
351
  </style>
352
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  ?>
354
 
355
-
356
-
357
-
358
-
359
  <div class="wrap" id="sm_div">
360
  <form method="post" action="<?php echo $this->sg->GetBackLink() ?>">
361
  <h2><?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this->sg->GetVersion() ?> </h2>
362
- <?php
363
  if(function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
364
  wp_update_plugins();
365
 
@@ -378,7 +447,7 @@ class GoogleSitemapGeneratorUI {
378
  printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.','default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin=$file", 'upgrade-plugin_' . $file) );
379
 
380
  ?></div><?php
381
- }
382
  }
383
  ?>
384
 
@@ -428,662 +497,630 @@ class GoogleSitemapGeneratorUI {
428
  </script>
429
  <?php endif; ?>
430
 
 
 
 
 
 
431
  <div id="poststuff">
432
  <div id="moremeta">
433
  <div id="grabit" class="dbx-group">
434
- <fieldset id="sm_pnres" class="dbx-box">
435
- <h3 class="dbx-handle"><?php _e('About this Plugin:','sitemap'); ?></h3>
436
- <div class="dbx-content">
437
- <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-home'); ?>"><?php _e('Plugin Homepage','sitemap'); ?></a>
438
- <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-feedback'); ?>"><?php _e('Suggest a Feature','sitemap'); ?></a>
439
- <a class="sm_button sm_pluginList" href="<?php echo $this->sg->GetRedirectLink('sitemap-list'); ?>"><?php _e('Notify List','sitemap'); ?></a>
440
- <a class="sm_button sm_pluginSupport" href="<?php echo $this->sg->GetRedirectLink('sitemap-support'); ?>"><?php _e('Support Forum','sitemap'); ?></a>
441
- <a class="sm_button sm_pluginBugs" href="<?php echo $this->sg->GetRedirectLink('sitemap-bugs'); ?>"><?php _e('Report a Bug','sitemap'); ?></a>
442
-
443
- <a class="sm_button sm_donatePayPal" href="<?php echo $this->sg->GetRedirectLink('sitemap-paypal'); ?>"><?php _e('Donate with PayPal','sitemap'); ?></a>
444
- <a class="sm_button sm_donateAmazon" href="<?php echo $this->sg->GetRedirectLink('sitemap-amazon'); ?>"><?php _e('My Amazon Wish List','sitemap'); ?></a>
445
- <?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 } ?>
446
- </div>
447
- </fieldset>
448
- <fieldset id="sm_smres" class="dbx-box">
449
- <h3 class="dbx-handle"><?php _e('Sitemap Resources:','sitemap'); ?></h3>
450
- <div class="dbx-content">
451
- <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwt'); ?>"><?php _e('Webmaster Tools','sitemap'); ?></a>
452
- <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwb'); ?>"><?php _e('Webmaster Blog','sitemap'); ?></a>
453
-
454
- <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-yse'); ?>"><?php _e('Site Explorer','sitemap'); ?></a>
455
- <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-ywb'); ?>"><?php _e('Search Blog','sitemap'); ?></a>
456
-
457
- <a class="sm_button sm_resLive" href="<?php echo $this->sg->GetRedirectLink('sitemap-lwt'); ?>"><?php _e('Webmaster Tools','sitemap'); ?></a>
458
- <a class="sm_button sm_resLive" href="<?php echo $this->sg->GetRedirectLink('sitemap-lswcb'); ?>"><?php _e('Webmaster Center Blog','sitemap'); ?></a>
459
- <br />
460
- <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-prot'); ?>"><?php _e('Sitemaps Protocol','sitemap'); ?></a>
461
- <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-ofaq'); ?>"><?php _e('Official Sitemaps FAQ','sitemap'); ?></a>
462
- <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-afaq'); ?>"><?php _e('My Sitemaps FAQ','sitemap'); ?></a>
463
- </div>
464
- </fieldset>
465
-
466
- <fieldset id="dm_donations" class="dbx-box">
467
- <h3 class="dbx-handle"><?php _e('Recent Donations:','sitemap'); ?></h3>
468
- <div class="dbx-content">
469
- <?php if($this->sg->GetOption('i_hide_donors')!==true) { ?>
470
- <iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php echo $this->sg->GetRedirectLink('sitemap-donorlist'); ?>">
471
- <?php _e('List of the donors','sitemap'); ?>
472
- </iframe><br />
473
- <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_hidedonors=true"; ?>"><small><?php _e('Hide this list','sitemap'); ?></small></a><br /><br />
474
- <?php } ?>
475
- <a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php echo $this->sg->GetPluginUrl(); ?>/img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a>
476
- <span><small><?php _e('Thanks for your support!','sitemap'); ?></small></span>
477
- </div>
478
- </fieldset>
479
  </div>
480
  </div>
481
 
482
- <div id="advancedstuff" class="dbx-group" >
 
483
 
484
- <!-- Rebuild Area -->
485
- <div class="dbx-b-ox-wrapper">
486
- <fieldset id="sm_rebuild" class="dbx-box">
487
- <div class="dbx-h-andle-wrapper">
488
- <h3 class="dbx-handle"><?php _e('Status', 'sitemap') ?></h3>
489
- </div>
490
- <div class="dbx-c-ontent-wrapper">
491
- <div class="dbx-content">
492
- <ul>
493
- <?php
494
 
495
- //#type $status GoogleSitemapGeneratorStatus
496
- $status = GoogleSitemapGeneratorStatus::Load();
497
- if($status == null) {
498
-
499
- echo "<li>" . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true",'sitemap'),__('The sitemap wasn\'t built yet. <a href="%s">Click here</a> to build it the first time.','sitemap')) . "</li>";
500
- } else {
501
- if($status->_endTime !== 0) {
502
- if($status->_usedXml) {
503
- if($status->_xmlSuccess) {
504
- $ft = filemtime($status->_xmlPath);
505
- echo "<li>" . str_replace("%url%",$status->_xmlUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your <a href=\"%url%\">sitemap</a> was last built on <b>%date%</b>.",'sitemap'))) . "</li>";
506
- } else {
507
- echo "<li class=\"sm_error\">" . str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-files'),__("There was a problem writing your sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a",'sitemap')) . "</li>";
508
- }
509
- }
510
-
511
- if($status->_usedZip) {
512
- if($status->_zipSuccess) {
513
- $ft = filemtime($status->_zipPath);
514
- echo "<li>" . str_replace("%url%",$status->_zipUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your sitemap (<a href=\"%url%\">zipped</a>) was last built on <b>%date%</b>.",'sitemap'))) . "</li>";
515
- } else {
516
- echo "<li class=\"sm_error\">" . str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-files'),__("There was a problem writing your zipped sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a",'sitemap')) . "</li>";
517
- }
518
- }
519
-
520
- if($status->_usedGoogle) {
521
- if($status->_gooogleSuccess) {
522
- echo "<li>" .__("Google was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
523
- $gt = $status->GetGoogleTime();
524
- if($gt>4) {
525
- echo "<li class=\sm_optimize\">" . str_replace("%time%",$gt,__("It took %time% seconds to notify Google, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
526
- }
527
- } else {
528
- echo "<li class=\"sm_error\">" . str_replace("%s",$status->_googleUrl,__('There was a problem while notifying Google. <a href="%s">View result</a>','sitemap')) . "</li>";
529
- }
530
- }
531
-
532
- if($status->_usedYahoo) {
533
- if($status->_yahooSuccess) {
534
- echo "<li>" .__("YAHOO was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
535
- $yt = $status->GetYahooTime();
536
- if($yt>4) {
537
- echo "<li class=\sm_optimize\">" . str_replace("%time%",$yt,__("It took %time% seconds to notify YAHOO, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
538
- }
539
- } else {
540
- echo "<li class=\"sm_error\">" . str_replace("%s",$status->_yahooUrl,__('There was a problem while notifying YAHOO. <a href="%s">View result</a>','sitemap')) . "</li>";
541
- }
542
- }
543
-
544
- if($status->_usedMsn) {
545
- if($status->_msnSuccess) {
546
- echo "<li>" .__("MSN was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
547
- $at = $status->GetMsnTime();
548
- if($at>4) {
549
- echo "<li class=\sm_optimize\">" . str_replace("%time%",$at,__("It took %time% seconds to notify MSN.com, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
550
- }
551
- } else {
552
- echo "<li class=\"sm_error\">" . str_replace("%s",$status->_msnUrl,__('There was a problem while notifying MSN.com. <a href="%s">View result</a>','sitemap')) . "</li>";
553
- }
554
- }
555
-
556
- if($status->_usedAsk) {
557
- if($status->_askSuccess) {
558
- echo "<li>" .__("Ask.com was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
559
- $at = $status->GetAskTime();
560
- if($at>4) {
561
- echo "<li class=\sm_optimize\">" . str_replace("%time%",$at,__("It took %time% seconds to notify Ask.com, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
562
- }
563
- } else {
564
- echo "<li class=\"sm_error\">" . str_replace("%s",$status->_askUrl,__('There was a problem while notifying Ask.com. <a href="%s">View result</a>','sitemap')) . "</li>";
565
- }
566
- }
567
-
568
- $et = $status->GetTime();
569
- $mem = $status->GetMemoryUsage();
570
-
571
- if($mem > 0) {
572
- echo "<li>" .str_replace(array("%time%","%memory%"),array($et,$mem),__("The building process took about <b>%time% seconds</b> to complete and used %memory% MB of memory.",'sitemap')). "</li>";
573
- } else {
574
- echo "<li>" .str_replace("%time%",$et,__("The building process took about <b>%time% seconds</b> to complete.",'sitemap')). "</li>";
575
- }
576
-
577
- if(!$status->_hasChanged) {
578
- echo "<li>" . __("The content of your sitemap <strong>didn't change</strong> since the last time so the files were not written and no search engine was pinged.",'sitemap'). "</li>";
579
- }
580
-
581
- } else {
582
- if($this->sg->GetOption("sm_b_auto_delay")) {
583
- $st = ($status->GetStartTime() - time()) * -1;
584
- //If the building process runs in background and was started within the last 45 seconds, the sitemap might not be completed yet...
585
- if($st < 45) {
586
- echo '<li class="">'. __("The building process might still be active! Reload the page in a few seconds and check if something has changed.",'sitemap') . '</li>';
587
- }
588
- }
589
- echo '<li class="sm_error">'. str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-memtime'),__("The last run didn't finish! Maybe you can raise the memory or time limit for PHP scripts. <a href=\"%url%\">Learn more</a>",'sitemap')) . '</li>';
590
- if($status->_memoryUsage > 0) {
591
- echo '<li class="sm_error">'. str_replace(array("%memused%","%memlimit%"),array($status->GetMemoryUsage(),ini_get('memory_limit')),__("The last known memory usage of the script was %memused%MB, the limit of your server is %memlimit%.",'sitemap')) . '</li>';
592
- }
593
-
594
- if($status->_lastTime > 0) {
595
- echo '<li class="sm_error">'. str_replace(array("%timeused%","%timelimit%"),array($status->GetLastTime(),ini_get('max_execution_time')),__("The last known execution time of the script was %timeused% seconds, the limit of your server is %timelimit% seconds.",'sitemap')) . '</li>';
596
- }
597
-
598
- if($status->GetLastPost() > 0) {
599
- echo '<li class="sm_optimize">'. str_replace("%lastpost%",$status->GetLastPost(),__("The script stopped around post number %lastpost% (+/- 100)",'sitemap')) . '</li>';
600
- }
601
- }
602
- echo "<li>" . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true",'sitemap'),__('If you changed something on your server or blog, you should <a href="%s">rebuild the sitemap</a> manually.','sitemap')) . "</li>";
603
  }
604
- 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 the build process you can use the <a href="%d">debug function</a> to get more information.','sitemap')) . "</li>";
605
- ?>
606
-
607
- </ul>
608
- </div>
609
- </div>
610
- </fieldset>
611
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
 
613
- <!-- Basic Options -->
614
- <div class="dbx-b-ox-wrapper">
615
- <fieldset id="sm_basic_options" class="dbx-box">
616
- <div class="dbx-h-andle-wrapper">
617
- <h3 class="dbx-handle"><?php _e('Basic Options', 'sitemap') ?></h3>
618
- </div>
619
- <div class="dbx-c-ontent-wrapper">
620
- <div class="dbx-content">
621
- <b><?php _e('Sitemap files:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-files'); ?>"><?php _e('Learn more','sitemap'); ?></a>
622
- <ul>
623
- <li>
624
- <label for="sm_b_xml">
625
- <input type="checkbox" id="sm_b_xml" name="sm_b_xml" <?php echo ($this->sg->GetOption("b_xml")==true?"checked=\"checked\"":"") ?> />
626
- <?php _e('Write a normal XML file (your filename)', 'sitemap') ?>
627
- </label>
628
- </li>
629
- <li>
630
- <label for="sm_b_gzip">
631
- <input type="checkbox" id="sm_b_gzip" name="sm_b_gzip" <?php if(function_exists("gzencode")) { echo ($this->sg->GetOption("b_gzip")==true?"checked=\"checked\"":""); } else echo "disabled=\"disabled\""; ?> />
632
- <?php _e('Write a gzipped file (your filename + .gz)', 'sitemap') ?>
633
- </label>
634
- </li>
635
- </ul>
636
- <b><?php _e('Building mode:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-process'); ?>"><?php _e('Learn more','sitemap'); ?></a>
637
- <ul>
638
- <li>
639
- <label for="sm_b_auto_enabled">
640
- <input type="checkbox" id="sm_b_auto_enabled" name="sm_b_auto_enabled" <?php echo ($this->sg->GetOption("sm_b_auto_enabled")==true?"checked=\"checked\"":""); ?> />
641
- <?php _e('Rebuild sitemap if you change the content of your blog', 'sitemap') ?>
642
- </label>
643
- </li>
644
- <li>
645
- <label for="sm_b_manual_enabled">
646
- <input type="hidden" name="sm_b_manual_key" value="<?php echo $this->sg->GetOption("b_manual_key"); ?>" />
647
- <input type="checkbox" id="sm_b_manual_enabled" name="sm_b_manual_enabled" <?php echo ($this->sg->GetOption("b_manual_enabled")==true?"checked=\"checked\"":"") ?> />
648
- <?php _e('Enable manual sitemap building via GET Request', 'sitemap') ?>
649
- </label>
650
- <a href="javascript:void(document.getElementById('sm_manual_help').style.display='');">[?]</a>
651
- <span id="sm_manual_help" style="display:none;"><br />
652
- <?php echo str_replace("%1",trailingslashit(get_bloginfo('siteurl')) . "?sm_command=build&amp;sm_key=" . $this->sg->GetOption("b_manual_key"),__('This will allow you to refresh your sitemap if an external tool wrote into the WordPress database without using the WordPress API. Use the following URL to start the process: <a href="%1">%1</a> Please check the logfile above to see if sitemap was successfully built.', 'sitemap')); ?>
653
- </span>
654
- </li>
655
- </ul>
656
- <b><?php _e('Update notification:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-ping'); ?>"><?php _e('Learn more','sitemap'); ?></a>
657
- <ul>
658
- <li>
659
- <input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php echo ($this->sg->GetOption("b_ping")==true?"checked=\"checked\"":"") ?> />
660
- <label for="sm_b_ping"><?php _e('Notify Google about updates of your Blog', 'sitemap') ?></label><br />
661
- <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-gwt'),__('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
662
- </li>
663
- <li>
664
- <input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php echo ($this->sg->GetOption("b_pingmsn")==true?"checked=\"checked\"":"") ?> />
665
- <label for="sm_b_pingmsn"><?php _e('Notify MSN Live Search about updates of your Blog', 'sitemap') ?></label><br />
666
- <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-lwt'),__('No registration required, but you can join the <a href="%s">MSN Live Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
667
- </li>
668
- <li>
669
- <input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php echo ($this->sg->GetOption("b_pingask")==true?"checked=\"checked\"":"") ?> />
670
- <label for="sm_b_pingask"><?php _e('Notify Ask.com about updates of your Blog', 'sitemap') ?></label><br />
671
- <small><?php _e('No registration required.','sitemap'); ?></small>
672
- </li>
673
- <li>
674
- <input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php echo ($this->sg->GetOption("sm_b_pingyahoo")==true?"checked=\"checked\"":"") ?> />
675
- <label for="sm_b_pingyahoo"><?php _e('Notify YAHOO about updates of your Blog', 'sitemap') ?></label><br />
676
- <label for="sm_b_yahookey"><?php _e('Your Application ID:', 'sitemap') ?> <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php echo $this->sg->GetOption("sm_b_yahookey"); ?>" /></label><br />
677
- <small><?php echo str_replace(array("%s1","%s2"),array($this->sg->GetRedirectLink('sitemap-ykr'),' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'),__('Don\'t you have such a key? <a href="%s1">Request one here</a>!</a> %s2','sitemap')); ?></small>
678
 
679
-
680
- </li>
681
- <li>
682
-
683
- <input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php echo ($this->sg->GetOption("sm_b_robots")==true?"checked=\"checked\"":"") ?> />
684
- <?php echo str_replace('%s',(file_exists($this->sg->GetRobotsFilePath())?'<a href="' . $this->sg->GetRobotsFileUrl() . '">robots.txt</a>':'robots.txt'),__("Modify or create %s file in blog root which contains the sitemap location.",'sitemap')); ?>
685
 
686
- <br />
687
- <?php _e("File permissions: ",'sitemap');
688
- $f = $this->sg->GetRobotsFilePath();
689
- $link = ' <a href="' . $this->sg->GetRedirectLink("sitemap-help-options-robots",'sitemap') . '">' . __("Learn more",'sitemap') . '</a>';
690
- if(file_exists($f)) {
691
- if(is_writable($f)) {
692
- _e("OK, robots.txt is writable.",'sitemap');
693
- } else {
694
- echo __("Error, robots.txt is not writable.",'sitemap') . $link;
695
- }
696
- } else {
697
- if(is_writable(dirname($f))) {
698
- _e("OK, robots.txt doesn't exist but the directory is writable.",'sitemap');
699
- } else {
700
- echo __("Error, robots.txt doesn't exist and the directory is not writable",'sitemap') . $link;
701
- }
702
- }
703
- ?>
704
- </li>
705
- </ul>
706
- <b><?php _e('Advanced options:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv'); ?>"><?php _e('Learn more','sitemap'); ?></a>
707
- <ul>
708
- <li>
709
- <label for="sm_b_max_posts"><?php _e('Limit the number of posts in the sitemap:', 'sitemap') ?> <input type="text" name="sm_b_max_posts" id="sm_b_max_posts" style="width:40px;" value="<?php echo ($this->sg->GetOption("sm_b_max_posts")<=0?"":$this->sg->GetOption("sm_b_max_posts")); ?>" /></label> (<?php echo __('Newer posts will be included first', 'sitemap'); ?>)
710
- </li>
711
- <li>
712
- <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 $this->sg->GetOption("sm_b_memory"); ?>" /></label> (<?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?>)
713
- </li>
714
- <li>
715
- <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 ($this->sg->GetOption("sm_b_time")===-1?'':$this->sg->GetOption("sm_b_time")); ?>" /></label> (<?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')) ?>)
716
- </li>
717
- <li>
718
- <label for="sm_b_style"><?php _e('Include a XSLT stylesheet:', 'sitemap') ?> <input type="text" name="sm_b_style" id="sm_b_style" value="<?php echo $this->sg->GetOption("sm_b_style"); ?>" /></label> <?php if($this->sg->GetDefaultStyle()) { echo ' <a href="javascript:void(0);" onclick="document.getElementById(\'sm_b_style\').value=\'' . $this->sg->GetDefaultStyle() . '\';">' . __('Use Default','sitemap') . '</a>'; } ?> (<?php _e('Full or relative URL to your .xsl file', 'sitemap') ?>)
719
- </li>
720
- <li>
721
- <label for="sm_b_safemode">
722
- <input type="checkbox" id="sm_b_safemode" name="sm_b_safemode" <?php echo ($this->sg->GetOption("sm_b_safemode")==true?"checked=\"checked\"":""); ?> />
723
- <?php _e('Enable MySQL standard mode. Use this only if you\'re getting MySQL errors. (Needs much more memory!)', 'sitemap') ?>
724
- </label>
725
- </li>
726
- <li>
727
- <label for="sm_b_auto_delay">
728
- <input type="checkbox" id="sm_b_auto_delay" name="sm_b_auto_delay" <?php echo ($this->sg->GetOption("sm_b_auto_delay")==true?"checked=\"checked\"":""); ?> />
729
- <?php _e('Build the sitemap in a background process (You don\'t have to wait when you save a post)', 'sitemap') ?>
730
- </label>
731
- </li>
732
- <li>
733
- <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 />
734
- <input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php echo implode(",",$this->sg->GetOption("sm_b_exclude")); ?>" /></label>
735
- </li>
736
- </ul>
737
- </div>
738
- </div>
739
- </fieldset>
740
- </div>
741
 
742
- <div class="dbx-b-ox-wrapper">
743
- <fieldset id="sm_pages" class="dbx-box">
744
- <div class="dbx-h-andle-wrapper">
745
- <h3 class="dbx-handle"><?php _e('Additional pages', 'sitemap') ?></h3>
746
- </div>
747
- <div class="dbx-c-ontent-wrapper">
748
- <div class="dbx-content">
749
- <?php
750
- _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com','sitemap');
751
- echo "<ul><li>";
752
- echo "<strong>" . __('Note','sitemap'). "</strong>: ";
753
- _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog 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');
754
- echo "</li><li>";
755
- echo "<strong>" . __('URL to the page','sitemap'). "</strong>: ";
756
- _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ",'sitemap');
757
- echo "</li><li>";
758
- echo "<strong>" . __('Priority','sitemap') . "</strong>: ";
759
- _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');
760
- echo "</li><li>";
761
- echo "<strong>" . __('Last Changed','sitemap'). "</strong>: ";
762
- _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).",'sitemap');
763
-
764
- echo "</li></ul>";
765
-
766
-
767
- ?>
768
- <script type="text/javascript">
769
- //<![CDATA[
770
- <?php
771
- $freqVals = "'" . implode("','",array_keys($this->sg->_freqNames)). "'";
772
- $freqNames = "'" . implode("','",array_values($this->sg->_freqNames)). "'";
773
- ?>
774
-
775
- var changeFreqVals = new Array( <?php echo $freqVals; ?> );
776
- var changeFreqNames= new Array( <?php echo $freqNames; ?> );
777
-
778
- var priorities= new Array(0 <?php for($i=0.1; $i<1; $i+=0.1) { echo "," . $i; } ?>);
779
-
780
- var pages = [ <?php
781
- if(count($this->sg->_pages)>0) {
782
- for($i=0; $i<count($this->sg->_pages); $i++) {
783
- $v=&$this->sg->_pages[$i];
784
- if($i>0) echo ",";
785
- echo '{url:"' . $v->getUrl() . '", priority:"' . $v->getPriority() . '", changeFreq:"' . $v->getChangeFreq() . '", lastChanged:"' . ($v!=null && $v->getLastMod()>0?date("Y-m-d",$v->getLastMod()):"") . '"}';
786
- }
787
- }
788
- ?> ];
789
- //]]>
790
- </script>
791
- <script type="text/javascript" src="<?php echo $this->sg->GetPluginUrl(); ?>/img/sitemap.js"></script>
792
- <table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable">
793
- <tr>
794
- <th scope="col"><?php _e('URL to the page','sitemap'); ?></th>
795
- <th scope="col"><?php _e('Priority','sitemap'); ?></th>
796
- <th scope="col"><?php _e('Change Frequency','sitemap'); ?></th>
797
- <th scope="col"><?php _e('Last Changed','sitemap'); ?></th>
798
- <th scope="col"><?php _e('#','sitemap'); ?></th>
799
- </tr>
800
- <?php
801
- if(count($this->sg->_pages)<=0) { ?>
802
- <tr>
803
- <td colspan="5" align="center"><?php _e('No pages defined.','sitemap') ?></td>
804
- </tr><?php
805
- }
806
- ?>
807
- </table>
808
- <a href="javascript:void(0);" onclick="sm_addPage();"><?php _e("Add new page",'sitemap'); ?></a>
809
- </div>
810
- </div>
811
- </fieldset>
812
- </div>
813
-
814
 
815
- <!-- AutoPrio Options -->
816
- <div class="dbx-b-ox-wrapper">
817
- <fieldset id="sm_postprio" class="dbx-box">
818
- <div class="dbx-h-andle-wrapper">
819
- <h3 class="dbx-handle"><?php _e('Post Priority', 'sitemap') ?></h3>
820
- </div>
821
- <div class="dbx-c-ontent-wrapper">
822
- <div class="dbx-content">
823
- <p><?php _e('Please select how the priority of each post should be calculated:', 'sitemap') ?></p>
824
- <ul>
825
- <li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php echo $this->sg->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>
826
- <?php
827
- for($i=0; $i<count($this->sg->_prioProviders); $i++) {
828
- echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_$i\" name=\"sm_b_prio_provider\" value=\"" . $this->sg->_prioProviders[$i] . "\" " . $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"),$this->sg->_prioProviders[$i]) . " /> <label for=\"sm_b_prio_provider_$i\">" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getName')) . "</label><br />" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getDescription')) . "</p></li>";
829
- }
830
- ?>
831
- </ul>
832
- </div>
833
- </div>
834
- </fieldset>
835
- </div>
836
 
837
 
838
- <!-- Location Options -->
839
- <div class="dbx-b-ox-wrapper">
840
- <fieldset id="sm_location" class="dbx-box">
841
- <div class="dbx-h-andle-wrapper">
842
- <h3 class="dbx-handle"><?php _e('Location of your sitemap file', 'sitemap') ?></h3>
843
- </div>
844
- <div class="dbx-c-ontent-wrapper">
845
- <div class="dbx-content">
846
- <div>
847
- <b><label for="sm_location_useauto"><input type="radio" id="sm_location_useauto" name="sm_b_location_mode" value="auto" <?php echo ($this->sg->GetOption("b_location_mode")=="auto"?"checked=\"checked\"":"") ?> /> <?php _e('Automatic detection','sitemap') ?></label></b>
848
- <ul>
849
- <li>
850
- <label for="sm_b_filename">
851
- <?php _e('Filename of the sitemap file', 'sitemap') ?>
852
- <input type="text" id="sm_b_filename" name="sm_b_filename" value="<?php echo $this->sg->GetOption("b_filename"); ?>" />
853
- </label><br />
854
- <?php _e('Detected Path', 'sitemap') ?>: <?php echo $this->sg->getXmlPath(true); ?><br /><?php _e('Detected URL', 'sitemap') ?>: <a href="<?php echo $this->sg->getXmlUrl(true); ?>"><?php echo $this->sg->getXmlUrl(true); ?></a>
855
- </li>
856
- </ul>
857
- </div>
858
- <div>
859
- <b><label for="sm_location_usemanual"><input type="radio" id="sm_location_usemanual" name="sm_b_location_mode" value="manual" <?php echo ($this->sg->GetOption("b_location_mode")=="manual"?"checked=\"checked\"":"") ?> /> <?php _e('Custom location','sitemap') ?></label></b>
860
- <ul>
861
- <li>
862
- <label for="sm_b_filename_manual">
863
- <?php _e('Absolute or relative path to the sitemap file, including name.','sitemap');
864
- echo "<br />";
865
- _e('Example','sitemap');
866
- echo ": /var/www/htdocs/wordpress/sitemap.xml"; ?><br />
867
- <input style="width:70%" type="text" id="sm_b_filename_manual" name="sm_b_filename_manual" value="<?php echo (!$this->sg->GetOption("b_filename_manual")?$this->sg->getXmlPath():$this->sg->GetOption("b_filename_manual")); ?>" />
868
- </label>
869
- </li>
870
- <li>
871
- <label for="sm_b_fileurl_manual">
872
- <?php _e('Complete URL to the sitemap file, including name.','sitemap');
873
- echo "<br />";
874
- _e('Example','sitemap');
875
- echo ": http://www.yourdomain.com/sitemap.xml"; ?><br />
876
- <input style="width:70%" type="text" id="sm_b_fileurl_manual" name="sm_b_fileurl_manual" value="<?php echo (!$this->sg->GetOption("b_fileurl_manual")?$this->sg->getXmlUrl():$this->sg->GetOption("b_fileurl_manual")); ?>" />
877
- </label>
878
- </li>
879
- </ul>
880
- </div>
881
- </div>
882
- </div>
883
- </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
884
  </div>
885
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
886
 
887
- <!-- Includes -->
888
- <div class="dbx-b-ox-wrapper">
889
- <fieldset id="sm_includes" class="dbx-box">
890
- <div class="dbx-h-andle-wrapper">
891
- <h3 class="dbx-handle"><?php _e('Sitemap Content', 'sitemap') ?></h3>
892
- </div>
893
- <div class="dbx-c-ontent-wrapper">
894
- <div class="dbx-content">
895
- <ul>
896
- <li>
897
- <label for="sm_in_home">
898
- <input type="checkbox" id="sm_in_home" name="sm_in_home" <?php echo ($this->sg->GetOption("in_home")==true?"checked=\"checked\"":"") ?> />
899
- <?php _e('Include homepage', 'sitemap') ?>
900
- </label>
901
- </li>
902
- <li>
903
- <label for="sm_in_posts">
904
- <input type="checkbox" id="sm_in_posts" name="sm_in_posts" <?php echo ($this->sg->GetOption("in_posts")==true?"checked=\"checked\"":"") ?> />
905
- <?php _e('Include posts', 'sitemap') ?>
906
- </label>
907
- </li>
908
- <li>
909
- <label for="sm_in_posts_sub">
910
- <input type="checkbox" id="sm_in_posts_sub" name="sm_in_posts_sub" <?php echo ($this->sg->GetOption("in_posts_sub")==true?"checked=\"checked\"":"") ?> />
911
- <?php _e('Include following pages of multi-page posts (&lt;!--nextpage--&gt;)', 'sitemap') ?>
912
- </label>
913
- </li>
914
- <li>
915
- <label for="sm_in_pages">
916
- <input type="checkbox" id="sm_in_pages" name="sm_in_pages" <?php echo ($this->sg->GetOption("in_pages")==true?"checked=\"checked\"":"") ?> />
917
- <?php _e('Include static pages', 'sitemap') ?>
918
- </label>
919
- </li>
920
- <li>
921
- <label for="sm_in_cats">
922
- <input type="checkbox" id="sm_in_cats" name="sm_in_cats" <?php echo ($this->sg->GetOption("in_cats")==true?"checked=\"checked\"":"") ?> />
923
- <?php _e('Include categories', 'sitemap') ?>
924
- </label>
925
- </li>
926
- <li>
927
- <label for="sm_in_arch">
928
- <input type="checkbox" id="sm_in_arch" name="sm_in_arch" <?php echo ($this->sg->GetOption("in_arch")==true?"checked=\"checked\"":"") ?> />
929
- <?php _e('Include archives', 'sitemap') ?>
930
- </label>
931
- </li>
932
- <?php if($this->sg->IsTaxonomySupported()): ?>
933
- <li>
934
- <label for="sm_in_tags">
935
- <input type="checkbox" id="sm_in_tags" name="sm_in_tags" <?php echo ($this->sg->GetOption("in_tags")==true?"checked=\"checked\"":"") ?> />
936
- <?php _e('Include tag pages', 'sitemap') ?>
937
- </label>
938
- </li>
939
- <?php endif; ?>
940
- <li>
941
- <label for="sm_in_auth">
942
- <input type="checkbox" id="sm_in_auth" name="sm_in_auth" <?php echo ($this->sg->GetOption("in_auth")==true?"checked=\"checked\"":"") ?> />
943
- <?php _e('Include author pages', 'sitemap') ?>
944
- </label>
945
- </li>
946
- </ul>
947
- </div>
948
- </div>
949
- </fieldset>
950
  </div>
 
 
 
951
 
952
-
953
- <!-- Change frequencies -->
954
- <div class="dbx-b-ox-wrapper">
955
- <fieldset id="sm_change_frequencies" class="dbx-box">
956
- <div class="dbx-h-andle-wrapper">
957
- <h3 class="dbx-handle"><?php _e('Change frequencies', 'sitemap') ?></h3>
958
- </div>
959
- <div class="dbx-c-ontent-wrapper">
960
- <div class="dbx-content">
961
- <p>
962
- <b><?php _e('Note', 'sitemap') ?>:</b>
963
- <?php _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap') ?>
964
- </p>
965
- <ul>
966
- <li>
967
- <label for="sm_cf_home">
968
- <select id="sm_cf_home" name="sm_cf_home"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_home")); ?></select>
969
- <?php _e('Homepage', 'sitemap') ?>
970
- </label>
971
- </li>
972
- <li>
973
- <label for="sm_cf_posts">
974
- <select id="sm_cf_posts" name="sm_cf_posts"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_posts")); ?></select>
975
- <?php _e('Posts', 'sitemap') ?>
976
- </label>
977
- </li>
978
- <li>
979
- <label for="sm_cf_pages">
980
- <select id="sm_cf_pages" name="sm_cf_pages"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_pages")); ?></select>
981
- <?php _e('Static pages', 'sitemap') ?>
982
- </label>
983
- </li>
984
- <li>
985
- <label for="sm_cf_cats">
986
- <select id="sm_cf_cats" name="sm_cf_cats"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_cats")); ?></select>
987
- <?php _e('Categories', 'sitemap') ?>
988
- </label>
989
- </li>
990
- <li>
991
- <label for="sm_cf_arch_curr">
992
- <select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr")); ?></select>
993
- <?php _e('The current archive of this month (Should be the same like your homepage)', 'sitemap') ?>
994
- </label>
995
- </li>
996
- <li>
997
- <label for="sm_cf_arch_old">
998
- <select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old")); ?></select>
999
- <?php _e('Older archives (Changes only if you edit an old post)', 'sitemap') ?>
1000
- </label>
1001
- </li>
1002
- <?php if($this->sg->IsTaxonomySupported()): ?>
1003
- <li>
1004
- <label for="sm_cf_tags">
1005
- <select id="sm_cf_tags" name="sm_cf_tags"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_tags")); ?></select>
1006
- <?php _e('Tag pages', 'sitemap') ?>
1007
- </label>
1008
- </li>
1009
- <?php endif; ?>
1010
- <li>
1011
- <label for="sm_cf_auth">
1012
- <select id="sm_cf_auth" name="sm_cf_auth"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_auth")); ?></select>
1013
- <?php _e('Author pages', 'sitemap') ?>
1014
- </label>
1015
- </li>
1016
- </ul>
1017
- </div>
1018
- </div>
1019
- </fieldset>
1020
  </div>
1021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
 
1023
- <!-- Priorities -->
1024
- <div class="dbx-b-ox-wrapper">
1025
- <fieldset id="sm_priorities" class="dbx-box">
1026
- <div class="dbx-h-andle-wrapper">
1027
- <h3 class="dbx-handle"><?php _e('Priorities', 'sitemap') ?></h3>
1028
- </div>
1029
- <div class="dbx-c-ontent-wrapper">
1030
- <div class="dbx-content">
1031
- <ul>
1032
- <li>
1033
- <label for="sm_pr_home">
1034
- <select id="sm_pr_home" name="sm_pr_home"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_home")); ?></select>
1035
- <?php _e('Homepage', 'sitemap') ?>
1036
- </label>
1037
- </li>
1038
- <li>
1039
- <label for="sm_pr_posts">
1040
- <select id="sm_pr_posts" name="sm_pr_posts"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts")); ?></select>
1041
- <?php _e('Posts (If auto calculation is disabled)', 'sitemap') ?>
1042
- </label>
1043
- </li>
1044
- <li>
1045
- <label for="sm_pr_posts_min">
1046
- <select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min")); ?></select>
1047
- <?php _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap') ?>
1048
- </label>
1049
- </li>
1050
- <li>
1051
- <label for="sm_pr_pages">
1052
- <select id="sm_pr_pages" name="sm_pr_pages"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_pages")); ?></select>
1053
- <?php _e('Static pages', 'sitemap'); ?>
1054
- </label>
1055
- </li>
1056
- <li>
1057
- <label for="sm_pr_cats">
1058
- <select id="sm_pr_cats" name="sm_pr_cats"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_cats")); ?></select>
1059
- <?php _e('Categories', 'sitemap') ?>
1060
- </label>
1061
- </li>
1062
- <li>
1063
- <label for="sm_pr_arch">
1064
- <select id="sm_pr_arch" name="sm_pr_arch"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_arch")); ?></select>
1065
- <?php _e('Archives', 'sitemap') ?>
1066
- </label>
1067
- </li>
1068
- <?php if($this->sg->IsTaxonomySupported()): ?>
1069
- <li>
1070
- <label for="sm_pr_tags">
1071
- <select id="sm_pr_tags" name="sm_pr_tags"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_tags")); ?></select>
1072
- <?php _e('Tag pages', 'sitemap') ?>
1073
- </label>
1074
- </li>
1075
- <?php endif; ?>
1076
- <li>
1077
- <label for="sm_pr_auth">
1078
- <select id="sm_pr_auth" name="sm_pr_auth"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_auth")); ?></select>
1079
- <?php _e('Author pages', 'sitemap') ?>
1080
- </label>
1081
- </li>
1082
- </ul>
1083
- </div>
1084
- </div>
1085
- </fieldset>
1086
- </div>
1087
  </div>
1088
  <div>
1089
  <p class="submit">
@@ -1092,6 +1129,11 @@ class GoogleSitemapGeneratorUI {
1092
  <input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php _e('Reset options', 'sitemap'); ?>" />
1093
  </p>
1094
  </div>
 
 
 
 
 
1095
  </div>
1096
  <script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script>
1097
  </form>
@@ -1104,6 +1146,7 @@ class GoogleSitemapGeneratorUI {
1104
  <input type="hidden" name="item_number" value="0001" />
1105
  <input type="hidden" name="currency_code" value="USD" />
1106
  <input type="hidden" name="bn" value="PP-BuyNowBF" />
 
1107
  <input type="hidden" name="rm" value="2" />
1108
  <input type="hidden" name="on0" value="Your Website" />
1109
  <input type="hidden" name="os0" value="<?php echo get_bloginfo("home"); ?>"/>
1
  <?php
2
  /*
3
 
4
+ $Id: sitemap-ui.php 81068 2008-12-19 04:05:57Z arnee $
5
 
6
  */
7
 
8
  class GoogleSitemapGeneratorUI {
9
 
10
  var $sg = null;
11
+
12
+ var $mode = 21;
13
 
14
  function GoogleSitemapGeneratorUI($sitemapBuilder) {
15
+ global $wp_version;
16
+ $this->sg = $sitemapBuilder;
17
+
18
+ if(floatval($wp_version) >= 2.7) {
19
+ $this->mode = 27;
20
+ }
21
+ }
22
+
23
+ function HtmlRegScripts() {
24
+
25
+
26
+ }
27
+
28
+ function HtmlPrintBoxHeader($id, $title, $right = false) {
29
+ if($this->mode == 27) {
30
+ ?>
31
+ <div id="<?php echo $id; ?>" class="postbox">
32
+ <h3 class="hndle"><span><?php echo $title ?></span></h3>
33
+ <div class="inside">
34
+ <?php
35
+ } else {
36
+ ?>
37
+ <fieldset id="<?php echo $id; ?>" class="dbx-box">
38
+ <?php if(!$right): ?><div class="dbx-h-andle-wrapper"><?php endif; ?>
39
+ <h3 class="dbx-handle"><?php echo $title ?></h3>
40
+ <?php if(!$right): ?></div><?php endif; ?>
41
+
42
+ <?php if(!$right): ?><div class="dbx-c-ontent-wrapper"><?php endif; ?>
43
+ <div class="dbx-content">
44
+ <?php
45
+ }
46
+ }
47
+
48
+ function HtmlPrintBoxFooter( $right = false) {
49
+ if($this->mode == 27) {
50
+ ?>
51
+ </div>
52
+ </div>
53
+ <?php
54
+ } else {
55
+ ?>
56
+ <?php if(!$right): ?></div><?php endif; ?>
57
+ </div>
58
+ </fieldset>
59
+ <?php
60
+ }
61
  }
62
 
63
  /**
76
 
77
  if(isset($_GET['sm_hidedonate'])) {
78
  $this->sg->SetOption('i_hide_donated',true);
79
+ $this->sg->SaveOptions();
80
  }
81
  if(isset($_GET['sm_donated'])) {
82
  $this->sg->SetOption('i_donated',true);
83
+ $this->sg->SaveOptions();
84
  }
85
  if(isset($_GET['sm_hide_note'])) {
86
  $this->sg->SetOption('i_hide_note',true);
87
+ $this->sg->SaveOptions();
88
  }
89
  if(isset($_GET['sm_hidedonors'])) {
90
  $this->sg->SetOption('i_hide_donors',true);
91
+ $this->sg->SaveOptions();
92
  }
93
 
94
  if(isset($_GET['sm_donated']) || ($this->sg->GetOption('i_donated')===true && $this->sg->GetOption('i_hide_donated')!==true)) {
96
  <div class="updated">
97
  <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>
98
  </div>
99
+ <?php
100
  } 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))) {
101
  ?>
102
  <div class="updated">
103
  <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 your are satisfied with the results, isn\'t it worth at least one dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>','sitemap')); ?> <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>
104
  <div style="clear:right;"></div>
105
  </div>
106
+ <?php
107
+ }
108
 
109
  if(function_exists("wp_next_scheduled")) {
110
  $next = wp_next_scheduled('sm_build_cron');
113
  if($diff <= 0) {
114
  $diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!','sitemap');
115
  } else {
116
+ $diffMsg = str_replace("%s",$diff,__('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!','sitemap'));
117
  }
118
  ?>
119
  <div class="updated">
120
  <strong><p><?php echo $diffMsg ?></p></strong>
121
  <div style="clear:right;"></div>
122
  </div>
123
+ <?php
124
  }
125
  }
126
 
130
 
131
  //Check again, just for the case that something went wrong before
132
  if(!current_user_can("administrator")) {
133
+ echo '<p>Please log in as admin</p>';
134
  return;
135
  }
136
 
165
  echo "<pre>";
166
  print_r($this->sg->_options);
167
  echo "</pre>";
168
+ echo '<h3>Errors, Warnings, Notices</h3>';
169
  echo '<div>';
170
  $status = $this->sg->BuildSitemap();
171
  echo '</div>';
177
 
178
  $total = 0;
179
  foreach($GLOBALS['wpdb']->queries as $q) {
180
+ $total+=$q[1];
181
  }
182
  echo '<h4>Total Query Time</h4>';
183
  echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total,2) . ' seconds.</pre>';
184
  } else {
185
+ echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>';
186
  }
187
  echo "<h3>Build Process Results</h3>";
188
  echo "<pre>";
203
  echo '<noscript><a href="' . $this->sg->GetBackLink() . '">Click here to continue</a></noscript>';
204
  exit;
205
  }
206
+ } else if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config
207
  check_admin_referer('sitemap');
208
  foreach($this->sg->_options as $k=>$v) {
209
  //Check vor values and convert them into their types, based on the category they are in
214
  if($k=="sm_b_filename_manual" && strpos($_POST[$k],"\\")!==false){
215
  $_POST[$k]=stripslashes($_POST[$k]);
216
  }
217
+
218
  $this->sg->_options[$k]=(string) $_POST[$k];
219
  } else if($k=="sm_b_location_mode") {
220
  $tmp=(string) $_POST[$k];
230
  $IDss = array();
231
  $IDs = explode(",",$_POST[$k]);
232
  for($x = 0; $x<count($IDs); $x++) {
233
+ $ID = intval(trim($IDs[$x]));
234
  if($ID>0) $IDss[] = $ID;
235
  }
236
  $this->sg->_options[$k] = $IDss;
237
+ } else if($k == "sm_b_exclude_cats") {
238
+
239
+ $exCats = array();
240
+ foreach((array) $_POST["post_category"] AS $vv) {
241
+ if(!empty($vv) && is_numeric($vv)) $exCats[] = intval($vv);
242
+ }
243
+ $this->sg->_options[$k] = $exCats;
244
  } else {
245
+ $this->sg->_options[$k]=(bool) $_POST[$k];
246
+
247
+ if($k == "sm_b_auto_delay" && $this->sg->_options[$k] == false) {
248
+ //If cron doesn't work and the user disables it, clear any remaining hooks
249
+ wp_clear_scheduled_hook('sm_build_cron');
250
+ }
251
  }
252
  //Options of the category "Includes" are boolean
253
  } else if(substr($k,0,6)=="sm_in_") {
254
+ $this->sg->_options[$k]=(bool) $_POST[$k];
255
  //Options of the category "Change frequencies" are string
256
  } else if(substr($k,0,6)=="sm_cf_") {
257
+ $this->sg->_options[$k]=(string) $_POST[$k];
258
  //Options of the category "Priorities" are float
259
  } else if(substr($k,0,6)=="sm_pr_") {
260
+ $this->sg->_options[$k]=(float) $_POST[$k];
261
  }
262
  }
263
 
272
 
273
  if($this->sg->GetOption('sm_b_robots')===true) {
274
  if($this->sg->WriteRobotsFile()) {
275
+ $message.=str_replace("%s",$this->sg->GetRobotsFileUrl(),__("<a href=\"%s\">Robots.txt</a> file saved",'sitemap')) . "<br />";
276
  } else {
277
+ $message.=__("Error while saving Robots.txt file",'sitemap') . "<br />";
278
+ }
279
  }
280
 
281
  } else if(!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config
319
  display:block;
320
  padding-left:25px;
321
  background-repeat:no-repeat;
322
+ background-position:5px 50%;
323
  text-decoration:none;
324
  border:none;
325
  }
329
  }
330
 
331
  a.sm_donatePayPal {
332
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-paypal.gif);
333
  }
334
 
335
  a.sm_donateAmazon {
336
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-amazon.gif);
337
  }
338
 
339
  a.sm_pluginHome {
340
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-arne.gif);
341
  }
342
 
343
  a.sm_pluginList {
344
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-email.gif);
345
  }
346
 
347
  a.sm_pluginSupport {
348
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-wordpress.gif);
349
  }
350
 
351
  a.sm_pluginBugs {
352
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-trac.gif);
353
  }
354
 
355
  a.sm_resGoogle {
356
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-google.gif);
357
  }
358
 
359
  a.sm_resYahoo {
360
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-yahoo.gif);
361
  }
362
 
363
  a.sm_resLive {
364
+ background-image:url(<?php echo $this->sg->GetPluginUrl(); ?>img/icon-live.gif);
365
  }
366
 
367
  div.sm-update-nag p {
368
  margin:5px;
369
+ }
370
 
371
  </style>
372
 
373
  <?php
374
+ if($this->mode == 27): ?>
 
375
  <style type="text/css">
376
+
377
+ .sm-padded .inside {
378
+ margin:12px!important;
379
+ }
380
+ .sm-padded .inside ul {
381
+ margin:6px 0 12px 0;
382
+ }
383
+
384
+ .sm-padded .inside input {
385
+ padding:1px;
386
+ margin:0;
387
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  </style>
389
+
390
+ <?php elseif(version_compare($wp_version,"2.5",">=")): ?>
391
+ <style type="text/css">
392
+ div#moremeta {
393
+ float:right;
394
+ width:200px;
395
+ margin-left:10px;
396
+ }
397
+ div#advancedstuff {
398
+ width:770px;
399
+ }
400
+ div#poststuff {
401
+ margin-top:10px;
402
+ }
403
+ fieldset.dbx-box {
404
+ margin-bottom:5px;
405
+ }
406
+
407
+ div.sm-update-nag {
408
+ margin-top:10px!important;
409
+ }
410
+ </style>
411
+ <!--[if lt IE 7]>
412
+ <style type="text/css">
413
+ div#advancedstuff {
414
+ width:735px;
415
+ }
416
+ </style>
417
+ <![endif]-->
418
+
419
+ <?php else: ?>
420
+ <style type="text/css">
421
+ div.updated-message {
422
+ margin-left:0; margin-right:0;
423
+ }
424
+ </style>
425
+ <?php endif;
426
  ?>
427
 
 
 
 
 
428
  <div class="wrap" id="sm_div">
429
  <form method="post" action="<?php echo $this->sg->GetBackLink() ?>">
430
  <h2><?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this->sg->GetVersion() ?> </h2>
431
+ <?php
432
  if(function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
433
  wp_update_plugins();
434
 
447
  printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.','default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin=$file", 'upgrade-plugin_' . $file) );
448
 
449
  ?></div><?php
450
+ }
451
  }
452
  ?>
453
 
497
  </script>
498
  <?php endif; ?>
499
 
500
+ <?php if($this->mode == 27): ?>
501
+ <div id="poststuff" class="metabox-holder">
502
+ <div class="inner-sidebar">
503
+ <div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
504
+ <?php else: ?>
505
  <div id="poststuff">
506
  <div id="moremeta">
507
  <div id="grabit" class="dbx-group">
508
+ <?php endif; ?>
509
+
510
+ <?php $this->HtmlPrintBoxHeader('sm_pnres',__('About this Plugin:','sitemap'),true); ?>
511
+ <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-home'); ?>"><?php _e('Plugin Homepage','sitemap'); ?></a>
512
+ <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-feedback'); ?>"><?php _e('Suggest a Feature','sitemap'); ?></a>
513
+ <a class="sm_button sm_pluginList" href="<?php echo $this->sg->GetRedirectLink('sitemap-list'); ?>"><?php _e('Notify List','sitemap'); ?></a>
514
+ <a class="sm_button sm_pluginSupport" href="<?php echo $this->sg->GetRedirectLink('sitemap-support'); ?>"><?php _e('Support Forum','sitemap'); ?></a>
515
+ <a class="sm_button sm_pluginBugs" href="<?php echo $this->sg->GetRedirectLink('sitemap-bugs'); ?>"><?php _e('Report a Bug','sitemap'); ?></a>
516
+
517
+ <a class="sm_button sm_donatePayPal" href="<?php echo $this->sg->GetRedirectLink('sitemap-paypal'); ?>"><?php _e('Donate with PayPal','sitemap'); ?></a>
518
+ <a class="sm_button sm_donateAmazon" href="<?php echo $this->sg->GetRedirectLink('sitemap-amazon'); ?>"><?php _e('My Amazon Wish List','sitemap'); ?></a>
519
+ <?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 } ?>
520
+ <?php $this->HtmlPrintBoxFooter(true); ?>
521
+
522
+ <?php $this->HtmlPrintBoxHeader('sm_smres',__('Sitemap Resources:','sitemap'),true); ?>
523
+ <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwt'); ?>"><?php _e('Webmaster Tools','sitemap'); ?></a>
524
+ <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-gwb'); ?>"><?php _e('Webmaster Blog','sitemap'); ?></a>
525
+
526
+ <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-yse'); ?>"><?php _e('Site Explorer','sitemap'); ?></a>
527
+ <a class="sm_button sm_resYahoo" href="<?php echo $this->sg->GetRedirectLink('sitemap-ywb'); ?>"><?php _e('Search Blog','sitemap'); ?></a>
528
+
529
+ <a class="sm_button sm_resLive" href="<?php echo $this->sg->GetRedirectLink('sitemap-lwt'); ?>"><?php _e('Webmaster Tools','sitemap'); ?></a>
530
+ <a class="sm_button sm_resLive" href="<?php echo $this->sg->GetRedirectLink('sitemap-lswcb'); ?>"><?php _e('Webmaster Center Blog','sitemap'); ?></a>
531
+ <br />
532
+ <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-prot'); ?>"><?php _e('Sitemaps Protocol','sitemap'); ?></a>
533
+ <a class="sm_button sm_resGoogle" href="<?php echo $this->sg->GetRedirectLink('sitemap-ofaq'); ?>"><?php _e('Official Sitemaps FAQ','sitemap'); ?></a>
534
+ <a class="sm_button sm_pluginHome" href="<?php echo $this->sg->GetRedirectLink('sitemap-afaq'); ?>"><?php _e('My Sitemaps FAQ','sitemap'); ?></a>
535
+ <?php $this->HtmlPrintBoxFooter(true); ?>
536
+
537
+ <?php $this->HtmlPrintBoxHeader('dm_donations',__('Recent Donations:','sitemap'),true); ?>
538
+
539
+ <?php if($this->sg->GetOption('i_hide_donors')!==true) { ?>
540
+ <iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php echo $this->sg->GetRedirectLink('sitemap-donorlist'); ?>">
541
+ <?php _e('List of the donors','sitemap'); ?>
542
+ </iframe><br />
543
+ <a href="<?php echo $this->sg->GetBackLink() . "&amp;sm_hidedonors=true"; ?>"><small><?php _e('Hide this list','sitemap'); ?></small></a><br /><br />
544
+ <?php } ?>
545
+ <a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php echo $this->sg->GetPluginUrl(); ?>img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a>
546
+ <span><small><?php _e('Thanks for your support!','sitemap'); ?></small></span>
547
+ <div style="clear:left; height:1px;"></div>
548
+ <?php $this->HtmlPrintBoxFooter(true); ?>
549
+
 
 
 
550
  </div>
551
  </div>
552
 
553
+ <?php if($this->mode == 27): ?>
554
+ <div class="has-sidebar sm-padded" >
555
 
556
+ <div id="post-body-content" class="has-sidebar-content">
557
+
558
+ <div class="meta-box-sortabless">
559
+ <?php else: ?>
560
+ <div id="advancedstuff" class="dbx-group" >
561
+ <?php endif; ?>
 
 
 
 
562
 
563
+ <!-- Rebuild Area -->
564
+ <?php $this->HtmlPrintBoxHeader('sm_rebuild',__('Status', 'sitemap')); ?>
565
+ <ul>
566
+ <?php
567
+
568
+ //#type $status GoogleSitemapGeneratorStatus
569
+ $status = GoogleSitemapGeneratorStatus::Load();
570
+ if($status == null) {
571
+
572
+ echo "<li>" . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true",'sitemap'),__('The sitemap wasn\'t built yet. <a href="%s">Click here</a> to build it the first time.','sitemap')) . "</li>";
573
+ } else {
574
+ if($status->_endTime !== 0) {
575
+ if($status->_usedXml) {
576
+ if($status->_xmlSuccess) {
577
+ $ft = filemtime($status->_xmlPath);
578
+ echo "<li>" . str_replace("%url%",$status->_xmlUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your <a href=\"%url%\">sitemap</a> was last built on <b>%date%</b>.",'sitemap'))) . "</li>";
579
+ } else {
580
+ echo "<li class=\"sm_error\">" . str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-files'),__("There was a problem writing your sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a",'sitemap')) . "</li>";
581
+ }
582
+ }
583
+
584
+ if($status->_usedZip) {
585
+ if($status->_zipSuccess) {
586
+ $ft = filemtime($status->_zipPath);
587
+ echo "<li>" . str_replace("%url%",$status->_zipUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your sitemap (<a href=\"%url%\">zipped</a>) was last built on <b>%date%</b>.",'sitemap'))) . "</li>";
588
+ } else {
589
+ echo "<li class=\"sm_error\">" . str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-files'),__("There was a problem writing your zipped sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a",'sitemap')) . "</li>";
590
+ }
591
+ }
592
+
593
+ if($status->_usedGoogle) {
594
+ if($status->_gooogleSuccess) {
595
+ echo "<li>" .__("Google was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
596
+ $gt = $status->GetGoogleTime();
597
+ if($gt>4) {
598
+ echo "<li class=\sm_optimize\">" . str_replace("%time%",$gt,__("It took %time% seconds to notify Google, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  }
600
+ } else {
601
+ echo "<li class=\"sm_error\">" . str_replace("%s",$status->_googleUrl,__('There was a problem while notifying Google. <a href="%s">View result</a>','sitemap')) . "</li>";
602
+ }
603
+ }
604
+
605
+ if($status->_usedYahoo) {
606
+ if($status->_yahooSuccess) {
607
+ echo "<li>" .__("YAHOO was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
608
+ $yt = $status->GetYahooTime();
609
+ if($yt>4) {
610
+ echo "<li class=\sm_optimize\">" . str_replace("%time%",$yt,__("It took %time% seconds to notify YAHOO, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
611
+ }
612
+ } else {
613
+ echo "<li class=\"sm_error\">" . str_replace("%s",$status->_yahooUrl,__('There was a problem while notifying YAHOO. <a href="%s">View result</a>','sitemap')) . "</li>";
614
+ }
615
+ }
616
+
617
+ if($status->_usedMsn) {
618
+ if($status->_msnSuccess) {
619
+ echo "<li>" .__("MSN was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
620
+ $at = $status->GetMsnTime();
621
+ if($at>4) {
622
+ echo "<li class=\sm_optimize\">" . str_replace("%time%",$at,__("It took %time% seconds to notify MSN.com, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
623
+ }
624
+ } else {
625
+ echo "<li class=\"sm_error\">" . str_replace("%s",$status->_msnUrl,__('There was a problem while notifying MSN.com. <a href="%s">View result</a>','sitemap')) . "</li>";
626
+ }
627
+ }
628
+
629
+ if($status->_usedAsk) {
630
+ if($status->_askSuccess) {
631
+ echo "<li>" .__("Ask.com was <b>successfully notified</b> about changes.",'sitemap'). "</li>";
632
+ $at = $status->GetAskTime();
633
+ if($at>4) {
634
+ echo "<li class=\sm_optimize\">" . str_replace("%time%",$at,__("It took %time% seconds to notify Ask.com, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "</li>";
635
+ }
636
+ } else {
637
+ echo "<li class=\"sm_error\">" . str_replace("%s",$status->_askUrl,__('There was a problem while notifying Ask.com. <a href="%s">View result</a>','sitemap')) . "</li>";
638
+ }
639
+ }
640
+
641
+ $et = $status->GetTime();
642
+ $mem = $status->GetMemoryUsage();
643
+
644
+ if($mem > 0) {
645
+ echo "<li>" .str_replace(array("%time%","%memory%"),array($et,$mem),__("The building process took about <b>%time% seconds</b> to complete and used %memory% MB of memory.",'sitemap')). "</li>";
646
+ } else {
647
+ echo "<li>" .str_replace("%time%",$et,__("The building process took about <b>%time% seconds</b> to complete.",'sitemap')). "</li>";
648
+ }
649
+
650
+ if(!$status->_hasChanged) {
651
+ echo "<li>" . __("The content of your sitemap <strong>didn't change</strong> since the last time so the files were not written and no search engine was pinged.",'sitemap'). "</li>";
652
+ }
653
+
654
+ } else {
655
+ if($this->sg->GetOption("sm_b_auto_delay")) {
656
+ $st = ($status->GetStartTime() - time()) * -1;
657
+ //If the building process runs in background and was started within the last 45 seconds, the sitemap might not be completed yet...
658
+ if($st < 45) {
659
+ echo '<li class="">'. __("The building process might still be active! Reload the page in a few seconds and check if something has changed.",'sitemap') . '</li>';
660
+ }
661
+ }
662
+ echo '<li class="sm_error">'. str_replace("%url%",$this->sg->GetRedirectLink('sitemap-help-memtime'),__("The last run didn't finish! Maybe you can raise the memory or time limit for PHP scripts. <a href=\"%url%\">Learn more</a>",'sitemap')) . '</li>';
663
+ if($status->_memoryUsage > 0) {
664
+ echo '<li class="sm_error">'. str_replace(array("%memused%","%memlimit%"),array($status->GetMemoryUsage(),ini_get('memory_limit')),__("The last known memory usage of the script was %memused%MB, the limit of your server is %memlimit%.",'sitemap')) . '</li>';
665
+ }
666
+
667
+ if($status->_lastTime > 0) {
668
+ echo '<li class="sm_error">'. str_replace(array("%timeused%","%timelimit%"),array($status->GetLastTime(),ini_get('max_execution_time')),__("The last known execution time of the script was %timeused% seconds, the limit of your server is %timelimit% seconds.",'sitemap')) . '</li>';
669
+ }
670
+
671
+ if($status->GetLastPost() > 0) {
672
+ echo '<li class="sm_optimize">'. str_replace("%lastpost%",$status->GetLastPost(),__("The script stopped around post number %lastpost% (+/- 100)",'sitemap')) . '</li>';
673
+ }
674
+ }
675
+ echo "<li>" . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true",'sitemap'),__('If you changed something on your server or blog, you should <a href="%s">rebuild the sitemap</a> manually.','sitemap')) . "</li>";
676
+ }
677
+ 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 the build process you can use the <a href="%d">debug function</a> to get more information.','sitemap')) . "</li>";
678
+ ?>
679
+
680
+ </ul>
681
+ <?php $this->HtmlPrintBoxFooter(); ?>
682
 
683
+ <!-- Basic Options -->
684
+ <?php $this->HtmlPrintBoxHeader('sm_basic_options',__('Basic Options', 'sitemap')); ?>
685
+
686
+ <b><?php _e('Sitemap files:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-files'); ?>"><?php _e('Learn more','sitemap'); ?></a>
687
+ <ul>
688
+ <li>
689
+ <label for="sm_b_xml">
690
+ <input type="checkbox" id="sm_b_xml" name="sm_b_xml" <?php echo ($this->sg->GetOption("b_xml")==true?"checked=\"checked\"":"") ?> />
691
+ <?php _e('Write a normal XML file (your filename)', 'sitemap') ?>
692
+ </label>
693
+ </li>
694
+ <li>
695
+ <label for="sm_b_gzip">
696
+ <input type="checkbox" id="sm_b_gzip" name="sm_b_gzip" <?php if(function_exists("gzencode")) { echo ($this->sg->GetOption("b_gzip")==true?"checked=\"checked\"":""); } else echo "disabled=\"disabled\""; ?> />
697
+ <?php _e('Write a gzipped file (your filename + .gz)', 'sitemap') ?>
698
+ </label>
699
+ </li>
700
+ </ul>
701
+ <b><?php _e('Building mode:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-process'); ?>"><?php _e('Learn more','sitemap'); ?></a>
702
+ <ul>
703
+ <li>
704
+ <label for="sm_b_auto_enabled">
705
+ <input type="checkbox" id="sm_b_auto_enabled" name="sm_b_auto_enabled" <?php echo ($this->sg->GetOption("sm_b_auto_enabled")==true?"checked=\"checked\"":""); ?> />
706
+ <?php _e('Rebuild sitemap if you change the content of your blog', 'sitemap') ?>
707
+ </label>
708
+ </li>
709
+ <li>
710
+ <label for="sm_b_manual_enabled">
711
+ <input type="hidden" name="sm_b_manual_key" value="<?php echo $this->sg->GetOption("b_manual_key"); ?>" />
712
+ <input type="checkbox" id="sm_b_manual_enabled" name="sm_b_manual_enabled" <?php echo ($this->sg->GetOption("b_manual_enabled")==true?"checked=\"checked\"":"") ?> />
713
+ <?php _e('Enable manual sitemap building via GET Request', 'sitemap') ?>
714
+ </label>
715
+ <a href="javascript:void(document.getElementById('sm_manual_help').style.display='');">[?]</a>
716
+ <span id="sm_manual_help" style="display:none;"><br />
717
+ <?php echo str_replace("%1",trailingslashit(get_bloginfo('siteurl')) . "?sm_command=build&amp;sm_key=" . $this->sg->GetOption("b_manual_key"),__('This will allow you to refresh your sitemap if an external tool wrote into the WordPress database without using the WordPress API. Use the following URL to start the process: <a href="%1">%1</a> Please check the logfile above to see if sitemap was successfully built.', 'sitemap')); ?>
718
+ </span>
719
+ </li>
720
+ </ul>
721
+ <b><?php _e('Update notification:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-ping'); ?>"><?php _e('Learn more','sitemap'); ?></a>
722
+ <ul>
723
+ <li>
724
+ <input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php echo ($this->sg->GetOption("b_ping")==true?"checked=\"checked\"":"") ?> />
725
+ <label for="sm_b_ping"><?php _e('Notify Google about updates of your Blog', 'sitemap') ?></label><br />
726
+ <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-gwt'),__('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
727
+ </li>
728
+ <li>
729
+ <input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php echo ($this->sg->GetOption("b_pingmsn")==true?"checked=\"checked\"":"") ?> />
730
+ <label for="sm_b_pingmsn"><?php _e('Notify MSN Live Search about updates of your Blog', 'sitemap') ?></label><br />
731
+ <small><?php echo str_replace("%s",$this->sg->GetRedirectLink('sitemap-lwt'),__('No registration required, but you can join the <a href="%s">MSN Live Webmaster Tools</a> to check crawling statistics.','sitemap')); ?></small>
732
+ </li>
733
+ <li>
734
+ <input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php echo ($this->sg->GetOption("b_pingask")==true?"checked=\"checked\"":"") ?> />
735
+ <label for="sm_b_pingask"><?php _e('Notify Ask.com about updates of your Blog', 'sitemap') ?></label><br />
736
+ <small><?php _e('No registration required.','sitemap'); ?></small>
737
+ </li>
738
+ <li>
739
+ <input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php echo ($this->sg->GetOption("sm_b_pingyahoo")==true?"checked=\"checked\"":"") ?> />
740
+ <label for="sm_b_pingyahoo"><?php _e('Notify YAHOO about updates of your Blog', 'sitemap') ?></label><br />
741
+ <label for="sm_b_yahookey"><?php _e('Your Application ID:', 'sitemap') ?> <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php echo $this->sg->GetOption("sm_b_yahookey"); ?>" /></label><br />
742
+ <small><?php echo str_replace(array("%s1","%s2"),array($this->sg->GetRedirectLink('sitemap-ykr'),' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'),__('Don\'t you have such a key? <a href="%s1">Request one here</a>! %s2','sitemap')); ?></small>
 
 
 
 
 
743
 
744
+
745
+ </li>
746
+ <li>
747
+
748
+ <input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php echo ($this->sg->GetOption("sm_b_robots")==true?"checked=\"checked\"":"") ?> />
749
+ <?php echo str_replace('%s',(file_exists($this->sg->GetRobotsFilePath())?'<a href="' . $this->sg->GetRobotsFileUrl() . '">robots.txt</a>':'robots.txt'),__("Modify or create %s file in blog root which contains the sitemap location.",'sitemap')); ?>
750
 
751
+ <br />
752
+ <?php _e("File permissions: ",'sitemap');
753
+ $f = $this->sg->GetRobotsFilePath();
754
+ $link = ' <a href="' . $this->sg->GetRedirectLink("sitemap-help-options-robots",'sitemap') . '">' . __("Learn more",'sitemap') . '</a>';
755
+ if(file_exists($f)) {
756
+ if(is_writable($f)) {
757
+ _e("OK, robots.txt is writable.",'sitemap');
758
+ } else {
759
+ echo __("Error, robots.txt is not writable.",'sitemap') . $link;
760
+ }
761
+ } else {
762
+ if(is_writable(dirname($f))) {
763
+ _e("OK, robots.txt doesn't exist but the directory is writable.",'sitemap');
764
+ } else {
765
+ echo __("Error, robots.txt doesn't exist and the directory is not writable",'sitemap') . $link;
766
+ }
767
+ }
768
+ ?>
769
+ </li>
770
+ </ul>
771
+ <b><?php _e('Advanced options:','sitemap'); ?></b> <a href="<?php echo $this->sg->GetRedirectLink('sitemap-help-options-adv'); ?>"><?php _e('Learn more','sitemap'); ?></a>
772
+ <ul>
773
+ <li>
774
+ <label for="sm_b_max_posts"><?php _e('Limit the number of posts in the sitemap:', 'sitemap') ?> <input type="text" name="sm_b_max_posts" id="sm_b_max_posts" style="width:40px;" value="<?php echo ($this->sg->GetOption("sm_b_max_posts")<=0?"":$this->sg->GetOption("sm_b_max_posts")); ?>" /></label> (<?php echo __('Newer posts will be included first', 'sitemap'); ?>)
775
+ </li>
776
+ <li>
777
+ <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 $this->sg->GetOption("sm_b_memory"); ?>" /></label> (<?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?>)
778
+ </li>
779
+ <li>
780
+ <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 ($this->sg->GetOption("sm_b_time")===-1?'':$this->sg->GetOption("sm_b_time")); ?>" /></label> (<?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')) ?>)
781
+ </li>
782
+ <li>
783
+ <label for="sm_b_style"><?php _e('Include a XSLT stylesheet:', 'sitemap') ?> <input type="text" name="sm_b_style" id="sm_b_style" value="<?php echo $this->sg->GetOption("sm_b_style"); ?>" /></label> <?php if($this->sg->GetDefaultStyle()) { echo ' <a href="javascript:void(0);" onclick="document.getElementById(\'sm_b_style\').value=\'' . $this->sg->GetDefaultStyle() . '\';">' . __('Use Default','sitemap') . '</a>'; } ?> (<?php _e('Full or relative URL to your .xsl file', 'sitemap') ?>)
784
+ </li>
785
+ <li>
786
+ <label for="sm_b_safemode">
787
+ <input type="checkbox" id="sm_b_safemode" name="sm_b_safemode" <?php echo ($this->sg->GetOption("sm_b_safemode")==true?"checked=\"checked\"":""); ?> />
788
+ <?php _e('Enable MySQL standard mode. Use this only if you\'re getting MySQL errors. (Needs much more memory!)', 'sitemap') ?>
789
+ </label>
790
+ </li>
791
+ <li>
792
+ <label for="sm_b_auto_delay">
793
+ <input type="checkbox" id="sm_b_auto_delay" name="sm_b_auto_delay" <?php echo ($this->sg->GetOption("sm_b_auto_delay")==true?"checked=\"checked\"":""); ?> />
794
+ <?php _e('Build the sitemap in a background process (You don\'t have to wait when you save a post)', 'sitemap') ?>
795
+ </label>
796
+ </li>
797
+ </ul>
 
 
 
 
 
 
 
 
798
 
799
+ <?php $this->HtmlPrintBoxFooter(); ?>
800
+
801
+ <?php $this->HtmlPrintBoxHeader('sm_pages',__('Additional pages', 'sitemap')); ?>
802
+
803
+ <?php
804
+ _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com','sitemap');
805
+ echo "<ul><li>";
806
+ echo "<strong>" . __('Note','sitemap'). "</strong>: ";
807
+ _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog 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');
808
+ echo "</li><li>";
809
+ echo "<strong>" . __('URL to the page','sitemap'). "</strong>: ";
810
+ _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ",'sitemap');
811
+ echo "</li><li>";
812
+ echo "<strong>" . __('Priority','sitemap') . "</strong>: ";
813
+ _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');
814
+ echo "</li><li>";
815
+ echo "<strong>" . __('Last Changed','sitemap'). "</strong>: ";
816
+ _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).",'sitemap');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
817
 
818
+ echo "</li></ul>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
819
 
820
 
821
+ ?>
822
+ <script type="text/javascript">
823
+ //<![CDATA[
824
+ <?php
825
+ $freqVals = "'" . implode("','",array_keys($this->sg->_freqNames)). "'";
826
+ $freqNames = "'" . implode("','",array_values($this->sg->_freqNames)). "'";
827
+ ?>
828
+
829
+ var changeFreqVals = new Array( <?php echo $freqVals; ?> );
830
+ var changeFreqNames= new Array( <?php echo $freqNames; ?> );
831
+
832
+ var priorities= new Array(0 <?php for($i=0.1; $i<1; $i+=0.1) { echo "," . $i; } ?>);
833
+
834
+ var pages = [ <?php
835
+ if(count($this->sg->_pages)>0) {
836
+ for($i=0; $i<count($this->sg->_pages); $i++) {
837
+ $v=&$this->sg->_pages[$i];
838
+ if($i>0) echo ",";
839
+ echo '{url:"' . $v->getUrl() . '", priority:"' . $v->getPriority() . '", changeFreq:"' . $v->getChangeFreq() . '", lastChanged:"' . ($v!=null && $v->getLastMod()>0?date("Y-m-d",$v->getLastMod()):"") . '"}';
840
+ }
841
+ }
842
+ ?> ];
843
+ //]]>
844
+ </script>
845
+ <script type="text/javascript" src="<?php echo $this->sg->GetPluginUrl(); ?>img/sitemap.js"></script>
846
+ <table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable">
847
+ <tr>
848
+ <th scope="col"><?php _e('URL to the page','sitemap'); ?></th>
849
+ <th scope="col"><?php _e('Priority','sitemap'); ?></th>
850
+ <th scope="col"><?php _e('Change Frequency','sitemap'); ?></th>
851
+ <th scope="col"><?php _e('Last Changed','sitemap'); ?></th>
852
+ <th scope="col"><?php _e('#','sitemap'); ?></th>
853
+ </tr>
854
+ <?php
855
+ if(count($this->sg->_pages)<=0) { ?>
856
+ <tr>
857
+ <td colspan="5" align="center"><?php _e('No pages defined.','sitemap') ?></td>
858
+ </tr><?php
859
+ }
860
+ ?>
861
+ </table>
862
+ <a href="javascript:void(0);" onclick="sm_addPage();"><?php _e("Add new page",'sitemap'); ?></a>
863
+ <?php $this->HtmlPrintBoxFooter(); ?>
864
+
865
+
866
+ <!-- AutoPrio Options -->
867
+ <?php $this->HtmlPrintBoxHeader('sm_postprio',__('Post Priority', 'sitemap')); ?>
868
+
869
+ <p><?php _e('Please select how the priority of each post should be calculated:', 'sitemap') ?></p>
870
+ <ul>
871
+ <li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php echo $this->sg->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>
872
+ <?php
873
+ for($i=0; $i<count($this->sg->_prioProviders); $i++) {
874
+ echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_$i\" name=\"sm_b_prio_provider\" value=\"" . $this->sg->_prioProviders[$i] . "\" " . $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"),$this->sg->_prioProviders[$i]) . " /> <label for=\"sm_b_prio_provider_$i\">" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getName')) . "</label><br />" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getDescription')) . "</p></li>";
875
+ }
876
+ ?>
877
+ </ul>
878
+ <?php $this->HtmlPrintBoxFooter(); ?>
879
+
880
+
881
+ <!-- Location Options -->
882
+ <?php $this->HtmlPrintBoxHeader('sm_location',__('Location of your sitemap file', 'sitemap')); ?>
883
+
884
+ <div>
885
+ <b><label for="sm_location_useauto"><input type="radio" id="sm_location_useauto" name="sm_b_location_mode" value="auto" <?php echo ($this->sg->GetOption("b_location_mode")=="auto"?"checked=\"checked\"":"") ?> /> <?php _e('Automatic detection','sitemap') ?></label></b>
886
+ <ul>
887
+ <li>
888
+ <label for="sm_b_filename">
889
+ <?php _e('Filename of the sitemap file', 'sitemap') ?>
890
+ <input type="text" id="sm_b_filename" name="sm_b_filename" value="<?php echo $this->sg->GetOption("b_filename"); ?>" />
891
+ </label><br />
892
+ <?php _e('Detected Path', 'sitemap') ?>: <?php echo $this->sg->getXmlPath(true); ?><br /><?php _e('Detected URL', 'sitemap') ?>: <a href="<?php echo $this->sg->getXmlUrl(true); ?>"><?php echo $this->sg->getXmlUrl(true); ?></a>
893
+ </li>
894
+ </ul>
895
+ </div>
896
+ <div>
897
+ <b><label for="sm_location_usemanual"><input type="radio" id="sm_location_usemanual" name="sm_b_location_mode" value="manual" <?php echo ($this->sg->GetOption("b_location_mode")=="manual"?"checked=\"checked\"":"") ?> /> <?php _e('Custom location','sitemap') ?></label></b>
898
+ <ul>
899
+ <li>
900
+ <label for="sm_b_filename_manual">
901
+ <?php _e('Absolute or relative path to the sitemap file, including name.','sitemap');
902
+ echo "<br />";
903
+ _e('Example','sitemap');
904
+ echo ": /var/www/htdocs/wordpress/sitemap.xml"; ?><br />
905
+ <input style="width:70%" type="text" id="sm_b_filename_manual" name="sm_b_filename_manual" value="<?php echo (!$this->sg->GetOption("b_filename_manual")?$this->sg->getXmlPath():$this->sg->GetOption("b_filename_manual")); ?>" />
906
+ </label>
907
+ </li>
908
+ <li>
909
+ <label for="sm_b_fileurl_manual">
910
+ <?php _e('Complete URL to the sitemap file, including name.','sitemap');
911
+ echo "<br />";
912
+ _e('Example','sitemap');
913
+ echo ": http://www.yourdomain.com/sitemap.xml"; ?><br />
914
+ <input style="width:70%" type="text" id="sm_b_fileurl_manual" name="sm_b_fileurl_manual" value="<?php echo (!$this->sg->GetOption("b_fileurl_manual")?$this->sg->getXmlUrl():$this->sg->GetOption("b_fileurl_manual")); ?>" />
915
+ </label>
916
+ </li>
917
+ </ul>
918
  </div>
919
 
920
+ <?php $this->HtmlPrintBoxFooter(); ?>
921
+
922
+ <!-- Includes -->
923
+ <?php $this->HtmlPrintBoxHeader('sm_includes',__('Sitemap Content', 'sitemap')); ?>
924
+
925
+ <ul>
926
+ <li>
927
+ <label for="sm_in_home">
928
+ <input type="checkbox" id="sm_in_home" name="sm_in_home" <?php echo ($this->sg->GetOption("in_home")==true?"checked=\"checked\"":"") ?> />
929
+ <?php _e('Include homepage', 'sitemap') ?>
930
+ </label>
931
+ </li>
932
+ <li>
933
+ <label for="sm_in_posts">
934
+ <input type="checkbox" id="sm_in_posts" name="sm_in_posts" <?php echo ($this->sg->GetOption("in_posts")==true?"checked=\"checked\"":"") ?> />
935
+ <?php _e('Include posts', 'sitemap') ?>
936
+ </label>
937
+ </li>
938
+ <li>
939
+ <label for="sm_in_posts_sub">
940
+ <input type="checkbox" id="sm_in_posts_sub" name="sm_in_posts_sub" <?php echo ($this->sg->GetOption("in_posts_sub")==true?"checked=\"checked\"":"") ?> />
941
+ <?php _e('Include following pages of multi-page posts (&lt;!--nextpage--&gt;)', 'sitemap') ?>
942
+ </label>
943
+ </li>
944
+ <li>
945
+ <label for="sm_in_pages">
946
+ <input type="checkbox" id="sm_in_pages" name="sm_in_pages" <?php echo ($this->sg->GetOption("in_pages")==true?"checked=\"checked\"":"") ?> />
947
+ <?php _e('Include static pages', 'sitemap') ?>
948
+ </label>
949
+ </li>
950
+ <li>
951
+ <label for="sm_in_cats">
952
+ <input type="checkbox" id="sm_in_cats" name="sm_in_cats" <?php echo ($this->sg->GetOption("in_cats")==true?"checked=\"checked\"":"") ?> />
953
+ <?php _e('Include categories', 'sitemap') ?>
954
+ </label>
955
+ </li>
956
+ <li>
957
+ <label for="sm_in_arch">
958
+ <input type="checkbox" id="sm_in_arch" name="sm_in_arch" <?php echo ($this->sg->GetOption("in_arch")==true?"checked=\"checked\"":"") ?> />
959
+ <?php _e('Include archives', 'sitemap') ?>
960
+ </label>
961
+ </li>
962
+ <?php if($this->sg->IsTaxonomySupported()): ?>
963
+ <li>
964
+ <label for="sm_in_tags">
965
+ <input type="checkbox" id="sm_in_tags" name="sm_in_tags" <?php echo ($this->sg->GetOption("in_tags")==true?"checked=\"checked\"":"") ?> />
966
+ <?php _e('Include tag pages', 'sitemap') ?>
967
+ </label>
968
+ </li>
969
+ <?php endif; ?>
970
+ <li>
971
+ <label for="sm_in_auth">
972
+ <input type="checkbox" id="sm_in_auth" name="sm_in_auth" <?php echo ($this->sg->GetOption("in_auth")==true?"checked=\"checked\"":"") ?> />
973
+ <?php _e('Include author pages', 'sitemap') ?>
974
+ </label>
975
+ </li>
976
+ </ul>
977
 
978
+ <?php $this->HtmlPrintBoxFooter(); ?>
979
+
980
+ <!-- Excluded Items -->
981
+ <?php $this->HtmlPrintBoxHeader('sm_excludes',__('Excluded items', 'sitemap')); ?>
982
+
983
+ <b><?php _e('Excluded categories', 'sitemap') ?>:</b>
984
+ <?php if(version_compare($wp_version,"2.5",">=")): ?>
985
+ <cite style="display:block; margin-left:40px;"><?php _e("Note","sitemap") ?>: <?php _e("Using this feature will increase build time and memory usage!","sitemap"); ?></cite>
986
+ <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;">
987
+ <ul>
988
+ <?php wp_category_checklist(0,0,$this->sg->GetOption("sm_b_exclude_cats"),false); ?>
989
+ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
990
  </div>
991
+ <?php else: ?>
992
+ <ul><li><?php echo sprintf(__("This feature requires at least WordPress 2.5, you are using %s","sitemap"),$wp_version); ?></li></ul>
993
+ <?php endif; ?>
994
 
995
+ <b><?php _e("Exclude posts","sitemap"); ?>:</b>
996
+ <div style="margin:5px 0 13px 40px;">
997
+ <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 />
998
+ <input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php echo implode(",",$this->sg->GetOption("sm_b_exclude")); ?>" /></label><br />
999
+ <cite><?php _e("Note","sitemap") ?>: <?php _e("Child posts will not automatically be excluded!","sitemap"); ?></cite>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
  </div>
1001
 
1002
+ <?php $this->HtmlPrintBoxFooter(); ?>
1003
+
1004
+ <!-- Change frequencies -->
1005
+ <?php $this->HtmlPrintBoxHeader('sm_change_frequencies',__('Change frequencies', 'sitemap')); ?>
1006
+
1007
+ <p>
1008
+ <b><?php _e('Note', 'sitemap') ?>:</b>
1009
+ <?php _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap') ?>
1010
+ </p>
1011
+ <ul>
1012
+ <li>
1013
+ <label for="sm_cf_home">
1014
+ <select id="sm_cf_home" name="sm_cf_home"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_home")); ?></select>
1015
+ <?php _e('Homepage', 'sitemap') ?>
1016
+ </label>
1017
+ </li>
1018
+ <li>
1019
+ <label for="sm_cf_posts">
1020
+ <select id="sm_cf_posts" name="sm_cf_posts"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_posts")); ?></select>
1021
+ <?php _e('Posts', 'sitemap') ?>
1022
+ </label>
1023
+ </li>
1024
+ <li>
1025
+ <label for="sm_cf_pages">
1026
+ <select id="sm_cf_pages" name="sm_cf_pages"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_pages")); ?></select>
1027
+ <?php _e('Static pages', 'sitemap') ?>
1028
+ </label>
1029
+ </li>
1030
+ <li>
1031
+ <label for="sm_cf_cats">
1032
+ <select id="sm_cf_cats" name="sm_cf_cats"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_cats")); ?></select>
1033
+ <?php _e('Categories', 'sitemap') ?>
1034
+ </label>
1035
+ </li>
1036
+ <li>
1037
+ <label for="sm_cf_arch_curr">
1038
+ <select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr")); ?></select>
1039
+ <?php _e('The current archive of this month (Should be the same like your homepage)', 'sitemap') ?>
1040
+ </label>
1041
+ </li>
1042
+ <li>
1043
+ <label for="sm_cf_arch_old">
1044
+ <select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old")); ?></select>
1045
+ <?php _e('Older archives (Changes only if you edit an old post)', 'sitemap') ?>
1046
+ </label>
1047
+ </li>
1048
+ <?php if($this->sg->IsTaxonomySupported()): ?>
1049
+ <li>
1050
+ <label for="sm_cf_tags">
1051
+ <select id="sm_cf_tags" name="sm_cf_tags"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_tags")); ?></select>
1052
+ <?php _e('Tag pages', 'sitemap') ?>
1053
+ </label>
1054
+ </li>
1055
+ <?php endif; ?>
1056
+ <li>
1057
+ <label for="sm_cf_auth">
1058
+ <select id="sm_cf_auth" name="sm_cf_auth"><?php $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_auth")); ?></select>
1059
+ <?php _e('Author pages', 'sitemap') ?>
1060
+ </label>
1061
+ </li>
1062
+ </ul>
1063
+
1064
+ <?php $this->HtmlPrintBoxFooter(); ?>
1065
+
1066
+ <!-- Priorities -->
1067
+ <?php $this->HtmlPrintBoxHeader('sm_priorities',__('Priorities', 'sitemap')); ?>
1068
+
1069
+ <ul>
1070
+ <li>
1071
+ <label for="sm_pr_home">
1072
+ <select id="sm_pr_home" name="sm_pr_home"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_home")); ?></select>
1073
+ <?php _e('Homepage', 'sitemap') ?>
1074
+ </label>
1075
+ </li>
1076
+ <li>
1077
+ <label for="sm_pr_posts">
1078
+ <select id="sm_pr_posts" name="sm_pr_posts"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts")); ?></select>
1079
+ <?php _e('Posts (If auto calculation is disabled)', 'sitemap') ?>
1080
+ </label>
1081
+ </li>
1082
+ <li>
1083
+ <label for="sm_pr_posts_min">
1084
+ <select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min")); ?></select>
1085
+ <?php _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap') ?>
1086
+ </label>
1087
+ </li>
1088
+ <li>
1089
+ <label for="sm_pr_pages">
1090
+ <select id="sm_pr_pages" name="sm_pr_pages"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_pages")); ?></select>
1091
+ <?php _e('Static pages', 'sitemap'); ?>
1092
+ </label>
1093
+ </li>
1094
+ <li>
1095
+ <label for="sm_pr_cats">
1096
+ <select id="sm_pr_cats" name="sm_pr_cats"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_cats")); ?></select>
1097
+ <?php _e('Categories', 'sitemap') ?>
1098
+ </label>
1099
+ </li>
1100
+ <li>
1101
+ <label for="sm_pr_arch">
1102
+ <select id="sm_pr_arch" name="sm_pr_arch"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_arch")); ?></select>
1103
+ <?php _e('Archives', 'sitemap') ?>
1104
+ </label>
1105
+ </li>
1106
+ <?php if($this->sg->IsTaxonomySupported()): ?>
1107
+ <li>
1108
+ <label for="sm_pr_tags">
1109
+ <select id="sm_pr_tags" name="sm_pr_tags"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_tags")); ?></select>
1110
+ <?php _e('Tag pages', 'sitemap') ?>
1111
+ </label>
1112
+ </li>
1113
+ <?php endif; ?>
1114
+ <li>
1115
+ <label for="sm_pr_auth">
1116
+ <select id="sm_pr_auth" name="sm_pr_auth"><?php $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_auth")); ?></select>
1117
+ <?php _e('Author pages', 'sitemap') ?>
1118
+ </label>
1119
+ </li>
1120
+ </ul>
1121
 
1122
+ <?php $this->HtmlPrintBoxFooter(); ?>
1123
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1124
  </div>
1125
  <div>
1126
  <p class="submit">
1129
  <input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php _e('Reset options', 'sitemap'); ?>" />
1130
  </p>
1131
  </div>
1132
+
1133
+ <?php if($this->mode == 27): ?>
1134
+ </div>
1135
+ </div>
1136
+ <?php endif; ?>
1137
  </div>
1138
  <script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script>
1139
  </form>
1146
  <input type="hidden" name="item_number" value="0001" />
1147
  <input type="hidden" name="currency_code" value="USD" />
1148
  <input type="hidden" name="bn" value="PP-BuyNowBF" />
1149
+ <input type="hidden" name="lc" value="US" />
1150
  <input type="hidden" name="rm" value="2" />
1151
  <input type="hidden" name="on0" value="Your Website" />
1152
  <input type="hidden" name="os0" value="<?php echo get_bloginfo("home"); ?>"/>
sitemap.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: sitemap.php 48032 2008-05-27 14:32:06Z arnee $
5
 
6
  Google XML Sitemaps Generator for WordPress
7
  ==============================================================================
@@ -16,16 +16,16 @@
16
 
17
  For aditional details like installation instructions, please check the readme.txt and documentation.txt files.
18
 
19
- Have fun!
20
  Arne
21
 
22
 
23
  Info for WordPress:
24
  ==============================================================================
25
- Plugin Name: Google XML Sitemaps
26
  Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
27
  Description: This plugin will generate a sitemaps.org compatible sitemap of your WordPress blog which is supported by Ask.com, Google, MSN Search and YAHOO. <a href="options-general.php?page=sitemap.php">Configuration Page</a>
28
- Version: 3.1.0.1
29
  Author: Arne Brachhold
30
  Author URI: http://www.arnebrachhold.de/
31
  */
@@ -40,61 +40,67 @@ class GoogleSitemapGeneratorLoader {
40
  add_action('delete_post', array('GoogleSitemapGeneratorLoader', 'CallCheckForAutoBuild'),9999,1);
41
 
42
  //Existing post gets published
43
- add_action('publish_post', array('GoogleSitemapGeneratorLoader', 'CallCheckForAutoBuild'),9999,1);
44
 
45
  //WP Cron hook
46
- add_action('sm_build_cron', array('GoogleSitemapGeneratorLoader', 'CallBuildSitemap'),1,0);
47
 
 
 
 
 
 
 
48
  if(!empty($_GET["sm_command"]) && !empty($_GET["sm_key"])) {
49
- GoogleSitemapGeneratorLoader::CallCheckForManualBuild();
50
  }
51
  }
52
 
53
  function RegisterAdminPage() {
54
 
55
  if (function_exists('add_options_page')) {
56
- add_options_page(__('XML-Sitemap Generator','sitemap'), __('XML-Sitemap','sitemap'), 10, basename(__FILE__), array('GoogleSitemapGeneratorLoader','CallHtmlShowOptionsPage'));
57
  }
58
  }
59
 
60
  function CallHtmlShowOptionsPage() {
61
- if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
62
  $gs = GoogleSitemapGenerator::GetInstance();
63
  $gs->HtmlShowOptionsPage();
64
  }
65
  }
66
 
67
  function CallCheckForAutoBuild($args) {
68
- if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
69
  $gs = GoogleSitemapGenerator::GetInstance();
70
  $gs->CheckForAutoBuild($args);
71
  }
72
  }
73
 
74
  function CallBuildSitemap() {
75
- if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
76
  $gs = GoogleSitemapGenerator::GetInstance();
77
  $gs->BuildSitemap();
78
  }
79
  }
80
 
81
  function CallCheckForManualBuild() {
82
- if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
83
  $gs = GoogleSitemapGenerator::GetInstance();
84
  $gs->CheckForManualBuild();
85
- }
86
  }
87
 
88
  function LoadPlugin() {
89
 
90
  $mem = abs(intval(@ini_get('memory_limit')));
91
  if($mem && $mem < 32) {
92
- @ini_set('memory_limit', '32M');
93
  }
94
 
95
- $time = abs(intval(@ini_get("max_execution_tim")));
96
  if($time != 0 && $time < 120) {
97
- @set_time_limit(120);
98
  }
99
 
100
  if(!class_exists("GoogleSitemapGenerator")) {
@@ -103,18 +109,18 @@ class GoogleSitemapGeneratorLoader {
103
 
104
  if(!file_exists( $path . 'sitemap-core.php')) return false;
105
  require_once($path. 'sitemap-core.php');
106
- }
107
 
108
- GoogleSitemapGenerator::Enable();
109
- return true;
110
  }
111
 
112
  function GetBaseName() {
113
- return plugin_basename(__FILE__);
114
  }
115
 
116
  function GetPluginFile() {
117
- return __FILE__;
118
  }
119
 
120
  function GetVersion() {
@@ -123,9 +129,23 @@ class GoogleSitemapGeneratorLoader {
123
  else if(file_exists(ABSPATH . 'wp-admin/admin-functions.php')) require_once(ABSPATH . 'wp-admin/admin-functions.php'); //2.1
124
  else return "0.ERROR";
125
  }
126
- $data = get_plugin_data(__FILE__);
127
  return $data['Version'];
128
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
 
131
  if(defined('ABSPATH') && defined('WPINC')) {
1
  <?php
2
 
3
  /*
4
+ $Id: sitemap.php 81520 2008-12-21 15:58:23Z arnee $
5
 
6
  Google XML Sitemaps Generator for WordPress
7
  ==============================================================================
16
 
17
  For aditional details like installation instructions, please check the readme.txt and documentation.txt files.
18
 
19
+ Have fun!
20
  Arne
21
 
22
 
23
  Info for WordPress:
24
  ==============================================================================
25
+ Plugin Name: Google XML Sitemaps
26
  Plugin URI: http://www.arnebrachhold.de/redir/sitemap-home/
27
  Description: This plugin will generate a sitemaps.org compatible sitemap of your WordPress blog which is supported by Ask.com, Google, MSN Search and YAHOO. <a href="options-general.php?page=sitemap.php">Configuration Page</a>
28
+ Version: 3.1.1
29
  Author: Arne Brachhold
30
  Author URI: http://www.arnebrachhold.de/
31
  */
40
  add_action('delete_post', array('GoogleSitemapGeneratorLoader', 'CallCheckForAutoBuild'),9999,1);
41
 
42
  //Existing post gets published
43
+ add_action('publish_post', array('GoogleSitemapGeneratorLoader', 'CallCheckForAutoBuild'),9999,1);
44
 
45
  //WP Cron hook
46
+ add_action('sm_build_cron', array('GoogleSitemapGeneratorLoader', 'CallBuildSitemap'),1,0);
47
 
48
+ //Help topics for context sensitive help
49
+ add_filter('contextual_help_list', array('GoogleSitemapGeneratorLoader', 'CallHtmlShowHelpList'),9999,2);
50
+
51
+ //Register javascripts if needed
52
+ add_filter('load-settings_page_sitemap', array('GoogleSitemapGeneratorLoader', 'CallHtmlRegScripts'),1,0);
53
+
54
  if(!empty($_GET["sm_command"]) && !empty($_GET["sm_key"])) {
55
+ GoogleSitemapGeneratorLoader::CallCheckForManualBuild();
56
  }
57
  }
58
 
59
  function RegisterAdminPage() {
60
 
61
  if (function_exists('add_options_page')) {
62
+ add_options_page(__('XML-Sitemap Generator','sitemap'), __('XML-Sitemap','sitemap'), 10, basename(__FILE__), array('GoogleSitemapGeneratorLoader','CallHtmlShowOptionsPage'));
63
  }
64
  }
65
 
66
  function CallHtmlShowOptionsPage() {
67
+ if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
68
  $gs = GoogleSitemapGenerator::GetInstance();
69
  $gs->HtmlShowOptionsPage();
70
  }
71
  }
72
 
73
  function CallCheckForAutoBuild($args) {
74
+ if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
75
  $gs = GoogleSitemapGenerator::GetInstance();
76
  $gs->CheckForAutoBuild($args);
77
  }
78
  }
79
 
80
  function CallBuildSitemap() {
81
+ if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
82
  $gs = GoogleSitemapGenerator::GetInstance();
83
  $gs->BuildSitemap();
84
  }
85
  }
86
 
87
  function CallCheckForManualBuild() {
88
+ if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
89
  $gs = GoogleSitemapGenerator::GetInstance();
90
  $gs->CheckForManualBuild();
91
+ }
92
  }
93
 
94
  function LoadPlugin() {
95
 
96
  $mem = abs(intval(@ini_get('memory_limit')));
97
  if($mem && $mem < 32) {
98
+ @ini_set('memory_limit', '32M');
99
  }
100
 
101
+ $time = abs(intval(@ini_get("max_execution_time")));
102
  if($time != 0 && $time < 120) {
103
+ @set_time_limit(120);
104
  }
105
 
106
  if(!class_exists("GoogleSitemapGenerator")) {
109
 
110
  if(!file_exists( $path . 'sitemap-core.php')) return false;
111
  require_once($path. 'sitemap-core.php');
112
+ }
113
 
114
+ GoogleSitemapGenerator::Enable();
115
+ return true;
116
  }
117
 
118
  function GetBaseName() {
119
+ return plugin_basename(__FILE__);
120
  }
121
 
122
  function GetPluginFile() {
123
+ return __FILE__;
124
  }
125
 
126
  function GetVersion() {
129
  else if(file_exists(ABSPATH . 'wp-admin/admin-functions.php')) require_once(ABSPATH . 'wp-admin/admin-functions.php'); //2.1
130
  else return "0.ERROR";
131
  }
132
+ $data = get_plugin_data(__FILE__);
133
  return $data['Version'];
134
  }
135
+
136
+ function CallHtmlRegScripts() {
137
+ if(GoogleSitemapGeneratorLoader::LoadPlugin()) {
138
+ $gs = GoogleSitemapGenerator::GetInstance();
139
+ $gs->HtmlRegScripts();
140
+ }
141
+ }
142
+
143
+ function CallHtmlShowHelpList($filterVal,$screen) {
144
+ if($screen == "settings_page_sitemap") {
145
+ $filterVal["settings_page_sitemap"] = '<a href="http://www.arnebrachhold.de/redir/sitemap-home/">Plugin Homepage</a><br /><a href="http://www.arnebrachhold.de/redir/sitemap-afaq/" target="_blank">Sitemap FAQ</a>';
146
+ }
147
+ return $filterVal;
148
+ }
149
  }
150
 
151
  if(defined('ABSPATH') && defined('WPINC')) {