Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
litespeed_wiki:cache:lscwp:esi_replace [2017/10/01 17:57] Hai Zheng |
litespeed_wiki:cache:lscwp:esi_replace [2017/10/02 14:33] (current) Hai Zheng |
||
---|---|---|---|
Line 3: | Line 3: | ||
Let's take **Caldera Forms Version 1.5.6.1** as the example. | Let's take **Caldera Forms Version 1.5.6.1** as the example. | ||
- | In <code>caldera-forms/classes/render/nonce.php</code> line 86 <code>public static function nonce_field( $form_id )</code> is where the form nonce is generated. So to convert it to ESI, change | + | In <code>caldera-forms/classes/render/nonce.php</code> line 86 <code php>public static function nonce_field( $form_id )</code> is where the form nonce is generated. So to convert it to ESI, change |
- | <code> | + | <code php> |
public static function nonce_field( $form_id ){ | public static function nonce_field( $form_id ){ | ||
$nonce_field = '<input type="hidden" id="' . esc_attr( self::nonce_field_name( $form_id ) ) . '" name="' . esc_attr( self::nonce_field_name() ) . '" value="' . esc_attr( self::create_verify_nonce( $form_id ) ) . '" data-nonce-time="' . esc_attr( time() ) . '" />'; | $nonce_field = '<input type="hidden" id="' . esc_attr( self::nonce_field_name( $form_id ) ) . '" name="' . esc_attr( self::nonce_field_name() ) . '" value="' . esc_attr( self::create_verify_nonce( $form_id ) ) . '" data-nonce-time="' . esc_attr( time() ) . '" />'; | ||
Line 14: | Line 14: | ||
to | to | ||
- | <code> | + | <code php> |
public static function nonce_field( $form_id, $from_esi = false ){ | public static function nonce_field( $form_id, $from_esi = false ){ | ||
Line 42: | Line 42: | ||
</code> | </code> | ||
- | Then go to <code>caldera-forms/classes/core.php</code>, in <code>function __construct()</code> line 146 or other preferred position, add this: | + | Then go to <code>caldera-forms/classes/core.php</code>, in <code php>function __construct()</code> line 146 or other preferred position, add this: |
- | <code> | + | <code php> |
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( 'caldera_forms', 'Caldera_Forms_Render_Nonce::hook_esi' ); | LiteSpeed_Cache_API::hook_tpl_esi( 'caldera_forms', 'Caldera_Forms_Render_Nonce::hook_esi' ); |