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27kfv9paLuPwrZ
 RPQkbbL/4TyhMZv4eQKtlslDyVTUh5teBGMzzcl1GWiY2f7ngNVJVUiDWna5MzFQ
 OcQh1NZYOsITSk7NdJwgYs0+Ej8tqSSrwJkDGyJm1fPVBXn98yqHvLn65oLKDTkt
 +F3pL0RThdUOK4/AMIfk7CatxtXXkmlB5g2zc/UOsTsJ2O9Z3VmLazfDSx4ea7Iv
 laXpdh72CgB42/BNN/REKty2N+9gJYJSs9aKXWCLnqF43g86qvL+qPJhELQZTRDt
 lv7vyw34qicgIBv9zQANMmD72ROx9p0q7DiLqhkFXJZmbyYPNSJR5VTAjdQ07zLv
 GawQ6xA6sxFnffr38oLACMKAky/s9G7y4tcSGJLtKCHL4+cpul7vdnjt34UbWvPM
 1NvcHW1rgs4mqn0sAij2E0wiseH/55JWGcVetnzT0LfduKb24hUeOov0VcWNvgaV
 vq1UiW2AhZv/Li2E9WAfWlrqwEo5ah+qy2GIWOF/1rRcG9ZwXfDub8t/2vcUWncN
 slgB1CrFOeW1474dbmEGzqb+E7xrD+jaiadOEBfzXsgakA8V1pI=
 =Pknp
 -----END PGP SIGNATURE-----

Merge tag '5.9.7' into develop

v5.9.7

Changed
- Update to v5.9.7 (0adb1f9)
This commit is contained in:
Titouan Mathis 2021-06-23 13:08:39 +02:00
commit c4dd1e9856
40 changed files with 168 additions and 151 deletions

View File

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

0
assets/inc/select2/3/select2-spinner.gif Normal file → Executable 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 Normal file → Executable file
View File

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

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

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

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

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

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

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

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

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

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

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

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

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

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

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

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

View File

@ -45,7 +45,7 @@ class ACF_Admin {
$cap = acf_get_setting('capability');
// Add menu items.
add_menu_page( __("Custom Fields",'acf'), __("Custom Fields",'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025' );
add_menu_page( __("Custom Fields",'acf'), __("Custom Fields",'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', 80 );
add_submenu_page( $slug, __('Field Groups','acf'), __('Field Groups','acf'), $cap, $slug );
add_submenu_page( $slug, __('Add New','acf'), __('Add New','acf'), $cap, 'post-new.php?post_type=acf-field-group' );
}

View File

@ -3436,13 +3436,13 @@ function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
/*
* acf_validate_attachment
*
* This function will validate an attachment based on a field's resrictions and return an array of errors
* This function will validate an attachment based on a field's restrictions and return an array of errors
*
* @type function
* @date 3/07/2015
* @since 5.2.3
*
* @param $attachment (array) attachment data. Cahnges based on context
* @param $attachment (array) attachment data. Changes based on context
* @param $field (array) field settings containing restrictions
* @param $context (string) $file is different when uploading / preparing
* @return $errors (array)
@ -3478,7 +3478,7 @@ function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
// prepare
} elseif( $context == 'prepare' ) {
$file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
$file['type'] = pathinfo($attachment['filename'], 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 +3487,7 @@ function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
} else {
$file = array_merge($file, $attachment);
$file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
$file['type'] = pathinfo($attachment['filename'], PATHINFO_EXTENSION);
}

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

View File

@ -163,7 +163,9 @@ class acf_field_email extends acf_field {
* @return bool|string
*/
public function validate_value( $valid, $value, $field, $input ) {
if ( $value && filter_var( wp_unslash($value), FILTER_VALIDATE_EMAIL ) === false ) {
$flags = defined( 'FILTER_FLAG_EMAIL_UNICODE' ) ? FILTER_FLAG_EMAIL_UNICODE : 0;
if ( $value && filter_var( wp_unslash($value), FILTER_VALIDATE_EMAIL, $flags ) === false ) {
return sprintf( __( "'%s' is not a valid email address", 'acf' ), esc_html( $value ) );
}

View File

@ -237,7 +237,7 @@ class acf_field_wysiwyg extends acf_field {
}
// must be logged in tp upload
// must be logged in to upload
if( !current_user_can('upload_files') ) {
$field['media_upload'] = 0;
@ -250,6 +250,7 @@ class acf_field_wysiwyg extends acf_field {
// filter
add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 );
$field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor );

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

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

View File

@ -6,49 +6,40 @@ if( ! class_exists('ACF_Media') ) :
class ACF_Media {
/*
* __construct
*
* Initialize filters, action, variables and includes
*
* @type function
* @date 23/06/12
* @since 5.0.0
*
* @param N/A
* @return N/A
*/
function __construct() {
/**
* Constructor.
*
* @date 23/06/12
* @since 5.0.0
*
* @param void
* @return void
*/
public function __construct() {
// actions
add_action('acf/enqueue_scripts', array($this, 'enqueue_scripts'));
add_action('acf/save_post', array($this, 'save_files'), 5, 1);
// Localize media strings.
add_action( 'acf/enqueue_scripts', array( $this, 'enqueue_scripts' ) );
// Save files uploaded from basic `$_FILE` field.
add_action( 'acf/save_post', array( $this, 'save_files' ), 5, 1 );
// filters
add_filter('wp_handle_upload_prefilter', array($this, 'handle_upload_prefilter'), 10, 1);
// Hook into Media Upload to run additional logic.
add_filter( 'wp_handle_upload_prefilter', array( $this, 'handle_upload_prefilter' ), 10, 1 );
// ajax
add_action('wp_ajax_query-attachments', array($this, 'wp_ajax_query_attachments'), -1);
// Hook into Media Modal Query to run additional logic.
add_action( 'wp_ajax_query-attachments', array( $this, 'wp_ajax_query_attachments' ), -1 );
}
/**
* enqueue_scripts
*
* Localizes data
*
* @date 27/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
function enqueue_scripts(){
* Fires when ACF scrtips are enqueued.
*
* @date 27/4/18
* @since 5.6.9
*
* @param void
* @return void
*/
public function enqueue_scripts(){
if( wp_script_is('acf-input') ) {
acf_localize_text(array(
'Select.verb' => _x('Select', 'verb', 'acf'),
@ -66,149 +57,162 @@ class ACF_Media {
));
}
}
/*
* handle_upload_prefilter
*
* description
*
* @type function
* @date 16/02/2015
* @since 5.1.5
*
* @param $post_id (int)
* @return $post_id (int)
*/
function handle_upload_prefilter( $file ) {
// bail early if no acf field
if( empty($_POST['_acfuploader']) ) {
return $file;
/**
* Uploads attachments found in the basic `$_FILES` array.
*
* @date 24/10/2014
* @since 5.0.9
*
* @param string|int $post_id The post ID being saved.
* @return void
*/
public function save_files( $post_id = 0 ) {
if( isset( $_FILES['acf']['name'] ) ) {
acf_upload_files();
}
// load field
$field = acf_get_field( $_POST['_acfuploader'] );
}
/**
* Filters data for the current file being uploaded.
*
* @date 16/02/2015
* @since 5.1.5
*
* @param array $file An array of data for a single file.
* @return array
*/
public function handle_upload_prefilter( $file ) {
$field = $this->get_source_field();
if( !$field ) {
return $file;
}
// get errors
// Validate the attachment and append any errors.
$errors = acf_validate_attachment( $file, $field, 'upload' );
/**
* Filters the errors for a file before it is uploaded to WordPress.
*
* @date 16/02/2015
* @since 5.1.5
*
* @param array $errors An array of errors.
* @param array $file An array of data for a single file.
* @param array $field The field array.
*/
* Filters the errors for a file before it is uploaded to WordPress.
*
* @date 16/02/2015
* @since 5.1.5
*
* @param array $errors An array of errors.
* @param array $file An array of data for a single file.
* @param array $field The field array.
*/
$errors = apply_filters( "acf/upload_prefilter/type={$field['type']}", $errors, $file, $field );
$errors = apply_filters( "acf/upload_prefilter/name={$field['_name']}", $errors, $file, $field );
$errors = apply_filters( "acf/upload_prefilter/key={$field['key']}", $errors, $file, $field );
$errors = apply_filters( "acf/upload_prefilter", $errors, $file, $field );
// append error
// Append errors.
if( !empty($errors) ) {
$file['error'] = implode("\n", $errors);
}
// Ensure newly uploaded image contains "preview_size" within the "size" data.
add_filter( 'image_size_names_choose', array( $this, 'image_size_names_choose' ), 10, 1 );
// return
// Return.
return $file;
}
/*
* save_files
*
* This function will save the $_FILES data
*
* @type function
* @date 24/10/2014
* @since 5.0.9
*
* @param $post_id (int)
* @return $post_id (int)
*/
function save_files( $post_id = 0 ) {
/**
* Returns the field responsible for the current Media query or upload context.
*
* @date 21/5/21
* @since 5.9.7
*
* @param void
* @return array| false.
*/
private function get_source_field() {
$field = false;
// bail early if no $_FILES data
if( empty($_FILES['acf']['name']) ) {
return;
// Search for field key within available data.
// Case 1) Media modal query.
if( isset( $_POST['query']['_acfuploader'] ) ) {
$field_key = (string) $_POST['query']['_acfuploader'];
// Case 2) Media modal upload.
} elseif( isset( $_POST['_acfuploader'] ) ) {
$field_key = (string) $_POST['_acfuploader'];
}
// upload files
acf_upload_files();
// Attempt to load field.
// Note the `acf_get_field()` function will return false if not found.
if( isset( $field_key ) ) {
$field = acf_get_field( $field_key );
}
return $field;
}
/*
* wp_ajax_query_attachments
*
* description
*
* @type function
* @date 26/06/2015
* @since 5.2.3
*
* @param $post_id (int)
* @return $post_id (int)
*/
/**
* Fires during the WP Modal Query AJAX call.
*
* @date 26/06/2015
* @since 5.2.3
*
* @param void
* @return void
*/
function wp_ajax_query_attachments() {
add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3);
if( $this->get_source_field() ) {
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'wp_prepare_attachment_for_js' ), 10, 3 );
add_filter( 'image_size_names_choose', array( $this, 'image_size_names_choose' ), 10, 1 );
}
}
/**
* Filters attachment data as it is being prepared for JS.
*
* @date 21/5/21
* @since 5.9.7
*
* @param array $response Array of prepared attachment data.
* @param WP_Post $attachment Attachment object.
* @param array|false $meta Array of attachment meta data, or false if there is none.
* @return array
*/
function wp_prepare_attachment_for_js( $response, $attachment, $meta ) {
$field = $this->get_source_field();
// append attribute
$response['acf_errors'] = false;
// bail early if no acf field
if( empty($_POST['query']['_acfuploader']) ) {
return $response;
}
// load field
$field = acf_get_field( $_POST['query']['_acfuploader'] );
if( !$field ) {
return $response;
}
// get errors
// Validate the attachment and append any errors.
$errors = acf_validate_attachment( $response, $field, 'prepare' );
// append errors
if( !empty($errors) ) {
$response['acf_errors'] = implode('<br />', $errors);
}
// return
// Return.
return $response;
}
/**
* Filters the names and labels of the default image sizes.
*
* @date 21/5/21
* @since 5.9.7
*
* @param array $size_names Array of image size labels keyed by their name.
* @return array
*/
function image_size_names_choose( $size_names ) {
$field = $this->get_source_field();
// Append "preview_size" setting to array of image sizes so WP will include in prepared JS data.
if( isset( $field['preview_size'] ) ) {
$name = (string) $field['preview_size'];
$size_names[ $name ] = $name; // Don't worry about size label, it is never used.
}
return $size_names;
}
}
// instantiate
acf_new_instance('ACF_Media');
// Instantiate.
acf_new_instance( 'ACF_Media' );
endif; // class_exists check
?>
endif; // class_exists check

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@ -96,7 +96,10 @@ class acf_options_page {
if( empty($page['menu_slug']) ) {
$page['menu_slug'] = 'acf-options-' . sanitize_title( $page['menu_title'] );
}
// Standardize on position being either null or int.
$page['position'] = is_numeric( $page['position'] ) ? (int) $page['position'] : null;
/**
* Filters the $page array after it has been validated.
*

View File

@ -51,8 +51,6 @@ From your WordPress dashboard
= What kind of support do you provide? =
**Help Desk.** Support is currently provided via our email help desk. Questions are generally answered within 24 hours, with the exception of weekends and holidays. We answer questions related to ACF, its usage and provide minor customization guidance. We cannot guarantee support for questions which include custom theme code, or 3rd party plugin conflicts & compatibility. [Open a Support Ticket](https://www.advancedcustomfields.com/support/)
**Support Forums.** Our Community Forums provide a great resource for searching and finding previously answered and asked support questions. You may create a new thread on these forums, however, it is not guaranteed that you will receive an answer from our support team. This is more of an area for developers to talk to one another, post ideas, plugins and provide basic help. [View the Support Forum](https://support.advancedcustomfields.com/)
@ -67,6 +65,15 @@ From your WordPress dashboard
== Changelog ==
= 5.9.7 =
*Release Date - 22 June 2021*
* Fix - Fixed PHP warnings logged due to incorrect parameter type for `add_menu_page()`/`add_submenu_page()`
* Fix - Fixed bug causing WYSIWYG field to not keep line breaks
* Fix - Fixed bug causing Email field to incorrectly invalidate emails with unicode characters
* Fix - Fixed bug causing file type validation to fail in some cases
* Fix - Fixed bug where newly uploaded or selected images do not contain custom preview size data
= 5.9.6 =
*Release Date - 20 May 2021*