This commit is contained in:
Toby Inkster 2021-02-22 13:49:10 +00:00
parent f0b0346bb7
commit b4b3628a65
14 changed files with 1059 additions and 853 deletions

View File

@ -3,7 +3,7 @@
Plugin Name: Advanced Custom Fields PRO
Plugin URI: https://www.advancedcustomfields.com
Description: Customize WordPress with powerful, professional and intuitive fields.
Version: 5.9.4
Version: 5.9.5
Author: Elliot Condon
Author URI: https://www.advancedcustomfields.com
Text Domain: acf
@ -17,7 +17,7 @@ if( ! class_exists('ACF') ) :
class ACF {
/** @var string The plugin version number. */
var $version = '5.9.4';
var $version = '5.9.5';
/** @var array The plugin settings array. */
var $settings = array();

View File

@ -1203,6 +1203,24 @@ function acf_untrash_field( $id = 0 ) {
return true;
}
/**
* Filter callback which returns the previous post_status instead of "draft" for the "acf-field" post type.
*
* Prior to WordPress 5.6.0, this filter was not needed as restored posts were always assigned their original status.
*
* @since 5.9.5
*
* @param string $new_status The new status of the post being restored.
* @param int $post_id The ID of the post being restored.
* @param string $previous_status The status of the post at the point where it was trashed.
* @return string.
*/
function _acf_untrash_field_post_status( $new_status, $post_id, $previous_status ) {
return ( get_post_type( $post_id ) === 'acf-field' ) ? $previous_status : $new_status;
}
add_action( 'wp_untrash_post_status', '_acf_untrash_field_post_status', 10, 3 );
/**
* acf_prefix_fields
*

View File

@ -763,6 +763,24 @@ function acf_untrash_field_group( $id = 0 ) {
return true;
}
/**
* Filter callback which returns the previous post_status instead of "draft" for the "acf-field-group" post type.
*
* Prior to WordPress 5.6.0, this filter was not needed as restored posts were always assigned their original status.
*
* @since 5.9.5
*
* @param string $new_status The new status of the post being restored.
* @param int $post_id The ID of the post being restored.
* @param string $previous_status The status of the post at the point where it was trashed.
* @return string.
*/
function _acf_untrash_field_group_post_status( $new_status, $post_id, $previous_status ) {
return ( get_post_type( $post_id ) === 'acf-field-group' ) ? $previous_status : $new_status;
}
add_action( 'wp_untrash_post_status', '_acf_untrash_field_group_post_status', 10, 3 );
/**
* acf_is_field_group
*

View File

@ -161,7 +161,7 @@ acf_add_filter_variations( 'acf/format_value', array('type', 'name', 'key'), 2 )
* @param array $field The field array.
* @return bool.
*/
function acf_update_value( $value = null, $post_id = 0, $field ) {
function acf_update_value( $value, $post_id, $field ) {
// Allow filter to short-circuit update_value logic.
$check = apply_filters( "acf/pre_update_value", null, $value, $post_id, $field );
@ -215,7 +215,7 @@ acf_add_filter_variations( 'acf/update_value', array('type', 'name', 'key'), 2 )
* @param (int|string) $post_id The post id.
* @return void
*/
function acf_update_values( $values = array(), $post_id = 0 ) {
function acf_update_values( $values, $post_id ) {
// Loop over values.
foreach( $values as $key => $value ) {

View File

@ -133,6 +133,7 @@ function acf_decode_post_id( $post_id = 0 ) {
$id = substr($post_id, $i+1);
} else {
$type = $post_id;
$id = '';
}
// Handle incorrect param type.

View File

@ -3163,9 +3163,11 @@ function acf_get_attachment( $attachment ) {
case 'image':
$sizes_id = $attachment->ID;
$src = wp_get_attachment_image_src( $attachment->ID, 'full' );
$response['url'] = $src[0];
$response['width'] = $src[1];
$response['height'] = $src[2];
if ( $src ) {
$response['url'] = $src[0];
$response['width'] = $src[1];
$response['height'] = $src[2];
}
break;
case 'video':
$response['width'] = acf_maybe_get( $meta, 'width', 0 );
@ -3184,14 +3186,16 @@ function acf_get_attachment( $attachment ) {
// Load array of image sizes.
if( $sizes_id ) {
$sizes = get_intermediate_image_sizes();
$data = array();
$sizes_data = array();
foreach( $sizes as $size ) {
$src = wp_get_attachment_image_src( $sizes_id, $size );
$data[ $size ] = $src[ 0 ];
$data[ $size . '-width' ] = $src[ 1 ];
$data[ $size . '-height' ] = $src[ 2 ];
if ( $src ) {
$sizes_data[ $size ] = $src[0];
$sizes_data[ $size . '-width' ] = $src[1];
$sizes_data[ $size . '-height' ] = $src[2];
}
}
$response['sizes'] = $data;
$response['sizes'] = $sizes_data;
}
/**
@ -4822,20 +4826,17 @@ function acf_array_camel_case( $array = array() ) {
}
/**
* acf_is_block_editor
* Returns true if the current screen is using the block editor.
*
* Returns true if the current screen uses the block editor.
* @date 13/12/18
* @since 5.8.0
*
* @date 13/12/18
* @since 5.8.0
*
* @param void
* @return bool
* @return bool
*/
function acf_is_block_editor() {
if( function_exists('get_current_screen') ) {
if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if( method_exists($screen, 'is_block_editor') ) {
if( $screen && method_exists( $screen, 'is_block_editor' ) ) {
return $screen->is_block_editor();
}
}

View File

@ -213,7 +213,7 @@ class ACF_Local_JSON {
if( $field_group['ID'] ) {
$field_group['modified'] = get_post_modified_time( 'U', true, $field_group['ID'] );
} else {
$field_group['modified'] = strtotime();
$field_group['modified'] = strtotime( 'now' );
}
// Prepare for export.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -67,6 +67,15 @@ From your WordPress dashboard
== Changelog ==
= 5.9.5 =
*Release Date - 11 February 2021*
* Fix - Fixed regression preventing blocks from loading correctly within the editor in WordPress 5.5.
* Fix - Fixed bug causing incorrect post_status properties when restoring a Field Group from trash in WordPress 5.6.
* Fix - Fixed edge case bug where a taxonomy named "options" could interfere with saving and loading option values.
* Fix - Fixed additional PHP 8.0 warnings.
* i18n - Updated Finnish translation thanks to Mikko Kekki
= 5.9.4 =
*Release Date - 14 January 2021*