PluginProbe
HTTP Headers / 1.11.0
HTTP Headers v1.11.0
1.19.5 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.14.0 1.14.1 1.14.2 1.15.0 All 60 releases
http-headers / views / feature-policy.php

feature-policy.php in HTTP Headers 1.11.0, at views/feature-policy.php

101 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5 ?>
6 <tr valign="top">
7 <th scope="row">Feature-Policy
8 <p class="description"><?php _e('With Feature Policy, you opt-in to a set of policies for the browser to enforce on specific features used throughout your site. These policies restrict what APIs the site can access or modify the browser\'s default behavior for certain features.', 'http-headers'); ?></p>
9 </th>
10 <td>
11 <fieldset>
12 <legend class="screen-reader-text">Feature-Policy</legend>
13 <?php
14 $feature_policy = get_option('hh_feature_policy', 0);
15 foreach ($bools as $k => $v)
16 {
17 ?><p><label><input type="radio" class="http-header" name="hh_feature_policy" value="<?php echo $k; ?>"<?php checked($feature_policy, $k, true); ?> /> <?php echo $v; ?></label></p><?php
18 }
19 ?>
20 </fieldset>
21 </td>
22 <td>
23 <?php settings_fields( 'http-headers-fp' ); ?>
24 <?php do_settings_sections( 'http-headers-fp' ); ?>
25 <table>
26 <tbody>
27 <?php
28 $features = array(
29 'accelerometer',
30 'ambient-light-sensor',
31 'autoplay',
32 'camera',
33 'cookie',
34 'docwrite',
35 'domain',
36 'encrypted-media',
37 'fullscreen',
38 'geolocation',
39 'gyroscope',
40 'magnetometer',
41 'microphone',
42 'midi',
43 'payment',
44 'picture-in-picture',
45 'speaker',
46 'sync-script',
47 'sync-xhr',
48 'unsized-media',
49 'usb',
50 'vertical-scroll',
51 'vibrate',
52 'vr',
53 );
54 $origins = array("'self'", "'none'", '*', 'origin(s)');
55
56 $feature_policy_value = get_option('hh_feature_policy_value');
57 $feature_policy_feature = get_option('hh_feature_policy_feature');
58 $feature_policy_origin = get_option('hh_feature_policy_origin');
59 if (!$feature_policy_value)
60 {
61 $feature_policy_value = array();
62 }
63 if (!$feature_policy_feature)
64 {
65 $feature_policy_feature = array();
66 }
67 if (!$feature_policy_origin)
68 {
69 $feature_policy_origin = array();
70 }
71
72 foreach ($features as $feature)
73 {
74 ?>
75 <tr>
76 <td><input type="checkbox" name="hh_feature_policy_feature[<?php echo $feature; ?>]" class="http-header-value"
77 value="1"<?php echo !is_array($feature_policy_feature) || !array_key_exists($feature, $feature_policy_feature) ? NULL : ' checked'; ?><?php echo $feature_policy == 1 ? NULL : ' readonly'; ?>></td>
78 <td><?php echo $feature; ?></td>
79 <td>
80 <select name="hh_feature_policy_value[<?php echo $feature; ?>]"
81 class="http-header-value"<?php echo $feature_policy == 1 ? NULL : ' readonly'; ?>>
82 <?php
83 foreach ($origins as $origin)
84 {
85 ?><option value="<?php echo $origin; ?>"<?php selected(@$feature_policy_value[$feature], $origin); ?>><?php echo $origin; ?></option><?php
86 }
87 ?>
88 </select>
89 <input type="text" name="hh_feature_policy_origin[<?php echo $feature; ?>]"
90 value="<?php echo @$feature_policy_origin[$feature]; ?>" size="30"<?php echo isset($feature_policy_value[$feature]) && in_array($feature_policy_value[$feature], array('origin(s)', "'self'")) ? NULL : ' style="display: none"'; ?>
91 class="http-header-value"<?php echo $feature_policy == 1 ? NULL : ' readonly'; ?>>
92 </td>
93 </tr>
94 <?php
95 }
96 ?>
97 </tbody>
98 </table>
99 </td>
100 </td>
101 </tr>