@@ -10,20 +10,20 @@ |
||
10 | 10 | * @subpackage WordPress_Security_Txt/admin/partials |
11 | 11 | */ |
12 | 12 | |
13 | -if (! empty($atts['label'])) { |
|
14 | - ?><label for="<?php echo esc_attr($atts['id']); ?>"><?php esc_html_e($atts['label'], 'wordpress-security-txt'); ?> |
|
13 | +if (!empty($atts[ 'label' ])) { |
|
14 | + ?><label for="<?php echo esc_attr($atts[ 'id' ]); ?>"><?php esc_html_e($atts[ 'label' ], 'wordpress-security-txt'); ?> |
|
15 | 15 | : </label><?php |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?><textarea |
19 | - class="<?php echo esc_attr($atts['class']); ?>" |
|
20 | - cols="<?php echo esc_attr($atts['cols']); ?>" |
|
21 | - id="<?php echo esc_attr($atts['id']); ?>" |
|
22 | - placeholder="<?php echo esc_attr($atts['placeholder']); ?>" |
|
23 | - name="<?php echo esc_attr($atts['name']); ?>" |
|
24 | - rows="<?php echo esc_attr($atts['rows']); ?>"><?php |
|
19 | + class="<?php echo esc_attr($atts[ 'class' ]); ?>" |
|
20 | + cols="<?php echo esc_attr($atts[ 'cols' ]); ?>" |
|
21 | + id="<?php echo esc_attr($atts[ 'id' ]); ?>" |
|
22 | + placeholder="<?php echo esc_attr($atts[ 'placeholder' ]); ?>" |
|
23 | + name="<?php echo esc_attr($atts[ 'name' ]); ?>" |
|
24 | + rows="<?php echo esc_attr($atts[ 'rows' ]); ?>"><?php |
|
25 | 25 | |
26 | - echo esc_textarea($atts['value']); |
|
26 | + echo esc_textarea($atts[ 'value' ]); |
|
27 | 27 | |
28 | 28 | ?></textarea> |
29 | -<span class="description"><?php esc_html_e($atts['description'], 'wordpress-security-txt'); ?></span> |
|
29 | +<span class="description"><?php esc_html_e($atts[ 'description' ], 'wordpress-security-txt'); ?></span> |
@@ -10,13 +10,13 @@ |
||
10 | 10 | * @subpackage WordPress_Security_Txt/admin/partials |
11 | 11 | */ |
12 | 12 | |
13 | -?><label for="<?php echo esc_attr($atts['id']); ?>"> |
|
13 | +?><label for="<?php echo esc_attr($atts[ 'id' ]); ?>"> |
|
14 | 14 | <input aria-role="checkbox" |
15 | - <?php checked(1, $atts['value'], true); ?> |
|
16 | - class="<?php echo esc_attr($atts['class']); ?>" |
|
17 | - id="<?php echo esc_attr($atts['id']); ?>" |
|
18 | - name="<?php echo esc_attr($atts['name']); ?>" |
|
15 | + <?php checked(1, $atts[ 'value' ], true); ?> |
|
16 | + class="<?php echo esc_attr($atts[ 'class' ]); ?>" |
|
17 | + id="<?php echo esc_attr($atts[ 'id' ]); ?>" |
|
18 | + name="<?php echo esc_attr($atts[ 'name' ]); ?>" |
|
19 | 19 | type="checkbox" |
20 | 20 | value="1"/> |
21 | - <span class="description"><?php esc_html_e($atts['description'], 'wordpress-security-txt'); ?></span> |
|
21 | + <span class="description"><?php esc_html_e($atts[ 'description' ], 'wordpress-security-txt'); ?></span> |
|
22 | 22 | </label> |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | <ul class="repeaters"> |
20 | 20 | <?php |
21 | 21 | |
22 | - for ($i = 0; $i <= $count; $i++) { |
|
22 | + for ($i=0; $i <= $count; $i++) { |
|
23 | 23 | if ($i === $count) { |
24 | - $setatts['class'] .= ' hidden'; |
|
24 | + $setatts[ 'class' ].=' hidden'; |
|
25 | 25 | } |
26 | 26 | |
27 | - if (! empty($repeater[$i][$setatts['title-field']])) { |
|
28 | - $setatts['label-header'] = $repeater[$i][$setatts['title-field']]; |
|
27 | + if (!empty($repeater[ $i ][ $setatts[ 'title-field' ] ])) { |
|
28 | + $setatts[ 'label-header' ]=$repeater[ $i ][ $setatts[ 'title-field' ] ]; |
|
29 | 29 | } ?> |
30 | - <li class="<?php echo esc_attr($setatts['class']); ?>"> |
|
30 | + <li class="<?php echo esc_attr($setatts[ 'class' ]); ?>"> |
|
31 | 31 | <div class="handle"> |
32 | - <span class="title-repeater"><?php echo esc_html($setatts['label-header']); ?></span> |
|
32 | + <span class="title-repeater"><?php echo esc_html($setatts[ 'label-header' ]); ?></span> |
|
33 | 33 | <button aria-expanded="true" class="btn-edit" type="button"> |
34 | - <span class="screen-reader-text"><?php echo esc_html($setatts['label-edit']); ?></span> |
|
34 | + <span class="screen-reader-text"><?php echo esc_html($setatts[ 'label-edit' ]); ?></span> |
|
35 | 35 | <span class="toggle-arrow"></span> |
36 | 36 | </button> |
37 | 37 | </div> |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | <div class="wrap-fields"> |
40 | 40 | <?php |
41 | 41 | |
42 | - foreach ($setatts['fields'] as $fieldcount => $field) { |
|
42 | + foreach ($setatts[ 'fields' ] as $fieldcount => $field) { |
|
43 | 43 | foreach ($field as $type => $atts) { |
44 | - if (! empty($repeater) && ! empty($repeater[$i][$atts['id']])) { |
|
45 | - $atts['value'] = $repeater[$i][$atts['id']]; |
|
44 | + if (!empty($repeater) && !empty($repeater[ $i ][ $atts[ 'id' ] ])) { |
|
45 | + $atts[ 'value' ]=$repeater[ $i ][ $atts[ 'id' ] ]; |
|
46 | 46 | } |
47 | 47 | |
48 | - $atts['id'] .= '[]'; |
|
49 | - $atts['name'] .= '[]'; ?><p class="wrap-field"><?php |
|
48 | + $atts[ 'id' ].='[]'; |
|
49 | + $atts[ 'name' ].='[]'; ?><p class="wrap-field"><?php |
|
50 | 50 | |
51 | 51 | require plugin_dir_path(__FILE__) . $this->plugin_name . '-field-' . $type . '.php'; ?> |
52 | 52 | </p> |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <span> |
60 | 60 | <?php |
61 | 61 | echo esc_html(apply_filters($this->plugin_name . '-repeater-remove-link-label', |
62 | - $setatts['label-remove'])); ?> |
|
62 | + $setatts[ 'label-remove' ])); ?> |
|
63 | 63 | </span> |
64 | 64 | </a> |
65 | 65 | </div> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <span id="status"></span> |
73 | 73 | <a class="button" href="#" id="add-repeater"> |
74 | 74 | <?php |
75 | - echo esc_html(apply_filters($this->plugin_name . '-repeater-more-link-label', $setatts['label-add'])); |
|
75 | + echo esc_html(apply_filters($this->plugin_name . '-repeater-more-link-label', $setatts[ 'label-add' ])); |
|
76 | 76 | ?> |
77 | 77 | </a> |
78 | 78 | </div> |
@@ -10,14 +10,14 @@ |
||
10 | 10 | * @subpackage WordPress_Security_Txt/admin/partials |
11 | 11 | */ |
12 | 12 | |
13 | -if (! empty($atts['label'])) { |
|
13 | +if (!empty($atts[ 'label' ])) { |
|
14 | 14 | ?><label for="<?php |
15 | 15 | |
16 | - echo esc_attr($atts['id']); ?>"><?php |
|
16 | + echo esc_attr($atts[ 'id' ]); ?>"><?php |
|
17 | 17 | |
18 | - esc_html_e($atts['label'], 'wordpress-security-txt'); ?>: </label><?php |
|
18 | + esc_html_e($atts[ 'label' ], 'wordpress-security-txt'); ?>: </label><?php |
|
19 | 19 | } |
20 | 20 | |
21 | -wp_editor(html_entity_decode($atts['value']), $atts['id'], $atts['settings']); |
|
21 | +wp_editor(html_entity_decode($atts[ 'value' ]), $atts[ 'id' ], $atts[ 'settings' ]); |
|
22 | 22 | |
23 | -?><span class="description"><?php esc_html_e($atts['description'], 'wordpress-security-txt'); ?></span> |
|
23 | +?><span class="description"><?php esc_html_e($atts[ 'description' ], 'wordpress-security-txt'); ?></span> |
@@ -10,19 +10,19 @@ |
||
10 | 10 | * @subpackage WordPress_Security_Txt/admin/partials |
11 | 11 | */ |
12 | 12 | |
13 | -if (! empty($atts['label'])) { |
|
14 | - ?><label for="<?php echo esc_attr($atts['id']); ?>"><?php esc_html_e($atts['label'], 'wordpress-security-txt'); ?> |
|
13 | +if (!empty($atts[ 'label' ])) { |
|
14 | + ?><label for="<?php echo esc_attr($atts[ 'id' ]); ?>"><?php esc_html_e($atts[ 'label' ], 'wordpress-security-txt'); ?> |
|
15 | 15 | : </label><?php |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?><input |
19 | - class="<?php echo esc_attr($atts['class']); ?>" |
|
20 | - id="<?php echo esc_attr($atts['id']); ?>" |
|
21 | - name="<?php echo esc_attr($atts['name']); ?>" |
|
22 | - placeholder="<?php echo esc_attr($atts['placeholder']); ?>" |
|
23 | - type="<?php echo esc_attr($atts['type']); ?>" |
|
24 | - value="<?php echo esc_attr($atts['value']); ?>" /><?php |
|
19 | + class="<?php echo esc_attr($atts[ 'class' ]); ?>" |
|
20 | + id="<?php echo esc_attr($atts[ 'id' ]); ?>" |
|
21 | + name="<?php echo esc_attr($atts[ 'name' ]); ?>" |
|
22 | + placeholder="<?php echo esc_attr($atts[ 'placeholder' ]); ?>" |
|
23 | + type="<?php echo esc_attr($atts[ 'type' ]); ?>" |
|
24 | + value="<?php echo esc_attr($atts[ 'value' ]); ?>" /><?php |
|
25 | 25 | |
26 | -if (! empty($atts['description'])) { |
|
27 | - ?><span class="description"><?php esc_html_e($atts['description'], 'wordpress-security-txt'); ?></span><?php |
|
26 | +if (!empty($atts[ 'description' ])) { |
|
27 | + ?><span class="description"><?php esc_html_e($atts[ 'description' ], 'wordpress-security-txt'); ?></span><?php |
|
28 | 28 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage WordPress_Security_Txt/admin/partials |
11 | 11 | */ |
12 | 12 | |
13 | -$links = [ |
|
13 | +$links=[ |
|
14 | 14 | 'repo' => 'https://github.com/austinheap/wordpress-security-txt', |
15 | 15 | 'issues' => 'https://github.com/austinheap/laravel-security-txt/issues', |
16 | 16 | 'pulls' => 'https://github.com/austinheap/laravel-security-txt/pulls', |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | <h2>security.txt Help</h2> |
27 | 27 | <p> |
28 | 28 | You are running <code>wordpress-security-txt v<?php echo WORDPRESS_SECURITY_TXT_VERSION ?></code>. Please |
29 | - report any issues you encounter via the <a href="<?php echo $links['issues']; ?>">GitHub issues tracker</a>. |
|
30 | - If you'd like to contribute to this plugin, <a href="<?php echo $links['pulls']; ?>">pull requests</a> are |
|
31 | - welcome. For more information please see <a href="<?php echo $links['contributing']; ?>">CONTRIBUTING.md</a>. |
|
29 | + report any issues you encounter via the <a href="<?php echo $links[ 'issues' ]; ?>">GitHub issues tracker</a>. |
|
30 | + If you'd like to contribute to this plugin, <a href="<?php echo $links[ 'pulls' ]; ?>">pull requests</a> are |
|
31 | + welcome. For more information please see <a href="<?php echo $links[ 'contributing' ]; ?>">CONTRIBUTING.md</a>. |
|
32 | 32 | </p> |
33 | 33 | <p> |
34 | 34 | This version of the plugin implements the <code>security.txt</code> |
35 | - <a href="<?php echo $links['specification']; ?>">specification</a> as follows: |
|
35 | + <a href="<?php echo $links[ 'specification' ]; ?>">specification</a> as follows: |
|
36 | 36 | </p> |
37 | 37 | <div class="specification"> |
38 | 38 | <pre><?php echo htmlspecialchars(file_get_contents(plugin_dir_path(__FILE__) . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'SPECIFICATION.txt')); ?></pre> |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($plugin_name, $version, $options) |
60 | 60 | { |
61 | - $this->plugin_name = $plugin_name; |
|
62 | - $this->version = $version; |
|
63 | - $this->options = $options; |
|
61 | + $this->plugin_name=$plugin_name; |
|
62 | + $this->version=$version; |
|
63 | + $this->options=$options; |
|
64 | 64 | |
65 | 65 | if ($this->version != WORDPRESS_SECURITY_TXT_VERSION) { |
66 | 66 | throw new Exception('Internal version mismatch in plugin wordpress-security-txt; it needs to be reinstalled.'); |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function checkbox($args) |
78 | 78 | { |
79 | - $defaults['class'] = $defaults['description'] = $defaults['label'] = ''; |
|
80 | - $defaults['name'] = $this->plugin_name . '-options[' . $args['id'] . ']'; |
|
81 | - $defaults['value'] = 0; |
|
79 | + $defaults[ 'class' ]=$defaults[ 'description' ]=$defaults[ 'label' ]=''; |
|
80 | + $defaults[ 'name' ]=$this->plugin_name . '-options[' . $args[ 'id' ] . ']'; |
|
81 | + $defaults[ 'value' ]=0; |
|
82 | 82 | |
83 | 83 | apply_filters($this->plugin_name . '-field-checkbox-options-defaults', $defaults); |
84 | 84 | |
85 | - $atts = wp_parse_args($args, $defaults); |
|
85 | + $atts=wp_parse_args($args, $defaults); |
|
86 | 86 | |
87 | - if (! empty($this->options[$atts['id']])) { |
|
88 | - $atts['value'] = $this->options[$atts['id']]; |
|
87 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
88 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-checkbox.php'; |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function editor($args) |
104 | 104 | { |
105 | - $defaults['description'] = $defaults['value'] = ''; |
|
106 | - $defaults['settings'] = ['textarea_name' => $this->plugin_name . '-options[' . $args['id'] . ']']; |
|
105 | + $defaults[ 'description' ]=$defaults[ 'value' ]=''; |
|
106 | + $defaults[ 'settings' ]=[ 'textarea_name' => $this->plugin_name . '-options[' . $args[ 'id' ] . ']' ]; |
|
107 | 107 | |
108 | 108 | apply_filters($this->plugin_name . '-field-editor-options-defaults', $defaults); |
109 | 109 | |
110 | - $atts = wp_parse_args($args, $defaults); |
|
110 | + $atts=wp_parse_args($args, $defaults); |
|
111 | 111 | |
112 | - if (! empty($this->options[$atts['id']])) { |
|
113 | - $atts['value'] = $this->options[$atts['id']]; |
|
112 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
113 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-editor.php'; |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function radios($args) |
127 | 127 | { |
128 | - $defaults['class'] = $defaults['label'] = $defaults['description'] = ''; |
|
129 | - $defaults['name'] = $this->plugin_name . '-options[' . $args['id'] . ']'; |
|
130 | - $defaults['value'] = 0; |
|
128 | + $defaults[ 'class' ]=$defaults[ 'label' ]=$defaults[ 'description' ]=''; |
|
129 | + $defaults[ 'name' ]=$this->plugin_name . '-options[' . $args[ 'id' ] . ']'; |
|
130 | + $defaults[ 'value' ]=0; |
|
131 | 131 | |
132 | 132 | apply_filters($this->plugin_name . '-field-radios-options-defaults', $defaults); |
133 | 133 | |
134 | - $atts = wp_parse_args($args, $defaults); |
|
134 | + $atts=wp_parse_args($args, $defaults); |
|
135 | 135 | |
136 | - if (! empty($this->options[$atts['id']])) { |
|
137 | - $atts['value'] = $this->options[$atts['id']]; |
|
136 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
137 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-radios.php'; |
@@ -142,26 +142,26 @@ discard block |
||
142 | 142 | |
143 | 143 | public function repeater($args) |
144 | 144 | { |
145 | - $defaults['class'] = 'repeater'; |
|
146 | - $defaults['fields'] = []; |
|
147 | - $defaults['id'] = $defaults['title-field'] = ''; |
|
148 | - $defaults['label-add'] = 'Add Item'; |
|
149 | - $defaults['label-edit'] = 'Edit Item'; |
|
150 | - $defaults['label-header'] = 'Item Name'; |
|
151 | - $defaults['label-remove'] = 'Remove Item'; |
|
145 | + $defaults[ 'class' ]='repeater'; |
|
146 | + $defaults[ 'fields' ]=[ ]; |
|
147 | + $defaults[ 'id' ]=$defaults[ 'title-field' ]=''; |
|
148 | + $defaults[ 'label-add' ]='Add Item'; |
|
149 | + $defaults[ 'label-edit' ]='Edit Item'; |
|
150 | + $defaults[ 'label-header' ]='Item Name'; |
|
151 | + $defaults[ 'label-remove' ]='Remove Item'; |
|
152 | 152 | |
153 | 153 | apply_filters($this->plugin_name . '-field-repeater-options-defaults', $defaults); |
154 | 154 | |
155 | - $setatts = wp_parse_args($args, $defaults); |
|
156 | - $count = 1; |
|
157 | - $repeater = []; |
|
155 | + $setatts=wp_parse_args($args, $defaults); |
|
156 | + $count=1; |
|
157 | + $repeater=[ ]; |
|
158 | 158 | |
159 | - if (! empty($this->options[$setatts['id']])) { |
|
160 | - $repeater = maybe_unserialize($this->options[$setatts['id']][0]); |
|
159 | + if (!empty($this->options[ $setatts[ 'id' ] ])) { |
|
160 | + $repeater=maybe_unserialize($this->options[ $setatts[ 'id' ] ][ 0 ]); |
|
161 | 161 | } |
162 | 162 | |
163 | - if (! empty($repeater)) { |
|
164 | - $count = count($repeater); |
|
163 | + if (!empty($repeater)) { |
|
164 | + $count=count($repeater); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-repeater.php'; |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function select($args) |
180 | 180 | { |
181 | - $defaults['aria'] = $defaults['blank'] = $defaults['context'] = $defaults['description'] = $defaults['label'] = $defaults['value'] = ''; |
|
182 | - $defaults['class'] = 'widefat'; |
|
183 | - $defaults['name'] = $this->plugin_name . '-options[' . $args['id'] . ']'; |
|
184 | - $defaults['selections'] = []; |
|
181 | + $defaults[ 'aria' ]=$defaults[ 'blank' ]=$defaults[ 'context' ]=$defaults[ 'description' ]=$defaults[ 'label' ]=$defaults[ 'value' ]=''; |
|
182 | + $defaults[ 'class' ]='widefat'; |
|
183 | + $defaults[ 'name' ]=$this->plugin_name . '-options[' . $args[ 'id' ] . ']'; |
|
184 | + $defaults[ 'selections' ]=[ ]; |
|
185 | 185 | |
186 | 186 | apply_filters($this->plugin_name . '-field-select-options-defaults', $defaults); |
187 | 187 | |
188 | - $atts = wp_parse_args($args, $defaults); |
|
188 | + $atts=wp_parse_args($args, $defaults); |
|
189 | 189 | |
190 | - if (! empty($this->options[$atts['id']])) { |
|
191 | - $atts['value'] = $this->options[$atts['id']]; |
|
190 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
191 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
192 | 192 | } |
193 | 193 | |
194 | - if (empty($atts['aria']) && ! empty($atts['description'])) { |
|
195 | - $atts['aria'] = $atts['description']; |
|
196 | - } elseif (empty($atts['aria']) && ! empty($atts['label'])) { |
|
197 | - $atts['aria'] = $atts['label']; |
|
194 | + if (empty($atts[ 'aria' ]) && !empty($atts[ 'description' ])) { |
|
195 | + $atts[ 'aria' ]=$atts[ 'description' ]; |
|
196 | + } elseif (empty($atts[ 'aria' ]) && !empty($atts[ 'label' ])) { |
|
197 | + $atts[ 'aria' ]=$atts[ 'label' ]; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-select.php'; |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function text($args) |
211 | 211 | { |
212 | - $defaults['placeholder'] = $defaults['description'] = $defaults['label'] = ''; |
|
213 | - $defaults['class'] = 'text widefat'; |
|
214 | - $defaults['name'] = $this->plugin_name . '-options[' . $args['id'] . ']'; |
|
215 | - $defaults['type'] = 'text'; |
|
216 | - $defaults['value'] = isset($args['value']) && ! empty($args['value']) ? $args['value'] : ''; |
|
212 | + $defaults[ 'placeholder' ]=$defaults[ 'description' ]=$defaults[ 'label' ]=''; |
|
213 | + $defaults[ 'class' ]='text widefat'; |
|
214 | + $defaults[ 'name' ]=$this->plugin_name . '-options[' . $args[ 'id' ] . ']'; |
|
215 | + $defaults[ 'type' ]='text'; |
|
216 | + $defaults[ 'value' ]=isset($args[ 'value' ]) && !empty($args[ 'value' ]) ? $args[ 'value' ] : ''; |
|
217 | 217 | |
218 | 218 | apply_filters($this->plugin_name . '-field-text-options-defaults', $defaults); |
219 | 219 | |
220 | - $atts = wp_parse_args($args, $defaults); |
|
220 | + $atts=wp_parse_args($args, $defaults); |
|
221 | 221 | |
222 | - if (! empty($this->options[$atts['id']])) { |
|
223 | - $atts['value'] = $this->options[$atts['id']]; |
|
222 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
223 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-text.php'; |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function textarea($args) |
237 | 237 | { |
238 | - $defaults['context'] = $defaults['description'] = $defaults['label'] = $defaults['placeholder'] = ''; |
|
239 | - $defaults['class'] = 'large-text'; |
|
240 | - $defaults['cols'] = 50; |
|
241 | - $defaults['name'] = $this->plugin_name . '-options[' . $args['id'] . ']'; |
|
242 | - $defaults['rows'] = 10; |
|
243 | - $defaults['value'] = isset($args['value']) && ! empty($args['value']) ? $args['value'] : ''; |
|
238 | + $defaults[ 'context' ]=$defaults[ 'description' ]=$defaults[ 'label' ]=$defaults[ 'placeholder' ]=''; |
|
239 | + $defaults[ 'class' ]='large-text'; |
|
240 | + $defaults[ 'cols' ]=50; |
|
241 | + $defaults[ 'name' ]=$this->plugin_name . '-options[' . $args[ 'id' ] . ']'; |
|
242 | + $defaults[ 'rows' ]=10; |
|
243 | + $defaults[ 'value' ]=isset($args[ 'value' ]) && !empty($args[ 'value' ]) ? $args[ 'value' ] : ''; |
|
244 | 244 | |
245 | 245 | apply_filters($this->plugin_name . '-field-textarea-options-defaults', $defaults); |
246 | 246 | |
247 | - $atts = wp_parse_args($args, $defaults); |
|
247 | + $atts=wp_parse_args($args, $defaults); |
|
248 | 248 | |
249 | - if (! empty($this->options[$atts['id']])) { |
|
250 | - $atts['value'] = $this->options[$atts['id']]; |
|
249 | + if (!empty($this->options[ $atts[ 'id' ] ])) { |
|
250 | + $atts[ 'value' ]=$this->options[ $atts[ 'id' ] ]; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | require plugin_dir_path(__FILE__) . 'partials/' . $this->plugin_name . '-field-textarea.php'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Value for default attributes which should be ignored. |
17 | 17 | */ |
18 | - const NO_VALUE_SET = -3.14159265359; |
|
18 | + const NO_VALUE_SET=-3.14159265359; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * The ID of this plugin. |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * @param mixed $data |
56 | 56 | * @param string $type |
57 | 57 | */ |
58 | - public function __construct($plugin_name, $version, $data = self::NO_VALUE_SET, $type = self::NO_VALUE_SET) |
|
58 | + public function __construct($plugin_name, $version, $data=self::NO_VALUE_SET, $type=self::NO_VALUE_SET) |
|
59 | 59 | { |
60 | - $this->plugin_name = $plugin_name; |
|
61 | - $this->version = $version; |
|
62 | - $this->data = $data == self::NO_VALUE_SET ? '' : $data; |
|
63 | - $this->type = $type == self::NO_VALUE_SET ? '' : $type; |
|
60 | + $this->plugin_name=$plugin_name; |
|
61 | + $this->version=$version; |
|
62 | + $this->data=$data == self::NO_VALUE_SET ? '' : $data; |
|
63 | + $this->type=$type == self::NO_VALUE_SET ? '' : $type; |
|
64 | 64 | |
65 | 65 | if ($this->version != WORDPRESS_SECURITY_TXT_VERSION) { |
66 | 66 | throw new Exception('Internal version mismatch in plugin wordpress-security-txt; it needs to be reinstalled.'); |
@@ -74,30 +74,30 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function clean() |
76 | 76 | { |
77 | - $sanitized = ''; |
|
78 | - |
|
79 | - if (in_array($this->type, ['color', 'radio', 'select'], true)) { |
|
80 | - $sanitized = $this->sanitize_random($this->data); |
|
81 | - } elseif (in_array($this->type, ['date', 'datetime', 'datetime-local', 'time', 'week'], true)) { |
|
82 | - $sanitized = $this->sanitize_wrapper($this->data, 'strtotime'); |
|
83 | - } elseif (in_array($this->type, ['number', 'range'], true)) { |
|
84 | - $sanitized = $this->sanitize_wrapper($this->data, 'intval'); |
|
85 | - } elseif (in_array($this->type, ['hidden', 'month', 'text'], true)) { |
|
86 | - $sanitized = $this->sanitize_wrapper($this->data, 'sanitize_text_field'); |
|
77 | + $sanitized=''; |
|
78 | + |
|
79 | + if (in_array($this->type, [ 'color', 'radio', 'select' ], true)) { |
|
80 | + $sanitized=$this->sanitize_random($this->data); |
|
81 | + } elseif (in_array($this->type, [ 'date', 'datetime', 'datetime-local', 'time', 'week' ], true)) { |
|
82 | + $sanitized=$this->sanitize_wrapper($this->data, 'strtotime'); |
|
83 | + } elseif (in_array($this->type, [ 'number', 'range' ], true)) { |
|
84 | + $sanitized=$this->sanitize_wrapper($this->data, 'intval'); |
|
85 | + } elseif (in_array($this->type, [ 'hidden', 'month', 'text' ], true)) { |
|
86 | + $sanitized=$this->sanitize_wrapper($this->data, 'sanitize_text_field'); |
|
87 | 87 | } elseif ($this->type == 'checkbox') { |
88 | - $sanitized = (isset($this->data) && ! is_null($this->data) ? true : false); |
|
88 | + $sanitized=(isset($this->data) && !is_null($this->data) ? true : false); |
|
89 | 89 | } elseif ($this->type == 'editor') { |
90 | - $sanitized = wp_kses_post($this->data); |
|
90 | + $sanitized=wp_kses_post($this->data); |
|
91 | 91 | } elseif ($this->type == 'email') { |
92 | - $sanitized = $this->sanitize_wrapper($this->data, 'sanitize_email'); |
|
92 | + $sanitized=$this->sanitize_wrapper($this->data, 'sanitize_email'); |
|
93 | 93 | } elseif ($this->type == 'file') { |
94 | - $sanitized = $this->sanitize_wrapper($this->data, 'sanitize_file_name'); |
|
94 | + $sanitized=$this->sanitize_wrapper($this->data, 'sanitize_file_name'); |
|
95 | 95 | } elseif ($this->type == 'tel') { |
96 | - $sanitized = $this->sanitize_phone($this->data); |
|
96 | + $sanitized=$this->sanitize_phone($this->data); |
|
97 | 97 | } elseif ($this->type == 'textarea') { |
98 | - $sanitized = $this->sanitize_wrapper($this->data, 'esc_textarea'); |
|
98 | + $sanitized=$this->sanitize_wrapper($this->data, 'esc_textarea'); |
|
99 | 99 | } elseif ($this->type == 'url') { |
100 | - $sanitized = $this->sanitize_wrapper($this->data, 'esc_url'); |
|
100 | + $sanitized=$this->sanitize_wrapper($this->data, 'esc_url'); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $sanitized; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function sanitize_random($input) |
114 | 114 | { |
115 | - $one = trim($input); |
|
116 | - $two = stripslashes($one); |
|
117 | - $return = htmlspecialchars($two); |
|
115 | + $one=trim($input); |
|
116 | + $two=stripslashes($one); |
|
117 | + $return=htmlspecialchars($two); |
|
118 | 118 | |
119 | 119 | return $return; |
120 | 120 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function set_data($data) |
157 | 157 | { |
158 | - $this->data = $data; |
|
158 | + $this->data=$data; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function set_type($type) |
167 | 167 | { |
168 | - $check = ''; |
|
168 | + $check=''; |
|
169 | 169 | |
170 | 170 | if (empty($type)) { |
171 | - $check = new WP_Error('forgot_type', |
|
171 | + $check=new WP_Error('forgot_type', |
|
172 | 172 | __('Specify the data type to sanitize.', $this->plugin_name)); |
173 | 173 | } |
174 | 174 | |
@@ -176,6 +176,6 @@ discard block |
||
176 | 176 | wp_die($check->get_error_message(), __('Forgot data type.', $this->plugin_name)); |
177 | 177 | } |
178 | 178 | |
179 | - $this->type = $type; |
|
179 | + $this->type=$type; |
|
180 | 180 | } |
181 | 181 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // If this file is called directly, abort. |
26 | -if (! defined('WPINC')) { |
|
26 | +if (!defined('WPINC')) { |
|
27 | 27 | die; |
28 | 28 | } |
29 | 29 | |
30 | 30 | // Used for referring to the plugin file or basename |
31 | -if (! defined('WORDPRESS_SECURITY_TXT_FILE')) { |
|
31 | +if (!defined('WORDPRESS_SECURITY_TXT_FILE')) { |
|
32 | 32 | define('WORDPRESS_SECURITY_TXT_FILE', plugin_basename(__FILE__)); |
33 | 33 | } |
34 | 34 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function run_wordpress_security_txt() |
76 | 76 | { |
77 | - $plugin = new WordPress_Security_Txt(); |
|
77 | + $plugin=new WordPress_Security_Txt(); |
|
78 | 78 | $plugin->run(); |
79 | 79 | } |
80 | 80 |