wp_cache_manager() │ WPSCache 1.0
Хуки из функции
Возвращает
null
. Ничего.
Использование
wp_cache_manager();
Код wp_cache_manager() wp cache manager WPSCache 1.9.4
<?php 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; global $wpsc_promo_links; 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 */ ?> <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 h4").css("cursor","pointer").on("click",function(){ jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow"); }); }); </script> <style type='text/css'> #nav h3 { border-bottom: 1px solid #ccc; padding-bottom: 0; height: 1.5em; } table.wpsc-settings-table { clear: both; } </style> <?php echo '<a name="top"></a>'; echo '<div class="wrap">'; echo '<h3>' . __( 'WP Super Cache Settings', 'wp-super-cache' ) . '</h3>'; // Set a default. 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 ) ) { $curr_tab = 'easy'; if ( $wp_cache_mod_rewrite ) { $curr_tab = 'settings'; 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; $count = wpsc_post_count(); if ( $count > 1000 ) { $min_refresh_interval = 720; } else { $min_refresh_interval = 30; } $return = wpsc_preload_settings( $min_refresh_interval ); $msg = ''; if ( empty( $return ) == false ) { foreach ( $return as $message ) { $msg .= $message; } } $currently_preloading = false; $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 ) { $msg .= '<p>' . sprintf( esc_html__( 'Currently caching from post %d to %d.', 'wp-super-cache' ), ( $preload_counter['c'] - 100 ), $preload_counter['c'] ) . '</p>'; $currently_preloading = true; if ( @file_exists( $cache_path . 'preload_permalink.txt' ) ) { $url = file_get_contents( $cache_path . 'preload_permalink.txt' ); $msg .= '<p>' . sprintf( __( '<strong>Page last cached:</strong> %s', 'wp-super-cache' ), '<span id="preload_status">' . $url . '</span>' ) . '</p>'; } if ( $msg != '' ) { echo '<div class="notice notice-warning"><h4>' . esc_html__( 'Preload Active', 'wp-super-cache' ) . '</h4>' . $msg; echo '<form name="do_preload" action="' . esc_url_raw( add_query_arg( 'tab', 'preload', $admin_url ) ) . '" method="POST">'; echo '<input type="hidden" name="action" value="preload" />'; echo '<input type="hidden" name="page" value="wpsupercache" />'; echo '<p><input class="button-primary" type="submit" name="preload_off" value="' . esc_html__( 'Cancel Cache Preload', 'wp-super-cache' ) . '" /></p>'; wp_nonce_field( 'wp-cache' ); echo '</form>'; echo '</div>'; } } 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' ) ); } } wpsc_admin_tabs( $curr_tab ); 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 ); } 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( 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 ); } ?> <style> .wpsc-boost-banner { 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; position: relative; } .wpsc-boost-banner-inner { display: flex; grid-template-columns: minmax(auto, 750px) 500px; justify-content: space-between; min-height: 300px; background: #fff; overflow: hidden; } .wpsc-boost-banner-content { display: inline-flex; flex-direction: column; padding: 2rem 3rem 2rem 2rem; text-align: left; } .wpsc-boost-banner-image-container { position: relative; background-image: url( <?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/jetpack-colors.svg' ); ?> ); background-size: cover; max-width: 40%; overflow: hidden; } .wpsc-boost-banner-image-container img { position: relative; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; } .wpsc-boost-banner p { font-size: 16px; line-height: 1.5; margin: 1rem 0 2rem; } .wpsc-boost-banner .wpsc-boost-dismiss { position: absolute; top: 10px; right: 10px; color: black; cursor:pointer; } .wpsc-boost-banner .button-primary { background: black; border-color: black; color: #fff; width: fit-content; padding: 0.4rem 1rem; font-size: 16px; } .wpsc-boost-banner .button-primary:hover { background-color: #333; } .wpsc-boost-banner .button-primary:visited { background-color: black; border-color: black; } </style> <table class="wpsc-settings-table"><td valign="top"> <?php wpsc_jetpack_boost_install_banner(); switch ( $curr_tab ) { case 'cdn': scossdl_off_options(); break; case 'tester': case 'contents': echo '<a name="test"></a>'; wp_cache_files(); break; case 'preload': wpsc_render_partial( 'preload', compact( 'cache_enabled', 'super_cache_enabled', 'admin_url', 'wp_cache_preload_interval', 'wp_cache_preload_on', 'wp_cache_preload_taxonomies', 'wp_cache_preload_email_me', 'wp_cache_preload_email_volume', 'currently_preloading', 'wp_cache_preload_posts' ) ); break; case 'plugins': wpsc_plugins_tab(); break; case 'debug': 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; wpsc_render_partial( 'debug', 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' ) ); break; case 'settings': 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_time_update(); wpsc_render_partial( 'advanced', compact( 'wp_cache_front_page_checks', 'admin_url', 'cache_enabled', 'super_cache_enabled', 'wp_cache_mod_rewrite', 'is_nginx', 'wp_cache_not_logged_in', 'wp_cache_no_cache_for_get', 'cache_compression', 'cache_rebuild_files', 'wpsc_save_headers', 'wp_supercache_304', 'wp_cache_make_known_anon', 'wp_cache_mfunc_enabled', 'wp_cache_mobile_enabled', 'wp_cache_mobile_browsers', 'wp_cache_disable_utf8', '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_page_secret', 'cache_path', 'cache_acceptable_files', 'wpsc_rejected_cookies', 'cache_rejected_uri', 'wp_cache_pages', 'cache_max_time', 'valid_nonce', 'super_cache_enabled', 'cache_schedule_type', 'cache_scheduled_time', 'cache_schedule_interval', 'cache_time_interval', 'cache_gc_email_me', 'wp_cache_mobile_prefixes', 'wp_cache_preload_on' ) ); wpsc_edit_tracking_parameters(); wpsc_edit_rejected_ua(); wpsc_lockdown(); wpsc_restore_settings(); break; case 'easy': default: wpsc_render_partial( 'easy', array( 'admin_url' => $admin_url, 'cache_enabled' => $cache_enabled, 'is_nginx' => $is_nginx, 'wp_cache_mod_rewrite' => $wp_cache_mod_rewrite, 'valid_nonce' => $valid_nonce, 'cache_path' => $cache_path, 'wp_super_cache_comments' => $wp_super_cache_comments, ) ); break; } ?> </fieldset> </td><td valign='top' style='width: 300px'> <div id="wpsc-callout" style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 3px 15px'> <h4><?php _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> </ul> <h4><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h4> <ol> <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> <li><?php printf( __( 'Check out the <a href="%1$s">support forum</a> and <a href="%2$s">FAQ</a>.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache', 'https://wordpress.org/plugins/wp-super-cache/#faq' ); ?></li> <li><?php printf( __( 'Visit the <a href="%1$s">plugin homepage</a>.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/' ); ?></li> <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> </ol> <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> <?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( esc_html__( 'Cached %s seconds ago', 'wp-super-cache' ), (int) $since ) . "' href='" . site_url( $url['url'] ) . "'>" . substr( $url['url'], 0, 20 ) . "</a></li>\n"; } ?> </ol> <small><?php esc_html_e( '(may not always be accurate on busy sites)', 'wp-super-cache' ); ?></small> </p><?php } elseif ( false == get_option( 'wpsupercache_start' ) ) { update_option( 'wpsupercache_start', time() ); update_option( 'wpsupercache_count', 0 ); } ?> </div> </td></table> <?php echo "</div>\n"; }