dynamic_output_buffer_test()WPSCache 1.0

No Hooks.

Return

null. Nothing (null).

Usage

dynamic_output_buffer_test( $cachedata );
$cachedata **
-

dynamic_output_buffer_test() code WPSCache 1.12.0

function dynamic_output_buffer_test( $cachedata = 0 ) {
	if ( defined( 'DYNAMIC_OB_TEXT' ) ) {
		return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT, $cachedata );
	}

	ob_start();
	// call the sidebar function, do something dynamic
	echo '<p>This is a test. The current time on the server is: ' . date( 'H:i:s' ) . '</p>';
	$text = ob_get_contents();
	ob_end_clean();

	if ( 0 === $cachedata ) { // called directly from the theme so store the output.
		define( 'DYNAMIC_OB_TEXT', $text );
	} else { // called via the wpsc_cachedata filter. We only get here in cached pages in wp-cache-phase1.php.
		return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, $text, $cachedata );
	}
}