Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
350
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. * Plugin Name: the time
  4. */
  5.  
  6. function show_esi(){
  7.     if( method_exists( 'LiteSpeed_Cache_API', 'esi_enabled' ) && LiteSpeed_Cache_API::esi_enabled() ) {
  8.         // To make sure is using the compatible API version
  9.         if ( method_exists( 'LiteSpeed_Cache_API', 'v' ) && LiteSpeed_Cache_API::v( '1.3' ) ) {
  10.             // Let's turn this block to ESI by returning directly
  11.             return LiteSpeed_Cache_API::esi_url( 'thetime_esi', 'My Plugin the time' ) ;
  12.         }
  13.     }
  14. }
  15.  
  16. if ( method_exists( 'LiteSpeed_Cache_API', 'esi_enabled' ) && LiteSpeed_Cache_API::esi_enabled() ) {
  17.     LiteSpeed_Cache_API::hook_tpl_esi('hook_esi' );
  18. }
  19.  
  20. function hook_esi(){
  21.     echo time();
  22.     exit;
  23. }
  24.  
  25. function theTime(){
  26.     echo show_esi() ;
  27.     // echo time();
  28. }
  29. add_shortcode('thetime', 'theTime');
  30. ?>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement