Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
litespeed_wiki:cache:lscwp:esi_nonce [2017/09/24 16:29]
Hai Zheng
litespeed_wiki:cache:lscwp:esi_nonce [2017/09/25 12:49]
Hai Zheng
Line 6: Line 6:
  
 In <​code>​js_composer/​include/​helpers/​helpers_factory.php</​code>​ line 486, In <​code>​js_composer/​include/​helpers/​helpers_factory.php</​code>​ line 486,
-<syntaxhighlight lang='​php'​>+<code>
 function vc_generate_nonce( $data ) { function vc_generate_nonce( $data ) {
  return wp_create_nonce( is_array( $data ) ? ( '​vc-nonce-'​ . implode( '​|',​ $data ) ) : ( '​vc-nonce-'​ . $data ) );  return wp_create_nonce( is_array( $data ) ? ( '​vc-nonce-'​ . implode( '​|',​ $data ) ) : ( '​vc-nonce-'​ . $data ) );
 } }
-</syntaxhighlight>+</code>
  
 change it to  change it to 
-<syntaxhighlight lang='​php'​>+<code>
 function vc_generate_nonce( $data, $from_esi = false ) { function vc_generate_nonce( $data, $from_esi = false ) {
  if ( ! $from_esi && ! vc_is_frontend_editor() ​ ) {  if ( ! $from_esi && ! vc_is_frontend_editor() ​ ) {
Line 37: Line 37:
  exit ;  exit ;
 } }
-</syntaxhighlight>+</code>
  
  
 Then, in <​code>​js_composer/​js_composer.php</​code>​ line 244, Then, in <​code>​js_composer/​js_composer.php</​code>​ line 244,
-<syntaxhighlight lang='​php'​>+<code>
  public function init() {  public function init() {
-</syntaxhighlight>+</code>
  
 Change it to  Change it to 
-<syntaxhighlight lang='​php'​>+<code>
  public function init() {  public function init() {
  if ( method_exists( '​LiteSpeed_Cache_API',​ '​esi_enabled'​ ) && LiteSpeed_Cache_API::​esi_enabled() ) {  if ( method_exists( '​LiteSpeed_Cache_API',​ '​esi_enabled'​ ) && LiteSpeed_Cache_API::​esi_enabled() ) {
  LiteSpeed_Cache_API::​hook_tpl_esi( '​js_composer',​ '​hook_esi'​ ) ;  LiteSpeed_Cache_API::​hook_tpl_esi( '​js_composer',​ '​hook_esi'​ ) ;
  }  }
-</syntaxhighlight>+</code>
  
 Now you can see WordPress nonce can be cached correctly. Now you can see WordPress nonce can be cached correctly.
  • Admin
  • Last modified: 2020/11/14 15:23
  • by Lisa Clarke