diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/class-wp-http-proxy.php --- a/wp/wp-includes/class-wp-http-proxy.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/class-wp-http-proxy.php Mon Oct 14 18:28:13 2019 +0200 @@ -52,7 +52,7 @@ * @return bool */ public function is_enabled() { - return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT'); + return defined( 'WP_PROXY_HOST' ) && defined( 'WP_PROXY_PORT' ); } /** @@ -66,7 +66,7 @@ * @return bool */ public function use_authentication() { - return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD'); + return defined( 'WP_PROXY_USERNAME' ) && defined( 'WP_PROXY_PASSWORD' ); } /** @@ -77,8 +77,9 @@ * @return string */ public function host() { - if ( defined('WP_PROXY_HOST') ) + if ( defined( 'WP_PROXY_HOST' ) ) { return WP_PROXY_HOST; + } return ''; } @@ -91,8 +92,9 @@ * @return string */ public function port() { - if ( defined('WP_PROXY_PORT') ) + if ( defined( 'WP_PROXY_PORT' ) ) { return WP_PROXY_PORT; + } return ''; } @@ -105,8 +107,9 @@ * @return string */ public function username() { - if ( defined('WP_PROXY_USERNAME') ) + if ( defined( 'WP_PROXY_USERNAME' ) ) { return WP_PROXY_USERNAME; + } return ''; } @@ -119,8 +122,9 @@ * @return string */ public function password() { - if ( defined('WP_PROXY_PASSWORD') ) + if ( defined( 'WP_PROXY_PASSWORD' ) ) { return WP_PROXY_PASSWORD; + } return ''; } @@ -167,13 +171,14 @@ * parse_url() only handles http, https type URLs, and will emit E_WARNING on failure. * This will be displayed on sites, which is not reasonable. */ - $check = @parse_url($uri); + $check = @parse_url( $uri ); // Malformed URL, can not process, but this could mean ssl, so let through anyway. - if ( $check === false ) + if ( $check === false ) { return true; + } - $home = parse_url( get_option('siteurl') ); + $home = parse_url( get_option( 'siteurl' ) ); /** * Filters whether to preempt sending the request through the proxy server. @@ -189,31 +194,36 @@ * @param array $home Associative array result of parsing the site URL. */ $result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home ); - if ( ! is_null( $result ) ) + if ( ! is_null( $result ) ) { return $result; + } - if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) + if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) { return false; + } - if ( !defined('WP_PROXY_BYPASS_HOSTS') ) + if ( ! defined( 'WP_PROXY_BYPASS_HOSTS' ) ) { return true; + } - static $bypass_hosts = null; + static $bypass_hosts = null; static $wildcard_regex = array(); if ( null === $bypass_hosts ) { - $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS); + $bypass_hosts = preg_split( '|,\s*|', WP_PROXY_BYPASS_HOSTS ); - if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) { + if ( false !== strpos( WP_PROXY_BYPASS_HOSTS, '*' ) ) { $wildcard_regex = array(); - foreach ( $bypass_hosts as $host ) + foreach ( $bypass_hosts as $host ) { $wildcard_regex[] = str_replace( '\*', '.+', preg_quote( $host, '/' ) ); - $wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i'; + } + $wildcard_regex = '/^(' . implode( '|', $wildcard_regex ) . ')$/i'; } } - if ( !empty($wildcard_regex) ) - return !preg_match($wildcard_regex, $check['host']); - else - return !in_array( $check['host'], $bypass_hosts ); + if ( ! empty( $wildcard_regex ) ) { + return ! preg_match( $wildcard_regex, $check['host'] ); + } else { + return ! in_array( $check['host'], $bypass_hosts ); + } } }