PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.2.35
Plugin Detective – Troubleshooting Conflicts v1.2.35
1.2.35 1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 All 54 releases
← All changes | troubleshoot/troubleshoot.php +12 -7 1.2.24 → 1.2.35 View file →
@@ -32,9 +32,9 @@
32 32 *
33 33 * @var string
34 34 * @since 0.0.0
35 35 */
36 - const VERSION = '1.2.24';
36 + const VERSION = '1.2.35';
37 37
38 38 /**
39 39 * URL of plugin directory.
40 40 *
@@ -159,9 +159,10 @@
159 159 $desired_protocol = 'https';
160 160 } elseif ( !empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
161 161 $desired_protocol = 'https';
162 162 } elseif ( !empty( $_SERVER['protocol'] ) ) {
163 - $desired_protocol = strtolower( substr( $_SERVER["SERVER_PROTOCOL"], 0, 5 ) ) == 'https' ? 'https' : 'http';
163 + $server_protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_PROTOCOL'] ) ) : '';
164 + $desired_protocol = strtolower( substr( $server_protocol, 0, 5 ) ) == 'https' ? 'https' : 'http';
164 165 }
165 166 }
166 167
167 168 $url = $desired_protocol . '://' . substr( $url, $pos_of_colon_slash_slash + 3 );
@@ -175,9 +176,10 @@
175 176 return $url;
176 177 }
177 178
178 179 if ( $should_be_www === null ) {
179 - if ( strpos( $_SERVER['HTTP_HOST'], 'www.' ) === 0 ) {
180 + $http_host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
181 + if ( strpos( $http_host, 'www.' ) === 0 ) {
180 182 $should_be_www = true;
181 183 } else {
182 184 $should_be_www = false;
183 185 }
@@ -265,8 +267,9 @@
265 267 return;
266 268 }
267 269
268 270 // Load translated strings for plugin.
271 + // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Standalone troubleshooter bootstrap; WordPress's automatic just-in-time textdomain loading does not run in this context.
269 272 load_plugin_textdomain( 'plugin-detective', false, dirname( $this->basename ) . '/languages/' );
270 273
271 274
272 275 // Initialize plugin classes.
@@ -333,9 +336,10 @@
333 336 */
334 337 public function requirements_not_met_notice() {
335 338
336 339 // Compile default message.
337 - $default_message = sprintf( __( 'Troubleshoot is missing requirements and has been <a href="%s">deactivated</a>. Please make sure all requirements are available.', 'troubleshoot' ), admin_url( 'plugins.php' ) );
340 + /* translators: %s: URL of the WordPress plugins admin page. */
341 + $default_message = sprintf( __( 'Troubleshoot is missing requirements and has been <a href="%s">deactivated</a>. Please make sure all requirements are available.', 'plugin-detective' ), admin_url( 'plugins.php' ) );
338 342
339 343 // Default details to null.
340 344 $details = null;
341 345
@@ -380,9 +384,9 @@
380 384 case 'clues':
381 385 case 'detective':
382 386 return $this->$field;
383 387 default:
384 - throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . $field );
388 + throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . esc_html( $field ) );
385 389 }
386 390 }
387 391
388 392 /**
@@ -442,10 +446,11 @@
442 446 public function delete_maintenance_file() {
443 447 if (is_user_logged_in() && current_user_can('manage_options')) {
444 448 // remove .maintenance file
445 449 $filename = ABSPATH . '.maintenance';
446 - if (file_exists($filename)) {
447 - return unlink($filename);
450 + if ( file_exists( $filename ) ) {
451 + wp_delete_file( $filename );
452 + return ! file_exists( $filename );
448 453 }
449 454 }
450 455 return false;
451 456 }