about-us
5 days ago
partials
5 days ago
passkeys
5 days ago
policies
5 days ago
reports
5 days ago
support
5 days ago
customize-code-page.php
5 days ago
customize-setup-wizard.php
5 days ago
customize-user-profile.php
5 days ago
customize-user-prompts.php
5 days ago
email-settings.php
5 days ago
general-settings.php
5 days ago
generic-settings.php
5 days ago
import-export.php
5 days ago
index.php
5 days ago
plugins-integrations.php
5 days ago
providers-integrations.php
5 days ago
sidebar.php
5 days ago
white-labeling.php
5 days ago
white-labeling.php
137 lines
| 1 | <?php |
| 2 | /** |
| 3 | * White labeling landing template. |
| 4 | * |
| 5 | * Lists the sub-sections available under White labeling: |
| 6 | * - Emails & SMS Templates |
| 7 | * - Customize 2FA code page |
| 8 | * - Customize 2FA setup wizard |
| 9 | * |
| 10 | * @package wp-2fa |
| 11 | * |
| 12 | * @since 4.0.0 |
| 13 | */ |
| 14 | |
| 15 | use WP2FA\Admin\Settings_Builder; |
| 16 | use WP2FA\Admin\SettingsPages\Settings_Page_White_Labeling_New; |
| 17 | use WP2FA\Licensing\Licensing_Factory; |
| 18 | |
| 19 | ?> |
| 20 | <div class="general-settings-main-wrapper"> |
| 21 | <?php |
| 22 | |
| 23 | Settings_Builder::build_option( |
| 24 | array( |
| 25 | 'title' => \esc_html__( 'White labeling', 'wp-2fa' ), |
| 26 | 'id' => 'white-labeling-tab', |
| 27 | 'type' => 'tab-title', |
| 28 | ) |
| 29 | ); |
| 30 | |
| 31 | Settings_Builder::build_option( |
| 32 | array( |
| 33 | 'text' => \wp_sprintf( |
| 34 | // translators: 1. Link to documentation, 2. Link to support. |
| 35 | \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' ), |
| 36 | \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=white_labeling_doc', \esc_html__( 'visit documentation', 'wp-2fa' ) ), |
| 37 | \wp_sprintf( '<a href="%s" target="_blank">%s</a>', 'https://melapress.com/support/?utm_source=plugin&utm_medium=wp2fa&utm_campaign=white_labeling_support', \esc_html__( 'contact support', 'wp-2fa' ) ) |
| 38 | ), |
| 39 | 'id' => 'white-labeling-tab', |
| 40 | 'type' => 'description', |
| 41 | ) |
| 42 | ); |
| 43 | ?> |
| 44 | |
| 45 | <div class="settings-card"> |
| 46 | <div class="settings-group"> |
| 47 | <?php |
| 48 | $white_labeling_tabs = Settings_Page_White_Labeling_New::collect_tabs(); |
| 49 | |
| 50 | Settings_Builder::build_option( |
| 51 | array( |
| 52 | 'values' => $white_labeling_tabs, |
| 53 | 'id' => 'white-labeling-wrap-list', |
| 54 | 'type' => 'list', |
| 55 | 'class' => 'settings-list', |
| 56 | ) |
| 57 | ); |
| 58 | |
| 59 | $is_enterprise = Licensing_Factory::has_active_valid_license() && ( Licensing_Factory::provider_call( 'is_plan_or_trial__premium_only', 'business', true ) || Licensing_Factory::provider_call( 'is_plan_or_trial__premium_only', 'ent', true ) || Licensing_Factory::provider_call( 'is_plan_or_trial__premium_only', 'enterprise', true ) ); |
| 60 | if ( ! $is_enterprise ) : |
| 61 | $enterprise_badge = Settings_Builder::get_enterprise_badge_html(); |
| 62 | $locked_items = array( |
| 63 | \esc_html__( 'Customize 2FA setup wizard', 'wp-2fa' ) => 'wl-setup-wizard', |
| 64 | \esc_html__( 'Customize 2FA user prompts and notifications', 'wp-2fa' ) => 'wl-prompts', |
| 65 | \esc_html__( 'Customize 2FA user profile page area', 'wp-2fa' ) => 'wl-profile', |
| 66 | ); |
| 67 | ?> |
| 68 | <ul class="wp-2fa-list-options settings-list wp2fa-premium-settings-list"> |
| 69 | <?php foreach ( $locked_items as $item_title => $item_context ) : ?> |
| 70 | <li class="wp2fa-premium-settings-item"> |
| 71 | <?php echo '' !== $item_context ? Settings_Builder::get_enterprise_badge_html( $item_context ) : $enterprise_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 72 | <span class="option-value"><?php echo \esc_html( $item_title ); ?></span> |
| 73 | </li> |
| 74 | <?php endforeach; ?> |
| 75 | </ul> |
| 76 | <?php endif; ?> |
| 77 | </div> |
| 78 | </div> |
| 79 | </div> |
| 80 | <script> |
| 81 | // handle navigation when clicking a settings list item |
| 82 | // extract span id and show corresponding '-wrap' section |
| 83 | |
| 84 | document.addEventListener('DOMContentLoaded', function() { |
| 85 | var container = document.querySelector('.general-settings-main-wrapper'); |
| 86 | if (!container) { |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | var items = container.querySelectorAll('.settings-group li'); |
| 91 | items.forEach(function(li) { |
| 92 | li.addEventListener('click', function() { |
| 93 | var span = li.querySelector('span'); |
| 94 | if (!span || !span.id) { |
| 95 | return; |
| 96 | } |
| 97 | var targetId = span.id + '-wrap'; |
| 98 | var target = document.getElementById(targetId); |
| 99 | if (target) { |
| 100 | |
| 101 | target.style.display = 'block'; |
| 102 | |
| 103 | var backButtons = target.querySelectorAll('.back-click'); |
| 104 | if ( backButtons ) { |
| 105 | backButtons.forEach( function(backButton) { |
| 106 | backButton.addEventListener('click', function(e) { |
| 107 | e.preventDefault(); |
| 108 | container.style.display = 'block'; |
| 109 | var items = container.querySelectorAll('.settings-group li'); |
| 110 | items.forEach(function(li) { |
| 111 | var span = li.querySelector('span'); |
| 112 | if (span && span.id) { |
| 113 | var wrapId = span.id + '-wrap'; |
| 114 | var wrap = document.getElementById(wrapId); |
| 115 | if (wrap) { |
| 116 | wrap.style.display = 'none'; |
| 117 | } |
| 118 | } |
| 119 | }); |
| 120 | }); |
| 121 | } ); |
| 122 | } |
| 123 | } |
| 124 | container.style.display = 'none'; |
| 125 | }); |
| 126 | }); |
| 127 | |
| 128 | |
| 129 | }); |
| 130 | |
| 131 | function toggleProvider(element) { |
| 132 | const item = element.closest('.provider-item'); |
| 133 | item.classList.toggle('open'); |
| 134 | } |
| 135 | |
| 136 | </script> |
| 137 |