Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/bdthemes-element-pack-lite/admin/admin-settings.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
use ElementPack\Notices;
4
+
use ElementPack\Utils;
5
+
use ElementPack\Admin\ModuleService;
6
+
use ElementPack\Base\Element_Pack_Base;
7
+
use Elementor\Modules\Usage\Module;
8
+
use Elementor\Tracker;
9
+
10
+
/**
11
+
* Element Pack Admin Settings Class
12
+
*/
13
+
14
+
class ElementPack_Admin_Settings {
15
+
16
+
public static $modules_list = null;
17
+
public static $modules_names = null;
18
+
19
+
public static $modules_list_only_widgets = null;
20
+
public static $modules_names_only_widgets = null;
21
+
22
+
public static $modules_list_only_3rdparty = null;
23
+
public static $modules_names_only_3rdparty = null;
24
+
25
+
const PAGE_ID = 'element_pack_options';
26
+
27
+
private $settings_api;
28
+
29
+
public $responseObj;
30
+
public $showMessage = false;
31
+
private $is_activated = false;
32
+
33
+
function __construct() {
34
+
$this->settings_api = new ElementPack_Settings_API;
35
+
36
+
add_action( 'admin_init', [ $this, 'admin_init' ] );
37
+
add_action( 'admin_menu', [ $this, 'admin_menu' ], 201 );
38
+
39
+
/**
40
+
* black_friday_notice
41
+
* Will be not show after 2024-12-06 00:00:00
42
+
*/
43
+
$current_date = date( 'Y-m-d H:i:s' );
44
+
$end_date = '2024-12-06 00:00:00';
45
+
46
+
if ( strtotime( $current_date ) < strtotime( $end_date ) ) {
47
+
add_action( 'admin_notices', [ $this, 'black_friday_notice' ], 10, 3 );
48
+
}
49
+
50
+
// Add custom CSS/JS functionality
51
+
$this->init_custom_code_functionality();
52
+
53
+
// Add AJAX handler for plugin installation
54
+
add_action('wp_ajax_ep_install_plugin', [$this, 'install_plugin_ajax']);
55
+
}
56
+
57
+
/**
58
+
* Initialize Custom Code Functionality
59
+
*
60
+
* @access public
61
+
* @return void
62
+
*/
63
+
public function init_custom_code_functionality() {
64
+
65
+
// Admin scripts (admin only)
66
+
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_custom_code_scripts' ] );
67
+
68
+
}
69
+
70
+
/**
71
+
* Enqueue scripts for custom code editor
72
+
*
73
+
* @access public
74
+
* @return void
75
+
*/
76
+
public function enqueue_custom_code_scripts( $hook ) {
77
+
if ( $hook !== 'toplevel_page_element_pack_options' ) {
78
+
return;
79
+
}
80
+
81
+
// Enqueue WordPress built-in CodeMirror
82
+
wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
83
+
wp_enqueue_code_editor( array( 'type' => 'application/javascript' ) );
84
+
85
+
// Enqueue WordPress media library scripts
86
+
wp_enqueue_media();
87
+
88
+
// Enqueue the admin script if it exists
89
+
$admin_script_path = BDTEP_ASSETS_PATH . 'js/ep-admin.js';
90
+
if ( file_exists( $admin_script_path ) ) {
91
+
wp_enqueue_script(
92
+
'ep-admin-script',
93
+
BDTEP_ASSETS_URL . 'js/ep-admin.js',
94
+
[ 'jquery', 'media-upload', 'media-views', 'code-editor' ],
95
+
BDTEP_VER,
96
+
true
97
+
);
98
+
99
+
// Localize script with AJAX data
100
+
wp_localize_script( 'ep-admin-script', 'ep_admin_ajax', [
101
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
102
+
'nonce' => wp_create_nonce( 'ep_custom_code_nonce' ),
103
+
'white_label_nonce' => wp_create_nonce( 'ep_white_label_nonce' )
104
+
] );
105
+
} else {
106
+
// Fallback: localize to jquery if the admin script doesn't exist
107
+
wp_localize_script( 'jquery', 'ep_admin_ajax', [
108
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
109
+
'nonce' => wp_create_nonce( 'ep_custom_code_nonce' ),
110
+
'white_label_nonce' => wp_create_nonce( 'ep_white_label_nonce' )
111
+
] );
112
+
}
113
+
}
114
+
115
+
/**
116
+
*Black Friday Notice
117
+
*
118
+
* @access public
119
+
*/
120
+
public function black_friday_notice() {
121
+
Notices::add_notice(
122
+
[
123
+
'id' => 'black-friday',
124
+
'type' => 'success',
125
+
'dismissible' => true,
126
+
'dismissible-time' => HOUR_IN_SECONDS * 72,
127
+
'html_message' => $this->black_friday_offer_notice_message(),
128
+
]
129
+
);
130
+
}
131
+
132
+
public function black_friday_offer_notice_message() {
133
+
$plugin_icon = BDTEP_ASSETS_URL . 'images/logo.svg';
134
+
$plugin_title = __( 'Best Savings On Black Friday Deals - ⚡Up To 85% Off🔥', 'bdthemes-element-pack' );
135
+
ob_start();
136
+
?>
137
+
<div class="bdt-license-notice-global element_pack_pro">
138
+
<div class="bdt-license-notice-content">
139
+
<h3>
140
+
<?php echo wp_kses_post( $plugin_title ); ?>
141
+
</h3>
142
+
<div class="bdt-license-notice-button-wrap">
143
+
<a href="https://bdthemes.com/black-friday/" target="_blank" class="bdt-button bdt-button-allow">
144
+
<?php esc_html_e( 'Get Deals Now', 'bdthemes-element-pack' ); ?>
145
+
</a>
146
+
</div>
147
+
</div>
148
+
<a href="https://bdthemes.com/black-friday/" target="_blank" class="bdt-link-btn"></a>
149
+
</div>
150
+
<?php
151
+
return ob_get_clean();
152
+
}
153
+
154
+
/**
155
+
* Get used widgets.
156
+
*
157
+
* @access public
158
+
* @return array
159
+
* @since 6.0.0
160
+
*
161
+
*/
162
+
public static function get_used_widgets() {
163
+
164
+
$used_widgets = array();
165
+
166
+
if ( ! Tracker::is_allow_track() ) {
167
+
return $used_widgets;
168
+
}
169
+
170
+
if ( class_exists( 'Elementor\Modules\Usage\Module' ) ) {
171
+
172
+
$module = Module::instance();
173
+
$elements = $module->get_formatted_usage( 'raw' );
174
+
$ep_widgets = self::get_ep_widgets_names();
175
+
176
+
if ( is_array( $elements ) || is_object( $elements ) ) {
177
+
178
+
foreach ( $elements as $post_type => $data ) {
179
+
foreach ( $data['elements'] as $element => $count ) {
180
+
if ( in_array( $element, $ep_widgets, true ) ) {
181
+
if ( isset( $used_widgets[ $element ] ) ) {
182
+
$used_widgets[ $element ] += $count;
183
+
} else {
184
+
$used_widgets[ $element ] = $count;
185
+
}
186
+
}
187
+
}
188
+
}
189
+
}
190
+
}
191
+
192
+
return $used_widgets;
193
+
}
194
+
195
+
/**
196
+
* Get used separate widgets.
197
+
*
198
+
* @access public
199
+
* @return array
200
+
* @since 6.0.0
201
+
*
202
+
*/
203
+
204
+
public static function get_used_only_widgets() {
205
+
206
+
$used_widgets = array();
207
+
208
+
if ( ! Tracker::is_allow_track() ) {
209
+
return $used_widgets;
210
+
}
211
+
212
+
if ( class_exists( 'Elementor\Modules\Usage\Module' ) ) {
213
+
214
+
$module = Module::instance();
215
+
$elements = $module->get_formatted_usage( 'raw' );
216
+
$ep_widgets = self::get_ep_only_widgets();
217
+
218
+
if ( is_array( $elements ) || is_object( $elements ) ) {
219
+
220
+
foreach ( $elements as $post_type => $data ) {
221
+
foreach ( $data['elements'] as $element => $count ) {
222
+
if ( in_array( $element, $ep_widgets, true ) ) {
223
+
if ( isset( $used_widgets[ $element ] ) ) {
224
+
$used_widgets[ $element ] += $count;
225
+
} else {
226
+
$used_widgets[ $element ] = $count;
227
+
}
228
+
}
229
+
}
230
+
}
231
+
}
232
+
}
233
+
234
+
return $used_widgets;
235
+
}
236
+
237
+
/**
238
+
* Get used only separate 3rdParty widgets.
239
+
*
240
+
* @access public
241
+
* @return array
242
+
* @since 6.0.0
243
+
*
244
+
*/
245
+
246
+
public static function get_used_only_3rdparty() {
247
+
248
+
$used_widgets = array();
249
+
250
+
if ( ! Tracker::is_allow_track() ) {
251
+
return $used_widgets;
252
+
}
253
+
254
+
if ( class_exists( 'Elementor\Modules\Usage\Module' ) ) {
255
+
256
+
$module = Module::instance();
257
+
$elements = $module->get_formatted_usage( 'raw' );
258
+
$ep_widgets = self::get_ep_only_3rdparty_names();
259
+
260
+
if ( is_array( $elements ) || is_object( $elements ) ) {
261
+
262
+
foreach ( $elements as $post_type => $data ) {
263
+
foreach ( $data['elements'] as $element => $count ) {
264
+
if ( in_array( $element, $ep_widgets, true ) ) {
265
+
if ( isset( $used_widgets[ $element ] ) ) {
266
+
$used_widgets[ $element ] += $count;
267
+
} else {
268
+
$used_widgets[ $element ] = $count;
269
+
}
270
+
}
271
+
}
272
+
}
273
+
}
274
+
}
275
+
276
+
return $used_widgets;
277
+
}
278
+
279
+
/**
280
+
* Get unused widgets.
281
+
*
282
+
* @access public
283
+
* @return array
284
+
* @since 6.0.0
285
+
*
286
+
*/
287
+
288
+
public static function get_unused_widgets() {
289
+
290
+
if ( ! current_user_can( 'install_plugins' ) ) {
291
+
die();
292
+
}
293
+
294
+
$ep_widgets = self::get_ep_widgets_names();
295
+
296
+
$used_widgets = self::get_used_widgets();
297
+
298
+
$unused_widgets = array_diff( $ep_widgets, array_keys( $used_widgets ) );
299
+
300
+
return $unused_widgets;
301
+
}
302
+
303
+
/**
304
+
* Get unused separate widgets.
305
+
*
306
+
* @access public
307
+
* @return array
308
+
* @since 6.0.0
309
+
*
310
+
*/
311
+
312
+
public static function get_unused_only_widgets() {
313
+
314
+
if ( ! current_user_can( 'install_plugins' ) ) {
315
+
die();
316
+
}
317
+
318
+
$ep_widgets = self::get_ep_only_widgets();
319
+
320
+
$used_widgets = self::get_used_only_widgets();
321
+
322
+
$unused_widgets = array_diff( $ep_widgets, array_keys( $used_widgets ) );
323
+
324
+
return $unused_widgets;
325
+
}
326
+
327
+
/**
328
+
* Get unused separate 3rdparty widgets.
329
+
*
330
+
* @access public
331
+
* @return array
332
+
* @since 6.0.0
333
+
*
334
+
*/
335
+
336
+
public static function get_unused_only_3rdparty() {
337
+
338
+
if ( ! current_user_can( 'install_plugins' ) ) {
339
+
die();
340
+
}
341
+
342
+
$ep_widgets = self::get_ep_only_3rdparty_names();
343
+
344
+
$used_widgets = self::get_used_only_3rdparty();
345
+
346
+
$unused_widgets = array_diff( $ep_widgets, array_keys( $used_widgets ) );
347
+
348
+
return $unused_widgets;
349
+
}
350
+
351
+
/**
352
+
* Get widgets name
353
+
*
354
+
* @access public
355
+
* @return array
356
+
* @since 6.0.0
357
+
*
358
+
*/
359
+
360
+
public static function get_ep_widgets_names() {
361
+
$names = self::$modules_names;
362
+
363
+
if ( null === $names ) {
364
+
$names = array_map(
365
+
function ($item) {
366
+
return isset( $item['name'] ) ? 'bdt-' . str_replace( '_', '-', $item['name'] ) : 'none';
367
+
},
368
+
self::$modules_list
369
+
);
370
+
}
371
+
372
+
return $names;
373
+
}
374
+
375
+
/**
376
+
* Get separate widgets name
377
+
*
378
+
* @access public
379
+
* @return array
380
+
* @since 6.0.0
381
+
*
382
+
*/
383
+
384
+
public static function get_ep_only_widgets() {
385
+
$names = self::$modules_names_only_widgets;
386
+
387
+
if ( null === $names ) {
388
+
$names = array_map(
389
+
function ($item) {
390
+
return isset( $item['name'] ) ? 'bdt-' . str_replace( '_', '-', $item['name'] ) : 'none';
391
+
},
392
+
self::$modules_list_only_widgets
393
+
);
394
+
}
395
+
396
+
return $names;
397
+
}
398
+
399
+
/**
400
+
* Get separate 3rdParty widgets name
401
+
*
402
+
* @access public
403
+
* @return array
404
+
* @since 6.0.0
405
+
*
406
+
*/
407
+
408
+
public static function get_ep_only_3rdparty_names() {
409
+
$names = self::$modules_names_only_3rdparty;
410
+
411
+
if ( null === $names ) {
412
+
$names = array_map(
413
+
function ($item) {
414
+
return isset( $item['name'] ) ? 'bdt-' . str_replace( '_', '-', $item['name'] ) : 'none';
415
+
},
416
+
self::$modules_list_only_3rdparty
417
+
);
418
+
}
419
+
420
+
return $names;
421
+
}
422
+
423
+
/**
424
+
* Get URL with page id
425
+
*
426
+
* @access public
427
+
*
428
+
*/
429
+
430
+
public static function get_url() {
431
+
return admin_url( 'admin.php?page=' . self::PAGE_ID );
432
+
}
433
+
434
+
/**
435
+
* Init settings API
436
+
*
437
+
* @access public
438
+
*
439
+
*/
440
+
441
+
public function admin_init() {
442
+
443
+
//set the settings
444
+
$this->settings_api->set_sections( $this->get_settings_sections() );
445
+
$this->settings_api->set_fields( $this->element_pack_admin_settings() );
446
+
447
+
//initialize settings
448
+
$this->settings_api->admin_init();
449
+
$this->ep_redirect_to_upgrade();
450
+
}
451
+
452
+
// Redirect to Element Pack Pro pricing page
453
+
public function ep_redirect_to_upgrade() {
454
+
if (isset($_GET['page']) && $_GET['page'] === self::PAGE_ID . '_upgrade') {
455
+
wp_redirect('https://bdthemes.com/deals/?utm_source=WordPress_org&utm_medium=bfcm_cta&utm_campaign=element_pack');
456
+
exit;
457
+
}
458
+
}
459
+
460
+
/**
461
+
* Add Plugin Menus
462
+
*
463
+
* @access public
464
+
*
465
+
*/
466
+
467
+
public function admin_menu() {
468
+
add_menu_page(
469
+
BDTEP_TITLE . ' ' . esc_html__( 'Dashboard', 'bdthemes-element-pack' ),
470
+
BDTEP_TITLE,
471
+
'manage_options',
472
+
self::PAGE_ID,
473
+
[ $this, 'plugin_page' ],
474
+
$this->element_pack_icon(),
475
+
58
476
+
);
477
+
478
+
add_submenu_page(
479
+
self::PAGE_ID,
480
+
esc_html__('Dashboard', 'bdthemes-element-pack'),
481
+
esc_html__('Dashboard', 'bdthemes-element-pack'),
482
+
'manage_options',
483
+
self::PAGE_ID,
484
+
[$this, 'plugin_page'],
485
+
);
486
+
487
+
add_submenu_page(
488
+
self::PAGE_ID,
489
+
BDTEP_TITLE,
490
+
esc_html__( 'Core Widgets', 'bdthemes-element-pack' ),
491
+
'manage_options',
492
+
self::PAGE_ID . '#element_pack_active_modules',
493
+
[ $this, 'display_page' ]
494
+
);
495
+
496
+
add_submenu_page(
497
+
self::PAGE_ID,
498
+
BDTEP_TITLE,
499
+
esc_html__( '3rd Party Widgets', 'bdthemes-element-pack' ),
500
+
'manage_options',
501
+
self::PAGE_ID . '#element_pack_third_party_widget',
502
+
[ $this, 'display_page' ]
503
+
);
504
+
505
+
add_submenu_page(
506
+
self::PAGE_ID,
507
+
BDTEP_TITLE,
508
+
esc_html__( 'Extensions', 'bdthemes-element-pack' ),
509
+
'manage_options',
510
+
self::PAGE_ID . '#element_pack_elementor_extend',
511
+
[ $this, 'display_page' ]
512
+
);
513
+
514
+
add_submenu_page(
515
+
self::PAGE_ID,
516
+
BDTEP_TITLE,
517
+
esc_html__( 'Special Features', 'bdthemes-element-pack' ),
518
+
'manage_options',
519
+
self::PAGE_ID . '#element_pack_other_settings',
520
+
[ $this, 'display_page' ]
521
+
);
522
+
523
+
add_submenu_page(
524
+
self::PAGE_ID,
525
+
BDTEP_TITLE,
526
+
esc_html__( 'API Settings', 'bdthemes-element-pack' ),
527
+
'manage_options',
528
+
self::PAGE_ID . '#element_pack_api_settings',
529
+
[ $this, 'display_page' ]
530
+
);
531
+
532
+
add_submenu_page(
533
+
self::PAGE_ID,
534
+
BDTEP_TITLE,
535
+
esc_html__('Extra Options', 'bdthemes-element-pack'),
536
+
'manage_options',
537
+
self::PAGE_ID . '#element_pack_extra_options',
538
+
[$this, 'display_page']
539
+
);
540
+
541
+
add_submenu_page(
542
+
self::PAGE_ID,
543
+
BDTEP_TITLE,
544
+
esc_html__('System Status', 'bdthemes-element-pack'),
545
+
'manage_options',
546
+
self::PAGE_ID . '#element_pack_analytics_system_req',
547
+
[$this, 'display_page']
548
+
);
549
+
550
+
add_submenu_page(
551
+
self::PAGE_ID,
552
+
BDTEP_TITLE,
553
+
esc_html__('Other Plugins', 'bdthemes-element-pack'),
554
+
'manage_options',
555
+
self::PAGE_ID . '#element_pack_other_plugins',
556
+
[$this, 'display_page']
557
+
);
558
+
559
+
if ( ! defined( 'BDTEP_LO' ) ) {
560
+
add_submenu_page(
561
+
self::PAGE_ID,
562
+
BDTEP_TITLE,
563
+
esc_html__( 'Black Friday Limited Offer up to 87%', 'bdthemes-element-pack' ),
564
+
'manage_options',
565
+
self::PAGE_ID . '_upgrade',
566
+
[ $this, 'display_page' ]
567
+
);
568
+
}
569
+
}
570
+
571
+
/**
572
+
* Get SVG Icons of Element Pack
573
+
*
574
+
* @access public
575
+
* @return string
576
+
*/
577
+
578
+
public function element_pack_icon() {
579
+
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSIyMzAuN3B4IiBoZWlnaHQ9IjI1NC44MXB4IiB2aWV3Qm94PSIwIDAgMjMwLjcgMjU0LjgxIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyMzAuNyAyNTQuODE7Ig0KCSB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik02MS4wOSwyMjkuMThIMjguOTVjLTMuMTcsMC01Ljc1LTIuNTctNS43NS01Ljc1bDAtMTkyLjA3YzAtMy4xNywyLjU3LTUuNzUsNS43NS01Ljc1aDMyLjE0DQoJYzMuMTcsMCw1Ljc1LDIuNTcsNS43NSw1Ljc1djE5Mi4wN0M2Ni44MywyMjYuNjEsNjQuMjYsMjI5LjE4LDYxLjA5LDIyOS4xOHoiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yMDcuNSwzMS4zN3YzMi4xNGMwLDMuMTctMi41Nyw1Ljc1LTUuNzUsNS43NUg5MC4wNGMtMy4xNywwLTUuNzUtMi41Ny01Ljc1LTUuNzVWMzEuMzcNCgljMC0zLjE3LDIuNTctNS43NSw1Ljc1LTUuNzVoMTExLjcyQzIwNC45MywyNS42MiwyMDcuNSwyOC4yLDIwNy41LDMxLjM3eiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIwNy41LDExMS4zM3YzMi4xNGMwLDMuMTctMi41Nyw1Ljc1LTUuNzUsNS43NUg5MC4wNGMtMy4xNywwLTUuNzUtMi41Ny01Ljc1LTUuNzV2LTMyLjE0DQoJYzAtMy4xNywyLjU3LTUuNzUsNS43NS01Ljc1aDExMS43MkMyMDQuOTMsMTA1LjU5LDIwNy41LDEwOC4xNiwyMDcuNSwxMTEuMzN6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjA3LjUsMTkxLjN2MzIuMTRjMCwzLjE3LTIuNTcsNS43NS01Ljc1LDUuNzVIOTAuMDRjLTMuMTcsMC01Ljc1LTIuNTctNS43NS01Ljc1VjE5MS4zDQoJYzAtMy4xNywyLjU3LTUuNzUsNS43NS01Ljc1aDExMS43MkMyMDQuOTMsMTg1LjU1LDIwNy41LDE4OC4xMywyMDcuNSwxOTEuM3oiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xNjkuNjIsMjUuNjJoMzIuMTRjMy4xNywwLDUuNzUsMi41Nyw1Ljc1LDUuNzV2MTEyLjFjMCwzLjE3LTIuNTcsNS43NS01Ljc1LDUuNzVoLTMyLjE0DQoJYy0zLjE3LDAtNS43NS0yLjU3LTUuNzUtNS43NVYzMS4zN0MxNjMuODcsMjguMiwxNjYuNDQsMjUuNjIsMTY5LjYyLDI1LjYyeiIvPg0KPC9zdmc+DQo=';
580
+
}
581
+
582
+
/**
583
+
* Get SVG Icons of Element Pack
584
+
*
585
+
* @access public
586
+
* @return array
587
+
*/
588
+
589
+
public function get_settings_sections() {
590
+
$sections = [
591
+
[
592
+
'id' => 'element_pack_active_modules',
593
+
'title' => esc_html__('Core Widgets', 'bdthemes-element-pack'),
594
+
'icon' => 'dashicons dashicons-screenoptions',
595
+
],
596
+
[
597
+
'id' => 'element_pack_third_party_widget',
598
+
'title' => esc_html__('3rd Party Widgets', 'bdthemes-element-pack'),
599
+
'icon' => 'dashicons dashicons-screenoptions',
600
+
],
601
+
[
602
+
'id' => 'element_pack_elementor_extend',
603
+
'title' => esc_html__('Extensions', 'bdthemes-element-pack'),
604
+
'icon' => 'dashicons dashicons-screenoptions',
605
+
],
606
+
[
607
+
'id' => 'element_pack_other_settings',
608
+
'title' => esc_html__('Special Features', 'bdthemes-element-pack'),
609
+
'icon' => 'dashicons dashicons-screenoptions',
610
+
],
611
+
[
612
+
'id' => 'element_pack_api_settings',
613
+
'title' => esc_html__('API Settings', 'bdthemes-element-pack'),
614
+
'icon' => 'dashicons dashicons-admin-settings',
615
+
],
616
+
];
617
+
618
+
return $sections;
619
+
}
620
+
621
+
/**
622
+
* Merge Admin Settings
623
+
*
624
+
* @access protected
625
+
* @return array
626
+
*/
627
+
628
+
protected function element_pack_admin_settings() {
629
+
630
+
return ModuleService::get_widget_settings( function ($settings) {
631
+
$settings_fields = $settings['settings_fields'];
632
+
633
+
self::$modules_list = array_merge( $settings_fields['element_pack_active_modules'], $settings_fields['element_pack_third_party_widget'] );
634
+
self::$modules_list_only_widgets = $settings_fields['element_pack_active_modules'];
635
+
self::$modules_list_only_3rdparty = $settings_fields['element_pack_third_party_widget'];
636
+
637
+
return $settings_fields;
638
+
} );
639
+
}
640
+
641
+
/**
642
+
* Get Welcome Panel
643
+
*
644
+
* @access public
645
+
* @return void
646
+
*/
647
+
648
+
public function element_pack_welcome() {
649
+
650
+
?>
651
+
652
+
<div class="ep-dashboard-panel"
653
+
bdt-scrollspy="target: > div > div > .bdt-card; cls: bdt-animation-slide-bottom-small; delay: 300">
654
+
655
+
<div class="ep-dashboard-welcome-container">
656
+
657
+
<div class="ep-dashboard-item ep-dashboard-welcome bdt-card bdt-card-body">
658
+
<h1 class="ep-feature-title ep-dashboard-welcome-title">
659
+
<?php esc_html_e('Welcome to Element Pack!', 'bdthemes-element-pack'); ?>
660
+
</h1>
661
+
<p class="ep-dashboard-welcome-desc">
662
+
<?php esc_html_e('Empower your web creation with powerful widgets, advanced extensions, and 2700+ ready templates and more.', 'bdthemes-element-pack'); ?>
663
+
</p>
664
+
<a href="<?php echo admin_url('?ep_setup_wizard=show'); ?>"
665
+
class="bdt-button bdt-welcome-button bdt-margin-small-top"
666
+
target="_blank"><?php esc_html_e('Setup Element Pack', 'bdthemes-element-pack'); ?></a>
667
+
668
+
<div class="ep-dashboard-compare-section">
669
+
<h4 class="ep-feature-sub-title">
670
+
<?php printf(esc_html__('Unlock %sPremium Features%s', 'bdthemes-element-pack'), '<strong class="ep-highlight-text">', '</strong>'); ?>
671
+
</h4>
672
+
<h1 class="ep-feature-title ep-dashboard-compare-title">
673
+
<?php esc_html_e('Create Your Sleek Website with Element Pack Pro!', 'bdthemes-element-pack'); ?>
674
+
</h1>
675
+
<p><?php esc_html_e('Don\'t need more plugins. This pro addon helps you build complex or professional websites—visually stunning, functional and customizable.', 'bdthemes-element-pack'); ?>
676
+
</p>
677
+
<ul>
678
+
<li><?php esc_html_e('Dynamic Content and Integrations', 'bdthemes-element-pack'); ?></li>
679
+
<li><?php esc_html_e('Enhanced Template Library', 'bdthemes-element-pack'); ?></li>
680
+
<li><?php esc_html_e('Theme Builder', 'bdthemes-element-pack'); ?></li>
681
+
<li><?php esc_html_e('Mega Menu Builder', 'bdthemes-element-pack'); ?></li>
682
+
<li><?php esc_html_e('Powerful Widgets and Advanced Extensions', 'bdthemes-element-pack'); ?>
683
+
</li>
684
+
</ul>
685
+
<div class="ep-dashboard-compare-section-buttons">
686
+
<a href="https://www.elementpack.pro/pricing/#a2a0062"
687
+
class="bdt-button bdt-welcome-button bdt-margin-small-right"
688
+
target="_blank"><?php esc_html_e('Compare Free Vs Pro', 'bdthemes-element-pack'); ?></a>
689
+
<a href="https://www.elementpack.pro/pricing?utm_source=ElementPackLite&utm_medium=PluginPage&utm_campaign=ElementPackLite&coupon=FREETOPRO"
690
+
class="bdt-button bdt-dashboard-sec-btn"
691
+
target="_blank"><?php esc_html_e('Get Premium at Up to 83% OFF', 'bdthemes-element-pack'); ?></a>
692
+
</div>
693
+
</div>
694
+
</div>
695
+
696
+
<div class="ep-dashboard-item ep-dashboard-template-quick-access bdt-card bdt-card-body">
697
+
<div class="ep-dashboard-template-section">
698
+
<img src="<?php echo BDTEP_ADMIN_URL . 'assets/images/template.jpg'; ?>"
699
+
alt="Element Pack Dashboard Template">
700
+
<h1 class="ep-feature-title ">
701
+
<?php esc_html_e('Faster Web Creation with Sleek and Ready-to-Use Templates!', 'bdthemes-element-pack'); ?>
702
+
</h1>
703
+
<p><?php esc_html_e('Build your wordpress websites of any niche—not from scratch and in a single click.', 'bdthemes-element-pack'); ?>
704
+
</p>
705
+
<a href="https://www.elementpack.pro/ready-templates/"
706
+
class="bdt-button bdt-dashboard-sec-btn bdt-margin-small-top"
707
+
target="_blank"><?php esc_html_e('View Templates', 'bdthemes-element-pack'); ?></a>
708
+
</div>
709
+
710
+
<div class="ep-dashboard-quick-access bdt-margin-medium-top">
711
+
<img src="<?php echo BDTEP_ADMIN_URL . 'assets/images/support.svg'; ?>"
712
+
alt="Element Pack Dashboard Template">
713
+
<h1 class="ep-feature-title">
714
+
<?php esc_html_e('Getting Started with Quick Access', 'bdthemes-element-pack'); ?>
715
+
</h1>
716
+
<ul>
717
+
<li><a href="https://www.elementpack.pro/contact/"
718
+
target="_blank"><?php esc_html_e('Contact Us', 'bdthemes-element-pack'); ?></a></li>
719
+
<li><a href="https://bdthemes.com/support/"
720
+
target="_blank"><?php esc_html_e('Help Centre', 'bdthemes-element-pack'); ?></a></li>
721
+
<li><a href="https://feedback.bdthemes.com/b/6vr2250l/feature-requests/idea/new"
722
+
target="_blank"><?php esc_html_e('Request a Feature', 'bdthemes-element-pack'); ?></a>
723
+
</li>
724
+
</ul>
725
+
<div class="ep-dashboard-support-section">
726
+
<h1 class="ep-feature-title">
727
+
<i class="dashicons dashicons-phone"></i>
728
+
<?php esc_html_e('24/7 Support', 'bdthemes-element-pack'); ?>
729
+
</h1>
730
+
<p><?php esc_html_e('Helping you get real-time solutions related to web creation with WordPress, Elementor, and Element Pack.', 'bdthemes-element-pack'); ?>
731
+
</p>
732
+
<a href="https://bdthemes.com/support/" class="bdt-margin-small-top"
733
+
target="_blank"><?php esc_html_e('Get Your Support', 'bdthemes-element-pack'); ?></a>
734
+
</div>
735
+
</div>
736
+
</div>
737
+
738
+
<div class="ep-dashboard-item ep-dashboard-request-feature bdt-card bdt-card-body">
739
+
<h1 class="ep-feature-title ep-dashboard-template-quick-title">
740
+
<?php esc_html_e('What\'s Stacking You?', 'bdthemes-element-pack'); ?>
741
+
</h1>
742
+
<p><?php esc_html_e('We are always here to help you. If you have any feature request, please let us know.', 'bdthemes-element-pack'); ?>
743
+
</p>
744
+
<a href="https://feedback.elementpack.pro/b/3v2gg80n/feature-requests/idea/new"
745
+
class="bdt-button bdt-dashboard-sec-btn bdt-margin-small-top"
746
+
target="_blank"><?php esc_html_e('Request Your Features', 'bdthemes-element-pack'); ?></a>
747
+
</div>
748
+
749
+
<a href="https://www.youtube.com/watch?v=-e-kr4Vkh4E&list=PLP0S85GEw7DOJf_cbgUIL20qqwqb5x8KA" target="_blank"
750
+
class="ep-dashboard-item ep-dashboard-footer-item ep-dashboard-video-tutorial bdt-card bdt-card-body bdt-card-small">
751
+
<span class="ep-dashboard-footer-item-icon">
752
+
<i class="dashicons dashicons-video-alt3"></i>
753
+
</span>
754
+
<h1 class="ep-feature-title"><?php esc_html_e('Watch Video Tutorials', 'bdthemes-element-pack'); ?></h1>
755
+
<p><?php esc_html_e('An invaluable resource for mastering WordPress, Elementor, and Web Creation', 'bdthemes-element-pack'); ?>
756
+
</p>
757
+
</a>
758
+
<a href="https://bdthemes.com/all-knowledge-base-of-element-pack/" target="_blank"
759
+
class="ep-dashboard-item ep-dashboard-footer-item ep-dashboard-documentation bdt-card bdt-card-body bdt-card-small">
760
+
<span class="ep-dashboard-footer-item-icon">
761
+
<i class="dashicons dashicons-admin-tools"></i>
762
+
</span>
763
+
</span>
764
+
<h1 class="ep-feature-title"><?php esc_html_e('Read Easy Documentation', 'bdthemes-element-pack'); ?></h1>
765
+
<p><?php esc_html_e('A way to eliminate the challenges you might face', 'bdthemes-element-pack'); ?></p>
766
+
</a>
767
+
<a href="https://www.facebook.com/bdthemes" target="_blank"
768
+
class="ep-dashboard-item ep-dashboard-footer-item ep-dashboard-community bdt-card bdt-card-body bdt-card-small">
769
+
<span class="ep-dashboard-footer-item-icon">
770
+
<i class="dashicons dashicons-admin-users"></i>
771
+
</span>
772
+
<h1 class="ep-feature-title"><?php esc_html_e('Join Our Community', 'bdthemes-element-pack'); ?></h1>
773
+
<p><?php esc_html_e('A platform for the opportunity to network, collaboration and innovation', 'bdthemes-element-pack'); ?>
774
+
</p>
775
+
</a>
776
+
<a href="https://wordpress.org/plugins/bdthemes-element-pack-lite/#reviews" target="_blank"
777
+
class="ep-dashboard-item ep-dashboard-footer-item ep-dashboard-review bdt-card bdt-card-body bdt-card-small">
778
+
<span class="ep-dashboard-footer-item-icon">
779
+
<i class="dashicons dashicons-star-filled"></i>
780
+
</span>
781
+
<h1 class="ep-feature-title"><?php esc_html_e('Show Your Love', 'bdthemes-element-pack'); ?></h1>
782
+
<p><?php esc_html_e('A way of the assessment of code', 'bdthemes-element-pack'); ?></p>
783
+
</a>
784
+
</div>
785
+
786
+
</div>
787
+
788
+
<?php
789
+
}
790
+
791
+
/**
792
+
* Others Plugin
793
+
*/
794
+
795
+
public function element_pack_others_plugin() {
796
+
// Include the Plugin Integration Helper and API Fetcher
797
+
require_once BDTEP_INC_PATH . 'setup-wizard/class-plugin-api-fetcher.php';
798
+
require_once BDTEP_INC_PATH . 'setup-wizard/class-plugin-integration-helper.php';
799
+
800
+
// Define plugin slugs to fetch data for (same as integration view)
801
+
$plugin_slugs = array(
802
+
'bdthemes-prime-slider-lite/bdthemes-prime-slider.php',
803
+
'ultimate-post-kit',
804
+
'ultimate-store-kit',
805
+
'zoloblocks',
806
+
'pixel-gallery',
807
+
'live-copy-paste',
808
+
'spin-wheel',
809
+
'ai-image',
810
+
'dark-reader',
811
+
'ar-viewer',
812
+
'smart-admin-assistant',
813
+
'website-accessibility',
814
+
);
815
+
816
+
// Get plugin data using the helper (same as integration view)
817
+
$ep_plugins = \ElementPack\SetupWizard\Plugin_Integration_Helper::build_plugin_data($plugin_slugs);
818
+
819
+
// Helper function for time formatting (same as integration view)
820
+
if (!function_exists('format_last_updated_ep')) {
821
+
function format_last_updated_ep($date_string) {
822
+
if (empty($date_string)) {
823
+
return __('Unknown', 'bdthemes-element-pack');
824
+
}
825
+
826
+
$date = strtotime($date_string);
827
+
if (!$date) {
828
+
return __('Unknown', 'bdthemes-element-pack');
829
+
}
830
+
831
+
$diff = current_time('timestamp') - $date;
832
+
833
+
if ($diff < 60) {
834
+
return __('Just now', 'bdthemes-element-pack');
835
+
} elseif ($diff < 3600) {
836
+
$minutes = floor($diff / 60);
837
+
return sprintf(_n('%d minute ago', '%d minutes ago', $minutes, 'bdthemes-element-pack'), $minutes);
838
+
} elseif ($diff < 86400) {
839
+
$hours = floor($diff / 3600);
840
+
return sprintf(_n('%d hour ago', '%d hours ago', $hours, 'bdthemes-element-pack'), $hours);
841
+
} elseif ($diff < 2592000) { // 30 days
842
+
$days = floor($diff / 86400);
843
+
return sprintf(_n('%d day ago', '%d days ago', $days, 'bdthemes-element-pack'), $days);
844
+
} elseif ($diff < 31536000) { // 1 year
845
+
$months = floor($diff / 2592000);
846
+
return sprintf(_n('%d month ago', '%d months ago', $months, 'bdthemes-element-pack'), $months);
847
+
} else {
848
+
$years = floor($diff / 31536000);
849
+
return sprintf(_n('%d year ago', '%d years ago', $years, 'bdthemes-element-pack'), $years);
850
+
}
851
+
}
852
+
}
853
+
854
+
// Helper function for fallback URLs (same as integration view)
855
+
if (!function_exists('get_plugin_fallback_urls_ep')) {
856
+
function get_plugin_fallback_urls_ep($plugin_slug) {
857
+
// Handle different plugin slug formats
858
+
if (strpos($plugin_slug, '/') !== false) {
859
+
// If it's a file path like 'plugin-name/plugin-name.php', extract directory
860
+
$plugin_slug_clean = dirname($plugin_slug);
861
+
} else {
862
+
// If it's just the plugin directory name, use it directly
863
+
$plugin_slug_clean = $plugin_slug;
864
+
}
865
+
866
+
// Custom icon URLs for specific plugins that might not be on WordPress.org
867
+
$custom_icons = [
868
+
'ar-viewer' => [
869
+
'https://ps.w.org/ar-viewer/assets/icon-256x256.gif',
870
+
'https://ps.w.org/ar-viewer/assets/icon-128x128.gif',
871
+
],
872
+
// 'spin-wheel' => [
873
+
// 'https://ps.w.org/spin-wheel/assets/icon-256x256.png',
874
+
// 'https://ps.w.org/spin-wheel/assets/icon-128x128.png',
875
+
// ],
876
+
// 'ai-image' => [
877
+
// 'https://ps.w.org/ai-image/assets/icon-256x256.png',
878
+
// 'https://ps.w.org/ai-image/assets/icon-128x128.png',
879
+
// ],
880
+
// 'smart-admin-assistant' => [
881
+
// 'https://ps.w.org/smart-admin-assistant/assets/icon-256x256.png',
882
+
// 'https://ps.w.org/smart-admin-assistant/assets/icon-128x128.png',
883
+
// ]
884
+
];
885
+
886
+
// Return custom icons if available, otherwise use default WordPress.org URLs
887
+
if (isset($custom_icons[$plugin_slug_clean])) {
888
+
return $custom_icons[$plugin_slug_clean];
889
+
}
890
+
891
+
return [
892
+
"https://ps.w.org/{$plugin_slug_clean}/assets/icon-256x256.png", // Then PNG
893
+
"https://ps.w.org/{$plugin_slug_clean}/assets/icon-128x128.png", // Medium PNG
894
+
"https://ps.w.org/{$plugin_slug_clean}/assets/icon-256x256.gif", // Try GIF first
895
+
"https://ps.w.org/{$plugin_slug_clean}/assets/icon-128x128.gif", // Medium GIF
896
+
];
897
+
}
898
+
}
899
+
?>
900
+
<div class="ep-dashboard-panel"
901
+
bdt-scrollspy="target: > div > div > .bdt-card; cls: bdt-animation-slide-bottom-small; delay: 300">
902
+
<div class="ep-dashboard-others-plugin">
903
+
904
+
<?php foreach ($ep_plugins as $plugin) :
905
+
$is_active = is_plugin_active($plugin['slug']);
906
+
907
+
// Get plugin logo with fallback
908
+
$logo_url = $plugin['logo'] ?? '';
909
+
$plugin_name = $plugin['name'] ?? '';
910
+
$plugin_slug = $plugin['slug'] ?? '';
911
+
912
+
if (empty($logo_url) || !filter_var($logo_url, FILTER_VALIDATE_URL)) {
913
+
// Generate fallback URLs for WordPress.org
914
+
$actual_slug = str_replace('.php', '', dirname($plugin_slug));
915
+
$fallback_urls = get_plugin_fallback_urls_ep($actual_slug);
916
+
$logo_url = $fallback_urls[0];
917
+
}
918
+
?>
919
+
920
+
<div class="bdt-card bdt-card-body bdt-flex bdt-flex-middle bdt-flex-between">
921
+
<div class="bdt-others-plugin-content">
922
+
<div class="bdt-plugin-logo-wrap bdt-flex bdt-flex-middle">
923
+
<div class="bdt-plugin-logo-container">
924
+
<img src="<?php echo esc_url($logo_url); ?>"
925
+
alt="<?php echo esc_attr($plugin_name); ?>"
926
+
class="bdt-plugin-logo"
927
+
onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
928
+
<div class="default-plugin-icon" style="display:none;">📦</div>
929
+
</div>
930
+
931
+
<div class="bdt-others-plugin-user-wrap bdt-flex bdt-flex-middle">
932
+
<h1 class="ep-feature-title"><?php echo esc_html($plugin_name); ?></h1>
933
+
</div>
934
+
</div>
935
+
936
+
<div class="bdt-others-plugin-content-text bdt-margin-top">
937
+
938
+
<?php if (!empty($plugin['description'])) : ?>
939
+
<p><?php echo esc_html($plugin['description']); ?></p>
940
+
<?php endif; ?>
941
+
942
+
<span class="active-installs bdt-margin-small-top">
943
+
<?php esc_html_e('Active Installs: ', 'bdthemes-element-pack');
944
+
// echo wp_kses_post($plugin['active_installs'] ?? '0');
945
+
if (isset($plugin['active_installs_count']) && $plugin['active_installs_count'] > 0) {
946
+
echo ' <span class="installs-count">' . number_format($plugin['active_installs_count']) . '+' . '</span>';
947
+
} else {
948
+
echo ' <span class="installs-count">Fewer than 10' . '</span>';
949
+
}
950
+
?>
951
+
</span>
952
+
953
+
<div class="bdt-others-plugin-rating bdt-margin-small-top bdt-flex bdt-flex-middle">
954
+
<span class="bdt-others-plugin-rating-stars">
955
+
<?php
956
+
$rating = floatval($plugin['rating'] ?? 0);
957
+
$full_stars = floor($rating);
958
+
$has_half_star = ($rating - $full_stars) >= 0.5;
959
+
$empty_stars = 5 - $full_stars - ($has_half_star ? 1 : 0);
960
+
961
+
// Full stars
962
+
for ($i = 0; $i < $full_stars; $i++) {
963
+
echo '<i class="dashicons dashicons-star-filled"></i>';
964
+
}
965
+
966
+
// Half star
967
+
if ($has_half_star) {
968
+
echo '<i class="dashicons dashicons-star-half"></i>';
969
+
}
970
+
971
+
// Empty stars
972
+
for ($i = 0; $i < $empty_stars; $i++) {
973
+
echo '<i class="dashicons dashicons-star-empty"></i>';
974
+
}
975
+
?>
976
+
</span>
977
+
<span class="bdt-others-plugin-rating-text bdt-margin-small-left">
978
+
<?php echo esc_html($plugin['rating'] ?? '0'); ?> <?php esc_html_e('out of 5 stars.', 'bdthemes-element-pack'); ?>
979
+
<?php if (isset($plugin['num_ratings']) && $plugin['num_ratings'] > 0): ?>
980
+
<span class="rating-count">(<?php echo number_format($plugin['num_ratings']); ?> <?php esc_html_e('ratings', 'bdthemes-element-pack'); ?>)</span>
981
+
<?php endif; ?>
982
+
</span>
983
+
</div>
984
+
985
+
<?php if (isset($plugin['downloaded_formatted']) && !empty($plugin['downloaded_formatted'])): ?>
986
+
<div class="bdt-others-plugin-downloads bdt-margin-small-top">
987
+
<span><?php esc_html_e('Downloads: ', 'bdthemes-element-pack'); ?><?php echo esc_html($plugin['downloaded_formatted']); ?></span>
988
+
</div>
989
+
<?php endif; ?>
990
+
991
+
<?php if (isset($plugin['last_updated']) && !empty($plugin['last_updated'])): ?>
992
+
<div class="bdt-others-plugin-updated bdt-margin-small-top">
993
+
<span><?php esc_html_e('Last Updated: ', 'bdthemes-element-pack'); ?><?php echo esc_html(format_last_updated_ep($plugin['last_updated'])); ?></span>
994
+
</div>
995
+
<?php endif; ?>
996
+
</div>
997
+
</div>
998
+
999
+
<div class="bdt-others-plugins-link">
1000
+
<?php echo $this->get_plugin_action_button($plugin['slug'], 'https://wordpress.org/plugins/' . dirname($plugin['slug']) . '/'); ?>
1001
+
<?php if (!empty($plugin['homepage'])) : ?>
1002
+
<a class="bdt-button bdt-dashboard-sec-btn" target="_blank" href="<?php echo esc_url($plugin['homepage']); ?>">
1003
+
<?php esc_html_e('Learn More', 'bdthemes-element-pack'); ?>
1004
+
</a>
1005
+
<?php endif; ?>
1006
+
</div>
1007
+
</div>
1008
+
1009
+
<?php endforeach; ?>
1010
+
</div>
1011
+
</div>
1012
+
<?php
1013
+
}
1014
+
1015
+
/**
1016
+
* Widgets Status
1017
+
*/
1018
+
1019
+
public function element_pack_widgets_status() {
1020
+
$track_nw_msg = '';
1021
+
if (!Tracker::is_allow_track()) {
1022
+
$track_nw = esc_html__('This feature is not working because the Elementor Usage Data Sharing feature is Not Enabled.', 'bdthemes-element-pack');
1023
+
$track_nw_msg = 'bdt-tooltip="' . $track_nw . '"';
1024
+
}
1025
+
?>
1026
+
<div class="ep-dashboard-widgets-status">
1027
+
<div class="bdt-grid bdt-grid-medium" bdt-grid bdt-height-match="target: > div > .bdt-card">
1028
+
<div class="bdt-width-1-2@m bdt-width-1-4@xl">
1029
+
<div class="ep-widget-status bdt-card bdt-card-body" <?php echo wp_kses_post($track_nw_msg); ?>>
1030
+
1031
+
<?php
1032
+
$used_widgets = count(self::get_used_widgets());
1033
+
$un_used_widgets = count(self::get_unused_widgets());
1034
+
?>
1035
+
1036
+
<div class="ep-count-canvas-wrap">
1037
+
<h1 class="ep-feature-title"><?php esc_html_e('All Widgets', 'bdthemes-element-pack'); ?></h1>
1038
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
1039
+
<div class="ep-count-wrap">
1040
+
<div class="ep-widget-count"><?php esc_html_e('Used:', 'bdthemes-element-pack'); ?> <b>
1041
+
<?php echo esc_html($used_widgets); ?>
1042
+
</b></div>
1043
+
<div class="ep-widget-count"><?php esc_html_e('Unused:', 'bdthemes-element-pack'); ?> <b>
1044
+
<?php echo esc_html($un_used_widgets); ?>
1045
+
</b>
1046
+
</div>
1047
+
<div class="ep-widget-count"><?php esc_html_e('Total:', 'bdthemes-element-pack'); ?>
1048
+
<b>
1049
+
<?php echo esc_html($used_widgets + $un_used_widgets); ?>
1050
+
</b>
1051
+
</div>
1052
+
</div>
1053
+
1054
+
<div class="ep-canvas-wrap">
1055
+
<canvas id="bdt-db-total-status" style="height: 100px; width: 100px;"
1056
+
data-label="Total Widgets Status - (<?php echo esc_html($used_widgets + $un_used_widgets); ?>)"
1057
+
data-labels="<?php echo esc_attr('Used, Unused'); ?>"
1058
+
data-value="<?php echo esc_attr($used_widgets) . ',' . esc_attr($un_used_widgets); ?>"
1059
+
data-bg="#FFD166, #fff4d9" data-bg-hover="#0673e1, #e71522"></canvas>
1060
+
</div>
1061
+
</div>
1062
+
</div>
1063
+
1064
+
</div>
1065
+
</div>
1066
+
<div class="bdt-width-1-2@m bdt-width-1-4@xl">
1067
+
<div class="ep-widget-status bdt-card bdt-card-body" <?php echo wp_kses_post($track_nw_msg); ?>>
1068
+
1069
+
<?php
1070
+
$used_only_widgets = count(self::get_used_only_widgets());
1071
+
$unused_only_widgets = count(self::get_unused_only_widgets());
1072
+
?>
1073
+
1074
+
1075
+
<div class="ep-count-canvas-wrap">
1076
+
<h1 class="ep-feature-title"><?php esc_html_e('Core', 'bdthemes-element-pack'); ?></h1>
1077
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
1078
+
<div class="ep-count-wrap">
1079
+
<div class="ep-widget-count"><?php esc_html_e('Used:', 'bdthemes-element-pack'); ?> <b>
1080
+
<?php echo esc_html($used_only_widgets); ?>
1081
+
</b></div>
1082
+
<div class="ep-widget-count"><?php esc_html_e('Unused:', 'bdthemes-element-pack'); ?> <b>
1083
+
<?php echo esc_html($unused_only_widgets); ?>
1084
+
</b></div>
1085
+
<div class="ep-widget-count"><?php esc_html_e('Total:', 'bdthemes-element-pack'); ?>
1086
+
<b>
1087
+
<?php echo esc_html($used_only_widgets + $unused_only_widgets); ?>
1088
+
</b>
1089
+
</div>
1090
+
</div>
1091
+
1092
+
<div class="ep-canvas-wrap">
1093
+
<canvas id="bdt-db-only-widget-status" style="height: 100px; width: 100px;"
1094
+
data-label="Core Widgets Status - (<?php echo esc_html($used_only_widgets + $unused_only_widgets); ?>)"
1095
+
data-labels="<?php echo esc_attr('Used, Unused'); ?>"
1096
+
data-value="<?php echo esc_attr($used_only_widgets) . ',' . esc_attr($unused_only_widgets); ?>"
1097
+
data-bg="#EF476F, #ffcdd9" data-bg-hover="#0673e1, #e71522"></canvas>
1098
+
</div>
1099
+
</div>
1100
+
</div>
1101
+
1102
+
</div>
1103
+
</div>
1104
+
<div class="bdt-width-1-2@m bdt-width-1-4@xl">
1105
+
<div class="ep-widget-status bdt-card bdt-card-body" <?php echo wp_kses_post($track_nw_msg); ?>>
1106
+
1107
+
<?php
1108
+
$used_only_3rdparty = count(self::get_used_only_3rdparty());
1109
+
$unused_only_3rdparty = count(self::get_unused_only_3rdparty());
1110
+
?>
1111
+
1112
+
1113
+
<div class="ep-count-canvas-wrap">
1114
+
<h1 class="ep-feature-title"><?php esc_html_e('3rd Party', 'bdthemes-element-pack'); ?></h1>
1115
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
1116
+
<div class="ep-count-wrap">
1117
+
<div class="ep-widget-count"><?php esc_html_e('Used:', 'bdthemes-element-pack'); ?> <b>
1118
+
<?php echo esc_html($used_only_3rdparty); ?>
1119
+
</b></div>
1120
+
<div class="ep-widget-count"><?php esc_html_e('Unused:', 'bdthemes-element-pack'); ?> <b>
1121
+
<?php echo esc_html($unused_only_3rdparty); ?>
1122
+
</b></div>
1123
+
<div class="ep-widget-count"><?php esc_html_e('Total:', 'bdthemes-element-pack'); ?>
1124
+
<b>
1125
+
<?php echo esc_html($used_only_3rdparty + $unused_only_3rdparty); ?>
1126
+
</b>
1127
+
</div>
1128
+
</div>
1129
+
1130
+
<div class="ep-canvas-wrap">
1131
+
<canvas id="bdt-db-only-3rdparty-status" style="height: 100px; width: 100px;"
1132
+
data-label="3rd Party Widgets Status - (<?php echo esc_html($used_only_3rdparty + $unused_only_3rdparty); ?>)"
1133
+
data-labels="<?php echo esc_attr('Used, Unused'); ?>"
1134
+
data-value="<?php echo esc_attr($used_only_3rdparty) . ',' . esc_attr($unused_only_3rdparty); ?>"
1135
+
data-bg="#06D6A0, #B6FFEC" data-bg-hover="#0673e1, #e71522"></canvas>
1136
+
</div>
1137
+
</div>
1138
+
</div>
1139
+
1140
+
</div>
1141
+
</div>
1142
+
1143
+
<div class="bdt-width-1-2@m bdt-width-1-4@xl">
1144
+
<div class="ep-widget-status bdt-card bdt-card-body" <?php echo wp_kses_post($track_nw_msg); ?>>
1145
+
1146
+
<div class="ep-count-canvas-wrap">
1147
+
<h1 class="ep-feature-title"><?php esc_html_e('Active', 'bdthemes-element-pack'); ?></h1>
1148
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
1149
+
<div class="ep-count-wrap">
1150
+
<div class="ep-widget-count"><?php esc_html_e('Core:', 'bdthemes-element-pack'); ?> <b
1151
+
id="bdt-total-widgets-status-core">0</b></div>
1152
+
<div class="ep-widget-count"><?php esc_html_e('3rd Party:', 'bdthemes-element-pack'); ?>
1153
+
<b id="bdt-total-widgets-status-3rd">0</b>
1154
+
</div>
1155
+
<div class="ep-widget-count"><?php esc_html_e('Extensions:', 'bdthemes-element-pack'); ?>
1156
+
<b id="bdt-total-widgets-status-extensions">0</b>
1157
+
</div>
1158
+
<div class="ep-widget-count"><?php esc_html_e('Total:', 'bdthemes-element-pack'); ?> <b
1159
+
id="bdt-total-widgets-status-heading">0</b></div>
1160
+
</div>
1161
+
1162
+
<div class="ep-canvas-wrap">
1163
+
<canvas id="bdt-total-widgets-status" style="height: 100px; width: 100px;"
1164
+
data-label="Total Active Widgets Status"
1165
+
data-labels="<?php echo esc_attr('Core, 3rd Party, Extensions'); ?>"
1166
+
data-value="0,0,0"
1167
+
data-bg="#0680d6, #B0EBFF, #E6F9FF" data-bg-hover="#0673e1, #B0EBFF, #b6f9e8">
1168
+
</canvas>
1169
+
</div>
1170
+
</div>
1171
+
</div>
1172
+
1173
+
</div>
1174
+
</div>
1175
+
</div>
1176
+
</div>
1177
+
1178
+
<?php if (!Tracker::is_allow_track()): ?>
1179
+
<div class="bdt-border-rounded bdt-box-shadow-small bdt-alert-warning" bdt-alert>
1180
+
<a href class="bdt-alert-close" bdt-close></a>
1181
+
<div class="bdt-text-default">
1182
+
<?php
1183
+
printf(
1184
+
esc_html__('To view widgets analytics, Elementor %1$sUsage Data Sharing%2$s feature by Elementor needs to be activated. Please activate the feature to get widget analytics instantly ', 'bdthemes-element-pack'),
1185
+
'<b>', '</b>'
1186
+
);
1187
+
1188
+
echo ' <a href="' . esc_url(admin_url('admin.php?page=elementor-settings')) . '">' . esc_html__('from here.', 'bdthemes-element-pack') . '</a>';
1189
+
?>
1190
+
</div>
1191
+
</div>
1192
+
<?php endif; ?>
1193
+
1194
+
<?php
1195
+
}
1196
+
1197
+
/**
1198
+
* Get Pro
1199
+
*
1200
+
* @access public
1201
+
* @return void
1202
+
*/
1203
+
1204
+
function element_pack_get_pro() {
1205
+
?>
1206
+
<div class="ep-dashboard-panel"
1207
+
bdt-scrollspy="target: > div > div > .bdt-card; cls: bdt-animation-slide-bottom-small; delay: 300">
1208
+
1209
+
<div class="bdt-grid" bdt-grid bdt-height-match="target: > div > .bdt-card"
1210
+
style="max-width: 1180px; margin-left: auto; margin-right: auto;">
1211
+
<div class="bdt-width-1-1@m ep-comparision bdt-text-center">
1212
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
1213
+
<div class="bdt-text-left">
1214
+
<h1 class="bdt-text-bold"><?php echo esc_html__( 'WHY GO WITH PRO?', 'bdthemes-element-pack' ); ?></h1>
1215
+
<h2><?php echo esc_html__( 'Just Compare With Element Pack Lite Vs Pro', 'bdthemes-element-pack' ); ?></h2>
1216
+
</div>
1217
+
<div class="ep-purchase-button">
1218
+
<a href="https://elementpack.pro/pricing/" target="_blank"><?php echo esc_html__( 'Purchase Now', 'bdthemes-element-pack' ); ?></a>
1219
+
</div>
1220
+
</div>
1221
+
1222
+
<div>
1223
+
1224
+
<ul class="bdt-list bdt-list-divider bdt-text-left bdt-text-normal" style="font-size: 15px;">
1225
+
1226
+
1227
+
<li class="bdt-text-bold">
1228
+
<div class="bdt-grid">
1229
+
<?php
1230
+
echo '<div class="bdt-width-expand@m">' . esc_html__( 'Features', 'bdthemes-element-pack' ) . '</div>';
1231
+
echo '<div class="bdt-width-auto@m">' . esc_html__( 'Free', 'bdthemes-element-pack' ) . '</div>';
1232
+
echo '<div class="bdt-width-auto@m">' . esc_html__( 'Pro', 'bdthemes-element-pack' ) . '</div>';
1233
+
?>
1234
+
</div>
1235
+
</li>
1236
+
<li class="">
1237
+
<div class="bdt-grid">
1238
+
<div class="bdt-width-expand@m"><span
1239
+
bdt-tooltip="pos: top-left; title: <?php echo esc_html__( 'Lite have 35+ Widgets but Pro have 100+ core widgets', 'bdthemes-element-pack' ); ?>"><?php echo esc_html__( 'Core Widgets', 'bdthemes-element-pack' ); ?></span>
1240
+
</div>
1241
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1242
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1243
+
</div>
1244
+
</li>
1245
+
<li class="">
1246
+
<div class="bdt-grid">
1247
+
<?php echo '<div class="bdt-width-expand@m">' . esc_html__( 'Theme Compatibility', 'bdthemes-element-pack' ) . '</div>'; ?>
1248
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1249
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1250
+
</div>
1251
+
</li>
1252
+
<li class="">
1253
+
<div class="bdt-grid">
1254
+
<?php echo '<div class="bdt-width-expand@m">' . esc_html__( 'Dynamic Content & Custom Fields Capabilities', 'bdthemes-element-pack' ) . '</div>'; ?>
1255
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1256
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1257
+
</div>
1258
+
</li>
1259
+
<li class="">
1260
+
<div class="bdt-grid">
1261
+
<?php echo '<div class="bdt-width-expand@m">' . esc_html__( 'Proper Documentation', 'bdthemes-element-pack' ) . '</div>'; ?>
1262
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1263
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1264
+
</div>
1265
+
</li>
1266
+
<li class="">
1267
+
<div class="bdt-grid">
1268
+
<?php echo '<div class="bdt-width-expand@m">' . esc_html__( 'Updates & Support', 'bdthemes-element-pack' ) . '</div>'; ?>
1269
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1270
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1271
+
</div>
1272
+
</li>
1273
+
<li class="">
1274
+
<div class="bdt-grid">
1275
+
<div class="bdt-width-expand@m">
1276
+
<?php echo esc_html__( 'Ready Made Pages', 'bdthemes-element-pack' ); ?></div>
1277
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1278
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1279
+
</div>
1280
+
</li>
1281
+
<li class="">
1282
+
<div class="bdt-grid">
1283
+
<div class="bdt-width-expand@m">
1284
+
<?php echo esc_html__( 'Ready Made Blocks', 'bdthemes-element-pack' ); ?></div>
1285
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1286
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1287
+
</div>
1288
+
</li>
1289
+
<li class="">
1290
+
<div class="bdt-grid">
1291
+
<div class="bdt-width-expand@m">
1292
+
<?php echo esc_html__( 'Elementor Extended Widgets', 'bdthemes-element-pack' ); ?></div>
1293
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1294
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1295
+
</div>
1296
+
</li>
1297
+
<li class="">
1298
+
<div class="bdt-grid">
1299
+
<div class="bdt-width-expand@m">
1300
+
<?php echo esc_html__( 'Asset Manager', 'bdthemes-element-pack' ); ?></div>
1301
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1302
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1303
+
</div>
1304
+
</li>
1305
+
<li class="">
1306
+
<div class="bdt-grid">
1307
+
<div class="bdt-width-expand@m">
1308
+
<?php echo esc_html__( 'Live Copy or Paste', 'bdthemes-element-pack' ); ?></div>
1309
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1310
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1311
+
</div>
1312
+
</li>
1313
+
1314
+
<li class="">
1315
+
<div class="bdt-grid">
1316
+
<div class="bdt-width-expand@m">
1317
+
<?php echo esc_html__( 'Template Library (in Editor)', 'bdthemes-element-pack' ); ?></div>
1318
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1319
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1320
+
</div>
1321
+
</li>
1322
+
<li class="">
1323
+
<div class="bdt-grid">
1324
+
<div class="bdt-width-expand@m">
1325
+
<?php echo esc_html__( 'SVG Support', 'bdthemes-element-pack' ); ?></div>
1326
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1327
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1328
+
</div>
1329
+
</li>
1330
+
<li class="">
1331
+
<div class="bdt-grid">
1332
+
<div class="bdt-width-expand@m">
1333
+
<a href="https://www.elementpack.pro/demo/element/dynamic-content/" target="_blank">
1334
+
<?php echo esc_html__( 'Dynamic Content', 'bdthemes-element-pack' ); ?>
1335
+
</a>
1336
+
</div>
1337
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1338
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1339
+
</div>
1340
+
</li>
1341
+
<li class="">
1342
+
<div class="bdt-grid">
1343
+
<div class="bdt-width-expand@m">
1344
+
<?php echo esc_html__( 'Smooth Scroller', 'bdthemes-element-pack' ); ?></div>
1345
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1346
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1347
+
</div>
1348
+
</li>
1349
+
1350
+
<li class="">
1351
+
<div class="bdt-grid">
1352
+
<?php echo '<div class="bdt-width-expand@m">' . esc_html__( 'Header & Footer Builder', 'bdthemes-element-pack' ) . '</div>'; ?>
1353
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1354
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1355
+
</div>
1356
+
</li>
1357
+
<li class="">
1358
+
<div class="bdt-grid">
1359
+
<div class="bdt-width-expand@m">
1360
+
<?php echo esc_html__( 'Rooten Theme Pro Features', 'bdthemes-element-pack' ); ?></div>
1361
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1362
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1363
+
</div>
1364
+
</li>
1365
+
<li class="">
1366
+
<div class="bdt-grid">
1367
+
<div class="bdt-width-expand@m">
1368
+
<?php echo esc_html__( 'Priority Support', 'bdthemes-element-pack' ); ?></div>
1369
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1370
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1371
+
</div>
1372
+
</li>
1373
+
<li class="">
1374
+
<div class="bdt-grid">
1375
+
<div class="bdt-width-expand@m">
1376
+
<?php echo esc_html__( 'WooCommerce Widgets', 'bdthemes-element-pack' ); ?></div>
1377
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1378
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1379
+
</div>
1380
+
</li>
1381
+
<li class="">
1382
+
<div class="bdt-grid">
1383
+
<div class="bdt-width-expand@m">
1384
+
<?php echo esc_html__( 'Ready Made Header & Footer', 'bdthemes-element-pack' ); ?></div>
1385
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1386
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1387
+
</div>
1388
+
</li>
1389
+
<li class="">
1390
+
<div class="bdt-grid">
1391
+
<div class="bdt-width-expand@m">
1392
+
<?php echo esc_html__( 'Essential Shortcodes', 'bdthemes-element-pack' ); ?></div>
1393
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1394
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1395
+
</div>
1396
+
</li>
1397
+
<li class="">
1398
+
<div class="bdt-grid">
1399
+
<div class="bdt-width-expand@m">
1400
+
<?php echo esc_html__( 'Context Menu', 'bdthemes-element-pack' ); ?></div>
1401
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-no"></span></div>
1402
+
<div class="bdt-width-auto@m"><span class="dashicons dashicons-yes"></span></div>
1403
+
</div>
1404
+
</li>
1405
+
</ul>
1406
+
1407
+
<div class="ep-more-features bdt-card bdt-card-body bdt-card-default bdt-margin-medium-top bdt-padding-large">
1408
+
<ul class="bdt-list bdt-list-divider bdt-text-left bdt-margin-remove" style="font-size: 15px;">
1409
+
<li>
1410
+
<div class="bdt-grid bdt-grid-small">
1411
+
<?php
1412
+
echo '<div class="bdt-width-1-3@m"><span class="dashicons dashicons-heart"></span> ' . esc_html__( ' Incredibly Advanced', 'bdthemes-element-pack' ) . '</div>';
1413
+
echo '<div class="bdt-width-1-3@m"><span class="dashicons dashicons-heart"></span> ' . esc_html__( ' Refund or Cancel Anytime', 'bdthemes-element-pack' ) . '</div>';
1414
+
echo '<div class="bdt-width-1-3@m"><span class="dashicons dashicons-heart"></span> ' . esc_html__( ' Dynamic Content', 'bdthemes-element-pack' ) . '</div>';
1415
+
?>
1416
+
</div>
1417
+
</li>
1418
+
1419
+
<li>
1420
+
<div class="bdt-grid bdt-grid-small">
1421
+
<div class="bdt-width-1-3@m">
1422
+
<span class="dashicons dashicons-heart"></span>
1423
+
<?php echo esc_html__( 'Super-Flexible Widgets', 'bdthemes-element-pack' ); ?>
1424
+
</div>
1425
+
<div class="bdt-width-1-3@m">
1426
+
<span
1427
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' 24/7 Premium Support', 'bdthemes-element-pack' ); ?>
1428
+
</div>
1429
+
<div class="bdt-width-1-3@m">
1430
+
<span
1431
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Third Party Plugins', 'bdthemes-element-pack' ); ?>
1432
+
</div>
1433
+
</div>
1434
+
</li>
1435
+
1436
+
<li>
1437
+
<div class="bdt-grid bdt-grid-small">
1438
+
<div class="bdt-width-1-3@m">
1439
+
<span
1440
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Special Discount!', 'bdthemes-element-pack' ); ?>
1441
+
</div>
1442
+
<div class="bdt-width-1-3@m">
1443
+
<span
1444
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Custom Field Integration', 'bdthemes-element-pack' ); ?>
1445
+
</div>
1446
+
<div class="bdt-width-1-3@m">
1447
+
<span
1448
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' With Live Chat Support', 'bdthemes-element-pack' ); ?>
1449
+
</div>
1450
+
</div>
1451
+
</li>
1452
+
1453
+
<li>
1454
+
<div class="bdt-grid bdt-grid-small">
1455
+
<div class="bdt-width-1-3@m">
1456
+
<span
1457
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Trusted Payment Methods', 'bdthemes-element-pack' ); ?>
1458
+
</div>
1459
+
<div class="bdt-width-1-3@m">
1460
+
<span
1461
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Interactive Effects', 'bdthemes-element-pack' ); ?>
1462
+
</div>
1463
+
<div class="bdt-width-1-3@m">
1464
+
<span
1465
+
class="dashicons dashicons-heart"></span><?php echo esc_html__( ' Video Tutorial', 'bdthemes-element-pack' ); ?>
1466
+
</div>
1467
+
</div>
1468
+
</li>
1469
+
</ul>
1470
+
1471
+
<div class="ep-purchase-button bdt-margin-medium-top">
1472
+
<a href="https://elementpack.pro/pricing/" target="_blank"><?php echo esc_html__( 'Purchase Now', 'bdthemes-element-pack' ); ?></a>
1473
+
</div>
1474
+
1475
+
</div>
1476
+
1477
+
</div>
1478
+
</div>
1479
+
</div>
1480
+
1481
+
</div>
1482
+
<?php
1483
+
}
1484
+
1485
+
/**
1486
+
* Display System Requirement
1487
+
*
1488
+
* @access public
1489
+
* @return void
1490
+
*/
1491
+
1492
+
public function element_pack_system_requirement() {
1493
+
$php_version = phpversion();
1494
+
$max_execution_time = ini_get('max_execution_time');
1495
+
$memory_limit = ini_get('memory_limit');
1496
+
$post_limit = ini_get('post_max_size');
1497
+
$uploads = wp_upload_dir();
1498
+
$upload_path = $uploads['basedir'];
1499
+
$yes_icon = '<span class="valid"><i class="dashicons-before dashicons-yes"></i></span>';
1500
+
$no_icon = '<span class="invalid"><i class="dashicons-before dashicons-no-alt"></i></span>';
1501
+
1502
+
$environment = Utils::get_environment_info();
1503
+
1504
+
?>
1505
+
<ul class="check-system-status bdt-grid bdt-child-width-1-2@m bdt-grid-small ">
1506
+
<li>
1507
+
<div>
1508
+
<span class="label1"><?php esc_html_e('PHP Version:', 'bdthemes-element-pack'); ?></span>
1509
+
1510
+
<?php
1511
+
if (version_compare($php_version, '7.4.0', '<')) {
1512
+
echo wp_kses_post($no_icon);
1513
+
echo '<span class="label2" title="' . esc_attr__('Min: 7.4 Recommended', 'bdthemes-element-pack') . '" bdt-tooltip>' . esc_html__('Currently:', 'bdthemes-element-pack') . ' ' . esc_html($php_version) . '</span>';
1514
+
} else {
1515
+
echo wp_kses_post($yes_icon);
1516
+
echo '<span class="label2">' . esc_html__('Currently:', 'bdthemes-element-pack') . ' ' . esc_html($php_version) . '</span>';
1517
+
}
1518
+
?>
1519
+
</div>
1520
+
1521
+
</li>
1522
+
1523
+
<li>
1524
+
<div>
1525
+
<span class="label1"><?php esc_html_e('Max execution time:', 'bdthemes-element-pack'); ?> </span>
1526
+
<?php
1527
+
if ($max_execution_time < '90') {
1528
+
echo wp_kses_post($no_icon);
1529
+
echo '<span class="label2" title="Min: 90 Recommended" bdt-tooltip>Currently: ' . esc_html($max_execution_time) . '</span>';
1530
+
} else {
1531
+
echo wp_kses_post($yes_icon);
1532
+
echo '<span class="label2">Currently: ' . esc_html($max_execution_time) . '</span>';
1533
+
}
1534
+
?>
1535
+
</div>
1536
+
</li>
1537
+
<li>
1538
+
<div>
1539
+
<span class="label1"><?php esc_html_e('Memory Limit:', 'bdthemes-element-pack'); ?> </span>
1540
+
1541
+
<?php
1542
+
if (intval($memory_limit) < '512') {
1543
+
echo wp_kses_post($no_icon);
1544
+
echo '<span class="label2" title="Min: 512M Recommended" bdt-tooltip>Currently: ' . esc_html($memory_limit) . '</span>';
1545
+
} else {
1546
+
echo wp_kses_post($yes_icon);
1547
+
echo '<span class="label2">Currently: ' . esc_html($memory_limit) . '</span>';
1548
+
}
1549
+
?>
1550
+
</div>
1551
+
</li>
1552
+
1553
+
<li>
1554
+
<div>
1555
+
<span class="label1"><?php esc_html_e('Max Post Limit:', 'bdthemes-element-pack'); ?> </span>
1556
+
1557
+
<?php
1558
+
if (intval($post_limit) < '32') {
1559
+
echo wp_kses_post($no_icon);
1560
+
echo '<span class="label2" title="Min: 32M Recommended" bdt-tooltip>Currently: ' . wp_kses_post($post_limit) . '</span>';
1561
+
} else {
1562
+
echo wp_kses_post($yes_icon);
1563
+
echo '<span class="label2">Currently: ' . wp_kses_post($post_limit) . '</span>';
1564
+
}
1565
+
?>
1566
+
</div>
1567
+
</li>
1568
+
1569
+
<li>
1570
+
<div>
1571
+
<span class="label1"><?php esc_html_e('Uploads folder writable:', 'bdthemes-element-pack'); ?></span>
1572
+
1573
+
<?php
1574
+
if (!is_writable($upload_path)) {
1575
+
echo wp_kses_post($no_icon);
1576
+
} else {
1577
+
echo wp_kses_post($yes_icon);
1578
+
}
1579
+
?>
1580
+
</div>
1581
+
1582
+
</li>
1583
+
1584
+
<li>
1585
+
<div>
1586
+
<span class="label1"><?php esc_html_e('GZip Enabled:', 'bdthemes-element-pack'); ?></span>
1587
+
1588
+
<?php
1589
+
if ($environment['gzip_enabled']) {
1590
+
echo wp_kses_post($yes_icon);
1591
+
} else {
1592
+
echo wp_kses_post($no_icon);
1593
+
}
1594
+
?>
1595
+
</div>
1596
+
1597
+
</li>
1598
+
1599
+
<li>
1600
+
<div>
1601
+
<span class="label1"><?php esc_html_e('Debug Mode:', 'bdthemes-element-pack'); ?></span>
1602
+
<?php
1603
+
if ($environment['wp_debug_mode']) {
1604
+
echo wp_kses_post($no_icon);
1605
+
echo '<span class="label2">' . esc_html__('Currently Turned On', 'bdthemes-element-pack') . '</span>';
1606
+
} else {
1607
+
echo wp_kses_post($yes_icon);
1608
+
echo '<span class="label2">' . esc_html__('Currently Turned Off', 'bdthemes-element-pack') . '</span>';
1609
+
}
1610
+
?>
1611
+
</div>
1612
+
1613
+
</li>
1614
+
1615
+
</ul>
1616
+
1617
+
<div class="bdt-admin-alert">
1618
+
<strong><?php esc_html_e('Note:', 'bdthemes-element-pack'); ?></strong>
1619
+
<?php
1620
+
/* translators: %s: Plugin name 'Element Pack' */
1621
+
printf(
1622
+
esc_html__('If you have multiple addons like %s so you may need to allocate additional memory for other addons as well.', 'bdthemes-element-pack'),
1623
+
'<b>Element Pack</b>'
1624
+
);
1625
+
?>
1626
+
</div>
1627
+
1628
+
<?php
1629
+
}
1630
+
1631
+
/**
1632
+
* Display Plugin Page
1633
+
*
1634
+
* @access public
1635
+
* @return void
1636
+
*/
1637
+
1638
+
public function plugin_page() {
1639
+
1640
+
?>
1641
+
1642
+
<div class="wrap element-pack-dashboard">
1643
+
<h1></h1> <!-- don't remove this div, it's used for the notice container -->
1644
+
1645
+
<div class="ep-dashboard-wrapper bdt-margin-top">
1646
+
<div class="ep-dashboard-header bdt-flex bdt-flex-wrap bdt-flex-between bdt-flex-middle"
1647
+
bdt-sticky="offset: 32; animation: bdt-animation-slide-top-small; duration: 300">
1648
+
1649
+
<div class="bdt-flex bdt-flex-wrap bdt-flex-middle">
1650
+
<!-- Header Shape Elements -->
1651
+
<div class="ep-header-elements">
1652
+
<span class="ep-header-element ep-header-circle"></span>
1653
+
<span class="ep-header-element ep-header-dots"></span>
1654
+
<span class="ep-header-element ep-header-line"></span>
1655
+
<span class="ep-header-element ep-header-square"></span>
1656
+
<span class="ep-header-element ep-header-wave"></span>
1657
+
</div>
1658
+
1659
+
<div class="ep-logo">
1660
+
<img src="<?php echo BDTEP_URL . 'assets/images/logo-with-text.svg'; ?>" alt="Element Pack Logo">
1661
+
</div>
1662
+
</div>
1663
+
1664
+
<div class="ep-dashboard-new-page-wrapper bdt-flex bdt-flex-wrap bdt-flex-middle">
1665
+
1666
+
1667
+
<!-- Always render save button, JavaScript will control visibility -->
1668
+
<div class="ep-dashboard-save-btn" style="display: none;">
1669
+
<button class="bdt-button bdt-button-primary element-pack-settings-save-btn" type="submit">
1670
+
<?php esc_html_e('Save Settings', 'bdthemes-element-pack'); ?>
1671
+
</button>
1672
+
</div>
1673
+
1674
+
<div class="ep-dashboard-new-page">
1675
+
<a class="bdt-flex bdt-flex-middle" href="<?php echo esc_url(admin_url('post-new.php?post_type=page')); ?>" class=""><i class="dashicons dashicons-admin-page"></i>
1676
+
<?php echo esc_html__('Create New Page', 'bdthemes-element-pack') ?>
1677
+
</a>
1678
+
</div>
1679
+
1680
+
</div>
1681
+
1682
+
</div>
1683
+
1684
+
<div class="ep-dashboard-container bdt-flex">
1685
+
<div class="ep-dashboard-nav-container-wrapper">
1686
+
<div class="ep-dashboard-nav-container-inner" bdt-sticky="end: !.ep-dashboard-container; offset: 115; animation: bdt-animation-slide-top-small; duration: 300">
1687
+
1688
+
<!-- Navigation Shape Elements -->
1689
+
<div class="ep-nav-elements">
1690
+
<span class="ep-nav-element ep-nav-circle"></span>
1691
+
<span class="ep-nav-element ep-nav-dots"></span>
1692
+
<span class="ep-nav-element ep-nav-line"></span>
1693
+
<span class="ep-nav-element ep-nav-square"></span>
1694
+
<span class="ep-nav-element ep-nav-triangle"></span>
1695
+
<span class="ep-nav-element ep-nav-plus"></span>
1696
+
<span class="ep-nav-element ep-nav-wave"></span>
1697
+
</div>
1698
+
1699
+
<?php $this->settings_api->show_navigation(); ?>
1700
+
</div>
1701
+
</div>
1702
+
1703
+
1704
+
<div class="bdt-switcher bdt-tab-container bdt-container-xlarge bdt-flex-1">
1705
+
<div id="element_pack_welcome_page" class="ep-option-page group">
1706
+
<?php $this->element_pack_welcome(); ?>
1707
+
</div>
1708
+
1709
+
<?php
1710
+
$this->settings_api->show_forms();
1711
+
?>
1712
+
1713
+
<div id="element_pack_extra_options_page" class="ep-option-page group">
1714
+
<?php $this->element_pack_extra_options(); ?>
1715
+
</div>
1716
+
1717
+
<div id="element_pack_analytics_system_req_page" class="ep-option-page group">
1718
+
<?php $this->element_pack_analytics_system_req_content(); ?>
1719
+
</div>
1720
+
1721
+
<div id="element_pack_other_plugins_page" class="ep-option-page group">
1722
+
<?php $this->element_pack_others_plugin(); ?>
1723
+
</div>
1724
+
1725
+
<div id="element_pack_get_pro_page" class="ep-option-page group">
1726
+
<?php $this->element_pack_get_pro(); ?>
1727
+
</div>
1728
+
1729
+
</div>
1730
+
</div>
1731
+
1732
+
<?php if (!defined('BDTEP_WL') ) {
1733
+
$this->footer_info();
1734
+
} ?>
1735
+
</div>
1736
+
1737
+
</div>
1738
+
1739
+
<?php
1740
+
1741
+
$this->script();
1742
+
1743
+
?>
1744
+
1745
+
<?php
1746
+
}
1747
+
1748
+
1749
+
1750
+
1751
+
1752
+
1753
+
/**
1754
+
* Tabbable JavaScript codes & Initiate Color Picker
1755
+
*
1756
+
* This code uses localstorage for displaying active tabs
1757
+
*/
1758
+
public function script() {
1759
+
?>
1760
+
<script>
1761
+
jQuery(document).ready(function () {
1762
+
jQuery('.ep-no-result').removeClass('bdt-animation-shake');
1763
+
});
1764
+
1765
+
function filterSearch(e) {
1766
+
var parentID = '#' + jQuery(e).data('id');
1767
+
var search = jQuery(parentID).find('.bdt-search-input').val().toLowerCase();
1768
+
1769
+
1770
+
jQuery(".ep-options .ep-option-item").filter(function () {
1771
+
jQuery(this).toggle(jQuery(this).attr('data-widget-name').toLowerCase().indexOf(search) > -1)
1772
+
});
1773
+
1774
+
if (!search) {
1775
+
jQuery(parentID).find('.bdt-search-input').attr('bdt-filter-control', "");
1776
+
jQuery(parentID).find('.ep-widget-all').trigger('click');
1777
+
} else {
1778
+
// if (search.length < 3) {
1779
+
// return;
1780
+
// }
1781
+
jQuery(parentID).find('.bdt-search-input').attr('bdt-filter-control', "filter: [data-widget-name*='" + search + "']");
1782
+
jQuery(parentID).find('.bdt-search-input').removeClass('bdt-active');
1783
+
}
1784
+
jQuery(parentID).find('.bdt-search-input').trigger('click');
1785
+
1786
+
}
1787
+
1788
+
1789
+
jQuery('.ep-options-parent').each(function (e, item) {
1790
+
var eachItem = '#' + jQuery(item).attr('id');
1791
+
jQuery(eachItem).on("beforeFilter", function () {
1792
+
jQuery(eachItem).find('.ep-no-result').removeClass('bdt-animation-shake');
1793
+
});
1794
+
1795
+
jQuery(eachItem).on("afterFilter", function () {
1796
+
var isElementVisible = false;
1797
+
var i = 0;
1798
+
1799
+
if (jQuery(eachItem).closest(".ep-options-parent").eq(i).is(":visible")) { } else {
1800
+
isElementVisible = true;
1801
+
}
1802
+
1803
+
while (!isElementVisible && i < jQuery(eachItem).find(".ep-option-item").length) {
1804
+
if (jQuery(eachItem).find(".ep-option-item").eq(i).is(":visible")) {
1805
+
isElementVisible = true;
1806
+
}
1807
+
i++;
1808
+
}
1809
+
1810
+
if (isElementVisible === false) {
1811
+
jQuery(eachItem).find('.ep-no-result').addClass('bdt-animation-shake');
1812
+
}
1813
+
1814
+
});
1815
+
});
1816
+
1817
+
function clearSearchInputs(context) {
1818
+
context.find('.bdt-search-input').val('').attr('bdt-filter-control', '');
1819
+
}
1820
+
1821
+
jQuery('.ep-widget-filter-nav li a').on('click', function () {
1822
+
// Scroll to top when filter tabs are clicked
1823
+
window.scrollTo({
1824
+
top: 0,
1825
+
behavior: 'smooth'
1826
+
});
1827
+
1828
+
const wrapper = jQuery(this).closest('.bdt-widget-filter-wrapper');
1829
+
clearSearchInputs(wrapper);
1830
+
});
1831
+
1832
+
jQuery('.bdt-dashboard-navigation li a').on('click', function () {
1833
+
// Scroll to top when main navigation tabs are clicked
1834
+
window.scrollTo({
1835
+
top: 0,
1836
+
behavior: 'smooth'
1837
+
});
1838
+
1839
+
const tabContainer = jQuery(this).closest('.ep-dashboard-nav-container-wrapper').siblings('.bdt-tab-container');
1840
+
clearSearchInputs(tabContainer);
1841
+
tabContainer.find('.bdt-search-input').trigger('keyup');
1842
+
});
1843
+
1844
+
jQuery(document).ready(function ($) {
1845
+
'use strict';
1846
+
1847
+
// Improved hash handler for tab switching
1848
+
function hashHandler() {
1849
+
if (window.location.hash) {
1850
+
var hash = window.location.hash.substring(1);
1851
+
1852
+
// Handle different hash formats
1853
+
var targetPage = hash;
1854
+
if (hash.includes('_page')) {
1855
+
targetPage = hash.replace('_page', '');
1856
+
}
1857
+
1858
+
// Find the navigation tab that corresponds to this hash
1859
+
var $navItem = $('.bdt-dashboard-navigation a[href="#' + targetPage + '"], .bdt-dashboard-navigation a[href="#' + hash + '"]').first();
1860
+
1861
+
if ($navItem.length > 0) {
1862
+
var tabIndex = $navItem.data('tab-index');
1863
+
if (typeof tabIndex !== 'undefined') {
1864
+
// Use UIkit tab system
1865
+
var $tab = $('.element-pack-dashboard .bdt-tab');
1866
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.tab) {
1867
+
bdtUIkit.tab($tab).show(tabIndex);
1868
+
}
1869
+
}
1870
+
}
1871
+
}
1872
+
}
1873
+
1874
+
// Handle initial page load
1875
+
function onWindowLoad() {
1876
+
hashHandler();
1877
+
}
1878
+
1879
+
// Initialize on document ready and window load
1880
+
if (document.readyState === 'complete') {
1881
+
onWindowLoad();
1882
+
} else {
1883
+
$(window).on('load', onWindowLoad);
1884
+
}
1885
+
1886
+
// Listen for hash changes
1887
+
window.addEventListener("hashchange", hashHandler, true);
1888
+
1889
+
// Handle admin menu clicks (from WordPress admin sidebar)
1890
+
$('.toplevel_page_element_pack_options > ul > li > a').on('click', function (event) {
1891
+
// Scroll to top when admin sub menu items are clicked
1892
+
window.scrollTo({
1893
+
top: 0,
1894
+
behavior: 'smooth'
1895
+
});
1896
+
1897
+
$(this).parent().siblings().removeClass('current');
1898
+
$(this).parent().addClass('current');
1899
+
1900
+
// Extract hash from href and trigger hash change
1901
+
var href = $(this).attr('href');
1902
+
if (href && href.includes('#')) {
1903
+
var hash = href.substring(href.indexOf('#'));
1904
+
if (hash && hash.length > 1) {
1905
+
window.location.hash = hash;
1906
+
}
1907
+
}
1908
+
});
1909
+
1910
+
// Handle navigation tab clicks
1911
+
$('.bdt-dashboard-navigation a').on('click', function(e) {
1912
+
// Scroll to top immediately when tab is clicked
1913
+
window.scrollTo({
1914
+
top: 0,
1915
+
behavior: 'smooth'
1916
+
});
1917
+
1918
+
var href = $(this).attr('href');
1919
+
if (href && href.startsWith('#')) {
1920
+
// Update URL hash for proper navigation
1921
+
window.history.pushState(null, null, href);
1922
+
1923
+
// Trigger hash change for proper tab switching
1924
+
setTimeout(function() {
1925
+
$(window).trigger('hashchange');
1926
+
}, 50);
1927
+
}
1928
+
});
1929
+
1930
+
// Handle filter navigation clicks (All, Free, Pro, etc.)
1931
+
$('.ep-widget-filter-nav li a').on('click', function() {
1932
+
// Scroll to top when filter tabs are clicked
1933
+
window.scrollTo({
1934
+
top: 0,
1935
+
behavior: 'smooth'
1936
+
});
1937
+
1938
+
const wrapper = jQuery(this).closest('.bdt-widget-filter-wrapper');
1939
+
clearSearchInputs(wrapper);
1940
+
});
1941
+
1942
+
// Handle sub-navigation clicks (within widget pages)
1943
+
$(document).on('click', '.bdt-subnav a, .ep-widget-filter a', function() {
1944
+
// Scroll to top for sub-navigation clicks
1945
+
window.scrollTo({
1946
+
top: 0,
1947
+
behavior: 'smooth'
1948
+
});
1949
+
});
1950
+
1951
+
// Enhanced tab switching with scroll to top
1952
+
$(document).on('click', '.bdt-tab a, .bdt-tab-item', function(e) {
1953
+
// Scroll to top for any tab click
1954
+
window.scrollTo({
1955
+
top: 0,
1956
+
behavior: 'smooth'
1957
+
});
1958
+
});
1959
+
1960
+
// Advanced tab switching for direct URL access
1961
+
function switchToTab(targetId) {
1962
+
var $navItem = $('.bdt-dashboard-navigation a[href="#' + targetId + '"]');
1963
+
if ($navItem.length > 0) {
1964
+
var tabIndex = $navItem.data('tab-index');
1965
+
if (typeof tabIndex !== 'undefined') {
1966
+
var $tab = $('.element-pack-dashboard .bdt-tab');
1967
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.tab) {
1968
+
bdtUIkit.tab($tab).show(tabIndex);
1969
+
}
1970
+
}
1971
+
}
1972
+
}
1973
+
1974
+
// Handle direct section navigation from external links
1975
+
$(document).on('click', 'a[href*="#element_pack"]', function(e) {
1976
+
var href = $(this).attr('href');
1977
+
if (href && href.includes('#element_pack')) {
1978
+
var hash = href.substring(href.indexOf('#element_pack'));
1979
+
var targetId = hash.substring(1);
1980
+
1981
+
// Navigate to the tab
1982
+
switchToTab(targetId);
1983
+
1984
+
// Update URL
1985
+
window.history.pushState(null, null, hash);
1986
+
}
1987
+
});
1988
+
1989
+
// Activate/Deactivate all widgets functionality
1990
+
$('#element_pack_active_modules_page a.ep-active-all-widget').on('click', function (e) {
1991
+
e.preventDefault();
1992
+
1993
+
$('#element_pack_active_modules_page .ep-option-item:not(.ep-pro-inactive) .checkbox:visible').each(function () {
1994
+
$(this).attr('checked', 'checked').prop("checked", true);
1995
+
});
1996
+
1997
+
$(this).addClass('bdt-active');
1998
+
$('#element_pack_active_modules_page a.ep-deactive-all-widget').removeClass('bdt-active');
1999
+
2000
+
// Ensure save button remains visible
2001
+
setTimeout(function() {
2002
+
$('.ep-dashboard-save-btn').show();
2003
+
}, 100);
2004
+
});
2005
+
2006
+
$('#element_pack_active_modules_page a.ep-deactive-all-widget').on('click', function (e) {
2007
+
e.preventDefault();
2008
+
2009
+
$('#element_pack_active_modules_page .checkbox:visible').each(function () {
2010
+
$(this).removeAttr('checked').prop("checked", false);
2011
+
});
2012
+
2013
+
$(this).addClass('bdt-active');
2014
+
$('#element_pack_active_modules_page a.ep-active-all-widget').removeClass('bdt-active');
2015
+
2016
+
// Ensure save button remains visible
2017
+
setTimeout(function() {
2018
+
$('.ep-dashboard-save-btn').show();
2019
+
}, 100);
2020
+
});
2021
+
2022
+
$('#element_pack_third_party_widget_page a.ep-active-all-widget').on('click', function (e) {
2023
+
e.preventDefault();
2024
+
2025
+
$('#element_pack_third_party_widget_page .ep-option-item:not(.ep-pro-inactive) .checkbox:visible').each(function () {
2026
+
$(this).attr('checked', 'checked').prop("checked", true);
2027
+
});
2028
+
2029
+
$(this).addClass('bdt-active');
2030
+
$('#element_pack_third_party_widget_page a.ep-deactive-all-widget').removeClass('bdt-active');
2031
+
2032
+
// Ensure save button remains visible
2033
+
setTimeout(function() {
2034
+
$('.ep-dashboard-save-btn').show();
2035
+
}, 100);
2036
+
});
2037
+
2038
+
$('#element_pack_third_party_widget_page a.ep-deactive-all-widget').on('click', function (e) {
2039
+
e.preventDefault();
2040
+
2041
+
$('#element_pack_third_party_widget_page .checkbox:visible').each(function () {
2042
+
$(this).removeAttr('checked').prop("checked", false);
2043
+
});
2044
+
2045
+
$(this).addClass('bdt-active');
2046
+
$('#element_pack_third_party_widget_page a.ep-active-all-widget').removeClass('bdt-active');
2047
+
2048
+
// Ensure save button remains visible
2049
+
setTimeout(function() {
2050
+
$('.ep-dashboard-save-btn').show();
2051
+
}, 100);
2052
+
});
2053
+
2054
+
$('#element_pack_elementor_extend_page a.ep-active-all-widget').on('click', function (e) {
2055
+
e.preventDefault();
2056
+
2057
+
$('#element_pack_elementor_extend_page .ep-option-item:not(.ep-pro-inactive) .checkbox:visible').each(function () {
2058
+
$(this).attr('checked', 'checked').prop("checked", true);
2059
+
});
2060
+
2061
+
$(this).addClass('bdt-active');
2062
+
$('#element_pack_elementor_extend_page a.ep-deactive-all-widget').removeClass('bdt-active');
2063
+
2064
+
// Ensure save button remains visible
2065
+
setTimeout(function() {
2066
+
$('.ep-dashboard-save-btn').show();
2067
+
}, 100);
2068
+
});
2069
+
2070
+
$('#element_pack_elementor_extend_page a.ep-deactive-all-widget').on('click', function (e) {
2071
+
e.preventDefault();
2072
+
2073
+
$('#element_pack_elementor_extend_page .checkbox:visible').each(function () {
2074
+
$(this).removeAttr('checked').prop("checked", false);
2075
+
});
2076
+
2077
+
$(this).addClass('bdt-active');
2078
+
$('#element_pack_elementor_extend_page a.ep-active-all-widget').removeClass('bdt-active');
2079
+
2080
+
// Ensure save button remains visible
2081
+
setTimeout(function() {
2082
+
$('.ep-dashboard-save-btn').show();
2083
+
}, 100);
2084
+
});
2085
+
2086
+
$('#element_pack_active_modules_page, #element_pack_third_party_widget_page, #element_pack_elementor_extend_page, #element_pack_other_settings_page').find('.ep-pro-inactive .checkbox').each(function () {
2087
+
$(this).removeAttr('checked');
2088
+
$(this).attr("disabled", true);
2089
+
});
2090
+
2091
+
});
2092
+
2093
+
// License Renew Redirect
2094
+
jQuery(document).ready(function ($) {
2095
+
const renewalLink = $('a[href="admin.php?page=element_pack_options_license_renew"]');
2096
+
if (renewalLink.length) {
2097
+
renewalLink.attr('target', '_blank');
2098
+
}
2099
+
});
2100
+
2101
+
// License Renew Redirect
2102
+
jQuery(document).ready(function ($) {
2103
+
const renewalLink = $('a[href="admin.php?page=element_pack_options_license_renew"]');
2104
+
if (renewalLink.length) {
2105
+
renewalLink.attr('target', '_blank');
2106
+
}
2107
+
});
2108
+
2109
+
// Dynamic Save Button Control
2110
+
jQuery(document).ready(function ($) {
2111
+
// Define pages that need save button - only specific settings pages
2112
+
const pagesWithSave = [
2113
+
'element_pack_active_modules', // Core widgets
2114
+
'element_pack_third_party_widget', // 3rd party widgets
2115
+
'element_pack_elementor_extend', // Extensions
2116
+
'element_pack_other_settings', // Special features
2117
+
'element_pack_api_settings' // API settings
2118
+
];
2119
+
2120
+
function toggleSaveButton() {
2121
+
const currentHash = window.location.hash.substring(1);
2122
+
const saveButton = $('.ep-dashboard-save-btn');
2123
+
2124
+
// Check if current page should have save button
2125
+
if (pagesWithSave.includes(currentHash)) {
2126
+
saveButton.fadeIn(200);
2127
+
} else {
2128
+
saveButton.fadeOut(200);
2129
+
}
2130
+
}
2131
+
2132
+
// Force save button to be visible for settings pages
2133
+
function forceSaveButtonVisible() {
2134
+
const currentHash = window.location.hash.substring(1);
2135
+
const saveButton = $('.ep-dashboard-save-btn');
2136
+
2137
+
if (pagesWithSave.includes(currentHash)) {
2138
+
saveButton.show();
2139
+
}
2140
+
}
2141
+
2142
+
// Initial check
2143
+
toggleSaveButton();
2144
+
2145
+
// Listen for hash changes
2146
+
$(window).on('hashchange', function() {
2147
+
toggleSaveButton();
2148
+
});
2149
+
2150
+
// Listen for tab clicks
2151
+
$('.bdt-dashboard-navigation a').on('click', function() {
2152
+
setTimeout(toggleSaveButton, 100);
2153
+
});
2154
+
2155
+
// Also listen for navigation menu clicks (from show_navigation())
2156
+
$(document).on('click', '.bdt-tab a, .bdt-subnav a, .ep-dashboard-nav a, [href*="#element_pack"]', function() {
2157
+
setTimeout(toggleSaveButton, 100);
2158
+
});
2159
+
2160
+
// Listen for bulk active/deactive button clicks to maintain save button visibility
2161
+
$(document).on('click', '.ep-active-all-widget, .ep-deactive-all-widget', function() {
2162
+
setTimeout(forceSaveButtonVisible, 50);
2163
+
});
2164
+
2165
+
// Listen for individual checkbox changes to maintain save button visibility
2166
+
$(document).on('change', '#element_pack_third_party_widget_page .checkbox, #element_pack_elementor_extend_page .checkbox, #element_pack_active_modules_page .checkbox', function() {
2167
+
setTimeout(forceSaveButtonVisible, 50);
2168
+
});
2169
+
2170
+
// Update URL when navigation items are clicked
2171
+
$(document).on('click', '.bdt-tab a, .bdt-subnav a, .ep-dashboard-nav a', function(e) {
2172
+
const href = $(this).attr('href');
2173
+
if (href && href.includes('#')) {
2174
+
const hash = href.substring(href.indexOf('#'));
2175
+
if (hash && hash.length > 1) {
2176
+
// Update browser URL with the hash
2177
+
const currentUrl = window.location.href.split('#')[0];
2178
+
const newUrl = currentUrl + hash;
2179
+
window.history.pushState(null, null, newUrl);
2180
+
2181
+
// Trigger hash change event for other listeners
2182
+
$(window).trigger('hashchange');
2183
+
}
2184
+
}
2185
+
});
2186
+
2187
+
// Handle save button click
2188
+
$(document).on('click', '.element-pack-settings-save-btn', function(e) {
2189
+
e.preventDefault();
2190
+
2191
+
// Find the active form in the current tab
2192
+
const currentHash = window.location.hash.substring(1);
2193
+
let targetForm = null;
2194
+
2195
+
// Look for forms in the active tab content
2196
+
if (currentHash) {
2197
+
// Try to find form in the specific tab page
2198
+
targetForm = $('#' + currentHash + '_page form.settings-save');
2199
+
2200
+
// If not found, try without _page suffix
2201
+
if (!targetForm || targetForm.length === 0) {
2202
+
targetForm = $('#' + currentHash + ' form.settings-save');
2203
+
}
2204
+
2205
+
// Try to find any form in the active tab content
2206
+
if (!targetForm || targetForm.length === 0) {
2207
+
targetForm = $('#' + currentHash + '_page form');
2208
+
}
2209
+
}
2210
+
2211
+
// Fallback to any visible form with settings-save class
2212
+
if (!targetForm || targetForm.length === 0) {
2213
+
targetForm = $('form.settings-save:visible').first();
2214
+
}
2215
+
2216
+
// Last fallback - any visible form
2217
+
if (!targetForm || targetForm.length === 0) {
2218
+
targetForm = $('.bdt-switcher .group:visible form').first();
2219
+
}
2220
+
2221
+
if (targetForm && targetForm.length > 0) {
2222
+
// Show loading notification
2223
+
// bdtUIkit.notification({
2224
+
// message: '<div bdt-spinner></div> <?php //esc_html_e('Please wait, Saving settings...', 'bdthemes-element-pack') ?>',
2225
+
// timeout: false
2226
+
// });
2227
+
2228
+
// Submit form using AJAX (same logic as existing form submission)
2229
+
targetForm.ajaxSubmit({
2230
+
success: function () {
2231
+
bdtUIkit.notification.closeAll();
2232
+
bdtUIkit.notification({
2233
+
message: '<span class="dashicons dashicons-yes"></span> <?php esc_html_e('Settings Saved Successfully.', 'bdthemes-element-pack') ?>',
2234
+
status: 'primary',
2235
+
pos: 'top-center'
2236
+
});
2237
+
},
2238
+
error: function (data) {
2239
+
bdtUIkit.notification.closeAll();
2240
+
bdtUIkit.notification({
2241
+
message: '<span bdt-icon=\'icon: warning\'></span> <?php esc_html_e('Unknown error, make sure access is correct!', 'bdthemes-element-pack') ?>',
2242
+
status: 'warning'
2243
+
});
2244
+
}
2245
+
});
2246
+
} else {
2247
+
// Show error if no form found
2248
+
bdtUIkit.notification({
2249
+
message: '<span bdt-icon="icon: warning"></span> <?php esc_html_e('No settings form found to save.', 'bdthemes-element-pack') ?>',
2250
+
status: 'warning'
2251
+
});
2252
+
}
2253
+
});
2254
+
2255
+
// White Label Settings Functionality
2256
+
// Check if ep_admin_ajax is available
2257
+
if (typeof ep_admin_ajax === 'undefined') {
2258
+
window.ep_admin_ajax = {
2259
+
ajax_url: '<?php echo admin_url('admin-ajax.php'); ?>',
2260
+
white_label_nonce: '<?php echo wp_create_nonce('ep_white_label_nonce'); ?>'
2261
+
};
2262
+
}
2263
+
2264
+
// Initialize CodeMirror editors for custom code
2265
+
var codeMirrorEditors = {};
2266
+
2267
+
function initializeCodeMirrorEditors() {
2268
+
// CSS Editor 1
2269
+
if (document.getElementById('ep-custom-css')) {
2270
+
codeMirrorEditors['ep-custom-css'] = wp.codeEditor.initialize('ep-custom-css', {
2271
+
type: 'text/css',
2272
+
codemirror: {
2273
+
lineNumbers: true,
2274
+
mode: 'css',
2275
+
theme: 'default',
2276
+
lineWrapping: true,
2277
+
autoCloseBrackets: true,
2278
+
matchBrackets: true,
2279
+
lint: false
2280
+
}
2281
+
});
2282
+
}
2283
+
2284
+
// JavaScript Editor 1
2285
+
if (document.getElementById('ep-custom-js')) {
2286
+
codeMirrorEditors['ep-custom-js'] = wp.codeEditor.initialize('ep-custom-js', {
2287
+
type: 'application/javascript',
2288
+
codemirror: {
2289
+
lineNumbers: true,
2290
+
mode: 'javascript',
2291
+
theme: 'default',
2292
+
lineWrapping: true,
2293
+
autoCloseBrackets: true,
2294
+
matchBrackets: true,
2295
+
lint: false
2296
+
}
2297
+
});
2298
+
}
2299
+
2300
+
// CSS Editor 2
2301
+
if (document.getElementById('ep-custom-css-2')) {
2302
+
codeMirrorEditors['ep-custom-css-2'] = wp.codeEditor.initialize('ep-custom-css-2', {
2303
+
type: 'text/css',
2304
+
codemirror: {
2305
+
lineNumbers: true,
2306
+
mode: 'css',
2307
+
theme: 'default',
2308
+
lineWrapping: true,
2309
+
autoCloseBrackets: true,
2310
+
matchBrackets: true,
2311
+
lint: false
2312
+
}
2313
+
});
2314
+
}
2315
+
2316
+
// JavaScript Editor 2
2317
+
if (document.getElementById('ep-custom-js-2')) {
2318
+
codeMirrorEditors['ep-custom-js-2'] = wp.codeEditor.initialize('ep-custom-js-2', {
2319
+
type: 'application/javascript',
2320
+
codemirror: {
2321
+
lineNumbers: true,
2322
+
mode: 'javascript',
2323
+
theme: 'default',
2324
+
lineWrapping: true,
2325
+
autoCloseBrackets: true,
2326
+
matchBrackets: true,
2327
+
lint: false
2328
+
}
2329
+
});
2330
+
}
2331
+
2332
+
// Refresh all editors after a short delay to ensure proper rendering
2333
+
setTimeout(function() {
2334
+
refreshAllCodeMirrorEditors();
2335
+
}, 100);
2336
+
}
2337
+
2338
+
// Function to refresh all CodeMirror editors
2339
+
function refreshAllCodeMirrorEditors() {
2340
+
Object.keys(codeMirrorEditors).forEach(function(editorKey) {
2341
+
if (codeMirrorEditors[editorKey] && codeMirrorEditors[editorKey].codemirror) {
2342
+
codeMirrorEditors[editorKey].codemirror.refresh();
2343
+
}
2344
+
});
2345
+
}
2346
+
2347
+
// Function to refresh editors when tab becomes visible
2348
+
function refreshEditorsOnTabShow() {
2349
+
// Listen for tab changes (UIkit tab switching)
2350
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.tab) {
2351
+
// When tab becomes active, refresh editors
2352
+
bdtUIkit.util.on(document, 'shown', '.bdt-tab', function() {
2353
+
setTimeout(function() {
2354
+
refreshAllCodeMirrorEditors();
2355
+
}, 50);
2356
+
});
2357
+
}
2358
+
2359
+
// Also listen for direct tab clicks
2360
+
$('.bdt-tab a').on('click', function() {
2361
+
setTimeout(function() {
2362
+
refreshAllCodeMirrorEditors();
2363
+
}, 100);
2364
+
});
2365
+
2366
+
// Listen for switcher changes (UIkit switcher)
2367
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.switcher) {
2368
+
bdtUIkit.util.on(document, 'shown', '.bdt-switcher', function() {
2369
+
setTimeout(function() {
2370
+
refreshAllCodeMirrorEditors();
2371
+
}, 50);
2372
+
});
2373
+
}
2374
+
}
2375
+
2376
+
// Initialize editors when page loads - with delay for better rendering
2377
+
setTimeout(function() {
2378
+
initializeCodeMirrorEditors();
2379
+
}, 100);
2380
+
2381
+
// Setup tab switching handlers
2382
+
setTimeout(function() {
2383
+
refreshEditorsOnTabShow();
2384
+
}, 100);
2385
+
2386
+
// Handle window resize events
2387
+
$(window).on('resize', function() {
2388
+
setTimeout(function() {
2389
+
refreshAllCodeMirrorEditors();
2390
+
}, 100);
2391
+
});
2392
+
2393
+
// Handle page visibility changes (when switching browser tabs)
2394
+
document.addEventListener('visibilitychange', function() {
2395
+
if (!document.hidden) {
2396
+
setTimeout(function() {
2397
+
refreshAllCodeMirrorEditors();
2398
+
}, 200);
2399
+
}
2400
+
});
2401
+
2402
+
// Force refresh when clicking on the Custom CSS & JS tab specifically
2403
+
$('a[href="#"]').on('click', function() {
2404
+
var tabText = $(this).text().trim();
2405
+
if (tabText === 'Custom CSS & JS') {
2406
+
setTimeout(function() {
2407
+
refreshAllCodeMirrorEditors();
2408
+
}, 150);
2409
+
}
2410
+
});
2411
+
2412
+
// Toggle white label fields visibility
2413
+
$('#ep-white-label-enabled').on('change', function() {
2414
+
if ($(this).is(':checked')) {
2415
+
$('.ep-white-label-fields').slideDown(300);
2416
+
} else {
2417
+
$('.ep-white-label-fields').slideUp(300);
2418
+
}
2419
+
});
2420
+
2421
+
// WordPress Media Library Integration for Icon Upload
2422
+
var mediaUploader;
2423
+
2424
+
$('#ep-upload-icon').on('click', function(e) {
2425
+
e.preventDefault();
2426
+
2427
+
// If the uploader object has already been created, reopen the dialog
2428
+
if (mediaUploader) {
2429
+
mediaUploader.open();
2430
+
return;
2431
+
}
2432
+
2433
+
// Create the media frame
2434
+
mediaUploader = wp.media.frames.file_frame = wp.media({
2435
+
title: 'Select Icon',
2436
+
button: {
2437
+
text: 'Use This Icon'
2438
+
},
2439
+
library: {
2440
+
type: ['image/jpeg', 'image/jpg', 'image/png', 'image/svg+xml']
2441
+
},
2442
+
multiple: false
2443
+
});
2444
+
2445
+
// When an image is selected, run a callback
2446
+
mediaUploader.on('select', function() {
2447
+
var attachment = mediaUploader.state().get('selection').first().toJSON();
2448
+
2449
+
// Set the hidden inputs
2450
+
$('#ep-white-label-icon').val(attachment.url);
2451
+
$('#ep-white-label-icon-id').val(attachment.id);
2452
+
2453
+
// Update preview
2454
+
$('#ep-icon-preview-img').attr('src', attachment.url);
2455
+
$('.ep-icon-preview-container').show();
2456
+
});
2457
+
2458
+
// Open the uploader dialog
2459
+
mediaUploader.open();
2460
+
});
2461
+
2462
+
// Remove icon functionality
2463
+
$('#ep-remove-icon').on('click', function(e) {
2464
+
e.preventDefault();
2465
+
2466
+
// Clear the hidden inputs
2467
+
$('#ep-white-label-icon').val('');
2468
+
$('#ep-white-label-icon-id').val('');
2469
+
2470
+
// Hide preview
2471
+
$('.ep-icon-preview-container').hide();
2472
+
$('#ep-icon-preview-img').attr('src', '');
2473
+
});
2474
+
2475
+
// BDTEP_HIDE Warning when checkbox is enabled
2476
+
$('#ep-white-label-bdtep-hide').on('change', function() {
2477
+
if ($(this).is(':checked')) {
2478
+
// Show warning modal/alert
2479
+
var warningMessage = '⚠️ WARNING: ADVANCED FEATURE\n\n' +
2480
+
'Enabling BDTEP_HIDE will activate advanced white label mode that:\n\n' +
2481
+
'• Hides ALL Element Pack branding and menus\n' +
2482
+
'• Makes these settings difficult to access later\n' +
2483
+
'• Requires the special access link to return\n' +
2484
+
'• Is intended for client/agency use only\n\n' +
2485
+
'An email with access instructions will be sent if you proceed.\n\n' +
2486
+
'Are you sure you want to enable this advanced mode?';
2487
+
2488
+
if (!confirm(warningMessage)) {
2489
+
// User cancelled, uncheck the box
2490
+
$(this).prop('checked', false);
2491
+
return false;
2492
+
}
2493
+
2494
+
// Show additional info message
2495
+
if ($('#ep-bdtep-hide-info').length === 0) {
2496
+
$(this).closest('.ep-option-item').after(
2497
+
'<div id="ep-bdtep-hide-info" class="bdt-alert bdt-alert-warning bdt-margin-small-top">' +
2498
+
'<p><strong>BDTEP_HIDE Mode Enabled</strong></p>' +
2499
+
'<p>When you save these settings, an email will be sent with instructions to access white label settings in the future.</p>' +
2500
+
'</div>'
2501
+
);
2502
+
}
2503
+
} else {
2504
+
// Remove info message when unchecked
2505
+
$('#ep-bdtep-hide-info').remove();
2506
+
}
2507
+
});
2508
+
2509
+
// Save white label settings with confirmation
2510
+
$('#ep-save-white-label').on('click', function(e) {
2511
+
e.preventDefault();
2512
+
2513
+
// Check if button is disabled (no license or no white label eligible license)
2514
+
if ($(this).prop('disabled')) {
2515
+
var buttonText = $(this).text().trim();
2516
+
var alertMessage = '';
2517
+
2518
+
if (buttonText.includes('License Not Activated')) {
2519
+
alertMessage = '<div class="bdt-alert bdt-alert-danger" bdt-alert>' +
2520
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2521
+
'<p><strong>License Not Activated</strong><br>You need to activate your Element Pack license to access White Label functionality. Please activate your license first.</p>' +
2522
+
'</div>';
2523
+
} else {
2524
+
alertMessage = '<div class="bdt-alert bdt-alert-warning" bdt-alert>' +
2525
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2526
+
'<p><strong>Eligible License Required</strong><br>White Label functionality is available for Agency, Extended, Developer, AppSumo Lifetime, and other eligible license holders. Please upgrade your license to access these features.</p>' +
2527
+
'</div>';
2528
+
}
2529
+
2530
+
$('#ep-white-label-message').html(alertMessage).show();
2531
+
return false;
2532
+
}
2533
+
2534
+
// Check if white label mode is being enabled
2535
+
var whiteLabelEnabled = $('#ep-white-label-enabled').is(':checked');
2536
+
var bdtepHideEnabled = $('#ep-white-label-bdtep-hide').is(':checked');
2537
+
2538
+
// Only show confirmation dialog if white label is enabled AND BDTEP_HIDE is enabled
2539
+
if (whiteLabelEnabled && bdtepHideEnabled) {
2540
+
var confirmMessage = '🔒 FINAL CONFIRMATION\n\n' +
2541
+
'You are about to save settings with BDTEP_HIDE enabled.\n\n' +
2542
+
'This will:\n' +
2543
+
'• Hide Element Pack from WordPress admin immediately\n' +
2544
+
'• Send access instructions to your email addresses\n' +
2545
+
'• Require the special link to modify these settings\n\n' +
2546
+
'Email will be sent to:\n' +
2547
+
'• License email: <?php echo esc_js('farid@bdthemes.com'); ?>\n' +
2548
+
'• Admin email: <?php echo esc_js(get_bloginfo('admin_email')); ?>\n\n' +
2549
+
'Are you absolutely sure you want to proceed?';
2550
+
2551
+
if (!confirm(confirmMessage)) {
2552
+
return false;
2553
+
}
2554
+
}
2555
+
2556
+
var $button = $(this);
2557
+
var originalText = $button.html();
2558
+
2559
+
// Show loading state
2560
+
$button.html('<span class="dashicons dashicons-update-alt"></span> Saving...');
2561
+
$button.prop('disabled', true);
2562
+
2563
+
// Collect form data
2564
+
var formData = {
2565
+
action: 'ep_save_white_label',
2566
+
nonce: ep_admin_ajax.white_label_nonce,
2567
+
white_label_enabled: $('#ep-white-label-enabled').is(':checked') ? 1 : 0,
2568
+
white_label_title: $('#ep-white-label-title').val(),
2569
+
white_label_icon: $('#ep-white-label-icon').val(),
2570
+
white_label_icon_id: $('#ep-white-label-icon-id').val(),
2571
+
hide_license: $('#ep-white-label-hide-license').is(':checked') ? 1 : 0,
2572
+
bdtep_hide: $('#ep-white-label-bdtep-hide').is(':checked') ? 1 : 0
2573
+
};
2574
+
2575
+
// Send AJAX request
2576
+
$.post(ep_admin_ajax.ajax_url, formData)
2577
+
.done(function(response) {
2578
+
if (response.success) {
2579
+
// Show success message with countdown
2580
+
var countdown = 2;
2581
+
var successMessage = response.data.message;
2582
+
2583
+
// Add email notification info if BDTEP_HIDE was enabled
2584
+
if (response.data.bdtep_hide && response.data.email_sent) {
2585
+
successMessage += '<br><br><strong>📧 Access Email Sent!</strong><br>Check your email for the access link to modify these settings in the future.';
2586
+
} else if (response.data.bdtep_hide && !response.data.email_sent && response.data.access_url) {
2587
+
// Localhost scenario - show the access URL directly
2588
+
successMessage += '<br><br><strong>📧 Localhost Email Notice:</strong><br>Email functionality is not available on localhost.<br><strong>Your Access URL:</strong><br><a href="' + response.data.access_url + '" target="_blank">Click here to access white label settings</a><br><small>Save this URL - you\'ll need it to modify settings when BDTEP_HIDE is active.</small>';
2589
+
} else if (response.data.bdtep_hide && !response.data.email_sent) {
2590
+
successMessage += '<br><br><strong>⚠️ Email Notice:</strong><br>There was an issue sending the access email. Please check your email settings or contact support.';
2591
+
}
2592
+
2593
+
$('#ep-white-label-message').html(
2594
+
'<div class="bdt-alert bdt-alert-success" bdt-alert>' +
2595
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2596
+
'<p>' + successMessage + ' <span id="ep-reload-countdown">Reloading in ' + countdown + ' seconds...</span></p>' +
2597
+
'</div>'
2598
+
).show();
2599
+
2600
+
// Update button text
2601
+
$button.html('<span class="dashicons dashicons-update-alt"></span> Reloading...');
2602
+
2603
+
// Countdown timer
2604
+
var countdownInterval = setInterval(function() {
2605
+
countdown--;
2606
+
if (countdown > 0) {
2607
+
$('#ep-reload-countdown').text('Reloading in ' + countdown + ' seconds...');
2608
+
} else {
2609
+
$('#ep-reload-countdown').text('Reloading now...');
2610
+
clearInterval(countdownInterval);
2611
+
}
2612
+
}, 1000);
2613
+
2614
+
// Check if BDTEP_HIDE is enabled and redirect accordingly
2615
+
setTimeout(function() {
2616
+
if (response.data.bdtep_hide) {
2617
+
// Redirect to admin dashboard if BDTEP_HIDE is enabled
2618
+
window.location.href = '<?php echo admin_url('index.php'); ?>';
2619
+
} else {
2620
+
// Reload current page if BDTEP_HIDE is not enabled
2621
+
window.location.reload();
2622
+
}
2623
+
}, 1500);
2624
+
} else {
2625
+
// Show error message
2626
+
$('#ep-white-label-message').html(
2627
+
'<div class="bdt-alert bdt-alert-danger" bdt-alert>' +
2628
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2629
+
'<p>Error: ' + (response.data.message || 'Unknown error occurred') + '</p>' +
2630
+
'</div>'
2631
+
).show();
2632
+
2633
+
// Restore button state for error case
2634
+
$button.html(originalText);
2635
+
$button.prop('disabled', false);
2636
+
}
2637
+
})
2638
+
.fail(function(xhr, status, error) {
2639
+
// Show error message
2640
+
$('#ep-white-label-message').html(
2641
+
'<div class="bdt-alert bdt-alert-danger" bdt-alert>' +
2642
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2643
+
'<p>Error: Failed to save settings. Please try again. (' + status + ')</p>' +
2644
+
'</div>'
2645
+
).show();
2646
+
2647
+
// Restore button state for failure case
2648
+
$button.html(originalText);
2649
+
$button.prop('disabled', false);
2650
+
});
2651
+
});
2652
+
2653
+
// Save custom code functionality (updated for CodeMirror)
2654
+
$('#ep-save-custom-code').on('click', function(e) {
2655
+
e.preventDefault();
2656
+
2657
+
var $button = $(this);
2658
+
var originalText = $button.html();
2659
+
2660
+
// Prevent multiple simultaneous saves
2661
+
if ($button.prop('disabled') || $button.hasClass('ep-saving')) {
2662
+
return;
2663
+
}
2664
+
2665
+
// Mark as saving
2666
+
$button.addClass('ep-saving');
2667
+
2668
+
// Get content from CodeMirror editors
2669
+
function getCodeMirrorContent(elementId) {
2670
+
if (codeMirrorEditors[elementId] && codeMirrorEditors[elementId].codemirror) {
2671
+
return codeMirrorEditors[elementId].codemirror.getValue();
2672
+
} else {
2673
+
// Fallback to textarea value
2674
+
return $('#' + elementId).val() || '';
2675
+
}
2676
+
}
2677
+
2678
+
var cssContent = getCodeMirrorContent('ep-custom-css');
2679
+
var jsContent = getCodeMirrorContent('ep-custom-js');
2680
+
var css2Content = getCodeMirrorContent('ep-custom-css-2');
2681
+
var js2Content = getCodeMirrorContent('ep-custom-js-2');
2682
+
2683
+
// Show loading state
2684
+
$button.html('<span class="dashicons dashicons-update-alt"></span> Saving...');
2685
+
$button.prop('disabled', true);
2686
+
2687
+
// Timeout safeguard - if AJAX doesn't complete in 30 seconds, restore button
2688
+
var timeoutId = setTimeout(function() {
2689
+
$button.removeClass('ep-saving');
2690
+
$button.html(originalText);
2691
+
$button.prop('disabled', false);
2692
+
$('#ep-custom-code-message').html(
2693
+
'<div class="bdt-alert bdt-alert-warning" bdt-alert>' +
2694
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2695
+
'<p>Save operation timed out. Please try again.</p>' +
2696
+
'</div>'
2697
+
).show();
2698
+
}, 30000);
2699
+
2700
+
// Collect form data
2701
+
var formData = {
2702
+
action: 'ep_save_custom_code',
2703
+
nonce: ep_admin_ajax.nonce,
2704
+
custom_css: cssContent,
2705
+
custom_js: jsContent,
2706
+
custom_css_2: css2Content,
2707
+
custom_js_2: js2Content,
2708
+
excluded_pages: $('#ep-excluded-pages').val() || []
2709
+
};
2710
+
2711
+
2712
+
// Verify we have some content before sending (optional check)
2713
+
var totalContentLength = cssContent.length + jsContent.length + css2Content.length + js2Content.length;
2714
+
if (totalContentLength === 0) {
2715
+
var confirmEmpty = confirm('No content detected in any editor. Do you want to save empty content (this will clear all custom code)?');
2716
+
if (!confirmEmpty) {
2717
+
// Restore button state
2718
+
$button.html(originalText);
2719
+
$button.prop('disabled', false);
2720
+
return;
2721
+
}
2722
+
}
2723
+
2724
+
// Send AJAX request
2725
+
$.post(ep_admin_ajax.ajax_url, formData)
2726
+
.done(function(response) {
2727
+
if (response.success) {
2728
+
// Show success message
2729
+
var successMessage = response.data.message;
2730
+
if (response.data.excluded_count) {
2731
+
successMessage += ' (' + response.data.excluded_count + ' pages excluded)';
2732
+
}
2733
+
2734
+
$('#ep-custom-code-message').html(
2735
+
'<div class="bdt-alert bdt-alert-success" bdt-alert>' +
2736
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2737
+
'<p>' + successMessage + '</p>' +
2738
+
'</div>'
2739
+
).show();
2740
+
2741
+
// Auto-hide message after 5 seconds
2742
+
setTimeout(function() {
2743
+
$('#ep-custom-code-message').fadeOut();
2744
+
}, 5000);
2745
+
2746
+
} else {
2747
+
// Show error message
2748
+
$('#ep-custom-code-message').html(
2749
+
'<div class="bdt-alert bdt-alert-danger" bdt-alert>' +
2750
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2751
+
'<p>Error: ' + (response.data.message || 'Unknown error occurred') + '</p>' +
2752
+
'</div>'
2753
+
).show();
2754
+
}
2755
+
})
2756
+
.fail(function(xhr, status, error) {
2757
+
// Show error message
2758
+
$('#ep-custom-code-message').html(
2759
+
'<div class="bdt-alert bdt-alert-danger" bdt-alert>' +
2760
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2761
+
'<p>Error: Failed to save custom code. Please try again. (' + status + ')</p>' +
2762
+
'</div>'
2763
+
).show();
2764
+
})
2765
+
.always(function() {
2766
+
2767
+
// Clear the timeout since AJAX completed
2768
+
clearTimeout(timeoutId);
2769
+
2770
+
try {
2771
+
$button.removeClass('ep-saving');
2772
+
$button.html(originalText);
2773
+
$button.prop('disabled', false);
2774
+
} catch (e) {
2775
+
// Fallback: force button restoration
2776
+
$('#ep-save-custom-code').removeClass('ep-saving').html('<span class="dashicons dashicons-yes"></span> Save Custom Code').prop('disabled', false);
2777
+
}
2778
+
});
2779
+
});
2780
+
2781
+
// Reset custom code functionality (updated for CodeMirror)
2782
+
$('#ep-reset-custom-code').on('click', function(e) {
2783
+
e.preventDefault();
2784
+
2785
+
if (confirm('Are you sure you want to reset all custom code? This action cannot be undone.')) {
2786
+
// Clear CodeMirror editors
2787
+
function clearCodeMirrorEditor(elementId) {
2788
+
if (codeMirrorEditors[elementId] && codeMirrorEditors[elementId].codemirror) {
2789
+
codeMirrorEditors[elementId].codemirror.setValue('');
2790
+
} else {
2791
+
// Fallback to clearing textarea
2792
+
$('#' + elementId).val('');
2793
+
}
2794
+
}
2795
+
2796
+
// Clear all editors
2797
+
clearCodeMirrorEditor('ep-custom-css');
2798
+
clearCodeMirrorEditor('ep-custom-js');
2799
+
clearCodeMirrorEditor('ep-custom-css-2');
2800
+
clearCodeMirrorEditor('ep-custom-js-2');
2801
+
2802
+
// Clear exclusions
2803
+
$('#ep-excluded-pages').val([]).trigger('change');
2804
+
2805
+
$('#ep-custom-code-message').html(
2806
+
'<div class="bdt-alert bdt-alert-warning" bdt-alert>' +
2807
+
'<a href="#" class="bdt-alert-close" onclick="$(this).parent().parent().hide(); return false;">×</a>' +
2808
+
'<p>All custom code has been cleared. Don\'t forget to save changes!</p>' +
2809
+
'</div>'
2810
+
).show();
2811
+
2812
+
// Auto-hide message after 3 seconds
2813
+
setTimeout(function() {
2814
+
$('#ep-custom-code-message').fadeOut();
2815
+
}, 3000);
2816
+
}
2817
+
});
2818
+
});
2819
+
2820
+
// Chart.js initialization for system status canvas charts
2821
+
function initElementPackCharts() {
2822
+
// Wait for Chart.js to be available
2823
+
if (typeof Chart === 'undefined') {
2824
+
setTimeout(initElementPackCharts, 500);
2825
+
return;
2826
+
}
2827
+
2828
+
// Chart instances storage
2829
+
window.epChartInstances = window.epChartInstances || {};
2830
+
window.epChartsInitialized = false;
2831
+
2832
+
// Function to create a chart
2833
+
function createChart(canvasId) {
2834
+
var canvas = document.getElementById(canvasId);
2835
+
if (!canvas) {
2836
+
return;
2837
+
}
2838
+
2839
+
var $canvas = jQuery('#' + canvasId);
2840
+
var valueStr = $canvas.data('value');
2841
+
var labelsStr = $canvas.data('labels');
2842
+
var bgStr = $canvas.data('bg');
2843
+
2844
+
if (!valueStr || !labelsStr || !bgStr) {
2845
+
return;
2846
+
}
2847
+
2848
+
// Parse data
2849
+
var values = valueStr.toString().split(',').map(v => parseInt(v.trim()) || 0);
2850
+
var labels = labelsStr.toString().split(',').map(l => l.trim());
2851
+
var colors = bgStr.toString().split(',').map(c => c.trim());
2852
+
2853
+
// Destroy existing chart using Chart.js built-in method
2854
+
var existingChart = Chart.getChart(canvas);
2855
+
if (existingChart) {
2856
+
existingChart.destroy();
2857
+
}
2858
+
2859
+
// Also destroy from our instance storage
2860
+
if (window.epChartInstances && window.epChartInstances[canvasId]) {
2861
+
window.epChartInstances[canvasId].destroy();
2862
+
delete window.epChartInstances[canvasId];
2863
+
}
2864
+
2865
+
// Create new chart
2866
+
try {
2867
+
var newChart = new Chart(canvas, {
2868
+
type: 'doughnut',
2869
+
data: {
2870
+
labels: labels,
2871
+
datasets: [{
2872
+
data: values,
2873
+
backgroundColor: colors,
2874
+
borderWidth: 0
2875
+
}]
2876
+
},
2877
+
options: {
2878
+
responsive: true,
2879
+
maintainAspectRatio: false,
2880
+
plugins: {
2881
+
legend: { display: false },
2882
+
tooltip: { enabled: true }
2883
+
},
2884
+
cutout: '60%'
2885
+
}
2886
+
});
2887
+
2888
+
// Store in our instance storage
2889
+
if (!window.epChartInstances) window.epChartInstances = {};
2890
+
window.epChartInstances[canvasId] = newChart;
2891
+
} catch (error) {
2892
+
// Do nothing
2893
+
}
2894
+
}
2895
+
2896
+
// Update total widgets status
2897
+
function updateTotalStatus() {
2898
+
var coreCount = jQuery('#element_pack_active_modules_page input:checked').length;
2899
+
var thirdPartyCount = jQuery('#element_pack_third_party_widget_page input:checked').length;
2900
+
var extensionsCount = jQuery('#element_pack_elementor_extend_page input:checked').length;
2901
+
2902
+
jQuery('#bdt-total-widgets-status-core').text(coreCount);
2903
+
jQuery('#bdt-total-widgets-status-3rd').text(thirdPartyCount);
2904
+
jQuery('#bdt-total-widgets-status-extensions').text(extensionsCount);
2905
+
jQuery('#bdt-total-widgets-status-heading').text(coreCount + thirdPartyCount + extensionsCount);
2906
+
2907
+
jQuery('#bdt-total-widgets-status').attr('data-value', [coreCount, thirdPartyCount, extensionsCount].join(','));
2908
+
}
2909
+
2910
+
// Initialize all charts once
2911
+
function initAllCharts() {
2912
+
// Check if charts already exist and are properly rendered
2913
+
if (window.epChartInstances && Object.keys(window.epChartInstances).length >= 4) {
2914
+
return;
2915
+
}
2916
+
2917
+
// Update total status first
2918
+
updateTotalStatus();
2919
+
2920
+
// Create all charts
2921
+
var chartCanvases = [
2922
+
'bdt-db-total-status',
2923
+
'bdt-db-only-widget-status',
2924
+
'bdt-db-only-3rdparty-status',
2925
+
'bdt-total-widgets-status'
2926
+
];
2927
+
2928
+
var successfulCharts = 0;
2929
+
chartCanvases.forEach(function(canvasId) {
2930
+
var canvas = document.getElementById(canvasId);
2931
+
if (canvas && canvas.offsetParent !== null) { // Check if canvas is visible
2932
+
createChart(canvasId);
2933
+
if (window.epChartInstances && window.epChartInstances[canvasId]) {
2934
+
successfulCharts++;
2935
+
}
2936
+
}
2937
+
});
2938
+
}
2939
+
2940
+
// Check if we're currently on system status tab and initialize
2941
+
function checkAndInitIfOnSystemStatus() {
2942
+
if (window.location.hash === '#element_pack_analytics_system_req') {
2943
+
setTimeout(initAllCharts, 300);
2944
+
}
2945
+
}
2946
+
2947
+
// Initialize charts when DOM is ready
2948
+
jQuery(document).ready(function() {
2949
+
// Only initialize if we're on the system status tab
2950
+
setTimeout(checkAndInitIfOnSystemStatus, 500);
2951
+
});
2952
+
2953
+
// Add click handler for System Status tab to create/refresh charts
2954
+
jQuery(document).on('click', 'a[href="#element_pack_analytics_system_req"], a[href*="element_pack_analytics_system_req"]', function() {
2955
+
setTimeout(function() {
2956
+
// Always recreate charts when tab is clicked to ensure they're visible
2957
+
initAllCharts();
2958
+
}, 200);
2959
+
});
2960
+
}
2961
+
2962
+
// Start the chart initialization
2963
+
setTimeout(initElementPackCharts, 1000);
2964
+
2965
+
// Handle plugin installation via AJAX
2966
+
jQuery(document).on('click', '.ep-install-plugin', function(e) {
2967
+
e.preventDefault();
2968
+
2969
+
var $button = jQuery(this);
2970
+
var pluginSlug = $button.data('plugin-slug');
2971
+
var nonce = $button.data('nonce');
2972
+
var originalText = $button.text();
2973
+
2974
+
// Disable button and show loading state
2975
+
$button.prop('disabled', true)
2976
+
.text('<?php echo esc_js(__('Installing...', 'bdthemes-element-pack')); ?>')
2977
+
.addClass('bdt-installing');
2978
+
2979
+
// Perform AJAX request
2980
+
jQuery.ajax({
2981
+
url: '<?php echo admin_url('admin-ajax.php'); ?>',
2982
+
type: 'POST',
2983
+
data: {
2984
+
action: 'ep_install_plugin',
2985
+
plugin_slug: pluginSlug,
2986
+
nonce: nonce
2987
+
},
2988
+
success: function(response) {
2989
+
if (response.success) {
2990
+
// Show success message
2991
+
$button.text('<?php echo esc_js(__('Installed!', 'bdthemes-element-pack')); ?>')
2992
+
.removeClass('bdt-installing')
2993
+
.addClass('bdt-installed');
2994
+
2995
+
// Show success notification
2996
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.notification) {
2997
+
bdtUIkit.notification({
2998
+
message: '<span class="dashicons dashicons-yes"></span> ' + response.data.message,
2999
+
status: 'success'
3000
+
});
3001
+
}
3002
+
3003
+
// Reload the page after 2 seconds to update button states
3004
+
setTimeout(function() {
3005
+
window.location.reload();
3006
+
}, 2000);
3007
+
3008
+
} else {
3009
+
// Show error message
3010
+
$button.prop('disabled', false)
3011
+
.text(originalText)
3012
+
.removeClass('bdt-installing');
3013
+
3014
+
// Show error notification
3015
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.notification) {
3016
+
bdtUIkit.notification({
3017
+
message: '<span class="dashicons dashicons-warning"></span> ' + response.data.message,
3018
+
status: 'danger'
3019
+
});
3020
+
}
3021
+
}
3022
+
},
3023
+
error: function() {
3024
+
// Handle network/server errors
3025
+
$button.prop('disabled', false)
3026
+
.text(originalText)
3027
+
.removeClass('bdt-installing');
3028
+
3029
+
// Show error notification
3030
+
if (typeof bdtUIkit !== 'undefined' && bdtUIkit.notification) {
3031
+
bdtUIkit.notification({
3032
+
message: '<span class="dashicons dashicons-warning"></span> <?php echo esc_js(__('Installation failed. Please try again.', 'bdthemes-element-pack')); ?>',
3033
+
status: 'danger'
3034
+
});
3035
+
}
3036
+
}
3037
+
});
3038
+
});
3039
+
3040
+
jQuery(document).ready(function ($) {
3041
+
const getProLink = $('a[href="admin.php?page=element_pack_options_upgrade"]');
3042
+
if (getProLink.length) {
3043
+
getProLink.attr('target', '_blank');
3044
+
}
3045
+
});
3046
+
</script>
3047
+
<?php
3048
+
}
3049
+
3050
+
/**
3051
+
* Display Footer
3052
+
*
3053
+
* @access public
3054
+
* @return void
3055
+
*/
3056
+
3057
+
public function footer_info() {
3058
+
?>
3059
+
<div class="element-pack-footer-info bdt-margin-medium-top">
3060
+
<div class="bdt-grid ">
3061
+
<div class="bdt-width-auto@s ep-setting-save-btn">
3062
+
</div>
3063
+
<div class="bdt-width-expand@s bdt-text-right">
3064
+
<p class="">
3065
+
<?php
3066
+
/* translators: %1$s: URL link to BdThemes website */
3067
+
echo sprintf(
3068
+
__('Element Pack plugin made with love by <a target="_blank" href="%1$s">BdThemes</a> Team.<br>All rights reserved by <a target="_blank" href="%1$s">BdThemes.com</a>.', 'bdthemes-element-pack'),
3069
+
esc_url('https://bdthemes.com')
3070
+
);
3071
+
?>
3072
+
</p>
3073
+
</div>
3074
+
</div>
3075
+
</div>
3076
+
<?php
3077
+
}
3078
+
3079
+
/**
3080
+
* Get all the pages
3081
+
*
3082
+
* @return array page names with key value pairs
3083
+
*/
3084
+
function get_pages() {
3085
+
$pages = get_pages();
3086
+
$pages_options = [];
3087
+
if ( $pages ) {
3088
+
foreach ( $pages as $page ) {
3089
+
$pages_options[ $page->ID ] = $page->post_title;
3090
+
}
3091
+
}
3092
+
3093
+
return $pages_options;
3094
+
}
3095
+
3096
+
/**
3097
+
* Display Analytics and System Requirements
3098
+
*
3099
+
* @access public
3100
+
* @return void
3101
+
*/
3102
+
3103
+
public function element_pack_analytics_system_req_content() {
3104
+
?>
3105
+
<div class="ep-dashboard-panel"
3106
+
bdt-scrollspy="target: > div > div > .bdt-card; cls: bdt-animation-slide-bottom-small; delay: 300">
3107
+
<div class="ep-dashboard-analytics-system">
3108
+
3109
+
<?php $this->element_pack_widgets_status(); ?>
3110
+
3111
+
<div class="bdt-grid bdt-grid-medium bdt-margin-medium-top" bdt-grid
3112
+
bdt-height-match="target: > div > .bdt-card">
3113
+
<div class="bdt-width-1-1">
3114
+
<div class="bdt-card bdt-card-body ep-system-requirement">
3115
+
<h1 class="ep-feature-title bdt-margin-small-bottom">
3116
+
<?php esc_html_e('System Requirement', 'bdthemes-element-pack'); ?>
3117
+
</h1>
3118
+
<?php $this->element_pack_system_requirement(); ?>
3119
+
</div>
3120
+
</div>
3121
+
</div>
3122
+
3123
+
</div>
3124
+
</div>
3125
+
<?php
3126
+
}
3127
+
3128
+
/**
3129
+
* Extra Options Start Here
3130
+
*/
3131
+
3132
+
public function element_pack_extra_options() {
3133
+
?>
3134
+
<div class="ep-dashboard-panel"
3135
+
bdt-scrollspy="target: > div > div > .bdt-card; cls: bdt-animation-slide-bottom-small; delay: 300">
3136
+
<div class="ep-dashboard-extra-options">
3137
+
<div class="bdt-card bdt-card-body">
3138
+
<h1 class="ep-feature-title"><?php esc_html_e('Extra Options', 'bdthemes-element-pack'); ?></h1>
3139
+
3140
+
<div class="ep-extra-options-tabs">
3141
+
<ul class="bdt-tab" bdt-tab="connect: #ep-extra-options-tab-content; animation: bdt-animation-fade">
3142
+
<li class="bdt-active"><a
3143
+
href="#"><?php esc_html_e('Custom CSS & JS', 'bdthemes-element-pack'); ?></a></li>
3144
+
<li><a href="#"><?php esc_html_e('White Label', 'bdthemes-element-pack'); ?></a></li>
3145
+
</ul>
3146
+
3147
+
<div id="ep-extra-options-tab-content" class="bdt-switcher">
3148
+
<!-- Custom CSS & JS Tab -->
3149
+
<div>
3150
+
<?php $this->render_custom_css_js_section(); ?>
3151
+
</div>
3152
+
3153
+
<!-- White Label Tab -->
3154
+
<div>
3155
+
<?php $this->render_white_label_section(); ?>
3156
+
</div>
3157
+
</div>
3158
+
</div>
3159
+
</div>
3160
+
</div>
3161
+
</div>
3162
+
<?php
3163
+
}
3164
+
3165
+
/**
3166
+
* Extra Options Start Here
3167
+
*/
3168
+
3169
+
/**
3170
+
* Render Custom CSS & JS Section
3171
+
*
3172
+
* @access public
3173
+
* @return void
3174
+
*/
3175
+
public function render_custom_css_js_section() {
3176
+
?>
3177
+
<div class="ep-custom-code-section">
3178
+
<!-- Header Section -->
3179
+
<div class="ep-code-section-header">
3180
+
<h2 class="ep-section-title"><?php esc_html_e('Header Code Injection', 'bdthemes-element-pack'); ?></h2>
3181
+
<p class="ep-section-description"><?php esc_html_e('Code added here will be injected into the <head> section of your website.', 'bdthemes-element-pack'); ?></p>
3182
+
</div>
3183
+
<div class="ep-code-row bdt-grid bdt-grid-small" bdt-grid>
3184
+
<div class="bdt-width-1-2@m">
3185
+
<div class="ep-code-editor-wrapper">
3186
+
<h3 class="ep-code-editor-title"><?php esc_html_e('CSS', 'bdthemes-element-pack'); ?></h3>
3187
+
<p class="ep-code-editor-description"><?php esc_html_e('Enter raw CSS code without <style> tags.', 'bdthemes-element-pack'); ?></p>
3188
+
<div class="ep-codemirror-editor-container">
3189
+
<textarea id="ep-custom-css" name="ep_custom_css" class="ep-code-editor" data-mode="css" placeholder=".example { background: red; border-radius: 5px; padding: 15px; } "><?php echo esc_textarea(get_option('ep_custom_css', '')); ?></textarea>
3190
+
</div>
3191
+
</div>
3192
+
</div>
3193
+
<div class="bdt-width-1-2@m">
3194
+
<div class="ep-code-editor-wrapper">
3195
+
<h3 class="ep-code-editor-title"><?php esc_html_e('JS', 'bdthemes-element-pack'); ?></h3>
3196
+
<p class="ep-code-editor-description"><?php esc_html_e('Enter raw JavaScript code without <script> tags.', 'bdthemes-element-pack'); ?></p>
3197
+
<div class="ep-codemirror-editor-container">
3198
+
<textarea id="ep-custom-js" name="ep_custom_js" class="ep-code-editor" data-mode="javascript" placeholder="alert('Hello, Element Pack!');"><?php echo esc_textarea(get_option('ep_custom_js', '')); ?></textarea>
3199
+
</div>
3200
+
</div>
3201
+
</div>
3202
+
</div>
3203
+
3204
+
<!-- Footer Section -->
3205
+
<div class="ep-code-section-header bdt-margin-medium-top">
3206
+
<h2 class="ep-section-title"><?php esc_html_e('Footer Code Injection', 'bdthemes-element-pack'); ?></h2>
3207
+
<p class="ep-section-description"><?php esc_html_e('Code added here will be injected before the closing </body> tag of your website.', 'bdthemes-element-pack'); ?></p>
3208
+
</div>
3209
+
<div class="ep-code-row bdt-grid bdt-grid-small bdt-margin-small-top" bdt-grid>
3210
+
<div class="bdt-width-1-2@m">
3211
+
<div class="ep-code-editor-wrapper">
3212
+
<h3 class="ep-code-editor-title"><?php esc_html_e('CSS', 'bdthemes-element-pack'); ?></h3>
3213
+
<p class="ep-code-editor-description"><?php esc_html_e('Enter raw CSS code without <style> tags.', 'bdthemes-element-pack'); ?></p>
3214
+
<div class="ep-codemirror-editor-container">
3215
+
<textarea id="ep-custom-css-2" name="ep_custom_css_2" class="ep-code-editor" data-mode="css" placeholder=".example { background: green; } "><?php echo esc_textarea(get_option('ep_custom_css_2', '')); ?></textarea>
3216
+
</div>
3217
+
</div>
3218
+
</div>
3219
+
<div class="bdt-width-1-2@m">
3220
+
<div class="ep-code-editor-wrapper">
3221
+
<h3 class="ep-code-editor-title"><?php esc_html_e('JS', 'bdthemes-element-pack'); ?></h3>
3222
+
<p class="ep-code-editor-description"><?php esc_html_e('Enter raw JavaScript code without <script> tags.', 'bdthemes-element-pack'); ?></p>
3223
+
<div class="ep-codemirror-editor-container">
3224
+
<textarea id="ep-custom-js-2" name="ep_custom_js_2" class="ep-code-editor" data-mode="javascript" placeholder="console.log('Hello, Element Pack!');"><?php echo esc_textarea(get_option('ep_custom_js_2', '')); ?></textarea>
3225
+
</div>
3226
+
</div>
3227
+
</div>
3228
+
</div>
3229
+
3230
+
<!-- Page Exclusion Section -->
3231
+
<div class="ep-code-section-header bdt-margin-medium-top">
3232
+
<h2 class="ep-section-title"><?php esc_html_e('Page & Post Exclusion Settings', 'bdthemes-element-pack'); ?></h2>
3233
+
<p class="ep-section-description"><?php esc_html_e('Select pages and posts where you don\'t want any custom code to be injected. This applies to all sections above.', 'bdthemes-element-pack'); ?></p>
3234
+
</div>
3235
+
<div class="ep-page-exclusion-wrapper">
3236
+
<label for="ep-excluded-pages" class="ep-exclusion-label">
3237
+
<?php esc_html_e('Exclude Pages & Posts:', 'bdthemes-element-pack'); ?>
3238
+
</label>
3239
+
<select id="ep-excluded-pages" name="ep_excluded_pages[]" multiple class="ep-page-select">
3240
+
<option value=""><?php esc_html_e('-- Select pages/posts to exclude --', 'bdthemes-element-pack'); ?></option>
3241
+
<?php
3242
+
$excluded_pages = get_option('ep_excluded_pages', array());
3243
+
if (!is_array($excluded_pages)) {
3244
+
$excluded_pages = array();
3245
+
}
3246
+
3247
+
// Get all published pages
3248
+
$pages = get_pages(array(
3249
+
'sort_order' => 'ASC',
3250
+
'sort_column' => 'post_title',
3251
+
'post_status' => 'publish'
3252
+
));
3253
+
3254
+
// Get recent posts (last 50)
3255
+
$posts = get_posts(array(
3256
+
'numberposts' => 50,
3257
+
'post_status' => 'publish',
3258
+
'post_type' => 'post',
3259
+
'orderby' => 'date',
3260
+
'order' => 'DESC'
3261
+
));
3262
+
3263
+
// Display pages first
3264
+
if (!empty($pages)) {
3265
+
echo '<optgroup label="' . esc_attr__('Pages', 'bdthemes-element-pack') . '">';
3266
+
foreach ($pages as $page) {
3267
+
$selected = in_array($page->ID, $excluded_pages) ? 'selected' : '';
3268
+
echo '<option value="' . esc_attr($page->ID) . '" ' . $selected . '>' . esc_html($page->post_title) . '</option>';
3269
+
}
3270
+
echo '</optgroup>';
3271
+
}
3272
+
3273
+
// Then display posts
3274
+
if (!empty($posts)) {
3275
+
echo '<optgroup label="' . esc_attr__('Recent Posts', 'bdthemes-element-pack') . '">';
3276
+
foreach ($posts as $post) {
3277
+
$selected = in_array($post->ID, $excluded_pages) ? 'selected' : '';
3278
+
$post_date = date('M j, Y', strtotime($post->post_date));
3279
+
echo '<option value="' . esc_attr($post->ID) . '" ' . $selected . '>' . esc_html($post->post_title) . ' (' . $post_date . ')</option>';
3280
+
}
3281
+
echo '</optgroup>';
3282
+
}
3283
+
?>
3284
+
</select>
3285
+
<p class="ep-exclusion-help">
3286
+
<?php esc_html_e('Hold Ctrl (or Cmd on Mac) to select multiple items. Selected pages and posts will not load any custom CSS or JavaScript code. The list shows all pages and the 50 most recent posts.', 'bdthemes-element-pack'); ?>
3287
+
</p>
3288
+
</div>
3289
+
3290
+
<!-- Save Button Section -->
3291
+
<div class="ep-code-save-section bdt-margin-medium-top bdt-text-center">
3292
+
<button type="button" id="ep-save-custom-code" class="bdt-button bdt-btn-blue bdt-margin-small-right" bdt-tooltip="Upgrade to Element Pack Pro to use this feature." disabled>
3293
+
<span class="dashicons dashicons-yes"></span>
3294
+
<?php esc_html_e('Save Custom Code', 'bdthemes-element-pack'); ?>
3295
+
</button>
3296
+
<button type="button" id="ep-reset-custom-code" class="bdt-button bdt-btn-grey">
3297
+
<span class="dashicons dashicons-update"></span>
3298
+
<?php esc_html_e('Reset Code', 'bdthemes-element-pack'); ?>
3299
+
</button>
3300
+
</div>
3301
+
3302
+
<!-- Success/Error Messages -->
3303
+
<div id="ep-custom-code-message" class="ep-code-message bdt-margin-small-top" style="display: none;">
3304
+
<div class="bdt-alert bdt-alert-success" bdt-alert>
3305
+
<a href class="bdt-alert-close" bdt-close></a>
3306
+
<p><?php esc_html_e('Custom code saved successfully!', 'bdthemes-element-pack'); ?></p>
3307
+
</div>
3308
+
</div>
3309
+
</div>
3310
+
<?php
3311
+
}
3312
+
3313
+
/**
3314
+
* Render White Label Section
3315
+
*
3316
+
* @access public
3317
+
* @return void
3318
+
*/
3319
+
public function render_white_label_section() {
3320
+
?>
3321
+
<div class="ep-white-label-section">
3322
+
<h1 class="ep-feature-title"><?php esc_html_e('White Label Settings', 'bdthemes-element-pack'); ?></h1>
3323
+
<p><?php esc_html_e('Enable white label mode to hide Element Pack branding from the admin interface and widgets.', 'bdthemes-element-pack'); ?></p>
3324
+
3325
+
<div class="bdt-alert bdt-alert-danger bdt-margin-medium-top" bdt-alert>
3326
+
<p><strong><?php esc_html_e('License Not Activated', 'bdthemes-element-pack'); ?></strong></p>
3327
+
<p><?php esc_html_e('You need to activate your Element Pack license to access White Label functionality. Please activate your license first.', 'bdthemes-element-pack'); ?></p>
3328
+
<div class="bdt-margin-small-top">
3329
+
<a href="https://elementpack.pro/pricing/" target="_blank" class="bdt-button bdt-btn-blue">
3330
+
<?php esc_html_e('Get License', 'bdthemes-element-pack'); ?>
3331
+
</a>
3332
+
</div>
3333
+
</div>
3334
+
3335
+
<!-- White Label Options -->
3336
+
<div class="ep-white-label-options ep-white-label-locked">
3337
+
<div class="ep-option-item ">
3338
+
<div class="ep-option-item-inner bdt-card">
3339
+
<div class="bdt-flex bdt-flex-between bdt-flex-middle">
3340
+
<div>
3341
+
<h3 class="ep-option-title"><?php esc_html_e('Enable White Label Mode', 'bdthemes-element-pack'); ?></h3>
3342
+
<p class="ep-option-description">
3343
+
<?php esc_html_e('This feature requires an eligible license (Agency, Extended, Developer, AppSumo Lifetime, etc.). Upgrade your license to access white label functionality.', 'bdthemes-element-pack'); ?>
3344
+
</p>
3345
+
</div>
3346
+
<div class="ep-option-switch">
3347
+
<?php
3348
+
$white_label_enabled = false;
3349
+
// Convert to boolean to ensure proper comparison
3350
+
$white_label_enabled = (bool) $white_label_enabled;
3351
+
?>
3352
+
<label class="switch">
3353
+
<input type="checkbox"
3354
+
id="ep-white-label-enabled"
3355
+
name="ep_white_label_enabled"
3356
+
<?php checked($white_label_enabled, true); ?>
3357
+
<?php disabled(true); ?>>
3358
+
<span class="slider"></span>
3359
+
</label>
3360
+
</div>
3361
+
</div>
3362
+
</div>
3363
+
</div>
3364
+
3365
+
<!-- Save Button Section -->
3366
+
<div class="ep-white-label-save-section bdt-margin-small-top bdt-text-center">
3367
+
<button type="button"
3368
+
id="ep-save-white-label"
3369
+
class="bdt-button bdt-btn-blue"
3370
+
<?php disabled(true); ?>>
3371
+
<span class="dashicons dashicons-yes"></span>
3372
+
<?php esc_html_e('Eligible License Required', 'bdthemes-element-pack'); ?>
3373
+
</button>
3374
+
</div>
3375
+
3376
+
<!-- Success/Error Messages -->
3377
+
<div id="ep-white-label-message" class="ep-white-label-message bdt-margin-small-top" style="display: none;">
3378
+
<div class="bdt-alert bdt-alert-success" bdt-alert>
3379
+
<a href class="bdt-alert-close" bdt-close></a>
3380
+
<p><?php esc_html_e('White label settings saved successfully!', 'bdthemes-element-pack'); ?></p>
3381
+
</div>
3382
+
</div>
3383
+
</div>
3384
+
</div>
3385
+
<?php
3386
+
}
3387
+
3388
+
/**
3389
+
* Check plugin status (installed, active, or not installed)
3390
+
*
3391
+
* @param string $plugin_path Plugin file path
3392
+
* @return string 'active', 'installed', or 'not_installed'
3393
+
*/
3394
+
private function get_plugin_status($plugin_path) {
3395
+
// Check if plugin is active
3396
+
if (is_plugin_active($plugin_path)) {
3397
+
return 'active';
3398
+
}
3399
+
3400
+
// Check if plugin is installed but not active
3401
+
$installed_plugins = get_plugins();
3402
+
if (isset($installed_plugins[$plugin_path])) {
3403
+
return 'installed';
3404
+
}
3405
+
3406
+
// Plugin is not installed
3407
+
return 'not_installed';
3408
+
}
3409
+
3410
+
/**
3411
+
* Get plugin action button HTML based on plugin status
3412
+
*
3413
+
* @param string $plugin_path Plugin file path
3414
+
* @param string $install_url Plugin installation URL
3415
+
* @param string $plugin_slug Plugin slug for activation
3416
+
* @return string Button HTML
3417
+
*/
3418
+
private function get_plugin_action_button($plugin_path, $install_url, $plugin_slug = '') {
3419
+
$status = $this->get_plugin_status($plugin_path);
3420
+
3421
+
switch ($status) {
3422
+
case 'active':
3423
+
return '';
3424
+
3425
+
case 'installed':
3426
+
$activate_url = wp_nonce_url(
3427
+
add_query_arg([
3428
+
'action' => 'activate',
3429
+
'plugin' => $plugin_path
3430
+
], admin_url('plugins.php')),
3431
+
'activate-plugin_' . $plugin_path
3432
+
);
3433
+
return '<a class="bdt-button bdt-welcome-button" href="' . esc_url($activate_url) . '">' .
3434
+
__('Activate', 'bdthemes-element-pack') . '</a>';
3435
+
3436
+
case 'not_installed':
3437
+
default:
3438
+
$plugin_slug = $this->extract_plugin_slug_from_path($plugin_path);
3439
+
$nonce = wp_create_nonce('ep_install_plugin_nonce');
3440
+
return '<a class="bdt-button bdt-welcome-button ep-install-plugin"
3441
+
data-plugin-slug="' . esc_attr($plugin_slug) . '"
3442
+
data-nonce="' . esc_attr($nonce) . '"
3443
+
href="#">' .
3444
+
__('Install', 'bdthemes-element-pack') . '</a>';
3445
+
}
3446
+
}
3447
+
3448
+
/**
3449
+
* Handle AJAX plugin installation
3450
+
*
3451
+
* @access public
3452
+
* @return void
3453
+
*/
3454
+
public function install_plugin_ajax() {
3455
+
// Check nonce
3456
+
if (!wp_verify_nonce($_POST['nonce'], 'ep_install_plugin_nonce')) {
3457
+
wp_send_json_error(['message' => __('Security check failed', 'bdthemes-element-pack')]);
3458
+
}
3459
+
3460
+
// Check user capability
3461
+
if (!current_user_can('install_plugins')) {
3462
+
wp_send_json_error(['message' => __('You do not have permission to install plugins', 'bdthemes-element-pack')]);
3463
+
}
3464
+
3465
+
$plugin_slug = sanitize_text_field($_POST['plugin_slug']);
3466
+
3467
+
if (empty($plugin_slug)) {
3468
+
wp_send_json_error(['message' => __('Plugin slug is required', 'bdthemes-element-pack')]);
3469
+
}
3470
+
3471
+
// Include necessary WordPress files
3472
+
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
3473
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
3474
+
require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php';
3475
+
3476
+
// Get plugin information
3477
+
$api = plugins_api('plugin_information', [
3478
+
'slug' => $plugin_slug,
3479
+
'fields' => [
3480
+
'sections' => false,
3481
+
],
3482
+
]);
3483
+
3484
+
if (is_wp_error($api)) {
3485
+
wp_send_json_error(['message' => __('Plugin not found: ', 'bdthemes-element-pack') . $api->get_error_message()]);
3486
+
}
3487
+
3488
+
// Install the plugin
3489
+
$skin = new \WP_Ajax_Upgrader_Skin();
3490
+
$upgrader = new \Plugin_Upgrader($skin);
3491
+
$result = $upgrader->install($api->download_link);
3492
+
3493
+
if (is_wp_error($result)) {
3494
+
wp_send_json_error(['message' => __('Installation failed: ', 'bdthemes-element-pack') . $result->get_error_message()]);
3495
+
} elseif ($skin->get_errors()->has_errors()) {
3496
+
wp_send_json_error(['message' => __('Installation failed: ', 'bdthemes-element-pack') . $skin->get_error_messages()]);
3497
+
} elseif (is_null($result)) {
3498
+
wp_send_json_error(['message' => __('Installation failed: Unable to connect to filesystem', 'bdthemes-element-pack')]);
3499
+
}
3500
+
3501
+
// Get installation status
3502
+
$install_status = install_plugin_install_status($api);
3503
+
3504
+
wp_send_json_success([
3505
+
'message' => __('Plugin installed successfully!', 'bdthemes-element-pack'),
3506
+
'plugin_file' => $install_status['file'],
3507
+
'plugin_name' => $api->name
3508
+
]);
3509
+
}
3510
+
3511
+
/**
3512
+
* Extract plugin slug from plugin path
3513
+
*
3514
+
* @param string $plugin_path Plugin file path
3515
+
* @return string Plugin slug
3516
+
*/
3517
+
private function extract_plugin_slug_from_path($plugin_path) {
3518
+
$parts = explode('/', $plugin_path);
3519
+
return isset($parts[0]) ? $parts[0] : '';
3520
+
}
3521
+
3522
+
3523
+
3524
+
3525
+
3526
+
}
3527
+
3528
+
new ElementPack_Admin_Settings();
3529
+