Skip to content

Commit

Permalink
v5.12.2
Browse files Browse the repository at this point in the history
Signed-off-by: Kolja Nolte <[email protected]>
  • Loading branch information
thaikolja committed Apr 14, 2022
1 parent 212be13 commit 11f28c1
Show file tree
Hide file tree
Showing 16 changed files with 784 additions and 795 deletions.
Empty file removed .gitlab-ci.yml
Empty file.
1,469 changes: 735 additions & 734 deletions acf.php

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions assets/build/css/acf-dark.css.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/build/css/acf-field-group.css.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/build/css/acf-global.css.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/build/css/acf-input.css.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/build/css/pro/acf-pro-field-group.css.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/build/css/pro/acf-pro-input.css.js

This file was deleted.

4 changes: 2 additions & 2 deletions assets/build/js/pro/acf-pro-input.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/build/js/pro/acf-pro-input.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/build/js/pro/acf-pro-input.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wordpress-premium/advanced-custom-fields-pro",
"description": "Customise WordPress with powerful, professional and intuitive fields.",
"type": "wordpress-plugin",
"version": "5.12.1",
"version": "5.12.2",
"homepage": "https://www.advancedcustomfields.com",
"require": {
"composer/installers": "^1.6"
Expand Down
38 changes: 25 additions & 13 deletions includes/acf-value-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,42 @@ function acf_get_value( $post_id, $field ) {
// Get field ID & type.
$decoded = acf_decode_post_id( $post_id );

$allow_load = true;

// If we don't have a proper field array, the field doesn't exist currently.
if ( empty( $field['type'] ) && empty( $field['key'] ) ) {

// Check if we should trigger warning about accessing fields too early via action.
do_action( 'acf/get_invalid_field_value', $field, __FUNCTION__ );

if ( apply_filters( 'acf/prevent_access_to_unknown_fields', false ) || ( 'option' === $decoded['type'] && 'options' !== $decoded['id'] ) ) {
return null;
$allow_load = false;
}

do_action( 'acf/get_invalid_field_value', $field, __FUNCTION__ );
}

// If we're using a non options_ option key, ensure we have a valid reference key.
if ( 'option' === $decoded['type'] && 'options' !== $decoded['id'] ) {
$meta = acf_get_metadata( $post_id, $field_name, true );
if ( ! $meta || $meta !== $field['key'] ) {
return null;
if ( ! $meta ) {
$allow_load = false;
} elseif ( $meta !== $field['key'] ) {
if ( ! isset( $field['__key'] ) || $meta !== $field['__key'] ) {
$allow_load = false;
}
}
}

// Check store.
// Load Store.
$store = acf_get_store( 'values' );
if ( $store->has( "$post_id:$field_name" ) ) {
return $store->get( "$post_id:$field_name" );
}

// Load value from database.
$value = acf_get_metadata( $post_id, $field_name );
// If we're allowing load, check the store or load value from database.
if ( $allow_load ) {
if ( $store->has( "$post_id:$field_name" ) ) {
return $store->get( "$post_id:$field_name" );
}

$value = acf_get_metadata( $post_id, $field_name );
}

// Use field's default_value if no meta was found.
if ( $value === null && isset( $field['default_value'] ) ) {
Expand All @@ -107,8 +117,10 @@ function acf_get_value( $post_id, $field ) {
*/
$value = apply_filters( 'acf/load_value', $value, $post_id, $field );

// Update store.
$store->set( "$post_id:$field_name", $value );
// Update store if we allowed the value load.
if ( $allow_load ) {
$store->set( "$post_id:$field_name", $value );
}

// Return value.
return $value;
Expand Down
4 changes: 4 additions & 0 deletions includes/rest-api/class-acf-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function initialize( $response, $handler, $request ) {
* Register our custom property as a REST field.
*/
public function register_field() {
if ( ! acf_get_setting( 'rest_api_enabled' ) ) {
return;
}

if ( ! $this->request instanceof ACF_Rest_Request ) {
$this->request = new ACF_Rest_Request();
$this->request->parse_request( null );
Expand Down
10 changes: 5 additions & 5 deletions lang/acf.pot
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ msgstr ""
msgid "copy"
msgstr ""

#: includes/acf-value-functions.php:353
#: includes/acf-value-functions.php:374
msgid "<strong>%1$s</strong> - We've detected one or more calls to retrieve ACF field values before ACF has been initialized. This is not supported and can result in malformed or missing data. <a href=\"%2$s\" target=\"_blank\">Learn how to fix this</a>."
msgstr ""

Expand Down Expand Up @@ -329,20 +329,20 @@ msgstr ""
msgid "Block type \"%s\" is already registered."
msgstr ""

#: pro/blocks.php:495
#: pro/blocks.php:496
msgid "Switch to Edit"
msgstr ""

#: pro/blocks.php:496
#: pro/blocks.php:497
msgid "Switch to Preview"
msgstr ""

#: pro/blocks.php:497
#: pro/blocks.php:498
msgid "Change content alignment"
msgstr ""

#. translators: %s: Block type title
#: pro/blocks.php:500
#: pro/blocks.php:501
msgid "%s settings"
msgstr ""

Expand Down
12 changes: 10 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: elliotcondon
Tags: acf, fields, custom fields, meta, repeater
Requires at least: 4.7
Tested up to: 5.9.2
Tested up to: 5.9.3
Requires PHP: 5.6
Stable tag: 5.12.1
Stable tag: 5.12.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -76,6 +76,14 @@ From your WordPress dashboard

== Changelog ==

= 5.12.2 =
*Release Date 6th April 2022*

* Fix - Cloned fields in custom named options pages now behave correctly
* Fix - Default values and the `acf/load_value` filter are now applied if a field value load [fails security validation](https://www.advancedcustomfields.com/resources/acf-field-functions/#non-acf-data)
* Fix - The ACF field is no longer present in REST responses if the ACF REST API setting is disabled
* Fix - Duplicating a flexible content layout or repeater row now also replaces the field ID in `for` attributes

= 5.12.1 =
*Release Date 23rd March 2022*

Expand Down

0 comments on commit 11f28c1

Please sign in to comment.