| 1 |
<?php |
| 2 |
// Prevent direct access |
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
$tab_slug = 'extensions'; |
| 7 |
$extensions_settings = get_option('easy_element_' . $tab_slug, []); |
| 8 |
$defaults = array_fill_keys(array_keys(easyel_get_extension_fields()), 0); |
| 9 |
$extensions_settings = wp_parse_args($extensions_settings, $defaults); |
| 10 |
|
| 11 |
$fields = easyel_get_extension_fields(); |
| 12 |
|
| 13 |
// Group fields |
| 14 |
$grouped_fields = []; |
| 15 |
foreach ($fields as $key => $data) { |
| 16 |
$group_name = $data['group'] ?? 'General Extensions'; |
| 17 |
$grouped_fields[$group_name][$key] = $data; |
| 18 |
} |
| 19 |
?> |
| 20 |
|
| 21 |
<div class=" easyel-extension-main-wrapper"> |
| 22 |
<div id="easyel-message-box"></div> |
| 23 |
<div class="form-table easyel-extension"> |
| 24 |
<h1 class="easyel-dashboard-heading"><?php esc_html_e('Extensions','easy-elements');?></h1> |
| 25 |
<?php foreach($grouped_fields as $group_name => $group_fields) : |
| 26 |
$group_slug = str_replace(' ', '-', strtolower($group_name)); |
| 27 |
$group_enabled = get_option('easy_element_group_' . $group_slug, 0); |
| 28 |
?> |
| 29 |
<div class="easyel-extension-heading-group easyel-dflex easyel-justify-between easyel-align-center"> |
| 30 |
<h2 class="easyel-extension-group-title"><?php echo esc_html( $group_name ); ?></h2> |
| 31 |
|
| 32 |
<label class="easyel-toggle-switch-extension"> |
| 33 |
<input type="checkbox" |
| 34 |
class="easyel-group-toggle" |
| 35 |
name ="easyel-toggle-switch-extension" |
| 36 |
data-group="<?php echo esc_attr($group_slug); ?>" |
| 37 |
<?php checked(1, $group_enabled); ?> /> |
| 38 |
<span class="easyel-enable-all">Enable All</span> |
| 39 |
<span class="slider"></span> |
| 40 |
</label> |
| 41 |
<input type="hidden" name="easy_element_group_<?php echo esc_attr($group_slug); ?>" |
| 42 |
class="easyel-group-hidden" |
| 43 |
value="<?php echo esc_attr($group_enabled); ?>" /> |
| 44 |
</div> |
| 45 |
|
| 46 |
<div class="easyel-extension-wrapper" data-group="<?php echo esc_attr($group_slug); ?>"> |
| 47 |
<?php foreach($group_fields as $key => $data) : |
| 48 |
|
| 49 |
$is_pro_enable = $data['is_pro']; |
| 50 |
$is_upcoming_enable = isset( $data['upcoming'] ) ? $data['upcoming'] : ''; |
| 51 |
$is_settings_enable = isset( $data['setting'] ) ? $data['setting'] : ''; |
| 52 |
$is_pro = $is_pro_enable && ! class_exists('Easy_Elements_Pro'); |
| 53 |
$pro_class = $is_pro ? ' easyel-pro-enable' : ''; |
| 54 |
$pro_widget = $is_pro_enable ? ' easyel-pro-widget' : ''; |
| 55 |
?> |
| 56 |
<div class="easyel-extension-item easyel-widget-card easyel-dflex easyel-justify-between easyel-align-center <?php echo esc_attr( $pro_class . $pro_widget ); ?>" style="padding-right:20px;"> |
| 57 |
<div class="easyel-widget-card-content easyel-dflex easyel-align-center"> |
| 58 |
<div class="easyel-widget-icon"> |
| 59 |
|
| 60 |
<?php |
| 61 |
if( $is_upcoming_enable ) { ?> |
| 62 |
<div class="easyel-pro-badge"> |
| 63 |
<i class="easyelIcon-crown"></i> |
| 64 |
<?php esc_html_e( 'Upcoming', 'easy-elements' )?> |
| 65 |
</div> |
| 66 |
|
| 67 |
<?php } elseif( $is_pro_enable ) { ?> |
| 68 |
<div class="easyel-pro-badge"> |
| 69 |
<i class="easyelIcon-crown"></i> |
| 70 |
<?php esc_html_e( 'Pro', 'easy-elements' )?> |
| 71 |
</div> |
| 72 |
<?php } ?> |
| 73 |
|
| 74 |
<img src="<?php echo esc_url( $data['icon'] ); ?>" alt=""> |
| 75 |
</div> |
| 76 |
<div class="easyel-widget-text"> |
| 77 |
<div class="widget-header"> |
| 78 |
<strong><?php echo esc_html($data['label']); ?></strong> |
| 79 |
</div> |
| 80 |
<div class="easyel-demo-link easyel-dflex easyel-align-center"> |
| 81 |
<a href="<?php echo esc_url($data['demo_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 82 |
<i class="easyelIcon-monitor"></i> |
| 83 |
<?php esc_html_e('Demo', 'easy-elements'); ?> |
| 84 |
</a> |
| 85 |
<a href="<?php echo esc_url($data['demo_url']); ?>" target="_blank" rel="noopener noreferrer"> |
| 86 |
<i class="easyelIcon-document"></i> |
| 87 |
<?php esc_html_e('Doc', 'easy-elements'); ?> |
| 88 |
</a> |
| 89 |
<?php |
| 90 |
if( $is_settings_enable && $key == 'enable_smooth_scroller' ) { |
| 91 |
?> |
| 92 |
<span class="easyel-scroll-smoother-popup-setting dashicons dashicons-admin-generic"></span> |
| 93 |
<?php } ?> |
| 94 |
<?php |
| 95 |
if( $is_settings_enable && $key == 'enable_reading_progress_bar' ) { |
| 96 |
?> |
| 97 |
<span class="easyel-readingprogress-bar-popup-setting dashicons dashicons-admin-generic"></span> |
| 98 |
<?php } ?> |
| 99 |
|
| 100 |
</div> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
<div class="widget-toggle easyel-widget-card-switcher"> |
| 104 |
<label class="easy-toggle-switch"> |
| 105 |
<?php |
| 106 |
if ( ! empty( $data['is_pro'] ) && ! class_exists('Easy_Elements_Pro') ) { ?> |
| 107 |
<input type="checkbox" |
| 108 |
class="easyel-extension-toggle" |
| 109 |
data-key="<?php echo esc_attr($key); ?>" |
| 110 |
data-tab="<?php echo esc_attr($tab_slug); ?>" |
| 111 |
value="1" |
| 112 |
<?php disabled($is_pro, true); ?> /> |
| 113 |
<?php } else { |
| 114 |
?> |
| 115 |
<input type="checkbox" |
| 116 |
class="easyel-extension-toggle" |
| 117 |
data-key="<?php echo esc_attr($key); ?>" |
| 118 |
data-tab="<?php echo esc_attr($tab_slug); ?>" |
| 119 |
value="1" |
| 120 |
<?php checked(1, $extensions_settings[$key]); ?> |
| 121 |
<?php disabled($is_pro, true); ?> /> |
| 122 |
<?php } ?> |
| 123 |
<span class="slider round"></span> |
| 124 |
</label> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
<?php endforeach; ?> |
| 128 |
</div> |
| 129 |
<?php endforeach; ?> |
| 130 |
</div> |
| 131 |
</div> |
| 132 |
<?php |
| 133 |
do_action('easyel_smooth_scroller_popup'); |
| 134 |
do_action('easyel_reading_progress_bar_popup'); |
| 135 |
?> |