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 / content-security-policy.php

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

63 lines 2.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 $content_security_policy = get_option('hh_content_security_policy', 0);
6 ?>
7 <tr valign="top">
8 <th scope="row">Content Security Policy
9 <p class="description"><?php _e('Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement or distribution of malware.', 'http-headers'); ?></p>
10
11 <p>
12 <label><input type="checkbox" class="http-header-value"
13 name="hh_content_security_policy_report_only" value="1"
14 <?php checked(get_option('hh_content_security_policy_report_only'), 1, true); ?>
15 <?php echo $content_security_policy == 1 ? NULL : ' readonly'; ?> /> "Report-Only" (<?php _e('for reporting-only purposes', 'http-headers'); ?>)</label>
16 </p>
17 </th>
18 <td>
19 <fieldset>
20 <legend class="screen-reader-text">Content-Security-Policy</legend>
21 <?php
22 foreach ($bools as $k => $v)
23 {
24 ?><p><label><input type="radio" class="http-header" name="hh_content_security_policy" value="<?php echo $k; ?>"<?php checked($content_security_policy, $k, true); ?> /> <?php echo $v; ?></label></p><?php
25 }
26 ?>
27 </fieldset>
28 </td>
29 <td>
30 <?php settings_fields( 'http-headers-csp' ); ?>
31 <?php do_settings_sections( 'http-headers-csp' ); ?>
32 <table>
33 <thead>
34 <tr>
35 <th><?php _e('Directive', 'http-headers'); ?></th>
36 <th><?php _e('Value', 'http-headers'); ?></th>
37 </tr>
38 </thead>
39 <tbody>
40 <?php
41 $directives = array('default-src', 'script-src', 'style-src', 'img-src', 'connect-src',
42 'font-src', 'media-src', 'sandbox', 'report-uri', 'child-src', 'form-action',
43 'frame-ancestors', 'plugin-types',
44 'object-src', 'frame-src', 'worker-src', 'manifest-src', 'base-uri', 'report-to',
45 );
46 $csp = get_option('hh_content_security_policy_value');
47 foreach ($directives as $item)
48 {
49 ?>
50 <tr>
51 <td><?php echo $item; ?></td>
52 <td class="hh-td-inner" valign="middle">
53 <input type="text" name="hh_content_security_policy_value[<?php echo $item; ?>]" class="http-header-value" size="40"
54 value="<?php echo esc_attr(@$csp[$item]); ?>"<?php echo $content_security_policy == 1 ? NULL : ' readonly'; ?>>
55 </td>
56 </tr>
57 <?php
58 }
59 ?>
60 </tbody>
61 </table>
62 </td>
63 </tr>