Update to 5.9.3

This commit is contained in:
Toby Inkster 2021-01-03 11:22:17 +00:00
parent a2b8fc9aec
commit 76383b8979
23 changed files with 475 additions and 358 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -3434,7 +3434,8 @@
wait: 'load', wait: 'load',
events: { events: {
'removeField': 'onRemove' 'removeField': 'onRemove',
'duplicateField': 'onDuplicate'
}, },
$input: function(){ $input: function(){
@ -3474,6 +3475,13 @@
if( this.select2 ) { if( this.select2 ) {
this.select2.destroy(); this.select2.destroy();
} }
},
onDuplicate: function( e, $el, $duplicate ){
if( this.select2 ) {
$duplicate.find('.select2-container').remove();
$duplicate.find('select').removeClass('select2-hidden-accessible');
}
} }
}); });
@ -7768,9 +7776,12 @@
}); });
} }
// remove conflicting atts // Temporarily remove conflicting attribute.
$select.removeData('ajax'); var attrAjax = $select.attr( 'data-ajax' );
$select.removeAttr('data-ajax'); if( attrAjax !== undefined ) {
$select.removeData('ajax');
$select.removeAttr('data-ajax');
}
// ajax // ajax
if( this.get('ajax') ) { if( this.get('ajax') ) {
@ -7831,6 +7842,11 @@
// add class // add class
$container.addClass('-acf'); $container.addClass('-acf');
// Add back temporarily removed attr.
if( attrAjax !== undefined ) {
$select.attr('data-ajax', attrAjax);
}
// action for 3rd party customization // action for 3rd party customization
acf.doAction('select2_init', $select, options, this.data, (field || false), this); acf.doAction('select2_init', $select, options, this.data, (field || false), this);
}, },

File diff suppressed because one or more lines are too long

View File

@ -124,6 +124,20 @@ function acf_request_args( $args = array() ) {
return $args; return $args;
} }
/**
* Returns a single $_REQUEST arg with fallback.
*
* @date 23/10/20
* @since 5.9.2
*
* @param string $key The property name.
* @param mixed $default The default value to fallback to.
* @return mixed
*/
function acf_request_arg( $name = '', $default = null ) {
return isset( $_REQUEST[ $name ] ) ? $_REQUEST[ $name ] : $default;
}
// Register store. // Register store.
acf_register_store( 'filters' ); acf_register_store( 'filters' );

View File

@ -1,64 +1,5 @@
<?php <?php
/**
* acf_decode_post_id
*
* Returns an array containing the object type and id for the given post_id string.
*
* @date 25/1/19
* @since 5.7.11
*
* @param (int|string) $post_id The post id.
* @return array()
*/
function acf_decode_post_id( $post_id = 0 ) {
// Default data
$data = array(
'type' => 'post',
'id' => 0
);
// Check if is numeric.
if( is_numeric($post_id) ) {
$data['id'] = (int) $post_id;
// Check if is string.
} elseif( is_string($post_id) ) {
// Determine "{$type}_{$id}" from string.
$bits = explode( '_', $post_id );
$id = array_pop( $bits );
$type = implode( '_', $bits );
// Check if is meta type.
if( function_exists("get_{$type}_meta") && is_numeric($id) ) {
$data['type'] = $type;
$data['id'] = (int) $id;
// Check if is taxonomy name.
} elseif( taxonomy_exists($type) && is_numeric($id) ) {
$data['type'] = 'term';
$data['id'] = (int) $id;
// Otherwise, default to option.
} else {
$data['type'] = 'option';
$data['id'] = $post_id;
}
}
/**
* Filters the $data array after it has been decoded.
*
* @date 12/02/2014
* @since 5.0.0
*
* @param array $data The type and id array.
*/
return apply_filters( "acf/decode_post_id", $data, $post_id );
}
/** /**
* acf_get_meta * acf_get_meta
* *
@ -74,20 +15,20 @@ function acf_get_meta( $post_id = 0 ) {
// Allow filter to short-circuit load_value logic. // Allow filter to short-circuit load_value logic.
$null = apply_filters( "acf/pre_load_meta", null, $post_id ); $null = apply_filters( "acf/pre_load_meta", null, $post_id );
if( $null !== null ) { if( $null !== null ) {
return ( $null === '__return_null' ) ? null : $null; return ( $null === '__return_null' ) ? null : $null;
} }
// Decode $post_id for $type and $id. // Decode $post_id for $type and $id.
extract( acf_decode_post_id($post_id) ); extract( acf_decode_post_id($post_id) );
// Use get_$type_meta() function when possible. // Determine CRUD function.
if( function_exists("get_{$type}_meta") ) { // - Relies on decoded post_id result to identify option or meta types.
$allmeta = call_user_func("get_{$type}_meta", $id, ''); // - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if( $type === 'option' ) {
// Default to wp_options.
} else {
$allmeta = acf_get_option_meta( $id ); $allmeta = acf_get_option_meta( $id );
} else {
$allmeta = get_metadata( $type, $id, '' );
} }
// Loop over meta and check that a reference exists for each value. // Loop over meta and check that a reference exists for each value.
@ -181,10 +122,10 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
// Allow filter to short-circuit logic. // Allow filter to short-circuit logic.
$null = apply_filters( "acf/pre_load_metadata", null, $post_id, $name, $hidden ); $null = apply_filters( "acf/pre_load_metadata", null, $post_id, $name, $hidden );
if( $null !== null ) { if( $null !== null ) {
return ( $null === '__return_null' ) ? null : $null; return ( $null === '__return_null' ) ? null : $null;
} }
// Decode $post_id for $type and $id. // Decode $post_id for $type and $id.
extract( acf_decode_post_id($post_id) ); extract( acf_decode_post_id($post_id) );
@ -196,11 +137,11 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
return null; return null;
} }
// Check option. // Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if( $type === 'option' ) { if( $type === 'option' ) {
return get_option( "{$prefix}{$id}_{$name}", null ); return get_option( "{$prefix}{$id}_{$name}", null );
// Check meta.
} else { } else {
$meta = get_metadata( $type, $id, "{$prefix}{$name}", false ); $meta = get_metadata( $type, $id, "{$prefix}{$name}", false );
return isset($meta[0]) ? $meta[0] : null; return isset($meta[0]) ? $meta[0] : null;
@ -225,10 +166,10 @@ function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = f
// Allow filter to short-circuit logic. // Allow filter to short-circuit logic.
$pre = apply_filters( "acf/pre_update_metadata", null, $post_id, $name, $value, $hidden ); $pre = apply_filters( "acf/pre_update_metadata", null, $post_id, $name, $value, $hidden );
if( $pre !== null ) { if( $pre !== null ) {
return $pre; return $pre;
} }
// Decode $post_id for $type and $id. // Decode $post_id for $type and $id.
extract( acf_decode_post_id($post_id) ); extract( acf_decode_post_id($post_id) );
@ -240,15 +181,13 @@ function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = f
return false; return false;
} }
// Update option. // Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if( $type === 'option' ) { if( $type === 'option' ) {
// Unslash value to match update_metadata() functionality.
$value = wp_unslash( $value ); $value = wp_unslash( $value );
$autoload = (bool) acf_get_setting('autoload'); $autoload = (bool) acf_get_setting('autoload');
return update_option( "{$prefix}{$id}_{$name}", $value, $autoload ); return update_option( "{$prefix}{$id}_{$name}", $value, $autoload );
// Update meta.
} else { } else {
return update_metadata( $type, $id, "{$prefix}{$name}", $value ); return update_metadata( $type, $id, "{$prefix}{$name}", $value );
} }
@ -271,10 +210,10 @@ function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
// Allow filter to short-circuit logic. // Allow filter to short-circuit logic.
$pre = apply_filters( "acf/pre_delete_metadata", null, $post_id, $name, $hidden ); $pre = apply_filters( "acf/pre_delete_metadata", null, $post_id, $name, $hidden );
if( $pre !== null ) { if( $pre !== null ) {
return $pre; return $pre;
} }
// Decode $post_id for $type and $id. // Decode $post_id for $type and $id.
extract( acf_decode_post_id($post_id) ); extract( acf_decode_post_id($post_id) );
@ -286,12 +225,11 @@ function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
return false; return false;
} }
// Update option. // Determine CRUD function.
// - Relies on decoded post_id result to identify option or meta types.
// - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
if( $type === 'option' ) { if( $type === 'option' ) {
$autoload = (bool) acf_get_setting('autoload');
return delete_option( "{$prefix}{$id}_{$name}" ); return delete_option( "{$prefix}{$id}_{$name}" );
// Update meta.
} else { } else {
return delete_metadata( $type, $id, "{$prefix}{$name}" ); return delete_metadata( $type, $id, "{$prefix}{$name}" );
} }

View File

@ -106,3 +106,111 @@ function acf_get_object_type( $object_type, $object_subtype = '' ) {
*/ */
return apply_filters( 'acf/get_object_type', $object, $object_type, $object_subtype ); return apply_filters( 'acf/get_object_type', $object, $object_type, $object_subtype );
} }
/**
* Decodes a post_id value such as 1 or "user_1" into an array containing the type and ID.
*
* @date 25/1/19
* @since 5.7.11
*
* @param (int|string) $post_id The post id.
* @return array
*/
function acf_decode_post_id( $post_id = 0 ) {
$type = '';
$id = 0;
// Interpret numeric value (123).
if ( is_numeric($post_id) ) {
$type = 'post';
$id = $post_id;
// Interpret string value ("user_123" or "option").
} elseif ( is_string($post_id) ) {
$i = strrpos($post_id, '_');
if( $i > 0 ) {
$type = substr($post_id, 0, $i);
$id = substr($post_id, $i+1);
} else {
$type = $post_id;
}
// Handle incorrect param type.
} else {
return compact( 'type', 'id' );
}
// Validate props based on param format.
$format = $type . '_' . (is_numeric($id) ? '%d' : '%s');
switch ( $format ) {
case 'post_%d':
$type = 'post';
$id = absint( $id );
break;
case 'term_%d':
$type = 'term';
$id = absint( $id );
break;
case 'attachment_%d':
$type = 'post';
$id = absint( $id );
break;
case 'comment_%d':
$type = 'comment';
$id = absint( $id );
break;
case 'widget_%s':
case 'widget_%d':
$type = 'option';
$id = $post_id;
break;
case 'menu_%d':
$type = 'term';
$id = absint( $id );
break;
case 'menu_item_%d':
$type = 'post';
$id = absint( $id );
break;
case 'user_%d':
$type = 'user';
$id = absint( $id );
break;
case 'block_%s':
$type = 'block';
$id = $post_id;
break;
case 'option_%s':
$type = 'option';
$id = $post_id;
break;
case 'blog_%d':
case 'site_%d':
$type = 'blog';
$id = absint( $id );
break;
default:
// Check for taxonomy name.
if( taxonomy_exists($type) && is_numeric($id) ) {
$type = 'term';
$id = absint( $id );
break;
}
// Treat unknown post_id format as an option.
$type = 'option';
$id = $post_id;
break;
}
/**
* Filters the decoded post_id information.
*
* @date 25/1/19
* @since 5.7.11
*
* @param array $props An array containing "type" and "id" information.
* @param (int|string) $post_id The post id.
*/
return apply_filters( "acf/decode_post_id", compact( 'type', 'id' ), $post_id );
}

View File

@ -2611,7 +2611,8 @@ function acf_get_valid_post_id( $post_id = 0 ) {
} }
// $post_id may be an object // $post_id may be an object.
// todo: Compare class types instead.
if( is_object($post_id) ) { if( is_object($post_id) ) {
// post // post
@ -2627,7 +2628,7 @@ function acf_get_valid_post_id( $post_id = 0 ) {
// term // term
} elseif( isset($post_id->taxonomy, $post_id->term_id) ) { } elseif( isset($post_id->taxonomy, $post_id->term_id) ) {
$post_id = acf_get_term_post_id( $post_id->taxonomy, $post_id->term_id ); $post_id = 'term_' . $post_id->term_id;
// comment // comment
} elseif( isset($post_id->comment_ID) ) { } elseif( isset($post_id->comment_ID) ) {
@ -2815,36 +2816,6 @@ function acf_isset_termmeta( $taxonomy = '' ) {
} }
/*
* acf_get_term_post_id
*
* This function will return a valid post_id string for a given term and taxonomy
*
* @type function
* @date 6/2/17
* @since 5.5.6
*
* @param $taxonomy (string)
* @param $term_id (int)
* @return (string)
*/
function acf_get_term_post_id( $taxonomy, $term_id ) {
// WP < 4.4
if( !acf_isset_termmeta() ) {
return $taxonomy . '_' . $term_id;
}
// return
return 'term_' . $term_id;
}
/* /*
* acf_upload_files * acf_upload_files
* *
@ -4870,5 +4841,3 @@ function acf_is_block_editor() {
} }
return false; return false;
} }
?>

View File

@ -138,22 +138,19 @@ function acf_get_taxonomy_labels( $taxonomies = array() ) {
*/ */
function acf_get_term_title( $term ) { function acf_get_term_title( $term ) {
// set to term name
$title = $term->name; $title = $term->name;
// allow for empty name // Allow for empty name.
if( $title === '' ) { if( $title === '' ) {
$title = __('(no title)', 'acf'); $title = __('(no title)', 'acf');
} }
// prepent ancestors indentation // Prepend ancestors indentation.
if( is_taxonomy_hierarchical($term->taxonomy) ) { if( is_taxonomy_hierarchical($term->taxonomy) ) {
$ancestors = get_ancestors( $term->term_id, $term->taxonomy ); $ancestors = get_ancestors( $term->term_id, $term->taxonomy );
$title = str_repeat('- ', count($ancestors)) . $title; $title = str_repeat('- ', count($ancestors)) . $title;
} }
// return
return $title; return $title;
} }
@ -493,6 +490,19 @@ function acf_get_choice_from_term( $term, $format = 'term_id' ) {
); );
} }
/**
* Returns a valid post_id string for a given term and taxonomy.
?> * No longer needed since WP introduced the termmeta table in WP 4.4.
*
* @date 6/2/17
* @since 5.5.6
* @deprecated 5.9.2
*
* @param $taxonomy (string) The taxonomy type.
* @param $term_id (int) The term ID.
* @return (string)
*/
function acf_get_term_post_id( $taxonomy, $term_id ) {
_deprecated_function( __FUNCTION__, '5.9.2', 'string format term_%d' );
return 'term_' . $term_id;
}

View File

@ -47,18 +47,34 @@ class acf_field_color_picker extends acf_field {
function input_admin_enqueue_scripts() { function input_admin_enqueue_scripts() {
// Register scripts for non-admin. // Register scripts for non-admin.
// Applies logic from wp_default_scripts() function. // Applies logic from wp_default_scripts() function defined in "wp-includes/script-loader.php".
if( !is_admin() ) { if( !is_admin() ) {
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$scripts = wp_scripts(); $scripts = wp_scripts();
$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 ); $scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 ); $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
$scripts->set_translations( 'wp-color-picker' );
// Handle localisation across multiple WP versions.
// WP 5.0+
if( method_exists($scripts, 'set_translations') ) {
$scripts->set_translations( 'wp-color-picker' );
// WP 4.9
} else {
$scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
'clear' => __( 'Clear' ),
'clearAriaLabel' => __( 'Clear color' ),
'defaultString' => __( 'Default' ),
'defaultAriaLabel' => __( 'Select default color' ),
'pick' => __( 'Select Color' ),
'defaultLabel' => __( 'Color value' ),
));
}
} }
// Enqueue. // Enqueue.
wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' );
} }

View File

@ -203,7 +203,7 @@ class acf_field_page_link extends acf_field {
// order posts by search // order posts by search
if( $is_search && empty($args['orderby']) ) { if( $is_search && empty($args['orderby']) && isset($args['s']) ) {
$posts = acf_order_by_search( $posts, $args['s'] ); $posts = acf_order_by_search( $posts, $args['s'] );

View File

@ -199,7 +199,7 @@ class acf_field_post_object extends acf_field {
// order posts by search // order posts by search
if( $is_search && empty($args['orderby']) ) { if( $is_search && empty($args['orderby']) && isset($args['s']) ) {
$posts = acf_order_by_search( $posts, $args['s'] ); $posts = acf_order_by_search( $posts, $args['s'] );

View File

@ -250,7 +250,7 @@ class acf_field_relationship extends acf_field {
// order posts by search // order posts by search
if( $is_search && empty($args['orderby']) ) { if( $is_search && empty($args['orderby']) && isset($args['s']) ) {
$posts = acf_order_by_search( $posts, $args['s'] ); $posts = acf_order_by_search( $posts, $args['s'] );
@ -643,7 +643,7 @@ class acf_field_relationship extends acf_field {
/* /*
* format_value() * format_value()
* *
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template * This filter is applied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
* @since 3.6 * @since 3.6
@ -733,7 +733,7 @@ class acf_field_relationship extends acf_field {
/* /*
* update_value() * update_value()
* *
* This filter is appied to the $value before it is updated in the db * This filter is applied to the $value before it is updated in the db
* *
* @type filter * @type filter
* @since 3.6 * @since 3.6
@ -777,4 +777,4 @@ acf_register_field_type( 'acf_field_relationship' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -32,13 +32,16 @@ class acf_field_taxonomy extends acf_field {
'field_type' => 'checkbox', 'field_type' => 'checkbox',
'multiple' => 0, 'multiple' => 0,
'allow_null' => 0, 'allow_null' => 0,
//'load_save_terms' => 0, // removed in 5.2.7
'return_format' => 'id', 'return_format' => 'id',
'add_term' => 1, // 5.2.3 'add_term' => 1, // 5.2.3
'load_terms' => 0, // 5.2.7 'load_terms' => 0, // 5.2.7
'save_terms' => 0 // 5.2.7 'save_terms' => 0 // 5.2.7
); );
// Register filter variations.
acf_add_filter_variations( 'acf/fields/taxonomy/query', array('name', 'key'), 1 );
acf_add_filter_variations( 'acf/fields/taxonomy/result', array('name', 'key'), 2 );
// ajax // ajax
add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query')); add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query'));
@ -156,8 +159,6 @@ class acf_field_taxonomy extends acf_field {
// filters // filters
$args = apply_filters('acf/fields/taxonomy/query', $args, $field, $options['post_id']); $args = apply_filters('acf/fields/taxonomy/query', $args, $field, $options['post_id']);
$args = apply_filters('acf/fields/taxonomy/query/name=' . $field['name'], $args, $field, $options['post_id'] );
$args = apply_filters('acf/fields/taxonomy/query/key=' . $field['key'], $args, $field, $options['post_id'] );
// get terms // get terms
@ -227,54 +228,35 @@ class acf_field_taxonomy extends acf_field {
} }
/**
/* * Returns the Term's title displayed in the field UI.
* get_term_title *
* * @date 1/11/2013
* This function returns the HTML for a result * @since 5.0.0
* *
* @type function * @param WP_Term $term The term object.
* @date 1/11/2013 * @param array $field The field settings.
* @since 5.0.0 * @param mixed $post_id The post_id being edited.
* * @return string
* @param $post (object) */
* @param $field (array)
* @param $post_id (int) the post_id to which this value is saved to
* @return (string)
*/
function get_term_title( $term, $field, $post_id = 0 ) { function get_term_title( $term, $field, $post_id = 0 ) {
$title = acf_get_term_title( $term );
// get post_id // Default $post_id to current post being edited.
if( !$post_id ) $post_id = acf_get_form_data('post_id'); $post_id = $post_id ? $post_id : acf_get_form_data('post_id');
/**
// vars * Filters the term title.
$title = ''; *
* @date 1/11/2013
* @since 5.0.0
// ancestors *
$ancestors = get_ancestors( $term->term_id, $field['taxonomy'] ); * @param string $title The term title.
* @param WP_Term $term The term object.
if( !empty($ancestors) ) { * @param array $field The field settings.
* @param (int|string) $post_id The post_id being edited.
$title .= str_repeat('- ', count($ancestors)); */
return apply_filters('acf/fields/taxonomy/result', $title, $term, $field, $post_id);
}
// title
$title .= $term->name;
// filters
$title = apply_filters('acf/fields/taxonomy/result', $title, $term, $field, $post_id);
$title = apply_filters('acf/fields/taxonomy/result/name=' . $field['_name'] , $title, $term, $field, $post_id);
$title = apply_filters('acf/fields/taxonomy/result/key=' . $field['key'], $title, $term, $field, $post_id);
// return
return $title;
} }
@ -347,9 +329,14 @@ class acf_field_taxonomy extends acf_field {
// load_terms // load_terms
if( $field['load_terms'] ) { if( $field['load_terms'] ) {
// Decode $post_id for $type and $id.
extract( acf_decode_post_id($post_id) );
if( $type === 'block' ) {
// Get parent block...
}
// get terms // get terms
$info = acf_get_post_id_info($post_id); $term_ids = wp_get_object_terms( $id, $field['taxonomy'], array('fields' => 'ids', 'orderby' => 'none') );
$term_ids = wp_get_object_terms($info['id'], $field['taxonomy'], array('fields' => 'ids', 'orderby' => 'none'));
// bail early if no terms // bail early if no terms
@ -481,11 +468,14 @@ class acf_field_taxonomy extends acf_field {
// Although not fully supported by WordPress, non "post" objects may use the term relationships table. // Although not fully supported by WordPress, non "post" objects may use the term relationships table.
// Sharing taxonomies across object types is discoraged, but unique taxonomies work well. // Sharing taxonomies across object types is discoraged, but unique taxonomies work well.
// Note: Do not attempt to restrict to "post" only. This has been attempted in 5.8.9 and later reverted. // Note: Do not attempt to restrict to "post" only. This has been attempted in 5.8.9 and later reverted.
$info = acf_get_post_id_info( $post_id ); extract( acf_decode_post_id($post_id) );
if( $type === 'block' ) {
// Get parent block...
}
// Loop over taxonomies and save terms. // Loop over taxonomies and save terms.
foreach( $this->save_post_terms as $taxonomy => $term_ids ){ foreach( $this->save_post_terms as $taxonomy => $term_ids ){
wp_set_object_terms( $info['id'], $term_ids, $taxonomy, false ); wp_set_object_terms( $id, $term_ids, $taxonomy, false );
} }
// Reset storage. // Reset storage.

View File

@ -141,7 +141,7 @@ class acf_form_nav_menu {
function update_nav_menu( $menu_id ) { function update_nav_menu( $menu_id ) {
// vars // vars
$post_id = acf_get_term_post_id( 'nav_menu', $menu_id ); $post_id = 'term_' . $menu_id;
// verify and remove nonce // verify and remove nonce
@ -288,7 +288,7 @@ class acf_form_nav_menu {
// vars // vars
$nav_menu_id = acf_get_data('nav_menu_id'); $nav_menu_id = acf_get_data('nav_menu_id');
$post_id = acf_get_term_post_id( 'nav_menu', $nav_menu_id ); $post_id = 'term_' . $nav_menu_id;
// get field groups // get field groups

View File

@ -136,7 +136,7 @@ class acf_form_taxonomy {
function add_term( $taxonomy ) { function add_term( $taxonomy ) {
// vars // vars
$post_id = acf_get_term_post_id( $taxonomy, 0 ); $post_id = 'term_0';
// update vars // update vars
@ -191,7 +191,7 @@ class acf_form_taxonomy {
function edit_term( $term, $taxonomy ) { function edit_term( $term, $taxonomy ) {
// vars // vars
$post_id = acf_get_term_post_id( $term->taxonomy, $term->term_id ); $post_id = 'term_' . $term->term_id;
// update vars // update vars
@ -345,7 +345,7 @@ if( $this->view == 'add' ): ?>
function save_term( $term_id, $tt_id, $taxonomy ) { function save_term( $term_id, $tt_id, $taxonomy ) {
// vars // vars
$post_id = acf_get_term_post_id( $taxonomy, $term_id ); $post_id = 'term_' . $term_id;
// verify and remove nonce // verify and remove nonce

View File

@ -169,13 +169,13 @@ class acf_revisions {
$value = $value[0]; $value = $value[0];
$key = $key[0]; $key = $key[0];
// Load field.
// bail early if $key is a not a field_key $field = acf_get_field( $key );
if( !acf_is_field_key($key) ) continue; if( !$field ) {
continue;
}
// get field // get field
$field = acf_get_field( $key );
$field_title = $field['label'] . ' (' . $name . ')'; $field_title = $field['label'] . ' (' . $name . ')';
$field_order = $field['menu_order']; $field_order = $field['menu_order'];
$ancestors = acf_get_field_ancestors( $field ); $ancestors = acf_get_field_ancestors( $field );

View File

@ -3,15 +3,15 @@ msgstr ""
"Project-Id-Version: Advanced Custom Fields Pro v5.8.5\n" "Project-Id-Version: Advanced Custom Fields Pro v5.8.5\n"
"Report-Msgid-Bugs-To: http://support.advancedcustomfields.com\n" "Report-Msgid-Bugs-To: http://support.advancedcustomfields.com\n"
"POT-Creation-Date: 2020-08-17 10:46+0200\n" "POT-Creation-Date: 2020-08-17 10:46+0200\n"
"PO-Revision-Date: 2020-08-17 10:13+0000\n" "PO-Revision-Date: 2020-09-11 10:26+0930\n"
"Last-Translator: Maxime BJ <maxime@dysign.fr>\n" "Last-Translator: Elliot Condon <e@elliotcondon.com>\n"
"Language-Team: Français\n" "Language-Team: Français\n"
"Language: fr_FR\n" "Language: fr_FR\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Loco https://localise.biz/\n" "X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
@ -500,7 +500,8 @@ msgid "Review sites & upgrade"
msgstr "Examiner les sites et mettre à niveau" msgstr "Examiner les sites et mettre à niveau"
# @ acf # @ acf
#: includes/admin/admin.php:48 includes/admin/views/field-group-options.php:110 #: includes/admin/admin.php:48
#: includes/admin/views/field-group-options.php:110
msgid "Custom Fields" msgid "Custom Fields"
msgstr "ACF" msgstr "ACF"
@ -1370,7 +1371,8 @@ msgid "jQuery"
msgstr "jQuery" msgstr "jQuery"
# @ acf # @ acf
#: includes/fields.php:354 includes/fields/class-acf-field-button-group.php:177 #: includes/fields.php:354
#: includes/fields/class-acf-field-button-group.php:177
#: includes/fields/class-acf-field-checkbox.php:389 #: includes/fields/class-acf-field-checkbox.php:389
#: includes/fields/class-acf-field-group.php:474 #: includes/fields/class-acf-field-group.php:474
#: includes/fields/class-acf-field-radio.php:290 #: includes/fields/class-acf-field-radio.php:290
@ -1487,7 +1489,7 @@ msgstr "Valeur par défaut"
#: includes/fields/class-acf-field-url.php:101 #: includes/fields/class-acf-field-url.php:101
#: includes/fields/class-acf-field-wysiwyg.php:372 #: includes/fields/class-acf-field-wysiwyg.php:372
msgid "Appears when creating a new post" msgid "Appears when creating a new post"
msgstr "Valeur affichée à la création dune publicaiton" msgstr "Valeur affichée à la création dune publication"
#: includes/fields/class-acf-field-button-group.php:183 #: includes/fields/class-acf-field-button-group.php:183
#: includes/fields/class-acf-field-checkbox.php:396 #: includes/fields/class-acf-field-checkbox.php:396
@ -2749,8 +2751,8 @@ msgid "Validate Email"
msgstr "Valider le-mail" msgstr "Valider le-mail"
# @ acf # @ acf
#: includes/forms/form-front.php:104 pro/fields/class-acf-field-gallery.php:510 #: includes/forms/form-front.php:104
#: pro/options-page.php:81 #: pro/fields/class-acf-field-gallery.php:510 pro/options-page.php:81
msgid "Update" msgid "Update"
msgstr "Mise à jour" msgstr "Mise à jour"
@ -2995,7 +2997,8 @@ msgid "<b>Error</b>. Could not connect to update server"
msgstr "<b>Erreur</b>. Impossible de joindre le serveur" msgstr "<b>Erreur</b>. Impossible de joindre le serveur"
# @ acf # @ acf
#: pro/admin/admin-updates.php:118 pro/admin/views/html-settings-updates.php:12 #: pro/admin/admin-updates.php:118
#: pro/admin/views/html-settings-updates.php:12
msgid "Updates" msgid "Updates"
msgstr "Mises à jour" msgstr "Mises à jour"
@ -3026,12 +3029,12 @@ msgstr "Informations sur la licence"
#, php-format #, php-format
msgid "" msgid ""
"To unlock updates, please enter your license key below. If you don't have a " "To unlock updates, please enter your license key below. If you don't have a "
"licence key, please see <a href=\"%s\" target=\"_blank\">details & " "licence key, please see <a href=\"%s\" target=\"_blank\">details & pricing</"
"pricing</a>." "a>."
msgstr "" msgstr ""
"Pour débloquer les mises à jour, veuillez entrer votre clé de licence ci-" "Pour débloquer les mises à jour, veuillez entrer votre clé de licence ci-"
"dessous. Si vous nen possédez pas encore une, jetez un oeil à nos <a " "dessous. Si vous nen possédez pas encore une, jetez un oeil à nos <a href="
"href=\"%s\" target=\"_blank\">détails & tarifs</a>." "\"%s\" target=\"_blank\">détails & tarifs</a>."
# @ acf # @ acf
#: pro/admin/views/html-settings-updates.php:28 #: pro/admin/views/html-settings-updates.php:28
@ -3414,9 +3417,9 @@ msgstr "Options mises à jour"
#: pro/updates.php:97 #: pro/updates.php:97
#, php-format #, php-format
msgid "" msgid ""
"To enable updates, please enter your license key on the <a href=\"%s\">" "To enable updates, please enter your license key on the <a href=\"%s"
"Updates</a> page. If you don't have a licence key, please see <a href=\"%s\">" "\">Updates</a> page. If you don't have a licence key, please see <a href=\"%s"
"details & pricing</a>." "\">details & pricing</a>."
msgstr "" msgstr ""
"Pour activer les mises à jour, veuillez entrer votre clé de licence sur la " "Pour activer les mises à jour, veuillez entrer votre clé de licence sur la "
"page <a href=\"%s\">Mises à jour</a>. Si vous nen possédez pas encore une, " "page <a href=\"%s\">Mises à jour</a>. Si vous nen possédez pas encore une, "

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Advanced Custom Fields\n" "Project-Id-Version: Advanced Custom Fields\n"
"Report-Msgid-Bugs-To: http://support.advancedcustomfields.com\n" "Report-Msgid-Bugs-To: http://support.advancedcustomfields.com\n"
"POT-Creation-Date: 2020-08-18 08:57+1000\n" "POT-Creation-Date: 2020-10-29 10:30+0930\n"
"PO-Revision-Date: 2015-06-11 13:00+1000\n" "PO-Revision-Date: 2015-06-11 13:00+1000\n"
"Last-Translator: Elliot Condon <e@elliotcondon.com>\n" "Last-Translator: Elliot Condon <e@elliotcondon.com>\n"
"Language-Team: Elliot Condon <e@elliotcondon.com>\n" "Language-Team: Elliot Condon <e@elliotcondon.com>\n"
@ -16,11 +16,12 @@ msgstr ""
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-Basepath: ..\n" "X-Poedit-Basepath: ../\n"
"X-Poedit-WPHeader: acf.php\n" "X-Poedit-WPHeader: acf.php\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n" "X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SearchPathExcluded-1: tests\n"
#: acf.php:68 #: acf.php:68
msgid "Advanced Custom Fields" msgid "Advanced Custom Fields"
@ -69,7 +70,7 @@ msgstr ""
#: acf.php:380 includes/admin/admin-field-group.php:232 #: acf.php:380 includes/admin/admin-field-group.php:232
#: includes/admin/admin-field-groups.php:262 #: includes/admin/admin-field-groups.php:262
#: pro/fields/class-acf-field-clone.php:811 #: pro/fields/class-acf-field-clone.php:808
msgid "Fields" msgid "Fields"
msgstr "" msgstr ""
@ -236,7 +237,7 @@ msgstr ""
#: includes/admin/views/field-group-field-conditional-logic.php:151 #: includes/admin/views/field-group-field-conditional-logic.php:151
#: includes/admin/views/field-group-locations.php:29 #: includes/admin/views/field-group-locations.php:29
#: includes/admin/views/html-location-group.php:3 #: includes/admin/views/html-location-group.php:3
#: includes/api/api-helpers.php:3675 #: includes/api/api-helpers.php:3646
msgid "or" msgid "or"
msgstr "" msgstr ""
@ -760,7 +761,7 @@ msgid "Label"
msgstr "" msgstr ""
#: includes/admin/views/field-group-fields.php:6 #: includes/admin/views/field-group-fields.php:6
#: includes/fields/class-acf-field-taxonomy.php:936 #: includes/fields/class-acf-field-taxonomy.php:926
#: pro/fields/class-acf-field-flexible-content.php:597 #: pro/fields/class-acf-field-flexible-content.php:597
msgid "Name" msgid "Name"
msgstr "" msgstr ""
@ -1088,42 +1089,42 @@ msgstr ""
msgid "Full Size" msgid "Full Size"
msgstr "" msgstr ""
#: includes/api/api-helpers.php:1632 includes/api/api-term.php:147 #: includes/api/api-helpers.php:1632 includes/api/api-term.php:145
#: pro/fields/class-acf-field-clone.php:996 #: pro/fields/class-acf-field-clone.php:993
msgid "(no title)" msgid "(no title)"
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3596 #: includes/api/api-helpers.php:3567
#, php-format #, php-format
msgid "Image width must be at least %dpx." msgid "Image width must be at least %dpx."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3601 #: includes/api/api-helpers.php:3572
#, php-format #, php-format
msgid "Image width must not exceed %dpx." msgid "Image width must not exceed %dpx."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3617 #: includes/api/api-helpers.php:3588
#, php-format #, php-format
msgid "Image height must be at least %dpx." msgid "Image height must be at least %dpx."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3622 #: includes/api/api-helpers.php:3593
#, php-format #, php-format
msgid "Image height must not exceed %dpx." msgid "Image height must not exceed %dpx."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3640 #: includes/api/api-helpers.php:3611
#, php-format #, php-format
msgid "File size must be at least %s." msgid "File size must be at least %s."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3645 #: includes/api/api-helpers.php:3616
#, php-format #, php-format
msgid "File size must not exceed %s." msgid "File size must not exceed %s."
msgstr "" msgstr ""
#: includes/api/api-helpers.php:3679 #: includes/api/api-helpers.php:3650
#, php-format #, php-format
msgid "File type must be %s." msgid "File type must be %s."
msgstr "" msgstr ""
@ -1134,13 +1135,13 @@ msgstr ""
#: includes/assets.php:344 includes/fields/class-acf-field-true_false.php:79 #: includes/assets.php:344 includes/fields/class-acf-field-true_false.php:79
#: includes/fields/class-acf-field-true_false.php:159 #: includes/fields/class-acf-field-true_false.php:159
#: pro/admin/views/html-settings-updates.php:88 #: pro/admin/views/html-settings-updates.php:86
msgid "Yes" msgid "Yes"
msgstr "" msgstr ""
#: includes/assets.php:345 includes/fields/class-acf-field-true_false.php:80 #: includes/assets.php:345 includes/fields/class-acf-field-true_false.php:80
#: includes/fields/class-acf-field-true_false.php:174 #: includes/fields/class-acf-field-true_false.php:174
#: pro/admin/views/html-settings-updates.php:98 #: pro/admin/views/html-settings-updates.php:96
msgid "No" msgid "No"
msgstr "" msgstr ""
@ -1216,7 +1217,7 @@ msgstr ""
#: includes/fields/class-acf-field-checkbox.php:389 #: includes/fields/class-acf-field-checkbox.php:389
#: includes/fields/class-acf-field-group.php:474 #: includes/fields/class-acf-field-group.php:474
#: includes/fields/class-acf-field-radio.php:290 #: includes/fields/class-acf-field-radio.php:290
#: pro/fields/class-acf-field-clone.php:843 #: pro/fields/class-acf-field-clone.php:840
#: pro/fields/class-acf-field-flexible-content.php:554 #: pro/fields/class-acf-field-flexible-content.php:554
#: pro/fields/class-acf-field-flexible-content.php:603 #: pro/fields/class-acf-field-flexible-content.php:603
#: pro/fields/class-acf-field-repeater.php:449 #: pro/fields/class-acf-field-repeater.php:449
@ -1291,14 +1292,14 @@ msgstr ""
#: includes/fields/class-acf-field-post_object.php:411 #: includes/fields/class-acf-field-post_object.php:411
#: includes/fields/class-acf-field-radio.php:244 #: includes/fields/class-acf-field-radio.php:244
#: includes/fields/class-acf-field-select.php:382 #: includes/fields/class-acf-field-select.php:382
#: includes/fields/class-acf-field-taxonomy.php:781 #: includes/fields/class-acf-field-taxonomy.php:771
#: includes/fields/class-acf-field-user.php:63 #: includes/fields/class-acf-field-user.php:63
msgid "Allow Null?" msgid "Allow Null?"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-button-group.php:168 #: includes/fields/class-acf-field-button-group.php:168
#: includes/fields/class-acf-field-checkbox.php:380 #: includes/fields/class-acf-field-checkbox.php:380
#: includes/fields/class-acf-field-color_picker.php:131 #: includes/fields/class-acf-field-color_picker.php:127
#: includes/fields/class-acf-field-email.php:118 #: includes/fields/class-acf-field-email.php:118
#: includes/fields/class-acf-field-number.php:127 #: includes/fields/class-acf-field-number.php:127
#: includes/fields/class-acf-field-radio.php:281 #: includes/fields/class-acf-field-radio.php:281
@ -1341,7 +1342,7 @@ msgstr ""
#: includes/fields/class-acf-field-file.php:214 #: includes/fields/class-acf-field-file.php:214
#: includes/fields/class-acf-field-link.php:166 #: includes/fields/class-acf-field-link.php:166
#: includes/fields/class-acf-field-radio.php:304 #: includes/fields/class-acf-field-radio.php:304
#: includes/fields/class-acf-field-taxonomy.php:826 #: includes/fields/class-acf-field-taxonomy.php:816
msgid "Return Value" msgid "Return Value"
msgstr "" msgstr ""
@ -1368,7 +1369,7 @@ msgid "Both (Array)"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-checkbox.php:25 #: includes/fields/class-acf-field-checkbox.php:25
#: includes/fields/class-acf-field-taxonomy.php:768 #: includes/fields/class-acf-field-taxonomy.php:758
msgid "Checkbox" msgid "Checkbox"
msgstr "" msgstr ""
@ -1413,20 +1414,28 @@ msgstr ""
msgid "Color Picker" msgid "Color Picker"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-color_picker.php:68 #: includes/fields/class-acf-field-color_picker.php:64
msgid "Clear" msgid "Clear"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-color_picker.php:69 #: includes/fields/class-acf-field-color_picker.php:65
msgid "Clear color"
msgstr ""
#: includes/fields/class-acf-field-color_picker.php:66
msgid "Default" msgid "Default"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-color_picker.php:70 #: includes/fields/class-acf-field-color_picker.php:67
msgid "Select default color"
msgstr ""
#: includes/fields/class-acf-field-color_picker.php:68
msgid "Select Color" msgid "Select Color"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-color_picker.php:71 #: includes/fields/class-acf-field-color_picker.php:69
msgid "Current Color" msgid "Color value"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-date_picker.php:25 #: includes/fields/class-acf-field-date_picker.php:25
@ -1812,12 +1821,12 @@ msgid "Sub Fields"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-group.php:475 #: includes/fields/class-acf-field-group.php:475
#: pro/fields/class-acf-field-clone.php:844 #: pro/fields/class-acf-field-clone.php:841
msgid "Specify the style used to render the selected fields" msgid "Specify the style used to render the selected fields"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-group.php:480 #: includes/fields/class-acf-field-group.php:480
#: pro/fields/class-acf-field-clone.php:849 #: pro/fields/class-acf-field-clone.php:846
#: pro/fields/class-acf-field-flexible-content.php:615 #: pro/fields/class-acf-field-flexible-content.php:615
#: pro/fields/class-acf-field-repeater.php:457 #: pro/fields/class-acf-field-repeater.php:457
#: pro/locations/class-acf-location-block.php:20 #: pro/locations/class-acf-location-block.php:20
@ -1825,14 +1834,14 @@ msgid "Block"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-group.php:481 #: includes/fields/class-acf-field-group.php:481
#: pro/fields/class-acf-field-clone.php:850 #: pro/fields/class-acf-field-clone.php:847
#: pro/fields/class-acf-field-flexible-content.php:614 #: pro/fields/class-acf-field-flexible-content.php:614
#: pro/fields/class-acf-field-repeater.php:456 #: pro/fields/class-acf-field-repeater.php:456
msgid "Table" msgid "Table"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-group.php:482 #: includes/fields/class-acf-field-group.php:482
#: pro/fields/class-acf-field-clone.php:851 #: pro/fields/class-acf-field-clone.php:848
#: pro/fields/class-acf-field-flexible-content.php:616 #: pro/fields/class-acf-field-flexible-content.php:616
#: pro/fields/class-acf-field-repeater.php:458 #: pro/fields/class-acf-field-repeater.php:458
msgid "Row" msgid "Row"
@ -2016,7 +2025,7 @@ msgstr ""
#: includes/fields/class-acf-field-page_link.php:262 #: includes/fields/class-acf-field-page_link.php:262
#: includes/fields/class-acf-field-post_object.php:267 #: includes/fields/class-acf-field-post_object.php:267
#: includes/fields/class-acf-field-taxonomy.php:958 #: includes/fields/class-acf-field-taxonomy.php:948
msgid "Parent" msgid "Parent"
msgstr "" msgstr ""
@ -2133,7 +2142,7 @@ msgstr ""
#: includes/fields/class-acf-field-relationship.php:589 #: includes/fields/class-acf-field-relationship.php:589
#: includes/fields/class-acf-field-taxonomy.php:28 #: includes/fields/class-acf-field-taxonomy.php:28
#: includes/fields/class-acf-field-taxonomy.php:751 #: includes/fields/class-acf-field-taxonomy.php:741
#: includes/locations/class-acf-location-taxonomy.php:20 #: includes/locations/class-acf-location-taxonomy.php:20
msgid "Taxonomy" msgid "Taxonomy"
msgstr "" msgstr ""
@ -2163,7 +2172,7 @@ msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: includes/fields/class-acf-field-select.php:25 #: includes/fields/class-acf-field-select.php:25
#: includes/fields/class-acf-field-taxonomy.php:773 #: includes/fields/class-acf-field-taxonomy.php:763
msgctxt "noun" msgctxt "noun"
msgid "Select" msgid "Select"
msgstr "" msgstr ""
@ -2268,88 +2277,88 @@ msgid ""
"group of tabs." "group of tabs."
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:711 #: includes/fields/class-acf-field-taxonomy.php:701
#, php-format #, php-format
msgctxt "No terms" msgctxt "No terms"
msgid "No %s" msgid "No %s"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:752 #: includes/fields/class-acf-field-taxonomy.php:742
msgid "Select the taxonomy to be displayed" msgid "Select the taxonomy to be displayed"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:761 #: includes/fields/class-acf-field-taxonomy.php:751
msgid "Appearance" msgid "Appearance"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:762 #: includes/fields/class-acf-field-taxonomy.php:752
msgid "Select the appearance of this field" msgid "Select the appearance of this field"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:767 #: includes/fields/class-acf-field-taxonomy.php:757
msgid "Multiple Values" msgid "Multiple Values"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:769 #: includes/fields/class-acf-field-taxonomy.php:759
msgid "Multi Select" msgid "Multi Select"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:771 #: includes/fields/class-acf-field-taxonomy.php:761
msgid "Single Value" msgid "Single Value"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:772 #: includes/fields/class-acf-field-taxonomy.php:762
msgid "Radio Buttons" msgid "Radio Buttons"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:796 #: includes/fields/class-acf-field-taxonomy.php:786
msgid "Create Terms" msgid "Create Terms"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:797 #: includes/fields/class-acf-field-taxonomy.php:787
msgid "Allow new terms to be created whilst editing" msgid "Allow new terms to be created whilst editing"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:806 #: includes/fields/class-acf-field-taxonomy.php:796
msgid "Save Terms" msgid "Save Terms"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:807 #: includes/fields/class-acf-field-taxonomy.php:797
msgid "Connect selected terms to the post" msgid "Connect selected terms to the post"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:816 #: includes/fields/class-acf-field-taxonomy.php:806
msgid "Load Terms" msgid "Load Terms"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:817 #: includes/fields/class-acf-field-taxonomy.php:807
msgid "Load value from posts terms" msgid "Load value from posts terms"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:831 #: includes/fields/class-acf-field-taxonomy.php:821
msgid "Term Object" msgid "Term Object"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:832 #: includes/fields/class-acf-field-taxonomy.php:822
msgid "Term ID" msgid "Term ID"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:882 #: includes/fields/class-acf-field-taxonomy.php:872
#, php-format #, php-format
msgid "User unable to add new %s" msgid "User unable to add new %s"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:892 #: includes/fields/class-acf-field-taxonomy.php:882
#, php-format #, php-format
msgid "%s already exists" msgid "%s already exists"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:924 #: includes/fields/class-acf-field-taxonomy.php:914
#, php-format #, php-format
msgid "%s added" msgid "%s added"
msgstr "" msgstr ""
#: includes/fields/class-acf-field-taxonomy.php:970 #: includes/fields/class-acf-field-taxonomy.php:960
#: includes/locations/class-acf-location-user-form.php:66 #: includes/locations/class-acf-location-user-form.php:66
msgid "Add" msgid "Add"
msgstr "" msgstr ""
@ -2763,68 +2772,68 @@ msgid ""
"a>." "a>."
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:28 #: pro/admin/views/html-settings-updates.php:26
msgid "License Key" msgid "License Key"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:60 #: pro/admin/views/html-settings-updates.php:58
msgid "Update Information" msgid "Update Information"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:67 #: pro/admin/views/html-settings-updates.php:65
msgid "Current Version" msgid "Current Version"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:75 #: pro/admin/views/html-settings-updates.php:73
msgid "Latest Version" msgid "Latest Version"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:83 #: pro/admin/views/html-settings-updates.php:81
msgid "Update Available" msgid "Update Available"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:91 #: pro/admin/views/html-settings-updates.php:89
msgid "Update Plugin" msgid "Update Plugin"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:93 #: pro/admin/views/html-settings-updates.php:91
msgid "Please enter your license key above to unlock updates" msgid "Please enter your license key above to unlock updates"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:99 #: pro/admin/views/html-settings-updates.php:97
msgid "Check Again" msgid "Check Again"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:106 #: pro/admin/views/html-settings-updates.php:104
msgid "Changelog" msgid "Changelog"
msgstr "" msgstr ""
#: pro/admin/views/html-settings-updates.php:116 #: pro/admin/views/html-settings-updates.php:114
msgid "Upgrade Notice" msgid "Upgrade Notice"
msgstr "" msgstr ""
#: pro/blocks.php:36 #: pro/blocks.php:37
msgid "Block type name is required." msgid "Block type name is required."
msgstr "" msgstr ""
#: pro/blocks.php:43 #: pro/blocks.php:44
#, php-format #, php-format
msgid "Block type \"%s\" is already registered." msgid "Block type \"%s\" is already registered."
msgstr "" msgstr ""
#: pro/blocks.php:418 #: pro/blocks.php:444
msgid "Switch to Edit" msgid "Switch to Edit"
msgstr "" msgstr ""
#: pro/blocks.php:419 #: pro/blocks.php:445
msgid "Switch to Preview" msgid "Switch to Preview"
msgstr "" msgstr ""
#: pro/blocks.php:420 #: pro/blocks.php:446
msgid "Change content alignment" msgid "Change content alignment"
msgstr "" msgstr ""
#: pro/blocks.php:423 #: pro/blocks.php:449
#, php-format #, php-format
msgid "%s settings" msgid "%s settings"
msgstr "" msgstr ""
@ -2834,53 +2843,53 @@ msgctxt "noun"
msgid "Clone" msgid "Clone"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:812 #: pro/fields/class-acf-field-clone.php:809
msgid "Select one or more fields you wish to clone" msgid "Select one or more fields you wish to clone"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:829 #: pro/fields/class-acf-field-clone.php:826
msgid "Display" msgid "Display"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:830 #: pro/fields/class-acf-field-clone.php:827
msgid "Specify the style used to render the clone field" msgid "Specify the style used to render the clone field"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:835 #: pro/fields/class-acf-field-clone.php:832
msgid "Group (displays selected fields in a group within this field)" msgid "Group (displays selected fields in a group within this field)"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:836 #: pro/fields/class-acf-field-clone.php:833
msgid "Seamless (replaces this field with selected fields)" msgid "Seamless (replaces this field with selected fields)"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:857 #: pro/fields/class-acf-field-clone.php:854
#, php-format #, php-format
msgid "Labels will be displayed as %s" msgid "Labels will be displayed as %s"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:860 #: pro/fields/class-acf-field-clone.php:857
msgid "Prefix Field Labels" msgid "Prefix Field Labels"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:871 #: pro/fields/class-acf-field-clone.php:868
#, php-format #, php-format
msgid "Values will be saved as %s" msgid "Values will be saved as %s"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:874 #: pro/fields/class-acf-field-clone.php:871
msgid "Prefix Field Names" msgid "Prefix Field Names"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:992 #: pro/fields/class-acf-field-clone.php:989
msgid "Unknown field" msgid "Unknown field"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:1031 #: pro/fields/class-acf-field-clone.php:1028
msgid "Unknown field group" msgid "Unknown field group"
msgstr "" msgstr ""
#: pro/fields/class-acf-field-clone.php:1035 #: pro/fields/class-acf-field-clone.php:1032
#, php-format #, php-format
msgid "All fields from %s field group" msgid "All fields from %s field group"
msgstr "" msgstr ""
@ -3117,14 +3126,6 @@ msgid ""
"\">details & pricing</a>." "\">details & pricing</a>."
msgstr "" msgstr ""
#: tests/basic/test-blocks.php:279
msgid "Hero"
msgstr ""
#: tests/basic/test-blocks.php:280
msgid "Display a random hero image."
msgstr ""
#. Plugin URI of the plugin/theme #. Plugin URI of the plugin/theme
#. Author URI of the plugin/theme #. Author URI of the plugin/theme
msgid "https://www.advancedcustomfields.com" msgid "https://www.advancedcustomfields.com"

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,7 @@ defined( 'ABSPATH' ) || exit;
// Register store. // Register store.
acf_register_store( 'block-types' ); acf_register_store( 'block-types' );
acf_register_store( 'block-cache' );
/** /**
* acf_register_block_type * acf_register_block_type
@ -52,7 +53,7 @@ function acf_register_block_type( $block ) {
if( function_exists('register_block_type') ) { if( function_exists('register_block_type') ) {
register_block_type($block['name'], array( register_block_type($block['name'], array(
'attributes' => acf_get_block_type_default_attributes( $block ), 'attributes' => acf_get_block_type_default_attributes( $block ),
'render_callback' => 'acf_rendered_block', 'render_callback' => 'acf_render_block_callback',
)); ));
} }
@ -283,24 +284,47 @@ function acf_prepare_block( $block ) {
} }
/** /**
* acf_rendered_block * The render callback for all ACF blocks.
* *
* Returns the HTML from acf_render_block(). * @date 28/10/20
* @since 5.9.2
*
* @param array $attributes The block attributes.
* @param string $content The block content.
* @param WP_Block $wp_block The block instance (since WP 5.5).
* @return string The block HTML.
*/
function acf_render_block_callback( $attributes, $content = '', $wp_block = null ) {
$is_preview = false;
$post_id = get_the_ID();
// Set preview flag to true when rendering for the block editor.
if( is_admin() && acf_is_block_editor() ) {
$is_preview = true;
}
// Return rendered block HTML.
return acf_rendered_block( $attributes, $content, $is_preview, $post_id, $wp_block );
}
/**
* Returns the rendered block HTML.
* *
* @date 28/2/19 * @date 28/2/19
* @since 5.7.13 * @since 5.7.13
* @see acf_render_block() for list of parameters.
* *
* @return string * @param array $attributes The block attributes.
* @param string $content The block content.
* @param bool $is_preview Whether or not the block is being rendered for editing preview.
* @param int $post_id The current post being edited or viewed.
* @param WP_Block $wp_block The block instance (since WP 5.5).
* @return string The block HTML.
*/ */
function acf_rendered_block( $block, $content = '', $is_preview = false, $post_id = 0 ) { function acf_rendered_block( $attributes, $content = '', $is_preview = false, $post_id = 0, $wp_block = null ) {
// Gutenberg plugin passes different parameters to core.
$is_preview = is_bool( $is_preview ) ? $is_preview : false;
// Capture block render output. // Capture block render output.
ob_start(); ob_start();
acf_render_block( $block, $content, $is_preview, $post_id ); acf_render_block( $attributes, $content, $is_preview, $post_id, $wp_block );
$html = ob_get_clean(); $html = ob_get_clean();
// Replace <InnerBlocks /> placeholder on front-end. // Replace <InnerBlocks /> placeholder on front-end.
@ -309,27 +333,29 @@ function acf_rendered_block( $block, $content = '', $is_preview = false, $post_i
$content = str_replace( '$', '\$', $content ); $content = str_replace( '$', '\$', $content );
$html = preg_replace( '/<InnerBlocks([\S\s]*?)\/>/', $content, $html ); $html = preg_replace( '/<InnerBlocks([\S\s]*?)\/>/', $content, $html );
} }
// Store in cache for preloading.
acf_get_store( 'block-cache' )->set( $attributes['id'], $html );
return $html; return $html;
} }
/** /**
* acf_render_block
*
* Renders the block HTML. * Renders the block HTML.
* *
* @date 19/2/19 * @date 19/2/19
* @since 5.7.12 * @since 5.7.12
* *
* @param array $block The block props. * @param array $attributes The block attributes.
* @param string $content The block content (emtpy string). * @param string $content The block content.
* @param bool $is_preview True during AJAX preview. * @param bool $is_preview Whether or not the block is being rendered for editing preview.
* @param int $post_id The post being edited. * @param int $post_id The current post being edited or viewed.
* @param WP_Block $wp_block The block instance (since WP 5.5).
* @return void * @return void
*/ */
function acf_render_block( $block, $content = '', $is_preview = false, $post_id = 0 ) { function acf_render_block( $attributes, $content = '', $is_preview = false, $post_id = 0, $wp_block = null ) {
// Prepare block ensuring all settings and attributes exist. // Prepare block ensuring all settings and attributes exist.
$block = acf_prepare_block( $block ); $block = acf_prepare_block( $attributes );
if( !$block ) { if( !$block ) {
return ''; return '';
} }
@ -347,7 +373,7 @@ function acf_render_block( $block, $content = '', $is_preview = false, $post_id
// Call render_callback. // Call render_callback.
if( is_callable( $block['render_callback'] ) ) { if( is_callable( $block['render_callback'] ) ) {
call_user_func( $block['render_callback'], $block, $content, $is_preview, $post_id ); call_user_func( $block['render_callback'], $block, $content, $is_preview, $post_id, $wp_block );
// Or include template. // Or include template.
} elseif( $block['render_template'] ) { } elseif( $block['render_template'] ) {
@ -412,7 +438,7 @@ function acf_get_block_fields( $block ) {
* @return void * @return void
*/ */
function acf_enqueue_block_assets() { function acf_enqueue_block_assets() {
// Localize text. // Localize text.
acf_localize_text(array( acf_localize_text(array(
'Switch to Edit' => __('Switch to Edit', 'acf'), 'Switch to Edit' => __('Switch to Edit', 'acf'),
@ -437,6 +463,7 @@ function acf_enqueue_block_assets() {
'cellspacing' => 'cellSpacing', 'cellspacing' => 'cellSpacing',
'class' => 'className', 'class' => 'className',
'colspan' => 'colSpan', 'colspan' => 'colSpan',
'datetime' => 'dateTime',
'for' => 'htmlFor', 'for' => 'htmlFor',
'hreflang' => 'hrefLang', 'hreflang' => 'hrefLang',
'readonly' => 'readOnly', 'readonly' => 'readOnly',
@ -454,6 +481,15 @@ function acf_enqueue_block_assets() {
// Enqueue block assets. // Enqueue block assets.
array_map( 'acf_enqueue_block_type_assets', $block_types ); array_map( 'acf_enqueue_block_type_assets', $block_types );
// During the edit screen loading, WordPress renders all blocks in its own attempt to preload data.
// Retrieve any cached block HTML and include this in the localized data.
if( defined('ACF_EXPERIMENTAL_PRELOAD_BLOCKS') && ACF_EXPERIMENTAL_PRELOAD_BLOCKS ) {
$preloaded_blocks = acf_get_store( 'block-cache' )->get_data();
acf_localize_data(array(
'preloadedBlocks' => $preloaded_blocks
));
}
} }
/** /**

View File

@ -194,30 +194,27 @@ class acf_field_clone extends acf_field {
$this->cloning[ $field['key'] ] = 1; $this->cloning[ $field['key'] ] = 1;
// loop // Loop over selectors and load fields.
foreach( $field['clone'] as $selector ) { foreach( $field['clone'] as $selector ) {
// field group // Field Group selector.
if( acf_is_field_group_key($selector) ) { if( acf_is_field_group_key($selector) ) {
// vars $field_group = acf_get_field_group( $selector );
$field_group = acf_get_field_group($selector); if( !$field_group ) {
$field_group_fields = acf_get_fields($field_group); continue;
}
$field_group_fields = acf_get_fields( $field_group );
if( !$field_group_fields ) {
continue;
}
// bail early if no fields $fields = array_merge( $fields, $field_group_fields );
if( !$field_group_fields ) continue;
// Field selector.
// append
$fields = array_merge($fields, $field_group_fields);
// field
} elseif( acf_is_field_key($selector) ) { } elseif( acf_is_field_key($selector) ) {
$fields[] = acf_get_field( $selector );
// append
$fields[] = acf_get_field($selector);
} }
} }

View File

@ -67,6 +67,25 @@ From your WordPress dashboard
== Changelog == == Changelog ==
= 5.9.3 =
*Release Date - 3 November 2020*
* Fix - Fixed bug causing Revision meta to incorrectly update the parent Post meta.
* Fix - Fixed bug breaking "Filter by Post Type" and "Filter by Taxonomy" Field settings.
= 5.9.2 =
*Release Date - 29 October 2020*
* Enhancement - Added experiment for preloading block HTML and reducing AJAX requests on page load.
* Fix - Added boolean attribute value detection to JSX parser (fixes issue with templateLock="false").
* Fix - Added "dateTime" attribute to JSX parser ruleset.
* Fix - Fixed unresponsive Select2 instances after duplicating a row or layout.
* Fix - Added missing Color Picker script translations for previous WordPress versions.
* Fix - Fixed bug in Clone Field causing potential PHP error if cloning a Field Group that no longer exists.
* Fix - Fixed PHP warning logged when comparing a revision that contains values for a Field that no longer exist.
* Dev - Added `$wp_block` parameter to block render_callback and render_template (unavailable during AJAX preview requests).
* Dev - Deprecated `acf_get_term_post_id()` function.
= 5.9.1 = = 5.9.1 =
*Release Date - 8 September 2020* *Release Date - 8 September 2020*