Exemple #1
0
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache');
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
</script>
<style type="text/css">
/* Taken from http://sw-guide.de/wordpress/plugins/simple-trackback-validation/ */
.wrap h3 { color: black; background-color: #e5f3ff; padding: 4px 8px; }
</style>
<?php 
    echo '<div class="wrap">';
    echo "<h2>WP Super Cache Manager</h2>\n";
    if (ini_get('safe_mode')) {
        ?>
<h3>Warning! PHP safe mode enabled!</h3>
		<p>You may experience problems running this plugin because SAFE MODE is enabled. <?php 
        if (!ini_get('safe_mode_gid')) {
            ?>
Your server is set up to check the owner of PHP scripts before allowing them to read and write files.</p><p>You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the <?php 
            echo WP_CONTENT_DIR;
            ?>
/cache/ directory must also be changed. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details.</p><?php 
        } else {
            ?>
You or an administrator must disable this. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.</p><?php 
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo "<br>Cannot continue... fix previous problems and retry.<br />";
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'>Mod rewrite may not be installed!</h4>
		<p>It appears that mod_rewrite is not installed. Sometimes this check isn't 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use WP-Cache.</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'>Read Only Mode. Configuration cannot be changed. <a href="javascript:toggleLayer('readonlywarning');" title="Why your configuration may not be changed">Why</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p>The WP Super Cache configuration file is <code><?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code> and cannot be modified. The file <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php must be writeable by the webserver to make any changes.<br />
		A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it's globally writeable and it should be fine.<br />
		Writeable: <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code><br />
		Readonly: <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'>Warning! <?php 
            echo WP_CONTENT_DIR;
            ?>
 is writeable!</h4>
			<p>You should change the permissions on <?php 
            echo WP_CONTENT_DIR;
            ?>
 and make it more restrictive. Use your ftp client, or the following command to fix things:<br /><code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
        }
        if (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
    }
    ?>
<fieldset class="options"> 
	<h3>WP Super Cache Status</h3><?php 
    echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong>ON</strong> (WP Cache and Super Cache enabled)</label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>HALF ON</strong> (Super Cache Disabled, only legacy WP-Cache caching.)</label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>OFF</strong> (WP Cache and Super Cache disabled)</label><br />
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
	<p>Note: if uninstalling this plugin, make sure the directory <em><?php 
    echo WP_CONTENT_DIR;
    ?>
</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)</p>
	<?php 
    echo "<div><input type='submit' " . SUBMITDISABLED . " value='Update Status &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	</fieldset>
	<?php 
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<br /><a name="files"></a><fieldset class="options"><h3>Accepted filenames, rejected URIs</h3>';
    wp_cache_edit_rejected();
    echo "<br />\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_files();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>Cache Plugins</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
Exemple #2
0
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation, $wp_cache_not_logged_in, $wp_supercache_cache_list;
    global $wp_super_cache_front_page_check;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2><a href='?page=wpsupercache'>" . __('WP Super Cache Manager', 'wp-super-cache') . "</a></h2>\n";
    if (1 == ini_get('safe_mode') || "on" == strtolower(ini_get('safe_mode'))) {
        ?>
<h3><?php 
        _e('Warning! PHP Safe Mode Enabled!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache');
        if (!ini_get('safe_mode_gid')) {
            echo __('Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache') . "</p><p>";
            echo sprintf(__('You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache'), WP_CONTENT_DIR) . "</p>";
        } else {
            echo __('You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache') . "</p>";
        }
    }
    if (isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>' . __('Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.', 'wp-super-cache') . '</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo '<p>' . __("Cannot continue... fix previous problems and retry.", 'wp-super-cache') . '</p>';
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3><?php 
                printf(__('Warning! Your hostname "%s" resolves to %s', 'wp-super-cache'), $hostname, $ip);
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p><?php 
                printf(__('Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache'), $ip);
                ?>
</p>
			<p><?php 
                printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                ?>
</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p><?php 
                    _e('Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache');
                    ?>
</p>
				<p><?php 
                    printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                    ?>
</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Mod rewrite may not be installed!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use half-on mode.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'><?php 
        _e('Read Only Mode. Configuration cannot be changed.', 'wp-super-cache');
        ?>
 <a href="javascript:toggleLayer('readonlywarning');" title="<?php 
        _e('Why your configuration may not be changed', 'wp-super-cache');
        ?>
"><?php 
        _e('Why', 'wp-super-cache');
        ?>
</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p><?php 
        printf(__('The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the webserver to make any changes.', 'wp-super-cache'), WP_CONTENT_DIR);
        ?>
		<?php 
        _e('A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache');
        ?>
</p>
		<?php 
        _e('Writeable:', 'wp-super-cache');
        ?>
 <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		<?php 
        _e('Readonly:', 'wp-super-cache');
        ?>
 <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'><?php 
            printf(__('Warning! %s is writeable!', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</h4>
			<p><?php 
            printf(__('You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                if (!isset($wp_cache_mobile_whitelist)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_whitelist', "\$wp_cache_mobile_whitelist = 'Stand Alone/QNws';", $wp_cache_config_file);
                }
                if (false == isset($wp_cache_mobile_browsers)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers', "\$wp_cache_mobile_browsers = 'Android, 2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP';", $wp_cache_config_file);
                }
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            $wp_supercache_cache_list = $_POST['wp_supercache_cache_list'] == 1 ? 1 : 0;
            wp_cache_replace_line('^ *\\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            if (defined('WPSC_DISABLE_LOCKING')) {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_not_logged_in'])) {
                if ($wp_cache_not_logged_in == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_not_logged_in = 1;
            } else {
                $wp_cache_not_logged_in = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_not_logged_in', "\$wp_cache_not_logged_in = " . $wp_cache_not_logged_in . ";", $wp_cache_config_file);
        }
        if (defined('WPSC_DISABLE_COMPRESSION')) {
            $cache_compression_changed = false;
            $cache_compression = 0;
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
        } elseif (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    echo '<a name="top"></a>';
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3><?php 
    _e('WP Super Cache Status', 'wp-super-cache');
    ?>
</h3><?php 
    echo '<form name="wp_manager" action="#top" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache enabled', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('HALF ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('Super Cache Disabled, only legacy WP-Cache caching.', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('OFF', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache disabled', 'wp-super-cache');
    ?>
</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_not_logged_in' <?php 
    if ($wp_cache_not_logged_in) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Don&#8217;t cache pages for logged in users.', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Proudly tell the world your server is Digg proof! (places a message in your blog&#8217;s footer)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.', 'wp-super-cache');
    ?>
</label></p>
	<?php 
    if (false == defined('WPSC_DISABLE_LOCKING')) {
        ?>
		<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
        if (!$wp_cache_mutex_disabled) {
            echo "checked";
        }
        ?>
 value='0'> <?php 
        _e('Coarse file locking. You probably don&#8217;t need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em>', 'wp-super-cache');
        ?>
</label></p>
	<?php 
    }
    ?>
	<p><label><input type='checkbox' name='wp_supercache_cache_list' <?php 
    if ($wp_supercache_cache_list) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('List the newest cached pages (may be expensive to run on busy sites, use with caution.)', 'wp-super-cache');
    ?>
</label>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Mobile device support.', 'wp-super-cache');
    ?>
</label>
	<?php 
    $home_path = trailingslashit(get_home_path());
    $scrules = implode("\n", extract_from_markers($home_path . '.htaccess', 'WPSuperCache'));
    if (!$wp_cache_mobile_enabled && strpos($scrules, '240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo')) {
        echo "<blockquote style='background-color:#feefb3; padding: 5px; margin: 5px;'><h4>" . __('Mobile rewrite rules detected', 'wp-super-cache') . "</h4>";
        echo "<p>" . __('For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "Android|2.0\\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone" and delete those.', 'wp-super-cache') . "</p><p>" . __('This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache') . "</p></blockquote>";
    } elseif ($wp_cache_mobile_enabled && $scrules != '' && false === strpos($scrules, '240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo')) {
        ?>
	<blockquote style='background-color:#fefeb3; padding: 5px; margin: 5px;'><p><?php 
        _e('Mobile support requires extra rules in your .htaccess file, or you can set the plugin to half-on mode. Here are your options (in order of difficulty):', 'wp-super-cache');
        ?>
	<ol><li> 1. <?php 
        _e('Set the plugin to half on mode and enable mobile support.', 'wp-super-cache');
        ?>
</li>
	<li> 2. <?php 
        printf(__('Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache'), $home_path);
        ?>
</li>
	<li> 3. <?php 
        printf(__('Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$</code> add this line: (do it twice, once for each section)', 'wp-super-cache'), $home_path);
        ?>
</p>
	<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre>RewriteCond %{HTTP_user_agent} !^.*(Android|2.0\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|hiptop|IEMobile|iPhone|iPod|KYOCERA/WX310K|LG/U990|MIDP-2.0|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|Playstation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|Windows\ CE|WinWAP).*</pre></div></li></ol></blockquote>
	<?php 
    }
    ?>
	<p><strong><?php 
    _e('Note:', 'wp-super-cache');
    ?>
</strong> <?php 
    printf(__('If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)', 'wp-super-cache'), WP_CONTENT_DIR);
    ?>
</p>
	<p><?php 
    printf(__('Uninstall using the <a href="%1$s/wp-super-cache/uninstall.php">uninstall script</a> to remove files and directories created by the plugin. (Please see <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script.)', 'wp-super-cache'), WP_PLUGIN_URL);
    ?>
</p>
	<?php 
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => __('Required to serve compressed supercache files properly.', 'wp-super-cache'), 'mod_headers' => __('Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache'), 'mod_expires' => __('Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache'));
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (isset($missing_mods) && is_array($missing_mods)) {
            echo "<h3>" . __('Missing Apache Modules', 'wp-super-cache') . "</h3>";
            echo "<p>" . __('The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache') . "</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'><?php 
    _e('Make WordPress Faster', 'wp-super-cache');
    ?>
</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><?php 
        printf(__('%1$s really makes your blog go faster. Make it go faster<sup>*</sup> by buying me an <a href="%2$s">Amazon gift card</a>! Make it out to "%3$s" for whatever amount you want. Every penny helps!', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a>', 'http://ocaoimh.ie/agc', '*****@*****.**');
        ?>
;</p>
	<p><?php 
        printf(__('If Amazon isn&#8217;t your thing, there&#8217;s also PayPal. Click the "Donate" button below or take a quick peek at my <a href="%s">wishlist</a>.', 'wp-super-cache'), 'http://ocaoimh.ie/wish');
        ?>
</p>
	<p><?php 
        _e('Thanks in advance!', 'wp-super-cache');
        ?>
<br />Donncha<br />
	<small>* <?php 
        _e('Ok, it won&#8217;t go any faster but you&#8217;ll make this plugin author very happy!', 'wp-super-cache');
        ?>
</small></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p><?php 
        _e('Don&#8217;t show me this again.', 'wp-super-cache');
        ?>
 <form action="#top" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='<?php 
        _e('Hide', 'wp-super-cache');
        ?>
' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><?php 
        printf(__('%1$s is maintained and developed by %2$s with contributions from many others.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a>', '<a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a>');
        ?>
</p>
	<p><?php 
        printf(__('He blogs at %1$s, posts photos at %2$s and <a href="%3$s">wishes</a> he had more time to read and relax.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>', '<a href="http://inphotos.org/?r=supercache">In Photos.org</a>', 'http://ocaoimh.ie/gad');
        ?>
</p>
	<p><?php 
        printf(__('Please say hi to him on %s too!', 'wp-super-cache'), '<a href="http://twitter.com/donncha/">Twitter</a>');
        ?>
</p>
	<?php 
    }
    if (isset($wp_supercache_cache_list) && $wp_supercache_cache_list) {
        $start_date = get_option('wpsupercache_start');
        if (!$start_date) {
            $start_date = time();
        }
        ?>
		<p><?php 
        printf(__('Cached pages since %1$s : <strong>%2$s</strong>', 'wp-super-cache'), date('M j, Y', $start_date), number_format(get_option('wpsupercache_count')));
        ?>
</p>
		<p><?php 
        _e('Newest Cached Pages:', 'wp-super-cache');
        ?>
<ol>
		<?php 
        foreach (array_reverse((array) get_option('supercache_last_cached')) as $url) {
            $since = time() - strtotime($url['date']);
            echo "<li><a title='" . sprintf(__('Cached %s seconds ago', 'wp-super-cache'), $since) . "' href='" . site_url($url['url']) . "'>{$url['url']}</a></li>\n";
        }
        ?>
</ol>
		<small><?php 
        _e('(may not always be accurate on busy sites)', 'wp-super-cache');
        ?>
</small>
		</p><?php 
    } else {
        $start_date = get_option('wpsupercache_start');
        if ($start_date) {
            update_option('wpsupercache_start', $start_date);
            update_option('wpsupercache_count', 0);
        }
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>' . __('Accepted Filenames &amp; Rejected URIs', 'wp-super-cache') . '</h3>';
    wp_cache_edit_rejected_pages();
    echo "\n";
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_debug_settings();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>' . __('Cache Plugins', 'wp-super-cache') . '</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
Exemple #3
0
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $wp_supercache_cache_list, $cache_page_secret, $cache_home_path;
    global $wp_super_cache_front_page_check, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
    global $wpmu_version, $cache_max_time, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks;
    if (!wpsupercache_site_admin()) {
        return false;
    }
    // used by mod_rewrite rules and config file
    if (function_exists("cfmobi_default_browsers")) {
        $wp_cache_mobile_browsers = cfmobi_default_browsers("mobile");
        $wp_cache_mobile_browsers = array_merge($wp_cache_mobile_browsers, cfmobi_default_browsers("touch"));
    } elseif (function_exists('lite_detection_ua_contains')) {
        $wp_cache_mobile_browsers = explode('|', lite_detection_ua_contains());
    } else {
        $wp_cache_mobile_browsers = array('2.0 MMP', '240x320', '400X240', 'AvantGo', 'BlackBerry', 'Blazer', 'Cellphone', 'Danger', 'DoCoMo', 'Elaine/3.0', 'EudoraWeb', 'Googlebot-Mobile', 'hiptop', 'IEMobile', 'KYOCERA/WX310K', 'LG/U990', 'MIDP-2.', 'MMEF20', 'MOT-V', 'NetFront', 'Newt', 'Nintendo Wii', 'Nitro', 'Nokia', 'Opera Mini', 'Palm', 'PlayStation Portable', 'portalmmm', 'Proxinet', 'ProxiNet', 'SHARP-TQ-GX10', 'SHG-i900', 'Small', 'SonyEricsson', 'Symbian OS', 'SymbianOS', 'TS21i-10', 'UP.Browser', 'UP.Link', 'webOS', 'Windows CE', 'WinWAP', 'YahooSeeker/M1A1-R2D2', 'iPhone', 'iPod', 'Android', 'BlackBerry9530', 'LG-TU915 Obigo', 'LGE VX', 'webOS', 'Nokia5800');
    }
    if (function_exists("lite_detection_ua_prefixes")) {
        $wp_cache_mobile_prefixes = lite_detection_ua_prefixes();
    } else {
        $wp_cache_mobile_prefixes = array('w3c ', 'w3c-', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'htc_', 'inno', 'ipaq', 'ipod', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'lg/u', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda ', 'xda-');
        // from http://svn.wp-plugins.org/wordpress-mobile-pack/trunk/plugins/wpmp_switcher/lite_detection.php
    }
    $wp_cache_mobile_browsers = apply_filters('cached_mobile_browsers', $wp_cache_mobile_browsers);
    // Allow mobile plugins access to modify the mobile UA list
    $wp_cache_mobile_prefixes = apply_filters('cached_mobile_prefixes', $wp_cache_mobile_prefixes);
    // Allow mobile plugins access to modify the mobile UA prefix list
    $mobile_groups = apply_filters('cached_mobile_groups', array());
    // Group mobile user agents by capabilities. Lump them all together by default
    // mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
    if (false == apply_filters('wp_super_cache_error_checking', true)) {
        return false;
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>

<style type='text/css'>
#nav h2 {
	border-bottom: 1px solid #ccc;
	padding-bottom: 0;
}
</style>
<?php 
    echo '<a name="top"></a>';
    echo '<div class="wrap">';
    echo '<h2>' . __('WP Super Cache Settings', 'wp-super-cache') . '</h2>';
    // set a default
    if ($cache_enabled == false && isset($wp_cache_mod_rewrite) == false) {
        $wp_cache_mod_rewrite = 0;
    } elseif (!isset($wp_cache_mod_rewrite) && $cache_enabled && $super_cache_enabled) {
        $wp_cache_mod_rewrite = 1;
    }
    if (!isset($_GET['tab']) && $cache_enabled && ($wp_cache_mod_rewrite || $super_cache_enabled == false)) {
        $_GET['tab'] = 'settings';
        echo '<div id="message" class="updated fade"><p>' . __('Notice: <em>Mod_rewrite or Legacy caching enabled</em>. Showing Advanced Settings Page by default.', 'wp-super-cache') . '</p></div>';
    }
    wpsc_admin_tabs();
    if (isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>' . __('Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.', 'wp-super-cache') . '</strong>';
    }
    if (substr(get_option('permalink_structure'), -1) == '/') {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 1;", $wp_cache_config_file);
    } else {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 0;", $wp_cache_config_file);
    }
    $home_path = parse_url(site_url());
    $home_path = trailingslashit($home_path['path']);
    if ("{$home_path}" != "{$wp_cache_home_path}") {
        wp_cache_replace_line('^ *\\$wp_cache_home_path', "\$wp_cache_home_path = '{$home_path}';", $wp_cache_config_file);
    }
    if ($wp_cache_mobile_enabled == 1) {
        update_cached_mobile_ua_list($wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $mobile_groups);
    }
    ?>
 <table><td valign='top'><?php 
    switch ($_GET['tab']) {
        case "cdn":
            scossdl_off_options();
            break;
        case "tester":
        case "contents":
            echo '<a name="test"></a>';
            wp_cache_files();
            break;
        case "preload":
            if (!$cache_enabled) {
                wp_die(__('Caching must be enabled to use this feature', 'wp-super-cache'));
            }
            echo '<a name="preload"></a>';
            if ($super_cache_enabled == true && false == defined('DISABLESUPERCACHEPRELOADING')) {
                global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
                $count = $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
                if ($count > 1000) {
                    $min_refresh_interval = 720;
                } else {
                    $min_refresh_interval = 30;
                }
                if (array_key_exists('action', $_POST) && $_POST['action'] == 'preload' && $valid_nonce) {
                    if ($_POST['posts_to_cache'] == 'all') {
                        $wp_cache_preload_posts = 'all';
                    } else {
                        $wp_cache_preload_posts = (int) $_POST['posts_to_cache'];
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_posts', "\$wp_cache_preload_posts = '{$wp_cache_preload_posts}';", $wp_cache_config_file);
                    if (isset($_POST['preload']) && $_POST['preload'] == __('Cancel Cache Preload', 'wp-super-cache')) {
                        $next_preload = wp_next_scheduled('wp_cache_preload_hook');
                        if ($next_preload) {
                            update_option('preload_cache_counter', array('c' => 0, 't' => time()));
                            wp_unschedule_event($next_preload, 'wp_cache_preload_hook');
                        }
                        $fp = @fopen($cache_path . "stop_preload.txt", 'w');
                        @fclose($fp);
                        echo "<p><strong>" . __('Scheduled preloading of cache almost cancelled. It may take up to a minute for it to cancel completely.', 'wp-super-cache') . "</strong></p>";
                    } elseif (isset($_POST['custom_preload_interval']) && ($_POST['custom_preload_interval'] == 0 || $_POST['custom_preload_interval'] >= $min_refresh_interval)) {
                        // if preload interval changes than unschedule any preload jobs and schedule any new one.
                        $_POST['custom_preload_interval'] = (int) $_POST['custom_preload_interval'];
                        if ($wp_cache_preload_interval != $_POST['custom_preload_interval']) {
                            $next_preload = wp_next_scheduled('wp_cache_full_preload_hook');
                            if ($next_preload) {
                                update_option('preload_cache_counter', array('c' => 0, 't' => time()));
                                add_option('preload_cache_stop', 1);
                                wp_unschedule_event($next_preload, 'wp_cache_full_preload_hook');
                                if ($wp_cache_preload_interval == 0) {
                                    echo "<p><strong>" . __('Scheduled preloading of cache cancelled.', 'wp-super-cache') . "</strong></p>";
                                }
                            }
                            if ($_POST['custom_preload_interval'] != 0) {
                                wp_schedule_single_event(time() + $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                            }
                        }
                        $wp_cache_preload_interval = (int) $_POST['custom_preload_interval'];
                        wp_cache_replace_line('^ *\\$wp_cache_preload_interval', "\$wp_cache_preload_interval = {$wp_cache_preload_interval};", $wp_cache_config_file);
                        if (isset($_POST['preload_email_me'])) {
                            $wp_cache_preload_email_me = 1;
                        } else {
                            $wp_cache_preload_email_me = 0;
                        }
                        wp_cache_replace_line('^ *\\$wp_cache_preload_email_me', "\$wp_cache_preload_email_me = {$wp_cache_preload_email_me};", $wp_cache_config_file);
                        if (isset($_POST['wp_cache_preload_email_volume']) && in_array($_POST['wp_cache_preload_email_volume'], array('less', 'medium', 'many'))) {
                            $wp_cache_preload_email_volume = $_POST['wp_cache_preload_email_volume'];
                        } else {
                            $wp_cache_preload_email_volume = 'medium';
                        }
                        wp_cache_replace_line('^ *\\$wp_cache_preload_email_volume', "\$wp_cache_preload_email_volume = '{$wp_cache_preload_email_volume}';", $wp_cache_config_file);
                        if (isset($_POST['preload_on'])) {
                            $wp_cache_preload_on = 1;
                        } else {
                            $wp_cache_preload_on = 0;
                        }
                        wp_cache_replace_line('^ *\\$wp_cache_preload_on', "\$wp_cache_preload_on = {$wp_cache_preload_on};", $wp_cache_config_file);
                        if (isset($_POST['preload']) && $_POST['preload'] == __('Preload Cache Now', 'wp-super-cache')) {
                            @unlink($cache_path . "preload_mutex.tmp");
                            update_option('preload_cache_counter', array('c' => 0, 't' => time()));
                            wp_schedule_single_event(time() + 10, 'wp_cache_preload_hook');
                            echo "<p><strong>" . __('Scheduled preloading of cache in 10 seconds.') . "</strong></p>";
                        } elseif ((int) $_POST['custom_preload_interval']) {
                            @unlink($cache_path . "preload_mutex.tmp");
                            update_option('preload_cache_counter', array('c' => 0, 't' => time()));
                            wp_schedule_single_event(time() + (int) $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                            echo "<p><strong>" . sprintf(__('Scheduled preloading of cache in %d minutes', 'wp-super-cache'), (int) $_POST['custom_preload_interval']) . "</strong></p>";
                        }
                    }
                }
                echo '<p>' . __('This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache') . '</p>';
                echo '<p>' . __('Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache') . '</p>';
                echo '<p>' . __('In &#8217;Preload Mode&#8217; regular garbage collection will only clean out old legacy files for known users, not the preloaded supercache files. This is a recommended setting when the cache is preloaded.', 'wp-super-cache') . '</p>';
                echo '<form name="cache_filler" action="" method="POST">';
                echo '<input type="hidden" name="action" value="preload" />';
                echo '<input type="hidden" name="page" value="wpsupercache" />';
                echo '<p>' . sprintf(__('Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache'), "<input type='text' size=4 name='custom_preload_interval' value='" . (int) $wp_cache_preload_interval . "' />", $min_refresh_interval) . '</p>';
                if ($count > 100) {
                    $step = (int) ($count / 10);
                    $select = "<select name='posts_to_cache' size=1>";
                    $select .= "<option value='all' ";
                    if (!isset($wp_cache_preload_posts) || $wp_cache_preload_posts == 'all') {
                        $checked = 'selectect=1 ';
                        $best = 'all';
                    } else {
                        $checked = ' ';
                        $best = $wp_cache_preload_posts;
                    }
                    $select .= "{$checked}>" . __('all', 'wp-super-cache') . "</option>";
                    for ($c = $step; $c < $count; $c += $step) {
                        $checked = ' ';
                        if ($best == $c) {
                            $checked = 'selected=1 ';
                        }
                        $select .= "<option value='{$c}'{$checked}>{$c}</option>";
                    }
                    $checked = ' ';
                    if ($best == $count) {
                        $checked = 'selected=1 ';
                    }
                    $select .= "<option value='{$count}'{$checked}>{$count}</option>";
                    $select .= "</select>";
                    echo '<p>' . sprintf(__('Preload %s posts.', 'wp-super-cache'), $select) . '</p>';
                } else {
                    echo '<input type="hidden" name="posts_to_cache" value="' . $count . '" />';
                }
                echo '<input type="checkbox" name="preload_on" value="1" ';
                echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
                echo ' /> ' . __('Preload mode (garbage collection only on legacy cache files. Recommended.)', 'wp-super-cache') . '<br />';
                echo '<input type="checkbox" name="preload_email_me" value="1" ';
                echo $wp_cache_preload_email_me == 1 ? 'checked=1' : '';
                echo ' /> ' . __('Send me status emails when files are refreshed.', 'wp-super-cache') . '<br />';
                if (!isset($wp_cache_preload_email_volume)) {
                    $wp_cache_preload_email_volume = 'many';
                }
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="many" class="tog" ';
                checked('many', $wp_cache_preload_email_volume);
                echo '/> ' . __('Many emails, 2 emails per 100 posts.', 'wp-super-cache') . '<br >';
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="medium" class="tog" ';
                checked('medium', $wp_cache_preload_email_volume);
                echo '/> ' . __('Medium, 1 email per 100 posts.', 'wp-super-cache') . '<br >';
                echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="less" class="tog" ';
                checked('less', $wp_cache_preload_email_volume);
                echo '/> ' . __('Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache') . '<br >';
                $currently_preloading = false;
                next_preload_message('wp_cache_preload_hook', __('Refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache'), 60);
                next_preload_message('wp_cache_full_preload_hook', __('Full refresh of cache in %d hours %d minutes and %d seconds.', 'wp-super-cache'));
                $preload_counter = get_option('preload_cache_counter');
                if (isset($preload_counter['first'])) {
                    // converted from int to array
                    update_option('preload_cache_counter', array('c' => $preload_counter['c'], 't' => time()));
                }
                if (is_array($preload_counter) && $preload_counter['c'] > 0) {
                    echo '<p><strong>' . sprintf(__('Currently caching from post %d to %d.', 'wp-super-cache'), $preload_counter['c'] - 100, $preload_counter['c']) . '</strong></p>';
                    $currently_preloading = true;
                    if (@file_exists($cache_path . "preload_permalink.txt")) {
                        $url = file_get_contents($cache_path . "preload_permalink.txt");
                        echo "<p>" . sprintf(__("<strong>Page last cached:</strong> %s", 'wp-super-cache'), $url) . "</p>";
                    }
                }
                echo '<div class="submit"><input type="submit" name="preload" value="' . __('Update Settings', 'wp-super-cache') . '" />&nbsp;<input type="submit" name="preload" value="' . __('Preload Cache Now', 'wp-super-cache') . '" />';
                if ($currently_preloading) {
                    echo '&nbsp;<input type="submit" name="preload" value="' . __('Cancel Cache Preload', 'wp-super-cache') . '" />';
                }
                echo '</div>';
                wp_nonce_field('wp-cache');
                echo '</form>';
            } else {
                echo '<p>' . __('Preloading of cache disabled. Please disable legacy page caching or talk to your host administrator.', 'wp-super-cache') . '</p>';
            }
            break;
        case 'plugins':
            wpsc_plugins_tab();
            break;
        case 'debug':
            wp_cache_debug_settings();
            break;
        case 'settings':
            if (isset($wp_cache_front_page_checks) == false) {
                $wp_cache_front_page_checks = true;
            }
            echo '<form name="wp_manager" action="' . add_query_arg(array('page' => 'wpsupercache', 'tab' => 'settings')) . '" method="post">';
            wp_nonce_field('wp-cache');
            echo '<input type="hidden" name="action" value="scupdates" />';
            ?>
<table class="form-table">
		<tr valign="top">
			<th scope="row"><label for="wp_cache_status"><?php 
            _e('Caching', 'wp-super-cache');
            ?>
</label></th>
			<td>
				<fieldset>
				<legend class="hidden">Caching</legend>
				<label><input type='checkbox' name='wp_cache_status' value='all' <?php 
            if ($cache_enabled == true) {
                echo 'checked=checked';
            }
            ?>
> <?php 
            _e('Cache hits to this website for quick access.', 'wp-super-cache');
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
</label><br /><br />
				<label><input type='radio' name='super_cache_enabled' <?php 
            if ($super_cache_enabled) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            printf(__('Use mod_rewrite to serve cache files.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wordpress-mobile-edition/');
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
</label><br />
				<label><input type='radio' name='super_cache_enabled' <?php 
            if ($wp_cache_mod_rewrite == 0) {
                echo "checked";
            }
            ?>
 value='2'> <?php 
            printf(__('Use PHP to serve cache files.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wordpress-mobile-edition/');
            ?>
</label><br />
				<label><input type='radio' name='super_cache_enabled' <?php 
            if ($super_cache_enabled == false) {
                echo "checked";
            }
            ?>
 value='0'> <?php 
            _e('Legacy page caching.', 'wp-super-cache');
            ?>
</label><br />
				<em><?php 
            _e('Mod_rewrite is fastest, PHP is almost as fast and easier to get working, while legacy caching is slower again, but more flexible and also easy to get working. New users should use PHP caching.', 'wp-super-cache');
            ?>
</em><br />
				</legend>
				</fieldset>
			</td>
		</tr>
		<tr valign="top">
			<th scope="row"><label for="wp_cache_status"><?php 
            _e('Miscellaneous', 'wp-super-cache');
            ?>
</label></th>
			<td>
				<fieldset>
				<legend class="hidden">Miscellaneous</legend>
				<?php 
            if (false == defined('WPSC_DISABLE_COMPRESSION')) {
                ?>
					<?php 
                if (false == function_exists('gzencode')) {
                    ?>
						<em><?php 
                    _e('Warning! Compression is disabled as gzencode() function not found.', 'wp-super-cache');
                    ?>
</em><br />
					<?php 
                } else {
                    ?>
						<label><input type='checkbox' name='cache_compression' <?php 
                    if ($cache_compression) {
                        echo "checked";
                    }
                    ?>
 value='1'> <?php 
                    _e('Compress pages so they&#8217;re served more quickly to visitors.', 'wp-super-cache');
                    echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
                    ?>
</label><br />
						<em><?php 
                    _e('Compression is disabled by default because some hosts have problems with compressed files. Switching it on and off clears the cache.', 'wp-super-cache');
                    ?>
</em><br />
					<?php 
                }
                ?>
				<?php 
            }
            ?>
				<?php 
            if (0 == $wp_cache_mod_rewrite) {
                ?>
					<label><input type='checkbox' name='wp_supercache_304' <?php 
                if ($wp_supercache_304) {
                    echo "checked";
                }
                ?>
 value='1'> <?php 
                _e('304 Not Modified browser caching. Indicate when a page has not been modified since last requested.', 'wp-super-cache');
                echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
                ?>
</label><br />
				<em><?php 
                _e('304 support is disabled by default because in the past GoDaddy had problems with some of the headers used.', 'wp-super-cache');
                ?>
</em><br />
				<?php 
            }
            ?>
				<label><input type='checkbox' name='wp_cache_not_logged_in' <?php 
            if ($wp_cache_not_logged_in) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Don&#8217;t cache pages for <acronym title="Logged in users and those that comment">known users</acronym>.', 'wp-super-cache');
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
</label><br />
				<label><input type='checkbox' name='wp_cache_make_known_anon' <?php 
            if ($wp_cache_make_known_anon) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Make known users anonymous so they&#8217;re served supercached static files.', 'wp-super-cache');
            ?>
</label><br />
				<label><input type='checkbox' name='cache_rebuild_files' <?php 
            if ($cache_rebuild_files) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache');
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
</label><br />
				<label><input type='checkbox' name='wp_cache_hello_world' <?php 
            if ($wp_cache_hello_world) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            printf(__('Proudly tell the world your server is <a href="%s">Stephen Fry proof</a>! (places a message in your blog&#8217;s footer)', 'wp-super-cache'), 'https://twitter.com/#!/HibbsLupusTrust/statuses/136429993059291136');
            ?>
</label><br />
				</legend>
				</fieldset>
			</td>
		</tr>
		<tr valign="top">
			<th scope="row"><label for="wp_cache_status"><?php 
            _e('Advanced', 'wp-super-cache');
            ?>
</label></th>
			<td>
				<fieldset>
				<legend class="hidden">Advanced</legend>
				<label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
            if ($wp_cache_mobile_enabled) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Mobile device support. (External plugin or theme required. See the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache');
            ?>
</label><br />
				<label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
            if ($wp_cache_clear_on_post_edit) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Clear all cache files when a post or page is published or updated.', 'wp-super-cache');
            ?>
</label><br />
				<label><input type='checkbox' name='wp_cache_front_page_checks' <?php 
            if ($wp_cache_front_page_checks) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Extra homepage checks. (Very occasionally stops homepage caching)', 'wp-super-cache');
            ?>
</label><?php 
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
<br />
				<label><input type='checkbox' name='wp_cache_refresh_single_only' <?php 
            if ($wp_cache_refresh_single_only) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Only refresh current page when comments made.', 'wp-super-cache');
            ?>
</label><br />
				<label><input type='checkbox' name='wp_supercache_cache_list' <?php 
            if ($wp_supercache_cache_list) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('List the newest cached pages on this page.', 'wp-super-cache');
            ?>
</label><br />
			<?php 
            if (false == defined('WPSC_DISABLE_LOCKING')) {
                ?>
				<label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
                if (!$wp_cache_mutex_disabled) {
                    echo "checked";
                }
                ?>
 value='0'> <?php 
                _e('Coarse file locking. You probably don&#8217;t need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em>', 'wp-super-cache');
                ?>
</label><br />
			<?php 
            }
            ?>
				<label><input type='checkbox' name='wp_super_cache_late_init' <?php 
            if ($wp_super_cache_late_init) {
                echo "checked";
            }
            ?>
 value='1'> <?php 
            _e('Late init. Display cached files after WordPress has loaded. Most useful in legacy mode.', 'wp-super-cache');
            ?>
</label><br />
			<?php 
            if ($_wp_using_ext_object_cache) {
                ?>
<label><input type='checkbox' name='wp_cache_object_cache' <?php 
                if ($wp_cache_object_cache) {
                    echo "checked";
                }
                ?>
 value='1'> <?php 
                echo __('Use object cache to store cached files.', 'wp-super-cache') . ' ' . __('(Experimental)', 'wp-super-cache');
                ?>
</label><?php 
            }
            ?>
			<?php 
            printf(__('<strong>DO NOT CACHE PAGE</strong> secret key: <a href="%s">%s</a>', 'wp-super-cache'), trailingslashit(get_bloginfo('wpurl')) . "?donotcachepage={$cache_page_secret}", $cache_page_secret);
            ?>
				</legend>
				</fieldset>
			</td>
		</tr>
		</table>
		<h3><?php 
            _e('Note:', 'wp-super-cache');
            ?>
</h3>
		<ol>
		<li><?php 
            _e('Uninstall this plugin on the plugins page. It will automatically clean up after itself. If manual intervention is required then simple instructions are provided.', 'wp-super-cache');
            ?>
</li>
		<li><?php 
            printf(__('If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</li>
		<li><?php 
            printf(__('Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache'), WP_PLUGIN_URL);
            ?>
</li><?php 
            echo "<li><em>" . sprintf(__('Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/', 'http://wordpress.org/tags/wp-super-cache?forum_id=10') . "</em></li>";
            echo "</ol>";
            echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div>";
            wp_nonce_field('wp-cache');
            ?>
 </form> <?php 
            wsc_mod_rewrite();
            wp_cache_edit_max_time();
            echo '<a name="files"></a><fieldset class="options"><h3>' . __('Accepted Filenames &amp; Rejected URIs', 'wp-super-cache') . '</h3>';
            wp_cache_edit_rejected_pages();
            echo "\n";
            wp_cache_edit_rejected();
            echo "\n";
            wp_cache_edit_accepted();
            echo '</fieldset>';
            wp_cache_edit_rejected_ua();
            wp_lock_down();
            wp_cache_restore();
            break;
        case "easy":
        default:
            echo '<form name="wp_manager" action="" method="post">';
            echo '<input type="hidden" name="action" value="easysetup" />';
            wp_nonce_field('wp-cache');
            ?>
<table class="form-table">
				<tr valign="top">
				<th scope="row"><label for="wp_cache_status"><?php 
            _e('Caching', 'wp-super-cache');
            ?>
</label></th>
				<td>
				<fieldset>
				<label><input type='radio' name='wp_cache_easy_on' value='1' <?php 
            if ($cache_enabled == true) {
                echo 'checked=checked';
            }
            ?>
> <?php 
            _e('Caching On', 'wp-super-cache');
            echo " <em>(" . __("Recommended", "wp-super-cache") . ")</em>";
            ?>
</label><br />
				<label><input type='radio' name='wp_cache_easy_on' value='0' <?php 
            if ($cache_enabled == false) {
                echo 'checked=checked';
            }
            ?>
> <?php 
            _e('Caching Off', 'wp-super-cache');
            ?>
</label><br />
				<em><?php 
            _e('Note: enables PHP caching, cache rebuild, and mobile support', 'wp-super-cache');
            ?>
</em><br />
				</legend>
				</fieldset>
				</td>
				</tr>
				</table>
			<?php 
            if ($cache_enabled && !$wp_cache_mod_rewrite) {
                $scrules = trim(implode("\n", extract_from_markers(trailingslashit(get_home_path()) . '.htaccess', 'WPSuperCache')));
                if ($scrules != '') {
                    echo "<p><strong>" . __('Notice: PHP caching enabled but Supercache mod_rewrite rules detected. Cached files will be served using those rules. If your site is working ok please ignore this message or you can edit the .htaccess file in the root of your install and remove the SuperCache rules.', 'wp-super-cache') . '</strong></p>';
                }
            }
            echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div></form>";
            if ($cache_enabled) {
                echo "<h3>" . __('Cache Tester', 'wp-super-cache') . "</h3>";
                echo '<p>' . __('Test your cached website by clicking the test button below.', 'wp-super-cache') . '</p>';
                if (array_key_exists('action', $_POST) && $_POST['action'] == 'test' && $valid_nonce) {
                    $url = trailingslashit(get_bloginfo('url'));
                    if (isset($_POST['httponly'])) {
                        $url = str_replace('https://', 'http://', $url);
                    }
                    // Prime the cache
                    echo "<p>" . sprintf(__('Fetching %s to prime cache: ', 'wp-super-cache'), $url);
                    $page = wp_remote_get($url, array('timeout' => 60, 'blocking' => true));
                    echo '<span style="color: #0a0; font-weight: bold;">' . __('OK', 'wp-super-cache') . '</strong></p>';
                    sleep(1);
                    // Get the first copy
                    echo "<p>" . sprintf(__('Fetching first copy of %s: ', 'wp-super-cache'), $url);
                    $page = wp_remote_get($url, array('timeout' => 60, 'blocking' => true));
                    if (!is_wp_error($page)) {
                        $fp = fopen($cache_path . "1.html", "w");
                        fwrite($fp, $page['body']);
                        fclose($fp);
                        echo '<span style="color: #0a0; font-weight: bold;">' . __('OK', 'wp-super-cache') . "</span> (<a href='" . WP_CONTENT_URL . "/cache/1.html'>1.html</a>)</p>";
                        sleep(1);
                    } else {
                        echo '<span style="color: #a00; font-weight: bold;">' . __('FAILED', 'wp-super-cache') . "</span></p>";
                    }
                    // Get the second copy
                    echo "<p>" . sprintf(__('Fetching second copy of %s: ', 'wp-super-cache'), $url);
                    $page2 = wp_remote_get($url, array('timeout' => 60, 'blocking' => true));
                    if (!is_wp_error($page2)) {
                        $fp = fopen($cache_path . "2.html", "w");
                        fwrite($fp, $page2['body']);
                        fclose($fp);
                        echo '<span style="color: #0a0; font-weight: bold;">' . __('OK', 'wp-super-cache') . "</span> (<a href='" . WP_CONTENT_URL . "/cache/2.html'>2.html</a>)</p>";
                    } else {
                        echo '<span style="color: #a00; font-weight: bold;">' . __('FAILED', 'wp-super-cache') . "</span></p>";
                    }
                    if (is_wp_error($page) || is_wp_error($page2) || $page['response']['code'] != 200 || $page2['response']['code'] != 200) {
                        echo '<p><span style="color: #a00; font-weight: bold;">' . __('One or more page requests failed:', 'wp-super-cache') . '</span></p>';
                        $error = false;
                        if (is_wp_error($page)) {
                            $error = $page;
                        } elseif (is_wp_error($page2)) {
                            $error = $page2;
                        }
                        if ($error) {
                            $errors = '';
                            $messages = '';
                            foreach ($error->get_error_codes() as $code) {
                                $severity = $error->get_error_data($code);
                                foreach ($error->get_error_messages($code) as $err) {
                                    $errors .= '	' . $err . "<br />\n";
                                }
                            }
                            if (!empty($err)) {
                                echo '<div class="updated fade">' . $errors . "</div>\n";
                            }
                        } else {
                            echo '<ul><li>' . sprintf(__('Page %d: %d (%s)', 'wp-super-cache'), 1, $page['response']['code'], $page['response']['message']) . '</li>';
                            echo '<li>' . sprintf(__('Page %d: %d (%s)', 'wp-super-cache'), 2, $page2['response']['code'], $page2['response']['message']) . '</li></ul>';
                        }
                    }
                    if (preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page['body'], $matches1) && preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page2['body'], $matches2) && $matches1[2] == $matches2[2]) {
                        echo '<p>' . sprintf(__('Page 1: %s', 'wp-super-cache'), $matches1[2]) . '</p>';
                        echo '<p>' . sprintf(__('Page 2: %s', 'wp-super-cache'), $matches2[2]) . '</p>';
                        echo '<p><span style="color: #0a0; font-weight: bold;">' . __('The timestamps on both pages match!', 'wp-super-cache') . '</span></p>';
                    } else {
                        echo '<p><strong>' . __('The pages do not match! Timestamps differ or were not found!', 'wp-super-cache') . '</strong></p>';
                        echo '<p>' . __('Things you can do:', 'wp-super-cache') . '</p>';
                        echo '<ol><li>' . __('Load your homepage in a logged out browser, check the timestamp at the end of the html source. Load the page again and compare the timestamp. Caching is working if the timestamps match.', 'wp-super-cache') . '</li>';
                        echo '<li>' . __('Enable logging on the Debug page here. That should help you track down the problem.', 'wp-super-cache') . '</li>';
                        echo '<li>' . __('You should check Page 1 and Page 2 above for errors. Your local server configuration may not allow your website to access itself.', 'wp-super-cache') . '</li>';
                        echo "</ol>";
                    }
                }
                echo '<form name="cache_tester" action="" method="post">';
                echo '<input type="hidden" name="action" value="test" />';
                if ('on' == strtolower($_SERVER['HTTPS'])) {
                    echo "<input type='checkbox' name='httponly' checked='checked' value='1' /> " . __('Send non-secure (non https) request for homepage', 'wp-super-cache');
                }
                echo '<div class="submit"><input type="submit" name="test" value="' . __('Test Cache', 'wp-super-cache') . '" /></div>';
                wp_nonce_field('wp-cache');
                echo '</form>';
            }
            echo "<h3>" . __("Delete Cached Pages", 'wp-super-cache') . "</h3>";
            echo "<p>" . __("Cached pages are stored on your server as html and PHP files. If you need to delete them use the button below.", 'wp-super-cache') . "</p>";
            echo '<form name="wp_cache_content_delete" action="?page=wpsupercache&tab=contents" method="post">';
            echo '<input type="hidden" name="wp_delete_cache" />';
            echo '<div class="submit" style="float:left;margin-left:10px"><input id="deletepost" type="submit" ' . SUBMITDISABLED . 'value="' . __('Delete Cache', 'wp-super-cache') . ' &raquo;" /></div>';
            wp_nonce_field('wp-cache');
            echo "</form>\n";
            if (defined('WP_ALLOW_MULTISITE') && wpsupercache_site_admin()) {
                echo '<form name="wp_cache_content_delete" action="#listfiles" method="post">';
                echo '<input type="hidden" name="wp_delete_all_cache" />';
                echo '<div class="submit" style="float:left;margin-left:10px"><input id="deleteallpost" type="submit" ' . SUBMITDISABLED . 'value="' . __('Delete Cache On All Blogs', 'wp-super-cache') . ' &raquo;" />';
                wp_nonce_field('wp-cache');
                echo "</form><br />\n";
            }
            ?>
			<h3><?php 
            _e('Recommended Links and Plugins', 'wp-super-cache');
            ?>
</h3>
			<p><?php 
            _e('Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache');
            ?>
</p>
			<ol><li><?php 
            printf(__('<a href="%s">WP Minify</a> reduces the number of files served by your web server by joining Javascript and CSS files together. Alternatively you can use <a href="%s">WPSCMin</a>, a Supercache plugin that minifies cached pages. It does not however join JS/CSS files together.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-minify/', 'http://lyncd.com/wpscmin/');
            ?>
</li>
			<li><?php 
            printf(__('<a href="%s">Yahoo! Yslow</a> is an extension for the Firefox add-on Firebug. It analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. Also try the performance tools online at <a href="%s">GTMetrix</a>.', 'wp-super-cache'), 'http://developer.yahoo.com/yslow/', 'http://gtmetrix.com/');
            ?>
</li>
			<li><?php 
            printf(__('<a href="%s">Use Google Libraries</a> allows you to load some commonly used Javascript libraries from Google webservers. Ironically it may reduce your Yslow score.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/use-google-libraries/');
            ?>
</li>
			<li><?php 
            printf(__('The <a href="%1$s">CDN Sync Tool</a> plugin will help upload files to Amazon S3/Cloudfront if you would rather not depend on origin pull. See the <a href="%2$s">plugin support forum</a> if you have any queries about this plugin.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/cdn-sync-tool/', 'http://wordpress.org/tags/cdn-sync-tool?forum_id=10');
            ?>
</li>
			<li><?php 
            printf(__('<strong>Advanced users only:</strong> <a href="%s">Speed up your site with Caching and cache-control</a> explains how to make your site more cacheable with .htaccess rules.', 'wp-super-cache'), 'http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html');
            ?>
</li>
			<li><?php 
            printf(__('<strong>Advanced users only:</strong> Install an object cache. Choose from <a href="%s">Memcached</a>, <a href="%s">XCache</a>, <a href="%s">eAcccelerator</a> and others.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/memcached/', 'http://neosmart.net/dl.php?id=12', 'http://neosmart.net/dl.php?id=13');
            ?>
</li>
			</ol>
			
			<?php 
            break;
    }
    ?>
	</fieldset>
	</td><td valign='top' style='width: 300px'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'><?php 
    _e('Make WordPress Faster', 'wp-super-cache');
    ?>
</h3>
	<p><?php 
    printf(__('%1$s is maintained and developed by %2$s with contributions from many others.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a>', '<a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a>');
    ?>
</p>
	<p><?php 
    printf(__('He blogs at %1$s and posts photos at %2$s.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>', '<a href="http://inphotos.org/?r=supercache">In Photos.org</a>');
    ?>
</p>
	<p><?php 
    printf(__('Please say hi to him on %s too!', 'wp-super-cache'), '<a href="http://twitter.com/donncha/">Twitter</a>');
    ?>
</p>
	<h3 align='center'><?php 
    _e('Need Help?', 'wp-super-cache');
    ?>
</h3>
	<ol>
	<li><?php 
    printf(__('<a href="%1$s">Installation Help</a>', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/installation/');
    ?>
</li>
	<li><?php 
    printf(__('<a href="%1$s">Frequently Asked Questions</a>', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
    ?>
</li>
	<li><?php 
    printf(__('<a href="%1$s">Support Forum</a>', 'wp-super-cache'), 'http://wordpress.org/tags/wp-super-cache');
    ?>
</li>
	</ol>
	<h3 align='center'><?php 
    _e('Rate This Plugin!', 'wp-super-cache');
    ?>
</h3>
	<p><?php 
    printf(__('Please <a href="%s">rate</a> this plugin and tell me if it works for you or not. It really helps development.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/');
    ?>
</p>

	<?php 
    if (isset($wp_supercache_cache_list) && $wp_supercache_cache_list) {
        $start_date = get_option('wpsupercache_start');
        if (!$start_date) {
            $start_date = time();
        }
        ?>
		<p><?php 
        printf(__('Cached pages since %1$s : <strong>%2$s</strong>', 'wp-super-cache'), date('M j, Y', $start_date), number_format(get_option('wpsupercache_count')));
        ?>
</p>
		<p><?php 
        _e('Newest Cached Pages:', 'wp-super-cache');
        ?>
<ol>
		<?php 
        foreach (array_reverse((array) get_option('supercache_last_cached')) as $url) {
            $since = time() - strtotime($url['date']);
            echo "<li><a title='" . sprintf(__('Cached %s seconds ago', 'wp-super-cache'), $since) . "' href='" . site_url($url['url']) . "'>" . substr($url['url'], 0, 20) . "</a></li>\n";
        }
        ?>
</ol>
		<small><?php 
        _e('(may not always be accurate on busy sites)', 'wp-super-cache');
        ?>
</small>
		</p><?php 
    } else {
        $start_date = get_option('wpsupercache_start');
        if ($start_date) {
            update_option('wpsupercache_start', $start_date);
            update_option('wpsupercache_count', 0);
        }
    }
    ?>
	</div>
	</td></table>

	<?php 
    echo "</div>\n";
}
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache');
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2>WP Super Cache Manager</h2>\n";
    if (ini_get('safe_mode')) {
        ?>
<h3>Warning! PHP Safe Mode Enabled!</h3>
		<p>You may experience problems running this plugin because SAFE MODE is enabled. <?php 
        if (!ini_get('safe_mode_gid')) {
            ?>
Your server is set up to check the owner of PHP scripts before allowing them to read and write files.</p><p>You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the <?php 
            echo WP_CONTENT_DIR;
            ?>
/cache/ directory must also be changed. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details.</p><?php 
        } else {
            ?>
You or an administrator must disable this. See the <a href='http://php.net/features.safe-mode'>safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.</p><?php 
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo "Cannot continue... fix previous problems and retry.";
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3>Warning! Your hostname "<?php 
                echo $hostname;
                ?>
" resolves to <?php 
                echo $ip;
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p>Your server thinks your hostname resolves to <?php 
                echo $ip;
                ?>
. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.</p>
			<p>Please see entry 16 in the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">Troubleshooting section</a> of the readme.txt</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p>Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.</p>
				<p>Please see entry 16 in the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">Troubleshooting section</a> of the readme.txt</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'>Mod rewrite may not be installed!</h4>
		<p>It appears that mod_rewrite is not installed. Sometimes this check isn't 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use WP-Cache.</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'>Read Only Mode. Configuration cannot be changed. <a href="javascript:toggleLayer('readonlywarning');" title="Why your configuration may not be changed">Why</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p>The WP Super Cache configuration file is <code><?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code> and cannot be modified. The file <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php must be writeable by the webserver to make any changes.
		A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it's globally writeable and it should be fine.
		Writeable: <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		Readonly: <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'>Warning! <?php 
            echo WP_CONTENT_DIR;
            ?>
 is writeable!</h4>
			<p>You should change the permissions on <?php 
            echo WP_CONTENT_DIR;
            ?>
 and make it more restrictive. Use your ftp client, or the following command to fix things:<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                if (!isset($wp_cache_mobile_whitelist)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_whitelist', "\$wp_cache_mobile_whitelist = 'Stand Alone/QNws';", $wp_cache_config_file);
                }
                if (false == isset($wp_cache_mobile_browsers)) {
                    wp_cache_replace_line('^ *\\$wp_cache_mobile_browsers', "\$wp_cache_mobile_browsers = '2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP';", $wp_cache_config_file);
                }
                $_POST['wp_cache_status'] = 'wpcache';
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
        }
        if (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            $cache_compression_changed = true;
            $cache_compression = intval($_POST['cache_compression']);
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
            if (function_exists('prune_super_cache')) {
                prune_super_cache($cache_path, true);
            }
            delete_option('super_cache_meta');
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3>WP Super Cache Status</h3><?php 
    echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong>ON</strong> <span class="setting-description">WP Cache and Super Cache enabled</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>HALF ON</strong> <span class="setting-description">Super Cache Disabled, only legacy WP-Cache caching.</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong>OFF</strong> <span class="setting-description">WP Cache and Super Cache disabled</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.</label></p>
	<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
    if (!$wp_cache_mutex_disabled) {
        echo "checked";
    }
    ?>
 value='0'> Coarse file locking. You probably don't need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em></label></p>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> Mobile device support. Plugin will enter "Half-On" mode.</label></p>
	<p><strong>Note:</strong> If uninstalling this plugin, make sure the directory <em><?php 
    echo WP_CONTENT_DIR;
    ?>
</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)</p>
	<?php 
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='Update Status &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => 'Required to serve compressed supercache files properly.', 'mod_headers' => 'Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'mod_expires' => 'Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.');
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (is_array($missing_mods)) {
            echo "<h3>Missing Apache Modules</h3>";
            echo "<p>The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'>Make WordPress Faster</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a> makes your blog go faster. Think that's worth $10? Click the "Donate" button below.</p>
	<p>Thanks!<br />Donncha O Caoimh.<br /></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p>Don't show me this again. <form action="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='Hide' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a> is maintained and developed by <a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a> with contributions from many others thanks to the GPL.</p>
	<p>He blogs at <a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a> and posts photos at <a href="http://inphotos.org/?r=supercache">In Photos.org</a>. You can say hi to him on <a href="http://twitter.com/donncha/">Twitter</a> too!</p>
	<?php 
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>Accepted Filenames &amp; Rejected URIs</h3>';
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>Cache Plugins</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
Exemple #5
0
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
    global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers;
    global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation, $wp_cache_not_logged_in, $wp_supercache_cache_list;
    global $wp_super_cache_front_page_check, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
    if (function_exists('is_site_admin')) {
        if (!is_site_admin()) {
            return;
        }
    }
    $supercachedir = $cache_path . 'supercache/' . preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"]);
    if (get_option('gzipcompression') == 1) {
        update_option('gzipcompression', 0);
    }
    if (!isset($cache_rebuild_files)) {
        $cache_rebuild_files = 0;
    }
    $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
    /* http://www.netlobo.com/div_hiding.html */
    ?>
<script type='text/javascript'>
<!--
function toggleLayer( whichLayer ) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
// -->
//Clicking header opens fieldset options
jQuery(document).ready(function(){
	jQuery("fieldset h3").css("cursor","pointer").click(function(){
		jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
	});
});
</script>
<?php 
    echo '<div class="wrap">';
    echo "<h2><a href='?page=wpsupercache'>" . __('WP Super Cache Manager', 'wp-super-cache') . "</a></h2>\n";
    if (1 == ini_get('safe_mode') || "on" == strtolower(ini_get('safe_mode'))) {
        ?>
<h3><?php 
        _e('Warning! PHP Safe Mode Enabled!', 'wp-super-cache');
        ?>
</h3>
		<p><?php 
        _e('You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache');
        if (!ini_get('safe_mode_gid')) {
            echo __('Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache') . "</p><p>";
            echo sprintf(__('You or an administrator may be able to make it work by changing the group owner of the plugin scripts to match that of the web server user. The group owner of the %s/cache/ directory must also be changed. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details.', 'wp-super-cache'), WP_CONTENT_DIR) . "</p>";
        } else {
            echo __('You or an administrator must disable this. See the <a href="http://php.net/features.safe-mode">safe mode manual page</a> for further details. This cannot be disabled in a .htaccess file unfortunately. It must be done in the php.ini config file.', 'wp-super-cache') . "</p>";
        }
    }
    if ('' == get_option('permalink_structure')) {
        echo "<h3>" . __('Permlink Structure Error', 'wp-super-cache') . "</h3>";
        echo "<p>" . __('A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.') . "</p>";
    }
    if (isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 1 && !wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>' . __('Configuration file changed, some values might be wrong. Load the page again from the "Settings" menu to reset them.', 'wp-super-cache') . '</strong>';
    }
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo '<p>' . __("Cannot continue... fix previous problems and retry.", 'wp-super-cache') . '</p>';
        echo "</div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</div>\n";
        return;
    }
    if ($wp_cache_debug || !$wp_cache_cron_check) {
        if (function_exists("wp_remote_get") == false) {
            $hostname = str_replace('http://', '', str_replace('https://', '', get_option('siteurl')));
            if (strpos($hostname, '/')) {
                $hostname = substr($hostname, 0, strpos($hostname, '/'));
            }
            $ip = gethostbyname($hostname);
            if (substr($ip, 0, 3) == '127' || substr($ip, 0, 7) == '192.168') {
                ?>
<h3><?php 
                printf(__('Warning! Your hostname "%s" resolves to %s', 'wp-super-cache'), $hostname, $ip);
                ?>
</h3>
			<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
			<p><?php 
                printf(__('Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache'), $ip);
                ?>
</p>
			<p><?php 
                printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                ?>
</p>
			</div>
			<?php 
            } else {
                wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
            }
        } else {
            $cron_url = get_option('siteurl') . '/wp-cron.php?check=' . wp_hash('187425');
            $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
            if (is_array($cron)) {
                if ($cron['response']['code'] == '404') {
                    ?>
<h3>Warning! wp-cron.php not found!</h3>
				<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>
				<p><?php 
                    _e('Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache');
                    ?>
</p>
				<p><?php 
                    printf(__('Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/faq/');
                    ?>
</p>
				</div>
				<?php 
                } else {
                    wp_cache_replace_line('^ *\\$wp_cache_cron_check', "\$wp_cache_cron_check = 1;", $wp_cache_config_file);
                }
            }
        }
    }
    if (substr(get_option('permalink_structure'), -1) == '/') {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 1;", $wp_cache_config_file);
    } else {
        wp_cache_replace_line('^ *\\$wp_cache_slash_check', "\$wp_cache_slash_check = 0;", $wp_cache_config_file);
    }
    if (1 == ini_get('zlib.output_compression') || "on" == strtolower(ini_get('zlib.output_compression'))) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Zlib Output Compression Enabled!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if ($cache_enabled == true && $super_cache_enabled == true && !got_mod_rewrite()) {
        ?>
<h4 style='color: #a00'><?php 
        _e('Mod rewrite may not be installed!', 'wp-super-cache');
        ?>
</h4>
		<p><?php 
        _e('It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use half-on mode.', 'wp-super-cache');
        ?>
</p><?php 
    }
    if (!is_writeable_ACLSafe($wp_cache_config_file)) {
        define("SUBMITDISABLED", 'disabled style="color: #aaa" ');
        ?>
<h4 style='text-align:center; color: #a00'><?php 
        _e('Read Only Mode. Configuration cannot be changed.', 'wp-super-cache');
        ?>
 <a href="javascript:toggleLayer('readonlywarning');" title="<?php 
        _e('Why your configuration may not be changed', 'wp-super-cache');
        ?>
"><?php 
        _e('Why', 'wp-super-cache');
        ?>
</a></h4>
		<div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'>
		<p><?php 
        printf(__('The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the webserver to make any changes.', 'wp-super-cache'), WP_CONTENT_DIR);
        ?>
		<?php 
        _e('A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache');
        ?>
</p>
		<?php 
        _e('Writeable:', 'wp-super-cache');
        ?>
 <code>chmod 666 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code>
		<?php 
        _e('Readonly:', 'wp-super-cache');
        ?>
 <code>chmod 644 <?php 
        echo WP_CONTENT_DIR;
        ?>
/wp-cache-config.php</code></p>
		</div><?php 
    } else {
        define("SUBMITDISABLED", ' ');
    }
    // Server could be running as the owner of the wp-content directory.  Therefore, if it's
    // writable, issue a warning only if the permissions aren't 755.
    if (is_writeable_ACLSafe(WP_CONTENT_DIR . '/')) {
        $wp_content_stat = stat(WP_CONTENT_DIR . '/');
        $wp_content_mode = $wp_content_stat['mode'] & 0777;
        if ($wp_content_mode != 0755) {
            ?>
<h4 style='text-align:center; color: #a00'><?php 
            printf(__('Warning! %s is writeable!', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
</h4>
			<p><?php 
            printf(__('You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache'), WP_CONTENT_DIR);
            ?>
<code>chmod 755 <?php 
            echo WP_CONTENT_DIR;
            ?>
/</code></p><?php 
        }
    }
    // used by mod_rewrite rules and config file
    if (function_exists("cfmobi_default_browsers")) {
        $wp_cache_mobile_browsers = cfmobi_default_browsers("mobile");
        $wp_cache_mobile_browsers = array_merge($wp_cache_mobile_browsers, cfmobi_default_browsers("touch"));
    } else {
        $wp_cache_mobile_browsers = array('2.0 MMP', '240x320', '400X240', 'AvantGo', 'BlackBerry', 'Blazer', 'Cellphone', 'Danger', 'DoCoMo', 'Elaine/3.0', 'EudoraWeb', 'Googlebot-Mobile', 'hiptop', 'IEMobile', 'KYOCERA/WX310K', 'LG/U990', 'MIDP-2.', 'MMEF20', 'MOT-V', 'NetFront', 'Newt', 'Nintendo Wii', 'Nitro', 'Nokia', 'Opera Mini', 'Palm', 'PlayStation Portable', 'portalmmm', 'Proxinet', 'ProxiNet', 'SHARP-TQ-GX10', 'SHG-i900', 'Small', 'SonyEricsson', 'Symbian OS', 'SymbianOS', 'TS21i-10', 'UP.Browser', 'UP.Link', 'webOS', 'Windows CE', 'WinWAP', 'YahooSeeker/M1A1-R2D2', 'iPhone', 'iPod', 'Android', 'BlackBerry9530', 'LG-TU915 Obigo', 'LGE VX', 'webOS', 'Nokia5800');
    }
    $wp_cache_mobile_prefixes = array('w3c ', 'w3c-', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'htc_', 'inno', 'ipaq', 'ipod', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'lg/u', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda ', 'xda-');
    // from http://svn.wp-plugins.org/wordpress-mobile-pack/trunk/plugins/wpmp_switcher/lite_detection.php
    $wp_cache_mobile_browsers = apply_filters('cached_mobile_browsers', $wp_cache_mobile_browsers);
    // Allow mobile plugins access to modify the mobile UA list
    $wp_cache_mobile_prefixes = apply_filters('cached_mobile_prefixes', $wp_cache_mobile_prefixes);
    // Allow mobile plugins access to modify the mobile UA prefix list
    $mobile_groups = apply_filters('cached_mobile_groups', array());
    // Group mobile user agents by capabilities. Lump them all together by default
    // mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
    if ($valid_nonce) {
        if (isset($_POST['wp_cache_status'])) {
            if (isset($_POST['wp_cache_mobile_enabled'])) {
                $wp_cache_mobile_enabled = 1;
            } else {
                $wp_cache_mobile_enabled = 0;
            }
            if ($wp_cache_mobile_enabled == 1) {
                update_cached_mobile_ua_list($wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $mobile_groups);
            }
            wp_cache_replace_line('^ *\\$wp_cache_mobile_enabled', "\$wp_cache_mobile_enabled = " . $wp_cache_mobile_enabled . ";", $wp_cache_config_file);
            $wp_supercache_cache_list = $_POST['wp_supercache_cache_list'] == 1 ? 1 : 0;
            wp_cache_replace_line('^ *\\$wp_supercache_cache_list', "\$wp_supercache_cache_list = " . $wp_supercache_cache_list . ";", $wp_cache_config_file);
            switch ($_POST['wp_cache_status']) {
                case 'all':
                    wp_cache_enable();
                    break;
                case 'none':
                    wp_cache_disable();
                    break;
                case 'wpcache':
                    wp_cache_enable();
                    wp_super_cache_disable();
                    break;
            }
            if (isset($_POST['wp_cache_hello_world'])) {
                $wp_cache_hello_world = 1;
            } else {
                $wp_cache_hello_world = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_hello_world', '$wp_cache_hello_world = ' . (int) $wp_cache_hello_world . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_clear_on_post_edit'])) {
                $wp_cache_clear_on_post_edit = 1;
            } else {
                $wp_cache_clear_on_post_edit = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_clear_on_post_edit', "\$wp_cache_clear_on_post_edit = " . $wp_cache_clear_on_post_edit . ";", $wp_cache_config_file);
            if (isset($_POST['cache_rebuild_files'])) {
                $cache_rebuild_files = 1;
            } else {
                $cache_rebuild_files = 0;
            }
            wp_cache_replace_line('^ *\\$cache_rebuild_files', "\$cache_rebuild_files = " . $cache_rebuild_files . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_mutex_disabled'])) {
                $wp_cache_mutex_disabled = 0;
            } else {
                $wp_cache_mutex_disabled = 1;
            }
            if (defined('WPSC_DISABLE_LOCKING')) {
                $wp_cache_mutex_disabled = 1;
            }
            wp_cache_replace_line('^ *\\$wp_cache_mutex_disabled', "\$wp_cache_mutex_disabled = " . $wp_cache_mutex_disabled . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_not_logged_in'])) {
                if ($wp_cache_not_logged_in == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_not_logged_in = 1;
            } else {
                $wp_cache_not_logged_in = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_not_logged_in', "\$wp_cache_not_logged_in = " . $wp_cache_not_logged_in . ";", $wp_cache_config_file);
            if ($_wp_using_ext_object_cache && isset($_POST['wp_cache_object_cache'])) {
                if ($wp_cache_object_cache == 0 && function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                $wp_cache_object_cache = 1;
            } else {
                $wp_cache_object_cache = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_object_cache', "\$wp_cache_object_cache = " . $wp_cache_object_cache . ";", $wp_cache_config_file);
            if (isset($_POST['wp_cache_refresh_single_only'])) {
                $wp_cache_refresh_single_only = 1;
            } else {
                $wp_cache_refresh_single_only = 0;
            }
            wp_cache_replace_line('^ *\\$wp_cache_refresh_single_only', "\$wp_cache_refresh_single_only = '" . $wp_cache_refresh_single_only . "';", $wp_cache_config_file);
        }
        if (defined('WPSC_DISABLE_COMPRESSION')) {
            $cache_compression_changed = false;
            $cache_compression = 0;
            wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
        } elseif (isset($_POST['cache_compression']) && $_POST['cache_compression'] != $cache_compression) {
            if ($_POST['cache_compression'] && 1 == ini_get('zlib.output_compression') || "on" == strtolower(ini_get('zlib.output_compression'))) {
                _e("<strong>Warning!</strong> You attempted to enable compression but <code>zlib.output_compression</code> is enabled. See #21 in the Troubleshooting section of the readme file.", 'wp-super-cache');
            } else {
                $cache_compression = intval($_POST['cache_compression']);
                $cache_compression_changed = true;
                wp_cache_replace_line('^ *\\$cache_compression', "\$cache_compression = " . $cache_compression . ";", $wp_cache_config_file);
                if (function_exists('prune_super_cache')) {
                    prune_super_cache($cache_path, true);
                }
                delete_option('super_cache_meta');
            }
        }
        if (isset($_POST['wp_cache_hide_donation']) && $_POST['wp_cache_hide_donation'] != $wp_cache_hide_donation) {
            $wp_cache_hide_donation = intval($_POST['wp_cache_hide_donation']);
            wp_cache_replace_line('^ *\\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
        }
    }
    echo '<a name="top"></a>';
    ?>
	<table><td><fieldset class="options" id="show-this-fieldset"> 
	<h3><?php 
    _e('WP Super Cache Status', 'wp-super-cache');
    ?>
</h3><?php 
    echo '<form name="wp_manager" action="#top" method="post">';
    ?>
	<label><input type='radio' name='wp_cache_status' value='all' <?php 
    if ($cache_enabled == true && $super_cache_enabled == true) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache enabled', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='wpcache' <?php 
    if ($cache_enabled == true && $super_cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('HALF ON', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('Super Cache Disabled, only legacy WP-Cache caching.', 'wp-super-cache');
    ?>
</span></label><br />
	<label><input type='radio' name='wp_cache_status' value='none' <?php 
    if ($cache_enabled == false) {
        echo 'checked=checked';
    }
    ?>
> <strong><?php 
    _e('OFF', 'wp-super-cache');
    ?>
</strong> <span class="setting-description"><?php 
    _e('WP Cache and Super Cache disabled', 'wp-super-cache');
    ?>
</span></label><br />
	<p><label><input type='checkbox' name='wp_cache_not_logged_in' <?php 
    if ($wp_cache_not_logged_in) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Don&#8217;t cache pages for known users. (Logged in users and those that comment)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_hello_world' <?php 
    if ($wp_cache_hello_world) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Proudly tell the world your server is Digg proof! (places a message in your blog&#8217;s footer)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php 
    if ($wp_cache_clear_on_post_edit) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)', 'wp-super-cache');
    ?>
</label></p>
	<p><label><input type='checkbox' name='cache_rebuild_files' <?php 
    if ($cache_rebuild_files) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.', 'wp-super-cache');
    ?>
</label></p>
	<?php 
    if (false == defined('WPSC_DISABLE_LOCKING')) {
        ?>
		<p><label><input type='checkbox' name='wp_cache_mutex_disabled' <?php 
        if (!$wp_cache_mutex_disabled) {
            echo "checked";
        }
        ?>
 value='0'> <?php 
        _e('Coarse file locking. You probably don&#8217;t need this but it may help if your server is underpowered. Warning! <em>May cause your server to lock up in very rare cases!</em>', 'wp-super-cache');
        ?>
</label></p>
	<?php 
    }
    ?>
	<p><label><input type='checkbox' name='wp_supercache_cache_list' <?php 
    if ($wp_supercache_cache_list) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    _e('List the newest cached pages (may be expensive to run on busy sites, use with caution.)', 'wp-super-cache');
    ?>
</label>
	<p><label><input type='checkbox' name='wp_cache_mobile_enabled' <?php 
    if ($wp_cache_mobile_enabled) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    printf(__('Mobile device support.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wordpress-mobile-edition/');
    ?>
</label>
	<?php 
    $home_path = trailingslashit(get_home_path());
    $scrules = implode("\n", extract_from_markers($home_path . '.htaccess', 'WPSuperCache'));
    if (!$wp_cache_mobile_enabled && strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' '))) {
        echo "<blockquote style='background-color:#feefb3; padding: 5px; margin: 5px;'><h4>" . __('Mobile rewrite rules detected', 'wp-super-cache') . "</h4>";
        echo "<p>" . __('For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\\ MMP|240x320" and delete those.', 'wp-super-cache') . "</p><p>" . __('This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache') . "</p></blockquote>";
    } elseif ($wp_cache_mobile_enabled && $scrules != '' && (false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ')) || false === strpos($scrules, addcslashes(implode('|', $wp_cache_mobile_browsers), ' ')))) {
        ?>
	<blockquote style='background-color:#fefeb3; padding: 5px; margin: 5px;'><h4><?php 
        _e('Rewrite rules must be updated', 'wp-super-cache');
        ?>
</h4>
	<p><?php 
        _e('The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache');
        ?>
	<?php 
        _e('Mobile support requires extra rules in your .htaccess file, or you can set the plugin to half-on mode. Here are your options (in order of difficulty):', 'wp-super-cache');
        ?>
	<ol><li> <?php 
        _e('Set the plugin to half on mode and enable mobile support.', 'wp-super-cache');
        ?>
</li>
	<li> <?php 
        _e('Scroll down this page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache');
        ?>
</li>
	<li> <?php 
        printf(__('Delete the plugin mod_rewrite rules in %s.htaccess enclosed by <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code> and let the plugin regenerate them by reloading this page.', 'wp-super-cache'), $home_path);
        ?>
</li>
	<li> <?php 
        printf(__('Add the rules yourself. Edit %s.htaccess and find the block of code enclosed by the lines <code># BEGIN WPSuperCache</code> and <code># END WPSuperCache</code>. There are two sections that look very similar. Just below the line <code>%%{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$</code> add these lines: (do it twice, once for each section)', 'wp-super-cache'), $home_path);
        ?>
</p>
	<div style='padding: 2px; margin: 2px; border: 1px solid #333; width:400px; overflow: scroll'><pre>RewriteCond %{HTTP_user_agent} !^.*(<?php 
        echo addcslashes(implode('|', $wp_cache_mobile_browsers), ' ');
        ?>
).*
RewriteCond %{HTTP_user_agent} !^(<?php 
        echo addcslashes(implode('|', $wp_cache_mobile_prefixes), ' ');
        ?>
).*</pre></div></li></ol></blockquote>
	<?php 
    }
    ?>
	<?php 
    if ($_wp_using_ext_object_cache) {
        ?>
<p><label><input type='checkbox' name='wp_cache_object_cache' <?php 
        if ($wp_cache_object_cache) {
            echo "checked";
        }
        ?>
 value='1'> <?php 
        echo __('Use object cache to store cached files.', 'wp-super-cache') . ' ' . __('(Experimental)', 'wp-super-cache');
        ?>
</label></p><?php 
    }
    ?>
<p><label><input type='checkbox' name='wp_cache_refresh_single_only' <?php 
    if ($wp_cache_refresh_single_only) {
        echo "checked";
    }
    ?>
 value='1'> <?php 
    echo __('Only refresh current page when comments made.', 'wp-super-cache');
    ?>
</label></p> 
	<p><strong><?php 
    _e('Note:', 'wp-super-cache');
    ?>
</strong> <?php 
    printf(__('If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable too is probably a good idea!)', 'wp-super-cache'), WP_CONTENT_DIR);
    ?>
</p>
	<p><?php 
    printf(__('Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache'), WP_PLUGIN_URL);
    ?>
</p><?php 
    echo "<p><em>" . sprintf(__('Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache'), 'http://wordpress.org/extend/plugins/wp-super-cache/', 'http://wordpress.org/tags/wp-super-cache?forum_id=10') . "</em></p>";
    echo "<div class='submit'><input type='submit' " . SUBMITDISABLED . " value='" . __('Update Status', 'wp-super-cache') . " &raquo;' /></div>";
    wp_nonce_field('wp-cache');
    ?>
	</form>
	<?php 
    if ($cache_enabled) {
        echo '<a name="test"></a>';
        echo "<h3>" . __('Cache Tester', 'wp-super-cache') . "</h3>";
        echo '<p>' . __('Test your cached website by clicking the test button below.', 'wp-super-cache') . '</p>';
        if ($_POST['action'] == 'test' && $valid_nonce) {
            // Prime the cache
            echo "<p>";
            printf(__('Fetching %s to prime cache: ', 'wp-super-cache'), site_url());
            $page = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            sleep(1);
            // Get the first copy
            echo "<p>";
            printf(__('Fetching first copy of %s: ', 'wp-super-cache'), site_url());
            $page = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            sleep(1);
            // Get the second copy
            echo "<p>";
            printf(__('Fetching second copy of %s: ', 'wp-super-cache'), site_url());
            $page2 = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
            echo '<strong>' . __('OK', 'wp-super-cache') . '</strong>';
            echo "</p>";
            if (preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page['body'], $matches1) && preg_match('/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page2['body'], $matches2) && $matches1[2] == $matches2[2]) {
                echo '<p>' . sprintf(__('Page 1: %s', 'wp-super-cache'), $matches1[2]) . '</p>';
                echo '<p>' . sprintf(__('Page 2: %s', 'wp-super-cache'), $matches2[2]) . '</p>';
                echo '<p><strong>' . __('The timestamps on both pages match!', 'wp-super-cache') . '</strong></p>';
            } else {
                echo '<p><strong>' . __('The pages do not match! Timestamps differ or were not found!', 'wp-super-cache') . '</strong></p>';
            }
        }
        echo '<form name="cache_tester" action="#test" method="post">';
        echo '<input type="hidden" name="action" value="test" />';
        echo '<div class="submit"><input type="submit" name="test" value="' . __('Test Cache', 'wp-super-cache') . '" /></div>';
        wp_nonce_field('wp-cache');
        echo '</form>';
        echo '<a name="preload"></a>';
        echo "<h3>" . __('Preload Cache', 'wp-super-cache') . "</h3>";
        if ($super_cache_enabled == true && false == defined('DISABLESUPERCACHEPRELOADING')) {
            global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
            $count = $wpdb->get_var("SELECT count(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
            if ($count > 1000) {
                $min_refresh_interval = 720;
            } else {
                $min_refresh_interval = 30;
            }
            if ($_POST['action'] == 'preload' && $valid_nonce) {
                if ($_POST['posts_to_cache'] == 'all') {
                    $wp_cache_preload_posts = 'all';
                } else {
                    $wp_cache_preload_posts = (int) $_POST['posts_to_cache'];
                }
                wp_cache_replace_line('^ *\\$wp_cache_preload_posts', "\$wp_cache_preload_posts = '{$wp_cache_preload_posts}';", $wp_cache_config_file);
                if (isset($_POST['preload']) && $_POST['preload'] == __('Cancel Cache Preload', 'wp-super-cache')) {
                    $next_preload = wp_next_scheduled('wp_cache_preload_hook');
                    if ($next_preload) {
                        update_option('preload_cache_counter', 0);
                        wp_unschedule_event($next_preload, 'wp_cache_preload_hook');
                    }
                    echo "<p><strong>" . __('Scheduled preloading of cache cancelled. If a job is currently running it will not shutdown until the current 100 pages are complete.', 'wp-super-cache') . "</strong></p>";
                } elseif (isset($_POST['custom_preload_interval']) && ($_POST['custom_preload_interval'] == 0 || $_POST['custom_preload_interval'] >= $min_refresh_interval)) {
                    // if preload interval changes than unschedule any preload jobs and schedule any new one.
                    $_POST['custom_preload_interval'] = (int) $_POST['custom_preload_interval'];
                    if ($wp_cache_preload_interval != $_POST['custom_preload_interval']) {
                        $next_preload = wp_next_scheduled('wp_cache_full_preload_hook');
                        if ($next_preload) {
                            update_option('preload_cache_counter', 0);
                            add_option('preload_cache_stop', 1);
                            wp_unschedule_event($next_preload, 'wp_cache_full_preload_hook');
                            if ($wp_cache_preload_interval == 0) {
                                echo "<p><strong>" . __('Scheduled preloading of cache cancelled.', 'wp-super-cache') . "</strong></p>";
                            }
                        }
                        if ($_POST['custom_preload_interval'] != 0) {
                            wp_schedule_single_event(time() + $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                        }
                    }
                    $wp_cache_preload_interval = (int) $_POST['custom_preload_interval'];
                    wp_cache_replace_line('^ *\\$wp_cache_preload_interval', "\$wp_cache_preload_interval = {$wp_cache_preload_interval};", $wp_cache_config_file);
                    if (isset($_POST['preload_email_me'])) {
                        $wp_cache_preload_email_me = 1;
                    } else {
                        $wp_cache_preload_email_me = 0;
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_email_me', "\$wp_cache_preload_email_me = {$wp_cache_preload_email_me};", $wp_cache_config_file);
                    if (isset($_POST['wp_cache_preload_email_volume']) && in_array($_POST['wp_cache_preload_email_volume'], array('less', 'medium', 'many'))) {
                        $wp_cache_preload_email_volume = $_POST['wp_cache_preload_email_volume'];
                    } else {
                        $wp_cache_preload_email_volume = 'medium';
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_email_volume', "\$wp_cache_preload_email_volume = '{$wp_cache_preload_email_volume}';", $wp_cache_config_file);
                    if (isset($_POST['preload_on'])) {
                        $wp_cache_preload_on = 1;
                    } else {
                        $wp_cache_preload_on = 0;
                    }
                    wp_cache_replace_line('^ *\\$wp_cache_preload_on', "\$wp_cache_preload_on = {$wp_cache_preload_on};", $wp_cache_config_file);
                    if (isset($_POST['preload']) && $_POST['preload'] == __('Preload Cache Now', 'wp-super-cache')) {
                        update_option('preload_cache_counter', 0);
                        wp_schedule_single_event(time() + 10, 'wp_cache_preload_hook');
                        echo "<p><strong>" . __('Scheduled preloading of cache in 10 seconds.') . "</strong></p>";
                    } elseif ((int) $_POST['custom_preload_interval']) {
                        update_option('preload_cache_counter', 0);
                        wp_schedule_single_event(time() + (int) $_POST['custom_preload_interval'] * 60, 'wp_cache_full_preload_hook');
                        echo "<p><strong>" . sprintf(__('Scheduled preloading of cache in %d minutes', 'wp-super-cache'), (int) $_POST['custom_preload_interval']) . "</strong></p>";
                    }
                }
            }
            echo '<p>' . __('This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache') . '</p>';
            echo '<p>' . __('Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache') . '</p>';
            echo '<p>' . __('In &#8217;Preload Mode&#8217; regular garbage collection will only clean out old half-on files for known users, not the preloaded supercache files. This is a recommended setting when the cache is preloaded.', 'wp-super-cache') . '</p>';
            echo '<form name="cache_filler" action="#preload" method="POST">';
            echo '<input type="hidden" name="action" value="preload" />';
            echo '<input type="hidden" name="page" value="wpsupercache" />';
            echo '<p>' . sprintf(__('Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache'), "<input type='text' size=4 name='custom_preload_interval' value='" . (int) $wp_cache_preload_interval . "' />", $min_refresh_interval) . '</p>';
            if ($count > 1000) {
                $step = (int) ($count / 5);
                $select = "<select name='posts_to_cache' size=1>";
                $select .= "<option value='all' ";
                if (!isset($wp_cache_preload_posts) || $wp_cache_preload_posts == 'all') {
                    $checked = 'selectect=1 ';
                    $best = 'all';
                } else {
                    $checked = ' ';
                    $best = $wp_cache_preload_posts;
                }
                $select .= "{$checked}>" . __('all', 'wp-super-cache') . "</option>";
                for ($c = $step; $c < $count; $c += $step) {
                    $checked = ' ';
                    if ($best == $c) {
                        $checked = 'selected=1 ';
                    }
                    $select .= "<option value='{$c}'{$checked}>{$c}</option>";
                }
                $checked = ' ';
                if ($best == $count) {
                    $checked = 'selected=1 ';
                }
                $select .= "<option value='{$count}'{$checked}>{$count}</option>";
                $select .= "</select>";
                echo '<p>' . sprintf(__('Preload %s posts.', 'wp-super-cache'), $select) . '</p>';
            } else {
                echo '<input type="hidden" name="posts_to_cache" value="' . $count . '" />';
            }
            echo '<input type="checkbox" name="preload_on" value="1" ';
            echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
            echo ' /> ' . __('Preload mode (garbage collection only on half-on cache files. Recommended.)', 'wp-super-cache') . '<br />';
            echo '<input type="checkbox" name="preload_email_me" value="1" ';
            echo $wp_cache_preload_email_me == 1 ? 'checked=1' : '';
            echo ' /> ' . __('Send me status emails when files are refreshed.', 'wp-super-cache') . '<br />';
            if (!isset($wp_cache_preload_email_volume)) {
                $wp_cache_preload_email_volume = 'many';
            }
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="many" class="tog" ';
            checked('many', $wp_cache_preload_email_volume);
            echo '/> ' . __('Many emails, 2 emails per 100 posts.') . '<br >';
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="medium" class="tog" ';
            checked('medium', $wp_cache_preload_email_volume);
            echo '/> ' . __('Medium, 1 email per 100 posts.') . '<br >';
            echo '&nbsp;&nbsp;&nbsp;&nbsp;<input name="wp_cache_preload_email_volume" type="radio" value="less" class="tog" ';
            checked('less', $wp_cache_preload_email_volume);
            echo '/> ' . __('Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache') . '<br >';
            $currently_preloading = false;
            next_preload_message('wp_cache_preload_hook', 'Refresh of cache in %d hours %d minutes and %d seconds.', 60);
            next_preload_message('wp_cache_full_preload_hook', 'Full refresh of cache in %d hours %d minutes and %d seconds.');
            if ($preload_counter = get_option('preload_cache_counter')) {
                echo '<p><strong>' . sprintf(__('Currently caching from post %d to %d.', 'wp-super-cache'), $preload_counter, $preload_counter + 100) . '</strong></p>';
                $currently_preloading = true;
            }
            echo '<div class="submit"><input type="submit" name="preload" value="' . __('Update Settings', 'wp-super-cache') . '" />&nbsp;<input type="submit" name="preload" value="' . __('Preload Cache Now', 'wp-super-cache') . '" />';
            if ($currently_preloading) {
                echo '&nbsp;<input type="submit" name="preload" value="' . __('Cancel Cache Preload', 'wp-super-cache') . '" />';
            }
            echo '</div>';
            wp_nonce_field('wp-cache');
            echo '</form>';
        } else {
            echo '<p>' . __('Preloading of cache disabled. Please enable supercaching or talk to your host administrator.', 'wp-super-cache') . '</p>';
        }
    }
    if ($super_cache_enabled && function_exists('apache_get_modules')) {
        $mods = apache_get_modules();
        $required_modules = array('mod_mime' => __('Required to serve compressed supercache files properly.', 'wp-super-cache'), 'mod_headers' => __('Required to set caching information on supercache pages. IE7 users will see old pages without this module.', 'wp-super-cache'), 'mod_expires' => __('Set the expiry date on supercached pages. Visitors may not see new pages when they refresh or leave comments without this module.', 'wp-super-cache'));
        foreach ($required_modules as $req => $desc) {
            if (!in_array($req, $mods)) {
                $missing_mods[$req] = $desc;
            }
        }
        if (isset($missing_mods) && is_array($missing_mods)) {
            echo "<h3>" . __('Missing Apache Modules', 'wp-super-cache') . "</h3>";
            echo "<p>" . __('The following Apache modules are missing. The plugin will work in half-on mode without them. In full Supercache mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache') . "</p>";
            echo "<ul>";
            foreach ($missing_mods as $req => $desc) {
                echo "<li> {$req} - {$desc}</li>";
            }
            echo "</ul>";
        }
    }
    ?>
	</fieldset>
	</td><td valign='top'>
	<div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
	<h3 align='center'><?php 
    _e('Make WordPress Faster', 'wp-super-cache');
    ?>
</h3>
	<?php 
    if ($wp_cache_hide_donation != 1) {
        ?>
	<p><?php 
        printf(__('%1$s really makes your blog go faster. Make it go faster<sup>*</sup> by buying me an <a href="%2$s">Amazon gift card</a>! Make it out to "%3$s" for whatever amount you want. Every penny helps!', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a>', 'http://ocaoimh.ie/agc', '*****@*****.**');
        ?>
;</p>
	<p><?php 
        printf(__('If Amazon isn&#8217;t your thing, there&#8217;s also PayPal. Click the "Donate" button below or take a quick peek at my <a href="%s">wishlist</a>.', 'wp-super-cache'), 'http://ocaoimh.ie/wish');
        ?>
</p>
	<p><?php 
        _e('Thanks in advance!', 'wp-super-cache');
        ?>
<br />Donncha<br />
	<small>* <?php 
        _e('Ok, it won&#8217;t go any faster but you&#8217;ll make this plugin author very happy!', 'wp-super-cache');
        ?>
</small></p>
	<div align='center'>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
	<input type="hidden" name="cmd" value="_s-xclick"/>
	<input type="hidden" name="hosted_button_id" value="3244504"/>
	<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt=""/>
	<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/><br />
	</form>
	<p><?php 
        _e('Don&#8217;t show me this again.', 'wp-super-cache');
        ?>
 <form action="#top" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='<?php 
        _e('Hide', 'wp-super-cache');
        ?>
' /><?php 
        wp_nonce_field('wp-cache');
        ?>
</form></p>
	</div>
	<?php 
    } else {
        ?>
	<p><?php 
        printf(__('%1$s is maintained and developed by %2$s with contributions from many others.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a>', '<a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a>');
        ?>
</p>
	<p><?php 
        printf(__('He blogs at %1$s and posts photos at %2$s. He would really appreciate a <a href="%3$s">donation</a> to encourage development of this plugin.<br />Even a penny will help.', 'wp-super-cache'), '<a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>', '<a href="http://inphotos.org/?r=supercache">In Photos.org</a>', 'http://ocaoimh.ie/gad');
        ?>
</p>
	<p><?php 
        printf(__('Please say hi to him on %s too!', 'wp-super-cache'), '<a href="http://twitter.com/donncha/">Twitter</a>');
        ?>
</p>
	<?php 
    }
    if (isset($wp_supercache_cache_list) && $wp_supercache_cache_list) {
        $start_date = get_option('wpsupercache_start');
        if (!$start_date) {
            $start_date = time();
        }
        ?>
		<p><?php 
        printf(__('Cached pages since %1$s : <strong>%2$s</strong>', 'wp-super-cache'), date('M j, Y', $start_date), number_format(get_option('wpsupercache_count')));
        ?>
</p>
		<p><?php 
        _e('Newest Cached Pages:', 'wp-super-cache');
        ?>
<ol>
		<?php 
        foreach (array_reverse((array) get_option('supercache_last_cached')) as $url) {
            $since = time() - strtotime($url['date']);
            echo "<li><a title='" . sprintf(__('Cached %s seconds ago', 'wp-super-cache'), $since) . "' href='" . site_url($url['url']) . "'>{$url['url']}</a></li>\n";
        }
        ?>
</ol>
		<small><?php 
        _e('(may not always be accurate on busy sites)', 'wp-super-cache');
        ?>
</small>
		</p><?php 
    } else {
        $start_date = get_option('wpsupercache_start');
        if ($start_date) {
            update_option('wpsupercache_start', $start_date);
            update_option('wpsupercache_count', 0);
        }
    }
    ?>
	</div>

	</td></table>
	<?php 
    wp_cache_files();
    wsc_mod_rewrite();
    wp_cache_edit_max_time();
    echo '<a name="files"></a><fieldset class="options"><h3>' . __('Accepted Filenames &amp; Rejected URIs', 'wp-super-cache') . '</h3>';
    wp_cache_edit_rejected_pages();
    echo "\n";
    wp_cache_edit_rejected();
    echo "\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_debug_settings();
    wp_lock_down();
    wp_cache_restore();
    ob_start();
    if (defined('WP_CACHE')) {
        if (function_exists('do_cacheaction')) {
            do_cacheaction('cache_admin_page');
        }
    }
    $out = ob_get_contents();
    ob_end_clean();
    if (SUBMITDISABLED == ' ' && $out != '') {
        echo '<fieldset class="options"><h3>' . __('Cache Plugins', 'wp-super-cache') . '</h3>';
        echo $out;
        echo '</fieldset>';
    }
    echo "</div>\n";
}
function wp_cache_manager()
{
    global $wp_cache_config_file, $valid_nonce;
    $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache');
    echo '<div class="wrap">';
    echo "<h2>WP-Cache Manager</h2>\n";
    if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) {
        unlink($wp_cache_config_file);
        echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Options" menu to reset them.</strong>';
    }
    echo '<a name="main"></a><fieldset class="options"><legend>Main options</legend>';
    if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) {
        echo "<br>Cannot continue... fix previous problems and retry.<br />";
        echo "</fieldset></div>\n";
        return;
    }
    if (!wp_cache_check_global_config()) {
        echo "</fieldset></div>\n";
        return;
    }
    if ($valid_nonce) {
        if (isset($_REQUEST['wp_enable'])) {
            wp_cache_enable();
        } elseif (isset($_REQUEST['wp_disable'])) {
            wp_cache_disable();
        }
    }
    echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">';
    if (wp_cache_is_enabled()) {
        echo '<strong>WP-Cache is Enabled</strong>';
        echo '<input type="hidden" name="wp_disable" />';
        echo '<div class="submit"><input type="submit"value="Disable it" /></div>';
    } else {
        echo '<strong>WP-Cache is Disabled</strong>';
        echo '<input type="hidden" name="wp_enable" />';
        echo '<div class="submit"><input type="submit" value="Enable it" /></div>';
    }
    wp_nonce_field('wp-cache');
    echo "</form>\n";
    wp_cache_edit_max_time();
    echo '</fieldset>';
    echo '<a name="files"></a><fieldset class="options"><legend>Accepted filenames, rejected URIs</legend>';
    wp_cache_edit_rejected();
    echo "<br />\n";
    wp_cache_edit_accepted();
    echo '</fieldset>';
    wp_cache_edit_rejected_ua();
    wp_cache_files();
    wp_cache_restore();
    echo "</div>\n";
}