@@ -179,7 +179,7 @@ |
||
| 179 | 179 | $this->loader->add_action('admin_init', $plugin_admin, 'register_sections'); |
| 180 | 180 | $this->loader->add_action('admin_init', $plugin_admin, 'register_fields'); |
| 181 | 181 | $this->loader->add_filter('plugin_action_links_' . WORDPRESS_SECURITY_TXT_FILE, $plugin_admin, |
| 182 | - 'link_settings'); |
|
| 182 | + 'link_settings'); |
|
| 183 | 183 | $this->loader->add_action('plugin_row_meta', $plugin_admin, 'link_row', 10, 2); |
| 184 | 184 | $this->loader->add_action('wp_before_admin_bar_render', $plugin_admin, 'admin_bar'); |
| 185 | 185 | } |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | public function __construct() |
| 71 | 71 | { |
| 72 | 72 | if (defined('WORDPRESS_SECURITY_TXT_VERSION')) { |
| 73 | - $this->version = WORDPRESS_SECURITY_TXT_VERSION; |
|
| 73 | + $this->version=WORDPRESS_SECURITY_TXT_VERSION; |
|
| 74 | 74 | } else { |
| 75 | - $this->version = '1.0.0'; |
|
| 75 | + $this->version='1.0.0'; |
|
| 76 | 76 | } |
| 77 | - $this->plugin_name = 'wordpress-security-txt'; |
|
| 77 | + $this->plugin_name='wordpress-security-txt'; |
|
| 78 | 78 | |
| 79 | 79 | $this->load_dependencies(); |
| 80 | 80 | $this->set_locale(); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | require_once plugin_dir_path(dirname(__FILE__)) . 'public/class-wordpress-security-txt-public.php'; |
| 141 | 141 | |
| 142 | - $this->loader = new WordPress_Security_Txt_Loader(); |
|
| 142 | + $this->loader=new WordPress_Security_Txt_Loader(); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | private function set_locale() |
| 155 | 155 | { |
| 156 | - $plugin_i18n = new WordPress_Security_Txt_i18n(); |
|
| 156 | + $plugin_i18n=new WordPress_Security_Txt_i18n(); |
|
| 157 | 157 | |
| 158 | 158 | $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
| 159 | 159 | } |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | private function define_admin_hooks() |
| 169 | 169 | { |
| 170 | - $plugin_admin = new WordPress_Security_Txt_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 170 | + $plugin_admin=new WordPress_Security_Txt_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 171 | 171 | |
| 172 | - if (isset($_GET['page']) && ($_GET['page'] == 'wordpress-security-txt' || $_GET['page'] == 'wordpress-security-txt-help')) { |
|
| 172 | + if (isset($_GET[ 'page' ]) && ($_GET[ 'page' ] == 'wordpress-security-txt' || $_GET[ 'page' ] == 'wordpress-security-txt-help')) { |
|
| 173 | 173 | $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
| 174 | 174 | $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
| 175 | 175 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | private function define_public_hooks() |
| 218 | 218 | { |
| 219 | - $plugin_public = new WordPress_Security_Txt_Public($this->get_plugin_name(), $this->get_version()); |
|
| 219 | + $plugin_public=new WordPress_Security_Txt_Public($this->get_plugin_name(), $this->get_version()); |
|
| 220 | 220 | |
| 221 | 221 | $this->loader->add_action('plugins_loaded', $plugin_public, 'route'); |
| 222 | 222 | } |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | * @since 1.0.0 |
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | - public static function event($name, $version = WORDPRESS_SECURITY_TXT_VERSION) |
|
| 230 | + public static function event($name, $version=WORDPRESS_SECURITY_TXT_VERSION) |
|
| 231 | 231 | { |
| 232 | - $options = WordPress_Security_Txt_Admin::get_options(); |
|
| 232 | + $options=WordPress_Security_Txt_Admin::get_options(); |
|
| 233 | 233 | |
| 234 | - if (isset($options['statistics']) && $options['statistics'] && extension_loaded('curl')) { |
|
| 235 | - $ch = curl_init('https://austinheap.com/projects/wordpress-security-txt/' . $name . '?version=' . $version); |
|
| 234 | + if (isset($options[ 'statistics' ]) && $options[ 'statistics' ] && extension_loaded('curl')) { |
|
| 235 | + $ch=curl_init('https://austinheap.com/projects/wordpress-security-txt/' . $name . '?version=' . $version); |
|
| 236 | 236 | |
| 237 | 237 | curl_setopt($ch, CURLOPT_VERBOSE, false); |
| 238 | 238 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | curl_setopt($ch, CURLOPT_TIMEOUT, 5); |
| 241 | 241 | curl_setopt($ch, CURLOPT_MAXREDIRS, 1); |
| 242 | 242 | |
| 243 | - $co = curl_exec($ch); |
|
| 243 | + $co=curl_exec($ch); |
|
| 244 | 244 | |
| 245 | 245 | unset($co); |
| 246 | 246 | } |
@@ -137,10 +137,10 @@ |
||
| 137 | 137 | <li><strong>File Size</strong>: |
| 138 | 138 | <code><?php echo filesize(WordPress_Security_Txt_Public::cache_file()); ?> bytes</code></li> |
| 139 | 139 | <li><strong>Creation Time</strong>: <code><?php echo date('c', |
| 140 | - filectime(WordPress_Security_Txt_Public::cache_file())); ?></code> |
|
| 140 | + filectime(WordPress_Security_Txt_Public::cache_file())); ?></code> |
|
| 141 | 141 | </li> |
| 142 | 142 | <li><strong>Modification Time</strong>: <code><?php echo date('c', |
| 143 | - filemtime(WordPress_Security_Txt_Public::cache_file())); ?></code> |
|
| 143 | + filemtime(WordPress_Security_Txt_Public::cache_file())); ?></code> |
|
| 144 | 144 | </li> |
| 145 | 145 | <?php |
| 146 | 146 | } ?> |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | <ul id="wordpress-security-txt-sections[debug][database]"> |
| 26 | 26 | <?php |
| 27 | 27 | foreach (WordPress_Security_Txt_Admin::get_options($this->plugin_name) as $key => $value) { |
| 28 | - if (! is_null($value)) { |
|
| 28 | + if (!is_null($value)) { |
|
| 29 | 29 | switch (gettype($value)) { |
| 30 | 30 | case 'boolean': |
| 31 | - $value = $value ? 'true' : 'false'; |
|
| 31 | + $value=$value ? 'true' : 'false'; |
|
| 32 | 32 | break; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | if (is_array($value)) { |
| 37 | 37 | ?> |
| 38 | - <li><strong><?php echo $key; ?></strong>: <?php if (! is_null($value)) { |
|
| 38 | + <li><strong><?php echo $key; ?></strong>: <?php if (!is_null($value)) { |
|
| 39 | 39 | ?> |
| 40 | 40 | <code>[count: <?php echo count($value); ?>]</code> <?php |
| 41 | 41 | } ?> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | foreach ($value as $sub_key => $sub_value) { |
| 46 | 46 | if (is_array($sub_value)) { |
| 47 | 47 | ?> |
| 48 | - <li><strong><?php echo $sub_key; ?></strong>: <?php if (! is_null($sub_value)) { |
|
| 48 | + <li><strong><?php echo $sub_key; ?></strong>: <?php if (!is_null($sub_value)) { |
|
| 49 | 49 | ?> |
| 50 | 50 | <code>[count: <?php echo count($sub_value); ?>]</code> <?php |
| 51 | 51 | } ?> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (is_array($sub_sub_value)) { |
| 58 | 58 | ?> |
| 59 | 59 | <li> |
| 60 | - <strong><?php echo $sub_sub_key; ?></strong>: <?php if (! is_null($sub_sub_value)) { |
|
| 60 | + <strong><?php echo $sub_sub_key; ?></strong>: <?php if (!is_null($sub_sub_value)) { |
|
| 61 | 61 | ?> |
| 62 | 62 | <code>[count: <?php echo count($sub_sub_value); ?> |
| 63 | 63 | ]</code> <?php |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } else { |
| 76 | 76 | ?> |
| 77 | 77 | <li> |
| 78 | - <strong><?php echo $sub_sub_key; ?></strong>: <?php if (! is_null($sub_sub_value)) { |
|
| 78 | + <strong><?php echo $sub_sub_key; ?></strong>: <?php if (!is_null($sub_sub_value)) { |
|
| 79 | 79 | ?> |
| 80 | 80 | <code><?php echo $sub_sub_value; ?></code> <?php |
| 81 | 81 | } ?> |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | <?php |
| 89 | 89 | } else { |
| 90 | 90 | ?> |
| 91 | - <li><strong><?php echo $key; ?></strong>: <?php if (! is_null($value)) { |
|
| 91 | + <li><strong><?php echo $key; ?></strong>: <?php if (!is_null($value)) { |
|
| 92 | 92 | ?> |
| 93 | 93 | <code><?php echo $value; ?></code> <?php |
| 94 | 94 | } ?> |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | <?php |
| 103 | 103 | } else { |
| 104 | 104 | ?> |
| 105 | - <li><strong><?php echo $key; ?></strong>: <?php if (! is_null($value)) { |
|
| 105 | + <li><strong><?php echo $key; ?></strong>: <?php if (!is_null($value)) { |
|
| 106 | 106 | ?> |
| 107 | 107 | <code><?php echo strlen($value) > 255 ? substr($value, 0, 36) : $value; ?></code><?php echo strlen($value) > 255 ? '...' : ''; ?> <?php |
| 108 | 108 | } ?>(<em><?php echo gettype($value); ?></em>) |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | <p>Details for plugin cache on the WordPress filesystem <code><?php echo get_temp_dir(); ?></code> for <code>wordpress-security-txt</code>: |
| 118 | 118 | </p> |
| 119 | 119 | <ul id="wordpress-security-txt-sections[debug][cache]"> |
| 120 | - <li><strong>Enabled</strong>: <?php if (! is_null($this->options['cache'])) { |
|
| 120 | + <li><strong>Enabled</strong>: <?php if (!is_null($this->options[ 'cache' ])) { |
|
| 121 | 121 | ?> |
| 122 | - <code><?php echo $this->options['cache'] ? 'true' : 'false'; ?></code> <?php |
|
| 122 | + <code><?php echo $this->options[ 'cache' ] ? 'true' : 'false'; ?></code> <?php |
|
| 123 | 123 | } ?> |
| 124 | - (<em><?php echo gettype($this->options['debug']); ?></em>) |
|
| 124 | + (<em><?php echo gettype($this->options[ 'debug' ]); ?></em>) |
|
| 125 | 125 | </li> |
| 126 | - <?php if (isset($this->options['cache']) && $this->options['cache']) { |
|
| 126 | + <?php if (isset($this->options[ 'cache' ]) && $this->options[ 'cache' ]) { |
|
| 127 | 127 | ?> |
| 128 | 128 | <li><strong>Location</strong>: <code><?php echo WordPress_Security_Txt_Public::cache_file(); ?></code></li> |
| 129 | 129 | <li><strong>Cleared</strong>: |
@@ -269,13 +269,13 @@ |
||
| 269 | 269 | 'value' => isset($this->options['disclosure']) ? $this->options['disclosure'] : 'default', |
| 270 | 270 | 'selections' => [ |
| 271 | 271 | ['value' => 'default', |
| 272 | - 'label' => 'Default — do not include the "Disclosure" directive'], |
|
| 272 | + 'label' => 'Default — do not include the "Disclosure" directive'], |
|
| 273 | 273 | ['value' => 'full', |
| 274 | - 'label' => 'Full — you will fully disclose reports after the issue has been resolved'], |
|
| 274 | + 'label' => 'Full — you will fully disclose reports after the issue has been resolved'], |
|
| 275 | 275 | ['value' => 'partial', |
| 276 | - 'label' => 'Partial — you will partially disclose reports after the issue has been resolved'], |
|
| 276 | + 'label' => 'Partial — you will partially disclose reports after the issue has been resolved'], |
|
| 277 | 277 | ['value' => 'none', |
| 278 | - 'label' => 'None — you do not want to disclose reports after the issue has been resolved'], |
|
| 278 | + 'label' => 'None — you do not want to disclose reports after the issue has been resolved'], |
|
| 279 | 279 | ], |
| 280 | 280 | ] |
| 281 | 281 | ); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @access private |
| 63 | 63 | * @var array $available_fields The fields this class can build. |
| 64 | 64 | */ |
| 65 | - private static $available_fields = [ |
|
| 65 | + private static $available_fields=[ |
|
| 66 | 66 | 'enable', |
| 67 | 67 | 'menu', |
| 68 | 68 | 'redirect', |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct($plugin_name, $version, $options) |
| 89 | 89 | { |
| 90 | - $this->plugin_name = $plugin_name; |
|
| 91 | - $this->version = $version; |
|
| 92 | - $this->options = $options; |
|
| 93 | - $this->builder = new WordPress_Security_Txt_Builder($this->plugin_name, $this->version, $this->options); |
|
| 90 | + $this->plugin_name=$plugin_name; |
|
| 91 | + $this->version=$version; |
|
| 92 | + $this->options=$options; |
|
| 93 | + $this->builder=new WordPress_Security_Txt_Builder($this->plugin_name, $this->version, $this->options); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | add_settings_field( |
| 150 | 150 | 'enable', |
| 151 | 151 | apply_filters($this->plugin_name . 'label-enable', esc_html__('Enable', $this->plugin_name)), |
| 152 | - [$this->builder, 'checkbox'], |
|
| 152 | + [ $this->builder, 'checkbox' ], |
|
| 153 | 153 | $this->plugin_name, |
| 154 | 154 | $this->plugin_name . '-general', |
| 155 | 155 | [ |
| 156 | 156 | 'description' => 'Serve ' . get_site_url() . '/.well-known/security.txt on your WordPress site.', |
| 157 | 157 | 'id' => 'enable', |
| 158 | - 'value' => isset($this->options['enable']) ? $this->options['enable'] : false, |
|
| 158 | + 'value' => isset($this->options[ 'enable' ]) ? $this->options[ 'enable' ] : false, |
|
| 159 | 159 | ] |
| 160 | 160 | ); |
| 161 | 161 | } |
@@ -170,13 +170,13 @@ discard block |
||
| 170 | 170 | add_settings_field( |
| 171 | 171 | 'menu', |
| 172 | 172 | apply_filters($this->plugin_name . 'label-menu', esc_html__('Menu', $this->plugin_name)), |
| 173 | - [$this->builder, 'checkbox'], |
|
| 173 | + [ $this->builder, 'checkbox' ], |
|
| 174 | 174 | $this->plugin_name, |
| 175 | 175 | $this->plugin_name . '-general', |
| 176 | 176 | [ |
| 177 | 177 | 'description' => 'Show security.txt menu at the top of the WordPress admin interface. You should turn this off after you have the plugin configured.', |
| 178 | 178 | 'id' => 'menu', |
| 179 | - 'value' => isset($this->options['menu']) ? $this->options['menu'] : false, |
|
| 179 | + 'value' => isset($this->options[ 'menu' ]) ? $this->options[ 'menu' ] : false, |
|
| 180 | 180 | ] |
| 181 | 181 | ); |
| 182 | 182 | } |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | add_settings_field( |
| 192 | 192 | 'redirect', |
| 193 | 193 | apply_filters($this->plugin_name . 'label-redirect', esc_html__('Redirect', $this->plugin_name)), |
| 194 | - [$this->builder, 'checkbox'], |
|
| 194 | + [ $this->builder, 'checkbox' ], |
|
| 195 | 195 | $this->plugin_name, |
| 196 | 196 | $this->plugin_name . '-general', |
| 197 | 197 | [ |
| 198 | 198 | 'description' => 'Redirect requests for ' . get_site_url() . '/security.txt to ' . get_site_url() . '/.well-known/security.txt.', |
| 199 | 199 | 'id' => 'redirect', |
| 200 | 200 | 'class' => 'hide-when-disabled', |
| 201 | - 'value' => isset($this->options['redirect']) ? $this->options['redirect'] : false, |
|
| 201 | + 'value' => isset($this->options[ 'redirect' ]) ? $this->options[ 'redirect' ] : false, |
|
| 202 | 202 | ] |
| 203 | 203 | ); |
| 204 | 204 | } |
@@ -213,14 +213,14 @@ discard block |
||
| 213 | 213 | add_settings_field( |
| 214 | 214 | 'contact', |
| 215 | 215 | apply_filters($this->plugin_name . 'label-contact', esc_html__('Contact', $this->plugin_name)), |
| 216 | - [$this->builder, 'text'], |
|
| 216 | + [ $this->builder, 'text' ], |
|
| 217 | 217 | $this->plugin_name, |
| 218 | 218 | $this->plugin_name . '-directives', |
| 219 | 219 | [ |
| 220 | 220 | 'description' => 'Your contact address. Valid formats: e-mail, URL, phone number. (Required)', |
| 221 | 221 | 'id' => 'contact', |
| 222 | 222 | 'class' => 'text widefat hide-when-disabled', |
| 223 | - 'value' => isset($this->options['contact']) ? $this->options['contact'] : false, |
|
| 223 | + 'value' => isset($this->options[ 'contact' ]) ? $this->options[ 'contact' ] : false, |
|
| 224 | 224 | 'placeholder' => get_bloginfo('admin_email'), |
| 225 | 225 | ] |
| 226 | 226 | ); |
@@ -236,14 +236,14 @@ discard block |
||
| 236 | 236 | add_settings_field( |
| 237 | 237 | 'encryption', |
| 238 | 238 | apply_filters($this->plugin_name . 'label-encryption', esc_html__('Encryption', $this->plugin_name)), |
| 239 | - [$this->builder, 'textarea'], |
|
| 239 | + [ $this->builder, 'textarea' ], |
|
| 240 | 240 | $this->plugin_name, |
| 241 | 241 | $this->plugin_name . '-directives', |
| 242 | 242 | [ |
| 243 | 243 | 'description' => 'Your GPG public key. (Optional)', |
| 244 | 244 | 'id' => 'encryption', |
| 245 | 245 | 'class' => 'large-text hide-when-disabled', |
| 246 | - 'value' => isset($this->options['encryption']) ? $this->options['encryption'] : false, |
|
| 246 | + 'value' => isset($this->options[ 'encryption' ]) ? $this->options[ 'encryption' ] : false, |
|
| 247 | 247 | 'rows' => 5, |
| 248 | 248 | ] |
| 249 | 249 | ); |
@@ -259,23 +259,23 @@ discard block |
||
| 259 | 259 | add_settings_field( |
| 260 | 260 | 'disclosure', |
| 261 | 261 | apply_filters($this->plugin_name . 'label-disclosure', esc_html__('Disclosure', $this->plugin_name)), |
| 262 | - [$this->builder, 'select'], |
|
| 262 | + [ $this->builder, 'select' ], |
|
| 263 | 263 | $this->plugin_name, |
| 264 | 264 | $this->plugin_name . '-directives', |
| 265 | 265 | [ |
| 266 | 266 | 'description' => 'Your disclosure policy. (Optional)', |
| 267 | 267 | 'id' => 'disclosure', |
| 268 | 268 | 'class' => 'widefat hide-when-disabled', |
| 269 | - 'value' => isset($this->options['disclosure']) ? $this->options['disclosure'] : 'default', |
|
| 269 | + 'value' => isset($this->options[ 'disclosure' ]) ? $this->options[ 'disclosure' ] : 'default', |
|
| 270 | 270 | 'selections' => [ |
| 271 | - ['value' => 'default', |
|
| 272 | - 'label' => 'Default — do not include the "Disclosure" directive'], |
|
| 273 | - ['value' => 'full', |
|
| 274 | - 'label' => 'Full — you will fully disclose reports after the issue has been resolved'], |
|
| 275 | - ['value' => 'partial', |
|
| 276 | - 'label' => 'Partial — you will partially disclose reports after the issue has been resolved'], |
|
| 277 | - ['value' => 'none', |
|
| 278 | - 'label' => 'None — you do not want to disclose reports after the issue has been resolved'], |
|
| 271 | + [ 'value' => 'default', |
|
| 272 | + 'label' => 'Default — do not include the "Disclosure" directive' ], |
|
| 273 | + [ 'value' => 'full', |
|
| 274 | + 'label' => 'Full — you will fully disclose reports after the issue has been resolved' ], |
|
| 275 | + [ 'value' => 'partial', |
|
| 276 | + 'label' => 'Partial — you will partially disclose reports after the issue has been resolved' ], |
|
| 277 | + [ 'value' => 'none', |
|
| 278 | + 'label' => 'None — you do not want to disclose reports after the issue has been resolved' ], |
|
| 279 | 279 | ], |
| 280 | 280 | ] |
| 281 | 281 | ); |
@@ -292,14 +292,14 @@ discard block |
||
| 292 | 292 | 'acknowledgement', |
| 293 | 293 | apply_filters($this->plugin_name . 'label-acknowledgement', |
| 294 | 294 | esc_html__('Acknowledgement', $this->plugin_name)), |
| 295 | - [$this->builder, 'text'], |
|
| 295 | + [ $this->builder, 'text' ], |
|
| 296 | 296 | $this->plugin_name, |
| 297 | 297 | $this->plugin_name . '-directives', |
| 298 | 298 | [ |
| 299 | 299 | 'description' => 'Your acknowledgements URL. (Optional)', |
| 300 | 300 | 'id' => 'acknowledgement', |
| 301 | 301 | 'class' => 'text widefat hide-when-disabled', |
| 302 | - 'value' => isset($this->options['acknowledgement']) ? $this->options['acknowledgement'] : false, |
|
| 302 | + 'value' => isset($this->options[ 'acknowledgement' ]) ? $this->options[ 'acknowledgement' ] : false, |
|
| 303 | 303 | 'placeholder' => get_site_url() . '/security-hall-of-fame/', |
| 304 | 304 | ] |
| 305 | 305 | ); |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | add_settings_field( |
| 316 | 316 | 'cache', |
| 317 | 317 | apply_filters($this->plugin_name . 'label-cache', esc_html__('Cache', $this->plugin_name)), |
| 318 | - [$this->builder, 'checkbox'], |
|
| 318 | + [ $this->builder, 'checkbox' ], |
|
| 319 | 319 | $this->plugin_name, |
| 320 | 320 | $this->plugin_name . '-library', |
| 321 | 321 | [ |
| 322 | 322 | 'description' => 'Enable cacheing of your security.txt file.', |
| 323 | 323 | 'id' => 'cache', |
| 324 | 324 | 'class' => 'hide-when-disabled', |
| 325 | - 'value' => isset($this->options['cache']) ? $this->options['cache'] : false, |
|
| 325 | + 'value' => isset($this->options[ 'cache' ]) ? $this->options[ 'cache' ] : false, |
|
| 326 | 326 | ] |
| 327 | 327 | ); |
| 328 | 328 | } |
@@ -337,14 +337,14 @@ discard block |
||
| 337 | 337 | add_settings_field( |
| 338 | 338 | 'credits', |
| 339 | 339 | apply_filters($this->plugin_name . 'label-credits', esc_html__('Credits', $this->plugin_name)), |
| 340 | - [$this->builder, 'checkbox'], |
|
| 340 | + [ $this->builder, 'checkbox' ], |
|
| 341 | 341 | $this->plugin_name, |
| 342 | 342 | $this->plugin_name . '-library', |
| 343 | 343 | [ |
| 344 | 344 | 'description' => 'Enable credits at the bottom of your security.txt file.', |
| 345 | 345 | 'id' => 'credits', |
| 346 | 346 | 'class' => 'hide-when-disabled', |
| 347 | - 'value' => isset($this->options['credits']) ? $this->options['credits'] : false, |
|
| 347 | + 'value' => isset($this->options[ 'credits' ]) ? $this->options[ 'credits' ] : false, |
|
| 348 | 348 | ] |
| 349 | 349 | ); |
| 350 | 350 | } |
@@ -359,14 +359,14 @@ discard block |
||
| 359 | 359 | add_settings_field( |
| 360 | 360 | 'statistics', |
| 361 | 361 | apply_filters($this->plugin_name . 'label-statistics', esc_html__('Statistics', $this->plugin_name)), |
| 362 | - [$this->builder, 'checkbox'], |
|
| 362 | + [ $this->builder, 'checkbox' ], |
|
| 363 | 363 | $this->plugin_name, |
| 364 | 364 | $this->plugin_name . '-library', |
| 365 | 365 | [ |
| 366 | 366 | 'description' => 'Allow anonymous collection of plugin usage statistics.', |
| 367 | 367 | 'id' => 'statistics', |
| 368 | 368 | 'class' => 'hide-when-disabled', |
| 369 | - 'value' => isset($this->options['statistics']) ? $this->options['statistics'] : false, |
|
| 369 | + 'value' => isset($this->options[ 'statistics' ]) ? $this->options[ 'statistics' ] : false, |
|
| 370 | 370 | ] |
| 371 | 371 | ); |
| 372 | 372 | } |
@@ -381,14 +381,14 @@ discard block |
||
| 381 | 381 | add_settings_field( |
| 382 | 382 | 'debug', |
| 383 | 383 | apply_filters($this->plugin_name . 'label-debug', esc_html__('Debug', $this->plugin_name)), |
| 384 | - [$this->builder, 'checkbox'], |
|
| 384 | + [ $this->builder, 'checkbox' ], |
|
| 385 | 385 | $this->plugin_name, |
| 386 | 386 | $this->plugin_name . '-library', |
| 387 | 387 | [ |
| 388 | 388 | 'description' => 'Enable debug at the bottom of your security.txt file & this page.', |
| 389 | 389 | 'id' => 'debug', |
| 390 | 390 | 'class' => 'hide-when-disabled', |
| 391 | - 'value' => isset($this->options['debug']) ? $this->options['debug'] : false, |
|
| 391 | + 'value' => isset($this->options[ 'debug' ]) ? $this->options[ 'debug' ] : false, |
|
| 392 | 392 | ] |
| 393 | 393 | ); |
| 394 | 394 | } |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // If uninstall not called from WordPress, then exit. |
| 29 | -if (! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 29 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
| 30 | 30 | exit; |
| 31 | 31 | } |
@@ -262,7 +262,7 @@ |
||
| 262 | 262 | WordPress_Security_Txt::import_lib(); |
| 263 | 263 | |
| 264 | 264 | $writer = (new \AustinHeap\Security\Txt\Writer)->setDebug(isset($this->options['credits']) ? $this->options['credits'] : false) |
| 265 | - ->addContact($this->options['contact']); |
|
| 265 | + ->addContact($this->options['contact']); |
|
| 266 | 266 | |
| 267 | 267 | if (! empty($this->options['encryption'])) { |
| 268 | 268 | $writer->setEncryption(get_site_url() . '/.well-known/gpg.txt'); |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function __construct($plugin_name, $version) |
| 70 | 70 | { |
| 71 | - $this->plugin_name = $plugin_name; |
|
| 72 | - $this->version = $version; |
|
| 71 | + $this->plugin_name=$plugin_name; |
|
| 72 | + $this->version=$version; |
|
| 73 | 73 | |
| 74 | - self::$cache_cleared = get_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED'); |
|
| 74 | + self::$cache_cleared=get_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED'); |
|
| 75 | 75 | |
| 76 | 76 | if ($this->version != WORDPRESS_SECURITY_TXT_VERSION) { |
| 77 | 77 | throw new Exception('Internal version mismatch in plugin wordpress-security-txt; it needs to be reinstalled.'); |
@@ -85,18 +85,18 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function route() |
| 87 | 87 | { |
| 88 | - if (! isset($_SERVER) || ! isset($_SERVER['REQUEST_URI']) || ! isset($_SERVER['HTTP_HOST'])) { |
|
| 88 | + if (!isset($_SERVER) || !isset($_SERVER[ 'REQUEST_URI' ]) || !isset($_SERVER[ 'HTTP_HOST' ])) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $this->options = WordPress_Security_Txt_Admin::get_options($this->plugin_name); |
|
| 92 | + $this->options=WordPress_Security_Txt_Admin::get_options($this->plugin_name); |
|
| 93 | 93 | |
| 94 | - if (! is_array($this->options) || ! isset($this->options['enable']) || ! $this->options['enable']) { |
|
| 94 | + if (!is_array($this->options) || !isset($this->options[ 'enable' ]) || !$this->options[ 'enable' ]) { |
|
| 95 | 95 | return; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $request = ($this->is_secure() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 99 | - $site = get_site_url(); |
|
| 98 | + $request=($this->is_secure() ? 'https' : 'http') . '://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ]; |
|
| 99 | + $site=get_site_url(); |
|
| 100 | 100 | |
| 101 | 101 | if (strpos($request, $site) !== 0) { |
| 102 | 102 | return; |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function apply_routes($uri) |
| 114 | 114 | { |
| 115 | - $routes = [ |
|
| 116 | - '/security.txt' => ['method' => 'redirect', 'document' => 'security.txt'], |
|
| 117 | - '/.well-known/security.txt' => ['method' => 'show', 'document' => 'security.txt'], |
|
| 115 | + $routes=[ |
|
| 116 | + '/security.txt' => [ 'method' => 'redirect', 'document' => 'security.txt' ], |
|
| 117 | + '/.well-known/security.txt' => [ 'method' => 'show', 'document' => 'security.txt' ], |
|
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | - if (isset($this->options['encryption']) && isset($this->options['encryption'])) { |
|
| 121 | - $routes = array_merge($routes, [ |
|
| 122 | - '/gpg.txt' => ['method' => 'redirect', 'document' => 'gpg.txt'], |
|
| 123 | - '/.well-known/gpg.txt' => ['method' => 'show', 'document' => 'gpg.txt'], |
|
| 120 | + if (isset($this->options[ 'encryption' ]) && isset($this->options[ 'encryption' ])) { |
|
| 121 | + $routes=array_merge($routes, [ |
|
| 122 | + '/gpg.txt' => [ 'method' => 'redirect', 'document' => 'gpg.txt' ], |
|
| 123 | + '/.well-known/gpg.txt' => [ 'method' => 'show', 'document' => 'gpg.txt' ], |
|
| 124 | 124 | ]); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if (isset($routes[$uri])) { |
|
| 128 | - if ($routes[$uri]['method'] == 'redirect') { |
|
| 129 | - $this->redirect($routes[$uri]['document']); |
|
| 130 | - } elseif ($routes[$uri]['method'] == 'show') { |
|
| 131 | - $this->show($routes[$uri]['document']); |
|
| 127 | + if (isset($routes[ $uri ])) { |
|
| 128 | + if ($routes[ $uri ][ 'method' ] == 'redirect') { |
|
| 129 | + $this->redirect($routes[ $uri ][ 'document' ]); |
|
| 130 | + } elseif ($routes[ $uri ][ 'method' ] == 'show') { |
|
| 131 | + $this->show($routes[ $uri ][ 'document' ]); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | private function is_secure() |
| 143 | 143 | { |
| 144 | - return (! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443; |
|
| 144 | + return (!empty($_SERVER[ 'HTTPS' ]) && $_SERVER[ 'HTTPS' ] !== 'off') || $_SERVER[ 'SERVER_PORT' ] == 443; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public static function cache_clear() |
| 183 | 183 | { |
| 184 | - $cache_file = self::cache_file(); |
|
| 184 | + $cache_file=self::cache_file(); |
|
| 185 | 185 | |
| 186 | 186 | if (is_file($cache_file)) { |
| 187 | - $result = unlink($cache_file); |
|
| 187 | + $result=unlink($cache_file); |
|
| 188 | 188 | set_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED', $result, 5); |
| 189 | - self::$cache_cleared = get_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED'); |
|
| 189 | + self::$cache_cleared=get_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | return false; |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return bool |
| 201 | 201 | */ |
| 202 | - public static function cache_cleared($reset = false) |
|
| 202 | + public static function cache_cleared($reset=false) |
|
| 203 | 203 | { |
| 204 | - $result = is_null(self::$cache_cleared) ? false : self::$cache_cleared; |
|
| 204 | + $result=is_null(self::$cache_cleared) ? false : self::$cache_cleared; |
|
| 205 | 205 | |
| 206 | 206 | if ($reset) { |
| 207 | 207 | delete_transient('WORDPRESS_SECURITY_TXT_CACHE_CLEARED'); |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | private function show($document) |
| 223 | 223 | { |
| 224 | 224 | if ($document == 'security.txt') { |
| 225 | - $output = $this->render_security_txt(); |
|
| 225 | + $output=$this->render_security_txt(); |
|
| 226 | 226 | } elseif ($document == 'gpg.txt') { |
| 227 | - $output = $this->render_gpg_txt(); |
|
| 227 | + $output=$this->render_gpg_txt(); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if (empty($output)) { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | private function render_gpg_txt() |
| 248 | 248 | { |
| 249 | - return $this->options['encryption']; |
|
| 249 | + return $this->options[ 'encryption' ]; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -256,27 +256,27 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private function render_security_txt() |
| 258 | 258 | { |
| 259 | - $output = $this->get_security_txt_cache(); |
|
| 259 | + $output=$this->get_security_txt_cache(); |
|
| 260 | 260 | |
| 261 | 261 | if (empty($output)) { |
| 262 | 262 | WordPress_Security_Txt::import_lib(); |
| 263 | 263 | |
| 264 | - $writer = (new \AustinHeap\Security\Txt\Writer)->setDebug(isset($this->options['credits']) ? $this->options['credits'] : false) |
|
| 265 | - ->addContact($this->options['contact']); |
|
| 264 | + $writer=(new \AustinHeap\Security\Txt\Writer)->setDebug(isset($this->options[ 'credits' ]) ? $this->options[ 'credits' ] : false) |
|
| 265 | + ->addContact($this->options[ 'contact' ]); |
|
| 266 | 266 | |
| 267 | - if (! empty($this->options['encryption'])) { |
|
| 267 | + if (!empty($this->options[ 'encryption' ])) { |
|
| 268 | 268 | $writer->setEncryption(get_site_url() . '/.well-known/gpg.txt'); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if (! empty($this->options['disclosure']) && $this->options['disclosure'] != 'default') { |
|
| 272 | - $writer->setDisclosure($this->options['disclosure']); |
|
| 271 | + if (!empty($this->options[ 'disclosure' ]) && $this->options[ 'disclosure' ] != 'default') { |
|
| 272 | + $writer->setDisclosure($this->options[ 'disclosure' ]); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if (! empty($this->options['acknowledgement'])) { |
|
| 276 | - $writer->setAcknowledgement($this->options['acknowledgement']); |
|
| 275 | + if (!empty($this->options[ 'acknowledgement' ])) { |
|
| 276 | + $writer->setAcknowledgement($this->options[ 'acknowledgement' ]); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $output = $writer->generate()->getText(); |
|
| 279 | + $output=$writer->generate()->getText(); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $this->write_security_txt_cache($output); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | private function write_security_txt_cache($data) |
| 294 | 294 | { |
| 295 | - if (isset($this->options['cache']) && $this->options['cache']) { |
|
| 295 | + if (isset($this->options[ 'cache' ]) && $this->options[ 'cache' ]) { |
|
| 296 | 296 | file_put_contents(self::cache_file(), $data); |
| 297 | 297 | WordPress_Security_Txt::event('cache'); |
| 298 | 298 | } |
@@ -305,17 +305,17 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | private function get_security_txt_cache() |
| 307 | 307 | { |
| 308 | - $data = null; |
|
| 308 | + $data=null; |
|
| 309 | 309 | |
| 310 | - if (isset($this->options['cache']) && $this->options['cache']) { |
|
| 311 | - $cache_file = self::cache_file(); |
|
| 310 | + if (isset($this->options[ 'cache' ]) && $this->options[ 'cache' ]) { |
|
| 311 | + $cache_file=self::cache_file(); |
|
| 312 | 312 | |
| 313 | 313 | if (is_file($cache_file) && filemtime($cache_file) < time() - 86400) { |
| 314 | 314 | self::cache_clear(); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | if (is_readable($cache_file)) { |
| 318 | - $data = file_get_contents($cache_file); |
|
| 318 | + $data=file_get_contents($cache_file); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __construct() |
| 51 | 51 | { |
| 52 | - $this->actions = []; |
|
| 53 | - $this->filters = []; |
|
| 52 | + $this->actions=[ ]; |
|
| 53 | + $this->filters=[ ]; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
| 65 | 65 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
| 66 | 66 | */ |
| 67 | - public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) |
|
| 67 | + public function add_action($hook, $component, $callback, $priority=10, $accepted_args=1) |
|
| 68 | 68 | { |
| 69 | - $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 69 | + $this->actions=$this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) |
| 89 | 89 | { |
| 90 | - $hooks[] = [ |
|
| 90 | + $hooks[ ]=[ |
|
| 91 | 91 | 'hook' => $hook, |
| 92 | 92 | 'component' => $component, |
| 93 | 93 | 'callback' => $callback, |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
| 110 | 110 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
| 111 | 111 | */ |
| 112 | - public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) |
|
| 112 | + public function add_filter($hook, $component, $callback, $priority=10, $accepted_args=1) |
|
| 113 | 113 | { |
| 114 | - $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 114 | + $this->filters=$this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | public function run() |
| 123 | 123 | { |
| 124 | 124 | foreach ($this->filters as $hook) { |
| 125 | - add_filter($hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], |
|
| 126 | - $hook['accepted_args']); |
|
| 125 | + add_filter($hook[ 'hook' ], [ $hook[ 'component' ], $hook[ 'callback' ] ], $hook[ 'priority' ], |
|
| 126 | + $hook[ 'accepted_args' ]); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | foreach ($this->actions as $hook) { |
| 130 | - add_action($hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], |
|
| 131 | - $hook['accepted_args']); |
|
| 130 | + add_action($hook[ 'hook' ], [ $hook[ 'component' ], $hook[ 'callback' ] ], $hook[ 'priority' ], |
|
| 131 | + $hook[ 'accepted_args' ]); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -36,11 +36,11 @@ |
||
| 36 | 36 | |
| 37 | 37 | flush_rewrite_rules(); |
| 38 | 38 | |
| 39 | - $opts = []; |
|
| 40 | - $options = WordPress_Security_Txt_Admin::get_options_list(); |
|
| 39 | + $opts=[ ]; |
|
| 40 | + $options=WordPress_Security_Txt_Admin::get_options_list(); |
|
| 41 | 41 | |
| 42 | 42 | foreach ($options as $option) { |
| 43 | - $opts[ $option[0] ] = $option[2]; |
|
| 43 | + $opts[ $option[ 0 ] ]=$option[ 2 ]; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | update_option('wordpress-security-txt-options', $opts); |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function __construct($plugin_name, $version) |
| 60 | 60 | { |
| 61 | - $this->plugin_name = $plugin_name; |
|
| 62 | - $this->version = $version; |
|
| 63 | - $this->options = $this::get_options($plugin_name); |
|
| 61 | + $this->plugin_name=$plugin_name; |
|
| 62 | + $this->version=$version; |
|
| 63 | + $this->options=$this::get_options($plugin_name); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param string $plugin_name The name of the plugin. |
| 70 | 70 | */ |
| 71 | - public static function get_options($plugin_name = 'wordpress-security-txt') |
|
| 71 | + public static function get_options($plugin_name='wordpress-security-txt') |
|
| 72 | 72 | { |
| 73 | 73 | return get_option($plugin_name . '-options'); |
| 74 | 74 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function enqueue_styles() |
| 82 | 82 | { |
| 83 | - wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/' . $this->plugin_name . '-admin.css', [], |
|
| 83 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/' . $this->plugin_name . '-admin.css', [ ], |
|
| 84 | 84 | $this->version, 'all'); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | wp_enqueue_script($this->plugin_name . '-repeater', |
| 95 | 95 | plugin_dir_url(__FILE__) . 'js/' . $this->plugin_name . '-repeater.min.js', |
| 96 | - ['jquery', 'jquery-ui-core', 'jquery-ui-sortable'], $this->version, true); |
|
| 96 | + [ 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ], $this->version, true); |
|
| 97 | 97 | |
| 98 | 98 | wp_enqueue_script($this->plugin_name . '-validator', |
| 99 | 99 | plugin_dir_url(__FILE__) . 'js/' . $this->plugin_name . '-validator.js', |
| 100 | - ['jquery'], $this->version, true); |
|
| 100 | + [ 'jquery' ], $this->version, true); |
|
| 101 | 101 | |
| 102 | 102 | wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/' . $this->plugin_name . '-admin.js', |
| 103 | - ['jquery'], $this->version, true); |
|
| 103 | + [ 'jquery' ], $this->version, true); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | add_options_page( |
| 114 | 114 | __('security.txt', $this->plugin_name), __('security.txt', $this->plugin_name), |
| 115 | - 'manage_options', $this->plugin_name, [$this, 'display_settings_page'] |
|
| 115 | + 'manage_options', $this->plugin_name, [ $this, 'display_settings_page' ] |
|
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | add_submenu_page( |
| 119 | 119 | 'options-general.php', |
| 120 | 120 | __('security.txt Help', $this->plugin_name), __('security.txt Help', $this->plugin_name), |
| 121 | - 'manage_options', $this->plugin_name . '-help', [$this, 'display_help_page'] |
|
| 121 | + 'manage_options', $this->plugin_name . '-help', [ $this, 'display_help_page' ] |
|
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | remove_submenu_page('options-general.php', 'wordpress-security-txt-help'); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | add_settings_section( |
| 158 | 158 | $this->plugin_name . '-general', |
| 159 | 159 | apply_filters($this->plugin_name . 'section-title-general', esc_html__('General', $this->plugin_name)), |
| 160 | - [$this, 'section_general'], |
|
| 160 | + [ $this, 'section_general' ], |
|
| 161 | 161 | $this->plugin_name |
| 162 | 162 | ); |
| 163 | 163 | |
@@ -165,21 +165,21 @@ discard block |
||
| 165 | 165 | $this->plugin_name . '-directives', |
| 166 | 166 | apply_filters($this->plugin_name . 'section-title-directives', |
| 167 | 167 | esc_html__('Directives', $this->plugin_name)), |
| 168 | - [$this, 'section_directives'], |
|
| 168 | + [ $this, 'section_directives' ], |
|
| 169 | 169 | $this->plugin_name |
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | 172 | add_settings_section( |
| 173 | 173 | $this->plugin_name . '-library', |
| 174 | 174 | apply_filters($this->plugin_name . 'section-title-library', esc_html__('Library', $this->plugin_name)), |
| 175 | - [$this, 'section_library'], |
|
| 175 | + [ $this, 'section_library' ], |
|
| 176 | 176 | $this->plugin_name |
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | 179 | add_settings_section( |
| 180 | 180 | $this->plugin_name . '-debug', |
| 181 | 181 | apply_filters($this->plugin_name . 'section-title-debug', esc_html__('Debug', $this->plugin_name)), |
| 182 | - [$this, 'section_debug'], |
|
| 182 | + [ $this, 'section_debug' ], |
|
| 183 | 183 | $this->plugin_name |
| 184 | 184 | ); |
| 185 | 185 | } |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | public function register_settings() |
| 262 | 262 | { |
| 263 | 263 | register_setting( |
| 264 | - $this->plugin_name,// . '-options', |
|
| 264 | + $this->plugin_name, // . '-options', |
|
| 265 | 265 | $this->plugin_name . '-options', |
| 266 | - [$this, 'validate_options'] |
|
| 266 | + [ $this, 'validate_options' ] |
|
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -271,17 +271,17 @@ discard block |
||
| 271 | 271 | { |
| 272 | 272 | WordPress_Security_Txt_Public::cache_clear(); |
| 273 | 273 | |
| 274 | - $valid = []; |
|
| 275 | - $options = $this->get_options_list(); |
|
| 274 | + $valid=[ ]; |
|
| 275 | + $options=$this->get_options_list(); |
|
| 276 | 276 | |
| 277 | 277 | foreach ($options as $option) { |
| 278 | - $name = $option[0]; |
|
| 279 | - $type = $option[1]; |
|
| 278 | + $name=$option[ 0 ]; |
|
| 279 | + $type=$option[ 1 ]; |
|
| 280 | 280 | |
| 281 | - if ($type == 'repeater' && is_array($option[2])) { |
|
| 281 | + if ($type == 'repeater' && is_array($option[ 2 ])) { |
|
| 282 | 282 | $this->validate_repeater($input, $valid); |
| 283 | 283 | } else { |
| 284 | - $valid[$option[0]] = $this->sanitizer($type, isset($input[$name]) ? $input[$name] : null); |
|
| 284 | + $valid[ $option[ 0 ] ]=$this->sanitizer($type, isset($input[ $name ]) ? $input[ $name ] : null); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -290,22 +290,22 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | private function validate_repeater($input, &$valid) |
| 292 | 292 | { |
| 293 | - $clean = []; |
|
| 293 | + $clean=[ ]; |
|
| 294 | 294 | |
| 295 | - foreach ($option[2] as $field) { |
|
| 296 | - foreach ($input[$field[0]] as $data) { |
|
| 295 | + foreach ($option[ 2 ] as $field) { |
|
| 296 | + foreach ($input[ $field[ 0 ] ] as $data) { |
|
| 297 | 297 | if (!empty($data)) { |
| 298 | - $clean[$field[0]][] = $this->sanitizer($field[1], $data); |
|
| 298 | + $clean[ $field[ 0 ] ][ ]=$this->sanitizer($field[ 1 ], $data); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - $count = 10; |
|
| 303 | + $count=10; |
|
| 304 | 304 | |
| 305 | - for ($i = 0; $i < $count; $i++) { |
|
| 305 | + for ($i=0; $i < $count; $i++) { |
|
| 306 | 306 | foreach ($clean as $field_name => $field) { |
| 307 | - if (isset($valid[$option[0]][$i])) { |
|
| 308 | - $valid[$option[0]][$i][$field_name] = $field[$i]; |
|
| 307 | + if (isset($valid[ $option[ 0 ] ][ $i ])) { |
|
| 308 | + $valid[ $option[ 0 ] ][ $i ][ $field_name ]=$field[ $i ]; |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -318,19 +318,19 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public static function get_options_list() |
| 320 | 320 | { |
| 321 | - $options = []; |
|
| 322 | - |
|
| 323 | - $options[] = ['enable', 'checkbox', true]; |
|
| 324 | - $options[] = ['redirect', 'checkbox', true]; |
|
| 325 | - $options[] = ['menu', 'checkbox', true]; |
|
| 326 | - $options[] = ['contact', 'text', get_bloginfo('admin_email')]; |
|
| 327 | - $options[] = ['encryption', 'textarea', null]; |
|
| 328 | - $options[] = ['acknowledgement', 'text', null]; |
|
| 329 | - $options[] = ['disclosure', 'select', 'default']; |
|
| 330 | - $options[] = ['cache', 'checkbox', true]; |
|
| 331 | - $options[] = ['credits', 'checkbox', true]; |
|
| 332 | - $options[] = ['statistics', 'checkbox', false]; |
|
| 333 | - $options[] = ['debug', 'checkbox', false]; |
|
| 321 | + $options=[ ]; |
|
| 322 | + |
|
| 323 | + $options[ ]=[ 'enable', 'checkbox', true ]; |
|
| 324 | + $options[ ]=[ 'redirect', 'checkbox', true ]; |
|
| 325 | + $options[ ]=[ 'menu', 'checkbox', true ]; |
|
| 326 | + $options[ ]=[ 'contact', 'text', get_bloginfo('admin_email') ]; |
|
| 327 | + $options[ ]=[ 'encryption', 'textarea', null ]; |
|
| 328 | + $options[ ]=[ 'acknowledgement', 'text', null ]; |
|
| 329 | + $options[ ]=[ 'disclosure', 'select', 'default' ]; |
|
| 330 | + $options[ ]=[ 'cache', 'checkbox', true ]; |
|
| 331 | + $options[ ]=[ 'credits', 'checkbox', true ]; |
|
| 332 | + $options[ ]=[ 'statistics', 'checkbox', false ]; |
|
| 333 | + $options[ ]=[ 'debug', 'checkbox', false ]; |
|
| 334 | 334 | |
| 335 | 335 | return $options; |
| 336 | 336 | } |
@@ -357,8 +357,8 @@ discard block |
||
| 357 | 357 | public function link_row($links, $file) |
| 358 | 358 | { |
| 359 | 359 | if (WORDPRESS_SECURITY_TXT_FILE === $file) { |
| 360 | - $links[] = '<a href="http://twitter.com/austinheap">@austinheap</a>'; |
|
| 361 | - $links[] = '<a href="http://twitter.com/EdOverflow">@EdOverflow</a>'; |
|
| 360 | + $links[ ]='<a href="http://twitter.com/austinheap">@austinheap</a>'; |
|
| 361 | + $links[ ]='<a href="http://twitter.com/EdOverflow">@EdOverflow</a>'; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | return $links; |
@@ -375,11 +375,11 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function link_settings($links) |
| 377 | 377 | { |
| 378 | - $links[] = sprintf('<a href="%s">%s</a>', |
|
| 378 | + $links[ ]=sprintf('<a href="%s">%s</a>', |
|
| 379 | 379 | esc_url(admin_url('options-general.php?page=' . $this->plugin_name)), |
| 380 | 380 | esc_html__('Settings', $this->plugin_name)); |
| 381 | 381 | |
| 382 | - $links[] = sprintf('<a href="%s">%s</a>', |
|
| 382 | + $links[ ]=sprintf('<a href="%s">%s</a>', |
|
| 383 | 383 | esc_url(admin_url('options-general.php?page=' . $this->plugin_name . '-help')), |
| 384 | 384 | esc_html__('Help', $this->plugin_name)); |
| 385 | 385 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | public function admin_bar() |
| 396 | 396 | { |
| 397 | 397 | global $wp_admin_bar; |
| 398 | - if (isset($this->options['menu']) && $this->options['menu']) { |
|
| 398 | + if (isset($this->options[ 'menu' ]) && $this->options[ 'menu' ]) { |
|
| 399 | 399 | $wp_admin_bar->add_menu([ |
| 400 | 400 | 'id' => $this->plugin_name . '_root_toolbar', |
| 401 | 401 | 'title' => __('security.txt', $this->plugin_name), |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | 'primary', |
| 34 | 34 | 'wordpress-security-txt[submit]', |
| 35 | 35 | false, |
| 36 | - ['disabled' => 'disabled'] |
|
| 36 | + [ 'disabled' => 'disabled' ] |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | ?> |