| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr> |
| 7 |
<th scope="row">Expires |
| 8 |
<p class="description"><?php esc_html_e('The Expires header contains the date/time after which the response is considered stale.', 'http-headers'); ?></p> |
| 9 |
<p class="description"><?php esc_html_e('Invalid dates, like the value 0, represent a date in the past and mean that the resource is already expired.', 'http-headers'); ?></p> |
| 10 |
<p class="description"><?php esc_html_e("If there is a Cache-Control header with the 'max-age' or 's-max-age' directive in the response, the Expires header is ignored.", 'http-headers'); ?></p> |
| 11 |
<p class="description"><?php esc_html_e('* Works only in Apache mode', 'http-headers'); ?></p> |
| 12 |
|
| 13 |
<hr> |
| 14 |
<p class="description"><?php esc_html_e('Read more at', 'http-headers'); ?> |
| 15 |
<a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires"><?php esc_html_e('MDN Web Docs', 'http-headers'); ?></a> |
| 16 |
</p> |
| 17 |
</th> |
| 18 |
<td> |
| 19 |
<fieldset> |
| 20 |
<legend class="screen-reader-text">Expires</legend> |
| 21 |
<?php |
| 22 |
$http_headers_expires = get_option('hh_expires', 0); |
| 23 |
foreach ($http_headers_bools as $http_headers_k => $http_headers_v) |
| 24 |
{ |
| 25 |
?><p><label><input type="radio" class="http-header" name="hh_expires" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_expires, $http_headers_k); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php |
| 26 |
} |
| 27 |
?> |
| 28 |
</fieldset> |
| 29 |
</td> |
| 30 |
<td> |
| 31 |
<?php settings_fields( 'http-headers-exp' ); ?> |
| 32 |
<?php do_settings_sections( 'http-headers-exp' ); ?> |
| 33 |
<table> |
| 34 |
<?php |
| 35 |
$http_headers_types = array( |
| 36 |
'default', |
| 37 |
'text/css', |
| 38 |
'text/javascript', |
| 39 |
'text/plain', |
| 40 |
'image/gif', |
| 41 |
'image/png', |
| 42 |
'image/jpeg', |
| 43 |
'image/x-icon', |
| 44 |
'application/x-javascript', |
| 45 |
'application/javascript', |
| 46 |
'application/x-icon', |
| 47 |
); |
| 48 |
$http_headers_items = array( |
| 49 |
'invalid_0_date' => '0 (invalid date)', |
| 50 |
'access_1_hour' => 'Access +1 hour', |
| 51 |
'access_6_hours' => 'Access +6 hours', |
| 52 |
'access_12_hours' => 'Access +12 hours', |
| 53 |
'access_1_day' => 'Access +1 day', |
| 54 |
'access_3_days' => 'Access +3 days', |
| 55 |
'access_1_week' => 'Access +1 week', |
| 56 |
'access_2_weeks' => 'Access +2 weeks', |
| 57 |
'access_1_month' => 'Access +1 month', |
| 58 |
'access_3_months' => 'Access +3 months', |
| 59 |
'access_6_months' => 'Access +6 months', |
| 60 |
'access_1_year' => 'Access +1 year', |
| 61 |
'modification_1_hour' => 'Modification +1 hour', |
| 62 |
'modification_6_hours' => 'Modification +6 hours', |
| 63 |
'modification_12_hours' => 'Modification +12 hours', |
| 64 |
'modification_1_day' => 'Modification +1 day', |
| 65 |
'modification_3_days' => 'Modification +3 days', |
| 66 |
'modification_1_week' => 'Modification +1 week', |
| 67 |
'modification_2_weeks' => 'Modification +2 weeks', |
| 68 |
'modification_1_month' => 'Modification +1 month', |
| 69 |
'modification_3_months' => 'Modification +3 months', |
| 70 |
'modification_6_months' => 'Modification +6 months', |
| 71 |
'modification_1_year' => 'Modification +1 year', |
| 72 |
); |
| 73 |
$http_headers_expires_value = get_option('hh_expires_value'); |
| 74 |
$http_headers_expires_type = get_option('hh_expires_type'); |
| 75 |
if (!$http_headers_expires_value) |
| 76 |
{ |
| 77 |
$http_headers_expires_value = array(); |
| 78 |
} |
| 79 |
if (!$http_headers_expires_type) |
| 80 |
{ |
| 81 |
$http_headers_expires_type = array(); |
| 82 |
} |
| 83 |
foreach ($http_headers_types as $http_headers_type) { |
| 84 |
?> |
| 85 |
<tr> |
| 86 |
<td><input type="checkbox" class="http-header-value" name="hh_expires_type[<?php echo esc_attr($http_headers_type); ?>]" value="1"<?php echo !is_array($http_headers_expires_type) || !array_key_exists($http_headers_type, $http_headers_expires_type) ? NULL : ' checked'; ?><?php echo $http_headers_expires == 1 ? NULL : ' readonly'; ?>></td> |
| 87 |
<td><?php echo esc_html($http_headers_type); ?></td> |
| 88 |
<td> |
| 89 |
<select class="http-header-value" name="hh_expires_value[<?php echo esc_attr($http_headers_type); ?>]"<?php echo $http_headers_expires == 1 ? NULL : ' readonly'; ?>> |
| 90 |
<?php |
| 91 |
foreach ($http_headers_items as $http_headers_k => $http_headers_v) { |
| 92 |
$http_headers_val_type = !empty($http_headers_expires_value[$http_headers_type]) ? $http_headers_expires_value[$http_headers_type] : ''; |
| 93 |
?><option value="<?php echo esc_attr($http_headers_k); ?>"<?php selected($http_headers_val_type, $http_headers_k); ?>><?php echo esc_html($http_headers_v); ?></option><?php |
| 94 |
} |
| 95 |
?> |
| 96 |
</select> |
| 97 |
</td> |
| 98 |
</tr> |
| 99 |
<?php |
| 100 |
} |
| 101 |
?> |
| 102 |
</table> |
| 103 |
</td> |
| 104 |
</tr> |