Update WP and plugins
This commit is contained in:
parent
10a4713229
commit
1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions
|
@ -52,7 +52,7 @@ class WP_HTTP_Proxy {
|
|||
* @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 @@ class WP_HTTP_Proxy {
|
|||
* @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 @@ class WP_HTTP_Proxy {
|
|||
* @return string
|
||||
*/
|
||||
public function host() {
|
||||
if ( defined('WP_PROXY_HOST') )
|
||||
if ( defined( 'WP_PROXY_HOST' ) ) {
|
||||
return WP_PROXY_HOST;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -91,8 +92,9 @@ class WP_HTTP_Proxy {
|
|||
* @return string
|
||||
*/
|
||||
public function port() {
|
||||
if ( defined('WP_PROXY_PORT') )
|
||||
if ( defined( 'WP_PROXY_PORT' ) ) {
|
||||
return WP_PROXY_PORT;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -105,8 +107,9 @@ class WP_HTTP_Proxy {
|
|||
* @return string
|
||||
*/
|
||||
public function username() {
|
||||
if ( defined('WP_PROXY_USERNAME') )
|
||||
if ( defined( 'WP_PROXY_USERNAME' ) ) {
|
||||
return WP_PROXY_USERNAME;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -119,8 +122,9 @@ class WP_HTTP_Proxy {
|
|||
* @return string
|
||||
*/
|
||||
public function password() {
|
||||
if ( defined('WP_PROXY_PASSWORD') )
|
||||
if ( defined( 'WP_PROXY_PASSWORD' ) ) {
|
||||
return WP_PROXY_PASSWORD;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -167,13 +171,14 @@ class WP_HTTP_Proxy {
|
|||
* 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 @@ class WP_HTTP_Proxy {
|
|||
* @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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue