| @@ -6,15 +6,9 @@ | ||
| 6 | 6 | use Jet_Form_Builder\Classes\Arguments\Default_Form_Arguments; |
| 7 | 7 | use Jet_Form_Builder\Classes\Arguments\Form_Arguments; |
| 8 | 8 | use Jet_Form_Builder\Exceptions\Repository_Exception; |
| 9 | 9 | use JFB_Components\Module\Base_Module_After_Install_It; |
| 10 | -use JFB_Components\Module\Base_Module_Dir_It; | |
| 11 | -use JFB_Components\Module\Base_Module_Dir_Trait; | |
| 12 | -use JFB_Components\Module\Base_Module_Handle_It; | |
| 13 | -use JFB_Components\Module\Base_Module_Handle_Trait; | |
| 14 | 10 | use JFB_Components\Module\Base_Module_It; |
| 15 | -use JFB_Components\Module\Base_Module_Url_It; | |
| 16 | -use JFB_Components\Module\Base_Module_Url_Trait; | |
| 17 | 11 | use JFB_Components\Repository\Repository_Pattern_Trait; |
| 18 | 12 | |
| 19 | 13 | // If this file is called directly, abort. |
| 20 | 14 | if ( ! defined( 'WPINC' ) ) { |
| @@ -25,25 +19,12 @@ | ||
| 25 | 19 | * Class Manager |
| 26 | 20 | * |
| 27 | 21 | * @package JFB_Modules\Shortcode |
| 28 | 22 | */ |
| 29 | -final class Module implements | |
| 30 | - Base_Module_It, | |
| 31 | - Base_Module_After_Install_It, | |
| 32 | - Base_Module_Handle_It, | |
| 33 | - Base_Module_Url_It, | |
| 34 | - Base_Module_Dir_It { | |
| 23 | +final class Module implements Base_Module_It, Base_Module_After_Install_It { | |
| 35 | 24 | |
| 36 | 25 | use Repository_Pattern_Trait; |
| 37 | - use Base_Module_Dir_Trait; | |
| 38 | - use Base_Module_Handle_Trait; | |
| 39 | - use Base_Module_Url_Trait; | |
| 40 | 26 | |
| 41 | - /** | |
| 42 | - * @var Onboarding_Builder | |
| 43 | - */ | |
| 44 | - private $onboarding_builder; | |
| 45 | - | |
| 46 | 27 | public function rep_item_id() { |
| 47 | 28 | return 'shortcode'; |
| 48 | 29 | } |
| 49 | 30 | |
| @@ -48,10 +29,8 @@ | ||
| 48 | 29 | } |
| 49 | 30 | |
| 50 | 31 | public function on_install() { |
| 51 | 32 | $this->rep_install(); |
| 52 | - | |
| 53 | - $this->onboarding_builder = new Onboarding_Builder(); | |
| 54 | 33 | } |
| 55 | 34 | |
| 56 | 35 | public function on_uninstall() { |
| 57 | 36 | $this->rep_clear(); |
| @@ -74,15 +53,8 @@ | ||
| 74 | 53 | array( $this, 'add_admin_column_content' ), |
| 75 | 54 | 10, |
| 76 | 55 | 2 |
| 77 | 56 | ); |
| 78 | - add_action( | |
| 79 | - 'jet-form-builder/use-form/register-assets', | |
| 80 | - array( $this, 'block_editor_assets' ), | |
| 81 | - 20 | |
| 82 | - ); | |
| 83 | - | |
| 84 | - $this->get_onboarding_builder()->init_hooks(); | |
| 85 | 57 | } |
| 86 | 58 | |
| 87 | 59 | public function remove_hooks() { |
| 88 | 60 | $slug = \JFB_Modules\Post_Type\Module::SLUG; |
| @@ -95,13 +67,8 @@ | ||
| 95 | 67 | remove_action( |
| 96 | 68 | "manage_{$slug}_posts_custom_column", |
| 97 | 69 | array( $this, 'add_admin_column_content' ) |
| 98 | 70 | ); |
| 99 | - remove_action( | |
| 100 | - 'jet-form-builder/use-form/register-assets', | |
| 101 | - array( $this, 'block_editor_assets' ), | |
| 102 | - 20 | |
| 103 | - ); | |
| 104 | 71 | } |
| 105 | 72 | |
| 106 | 73 | public function rep_instances(): array { |
| 107 | 74 | return array( |
| @@ -138,18 +105,8 @@ | ||
| 138 | 105 | Default_Form_Arguments::arguments(), |
| 139 | 106 | $arguments |
| 140 | 107 | ); |
| 141 | 108 | |
| 142 | - if ( isset( $arguments['load_nonce'] ) ) { | |
| 143 | - unset( $arguments['load_nonce'] ); | |
| 144 | - } | |
| 145 | - if ( isset( $arguments['use_honeypot'] ) ) { | |
| 146 | - unset( $arguments['use_honeypot'] ); | |
| 147 | - } | |
| 148 | - if ( isset( $arguments['use_csrf'] ) ) { | |
| 149 | - unset( $arguments['use_csrf'] ); | |
| 150 | - } | |
| 151 | - | |
| 152 | 109 | printf( |
| 153 | 110 | '<input readonly type="text" onclick="this.select()" value="%s" style="%s"/>', |
| 154 | 111 | esc_attr( $this->get_shortcode( 'jet_fb_form', $arguments ) ), |
| 155 | 112 | 'width: 100%' |
| @@ -167,28 +124,8 @@ | ||
| 167 | 124 | |
| 168 | 125 | return sprintf( $format, $type->get_name(), $this->generate_arguments_string( $arguments ) ); |
| 169 | 126 | } |
| 170 | 127 | |
| 171 | - public function block_editor_assets() { | |
| 172 | - /** @var \JFB_Modules\Onboarding\Module $onboarding */ | |
| 173 | - /** @noinspection PhpUnhandledExceptionInspection */ | |
| 174 | - $onboarding = jet_form_builder()->module( 'onboarding' ); | |
| 175 | - $script_asset = require_once $this->get_dir( 'assets/build/block.editor.asset.php' ); | |
| 176 | - | |
| 177 | - array_push( | |
| 178 | - $script_asset['dependencies'], | |
| 179 | - $onboarding->get_use_form()->get_handle() | |
| 180 | - ); | |
| 181 | - | |
| 182 | - wp_enqueue_script( | |
| 183 | - $this->get_handle( 'block-editor' ), | |
| 184 | - $this->get_url( 'assets/build/block.editor.js' ), | |
| 185 | - $script_asset['dependencies'], | |
| 186 | - $script_asset['version'], | |
| 187 | - true | |
| 188 | - ); | |
| 189 | - } | |
| 190 | - | |
| 191 | 128 | private function generate_arguments_string( $arguments ): string { |
| 192 | 129 | $response = array(); |
| 193 | 130 | |
| 194 | 131 | foreach ( $arguments as $name => $value ) { |
| @@ -195,13 +132,6 @@ | ||
| 195 | 132 | $response[] = "$name=\"$value\""; |
| 196 | 133 | } |
| 197 | 134 | |
| 198 | 135 | return implode( ' ', $response ); |
| 199 | - } | |
| 200 | - | |
| 201 | - /** | |
| 202 | - * @return Onboarding_Builder | |
| 203 | - */ | |
| 204 | - public function get_onboarding_builder(): Onboarding_Builder { | |
| 205 | - return $this->onboarding_builder; | |
| 206 | 136 | } |
| 207 | 137 | } |