| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<tr> |
| 7 |
<th scope="row">Cache-Control |
| 8 |
<p class="description"><?php _e('The Cache-Control general-header field is used to specify directives for caching mechanisms in both, requests and responses. Caching directives are unidirectional, meaning that a given directive in a request is not implying that the same directive is to be given in the response.', 'http-headers'); ?></p> |
| 9 |
</th> |
| 10 |
<td> |
| 11 |
<fieldset> |
| 12 |
<legend class="screen-reader-text">Cache-Control</legend> |
| 13 |
<?php |
| 14 |
$cache_control = get_option('hh_cache_control', 0); |
| 15 |
foreach ($bools as $k => $v) |
| 16 |
{ |
| 17 |
?><p><label><input type="radio" class="http-header" name="hh_cache_control" value="<?php echo $k; ?>"<?php checked($cache_control, $k); ?> /> <?php echo $v; ?></label></p><?php |
| 18 |
} |
| 19 |
?> |
| 20 |
</fieldset> |
| 21 |
</td> |
| 22 |
<td> |
| 23 |
<?php settings_fields( 'http-headers-cc' ); ?> |
| 24 |
<?php do_settings_sections( 'http-headers-cc' ); ?> |
| 25 |
<?php |
| 26 |
$items = array( |
| 27 |
'must-revalidate' => 'bool', |
| 28 |
'no-cache' => 'bool', |
| 29 |
'no-store' => 'bool', |
| 30 |
'no-transform' => 'bool', |
| 31 |
'public' => 'bool', |
| 32 |
'private' => 'bool', |
| 33 |
'proxy-revalidate' => 'bool', |
| 34 |
'max-age' => 'int', |
| 35 |
's-maxage' => 'int', |
| 36 |
'immutable' => 'bool', |
| 37 |
'stale-while-revalidate' => 'int', |
| 38 |
'stale-if-error' => 'int', |
| 39 |
); |
| 40 |
?> |
| 41 |
<table> |
| 42 |
<?php |
| 43 |
$cache_control_value = get_option('hh_cache_control_value'); |
| 44 |
if (!$cache_control_value) |
| 45 |
{ |
| 46 |
$cache_control_value = array(); |
| 47 |
} |
| 48 |
foreach ($items as $item => $type) |
| 49 |
{ |
| 50 |
?> |
| 51 |
<tr> |
| 52 |
<td><label for="hh_cache_control_value_<?php echo $item; ?>"><?php echo $item; ?></label></td> |
| 53 |
<td><?php |
| 54 |
switch ($type) { |
| 55 |
case 'bool': |
| 56 |
?><input type="checkbox" class="http-header-value" name="hh_cache_control_value[<?php echo $item; ?>]" id="hh_cache_control_value_<?php echo $item; ?>" value="1"<?php checked(array_key_exists($item, $cache_control_value), 1, true); ?>><?php |
| 57 |
break; |
| 58 |
case 'int': |
| 59 |
?><input type="text" class="http-header-value" name="hh_cache_control_value[<?php echo $item; ?>]" id="hh_cache_control_value_<?php echo $item; ?>" size="6" value="<?php echo array_key_exists($item, $cache_control_value) && strlen($cache_control_value[$item]) > 0 ? (int) $cache_control_value[$item] : NULL; ?>"> <?php _e('seconds', 'http-headers'); |
| 60 |
break; |
| 61 |
} |
| 62 |
?> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
<?php |
| 66 |
} |
| 67 |
?> |
| 68 |
</table> |
| 69 |
</td> |
| 70 |
</tr> |