elements.php
1 year ago
features.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
features.php
152 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; // Exit if accessed directly |
| 4 | } |
| 5 | |
| 6 | use SPEL\includes\Admin\Module_Settings; |
| 7 | |
| 8 | $features = Module_Settings::get_widget_settings(); |
| 9 | |
| 10 | // Global switcher |
| 11 | $opt = get_option( 'spel_features_settings' ); |
| 12 | $global_switcher = $opt['features_global_switcher'] ?? ''; |
| 13 | $is_checked = ! empty ( $global_switcher == 'on' ) ? ' checked' : ''; |
| 14 | $checked = ! isset ( $opt['features_global_switcher'] ) ? ' checked' : $is_checked; |
| 15 | |
| 16 | // Get the current theme |
| 17 | $theme = wp_get_theme(); |
| 18 | $theme = in_array( $theme->get( 'Name' ), [ 'jobi', 'Jobi', 'jobi-child', 'Jobi Child' ] ); |
| 19 | ?> |
| 20 | <div id="features" class="tab-box"> |
| 21 | |
| 22 | <div class="elements_tab_menu"> |
| 23 | <div class="tab_contents"> |
| 24 | <div class="icon"> |
| 25 | <i class="icon-feature_two"></i> |
| 26 | </div> |
| 27 | <div class="content"> |
| 28 | <h3><?php esc_html_e( 'Features', 'spider-elements' ); ?></h3> |
| 29 | </div> |
| 30 | </div> |
| 31 | |
| 32 | <div class="menu_right_content"> |
| 33 | <div class="plugin_active_switcher"> |
| 34 | <label class="toggler" id="features_disabled"><?php esc_html_e( 'Disable All', 'spider-elements' ); ?></label> |
| 35 | <div class="toggle"> |
| 36 | <input type="checkbox" data-id="widget-list" id="features_switcher" name="features_global_switcher" class="check features_global_switcher"> |
| 37 | <label class="b switch" for="features_switcher"></label> |
| 38 | </div> |
| 39 | <label class="toggler" id="features_enabled"><?php esc_html_e( 'Enabled All', 'spider-elements' ); ?></label> |
| 40 | </div> |
| 41 | <button type="submit" name="features-submit" id="features-submit" class="dashboard_btn save_btn"> |
| 42 | <?php esc_html_e( 'Save Changes', 'spider-elements' ); ?> |
| 43 | </button> |
| 44 | </div> |
| 45 | |
| 46 | </div> |
| 47 | |
| 48 | <div class="elements_tab" id="elements_filter"> |
| 49 | <div class="filter_data active" data-filter="*"> |
| 50 | <i class="icon-star"></i> |
| 51 | <?php esc_html_e( 'All', 'spider-elements' ); ?> |
| 52 | </div> |
| 53 | <div class="filter_data" data-filter=".free"> |
| 54 | <i class="icon-gift"></i> |
| 55 | <?php esc_html_e( 'Free', 'spider-elements' ); ?> |
| 56 | </div> |
| 57 | <div class="filter_data" data-filter=".pro"> |
| 58 | <i class="icon-premium"></i> |
| 59 | <?php esc_html_e( 'Pro', 'spider-elements' ); ?> |
| 60 | </div> |
| 61 | </div> |
| 62 | |
| 63 | <div class="filter_content ezd-d-flex" id="features_gallery"> |
| 64 | <?php |
| 65 | if ( isset( $features['spider_elements_features'] ) && is_array( $features['spider_elements_features'] ) ) { |
| 66 | foreach ( $features['spider_elements_features'] as $item ) { |
| 67 | |
| 68 | $feature_type = $item['feature_type'] ?? ''; |
| 69 | $feature_name = $item['name'] ?? ''; |
| 70 | |
| 71 | // Default class and attributes for widgets |
| 72 | $is_pro_feature = $feature_type === 'pro' ? ' pro_popup' : ''; |
| 73 | $is_pro_feature_enabled = $feature_type === 'pro' ? ' disabled' : ''; |
| 74 | |
| 75 | // Unlock specific features for Jobi theme users |
| 76 | if ( in_array( $item['name'], [ 'spel_badge', 'spel_heading_highlighted' ] ) && $theme || spel_is_premium() ) { |
| 77 | $is_pro_feature = ''; // Remove pro_popup class |
| 78 | $is_pro_feature_enabled = ''; // Enable widget |
| 79 | } |
| 80 | |
| 81 | // By default, only free features are checked |
| 82 | $opt_input = $opt[ $feature_name ] ?? ''; |
| 83 | if ( $feature_type === 'pro' && ! spel_is_premium() && ! ( in_array( $item['name'], [ 'spel_badge', 'spel_heading_highlighted' ] ) && $theme ) ) { |
| 84 | // Pro feature: unchecked by default |
| 85 | $checked = ! isset( $opt[ $feature_name ] ) ? '' : ( ! empty( $opt_input == 'on' ) ? ' checked' : '' ); |
| 86 | } else { |
| 87 | // Free feature or unlocked pro: checked by default |
| 88 | $is_checked = ! empty( $opt_input == 'on' ) ? ' checked' : ''; |
| 89 | $checked = ! isset( $opt[ $feature_name ] ) ? ' checked' : $is_checked; |
| 90 | } |
| 91 | ?> |
| 92 | <div class="ezd-colum-space-4 <?php echo esc_attr( $item['feature_type'] ) ?>"> |
| 93 | <div class="element_box element_switch badge"> |
| 94 | <div class="element_content"> |
| 95 | <?php |
| 96 | if ( ! empty( $item['icon'] ) ) { ?> |
| 97 | <i class="<?php echo esc_attr( $item['icon'] ) ?>"></i> |
| 98 | <?php |
| 99 | } |
| 100 | if ( ! empty( $item['label'] ) ) { ?> |
| 101 | <label for="elementor-video"><?php echo esc_html( $item['label'] ) ?></label> |
| 102 | <?php |
| 103 | } |
| 104 | ?> |
| 105 | </div> |
| 106 | <div class="element_right"> |
| 107 | <?php |
| 108 | if ( ! empty( $item['label'] ) ) { |
| 109 | ?> |
| 110 | <div class="link"> |
| 111 | |
| 112 | <?php |
| 113 | if ( ! empty( $item['demo_url'] ) ) { |
| 114 | ?> |
| 115 | <a href="<?php echo esc_url( $item['demo_url'] ) ?>" class="tooltip-top" |
| 116 | data-tooltip="<?php echo sprintf( esc_attr__( 'View %s Feature Demo', 'spider-elements' ), $item['label'] ) ?>" |
| 117 | target="_blank"> |
| 118 | <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-demo.svg' ) ?>" |
| 119 | alt="<?php esc_attr_e( 'Widget Demo', 'spider-elements' ); ?>"> |
| 120 | </a> |
| 121 | <?php |
| 122 | } |
| 123 | if ( ! empty( $item['demo_url'] ) ) { |
| 124 | ?> |
| 125 | <a href="<?php echo esc_url( $item['video_url'] ) ?>" class="tooltip-top" |
| 126 | data-tooltip="<?php echo sprintf( esc_attr__( 'View %s Video Tutorial', 'spider-elements' ), $item['label'] ) ?>" |
| 127 | target="_blank"> |
| 128 | <img src="<?php echo esc_url( SPEL_IMG . '/dashboard/icon-video.svg' ) ?>" |
| 129 | alt="<?php esc_attr_e( 'Video Tutorial', 'spider-elements' ); ?>"> |
| 130 | </a> |
| 131 | <?php |
| 132 | } |
| 133 | |
| 134 | ?> |
| 135 | </div> |
| 136 | <?php |
| 137 | } |
| 138 | ?> |
| 139 | <label for="<?php echo esc_attr( $item['name'] ) ?>" class="switch_label<?php echo esc_attr( $is_pro_feature ) ?>"> |
| 140 | <input type="checkbox" class="widget_checkbox widget-list" name="<?php echo esc_attr( $item['name'] ) ?>" |
| 141 | id="<?php echo esc_attr( $item['name'] ) ?>" <?php echo esc_attr( $checked . $is_pro_feature_enabled ); ?>> |
| 142 | <span class="widget_switcher"></span> |
| 143 | </label> |
| 144 | </div> |
| 145 | </div> |
| 146 | </div> |
| 147 | <?php |
| 148 | } |
| 149 | } |
| 150 | ?> |
| 151 | </div> |
| 152 | </div> |