if ( ! empty ( $_SERVER[ 'HTTP_ORIGIN' ] ) )
$origin = $_SERVER[ 'HTTP_ORIGIN' ];
+ /**
+ * Change the origin of an HTTP request.
+ *
+ * @since 3.4.0
+ *
+ * @param string $origin The original origin for the request.
+ */
return apply_filters( 'http_origin', $origin );
}
/**
- * Retrieve list of allowed http origins.
+ * Retrieve list of allowed HTTP origins.
*
* @since 3.4.0
*
'https://' . $home_origin[ 'host' ],
) );
+ /**
+ * Change the origin types allowed for HTTP requests.
+ *
+ * @since 3.4.0
+ *
+ * @param array $allowed_origins {
+ * Default allowed HTTP origins.
+ * @type string Non-secure URL for admin origin.
+ * @type string Secure URL for admin origin.
+ * @type string Non-secure URL for home origin.
+ * @type string Secure URL for home origin.
+ * }
+ */
return apply_filters( 'allowed_http_origins' , $allowed_origins );
}
/**
- * Determines if the http origin is an authorized one.
+ * Determines if the HTTP origin is an authorized one.
*
* @since 3.4.0
*
if ( $origin && ! in_array( $origin, get_allowed_http_origins() ) )
$origin = '';
+ /**
+ * Change the allowed HTTP origin result.
+ *
+ * @since 3.4.0
+ *
+ * @param string $origin Result of check for allowed origin.
+ * @param string $origin_arg original origin string passed into is_allowed_http_origin function.
+ */
return apply_filters( 'allowed_http_origin', $origin, $origin_arg );
}
|| ( 192 === $parts[0] && 168 === $parts[1] )
) {
// If host appears local, reject unless specifically allowed.
+ /**
+ * Check if HTTP request is external or not.
+ *
+ * Allows to change and allow external requests for the HTTP request.
+ *
+ * @since 3.6.0
+ *
+ * @param bool false Whether HTTP request is external or not.
+ * @param string $host IP of the requested host.
+ * @param string $url URL of the requested host.
+ */
if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) )
return false;
}
* @return bool
*/
function ms_allowed_http_request_hosts( $is_external, $host ) {
- global $wpdb, $current_site;
+ global $wpdb;
static $queried = array();
if ( $is_external )
return $is_external;
- if ( $host === $current_site->domain )
+ if ( $host === get_current_site()->domain )
return true;
if ( isset( $queried[ $host ] ) )
return $queried[ $host ];