PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.5.2
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 / html-parser / module.php
jetformbuilder / modules / html-parser Last commit date
admin 1 year ago assets 11 months ago module.php 1 year ago
module.php
98 lines
1 <?php
2
3
4 namespace JFB_Modules\Html_Parser;
5
6 use JFB_Components\Module\Base_Module_Dir_It;
7 use JFB_Components\Module\Base_Module_Dir_Trait;
8 use JFB_Components\Module\Base_Module_Handle_It;
9 use JFB_Components\Module\Base_Module_Handle_Trait;
10 use JFB_Components\Module\Base_Module_It;
11 use JFB_Components\Module\Base_Module_Url_It;
12 use JFB_Components\Module\Base_Module_Url_Trait;
13
14 // If this file is called directly, abort.
15 if ( ! defined( 'WPINC' ) ) {
16 die;
17 }
18
19 class Module implements
20 Base_Module_It,
21 Base_Module_Handle_It,
22 Base_Module_Url_It,
23 Base_Module_Dir_It {
24
25 use Base_Module_Url_Trait;
26 use Base_Module_Handle_Trait;
27 use Base_Module_Dir_Trait;
28
29 public function rep_item_id() {
30 return 'html-parser';
31 }
32
33 public function condition(): bool {
34 return true;
35 }
36
37 public function init_hooks() {
38 }
39
40 public function remove_hooks() {
41 }
42
43 public function register_scripts() {
44 $script_asset = require_once $this->get_dir( 'assets/build/parser.asset.php' );
45
46 // script have already registered
47 if ( true === $script_asset ) {
48 return;
49 }
50
51 /** @var \JFB_Modules\Jet_Plugins\Module $jet_plugins */
52 /** @noinspection PhpUnhandledExceptionInspection */
53 $jet_plugins = jet_form_builder()->module( 'jet-plugins' );
54 $jet_plugins->register_scripts();
55
56 array_push(
57 $script_asset['dependencies'],
58 $jet_plugins::HANDLE
59 );
60
61 wp_register_script(
62 $this->get_handle(),
63 $this->get_url( 'assets/build/parser.js' ),
64 $script_asset['dependencies'],
65 $script_asset['version'],
66 true
67 );
68
69 wp_localize_script(
70 $this->get_handle(),
71 'JetFormBuilderParserConfig',
72 array(
73 'mimes' => get_allowed_mime_types(),
74 )
75 );
76
77 $ui_asset = require $this->get_dir( 'assets/build/admin-ui.asset.php' );
78 wp_register_script(
79 'jfb-html-parser-admin-ui',
80 $this->get_url( 'assets/build/admin-ui.js' ),
81 $ui_asset['dependencies'],
82 $ui_asset['version'],
83 true
84 );
85
86 if (
87 is_admin()
88 && isset( $_GET['post_type'] )
89 && 'jet-form-builder' === $_GET['post_type']
90 && isset( $_SERVER['REQUEST_URI'] )
91 && false !== strpos( $_SERVER['REQUEST_URI'], 'edit.php' ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
92 ) {
93 wp_enqueue_script( $this->get_handle() );
94 wp_enqueue_script( 'jfb-html-parser-admin-ui' );
95 }
96 }
97 }
98