Update to v5.9.9

This commit is contained in:
Titouan Mathis 2021-07-22 14:55:46 +02:00
parent 55214cb856
commit e07920e956
No known key found for this signature in database
GPG Key ID: A292A3DB3103F19D
47 changed files with 20781 additions and 17723 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.8
Version: 5.9.9
Author: Delicious Brains
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.8';
var $version = '5.9.9';
/** @var array The plugin settings array. */
var $settings = array();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,5 @@
(function ($) {
(function($){
/*
* Repeater
*
@ -11,42 +12,51 @@
* @param n/a
* @return n/a
*/
var RepeaterCollapsedFieldSetting = acf.FieldSetting.extend({
type: 'repeater',
name: 'collapsed',
events: {
'focus select': 'onFocus'
'focus select': 'onFocus',
},
onFocus: function (e, $el) {
onFocus: function( e, $el ){
// vars
var $select = $el; // collapsed
var $select = $el;
var choices = []; // keep 'null' choice
// collapsed
var choices = [];
// keep 'null' choice
choices.push({
label: $select.find('option[value=""]').text(),
value: ''
}); // find sub fields
});
// find sub fields
var $list = this.fieldObject.$('.acf-field-list:first');
var fields = acf.getFieldObjects({
list: $list
}); // loop
});
fields.map(function (field) {
// loop
fields.map(function( field ){
choices.push({
label: field.prop('label'),
value: field.prop('key')
});
}); // render
});
acf.renderSelect($select, choices);
// render
acf.renderSelect( $select, choices );
}
});
acf.registerFieldSetting(RepeaterCollapsedFieldSetting);
})(jQuery);
(function ($) {
acf.registerFieldSetting( RepeaterCollapsedFieldSetting );
})(jQuery);
(function($){
/**
* CloneDisplayFieldSetting
*
@ -58,177 +68,216 @@
* @param void
* @return void
*/
var FlexibleContentLayoutFieldSetting = acf.FieldSetting.extend({
type: 'flexible_content',
name: 'fc_layout',
events: {
'blur .layout-label': 'onChangeLabel',
'click .add-layout': 'onClickAdd',
'click .duplicate-layout': 'onClickDuplicate',
'click .delete-layout': 'onClickDelete'
},
$input: function (name) {
$input: function( name ){
return $('#' + this.getInputId() + '-' + name);
},
$list: function () {
$list: function(){
return this.$('.acf-field-list:first');
},
getInputId: function () {
getInputId: function(){
return this.fieldObject.getInputId() + '-layouts-' + this.field.get('id');
},
// get all sub fields
getFields: function () {
return acf.getFieldObjects({
parent: this.$el
});
getFields: function(){
return acf.getFieldObjects({ parent: this.$el });
},
// get imediate children
getChildren: function () {
return acf.getFieldObjects({
list: this.$list()
});
getChildren: function(){
return acf.getFieldObjects({ list: this.$list() });
},
initialize: function () {
initialize: function(){
// add sortable
var $tbody = this.$el.parent();
if( !$tbody.hasClass('ui-sortable') ) {
if (!$tbody.hasClass('ui-sortable')) {
$tbody.sortable({
items: '> .acf-field-setting-fc_layout',
handle: '.reorder-layout',
forceHelperSize: true,
forcePlaceholderSize: true,
scroll: true,
stop: this.proxy(function (event, ui) {
stop: this.proxy(function(event, ui) {
this.fieldObject.save();
})
});
} // add meta to sub fields
}
// add meta to sub fields
this.updateFieldLayouts();
},
updateFieldLayouts: function () {
updateFieldLayouts: function(){
this.getChildren().map(this.updateFieldLayout, this);
},
updateFieldLayout: function (field) {
updateFieldLayout: function( field ){
field.prop('parent_layout', this.get('id'));
},
onChangeLabel: function (e, $el) {
onChangeLabel: function( e, $el ){
// vars
var label = $el.val();
var $name = this.$input('name'); // render name
var $name = this.$input('name');
if ($name.val() == '') {
// render name
if( $name.val() == '' ) {
acf.val($name, acf.strSanitize(label));
}
},
onClickAdd: function (e, $el) {
onClickAdd: function( e, $el ){
// vars
var prevKey = this.get('id');
var newKey = acf.uniqid('layout_'); // duplicate
var newKey = acf.uniqid('layout_');
// duplicate
$layout = acf.duplicate({
$el: this.$el,
search: prevKey,
replace: newKey,
after: function ($el, $el2) {
after: function( $el, $el2 ){
// vars
var $list = $el2.find('.acf-field-list:first'); // remove sub fields
var $list = $el2.find('.acf-field-list:first');
$list.children('.acf-field-object').remove(); // show empty
// remove sub fields
$list.children('.acf-field-object').remove();
$list.addClass('-empty'); // reset layout meta values
// show empty
$list.addClass('-empty');
// reset layout meta values
$el2.find('.acf-fc-meta input').val('');
}
}); // get layout
});
var layout = acf.getFieldSetting($layout); // update hidden input
// get layout
var layout = acf.getFieldSetting( $layout );
layout.$input('key').val(newKey); // save
// update hidden input
layout.$input('key').val( newKey );
// save
this.fieldObject.save();
},
onClickDuplicate: function (e, $el) {
onClickDuplicate: function( e, $el ){
// vars
var prevKey = this.get('id');
var newKey = acf.uniqid('layout_'); // duplicate
var newKey = acf.uniqid('layout_');
// duplicate
$layout = acf.duplicate({
$el: this.$el,
search: prevKey,
replace: newKey
}); // get all fields in new layout similar to fieldManager.onDuplicateField().
// important to run field.wipe() before making any changes to the "parent_layout" prop
// to ensure the correct input is modified.
var children = acf.getFieldObjects({
parent: $layout
});
if (children.length) {
// get all fields in new layout similar to fieldManager.onDuplicateField().
// important to run field.wipe() before making any changes to the "parent_layout" prop
// to ensure the correct input is modified.
var children = acf.getFieldObjects({ parent: $layout });
if( children.length ) {
// loop
children.map(function (child) {
children.map(function( child ){
// wipe field
child.wipe(); // update parent
child.wipe();
// update parent
child.updateParent();
}); // action
});
// action
acf.doAction('duplicate_field_objects', children, this.fieldObject, this.fieldObject);
} // get layout
}
// get layout
var layout = acf.getFieldSetting( $layout );
var layout = acf.getFieldSetting($layout); // update hidden input
layout.$input('key').val(newKey); // save
// update hidden input
layout.$input('key').val( newKey );
// save
this.fieldObject.save();
},
onClickDelete: function (e, $el) {
onClickDelete: function( e, $el ){
// Bypass confirmation when holding down "shift" key.
if (e.shiftKey) {
if( e.shiftKey ) {
return this.delete();
} // add class
}
// add class
this.$el.addClass('-hover');
this.$el.addClass('-hover'); // add tooltip
// add tooltip
var tooltip = acf.newTooltip({
confirmRemove: true,
target: $el,
context: this,
confirm: function () {
confirm: function(){
this.delete();
},
cancel: function () {
cancel: function(){
this.$el.removeClass('-hover');
}
});
},
delete: function () {
delete: function(){
// vars
var $siblings = this.$el.siblings('.acf-field-setting-fc_layout'); // validate
var $siblings = this.$el.siblings('.acf-field-setting-fc_layout');
if (!$siblings.length) {
alert(acf.__('Flexible Content requires at least 1 layout'));
// validate
if( !$siblings.length ) {
alert( acf.__('Flexible Content requires at least 1 layout') );
return false;
} // delete sub fields
}
this.getFields().map(function (child) {
// delete sub fields
this.getFields().map(function( child ){
child.delete({
animate: false
});
}); // remove tr
});
acf.remove(this.$el); // save
// remove tr
acf.remove( this.$el );
// save
this.fieldObject.save();
}
});
acf.registerFieldSetting(FlexibleContentLayoutFieldSetting);
acf.registerFieldSetting( FlexibleContentLayoutFieldSetting );
/**
* flexibleContentHelper
*
@ -246,31 +295,36 @@
'sortstop_field_object': 'updateParentLayout',
'change_field_object_parent': 'updateParentLayout'
},
updateParentLayout: function (fieldObject) {
// vars
var parent = fieldObject.getParent(); // delete meta
if (!parent || parent.prop('type') !== 'flexible_content') {
updateParentLayout: function( fieldObject ){
// vars
var parent = fieldObject.getParent();
// delete meta
if( !parent || parent.prop('type') !== 'flexible_content' ) {
fieldObject.prop('parent_layout', null);
return;
} // get layout
}
// get layout
var $layout = fieldObject.$el.closest('.acf-field-setting-fc_layout');
var layout = acf.getFieldSetting($layout); // check if previous prop exists
var layout = acf.getFieldSetting($layout);
// check if previous prop exists
// - if not, set prop to allow following code to trigger 'change' and save the field
if (!fieldObject.has('parent_layout')) {
if( !fieldObject.has('parent_layout') ) {
fieldObject.prop('parent_layout', 0);
} // update meta
}
// update meta
fieldObject.prop('parent_layout', layout.get('id'));
}
});
})(jQuery);
(function ($) {
})(jQuery);
(function($){
/**
* CloneDisplayFieldSetting
*
@ -282,17 +336,23 @@
* @param void
* @return void
*/
var CloneDisplayFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'display',
render: function () {
// vars
var display = this.field.val(); // set data attribute used by CSS to hide/show
render: function(){
// vars
var display = this.field.val();
// set data attribute used by CSS to hide/show
this.$fieldObject.attr('data-display', display);
}
});
acf.registerFieldSetting(CloneDisplayFieldSetting);
acf.registerFieldSetting( CloneDisplayFieldSetting );
/**
* ClonePrefixLabelFieldSetting
*
@ -308,19 +368,24 @@
var ClonePrefixLabelFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'prefix_label',
render: function () {
render: function(){
// vars
var prefix = ''; // if checked
var prefix = '';
if (this.field.val()) {
// if checked
if( this.field.val() ) {
prefix = this.fieldObject.prop('label') + ' ';
} // update HTML
}
this.$('code').html(prefix + '%field_label%');
// update HTML
this.$('code').html( prefix + '%field_label%' );
}
});
acf.registerFieldSetting(ClonePrefixLabelFieldSetting);
acf.registerFieldSetting( ClonePrefixLabelFieldSetting );
/**
* ClonePrefixNameFieldSetting
*
@ -336,19 +401,24 @@
var ClonePrefixNameFieldSetting = acf.FieldSetting.extend({
type: 'clone',
name: 'prefix_name',
render: function () {
render: function(){
// vars
var prefix = ''; // if checked
var prefix = '';
if (this.field.val()) {
// if checked
if( this.field.val() ) {
prefix = this.fieldObject.prop('name') + '_';
} // update HTML
}
this.$('code').html(prefix + '%field_name%');
// update HTML
this.$('code').html( prefix + '%field_name%' );
}
});
acf.registerFieldSetting(ClonePrefixNameFieldSetting);
acf.registerFieldSetting( ClonePrefixNameFieldSetting );
/**
* cloneFieldSelectHelper
*
@ -365,35 +435,46 @@
filters: {
'select2_args': 'select2Args'
},
select2Args: function (options, $select, data, $el, instance) {
select2Args: function( options, $select, data, $el, instance ){
// check
if (data.ajaxAction == 'acf/fields/clone/query') {
if( data.ajaxAction == 'acf/fields/clone/query' ) {
// remain open on select
options.closeOnSelect = false; // customize ajaxData function
options.closeOnSelect = false;
// customize ajaxData function
instance.data.ajaxData = this.ajaxData;
} // return
}
// return
return options;
},
ajaxData: function (data) {
// find current fields
data.fields = {}; // loop
acf.getFieldObjects().map(function (fieldObject) {
ajaxData: function( data ){
// find current fields
data.fields = {};
// loop
acf.getFieldObjects().map(function(fieldObject){
// append
data.fields[fieldObject.prop('key')] = {
data.fields[ fieldObject.prop('key') ] = {
key: fieldObject.prop('key'),
type: fieldObject.prop('type'),
label: fieldObject.prop('label'),
ancestors: fieldObject.getParents().length
};
}); // append title
});
data.title = $('#title').val(); // return
// append title
data.title = $('#title').val();
// return
return data;
}
});
})(jQuery);

File diff suppressed because it is too large Load Diff

0
assets/inc/select2/3/select2-spinner.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
assets/inc/select2/3/select2.css vendored Executable file → Normal file
View File

0
assets/inc/select2/3/select2.js vendored Executable file → Normal file
View File

0
assets/inc/select2/3/select2.min.js vendored Executable file → Normal file
View File

0
assets/inc/select2/3/select2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

0
assets/inc/select2/3/select2x2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

0
assets/inc/select2/4/select2.css vendored Executable file → Normal file
View File

0
assets/inc/select2/4/select2.full.js vendored Executable file → Normal file
View File

0
assets/inc/select2/4/select2.full.min.js vendored Executable file → Normal file
View File

0
assets/inc/select2/4/select2.js vendored Executable file → Normal file
View File

0
assets/inc/select2/4/select2.min.css vendored Executable file → Normal file
View File

0
assets/inc/select2/4/select2.min.js vendored Executable file → Normal file
View File

0
assets/inc/timepicker/jquery-ui-timepicker-addon.css Executable file → Normal file
View File

0
assets/inc/timepicker/jquery-ui-timepicker-addon.js vendored Executable file → Normal file
View File

0
assets/inc/timepicker/jquery-ui-timepicker-addon.min.css vendored Executable file → Normal file
View File

0
assets/inc/timepicker/jquery-ui-timepicker-addon.min.js vendored Executable file → Normal file
View File

View File

@ -80,7 +80,7 @@ if( $tabs === false ) {
} ?>
<?php if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) : ?>
<a href="https://www.advancedcustomfields.com/pro/?utm_source=ACF%2BFree&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade" class="btn-upgrade">
<a target="_blank" href="https://www.advancedcustomfields.com/pro/?utm_source=ACF%2BFree&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade" class="btn-upgrade">
<img src="<?php echo acf_get_url('assets/images/icon-upgrade-pro.svg' ); ?>" />
<p><?php _e('Upgrade to Pro', 'acf'); ?></p>
</a>

View File

@ -3478,7 +3478,8 @@ function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
// prepare
} elseif( $context == 'prepare' ) {
$file['type'] = pathinfo($attachment['filename'], PATHINFO_EXTENSION);
$use_path = isset($attachment['filename']) ? $attachment['filename'] : $attachment['url'];
$file['type'] = pathinfo($use_path, PATHINFO_EXTENSION);
$file['size'] = acf_maybe_get($attachment, 'filesizeInBytes', 0);
$file['width'] = acf_maybe_get($attachment, 'width', 0);
$file['height'] = acf_maybe_get($attachment, 'height', 0);
@ -3487,7 +3488,8 @@ function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
} else {
$file = array_merge($file, $attachment);
$file['type'] = pathinfo($attachment['filename'], PATHINFO_EXTENSION);
$use_path = isset($attachment['filename']) ? $attachment['filename'] : $attachment['url'];
$file['type'] = pathinfo($use_path, PATHINFO_EXTENSION);
}

View File

@ -1041,7 +1041,7 @@ function delete_field( $selector, $post_id = false ) {
// delete
return acf_delete_value( $post_id, $field );
return $field ? acf_delete_value( $post_id, $field ) : false;
}

0
includes/fields.php Executable file → Normal file
View File

0
includes/fields/class-acf-field.php Executable file → Normal file
View File

0
includes/local-meta.php Executable file → Normal file
View File

0
lang/acf-ar.mo Executable file → Normal file
View File

0
lang/acf-cs_CZ.mo Executable file → Normal file
View File

0
lang/acf-de_CH.mo Executable file → Normal file
View File

0
lang/acf-de_DE.mo Executable file → Normal file
View File

0
lang/acf-de_DE_formal.mo Executable file → Normal file
View File

0
lang/acf-fr_FR.mo Executable file → Normal file
View File

0
lang/acf-id_ID.mo Executable file → Normal file
View File

0
lang/acf-it_IT.mo Executable file → Normal file
View File

0
lang/acf-ja.mo Executable file → Normal file
View File

0
lang/acf-pt_BR.mo Executable file → Normal file
View File

0
lang/acf-sk_SK.mo Executable file → Normal file
View File

View File

@ -16,7 +16,7 @@ $readonly = $active ? 1 : 0;
<h3><?php _e('License Information', 'acf'); ?></h3>
</div>
<div class="inner">
<p><?php printf(__('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 & pricing</a>.','acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?></p>
<p><?php printf(__('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 & pricing</a>.','acf'), esc_url('https://www.advancedcustomfields.com/pro/?utm_source=ACF%2Bpro%2Bplugin&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade&utm_content=license%2Bactivations')); ?></p>
<form action="" method="post">
<?php acf_nonce_input( $nonce ); ?>
<table class="form-table">

0
pro/blocks.php Executable file → Normal file
View File

0
pro/locations/class-acf-location-block.php Executable file → Normal file
View File

View File

@ -94,7 +94,7 @@ class acf_pro_updates {
// display message
echo '<br />' . sprintf( __('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">details & pricing</a>.', 'acf'), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'https://www.advancedcustomfields.com/pro' );
echo '<br />' . sprintf( __('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" target="_blank">details & pricing</a>.', 'acf'), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-updates'), 'https://www.advancedcustomfields.com/pro/?utm_source=ACF%2Bpro%2Bplugin&utm_medium=insideplugin&utm_campaign=ACF%2Bupgrade&utm_content=updates' );
}

View File

@ -2,8 +2,9 @@
Contributors: elliotcondon
Tags: acf, fields, custom fields, meta, repeater
Requires at least: 4.7
Tested up to: 5.7
Tested up to: 5.8
Requires PHP: 5.6
Stable tag: 5.9.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@ -65,6 +66,13 @@ From your WordPress dashboard
== Changelog ==
= 5.9.9 =
*Release Date - 20 July 2021*
* Fix - Fixed warning when deleting fields which don't exist
* Fix - Fixed issues with older browsers and the blocks JavaScript
* Fix - Fixed file size & file type validation for front end forms using the basic uploader
= 5.9.8 =
*Release Date - 08 July 2021*