<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet title="XSL_formatting" type="text/xsl" href="http://postedpost.com/wp-content/feedxsl/feeder.xsl"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Posted Post &#187; WordPress</title>
	<atom:link href="http://postedpost.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://postedpost.com</link>
	<description>Posted People, Posted Life.</description>
	<lastBuildDate>Thu, 08 Oct 2009 12:46:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple Fix Dagon Design Form Mailer Cannot Send Mail in WordPress</title>
		<link>http://postedpost.com/2009/01/06/simple-fix-dagon-design-form-mailer-cannot-send-mail-in-wordpress/</link>
		<comments>http://postedpost.com/2009/01/06/simple-fix-dagon-design-form-mailer-cannot-send-mail-in-wordpress/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 21:56:34 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://postedpost.com/?p=89</guid>
		<description><![CDATA[For default, there do not have a Form widgets in WordPress, so I use Dagon Design Form Mailer, very easy to use.
Ok, I am not introduce you the form mailer here, I met problem indeed. I use the mailer for get email, the problem is, no matter how hard I try, how many settings I [...]]]></description>
			<content:encoded><![CDATA[<p>For default, there do not have a Form widgets in WordPress, so I use Dagon Design Form Mailer, very easy to use.</p>
<p>Ok, I am not introduce you the form mailer here, I met problem indeed. I use the mailer for get email, the problem is, no matter how hard I try, how many settings I change, there is just no mail arrive my box. <img src='http://postedpost.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> <span id="more-89"></span></p>
<p>The WordPress itself works well and can send email. So, simple fix is use wordpress mail function instead the one in the <a href="http://www.dagondesign.com/articles/secure-form-mailer-plugin-for-wordpress/" target="_blank">Form Mailer</a>.</p>
<p>Here is how to do it:</p>
<p>open <strong>dd-formmailer.php</strong> file, find the <strong>mail function</strong>: (mail($send_to, $email_subject, $msg, $headers);</p>
<p>change <strong>mail </strong>to <strong>wp_mail</strong>. Done.</p>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2009/01/06/simple-fix-dagon-design-form-mailer-cannot-send-mail-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<dc:id>89</dc:id>	</item>
		<item>
		<title>Fix Weird Wordpress Relative Path Problem</title>
		<link>http://postedpost.com/2008/10/13/fix-weird-wordpress-relative-path-problem/</link>
		<comments>http://postedpost.com/2008/10/13/fix-weird-wordpress-relative-path-problem/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 19:14:44 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=58</guid>
		<description><![CDATA[After update Wordpress to 3.0, I noticed some weird server-relative path appear in the post source file, for example:
&#60;a href=&#8221;./tag/something/&#8221;&#62;something&#60;/a&#62;
And it should be ( and always before update), a absolute path like
&#60;a href=&#8221;http://postedpost.com/tag/something/&#8221;&#62;something&#60;/a&#62;
It&#8217;s strange and hard to notice because the relative path works fine in the blog site itself, but, but it will mess up [...]]]></description>
			<content:encoded><![CDATA[<p>After update Wordpress to 3.0, I noticed some weird server-<a href="http://postedpost.com/tag/relative-path/"><strong>relative path</strong></a> appear in the post source file, for example:</p>
<p>&lt;a href=&#8221;./tag/<a href="http://postedpost.com/tag/something/">something</a>/&#8221;&gt;<a href="http://postedpost.com/tag/something/">something</a>&lt;/a&gt;</p>
<p>And it should be ( and always before update), a absolute <a href="http://postedpost.com/tag/path/">path</a> like</p>
<p>&lt;a href=&#8221;http://postedpost.com/tag/<a href="http://postedpost.com/tag/something/">something</a>/&#8221;&gt;<a href="http://postedpost.com/tag/something/">something</a>&lt;/a&gt;</p>
<p>It&#8217;s strange and hard to notice because the <a href="http://postedpost.com/tag/relative-path/"><strong>relative path</strong></a> works fine in the blog site itself, but, but it will mess up the <a href="http://postedpost.com/tag/code/">code</a> at third party, like feedburner <a href="http://postedpost.com/tag/code/">code</a> etc.<span id="more-58"></span></p>
<p>After investigate, I convinced the problem is the html <a href="http://postedpost.com/tag/code/">code</a> editor does not load properly.</p>
<p>The html editor located at /wp-includes/js/tinymce/, you can check this folder, lots and lots of file inside. I can understand why it&#8217;s not load right every time.</p>
<p>Anyway, a little <a href="http://postedpost.com/tag/code/">code</a> can fix this problem, dynamic replace the <a href="http://postedpost.com/tag/relative-path/"><strong>relative path</strong></a> to absolute <a href="http://postedpost.com/tag/path/">path</a> when <a href="http://postedpost.com/tag/code/">code</a> displayed, because simply <a href="http://postedpost.com/tag/relative-path/"><strong>relative path</strong></a> does not make sense.</p>
<pre>function postedpost_content($<a href="http://postedpost.com/tag/content/">content</a>){
 $siteurl = get_settings('siteurl');
 if (strpos($<a href="http://postedpost.com/tag/content/">content</a>, '"http://postedpost.com/') !== false) $<a href="http://postedpost.com/tag/content/">content</a> = str_replace('"http://postedpost.com/', '"' . $siteurl . '/', $<a href="http://postedpost.com/tag/content/">content</a>);
 return $<a href="http://postedpost.com/tag/content/">content</a>;
}
add_filter('the_content', 'postedpost_content', 20, 1);</pre>
<p>Put the <a href="http://postedpost.com/tag/code/">code</a> into <a href="http://postedpost.com/tag/postedpostphp/">postedpost.php</a> file at mu-plugins folder, done.</p>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/10/13/fix-weird-wordpress-relative-path-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>58</dc:id>	</item>
		<item>
		<title>WordPress mu Sitemap Files: postedpost.php</title>
		<link>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-postedpost-php/</link>
		<comments>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-postedpost-php/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 18:52:20 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[Sample File]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=51</guid>
		<description><![CDATA[Check WordPress Mu Google XML Sitemap Solution for what this file is about.
Filename postedpost.php, placed into mu-plugins folder. Please note, if you have any other code or hacks, you can put all code together, for increase performance.
&#60;?php
// postedpost.php, for WordPress Mu Google XML Sitemap Solution
// http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/
Function postedpost_do_robots() {
    global $current_blog;
   [...]]]></description>
			<content:encoded><![CDATA[<p>Check <a title="Permanent link to WordPress Mu Google XML Sitemap Solution" rel="bookmark" href="http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/"><strong>WordPress Mu Google XML Sitemap Solution</strong></a> for what this file is about.</p>
<p>Filename <strong>postedpost.php</strong>, placed into mu-plugins folder. Please note, if you have any other code or hacks, you can put all code together, for increase performance.<span id="more-51"></span></p>
<pre>&lt;?php
// postedpost.php, for WordPress Mu Google XML Sitemap Solution
// http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/
Function postedpost_do_robots() {
    global $current_blog;
    if ('0' != $current_blog-&gt;public ) {
        $siteurl = get_settings('siteurl');
        if ( class_exists('GoogleSitemapGeneratorLoader' ) ) {
            echo "Sitemap: " . $siteurl . "/sitemap.xml\n";
            echo "Sitemap: " . $siteurl . "/sitemap.xml.gz\n";
        }
    }
}
add_action('do_robots', 'postedpost_do_robots', 20);

Function postedpost_rewrite_rules_array($rules){
    $newrules = array();
    $newrules['sitemap\.(xml|xml\.gz)$'] = 'index.php?is_page_redirect=1&amp;redirect_method=sitemap&amp;redirect_url=$matches[1]';
    return $newrules+$rules;
}
add_filter('rewrite_rules_array', 'postedpost_rewrite_rules_array');

Function postedpost_parse_query($query){
    global $blog_id;;
    $siteurl = get_settings('siteurl');
    $uri = parse_url($siteurl);
    if(!empty($query-&gt;query_vars['is_page_redirect'])){
        $redirect_method = $query-&gt;query_vars['redirect_method'];
        if ( $redirect_method == 'sitemap' ) {
            $redirect_url = $siteurl . '/wp-content/blogs.dir/' . $blog_id . '/files/sitemap.' . $redirect_url;
        } else {
            $redirect_url = get_settings('siteurl');
            Header('HTTP/1.1 301 Moved Permanently');
            Header('Location: ' . get_settings('siteurl'));
            exit();
        }
        Header('HTTP/1.1 302 Moved Temporarily');
        Header('Location: ' . $redirect_url);
        exit();
    }
}
add_action('parse_query', 'postedpost_parse_query');

Function postedpost_init() {
    global $wp_rewrite;
    // postedpost_flush_rewrite_rules
    $wp_rewrite-&gt;flush_rules();
    add_rewrite_tag('%comment_id%', '(([0-9]{1,})');
}
add_action('init', 'postedpost_init');

?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-postedpost-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>51</dc:id>	</item>
		<item>
		<title>WordPress mu Sitemap Files: sitemap-ui.php</title>
		<link>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-ui-php/</link>
		<comments>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-ui-php/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 18:43:56 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[Sample File]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=48</guid>
		<description><![CDATA[Check WordPress Mu Google XML Sitemap Solution for what this file is about.
File name sitemap-ui.php, a modified version of Google Sitemaps Generator (from verison 3.1.0.1)
&#60;?php
/*

 $Id: sitemap-ui.php 48028 2008-05-27 14:29:50Z arnee $

*/

class GoogleSitemapGeneratorUI {

    var $sg = null;

    function GoogleSitemapGeneratorUI($sitemapBuilder) {
        $this-&#62;sg [...]]]></description>
			<content:encoded><![CDATA[<p>Check <a title="Permanent link to WordPress Mu Google XML Sitemap Solution" rel="bookmark" href="http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/"><strong>WordPress Mu Google XML Sitemap Solution</strong></a> for what this file is about.</p>
<p>File name <strong>sitemap-ui.php</strong>, a modified version of <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" target="_blank">Google Sitemaps Generator</a> (from verison 3.1.0.1)<span id="more-48"></span></p>
<pre>&lt;?php
/*

 $Id: sitemap-ui.php 48028 2008-05-27 14:29:50Z arnee $

*/

class GoogleSitemapGeneratorUI {

    var $sg = null;

    function GoogleSitemapGeneratorUI($sitemapBuilder) {
        $this-&gt;sg = $sitemapBuilder;
    }

    /**
     * Displays the option page
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     */
    function HtmlShowOptionsPage() {
        global $wp_version;
        $this-&gt;sg-&gt;Initate();

        //All output should go in this var which get printed at the end
        $message="";

        if(isset($_GET['sm_hidedonate'])) {
            $this-&gt;sg-&gt;SetOption('i_hide_donated',true);
            $this-&gt;sg-&gt;SaveOptions();
        }
        if(isset($_GET['sm_donated'])) {
            $this-&gt;sg-&gt;SetOption('i_donated',true);
            $this-&gt;sg-&gt;SaveOptions();
        }
        if(isset($_GET['sm_hide_note'])) {
            $this-&gt;sg-&gt;SetOption('i_hide_note',true);
            $this-&gt;sg-&gt;SaveOptions();
        }
        if(isset($_GET['sm_hidedonors'])) {
            $this-&gt;sg-&gt;SetOption('i_hide_donors',true);
            $this-&gt;sg-&gt;SaveOptions();
        }

        if(isset($_GET['sm_donated']) || ($this-&gt;sg-&gt;GetOption('i_donated')===true &amp;&amp; $this-&gt;sg-&gt;GetOption('i_hide_donated')!==true)) {
            ?&gt;
            &lt;div class="updated"&gt;
                &lt;strong&gt;&lt;p&gt;&lt;?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'); ?&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetBackLink() . "&amp;amp;sm_hidedonate=true"; ?&gt;"&gt;&lt;small style="font-weight:normal;"&gt;&lt;?php _e('Hide this notice', 'sitemap'); ?&gt;&lt;/small&gt;&lt;/a&gt;&lt;/p&gt;&lt;/strong&gt;
            &lt;/div&gt;
            &lt;?php
        } else if($this-&gt;sg-&gt;GetOption('i_donated') !== true &amp;&amp; $this-&gt;sg-&gt;GetOption('i_install_date')&gt;0 &amp;&amp; $this-&gt;sg-&gt;GetOption('i_hide_note')!==true &amp;&amp; time() &gt; ($this-&gt;sg-&gt;GetOption('i_install_date') + (60*60*24*30))) {
            ?&gt;
            &lt;div class="updated"&gt;
                &lt;strong&gt;&lt;p&gt;&lt;?php echo str_replace("%s",$this-&gt;sg-&gt;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? &lt;a href="%s"&gt;Donations&lt;/a&gt; help me to continue support and development of this &lt;i&gt;free&lt;/i&gt; software! &lt;a href="%s"&gt;Sure, no problem!&lt;/a&gt;','sitemap')); ?&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetBackLink() . "&amp;amp;sm_hide_note=true"; ?&gt;" style="float:right; display:block; border:none;"&gt;&lt;small style="font-weight:normal; "&gt;&lt;?php _e('No thanks, please don\'t bug me anymore!', 'sitemap'); ?&gt;&lt;/small&gt;&lt;/a&gt;&lt;/p&gt;&lt;/strong&gt;
                &lt;div style="clear:right;"&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;?php
        }

        if(function_exists("wp_next_scheduled")) {
            $next = wp_next_scheduled('sm_build_cron');
            if($next) {
                $diff = (time()-$next)*-1;
                if($diff &lt;= 0) {
                    $diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!','sitemap');
                } else {
                    $diffMsg = str_replace("%s",$diff,__('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!','sitemap'));
                }
                ?&gt;
                &lt;div class="updated"&gt;
                    &lt;strong&gt;&lt;p&gt;&lt;?php echo $diffMsg ?&gt;&lt;/p&gt;&lt;/strong&gt;
                    &lt;div style="clear:right;"&gt;&lt;/div&gt;
                &lt;/div&gt;
                &lt;?php
            }
        }

        if(!empty($_REQUEST["sm_rebuild"])) { //Pressed Button: Rebuild Sitemap
            check_admin_referer('sitemap');
            if(isset($_GET["sm_do_debug"]) &amp;&amp; $_GET["sm_do_debug"]=="true") {

                //Check again, just for the case that something went wrong before
                if(!current_user_can("administrator")) {
                    echo '&lt;p&gt;Please log in as admin&lt;/p&gt;';
                    return;
                }

                $oldErr = error_reporting(E_ALL);
                $oldIni = ini_set("display_errors",1);

                echo '&lt;div class="wrap"&gt;';
                echo '&lt;h2&gt;' .  __('XML Sitemap Generator for WordPress', 'sitemap') .  " " . $this-&gt;sg-&gt;GetVersion(). '&lt;/h2&gt;';
                echo '&lt;p&gt;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.&lt;/p&gt;';
                echo '&lt;p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;"&gt;DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!&lt;/p&gt;';
                echo "&lt;h3&gt;WordPress and PHP Information&lt;/h3&gt;";
                echo '&lt;p&gt;WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '&lt;/p&gt;';
                echo '&lt;p&gt;Plugin version: ' . $this-&gt;sg-&gt;GetVersion() . ' (' . $this-&gt;sg-&gt;_svnVersion . ')';
                echo '&lt;h4&gt;Environment&lt;/h4&gt;';
                echo "&lt;pre&gt;";
                $sc = $_SERVER;
                unset($sc["HTTP_COOKIE"]);
                print_r($sc);
                echo "&lt;/pre&gt;";
                echo "&lt;h4&gt;WordPress Config&lt;/h4&gt;";
                echo "&lt;pre&gt;";
                $opts = wp_load_alloptions();
                $popts = array();
                foreach($opts as $k=&gt;$v) {
                    //Try to filter out passwords etc...
                    if(preg_match("/(pass|login|pw|secret|user|usr)/si",$v)) continue;
                    $popts[$k] = htmlspecialchars($v);
                }
                print_r($popts);
                echo "&lt;/pre&gt;";
                echo '&lt;h4&gt;Sitemap Config&lt;/h4&gt;';
                echo "&lt;pre&gt;";
                print_r($this-&gt;sg-&gt;_options);
                echo "&lt;/pre&gt;";
                echo '&lt;h3&gt;Errors, Warnings, Notices&lt;/h3&gt;';
                echo '&lt;div&gt;';
                $status = $this-&gt;sg-&gt;BuildSitemap();
                echo '&lt;/div&gt;';
                echo '&lt;h3&gt;MySQL Queries&lt;/h3&gt;';
                if(defined('SAVEQUERIES') &amp;&amp; SAVEQUERIES) {
                    echo '&lt;pre&gt;';
                    var_dump($GLOBALS['wpdb']-&gt;queries);
                    echo '&lt;/pre&gt;';

                    $total = 0;
                    foreach($GLOBALS['wpdb']-&gt;queries as $q) {
                        $total+=$q[1];
                    }
                    echo '&lt;h4&gt;Total Query Time&lt;/h4&gt;';
                    echo '&lt;pre&gt;' . count($GLOBALS['wpdb']-&gt;queries) . ' queries in ' . round($total,2) . ' seconds.&lt;/pre&gt;';
                } else {
                    echo '&lt;p&gt;Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.&lt;/p&gt;';
                }
                echo "&lt;h3&gt;Build Process Results&lt;/h3&gt;";
                echo "&lt;pre&gt;";
                print_r($status);
                echo "&lt;/pre&gt;";
                echo '&lt;p&gt;Done. &lt;a href="' . wp_nonce_url($this-&gt;sg-&gt;GetBackLink() . "&amp;sm_rebuild=true&amp;sm_do_debug=true",'sitemap') . '"&gt;Rebuild&lt;/a&gt; or &lt;a href="' . $this-&gt;sg-&gt;GetBackLink() . '"&gt;Return&lt;/a&gt;&lt;/p&gt;';
                echo '&lt;p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;"&gt;DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!&lt;/p&gt;';
                echo '&lt;/div&gt;';
                @error_reporting($oldErr);
                @ini_set("display_errors",$oldIni);
                return;
            } else {
                $this-&gt;sg-&gt;BuildSitemap();
                //Redirect so the sm_rebuild GET parameter no longer exists.
                @header("location: " . $this-&gt;sg-&gt;GetBackLink());
                //If there was already any other output, the header redirect will fail
                echo '&lt;script type="text/javascript"&gt;location.replace("' . $this-&gt;sg-&gt;GetBackLink() . '");&lt;/script&gt;';
                echo '&lt;noscript&gt;&lt;a href="' . $this-&gt;sg-&gt;GetBackLink() . '"&gt;Click here to continue&lt;/a&gt;&lt;/noscript&gt;';
                exit;
            }
        } else if (!empty($_POST['sm_update'])) { //Pressed Button: Update Config
            check_admin_referer('sitemap');
            foreach($this-&gt;sg-&gt;_options as $k=&gt;$v) {
                //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_filename" || $k=="sm_b_fileurl_manual" || $k=="sm_b_filename_manual" || $k=="sm_b_prio_provider" || $k=="sm_b_manual_key" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") {
                        if($k=="sm_b_filename_manual" &amp;&amp; strpos($_POST[$k],"\\")!==false){
                            $_POST[$k]=stripslashes($_POST[$k]);
                        }
                        $this-&gt;sg-&gt;_options[$k]=(string) $_POST[$k];
                    } else if($k == "sm_b_time" || $k=="sm_b_max_posts") {
                        if($_POST[$k]=='') $_POST[$k] = -1;
                        $this-&gt;sg-&gt;_options[$k] = intval($_POST[$k]);
                    } else if($k== "sm_i_install_date") {
                        if($this-&gt;sg-&gt;GetOption('i_install_date')&lt;=0) $this-&gt;sg-&gt;_options[$k] = time();
                    } else if($k=="sm_b_exclude") {
                        $IDss = array();
                        $IDs = explode(",",$_POST[$k]);
                        for($x = 0; $x&lt;count($IDs); $x++) {
                            $ID = intval(trim($IDs[$x]));
                            if($ID&gt;0) $IDss[] = $ID;
                        }
                        $this-&gt;sg-&gt;_options[$k] = $IDss;
                    } else {
                        $this-&gt;sg-&gt;_options[$k]=(bool) $_POST[$k];
                    }
                //Options of the category "Includes" are boolean
                } else if(substr($k,0,6)=="sm_in_") {
                    $this-&gt;sg-&gt;_options[$k]=(bool) $_POST[$k];
                //Options of the category "Change frequencies" are string
                } else if(substr($k,0,6)=="sm_cf_") {
                    $this-&gt;sg-&gt;_options[$k]=(string) $_POST[$k];
                //Options of the category "Priorities" are float
                } else if(substr($k,0,6)=="sm_pr_") {
                        $this-&gt;sg-&gt;_options[$k]=(float) $_POST[$k];
                }
            }

            //Apply page changes from POST
            $this-&gt;sg-&gt;_pages=$this-&gt;sg-&gt;HtmlApplyPages();

            if($this-&gt;sg-&gt;SaveOptions()) $message.=__('Configuration updated', 'sitemap') . "&lt;br /&gt;";
            else $message.=__('Error while saving options', 'sitemap') . "&lt;br /&gt;";

            if($this-&gt;sg-&gt;SavePages()) $message.=__("Pages saved",'sitemap') . "&lt;br /&gt;";
            else $message.=__('Error while saving pages', 'sitemap'). "&lt;br /&gt;";

        } else if(!empty($_POST["sm_reset_config"])) { //Pressed Button: Reset Config
            check_admin_referer('sitemap');
            $this-&gt;sg-&gt;InitOptions();
            $this-&gt;sg-&gt;SaveOptions();

            $message.=__('The default configuration was restored.','sitemap');
        }

        //Print out the message to the user, if any
        if($message!="") {
            ?&gt;
            &lt;div class="updated"&gt;&lt;strong&gt;&lt;p&gt;&lt;?php
            echo $message;
            ?&gt;&lt;/p&gt;&lt;/strong&gt;&lt;/div&gt;&lt;?php
        }
        ?&gt;

        &lt;style type="text/css"&gt;

        li.sm_hint {
            color:green;
        }

        li.sm_optimize {
            color:orange;
        }

        li.sm_error {
            color:red;
        }

        input.sm_warning:hover {
            background: #ce0000;
            color: #fff;
        }

        a.sm_button {
            padding:4px;
            display:block;
            padding-left:25px;
            background-repeat:no-repeat;
            background-position:5px 50%;
            text-decoration:none;
            border:none;
        }

        a.sm_button:hover {
            border-bottom-width:1px;
        }

        a.sm_donatePayPal {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-paypal.gif);
        }

        a.sm_donateAmazon {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-amazon.gif);
        }

        a.sm_pluginHome {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-arne.gif);
        }

        a.sm_pluginList {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-email.gif);
        }

        a.sm_pluginSupport {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-wordpress.gif);
        }

        a.sm_pluginBugs {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-trac.gif);
        }

        a.sm_resGoogle {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-google.gif);
        }

        a.sm_resYahoo {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-yahoo.gif);
        }

        a.sm_resLive {
            background-image:url(&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-live.gif);
        }

        div.sm-update-nag p {
            margin:5px;
        }

        &lt;/style&gt;

        &lt;?php
            if(version_compare($wp_version,"2.5","&gt;=")) {
                ?&gt;
            &lt;style type="text/css"&gt;
            div#moremeta {
                float:right;
                width:200px;
                margin-left:10px;
            }
            div#advancedstuff {
                width:770px;
            }
            div#poststuff {
                margin-top:10px;
            }
            fieldset.dbx-box {
                margin-bottom:5px;
            }

            div.sm-update-nag {
                margin-top:10px!important;
            }

            &lt;/style&gt;
            &lt;!--[if lt IE 7]&gt;
            &lt;style type="text/css"&gt;
            div#advancedstuff {
                width:735px;
            }
            &lt;/style&gt;
            &lt;![endif]--&gt;

            &lt;?php
            } else { ?&gt;
            &lt;style type="text/css"&gt;
            div.updated-message {
                margin-left:0; margin-right:0;
            }
            &lt;/style&gt;
            &lt;?php }
        ?&gt;

        &lt;div class="wrap" id="sm_div"&gt;
            &lt;form method="post" action="&lt;?php echo $this-&gt;sg-&gt;GetBackLink() ?&gt;"&gt;
                &lt;h2&gt;&lt;?php _e('XML Sitemap Generator for WordPress', 'sitemap'); echo " " . $this-&gt;sg-&gt;GetVersion() ?&gt; &lt;/h2&gt;
        &lt;?php
        if(function_exists("wp_update_plugins") &amp;&amp; (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
            wp_update_plugins();

            $file = GoogleSitemapGeneratorLoader::GetBaseName();

            $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile());
            $current = get_option( 'update_plugins' );
            if(isset($current-&gt;response[$file])) {
                $r = $current-&gt;response[$file];
                ?&gt;&lt;div id="update-nag" class="sm-update-nag"&gt;&lt;?php
                if ( !current_user_can('edit_plugins') || version_compare($wp_version,"2.5","&lt;") )
                    printf( __('There is a new version of %1$s available. &lt;a href="%2$s"&gt;Download version %3$s here&lt;/a&gt;.','default'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version);
                else if ( empty($r-&gt;package) )
                    printf( __('There is a new version of %1$s available. &lt;a href="%2$s"&gt;Download version %3$s here&lt;/a&gt; &lt;em&gt;automatic upgrade unavailable for this plugin&lt;/em&gt;.','default'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version);
                else
                    printf( __('There is a new version of %1$s available. &lt;a href="%2$s"&gt;Download version %3$s here&lt;/a&gt; or &lt;a href="%4$s"&gt;upgrade automatically&lt;/a&gt;.','default'), $plugin_data['Name'], $r-&gt;url, $r-&gt;new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;amp;plugin=$file", 'upgrade-plugin_' . $file) );

                ?&gt;&lt;/div&gt;&lt;?php
            }
        }
        ?&gt;

                &lt;?php if(version_compare($wp_version,"2.5","&lt;")): ?&gt;
                &lt;script type="text/javascript" src="http://postedpost.com/wp-includes/js/dbx.js"&gt;&lt;/script&gt;
                &lt;script type="text/javascript"&gt;
                //&lt;![CDATA[
                addLoadEvent( function() {
                    var manager = new dbxManager('sm_sitemap_meta_33');

                    //create new docking boxes group
                    var meta = new dbxGroup(
                        'grabit',         // container ID [/-_a-zA-Z0-9/]
                        'vertical',     // orientation ['vertical'|'horizontal']
                        '10',             // drag threshold ['n' pixels]
                        'no',            // restrict drag movement to container axis ['yes'|'no']
                        '10',             // animate re-ordering [frames per transition, or '0' for no effect]
                        'yes',             // include open/close toggle buttons ['yes'|'no']
                        'open',         // default state ['open'|'closed']
                        &lt;?php echo "'" . js_escape(__('open')); ?&gt;',         // word for "open", as in "open this box"
                        &lt;?php echo "'" . js_escape(__('close')); ?&gt;',         // word for "close", as in "close this box"
                        &lt;?php echo "'" . js_escape(__('click-down and drag to move this box')); ?&gt;', // sentence for "move this box" by mouse
                        &lt;?php echo "'" . js_escape(__('click to %toggle% this box')); ?&gt;', // pattern-match sentence for "(open|close) this box" by mouse
                        &lt;?php echo "'" . js_escape(__('use the arrow keys to move this box')); ?&gt;', // sentence for "move this box" by keyboard
                        &lt;?php echo "'" . js_escape(__(', or press the enter key to %toggle% it')); ?&gt;',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
                        '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
                        );

                    var advanced = new dbxGroup(
                        'advancedstuff',         // container ID [/-_a-zA-Z0-9/]
                        'vertical',         // orientation ['vertical'|'horizontal']
                        '10',             // drag threshold ['n' pixels]
                        'yes',            // restrict drag movement to container axis ['yes'|'no']
                        '10',             // animate re-ordering [frames per transition, or '0' for no effect]
                        'yes',             // include open/close toggle buttons ['yes'|'no']
                        'open',         // default state ['open'|'closed']
                        &lt;?php echo "'" . js_escape(__('open')); ?&gt;',         // word for "open", as in "open this box"
                        &lt;?php echo "'" . js_escape(__('close')); ?&gt;',         // word for "close", as in "close this box"
                        &lt;?php echo "'" . js_escape(__('click-down and drag to move this box')); ?&gt;', // sentence for "move this box" by mouse
                        &lt;?php echo "'" . js_escape(__('click to %toggle% this box')); ?&gt;', // pattern-match sentence for "(open|close) this box" by mouse
                        &lt;?php echo "'" . js_escape(__('use the arrow keys to move this box')); ?&gt;', // sentence for "move this box" by keyboard
                        &lt;?php echo "'" . js_escape(__(', or press the enter key to %toggle% it')); ?&gt;',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
                        '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
                        );
                });
                //]]&gt;
                &lt;/script&gt;
                &lt;?php endif; ?&gt;

                &lt;div id="poststuff"&gt;
                    &lt;div id="moremeta"&gt;
                        &lt;div id="grabit" class="dbx-group"&gt;
                            &lt;fieldset id="sm_pnres" class="dbx-box"&gt;
                                &lt;h3 class="dbx-handle"&gt;&lt;?php _e('About this Plugin:','sitemap'); ?&gt;&lt;/h3&gt;
                                &lt;div class="dbx-content"&gt;
                                    &lt;a class="sm_button sm_pluginHome"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-home'); ?&gt;"&gt;&lt;?php _e('Plugin Homepage','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_pluginHome"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-feedback'); ?&gt;"&gt;&lt;?php _e('Suggest a Feature','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_pluginList"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-list'); ?&gt;"&gt;&lt;?php _e('Notify List','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_pluginSupport" href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-support'); ?&gt;"&gt;&lt;?php _e('Support Forum','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_pluginBugs"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-bugs'); ?&gt;"&gt;&lt;?php _e('Report a Bug','sitemap'); ?&gt;&lt;/a&gt;

                                    &lt;a class="sm_button sm_donatePayPal"  href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-paypal'); ?&gt;"&gt;&lt;?php _e('Donate with PayPal','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_donateAmazon"  href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-amazon'); ?&gt;"&gt;&lt;?php _e('My Amazon Wish List','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;?php if(__('translator_name','sitemap')!='translator_name') {?&gt;&lt;a class="sm_button sm_pluginSupport" href="&lt;?php _e('translator_url','sitemap'); ?&gt;"&gt;&lt;?php _e('translator_name','sitemap'); ?&gt;&lt;/a&gt;&lt;?php } ?&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                            &lt;fieldset id="sm_smres" class="dbx-box"&gt;
                                &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Sitemap Resources:','sitemap'); ?&gt;&lt;/h3&gt;
                                &lt;div class="dbx-content"&gt;
                                    &lt;a class="sm_button sm_resGoogle"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-gwt'); ?&gt;"&gt;&lt;?php _e('Webmaster Tools','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_resGoogle"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-gwb'); ?&gt;"&gt;&lt;?php _e('Webmaster Blog','sitemap'); ?&gt;&lt;/a&gt;

                                    &lt;a class="sm_button sm_resYahoo"     href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-yse'); ?&gt;"&gt;&lt;?php _e('Site Explorer','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_resYahoo"     href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-ywb'); ?&gt;"&gt;&lt;?php _e('Search Blog','sitemap'); ?&gt;&lt;/a&gt;

                                    &lt;a class="sm_button sm_resLive"     href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-lwt'); ?&gt;"&gt;&lt;?php _e('Webmaster Tools','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_resLive"     href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-lswcb'); ?&gt;"&gt;&lt;?php _e('Webmaster Center Blog','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;br /&gt;
                                    &lt;a class="sm_button sm_resGoogle"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-prot'); ?&gt;"&gt;&lt;?php _e('Sitemaps Protocol','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_resGoogle"    href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-ofaq'); ?&gt;"&gt;&lt;?php _e('Official Sitemaps FAQ','sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;a class="sm_button sm_pluginHome"   href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-afaq'); ?&gt;"&gt;&lt;?php _e('My Sitemaps FAQ','sitemap'); ?&gt;&lt;/a&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;

                            &lt;fieldset id="dm_donations" class="dbx-box"&gt;
                                &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Recent Donations:','sitemap'); ?&gt;&lt;/h3&gt;
                                &lt;div class="dbx-content"&gt;
                                    &lt;?php if($this-&gt;sg-&gt;GetOption('i_hide_donors')!==true) { ?&gt;
                                        &lt;iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-donorlist'); ?&gt;"&gt;
                                        &lt;?php _e('List of the donors','sitemap'); ?&gt;
                                        &lt;/iframe&gt;&lt;br /&gt;
                                        &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetBackLink() . "&amp;amp;sm_hidedonors=true"; ?&gt;"&gt;&lt;small&gt;&lt;?php _e('Hide this list','sitemap'); ?&gt;&lt;/small&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                    &lt;?php } ?&gt;
                                    &lt;a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"&gt;&lt;img style="vertical-align:middle; border:none; margin-top:2px;" src="&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin <img src='http://postedpost.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> " /&gt;&lt;/a&gt;
                                    &lt;span&gt;&lt;small&gt;&lt;?php _e('Thanks for your support!','sitemap'); ?&gt;&lt;/small&gt;&lt;/span&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;

                    &lt;div id="advancedstuff" class="dbx-group" &gt;

                        &lt;!-- Rebuild Area --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_rebuild" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Status', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;ul&gt;
                                            &lt;?php

                                            //#type $status GoogleSitemapGeneratorStatus
                                            $status = GoogleSitemapGeneratorStatus::Load();
                                            if($status == null) {

                                                echo "&lt;li&gt;" . str_replace("%s",wp_nonce_url($this-&gt;sg-&gt;GetBackLink() . "&amp;sm_rebuild=true",'sitemap'),__('The sitemap wasn\'t built yet. &lt;a href="%s"&gt;Click here&lt;/a&gt; to build it the first time.','sitemap')) . "&lt;/li&gt;";
                                            }  else {
                                                if($status-&gt;_endTime !== 0) {
                                                    if($status-&gt;_usedXml) {
                                                        if($status-&gt;_xmlSuccess) {
                                                            $ft = filemtime($status-&gt;_xmlPath);
                                                            echo "&lt;li&gt;" . str_replace("%url%",$status-&gt;_xmlUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your &lt;a href=\"%url%\"&gt;sitemap&lt;/a&gt; was last built on &lt;b&gt;%date%&lt;/b&gt;.",'sitemap'))) . "&lt;/li&gt;";
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%url%",$this-&gt;sg-&gt;GetRedirectLink('sitemap-help-files'),__("There was a problem writing your sitemap file. Make sure the file exists and is writable. &lt;a href=\"%url%\"&gt;Learn more&lt;/a",'sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    if($status-&gt;_usedZip) {
                                                        if($status-&gt;_zipSuccess) {
                                                                $ft = filemtime($status-&gt;_zipPath);
                                                                echo "&lt;li&gt;" . str_replace("%url%",$status-&gt;_zipUrl,str_replace("%date%",date(get_option('date_format'),$ft) . " " . date(get_option('time_format'),$ft),__("Your sitemap (&lt;a href=\"%url%\"&gt;zipped&lt;/a&gt;) was last built on &lt;b&gt;%date%&lt;/b&gt;.",'sitemap'))) . "&lt;/li&gt;";
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%url%",$this-&gt;sg-&gt;GetRedirectLink('sitemap-help-files'),__("There was a problem writing your zipped sitemap file. Make sure the file exists and is writable. &lt;a href=\"%url%\"&gt;Learn more&lt;/a",'sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    if($status-&gt;_usedGoogle) {
                                                        if($status-&gt;_gooogleSuccess) {
                                                            echo "&lt;li&gt;" .__("Google was &lt;b&gt;successfully notified&lt;/b&gt; about changes.",'sitemap'). "&lt;/li&gt;";
                                                            $gt = $status-&gt;GetGoogleTime();
                                                            if($gt&gt;4) {
                                                                echo "&lt;li class=\sm_optimize\"&gt;" . str_replace("%time%",$gt,__("It took %time% seconds to notify Google, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "&lt;/li&gt;";
                                                            }
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%s",$status-&gt;_googleUrl,__('There was a problem while notifying Google. &lt;a href="%s"&gt;View result&lt;/a&gt;','sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    if($status-&gt;_usedYahoo) {
                                                        if($status-&gt;_yahooSuccess) {
                                                            echo "&lt;li&gt;" .__("YAHOO was &lt;b&gt;successfully notified&lt;/b&gt; about changes.",'sitemap'). "&lt;/li&gt;";
                                                            $yt = $status-&gt;GetYahooTime();
                                                            if($yt&gt;4) {
                                                                echo "&lt;li class=\sm_optimize\"&gt;" . str_replace("%time%",$yt,__("It took %time% seconds to notify YAHOO, maybe you want to disable this feature to reduce the building time.",'sitemap')) . "&lt;/li&gt;";
                                                            }
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%s",$status-&gt;_yahooUrl,__('There was a problem while notifying YAHOO. &lt;a href="%s"&gt;View result&lt;/a&gt;','sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    if($status-&gt;_usedMsn) {
                                                        if($status-&gt;_msnSuccess) {
                                                            echo "&lt;li&gt;" .__("MSN was &lt;b&gt;successfully notified&lt;/b&gt; about changes.",'sitemap'). "&lt;/li&gt;";
                                                            $at = $status-&gt;GetMsnTime();
                                                            if($at&gt;4) {
                                                                echo "&lt;li class=\sm_optimize\"&gt;" . 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')) . "&lt;/li&gt;";
                                                            }
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%s",$status-&gt;_msnUrl,__('There was a problem while notifying MSN.com. &lt;a href="%s"&gt;View result&lt;/a&gt;','sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    if($status-&gt;_usedAsk) {
                                                        if($status-&gt;_askSuccess) {
                                                            echo "&lt;li&gt;" .__("Ask.com was &lt;b&gt;successfully notified&lt;/b&gt; about changes.",'sitemap'). "&lt;/li&gt;";
                                                            $at = $status-&gt;GetAskTime();
                                                            if($at&gt;4) {
                                                                echo "&lt;li class=\sm_optimize\"&gt;" . 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')) . "&lt;/li&gt;";
                                                            }
                                                        } else {
                                                            echo "&lt;li class=\"sm_error\"&gt;" . str_replace("%s",$status-&gt;_askUrl,__('There was a problem while notifying Ask.com. &lt;a href="%s"&gt;View result&lt;/a&gt;','sitemap')) . "&lt;/li&gt;";
                                                        }
                                                    }

                                                    $et = $status-&gt;GetTime();
                                                    $mem = $status-&gt;GetMemoryUsage();

                                                    if($mem &gt; 0) {
                                                        echo "&lt;li&gt;" .str_replace(array("%time%","%memory%"),array($et,$mem),__("The building process took about &lt;b&gt;%time% seconds&lt;/b&gt; to complete and used %memory% MB of memory.",'sitemap')). "&lt;/li&gt;";
                                                    } else {
                                                        echo "&lt;li&gt;" .str_replace("%time%",$et,__("The building process took about &lt;b&gt;%time% seconds&lt;/b&gt; to complete.",'sitemap')). "&lt;/li&gt;";
                                                    }

                                                    if(!$status-&gt;_hasChanged) {
                                                        echo "&lt;li&gt;" . __("The content of your sitemap &lt;strong&gt;didn't change&lt;/strong&gt; since the last time so the files were not written and no search engine was pinged.",'sitemap'). "&lt;/li&gt;";
                                                    }

                                                } else {
                                                    if($this-&gt;sg-&gt;GetOption("sm_b_auto_delay")) {
                                                        $st = ($status-&gt;GetStartTime() - time()) * -1;
                                                        //If the building process runs in background and was started within the last 45 seconds, the sitemap might not be completed yet...
                                                        if($st &lt; 45) {
                                                            echo '&lt;li class=""&gt;'. __("The building process might still be active! Reload the page in a few seconds and check if something has changed.",'sitemap') . '&lt;/li&gt;';
                                                        }
                                                    }
                                                    echo '&lt;li class="sm_error"&gt;'. str_replace("%url%",$this-&gt;sg-&gt;GetRedirectLink('sitemap-help-memtime'),__("The last run didn't finish! Maybe you can raise the memory or time limit for PHP scripts. &lt;a href=\"%url%\"&gt;Learn more&lt;/a&gt;",'sitemap')) . '&lt;/li&gt;';
                                                    if($status-&gt;_memoryUsage &gt; 0) {
                                                        echo '&lt;li class="sm_error"&gt;'. str_replace(array("%memused%","%memlimit%"),array($status-&gt;GetMemoryUsage(),ini_get('memory_limit')),__("The last known memory usage of the script was %memused%MB, the limit of your server is %memlimit%.",'sitemap')) . '&lt;/li&gt;';
                                                    }

                                                    if($status-&gt;_lastTime &gt; 0) {
                                                        echo '&lt;li class="sm_error"&gt;'. str_replace(array("%timeused%","%timelimit%"),array($status-&gt;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')) . '&lt;/li&gt;';
                                                    }

                                                    if($status-&gt;GetLastPost() &gt; 0) {
                                                        echo '&lt;li class="sm_optimize"&gt;'. str_replace("%lastpost%",$status-&gt;GetLastPost(),__("The script stopped around post number %lastpost% (+/- 100)",'sitemap')) . '&lt;/li&gt;';
                                                    }
                                                }
                                                echo "&lt;li&gt;" . str_replace("%s",wp_nonce_url($this-&gt;sg-&gt;GetBackLink() . "&amp;sm_rebuild=true",'sitemap'),__('If you changed something on your server or blog, you should &lt;a href="%s"&gt;rebuild the sitemap&lt;/a&gt; manually.','sitemap')) . "&lt;/li&gt;";
                                            }
                                            echo "&lt;li&gt;" . str_replace("%d",wp_nonce_url($this-&gt;sg-&gt;GetBackLink() . "&amp;sm_rebuild=true&amp;sm_do_debug=true",'sitemap'),__('If you encounter any problems with the build process you can use the &lt;a href="%d"&gt;debug function&lt;/a&gt; to get more information.','sitemap')) . "&lt;/li&gt;";
                                            ?&gt;

                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;!-- Basic Options --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_basic_options" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Basic Options', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;b&gt;&lt;?php _e('Sitemap files:','sitemap'); ?&gt;&lt;/b&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-help-options-files'); ?&gt;"&gt;&lt;?php _e('Learn more','sitemap'); ?&gt;&lt;/a&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_xml"&gt;
                                                    &lt;input type="checkbox" id="sm_b_xml" name="sm_b_xml" &lt;?php echo ($this-&gt;sg-&gt;GetOption("b_xml")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Write a normal XML file (your filename)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_gzip"&gt;
                                                    &lt;input type="checkbox" id="sm_b_gzip" name="sm_b_gzip" &lt;?php if(function_exists("gzencode")) { echo ($this-&gt;sg-&gt;GetOption("b_gzip")==true?"checked=\"checked\"":""); } else echo "disabled=\"disabled\"";  ?&gt; /&gt;
                                                    &lt;?php _e('Write a gzipped file (your filename + .gz)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                        &lt;b&gt;&lt;?php _e('Building mode:','sitemap'); ?&gt;&lt;/b&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-help-options-process'); ?&gt;"&gt;&lt;?php _e('Learn more','sitemap'); ?&gt;&lt;/a&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_auto_enabled"&gt;
                                                    &lt;input type="checkbox" id="sm_b_auto_enabled" name="sm_b_auto_enabled" &lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_auto_enabled")==true?"checked=\"checked\"":""); ?&gt; /&gt;
                                                    &lt;?php _e('Rebuild sitemap if you change the content of your blog', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_manual_enabled"&gt;
                                                    &lt;input type="hidden" name="sm_b_manual_key" value="&lt;?php echo $this-&gt;sg-&gt;GetOption("b_manual_key"); ?&gt;" /&gt;
                                                    &lt;input type="checkbox" id="sm_b_manual_enabled" name="sm_b_manual_enabled" &lt;?php echo ($this-&gt;sg-&gt;GetOption("b_manual_enabled")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Enable manual sitemap building via GET Request', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                                &lt;a href="javascript:void(document.getElementById('sm_manual_help').style.display='');"&gt;[?]&lt;/a&gt;
                                                &lt;span id="sm_manual_help" style="display:none;"&gt;&lt;br /&gt;
                                                &lt;?php echo str_replace("%1",trailingslashit(get_bloginfo('siteurl')) . "?sm_command=build&amp;amp;sm_key=" . $this-&gt;sg-&gt;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: &lt;a href="%1"&gt;%1&lt;/a&gt; Please check the logfile above to see if sitemap was successfully built.', 'sitemap')); ?&gt;
                                                &lt;/span&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                        &lt;b&gt;&lt;?php _e('Update notification:','sitemap'); ?&gt;&lt;/b&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-help-options-ping'); ?&gt;"&gt;&lt;?php _e('Learn more','sitemap'); ?&gt;&lt;/a&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;input type="checkbox" id="sm_b_ping" name="sm_b_ping" &lt;?php echo ($this-&gt;sg-&gt;GetOption("b_ping")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                &lt;label for="sm_b_ping"&gt;&lt;?php _e('Notify Google about updates of your Blog', 'sitemap') ?&gt;&lt;/label&gt;&lt;br /&gt;
                                                &lt;small&gt;&lt;?php echo str_replace("%s",$this-&gt;sg-&gt;GetRedirectLink('sitemap-gwt'),__('No registration required, but you can join the &lt;a href="%s"&gt;Google Webmaster Tools&lt;/a&gt; to check crawling statistics.','sitemap')); ?&gt;&lt;/small&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" &lt;?php echo ($this-&gt;sg-&gt;GetOption("b_pingmsn")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                &lt;label for="sm_b_pingmsn"&gt;&lt;?php _e('Notify MSN Live Search about updates of your Blog', 'sitemap') ?&gt;&lt;/label&gt;&lt;br /&gt;
                                                &lt;small&gt;&lt;?php echo str_replace("%s",$this-&gt;sg-&gt;GetRedirectLink('sitemap-lwt'),__('No registration required, but you can join the &lt;a href="%s"&gt;MSN Live Webmaster Tools&lt;/a&gt; to check crawling statistics.','sitemap')); ?&gt;&lt;/small&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" &lt;?php echo ($this-&gt;sg-&gt;GetOption("b_pingask")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                &lt;label for="sm_b_pingask"&gt;&lt;?php _e('Notify Ask.com about updates of your Blog', 'sitemap') ?&gt;&lt;/label&gt;&lt;br /&gt;
                                                &lt;small&gt;&lt;?php _e('No registration required.','sitemap'); ?&gt;&lt;/small&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" &lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_pingyahoo")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                &lt;label for="sm_b_pingyahoo"&gt;&lt;?php _e('Notify YAHOO about updates of your Blog', 'sitemap') ?&gt;&lt;/label&gt;&lt;br /&gt;
                                                &lt;label for="sm_b_yahookey"&gt;&lt;?php _e('Your Application ID:', 'sitemap') ?&gt; &lt;input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="&lt;?php echo $this-&gt;sg-&gt;GetOption("sm_b_yahookey"); ?&gt;" /&gt;&lt;/label&gt;&lt;br /&gt;
                                                &lt;small&gt;&lt;?php echo str_replace(array("%s1","%s2"),array($this-&gt;sg-&gt;GetRedirectLink('sitemap-ykr'),' (&lt;a href="http://developer.yahoo.net/about/"&gt;Web Services by Yahoo!&lt;/a&gt;)'),__('Don\'t you have such a key? &lt;a href="%s1"&gt;Request one here&lt;/a&gt;!&lt;/a&gt; %s2','sitemap')); ?&gt;&lt;/small&gt;

                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                        &lt;b&gt;&lt;?php _e('Advanced options:','sitemap'); ?&gt;&lt;/b&gt; &lt;a href="&lt;?php echo $this-&gt;sg-&gt;GetRedirectLink('sitemap-help-options-adv'); ?&gt;"&gt;&lt;?php _e('Learn more','sitemap'); ?&gt;&lt;/a&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_max_posts"&gt;&lt;?php _e('Limit the number of posts in the sitemap:', 'sitemap') ?&gt; &lt;input type="text" name="sm_b_max_posts" id="sm_b_max_posts" style="width:40px;" value="&lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_max_posts")&lt;=0?"":$this-&gt;sg-&gt;GetOption("sm_b_max_posts")); ?&gt;" /&gt;&lt;/label&gt; (&lt;?php echo __('Newer posts will be included first', 'sitemap'); ?&gt;)
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_memory"&gt;&lt;?php _e('Try to increase the memory limit to:', 'sitemap') ?&gt; &lt;input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="&lt;?php echo $this-&gt;sg-&gt;GetOption("sm_b_memory"); ?&gt;" /&gt;&lt;/label&gt; (&lt;?php echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap')); ?&gt;)
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_time"&gt;&lt;?php _e('Try to increase the execution time limit to:', 'sitemap') ?&gt; &lt;input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="&lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_time")===-1?'':$this-&gt;sg-&gt;GetOption("sm_b_time")); ?&gt;" /&gt;&lt;/label&gt; (&lt;?php echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap')) ?&gt;)
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_style"&gt;&lt;?php _e('Include a XSLT stylesheet:', 'sitemap') ?&gt; &lt;input type="text" name="sm_b_style" id="sm_b_style"  value="&lt;?php echo $this-&gt;sg-&gt;GetOption("sm_b_style"); ?&gt;" /&gt;&lt;/label&gt; &lt;?php if($this-&gt;sg-&gt;GetDefaultStyle()) { echo ' &lt;a href="javascript:void(0);" onclick="document.getElementById(\'sm_b_style\').value=\'' . $this-&gt;sg-&gt;GetDefaultStyle() . '\';"&gt;' . __('Use Default','sitemap') . '&lt;/a&gt;'; } ?&gt; (&lt;?php _e('Full or relative URL to your .xsl file', 'sitemap') ?&gt;)
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_safemode"&gt;
                                                    &lt;input type="checkbox" id="sm_b_safemode" name="sm_b_safemode" &lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_safemode")==true?"checked=\"checked\"":""); ?&gt; /&gt;
                                                    &lt;?php _e('Enable MySQL standard mode. Use this only if you\'re getting MySQL errors. (Needs much more memory!)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_auto_delay"&gt;
                                                    &lt;input type="checkbox" id="sm_b_auto_delay" name="sm_b_auto_delay" &lt;?php echo ($this-&gt;sg-&gt;GetOption("sm_b_auto_delay")==true?"checked=\"checked\"":""); ?&gt; /&gt;
                                                    &lt;?php _e('Build the sitemap in a background process (You don\'t have to wait when you save a post)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_b_exclude"&gt;&lt;?php _e('Exclude the following posts or pages:', 'sitemap') ?&gt; &lt;small&gt;&lt;?php _e('List of IDs, separated by comma', 'sitemap') ?&gt;&lt;/small&gt;&lt;br /&gt;
                                                &lt;input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="&lt;?php echo implode(",",$this-&gt;sg-&gt;GetOption("sm_b_exclude")); ?&gt;" /&gt;&lt;/label&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_pages" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Additional pages', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;?php
                                        _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.&lt;br /&gt;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');
                                        echo "&lt;ul&gt;&lt;li&gt;";
                                        echo "&lt;strong&gt;" . __('Note','sitemap'). "&lt;/strong&gt;: ";
                                        _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 &amp;quot;Location of your sitemap file&amp;quot; section on this page)!",'sitemap');
                                        echo "&lt;/li&gt;&lt;li&gt;";
                                        echo "&lt;strong&gt;" . __('URL to the page','sitemap'). "&lt;/strong&gt;: ";
                                        _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ",'sitemap');
                                        echo "&lt;/li&gt;&lt;li&gt;";
                                        echo "&lt;strong&gt;" . __('Priority','sitemap') . "&lt;/strong&gt;: ";
                                        _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 "&lt;/li&gt;&lt;li&gt;";
                                        echo "&lt;strong&gt;" . __('Last Changed','sitemap'). "&lt;/strong&gt;: ";
                                        _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).",'sitemap');

                                        echo "&lt;/li&gt;&lt;/ul&gt;";

                                        ?&gt;
                                        &lt;script type="text/javascript"&gt;
                                            //&lt;![CDATA[
                                            &lt;?php
                                            $freqVals = "'" . implode("','",array_keys($this-&gt;sg-&gt;_freqNames)). "'";
                                            $freqNames = "'" . implode("','",array_values($this-&gt;sg-&gt;_freqNames)). "'";
                                            ?&gt;

                                            var changeFreqVals = new Array( &lt;?php echo $freqVals; ?&gt; );
                                            var changeFreqNames= new Array( &lt;?php echo $freqNames; ?&gt; );

                                            var priorities= new Array(0 &lt;?php for($i=0.1; $i&lt;1; $i+=0.1) { echo "," .  $i; } ?&gt;);

                                            var pages = [ &lt;?php
                                                if(count($this-&gt;sg-&gt;_pages)&gt;0) {
                                                    for($i=0; $i&lt;count($this-&gt;sg-&gt;_pages); $i++) {
                                                        $v=&amp;$this-&gt;sg-&gt;_pages[$i];
                                                        if($i&gt;0) echo ",";
                                                        echo '{url:"' . $v-&gt;getUrl() . '", priority:"' . $v-&gt;getPriority() . '", changeFreq:"' . $v-&gt;getChangeFreq() . '", lastChanged:"' . ($v!=null &amp;&amp; $v-&gt;getLastMod()&gt;0?date("Y-m-d",$v-&gt;getLastMod()):"") . '"}';
                                                    }
                                                }
                                            ?&gt; ];
                                            //]]&gt;
                                        &lt;/script&gt;
                                        &lt;script type="text/javascript" src="&lt;?php echo $this-&gt;sg-&gt;GetPluginUrl(); ?&gt;/img/sitemap.js"&gt;&lt;/script&gt;
                                        &lt;table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable"&gt;
                                            &lt;tr&gt;
                                                &lt;th scope="col"&gt;&lt;?php _e('URL to the page','sitemap'); ?&gt;&lt;/th&gt;
                                                &lt;th scope="col"&gt;&lt;?php _e('Priority','sitemap'); ?&gt;&lt;/th&gt;
                                                &lt;th scope="col"&gt;&lt;?php _e('Change Frequency','sitemap'); ?&gt;&lt;/th&gt;
                                                &lt;th scope="col"&gt;&lt;?php _e('Last Changed','sitemap'); ?&gt;&lt;/th&gt;
                                                &lt;th scope="col"&gt;&lt;?php _e('#','sitemap'); ?&gt;&lt;/th&gt;
                                            &lt;/tr&gt;
                                            &lt;?php
                                                if(count($this-&gt;sg-&gt;_pages)&lt;=0) { ?&gt;
                                                    &lt;tr&gt;
                                                        &lt;td colspan="5" align="center"&gt;&lt;?php _e('No pages defined.','sitemap') ?&gt;&lt;/td&gt;
                                                    &lt;/tr&gt;&lt;?php
                                                }
                                            ?&gt;
                                        &lt;/table&gt;
                                        &lt;a href="javascript:void(0);" onclick="sm_addPage();"&gt;&lt;?php _e("Add new page",'sitemap'); ?&gt;&lt;/a&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;!-- AutoPrio Options --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_postprio" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Post Priority', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;p&gt;&lt;?php _e('Please select how the priority of each post should be calculated:', 'sitemap') ?&gt;&lt;/p&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;&lt;p&gt;&lt;input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" &lt;?php echo $this-&gt;sg-&gt;HtmlGetChecked($this-&gt;sg-&gt;GetOption("b_prio_provider"),"") ?&gt; /&gt; &lt;label for="sm_b_prio_provider__0"&gt;&lt;?php _e('Do not use automatic priority calculation', 'sitemap') ?&gt;&lt;/label&gt;&lt;br /&gt;&lt;?php _e('All posts will have the same priority which is defined in &amp;quot;Priorities&amp;quot;', 'sitemap') ?&gt;&lt;/p&gt;&lt;/li&gt;
                                            &lt;?php
                                            for($i=0; $i&lt;count($this-&gt;sg-&gt;_prioProviders); $i++) {
                                                echo "&lt;li&gt;&lt;p&gt;&lt;input type=\"radio\" id=\"sm_b_prio_provider_$i\" name=\"sm_b_prio_provider\" value=\"" . $this-&gt;sg-&gt;_prioProviders[$i] . "\" " .  $this-&gt;sg-&gt;HtmlGetChecked($this-&gt;sg-&gt;GetOption("b_prio_provider"),$this-&gt;sg-&gt;_prioProviders[$i]) . " /&gt; &lt;label for=\"sm_b_prio_provider_$i\"&gt;" . call_user_func(array(&amp;$this-&gt;sg-&gt;_prioProviders[$i], 'getName'))  . "&lt;/label&gt;&lt;br /&gt;" .  call_user_func(array(&amp;$this-&gt;sg-&gt;_prioProviders[$i], 'getDescription')) . "&lt;/p&gt;&lt;/li&gt;";
                                            }
                                            ?&gt;
                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;!-- Includes --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_includes" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Sitemap Content', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_home"&gt;
                                                    &lt;input type="checkbox" id="sm_in_home" name="sm_in_home"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_home")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include homepage', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_posts"&gt;
                                                    &lt;input type="checkbox" id="sm_in_posts" name="sm_in_posts"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_posts")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include posts', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_posts_sub"&gt;
                                                    &lt;input type="checkbox" id="sm_in_posts_sub" name="sm_in_posts_sub"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_posts_sub")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include following pages of multi-page posts (&amp;lt;!--nextpage--&amp;gt;)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_pages"&gt;
                                                    &lt;input type="checkbox" id="sm_in_pages" name="sm_in_pages"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_pages")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include static pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_cats"&gt;
                                                    &lt;input type="checkbox" id="sm_in_cats" name="sm_in_cats"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_cats")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include categories', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_arch"&gt;
                                                    &lt;input type="checkbox" id="sm_in_arch" name="sm_in_arch"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_arch")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include archives', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php if($this-&gt;sg-&gt;IsTaxonomySupported()): ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_tags"&gt;
                                                    &lt;input type="checkbox" id="sm_in_tags" name="sm_in_tags"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_tags")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include tag pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php endif; ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_in_auth"&gt;
                                                    &lt;input type="checkbox" id="sm_in_auth" name="sm_in_auth"  &lt;?php echo ($this-&gt;sg-&gt;GetOption("in_auth")==true?"checked=\"checked\"":"") ?&gt; /&gt;
                                                    &lt;?php _e('Include author pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;!-- Change frequencies --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_change_frequencies" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Change frequencies', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;p&gt;
                                            &lt;b&gt;&lt;?php _e('Note', 'sitemap') ?&gt;:&lt;/b&gt;
                                            &lt;?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') ?&gt;
                                        &lt;/p&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_home"&gt;
                                                    &lt;select id="sm_cf_home" name="sm_cf_home"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_home")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Homepage', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_posts"&gt;
                                                    &lt;select id="sm_cf_posts" name="sm_cf_posts"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_posts")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Posts', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_pages"&gt;
                                                    &lt;select id="sm_cf_pages" name="sm_cf_pages"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_pages")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Static pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_cats"&gt;
                                                    &lt;select id="sm_cf_cats" name="sm_cf_cats"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_cats")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Categories', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_arch_curr"&gt;
                                                    &lt;select id="sm_cf_arch_curr" name="sm_cf_arch_curr"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_arch_curr")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('The current archive of this month (Should be the same like your homepage)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_arch_old"&gt;
                                                    &lt;select id="sm_cf_arch_old" name="sm_cf_arch_old"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_arch_old")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Older archives (Changes only if you edit an old post)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php if($this-&gt;sg-&gt;IsTaxonomySupported()): ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_tags"&gt;
                                                    &lt;select id="sm_cf_tags" name="sm_cf_tags"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_tags")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Tag pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php endif; ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_cf_auth"&gt;
                                                    &lt;select id="sm_cf_auth" name="sm_cf_auth"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetFreqNames($this-&gt;sg-&gt;GetOption("cf_auth")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Author pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;

                        &lt;!-- Priorities --&gt;
                        &lt;div class="dbx-b-ox-wrapper"&gt;
                            &lt;fieldset id="sm_priorities" class="dbx-box"&gt;
                                &lt;div class="dbx-h-andle-wrapper"&gt;
                                    &lt;h3 class="dbx-handle"&gt;&lt;?php _e('Priorities', 'sitemap') ?&gt;&lt;/h3&gt;
                                &lt;/div&gt;
                                &lt;div class="dbx-c-ontent-wrapper"&gt;
                                    &lt;div class="dbx-content"&gt;
                                        &lt;ul&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_home"&gt;
                                                    &lt;select id="sm_pr_home" name="sm_pr_home"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_home")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Homepage', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_posts"&gt;
                                                    &lt;select id="sm_pr_posts" name="sm_pr_posts"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_posts")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Posts (If auto calculation is disabled)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_posts_min"&gt;
                                                    &lt;select id="sm_pr_posts_min" name="sm_pr_posts_min"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_posts_min")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_pages"&gt;
                                                    &lt;select id="sm_pr_pages" name="sm_pr_pages"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_pages")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Static pages', 'sitemap'); ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_cats"&gt;
                                                    &lt;select id="sm_pr_cats" name="sm_pr_cats"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_cats")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Categories', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_arch"&gt;
                                                    &lt;select id="sm_pr_arch" name="sm_pr_arch"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_arch")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Archives', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php if($this-&gt;sg-&gt;IsTaxonomySupported()): ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_tags"&gt;
                                                    &lt;select id="sm_pr_tags" name="sm_pr_tags"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_tags")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Tag pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                            &lt;?php endif; ?&gt;
                                            &lt;li&gt;
                                                &lt;label for="sm_pr_auth"&gt;
                                                    &lt;select id="sm_pr_auth" name="sm_pr_auth"&gt;&lt;?php $this-&gt;sg-&gt;HtmlGetPriorityValues($this-&gt;sg-&gt;GetOption("pr_auth")); ?&gt;&lt;/select&gt;
                                                    &lt;?php _e('Author pages', 'sitemap') ?&gt;
                                                &lt;/label&gt;
                                            &lt;/li&gt;
                                        &lt;/ul&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/fieldset&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div&gt;
                        &lt;p class="submit"&gt;
                            &lt;?php wp_nonce_field('sitemap') ?&gt;
                            &lt;input type="submit" name="sm_update" value="&lt;?php _e('Update options', 'sitemap'); ?&gt;" /&gt;
                            &lt;input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="&lt;?php _e('Reset options', 'sitemap'); ?&gt;" /&gt;
                        &lt;/p&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;script type="text/javascript"&gt;if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); &lt;/script&gt;
            &lt;/form&gt;
            &lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="sm_donate_form"&gt;
                &lt;input type="hidden" name="cmd" value="_xclick" /&gt;
                &lt;input type="hidden" name="business" value="&lt;?php echo "donate" /* N O S P A M */ . "@" . "arnebra" . "chhold.de"; ?&gt;" /&gt;
                &lt;input type="hidden" name="item_name" value="Sitemap Generator for WordPress. Please tell me if if you don't want to be listed on the donator list." /&gt;
                &lt;input type="hidden" name="no_shipping" value="1" /&gt;
                &lt;input type="hidden" name="return" value="&lt;?php echo 'http://' . $_SERVER['HTTP_HOST'] . $this-&gt;sg-&gt;GetBackLink(); ?&gt;&amp;amp;sm_donated=true" /&gt;
                &lt;input type="hidden" name="item_number" value="0001" /&gt;
                &lt;input type="hidden" name="currency_code" value="USD" /&gt;
                &lt;input type="hidden" name="bn" value="PP-BuyNowBF" /&gt;
                &lt;input type="hidden" name="rm" value="2" /&gt;
                &lt;input type="hidden" name="on0" value="Your Website" /&gt;
                &lt;input type="hidden" name="os0" value="&lt;?php echo get_bloginfo("home"); ?&gt;"/&gt;
            &lt;/form&gt;
        &lt;/div&gt;
        &lt;?php
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-ui-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>48</dc:id>	</item>
		<item>
		<title>WordPress mu Sitemap Files: sitemap-core.php</title>
		<link>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-core-php/</link>
		<comments>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-core-php/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 18:40:05 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[Sample File]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=45</guid>
		<description><![CDATA[Check WordPress Mu Google XML Sitemap Solution for what this file is about.
File name sitemap-core.php, a modified version of Google Sitemaps Generator (from verison 3.1.0.1)
&#60;?php
/*

 $Id: sitemap-core.php 48034 2008-05-27 14:36:18Z arnee $

*/

//Enable for dev! Good code doesn't generate any notices...
//error_reporting(E_ALL);
//ini_set("display_errors",1);

#region PHP5 compat functions
if (!function_exists('file_get_contents')) {
    /**
     * Replace [...]]]></description>
			<content:encoded><![CDATA[<p>Check <a title="Permanent link to WordPress Mu Google XML Sitemap Solution" rel="bookmark" href="http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/"><strong>WordPress Mu Google XML Sitemap Solution</strong></a> for what this file is about.</p>
<p>File name <strong>sitemap-core.php</strong>, a modified version of <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" target="_blank">Google Sitemaps Generator</a> (from verison 3.1.0.1)<span id="more-45"></span></p>
<pre>&lt;?php
/*

 $Id: sitemap-core.php 48034 2008-05-27 14:36:18Z arnee $

*/

//Enable for dev! Good code doesn't generate any notices...
//error_reporting(E_ALL);
//ini_set("display_errors",1);

#region PHP5 compat functions
if (!function_exists('file_get_contents')) {
    /**
     * Replace file_get_contents()
     *
     * @category    PHP
     * @package     PHP_Compat
     * @link        http://php.net/function.file_get_contents
     * @author      Aidan Lister &lt;aidan - php - net&gt;
     * @version     $Revision: 1.21 $
     * @internal    resource_context is not supported
     * @since       PHP 5
     */
    function file_get_contents($filename, $incpath = false, $resource_context = null) {
        if (false === $fh = fopen($filename, 'rb', $incpath)) {
            user_error('file_get_contents() failed to open stream: No such file or directory', E_USER_WARNING);
            return false;
        }

        clearstatcache();
        if ($fsize = @filesize($filename)) {
            $data = fread($fh, $fsize);
        } else {
            $data = '';
            while (!feof($fh)) {
                $data .= fread($fh, 8192);
            }
        }

        fclose($fh);
        return $data;
    }
}

if(!function_exists('file_put_contents')) {

    if (!defined('FILE_USE_INCLUDE_PATH')) {
        define('FILE_USE_INCLUDE_PATH', 1);
    }

    if (!defined('LOCK_EX')) {
        define('LOCK_EX', 2);
    }

    if (!defined('FILE_APPEND')) {
        define('FILE_APPEND', 8);
    }

    /**
     * Replace file_put_contents()
     *
     * @category    PHP
     * @package     PHP_Compat
     * @link        http://php.net/function.file_put_contents
     * @author      Aidan Lister &lt;aidan - php - net&gt;
     * @version     $Revision: 1.25 $
     * @internal    resource_context is not supported
     * @since       PHP 5
     * @require     PHP 4.0.0 (user_error)
     */
    function file_put_contents($filename, $content, $flags = null, $resource_context = null) {
        // If $content is an array, convert it to a string
        if (is_array($content)) {
            $content = implode('', $content);
        }

        // If we don't have a string, throw an error
        if (!is_scalar($content)) {
            user_error('file_put_contents() The 2nd parameter should be either a string or an array',E_USER_WARNING);
            return false;
        }

        // Get the length of data to write
        $length = strlen($content);

        // Check what mode we are using
        $mode = ($flags &amp; FILE_APPEND)?'a':'wb';

        // Check if we're using the include path
        $use_inc_path = ($flags &amp; FILE_USE_INCLUDE_PATH)?true:false;

        // Open the file for writing
        if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) {
            user_error('file_put_contents() failed to open stream: Permission denied',E_USER_WARNING);
            return false;
        }

        // Attempt to get an exclusive lock
        $use_lock = ($flags &amp; LOCK_EX) ? true : false ;
        if ($use_lock === true) {
            if (!flock($fh, LOCK_EX)) {
                return false;
            }
        }

        // Write to the file
        $bytes = 0;
        if (($bytes = @fwrite($fh, $content)) === false) {
            $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s',$length,$filename);
            user_error($errormsg, E_USER_WARNING);
            return false;
        }

        // Close the handle
        @fclose($fh);

        // Check all the data was written
        if ($bytes != $length) {
            $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.',$bytes,$length);
            user_error($errormsg, E_USER_WARNING);
            return false;
        }

        // Return length
        return $bytes;
    }

}
#endregion

/**
 * Represents the status (success and failures) of a building process
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0b5
 */
class GoogleSitemapGeneratorStatus {

    function GoogleSitemapGeneratorStatus() {
        $this-&gt;_startTime = $this-&gt;GetMicrotimeFloat();

        $exists = get_option("sm_status");

        if($exists === false) add_option("sm_status","","Status","no");

        $this-&gt;Save();
    }

    function Save() {
        update_option("sm_status",$this);
    }

    function Load() {
        $status = @get_option("sm_status");
        if(is_a($status,"GoogleSitemapGeneratorStatus")) return $status;
        else return null;
    }

    /**
     * @var float $_startTime The start time of the building process
     * @access private
     */
    var $_startTime = 0;

    /**
     * @var float $_endTime The end time of the building process
     * @access private
     */
    var $_endTime = 0;

    /**
     * @var bool $$_hasChanged Indicates if the sitemap content has changed
     * @access private
     */
    var $_hasChanged = true;

    /**
     * @var int $_memoryUsage The amount of memory used in bytes
     * @access private
     */
    var $_memoryUsage = 0;

    /**
     * @var int $_lastPost The number of posts processed. This value is updated every 50 posts.
     * @access private
     */
    var $_lastPost = 0;

    /**
     * @var int $_lastTime The time when the last step-update occured. This value is updated every 50 posts.
     * @access private
     */
    var $_lastTime = 0;

    function End($hasChanged = true) {
        $this-&gt;_endTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;SetMemoryUsage();

        $this-&gt;_hasChanged = $hasChanged;

        $this-&gt;Save();
    }

    function SetMemoryUsage() {
        if(function_exists("memory_get_peak_usage")) {
            $this-&gt;_memoryUsage = memory_get_peak_usage(true);
        } else if(function_exists("memory_get_usage")) {
            $this-&gt;_memoryUsage =  memory_get_usage(true);
        }
    }

    function GetMemoryUsage() {
        return round($this-&gt;_memoryUsage / 1024 / 1024,2);
    }

    function SaveStep($postCount) {
        $this-&gt;SetMemoryUsage();
        $this-&gt;_lastPost = $postCount;
        $this-&gt;_lastTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;Save();
    }

    function GetTime() {
        return round($this-&gt;_endTime - $this-&gt;_startTime,2);
    }

    function GetStartTime() {
        return round($this-&gt;_startTime, 2);
    }

    function GetLastTime() {
        return round($this-&gt;_lastTime - $this-&gt;_startTime,2);
    }

    function GetLastPost() {
        return $this-&gt;_lastPost;
    }

    var $_usedXml = false;
    var $_xmlSuccess = false;
    var $_xmlPath = '';
    var $_xmlUrl = '';

    function StartXml($path,$url) {
        $this-&gt;_usedXml = true;
        $this-&gt;_xmlPath = $path;
        $this-&gt;_xmlUrl = $url;

        $this-&gt;Save();
    }

    function EndXml($success) {
        $this-&gt;_xmlSuccess = $success;

        $this-&gt;Save();
    }

    var $_usedZip = false;
    var $_zipSuccess = false;
    var $_zipPath = '';
    var $_zipUrl = '';

    function StartZip($path,$url) {
        $this-&gt;_usedZip = true;
        $this-&gt;_zipPath = $path;
        $this-&gt;_zipUrl = $url;

        $this-&gt;Save();
    }

    function EndZip($success) {
        $this-&gt;_zipSuccess = $success;

        $this-&gt;Save();
    }

    var $_usedGoogle = false;
    var $_googleUrl = '';
    var $_gooogleSuccess = false;
    var $_googleStartTime = 0;
    var $_googleEndTime = 0;

    function StartGooglePing($url) {
        $this-&gt;_googleUrl = true;
        $this-&gt;_usedGoogle = true;
        $this-&gt;_googleStartTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;Save();
    }

    function EndGooglePing($success) {
        $this-&gt;_googleEndTime = $this-&gt;GetMicrotimeFloat();
        $this-&gt;_gooogleSuccess = $success;

        $this-&gt;Save();
    }

    function GetGoogleTime() {
        return round($this-&gt;_googleEndTime - $this-&gt;_googleStartTime,2);
    }

    var $_usedYahoo = false;
    var $_yahooUrl = '';
    var $_yahooSuccess = false;
    var $_yahooStartTime = 0;
    var $_yahooEndTime = 0;

    function StartYahooPing($url) {
        $this-&gt;_yahooUrl = $url;
        $this-&gt;_usedYahoo = true;
        $this-&gt;_yahooStartTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;Save();
    }

    function EndYahooPing($success) {
        $this-&gt;_yahooEndTime = $this-&gt;GetMicrotimeFloat();
        $this-&gt;_yahooSuccess = $success;

        $this-&gt;Save();
    }

    function GetYahooTime() {
        return round($this-&gt;_yahooEndTime - $this-&gt;_yahooStartTime,2);
    }

    var $_usedAsk = false;
    var $_askUrl = '';
    var $_askSuccess = false;
    var $_askStartTime = 0;
    var $_askEndTime = 0;

    function StartAskPing($url) {
        $this-&gt;_usedAsk = true;
        $this-&gt;_askUrl = $url;
        $this-&gt;_askStartTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;Save();
    }

    function EndAskPing($success) {
        $this-&gt;_askEndTime = $this-&gt;GetMicrotimeFloat();
        $this-&gt;_askSuccess = $success;

        $this-&gt;Save();
    }

    function GetAskTime() {
        return round($this-&gt;_askEndTime - $this-&gt;_askStartTime,2);
    }

    var $_usedMsn = false;
    var $_msnUrl = '';
    var $_msnSuccess = false;
    var $_msnStartTime = 0;
    var $_msnEndTime = 0;

    function StartMsnPing($url) {
        $this-&gt;_usedMsn = true;
        $this-&gt;_msnUrl = $url;
        $this-&gt;_msnStartTime = $this-&gt;GetMicrotimeFloat();

        $this-&gt;Save();
    }

    function EndMsnPing($success) {
        $this-&gt;_msnEndTime = $this-&gt;GetMicrotimeFloat();
        $this-&gt;_msnSuccess = $success;

        $this-&gt;Save();
    }

    function GetMsnTime() {
        return round($this-&gt;_msnEndTime - $this-&gt;_msnStartTime,2);
    }

    function GetMicrotimeFloat() {
        list($usec, $sec) = explode(" ", microtime());
        return ((float)$usec + (float)$sec);
    }
}

/**
 * Represents an item in the page list
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0
 */
class GoogleSitemapGeneratorPage {

    /**
     * @var string $_url Sets the URL or the relative path to the blog dir of the page
     * @access private
     */
    var $_url;

    /**
     * @var float $_priority Sets the priority of this page
     * @access private
     */
    var $_priority;

    /**
     * @var string $_changeFreq Sets the chanfe frequency of the page. I want Enums!
     * @access private
     */
    var $_changeFreq;

    /**
     * @var int $_lastMod Sets the lastMod date as a UNIX timestamp.
     * @access private
     */
    var $_lastMod;

    /**
     * Initialize a new page object
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @param bool $enabled Should this page be included in thesitemap
     * @param string $url The URL or path of the file
     * @param float $priority The Priority of the page 0.0 to 1.0
     * @param string $changeFreq The change frequency like daily, hourly, weekly
     * @param int $lastMod The last mod date as a unix timestamp
     */
    function GoogleSitemapGeneratorPage($url="",$priority=0.0,$changeFreq="never",$lastMod=0) {
        $this-&gt;SetUrl($url);
        $this-&gt;SetProprity($priority);
        $this-&gt;SetChangeFreq($changeFreq);
        $this-&gt;SetLastMod($lastMod);
    }

    /**
     * Returns the URL of the page
     *
     * @return string The URL
     */
    function GetUrl() {
        return $this-&gt;_url;
    }

    /**
     * Sets the URL of the page
     *
     * @param string $url The new URL
     */
    function SetUrl($url) {
        $this-&gt;_url=(string) $url;
    }

    /**
     * Returns the priority of this page
     *
     * @return float the priority, from 0.0 to 1.0
     */
    function GetPriority() {
        return $this-&gt;_priority;
    }

    /**
     * Sets the priority of the page
     *
     * @param float $priority The new priority from 0.1 to 1.0
     */
    function SetProprity($priority) {
        $this-&gt;_priority=floatval($priority);
    }

    /**
     * Returns the change frequency of the page
     *
     * @return string The change frequncy like hourly, weekly, monthly etc.
     */
    function GetChangeFreq() {
        return $this-&gt;_changeFreq;
    }

    /**
     * Sets the change frequency of the page
     *
     * @param string $changeFreq The new change frequency
     */
    function SetChangeFreq($changeFreq) {
        $this-&gt;_changeFreq=(string) $changeFreq;
    }

    /**
     * Returns the last mod of the page
     *
     * @return int The lastmod value in seconds
     */
    function GetLastMod() {
        return $this-&gt;_lastMod;
    }

    /**
     * Sets the last mod of the page
     *
     * @param int $lastMod The lastmod of the page
     */
    function SetLastMod($lastMod) {
        $this-&gt;_lastMod=intval($lastMod);
    }

    function Render() {

        if($this-&gt;_url == "/" || empty($this-&gt;_url)) return '';

        $r="";
        $r.= "\t&lt;url&gt;\n";
        $r.= "\t\t&lt;loc&gt;" . $this-&gt;EscapeXML($this-&gt;_url) . "&lt;/loc&gt;\n";
        if($this-&gt;_lastMod&gt;0) $r.= "\t\t&lt;lastmod&gt;" . date('Y-m-d\TH:i:s+00:00',$this-&gt;_lastMod) . "&lt;/lastmod&gt;\n";
        if(!empty($this-&gt;_changeFreq)) $r.= "\t\t&lt;changefreq&gt;" . $this-&gt;_changeFreq . "&lt;/changefreq&gt;\n";
        if($this-&gt;_priority!==false &amp;&amp; $this-&gt;_priority!=="") $r.= "\t\t&lt;priority&gt;" . number_format($this-&gt;_priority,1) . "&lt;/priority&gt;\n";
        $r.= "\t&lt;/url&gt;\n";
        return $r;
    }

    function EscapeXML($string) {
        return str_replace ( array ( '&amp;', '"', "'", '&lt;', '&gt;'), array ( '&amp;amp;' , '&amp;quot;', '&amp;apos;' , '&amp;lt;' , '&amp;gt;'), $string);
    }
}

class GoogleSitemapGeneratorXmlEntry {

    var $_xml;

    function GoogleSitemapGeneratorXmlEntry($xml) {
        $this-&gt;_xml = $xml;
    }

    function Render() {
        return $this-&gt;_xml;
    }
}

class GoogleSitemapGeneratorDebugEntry extends GoogleSitemapGeneratorXmlEntry {

    function Render() {
        return "&lt;!-- " . $this-&gt;_xml . " --&gt;";
    }
}

/**
 * Base class for all priority providers
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0
 */
class GoogleSitemapGeneratorPrioProviderBase {

    /**
     * @var int $_totalComments The total number of comments of all posts
     * @access protected
     */
    var $_totalComments=0;

    /**
     * @var int $_totalComments The total number of posts
     * @access protected
     */
    var $_totalPosts=0;

    /**
     * Returns the (translated) name of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated name
    */
    function GetName() {
        return "";
    }

    /**
     * Returns the (translated) description of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated description
    */
    function GetDescription() {
        return "";
    }

    /**
     * Initializes a new priority provider
     *
     * @param $totalComments int The total number of comments of all posts
     * @param $totalPosts int The total number of posts
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts) {
        $this-&gt;_totalComments=$totalComments;
        $this-&gt;_totalPosts=$totalPosts;

    }

    /**
     * Returns the priority for a specified post
     *
     * @param $postID int The ID of the post
     * @param $commentCount int The number of comments for this post
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return int The calculated priority
    */
    function GetPostPriority($postID,$commentCount) {
        return 0;
    }
}

/**
 * Priority Provider which calculates the priority based on the number of comments
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0
 */
class GoogleSitemapGeneratorPrioByCountProvider extends GoogleSitemapGeneratorPrioProviderBase {

    /**
     * Returns the (translated) name of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated name
    */
    function GetName() {
        return __("Comment Count",'sitemap');
    }

    /**
     * Returns the (translated) description of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated description
    */
    function GetDescription() {
        return __("Uses the number of comments of the post to calculate the priority",'sitemap');
    }

    /**
     * Initializes a new priority provider which calculates the post priority based on the number of comments
     *
     * @param $totalComments int The total number of comments of all posts
     * @param $totalPosts int The total number of posts
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function GoogleSitemapGeneratorPrioByCountProvider($totalComments,$totalPosts) {
        parent::GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts);
    }

    /**
     * Returns the priority for a specified post
     *
     * @param $postID int The ID of the post
     * @param $commentCount int The number of comments for this post
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return int The calculated priority
    */
    function GetPostPriority($postID,$commentCount) {
        $prio=0;
        if($this-&gt;_totalComments&gt;0 &amp;&amp; $commentCount&gt;0) {
            $prio = round(($commentCount*100/$this-&gt;_totalComments)/100,1);
        } else {
            $prio = 0;
        }
        return $prio;
    }
}

/**
 * Priority Provider which calculates the priority based on the average number of comments
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0
 */
class GoogleSitemapGeneratorPrioByAverageProvider extends GoogleSitemapGeneratorPrioProviderBase {

    /**
     * @var int $_average The average number of comments per post
     * @access protected
     */
    var $_average=0.0;

    /**
     * Returns the (translated) name of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated name
    */
    function GetName() {
        return __("Comment Average",'sitemap');
    }

    /**
     * Returns the (translated) description of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated description
    */
    function GetDescription() {
        return __("Uses the average comment count to calculate the priority",'sitemap');
    }

    /**
     * Initializes a new priority provider which calculates the post priority based on the average number of comments
     *
     * @param $totalComments int The total number of comments of all posts
     * @param $totalPosts int The total number of posts
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function GoogleSitemapGeneratorPrioByAverageProvider($totalComments,$totalPosts) {
        parent::GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts);

        if($this-&gt;_totalComments&gt;0 &amp;&amp; $this-&gt;_totalPosts&gt;0) {
            $this-&gt;_average= (double) $this-&gt;_totalComments / $this-&gt;_totalPosts;
        }
    }

    /**
     * Returns the priority for a specified post
     *
     * @param $postID int The ID of the post
     * @param $commentCount int The number of comments for this post
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return int The calculated priority
    */
    function GetPostPriority($postID,$commentCount) {
        $prio = 0;
        //Do not divide by zero!
        if($this-&gt;_average==0) {
            if($commentCount&gt;0)    $prio = 1;
            else $prio = 0;
        } else {
            $prio = $commentCount/$this-&gt;_average;
            if($prio&gt;1) $prio = 1;
            else if($prio&lt;0) $prio = 0;
        }

        return round($prio,1);
    }
}

/**
 * Priority Provider which calculates the priority based on the popularity by the PopularityContest Plugin
 * @author Arne Brachhold
 * @package sitemap
 * @since 3.0
 */
class GoogleSitemapGeneratorPrioByPopularityContestProvider extends GoogleSitemapGeneratorPrioProviderBase {

    /**
     * Returns the (translated) name of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated name
    */
    function GetName() {
        return __("Popularity Contest",'sitemap');
    }

    /**
     * Returns the (translated) description of this priority provider
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return string The translated description
    */
    function GetDescription() {
        return str_replace("%4","index.php?page=popularity-contest.php",str_replace("%3","options-general.php?page=popularity-contest.php",str_replace("%2","http://www.alexking.org/",str_replace("%1","http://www.alexking.org/index.php?content=software/wordpress/content.php",__("Uses the activated &lt;a href=\"%1\"&gt;Popularity Contest Plugin&lt;/a&gt; from &lt;a href=\"%2\"&gt;Alex King&lt;/a&gt;. See &lt;a href=\"%3\"&gt;Settings&lt;/a&gt; and &lt;a href=\"%4\"&gt;Most Popular Posts&lt;/a&gt;",'sitemap')))));
    }

    /**
     * Initializes a new priority provider which calculates the post priority based on the popularity by the PopularityContest Plugin
     *
     * @param $totalComments int The total number of comments of all posts
     * @param $totalPosts int The total number of posts
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function GoogleSitemapGeneratorPrioByPopularityContestProvider($totalComments,$totalPosts) {
        parent::GoogleSitemapGeneratorPrioProviderBase($totalComments,$totalPosts);
    }

    /**
     * Returns the priority for a specified post
     *
     * @param $postID int The ID of the post
     * @param $commentCount int The number of comments for this post
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return int The calculated priority
    */
    function GetPostPriority($postID,$commentCount) {
        //$akpc is the global instance of the Popularity Contest Plugin
        global $akpc,$posts;

        $res=0;
        //Better check if its there
        if(!empty($akpc) &amp;&amp; is_object($akpc)) {
            //Is the method we rely on available?
        if(method_exists($akpc,"get_post_rank")) {
            if(!is_array($posts) || !$posts) $posts = array();
                if(!isset($posts[$postID])) $posts[$postID] = get_post($postID);
                //popresult comes as a percent value
                $popresult=$akpc-&gt;get_post_rank($postID);
                if(!empty($popresult) &amp;&amp; strpos($popresult,"%")!==false) {
                    //We need to parse it to get the priority as an int (percent)
                    $matches=null;
                    preg_match("/([0-9]{1,3})\%/si",$popresult,$matches);
                    if(!empty($matches) &amp;&amp; is_array($matches) &amp;&amp; count($matches)==2) {
                        //Divide it so 100% = 1, 10% = 0.1
                        $res=round(intval($matches[1])/100,1);
                    }
                }
            }
        }
        return $res;
    }
}

/**
 * Class to generate a sitemaps.org Sitemaps compliant sitemap of a WordPress blog.
 *
 * @package sitemap
 * @author Arne Brachhold
 * @since 3.0
*/
class GoogleSitemapGenerator {
    /**
     * @var Version of the generator in SVN
    */
    var $_svnVersion = '$Id: sitemap-core.php 48034 2008-05-27 14:36:18Z arnee $';

    /**
     * @var array The unserialized array with the stored options
     */
    var $_options = array();

    /**
     * @var array The saved additional pages
     */
    var $_pages = array();

    /**
     * @var array The values and names of the change frequencies
     */
    var $_freqNames = array();

    /**
     * @var array A list of class names which my be called for priority calculation
     */
    var $_prioProviders = array();

    /**
     * @var bool True if init complete (options loaded etc)
     */
    var $_initiated = false;

    /**
     * @var string Holds the last error if one occurs when writing the files
     */
    var $_lastError=null;

    /**
     * @var int The last handled post ID
     */
    var $_lastPostID = 0;

    /**
     * @var bool Defines if the sitemap building process is active at the moment
     */
    var $_isActive = false;

    /**
     * @var bool Defines if the sitemap building process has been scheduled via Wp cron
     */
    var $_isScheduled = false;

    /**
     * @var object The file handle which is used to write the sitemap file
     */
    var $_fileHandle = null;

    /**
     * @var object The file handle which is used to write the zipped sitemap file
     */
    var $_fileZipHandle = null;

    /**
     * Returns the path to the blog directory
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return string The full path to the blog directory
    */
    function GetHomePath() {

        $res="";
        //Check if we are in the admin area -&gt; get_home_path() is avaiable
        if(function_exists("get_home_path")) {
            $res = get_home_path();
        } else {
            //get_home_path() is not available, but we can't include the admin
            //libraries because many plugins check for the "check_admin_referer"
            //function to detect if you are on an admin page. So we have to copy
            //the get_home_path function in our own...
            $home = get_option( 'home' );
            if ( $home != '' &amp;&amp; $home != get_option( 'siteurl' ) ) {
                $home_path = parse_url( $home );
                $home_path = $home_path['path'];
                $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
                $home_path = trailingslashit( $root.$home_path );
            } else {
                $home_path = ABSPATH;
            }

            $res = $home_path;
        }
        global $blog_id;
        if ($blog_id != 1) $res .= 'wp-content/blogs.dir/' . $blog_id . '/files/';
        return $res;
    }

    /**
     * Returns the path to the directory where the plugin file is located
     * @since 3.0b5
     * @access private
     * @author Arne Brachhold
     * @return string The path to the plugin directory
     */
    function GetPluginPath() {
        $path = dirname(__FILE__);
        return trailingslashit(str_replace("\\","/",$path));
    }

    /**
     * Returns the URL to the directory where the plugin file is located
     * @since 3.0b5
     * @access private
     * @author Arne Brachhold
     * @return string The URL to the plugin directory
     */
    function GetPluginUrl() {
        $path = dirname(__FILE__);
        $path = str_replace("\\","/",$path);
        $path = trailingslashit(get_bloginfo('wpurl')) . trailingslashit(substr($path,strpos($path,"wp-content/")));
        return $path;
    }

    /**
     * Returns the URL to default XSLT style if it exists
     * @since 3.0b5
     * @access private
     * @author Arne Brachhold
     * @return string The URL to the default stylesheet, empry string if not available.
     */
    function GetDefaultStyle() {
        $p = $this-&gt;GetPluginPath();
        if(file_exists($p . "sitemap.xsl")) {
            return $this-&gt;GetPluginUrl() . 'sitemap.xsl';
        }
        return '';
    }

    /**
     * Returns the path to the robots.txt file in the blog root
     *
     * @since 3.0b8
     * @access private
     * @author Arne Brachhold
     * @return The full path to the robots.txt file
     */
    function GetRobotsFilePath() {
        return trailingslashit($this-&gt;GetHomePath()) . 'robots.txt';
    }

    /**
     * Returns the URL to the robots.txt file in the blog root
     *
     * @since 3.0b8
     * @access private
     * @author Arne Brachhold
     * @return The full URL to the robots.txt file
     */
    function GetRobotsFileUrl() {
        return trailingslashit(get_bloginfo('siteurl')) . 'robots.txt';
    }

    /**
     * Sets up the default configuration
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function InitOptions() {

        $this-&gt;_options=array();
        $this-&gt;_options["sm_b_prio_provider"]="GoogleSitemapGeneratorPrioByAverageProvider";            //Provider for automatic priority calculation
        $this-&gt;_options["sm_b_filename"]="sitemap.xml";        //Name of the Sitemap file
        $this-&gt;_options["sm_b_debug"]=true;                    //Write debug messages in the xml file
        $this-&gt;_options["sm_b_xml"]=true;                    //Create a .xml file
        $this-&gt;_options["sm_b_gzip"]=true;                    //Create a gzipped .xml file(.gz) file
        $this-&gt;_options["sm_b_ping"]=true;                    //Auto ping Google
        $this-&gt;_options["sm_b_pingyahoo"]=true;                //Auto ping YAHOO
        $this-&gt;_options["sm_b_yahookey"]='Q89D23fV34GSeqHjRl8o5i55ojmxrmwJPyMa_195mBnBaK6Vp_NB8y5WjnIoamjikw--';                //YAHOO Application Key, default for all
        $this-&gt;_options["sm_b_pingask"]=true;                //Auto ping Ask.com
        $this-&gt;_options["sm_b_pingmsn"]=true;                //Auto ping MSN
        $this-&gt;_options["sm_b_manual_enabled"]=false;        //Allow manual creation of the sitemap via GET request
        $this-&gt;_options["sm_b_auto_enabled"]=true;            //Rebuild sitemap when content is changed
        $this-&gt;_options["sm_b_auto_delay"]=true;            //Use WP Cron to execute the building process in the background
        $this-&gt;_options["sm_b_manual_key"]=md5(microtime());//The secret key to build the sitemap via GET request
        $this-&gt;_options["sm_b_memory"] = '';                //Set Memory Limit (e.g. 16M)
        $this-&gt;_options["sm_b_time"] = -1;                    //Set time limit in seconds, 0 for unlimited, -1 for disabled
        $this-&gt;_options["sm_b_max_posts"] = -1;                //Maximum number of posts, &lt;= 0 for all
        $this-&gt;_options["sm_b_safemode"] = false;            //Enable MySQL Safe Mode (doesn't use unbuffered results)
        $this-&gt;_options["sm_b_style"] = $this-&gt;GetDefaultStyle(); //Include a stylesheet in the XML
        $this-&gt;_options["sm_b_robots"] = false;                //Modify or create robots.txt file in blog root which contains the sitemap location
        $this-&gt;_options["sm_b_exclude"] = array();            //List of post / page IDs to exclude
        $this-&gt;_options["sm_b_location_mode"]="auto";        //Mode of location, auto or manual
        $this-&gt;_options["sm_b_filename_manual"]="";            //Manuel filename
        $this-&gt;_options["sm_b_fileurl_manual"]="";            //Manuel fileurl

        $this-&gt;_options["sm_in_home"]=true;                    //Include homepage
        $this-&gt;_options["sm_in_posts"]=true;                //Include posts
        $this-&gt;_options["sm_in_posts_sub"]=false;            //Include post pages (&lt;!--nextpage--&gt; tag)
        $this-&gt;_options["sm_in_pages"]=true;                //Include static pages
        $this-&gt;_options["sm_in_cats"]=false;                //Include categories
        $this-&gt;_options["sm_in_arch"]=false;                //Include archives
        $this-&gt;_options["sm_in_auth"]=false;                //Include author pages
        $this-&gt;_options["sm_in_tags"]=false;                //Include tag pages

        $this-&gt;_options["sm_cf_home"]="daily";                //Change frequency of the homepage
        $this-&gt;_options["sm_cf_posts"]="monthly";            //Change frequency of posts
        $this-&gt;_options["sm_cf_pages"]="weekly";            //Change frequency of static pages
        $this-&gt;_options["sm_cf_cats"]="weekly";                //Change frequency of categories
        $this-&gt;_options["sm_cf_auth"]="weekly";                //Change frequency of author pages
        $this-&gt;_options["sm_cf_arch_curr"]="daily";            //Change frequency of the current archive (this month)
        $this-&gt;_options["sm_cf_arch_old"]="yearly";            //Change frequency of older archives
        $this-&gt;_options["sm_cf_tags"]="weekly";                //Change frequency of tags

        $this-&gt;_options["sm_pr_home"]=1.0;                    //Priority of the homepage
        $this-&gt;_options["sm_pr_posts"]=0.6;                    //Priority of posts (if auto prio is disabled)
        $this-&gt;_options["sm_pr_posts_min"]=0.2;                //Minimum Priority of posts, even if autocalc is enabled
        $this-&gt;_options["sm_pr_pages"]=0.6;                    //Priority of static pages
        $this-&gt;_options["sm_pr_cats"]=0.3;                    //Priority of categories
        $this-&gt;_options["sm_pr_arch"]=0.3;                    //Priority of archives
        $this-&gt;_options["sm_pr_auth"]=0.3;                    //Priority of author pages
        $this-&gt;_options["sm_pr_tags"]=0.3;                    //Priority of tags

        $this-&gt;_options["sm_i_donated"]=false;                //Did you donate? Thank you! <img src='http://postedpost.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
        $this-&gt;_options["sm_i_hide_donated"]=false;            //And hide the thank you..
        $this-&gt;_options["sm_i_install_date"]=time();        //The installation date
        $this-&gt;_options["sm_i_hide_note"]=false;            //Hide the note which appears after 30 days
        $this-&gt;_options["sm_i_hide_donors"]=false;            //Hide the list of donations
    }

    /**
     * Loads the configuration from the database
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function LoadOptions() {

        $this-&gt;InitOptions();

        //First init default values, then overwrite it with stored values so we can add default
        //values with an update which get stored by the next edit.
        $storedoptions=get_option("sm_options");
        if($storedoptions &amp;&amp; is_array($storedoptions)) {
            foreach($storedoptions AS $k=&gt;$v) {
                $this-&gt;_options[$k]=$v;
            }
        } else update_option("sm_options",$this-&gt;_options); //First time use, store default values
    }

    /**
     * Initializes a new Google Sitemap Generator
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function GoogleSitemapGenerator() {

    }

    /**
     * Returns the version of the generator
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @return int The version
    */
    function GetVersion() {
        return GoogleSitemapGeneratorLoader::GetVersion();
    }

    /**
     * Returns all parent classes of a class
     *
     * @param $className string The name of the class
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return array An array which contains the names of the parent classes
    */
    function GetParentClasses($classname) {
        $parent = get_parent_class($classname);
        $parents = array();
        if (!empty($parent)) {
            $parents = $this-&gt;GetParentClasses($parent);
            $parents[] = strtolower($parent);
        }
        return $parents;
    }

    /**
     * Returns if a class is a subclass of another class
     *
     * @param $className string The name of the class
     * @param $$parentName string The name of the parent class
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return bool true if the given class is a subclass of the other one
    */
    function IsSubclassOf($className, $parentName) {

        $className = strtolower($className);
        $parentName = strtolower($parentName);

        if(empty($className) || empty($parentName) || !class_exists($className) || !class_exists($parentName)) return false;

        $parents=$this-&gt;GetParentClasses($className);

        return in_array($parentName,$parents);
    }

    /**
     * Loads up the configuration and validates the prioity providers
     *
     * This method is only called if the sitemaps needs to be build or the admin page is displayed.
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function Initate() {
        if(!$this-&gt;_initiated) {

            //Loading language file...
            //load_plugin_textdomain('sitemap');
            //Hmm, doesn't work if the plugin file has its own directory.
            //Let's make it our way... load_plugin_textdomain() searches only in the wp-content/plugins dir.
            $currentLocale = get_locale();
            if(!empty($currentLocale)) {
                $moFile = dirname(__FILE__) . "/lang/sitemap-" . $currentLocale . ".mo";
                if(@file_exists($moFile) &amp;&amp; is_readable($moFile)) load_textdomain('sitemap', $moFile);
            }

            $this-&gt;_freqNames = array(
                "always"=&gt;__("Always","sitemap"),
                "hourly"=&gt;__("Hourly","sitemap"),
                "daily"=&gt;__("Daily","sitemap"),
                "weekly"=&gt;__("Weekly","sitemap"),
                "monthly"=&gt;__("Monthly","sitemap"),
                "yearly"=&gt;__("Yearly","sitemap"),
                "never"=&gt;__("Never","sitemap")
            );

            $this-&gt;LoadOptions();
            $this-&gt;LoadPages();

            //Register our own priority providers
            add_filter("sm_add_prio_provider",array(&amp;$this, 'AddDefaultPrioProviders'));

            //Let other plugins register their providers
            $r = apply_filters("sm_add_prio_provider",$this-&gt;_prioProviders);

            //Check if no plugin return null
            if($r != null) $this-&gt;_prioProviders = $r;

            $this-&gt;ValidatePrioProviders();

            $this-&gt;_initiated = true;
        }
    }

    /**
     * Returns the instance of the Sitemap Generator
     *
     * @since 3.0
     * @access public
     * @return GoogleSitemapGenerator The instance or null if not available.
     * @author Arne Brachhold
    */
    function &amp;GetInstance() {
        if(isset($GLOBALS["sm_instance"])) {
            return $GLOBALS["sm_instance"];
        } else return null;
    }

    /**
     * Returns if the sitemap building process is currently active
     *
     * @since 3.0
     * @access public
     * @return bool true if active
     * @author Arne Brachhold
    */
    function IsActive() {
        $inst = &amp;GoogleSitemapGenerator::GetInstance();
        return ($inst != null &amp;&amp; $inst-&gt;_isActive);
    }

    /**
     * Returns if the compressed sitemap was activated
     *
     * @since 3.0b8
     * @access private
     * @author Arne Brachhold
     * @return true if compressed
     */
    function IsGzipEnabled() {
        return ($this-&gt;GetOption("b_gzip")===true &amp;&amp; function_exists("gzwrite"));
    }

    /**
     * Returns if this version of WordPress supports the new taxonomy system
     *
     * @since 3.0b8
     * @access private
     * @author Arne Brachhold
     * @return true if supported
     */
    function IsTaxonomySupported() {
        return (function_exists("get_taxonomy") &amp;&amp; function_exists("get_terms"));
    }

    /**
     * Enables the Google Sitemap Generator and registers the WordPress hooks
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function Enable() {
        if(!isset($GLOBALS["sm_instance"])) {
            $GLOBALS["sm_instance"]=new GoogleSitemapGenerator();
        }
    }

    /**
     * Checks if sitemap building after content changed is enabled and rebuild the sitemap
     *
     * @param int $postID The ID of the post to handle. Used to avoid double rebuilding if more than one hook was fired.
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function CheckForAutoBuild($postID) {
        $this-&gt;Initate();
        //Build one time per post and if not importing.
        if($this-&gt;GetOption("b_auto_enabled")===true &amp;&amp; $this-&gt;_lastPostID != $postID &amp;&amp; (!defined('WP_IMPORTING') || WP_IMPORTING != true)) {
            $this-&gt;_lastPostID = $postID;

            //Build the sitemap directly or schedule it with WP cron
            if($this-&gt;GetOption("b_auto_delay")==true) {
                if(!$this-&gt;_isScheduled) {
                    //Schedule in 15 seconds, this should be enough to catch all changes.
                    //Clear all other existing hooks, so the sitemap is only built once.
                    wp_clear_scheduled_hook('sm_build_cron');
                    wp_schedule_single_event(time()+15,'sm_build_cron');
                    $this-&gt;_isScheduled = true;
                }
            } else {
                $this-&gt;BuildSitemap();
            }
        }
    }

    /**
     * Checks if the rebuild request was send and starts to rebuilt the sitemap
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
    */
    function CheckForManualBuild() {
        if(!empty($_GET["sm_command"]) &amp;&amp; !empty($_GET["sm_key"])) {
            $this-&gt;Initate();
            if($this-&gt;GetOption("b_manual_enabled")===true &amp;&amp; $_GET["sm_command"]=="build" &amp;&amp; $_GET["sm_key"]==$this-&gt;GetOption("b_manual_key")) {
                $this-&gt;BuildSitemap();
                echo "DONE";
                exit;
            }
        }
    }

    /**
     * Validates all given Priority Providers by checking them for required methods and existence
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function ValidatePrioProviders() {
        $validProviders=array();

        for($i=0; $i&lt;count($this-&gt;_prioProviders); $i++) {
            if(class_exists($this-&gt;_prioProviders[$i])) {
                if($this-&gt;IsSubclassOf($this-&gt;_prioProviders[$i],"GoogleSitemapGeneratorPrioProviderBase")) {
                    array_push($validProviders,$this-&gt;_prioProviders[$i]);
                }
            }
        }
        $this-&gt;_prioProviders=$validProviders;

        if(!$this-&gt;GetOption("b_prio_provider")) {
            if(!in_array($this-&gt;GetOption("b_prio_provider"),$this-&gt;_prioProviders,true)) {
                $this-&gt;SetOption("b_prio_provider","");
            }
        }
    }

    /**
     * Adds the default Priority Providers to the provider list
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function AddDefaultPrioProviders($providers) {
        array_push($providers,"GoogleSitemapGeneratorPrioByCountProvider");
        array_push($providers,"GoogleSitemapGeneratorPrioByAverageProvider");
        if(class_exists("ak_popularity_contest")) {
            array_push($providers,"GoogleSitemapGeneratorPrioByPopularityContestProvider");
        }
        return $providers;
    }

    /**
     * Loads the stored pages from the database
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
    */
    function LoadPages() {
        global $wpdb;

        $needsUpdate=false;

        $pagesString=$wpdb-&gt;get_var("SELECT option_value FROM $wpdb-&gt;options WHERE option_name = 'sm_cpages'");

        //Class sm_page was renamed with 3.0 -&gt; rename it in serialized value for compatibility
        if(!empty($pagesString) &amp;&amp; strpos($pagesString,"sm_page")!==false) {
            $pagesString = str_replace("O:7:\"sm_page\"","O:26:\"GoogleSitemapGeneratorPage\"",$pagesString);
            $needsUpdate=true;
        }

        if(!empty($pagesString)) {
            $storedpages=unserialize($pagesString);
            $this-&gt;_pages=$storedpages;
        } else {
            $this-&gt;_pages=array();
        }

        if($needsUpdate) $this-&gt;SavePages();
    }

    /**
     * Saved the additional pages back to the database
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return true on success
    */
    function SavePages() {
        $oldvalue = get_option("sm_cpages");
        if($oldvalue == $this-&gt;_pages) {
            return true;
        } else {
            delete_option("sm_cpages");
            //Add the option, Note the autoload=false because when the autoload happens, our class GoogleSitemapGeneratorPage doesn't exist
            add_option("sm_cpages",$this-&gt;_pages,"Storage for custom pages of the sitemap plugin","no");
            return true;
        }
    }

    /**
     * Returns the URL for the sitemap file
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param bool $forceAuto Force the return value to the autodetected value.
     * @return The URL to the Sitemap file
    */
    function GetXmlUrl($forceAuto=false) {

        if(!$forceAuto &amp;&amp; $this-&gt;GetOption("b_location_mode")=="manual") {
            return $this-&gt;GetOption("b_fileurl_manual");
        } else {
            return trailingslashit(get_bloginfo('siteurl')). $this-&gt;GetOption("b_filename");
        }
    }

    /**
     * Returns the URL for the gzipped sitemap file
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param bool $forceAuto Force the return value to the autodetected value.
     * @return The URL to the gzipped Sitemap file
    */
    function GetZipUrl($forceAuto=false) {
        return $this-&gt;GetXmlUrl($forceAuto) . ".gz";
    }

    /**
     * Returns the file system path to the sitemap file
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param bool $forceAuto Force the return value to the autodetected value.
     * @return The file system path;
    */
    function GetXmlPath($forceAuto=false) {
        if(!$forceAuto &amp;&amp; $this-&gt;GetOption("b_location_mode")=="manual") {
            return $this-&gt;GetOption("b_filename_manual");
        } else {
            return $this-&gt;GetHomePath()  . $this-&gt;GetOption("b_filename");
        }
    }

    /**
     * Returns the file system path to the gzipped sitemap file
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param bool $forceAuto Force the return value to the autodetected value.
     * @return The file system path;
    */
    function GetZipPath($forceAuto=false) {
        return $this-&gt;GetXmlPath($forceAuto) . ".gz";
    }

    /**
     * Returns the option value for the given key
     * Alias for getOption
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $key string The Configuration Key
     * @return mixed The value
    */
    function Go($key) {
        return $this-&gt;getOption($key);
    }

    /**
     * Returns the option value for the given key
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $key string The Configuration Key
     * @return mixed The value
     */
    function GetOption($key) {
        if(strpos($key,"sm_")!==0) $key="sm_" . $key;
        if(array_key_exists($key,$this-&gt;_options)) {
            return $this-&gt;_options[$key];
        } else return null;
    }

    /**
     * Sets an option to a new value
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $key string The configuration key
     * @param $value mixed The new object
     */
    function SetOption($key,$value) {
        if(strstr($key,"sm_")!==0) $key="sm_" . $key;

        $this-&gt;_options[$key]=$value;
    }

    /**
     * Saves the options back to the database
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return bool true on success
     */
    function SaveOptions() {
        $oldvalue = get_option("sm_options");
        if($oldvalue == $this-&gt;_options) {
            return true;
        } else return update_option("sm_options",$this-&gt;_options);
    }

    /**
     * Retrieves the number of comments of a post in a asso. array
     * The key is the postID, the value the number of comments
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @return array An array with postIDs and their comment count
     */
    function GetComments() {
        global $wpdb;
        $comments=array();

        //Query comments and add them into the array
        $commentRes=$wpdb-&gt;get_results("SELECT `comment_post_ID` as `post_id`, COUNT(comment_ID) as `comment_count` FROM `" . $wpdb-&gt;comments . "` WHERE `comment_approved`='1' GROUP BY `comment_post_ID`");
        if($commentRes) {
            foreach($commentRes as $comment) {
                $comments[$comment-&gt;post_id]=$comment-&gt;comment_count;
            }
        }
        return $comments;
    }

    /**
     * Calculates the full number of comments from an sm_getComments() generated array
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $comments array The Array with posts and c0mment count
     * @see sm_getComments
     * @return The full number of comments
     */
    function GetCommentCount($comments) {
        $commentCount=0;
        foreach($comments AS $k=&gt;$v) {
            $commentCount+=$v;
        }
        return $commentCount;
    }

    /**
     * Adds a url to the sitemap. You can use this method or call AddElement directly.
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     * @param $loc string The location (url) of the page
     * @param $lastMod int The last Modification time as a UNIX timestamp
     * @param $changeFreq string The change frequenty of the page, Valid values are "always", "hourly", "daily", "weekly", "monthly", "yearly" and "never".
     * @param $priorty float The priority of the page, between 0.0 and 1.0
     * @see AddElement
     * @return string The URL node
     */
    function AddUrl($loc,$lastMod=0,$changeFreq="monthly",$priority=0.5) {
        $page = new GoogleSitemapGeneratorPage($loc,$priority,$changeFreq,$lastMod);

        $this-&gt;AddElement($page);
    }

    /**
     * Adds an element to the sitemap
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $page The element
     */
    function AddElement(&amp;$page) {
        if(empty($page)) return;

        $s = $page-&gt;Render();

        if($this-&gt;_fileZipHandle &amp;&amp; $this-&gt;IsGzipEnabled()) {
            gzwrite($this-&gt;_fileZipHandle,$s);
        }

        if($this-&gt;_fileHandle &amp;&amp; $this-&gt;GetOption("b_xml")) {
            fwrite($this-&gt;_fileHandle,$s);
        }
    }

    /**
     * Checks if a file is writable and tries to make it if not.
     *
     * @since 3.05b
     * @access private
     * @author  VJTD3 &lt;http://www.VJTD3.com&gt;
     * @return bool true if writable
     */
    function IsFileWritable($filename) {
        //can we write?
        if(!is_writable($filename)) {
            //no we can't.
            if(!@chmod($filename, 0666)) {
                $pathtofilename = dirname($filename);
                //Lets check if parent directory is writable.
                if(!is_writable($pathtofilename)) {
                    //it's not writeable too.
                    if(!@chmod($pathtoffilename, 0666)) {
                        //darn couldn't fix up parrent directory this hosting is foobar.
                        //Lets error because of the permissions problems.
                        return false;
                    }
                }
            }
        }
        //we can write, return 1/true/happy dance.
        return true;
    }

    /**
     * Creates or opens the robots.txt in blog root and inserts the sitemap location
     *
     * @since 3.0b8
     * @access private
     * @author Arne Brachhold
     * @return true on success
     */
    function WriteRobotsFile() {
        $file = $this-&gt;GetRobotsFilePath();

        $marker = 'XML-SITEMAP-PLUGIN';

        $current = extract_from_markers($file,$marker);
        if(is_array($current)) $current = $current[0];

        $smUrl = $this-&gt;GetXmlUrl();
        if($this-&gt;IsGzipEnabled()) {
            $smUrl = $this-&gt;GetZipUrl();
        }

        $new = "Sitemap: " . $smUrl;

        if($current != $new) {
            if($this-&gt;IsFileWritable($file)) return insert_with_markers($file,$marker,array($new));
            else return false;
        }
        return true;
    }

    /**
     * Builds the sitemap and writes it into a xml file.
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold &lt;himself [at] arnebrachhold [dot] de&gt;
     * @return array An array with messages such as failed writes etc.
     */
    function BuildSitemap() {
        global $wpdb, $posts, $wp_version;
        $this-&gt;Initate();

        if($this-&gt;GetOption("b_memory")!='') {
            @ini_set("memory_limit",$this-&gt;GetOption("b_memory"));
        }

        if($this-&gt;GetOption("sm_b_time")!=-1) {
            @set_time_limit($this-&gt;GetOption("sm_b_time"));
        }

        //This object saves the status information of the script directly to the database
        $status = new GoogleSitemapGeneratorStatus();

        //Other plugins can detect if the building process is active
        $this-&gt;_isActive = true;

        //$this-&gt;AddElement(new GoogleSitemapGeneratorXmlEntry());

        //Debug mode?
        $debug=$this-&gt;GetOption("b_debug");

        if($this-&gt;GetOption("b_xml")) {
            $fileName = $this-&gt;GetXmlPath();
            $status-&gt;StartXml($this-&gt;GetXmlPath(),$this-&gt;GetXmlUrl());

            if($this-&gt;IsFileWritable($fileName)) {

                $this-&gt;_fileHandle = fopen($fileName,"w");
                if(!$this-&gt;_fileHandle) $status-&gt;EndXml(false,"Not openable");

            } else $status-&gt;EndXml(false,"not writable");
        }

        //Write gzipped sitemap file
        if($this-&gt;IsGzipEnabled()) {
            $fileName = $this-&gt;GetZipPath();
            $status-&gt;StartZip($this-&gt;GetZipPath(),$this-&gt;GetZipUrl());

            if($this-&gt;IsFileWritable($fileName)) {

                $this-&gt;_fileZipHandle = gzopen($fileName,"w1");
                if(!$this-&gt;_fileZipHandle) $status-&gt;EndZip(false,"Not openable");

            } else $status-&gt;EndZip(false,"not writable");
        }

        if(!$this-&gt;_fileHandle &amp;&amp; !$this-&gt;_fileZipHandle) {
            $status-&gt;End();
            return;
        }

        //Content of the XML file
        $this-&gt;AddElement(new GoogleSitemapGeneratorXmlEntry('&lt;?xml version="1.0" encoding="UTF-8"' . '?' . '&gt;'));

        if($this-&gt;GetOption("b_style")!='') {
            $this-&gt;AddElement(new GoogleSitemapGeneratorXmlEntry('&lt;' . '?xml-stylesheet type="text/xsl" href="' . $this-&gt;GetOption("b_style") . '"?' . '&gt;'));
        }

        $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("generator=\"wordpress/" . get_bloginfo('version') . "\""));
        $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("sitemap-generator-url=\"http://www.arnebrachhold.de\" sitemap-generator-version=\"" . $this-&gt;GetVersion() . "\""));
        $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("generated-on=\"" . date(get_option("date_format") . " " . get_option("time_format")) . "\""));

        //All comments as an asso. Array (postID=&gt;commentCount)
        $comments=($this-&gt;GetOption("b_prio_provider")!=""?$this-&gt;GetComments():array());

        //Full number of comments
        $commentCount=(count($comments)&gt;0?$this-&gt;GetCommentCount($comments):0);

        if($debug &amp;&amp; $this-&gt;GetOption("b_prio_provider")!="") {
            $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Total comment count: " . $commentCount));
        }

        //Go XML!
        $this-&gt;AddElement(new GoogleSitemapGeneratorXmlEntry('&lt;urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;'));

        $home = get_bloginfo('url');

        //Add the home page (WITH a slash!)
        if($this-&gt;GetOption("in_home")) {
            $this-&gt;AddUrl(trailingslashit($home),$this-&gt;GetTimestampFromMySql(get_lastpostmodified('GMT')),$this-&gt;GetOption("cf_home"),$this-&gt;GetOption("pr_home"));
        }

        //Add the posts
        if($this-&gt;GetOption("in_posts") || $this-&gt;GetOption("in_pages")) {

            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Postings"));

            //Pre 2.1 compatibility. 2.1 introduced 'future' as post_status so we don't need to check post_date
            $wpCompat = (floatval($wp_version) &lt; 2.1);

            $postPageStmt = '';

            $inSubPages = ($this-&gt;GetOption('sm_in_posts_sub')===true);

            if($inSubPages &amp;&amp; $this-&gt;GetOption('in_posts')===true) {
                $pageDivider='&lt;!--nextpage--&gt;';
                $postPageStmt = ", (character_length(`post_content`)  - character_length(REPLACE(`post_content`, '$pageDivider', ''))) / " . strlen($pageDivider) . " as postPages";
            }

            $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-&gt;posts . "` WHERE ";

            $where = '(';

            if($this-&gt;GetOption('in_posts')) {
                //WP &lt; 2.1: posts are post_status = publish
                //WP &gt;= 2.1: post_type must be 'post', no date check required because future posts are post_status='future'
                if($wpCompat) $where.="(post_status = 'publish' AND post_date_gmt &lt;= '" . gmdate('Y-m-d H:i:59') . "')";
                else $where.=" (post_status = 'publish' AND (post_type = 'post' OR post_type = '')) ";
            }

            if($this-&gt;GetOption('in_pages')) {
                if($this-&gt;GetOption('in_posts')) {
                    $where.=" OR ";
                }
                if($wpCompat) {
                    //WP &lt; 2.1: posts have post_status = published, pages have post_status = static
                    $where.=" post_status='static' ";
                } else {
                    //WP &gt;= 2.1: posts have post_type = 'post' and pages have post_type = 'page'. Both must be published.
                    $where.=" (post_status = 'publish' AND post_type = 'page') ";
                }
            }

            $where.=") ";

            $excludes = $this-&gt;GetOption('b_exclude');

            if(is_array($excludes) &amp;&amp; count($excludes)&gt;0) {
                $where.=" AND ID NOT IN ('" . implode("','",$excludes) . "')";
            }

            $where.=" AND post_password='' ORDER BY post_modified DESC";

            $sql .= $where;

            if($this-&gt;GetOption("sm_b_max_posts")&gt;0) {
                $sql.=" LIMIT 0," . $this-&gt;GetOption("sm_b_max_posts");
            }

            $postCount = intval($wpdb-&gt;get_var("SELECT COUNT(*) AS cnt FROM `" . $wpdb-&gt;posts . "` WHERE ". $where,0,0));

            //Create a new connection because we are using mysql_unbuffered_query and don't want to disturb the WP connection
            //Safe Mode for other plugins which use mysql_query() without a connection handler and will destroy our resultset <img src='http://postedpost.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />
            $con = $postRes = null;
            if($this-&gt;GetOption("b_safemode")===true) {
                $postRes = mysql_query($sql,$wpdb-&gt;dbh);
                if(!$postRes) {
                    trigger_error("MySQL query failed: " . mysql_error(),E_USER_NOTICE); //E_NOTE will be displayed on our debug mode
                    return;
                }
            } else {
                $con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD,true);
                if(!$con) {
                    trigger_error("MySQL Connection failed: " . mysql_error(),E_USER_NOTICE);
                    return;
                }
                if(!mysql_select_db(DB_NAME,$con)) {
                    trigger_error("MySQL DB Select failed: " . mysql_error(),E_USER_NOTICE);
                    return;
                }
                $postRes = mysql_unbuffered_query($sql,$con);

                if(!$postRes) {
                    trigger_error("MySQL unbuffered query failed: " . mysql_error(),E_USER_NOTICE);
                    return;
                }
            }

            if($postRes) {

                //#type $prioProvider GoogleSitemapGeneratorPrioProviderBase
                $prioProvider=NULL;

                if($this-&gt;GetOption("b_prio_provider") != '') {
                    $providerClass=$this-&gt;GetOption('b_prio_provider');
                    $prioProvider = new $providerClass($commentCount,$postCount);
                }

                //$posts is used by Alex King's Popularity Contest plugin
                //if($posts == null || !is_array($posts)) {
                //    $posts = &amp;$postRes;
                //}

                $z = 1;
                $zz = 1;

                //Default priorities
                $default_prio_posts = $this-&gt;GetOption('pr_posts');
                $default_prio_pages = $this-&gt;GetOption('pr_pages');

                //Change frequencies
                $cf_pages = $this-&gt;GetOption('sm_cf_pages');
                $cf_posts = $this-&gt;GetOption('sm_cf_posts');

                $minPrio=$this-&gt;GetOption('pr_posts_min');

                $useQTransLate = false; //function_exists('qtrans_convertURL'); Not ready yet

                //Cycle through all posts and add them
                while($post = mysql_fetch_object($postRes)) {

                    //Fill the cache with our DB result. Since it's incomplete (no text-content for example), we will clean it later.
                    $cache = array(&amp;$post);
                    update_post_cache($cache);

                    $permalink = get_permalink($post-&gt;ID);
                    if($permalink != $home) {

                        $isPage = false;
                        if($wpCompat) {
                            $isPage = ($post-&gt;post_status == 'static');
                        } else {
                            $isPage = ($post-&gt;post_type == 'page');
                        }

                        //Set the current working post
                        $GLOBALS['post'] = &amp;$post;

                        //Default Priority if auto calc is disabled
                        $prio = 0;

                        if($isPage) {
                            //Priority for static pages
                            $prio = $default_prio_pages;
                        } else {
                            //Priority for normal posts
                            $prio = $default_prio_posts;
                        }

                        //If priority calc. is enabled, calculate (but only for posts, not pages)!
                        if($prioProvider !== null &amp;&amp; !$isPage) {

                            //Comment count for this post
                            $cmtcnt = (isset($comments[$post-&gt;ID])?$comments[$post-&gt;ID]:0);
                            $prio = $prioProvider-&gt;GetPostPriority($post-&gt;ID,$cmtcnt);

                            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry('Debug: Priority report of postID ' . $post-&gt;ID . ': Comments: ' . $cmtcnt . ' of ' . $commentCount . ' = ' . $prio . ' points'));
                        }

                        if(!$isPage &amp;&amp; $minPrio&gt;0 &amp;&amp; $prio&lt;$minPrio) {
                            $prio = $minPrio;
                        }

                        //Add it
                        $this-&gt;AddUrl($permalink,$this-&gt;GetTimestampFromMySql(($post-&gt;post_modified_gmt &amp;&amp; $post-&gt;post_modified_gmt!='0000-00-00 00:00:00'?$post-&gt;post_modified_gmt:$post-&gt;post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);

                        if($inSubPages) {
                            $subPage = '';
                            for($p =1; $p&lt;=$post-&gt;postPages; $p++) {
                                if(get_option('permalink_structure') == '') {
                                    $subPage = $permalink . '&amp;amp;page=' . $p;
                                } else {
                                    $subPage = trailingslashit($permalink) . user_trailingslashit($p, 'single_paged');
                                }

                                $this-&gt;AddUrl($subPage,$this-&gt;GetTimestampFromMySql(($post-&gt;post_modified_gmt &amp;&amp; $post-&gt;post_modified_gmt!='0000-00-00 00:00:00'?$post-&gt;post_modified_gmt:$post-&gt;post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
                            }
                        }

                       // Multilingual Support with qTranslate, thanks to Qian Qin
                       if($useQTransLate) {
                           global $q_config;
                           foreach($q_config['enabled_languages'] as $language) {
                               if($language != $q_config['default_language']) {
                                   $this-&gt;AddUrl(qtrans_convertURL($permalink,$language),$this-&gt;GetTimestampFromMySql(($post-&gt;post_modified_gmt &amp;&amp; $post-&gt;post_modified_gmt!='0000-00-00 00:00:00'?$post-&gt;post_modified_gmt:$post-&gt;post_date_gmt)),($isPage?$cf_pages:$cf_posts),$prio);
                               }
                           }
                       }
                    }

                    //Update the status every 100 posts and at the end.
                    //If the script breaks because of memory or time limit,
                    //we have a "last reponded" value which can be compared to the server settings
                    if($zz==100 || $z == $postCount) {
                        $status-&gt;SaveStep($z);
                        $zz=0;
                    } else $zz++;

                    $z++;

                    //Clean cache because it's incomplete
                    if(version_compare($wp_version,"2.5","&gt;=")) {
                        //WP 2.5 makes a mysql query for every clean_post_cache to clear the child cache
                        //so I've vopied the function here until a patch arrives...
                        wp_cache_delete($post-&gt;ID, 'posts');
                        wp_cache_delete($post-&gt;ID, 'post_meta');
                        clean_object_term_cache($post-&gt;ID, 'post');
                    } else {
                        clean_post_cache($post-&gt;ID);
                    }
                }
                unset($postRes);
                unset($prioProvider);

                if($this-&gt;GetOption("b_safemode")!==true &amp;&amp; $con) mysql_close($con);
            }
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Postings"));
        }

        //Add the cats
        if($this-&gt;GetOption("in_cats")) {
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Cats"));

            if(!$this-&gt;IsTaxonomySupported()) {

                $catsRes=$wpdb-&gt;get_results("
                            SELECT
                                c.cat_ID AS ID,
                                MAX(p.post_modified_gmt) AS last_mod
                            FROM
                                `" . $wpdb-&gt;categories . "` c,
                                `" . $wpdb-&gt;post2cat . "` pc,
                                `" . $wpdb-&gt;posts . "` p
                            WHERE
                                pc.category_id = c.cat_ID
                                AND p.ID = pc.post_id
                                AND p.post_status = 'publish'
                                AND p.post_type='post'
                            GROUP
                                BY c.cat_id
                            ");
                if($catsRes) {
                    foreach($catsRes as $cat) {
                        if($cat &amp;&amp; $cat-&gt;ID &amp;&amp; $cat-&gt;ID&gt;0) {
                            if($debug) if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Cat-ID:" . $cat-&gt;ID));
                            $this-&gt;AddUrl(get_category_link($cat-&gt;ID),$this-&gt;GetTimestampFromMySql($cat-&gt;last_mod),$this-&gt;GetOption("cf_cats"),$this-&gt;GetOption("pr_cats"));
                        }
                    }
                }
            } else {
                $cats = get_terms("category",array("hide_empty"=&gt;true,"hierarchical"=&gt;false));
                if($cats &amp;&amp; is_array($cats) &amp;&amp; count($cats)&gt;0) {
                    foreach($cats AS $cat) {
                        $this-&gt;AddUrl(get_category_link($cat-&gt;term_id),0,$this-&gt;GetOption("cf_cats"),$this-&gt;GetOption("pr_cats"));
                    }
                }
            }
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Cats"));
        }

        //Add the archives
        if($this-&gt;GetOption("in_arch")) {
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Archive"));
            $now = current_time('mysql');

            //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
            $arcresults = $wpdb-&gt;get_results("
                        SELECT DISTINCT
                            YEAR(post_date_gmt) AS `year`,
                            MONTH(post_date_gmt) AS `month`,
                            MAX(post_date_gmt) as last_mod,
                            count(ID) as posts
                        FROM
                            $wpdb-&gt;posts
                        WHERE
                            post_date &lt; '$now'
                            AND post_status = 'publish'
                            AND post_type = 'post'
                            " . (floatval($wp_version) &lt; 2.1?"AND {$wpdb-&gt;posts}.post_date_gmt &lt;= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
                        GROUP BY
                            YEAR(post_date_gmt),
                            MONTH(post_date_gmt)
                        ORDER BY
                            post_date_gmt DESC");
            if ($arcresults) {
                foreach ($arcresults as $arcresult) {

                    $url  = get_month_link($arcresult-&gt;year,   $arcresult-&gt;month);
                    $changeFreq="";

                    //Archive is the current one
                    if($arcresult-&gt;month==date("n") &amp;&amp; $arcresult-&gt;year==date("Y")) {
                        $changeFreq=$this-&gt;GetOption("cf_arch_curr");
                    } else { // Archive is older
                        $changeFreq=$this-&gt;GetOption("cf_arch_old");
                    }

                    $this-&gt;AddUrl($url,$this-&gt;GetTimestampFromMySql($arcresult-&gt;last_mod),$changeFreq,$this-&gt;GetOption("pr_arch"));
                }
            }
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Archive"));
        }

        //Add the author pages
        if($this-&gt;GetOption("in_auth")) {
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Author pages"));

            $linkFunc = null;

            //get_author_link is deprecated in WP 2.1, try to use get_author_posts_url first.
            if(function_exists('get_author_posts_url')) {
                $linkFunc = 'get_author_posts_url';
            } else if(function_exists('get_author_link')) {
                $linkFunc = 'get_author_link';
            }

            //Who knows what happens in later WP versions, so check again if it worked
            if($linkFunc !== null) {
                //Unfortunately there is no API function to get all authors, so we have to do it the dirty way...
                //We retrieve only users with published and not password protected posts (and not pages)
                //WP2.1 introduced post_status='future', for earlier WP versions we need to check the post_date_gmt
                $sql = "SELECT DISTINCT
                            {$wpdb-&gt;users}.ID,
                            {$wpdb-&gt;users}.user_nicename,
                            MAX({$wpdb-&gt;posts}.post_modified_gmt) AS last_post
                        FROM
                            {$wpdb-&gt;users},
                            {$wpdb-&gt;posts}
                        WHERE
                            {$wpdb-&gt;posts}.post_author = {$wpdb-&gt;users}.ID
                            AND {$wpdb-&gt;posts}.post_status = 'publish'
                            AND {$wpdb-&gt;posts}.post_type = 'post'
                            AND {$wpdb-&gt;posts}.post_password = ''
                            " . (floatval($wp_version) &lt; 2.1?"AND {$wpdb-&gt;posts}.post_date_gmt &lt;= '" . gmdate('Y-m-d H:i:59') . "'":"") . "
                        GROUP BY
                            {$wpdb-&gt;users}.ID,
                            {$wpdb-&gt;users}.user_nicename";

                $authors = $wpdb-&gt;get_results($sql);

                if($authors &amp;&amp; is_array($authors)) {
                    foreach($authors as $author) {
                        if($debug) if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Author-ID:" . $author-&gt;ID));
                        $url = ($linkFunc=='get_author_posts_url'?get_author_posts_url($author-&gt;ID,$author-&gt;user_nicename):get_author_link(false,$author-&gt;ID,$author-&gt;user_nicename));
                        $this-&gt;AddUrl($url,$this-&gt;GetTimestampFromMySql($author-&gt;last_post),$this-&gt;GetOption("cf_auth"),$this-&gt;GetOption("pr_auth"));
                    }
                }
            } else {
                //Too bad, no author pages for you <img src='http://postedpost.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />
                if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: No valid author link function found"));
            }

            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Author pages"));
        }

        //Add tag pages
        if($this-&gt;GetOption("in_tags") &amp;&amp; $this-&gt;IsTaxonomySupported()) {
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Tags"));
            $tags = get_terms("post_tag",array("hide_empty"=&gt;true,"hierarchical"=&gt;false));
            if($tags &amp;&amp; is_array($tags) &amp;&amp; count($tags)&gt;0) {
                foreach($tags AS $tag) {
                    $this-&gt;AddUrl(get_tag_link($tag-&gt;term_id),0,$this-&gt;GetOption("cf_tags"),$this-&gt;GetOption("pr_tags"));
                }
            }
            if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Tags"));
        }

        //Add the custom pages
        if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start Custom Pages"));
        if($this-&gt;_pages &amp;&amp; is_array($this-&gt;_pages) &amp;&amp; count($this-&gt;_pages)&gt;0) {
            //#type $page GoogleSitemapGeneratorPage
            foreach($this-&gt;_pages AS $page) {
                $this-&gt;AddUrl($page-&gt;GetUrl(),$page-&gt;getLastMod(),$page-&gt;getChangeFreq(),$page-&gt;getPriority());
            }
        }

        if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End Custom Pages"));

        if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: Start additional URLs"));

        do_action("sm_buildmap");

        if($debug) $this-&gt;AddElement(new GoogleSitemapGeneratorDebugEntry("Debug: End additional URLs"));

        $this-&gt;AddElement(new GoogleSitemapGeneratorXmlEntry("&lt;/urlset&gt;"));

        $pingUrl='';

        if($this-&gt;GetOption("b_xml")) {
            if($this-&gt;_fileHandle &amp;&amp; fclose($this-&gt;_fileHandle)) {
                $this-&gt;_fileHandle = null;
                $status-&gt;EndXml(true);
                $pingUrl=$this-&gt;GetXmlUrl();
            } else $status-&gt;EndXml(false,"Could not close the sitemap file.");
        }

        if($this-&gt;IsGzipEnabled()) {
            if($this-&gt;_fileZipHandle &amp;&amp; fclose($this-&gt;_fileZipHandle)) {
                $this-&gt;_fileZipHandle = null;
                $status-&gt;EndZip(true);
                $pingUrl=$this-&gt;GetZipUrl();
            } else $status-&gt;EndZip(false,"Could not close the zipped sitemap file");
        }

        //Ping Google
        if($this-&gt;GetOption("b_ping") &amp;&amp; !empty($pingUrl)) {
            $sPingUrl="http://www.google.com/webmasters/sitemaps/ping?sitemap=" . urlencode($pingUrl);
            $status-&gt;StartGooglePing($sPingUrl);
            $pingres=$this-&gt;RemoteOpen($sPingUrl);

            if($pingres==NULL || $pingres===false) {
                $status-&gt;EndGooglePing(false,$this-&gt;_lastError);
            } else {
                $status-&gt;EndGooglePing(true);
            }
        }

        //Ping Ask.com
        if($this-&gt;GetOption("b_pingask") &amp;&amp; !empty($pingUrl)) {
            $sPingUrl="http://submissions.ask.com/ping?sitemap=" . urlencode($pingUrl);
            $status-&gt;StartAskPing($sPingUrl);
            $pingres=$this-&gt;RemoteOpen($sPingUrl);

            if($pingres==NULL || $pingres===false || strpos($pingres,"successfully received and added")===false) { //Ask.com returns 200 OK even if there was an error, so we need to check the content.
                $status-&gt;EndAskPing(false,$this-&gt;_lastError);
            } else {
                $status-&gt;EndAskPing(true);
            }
        }

        //Ping YAHOO
        if($this-&gt;GetOption("sm_b_pingyahoo")===true &amp;&amp; $this-&gt;GetOption("sm_b_yahookey")!="" &amp;&amp; !empty($pingUrl)) {
            $sPingUrl="http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=" . $this-&gt;GetOption("sm_b_yahookey") . "&amp;url=" . urlencode($pingUrl);
            $status-&gt;StartYahooPing($sPingUrl);
            $pingres=$this-&gt;RemoteOpen($sPingUrl);

            if($pingres==NULL || $pingres===false || strpos(strtolower($pingres),"success")===false) {
                $status-&gt;EndYahooPing(false,$this-&gt;_lastError);
            } else {
                $status-&gt;EndYahooPing(true);
            }
        }

        //Ping MSN
        if($this-&gt;GetOption("b_pingmsn") &amp;&amp; !empty($pingUrl)) {
            $sPingUrl="http://webmaster.live.com/ping.aspx?siteMap=" . urlencode($pingUrl);
            $status-&gt;StartMsnPing($sPingUrl);
            $pingres=$this-&gt;RemoteOpen($sPingUrl);

            if($pingres==NULL || $pingres===false || strpos($pingres,"Thanks for submitting your sitemap")===false) {
                $status-&gt;EndMsnPing(false,$this-&gt;_lastError);
            } else {
                $status-&gt;EndMsnPing(true);
            }
        }

        $status-&gt;End();

        $this-&gt;_isActive = false;

        //done...
        return $status;
    }

    function RemoteOpen($url) {
        $res = null;

        if(file_exists(ABSPATH . 'wp-includes/class-snoopy.php')) {
            require_once( ABSPATH . 'wp-includes/class-snoopy.php');

            $s = new Snoopy();
            $s-&gt;fetch($url);

            if($s-&gt;status == 200) {
                $res = $s-&gt;results;
            }
        } else {
            $res = wp_remote_fopen($url);
        }
        return $res;
    }

    /**
     * Tracks the last error (gets called by PHP)
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     */
    function TrackError($log_level, $log_text, $error_file, $error_line) {
        $this-&gt;_lastError = $log_text;
    }

    /**
     * Echos option fields for an select field containing the valid change frequencies
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $currentVal The value which should be selected
     * @return all valid change frequencies as html option fields
     */
    function HtmlGetFreqNames($currentVal) {

        foreach($this-&gt;_freqNames AS $k=&gt;$v) {
            echo "&lt;option value=\"$k\" " . $this-&gt;HtmlGetSelected($k,$currentVal) ."&gt;" . $v . "&lt;/option&gt;";
        }
    }

    /**
     * Echos option fields for an select field containing the valid priorities (0- 1.0)
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $currentVal string The value which should be selected
     * @return 0.0 - 1.0 as html option fields
     */
    function HtmlGetPriorityValues($currentVal) {
        $currentVal=(float) $currentVal;
        for($i=0.0; $i&lt;=1.0; $i+=0.1) {
            echo "&lt;option value=\"$i\" " . $this-&gt;HtmlGetSelected("$i","$currentVal") ."&gt;";
            _e(strval($i));
            echo "&lt;/option&gt;";
        }
    }

    /**
     * Returns the checked attribute if the given values match
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $val string The current value
     * @param $equals string The value to match
     * @return The checked attribute if the given values match, an empty string if not
     */
    function HtmlGetChecked($val,$equals) {
        if($val==$equals) return $this-&gt;HtmlGetAttribute("checked");
        else return "";
    }

    /**
     * Returns the selected attribute if the given values match
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $val string The current value
     * @param $equals string The value to match
     * @return The selected attribute if the given values match, an empty string if not
     */
    function HtmlGetSelected($val,$equals) {
        if($val==$equals) return $this-&gt;HtmlGetAttribute("selected");
        else return "";
    }

    /**
     * Returns an formatted attribute. If the value is NULL, the name will be used.
     *
     * @since 3.0
     * @access private
     * @author Arne Brachhold
     * @param $attr string The attribute name
     * @param $value string The attribute value
     * @return The formatted attribute
     */
    function HtmlGetAttribute($attr,$value=NULL) {
        if($value==NULL) $value=$attr;
        return " " . $attr . "=\"" . $value . "\" ";
    }

    /**
     * Returns an array with GoogleSitemapGeneratorPage objects which is generated from POST values
     *
     * @since 3.0
     * @see GoogleSitemapGeneratorPage
     * @access private
     * @author Arne Brachhold
     * @return array An array with GoogleSitemapGeneratorPage objects
     */
    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"]) &amp;&amp; is_array($_POST["sm_pages_mark"])) {
            for($i=0; $i&lt;count($_POST["sm_pages_mark"]); $i++) {
                //Create new object
                $p=new GoogleSitemapGeneratorPage();
                if(substr($pages_ur[$i],0,4)=="www.") $pages_ur[$i]="http://" . $pages_ur[$i];
                $p-&gt;SetUrl($pages_ur[$i]);
                $p-&gt;SetProprity($pages_pr[$i]);
                $p-&gt;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-&gt;setLastMod(0);
                else $p-&gt;setLastMod($lm);

                //Add it to the array
                array_push($pages,$p);
            }
        }
        return $pages;
    }

    function GetTimestampFromMySql($mysqlDateTime) {
        list($date, $hours) = split(' ', $mysqlDateTime);
        list($year,$month,$day) = split('-',$date);
        list($hour,$min,$sec) = split(':',$hours);
        return mktime($hour, $min, $sec, $month, $day, $year);
    }

    function GetResourceLink($resourceID) {
        return trailingslashit(get_bloginfo('siteurl')) . '?res=' . $resourceID;
    }

    function GetRedirectLink($redir) {
        return trailingslashit("http://www.arnebrachhold.de/redir/" . $redir);
    }

    function GetBackLink() {
        $page = basename(__FILE__);
        if(isset($_GET['page']) &amp;&amp; !empty($_GET['page'])) {
            $page = preg_replace('[^a-zA-Z0-9\.\_\-]','',$_GET['page']);
        }
        return $_SERVER['PHP_SELF'] . "?page=" .  $page;
    }

    function HtmlShowOptionsPage() {
        if(!class_exists("GoogleSitemapGeneratorUI")) {

            $path = trailingslashit(dirname(__FILE__));

            if(!file_exists( $path . 'sitemap-ui.php')) return false;
            require_once($path. 'sitemap-ui.php');
        }

        $ui = new GoogleSitemapGeneratorUI($this);
        $ui-&gt;HtmlShowOptionsPage();
        return true;
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-core-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>45</dc:id>	</item>
		<item>
		<title>Wordpress Mu Google XML Sitemap Solution</title>
		<link>http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/</link>
		<comments>http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 04:25:05 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=39</guid>
		<description><![CDATA[After download the Google Sitemaps Generator, I thought it might easy to install on Wordpress mu system. But I am wrong, not that simple, I have to change lots of place to make it useful. Here is what I do and why:
First thing first, install:
Install the sitemap generator is same as install any other plugin, [...]]]></description>
			<content:encoded><![CDATA[<p>After download the <a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/" target="_blank">Google Sitemaps Generator</a>, I thought it might easy to install on <a href="http://postedpost.com/tag/wordpress/">Wordpress</a> <a href="http://postedpost.com/tag/mu-system/"><strong>mu system</strong></a>. But I am wrong, not that simple, I have to change lots of place to make it useful. Here is what I do and why:</p>
<h2>First thing first, install:</h2>
<p>Install the <a href="http://postedpost.com/tag/sitemap-generator/"><strong>sitemap generator</strong></a> is same as install any other <a href="http://postedpost.com/tag/plugin/">plugin</a>, unzip and put it into <a href="http://postedpost.com/tag/plugin/">plugin</a> <a href="http://postedpost.com/tag/folder/">folder</a>, like:</p>
<p><strong>\wp-content\<a href="http://postedpost.com/tag/plugin/">plugins</a>\<a href="http://postedpost.com/tag/google-sitemap-generator/"><big>google-sitemap-generator</big></a></strong></p>
<p>I am not put it into <strong><a href="http://postedpost.com/tag/mu/">mu</a>-<a href="http://postedpost.com/tag/plugin/">plugins</a></strong> <a href="http://postedpost.com/tag/folder/">folder</a>, because I do not want <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a> for all <a href="http://postedpost.com/tag/blog/">blogs</a>, I need give blogger choice, they can active it when they need <a href="http://postedpost.com/tag/sitemap/">sitemap</a>. (Not everyone like <a href="http://postedpost.com/tag/sitemap/">sitemap</a> IMO)<span id="more-39"></span></p>
<h2>Now, Lets Make Some Change</h2>
<h3><a href="http://postedpost.com/tag/function/">function</a> GetHomePath()</h3>
<p>Find <a href="http://postedpost.com/tag/function/">function</a> <strong>GetHomePath</strong> at <strong><a href="http://postedpost.com/tag/sitemap/">sitemap</a>-core.<a href="http://postedpost.com/tag/php/">php</a></strong> <a href="http://postedpost.com/tag/file/">file</a>, this <a href="http://postedpost.com/tag/function/">function</a> return the <a href="http://postedpost.com/tag/value/">value</a> of <a href="http://postedpost.com/tag/blog/">blog</a> root, it works fine for single <a href="http://postedpost.com/tag/wordpress/">wordpress</a> <a href="http://postedpost.com/tag/system/">system</a>, but for <a href="http://postedpost.com/tag/mu-system/"><strong>mu system</strong></a>, it will cause mess, as author recommend, we change this <a href="http://postedpost.com/tag/function/">function</a>, before return $res;</p>
<blockquote><p>Global $blog_id;<br />
if ($blog_id != 1) $res .= &#8216;wp-content/<a href="http://postedpost.com/tag/blog/">blogs</a>.dir/&#8217; . $blog_id . &#8216;/<a href="http://postedpost.com/tag/file/">files</a>/&#8217;;<br />
return $res;</p></blockquote>
<p>After change this <a href="http://postedpost.com/tag/function/">function</a>, the <strong><a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a></strong> and <strong><a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>.gz</strong> <a href="http://postedpost.com/tag/file/">file</a> will be placed at <a href="http://postedpost.com/tag/blog/">blog</a> <a href="http://postedpost.com/tag/file/">file</a> <a href="http://postedpost.com/tag/folder/">folder</a>.</p>
<h3><a href="http://postedpost.com/tag/remove/">Remove</a> <a href="http://postedpost.com/tag/user/">user</a> ability to make <a href="http://postedpost.com/tag/key/">key</a> setting changes</h3>
<p><a href="http://postedpost.com/tag/wordpress/">WordPress</a> <a href="http://postedpost.com/tag/mu/">mu</a> is a multiuser <a href="http://postedpost.com/tag/system/">system</a>, you should not allow <a href="http://postedpost.com/tag/user/">user</a> to change some <a href="http://postedpost.com/tag/key/">key</a> <a href="http://postedpost.com/tag/sitemap/">sitemap</a> setting, open <strong><a href="http://postedpost.com/tag/sitemap/">sitemap</a>-ui.<a href="http://postedpost.com/tag/php/">php</a></strong> <a href="http://postedpost.com/tag/file/">file</a>,</p>
<p><strong><a href="http://postedpost.com/tag/remove/">Remove</a></strong></p>
<blockquote><p>} <a href="http://postedpost.com/tag/else/">else</a> if($k==&#8221;sm_b_location_mode&#8221;) {<br />
$<a href="http://postedpost.com/tag/tmp/">tmp</a>=(string) $_POST[$k];<br />
$<a href="http://postedpost.com/tag/tmp/">tmp</a>=strtolower($<a href="http://postedpost.com/tag/tmp/">tmp</a>);<br />
if($<a href="http://postedpost.com/tag/tmp/">tmp</a>==&#8221;<a href="http://postedpost.com/tag/auto/">auto</a>&#8221; || $<a href="http://postedpost.com/tag/tmp/">tmp</a>=&#8221;manual&#8221;) $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;_options[$k]=$<a href="http://postedpost.com/tag/tmp/">tmp</a>;<br />
<a href="http://postedpost.com/tag/else/">else</a> $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;_options[$k]=&#8221;<a href="http://postedpost.com/tag/auto/">auto</a>&#8220;;</p></blockquote>
<p>This is for decide where the <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a> placed, do not need for <a href="http://postedpost.com/tag/mu-system/"><strong>mu system</strong></a></p>
<p><strong><a href="http://postedpost.com/tag/remove/">Remove</a></strong></p>
<blockquote><p>If($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8217;sm_b_robots&#8217;)===<a href="http://postedpost.com/tag/true/">true</a>) {<br />
if($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;WriteRobotsFile()) {<br />
$message.=str_replace(&#8221;%s&#8221;,$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;GetRobotsFileUrl(),__(&#8221;&lt;a href=\&#8221;%s\&#8221;&gt;<a href="http://postedpost.com/tag/robots/">Robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a>&lt;/a&gt; <a href="http://postedpost.com/tag/file/">file</a> saved&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;)) . &#8220;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;&#8221;;<br />
} <a href="http://postedpost.com/tag/else/">else</a> {<br />
$message.=__(&#8221;Error while saving <a href="http://postedpost.com/tag/robots/">Robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a>&#8220;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) . &#8220;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;&#8221;;<br />
}<br />
}</p></blockquote>
<p>This is for how to change <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a>, as we know, for <a href="http://postedpost.com/tag/mu-system/"><strong>mu system</strong></a>, <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a> is generated on the fly, so cannot allow <a href="http://postedpost.com/tag/user/">user</a> to change it.</p>
<p><strong><a href="http://postedpost.com/tag/remove/">Remove</a></strong></p>
<blockquote><p><strong>&lt;<a href="http://postedpost.com/tag/li/">li</a>&gt;</strong></p></blockquote>
<blockquote><p>&lt;<a href="http://postedpost.com/tag/input-type/"><strong>input type</strong></a>=&#8221;checkbox&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_b_robots&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_robots&#8221; &lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> ($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;sm_b_robots&#8221;)==<a href="http://postedpost.com/tag/true/">true</a>?&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>=\&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>\&#8221;":&#8221;") ?&gt; /&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> str_replace(&#8217;%s&#8217;,(file_exists($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;GetRobotsFilePath())?&#8217;&lt;a href=&#8221;&#8216; . $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;GetRobotsFileUrl() . &#8216;&#8221;&gt;<a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a>&lt;/a&gt;&#8217;:&#8217;<a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a>&#8216;),__(&#8221;Modify or create %s <a href="http://postedpost.com/tag/file/">file</a> in <a href="http://postedpost.com/tag/blog/">blog</a> root which contains the <a href="http://postedpost.com/tag/sitemap/">sitemap</a> <a href="http://postedpost.com/tag/location/">location</a>.&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;)); ?&gt;</p>
<p>&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8221;<a href="http://postedpost.com/tag/file/">File</a> permissions: &#8220;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
$f = $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;GetRobotsFilePath();<br />
$link = &#8216; &lt;a href=&#8221;&#8216; . $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;GetRedirectLink(&#8221;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>-help-<a href="http://postedpost.com/tag/options/">options</a>-<a href="http://postedpost.com/tag/robots/">robots</a>&#8220;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) . &#8216;&#8221;&gt;&#8217; . __(&#8221;Learn more&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) . &#8216;&lt;/a&gt;&#8217;;<br />
if(file_exists($f)) {<br />
if(is_writable($f)) {<br />
_e(&#8221;OK, <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a> is <a href="http://postedpost.com/tag/writable/">writable</a>.&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
} <a href="http://postedpost.com/tag/else/">else</a> {<br />
<a href="http://postedpost.com/tag/echo/">echo</a> __(&#8221;Error, <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a> is not <a href="http://postedpost.com/tag/writable/">writable</a>.&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) . $link;<br />
}<br />
} <a href="http://postedpost.com/tag/else/">else</a> {<br />
if(is_writable(dirname($f))) {<br />
_e(&#8221;OK, <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a> doesn&#8217;t exist but the directory is <a href="http://postedpost.com/tag/writable/">writable</a>.&#8221;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
} <a href="http://postedpost.com/tag/else/">else</a> {<br />
<a href="http://postedpost.com/tag/echo/">echo</a> __(&#8221;Error, <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt/">txt</a> doesn&#8217;t exist and the directory is not <a href="http://postedpost.com/tag/writable/">writable</a>&#8220;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) . $link;<br />
}<br />
}<br />
?&gt;<br />
&lt;/<a href="http://postedpost.com/tag/li/">li</a>&gt;</p></blockquote>
<p>This is the UI (<a href="http://postedpost.com/tag/user/">User</a> Interface) part of <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a> change, if you do not <a href="http://postedpost.com/tag/user/">user</a> change it, so don&#8217;t let them see it.</p>
<p><strong><a href="http://postedpost.com/tag/remove/">Remove</a></strong></p>
<blockquote><p>&lt;!&#8211; <a href="http://postedpost.com/tag/location/">Location</a> <a href="http://postedpost.com/tag/options/">Options</a> &#8211;&gt;<br />
&lt;<a href="http://postedpost.com/tag/div-class/"><strong>div class</strong></a>=&#8221;dbx-<a href="http://postedpost.com/tag/b/">b</a>-ox-wrapper&#8221;&gt;<br />
&lt;fieldset <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_location&#8221; <a href="http://postedpost.com/tag/class/">class</a>=&#8221;dbx-box&#8221;&gt;<br />
&lt;<a href="http://postedpost.com/tag/div-class/"><strong>div class</strong></a>=&#8221;dbx-h-andle-wrapper&#8221;&gt;<br />
&lt;h3 <a href="http://postedpost.com/tag/class/">class</a>=&#8221;dbx-handle&#8221;&gt;&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;<a href="http://postedpost.com/tag/location/">Location</a> of your <a href="http://postedpost.com/tag/sitemap-file/"><strong>sitemap file</strong></a>&#8216;, &#8216;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;&lt;/h3&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/div-class/"><strong>div class</strong></a>=&#8221;dbx-c-ontent-wrapper&#8221;&gt;<br />
&lt;<a href="http://postedpost.com/tag/div-class/"><strong>div class</strong></a>=&#8221;dbx-content&#8221;&gt;<br />
&lt;<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/b/">b</a>&gt;&lt;<a href="http://postedpost.com/tag/label/">label</a> for=&#8221;sm_location_useauto&#8221;&gt;&lt;<a href="http://postedpost.com/tag/input-type/"><strong>input type</strong></a>=&#8221;radio&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_location_useauto&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_location_mode&#8221; <a href="http://postedpost.com/tag/value/">value</a>=&#8221;<a href="http://postedpost.com/tag/auto/">auto</a>&#8221; &lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> ($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_location_mode&#8221;)==&#8221;<a href="http://postedpost.com/tag/auto/">auto</a>&#8220;?&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>=\&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>\&#8221;":&#8221;") ?&gt; /&gt; &lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Automatic detection&#8217;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;&lt;/<a href="http://postedpost.com/tag/label/">label</a>&gt;&lt;/<a href="http://postedpost.com/tag/b/">b</a>&gt;<br />
&lt;ul&gt;<br />
&lt;<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/label/">label</a> for=&#8221;sm_b_filename&#8221;&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;<a href="http://postedpost.com/tag/filename/">Filename</a> of the <a href="http://postedpost.com/tag/sitemap-file/"><strong>sitemap file</strong></a>&#8216;, &#8216;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;<br />
&lt;<a href="http://postedpost.com/tag/input-type/"><strong>input type</strong></a>=&#8221;text&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_b_filename&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_filename&#8221; <a href="http://postedpost.com/tag/value/">value</a>=&#8221;&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_filename&#8221;); ?&gt;&#8221; /&gt;<br />
&lt;/<a href="http://postedpost.com/tag/label/">label</a>&gt;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Detected Path&#8217;, &#8216;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;: &lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;getXmlPath(<a href="http://postedpost.com/tag/true/">true</a>); ?&gt;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Detected <a href="http://postedpost.com/tag/url/">URL</a>&#8216;, &#8216;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;: &lt;a href=&#8221;&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;getXmlUrl(<a href="http://postedpost.com/tag/true/">true</a>); ?&gt;&#8221;&gt;&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> $this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;getXmlUrl(<a href="http://postedpost.com/tag/true/">true</a>); ?&gt;&lt;/a&gt;<br />
&lt;/<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;/ul&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/b/">b</a>&gt;&lt;<a href="http://postedpost.com/tag/label/">label</a> for=&#8221;sm_location_usemanual&#8221;&gt;&lt;<a href="http://postedpost.com/tag/input-type/"><strong>input type</strong></a>=&#8221;radio&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_location_usemanual&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_location_mode&#8221; <a href="http://postedpost.com/tag/value/">value</a>=&#8221;manual&#8221; &lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> ($this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_location_mode&#8221;)==&#8221;manual&#8221;?&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>=\&#8221;<a href="http://postedpost.com/tag/checked/">checked</a>\&#8221;":&#8221;") ?&gt; /&gt; &lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Custom <a href="http://postedpost.com/tag/location/">location</a>&#8216;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;) ?&gt;&lt;/<a href="http://postedpost.com/tag/label/">label</a>&gt;&lt;/<a href="http://postedpost.com/tag/b/">b</a>&gt;<br />
&lt;ul&gt;<br />
&lt;<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/label/">label</a> for=&#8221;sm_b_filename_manual&#8221;&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Absolute or relative path to the <a href="http://postedpost.com/tag/sitemap-file/"><strong>sitemap file</strong></a>, including <a href="http://postedpost.com/tag/name/">name</a>.&#8217;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;&#8221;;<br />
_e(&#8217;Example&#8217;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;: /var/www/htdocs/<a href="http://postedpost.com/tag/wordpress/">wordpress</a>/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>&#8220;; ?&gt;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;<br />
&lt;<a href="http://postedpost.com/tag/input/">input</a> style=&#8221;width:70%&#8221; <a href="http://postedpost.com/tag/type/">type</a>=&#8221;text&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_b_filename_manual&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_filename_manual&#8221; <a href="http://postedpost.com/tag/value/">value</a>=&#8221;&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> (!$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_filename_manual&#8221;)?$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;getXmlPath():$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_filename_manual&#8221;)); ?&gt;&#8221; /&gt;<br />
&lt;/<a href="http://postedpost.com/tag/label/">label</a>&gt;<br />
&lt;/<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;<a href="http://postedpost.com/tag/label/">label</a> for=&#8221;sm_b_fileurl_manual&#8221;&gt;<br />
&lt;?<a href="http://postedpost.com/tag/php/">php</a> _e(&#8217;Complete <a href="http://postedpost.com/tag/url/">URL</a> to the <a href="http://postedpost.com/tag/sitemap-file/"><strong>sitemap file</strong></a>, including <a href="http://postedpost.com/tag/name/">name</a>.&#8217;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;&#8221;;<br />
_e(&#8217;Example&#8217;,&#8217;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216;);<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;: http://www.yourdomain.com/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>&#8220;; ?&gt;&lt;<a href="http://postedpost.com/tag/br/">br</a> /&gt;<br />
&lt;<a href="http://postedpost.com/tag/input/">input</a> style=&#8221;width:70%&#8221; <a href="http://postedpost.com/tag/type/">type</a>=&#8221;text&#8221; <a href="http://postedpost.com/tag/id/">id</a>=&#8221;sm_b_fileurl_manual&#8221; <a href="http://postedpost.com/tag/name/">name</a>=&#8221;sm_b_fileurl_manual&#8221; <a href="http://postedpost.com/tag/value/">value</a>=&#8221;&lt;?<a href="http://postedpost.com/tag/php-echo/"><strong>php echo</strong></a> (!$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_fileurl_manual&#8221;)?$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;getXmlUrl():$this-&gt;<a href="http://postedpost.com/tag/sg/">sg</a>-&gt;<a href="http://postedpost.com/tag/getoption/">GetOption</a>(&#8221;b_fileurl_manual&#8221;)); ?&gt;&#8221; /&gt;<br />
&lt;/<a href="http://postedpost.com/tag/label/">label</a>&gt;<br />
&lt;/<a href="http://postedpost.com/tag/li/">li</a>&gt;<br />
&lt;/ul&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;<br />
&lt;/fieldset&gt;<br />
&lt;/<a href="http://postedpost.com/tag/div/">div</a>&gt;</p></blockquote>
<p>This part is for choose <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a> <a href="http://postedpost.com/tag/location/">location</a>, same same, if you do not want <a href="http://postedpost.com/tag/user/">user</a> change it, better not allow them see it.</p>
<h3>Change <a href="http://postedpost.com/tag/default/">Default</a> <a href="http://postedpost.com/tag/settings/">Settings</a></h3>
<p>This is not must, but I recommend you change it, to make your <a href="http://postedpost.com/tag/user/">user</a> life easier</p>
<p>On <strong><a href="http://postedpost.com/tag/sitemap/">sitemap</a>-core.<a href="http://postedpost.com/tag/php/">php</a></strong> <a href="http://postedpost.com/tag/file/">file</a>, you can find <a href="http://postedpost.com/tag/default/">default</a> <a href="http://postedpost.com/tag/value/">value</a> at <a href="http://postedpost.com/tag/function/">function</a> <strong>InitOptions</strong></p>
<p><strong>The change I made are:</strong></p>
<blockquote><p>$this-&gt;_options["sm_b_prio_provider"]=&#8221;GoogleSitemapGeneratorPrioByAverageProvider&#8221;;</p></blockquote>
<p>The provider for automatic priority calculation, after I test, <strong><a href="http://postedpost.com/tag/google-sitemap-generator/"><big>Google Sitemap Generator</big></a> Prio By Average Provider</strong> is working better than <strong><a href="http://postedpost.com/tag/google-sitemap-generator/"><big>Google Sitemap Generator</big></a> Prio By Count Provider</strong></p>
<blockquote><p>$this-&gt;_options["sm_b_pingyahoo"]=<a href="http://postedpost.com/tag/true/">true</a>; //<a href="http://postedpost.com/tag/auto/">Auto</a> ping <a href="http://postedpost.com/tag/yahoo/">YAHOO</a><br />
$this-&gt;_options["sm_b_yahookey"]=&#8217;Q89D23fV34GSeqHjRl8o5i55ojmxrmwJPyMa_195mBnBaK6Vp_NB8y5WjnIoamjikw&#8211;&#8217;; //<a href="http://postedpost.com/tag/yahoo/">YAHOO</a> Application <a href="http://postedpost.com/tag/key/">Key</a>, <a href="http://postedpost.com/tag/default/">default</a> for all</p></blockquote>
<p><a href="http://postedpost.com/tag/default/">Default</a> the <a href="http://postedpost.com/tag/sitemap/">sitemap</a> not ping <a href="http://postedpost.com/tag/yahoo/">Yahoo</a> after generated, because you need a <a href="http://postedpost.com/tag/yahoo/">yahoo</a> <a href="http://postedpost.com/tag/key/">key</a> to ping it, so I put a <a href="http://postedpost.com/tag/key/">key</a> (get free form <a href="http://postedpost.com/tag/yahoo/">yahoo</a>) as <a href="http://postedpost.com/tag/default/">default</a>, I suggest you get one free <a href="http://postedpost.com/tag/key/">key</a> from <a href="http://postedpost.com/tag/yahoo/">yahoo</a> too and put there, of course if you like you may keep my <a href="http://postedpost.com/tag/key/">key</a>, not a big deal.</p>
<h2>Done</h2>
<p>Ok, it&#8217;s half done, all the change on the <a href="http://postedpost.com/tag/plugin/">plugin</a> is finished, if <a href="http://postedpost.com/tag/user/">user</a> active the <a href="http://postedpost.com/tag/plugin/">plugin</a> at them <a href="http://postedpost.com/tag/plugin/">plugin</a> page, a <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a> and a <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>.gz (a zip verison) will be create and placed into the <a href="http://postedpost.com/tag/blog/">blog</a> <a href="http://postedpost.com/tag/folder/">folder</a> and ping the <a href="http://postedpost.com/tag/search-engine/"><strong>search engines</strong></a>.</p>
<p>Everything is perfect except: the <a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a> NOT at root <a href="http://postedpost.com/tag/folder/">folder</a>, so when <a href="http://postedpost.com/tag/search-engine/"><strong>search engine</strong></a> spider come, it can claw nothing except a 404 error. The following is how to fix this:</p>
<h2>Plug You <a href="http://postedpost.com/tag/plugin/">Plugin</a> in to <a href="http://postedpost.com/tag/mu/">mu</a>-<a href="http://postedpost.com/tag/plugin/">plugins</a></h2>
<p>Don&#8217;t laugh, I know it&#8217;s a silly title, just some stupid thing have to do.</p>
<p>We know the <a href="http://postedpost.com/tag/php-file/"><strong>php file</strong></a> in <a href="http://postedpost.com/tag/mu/">mu</a>-<a href="http://postedpost.com/tag/plugin/">plugins</a> <a href="http://postedpost.com/tag/folder/">folder</a> will be load automatically by <a href="http://postedpost.com/tag/wordpress/">WordPress</a>. So I created a postedpost.<a href="http://postedpost.com/tag/php-file/"><strong>php file</strong></a> and write all my little change and hacks inside, like my <a title="Permanent link to Ultimate WP Post Name URL Sanitize Solution" rel="bookmark" href="http://postedpost.com/2008/06/23/ultimate-wordpress-post-name-url-sanitize-solution/">Ultimate WP Post Name URL Sanitize Solution</a>, I suggest you do it to, very easy and convenience. Anyway, the following code should inside <a href="http://postedpost.com/tag/mu/">mu</a>-<a href="http://postedpost.com/tag/plugin/">plugins</a> <a href="http://postedpost.com/tag/folder/">folder</a>.</p>
<h3>Put <a href="http://postedpost.com/tag/sitemap/">sitemap</a> into <a href="http://postedpost.com/tag/robots/">Robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a></h3>
<blockquote><p><a href="http://postedpost.com/tag/function/">Function</a> postedpost_do_robots() {<br />
global $current_blog;<br />
if ( &#8216;0&#8242; != $current_blog-&gt;public ) {<br />
$<a href="http://postedpost.com/tag/siteurl/">siteurl</a> = get_settings(&#8217;<a href="http://postedpost.com/tag/siteurl/">siteurl</a>&#8216;);<br />
if ( class_exists( &#8216;GoogleSitemapGeneratorLoader&#8217; ) ) {<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;<a href="http://postedpost.com/tag/sitemap/">Sitemap</a>: &#8221; . $<a href="http://postedpost.com/tag/siteurl/">siteurl</a> . &#8220;/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>\n&#8221;;<br />
<a href="http://postedpost.com/tag/echo/">echo</a> &#8220;<a href="http://postedpost.com/tag/sitemap/">Sitemap</a>: &#8221; . $<a href="http://postedpost.com/tag/siteurl/">siteurl</a> . &#8220;/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>.gz\n&#8221;;<br />
}<br />
}<br />
}<br />
add_action(&#8217;do_robots&#8217;, &#8216;postedpost_do_robots&#8217;, 20);</p></blockquote>
<p>As the new <a href="http://www.sitemaps.org/" target="_blank">sitemap protocol</a>, you can put <a href="http://postedpost.com/tag/sitemap/">sitemap</a> <a href="http://postedpost.com/tag/location/">location</a> into <a href="http://postedpost.com/tag/robots/">robots</a>.<a href="http://postedpost.com/tag/txt-file/"><strong>txt file</strong></a>, so <a href="http://postedpost.com/tag/search-engine/"><strong>search engine</strong></a> can find your <a href="http://postedpost.com/tag/sitemap/">sitemap</a> without you told them, <a href="http://postedpost.com/tag/e/">e</a>.g. Google Webmaster Tool.</p>
<h3><a href="http://postedpost.com/tag/rewrite-rules/"><strong>Rewrite Rules</strong></a></h3>
<blockquote><p><a href="http://postedpost.com/tag/function/">Function</a> postedpost_rewrite_rules_array($<a href="http://postedpost.com/tag/rules/">rules</a>){<br />
$newrules = array();<br />
$newrules['<a href="http://postedpost.com/tag/sitemap/">sitemap</a>\.(<a href="http://postedpost.com/tag/xml/">xml</a>|<a href="http://postedpost.com/tag/xml/">xml</a>\.gz)$'] = &#8216;index.<a href="http://postedpost.com/tag/php/">php</a>?is_page_redirect=1&amp;redirect_method=<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&amp;redirect_url=$matches[1]&#8216;;<br />
return $newrules+$<a href="http://postedpost.com/tag/rules/">rules</a>;<br />
}<br />
add_filter(&#8217;rewrite_rules_array&#8217;, &#8216;postedpost_rewrite_rules_array&#8217;);</p>
<p><a href="http://postedpost.com/tag/function/">Function</a> postedpost_parse_query($<a href="http://postedpost.com/tag/query/">query</a>){<br />
global $blog_id;;<br />
$<a href="http://postedpost.com/tag/siteurl/">siteurl</a> = get_settings(&#8217;<a href="http://postedpost.com/tag/siteurl/">siteurl</a>&#8216;);<br />
$uri = parse_url($<a href="http://postedpost.com/tag/siteurl/">siteurl</a>);<br />
if(!empty($<a href="http://postedpost.com/tag/query/">query</a>-&gt;query_vars['is_page_redirect'])){<br />
$redirect_method = $<a href="http://postedpost.com/tag/query/">query</a>-&gt;query_vars['redirect_method'];<br />
if ( $redirect_method == &#8216;<a href="http://postedpost.com/tag/sitemap/">sitemap</a>&#8216; ) {<br />
$redirect_url = $<a href="http://postedpost.com/tag/siteurl/">siteurl</a> . &#8216;/wp-content/<a href="http://postedpost.com/tag/blog/">blogs</a>.dir/&#8217; . $blog_id . &#8216;/<a href="http://postedpost.com/tag/file/">files</a>/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.&#8217; . $redirect_url;<br />
} <a href="http://postedpost.com/tag/else/">else</a> {<br />
$redirect_url = get_settings(&#8217;<a href="http://postedpost.com/tag/siteurl/">siteurl</a>&#8216;);<br />
Header(&#8217;HTTP/1.1 301 Moved Permanently&#8217;);<br />
Header(&#8217;<a href="http://postedpost.com/tag/location/">Location</a>: &#8216; . get_settings(&#8217;<a href="http://postedpost.com/tag/siteurl/">siteurl</a>&#8216;));<br />
exit();<br />
}<br />
Header(&#8217;HTTP/1.1 302 Moved Temporarily&#8217;);<br />
Header(&#8217;<a href="http://postedpost.com/tag/location/">Location</a>: &#8216; . $redirect_url);<br />
exit();<br />
}<br />
}<br />
add_action(&#8217;parse_query&#8217;, &#8216;postedpost_parse_query&#8217;);</p>
<p><a href="http://postedpost.com/tag/function/">Function</a> postedpost_init() {<br />
global $wp_rewrite;<br />
// postedpost_flush_rewrite_rules<br />
$wp_rewrite-&gt;flush_rules();<br />
add_rewrite_tag(&#8217;%comment_id%&#8217;, &#8216;(([0-9]{1,})&#8217;);</p>
<p>}<br />
add_action(&#8217;init&#8217;, &#8216;postedpost_init&#8217;);</p></blockquote>
<p>These code all about <a href="http://postedpost.com/tag/rewrite-rules/"><strong>rewrite rules</strong></a>, when <a href="http://postedpost.com/tag/search-engine/"><strong>search engine</strong></a> or visitor visit /<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>, it will be 302 <a href="http://postedpost.com/tag/redirect/">redirect</a> to /wp-content/<a href="http://postedpost.com/tag/blog/">blogs</a>.dir/[blog_id]/<a href="http://postedpost.com/tag/file/">files</a>/<a href="http://postedpost.com/tag/sitemap/">sitemap</a>.<a href="http://postedpost.com/tag/xml/">xml</a>. Btw, in my own code, I have many other <a href="http://postedpost.com/tag/rewrite-rules/"><strong>rewrite rules</strong></a> and process code in these <a href="http://postedpost.com/tag/function/">functions</a>, that also why I say put all hacks in one <a href="http://postedpost.com/tag/php-file/"><strong>php file</strong></a>, for make easier on process common task and improve <a href="http://dodomarketing.blogtells.com/2008/09/23/from-profit-to-performance-marketing-logistics-continue/" target="_blank">performance</a>.</p>
<h3>OK, Done</h3>
<p>This time all done. Here is the list of all files I talked above, you may check it.</p>
<ul>
<li><a title=" sitemap-core.php" rel="bookmark" href="http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-core-php/">WordPress mu Sitemap Files: sitemap-core.php</a></li>
<li><a title=" sitemap-ui.php" rel="bookmark" href="http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-sitemap-ui-php/">WordPress mu Sitemap Files: sitemap-ui.php</a></li>
<li><a title=" postedpost.php" rel="bookmark" href="http://postedpost.com/2008/10/13/wordpress-mu-sitemap-files-postedpost-php/">WordPress mu Sitemap Files: postedpost.php</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/10/12/wordpress-mu-google-xml-sitemap/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<dc:id>39</dc:id>	</item>
		<item>
		<title>Ultimate WP Post Name URL Sanitize Solution</title>
		<link>http://postedpost.com/2008/06/23/ultimate-wordpress-post-name-url-sanitize-solution/</link>
		<comments>http://postedpost.com/2008/06/23/ultimate-wordpress-post-name-url-sanitize-solution/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 02:16:43 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=10</guid>
		<description><![CDATA[Few days ago, I was not satisfied with the ugly URL of some post, so I hacked “sanitize_title” function. After I said that time, I also not satisfied with super-long URL and want short them. After short WP category permalink structure today, I put more hacked code in sanitize_title function for short URL. Anyhow, shit [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago, I was not satisfied with the ugly <a href="http://postedpost.com/tag/url/">URL</a> of some <a href="http://postedpost.com/tag/post/">post</a>, so I <a href="http://postedpost.com/2008/06/22/hack-wordpress-sanitize-title-function/">hacked “sanitize_title” function</a>. After I said that time, I also not satisfied with super-long <a href="http://postedpost.com/tag/url/">URL</a> and want short them. After <a href="http://postedpost.com/2008/06/22/single-category-permalink-structure/">short WP category permalink structure</a> today, I put more hacked code in sanitize_title <a href="http://postedpost.com/tag/function/">function</a> for short <a href="http://postedpost.com/tag/url/">URL</a>. Anyhow, shit happens and I noticed sanitize_title <a href="http://postedpost.com/tag/function/">function</a> also used almost everywhere, special when normal visitor visit and process the <a href="http://postedpost.com/tag/url/">URL</a>. I don&#8217;t want to explain how this mess up, just forget it.</p>
<p>So, I need new method of short and nice <a href="http://postedpost.com/tag/url/">URL</a> for article <a href="http://postedpost.com/tag/post/">post</a>. I need find a place for &#8220;<strong>apply_filters</strong>&#8221; or &#8220;<strong>do_action</strong>&#8220;, after quite long time track from /wp-admin/<a href="http://postedpost.com/tag/post/">post</a>.php, finally I found at <strong>sanitize_post_field</strong> <a href="http://postedpost.com/tag/function/">function</a>, <strong>$value = apply_filters(&#8221;pre_$field&#8221;, $value);</strong> to pretreat all submit data.</p>
<p><strong>Here is my filter:</strong><span id="more-10"></span></p>
<p><a href="http://postedpost.com/tag/function/">function</a> postedpost_sanitize_post_name( $post_name ){<br />
if ( empty($post_name) || ( $post_name == &#8221;) ) {<br />
<strong>//most of time, new submit article do not have post_name, so get data from post_title</strong><br />
if ( isset( $_POST['post_title'] ) )<br />
$post_name = $_POST['post_title'];<br />
else<br />
$post_name = &#8221;;<br />
}<br />
$post_name = strip_tags($post_name); // remove tags&#8230;<br />
$post_name = preg_replace(&#8221;/[^a-z0-9]+/i&#8221;, &#8221; &#8220;, strtolower($post_name)); //remove all non-English code<br />
$post_name = trim(preg_replace(&#8221;/\s+/i&#8221;, &#8221; &#8220;, $post_name));<br />
if (strlen($post_name) &gt; 65) { // if length too long<br />
$post_name = preg_replace(&#8221;/ [a-z0-9]{1,2} | \d+ | about | after | all | also | and | another | any | are | because | been | before | being | between | both | but | came | can | come | could | did | each | for | from | get | got | has | had | have | her | here | him | himself | his | how | into | like | make | many | might | more | most | much | must | never | now | only | other | our | out | over | said | same | see | should | since | some | still | such | take | than | that | the | their | them | then | there | these | they | this | those | through | too | under | very | was | way | well | were | what | where | when | which | while | who | with | would | you | your /i&#8221;, &#8221; &#8220;, $post_name); //first try remove some common words, for SEO <img src='http://postedpost.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
$post_name = trim(preg_replace(&#8221;/ {2,}/i&#8221;, &#8221; &#8220;, $post_name));<br />
if (strlen($post_name) &gt; 65) { //if still long<br />
$post_name = substr($post_name, 0, 65);<br />
$post_name = substr($post_name, 0, strrpos($post_name, &#8221; &#8220;));<br />
}<br />
}<br />
return $post_name;<br />
}<br />
add_filter(&#8217;pre_post_name&#8217;, &#8216;postedpost_sanitize_post_name&#8217;);</p>
<p>&#8212;</p>
<p><strong>That&#8217;s all, works well. Btw, for English <a href="http://postedpost.com/tag/title/">title</a> only.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/06/23/ultimate-wordpress-post-name-url-sanitize-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>10</dc:id>	</item>
		<item>
		<title>Single &quot;Category Permalink Structure&quot;</title>
		<link>http://postedpost.com/2008/06/22/single-category-permalink-structure/</link>
		<comments>http://postedpost.com/2008/06/22/single-category-permalink-structure/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 21:21:46 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=8</guid>
		<description><![CDATA[What is SINGLE &#8220;Category Permalink Structure&#8221;?
Here is an example:
One of my blog category URL looks like this before:
http://fashion.postedpost.com/category/fashion-house/accessories/ties/
After single it, it will look like:
http://fashion.postedpost.com/category/ties/
Why we need shorter category permalink?

Shorter is better, you know, size is always an issue.
Change categories structure anytime without change urls
Avoid duplicate content issue, because both of URLs are display a same [...]]]></description>
			<content:encoded><![CDATA[<h3>What is SINGLE &#8220;<a href="http://postedpost.com/tag/category/">Category</a> Permalink Structure&#8221;?</h3>
<p><strong>Here is an example:</strong></p>
<p>One of my blog category URL looks like this before:<br />
http://<a href="http://fashion.postedpost.com/" target="_blank">fashion</a>.postedpost.com/<a href="http://postedpost.com/tag/category/">category</a>/fashion-house/accessories/ties/</p>
<p>After single it, it will look like:<br />
<a href="http://fashion.postedpost.com/category/ties/">http://fashion.postedpost.com/category/ties/</a></p>
<h3>Why we need shorter <a href="http://postedpost.com/tag/category/">category</a> permalink?</h3>
<ol>
<li>Shorter is better, you know, size is always an issue.</li>
<li>Change categories structure anytime without change urls</li>
<li>Avoid duplicate content issue, because both of URLs are display a same webpage.</li>
</ol>
<h3><strong>How to do it.</strong></h3>
<p>Find <a href="http://postedpost.com/tag/category/">category</a>-<a href="http://web2.blogtells.com/category/templates/">template</a>.php in WordPress <strong>wp-includes</strong> folder, find this function: <strong>function get_category_link($category_id)</strong></p>
<p><strong>Comment the following lines:</strong></p>
<p>//if ( $parent = $<a href="http://postedpost.com/tag/category/">category</a>-&gt;parent )<br />
// $category_nicename = get_category_parents($parent, false, &#8216;/&#8217;, true) . $category_nicename;</p>
<p>(or get a plugin if you like)</p>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/06/22/single-category-permalink-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<dc:id>8</dc:id>	</item>
		<item>
		<title>Hack WordPress &quot;sanitize_title&quot; Function</title>
		<link>http://postedpost.com/2008/06/22/hack-wordpress-sanitize-title-function/</link>
		<comments>http://postedpost.com/2008/06/22/hack-wordpress-sanitize-title-function/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 02:48:10 +0000</pubDate>
		<dc:creator>warren.rior</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://famulus.wordpress.com/?p=6</guid>
		<description><![CDATA[I use English as title only, recently I noticed some of my blog post has &#8220;%&#8221; in url (e.g.) or too too many dashes &#8220;&#8212;&#8221; in url (e.g.). !!!!! (2008/6/23 .. forget this method, check Ultimate WP Post Name URL Sanitize Solution)
So unacceptable. So I check the wordpress code and update the following:
function sanitize_title($title, $fallback_title [...]]]></description>
			<content:encoded><![CDATA[<p>I use English as <a href="http://postedpost.com/tag/title/">title</a> only, recently I noticed some of my blog post has &#8220;%&#8221; in url (<a href="http://business.blogtells.com/2008/02/09/become-the-customers%e2%80%99-trusted-companion/">e.g.</a>) or too too many dashes &#8220;&#8212;&#8221; in url (<a href="http://business.blogtells.com/2008/05/06/how-to-select-the-right-business-%e2%80%94-follow-your-instinct-but-proceed-with-caution/">e.g.</a>). <strong>!!!!! (2008/6/23 .. forget this method, check <a href="http://postedpost.com/2008/06/23/ultimate-wordpress-post-name-url-sanitize-solution/">Ultimate WP Post Name URL Sanitize Solution</a>)</strong></p>
<p>So unacceptable. So I check the wordpress code and update the following:</p>
<p>function sanitize_title($<a href="http://postedpost.com/tag/title/">title</a>, $fallback_title = &#8221;) {<br />
$<a href="http://postedpost.com/tag/title/">title</a> = strip_tags($<a href="http://postedpost.com/tag/title/">title</a>);<br />
$<a href="http://postedpost.com/tag/title/">title</a> = preg_replace(&#8217;/&amp;.+?;/&#8217;, &#8221;, $<a href="http://postedpost.com/tag/title/">title</a>); // Kill entities<br />
$<a href="http://postedpost.com/tag/title/">title</a> = preg_replace(&#8221;/[^a-z0-9]+/i&#8221;, &#8221; &#8220;, strtolower($<a href="http://postedpost.com/tag/title/">title</a>)); // Remove all non-english and non-number code<br />
$<a href="http://postedpost.com/tag/title/">title</a> = trim(preg_replace(&#8221;/ {2,}/i&#8221;, &#8221; &#8220;, $<a href="http://postedpost.com/tag/title/">title</a>)); // Remove extra space<br />
$<a href="http://postedpost.com/tag/title/">title</a> = apply_filters(&#8217;sanitize_title&#8217;, $<a href="http://postedpost.com/tag/title/">title</a>);<br />
if (empty($<a href="http://postedpost.com/tag/title/">title</a>)) {<br />
$<a href="http://postedpost.com/tag/title/">title</a> = $fallback_title;<br />
}<br />
return $<a href="http://postedpost.com/tag/title/">title</a>;<br />
}</p>
<p><strong>at &#8220;formatting.php&#8221;.</strong></p>
<p>Next thing: I serious think about shorter very long url (the post_name is varchar(200) in <a href="http://web2.blogtells.com/2008/06/13/keeping-multiple-database-applications-in-sync-with-replication/" target="_blank">database</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://postedpost.com/2008/06/22/hack-wordpress-sanitize-title-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<dc:id>7</dc:id>	</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.787 seconds -->
