| @@ -1,54 +1,54 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class easy_basic_authentication_form_class { |
| 4 | 4 | |
| 5 | - const FORM_FIELD = array( | |
| 6 | - '0' => array( | |
| 7 | - 'id' => 'basic-auth-plugin-admin-enable', | |
| 8 | - 'title' => 'Enable for wp-admin', | |
| 9 | - 'callback' => 'basic_auth_plugin_admin_enable_cb', | |
| 10 | - ), | |
| 11 | - '1' => array( | |
| 12 | - 'id' => 'basic-auth-plugin-enable', | |
| 13 | - 'title' => 'Enable for the entire site (only if wp-admin is enabled)', | |
| 14 | - 'callback' => 'basic_auth_plugin_enable_cb', | |
| 15 | - ), | |
| 16 | - '2' => array( | |
| 17 | - 'id' => 'basic-auth-plugin-username', | |
| 18 | - 'title' => 'Username', | |
| 19 | - 'callback' => 'basic_auth_plugin_username_cb', | |
| 20 | - ), | |
| 21 | - '3' => array( | |
| 22 | - 'id' => 'basic-auth-plugin-password', | |
| 23 | - 'title' => 'Password', | |
| 24 | - 'callback' => 'basic_auth_plugin_password_cb', | |
| 25 | - ), | |
| 26 | - '4' => array( | |
| 27 | - 'id' => 'basic-auth-plugin-admin-log-enable', | |
| 28 | - 'title' => 'Enable access logs', | |
| 29 | - 'callback' => 'basic_auth_plugin_admin_log_enable_cb', | |
| 30 | - ), | |
| 31 | - '5' => array( | |
| 32 | - 'id' => 'basic-auth-plugin-alert-enable', | |
| 33 | - 'title' => 'Enable email alert', | |
| 34 | - 'callback' => 'basic_auth_plugin_alert_enable_cb', | |
| 35 | - ), | |
| 36 | - '6' => array( | |
| 37 | - 'id' => 'basic-auth-plugin-email-alert', | |
| 38 | - 'title' => 'Email for alert', | |
| 39 | - 'callback' => 'basic_auth_plugin_alertemail_cb', | |
| 40 | - ), | |
| 41 | - '7' => array( | |
| 42 | - 'id' => 'basic-auth-plugin-white-list', | |
| 43 | - 'title' => 'Ip White list', | |
| 44 | - 'callback' => 'basic_auth_plugin_whitelist_cb', | |
| 45 | - ) | |
| 46 | - ); | |
| 5 | + public $form_field = []; | |
| 47 | 6 | |
| 48 | 7 | public function __construct() |
| 49 | - { | |
| 50 | - | |
| 8 | + { | |
| 9 | + $this->form_field = array( | |
| 10 | + '0' => array( | |
| 11 | + 'id' => 'basic-auth-plugin-admin-enable', | |
| 12 | + 'title' => __('Enable for wp-admin', 'easy-basic-authentication'), | |
| 13 | + 'callback' => 'basic_auth_plugin_admin_enable_cb', | |
| 14 | + ), | |
| 15 | + '1' => array( | |
| 16 | + 'id' => 'basic-auth-plugin-enable', | |
| 17 | + 'title' => __('Enable for the entire site (only if wp-admin is enabled)', 'easy-basic-authentication'), | |
| 18 | + 'callback' => 'basic_auth_plugin_enable_cb', | |
| 19 | + ), | |
| 20 | + '2' => array( | |
| 21 | + 'id' => 'basic-auth-plugin-username', | |
| 22 | + 'title' => __('Username', 'easy-basic-authentication'), | |
| 23 | + 'callback' => 'basic_auth_plugin_username_cb', | |
| 24 | + ), | |
| 25 | + '3' => array( | |
| 26 | + 'id' => 'basic-auth-plugin-password', | |
| 27 | + 'title' => __('Password', 'easy-basic-authentication'), | |
| 28 | + 'callback' => 'basic_auth_plugin_password_cb', | |
| 29 | + ), | |
| 30 | + '4' => array( | |
| 31 | + 'id' => 'basic-auth-plugin-admin-log-enable', | |
| 32 | + 'title' => __('Enable access logs', 'easy-basic-authentication'), | |
| 33 | + 'callback' => 'basic_auth_plugin_admin_log_enable_cb', | |
| 34 | + ), | |
| 35 | + '5' => array( | |
| 36 | + 'id' => 'basic-auth-plugin-alert-enable', | |
| 37 | + 'title' => __('Enable email alert', 'easy-basic-authentication'), | |
| 38 | + 'callback' => 'basic_auth_plugin_alert_enable_cb', | |
| 39 | + ), | |
| 40 | + '6' => array( | |
| 41 | + 'id' => 'basic-auth-plugin-email-alert', | |
| 42 | + 'title' => __('Email for alert', 'easy-basic-authentication'), | |
| 43 | + 'callback' => 'basic_auth_plugin_alertemail_cb', | |
| 44 | + ), | |
| 45 | + '7' => array( | |
| 46 | + 'id' => 'basic-auth-plugin-white-list', | |
| 47 | + 'title' => __('Ip White list', 'easy-basic-authentication'), | |
| 48 | + 'callback' => 'basic_auth_plugin_whitelist_cb', | |
| 49 | + ) | |
| 50 | + ); | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function basic_auth_plugin_settings_init() { |
| 54 | 54 | register_setting( 'basic-auth-plugin-settings', 'basic_auth_plugin_admin_enable' ); |
| @@ -62,12 +62,12 @@ | ||
| 62 | 62 | array($this,'basic_auth_plugin_section_cb'), |
| 63 | 63 | 'basic-auth-plugin-settings' |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - foreach(self::FORM_FIELD as $field) { | |
| 66 | + foreach($this->form_field as $field) { | |
| 67 | 67 | add_settings_field( |
| 68 | 68 | $field['id'], |
| 69 | - esc_html__($field['title'], 'easy-basic-authentication'), | |
| 69 | + esc_html($field['title']), | |
| 70 | 70 | array($this,$field['callback']), |
| 71 | 71 | 'basic-auth-plugin-settings', |
| 72 | 72 | 'basic-auth-plugin-section' |
| 73 | 73 | ); |