=' ) ) { return current_user_can( 'setup_network' ); } return is_super_admin(); } function wp_cache_add_pages() { if ( wpsupercache_site_admin() ) { // In single or MS mode add this menu item too, but only for superadmins in MS mode. add_options_page( 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager' ); } } add_action( 'admin_menu', 'wp_cache_add_pages' ); function wp_cache_network_pages() { add_submenu_page( 'settings.php', 'WP Super Cache', 'WP Super Cache', 'manage_options', 'wpsupercache', 'wp_cache_manager' ); } add_action( 'network_admin_menu', 'wp_cache_network_pages' ); function wp_cache_manager_error_checks() { global $wp_cache_debug, $wp_cache_cron_check, $cache_enabled, $super_cache_enabled, $wp_cache_config_file, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes, $wp_cache_mobile_browsers, $wp_cache_mobile_enabled, $wp_cache_mod_rewrite; global $dismiss_htaccess_warning, $dismiss_readable_warning, $dismiss_gc_warning, $wp_cache_shutdown_gc, $is_nginx; global $htaccess_path; if ( ! wpsupercache_site_admin() ) { return false; } if ( PHP_VERSION_ID < 50300 && ( ini_get( 'safe_mode' ) === '1' || strtolower( ini_get( 'safe_mode' ) ) === 'on' ) ) { // @codingStandardsIgnoreLine echo '
' . esc_html__( 'You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache' ) . '
';
if ( ! ini_get( 'safe_mode_gid' ) ) { // @codingStandardsIgnoreLine
esc_html_e( 'Your server is set up to check the owner of PHP scripts before allowing them to read and write files.', 'wp-super-cache' );
echo '
';
printf( __( '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 safe mode manual page for further details.', 'wp-super-cache' ), esc_attr( WP_CONTENT_DIR ) );
} else {
_e( 'You or an administrator must disable this. See the safe mode manual page 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' );
}
echo '
" . __( 'A custom url or permalink structure is required for this plugin to work correctly. Please go to the Permalinks Options Page to configure your permalinks.', 'wp-super-cache' ) . "
"; echo 'Troubleshooting section of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?>
Troubleshooting section of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?>
define( 'WP_CACHE', true );
define( 'WPCACHEHOME', '" . dirname( __FILE__ ) . "/' );
this page for instructions on modifying your php.ini.', 'wp-super-cache' ); ?>
%s/wp-cache-config.php and cannot be modified. That file must be writeable by the web server to make any changes.', 'wp-super-cache' ), WP_CONTENT_DIR ); ?>
This page explains how to change file permissions.', 'wp-super-cache' ); ?>
chmod 666 /wp-cache-config.php
chmod 644 /wp-cache-config.php
this form to enable it.', 'wp-super-cache' ); ?>
chmod 755 /
This page explains how to change file permissions.', 'wp-super-cache' ); ?>
" . __( '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' ) . "
" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "
"; } elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && ( ( '' != $wp_cache_mobile_prefixes && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) ) ) || ( '' != $wp_cache_mobile_browsers && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) ) ) { ?>
# END WPSuperCache
and let the plugin regenerate them by reloading this page.', 'wp-super-cache' ), $home_path ); ?># END WPSuperCache
. There are two sections that look very similar. Just below the line %%{HTTP:Cookie} !^.*(comment_author_|%s|wp-postpass_).*$
add these lines: (do it twice, once for each section)', 'wp-super-cache' ), $home_path, wpsc_get_logged_in_cookie() ); ?>
Update Mod_Rewrite Rules button.', 'wp-super-cache' ); ?>
here. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.
When you update the rewrite rules in this plugin you will have to copy the file to where your site is hosted. This will be fixed in the future.', 'wp-super-cache' ); ?>
zlib.output_compression
is enabled. See #21 in the Troubleshooting section of the readme file.", 'wp-super-cache' ) . '';
} else {
if ( $new_cache_compression != $cache_compression ) {
$cache_compression = $new_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( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpsupercache' )
add_action( 'admin_init', 'wp_cache_manager_updates' );
function wp_cache_manager() {
global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled;
global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers, $wp_cache_no_cache_for_get;
global $wp_cache_not_logged_in, $wp_cache_make_known_anon, $wp_supercache_cache_list, $cache_page_secret;
global $wp_super_cache_front_page_check, $wp_cache_refresh_single_only, $wp_cache_mobile_prefixes;
global $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $wp_cache_disable_utf8, $wp_cache_mfunc_enabled;
global $wp_super_cache_comments, $wp_cache_home_path, $wpsc_save_headers, $is_nginx;
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', 'iPad', '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
if ( function_exists( 'do_cacheaction' ) ) {
$wp_cache_mobile_browsers = do_cacheaction( 'wp_super_cache_mobile_browsers', $wp_cache_mobile_browsers );
$wp_cache_mobile_prefixes = do_cacheaction( 'wp_super_cache_mobile_prefixes', $wp_cache_mobile_prefixes );
}
$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' ) );
$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 ) )
return false;
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 */
?>
';
echo '' . __( 'Notice: Expert mode caching enabled. Showing Advanced Settings Page by default.', 'wp-super-cache' ) . '
' . sprintf( esc_html__( 'Currently caching from post %d to %d.', 'wp-super-cache' ), ( $preload_counter['c'] - 100 ), $preload_counter['c'] ) . '
'; $currently_preloading = true; if ( @file_exists( $cache_path . 'preload_permalink.txt' ) ) { $url = file_get_contents( $cache_path . 'preload_permalink.txt' ); $msg .= '' . sprintf( __( 'Page last cached: %s', 'wp-super-cache' ), $url ) . '
'; } if ( $msg != '' ) { echo '
';
wp_cache_files();
break;
case 'preload':
if ( ! $cache_enabled ) {
wp_die( esc_html__( 'Caching must be enabled to use this feature', 'wp-super-cache' ) );
}
echo '';
if ( $super_cache_enabled == true && false == defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
echo ' ' . __( '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' ) . ' '; echo '' . __( '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' ) . ' '; echo '' . __( 'In ’Preload Mode’ regular garbage collection will be disabled so that old cache files are not deleted. This is a recommended setting when the cache is preloaded.', 'wp-super-cache' ) . ' '; echo ''; echo ''; } else { echo '' . __( 'Preloading of cache disabled. Please make sure simple or expert mode is enabled or talk to your host administrator.', 'wp-super-cache' ) . ' ' . esc_html__( 'Cache Tester', 'wp-super-cache' ) . ''; echo '' . esc_html__( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . ' '; echo '' . __( 'Note: if you use Cloudflare or other transparent front-end proxy service this test may fail.
' . sprintf( $message, $url ); $page[ $c ] = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) ); if ( ! is_wp_error( $page[ $c ] ) ) { $fp = fopen( $cache_path . $c . '.html', 'w' ); fwrite( $fp, $page[ $c ]['body'] ); fclose( $fp ); echo '' . esc_html__( 'OK', 'wp-super-cache' ) . " (" . $c . '.html) '; sleep( 1 ); } else { $cache_test_error = true; echo '' . esc_html__( 'FAILED', 'wp-super-cache' ) . ''; $errors = ''; $messages = ''; foreach ( $page[ $c ]->get_error_codes() as $code ) { $severity = $page[ $c ]->get_error_data( $code ); foreach ( $page[ $c ]->get_error_messages( $code ) as $err ) { $errors .= $severity . ': ' . $err . "\n"; } } if ( ! empty( $errors ) ) { echo ' ' . sprintf( __( 'Errors: %s', 'wp-super-cache' ), $errors ) . ' '; } } $c ++; } if ( false == $cache_test_error ) { echo '
' . sprintf( esc_html__( 'Page 1: %s', 'wp-super-cache' ), $matches1[2] ) . ' '; echo '' . sprintf( esc_html__( 'Page 2: %s', 'wp-super-cache' ), $matches2[2] ) . ' '; echo '' . esc_html__( 'The timestamps on both pages match!', 'wp-super-cache' ) . ' '; } else { echo '' . esc_html__( 'The pages do not match! Timestamps differ or were not found!', 'wp-super-cache' ) . ' '; echo '' . esc_html__( 'Things you can do:', 'wp-super-cache' ) . ' '; echo '
' . esc_html__( 'Delete Cached Pages', 'wp-super-cache' ) . ''; echo '' . esc_html__( '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' ) . ' '; echo '\n"; if ( is_multisite() && wpsupercache_site_admin() ) { echo '\n"; } ?>
|
rate us and give feedback.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache/reviews?rate=5#new-post' ); ?> %2$s', 'wp-super-cache' ), date( 'M j, Y', $start_date ), number_format( get_option( 'wpsupercache_count' ) ) ); ?>
|
' . 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' ) . '
'; echo '' . 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' ) . '
'; echo '' . sprintf( __( 'Warning! 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 $wp_cache_plugins_dir to the new location in wp-config.php, WP Super Cache will look there instead.
You can find additional details in the developer documentation.', 'wp-super-cache' ), 'https://odd.blog/wp-super-cache-developers/' ) . '
" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "
\n"; } else { global $update_mod_rewrite_rules_error; echo "" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s.
The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, "" . $update_mod_rewrite_rules_error . "" ) . "
" . esc_html( $rules ) . "\n
Click the following link to see the lines added to that file. If you have upgraded the plugin, make sure these rules match.', 'wp-super-cache' ), $home_path ); ?>
"; if ( $rules != $scrules ) echo '# BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache\n"; echo "
" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "
"; echo "# BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache"; echo ''; } ?>