PluginProbe ʕ •ᴥ•ʔ
Element Pack – Widgets, Templates & Addons for Elementor / 5.4.0
Element Pack – Widgets, Templates & Addons for Elementor v5.4.0
8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.3 8.6.2 8.6.1 trunk 1.0 1.0.1 1.0.3 1.1.0 1.2.0 1.8.0 2.1.0 2.7.0 2.9.2 3.7.3 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.11.1 4.11.2 4.3.0 4.5.0 4.8.2 5.0.0 5.0.1 5.1.0 5.1.1 5.1.2 5.1.3 5.10.0 5.10.1 5.10.10 5.10.11 5.10.12 5.10.13 5.10.14 5.10.15 5.10.16 5.10.17 5.10.18 5.10.19 5.10.2 5.10.20 5.10.21 5.10.22 5.10.23 5.10.24 5.10.25 5.10.26 5.10.27 5.10.28 5.10.29 5.10.3 5.10.30 5.10.4 5.10.5 5.10.6 5.10.7 5.10.8 5.10.9 5.11.0 5.11.1 5.11.2 5.11.3 5.2.2 5.2.3 5.3.0 5.3.1 5.4.0 5.4.1 5.4.10 5.4.11 5.4.13 5.4.14 5.4.2 5.4.3 5.4.4 5.4.5 5.4.6 5.4.7 5.4.8 5.4.9 5.5.0 5.5.2 5.5.6 5.6.0 5.6.10 5.6.11 5.6.12 5.6.13 5.6.14 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 5.6.8 5.6.9 5.7.0 5.7.1 5.7.2 5.7.3 5.7.4 5.7.5 5.7.6 5.7.7 5.7.8 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.9.0 8.0.0 8.1.0 8.1.1 8.1.10 8.1.2 8.1.3 8.1.4 8.1.5 8.1.6 8.1.7 8.1.8 8.1.9 8.2.0 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.3.0 8.3.1 8.3.10 8.3.11 8.3.12 8.3.13 8.3.14 8.3.15 8.3.16 8.3.17 8.3.18 8.3.19 8.3.2 8.3.3 8.3.4 8.3.5 8.3.6 8.3.7 8.3.8 8.3.9 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0
bdthemes-element-pack-lite / loader.php
bdthemes-element-pack-lite Last commit date
admin 2 years ago assets 2 years ago base 2 years ago freemius 2 years ago includes 2 years ago languages 2 years ago modules 2 years ago traits 2 years ago bdthemes-element-pack-lite.php 2 years ago loader.php 2 years ago readme.txt 2 years ago
loader.php
655 lines
1 <?php
2
3 namespace ElementPack;
4
5 use Elementor\Plugin;
6 use ElementPack\Includes\Element_Pack_WPML;
7 use Elementor\Core\Kits\Documents\Kit;
8 use ElementPack\Includes\ElementPack_FB_Access_Token_Generator_Control;
9 use ElementPack\Includes\ElementPack_JSON_File_Upload_Control;
10 use ElementPack\Includes\SVG_Support;
11 use ElementPack\Includes\Pro_Widget_Map;
12
13 if (!defined('ABSPATH')) {
14 exit;
15 } // Exit if accessed directly
16
17 /**
18 * Main class for element pack
19 */
20 class Element_Pack_Loader {
21
22 /**
23 * @var Element_Pack_Loader
24 */
25 private static $_instance;
26
27 public $elements_data = [
28 'sections' => [],
29 'columns' => [],
30 'widgets' => [],
31 ];
32
33 private function get_upload_dir() {
34 return trailingslashit(wp_upload_dir()['basedir']) . 'element-pack/minified/';
35 }
36
37 private function get_upload_url() {
38 return trailingslashit(wp_upload_dir()['baseurl']) . 'element-pack/minified/';
39 }
40
41 /**
42 * @return string
43 * @deprecated
44 *
45 */
46 public function get_version() {
47 return BDTEP_VER;
48 }
49
50 /**
51 * return active theme
52 */
53 public function get_theme() {
54 return wp_get_theme();
55 }
56
57 /**
58 * Throw error on object clone
59 *
60 * The whole idea of the singleton design pattern is that there is a single
61 * object therefore, we don't want the object to be cloned.
62 *
63 * @return void
64 * @since 1.0.0
65 */
66 public function __clone() {
67 // Cloning instances of the class is forbidden
68 _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'bdthemes-element-pack'), '1.6.0');
69 }
70
71 /**
72 * Disable unserializing of the class
73 *
74 * @return void
75 * @since 1.0.0
76 */
77 public function __wakeup() {
78 // Unserializing instances of the class is forbidden
79 _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'bdthemes-element-pack'), '1.6.0');
80 }
81
82 /**
83 * @return Plugin
84 */
85
86 public static function elementor() {
87 return Plugin::$instance;
88 }
89
90 /**
91 * @return Element_Pack_Loader
92 */
93 public static function instance() {
94 if (is_null(self::$_instance)) {
95 self::$_instance = new self();
96 }
97
98 return self::$_instance;
99 }
100
101
102 /**
103 * we loaded module manager + admin php from here
104 * @return [type] [description]
105 */
106 private function _includes() {
107
108 $live_copy = element_pack_option('live-copy', 'element_pack_other_settings', 'off');
109 $template_library = element_pack_option('template-library', 'element_pack_other_settings', 'off');
110 $duplicator = element_pack_option('duplicator', 'element_pack_other_settings', 'off');
111
112 // Admin settings controller
113 require_once BDTEP_ADMIN_PATH . 'module-settings.php';
114 //Assets Manager
115 require_once 'admin/optimizer/asset-minifier-manager.php';
116
117 // Dynamic Select control
118 require_once BDTEP_INC_PATH . 'controls/select-input/dynamic-select-input-module.php';
119 require_once BDTEP_INC_PATH . 'controls/select-input/dynamic-select.php';
120
121 // Global Controls
122 require_once BDTEP_PATH . 'traits/global-widget-controls.php';
123 require_once BDTEP_PATH . 'traits/global-swiper-controls.php';
124 require_once BDTEP_PATH . 'traits/global-mask-controls.php';
125
126 // json upload support for wordpress
127 require_once BDTEP_INC_PATH . 'class-json-file-upload-control.php';
128 // svg support for full wordpress site
129 require_once BDTEP_INC_PATH . 'class-svg-support.php';
130 // All modules loading from here
131 require_once BDTEP_INC_PATH . 'modules-manager.php';
132 // wpml compatibility class for wpml support
133 require_once BDTEP_INC_PATH . 'class-elements-wpml-compatibility.php';
134 // For changelog file parse
135 require_once BDTEP_INC_PATH . 'class-parsedown.php';
136
137 // Live copy paste from demo website
138 if ($live_copy == 'on') {
139 require_once BDTEP_INC_PATH . 'live-copy/class-live-copy.php';
140 }
141
142 // register the elementor template loading widget in widgets
143 require_once BDTEP_INC_PATH . 'widgets/elementor-template.php';
144
145 // Facebook access token generator control for editor
146 require_once BDTEP_INC_PATH . 'class-fb-access-token-generator-control.php';
147
148 require_once BDTEP_INC_PATH . 'class-google-recaptcha.php';
149
150 if ($duplicator == 'on') {
151 require_once BDTEP_INC_PATH . 'class-duplicator.php';
152 }
153
154 // Rooten theme header footer compatibility
155 if ('Rooten' === $this->get_theme()->name or 'Rooten' === $this->get_theme()->parent_theme) {
156 if (!class_exists('RootenCustomTemplate')) {
157 require_once BDTEP_INC_PATH . 'class-rooten-theme-compatibility.php';
158 }
159 }
160
161 // editor template library
162 if (!defined('BDTEP_CH') and $template_library == 'on') {
163 require_once(BDTEP_INC_PATH . 'template-library/editor/init.php');
164 }
165
166 if (is_admin()) {
167 if (!defined('BDTEP_CH')) {
168 require_once BDTEP_ADMIN_PATH . 'admin.php';
169
170 if (!defined('BDTEP_CH') and $template_library == 'on') {
171 require_once(BDTEP_INC_PATH . 'template-library/template-library-base.php');
172 require_once(BDTEP_INC_PATH . 'template-library/editor/manager/api.php');
173 }
174
175 // Load admin class for admin related content process
176 new Admin();
177 }
178 }
179 }
180
181 /**
182 * Autoloader function for all classes files
183 *
184 * @param [type] class [description]
185 *
186 * @return [type] [description]
187 */
188 public function autoload($class) {
189 if (0 !== strpos($class, __NAMESPACE__)) {
190 return;
191 }
192
193
194 $class_to_load = $class;
195
196 if (!class_exists($class_to_load)) {
197 $filename = strtolower(
198 preg_replace(
199 ['/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z0-9])/', '/_/', '/\\\/'],
200 ['', '$1-$2', '-', DIRECTORY_SEPARATOR],
201 $class_to_load
202 )
203 );
204
205 $filename = BDTEP_PATH . $filename . '.php';
206
207 if (is_readable($filename)) {
208 include($filename);
209 }
210 }
211 }
212
213 /**
214 * Register all script that need for any specific widget on call basis.
215 * @return [type] [description]
216 */
217 public function register_site_scripts() {
218
219 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
220 $api_settings = get_option('element_pack_api_settings');
221
222 if (element_pack_is_widget_enabled('progress-pie')) {
223 wp_register_script('aspieprogress', BDTEP_ASSETS_URL . 'vendor/js/jquery-asPieProgress.min.js', ['jquery'], '0.4.7', true);
224 }
225 if (element_pack_is_widget_enabled('cookie-consent')) {
226 wp_register_script('cookieconsent', BDTEP_ASSETS_URL . 'vendor/js/cookieconsent.min.js', ['jquery'], '3.1.0', true);
227 }
228 if (element_pack_is_widget_enabled('static-grid-tab')) {
229 wp_register_script('gridtab', BDTEP_ASSETS_URL . 'vendor/js/gridtab.min.js', ['jquery'], '2.1.1', true);
230 }
231 if (element_pack_is_widget_enabled('user-register') or element_pack_is_widget_enabled('contact-form')) {
232 wp_register_script('recaptcha', 'https://www.google.com/recaptcha/api.js', ['jquery'], null, true);
233 }
234 if (element_pack_is_widget_enabled('open-street-map')) {
235 wp_register_script('leaflet', BDTEP_ASSETS_URL . 'vendor/js/leaflet.min.js', ['jquery'], '', true);
236 }
237 if (element_pack_is_widget_enabled('panel-slider')) {
238 wp_register_script('bdt-parallax', BDTEP_ASSETS_URL . 'vendor/js/parallax.min.js', ['jquery'], null, true);
239 }
240 if (element_pack_is_widget_enabled('image-magnifier')) {
241 wp_register_script('imagezoom', BDTEP_ASSETS_URL . 'vendor/js/jquery.imagezoom.min.js', ['jquery'], null, true);
242 }
243 if (element_pack_is_widget_enabled('logo-grid')) {
244 wp_register_script('popper', BDTEP_ASSETS_URL . 'vendor/js/popper.min.js', ['jquery'], null, true);
245 wp_register_script('tippyjs', BDTEP_ASSETS_URL . 'vendor/js/tippy.all.min.js', ['jquery'], null, true);
246 }
247 //advanced-image-gallery
248 if (element_pack_is_widget_enabled('custom-gallery') or element_pack_is_widget_enabled('tutor-lms-course-grid')) {
249 wp_register_script('tilt', BDTEP_ASSETS_URL . 'vendor/js/vanilla-tilt.min.js', ['jquery'], null, true);
250 }
251 if (element_pack_is_widget_enabled('reading-progress')) {
252 wp_register_script('progressHorizontal', BDTEP_ASSETS_URL . 'vendor/js/jquery.progressHorizontal.min.js', ['jquery'], '2.0.2', true);
253 // wp_register_script('progressScroll', BDTEP_ASSETS_URL . 'vendor/js/jquery.progressScroll.min.js', ['jquery'], '2.0.2', true);
254 }
255 if (element_pack_is_widget_enabled('image-compare')) {
256 wp_register_script('image-compare-viewer', BDTEP_ASSETS_URL . 'vendor/js/image-compare-viewer.min.js', ['jquery'], '0.0.1', true);
257 }
258 if (element_pack_is_widget_enabled('calendly')) {
259 wp_register_script('calendly', BDTEP_ASSETS_URL . 'vendor/js/calendly.min.js', ['jquery'], '0.0.1', true);
260 }
261 if (element_pack_is_widget_enabled('dark-mode')) {
262 wp_register_script('darkmode', BDTEP_ASSETS_URL . 'vendor/js/darkmode.min.js', ['jquery'], '1.1.1', true);
263 }
264 }
265
266 public function register_site_styles() {
267 $direction_suffix = is_rtl() ? '.rtl' : '';
268
269 // third party widget css
270 if (element_pack_is_widget_enabled('image-magnifier')) {
271 wp_register_style('imagezoom', BDTEP_ASSETS_URL . 'css/imagezoom' . $direction_suffix . '.css', [], BDTEP_VER);
272 }
273
274 /**
275 * ?TODO: Need to separate wc widget css
276 */
277 wp_register_style('ep-tutor-lms', BDTEP_ASSETS_URL . 'css/ep-tutor-lms' . $direction_suffix . '.css', [], BDTEP_VER);
278 // Vendor style register
279 wp_register_style('tippy', BDTEP_ASSETS_URL . 'css/tippy' . $direction_suffix . '.css', [], BDTEP_VER);
280 }
281
282 /**
283 * Loading site related style from here.
284 * @return [type] [description]
285 */
286 public function enqueue_site_styles() {
287
288 $direction_suffix = is_rtl() ? '.rtl' : '';
289
290 wp_enqueue_style('bdt-uikit', BDTEP_ASSETS_URL . 'css/bdt-uikit' . $direction_suffix . '.css', [], '3.13.1');
291 wp_enqueue_style('ep-helper', BDTEP_ASSETS_URL . 'css/ep-helper' . $direction_suffix . '.css', [], BDTEP_VER);
292 }
293
294
295 /**
296 * Loading site related script that needs all time such as uikit.
297 * @return [type] [description]mn
298 */
299 public function enqueue_site_scripts() {
300
301 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
302
303 wp_enqueue_script('bdt-uikit', BDTEP_ASSETS_URL . 'js/bdt-uikit' . $suffix . '.js', ['jquery'], '3.13.1', true);
304
305 if (!element_pack_is_asset_optimization_enabled()) {
306 wp_enqueue_script('element-pack-helper', BDTEP_ASSETS_URL . 'js/common/helper' . $suffix . '.js', ['jquery', 'elementor-frontend'], BDTEP_VER, true);
307 }
308
309
310 $script_config = [
311 'ajaxurl' => admin_url('admin-ajax.php'),
312 'nonce' => wp_create_nonce('element-pack-site'),
313 'data_table' => [
314 'language' => [
315 'lengthMenu' => sprintf(esc_html_x('Show %1s Entries', 'DataTable String', 'bdthemes-element-pack'), '_MENU_'),
316 'info' => sprintf(esc_html_x('Showing %1s to %2s of %3s entries', 'DataTable String', 'bdthemes-element-pack'), '_START_', '_END_', '_TOTAL_'),
317 'search' => esc_html_x('Search :', 'DataTable String', 'bdthemes-element-pack'),
318 'paginate' => [
319 'previous' => esc_html_x('Previous', 'DataTable String', 'bdthemes-element-pack'),
320 'next' => esc_html_x('Next', 'DataTable String', 'bdthemes-element-pack'),
321 ],
322 ],
323 ],
324 'contact_form' => [
325 'sending_msg' => esc_html_x('Sending message please wait...', 'Contact Form String', 'bdthemes-element-pack'),
326 'captcha_nd' => esc_html_x('Invisible captcha not defined!', 'Contact Form String', 'bdthemes-element-pack'),
327 'captcha_nr' => esc_html_x('Could not get invisible captcha response!', 'Contact Form String', 'bdthemes-element-pack'),
328
329 ],
330 'mailchimp' => [
331 'subscribing' => esc_html_x('Subscribing you please wait...', 'Mailchimp String', 'bdthemes-element-pack'),
332 ],
333 'elements_data' => $this->elements_data,
334 ];
335
336
337 // localize for user login widget ajax login script
338
339 // if (!defined('ICL_LANGUAGE_CODE')) {
340 // define('ICL_LANGUAGE_CODE', null);
341 // }
342 // ICL_LANGUAGE_CODE = '';
343 // TODO Language dynamic for ajax call
344
345 wp_localize_script(
346 'bdt-uikit',
347 'element_pack_ajax_login_config',
348 array(
349 'ajaxurl' => admin_url('admin-ajax.php'),
350 'language' => substr(get_locale(), 0, 2),
351 'loadingmessage' => esc_html_x('Sending user info, please wait...', 'User Login and Register', 'bdthemes-element-pack'),
352 'unknownerror' => esc_html_x('Unknown error, make sure access is correct!', 'User Login and Register', 'bdthemes-element-pack'),
353 )
354 );
355
356 $script_config = apply_filters('element_pack/frontend/localize_settings', $script_config);
357
358 // TODO for editor script
359 wp_localize_script('bdt-uikit', 'ElementPackConfig', $script_config);
360 }
361
362 public function enqueue_editor_scripts() {
363
364 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
365
366 wp_enqueue_script(
367 'element-pack',
368 BDTEP_ASSETS_URL . 'js/ep-editor' . $suffix . '.js',
369 [
370 'backbone-marionette',
371 'elementor-common-modules',
372 'elementor-editor-modules',
373 ],
374 BDTEP_VER,
375 true
376 );
377
378 $localize_data = [
379 'pro_installed' => element_pack_pro_installed(),
380 'promotional_widgets' => [],
381 ];
382
383 if (!element_pack_pro_installed()) {
384 $pro_widget_map = new Pro_Widget_Map();
385 $localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map();
386 }
387
388 wp_localize_script(
389 'element-pack',
390 'ElementPackConfig',
391 $localize_data
392 );
393
394 // $locale_settings = [
395 // 'i18n' => [],
396 // 'urls' => [
397 // 'modules' => BDTEP_MODULES_URL,
398 // ],
399 // ];
400
401 // $locale_settings = apply_filters( 'element_pack/editor/localize_settings', $locale_settings );
402
403 // wp_localize_script(
404 // 'element-pack',
405 // 'ElementPackConfig',
406 // $locale_settings
407 // );f
408 }
409
410 /**
411 * Load editor editor related style from here
412 * @return [type] [description]
413 */
414 public function enqueue_preview_styles() {
415 $direction_suffix = is_rtl() ? '.rtl' : '';
416
417 wp_enqueue_style('ep-preview', BDTEP_ASSETS_URL . 'css/ep-preview' . $direction_suffix . '.css', '', BDTEP_VER);
418 }
419
420
421 public function enqueue_editor_styles() {
422 $direction_suffix = is_rtl() ? '.rtl' : '';
423
424 wp_register_style('ep-editor', BDTEP_ASSETS_URL . 'css/ep-editor' . $direction_suffix . '.css', '', BDTEP_VER);
425 wp_enqueue_style('ep-editor');
426 }
427
428
429 public function enqueue_minified_css() {
430 $direction_suffix = is_rtl() ? '.rtl' : '';
431
432 $upload_dir = $this->get_upload_dir() . 'css/ep-styles.css';
433 $version = get_option('element-pack-minified-asset-manager-version');
434
435 if (element_pack_is_asset_optimization_enabled() && file_exists($upload_dir)) {
436 $upload_url = $this->get_upload_url() . 'css/ep-styles.css';
437 wp_register_style('ep-styles', $upload_url, [], $version);
438 } else {
439 wp_register_style('ep-styles', BDTEP_URL . 'assets/css/ep-styles' . $direction_suffix . '.css', [], BDTEP_VER);
440 wp_register_style('ep-font', BDTEP_ASSETS_URL . 'css/ep-font' . $direction_suffix . '.css', [], BDTEP_VER);
441 }
442
443 if (element_pack_is_asset_optimization_enabled()) {
444 wp_enqueue_style('ep-styles');
445 }
446 }
447
448 public function enqueue_minified_js() {
449 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
450
451 $upload_dir = $this->get_upload_dir() . 'js/ep-scripts.js';
452 $version = get_option('element-pack-minified-asset-manager-version');
453
454 if (element_pack_is_asset_optimization_enabled() && file_exists($upload_dir)) {
455 $upload_url = $this->get_upload_url() . 'js/ep-scripts.js';
456
457 wp_register_script('ep-scripts', $upload_url, ['elementor-frontend'], $version, true);
458 } else {
459 wp_register_script('ep-scripts', BDTEP_URL . 'assets/js/ep-scripts' . $suffix . '.js', ['elementor-frontend'], BDTEP_VER, true);
460 }
461
462 if (element_pack_is_asset_optimization_enabled()) {
463 wp_enqueue_script('ep-scripts');
464 }
465 }
466
467 /**
468 * To load notice JS file
469 */
470
471 public function enqueue_admin_scripts() {
472 wp_enqueue_script('ep-notice-js', BDTEP_ADMIN_URL . 'assets/js/ep-notice.js', ['jquery'], BDTEP_VER, true);
473 }
474
475 /**
476 * Callback to shortcodes template
477 * @param array $atts attributes for shortcode.
478 */
479 public function shortcode_template($atts) {
480
481 $atts = shortcode_atts(
482 array(
483 'id' => '',
484 ),
485 $atts,
486 'rooten_custom_template'
487 );
488
489 $id = !empty($atts['id']) ? intval($atts['id']) : '';
490
491 if (empty($id)) {
492 return '';
493 }
494
495 return self::elementor()->frontend->get_builder_content_for_display($id);
496 }
497
498
499 /**
500 * Add element_pack_ajax_login() function with wp_ajax_nopriv_ function
501 * @return [type] [description]
502 */
503 public function element_pack_ajax_login_init() {
504 // Enable the user with no privileges to run element_pack_ajax_login() in AJAX
505 add_action('wp_ajax_nopriv_element_pack_ajax_login', [$this, "element_pack_ajax_login"]);
506 }
507
508 /**
509 * For ajax login
510 * @return [type] [description]
511 */
512 public function element_pack_ajax_login() {
513 // First check the nonce, if it fails the function will break
514 check_ajax_referer('ajax-login-nonce', 'bdt-user-login-sc');
515
516 // Nonce is checked, get the POST data and sign user on
517 $access_info = [];
518 $access_info['user_login'] = !empty($_POST['user_login']) ? $_POST['user_login'] : "";
519 $access_info['user_password'] = !empty($_POST['user_password']) ? $_POST['user_password'] : "";
520 $access_info['remember'] = !empty($_POST['rememberme']) ? true : false;
521 $user_signon = wp_signon($access_info, false);
522
523 if (!is_wp_error($user_signon)) {
524 echo wp_json_encode(
525 [
526 'loggedin' => true,
527 'message' => esc_html_x('Login successful, Redirecting...', 'User Login and Register', 'bdthemes-element-pack')
528 ]
529 );
530 } else {
531 echo wp_json_encode(
532 [
533 'loggedin' => false,
534 'message' => esc_html_x('Oops! Wrong username or password!', 'User Login and Register', 'bdthemes-element-pack')
535 ]
536 );
537 }
538
539 die();
540 }
541
542
543
544 // Load WPML compatibility instance
545 public function wpml_compatiblity() {
546 return Element_Pack_WPML::get_instance();
547 }
548
549
550 /**
551 * initialize the category
552 * @return void
553 */
554 public function element_pack_init() {
555
556 $this->_modules_manager = new Manager();
557
558 do_action('bdthemes_element_pack/init');
559 }
560
561 function ElementPack_Json_File_Import_register_controls() {
562 $controls_manager = Plugin::$instance->controls_manager;
563 $controls_manager->register(new ElementPack_JSON_File_Upload_Control());
564 }
565
566
567
568 function ElementPack_FB_Token_Register_Controls() {
569
570 $controls_manager = Plugin::$instance->controls_manager;
571 $controls_manager->register(new ElementPack_FB_Access_Token_Generator_Control());
572 }
573
574 /**
575 * initialize the category
576 * @return [type] [description]
577 */
578 public function element_pack_category_register() {
579
580 $elementor = Plugin::$instance;
581
582 // Add element category in panel
583 $elementor->elements_manager->add_category(BDTEP_SLUG, ['title' => BDTEP_TITLE, 'icon' => 'font']);
584 }
585
586 public function element_pack_svg_support() {
587
588 return SVG_Support::get_instance();
589 }
590
591 private function setup_hooks() {
592
593 add_action('elementor/controls/register', [$this, 'ElementPack_Json_File_Import_register_controls']);
594
595 add_action('elementor/controls/register', [$this, 'ElementPack_FB_Token_Register_Controls']);
596
597 add_action('elementor/elements/categories_registered', [$this, 'element_pack_category_register']);
598 add_action('elementor/init', [$this, 'element_pack_init']);
599
600
601 add_action('elementor/editor/after_enqueue_styles', [$this, 'enqueue_editor_styles']);
602
603 add_action('elementor/frontend/before_register_styles', [$this, 'register_site_styles']);
604 add_action('elementor/frontend/before_register_scripts', [$this, 'register_site_scripts']);
605
606 add_action('elementor/preview/enqueue_styles', [$this, 'enqueue_preview_styles']);
607 add_action('elementor/editor/after_enqueue_scripts', [$this, 'enqueue_editor_scripts']);
608
609 add_action('elementor/frontend/after_register_styles', [$this, 'enqueue_site_styles']);
610 add_action('elementor/frontend/before_enqueue_scripts', [$this, 'enqueue_site_scripts']);
611
612 // For frontend css load
613 add_action('elementor/frontend/after_enqueue_styles', [$this, 'enqueue_minified_css']);
614 add_action('elementor/frontend/after_enqueue_scripts', [$this, 'enqueue_minified_js']);
615
616
617 add_shortcode('rooten_custom_template', [$this, 'shortcode_template']);
618
619
620 // When user not login add this action
621 if (!is_user_logged_in()) {
622 add_action('elementor/init', [$this, 'element_pack_ajax_login_init']);
623 }
624
625 // load WordPress dashboard scripts
626 add_action('admin_init', [$this, 'enqueue_admin_scripts']);
627 }
628
629 /**
630 * Element_Pack_Loader constructor.
631 */
632 private function __construct() {
633 // Register class automatically
634 spl_autoload_register([$this, 'autoload']);
635 // Include some backend files
636 $this->_includes();
637
638 // Finally hooked up all things here
639 $this->setup_hooks();
640
641 $this->element_pack_svg_support()->init();
642
643 $this->wpml_compatiblity()->init();
644 }
645 }
646
647 if (!defined('BDTEP_TESTS')) {
648 // In tests we run the instance manually.
649 Element_Pack_Loader::instance();
650 }
651 // handy function for push data
652 function element_pack_config() {
653 return Element_Pack_Loader::instance();
654 }
655