| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr valign="top"> |
| 7 |
<th scope="row">NEL |
| 8 |
<p class="description"><?php esc_html_e('Network Error Logging is a mechanism that can be configured via the NEL HTTP response header. This experimental header allows web sites and applications to opt-in to receive reports about failed (and, if desired, successful) network fetches from supporting browsers.', '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/Network_Error_Logging"><?php esc_html_e('MDN Web Docs', 'http-headers'); ?></a> |
| 12 |
</p> |
| 13 |
</th> |
| 14 |
<td> |
| 15 |
<fieldset> |
| 16 |
<legend class="screen-reader-text">NEL</legend> |
| 17 |
<?php |
| 18 |
$http_headers_nel = get_option('hh_nel', 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_nel" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_nel, $http_headers_k, true); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php |
| 22 |
} |
| 23 |
?> |
| 24 |
</fieldset> |
| 25 |
</td> |
| 26 |
<td> |
| 27 |
<?php settings_fields( 'http-headers-nel' ); ?> |
| 28 |
<?php do_settings_sections( 'http-headers-nel' ); ?> |
| 29 |
<?php |
| 30 |
$http_headers_nel_value = get_option('hh_nel_value', array()); |
| 31 |
|
| 32 |
$http_headers_report_to = isset($http_headers_nel_value['report_to']) ? $http_headers_nel_value['report_to'] : NULL; |
| 33 |
$http_headers_max_age = isset($http_headers_nel_value['max_age']) ? $http_headers_nel_value['max_age'] : NULL; |
| 34 |
$http_headers_include_subdomains = isset($http_headers_nel_value['include_subdomains']) ? $http_headers_nel_value['include_subdomains'] : NULL; |
| 35 |
$http_headers_success_fraction = isset($http_headers_nel_value['success_fraction']) ? $http_headers_nel_value['success_fraction'] : NULL; |
| 36 |
$http_headers_failure_fraction = isset($http_headers_nel_value['failure_fraction']) ? $http_headers_nel_value['failure_fraction'] : NULL; |
| 37 |
$http_headers_request_headers = isset($http_headers_nel_value['request_headers']) ? $http_headers_nel_value['request_headers'] : NULL; |
| 38 |
$http_headers_response_headers = isset($http_headers_nel_value['response_headers']) ? $http_headers_nel_value['response_headers'] : NULL; |
| 39 |
?> |
| 40 |
<table> |
| 41 |
<tr> |
| 42 |
<td>report_to:</td> |
| 43 |
<td><input type="text" class="http-header-value" name="hh_nel_value[report_to]" value="<?php echo esc_attr($http_headers_report_to); ?>"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?>></td> |
| 44 |
</tr> |
| 45 |
<tr> |
| 46 |
<td>max_age:</td> |
| 47 |
<td><select name="hh_nel_value[max_age]" class="http-header-value"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?>> |
| 48 |
<?php |
| 49 |
$http_headers_items = array('3600' => '1 hour', '86400' => '1 day', '604800' => '7 days', '2592000' => '30 days', '5184000' => '60 days', '7776000' => '90 days', '31536000' => '1 year'); |
| 50 |
foreach ($http_headers_items as $http_headers_key => $http_headers_item) { |
| 51 |
?><option value="<?php echo esc_attr($http_headers_key); ?>"<?php selected($http_headers_max_age, $http_headers_key); ?>><?php echo esc_html($http_headers_item); ?></option><?php |
| 52 |
} |
| 53 |
?> |
| 54 |
</select></td> |
| 55 |
</tr> |
| 56 |
<tr> |
| 57 |
<td>include_subdomains:</td> |
| 58 |
<td><input type="checkbox" class="http-header-value" name="hh_nel_value[include_subdomains]" value="1"<?php checked($http_headers_include_subdomains, 1, true); ?><?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?>></td> |
| 59 |
</tr> |
| 60 |
<tr> |
| 61 |
<td>success_fraction:</td> |
| 62 |
<td><input type="number" class="http-header-value" name="hh_nel_value[success_fraction]" value="<?php echo esc_attr($http_headers_success_fraction); ?>"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?> min="0.0" max="1.0" step="0.1"></td> |
| 63 |
</tr> |
| 64 |
<tr> |
| 65 |
<td>failure_fraction:</td> |
| 66 |
<td><input type="number" class="http-header-value" name="hh_nel_value[failure_fraction]" value="<?php echo esc_attr($http_headers_failure_fraction); ?>"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?> min="0.0" max="1.0" step="0.1"></td> |
| 67 |
</tr> |
| 68 |
<tr> |
| 69 |
<td>request_headers:</td> |
| 70 |
<td><input type="text" class="http-header-value" name="hh_nel_value[request_headers]" value="<?php echo esc_attr($http_headers_request_headers); ?>"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?>></td> |
| 71 |
</tr> |
| 72 |
<tr> |
| 73 |
<td>response_headers:</td> |
| 74 |
<td><input type="text" class="http-header-value" name="hh_nel_value[response_headers]" value="<?php echo esc_attr($http_headers_response_headers); ?>"<?php echo $http_headers_nel == 1 ? NULL : ' readonly'; ?>></td> |
| 75 |
</tr> |
| 76 |
</table> |
| 77 |
</td> |
| 78 |
</tr> |