PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4.1
3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / wysiwyg / module.php
jetformbuilder / modules / wysiwyg Last commit date
assets 1 month ago blocks 1 month ago module.php 1 month ago
module.php
119 lines
1 <?php
2
3
4 namespace JFB_Modules\Wysiwyg;
5
6 use Jet_Form_Builder\Blocks\Module as BlocksModule;
7 use Jet_Form_Builder\Plugin;
8 use JFB_Components\Module\Base_Module_Dir_It;
9 use JFB_Components\Module\Base_Module_Dir_Trait;
10 use JFB_Components\Module\Base_Module_Handle_It;
11 use JFB_Components\Module\Base_Module_Handle_Trait;
12 use JFB_Components\Module\Base_Module_It;
13 use JFB_Components\Module\Base_Module_Url_It;
14 use JFB_Components\Module\Base_Module_Url_Trait;
15
16 // If this file is called directly, abort.
17 if ( ! defined( 'WPINC' ) ) {
18 die;
19 }
20
21 final class Module implements
22 Base_Module_It,
23 Base_Module_Url_It,
24 Base_Module_Handle_It,
25 Base_Module_Dir_It {
26
27 use Base_Module_Url_Trait;
28 use Base_Module_Dir_Trait;
29 use Base_Module_Handle_Trait;
30
31 public function rep_item_id() {
32 return 'wysiwyg';
33 }
34
35 public function condition(): bool {
36 return true;
37 }
38
39 public function init_hooks() {
40 add_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) );
41 add_action( 'init', array( $this, 'register_editor_styles' ) );
42 add_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
43 add_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) );
44 add_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) );
45 }
46
47 public function remove_hooks() {
48 remove_filter( 'jet-form-builder/blocks/items', array( $this, 'add_blocks_types' ) );
49 remove_action( 'init', array( $this, 'register_editor_styles' ) );
50 remove_action( 'jet-form-builder/editor-assets/before', array( $this, 'enqueue_admin_assets' ) );
51 remove_action( 'wp_enqueue_scripts', array( $this, 'register_frontend_scripts' ) );
52 remove_action( 'jet_plugins/frontend/register_scripts', array( $this, 'register_frontend_scripts' ) );
53 }
54
55 public function add_blocks_types( array $block_types ): array {
56 $block_types[] = new Blocks\Wysiwyg\Block_Type();
57
58 return $block_types;
59 }
60
61 public function register_editor_styles() {
62
63 $editor_asset = require $this->get_dir( 'assets/build/editor.asset.php' );
64 wp_register_style(
65 $this->get_handle( 'lightgray-skin' ),
66 includes_url( 'js/tinymce/skins/lightgray/skin.min.css' ),
67 array(),
68 $editor_asset['version']
69 );
70 wp_register_style(
71 $this->get_handle(),
72 $this->get_url( 'assets/build/wysiwyg.css' ),
73 array(
74 'editor-buttons',
75 ),
76 $editor_asset['version']
77 );
78 }
79
80 public function enqueue_admin_assets() {
81 $script_asset = require $this->get_dir( 'assets/build/editor.asset.php' );
82
83 wp_enqueue_script(
84 $this->get_handle(),
85 $this->get_url( 'assets/build/editor.js' ),
86 $script_asset['dependencies'],
87 $script_asset['version'],
88 true
89 );
90 }
91
92 public function register_frontend_scripts() {
93 $script_asset = require $this->get_dir( 'assets/build/wysiwyg.asset.php' );
94
95 if ( true === $script_asset ) {
96 return;
97 }
98
99 array_push(
100 $script_asset['dependencies'],
101 BlocksModule::MAIN_SCRIPT_HANDLE
102 );
103
104 wp_register_script(
105 $this->get_handle(),
106 $this->get_url( 'assets/build/wysiwyg.js' ),
107 $script_asset['dependencies'],
108 $script_asset['version'],
109 true
110 );
111 wp_register_style(
112 $this->get_handle(),
113 $this->get_url( 'assets/build/wysiwyg.css' ),
114 array(),
115 $script_asset['version']
116 );
117 }
118 }
119