PluginProbe
FileBird – WordPress Media Library Folders & File Manager / 5.6
FileBird – WordPress Media Library Folders & File Manager v5.6
6.5.8 6.5.7 6.5.5 6.5.4 trunk 4.3.1 5.1.6 5.3 5.3.2 5.4.3 5.4.4 5.4.5 5.5 5.5.3 5.5.5 5.5.8 5.5.8.1 5.6 5.6.1 5.6.2 5.6.3 5.6.4 6.2.3 6.2.5 6.3 All 36 releases
filebird / includes / Support / PageBuilders.php

PageBuilders.php in FileBird – WordPress Media Library Folders & File Manager 5.6, at includes/Support/PageBuilders.php

240 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace FileBird\Support;
3
4 use FileBird\Controller\Folder;
5
6 defined( 'ABSPATH' ) || exit;
7
8 class PageBuilders {
9 protected $folderController;
10
11 public function __construct() {
12 $this->folderController = Folder::getInstance();
13 add_action( 'init', array( $this, 'prepareRegister' ) );
14 }
15
16 public function prepareRegister() {
17 // Compatible for Elementor
18 if ( defined( 'ELEMENTOR_VERSION' ) ) {
19 $this->registerForElementor();
20 }
21 // Compatible for WPBakery - Work normally
22
23 // Compatible for Beaver Builder
24 if ( class_exists( 'FLBuilderLoader' ) ) {
25 $this->registerForBeaver();
26 }
27
28 // Brizy Builder
29 if ( class_exists( 'Brizy_Editor' ) ) {
30 $this->registerForBrizy();
31 }
32
33 // Cornerstone
34 if ( class_exists( 'Cornerstone_Plugin' ) ) {
35 $this->registerCornerstone();
36 }
37
38 // Compatible for Divi
39 if ( class_exists( 'ET_Builder_Element' ) ) {
40 $this->registerForDivi();
41 }
42
43 // Compatible for Thrive
44 if ( defined( 'TVE_IN_ARCHITECT' ) || class_exists( 'Thrive_Quiz_Builder' ) ) {
45 $this->registerForThrive();
46 }
47
48 // Fusion Builder
49 if ( class_exists( 'Fusion_Builder_Front' ) ) {
50 $this->registerForFusion();
51 }
52
53 // Avada Theme
54 if ( ! class_exists( 'Fusion_Builder_Front' ) && defined( 'AVADA_VERSION' ) ) {
55 $this->registerAvada();
56 }
57
58 // Oxygen Builder
59 if ( defined( 'CT_VERSION' ) ) {
60 $this->registerOxygenBuilder();
61 }
62
63 // Tatsu Builder
64 if ( defined( 'TATSU_VERSION' ) ) {
65 $this->registerTatsuBuilder();
66 }
67
68 // Dokan plugin
69 if ( defined( 'DOKAN_PLUGIN_VERSION' ) ) {
70 $this->registerForDokan();
71 }
72
73 // Themify
74 if ( defined( 'THEMIFY_VERSION' ) && class_exists( 'Themify_Builder_Model' ) ) {
75 $this->registerThemify();
76 }
77
78 // Bricks
79 if ( defined( 'BRICKS_VERSION' ) ) {
80 $this->registerBricksBuilder();
81 }
82
83 // BeTheme
84 if ( defined( 'MFN_THEME_VERSION' ) ) {
85 $this->registerBeBuilder();
86 }
87
88 // LearnPress
89 if ( class_exists( 'LP_Addon_Frontend_Editor_Preload' ) ) {
90 $this->registerLearnPress();
91 }
92
93 // Break Dance Builder
94 if ( defined( '__BREAKDANCE_VERSION' ) ) {
95 $this->registerBreakDance();
96 }
97
98 // YooTheme
99 if ( class_exists( 'YOOtheme\Builder' ) ) {
100 $this->registerYooTheme();
101 }
102 }
103
104 public function enqueueScripts( $is_enqueue_media = false, $is_enqueue_footer = false ) {
105 if ( $is_enqueue_media ) {
106 wp_enqueue_media();
107
108 }
109
110 if ( $is_enqueue_footer ) {
111 add_action(
112 'wp_footer',
113 function() {
114 $this->folderController->enqueueAdminScripts( 'pagebuilders' );
115 }
116 );
117 }
118
119 $this->folderController->enqueueAdminScripts( 'pagebuilders' );
120 }
121
122 public function registerForElementor() {
123 add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'enqueueScripts' ) );
124 }
125
126 public function registerForBeaver() {
127 add_action(
128 'fl_before_sortable_enqueue',
129 function() {
130 $this->enqueueScripts( false, true );
131 }
132 );
133 }
134
135 public function registerForBrizy() {
136 add_action( 'brizy_editor_enqueue_scripts', array( $this, 'enqueueScripts' ) );
137 }
138
139 public function registerCornerstone() {
140 add_action( 'cornerstone_before_wp_editor', array( $this, 'enqueueScripts' ) );
141 }
142
143 public function registerForDivi() {
144 add_action(
145 'et_fb_enqueue_assets',
146 function() {
147 $this->enqueueScripts();
148 }
149 );
150 }
151
152 public function registerForThrive() {
153 add_action( 'tcb_main_frame_enqueue', array( $this, 'enqueueScripts' ) );
154 }
155
156 public function registerForFusion() {
157 add_action( 'fusion_builder_enqueue_live_scripts', array( $this, 'enqueueScripts' ) );
158 }
159
160 public function registerOxygenBuilder() {
161 add_action( 'oxygen_enqueue_ui_scripts', array( $this, 'enqueueScripts' ) );
162 }
163
164 public function registerTatsuBuilder() {
165 add_action( 'tatsu_builder_footer', array( $this, 'enqueueScripts' ) );
166 }
167
168 public function registerForDokan() {
169 add_action(
170 'dokan_enqueue_scripts',
171 function() {
172 if ( function_exists( 'dokan_is_seller_dashboard' ) ) {
173 if ( ( dokan_is_seller_dashboard() || ( get_query_var( 'edit' ) && is_singular( 'product' ) ) ) || apply_filters( 'dokan_forced_load_scripts', false ) ) {
174 $this->enqueueScripts();
175 }
176 }
177 }
178 );
179 }
180
181 public function registerThemify() {
182 add_action(
183 'wp_ajax_tb_load_editor',
184 function() {
185 $this->enqueueScripts( true );
186 },
187 9
188 );
189 }
190
191 public function registerBricksBuilder() {
192 if ( function_exists( 'bricks_is_builder' ) && \bricks_is_builder() ) {
193 add_action( 'bricks_after_footer', array( $this, 'enqueueScripts' ) );
194 }
195 }
196
197 public function registerAvada() {
198 add_action( 'fusion_enqueue_live_scripts', array( $this, 'enqueueScripts' ) );
199 }
200
201 public function registerBeBuilder() {
202 add_action(
203 'admin_enqueue_scripts',
204 function() {
205 if ( ! wp_script_is( 'mfn-vbscripts', 'enqueued' ) ) {
206 return;
207 }
208
209 $this->enqueueScripts();
210 },
211 PHP_INT_MAX
212 );
213
214 add_action(
215 'wp_enqueue_scripts',
216 function() {
217 if ( ! wp_script_is( 'mfn-vbscripts', 'enqueued' ) ) {
218 return;
219 }
220
221 $this->enqueueScripts();
222 },
223 PHP_INT_MAX
224 );
225 }
226
227 public function registerLearnPress() {
228 add_action( 'learnpress/addons/frontend_editor/enqueue_scripts', array( $this, 'enqueueScripts' ) );
229 }
230
231 public function registerBreakDance() {
232 if ( isset( $_GET['breakdance_wpuiforbuilder_media'] ) && $_GET['breakdance_wpuiforbuilder_media'] ) {
233 add_action( 'admin_enqueue_scripts', array( $this, 'enqueueScripts' ), 9 );
234 }
235 }
236
237 public function registerYooTheme() {
238 add_action( 'admin_print_footer_scripts-yootheme_customizer', array( $this, 'enqueueScripts' ) );
239 }
240 }