sg = $sitemapBuilder; } private function HtmlPrintBoxHeader($id, $title) { ?>

sg->GetFreqNames() AS $k=>$v) { echo ""; } } /** * Echos option fields for an select field containing the valid priorities (0- 1.0) * * @since 4.0 * @param $currentVal string The value which should be selected * @return void */ public static function HtmlGetPriorityValues($currentVal) { $currentVal=(float) $currentVal; for($i=0.0; $i<=1.0; $i+=0.1) { $v = number_format($i,1,".",""); echo ""; } } /** * Returns the checked attribute if the given values match * * @since 4.0 * @param $val string The current value * @param $equals string The value to match * @return string The checked attribute if the given values match, an empty string if not */ public static function HtmlGetChecked($val, $equals) { if($val==$equals) return self::HtmlGetAttribute("checked"); else return ""; } /** * Returns the selected attribute if the given values match * * @since 4.0 * @param $val string The current value * @param $equals string The value to match * @return string The selected attribute if the given values match, an empty string if not */ public static function HtmlGetSelected($val,$equals) { if($val==$equals) return self::HtmlGetAttribute("selected"); else return ""; } /** * Returns an formatted attribute. If the value is NULL, the name will be used. * * @since 4.0 * @param $attr string The attribute name * @param $value string The attribute value * @return string The formatted attribute */ public static function HtmlGetAttribute($attr,$value=NULL) { if($value==NULL) $value=$attr; return " " . $attr . "=\"" . esc_attr($value) . "\" "; } /** * Returns an array with GoogleSitemapGeneratorPage objects which is generated from POST values * * @since 4.0 * @see GoogleSitemapGeneratorPage * @return array An array with GoogleSitemapGeneratorPage objects */ public function HtmlApplyPages() { // Array with all page URLs $pages_ur=(!isset($_POST["sm_pages_ur"]) || !is_array($_POST["sm_pages_ur"])?array():$_POST["sm_pages_ur"]); //Array with all priorities $pages_pr=(!isset($_POST["sm_pages_pr"]) || !is_array($_POST["sm_pages_pr"])?array():$_POST["sm_pages_pr"]); //Array with all change frequencies $pages_cf=(!isset($_POST["sm_pages_cf"]) || !is_array($_POST["sm_pages_cf"])?array():$_POST["sm_pages_cf"]); //Array with all lastmods $pages_lm=(!isset($_POST["sm_pages_lm"]) || !is_array($_POST["sm_pages_lm"])?array():$_POST["sm_pages_lm"]); //Array where the new pages are stored $pages=array(); //Loop through all defined pages and set their properties into an object if(isset($_POST["sm_pages_mark"]) && is_array($_POST["sm_pages_mark"])) { for($i=0; $iSetUrl($pages_ur[$i]); $p->SetProprity($pages_pr[$i]); $p->SetChangeFreq($pages_cf[$i]); //Try to parse last modified, if -1 (note ===) automatic will be used (0) $lm=(!empty($pages_lm[$i])?strtotime($pages_lm[$i],time()):-1); if($lm===-1) $p->setLastMod(0); else $p->setLastMod($lm); //Add it to the array array_push($pages,$p); } } return $pages; } /** * Displays the option page * * @since 3.0 * @access public * @author Arne Brachhold */ public function HtmlShowOptionsPage() { global $wp_version; $snl = false; //SNL $this->sg->Initate(); $message=""; if(!empty($_REQUEST["sm_rebuild"])) { //Pressed Button: Rebuild Sitemap check_admin_referer('sitemap'); if(isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"]=="true") { //Check again, just for the case that something went wrong before if(!current_user_can("administrator") || !is_super_admin()) { echo '

Please log in as admin

'; return; } $oldErr = error_reporting(E_ALL); $oldIni = ini_set("display_errors",1); echo '
'; echo '

' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion(). '

'; echo '

This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.

'; echo '

DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!

'; echo "

WordPress and PHP Information

"; echo '

WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '

'; echo '

Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->GetSvnVersion() . ')'; echo '

Environment

'; echo "
";
				$sc = $_SERVER;
				unset($sc["HTTP_COOKIE"]);
				print_r($sc);
				echo "
"; echo "

WordPress Config

"; echo "
";
				$opts = array();
				if(function_exists('wp_load_alloptions')) {
					$opts = wp_load_alloptions();
				} else {
					/** @var $wpdb wpdb*/
					global $wpdb;
					$os = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options");
					foreach ( (array) $os as $o ) $opts[$o->option_name] = $o->option_value;
				}

				$popts = array();
				foreach($opts as $k=>$v) {
					//Try to filter out passwords etc...
					if(preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si",$k)) continue;
					$popts[$k] = htmlspecialchars($v);
				}
				print_r($popts);
				echo "
"; echo '

Sitemap Config

'; echo "
";
				print_r($this->sg->GetOptions());
				echo "
"; echo '

Sitemap Content and Errors, Warnings, Notices

'; echo '
'; $sitemaps = $this->sg->SimulateIndex(); foreach($sitemaps AS $sitemap) { /** @var $s GoogleSitemapGeneratorSitemapEntry */ $s = $sitemap["data"]; echo "

Sitemap: GetUrl() . "\">" . $sitemap["type"] . "/" . ($sitemap["params"]?$sitemap["params"]:"(No parameters)") . " by " . $sitemap["caller"]["class"] . "

"; $res = $this->sg->SimulateSitemap($sitemap["type"], $sitemap["params"]); echo "
    "; foreach($res AS $s) { /** @var $d GoogleSitemapGeneratorSitemapEntry */ $d = $s["data"]; echo "
  • " . $d->GetUrl() . "
  • "; } echo "
"; } $status = GoogleSitemapGeneratorStatus::Load(); echo '
'; echo '

MySQL Queries

'; if(defined('SAVEQUERIES') && SAVEQUERIES) { echo '
';
					var_dump($GLOBALS['wpdb']->queries);
					echo '
'; $total = 0; foreach($GLOBALS['wpdb']->queries as $q) { $total+=$q[1]; } echo '

Total Query Time

'; echo '
' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total,2) . ' seconds.
'; } else { echo '

Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.

'; } echo "

Build Process Results

"; echo "
";
				print_r($status);
				echo "
"; echo '

Done. Rebuild or Return

'; echo '

DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!

'; echo '
'; @error_reporting($oldErr); @ini_set("display_errors",$oldIni); return; } else { $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true'; //Redirect so the sm_rebuild GET parameter no longer exists. @header("location: " . $redirURL); //If there was already any other output, the header redirect will fail echo ''; echo ''; exit; } } else if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config check_admin_referer('sitemap'); if(isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) { $_POST['sm_b_style_default'] = true; $_POST['sm_b_style'] = ''; } foreach($this->sg->GetOptions() as $k=>$v) { //Skip some options if the user is not super admin... if(!is_super_admin() && in_array($k,array("sm_b_time","sm_b_memory","sm_b_style","sm_b_style_default"))) { continue; } //Check vor values and convert them into their types, based on the category they are in if(!isset($_POST[$k])) $_POST[$k]=""; // Empty string will get false on 2bool and 0 on 2float //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider if(substr($k,0,5)=="sm_b_") { if($k=="sm_b_prio_provider" || $k == "sm_b_style" || $k == "sm_b_memory" || $k == "sm_b_baseurl") { if($k=="sm_b_filename_manual" && strpos($_POST[$k],"\\")!==false){ $_POST[$k]=stripslashes($_POST[$k]); } else if($k=="sm_b_baseurl") { $_POST[$k] = trim($_POST[$k]); if(!empty($_POST[$k])) $_POST[$k] = trailingslashit($_POST[$k]); } $this->sg->SetOption($k,(string) $_POST[$k]); } else if($k == "sm_b_time") { if($_POST[$k]=='') $_POST[$k] = -1; $this->sg->SetOption($k,intval($_POST[$k])); } else if($k== "sm_i_install_date") { if($this->sg->GetOption('i_install_date')<=0) $this->sg->SetOption($k,time()); } else if($k=="sm_b_exclude") { $IDss = array(); $IDs = explode(",",$_POST[$k]); for($x = 0; $x0) $IDss[] = $ID; } $this->sg->SetOption($k,$IDss); } else if($k == "sm_b_exclude_cats") { $exCats = array(); if(isset($_POST["post_category"])) { foreach((array) $_POST["post_category"] AS $vv) if(!empty($vv) && is_numeric($vv)) $exCats[] = intval($vv); } $this->sg->SetOption($k,$exCats); } else { $this->sg->SetOption($k,(bool) $_POST[$k]); } //Options of the category "Includes" are boolean } else if(substr($k,0,6)=="sm_in_") { if($k=='sm_in_tax') { $enabledTaxonomies = array(); foreach(array_keys((array) $_POST[$k]) AS $taxName) { if(empty($taxName) || !taxonomy_exists($taxName)) continue; $enabledTaxonomies[] = $taxName; } $this->sg->SetOption($k,$enabledTaxonomies); } else if($k=='sm_in_customtypes') { $enabledPostTypes = array(); foreach(array_keys((array) $_POST[$k]) AS $postTypeName) { if(empty($postTypeName) || !post_type_exists($postTypeName)) continue; $enabledPostTypes[] = $postTypeName; } $this->sg->SetOption($k, $enabledPostTypes); } else $this->sg->SetOption($k,(bool) $_POST[$k]); //Options of the category "Change frequencies" are string } else if(substr($k,0,6)=="sm_cf_") { $this->sg->SetOption($k,(string) $_POST[$k]); //Options of the category "Priorities" are float } else if(substr($k,0,6)=="sm_pr_") { $this->sg->SetOption($k,(float) $_POST[$k]); } } //Apply page changes from POST if(is_super_admin()) $this->sg->SetPages($this->HtmlApplyPages()); if($this->sg->SaveOptions()) $message.=__('Configuration updated', 'sitemap') . "
"; else $message.=__('Error while saving options', 'sitemap') . "
"; if(is_super_admin()) { if($this->sg->SavePages()) $message.=__("Pages saved",'sitemap') . "
"; else $message.=__('Error while saving pages', 'sitemap'). "
"; } } else if(!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config check_admin_referer('sitemap'); $this->sg->InitOptions(); $this->sg->SaveOptions(); $message.=__('The default configuration was restored.','sitemap'); } else if(!empty($_GET["sm_delete_old"])) { //Delete old sitemap files check_admin_referer('sitemap'); //Check again, just for the case that something went wrong before if(!current_user_can("administrator")) { echo '

Please log in as admin

'; return; } if(!$this->sg->DeleteOldFiles()) { $message = __("The old files could NOT be deleted. Please use an FTP program and delete them by yourself.","sitemap"); } else { $message = __("The old files were successfully deleted.","sitemap"); } } else if(!empty($_GET["sm_ping_all"])) { check_admin_referer('sitemap'); //Check again, just for the case that something went wrong before if(!current_user_can("administrator")) { echo '

Please log in as admin

'; return; } echo << HTML; echo "

" . __('Notify Search Engines about all sitemaps','sitemap') ."

"; echo "

" . __('The plugin is notifying the selected search engines about your main sitemap and all sub-sitemaps. This might take a minute or two.','sitemaps') . "

"; flush(); $results = $this->sg->SendPingAll(); echo ""; echo "

" . __('All done!','sitemap') . "

"; echo << HTML; exit; } else if(!empty($_GET["sm_ping_main"])) { check_admin_referer('sitemap'); //Check again, just for the case that something went wrong before if(!current_user_can("administrator")) { echo '

Please log in as admin

'; return; } $this->sg->SendPing(); $message = __("Ping was executed, please see below for the result.","sitemap"); } //Print out the message to the user, if any if($message!="") { ?>

sg->SetOption('i_hide_donated',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_donated'])) { $this->sg->SetOption('i_donated',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_hide_note'])) { $this->sg->SetOption('i_hide_note',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_hide_survey'])) { $this->sg->SetOption('i_hide_survey',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_hidedonors'])) { $this->sg->SetOption('i_hide_donors',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_hide_works'])) { $this->sg->SetOption('i_hide_works',true); $this->sg->SaveOptions(); } if(isset($_GET['sm_disable_supportfeed'])) { $this->sg->SetOption('i_supportfeed',$_GET["sm_disable_supportfeed"]=="true"?false:true); $this->sg->SaveOptions(); } if(isset($_GET['sm_donated']) || ($this->sg->GetOption('i_donated')===true && $this->sg->GetOption('i_hide_donated')!==true)) { ?> 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))) { ?> sg->GetOption('i_install_date')>0 && $this->sg->GetOption('i_hide_works')!==true && time() > ($this->sg->GetOption('i_install_date') + (60*60*24*15))) { ?>

sg->GetRedirectLink("sitemap-works-note"),__('Thanks for using this plugin! You\'ve installed this plugin some time ago. If it works and your are satisfied, why not rate it and recommend it to others? :-)','sitemap')); ?> " style="float:right; display:block; border:none;">

sg->ShowSurvey()) $this->sg->HtmlSurvey(); } ?>

sg->GetVersion() ?>

Reading Settings to change this.','sitemap')); ?>

HtmlPrintBoxHeader('sm_pnres',__('About this Plugin:','sitemap'),true); ?> HtmlPrintBoxFooter(true); ?> HtmlPrintBoxHeader('sm_smres',__('Sitemap Resources:','sitemap'),true); ?>
HtmlPrintBoxFooter(true); ?>
GetStartTime() > 0) { $st=$status->GetStartTime() + (get_option( 'gmt_offset' ) * 3600); $head=str_replace("%date%",date_i18n(get_option('date_format'),$st) . " " . date_i18n(get_option('time_format'),$st),__('Result of the last ping, started on %date%.','sitemap')); } $this->HtmlPrintBoxHeader('sm_rebuild',$head); ?>
sg->GetOption('i_supportfeed')) { echo "sg->GetBackLink() . "&sm_disable_supportfeed=true") . "\">" . __('Disable','sitemap') . ""; $supportFeed = $this->sg->GetSupportFeed(); if (!is_wp_error($supportFeed) && $supportFeed) { $supportItems = $supportFeed->get_items(0, $supportFeed->get_item_quantity(3)); if(count($supportItems)>0) { echo "
    "; foreach($supportItems AS $item) { $url = esc_url($item->get_permalink()); $title = esc_html($item->get_title()); echo "
  • {$title}
  • "; } echo "
"; } } else { echo "
  • " . __('No support topics available or an error occurred while fetching them.','sitemap') . "
"; } } else { echo ""; } ?>
    sg->OldFileExists()) { echo "
  • " . str_replace("%s",wp_nonce_url($this->sg->GetBackLink() . "&sm_delete_old=true",'sitemap'),__('There is still a sitemap.xml or sitemap.xml.gz file in your site directory. Please delete them as no static files are used anymore or try to delete them automatically.','sitemap')) . "
  • "; } echo "
  • " . str_replace("%s",$this->sg->getXmlUrl(),__('The URL to your sitemap index file is: %s.','sitemap')) . "
  • "; if($status == null) { echo "
  • " . __('Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.','sitemap') . "
  • "; } else { $services = $status->GetUsedPingServices(); foreach($services AS $service) { $name = $status->GetServiceName($service); if($status->GetPingResult($service)) { echo "
  • " . sprintf(__("%s was successfully notified about changes.",'sitemap'),$name). "
  • "; $dur = $status->GetPingDuration($service); if($dur > 4) { echo "
  • " . str_replace(array("%time%","%name%"),array($dur,$name),__("It took %time% seconds to notify %name%, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "
  • "; } } else { echo "
  • " . str_replace(array("%s","%name%"),array(wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=" . $service . "&noheader=true",'sitemap'),$name),__('There was a problem while notifying %name%. View result','sitemap')) . "
  • "; } } } ?> sg->GetOption('b_ping') || $this->sg->GetOption('b_pingmsn')): ?>
  • Notify Search Engines about ">your sitemap or ','','width=650, height=500, resizable=yes'); return false;">your main sitemap and all sub-sitemaps now.
  • " . str_replace("%d",wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true",'sitemap'),__('If you encounter any problems with your sitemap you can use the debug function to get more information.','sitemap')) . ""; ?>
  • rate it 5 stars! :)','sitemap'),$this->sg->GetRedirectLink('sitemap-works-note'),$this->sg->GetRedirectLink('sitemap-paypal')); ?>
HtmlPrintBoxFooter(); ?> sg->IsNginx() && $this->sg->IsUsingPermalinks()): ?> HtmlPrintBoxHeader('ngin_x',__('Webserver Configuration', 'sitemap')); ?>

"; } ?>

HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_basic_options',__('Basic Options', 'sitemap')); ?>
  • sg->GetOption("b_ping")==true?"checked=\"checked\"":"") ?> />
    sg->GetRedirectLink('sitemap-gwt'),__('No registration required, but you can join the Google Webmaster Tools to check crawling statistics.','sitemap')); ?>
  • sg->GetOption("b_pingmsn")==true?"checked=\"checked\"":"") ?> />
    sg->GetRedirectLink('sitemap-lwt'),__('No registration required, but you can join the Bing Webmaster Tools to check crawling statistics.','sitemap')); ?>

  • ()
  • ()

  • sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default')===true); ?> () sg->GetDefaultStyle()): ?>

HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_pages',__('Additional Pages', 'sitemap')); ?> For example, if your domain is www.foo.com and your site is located on www.foo.com/site you might want to include your homepage at www.foo.com','sitemap'); echo "
  • "; echo "" . __('Note','sitemap'). ": "; _e("If your site is in a subdirectory and you want to add pages which are NOT in the site directory or beneath, you MUST place your sitemap file in the root directory (Look at the "Location of your sitemap file" section on this page)!",'sitemap'); echo "
  • "; echo "" . __('URL to the page','sitemap'). ": "; _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ",'sitemap'); echo "
  • "; echo "" . __('Priority','sitemap') . ": "; _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'); echo "
  • "; echo "" . __('Last Changed','sitemap'). ": "; _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).",'sitemap'); echo "
"; ?>
HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_postprio',__('Post Priority', 'sitemap')); ?>

  • HtmlGetChecked($this->sg->GetOption("b_prio_provider"),"") ?> />

  • sg->GetPrioProviders(); for($i=0; $i

    HtmlGetChecked($this->sg->GetOption("b_prio_provider"),$provs[$i]) . " />
    " . call_user_func(array($provs[$i], 'getDescription')) . "

    "; } ?>
HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_includes',__('Sitemap Content', 'sitemap')); ?> :
  • sg->IsTaxonomySupported()): ?>
sg->IsTaxonomySupported()) { $taxonomies = $this->sg->GetCustomTaxonomies(); $enabledTaxonomies = $this->sg->GetOption('in_tax'); if(count($taxonomies)>0) { ?>:
    name, $enabledTaxonomies); ?>
sg->IsCustomPostTypesSupported()) { $custom_post_types = $this->sg->GetCustomPostTypes(); $enabledPostTypes = $this->sg->GetOption('in_customtypes'); if(count($custom_post_types)>0) { ?>:
    name, $enabledPostTypes); ?>
:

  • all sitemap entries.', 'sitemap') ?>
HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_excludes',__('Excluded Items', 'sitemap')); ?> :
    sg->GetOption("b_exclude_cats"),false); ?>
:

:
HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_change_frequencies',__('Change Frequencies', 'sitemap')); ?>

:

  • sg->IsTaxonomySupported()): ?>
HtmlPrintBoxFooter(); ?> HtmlPrintBoxHeader('sm_priorities',__('Priorities', 'sitemap')); ?>
  • sg->IsTaxonomySupported()): ?>
HtmlPrintBoxFooter(); ?>

array("cc"=>"USD","lc"=>"US"), "en-GB"=>array("cc"=>"GBP","lc"=>"GB"), "de"=>array("cc"=>"EUR","lc"=>"DE"), ); $myLc = $lc["en"]; $wpl = get_bloginfo('language'); if(!empty($wpl)) { if(array_key_exists($wpl,$lc)) $myLc = $lc[$wpl]; else { $wpl = substr($wpl,0,2); if(array_key_exists($wpl,$lc)) $myLc = $lc[$wpl]; } } ?> " /> " /> " /> "/>