api-settings.php
1 year ago
elements.php
1 year ago
features.php
1 year ago
go-premium.php
1 year ago
integration.php
1 year ago
popup-pro.php
1 year ago
sidebar.php
1 year ago
welcome.php
1 year ago
elements.php
139 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; // Exit if accessed directly |
| 4 | } |
| 5 | |
| 6 | use SPEL\includes\Admin\Module_Settings; |
| 7 | |
| 8 | $elements = Module_Settings::get_widget_settings(); |
| 9 | |
| 10 | // Global switcher |
| 11 | $element_opt = get_option( 'spe_widget_settings' ); |
| 12 | $global_switcher = $element_opt['element_global_switcher'] ?? ''; |
| 13 | $is_checked = ! empty ( $global_switcher == 'on' ) ? ' checked' : ''; |
| 14 | $checked = ! isset ( $element_opt['element_global_switcher'] ) ? ' checked' : $is_checked; |
| 15 | ?> |
| 16 | <div id="elements" class="tab-box"> |
| 17 | <div class="elements_tab_menu"> |
| 18 | <div class="tab_contents"> |
| 19 | <div class="icon"> |
| 20 | <i class="icon-element"></i> |
| 21 | </div> |
| 22 | <div class="content"> |
| 23 | <h3><?php esc_html_e( 'Elements', 'spider-elements' ); ?></h3> |
| 24 | </div> |
| 25 | </div> |
| 26 | <div class="menu_right_content"> |
| 27 | <div class="plugin_active_switcher"> |
| 28 | <label class="toggler" id="element_disabled"><?php esc_html_e( 'Disable All', 'spider-elements' ); ?></label> |
| 29 | <div class="toggle"> |
| 30 | <input type="checkbox" data-id="widget-list" id="element_switcher" name="element_global_switcher" class="check element_global_switcher"> |
| 31 | <label class="b switch" for="element_switcher"></label> |
| 32 | </div> |
| 33 | <label class="toggler" id="element_enabled"><?php esc_html_e( 'Enabled All', 'spider-elements' ); ?></label> |
| 34 | </div> |
| 35 | <button type="submit" name="elements-submit" id="elements-submit" class="dashboard_btn save_btn"> |
| 36 | <?php esc_html_e( 'Save Changes', 'spider-elements' ); ?> |
| 37 | </button> |
| 38 | </div> |
| 39 | </div> |
| 40 | |
| 41 | <div class="elements_tab" id="elements_filter"> |
| 42 | <div class="filter_data active" data-filter="*"> |
| 43 | <i class="icon-star"></i><?php esc_html_e( 'All', 'spider-elements' ); ?> |
| 44 | </div> |
| 45 | <div class="filter_data" data-filter=".free"> |
| 46 | <i class="icon-gift"></i><?php esc_html_e( 'Free', 'spider-elements' ); ?> |
| 47 | </div> |
| 48 | <div class="filter_data" data-filter=".pro"> |
| 49 | <i class="icon-premium"></i><?php esc_html_e( 'Pro', 'spider-elements' ); ?> |
| 50 | </div> |
| 51 | </div> |
| 52 | |
| 53 | <div class="filter_content ezd-d-flex" id="elements_gallery"> |
| 54 | <?php |
| 55 | if ( is_array( $elements['spider_elements_widgets'] ) ) { |
| 56 | foreach ( $elements['spider_elements_widgets'] as $item ) { |
| 57 | $widget_type = $item['widget_type'] ?? ''; |
| 58 | |
| 59 | // Default class and attributes for widgets |
| 60 | $is_pro_widget = $widget_type === 'pro' ? ' pro_popup' : ''; |
| 61 | $is_pro_widget_enabled = $widget_type === 'pro' ? ' disabled' : ''; |
| 62 | |
| 63 | // If premium, enable pro widgets |
| 64 | if ( spel_is_premium() ) { |
| 65 | $is_pro_widget = ''; // Remove pro_popup class |
| 66 | $is_pro_widget_enabled = ''; // Enable widget |
| 67 | } |
| 68 | |
| 69 | $opt = get_option( 'spe_widget_settings' ); |
| 70 | $opt_name = $item['name'] ?? ''; |
| 71 | |
| 72 | // By default, all the switcher is checked |
| 73 | $opt_input = $opt[ $opt_name ] ?? ''; |
| 74 | $is_checked = ! empty ( $opt_input == 'on' ) ? ' checked' : ''; |
| 75 | $checked = ! isset ( $opt[ $opt_name ] ) ? ' checked' : $is_checked; |
| 76 | ?> |
| 77 | <div class="ezd-colum-space-4 <?php echo esc_attr( $item['widget_type'] ) ?>"> |
| 78 | <div class="element_box element_switch badge"> |
| 79 | <div class="element_content"> |
| 80 | <?php |
| 81 | if ( ! empty( $item['icon'] ) ) { ?> |
| 82 | <i class="<?php echo esc_attr( $item['icon'] ) ?>"></i> |
| 83 | <?php |
| 84 | } |
| 85 | if ( ! empty( $item['label'] ) ) { ?> |
| 86 | <label for="<?php echo esc_attr( $item['name'] ) ?>"><?php echo esc_html( $item['label'] ) ?></label> |
| 87 | <?php |
| 88 | } |
| 89 | ?> |
| 90 | </div> |
| 91 | <div class="element_right"> |
| 92 | <?php |
| 93 | if ( ! empty( $item['label'] ) ) { |
| 94 | ?> |
| 95 | <div class="link"> |
| 96 | <?php |
| 97 | if ( ! empty( $item['demo_url'] ) ) { |
| 98 | ?> |
| 99 | <a href="<?php echo esc_url( $item['demo_url'] ) ?>" class="tooltip-top" |
| 100 | data-tooltip="<?php echo sprintf( esc_attr__( 'View %s Widget Demo', 'spider-elements' ), $item['label'] ) ?>" |
| 101 | target="_blank"> |
| 102 | <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-demo.svg' ) ?>" |
| 103 | alt="<?php esc_attr_e( 'Widget Demo', 'spider-elements' ); ?>"> |
| 104 | </a> |
| 105 | <?php |
| 106 | } |
| 107 | if ( ! empty( $item['video_url'] ) ) { |
| 108 | ?> |
| 109 | <a href="<?php echo esc_url( $item['video_url'] ) ?>" class="tooltip-top" data-tooltip="<?php echo sprintf( esc_attr__( 'View %s Video Tutorial', 'spider-elements' ), $item['label'] ) ?>" target="_blank"> |
| 110 | <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-video.svg' ) ?>" alt="<?php esc_attr_e( 'Video Tutorial', 'spider-elements' ); ?>"> |
| 111 | </a> |
| 112 | <?php |
| 113 | } |
| 114 | if ( ! empty( $item['docs_url'] ) ) { |
| 115 | ?> |
| 116 | <a href="<?php echo esc_url( $item['docs_url'] ) ?>" class="tooltip-top" data-tooltip="<?php echo sprintf( esc_attr__( 'View %s Documentation', 'spider-elements' ), $item['label'] ) ?>" target="_blank"> |
| 117 | <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-document.svg' ) ?>" alt="<?php esc_attr_e( 'Documentation', 'spider-elements' ); ?>"> |
| 118 | </a> |
| 119 | <?php |
| 120 | } |
| 121 | ?> |
| 122 | </div> |
| 123 | <?php |
| 124 | } |
| 125 | ?> |
| 126 | <label for="<?php echo esc_attr( $item['name'] ) ?>" class="switch_label<?php echo esc_attr( $is_pro_widget ) ?>"> |
| 127 | <input type="checkbox" class="widget_checkbox widget-list" name="<?php echo esc_attr( $item['name'] ) ?>" id="<?php echo esc_attr( $item['name'] ) ?>" <?php echo esc_attr( $checked . $is_pro_widget_enabled ); ?>> |
| 128 | <span class="widget_switcher"></span> |
| 129 | </label> |
| 130 | </div> |
| 131 | </div> |
| 132 | </div> |
| 133 | <?php |
| 134 | } |
| 135 | } |
| 136 | ?> |
| 137 | |
| 138 | </div> |
| 139 | </div> |