From 40706838a1cbb34a40048b891a28d1f9af62d1e3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Oct 2017 21:27:22 +0000 Subject: [PATCH] Rewrite Rules: Remove redundant `if` condition in `extract_from_markers()`. Props Dency, yahil, appchecker. Fixes #39920. git-svn-id: https://develop.svn.wordpress.org/trunk@41928 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/misc.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 5cf0e21f28..7b2301a2a9 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -67,20 +67,22 @@ function got_url_rewrite() { function extract_from_markers( $filename, $marker ) { $result = array (); - if (!file_exists( $filename ) ) { + if ( ! file_exists( $filename ) ) { return $result; } - if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) )); - { - $state = false; - foreach ( $markerdata as $markerline ) { - if (strpos($markerline, '# END ' . $marker) !== false) - $state = false; - if ( $state ) + $markerdata = explode( "\n", implode( '', file( $filename ) ) ); + + $state = false; + foreach ( $markerdata as $markerline ) { + if ( false !== strpos( $markerline, '# END ' . $marker ) ) { + $state = false; + if ( $state ) { $result[] = $markerline; - if (strpos($markerline, '# BEGIN ' . $marker) !== false) + } + if ( false !== strpos( $markerline, '# BEGIN ' . $marker ) ) { $state = true; + } } }