PluginProbe
HTTP Headers / trunk
HTTP Headers vtrunk
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 / x-robots-tag.php

x-robots-tag.php in HTTP Headers trunk, at views/x-robots-tag.php

96 lines 4.7 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">X-Robots-Tag
8 <p class="description"><?php esc_html_e('The X-Robots-Tag HTTP header is used to indicate how a web page is to be indexed within public search engine results. The header is effectively equivalent to <code>&lt;meta name="robots" content="..."&gt;</code>.', 'http-headers'); ?></p>
9 <hr>
10 <p class="description"><?php esc_html_e('Read more at', 'http-headers'); ?>
11 <a target="_blank" href="https://developers.google.com/search/docs/advanced/robots/robots_meta_tag"><?php esc_html_e('Google Search Central', 'http-headers'); ?></a>
12 </p>
13 </th>
14 <td>
15 <fieldset>
16 <legend class="screen-reader-text">X-Robots-Tag</legend>
17 <?php
18 $http_headers_x_robots_tag = get_option('hh_x_robots_tag', 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_x_robots_tag" value="<?php echo esc_attr($http_headers_k); ?>"<?php checked($http_headers_x_robots_tag, $http_headers_k); ?> /> <?php echo esc_html($http_headers_v); ?></label></p><?php
22 }
23 ?>
24 </fieldset>
25 </td>
26 <td>
27 <?php settings_fields( 'http-headers-rob' ); ?>
28 <?php do_settings_sections( 'http-headers-rob' ); ?>
29 <?php
30 $http_headers_items = array(
31 'all' => 'bool',
32 'noindex' => 'bool',
33 'nofollow' => 'bool',
34 'none' => 'bool',
35 'noarchive' => 'bool',
36 'nosnippet' => 'bool',
37 'max-snippet' => 'number',
38 'max-image-preview' => 'setting',
39 'max-video-preview' => 'number',
40 'notranslate' => 'bool',
41 'noimageindex' => 'bool',
42 'unavailable_after' => 'datetime',
43 );
44 ?>
45 <table>
46 <?php
47 $http_headers_x_robots_tag_value = get_option('hh_x_robots_tag_value');
48 if (!$http_headers_x_robots_tag_value)
49 {
50 $http_headers_x_robots_tag_value = array();
51 }
52 foreach ($http_headers_items as $http_headers_item => $http_headers_type)
53 {
54 ?>
55 <tr>
56 <td><label for="hh_x_robots_tag_value_<?php echo esc_attr($http_headers_item); ?>"><?php echo esc_html($http_headers_item); ?></label></td>
57 <td><?php
58 switch ($http_headers_type) {
59 case 'bool':
60 ?><input type="checkbox" class="http-header-value" name="hh_x_robots_tag_value[<?php echo esc_attr($http_headers_item); ?>]"
61 id="hh_x_robots_tag_value_<?php echo esc_attr($http_headers_item); ?>"<?php echo $http_headers_x_robots_tag == 1 ? NULL : ' readonly'; ?>
62 value="1"<?php checked(array_key_exists($http_headers_item, $http_headers_x_robots_tag_value), 1, true); ?>><?php
63 break;
64 case 'number':
65 ?><input type="number" class="http-header-value" name="hh_x_robots_tag_value[<?php echo esc_attr($http_headers_item); ?>]"
66 id="hh_x_robots_tag_value_<?php echo esc_attr($http_headers_item); ?>"
67 size="6" min="-1" step="1"<?php echo $http_headers_x_robots_tag == 1 ? NULL : ' readonly'; ?>
68 value="<?php echo array_key_exists($http_headers_item, $http_headers_x_robots_tag_value) && strlen($http_headers_x_robots_tag_value[$http_headers_item]) > 0 ? (int) $http_headers_x_robots_tag_value[$http_headers_item] : NULL; ?>"><?php
69 break;
70 case 'setting':
71 ?><select class="http-header-value" name="hh_x_robots_tag_value[<?php echo esc_attr($http_headers_item); ?>]"
72 id="hh_x_robots_tag_value_<?php echo esc_attr($http_headers_item); ?>"<?php echo $http_headers_x_robots_tag == 1 ? NULL : ' readonly'; ?>>
73 <option value="">---</option>
74 <?php
75 foreach (array('none', 'standard', 'large') as $http_headers_k)
76 {
77 ?><option value="<?php echo esc_attr($http_headers_k); ?>"<?php echo array_key_exists($http_headers_item, $http_headers_x_robots_tag_value) && $http_headers_k == $http_headers_x_robots_tag_value[$http_headers_item] ? ' selected="selected"' : NULL; ?>><?php echo esc_html($http_headers_k); ?></option><?php
78 }
79 ?>
80 </select><?php
81 break;
82 case 'datetime':
83 ?><input type="date" class="http-header-value" name="hh_x_robots_tag_value[<?php echo esc_attr($http_headers_item); ?>]"
84 id="hh_x_robots_tag_value_<?php echo esc_attr($http_headers_item); ?>"<?php echo $http_headers_x_robots_tag == 1 ? NULL : ' readonly'; ?>
85 value="<?php echo array_key_exists($http_headers_item, $http_headers_x_robots_tag_value) && strlen($http_headers_x_robots_tag_value[$http_headers_item]) > 0 ? esc_attr($http_headers_x_robots_tag_value[$http_headers_item]) : NULL; ?>"><?php
86 break;
87 }
88 ?>
89 </td>
90 </tr>
91 <?php
92 }
93 ?>
94 </table>
95 </td>
96 </tr>