| @@ -1,7 +1,11 @@ | ||
| 1 | -<?php | |
| 2 | -$dir_file = realpath(dirname(__FILE__) . '/../class/easy-basic-authentication-class.php'); | |
| 3 | -$content_file = "add_action( 'init', array(\$this,'basic_auth_admin') );"; | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | + | |
| 6 | +$basic_auth_dir_file = realpath(dirname(__FILE__) . '/../class/easy-basic-authentication-class.php'); | |
| 7 | +$basic_auth_content_file = "add_action( 'init', array(\$this,'basic_auth_admin') );"; | |
| 4 | 8 | ?> |
| 5 | 9 | |
| 6 | 10 | <div class="wrap easy-basic-settings"> |
| 7 | 11 | <div class="error-message"> |
| @@ -6,36 +10,57 @@ | ||
| 6 | 10 | <div class="wrap easy-basic-settings"> |
| 7 | 11 | <div class="error-message"> |
| 8 | 12 | <?php settings_errors(); ?> |
| 9 | 13 | </div> |
| 14 | + | |
| 15 | + <?php if ( ! is_ssl() ) : ?> | |
| 16 | + <div class="notice notice-warning"> | |
| 17 | + <p> | |
| 18 | + <strong><?php esc_html_e('Warning:', 'easy-basic-authentication'); ?></strong> | |
| 19 | + <?php esc_html_e('Your site is currently not using HTTPS. Basic Authentication may not work correctly over HTTP due to browser and server restrictions.', 'easy-basic-authentication'); ?> | |
| 20 | + </p> | |
| 21 | + </div> | |
| 22 | + <?php endif; ?> | |
| 23 | + | |
| 10 | 24 | <form method="post" action="options.php" class="easy-basic-form"> |
| 11 | 25 | <?php |
| 26 | + easy_basic_authentication_compatcheck_class::render_button_html(); | |
| 27 | + | |
| 12 | 28 | settings_fields( 'basic-auth-plugin-settings' ); |
| 13 | 29 | do_settings_sections( 'basic-auth-plugin-settings' ); |
| 14 | - submit_button(__('save', 'easy-basic-authentication'), 'primary', 'eba_submit', false); | |
| 30 | + submit_button(__('Save Settings', 'easy-basic-authentication'), 'primary', 'eba_submit', false); | |
| 15 | 31 | ?> |
| 16 | 32 | </form> |
| 33 | + | |
| 17 | 34 | <div id="password-recovery-alert" class="container"> |
| 18 | 35 | <div class="alert alert-warning alert-dismissible fade show" role="alert"> |
| 19 | - <strong><?php echo esc_html__('Attention:', 'easy-basic-authentication'); ?></strong> <?php echo esc_html__('To recover your password, you need to comment out a line in a file via FTP.', 'easy-basic-authentication'); ?> | |
| 20 | - <?php echo esc_html__('Please follow the instructions', 'easy-basic-authentication'); ?> <a href="#" class="alert-link" onclick="toggleInstructions()"><?php echo esc_html__('here.', 'easy-basic-authentication');?></a> | |
| 36 | + <strong><?php echo esc_html__('Attention:', 'easy-basic-authentication'); ?></strong> | |
| 37 | + <?php echo esc_html__('To recover your password, you need to comment out a line in a file via FTP.', 'easy-basic-authentication'); ?> | |
| 38 | + <?php echo esc_html__('Please follow the instructions', 'easy-basic-authentication'); ?> | |
| 39 | + <a href="#" class="alert-link" onclick="toggleInstructions()"><?php echo esc_html__('here.', 'easy-basic-authentication');?></a> | |
| 21 | 40 | </div> |
| 22 | 41 | |
| 23 | 42 | <div id="instructions" style="display: none;" class="mt-3"> |
| 24 | 43 | <p><strong><?php echo esc_html__('Instructions:', 'easy-basic-authentication'); ?></strong></p> |
| 25 | 44 | <ol> |
| 26 | - <li><?php echo esc_html__('Connect to your website via FTP.', 'easy-basic-authentication'); ?></li> | |
| 27 | - <li><?php echo esc_html__('Navigate to the plugin directory.', 'easy-basic-authentication'); ?></li> | |
| 28 | - <li><?php | |
| 29 | - // translators: %s è il percorso del file del plugin | |
| 30 | - echo sprintf(esc_html__('Locate the file named %s.', 'easy-basic-authentication'), esc_attr($dir_file)); ?> | |
| 31 | - </li> | |
| 32 | - <li><?php | |
| 33 | - // translators: %s is the content file path | |
| 34 | - echo sprintf(esc_html__('Find the line containing %s.', 'easy-basic-authentication'), esc_attr($content_file)); ?> | |
| 35 | - </li> | |
| 36 | - <li><?php echo esc_html__('Comment out that line by adding "#" at the beginning.', 'easy-basic-authentication'); ?></li> | |
| 37 | - <li><?php echo esc_html__('Save the file and re-upload it to your server.', 'easy-basic-authentication'); ?></li> | |
| 45 | + <li><?php echo esc_html__('Connect to your website via FTP.', 'easy-basic-authentication'); ?></li> | |
| 46 | + <li><?php echo esc_html__('Navigate to the plugin directory.', 'easy-basic-authentication'); ?></li> | |
| 47 | + <li><?php | |
| 48 | + echo sprintf( | |
| 49 | + /* translators: %s: full path of the plugin file to edit. */ | |
| 50 | + esc_html__('Locate the file named %s.', 'easy-basic-authentication'), | |
| 51 | + esc_attr($basic_auth_dir_file) | |
| 52 | + ); ?> | |
| 53 | + </li> | |
| 54 | + <li><?php | |
| 55 | + echo sprintf( | |
| 56 | + /* translators: %s: line of PHP code to comment out. */ | |
| 57 | + esc_html__('Find the line containing %s.', 'easy-basic-authentication'), | |
| 58 | + esc_attr($basic_auth_content_file) | |
| 59 | + ); ?> | |
| 60 | + </li> | |
| 61 | + <li><?php echo esc_html__('Comment out that line by adding "#" at the beginning.', 'easy-basic-authentication'); ?></li> | |
| 62 | + <li><?php echo esc_html__('Save the file and re-upload it to your server.', 'easy-basic-authentication'); ?></li> | |
| 38 | 63 | </ol> |
| 39 | 64 | </div> |
| 40 | 65 | </div> |
| 41 | 66 | |
| @@ -41,16 +66,11 @@ | ||
| 41 | 66 | |
| 42 | 67 | <script> |
| 43 | 68 | function toggleInstructions() { |
| 44 | 69 | var instructions = document.getElementById("instructions"); |
| 45 | - if (instructions.style.display === "none") { | |
| 46 | - instructions.style.display = "block"; | |
| 47 | - } else { | |
| 48 | - instructions.style.display = "none"; | |
| 49 | - } | |
| 70 | + instructions.style.display = (instructions.style.display === "none") ? "block" : "none"; | |
| 50 | 71 | } |
| 51 | 72 | </script> |
| 52 | - | |
| 53 | 73 | </div> |
| 54 | 74 | |
| 55 | 75 | <style> |
| 56 | 76 | .easy-basic-settings { |
| @@ -101,5 +121,5 @@ | ||
| 101 | 121 | |
| 102 | 122 | .easy-basic-settings #password-recovery-alert { |
| 103 | 123 | margin-top: 30px; |
| 104 | 124 | } |
| 105 | -</style> | |
| 125 | +</style> | |