: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// mobile_groups = array( 'apple' => array( 'ipod', 'iphone' ), 'nokia' => array( 'nokia5800', 'symbianos' ) );
$wp_cache_mobile_browsers = implode( ', ', $wp_cache_mobile_browsers );
$wp_cache_mobile_prefixes = implode( ', ', $wp_cache_mobile_prefixes );
if ( false == apply_filters( 'wp_super_cache_error_checking', true ) )
if ( function_exists( 'get_supercache_dir' ) )
$supercachedir = get_supercache_dir();
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 ) {
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];
// 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 h4").css("cursor","pointer").on("click",function(){
jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
border-bottom: 1px solid #ccc;
table.wpsc-settings-table {
<div id="wpsc-dashboard">
echo '<div class="wpsc-body">';
echo '<a name="top"></a>';
if ( false === $cache_enabled && ! isset( $wp_cache_mod_rewrite ) ) {
$wp_cache_mod_rewrite = 0;
} elseif ( ! isset( $wp_cache_mod_rewrite ) && $cache_enabled && $super_cache_enabled ) {
$wp_cache_mod_rewrite = 1;
$admin_url = admin_url( 'options-general.php?page=wpsupercache' );
$curr_tab = ! empty( $_GET['tab'] ) ? sanitize_text_field( stripslashes( $_GET['tab'] ) ) : ''; // WPCS: sanitization ok.
if ( empty( $curr_tab ) ) {
if ( $wp_cache_mod_rewrite ) {
echo '<div class="notice notice-info is-dismissible"><p>' . __( 'Notice: <em>Expert mode caching enabled</em>. Showing Advanced Settings Page by default.', 'wp-super-cache' ) . '</p></div>';
if ( 'preload' === $curr_tab ) {
if ( true == $super_cache_enabled && ! defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
global $wp_cache_preload_interval, $wp_cache_preload_on, $wp_cache_preload_taxonomies, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $wp_cache_preload_posts, $wpdb;
$currently_preloading = false;
echo '<div id="wpsc-preload-status"></div>';
wpsc_admin_tabs( $curr_tab );
echo '<div class="wpsc-body-content wrap">';
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' );
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>' . esc_html__( '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 );
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( array_key_exists( 'path', $home_path ) ? $home_path['path'] : '' );
if ( ! isset( $wp_cache_home_path ) ) {
$wp_cache_home_path = '/';
wp_cache_setting( 'wp_cache_home_path', '/' );
if ( "$home_path" != "$wp_cache_home_path" ) {
wp_cache_setting( 'wp_cache_home_path', $home_path );
if ( $wp_cache_mobile_enabled == 1 ) {
update_cached_mobile_ua_list( $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $mobile_groups );
margin: 2px 1.25rem 1.25rem 0;
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.03), 0px 1px 2px rgba(0, 0, 0, 0.03);
border: 1px solid #d5d5d5;
.wpsc-boost-banner-inner {
grid-template-columns: minmax(auto, 750px) 500px;
justify-content: space-between;
.wpsc-boost-banner-content {
.wpsc-boost-banner-image-container {
background-image: url( <?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/jetpack-colors.svg' ); ?> );
.wpsc-boost-banner-image-container img {
transform: translateY(-50%);
.wpsc-boost-banner .wpsc-boost-dismiss {
.wpsc-boost-banner .button-primary {
.wpsc-boost-banner .button-primary:hover {
.wpsc-boost-banner .button-primary:visited {
<table class="wpsc-settings-table"><td valign="top">
wpsc_jetpack_boost_install_banner();
echo '<a name="test"></a>';
'wp_cache_preload_interval',
'wp_cache_preload_taxonomies',
'wp_cache_preload_email_me',
'wp_cache_preload_email_volume',
global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $wp_cache_debug_ip;
global $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification;
global $wp_super_cache_advanced_debug, $wp_cache_debug_username, $wp_super_cache_front_page_clear;
compact( 'wp_super_cache_debug', 'wp_cache_debug_log', 'wp_cache_debug_ip', 'cache_path', 'valid_nonce', 'wp_cache_config_file', 'wp_super_cache_comments', 'wp_super_cache_front_page_check', 'wp_super_cache_front_page_clear', 'wp_super_cache_front_page_text', 'wp_super_cache_front_page_notification', 'wp_super_cache_advanced_debug', 'wp_cache_debug_username', 'wp_cache_home_path' )
global $cache_acceptable_files, $wpsc_rejected_cookies, $cache_rejected_uri, $wp_cache_pages;
global $cache_max_time, $wp_cache_config_file, $valid_nonce, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on;
wp_cache_update_rejected_pages();
wp_cache_update_rejected_cookies();
wp_cache_update_rejected_strings();
wp_cache_update_accepted_strings();
'wp_cache_front_page_checks',
'wp_cache_not_logged_in',
'wp_cache_no_cache_for_get',
'wp_cache_make_known_anon',
'wp_cache_mfunc_enabled',
'wp_cache_mobile_enabled',
'wp_cache_mobile_browsers',
'wp_cache_clear_on_post_edit',
'wp_cache_front_page_checks',
'wp_cache_refresh_single_only',
'wp_supercache_cache_list',
'wp_cache_mutex_disabled',
'wp_super_cache_late_init',
'cache_acceptable_files',
'cache_schedule_interval',
'wp_cache_mobile_prefixes',
wpsc_edit_tracking_parameters();
'admin_url' => $admin_url,
'cache_enabled' => $cache_enabled,
'wp_cache_mod_rewrite' => $wp_cache_mod_rewrite,
'valid_nonce' => $valid_nonce,
'cache_path' => $cache_path,
'wp_super_cache_comments' => $wp_super_cache_comments,
</td><td valign='top' style='width: 300px'>
<!-- TODO: Hide #wpsc-callout from all pages except the Easy tab -->
<div class="wpsc-card" id="wpsc-callout">
<?php if ( ! empty( $wpsc_promo_links ) && is_array( $wpsc_promo_links ) ) : ?>
<h4><?php esc_html_e( 'Other Site Tools', 'wp-super-cache' ); ?></h4>
<ul style="list-style: square; margin-left: 2em;">
<li><a href="<?php echo esc_url( $wpsc_promo_links['boost'] ); ?>"><?php esc_html_e( 'Boost your page speed scores', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['photon'] ); ?>"><?php esc_html_e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['videopress'] ); ?>"><?php esc_html_e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
<li><a href="<?php echo esc_url( $wpsc_promo_links['crowdsignal'] ); ?>"><?php esc_html_e( 'Add Surveys and Polls to your site', 'wp-super-cache' ); ?></a></li>
<h4><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h4>
<li><?php printf( __( 'Use the <a href="%1$s">Debug tab</a> for diagnostics.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache&tab=debug' ) ); ?></li>
/* translators: %s is the URL for the documentation. */
__( 'Check out the <a href="%s">plugin documentation</a>.', 'wp-super-cache' ),
'https://jetpack.com/support/wp-super-cache/'
/* translators: %1$s is the URL for the support forum. */
__( 'Visit the <a href="%1$s">support forum</a>.', 'wp-super-cache' ),
'https://wordpress.org/support/plugin/wp-super-cache/'
<li><?php printf( __( 'Try out the <a href="%1$s">development version</a> for the latest fixes (<a href="%2$s">changelog</a>).', 'wp-super-cache' ), 'https://odd.blog/y/2o', 'https://plugins.trac.wordpress.org/log/wp-super-cache/' ); ?></li>
<h4><?php esc_html_e( 'Rate This Plugin', 'wp-super-cache' ); ?></h4>
<p><?php printf( __( 'Please <a href="%s">rate us</a> and give feedback.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache/reviews?rate=5#new-post' ); ?></p>
if ( isset( $wp_supercache_cache_list ) && $wp_supercache_cache_list ) {
$start_date = get_option( 'wpsupercache_start' );
<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>
foreach ( array_reverse( (array) get_option( 'supercache_last_cached' ) ) as $url ) {
$since = time() - strtotime( $url['date'] );
echo "<li><a title='" . sprintf( esc_html__( 'Cached %s seconds ago', 'wp-super-cache' ), (int) $since ) . "' href='" . site_url( $url['url'] ) . "'>" . substr( $url['url'], 0, 20 ) . "</a></li>\n";
<small><?php esc_html_e( '(may not always be accurate on busy sites)', 'wp-super-cache' ); ?></small>
} elseif ( false == get_option( 'wpsupercache_start' ) ) {
update_option( 'wpsupercache_start', time() );
update_option( 'wpsupercache_count', 0 );
<?php wpsc_render_footer(); ?>
function wpsc_plugins_tab() {
echo '<div class="wpsc-card">';
echo '<p>' . esc_html__( 'Cache plugins are PHP scripts you\'ll find in a dedicated folder inside the WP Super Cache folder (wp-super-cache/plugins/). They load at the same time as WP Super Cache, and before regular WordPress plugins.', 'wp-super-cache' ) . '</p>';
echo '<p>' . esc_html__( 'Keep in mind that cache plugins are for advanced users only. To create and manage them, you\'ll need extensive knowledge of both PHP and WordPress actions.', 'wp-super-cache' ) . '</p>';
echo '<p>' . sprintf( __( '<strong>Warning</strong>! Due to the way WordPress upgrades plugins, the ones you upload to the WP Super Cache folder (wp-super-cache/plugins/) will be deleted when you upgrade WP Super Cache. To avoid this loss, load your cache plugins from a different location. When you set <strong>$wp_cache_plugins_dir</strong> to the new location in wp-config.php, WP Super Cache will look there instead. <br />You can find additional details in the <a href="%s">developer documentation</a>.', 'wp-super-cache' ), 'https://odd.blog/wp-super-cache-developers/' ) . '</p>';
echo '<div class="wpsc-card">';
if ( defined( 'WP_CACHE' ) ) {
if ( function_exists( 'do_cacheaction' ) ) {
do_cacheaction( 'cache_admin_page' );
$out = ob_get_contents();
if ( SUBMITDISABLED == ' ' && $out != '' ) {
echo '<h4>' . esc_html__( 'Available Plugins', 'wp-super-cache' ) . '</h4>';
function wpsc_admin_tabs( $current = '' ) {
global $cache_enabled, $super_cache_enabled, $wp_cache_mod_rewrite;
$current = ! empty( $_GET['tab'] ) ? stripslashes( $_GET['tab'] ) : ''; // WPCS: CSRF ok, sanitization ok.
$admin_url = admin_url( 'options-general.php?page=wpsupercache' );
'easy' => __( 'Easy', 'wp-super-cache' ),
'settings' => __( 'Advanced', 'wp-super-cache' ),
'cdn' => __( 'CDN', 'wp-super-cache' ),
'contents' => __( 'Contents', 'wp-super-cache' ),
'preload' => __( 'Preload', 'wp-super-cache' ),
'plugins' => __( 'Plugins', 'wp-super-cache' ),
'debug' => __( 'Debug', 'wp-super-cache' ),
echo '<div class="wpsc-nav-container"><ul class="wpsc-nav">';
foreach ( $admin_tabs as $tab => $name ) {
'<li class="%s"><a href="%s">%s</a></li>',
esc_attr( $tab === $current ? 'wpsc-nav-tab wpsc-nav-tab-selected' : 'wpsc-nav-tab' ),
esc_url_raw( add_query_arg( 'tab', $tab, $admin_url ) ),
function wpsc_restore_settings() {
$admin_url = admin_url( 'options-general.php?page=wpsupercache' );
function comment_form_lockdown_message() {
?><p><?php _e( "Comment moderation is enabled. Your comment may take some time to appear.", 'wp-super-cache' ); ?></p><?php
if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) )
add_action( 'comment_form', 'comment_form_lockdown_message' );
function wp_update_lock_down() {
global $cache_path, $wp_cache_config_file, $valid_nonce;
if ( isset( $_POST[ 'wp_lock_down' ] ) && $valid_nonce ) {
$wp_lock_down = $_POST[ 'wp_lock_down' ] == '1' ? '1' : '0';
wp_cache_replace_line( '^.*WPLOCKDOWN', "if ( ! defined( 'WPLOCKDOWN' ) ) define( 'WPLOCKDOWN', '$wp_lock_down' );", $wp_cache_config_file );
if ( false == defined( 'WPLOCKDOWN' ) )
define( 'WPLOCKDOWN', $wp_lock_down );
if ( $wp_lock_down == '0' && function_exists( 'prune_super_cache' ) )
prune_super_cache( $cache_path, true ); // clear the cache after lockdown
if ( defined( 'WPLOCKDOWN' ) )
return constant( 'WPLOCKDOWN' );
function wpsc_update_direct_pages() {
global $cached_direct_pages, $valid_nonce, $cache_path, $wp_cache_config_file;
if ( false == isset( $cached_direct_pages ) )
$cached_direct_pages = array();
if ( $valid_nonce && array_key_exists('direct_pages', $_POST) && is_array( $_POST[ 'direct_pages' ] ) && !empty( $_POST[ 'direct_pages' ] ) ) {
$expiredfiles = array_diff( $cached_direct_pages, $_POST[ 'direct_pages' ] );
unset( $cached_direct_pages );
foreach( $_POST[ 'direct_pages' ] as $page ) {
$page = str_replace( '..', '', preg_replace( '/[ <>\'\"\r\n\t\(\)\$\[\];#]/', '', $page ) );
$cached_direct_pages[] = $page;