Skip to content

Commit acfdc22

Browse files
Move wp_get_update_api_base
1 parent ad0cf43 commit acfdc22

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

src/wp-admin/includes/update.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,39 +1125,3 @@ function wp_get_auto_update_message() {
11251125

11261126
return $message;
11271127
}
1128-
1129-
/**
1130-
* Returns the base URL in use for the wordpress.org API. Defaults to http://api.wordpress.org .
1131-
*
1132-
* This URL can be overridden by specifying an environment variable `WP_UPDATE_API_BASE` or
1133-
* by using the {@see wp_update_api_base} filter. Providing an empty URL is not allowed and
1134-
* will result in the default being used.
1135-
*
1136-
* @since 6.8.0
1137-
*
1138-
* @param bool $https Whether requests should use https instead of http, defaults to true.
1139-
* @return string The base URL in use for the wordpress.org update API.
1140-
*/
1141-
function wp_get_update_api_base( $https = true ) {
1142-
$api_base = WP_UPDATE_API_DEFAULT;
1143-
1144-
if ( false !== getenv('WP_UPDATE_API_BASE') ) {
1145-
$api_base = getenv('WP_UPDATE_API_BASE');
1146-
}
1147-
1148-
/**
1149-
* Filters the base URL used for wordpress.org API requests.
1150-
*
1151-
* @since 6.8.0
1152-
*
1153-
* @param string $content Default text.
1154-
*/
1155-
$api_base = apply_filters( 'wp_update_api_base', $api_base );
1156-
1157-
// required for back-compat as many old api references in core use http:// explicitly
1158-
if ( (! $https) && (substr($api_base, 0, 7) == 'http://') && ($api_base === WP_UPDATE_API_DEFAULT)) {
1159-
$api_base = str_replace( $api_base, 'http://', 'https://' );
1160-
}
1161-
1162-
return $api_base;
1163-
}

src/wp-includes/functions.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9221,3 +9221,39 @@ function wp_verify_fast_hash(
92219221

92229222
return hash_equals( $hash, wp_fast_hash( $message ) );
92239223
}
9224+
9225+
/**
9226+
* Returns the base URL in use for the wordpress.org API. Defaults to http://api.wordpress.org .
9227+
*
9228+
* This URL can be overridden by specifying an environment variable `WP_UPDATE_API_BASE` or
9229+
* by using the {@see wp_update_api_base} filter. Providing an empty URL is not allowed and
9230+
* will result in the default being used.
9231+
*
9232+
* @since 7.0.0
9233+
*
9234+
* @param bool $https Whether requests should use https instead of http, defaults to true.
9235+
* @return string The base URL in use for the wordpress.org update API.
9236+
*/
9237+
function wp_get_update_api_base( $https = true ) {
9238+
$api_base = WP_UPDATE_API_DEFAULT;
9239+
9240+
if ( false !== getenv('WP_UPDATE_API_BASE') ) {
9241+
$api_base = getenv('WP_UPDATE_API_BASE');
9242+
}
9243+
9244+
/**
9245+
* Filters the base URL used for wordpress.org API requests.
9246+
*
9247+
* @since 7.0.0
9248+
*
9249+
* @param string $content Default text.
9250+
*/
9251+
$api_base = apply_filters( 'wp_update_api_base', $api_base );
9252+
9253+
// required for back-compat as many old api references in core use http:// explicitly
9254+
if ( (! $https) && (substr($api_base, 0, 7) == 'http://') && ($api_base === WP_UPDATE_API_DEFAULT)) {
9255+
$api_base = str_replace( $api_base, 'http://', 'https://' );
9256+
}
9257+
9258+
return $api_base;
9259+
}

0 commit comments

Comments
 (0)