WordPress.org

Plugin Directory

Changeset 696583


Ignore:
Timestamp:
04/12/13 13:59:16 (13 months ago)
Author:
donncha
Message:

Disable mfunc and related tags. Add an option on the settings page.

Location:
wp-super-cache/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-super-cache/trunk/wp-cache-phase2.php

    r633396 r696583  
    500500    $oc_key = get_oc_key(); 
    501501    if ( preg_match( '/<!--mclude|<!--mfunc|<!--dynamic-cached-content-->/', $buffer ) ) { //Dynamic content 
    502         if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Dynamic content found in buffer.", 4 ); 
    503         $store = preg_replace('|<!--mclude (.*?)-->(.*?)<!--/mclude-->|is', 
     502        if ( !isset( $wp_cache_mfunc_enabled ) || $wp_cache_mfunc_enabled == 0 ) { 
     503            if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Dynamic content found in buffer but dynamic caching disabled on settings page.", 4 ); 
     504            wp_cache_add_to_buffer( $buffer, 'Super Cache dynamic page detected but dynamic caching disabled on the settings page.' ); 
     505            $buffer = preg_replace( '#(<!--\s*(mclude|mfunc|dynamic-cached-content).*<!-+\s*/\s*(mfunc|mclude|dynamic-cached-content)\s*-+>)#ism','', $buffer ); 
     506            $store = $buffer; 
     507            /* Clean function calls in tag */ 
     508            $store = apply_filters( 'wpsupercache_buffer', $store ); 
     509        } else { 
     510            if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( "Dynamic content found in buffer.", 4 ); 
     511            $store = preg_replace('|<!--mclude (.*?)-->(.*?)<!--/mclude-->|is', 
    504512                "<!--mclude-->\n<?php include_once('" . ABSPATH . "$1'); ?>\n<!--/mclude-->", $buffer); 
    505         $store = preg_replace('|<!--mfunc (.*?)-->(.*?)<!--/mfunc-->|is', 
     513            $store = preg_replace('|<!--mfunc (.*?)-->(.*?)<!--/mfunc-->|is', 
    506514                "<!--mfunc-->\n<?php $1 ;?>\n<!--/mfunc-->", $store); 
    507         $store = preg_replace('|<!--dynamic-cached-content-->(.*?)<!--(.*?)--><!--/dynamic-cached-content-->|is', 
     515            $store = preg_replace('|<!--dynamic-cached-content-->(.*?)<!--(.*?)--><!--/dynamic-cached-content-->|is', 
    508516                "<!--dynamic-cached-content-->\n<?php$2?>\n<!--/dynamic-cached-content-->", $store); 
    509         $wp_cache_meta[ 'dynamic' ] = true; 
    510         /* Clean function calls in tag */ 
    511         $buffer = preg_replace('|<!--mclude (.*?)-->|is', '<!--mclude-->', $buffer); 
    512         $buffer = preg_replace('|<!--mfunc (.*?)-->|is', '<!--mfunc-->', $buffer); 
    513         $buffer = preg_replace('|<!--dynamic-cached-content-->(.*?)<!--(.*?)--><!--/dynamic-cached-content-->|is', 
     517            $wp_cache_meta[ 'dynamic' ] = true; 
     518            /* Clean function calls in tag */ 
     519            $buffer = preg_replace('|<!--mclude (.*?)-->|is', '<!--mclude-->', $buffer); 
     520            $buffer = preg_replace('|<!--mfunc (.*?)-->|is', '<!--mfunc-->', $buffer); 
     521            $buffer = preg_replace('|<!--dynamic-cached-content-->(.*?)<!--(.*?)--><!--/dynamic-cached-content-->|is', 
    514522                "<!--dynamic-cached-content-->$1<!--/dynamic-cached-content-->", $buffer); 
    515         $store = apply_filters( 'wpsupercache_buffer', $store ); 
     523            $store = apply_filters( 'wpsupercache_buffer', $store ); 
     524        } 
    516525        // Append WP Super Cache or Live page comment tag 
    517526        wp_cache_append_tag($buffer); 
  • wp-super-cache/trunk/wp-cache.php

    r696531 r696583  
    396396 
    397397function wp_cache_manager_updates() { 
    398     global $wp_cache_mobile_enabled, $wp_supercache_cache_list, $wp_cache_config_file, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $cache_path, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $cache_compression, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $cache_page_secret, $wp_cache_disable_utf8, $wp_cache_no_cache_for_get; 
     398    global $wp_cache_mobile_enabled, $wp_cache_mfunc_enabled, $wp_supercache_cache_list, $wp_cache_config_file, $wp_cache_hello_world, $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_not_logged_in, $wp_cache_make_known_anon, $cache_path, $wp_cache_object_cache, $_wp_using_ext_object_cache, $wp_cache_refresh_single_only, $cache_compression, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $cache_page_secret, $wp_cache_disable_utf8, $wp_cache_no_cache_for_get; 
    399399    global $cache_schedule_type, $cache_scheduled_time, $cache_max_time, $cache_time_interval, $wp_cache_shutdown_gc; 
    400400 
     
    472472        wp_cache_replace_line('^ *\$wp_supercache_304', "\$wp_supercache_304 = " . $wp_supercache_304 . ";", $wp_cache_config_file); 
    473473 
     474        if( isset( $_POST[ 'wp_cache_mfunc_enabled' ] ) ) { 
     475            $wp_cache_mfunc_enabled = 1; 
     476        } else { 
     477            $wp_cache_mfunc_enabled = 0; 
     478        } 
     479        wp_cache_replace_line('^ *\$wp_cache_mfunc_enabled', "\$wp_cache_mfunc_enabled = " . $wp_cache_mfunc_enabled . ";", $wp_cache_config_file); 
     480 
    474481        if( isset( $_POST[ 'wp_cache_mobile_enabled' ] ) ) { 
    475482            $wp_cache_mobile_enabled = 1; 
     
    609616    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; 
    610617    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; 
    611     global $wpmu_version, $cache_max_time, $wp_cache_mod_rewrite, $wp_supercache_304, $wp_super_cache_late_init, $wp_cache_front_page_checks, $wp_cache_disable_utf8; 
     618    global $wpmu_version, $cache_max_time, $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; 
    612619 
    613620    if ( !wpsupercache_site_admin() ) 
     
    974981                <fieldset> 
    975982                <legend class="hidden">Advanced</legend> 
     983                <label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite || $super_cache_enabled == false ) { echo "disabled='disabled'"; } ?>> <?php _e( 'Enable dynamic caching (mfunc, mclude, dynamic-cached-content). See the <a href="http://wordpress.org/extend/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br /> 
    976984                <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 /> 
    977985                <?php if ( $wp_cache_mobile_enabled ) { 
Note: See TracChangeset for help on using the changeset viewer.