Skip to content

Commit

Permalink
ACF 5.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotcondon committed Feb 11, 2021
1 parent 691bae3 commit 89421ce
Show file tree
Hide file tree
Showing 10 changed files with 1,048 additions and 842 deletions.
4 changes: 2 additions & 2 deletions acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Advanced Custom Fields
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
Expand All @@ -17,7 +17,7 @@
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();
Expand Down
18 changes: 18 additions & 0 deletions includes/acf-field-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
18 changes: 18 additions & 0 deletions includes/acf-field-group-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 2 additions & 2 deletions includes/acf-value-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function acf_format_value( $value, $post_id, $field ) {
* @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 );
Expand Down Expand Up @@ -215,7 +215,7 @@ function acf_update_value( $value = null, $post_id = 0, $field ) {
* @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 ) {
Expand Down
1 change: 1 addition & 0 deletions includes/acf-wp-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
35 changes: 18 additions & 17 deletions includes/api/api-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -4822,20 +4826,17 @@ function acf_array_camel_case( $array = array() ) {
}

/**
* acf_is_block_editor
*
* Returns true if the current screen uses the block editor.
* Returns true if the current screen is using 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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/local-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function save_file( $key, $field_group ) {
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.
Expand Down
Binary file modified lang/acf-fi.mo
Binary file not shown.
Loading

0 comments on commit 89421ce

Please sign in to comment.