Skip to content

Commit ed376e7

Browse files
author
ACF
committed
Updates to 6.5.1
1 parent 7cb3213 commit ed376e7

File tree

152 files changed

+350
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+350
-226
lines changed

acf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Plugin Name: Advanced Custom Fields PRO
1010
* Plugin URI: https://www.advancedcustomfields.com
1111
* Description: Customize WordPress with powerful, professional and intuitive fields.
12-
* Version: 6.5.0.1
12+
* Version: 6.5.1
1313
* Author: WP Engine
1414
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
1515
* Update URI: https://www.advancedcustomfields.com/pro
@@ -35,7 +35,7 @@ class ACF {
3535
*
3636
* @var string
3737
*/
38-
public $version = '6.5.0.1';
38+
public $version = '6.5.1';
3939

4040
/**
4141
* The plugin settings array.

assets/build/css/acf-global.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/css/pro/acf-pro-input.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/js/acf.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/build/js/pro/acf-pro-input.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 2 deletions
Loading

includes/Updater/Updater.php

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,46 @@ public function __construct() {
5454
return;
5555
}
5656

57-
// append update information to transient.
58-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'modify_plugins_transient' ), 10, 1 );
57+
// append update information to transient on both save and get.
58+
add_filter( 'site_transient_update_plugins', array( $this, 'modify_plugins_transient' ), 10, 1 );
59+
60+
// clear ACF transient when updates complete.
61+
add_filter( 'upgrader_process_complete', array( $this, 'clear_transients_on_upgrade' ), 5, 2 );
5962

6063
// modify plugin data visible in the 'View details' popup.
6164
add_filter( 'plugins_api', array( $this, 'modify_plugin_details' ), 10, 3 );
6265
}
6366

67+
/**
68+
* Clears ACF plugin update transients when ACF is updated.
69+
*
70+
* This method is hooked to the 'upgrader_process_complete' action and will
71+
* delete the 'acf_plugin_updates' transient when the ACF plugin is updated,
72+
* ensuring fresh update data is fetched on the next check.
73+
*
74+
* @since 6.5.1
75+
*
76+
* @param WP_Upgrader $upgrader_object The upgrader instance.
77+
* @param array $options Array of update details including:
78+
* - 'action' (string) The action performed (e.g., 'update').
79+
* - 'type' (string) The type of update (e.g., 'plugin').
80+
* - 'plugins' (array) Array of plugin basenames that were updated.
81+
*/
82+
public function clear_transients_on_upgrade( $upgrader_object, $options ) {
83+
// Check if this was a plugin update
84+
if ( $options['action'] === 'update' && $options['type'] === 'plugin' ) {
85+
// Check if we were one of the updated plugins
86+
if ( isset( $options['plugins'] ) ) {
87+
$acf_basename = acf_get_setting( 'basename' );
88+
if ( in_array( $acf_basename, $options['plugins'], true ) ) {
89+
$plugin = $this->get_plugin_by( 'basename', $acf_basename );
90+
$plugin_id = $plugin ? $plugin['id'] : false;
91+
$this->refresh_plugins_transient( $plugin_id );
92+
}
93+
}
94+
}
95+
}
96+
6497
/**
6598
* Registeres a plugin for updates.
6699
*
@@ -134,6 +167,16 @@ public function request( $endpoint = '', $body = null ) {
134167
'X-ACF-URL' => $site_url,
135168
);
136169

170+
// Add update channel header if defined.
171+
if ( defined( 'ACF_UPDATE_CHANNEL' ) && ACF_UPDATE_CHANNEL ) {
172+
$headers['X-ACF-Update-Channel'] = ACF_UPDATE_CHANNEL;
173+
}
174+
175+
// Add plugin override header if defined.
176+
if ( defined( 'ACF_RELEASE_ACCESS_KEY' ) && ACF_RELEASE_ACCESS_KEY ) {
177+
$headers['X-ACF-Release-Access-Key'] = ACF_RELEASE_ACCESS_KEY;
178+
}
179+
137180
$url = "https://connect.advancedcustomfields.com/$endpoint";
138181

139182
// Staging environment.
@@ -391,13 +434,19 @@ public function get_expiration( $response = false, $min = 10800, $max = 604800 )
391434
}
392435

393436
/**
394-
* Deletes transients and allows a fresh lookup.
437+
* Deletes cached ACF plugin update transients and allows a fresh lookup.
395438
*
396439
* @since 5.5.10
440+
*
441+
* @param string|false $id Optional. The plugin ID to clear specific plugin info transient.
442+
* If provided, will delete the 'acf_plugin_info_{id}' transient.
443+
* Defaults to false.
397444
*/
398-
public function refresh_plugins_transient() {
399-
delete_site_transient( 'update_plugins' );
445+
public function refresh_plugins_transient( $id = false ) {
400446
delete_transient( 'acf_plugin_updates' );
447+
if ( ! empty( $id ) && is_string( $id ) ) {
448+
delete_transient( 'acf_plugin_info_' . $id );
449+
}
401450
}
402451

403452
/**
@@ -409,11 +458,6 @@ public function refresh_plugins_transient() {
409458
* @return object $transient The modified transient value.
410459
*/
411460
public function modify_plugins_transient( $transient ) {
412-
// Bail if we're just completing a plugin update.
413-
if ( doing_action( 'upgrader_process_complete' ) ) {
414-
return $transient;
415-
}
416-
417461
// Bail early if no response (error).
418462
if ( ! isset( $transient->response ) ) {
419463
return $transient;

includes/admin/tools/class-acf-admin-tool-import.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,21 @@ function html() {
4444
?>
4545
<div class="acf-postbox-header">
4646
<h2 class="acf-postbox-title"><?php esc_html_e( 'Import', 'acf' ); ?></h2>
47-
<div class="acf-tip"><i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Select the Advanced Custom Fields JSON file you would like to import. When you click the import button below, ACF will import the items in that file.', 'acf' ); ?>">?</i></div>
47+
<div class="acf-tip"><i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Choose an ACF JSON file to import. Use only files from trusted sources, then click Import.', 'acf' ); ?>">?</i></div>
4848
</div>
4949
<div class="acf-postbox-inner">
5050
<div class="acf-fields">
5151
<?php
5252

5353
acf_render_field_wrap(
5454
array(
55-
'label' => __( 'Select File', 'acf' ),
56-
'type' => 'file',
57-
'name' => 'acf_import_file',
58-
'value' => false,
59-
'uploader' => 'basic',
55+
'label' => __( 'Select JSON File', 'acf' ),
56+
'type' => 'file',
57+
'name' => 'acf_import_file',
58+
'value' => false,
59+
'uploader' => 'basic',
60+
'mime_types' => 'application/json,application/x-json,application/x-javascript,text/javascript,text/x-javascript,text/json',
61+
'instructions' => __( 'Import JSON containing field groups, post types, or taxonomies (trusted sources only)', 'acf' ),
6062
)
6163
);
6264

includes/class-acf-internal-post-type.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,12 @@ public function duplicate_post( $id = 0, $new_post_id = 0 ) {
731731
// When importing a new field group, insert a temporary post and set the field group's ID.
732732
// This allows fields to be updated before the field group (field group ID is needed for field parent setting).
733733
if ( ! $post['ID'] ) {
734-
$post['ID'] = wp_insert_post( array( 'post_title' => $post['key'] ) );
734+
$post['ID'] = wp_insert_post(
735+
array(
736+
'post_title' => $post['key'],
737+
'post_type' => $this->post_type,
738+
)
739+
);
735740
}
736741

737742
$post = $this->update_post( $post );

includes/fields/class-acf-field-file.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,17 @@ function render_field( $field ) {
161161

162162
<label class="acf-basic-uploader">
163163
<?php
164-
acf_file_input(
165-
array(
166-
'name' => $field['name'],
167-
'id' => $field['id'],
168-
'key' => $field['key'],
169-
)
164+
$args = array(
165+
'name' => $field['name'],
166+
'id' => $field['id'],
167+
'key' => $field['key'],
170168
);
169+
170+
if ( ! empty( $field['mime_types'] ) ) {
171+
$args['accept'] = $field['mime_types'];
172+
}
173+
174+
acf_file_input( $args );
171175
?>
172176
</label>
173177

0 commit comments

Comments
 (0)