WordPress.org

Plugin Directory

Changeset 706419


Ignore:
Timestamp:
05/01/13 12:34:34 (12 months ago)
Author:
donncha
Message:

Added "DYNAMIC_CACHE_TEST_TAG" constant so users will have to pick a secret template tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-super-cache/trunk/plugins/dynamic-cache-test.php

    r703559 r706419  
    2525 * This function hooks on to the filter through which all the cached data 
    2626 * sent to visitors is sent. 
    27  * In this simple example the template tag "HELLOWORLD12345" is replaced 
    28  * by a html comment containing the text "Hello world at " and the  
    29  * current server time. If you want to use the output of a WordPress 
    30  * plugin or command you must enable "late init" on the settings page. 
    31  * Each time you reload the cached page this time will change. View the 
    32  * page source to examine this text. 
     27 * In this simple example the template tag is replaced by a html comment  
     28 * containing the text "Hello world at " and the current server time.  
     29 * If you want to use the output of a WordPress plugin or command you  
     30 * must enable "late init" on the settings page. Each time you reload  
     31 * the cached page this time will change. View the page source to examine  
     32 * this text. 
    3333 * 
     34 * Plugin authors: NEVER define the template tag for your users. Make them  
     35 * choose one so it will be unique to their site. 
    3436 * 
    3537 * **** MAKE SURE YOU KEEP THE TEMPLATE TAG SECRET **** 
     
    3941 
    4042/* 
    41  * Uncomment the code below, enable dynamic caching and clear the cache. 
     43 * Uncomment the code below, enable dynamic caching on the Advanced Settings 
     44 * page and clear the cache.  
     45 * Be sure to define DYNAMIC_CACHE_TEST_TAG too. Make it a random string 
     46 * that will never appear on your website. In your own application this 
     47 * tag can be whatever you like. 
    4248 */ 
    4349 
    4450 
    4551/* 
     52 
     53define( 'DYNAMIC_CACHE_TEST_TAG', '' ); 
     54 
     55if ( DYNAMIC_CACHE_TEST_TAG == '' ) 
     56    return false; 
     57 
    4658function dynamic_cache_test_filter( &$cachedata) { 
    47     return str_replace( "HELLOWORLD12345", "<!-- Hello world at " . date( 'H:i:s' ) . " -->", $cachedata ); 
     59    return str_replace( DYNAMIC_CACHE_TEST_TAG, "<!-- Hello world at " . date( 'H:i:s' ) . " -->", $cachedata ); 
    4860} 
    4961add_cacheaction( 'wpsc_cachedata', 'dynamic_cache_test_filter' ); 
    5062 
    5163function dynamic_cache_test_template_tag() { 
    52     echo "HELLOWORLD12345"; // This is the template tag 
     64    echo DYNAMIC_CACHE_TEST_TAG; // This is the template tag 
    5365} 
    5466 
     
    5769} 
    5870add_cacheaction( 'add_cacheaction', 'dynamic_cache_test_init' ); 
     71 
    5972*/ 
    6073 
Note: See TracChangeset for help on using the changeset viewer.