| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr valign="top"> |
| 7 |
<th scope="row">WWW-Authenticate |
| 8 |
<p class="description"><?php esc_html_e('HTTP supports the use of several authentication mechanisms to control access to pages and other resources. These mechanisms are all based around the use of the 401 status code and the WWW-Authenticate response header.', 'http-headers'); ?></p> |
| 9 |
<hr> |
| 10 |
<p class="description"><?php esc_html_e('Read more at', 'http-headers'); ?> |
| 11 |
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate"><?php esc_html_e('MDN Web Docs', 'http-headers'); ?></a> |
| 12 |
</p> |
| 13 |
</th> |
| 14 |
<td> |
| 15 |
<fieldset> |
| 16 |
<legend class="screen-reader-text">WWW-Authenticate</legend> |
| 17 |
<?php |
| 18 |
$http_headers_www_authenticate = get_option ( 'hh_www_authenticate', 0 ); |
| 19 |
foreach ( $http_headers_bools as $http_headers_k => $http_headers_v ) { |
| 20 |
?><p> |
| 21 |
<label><input type="radio" class="http-header" name="hh_www_authenticate" value="<?php echo esc_attr($http_headers_k); ?>" <?php checked($http_headers_www_authenticate, $http_headers_k, true); ?> /> <?php echo esc_html($http_headers_v); ?></label> |
| 22 |
</p><?php |
| 23 |
} |
| 24 |
?> |
| 25 |
</fieldset> |
| 26 |
</td> |
| 27 |
<td> |
| 28 |
<?php settings_fields( 'http-headers-wwa' ); ?> |
| 29 |
<?php do_settings_sections( 'http-headers-wwa' ); ?> |
| 30 |
<table> |
| 31 |
<tbody> |
| 32 |
<tr> |
| 33 |
<td>Type</td> |
| 34 |
<td colspan="3"> |
| 35 |
<select name="hh_www_authenticate_type" class="http-header-value"<?php echo $http_headers_www_authenticate == 1 ? NULL : ' readonly'; ?>> |
| 36 |
<?php |
| 37 |
$http_headers_items = array ('Basic', 'Digest'); |
| 38 |
$http_headers_www_authenticate_type = get_option ( 'hh_www_authenticate_type' ); |
| 39 |
foreach ( $http_headers_items as $http_headers_item ) { |
| 40 |
?><option value="<?php echo esc_attr($http_headers_item); ?>" <?php selected($http_headers_www_authenticate_type, $http_headers_item); ?>><?php echo esc_html($http_headers_item); ?></option><?php |
| 41 |
} |
| 42 |
?> |
| 43 |
</select> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
<tr> |
| 47 |
<td>Realm</td> |
| 48 |
<td colspan="3"><input type="text" name="hh_www_authenticate_realm" class="http-header-value" size="30" value="<?php echo esc_attr(get_option('hh_www_authenticate_realm')); ?>"<?php echo $http_headers_www_authenticate == 1 ? NULL : ' readonly'; ?> placeholder="Restricted area"></td> |
| 49 |
</tr> |
| 50 |
<tr> |
| 51 |
<td> </td> |
| 52 |
<td><strong><?php esc_html_e('Username', 'http-headers'); ?></strong></td> |
| 53 |
<td><strong><?php esc_html_e('Password', 'http-headers'); ?></strong></td> |
| 54 |
<td> </td> |
| 55 |
</tr> |
| 56 |
<?php |
| 57 |
$http_headers_usernames = get_option('hh_www_authenticate_user', array()); |
| 58 |
$http_headers_passwords = get_option('hh_www_authenticate_pswd', array()); |
| 59 |
if (!is_array($http_headers_usernames)) { |
| 60 |
$http_headers_usernames = array($http_headers_usernames); |
| 61 |
} |
| 62 |
if (!is_array($http_headers_passwords)) { |
| 63 |
$http_headers_passwords = array($http_headers_passwords); |
| 64 |
} |
| 65 |
$http_headers_i = 0; |
| 66 |
foreach ($http_headers_usernames as $http_headers_k => $http_headers_user) { |
| 67 |
?> |
| 68 |
<tr> |
| 69 |
<td> </td> |
| 70 |
<td><input type="text" name="hh_www_authenticate_user[]" class="http-header-value" value="<?php echo esc_attr($http_headers_user); ?>"<?php echo $http_headers_www_authenticate == 1 ? NULL : ' readonly'; ?>></td> |
| 71 |
<td><input type="text" name="hh_www_authenticate_pswd[]" class="http-header-value" value="<?php echo esc_attr($http_headers_passwords[$http_headers_k]); ?>"<?php echo $http_headers_www_authenticate == 1 ? NULL : ' readonly'; ?>></td> |
| 72 |
<td><?php |
| 73 |
if ($http_headers_i > 0) |
| 74 |
{ |
| 75 |
?><button type="button" class="button button-small hh-btn-delete-user" title="<?php esc_attr_e('Delete', 'http-headers'); ?>">x</button><?php |
| 76 |
} else { |
| 77 |
echo " "; |
| 78 |
} |
| 79 |
?></td> |
| 80 |
</tr> |
| 81 |
<?php |
| 82 |
$http_headers_i += 1; |
| 83 |
} |
| 84 |
?> |
| 85 |
<tr> |
| 86 |
<td> </td> |
| 87 |
<td colspan="3"> |
| 88 |
<button type="button" class="button hh-btn-add-user">+ <?php esc_html_e('Add user', 'http-headers'); ?></button> |
| 89 |
</td> |
| 90 |
</tr> |
| 91 |
</tbody> |
| 92 |
</table> |
| 93 |
</td> |
| 94 |
</tr> |