| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr> |
| 7 |
<th scope="row">Custom headers |
| 8 |
<p class="description"><?php esc_html_e('Common non-standard response fields:', 'http-headers'); ?> |
| 9 |
<br>X-Pingback |
| 10 |
<br>X-Cache |
| 11 |
<br>X-Edge-Location |
| 12 |
<br>X-HTTP-Method-Override |
| 13 |
<br>X-Csrf-Token |
| 14 |
<br>X-Request-ID |
| 15 |
<br>X-Correlation-ID |
| 16 |
<br>X-Content-Duration |
| 17 |
</p> |
| 18 |
</th> |
| 19 |
<td> |
| 20 |
<fieldset> |
| 21 |
<legend class="screen-reader-text">Custom headers</legend> |
| 22 |
<?php |
| 23 |
$http_headers_custom_headers = get_option('hh_custom_headers', 0); |
| 24 |
foreach ($http_headers_bools as $http_headers_k => $http_headers_v) |
| 25 |
{ |
| 26 |
?><p><label><input type="radio" class="http-header" name="hh_custom_headers" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_custom_headers, $http_headers_k); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php |
| 27 |
} |
| 28 |
?> |
| 29 |
</fieldset> |
| 30 |
</td> |
| 31 |
<td> |
| 32 |
<?php settings_fields( 'http-headers-che' ); ?> |
| 33 |
<?php do_settings_sections( 'http-headers-che' ); ?> |
| 34 |
<?php |
| 35 |
$http_headers_custom_headers_value = get_option('hh_custom_headers_value'); |
| 36 |
if (!is_array($http_headers_custom_headers_value)) { |
| 37 |
$http_headers_custom_headers_value = array(); |
| 38 |
} |
| 39 |
?> |
| 40 |
<table> |
| 41 |
<thead> |
| 42 |
<tr> |
| 43 |
<th><?php esc_html_e('Header', 'http-headers'); ?></th> |
| 44 |
<th><?php esc_html_e('Value', 'http-headers'); ?></th> |
| 45 |
<th></th> |
| 46 |
</tr> |
| 47 |
</thead> |
| 48 |
<tbody> |
| 49 |
<?php |
| 50 |
if (empty($http_headers_custom_headers_value)) |
| 51 |
{ |
| 52 |
?> |
| 53 |
<tr> |
| 54 |
<td><input type="text" name="hh_custom_headers_value[name][]" class="http-header-value" placeholder="X-Custom-Name"></td> |
| 55 |
<td><input type="text" name="hh_custom_headers_value[value][]" class="http-header-value" placeholder="<?php esc_attr_e('Value', 'http-headers'); ?>"></td> |
| 56 |
<td></td> |
| 57 |
</tr> |
| 58 |
<?php |
| 59 |
} else { |
| 60 |
foreach ($http_headers_custom_headers_value['name'] as $http_headers_key => $http_headers_name) |
| 61 |
{ |
| 62 |
if (empty($http_headers_name) || empty($http_headers_custom_headers_value['value'][$http_headers_key])) |
| 63 |
{ |
| 64 |
continue; |
| 65 |
} |
| 66 |
?> |
| 67 |
<tr> |
| 68 |
<td><input type="text" name="hh_custom_headers_value[name][]" class="http-header-value" placeholder="X-Custom-Name" value="<?php echo esc_attr($http_headers_name); ?>"<?php echo $http_headers_custom_headers == 1 ? NULL : ' readonly'; ?>></td> |
| 69 |
<td><input type="text" name="hh_custom_headers_value[value][]" class="http-header-value" placeholder="<?php esc_attr_e('Value', 'http-headers'); ?>" value="<?php echo esc_attr($http_headers_custom_headers_value['value'][$http_headers_key]); ?>"<?php echo $http_headers_custom_headers == 1 ? NULL : ' readonly'; ?>></td> |
| 70 |
<td><button type="button" class="button button-small hh-btn-delete-header" title="<?php esc_attr_e('Delete', 'http-headers'); ?>">x</button></td> |
| 71 |
</tr> |
| 72 |
<?php |
| 73 |
} |
| 74 |
} |
| 75 |
?> |
| 76 |
<tr> |
| 77 |
<td colspan="3"><button type="button" class="button" id="hh-btn-add-header">+ <?php esc_html_e('Add header', 'http-headers'); ?></button></td> |
| 78 |
</tr> |
| 79 |
</tbody> |
| 80 |
</table> |
| 81 |
</td> |
| 82 |
</tr> |