Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/bdthemes-element-pack-lite/loader.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
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
+
if (!defined('BDTEP_PC')) {
19
+
define('BDTEP_PC', '<span class="bdt-ep-pro-control"></span>');
20
+
} // pro control badge
21
+
define('BDTEP_IS_PC', 'bdt-ep-disabled-control');
22
+
define('BDTEP_LOCK_CLASS', 'bdt-ep-lock-control');
23
+
24
+
if (!defined('BDTEP_LOCK')) {
25
+
define('BDTEP_LOCK', ' - Pro ✨');
26
+
} // lock control badge
27
+
/**
28
+
* Main class for element pack
29
+
*/
30
+
class Element_Pack_Loader {
31
+
32
+
/**
33
+
* @var Element_Pack_Loader
34
+
*/
35
+
private static $_instance;
36
+
public $_modules_manager;
37
+
38
+
public $elements_data = [
39
+
'sections' => [],
40
+
'columns' => [],
41
+
'widgets' => [],
42
+
];
43
+
44
+
private function get_upload_dir() {
45
+
return trailingslashit(wp_upload_dir()['basedir']) . 'element-pack/minified/';
46
+
}
47
+
48
+
private function get_upload_url() {
49
+
return trailingslashit(wp_upload_dir()['baseurl']) . 'element-pack/minified/';
50
+
}
51
+
52
+
/**
53
+
* @return string
54
+
* @deprecated
55
+
*
56
+
*/
57
+
public function get_version() {
58
+
return BDTEP_VER;
59
+
}
60
+
61
+
/**
62
+
* return active theme
63
+
*/
64
+
public function get_theme() {
65
+
return wp_get_theme();
66
+
}
67
+
68
+
/**
69
+
* Throw error on object clone
70
+
*
71
+
* The whole idea of the singleton design pattern is that there is a single
72
+
* object therefore, we don't want the object to be cloned.
73
+
*
74
+
* @return void
75
+
* @since 1.0.0
76
+
*/
77
+
public function __clone() {
78
+
// Cloning instances of the class is forbidden
79
+
_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'bdthemes-element-pack'), '1.6.0');
80
+
}
81
+
82
+
/**
83
+
* Disable unserializing of the class
84
+
*
85
+
* @return void
86
+
* @since 1.0.0
87
+
*/
88
+
public function __wakeup() {
89
+
// Unserializing instances of the class is forbidden
90
+
_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'bdthemes-element-pack'), '1.6.0');
91
+
}
92
+
93
+
/**
94
+
* @return Plugin
95
+
*/
96
+
97
+
public static function elementor() {
98
+
return Plugin::$instance;
99
+
}
100
+
101
+
/**
102
+
* @return Element_Pack_Loader
103
+
*/
104
+
public static function instance() {
105
+
if (is_null(self::$_instance)) {
106
+
self::$_instance = new self();
107
+
}
108
+
109
+
return self::$_instance;
110
+
}
111
+
112
+
113
+
/**
114
+
* we loaded module manager + admin php from here
115
+
* @return [type] [description]
116
+
*/
117
+
private function _includes() {
118
+
119
+
$live_copy = element_pack_option('live-copy', 'element_pack_other_settings', 'off');
120
+
$template_library = element_pack_option('template-library', 'element_pack_other_settings', 'off');
121
+
$duplicator = element_pack_option('duplicator', 'element_pack_other_settings', 'off');
122
+
123
+
// Admin settings controller
124
+
require_once BDTEP_ADMIN_PATH . 'module-settings.php';
125
+
//Assets Manager
126
+
require_once 'admin/optimizer/asset-minifier-manager.php';
127
+
128
+
// Dynamic Select control
129
+
require_once BDTEP_INC_PATH . 'controls/select-input/dynamic-select-input-module.php';
130
+
require_once BDTEP_INC_PATH . 'controls/select-input/dynamic-select.php';
131
+
132
+
// Global Controls
133
+
require_once BDTEP_PATH . 'traits/global-widget-controls.php';
134
+
require_once BDTEP_PATH . 'traits/global-swiper-controls.php';
135
+
require_once BDTEP_PATH . 'traits/global-mask-controls.php';
136
+
137
+
// json upload support for wordpress
138
+
require_once BDTEP_INC_PATH . 'class-json-file-upload-control.php';
139
+
// svg support for full wordpress site
140
+
require_once BDTEP_INC_PATH . 'class-svg-support.php';
141
+
// All modules loading from here
142
+
require_once BDTEP_INC_PATH . 'modules-manager.php';
143
+
// wpml compatibility class for wpml support
144
+
require_once BDTEP_INC_PATH . 'class-elements-wpml-compatibility.php';
145
+
// For changelog file parse
146
+
require_once BDTEP_INC_PATH . 'class-parsedown.php';
147
+
148
+
// Live copy paste from demo website
149
+
if ($live_copy == 'on') {
150
+
require_once BDTEP_INC_PATH . 'live-copy/class-live-copy.php';
151
+
}
152
+
153
+
// register the elementor template loading widget in widgets
154
+
require_once BDTEP_INC_PATH . 'widgets/elementor-template.php';
155
+
156
+
// Facebook access token generator control for editor
157
+
require_once BDTEP_INC_PATH . 'class-fb-access-token-generator-control.php';
158
+
159
+
require_once BDTEP_INC_PATH . 'class-google-recaptcha.php';
160
+
161
+
if ($duplicator == 'on') {
162
+
require_once BDTEP_INC_PATH . 'class-duplicator.php';
163
+
}
164
+
165
+
// Rooten theme header footer compatibility
166
+
if ('Rooten' === $this->get_theme()->name or 'Rooten' === $this->get_theme()->parent_theme) {
167
+
if (!class_exists('RootenCustomTemplate')) {
168
+
require_once BDTEP_INC_PATH . 'class-rooten-theme-compatibility.php';
169
+
}
170
+
}
171
+
172
+
/**
173
+
* Editor template library
174
+
*/
175
+
if ( ! defined( 'BDTEP_CH' ) and $template_library == 'on' ) {
176
+
require_once BDTEP_INC_PATH . 'template-library/editor/init.php';
177
+
require_once BDTEP_INC_PATH . 'template-library/template-library-base.php';
178
+
require_once BDTEP_INC_PATH . 'template-library/editor/manager/api.php';
179
+
}
180
+
}
181
+
182
+
/**
183
+
* Autoloader function for all classes files
184
+
*
185
+
* @param [type] class [description]
186
+
*
187
+
* @return [type] [description]
188
+
*/
189
+
public function autoload($class) {
190
+
if (0 !== strpos($class, __NAMESPACE__)) {
191
+
return;
192
+
}
193
+
194
+
195
+
$class_to_load = $class;
196
+
197
+
if (!class_exists($class_to_load)) {
198
+
$filename = strtolower(
199
+
preg_replace(
200
+
['/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z0-9])/', '/_/', '/\\\/'],
201
+
['', '$1-$2', '-', DIRECTORY_SEPARATOR],
202
+
$class_to_load
203
+
)
204
+
);
205
+
206
+
$filename = BDTEP_PATH . $filename . '.php';
207
+
208
+
if (is_readable($filename)) {
209
+
include($filename);
210
+
}
211
+
}
212
+
}
213
+
214
+
/**
215
+
* Register all script that need for any specific widget on call basis.
216
+
* @return [type] [description]
217
+
*/
218
+
public function register_site_scripts() {
219
+
220
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
221
+
$api_settings = get_option('element_pack_api_settings');
222
+
223
+
if ( element_pack_is_widget_enabled( 'social-share' ) ) {
224
+
wp_register_script( 'goodshare', BDTEP_ASSETS_URL . 'vendor/js/goodshare.min.js', [ 'jquery' ], '4.1.2', true );
225
+
}
226
+
if (element_pack_is_widget_enabled('progress-pie')) {
227
+
wp_register_script('aspieprogress', BDTEP_ASSETS_URL . 'vendor/js/jquery-asPieProgress.min.js', ['jquery'], '0.4.7', true);
228
+
}
229
+
if (element_pack_is_widget_enabled('cookie-consent')) {
230
+
wp_register_script('cookieconsent', BDTEP_ASSETS_URL . 'vendor/js/cookieconsent.min.js', ['jquery'], '3.1.0', true);
231
+
}
232
+
if (element_pack_is_widget_enabled('static-grid-tab')) {
233
+
wp_register_script('gridtab', BDTEP_ASSETS_URL . 'vendor/js/gridtab.min.js', ['jquery'], '2.1.1', true);
234
+
}
235
+
if (element_pack_is_widget_enabled('user-register') or element_pack_is_widget_enabled('contact-form')) {
236
+
wp_register_script('recaptcha', 'https://www.google.com/recaptcha/api.js', ['jquery'], null, true);
237
+
}
238
+
if (element_pack_is_widget_enabled('open-street-map')) {
239
+
wp_register_script('leaflet', BDTEP_ASSETS_URL . 'vendor/js/leaflet.min.js', ['jquery'], '', true);
240
+
}
241
+
if (element_pack_is_widget_enabled('panel-slider')) {
242
+
wp_register_script('bdt-parallax', BDTEP_ASSETS_URL . 'vendor/js/parallax.min.js', ['jquery'], null, true);
243
+
}
244
+
if (element_pack_is_widget_enabled('image-magnifier')) {
245
+
wp_register_script('imagezoom', BDTEP_ASSETS_URL . 'vendor/js/jquery.imagezoom.min.js', ['jquery'], null, true);
246
+
}
247
+
if (element_pack_is_widget_enabled('logo-grid')) {
248
+
wp_register_script('popper', BDTEP_ASSETS_URL . 'vendor/js/popper.min.js', ['jquery'], null, true);
249
+
wp_register_script('tippyjs', BDTEP_ASSETS_URL . 'vendor/js/tippy.all.min.js', ['jquery'], null, true);
250
+
}
251
+
//advanced-image-gallery
252
+
if (element_pack_is_widget_enabled('custom-gallery') or element_pack_is_widget_enabled('tutor-lms-course-grid')) {
253
+
wp_register_script('tilt', BDTEP_ASSETS_URL . 'vendor/js/vanilla-tilt.min.js', ['jquery'], null, true);
254
+
}
255
+
if (element_pack_is_widget_enabled('reading-progress')) {
256
+
wp_register_script('progressHorizontal', BDTEP_ASSETS_URL . 'vendor/js/jquery.progressHorizontal.min.js', ['jquery'], '2.0.2', true);
257
+
// wp_register_script('progressScroll', BDTEP_ASSETS_URL . 'vendor/js/jquery.progressScroll.min.js', ['jquery'], '2.0.2', true);
258
+
}
259
+
if (element_pack_is_widget_enabled('image-compare')) {
260
+
wp_register_script('image-compare-viewer', BDTEP_ASSETS_URL . 'vendor/js/image-compare-viewer.min.js', ['jquery'], '0.0.1', true);
261
+
}
262
+
if (element_pack_is_widget_enabled('calendly')) {
263
+
wp_register_script('calendly', BDTEP_ASSETS_URL . 'vendor/js/calendly.min.js', ['jquery'], '0.0.1', true);
264
+
}
265
+
if (element_pack_is_widget_enabled('dark-mode')) {
266
+
wp_register_script('darkmode', BDTEP_ASSETS_URL . 'vendor/js/darkmode.min.js', ['jquery'], '1.1.1', true);
267
+
}
268
+
269
+
if ( element_pack_is_widget_enabled( 'review-card' )
270
+
or element_pack_is_widget_enabled( 'review-card-carousel' )
271
+
or element_pack_is_widget_enabled( 'testimonial-grid' ) ) {
272
+
wp_register_script( 'ep-text-read-more-toggle', BDTEP_ASSETS_URL . 'vendor/js/ep-text-read-more-toggle.min.js', ['jquery', 'bdt-uikit'], BDTEP_VER, true );
273
+
}
274
+
}
275
+
276
+
public function register_site_styles() {
277
+
$direction_suffix = is_rtl() ? '.rtl' : '';
278
+
279
+
// third party widget css
280
+
if (element_pack_is_widget_enabled('image-magnifier')) {
281
+
wp_register_style('imagezoom', BDTEP_ASSETS_URL . 'css/imagezoom' . $direction_suffix . '.css', [], BDTEP_VER);
282
+
}
283
+
284
+
/**
285
+
* ?TODO: Need to separate wc widget css
286
+
*/
287
+
wp_register_style('ep-tutor-lms', BDTEP_ASSETS_URL . 'css/ep-tutor-lms' . $direction_suffix . '.css', [], BDTEP_VER);
288
+
// Vendor style register
289
+
wp_register_style('tippy', BDTEP_ASSETS_URL . 'css/tippy' . $direction_suffix . '.css', [], BDTEP_VER);
290
+
}
291
+
292
+
/**
293
+
* Loading site related style from here.
294
+
* @return [type] [description]
295
+
*/
296
+
public function enqueue_site_styles() {
297
+
298
+
$direction_suffix = is_rtl() ? '.rtl' : '';
299
+
300
+
wp_register_style('bdt-uikit', BDTEP_ASSETS_URL . 'css/bdt-uikit' . $direction_suffix . '.css', [], '3.21.7');
301
+
wp_register_style('ep-helper', BDTEP_ASSETS_URL . 'css/ep-helper' . $direction_suffix . '.css', [], BDTEP_VER);
302
+
303
+
wp_enqueue_style( 'bdt-uikit' );
304
+
wp_enqueue_style( 'ep-helper' );
305
+
}
306
+
307
+
308
+
/**
309
+
* Loading site related script that needs all time such as uikit.
310
+
* @return [type] [description]mn
311
+
*/
312
+
public function enqueue_site_scripts() {
313
+
314
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
315
+
316
+
wp_register_script('bdt-uikit', BDTEP_ASSETS_URL . 'js/bdt-uikit' . $suffix . '.js', ['jquery'], '3.21.7', true);
317
+
318
+
wp_enqueue_script( 'bdt-uikit' );
319
+
320
+
if (!element_pack_is_asset_optimization_enabled()) {
321
+
wp_register_script('element-pack-helper', BDTEP_ASSETS_URL . 'js/common/helper' . $suffix . '.js', ['jquery'], BDTEP_VER, true);
322
+
wp_enqueue_script('element-pack-helper');
323
+
}
324
+
325
+
326
+
$script_config = [
327
+
'ajaxurl' => admin_url('admin-ajax.php'),
328
+
'nonce' => wp_create_nonce('element-pack-site'),
329
+
'data_table' => [
330
+
'language' => [
331
+
'lengthMenu' => sprintf(esc_html_x('Show %1s Entries', 'DataTable String', 'bdthemes-element-pack'), '_MENU_'),
332
+
'info' => sprintf(esc_html_x('Showing %1s to %2s of %3s entries', 'DataTable String', 'bdthemes-element-pack'), '_START_', '_END_', '_TOTAL_'),
333
+
'search' => esc_html_x('Search :', 'DataTable String', 'bdthemes-element-pack'),
334
+
'paginate' => [
335
+
'previous' => esc_html_x('Previous', 'DataTable String', 'bdthemes-element-pack'),
336
+
'next' => esc_html_x('Next', 'DataTable String', 'bdthemes-element-pack'),
337
+
],
338
+
],
339
+
],
340
+
'contact_form' => [
341
+
'sending_msg' => esc_html_x('Sending message please wait...', 'Contact Form String', 'bdthemes-element-pack'),
342
+
'captcha_nd' => esc_html_x('Invisible captcha not defined!', 'Contact Form String', 'bdthemes-element-pack'),
343
+
'captcha_nr' => esc_html_x('Could not get invisible captcha response!', 'Contact Form String', 'bdthemes-element-pack'),
344
+
345
+
],
346
+
'mailchimp' => [
347
+
'subscribing' => esc_html_x('Subscribing you please wait...', 'Mailchimp String', 'bdthemes-element-pack'),
348
+
],
349
+
'search' => [
350
+
'more_result' => esc_html_x( 'More Results', 'Search Widget String', 'bdthemes-element-pack' ),
351
+
'search_result' => esc_html_x( 'SEARCH RESULT', 'Search Widget String', 'bdthemes-element-pack' ),
352
+
'not_found' => esc_html_x( 'not found', 'Search Widget String', 'bdthemes-element-pack' ),
353
+
],
354
+
'words_limit' => [
355
+
'read_more' => esc_html_x( '[read more]', 'Read More String', 'bdthemes-element-pack' ),
356
+
'read_less' => esc_html_x( '[read less]', 'Read Less String', 'bdthemes-element-pack' ),
357
+
],
358
+
'elements_data' => $this->elements_data,
359
+
];
360
+
361
+
362
+
// localize for user login widget ajax login script
363
+
364
+
// if (!defined('ICL_LANGUAGE_CODE')) {
365
+
// define('ICL_LANGUAGE_CODE', null);
366
+
// }
367
+
// ICL_LANGUAGE_CODE = '';
368
+
// TODO Language dynamic for ajax call
369
+
370
+
wp_localize_script(
371
+
'bdt-uikit',
372
+
'element_pack_ajax_login_config',
373
+
array(
374
+
'ajaxurl' => admin_url('admin-ajax.php'),
375
+
'language' => substr(get_locale(), 0, 2),
376
+
'loadingmessage' => esc_html_x('Sending user info, please wait...', 'User Login and Register', 'bdthemes-element-pack'),
377
+
'unknownerror' => esc_html_x('Unknown error, make sure access is correct!', 'User Login and Register', 'bdthemes-element-pack'),
378
+
)
379
+
);
380
+
381
+
$script_config = apply_filters('element_pack/frontend/localize_settings', $script_config);
382
+
383
+
// TODO for editor script
384
+
wp_localize_script('bdt-uikit', 'ElementPackConfig', $script_config);
385
+
}
386
+
387
+
public function enqueue_editor_scripts() {
388
+
389
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
390
+
391
+
wp_register_script(
392
+
'element-pack',
393
+
BDTEP_ASSETS_URL . 'js/ep-editor' . $suffix . '.js',
394
+
[
395
+
'backbone-marionette',
396
+
'elementor-common-modules',
397
+
'elementor-editor-modules',
398
+
],
399
+
BDTEP_VER,
400
+
true
401
+
);
402
+
403
+
wp_enqueue_script( 'element-pack' );
404
+
405
+
$localize_data = [
406
+
'pro_installed' => element_pack_pro_installed(),
407
+
'promotional_widgets' => [],
408
+
'elementPackDynamicTags' => [
409
+
'enabled' => true,
410
+
'isProActive' => element_pack_pro_installed(),
411
+
'upgradeUrl' => 'https://elementpack.pro/pricing/',
412
+
'proFeatures' => [
413
+
'title' => esc_html__('Element Pack Pro', 'bdthemes-element-pack'),
414
+
'content' => esc_html__('Unlock advanced dynamic content features with Element Pack Pro. Access dozens of dynamic tags to create more personalized and dynamic sites.', 'bdthemes-element-pack'),
415
+
'upgradeText' => esc_html__('Upgrade to Pro', 'bdthemes-element-pack')
416
+
]
417
+
]
418
+
];
419
+
420
+
if (!element_pack_pro_installed()) {
421
+
$pro_widget_map = new Pro_Widget_Map();
422
+
$localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map();
423
+
}
424
+
425
+
wp_localize_script(
426
+
'element-pack',
427
+
'ElementPackConfig',
428
+
$localize_data
429
+
);
430
+
431
+
// $locale_settings = [
432
+
// 'i18n' => [],
433
+
// 'urls' => [
434
+
// 'modules' => BDTEP_MODULES_URL,
435
+
// ],
436
+
// ];
437
+
438
+
// $locale_settings = apply_filters( 'element_pack/editor/localize_settings', $locale_settings );
439
+
440
+
// wp_localize_script(
441
+
// 'element-pack',
442
+
// 'ElementPackConfig',
443
+
// $locale_settings
444
+
// );f
445
+
}
446
+
447
+
/**
448
+
* Load editor editor related style from here
449
+
* @return [type] [description]
450
+
*/
451
+
public function enqueue_preview_styles() {
452
+
$direction_suffix = is_rtl() ? '.rtl' : '';
453
+
454
+
wp_enqueue_style('ep-preview', BDTEP_ASSETS_URL . 'css/ep-preview' . $direction_suffix . '.css', '', BDTEP_VER);
455
+
}
456
+
457
+
458
+
public function enqueue_editor_styles() {
459
+
$direction_suffix = is_rtl() ? '.rtl' : '';
460
+
461
+
wp_register_style('ep-editor', BDTEP_ASSETS_URL . 'css/ep-editor' . $direction_suffix . '.css', '', BDTEP_VER);
462
+
wp_enqueue_style('ep-editor');
463
+
}
464
+
465
+
466
+
public function enqueue_minified_css() {
467
+
$direction_suffix = is_rtl() ? '.rtl' : '';
468
+
469
+
$upload_dir = $this->get_upload_dir() . 'css/ep-styles.css';
470
+
$version = get_option('element-pack-minified-asset-manager-version');
471
+
472
+
if (element_pack_is_asset_optimization_enabled() && file_exists($upload_dir)) {
473
+
$upload_url = $this->get_upload_url() . 'css/ep-styles.css';
474
+
wp_register_style('ep-styles', $upload_url, [], $version);
475
+
} else {
476
+
wp_register_style('ep-styles', BDTEP_URL . 'assets/css/ep-styles' . $direction_suffix . '.css', [], BDTEP_VER);
477
+
wp_register_style('ep-font', BDTEP_ASSETS_URL . 'css/ep-font' . $direction_suffix . '.css', [], BDTEP_VER);
478
+
}
479
+
480
+
if (element_pack_is_asset_optimization_enabled()) {
481
+
wp_enqueue_style('ep-styles');
482
+
}
483
+
484
+
/**
485
+
* Must load into Editor for Extension Support
486
+
*
487
+
* by U-011
488
+
*/
489
+
if ( Element_Pack_Loader::elementor()->preview->is_preview_mode() || Element_Pack_Loader::elementor()->editor->is_edit_mode() ) {
490
+
wp_enqueue_style( 'ep-styles' );
491
+
}
492
+
}
493
+
494
+
public function enqueue_minified_js() {
495
+
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
496
+
497
+
$upload_dir = $this->get_upload_dir() . 'js/ep-scripts.js';
498
+
$version = get_option('element-pack-minified-asset-manager-version');
499
+
500
+
if (element_pack_is_asset_optimization_enabled() && file_exists($upload_dir)) {
501
+
$upload_url = $this->get_upload_url() . 'js/ep-scripts.js';
502
+
503
+
wp_register_script('ep-scripts', $upload_url, ['jquery'], $version, true);
504
+
} else {
505
+
wp_register_script('ep-scripts', BDTEP_URL . 'assets/js/ep-scripts' . $suffix . '.js', ['jquery'], BDTEP_VER, true);
506
+
}
507
+
508
+
if (element_pack_is_asset_optimization_enabled()) {
509
+
wp_enqueue_script('ep-scripts');
510
+
}
511
+
/**
512
+
* Must load into Editor for Extension Support
513
+
*
514
+
* by U-011
515
+
*/
516
+
if ( Element_Pack_Loader::elementor()->preview->is_preview_mode() || Element_Pack_Loader::elementor()->editor->is_edit_mode() ) {
517
+
wp_enqueue_script( 'ep-scripts' );
518
+
}
519
+
}
520
+
521
+
/**
522
+
* To load biggopti JS file
523
+
*/
524
+
525
+
public function enqueue_admin_scripts() {
526
+
wp_enqueue_style( 'ep-biggopti', BDTEP_ADMIN_URL . 'assets/css/ep-biggopti.css', [], BDTEP_VER, 'all' );
527
+
wp_enqueue_script( 'ep-biggopti', BDTEP_ADMIN_URL . 'assets/js/ep-biggopti.js', [ 'jquery' ], BDTEP_VER, true );
528
+
529
+
$script_config = [
530
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
531
+
'nonce' => wp_create_nonce( 'element-pack' ),
532
+
];
533
+
wp_localize_script( 'ep-biggopti', 'ElementPackBiggoptiConfig', $script_config );
534
+
}
535
+
536
+
/**
537
+
* Callback to shortcodes template
538
+
* @param array $atts attributes for shortcode.
539
+
*/
540
+
public function shortcode_template($atts) {
541
+
542
+
$atts = shortcode_atts(
543
+
array(
544
+
'id' => '',
545
+
),
546
+
$atts,
547
+
'rooten_custom_template'
548
+
);
549
+
550
+
$id = !empty($atts['id']) ? intval($atts['id']) : '';
551
+
552
+
if (empty($id)) {
553
+
return '';
554
+
}
555
+
556
+
return self::elementor()->frontend->get_builder_content_for_display($id);
557
+
}
558
+
559
+
560
+
/**
561
+
* Add element_pack_ajax_login() function with wp_ajax_nopriv_ function
562
+
* @return [type] [description]
563
+
*/
564
+
public function element_pack_ajax_login_init() {
565
+
// Enable the user with no privileges to run element_pack_ajax_login() in AJAX
566
+
add_action('wp_ajax_nopriv_element_pack_ajax_login', [$this, "element_pack_ajax_login"]);
567
+
}
568
+
569
+
/**
570
+
* For ajax login
571
+
* @return [type] [description]
572
+
*/
573
+
public function element_pack_ajax_login() {
574
+
// First check the nonce, if it fails the function will break
575
+
check_ajax_referer('ajax-login-nonce', 'bdt-user-login-sc');
576
+
577
+
// Nonce is checked, get the POST data and sign user on
578
+
$access_info = [];
579
+
$access_info['user_login'] = !empty($_POST['user_login']) ? $_POST['user_login'] : "";
580
+
$access_info['user_password'] = !empty($_POST['user_password']) ? $_POST['user_password'] : "";
581
+
$access_info['remember'] = !empty($_POST['rememberme']) ? true : false;
582
+
$user_signon = wp_signon($access_info, false);
583
+
584
+
if (!is_wp_error($user_signon)) {
585
+
echo wp_json_encode(
586
+
[
587
+
'loggedin' => true,
588
+
'message' => esc_html_x('Login successful, Redirecting...', 'User Login and Register', 'bdthemes-element-pack')
589
+
]
590
+
);
591
+
} else {
592
+
echo wp_json_encode(
593
+
[
594
+
'loggedin' => false,
595
+
'message' => esc_html_x('Oops! Wrong username or password!', 'User Login and Register', 'bdthemes-element-pack')
596
+
]
597
+
);
598
+
}
599
+
600
+
die();
601
+
}
602
+
603
+
604
+
605
+
// Load WPML compatibility instance
606
+
public function wpml_compatiblity() {
607
+
return Element_Pack_WPML::get_instance();
608
+
}
609
+
610
+
611
+
/**
612
+
* initialize the category
613
+
* @return void
614
+
*/
615
+
public function element_pack_init() {
616
+
617
+
$this->_modules_manager = new Manager();
618
+
619
+
do_action('bdthemes_element_pack/init');
620
+
}
621
+
622
+
function ElementPack_Json_File_Import_register_controls() {
623
+
$controls_manager = Plugin::$instance->controls_manager;
624
+
$controls_manager->register(new ElementPack_JSON_File_Upload_Control());
625
+
}
626
+
627
+
628
+
629
+
function ElementPack_FB_Token_Register_Controls() {
630
+
631
+
$controls_manager = Plugin::$instance->controls_manager;
632
+
$controls_manager->register(new ElementPack_FB_Access_Token_Generator_Control());
633
+
}
634
+
635
+
/**
636
+
* initialize the category
637
+
* @return [type] [description]
638
+
*/
639
+
public function element_pack_category_register() {
640
+
641
+
$elementor = Plugin::$instance;
642
+
643
+
// Add element category in panel
644
+
$elementor->elements_manager->add_category(BDTEP_SLUG, ['title' => BDTEP_TITLE, 'icon' => 'font']);
645
+
}
646
+
647
+
public function element_pack_svg_support() {
648
+
649
+
return SVG_Support::get_instance();
650
+
}
651
+
652
+
private function setup_hooks() {
653
+
654
+
add_action('elementor/controls/register', [$this, 'ElementPack_Json_File_Import_register_controls']);
655
+
add_action('elementor/controls/register', [$this, 'ElementPack_FB_Token_Register_Controls']);
656
+
add_action('elementor/elements/categories_registered', [$this, 'element_pack_category_register']);
657
+
add_action('elementor/init', [$this, 'element_pack_init']);
658
+
659
+
add_action('elementor/editor/after_enqueue_styles', [$this, 'enqueue_editor_styles']);
660
+
661
+
add_action('wp_enqueue_scripts', [$this, 'register_site_styles'], 99999);
662
+
add_action('wp_enqueue_scripts', [$this, 'register_site_scripts'], 99999);
663
+
add_action('wp_enqueue_scripts', [$this, 'enqueue_site_styles'], 99999);
664
+
add_action('wp_enqueue_scripts', [$this, 'enqueue_site_scripts'], 99999);
665
+
666
+
add_action('elementor/preview/enqueue_styles', [$this, 'enqueue_preview_styles']);
667
+
add_action('elementor/editor/after_enqueue_scripts', [$this, 'enqueue_editor_scripts']);
668
+
669
+
670
+
// For frontend css load
671
+
add_action('elementor/frontend/after_enqueue_styles', [$this, 'enqueue_minified_css']);
672
+
add_action('elementor/frontend/after_enqueue_scripts', [$this, 'enqueue_minified_js']);
673
+
674
+
675
+
add_shortcode('rooten_custom_template', [$this, 'shortcode_template']);
676
+
677
+
678
+
// When user not login add this action
679
+
if (!is_user_logged_in()) {
680
+
add_action('elementor/init', [$this, 'element_pack_ajax_login_init']);
681
+
}
682
+
683
+
// load WordPress dashboard scripts
684
+
add_action('admin_init', [$this, 'enqueue_admin_scripts']);
685
+
}
686
+
687
+
/**
688
+
* Load files on init
689
+
*/
690
+
public function init() {
691
+
if ( is_admin() ) {
692
+
require_once BDTEP_ADMIN_PATH . 'admin.php';
693
+
new Admin();
694
+
}
695
+
}
696
+
697
+
/**
698
+
* Element_Pack_Loader constructor.
699
+
*/
700
+
private function __construct() {
701
+
// Register class automatically
702
+
spl_autoload_register([$this, 'autoload']);
703
+
// Include some backend files
704
+
$this->_includes();
705
+
706
+
// Finally hooked up all things here
707
+
$this->setup_hooks();
708
+
709
+
$this->element_pack_svg_support()->init();
710
+
711
+
$this->wpml_compatiblity()->init();
712
+
713
+
add_action( 'init', [ $this, 'init' ] );
714
+
}
715
+
}
716
+
717
+
if (!defined('BDTEP_TESTS')) {
718
+
// In tests we run the instance manually.
719
+
Element_Pack_Loader::instance();
720
+
}
721
+
// handy function for push data
722
+
function element_pack_config() {
723
+
return Element_Pack_Loader::instance();
724
+
}
725
+