plugin updates

This commit is contained in:
Tony Volpe
2024-10-24 12:57:16 -04:00
parent 8217f0dbed
commit 5e040c9234
399 changed files with 3377 additions and 46318 deletions

View File

@@ -537,3 +537,47 @@ function acf_upgrade_550_taxonomy( $taxonomy ) {
// action for 3rd party
do_action( 'acf/upgrade_550_taxonomy', $taxonomy );
}
/**
* Unsets ACF from reporting back to the WP.org API.
*
* @param array $args An array of HTTP request arguments.
* @param string $url The request URL.
* @return array|mixed
*/
function acf_unset_plugin_from_org_reporting( $args, $url ) {
// Bail if not a plugins request.
if ( empty( $args['body']['plugins'] ) ) {
return $args;
}
// Bail if not a request to the wp.org API.
$parsed_url = wp_parse_url( $url );
if ( empty( $parsed_url['host'] ) || 'api.wordpress.org' !== $parsed_url['host'] ) {
return $args;
}
$plugins = json_decode( $args['body']['plugins'], true );
if ( empty( $plugins ) ) {
return $args;
}
// Remove ACF from reporting.
if ( ! empty( $plugins['plugins'][ ACF_BASENAME ] ) ) {
unset( $plugins['plugins'][ ACF_BASENAME ] );
}
if ( ! empty( $plugins['active'] ) && is_array( $plugins['active'] ) ) {
$is_active = array_search( ACF_BASENAME, $plugins['active'], true );
if ( $is_active !== false ) {
unset( $plugins['active'][ $is_active ] );
$plugins['active'] = array_values( $plugins['active'] );
}
}
// Add the plugins list (minus ACF) back to $args.
$args['body']['plugins'] = wp_json_encode( $plugins );
return $args;
}
add_filter( 'http_request_args', 'acf_unset_plugin_from_org_reporting', 10, 2 );