about-us
1 day ago
partials
1 day ago
passkeys
1 day ago
policies
1 day ago
reports
1 day ago
support
1 day ago
customize-code-page.php
1 day ago
customize-setup-wizard.php
1 day ago
customize-user-profile.php
1 day ago
customize-user-prompts.php
1 day ago
email-settings.php
1 day ago
general-settings.php
1 day ago
generic-settings.php
1 day ago
import-export.php
1 day ago
index.php
1 day ago
plugins-integrations.php
1 day ago
providers-integrations.php
1 day ago
sidebar.php
1 day ago
white-labeling.php
1 day ago
general-settings.php
180 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Settings Template |
| 4 | * |
| 5 | * @package wp-2fa |
| 6 | */ |
| 7 | |
| 8 | use WP2FA\Admin\Settings_Builder; |
| 9 | use WP2FA\Admin\Settings_Page; |
| 10 | use WP2FA\Admin\SettingsPages\Settings_Page_New; |
| 11 | use WP2FA\Licensing\Licensing_Factory; |
| 12 | |
| 13 | ?> |
| 14 | <div class="general-settings-main-wrapper"> |
| 15 | <?php |
| 16 | |
| 17 | Settings_Builder::build_option( |
| 18 | array( |
| 19 | 'title' => \esc_html__( 'Settings', 'wp-2fa' ), |
| 20 | 'id' => 'general-settings-tab', |
| 21 | 'type' => 'tab-title', |
| 22 | ) |
| 23 | ); |
| 24 | |
| 25 | Settings_Builder::build_option( |
| 26 | array( |
| 27 | 'text' => \wp_sprintf( |
| 28 | // translators: 1. Link to documentation, 2. Link to support. |
| 29 | \esc_html__( 'Use the settings below to configure several 2FA settings on your website. If you have any questions, %1$s or %2$s.', 'wp-2fa' ), |
| 30 | \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/kb/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=settings_page_doc', \esc_html__( 'visit documentation', 'wp-2fa' ) ), |
| 31 | \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=general_settings_support', \esc_html__( 'contact support', 'wp-2fa' ) ) |
| 32 | ), |
| 33 | 'id' => 'general-settings-tab', |
| 34 | 'type' => 'description', |
| 35 | ) |
| 36 | ); |
| 37 | ?> |
| 38 | |
| 39 | <div class="settings-card"> |
| 40 | <div class="settings-group"> |
| 41 | <div class="group-title" style="display:none"> |
| 42 | <?php |
| 43 | Settings_Builder::build_option( |
| 44 | array( |
| 45 | 'text' => \esc_html__( 'General Settings', 'wp-2fa' ), |
| 46 | 'id' => 'general-settings-group-title', |
| 47 | 'type' => 'simple-text', |
| 48 | ) |
| 49 | ); |
| 50 | ?> |
| 51 | </div> |
| 52 | <?php |
| 53 | $general_settings = \apply_filters( WP_2FA_PREFIX . 'general_settings_group', Settings_Page_New::register_general_settings( array() ) ); |
| 54 | |
| 55 | Settings_Builder::build_option( |
| 56 | array( |
| 57 | 'values' => $general_settings, |
| 58 | 'id' => 'general-settings-wrap-list', |
| 59 | 'type' => 'list', |
| 60 | 'class' => 'settings-list', |
| 61 | ) |
| 62 | ); |
| 63 | ?> |
| 64 | </div> |
| 65 | |
| 66 | <?php if ( ! Settings_Page::is_new_interface_enabled() ) : ?> |
| 67 | <div class="settings-group"> |
| 68 | <div class="group-title"> |
| 69 | <?php |
| 70 | Settings_Builder::build_option( |
| 71 | array( |
| 72 | 'text' => \esc_html__( 'White Labelling', 'wp-2fa' ), |
| 73 | 'id' => 'white-labelling-group-title', |
| 74 | 'type' => 'simple-text', |
| 75 | ) |
| 76 | ); |
| 77 | ?> |
| 78 | </div> |
| 79 | <?php |
| 80 | $white_labelling_settings = \apply_filters( WP_2FA_PREFIX . 'white_labelling_settings_group', Settings_Page_New::register_white_labelling_settings( array() ) ); |
| 81 | |
| 82 | Settings_Builder::build_option( |
| 83 | array( |
| 84 | 'values' => $white_labelling_settings, |
| 85 | 'id' => 'white-labelling-wrap-list', |
| 86 | 'type' => 'list', |
| 87 | 'class' => 'settings-list', |
| 88 | ) |
| 89 | ); |
| 90 | ?> |
| 91 | </div> |
| 92 | <?php endif; ?> |
| 93 | </div> |
| 94 | |
| 95 | <?php if ( ! Licensing_Factory::has_active_valid_license() ) : |
| 96 | $panel_items = array( |
| 97 | array( |
| 98 | 'title' => \esc_html__( '2FA provider integrations', 'wp-2fa' ), |
| 99 | 'context' => 'provider-integrations', |
| 100 | ), |
| 101 | array( |
| 102 | 'title' => \esc_html__( 'Plugin integrations', 'wp-2fa' ), |
| 103 | 'context' => 'plugin-integrations', |
| 104 | ), |
| 105 | array( |
| 106 | 'title' => \esc_html__( 'Export / import', 'wp-2fa' ), |
| 107 | 'context' => 'export-import', |
| 108 | ), |
| 109 | ); |
| 110 | |
| 111 | $panel_banner_title = \esc_html__( 'Unlock all settings in Premium', 'wp-2fa' ); |
| 112 | $panel_banner_desc = \esc_html__( 'Enjoy unlimited flexibility and control with advanced settings', 'wp-2fa' ); |
| 113 | $panel_banner_cta = \esc_html__( 'Upgrade to Premium', 'wp-2fa' ); |
| 114 | $panel_banner_url = 'https://melapress.com/wordpress-2fa/pricing/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=free-settings-page'; |
| 115 | $panel_visible_count = 3; |
| 116 | $panel_id = 'wp2fa-locked-panel-settings-new'; |
| 117 | $panel_banner_badge_context = 'settings-banner'; |
| 118 | |
| 119 | include \WP_2FA_PATH . 'includes/classes/Admin/Settings/templates/partials/premium-locked-panel.php'; |
| 120 | endif; ?> |
| 121 | </div> |
| 122 | <script> |
| 123 | // handle navigation when clicking a settings list item |
| 124 | // extract span id and show corresponding '-wrap' section |
| 125 | |
| 126 | document.addEventListener('DOMContentLoaded', function() { |
| 127 | var container = document.querySelector('.general-settings-main-wrapper'); |
| 128 | if (!container) { |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | var items = container.querySelectorAll('.settings-group li'); |
| 133 | items.forEach(function(li) { |
| 134 | li.addEventListener('click', function() { |
| 135 | var span = li.querySelector('span'); |
| 136 | if (!span || !span.id) { |
| 137 | return; |
| 138 | } |
| 139 | var targetId = span.id + '-wrap'; |
| 140 | var target = document.getElementById(targetId); |
| 141 | if (target) { |
| 142 | |
| 143 | target.style.display = 'block'; |
| 144 | |
| 145 | var backButtons = target.querySelectorAll('.back-click'); |
| 146 | if ( backButtons ) { |
| 147 | backButtons.forEach( function(backButton) { |
| 148 | backButton.addEventListener('click', function(e) { |
| 149 | e.preventDefault(); |
| 150 | container.style.display = 'block'; |
| 151 | var items = container.querySelectorAll('.settings-group li'); |
| 152 | items.forEach(function(li) { |
| 153 | var span = li.querySelector('span'); |
| 154 | if (span && span.id) { |
| 155 | var wrapId = span.id + '-wrap'; |
| 156 | var wrap = document.getElementById(wrapId); |
| 157 | if (wrap) { |
| 158 | wrap.style.display = 'none'; |
| 159 | } |
| 160 | } |
| 161 | }); |
| 162 | }); |
| 163 | } ); |
| 164 | } |
| 165 | } |
| 166 | container.style.display = 'none'; |
| 167 | }); |
| 168 | }); |
| 169 | |
| 170 | |
| 171 | }); |
| 172 | |
| 173 | function toggleProvider(element) { |
| 174 | const item = element.closest('.provider-item'); |
| 175 | item.classList.toggle('open'); |
| 176 | } |
| 177 | |
| 178 | </script> |
| 179 | |
| 180 |