litespeed.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Litespeed; |
| 5 | |
| 6 | // If this file is called directly, abort. |
| 7 | if ( ! defined( 'WPINC' ) ) { |
| 8 | die; |
| 9 | } |
| 10 | |
| 11 | use JFB_Modules\Security\Wp_Nonce; |
| 12 | use JFB_Components\Module\Base_Module_It; |
| 13 | |
| 14 | class Litespeed implements Base_Module_It { |
| 15 | |
| 16 | public function rep_item_id() { |
| 17 | return 'litespeed'; |
| 18 | } |
| 19 | |
| 20 | public function condition(): bool { |
| 21 | return defined( 'LSCWP_V' ); |
| 22 | } |
| 23 | |
| 24 | public function init_hooks() { |
| 25 | add_filter( |
| 26 | 'jet-form-builder/after-start-form', |
| 27 | array( $this, 'on_render_form' ), |
| 28 | 9 |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | public function remove_hooks() { |
| 33 | remove_filter( |
| 34 | 'jet-form-builder/after-start-form', |
| 35 | array( $this, 'on_render_form' ), |
| 36 | 9 |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | public function on_render_form( string $html ): string { |
| 41 | do_action( 'litespeed_nonce', Wp_Nonce\Module::NONCE_ACTION_PREF . '*' ); |
| 42 | |
| 43 | $this->remove_hooks(); |
| 44 | |
| 45 | return $html; |
| 46 | } |
| 47 | } |
| 48 |