rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -39,6 +39,7 @@ function _wp_http_get_object() {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_safe_remote_request( $url, $args = array() ) {
@@ -60,6 +61,7 @@ function wp_safe_remote_request( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_safe_remote_get( $url, $args = array() ) {
@@ -81,6 +83,7 @@ function wp_safe_remote_get( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_safe_remote_post( $url, $args = array() ) {
@@ -102,6 +105,7 @@ function wp_safe_remote_post( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_safe_remote_head( $url, $args = array() ) {
@@ -125,6 +129,7 @@ function wp_safe_remote_head( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error {
* The response array or a WP_Error on failure.
*
@@ -155,6 +160,7 @@ function wp_remote_request( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_remote_get( $url, $args = array() ) {
@@ -172,6 +178,7 @@ function wp_remote_get( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_remote_post( $url, $args = array() ) {
@@ -189,6 +196,7 @@ function wp_remote_post( $url, $args = array() ) {
*
* @param string $url URL to retrieve.
* @param array $args Optional. Request arguments. Default empty array.
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
*/
function wp_remote_head( $url, $args = array() ) {
@@ -372,7 +380,7 @@ function wp_http_supports( $capabilities = array(), $url = null ) {
$count = count( $capabilities );
// If we have a numeric $capabilities array, spoof a wp_remote_request() associative $args array.
if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) == $count ) {
if ( $count && count( array_filter( array_keys( $capabilities ), 'is_numeric' ) ) === $count ) {
$capabilities = array_combine( array_values( $capabilities ), array_fill( 0, $count, true ) );
}
@@ -593,7 +601,7 @@ function wp_http_validate_url( $url ) {
*
* @since 5.9.0
*
* @param array $allowed_ports Array of integers for valid ports.
* @param int[] $allowed_ports Array of integers for valid ports.
* @param string $host Host name of the requested URL.
* @param string $url Requested URL.
*/
@@ -686,10 +694,10 @@ function wp_parse_url( $url, $component = -1 ) {
$to_unset = array();
$url = (string) $url;
if ( '//' === substr( $url, 0, 2 ) ) {
if ( str_starts_with( $url, '//' ) ) {
$to_unset[] = 'scheme';
$url = 'placeholder:' . $url;
} elseif ( '/' === substr( $url, 0, 1 ) ) {
} elseif ( str_starts_with( $url, '/' ) ) {
$to_unset[] = 'scheme';
$to_unset[] = 'host';
$url = 'placeholder://placeholder' . $url;