| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr> |
| 7 |
<th scope="row">Access-Control-Allow-Headers |
| 8 |
<p class="description"><?php esc_html_e('The Access-Control-Allow-Headers header is returned by the server in a response to a preflight request and informs the browser about the HTTP headers that can be used in the actual request.', '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/Access-Control-Allow-Headers"><?php esc_html_e('MDN Web Docs', 'http-headers'); ?></a> |
| 12 |
</p> |
| 13 |
</th> |
| 14 |
<td> |
| 15 |
<fieldset> |
| 16 |
<legend class="screen-reader-text">Access-Control-Allow-Credentials</legend> |
| 17 |
<?php |
| 18 |
$http_headers_access_control_allow_headers = get_option('hh_access_control_allow_headers', 0); |
| 19 |
foreach ($http_headers_bools as $http_headers_k => $http_headers_v) |
| 20 |
{ |
| 21 |
?><p><label><input type="radio" class="http-header" name="hh_access_control_allow_headers" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_access_control_allow_headers, $http_headers_k); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php |
| 22 |
} |
| 23 |
?> |
| 24 |
</fieldset> |
| 25 |
</td> |
| 26 |
<td> |
| 27 |
<?php settings_fields( 'http-headers-acah' ); ?> |
| 28 |
<?php do_settings_sections( 'http-headers-acah' ); ?> |
| 29 |
<table><tbody><tr> |
| 30 |
<?php |
| 31 |
$http_headers_access_control_allow_headers_value = get_option('hh_access_control_allow_headers_value'); |
| 32 |
if (!$http_headers_access_control_allow_headers_value) |
| 33 |
{ |
| 34 |
$http_headers_access_control_allow_headers_value = array(); |
| 35 |
} |
| 36 |
$http_headers_i = 0; |
| 37 |
array_unshift($http_headers_list, '*'); |
| 38 |
foreach ($http_headers_list as $http_headers_item) { |
| 39 |
if (in_array($http_headers_item, $http_headers_cors_safe_request_headers)) { |
| 40 |
continue; |
| 41 |
} |
| 42 |
if ($http_headers_i % 3 === 0) { |
| 43 |
?></tr><tr><?php |
| 44 |
} |
| 45 |
?><td><label><input type="checkbox" class="http-header-value" name="hh_access_control_allow_headers_value[<?php echo esc_attr($http_headers_item); ?>]" value="1"<?php echo !array_key_exists($http_headers_item, $http_headers_access_control_allow_headers_value) ? NULL : ' checked'; ?><?php echo $http_headers_access_control_allow_headers == 1 ? NULL : ' readonly'; ?> /> <?php echo esc_html($http_headers_item); ?></label></td><?php |
| 46 |
$http_headers_i += 1; |
| 47 |
} |
| 48 |
?> |
| 49 |
</tr></tbody></table> |
| 50 |
<table><tbody> |
| 51 |
<?php |
| 52 |
$http_headers_access_control_allow_headers_custom = get_option('hh_access_control_allow_headers_custom'); |
| 53 |
if (is_array($http_headers_access_control_allow_headers_custom)) |
| 54 |
{ |
| 55 |
foreach ($http_headers_access_control_allow_headers_custom as $http_headers_header) |
| 56 |
{ |
| 57 |
?> |
| 58 |
<tr> |
| 59 |
<td><input type="text" name="hh_access_control_allow_headers_custom[]" |
| 60 |
class="http-header-value" size="35" |
| 61 |
value="<?php echo esc_attr($http_headers_header); ?>"<?php echo $http_headers_access_control_allow_headers == 1 ? NULL : ' readonly'; ?> /> |
| 62 |
</td> |
| 63 |
<td> |
| 64 |
<button type="button" class="button button-small hh-btn-delete-ac" |
| 65 |
title="<?php esc_attr_e('Delete', 'http-headers'); ?>">x</button> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
<?php |
| 69 |
} |
| 70 |
} |
| 71 |
?> |
| 72 |
<tr> |
| 73 |
<td colspan="2"> |
| 74 |
<button type="button" class="button hh-btn-add-ac" data-name="hh_access_control_allow_headers_custom[]">+ <?php esc_html_e('Add header', 'http-headers'); ?></button> |
| 75 |
</td> |
| 76 |
</tr> |
| 77 |
</tbody></table> |
| 78 |
</td> |
| 79 |
</tr> |