Updates to 6.2.4

This commit is contained in:
ACF 2023-11-29 10:16:12 +00:00
parent 61bf366867
commit 830e8b94a8
255 changed files with 7704 additions and 9175 deletions

View File

@ -9,7 +9,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: 6.2.3 * Version: 6.2.4
* Author: WP Engine * Author: WP Engine
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields * Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
* Update URI: https://www.advancedcustomfields.com/pro * Update URI: https://www.advancedcustomfields.com/pro
@ -36,7 +36,7 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @var string * @var string
*/ */
public $version = '6.2.3'; public $version = '6.2.4';
/** /**
* The plugin settings array. * The plugin settings array.
@ -177,7 +177,6 @@ if ( ! class_exists( 'ACF' ) ) {
acf_include( 'includes/loop.php' ); acf_include( 'includes/loop.php' );
acf_include( 'includes/media.php' ); acf_include( 'includes/media.php' );
acf_include( 'includes/revisions.php' ); acf_include( 'includes/revisions.php' );
acf_include( 'includes/updates.php' );
acf_include( 'includes/upgrades.php' ); acf_include( 'includes/upgrades.php' );
acf_include( 'includes/validation.php' ); acf_include( 'includes/validation.php' );
acf_include( 'includes/rest-api.php' ); acf_include( 'includes/rest-api.php' );
@ -783,5 +782,4 @@ if ( ! class_exists( 'ACF' ) ) {
// Instantiate. // Instantiate.
acf(); acf();
} // class_exists check } // class_exists check

View File

@ -1610,6 +1610,7 @@ html[dir=rtl] .acf-relationship .selection .values .acf-icon {
.acf-tab-wrap { .acf-tab-wrap {
clear: both; clear: both;
z-index: 1; z-index: 1;
overflow: auto;
} }
.acf-tab-group { .acf-tab-group {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4255,7 +4255,6 @@
active: false, active: false,
actions: { actions: {
refresh: 'onRefresh', refresh: 'onRefresh',
resize: 'onRefresh',
close_field_object: 'onCloseFieldObject' close_field_object: 'onCloseFieldObject'
}, },
data: { data: {
@ -4428,28 +4427,21 @@
return tab; return tab;
}, },
onRefresh: function () { onRefresh: function () {
// Don't run on field group tabs. // only for left placements
if (['acf_field_settings_tabs', 'acf_field_group_settings_tabs'].includes(this.get('key'))) { if (this.get('placement') !== 'left') {
return; return;
} }
// Block editor needs timeout to run after script is finished. // vars
setTimeout(() => { var $parent = this.$el.parent();
const $list = this.$el.children('ul'); var $list = this.$el.children('ul');
let $element = this.$el; var attribute = $parent.is('td') ? 'height' : 'min-height';
let attribute = 'height';
let height;
if (this.get('placement') === 'left') {
$element = this.$el.parent();
attribute = $element.is('td') ? 'height' : 'min-height';
// Find height (minus 1 for border-bottom). // find height (minus 1 for border-bottom)
height = $list.position().top + $list.outerHeight(true) - 1; var height = $list.position().top + $list.outerHeight(true) - 1;
} else {
height = Math.ceil($list.outerHeight(true)); // add css
} $parent.css(attribute, height);
$element.css(attribute, height);
}, 0);
}, },
onCloseFieldObject: function (fieldObject) { onCloseFieldObject: function (fieldObject) {
const tab = this.getVisible().find(item => { const tab = this.getVisible().find(item => {
@ -6348,13 +6340,11 @@
refresh: 'renderGroups' refresh: 'renderGroups'
}, },
renderGroups: function () { renderGroups: function () {
// Set timeout so the editor fires at the right time. // loop
setTimeout(() => {
var self = this; var self = this;
$('.acf-fields:visible').each(function () { $('.acf-fields:visible').each(function () {
self.renderGroup($(this)); self.renderGroup($(this));
}); });
}, 0);
}, },
renderGroup: function ($el) { renderGroup: function ($el) {
// vars // vars

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -88,7 +88,7 @@
const fieldGroupTitle = $('.acf-headerbar-title-field').val(); const fieldGroupTitle = $('.acf-headerbar-title-field').val();
const ajaxData = { const ajaxData = {
action: 'acf/create_options_page', action: 'acf/create_options_page',
acf_parent_page_choices: this.acf.data.acfParentPageChoices ? this.acf.data.acfParentPageChoices : [] acf_parent_page_choices: this.acf.data.optionPageParentOptions ? this.acf.data.optionPageParentOptions : []
}; };
if (fieldGroupTitle.length) { if (fieldGroupTitle.length) {
ajaxData.field_group_title = fieldGroupTitle; ajaxData.field_group_title = fieldGroupTitle;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{var e={412:()=>{!function(e,t){const a=function(t){return void 0===t.element?t:t.children&&"None"===t.text?void 0:("acfOptionsPages"===t.text&&(t.text=acf.__("Options Pages")),e('<span class="acf-selection"></span>').data("element",t.element).html(acf.escHtml(t.text)))},n=function(t){if(void 0===t.element)return t;const a=e('<span class="acf-selection"></span>');return a.html(acf.escHtml(t.element.innerHTML)),"options"!==t.id&&"edit_posts"!==t.id||a.append('<span class="acf-select2-default-pill">'+acf.__("Default")+"</span>"),a.data("element",t.element),a};new acf.Model({id:"UIOptionsPageManager",wait:"ready",events:{"change .acf-options-page-parent_slug":"toggleMenuPositionDesc"},initialize:function(){"ui_options_page"===acf.get("screen")&&(acf.newSelect2(e("select.acf-options-page-parent_slug"),{field:!1,templateSelection:a,templateResult:a,dropdownCssClass:"field-type-select-results"}),acf.newSelect2(e("select.acf-options-page-capability"),{field:!1,templateSelection:n,templateResult:n}),acf.newSelect2(e("select.acf-options-page-data_storage"),{field:!1,templateSelection:n,templateResult:n}),this.toggleMenuPositionDesc())},toggleMenuPositionDesc:function(t,a){"none"===e("select.acf-options-page-parent_slug").val()?(e(".acf-menu-position-desc-child").hide(),e(".acf-menu-position-desc-parent").show()):(e(".acf-menu-position-desc-parent").hide(),e(".acf-menu-position-desc-child").show())}}),new acf.Model({id:"optionsPageModalManager",events:{"change .location-rule-value":"createOptionsPage"},createOptionsPage:function(t){const n=e(t.target);if("add_new_options_page"!==n.val())return;let o=!1;const s=function(t){o=acf.newPopup({title:t.data.title,content:t.data.content,width:"600px"}),o.$el.addClass("acf-create-options-page-popup");const n=o.$el.find("#acf_ui_options_page-page_title"),s=n.val();n.focus().val("").val(s),acf.newSelect2(e("#acf_ui_options_page-parent_slug"),{field:!1,templateSelection:a,templateResult:a,dropdownCssClass:"field-type-select-results"}),o.on("submit","form",c)},c=function(t){t.preventDefault(),acf.validateForm({form:e("#acf-create-options-page-form"),success:i,failure:l})},i=function(){const t=e("#acf-create-options-page-form").serializeArray(),a={action:"acf/create_options_page"};t.forEach((e=>{a[e.name]=e.value})),e.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(a),type:"post",dataType:"json",success:p})},l=function(t){const a=e("#acf-create-options-page-form"),n=a.find(".acf-field .acf-error-message");a.find(".acf-notice").first().remove(),n.each((function(){const t=e(this).closest(".acf-field").find(".acf-label:first");e(this).attr("class","acf-options-page-modal-error").appendTo(t)}))},p=function(e){e.success&&e.data.menu_slug?(n.prepend('<option value="'+e.data.menu_slug+'">'+e.data.page_title+"</option>"),n.val(e.data.menu_slug),o.close()):!e.success&&e.data.error&&alert(e.data.error)};!function(){const t=e(".acf-headerbar-title-field").val(),a={action:"acf/create_options_page",acf_parent_page_choices:this.acf.data.acfParentPageChoices?this.acf.data.acfParentPageChoices:[]};t.length&&(a.field_group_title=t),e.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(a),type:"post",dataType:"json",success:s})}()}})}(jQuery)}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,a),s.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";a(412)})()})(); (()=>{var e={412:()=>{!function(e,t){const a=function(t){return void 0===t.element?t:t.children&&"None"===t.text?void 0:("acfOptionsPages"===t.text&&(t.text=acf.__("Options Pages")),e('<span class="acf-selection"></span>').data("element",t.element).html(acf.escHtml(t.text)))},n=function(t){if(void 0===t.element)return t;const a=e('<span class="acf-selection"></span>');return a.html(acf.escHtml(t.element.innerHTML)),"options"!==t.id&&"edit_posts"!==t.id||a.append('<span class="acf-select2-default-pill">'+acf.__("Default")+"</span>"),a.data("element",t.element),a};new acf.Model({id:"UIOptionsPageManager",wait:"ready",events:{"change .acf-options-page-parent_slug":"toggleMenuPositionDesc"},initialize:function(){"ui_options_page"===acf.get("screen")&&(acf.newSelect2(e("select.acf-options-page-parent_slug"),{field:!1,templateSelection:a,templateResult:a,dropdownCssClass:"field-type-select-results"}),acf.newSelect2(e("select.acf-options-page-capability"),{field:!1,templateSelection:n,templateResult:n}),acf.newSelect2(e("select.acf-options-page-data_storage"),{field:!1,templateSelection:n,templateResult:n}),this.toggleMenuPositionDesc())},toggleMenuPositionDesc:function(t,a){"none"===e("select.acf-options-page-parent_slug").val()?(e(".acf-menu-position-desc-child").hide(),e(".acf-menu-position-desc-parent").show()):(e(".acf-menu-position-desc-parent").hide(),e(".acf-menu-position-desc-child").show())}}),new acf.Model({id:"optionsPageModalManager",events:{"change .location-rule-value":"createOptionsPage"},createOptionsPage:function(t){const n=e(t.target);if("add_new_options_page"!==n.val())return;let o=!1;const s=function(t){o=acf.newPopup({title:t.data.title,content:t.data.content,width:"600px"}),o.$el.addClass("acf-create-options-page-popup");const n=o.$el.find("#acf_ui_options_page-page_title"),s=n.val();n.focus().val("").val(s),acf.newSelect2(e("#acf_ui_options_page-parent_slug"),{field:!1,templateSelection:a,templateResult:a,dropdownCssClass:"field-type-select-results"}),o.on("submit","form",c)},c=function(t){t.preventDefault(),acf.validateForm({form:e("#acf-create-options-page-form"),success:i,failure:l})},i=function(){const t=e("#acf-create-options-page-form").serializeArray(),a={action:"acf/create_options_page"};t.forEach((e=>{a[e.name]=e.value})),e.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(a),type:"post",dataType:"json",success:p})},l=function(t){const a=e("#acf-create-options-page-form"),n=a.find(".acf-field .acf-error-message");a.find(".acf-notice").first().remove(),n.each((function(){const t=e(this).closest(".acf-field").find(".acf-label:first");e(this).attr("class","acf-options-page-modal-error").appendTo(t)}))},p=function(e){e.success&&e.data.menu_slug?(n.prepend('<option value="'+e.data.menu_slug+'">'+e.data.page_title+"</option>"),n.val(e.data.menu_slug),o.close()):!e.success&&e.data.error&&alert(e.data.error)};!function(){const t=e(".acf-headerbar-title-field").val(),a={action:"acf/create_options_page",acf_parent_page_choices:this.acf.data.optionPageParentOptions?this.acf.data.optionPageParentOptions:[]};t.length&&(a.field_group_title=t),e.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(a),type:"post",dataType:"json",success:s})}()}})}(jQuery)}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,a),s.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";a(412)})()})();

View File

@ -11,7 +11,7 @@
* @since 6.2 * @since 6.2
* *
* @param array $target_item_ids The post, user or term IDs which should be updated with the origin item ID. * @param array $target_item_ids The post, user or term IDs which should be updated with the origin item ID.
* @param int|string $post_id The ACF encoded origin post, user or term ID. * @param integer|string $post_id The ACF encoded origin post, user or term ID.
* @param array $field The field being updated on the origin post, user or term ID. * @param array $field The field being updated on the origin post, user or term ID.
* @param string|false $target_prefix The ACF prefix for a post, user or term ID required for the update_field call for this field type. * @param string|false $target_prefix The ACF prefix for a post, user or term ID required for the update_field call for this field type.
*/ */
@ -57,7 +57,7 @@ function acf_update_bidirectional_values( $target_item_ids, $post_id, $field, $t
// Prefix additions and subtractions for destinations which aren't posts. // Prefix additions and subtractions for destinations which aren't posts.
if ( ! empty( $target_prefix ) ) { if ( ! empty( $target_prefix ) ) {
$mapper = function( $v ) use ( $target_prefix ) { $mapper = function ( $v ) use ( $target_prefix ) {
return $target_prefix . '_' . $v; return $target_prefix . '_' . $v;
}; };
$additions = array_map( $mapper, $additions ); $additions = array_map( $mapper, $additions );
@ -89,6 +89,7 @@ function acf_update_bidirectional_values( $target_item_ids, $post_id, $field, $t
* @since 6.2 * @since 6.2
* *
* @param string $object_type The object type that will be updated on the target field, such as 'term', 'user' or 'post'. * @param string $object_type The object type that will be updated on the target field, such as 'term', 'user' or 'post'.
*
* @return array An array of valid field type names (slugs) for the target of the bidirectional field. * @return array An array of valid field type names (slugs) for the target of the bidirectional field.
*/ */
function acf_get_valid_bidirectional_target_types( $object_type ) { function acf_get_valid_bidirectional_target_types( $object_type ) {
@ -153,7 +154,7 @@ function acf_build_bidirectional_relationship_field_target_args( $results, $opti
$field_groups = array_filter( $field_groups = array_filter(
acf_get_field_groups(), acf_get_field_groups(),
function( $field_group ) { function ( $field_group ) {
return $field_group['active']; return $field_group['active'];
} }
); );

View File

@ -309,7 +309,6 @@ function acf_translate_field( $field = array() ) {
// Translate field settings if textdomain is set. // Translate field settings if textdomain is set.
if ( $l10n && $l10n_textdomain ) { if ( $l10n && $l10n_textdomain ) {
$field['label'] = acf_translate( $field['label'] ); $field['label'] = acf_translate( $field['label'] );
$field['instructions'] = acf_translate( $field['instructions'] ); $field['instructions'] = acf_translate( $field['instructions'] );
@ -604,7 +603,6 @@ function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = '
// Loop over and render fields. // Loop over and render fields.
if ( $fields ) { if ( $fields ) {
foreach ( $fields as $field ) { foreach ( $fields as $field ) {
$field = apply_filters( 'acf/pre_render_field', $field, $post_id ); $field = apply_filters( 'acf/pre_render_field', $field, $post_id );
// Load value if not already loaded. // Load value if not already loaded.
@ -1323,7 +1321,6 @@ function acf_get_sub_field( $id, $field ) {
// return // return
return $sub_field; return $sub_field;
} }
// Register variation. // Register variation.
@ -1588,7 +1585,7 @@ function acf_prepare_fields_for_import( $fields = array() ) {
} }
// Iterate. // Iterate.
$i++; ++$i;
} }
/** /**

View File

@ -220,4 +220,3 @@ function _acf_apply_deprecated_hook() {
// Return first arg. // Return first arg.
return $args[0]; return $args[0];
} }

View File

@ -257,7 +257,6 @@ function acf_get_object_id( $object ) {
} }
} elseif ( isset( $object['id'] ) ) { } elseif ( isset( $object['id'] ) ) {
return (int) $object['id']; return (int) $object['id'];
} elseif ( isset( $object['ID'] ) ) { } elseif ( isset( $object['ID'] ) ) {
return (int) $object['ID']; return (int) $object['ID'];
} }

View File

@ -935,7 +935,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
acf_delete_internal_post_type( $post_id, $this->post_type ); acf_delete_internal_post_type( $post_id, $this->post_type );
} }
} }
} }
endif; // Class exists check. endif; // Class exists check.

View File

@ -356,7 +356,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
) )
); );
} }
} }
endif; // Class exists check. endif; // Class exists check.

View File

@ -62,7 +62,6 @@ if ( ! class_exists( 'ACF_Admin_Options_Preview' ) ) :
$view = array( 'screen_id' => $screen->id ); $view = array( 'screen_id' => $screen->id );
acf_get_view( 'options-page-preview', $view ); acf_get_view( 'options-page-preview', $view );
} }
} }
new ACF_Admin_Options_Preview(); new ACF_Admin_Options_Preview();

View File

@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
// actions // actions
add_action( 'admin_menu', array( $this, 'admin_menu' ), 15 ); add_action( 'admin_menu', array( $this, 'admin_menu' ), 15 );
} }
/** /**
@ -52,7 +51,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
$instance = new $class(); $instance = new $class();
$this->tools[ $instance->name ] = $instance; $this->tools[ $instance->name ] = $instance;
} }
@ -71,7 +69,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
function get_tool( $name ) { function get_tool( $name ) {
return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null; return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null;
} }
@ -90,7 +87,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
function get_tools() { function get_tools() {
return $this->tools; return $this->tools;
} }
@ -119,7 +115,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
// actions // actions
add_action( 'load-' . $page, array( $this, 'load' ) ); add_action( 'load-' . $page, array( $this, 'load' ) );
} }
@ -150,7 +145,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
// load acf scripts // load acf scripts
acf_enqueue_scripts(); acf_enqueue_scripts();
} }
/** /**
@ -187,7 +181,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
// action // action
do_action( 'acf/include_admin_tools' ); do_action( 'acf/include_admin_tools' );
} }
@ -216,7 +209,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
$tool->submit(); $tool->submit();
} }
} }
} }
@ -254,12 +246,10 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
// add metabox // add metabox
add_meta_box( 'acf-admin-tool-' . $tool->name, acf_esc_html( $tool->title ), array( $this, 'metabox_html' ), $screen->id, 'normal', 'default', array( 'tool' => $tool->name ) ); add_meta_box( 'acf-admin-tool-' . $tool->name, acf_esc_html( $tool->title ), array( $this, 'metabox_html' ), $screen->id, 'normal', 'default', array( 'tool' => $tool->name ) );
} }
// view // view
acf_get_view( 'tools/tools', $view ); acf_get_view( 'tools/tools', $view );
} }
@ -286,12 +276,10 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
acf_nonce_input( $tool->name ); acf_nonce_input( $tool->name );
echo '</form>'; echo '</form>';
} }
} }
// initialize // initialize
acf()->admin_tools = new acf_admin_tools(); acf()->admin_tools = new acf_admin_tools();
endif; // class_exists check endif; // class_exists check
@ -311,7 +299,6 @@ endif; // class_exists check
function acf_register_admin_tool( $class ) { function acf_register_admin_tool( $class ) {
return acf()->admin_tools->register_tool( $class ); return acf()->admin_tools->register_tool( $class );
} }
@ -331,7 +318,6 @@ function acf_register_admin_tool( $class ) {
function acf_get_admin_tools_url() { function acf_get_admin_tools_url() {
return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' ); return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' );
} }
@ -351,5 +337,4 @@ function acf_get_admin_tools_url() {
function acf_get_admin_tool_url( $tool = '' ) { function acf_get_admin_tool_url( $tool = '' ) {
return acf_get_admin_tools_url() . '&tool=' . $tool; return acf_get_admin_tools_url() . '&tool=' . $tool;
} }

View File

@ -293,5 +293,4 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
// instantiate // instantiate
acf_new_instance( 'ACF_Admin_Upgrade' ); acf_new_instance( 'ACF_Admin_Upgrade' );
endif; // class_exists check endif; // class_exists check

View File

@ -303,10 +303,8 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
} }
return $submenu_file; return $submenu_file;
} }
} }
// Instantiate. // Instantiate.
acf_new_instance( 'ACF_Admin' ); acf_new_instance( 'ACF_Admin' );
endif; // class_exists check endif; // class_exists check

View File

@ -122,14 +122,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
) )
); );
if ( acf_is_pro() && acf_get_setting( 'enable_options_pages_ui' ) ) {
acf_localize_data(
array(
'acfParentPageChoices' => ACF_Admin_UI_Options_Page::get_parent_page_choices(),
)
);
}
acf_localize_data( acf_localize_data(
array( array(
'fieldTypes' => acf_get_field_types_info(), 'fieldTypes' => acf_get_field_types_info(),
@ -619,7 +611,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
die(); die();
} }
} }
// initialize. // initialize.

View File

@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) : if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
#[AllowDynamicProperties] #[AllowDynamicProperties]
class ACF_Admin_Field_Groups extends ACF_Admin_Internal_Post_Type_List { class ACF_Admin_Field_Groups extends ACF_Admin_Internal_Post_Type_List {
@ -386,10 +385,8 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
return $text; return $text;
} }
} }
// Instantiate. // Instantiate.
acf_new_instance( 'ACF_Admin_Field_Groups' ); acf_new_instance( 'ACF_Admin_Field_Groups' );
endif; // Class exists check. endif; // Class exists check.

View File

@ -362,11 +362,9 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
public function mb_advanced_settings() { public function mb_advanced_settings() {
acf_get_view( $this->post_type . '/advanced-settings' ); acf_get_view( $this->post_type . '/advanced-settings' );
} }
} }
new ACF_Admin_Post_Type(); new ACF_Admin_Post_Type();
endif; // Class exists check. endif; // Class exists check.
?> ?>

View File

@ -370,10 +370,8 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
__( 'This post type could not be registered because its key is in use by another post type registered by another plugin or theme.', 'acf' ) . __( 'This post type could not be registered because its key is in use by another post type registered by another plugin or theme.', 'acf' ) .
'"></span> ' . _x( 'Registration Failed', 'post status', 'acf' ); '"></span> ' . _x( 'Registration Failed', 'post status', 'acf' );
} }
} }
// Instantiate. // Instantiate.
acf_new_instance( 'ACF_Admin_Post_Types' ); acf_new_instance( 'ACF_Admin_Post_Types' );
endif; // Class exists check. endif; // Class exists check.

View File

@ -299,8 +299,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
} }
$num_terms = wp_count_terms( $num_terms = wp_count_terms(
$taxonomy['taxonomy'],
array( array(
'taxonomy' => $taxonomy['taxonomy'],
'hide_empty' => false, 'hide_empty' => false,
'parent' => 0, 'parent' => 0,
) )
@ -377,10 +377,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
__( 'This taxonomy could not be registered because its key is in use by another taxonomy registered by another plugin or theme.', 'acf' ) . __( 'This taxonomy could not be registered because its key is in use by another taxonomy registered by another plugin or theme.', 'acf' ) .
'"></span> ' . _x( 'Registration Failed', 'post status', 'acf' ); '"></span> ' . _x( 'Registration Failed', 'post status', 'acf' );
} }
} }
// Instantiate. // Instantiate.
acf_new_instance( 'ACF_Admin_Taxonomies' ); acf_new_instance( 'ACF_Admin_Taxonomies' );
endif; // Class exists check. endif; // Class exists check.

View File

@ -364,7 +364,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
public function mb_advanced_settings() { public function mb_advanced_settings() {
acf_get_view( $this->post_type . '/advanced-settings' ); acf_get_view( $this->post_type . '/advanced-settings' );
} }
} }
new ACF_Admin_Taxonomy(); new ACF_Admin_Taxonomy();

View File

@ -38,7 +38,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
if ( $this->is_active() ) { if ( $this->is_active() ) {
$this->title .= ' - ' . __( 'Generate PHP', 'acf' ); $this->title .= ' - ' . __( 'Generate PHP', 'acf' );
} }
} }
@ -61,16 +60,12 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
// download // download
if ( $action === 'download' ) { if ( $action === 'download' ) {
$this->submit_download(); $this->submit_download();
// generate // generate
} elseif ( $action === 'generate' ) { } elseif ( $action === 'generate' ) {
$this->submit_generate(); $this->submit_generate();
} }
} }
@ -105,7 +100,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
// return // return
echo acf_json_encode( $json ) . "\r\n"; echo acf_json_encode( $json ) . "\r\n";
die; die;
} }
@ -137,7 +131,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
// redirect // redirect
wp_redirect( $url ); wp_redirect( $url );
exit; exit;
} }
@ -168,7 +161,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
acf_add_admin_notice( $text, 'success' ); acf_add_admin_notice( $text, 'success' );
} }
} }
} }
@ -188,16 +180,12 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
// single (generate PHP) // single (generate PHP)
if ( $this->is_active() ) { if ( $this->is_active() ) {
$this->html_single(); $this->html_single();
// archive // archive
} else { } else {
$this->html_archive(); $this->html_archive();
} }
} }
@ -361,7 +349,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
</div> </div>
</div> </div>
<?php <?php
} }
@ -394,7 +381,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
</p> </p>
</div> </div>
<?php <?php
} }
/** /**
@ -468,7 +454,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
} }
echo "\t" . acf_export_internal_post_type_as_php( $post, $post_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- esc_textarea() used earlier. echo "\t" . acf_export_internal_post_type_as_php( $post, $post_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- esc_textarea() used earlier.
$count++; ++$count;
} }
if ( in_array( $post_type, array( 'acf-post-type', 'acf-taxonomy', 'acf-field-group', 'acf-ui-options-page' ), true ) ) { if ( in_array( $post_type, array( 'acf-post-type', 'acf-taxonomy', 'acf-field-group', 'acf-ui-options-page' ), true ) ) {
@ -529,7 +515,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
* @return array|bool * @return array|bool
*/ */
public function get_selected_keys() { public function get_selected_keys() {
$key_names = array( 'keys', 'post_type_keys', 'taxonomy_keys', 'ui_options_page_keys' ); $key_names = array( 'keys', 'taxonomy_keys', 'post_type_keys', 'ui_options_page_keys' );
$all_keys = array(); $all_keys = array();
foreach ( $key_names as $key_name ) { foreach ( $key_names as $key_name ) {
@ -583,12 +569,10 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
return $json; return $json;
} }
} }
// initialize // initialize
acf_register_admin_tool( 'ACF_Admin_Tool_Export' ); acf_register_admin_tool( 'ACF_Admin_Tool_Export' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -26,7 +26,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
$this->name = 'import'; $this->name = 'import';
$this->title = __( 'Import Field Groups', 'acf' ); $this->title = __( 'Import Field Groups', 'acf' );
$this->icon = 'dashicons-upload'; $this->icon = 'dashicons-upload';
} }
@ -133,7 +132,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
?> ?>
</div> </div>
<?php <?php
} }
/** /**
@ -291,12 +289,10 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
return acf_add_admin_notice( __( 'Nothing to import', 'acf' ), 'warning' ); return acf_add_admin_notice( __( 'Nothing to import', 'acf' ), 'warning' );
} }
} }
// Initialize. // Initialize.
acf_register_admin_tool( 'ACF_Admin_Tool_Import' ); acf_register_admin_tool( 'ACF_Admin_Tool_Import' );
endif; // class_exists check. endif; // class_exists check.
?> ?>

View File

@ -110,7 +110,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
// initialize // initialize
$this->initialize(); $this->initialize();
} }
@ -129,7 +128,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
function initialize() { function initialize() {
/* do nothing */ /* do nothing */
} }
@ -149,7 +147,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
function load() { function load() {
/* do nothing */ /* do nothing */
} }
@ -166,7 +163,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
*/ */
function html() { function html() {
} }
@ -183,12 +179,7 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
*/ */
function submit() { function submit() {
} }
} }
endif; // class_exists check endif; // class_exists check

View File

@ -5,7 +5,6 @@ $disabled = false;
// empty // empty
if ( empty( $field['conditional_logic'] ) ) { if ( empty( $field['conditional_logic'] ) ) {
$disabled = true; $disabled = true;
$field['conditional_logic'] = array( $field['conditional_logic'] = array(
@ -43,7 +42,13 @@ if ( empty( $field['conditional_logic'] ) ) {
</div> </div>
</div> </div>
<div class="rule-groups" <?php if ( $disabled ) echo ' style="display:none"'; ?>> <div class="rule-groups"
<?php
if ( $disabled ) {
echo ' style="display:none"';
}
?>
>
<?php <?php
foreach ( $field['conditional_logic'] as $group_id => $group ) : foreach ( $field['conditional_logic'] as $group_id => $group ) :

View File

@ -79,9 +79,7 @@ if ( $is_subfield ) {
<?php <?php
if ( $fields ) : if ( $fields ) :
foreach ( $fields as $i => $field ) : foreach ( $fields as $i => $field ) :
acf_get_view( acf_get_view(
'acf-field-group/field', 'acf-field-group/field',
array( array(
@ -90,9 +88,7 @@ if ( $is_subfield ) {
'num_field_groups' => $num_field_groups, 'num_field_groups' => $num_field_groups,
) )
); );
endforeach; endforeach;
endif; endif;
?> ?>

View File

@ -21,7 +21,6 @@
'rule' => $rule, 'rule' => $rule,
) )
); );
endforeach; endforeach;
?> ?>
</tbody> </tbody>

View File

@ -13,7 +13,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// array // array
if ( is_array( $choices ) ) { if ( is_array( $choices ) ) {
acf_render_field( acf_render_field(
array( array(
'type' => 'select', 'type' => 'select',
@ -24,7 +23,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
'class' => 'refresh-location-rule', 'class' => 'refresh-location-rule',
) )
); );
} }
?> ?>
@ -38,7 +36,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// array // array
if ( is_array( $choices ) ) { if ( is_array( $choices ) ) {
acf_render_field( acf_render_field(
array( array(
'type' => 'select', 'type' => 'select',
@ -51,9 +48,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// custom // custom
} else { } else {
echo $choices; echo $choices;
} }
?> ?>
@ -67,7 +62,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// array // array
if ( is_array( $choices ) ) { if ( is_array( $choices ) ) {
acf_render_field( acf_render_field(
array( array(
'type' => 'select', 'type' => 'select',
@ -81,9 +75,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// custom // custom
} else { } else {
echo $choices; echo $choices;
} }
?> ?>

View File

@ -29,7 +29,6 @@ global $field_group;
'group_id' => "group_{$i}", 'group_id' => "group_{$i}",
) )
); );
endforeach; endforeach;
?> ?>

View File

@ -9,7 +9,7 @@ $acf_more_tools_link = acf_add_url_utm_tags( 'https://wpengine.co
$acf_wpengine_logo_link = acf_add_url_utm_tags( 'https://wpengine.com/', 'bx_prod_referral', 'acf_free_plugin_cta_panel_logo', false, 'acf_plugin', 'referral' ); $acf_wpengine_logo_link = acf_add_url_utm_tags( 'https://wpengine.com/', 'bx_prod_referral', 'acf_free_plugin_cta_panel_logo', false, 'acf_plugin', 'referral' );
if ( acf_is_pro() ) { if ( acf_is_pro() ) {
if ( ! acf_pro_get_license_key() ) { if ( ! acf_pro_get_license_key() && acf_is_updates_page_visible() ) {
$acf_learn_more_target = ''; $acf_learn_more_target = '';
$acf_learn_more_text = __( 'Manage License', 'acf' ); $acf_learn_more_text = __( 'Manage License', 'acf' );
$acf_learn_more_link = esc_url( admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' ) ); $acf_learn_more_link = esc_url( admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' ) );

View File

@ -216,9 +216,14 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'key' => 'add_new', 'key' => 'add_new',
'prefix' => 'acf_post_type[labels]', 'prefix' => 'acf_post_type[labels]',
'value' => $acf_post_type['labels']['add_new'], 'value' => $acf_post_type['labels']['add_new'],
'data' => array(
/* translators: %s Singular form of post type name */
'label' => __( 'Add New %s', 'acf' ),
'replace' => 'singular',
),
'label' => __( 'Add New', 'acf' ), 'label' => __( 'Add New', 'acf' ),
'instructions' => __( 'In the post type submenu in the admin dashboard.', 'acf' ), 'instructions' => __( 'In the post type submenu in the admin dashboard.', 'acf' ),
'placeholder' => __( 'Add New', 'acf' ), 'placeholder' => __( 'Add New Post', 'acf' ),
), ),
'div', 'div',
'field' 'field'
@ -1285,4 +1290,3 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
echo '</div>'; echo '</div>';
} }

View File

@ -212,8 +212,10 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
$unlock_text = __( 'Unlock Extra Features with ACF PRO', 'acf' ); $unlock_text = __( 'Unlock Extra Features with ACF PRO', 'acf' );
if ( acf_is_pro() ) { if ( acf_is_pro() ) {
if ( acf_is_updates_page_visible() ) {
$unlock_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' ); $unlock_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' );
$unlock_target = ''; $unlock_target = '';
}
if ( acf_pro_is_license_expired() ) { if ( acf_pro_is_license_expired() ) {
$unlock_url = acf_add_url_utm_tags( acf_pro_get_manage_license_url(), 'ACF renewal', 'header' ); $unlock_url = acf_add_url_utm_tags( acf_pro_get_manage_license_url(), 'ACF renewal', 'header' );

View File

@ -23,7 +23,7 @@
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1> <h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
<p><?php echo sprintf( __( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . __( 'Upgrade Sites', 'acf' ) . '"' ); ?></p> <p><?php printf( __( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . __( 'Upgrade Sites', 'acf' ) . '"' ); ?></p>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p> <p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p>
<table class="wp-list-table widefat"> <table class="wp-list-table widefat">
@ -85,7 +85,6 @@
// restore // restore
restore_current_blog(); restore_current_blog();
endforeach; endforeach;
endif; endif;
@ -94,7 +93,7 @@
</table> </table>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p> <p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p>
<p class="show-on-complete"><?php echo sprintf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p> <p class="show-on-complete"><?php printf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p>
<script type="text/javascript"> <script type="text/javascript">
(function($) { (function($) {

View File

@ -4,7 +4,6 @@
$plugins = array(); $plugins = array();
if ( ! acf_get_setting( 'pro' ) ) { if ( ! acf_get_setting( 'pro' ) ) {
if ( is_plugin_active( 'acf-repeater/acf-repeater.php' ) ) { if ( is_plugin_active( 'acf-repeater/acf-repeater.php' ) ) {
$plugins[] = __( 'Repeater', 'acf' ); $plugins[] = __( 'Repeater', 'acf' );
} }

View File

@ -30,7 +30,7 @@
<p><?php _e( 'Reading upgrade tasks...', 'acf' ); ?></p> <p><?php _e( 'Reading upgrade tasks...', 'acf' ); ?></p>
<p class="step-1"><i class="acf-loading"></i> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?></p> <p class="step-1"><i class="acf-loading"></i> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?></p>
<p class="step-2"></p> <p class="step-2"></p>
<p class="step-3"><?php echo sprintf( __( 'Database upgrade complete. <a href="%s">See what\'s new</a>', 'acf' ), admin_url( 'edit.php?post_type=acf-field-group' ) ); ?></p> <p class="step-3"><?php printf( __( 'Database upgrade complete. <a href="%s">See what\'s new</a>', 'acf' ), admin_url( 'edit.php?post_type=acf-field-group' ) ); ?></p>
<script type="text/javascript"> <script type="text/javascript">
(function($) { (function($) {

View File

@ -104,7 +104,4 @@ if ( ! class_exists( 'ACF_Ajax_Check_Screen' ) ) :
} }
acf_new_instance( 'ACF_Ajax_Check_Screen' ); acf_new_instance( 'ACF_Ajax_Check_Screen' );
endif; // class_exists check endif; // class_exists check

View File

@ -95,5 +95,4 @@ if ( ! class_exists( 'ACF_Ajax_Local_JSON_Diff' ) ) :
} }
acf_new_instance( 'ACF_Ajax_Local_JSON_Diff' ); acf_new_instance( 'ACF_Ajax_Local_JSON_Diff' );
endif; // class_exists check endif; // class_exists check

View File

@ -87,7 +87,6 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
if ( isset( $args['users_per_page'] ) ) { if ( isset( $args['users_per_page'] ) ) {
$this->per_page = intval( $args['users_per_page'] ); $this->per_page = intval( $args['users_per_page'] );
unset( $args['users_per_page'] ); unset( $args['users_per_page'] );
} elseif ( isset( $args['number'] ) ) { } elseif ( isset( $args['number'] ) ) {
$this->per_page = intval( $args['number'] ); $this->per_page = intval( $args['number'] );
} }
@ -271,5 +270,4 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
} }
acf_new_instance( 'ACF_Ajax_Query_Users' ); acf_new_instance( 'ACF_Ajax_Query_Users' );
endif; // class_exists check endif; // class_exists check

View File

@ -52,5 +52,4 @@ if ( ! class_exists( 'ACF_Ajax_Upgrade' ) ) :
} }
acf_new_instance( 'ACF_Ajax_Upgrade' ); acf_new_instance( 'ACF_Ajax_Upgrade' );
endif; // class_exists check endif; // class_exists check

View File

@ -39,5 +39,4 @@ if ( ! class_exists( 'ACF_Ajax_User_Setting' ) ) :
} }
acf_new_instance( 'ACF_Ajax_User_Setting' ); acf_new_instance( 'ACF_Ajax_User_Setting' );
endif; // class_exists check endif; // class_exists check

View File

@ -228,5 +228,3 @@ if ( ! class_exists( 'ACF_Ajax' ) ) :
} }
endif; // class_exists check endif; // class_exists check

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,6 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
// create dummy field // create dummy field
if ( ! $field ) { if ( ! $field ) {
$field = acf_get_valid_field( $field = acf_get_valid_field(
array( array(
'name' => $selector, 'name' => $selector,
@ -38,7 +37,6 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
// prevent formatting // prevent formatting
$format_value = false; $format_value = false;
} }
// get value for field // get value for field
@ -49,12 +47,10 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
// get value for field // get value for field
$value = acf_format_value( $value, $post_id, $field ); $value = acf_format_value( $value, $post_id, $field );
} }
// return // return
return $value; return $value;
} }
/** /**
@ -206,7 +202,6 @@ function acf_maybe_get_sub_field( $selectors, $post_id = false, $strict = true )
// add to name // add to name
$field['name'] = $field_name . '_' . ( $sub_i - $offset ) . '_' . $field['name']; $field['name'] = $field_name . '_' . ( $sub_i - $offset ) . '_' . $field['name'];
} }
// return // return
@ -241,14 +236,11 @@ function get_fields( $post_id = false, $format_value = true ) {
// populate // populate
foreach ( $fields as $k => $field ) { foreach ( $fields as $k => $field ) {
$meta[ $k ] = $field['value']; $meta[ $k ] = $field['value'];
} }
// return // return
return $meta; return $meta;
} }
@ -482,14 +474,13 @@ function the_row( $format = false ) {
$i = acf_get_loop( 'active', 'i' ); $i = acf_get_loop( 'active', 'i' );
// increase // increase
$i++; ++$i;
// update // update
acf_update_loop( 'active', 'i', $i ); acf_update_loop( 'active', 'i', $i );
// return // return
return get_row( $format ); return get_row( $format );
} }
function get_row( $format = false ) { function get_row( $format = false ) {
@ -531,13 +522,11 @@ function get_row( $format = false ) {
// - no performance issues here thanks to cache // - no performance issues here thanks to cache
$value = acf_format_value( $loop['value'], $loop['post_id'], $field ); $value = acf_format_value( $loop['value'], $loop['post_id'], $field );
$value = acf_maybe_get( $value, $loop['i'] ); $value = acf_maybe_get( $value, $loop['i'] );
} }
} }
// return // return
return $value; return $value;
} }
function get_row_index() { function get_row_index() {
@ -548,13 +537,11 @@ function get_row_index() {
// return // return
return $offset + $i; return $offset + $i;
} }
function the_row_index() { function the_row_index() {
echo get_row_index(); echo get_row_index();
} }
@ -594,7 +581,6 @@ function get_row_sub_field( $selector ) {
// return // return
return $sub_field; return $sub_field;
} }
@ -623,14 +609,11 @@ function get_row_sub_value( $selector ) {
// return value // return value
if ( isset( $row['value'][ $row['i'] ][ $selector ] ) ) { if ( isset( $row['value'][ $row['i'] ][ $selector ] ) ) {
return $row['value'][ $row['i'] ][ $selector ]; return $row['value'][ $row['i'] ][ $selector ];
} }
// return // return
return null; return null;
} }
@ -655,7 +638,6 @@ function reset_rows() {
// return // return
return true; return true;
} }
@ -682,20 +664,16 @@ function has_sub_field( $field_name, $post_id = false ) {
// if has rows, progress through 1 row for the while loop to work // if has rows, progress through 1 row for the while loop to work
if ( $r ) { if ( $r ) {
the_row(); the_row();
} }
// return // return
return $r; return $r;
} }
function has_sub_fields( $field_name, $post_id = false ) { function has_sub_fields( $field_name, $post_id = false ) {
return has_sub_field( $field_name, $post_id ); return has_sub_field( $field_name, $post_id );
} }
@ -724,7 +702,6 @@ function get_sub_field( $selector = '', $format_value = true ) {
// return // return
return $sub_field['value']; return $sub_field['value'];
} }
@ -746,9 +723,7 @@ function the_sub_field( $field_name, $format_value = true ) {
$value = get_sub_field( $field_name, $format_value ); $value = get_sub_field( $field_name, $format_value );
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
$value = implode( ', ', $value ); $value = implode( ', ', $value );
} }
echo $value; echo $value;
@ -788,9 +763,7 @@ function get_sub_field_object( $selector, $format_value = true, $load_value = tr
// load value // load value
if ( $load_value ) { if ( $load_value ) {
$sub_field['value'] = get_row_sub_value( $sub_field['key'] ); $sub_field['value'] = get_row_sub_value( $sub_field['key'] );
} }
// format value // format value
@ -798,12 +771,10 @@ function get_sub_field_object( $selector, $format_value = true, $load_value = tr
// get value for field // get value for field
$sub_field['value'] = acf_format_value( $sub_field['value'], $row['post_id'], $sub_field ); $sub_field['value'] = acf_format_value( $sub_field['value'], $row['post_id'], $sub_field );
} }
// return // return
return $sub_field; return $sub_field;
} }
@ -827,14 +798,11 @@ function get_row_layout() {
// return // return
if ( isset( $row['acf_fc_layout'] ) ) { if ( isset( $row['acf_fc_layout'] ) ) {
return $row['acf_fc_layout']; return $row['acf_fc_layout'];
} }
// return // return
return false; return false;
} }
/** /**
@ -932,7 +900,6 @@ function update_field( $selector, $value, $post_id = false ) {
// create dummy field // create dummy field
if ( ! $field ) { if ( ! $field ) {
$field = acf_get_valid_field( $field = acf_get_valid_field(
array( array(
'name' => $selector, 'name' => $selector,
@ -940,12 +907,10 @@ function update_field( $selector, $value, $post_id = false ) {
'type' => '', 'type' => '',
) )
); );
} }
// save // save
return acf_update_value( $value, $post_id, $field ); return acf_update_value( $value, $post_id, $field );
} }
@ -971,15 +936,11 @@ function update_sub_field( $selector, $value, $post_id = false ) {
// get sub field // get sub field
if ( is_array( $selector ) ) { if ( is_array( $selector ) ) {
$post_id = acf_get_valid_post_id( $post_id ); $post_id = acf_get_valid_post_id( $post_id );
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false ); $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
} else { } else {
$post_id = acf_get_loop( 'active', 'post_id' ); $post_id = acf_get_loop( 'active', 'post_id' );
$sub_field = get_row_sub_field( $selector ); $sub_field = get_row_sub_field( $selector );
} }
// bail early if no sub field // bail early if no sub field
@ -989,7 +950,6 @@ function update_sub_field( $selector, $value, $post_id = false ) {
// update // update
return acf_update_value( $value, $post_id, $sub_field ); return acf_update_value( $value, $post_id, $sub_field );
} }
@ -1017,7 +977,6 @@ function delete_field( $selector, $post_id = false ) {
// delete // delete
return $field ? acf_delete_value( $post_id, $field ) : false; return $field ? acf_delete_value( $post_id, $field ) : false;
} }
@ -1039,7 +998,6 @@ function delete_field( $selector, $post_id = false ) {
function delete_sub_field( $selector, $post_id = false ) { function delete_sub_field( $selector, $post_id = false ) {
return update_sub_field( $selector, null, $post_id ); return update_sub_field( $selector, null, $post_id );
} }
@ -1088,7 +1046,6 @@ function add_row( $selector, $row = false, $post_id = false ) {
// return // return
return count( $value ); return count( $value );
} }
@ -1114,15 +1071,11 @@ function add_sub_row( $selector, $row = false, $post_id = false ) {
// get sub field // get sub field
if ( is_array( $selector ) ) { if ( is_array( $selector ) ) {
$post_id = acf_get_valid_post_id( $post_id ); $post_id = acf_get_valid_post_id( $post_id );
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false ); $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
} else { } else {
$post_id = acf_get_loop( 'active', 'post_id' ); $post_id = acf_get_loop( 'active', 'post_id' );
$sub_field = get_row_sub_field( $selector ); $sub_field = get_row_sub_field( $selector );
} }
// bail early if no sub field // bail early if no sub field
@ -1144,7 +1097,6 @@ function add_sub_row( $selector, $row = false, $post_id = false ) {
// return // return
return count( $value ); return count( $value );
} }
@ -1195,7 +1147,6 @@ function update_row( $selector, $i = 1, $row = false, $post_id = false ) {
// return // return
return true; return true;
} }
@ -1223,15 +1174,11 @@ function update_sub_row( $selector, $i = 1, $row = false, $post_id = false ) {
// get sub field // get sub field
if ( is_array( $selector ) ) { if ( is_array( $selector ) ) {
$post_id = acf_get_valid_post_id( $post_id ); $post_id = acf_get_valid_post_id( $post_id );
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false ); $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
} else { } else {
$post_id = acf_get_loop( 'active', 'post_id' ); $post_id = acf_get_loop( 'active', 'post_id' );
$sub_field = get_row_sub_field( $selector ); $sub_field = get_row_sub_field( $selector );
} }
// bail early if no sub field // bail early if no sub field
@ -1253,7 +1200,6 @@ function update_sub_row( $selector, $i = 1, $row = false, $post_id = false ) {
// return // return
return true; return true;
} }
@ -1308,7 +1254,6 @@ function delete_row( $selector, $i = 1, $post_id = false ) {
// return // return
return true; return true;
} }
@ -1336,15 +1281,11 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
// get sub field // get sub field
if ( is_array( $selector ) ) { if ( is_array( $selector ) ) {
$post_id = acf_get_valid_post_id( $post_id ); $post_id = acf_get_valid_post_id( $post_id );
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false ); $sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
} else { } else {
$post_id = acf_get_loop( 'active', 'post_id' ); $post_id = acf_get_loop( 'active', 'post_id' );
$sub_field = get_row_sub_field( $selector ); $sub_field = get_row_sub_field( $selector );
} }
// bail early if no sub field // bail early if no sub field
@ -1371,7 +1312,6 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
// return // return
return true; return true;
} }
@ -1391,37 +1331,29 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
function create_field( $field ) { function create_field( $field ) {
acf_render_field( $field ); acf_render_field( $field );
} }
function render_field( $field ) { function render_field( $field ) {
acf_render_field( $field ); acf_render_field( $field );
} }
function reset_the_repeater_field() { function reset_the_repeater_field() {
return reset_rows(); return reset_rows();
} }
function the_repeater_field( $field_name, $post_id = false ) { function the_repeater_field( $field_name, $post_id = false ) {
return has_sub_field( $field_name, $post_id ); return has_sub_field( $field_name, $post_id );
} }
function the_flexible_field( $field_name, $post_id = false ) { function the_flexible_field( $field_name, $post_id = false ) {
return has_sub_field( $field_name, $post_id ); return has_sub_field( $field_name, $post_id );
} }
function acf_filter_post_id( $post_id ) { function acf_filter_post_id( $post_id ) {
return acf_get_valid_post_id( $post_id ); return acf_get_valid_post_id( $post_id );
} }

View File

@ -113,7 +113,7 @@ function acf_get_taxonomy_labels( $taxonomies = array() ) {
if ( ! isset( $ref[ $label ] ) ) { if ( ! isset( $ref[ $label ] ) ) {
$ref[ $label ] = 0; $ref[ $label ] = 0;
} }
$ref[ $label ]++; ++$ref[ $label ];
} }
// show taxonomy name next to label for shared labels // show taxonomy name next to label for shared labels

View File

@ -547,7 +547,6 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
// instantiate // instantiate
acf_new_instance( 'ACF_Assets' ); acf_new_instance( 'ACF_Assets' );
endif; // class_exists check endif; // class_exists check
/** /**

View File

@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
if ( ! class_exists( 'ACF_Data' ) ) : if ( ! class_exists( 'ACF_Data' ) ) :
#[AllowDynamicProperties] #[AllowDynamicProperties]
class ACF_Data { class ACF_Data {

View File

@ -445,7 +445,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
if ( ! empty( $args['active'] ) ) { if ( ! empty( $args['active'] ) ) {
$posts = array_filter( $posts = array_filter(
$posts, $posts,
function( $post ) { function ( $post ) {
return $post['active']; return $post['active'];
} }
); );
@ -927,7 +927,6 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
return $post; return $post;
} }
} }
} }

View File

@ -465,11 +465,9 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
// return // return
return $rule; return $rule;
} }
} }
acf_new_instance( 'ACF_Compatibility' ); acf_new_instance( 'ACF_Compatibility' );
endif; // class_exists check endif; // class_exists check
/* /*

View File

@ -136,7 +136,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
// initialize // initialize
acf()->fields = new acf_fields(); acf()->fields = new acf_fields();
endif; // class_exists check endif; // class_exists check

View File

@ -60,7 +60,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
?> ?>
<div <?php echo acf_esc_attrs( $atts ); ?>></div> <div <?php echo acf_esc_attrs( $atts ); ?>></div>
<?php <?php
} }
@ -141,7 +140,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
// return // return
return $field; return $field;
} }
} }

View File

@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
'return_format' => 'value', 'return_format' => 'value',
'layout' => 'horizontal', 'layout' => 'horizontal',
); );
} }
@ -78,7 +77,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
'label' => $_label, 'label' => $_label,
'checked' => $checked, 'checked' => $checked,
); );
} }
// maybe select initial value // maybe select initial value
@ -114,7 +112,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
// append // append
$html .= acf_get_radio_input( $button ); $html .= acf_get_radio_input( $button );
} }
// close // close
@ -122,7 +119,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
// return // return
echo $html; echo $html;
} }
@ -176,7 +172,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
), ),
) )
); );
} }
/** /**
@ -260,7 +255,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
function load_value( $value, $post_id, $field ) { function load_value( $value, $post_id, $field ) {
return acf_get_field_type( 'radio' )->load_value( $value, $post_id, $field ); return acf_get_field_type( 'radio' )->load_value( $value, $post_id, $field );
} }
@ -279,7 +273,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
function translate_field( $field ) { function translate_field( $field ) {
return acf_get_field_type( 'radio' )->translate_field( $field ); return acf_get_field_type( 'radio' )->translate_field( $field );
} }
@ -300,7 +293,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
function format_value( $value, $post_id, $field ) { function format_value( $value, $post_id, $field ) {
return acf_get_field_type( 'radio' )->format_value( $value, $post_id, $field ); return acf_get_field_type( 'radio' )->format_value( $value, $post_id, $field );
} }
/** /**
@ -326,13 +318,9 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_button_group' ); acf_register_field_type( 'acf_field_button_group' );
endif; // class_exists check endif; // class_exists check

View File

@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
'return_format' => 'value', 'return_format' => 'value',
'custom_choice_button_text' => __( 'Add new choice', 'acf' ), 'custom_choice_button_text' => __( 'Add new choice', 'acf' ),
); );
} }
@ -101,7 +100,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// return // return
echo '<ul ' . acf_esc_attr( $ul ) . '>' . "\n" . $li . '</ul>' . "\n"; echo '<ul ' . acf_esc_attr( $ul ) . '>' . "\n" . $li . '</ul>' . "\n";
} }
@ -122,7 +120,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// walk // walk
return $this->walk( $field['choices'], $field ); return $this->walk( $field['choices'], $field );
} }
/** /**
@ -186,7 +183,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// return // return
return '<li>' . acf_get_checkbox_input( $atts ) . '</li>' . "\n"; return '<li>' . acf_get_checkbox_input( $atts ) . '</li>' . "\n";
} }
@ -230,7 +226,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// append // append
$html .= '<li><input class="acf-checkbox-custom" type="checkbox" checked="checked" />' . acf_get_text_input( $text_input ) . '</li>' . "\n"; $html .= '<li><input class="acf-checkbox-custom" type="checkbox" checked="checked" />' . acf_get_text_input( $text_input ) . '</li>' . "\n";
} }
// append button // append button
@ -238,7 +233,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// return // return
return $html; return $html;
} }
@ -278,7 +272,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// optgroup // optgroup
if ( is_array( $label ) ) { if ( is_array( $label ) ) {
$html .= '<ul>' . "\n"; $html .= '<ul>' . "\n";
$html .= $this->walk( $label, $args, $depth + 1 ); $html .= $this->walk( $label, $args, $depth + 1 );
$html .= '</ul>'; $html .= '</ul>';
@ -313,17 +306,14 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// append // append
$html .= acf_get_checkbox_input( $atts ); $html .= acf_get_checkbox_input( $atts );
} }
// close // close
$html .= '</li>' . "\n"; $html .= '</li>' . "\n";
} }
// return // return
return $html; return $html;
} }
@ -380,7 +370,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
), ),
) )
); );
} }
/** /**
@ -538,17 +527,14 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
// append // append
$field['choices'][ $v ] = $v; $field['choices'][ $v ] = $v;
} }
// save // save
acf_update_field( $field ); acf_update_field( $field );
} }
// return // return
return $value; return $value;
} }
@ -568,7 +554,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
function translate_field( $field ) { function translate_field( $field ) {
return acf_get_field_type( 'select' )->translate_field( $field ); return acf_get_field_type( 'select' )->translate_field( $field );
} }
@ -630,13 +615,9 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_checkbox' ); acf_register_field_type( 'acf_field_checkbox' );
endif; // class_exists check endif; // class_exists check

View File

@ -288,7 +288,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_color_picker' ); acf_register_field_type( 'acf_field_color_picker' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -258,14 +258,11 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
// save_format - compatibility with ACF < 5.0.0 // save_format - compatibility with ACF < 5.0.0
if ( ! empty( $field['save_format'] ) ) { if ( ! empty( $field['save_format'] ) ) {
return $value; return $value;
} }
// return // return
return acf_format_date( $value, $field['return_format'] ); return acf_format_date( $value, $field['return_format'] );
} }
@ -322,13 +319,11 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
return (string) $value; return (string) $value;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_date_picker' ); acf_register_field_type( 'acf_field_date_picker' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -150,7 +150,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
<?php acf_text_input( $text_input ); ?> <?php acf_text_input( $text_input ); ?>
</div> </div>
<?php <?php
} }
@ -245,7 +244,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
function format_value( $value, $post_id, $field ) { function format_value( $value, $post_id, $field ) {
return acf_format_date( $value, $field['return_format'] ); return acf_format_date( $value, $field['return_format'] );
} }
@ -286,13 +284,11 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
'required' => ! empty( $field['required'] ), 'required' => ! empty( $field['required'] ),
); );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_date_and_time_picker' ); acf_register_field_type( 'acf_field_date_and_time_picker' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
); );
} }
@ -58,18 +57,14 @@ if ( ! class_exists( 'acf_field_email' ) ) :
// prepend // prepend
if ( $field['prepend'] !== '' ) { if ( $field['prepend'] !== '' ) {
$field['class'] .= ' acf-is-prepended'; $field['class'] .= ' acf-is-prepended';
$html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>'; $html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>';
} }
// append // append
if ( $field['append'] !== '' ) { if ( $field['append'] !== '' ) {
$field['class'] .= ' acf-is-appended'; $field['class'] .= ' acf-is-appended';
$html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>'; $html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>';
} }
// atts (value="123") // atts (value="123")
@ -94,7 +89,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
// return // return
echo $html; echo $html;
} }
@ -196,13 +190,9 @@ if ( ! class_exists( 'acf_field_email' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_email' ); acf_register_field_type( 'acf_field_email' );
endif; // class_exists check endif; // class_exists check

View File

@ -109,7 +109,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
// has value? // has value?
if ( $field['value'] ) { if ( $field['value'] ) {
$attachment = acf_get_attachment( $field['value'] ); $attachment = acf_get_attachment( $field['value'] );
if ( $attachment ) { if ( $attachment ) {
@ -190,7 +189,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
</div> </div>
</div> </div>
<?php <?php
} }
/* /*
@ -254,7 +252,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
); );
foreach ( $clear as $k ) { foreach ( $clear as $k ) {
if ( empty( $field[ $k ] ) ) { if ( empty( $field[ $k ] ) ) {
$field[ $k ] = ''; $field[ $k ] = '';
} }
@ -328,11 +325,8 @@ if ( ! class_exists( 'acf_field_file' ) ) :
// format // format
if ( $field['return_format'] == 'url' ) { if ( $field['return_format'] == 'url' ) {
return wp_get_attachment_url( $value ); return wp_get_attachment_url( $value );
} elseif ( $field['return_format'] == 'array' ) { } elseif ( $field['return_format'] == 'array' ) {
return acf_get_attachment( $value ); return acf_get_attachment( $value );
} }
@ -358,7 +352,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
$vars['send'] = true; $vars['send'] = true;
return( $vars ); return( $vars );
} }
@ -540,13 +533,11 @@ if ( ! class_exists( 'acf_field_file' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_file' ); acf_register_field_type( 'acf_field_file' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -169,7 +169,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
</div> </div>
<?php <?php
} }
@ -239,7 +238,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
'placeholder' => $this->default_values['height'], 'placeholder' => $this->default_values['height'],
) )
); );
} }
/** /**
@ -385,7 +383,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_google_map' ); acf_register_field_type( 'acf_field_google_map' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -36,7 +36,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// field filters // field filters
$this->add_field_filter( 'acf/prepare_field_for_export', array( $this, 'prepare_field_for_export' ) ); $this->add_field_filter( 'acf/prepare_field_for_export', array( $this, 'prepare_field_for_export' ) );
$this->add_field_filter( 'acf/prepare_field_for_import', array( $this, 'prepare_field_for_import' ) ); $this->add_field_filter( 'acf/prepare_field_for_import', array( $this, 'prepare_field_for_import' ) );
} }
@ -61,14 +60,11 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// append // append
if ( $sub_fields ) { if ( $sub_fields ) {
$field['sub_fields'] = $sub_fields; $field['sub_fields'] = $sub_fields;
} }
// return // return
return $field; return $field;
} }
@ -105,12 +101,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// load // load
$value[ $sub_field['key'] ] = acf_get_value( $post_id, $sub_field ); $value[ $sub_field['key'] ] = acf_get_value( $post_id, $sub_field );
} }
// return // return
return $value; return $value;
} }
@ -151,12 +145,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// append to $row // append to $row
$value[ $sub_field['_name'] ] = $sub_value; $value[ $sub_field['_name'] ] = $sub_value;
} }
// return // return
return $value; return $value;
} }
@ -199,12 +191,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// key (backend) // key (backend)
if ( isset( $value[ $sub_field['key'] ] ) ) { if ( isset( $value[ $sub_field['key'] ] ) ) {
$v = $value[ $sub_field['key'] ]; $v = $value[ $sub_field['key'] ];
// name (frontend) // name (frontend)
} elseif ( isset( $value[ $sub_field['_name'] ] ) ) { } elseif ( isset( $value[ $sub_field['_name'] ] ) ) {
$v = $value[ $sub_field['_name'] ]; $v = $value[ $sub_field['_name'] ];
// empty // empty
@ -212,17 +202,14 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// input is not set (hidden by conditioanl logic) // input is not set (hidden by conditioanl logic)
continue; continue;
} }
// update value // update value
acf_update_value( $v, $post_id, $sub_field ); acf_update_value( $v, $post_id, $sub_field );
} }
// return // return
return ''; return '';
} }
@ -251,12 +238,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// prefix name // prefix name
$sub_field['name'] = $field['name'] . '_' . $sub_field['_name']; $sub_field['name'] = $field['name'] . '_' . $sub_field['_name'];
} }
// return // return
return $field; return $field;
} }
@ -287,12 +272,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// this is a normal value // this is a normal value
$sub_field['value'] = $field['value'][ $sub_field['key'] ]; $sub_field['value'] = $field['value'][ $sub_field['key'] ];
} elseif ( isset( $sub_field['default_value'] ) ) { } elseif ( isset( $sub_field['default_value'] ) ) {
// no value, but this sub field has a default value // no value, but this sub field has a default value
$sub_field['value'] = $sub_field['default_value']; $sub_field['value'] = $sub_field['default_value'];
} }
// update prefix to allow for nested values // update prefix to allow for nested values
@ -306,15 +289,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// render // render
if ( $field['layout'] == 'table' ) { if ( $field['layout'] == 'table' ) {
$this->render_field_table( $field ); $this->render_field_table( $field );
} else { } else {
$this->render_field_block( $field ); $this->render_field_block( $field );
} }
} }
@ -340,13 +318,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
echo '<div class="acf-fields -' . $label_placement . ' -border">'; echo '<div class="acf-fields -' . $label_placement . ' -border">';
foreach ( $field['sub_fields'] as $sub_field ) { foreach ( $field['sub_fields'] as $sub_field ) {
acf_render_field_wrap( $sub_field ); acf_render_field_wrap( $sub_field );
} }
echo '</div>'; echo '</div>';
} }
@ -389,10 +364,8 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// Add custom width // Add custom width
if ( $sub_field['wrapper']['width'] ) { if ( $sub_field['wrapper']['width'] ) {
$atts['data-width'] = $sub_field['wrapper']['width']; $atts['data-width'] = $sub_field['wrapper']['width'];
$atts['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;'; $atts['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;';
} }
?> ?>
@ -408,9 +381,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
<?php <?php
foreach ( $field['sub_fields'] as $sub_field ) { foreach ( $field['sub_fields'] as $sub_field ) {
acf_render_field_wrap( $sub_field, 'td' ); acf_render_field_wrap( $sub_field, 'td' );
} }
?> ?>
@ -418,7 +389,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
</tbody> </tbody>
</table> </table>
<?php <?php
} }
@ -475,7 +445,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
), ),
) )
); );
} }
@ -522,12 +491,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// validate // validate
acf_validate_value( $value[ $k ], $sub_field, "{$input}[{$k}]" ); acf_validate_value( $value[ $k ], $sub_field, "{$input}[{$k}]" );
} }
// return // return
return $valid; return $valid;
} }
@ -558,7 +525,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// return // return
return $field; return $field;
} }
/** /**
@ -606,7 +572,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
// Return array of [field, sub_1, sub_2, ...]. // Return array of [field, sub_1, sub_2, ...].
return array_merge( array( $field ), $sub_fields ); return array_merge( array( $field ), $sub_fields );
} }
return $field; return $field;
} }
@ -712,13 +677,11 @@ if ( ! class_exists( 'acf_field__group' ) ) :
return $value; return $value;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field__group' ); acf_register_field_type( 'acf_field__group' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -42,7 +42,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
// filters // filters
add_filter( 'get_media_item_args', array( $this, 'get_media_item_args' ) ); add_filter( 'get_media_item_args', array( $this, 'get_media_item_args' ) );
} }
@ -375,18 +374,13 @@ if ( ! class_exists( 'acf_field_image' ) ) :
// format // format
if ( $field['return_format'] == 'url' ) { if ( $field['return_format'] == 'url' ) {
return wp_get_attachment_url( $value ); return wp_get_attachment_url( $value );
} elseif ( $field['return_format'] == 'array' ) { } elseif ( $field['return_format'] == 'array' ) {
return acf_get_attachment( $value ); return acf_get_attachment( $value );
} }
// return // return
return $value; return $value;
} }
@ -407,7 +401,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
$vars['send'] = true; $vars['send'] = true;
return( $vars ); return( $vars );
} }
@ -430,7 +423,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
function update_value( $value, $post_id, $field ) { function update_value( $value, $post_id, $field ) {
return acf_get_field_type( 'file' )->update_value( $value, $post_id, $field ); return acf_get_field_type( 'file' )->update_value( $value, $post_id, $field );
} }
@ -484,13 +476,11 @@ if ( ! class_exists( 'acf_field_image' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_image' ); acf_register_field_type( 'acf_field_image' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -30,7 +30,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
$this->defaults = array( $this->defaults = array(
'return_format' => 'array', 'return_format' => 'array',
); );
} }
@ -58,25 +57,20 @@ if ( ! class_exists( 'acf_field_link' ) ) :
// array (ACF 5.6.0) // array (ACF 5.6.0)
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
$link = array_merge( $link, $value ); $link = array_merge( $link, $value );
// post id (ACF < 5.6.0) // post id (ACF < 5.6.0)
} elseif ( is_numeric( $value ) ) { } elseif ( is_numeric( $value ) ) {
$link['title'] = get_the_title( $value ); $link['title'] = get_the_title( $value );
$link['url'] = get_permalink( $value ); $link['url'] = get_permalink( $value );
// string (ACF < 5.6.0) // string (ACF < 5.6.0)
} elseif ( is_string( $value ) ) { } elseif ( is_string( $value ) ) {
$link['url'] = $value; $link['url'] = $value;
} }
// return // return
return $link; return $link;
} }
@ -147,7 +141,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
</div> </div>
<?php <?php
} }
@ -178,7 +171,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
), ),
) )
); );
} }
/* /*
@ -209,14 +201,11 @@ if ( ! class_exists( 'acf_field_link' ) ) :
// format value // format value
if ( $field['return_format'] == 'url' ) { if ( $field['return_format'] == 'url' ) {
return $link['url']; return $link['url'];
} }
// return link // return link
return $link; return $link;
} }
@ -242,14 +231,11 @@ if ( ! class_exists( 'acf_field_link' ) ) :
// URL is required // URL is required
if ( empty( $value ) || empty( $value['url'] ) ) { if ( empty( $value ) || empty( $value['url'] ) ) {
return false; return false;
} }
// return // return
return $valid; return $valid;
} }
@ -310,7 +296,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_link' ); acf_register_field_type( 'acf_field_link' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
'esc_html' => 0, 'esc_html' => 0,
'new_lines' => 'wpautop', 'new_lines' => 'wpautop',
); );
} }
@ -58,25 +57,18 @@ if ( ! class_exists( 'acf_field_message' ) ) :
// esc_html // esc_html
if ( $field['esc_html'] ) { if ( $field['esc_html'] ) {
$m = esc_html( $m ); $m = esc_html( $m );
} }
// new lines // new lines
if ( $field['new_lines'] == 'wpautop' ) { if ( $field['new_lines'] == 'wpautop' ) {
$m = wpautop( $m ); $m = wpautop( $m );
} elseif ( $field['new_lines'] == 'br' ) { } elseif ( $field['new_lines'] == 'br' ) {
$m = nl2br( $m ); $m = nl2br( $m );
} }
// return // return
echo acf_esc_html( $m ); echo acf_esc_html( $m );
} }
@ -150,7 +142,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
// return // return
return $field; return $field;
} }
@ -184,13 +175,9 @@ if ( ! class_exists( 'acf_field_message' ) ) :
// return // return
return $field; return $field;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_message' ); acf_register_field_type( 'acf_field_message' );
endif; // class_exists check endif; // class_exists check

View File

@ -35,7 +35,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
); );
} }
@ -66,18 +65,14 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// prepend // prepend
if ( $field['prepend'] !== '' ) { if ( $field['prepend'] !== '' ) {
$field['class'] .= ' acf-is-prepended'; $field['class'] .= ' acf-is-prepended';
$html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>'; $html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>';
} }
// append // append
if ( $field['append'] !== '' ) { if ( $field['append'] !== '' ) {
$field['class'] .= ' acf-is-appended'; $field['class'] .= ' acf-is-appended';
$html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>'; $html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>';
} }
// atts (value="123") // atts (value="123")
@ -102,7 +97,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// return // return
echo $html; echo $html;
} }
@ -230,9 +224,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// remove ',' // remove ','
if ( acf_str_exists( ',', $value ) ) { if ( acf_str_exists( ',', $value ) ) {
$value = str_replace( ',', '', $value ); $value = str_replace( ',', '', $value );
} }
// if value is not numeric... // if value is not numeric...
@ -240,14 +232,11 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// allow blank to be saved // allow blank to be saved
if ( ! empty( $value ) ) { if ( ! empty( $value ) ) {
$valid = __( 'Value must be a number', 'acf' ); $valid = __( 'Value must be a number', 'acf' );
} }
// return early // return early
return $valid; return $valid;
} }
// convert // convert
@ -255,21 +244,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// min // min
if ( is_numeric( $field['min'] ) && $value < floatval( $field['min'] ) ) { if ( is_numeric( $field['min'] ) && $value < floatval( $field['min'] ) ) {
$valid = sprintf( __( 'Value must be equal to or higher than %d', 'acf' ), $field['min'] ); $valid = sprintf( __( 'Value must be equal to or higher than %d', 'acf' ), $field['min'] );
} }
// max // max
if ( is_numeric( $field['max'] ) && $value > floatval( $field['max'] ) ) { if ( is_numeric( $field['max'] ) && $value > floatval( $field['max'] ) ) {
$valid = sprintf( __( 'Value must be equal to or lower than %d', 'acf' ), $field['max'] ); $valid = sprintf( __( 'Value must be equal to or lower than %d', 'acf' ), $field['max'] );
} }
// return // return
return $valid; return $valid;
} }
@ -293,21 +277,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
// no formatting needed for empty value // no formatting needed for empty value
if ( empty( $value ) ) { if ( empty( $value ) ) {
return $value; return $value;
} }
// remove ',' // remove ','
if ( acf_str_exists( ',', $value ) ) { if ( acf_str_exists( ',', $value ) ) {
$value = str_replace( ',', '', $value ); $value = str_replace( ',', '', $value );
} }
// return // return
return $value; return $value;
} }
/** /**
@ -348,13 +327,9 @@ if ( ! class_exists( 'acf_field_number' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_number' ); acf_register_field_type( 'acf_field_number' );
endif; // class_exists check endif; // class_exists check

View File

@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
// extra // extra
add_action( 'wp_ajax_acf/fields/oembed/search', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_acf/fields/oembed/search', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/oembed/search', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_nopriv_acf/fields/oembed/search', array( $this, 'ajax_query' ) );
} }
@ -66,7 +65,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
// return // return
return $field; return $field;
} }
/** /**
@ -125,7 +123,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
// return // return
wp_send_json( $response ); wp_send_json( $response );
} }
@ -170,7 +167,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
// return // return
return $response; return $response;
} }
@ -242,7 +238,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
</div> </div>
<?php <?php
} }
@ -333,7 +328,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_oembed' ); acf_register_field_type( 'acf_field_oembed' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -27,7 +27,6 @@ if ( ! class_exists( 'acf_field_output' ) ) :
$this->defaults = array( $this->defaults = array(
'html' => false, 'html' => false,
); );
} }
@ -55,24 +54,16 @@ if ( ! class_exists( 'acf_field_output' ) ) :
// html // html
if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) { if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) {
echo $field['html']; echo $field['html'];
// function // function
} else { } else {
call_user_func_array( $field['html'], array( $field ) ); call_user_func_array( $field['html'], array( $field ) );
} }
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_output' ); acf_register_field_type( 'acf_field_output' );
endif; // class_exists check endif; // class_exists check

View File

@ -38,7 +38,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// extra // extra
add_action( 'wp_ajax_acf/fields/page_link/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_acf/fields/page_link/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/page_link/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_nopriv_acf/fields/page_link/query', array( $this, 'ajax_query' ) );
} }
@ -92,7 +91,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// update vars // update vars
$args['s'] = $s; $args['s'] = $s;
$is_search = true; $is_search = true;
} }
// load field // load field
@ -103,24 +101,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// update $args // update $args
if ( ! empty( $field['post_type'] ) ) { if ( ! empty( $field['post_type'] ) ) {
$args['post_type'] = acf_get_array( $field['post_type'] ); $args['post_type'] = acf_get_array( $field['post_type'] );
} else { } else {
$args['post_type'] = acf_get_post_types(); $args['post_type'] = acf_get_post_types();
} }
// post status // post status
if ( ! empty( $options['post_status'] ) ) { if ( ! empty( $options['post_status'] ) ) {
$args['post_status'] = acf_get_array( $options['post_status'] ); $args['post_status'] = acf_get_array( $options['post_status'] );
} elseif ( ! empty( $field['post_status'] ) ) { } elseif ( ! empty( $field['post_status'] ) ) {
$args['post_status'] = acf_get_array( $field['post_status'] ); $args['post_status'] = acf_get_array( $field['post_status'] );
} }
// create tax queries // create tax queries
@ -134,13 +124,11 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// now create the tax queries // now create the tax queries
foreach ( $taxonomies as $taxonomy => $terms ) { foreach ( $taxonomies as $taxonomy => $terms ) {
$args['tax_query'][] = array( $args['tax_query'][] = array(
'taxonomy' => $taxonomy, 'taxonomy' => $taxonomy,
'field' => 'slug', 'field' => 'slug',
'terms' => $terms, 'terms' => $terms,
); );
} }
} }
@ -187,7 +175,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// loop // loop
if ( ! empty( $groups ) ) { if ( ! empty( $groups ) ) {
foreach ( array_keys( $groups ) as $group_title ) { foreach ( array_keys( $groups ) as $group_title ) {
// vars // vars
@ -201,28 +188,21 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// convert post objects to post titles // convert post objects to post titles
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search ); $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
} }
// order posts by search // order posts by search
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) { 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'] );
} }
// append to $data // append to $data
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] ); $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
} }
// append to $results // append to $results
$results[] = $data; $results[] = $data;
} }
} }
@ -233,7 +213,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
'limit' => $args['posts_per_page'], 'limit' => $args['posts_per_page'],
) )
); );
} }
@ -264,15 +243,12 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
$pos = strpos( $text, $search ); $pos = strpos( $text, $search );
if ( $pos !== false ) { if ( $pos !== false ) {
$result['description'] = substr( $text, $pos + 2 ); $result['description'] = substr( $text, $pos + 2 );
$result['text'] = substr( $text, 0, $pos ); $result['text'] = substr( $text, 0, $pos );
} }
// return // return
return $result; return $result;
} }
@ -308,7 +284,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// return // return
return $title; return $title;
} }
@ -334,20 +309,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
$post__in = array(); $post__in = array();
foreach ( $value as $k => $v ) { foreach ( $value as $k => $v ) {
if ( is_numeric( $v ) ) { if ( is_numeric( $v ) ) {
// append to $post__in // append to $post__in
$post__in[] = (int) $v; $post__in[] = (int) $v;
} }
} }
// bail early if no posts // bail early if no posts
if ( empty( $post__in ) ) { if ( empty( $post__in ) ) {
return $value; return $value;
} }
// get posts // get posts
@ -363,7 +334,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// append to $return // append to $return
foreach ( $value as $k => $v ) { foreach ( $value as $k => $v ) {
if ( is_numeric( $v ) ) { if ( is_numeric( $v ) ) {
// extract first post // extract first post
@ -371,20 +341,15 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// append // append
if ( $post ) { if ( $post ) {
$return[] = $post; $return[] = $post;
} }
} else { } else {
$return[] = $v; $return[] = $v;
} }
} }
// return // return
return $return; return $return;
} }
@ -416,7 +381,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// set choices // set choices
if ( ! empty( $posts ) ) { if ( ! empty( $posts ) ) {
foreach ( array_keys( $posts ) as $i ) { foreach ( array_keys( $posts ) as $i ) {
// vars // vars
@ -426,12 +390,10 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// append to choices // append to choices
$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field ); $field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
} else { } else {
// append to choices // append to choices
$field['choices'][ $post ] = $post; $field['choices'][ $post ] = $post;
} }
} }
} }
@ -564,16 +526,12 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// ACF4 null // ACF4 null
if ( $value === 'null' ) { if ( $value === 'null' ) {
return false; return false;
} }
// bail early if no value // bail early if no value
if ( empty( $value ) ) { if ( empty( $value ) ) {
return $value; return $value;
} }
// get posts // get posts
@ -587,26 +545,20 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
// convert $post to permalink // convert $post to permalink
if ( is_object( $post ) ) { if ( is_object( $post ) ) {
$post = get_permalink( $post ); $post = get_permalink( $post );
} }
// append back to $value // append back to $value
$value[ $i ] = $post; $value[ $i ] = $post;
} }
// convert back from array if neccessary // convert back from array if neccessary
if ( ! $field['multiple'] ) { if ( ! $field['multiple'] ) {
$value = array_shift( $value ); $value = array_shift( $value );
} }
// return value // return value
return $value; return $value;
} }
@ -733,13 +685,9 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_page_link' ); acf_register_field_type( 'acf_field_page_link' );
endif; // class_exists check endif; // class_exists check

View File

@ -31,7 +31,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
); );
} }
@ -50,7 +49,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
function render_field( $field ) { function render_field( $field ) {
acf_get_field_type( 'text' )->render_field( $field ); acf_get_field_type( 'text' )->render_field( $field );
} }
/* /*
@ -108,13 +106,9 @@ if ( ! class_exists( 'acf_field_password' ) ) :
) )
); );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_password' ); acf_register_field_type( 'acf_field_password' );
endif; // class_exists check endif; // class_exists check

View File

@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// extra // extra
add_action( 'wp_ajax_acf/fields/post_object/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_acf/fields/post_object/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/post_object/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_nopriv_acf/fields/post_object/query', array( $this, 'ajax_query' ) );
} }
@ -61,7 +60,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// return // return
acf_send_ajax_results( $response ); acf_send_ajax_results( $response );
} }
@ -116,29 +114,20 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// update vars // update vars
$args['s'] = $s; $args['s'] = $s;
$is_search = true; $is_search = true;
} }
// post_type // post_type
if ( ! empty( $field['post_type'] ) ) { if ( ! empty( $field['post_type'] ) ) {
$args['post_type'] = acf_get_array( $field['post_type'] ); $args['post_type'] = acf_get_array( $field['post_type'] );
} else { } else {
$args['post_type'] = acf_get_post_types(); $args['post_type'] = acf_get_post_types();
} }
// post status // post status
if ( ! empty( $options['post_status'] ) ) { if ( ! empty( $options['post_status'] ) ) {
$args['post_status'] = acf_get_array( $options['post_status'] ); $args['post_status'] = acf_get_array( $options['post_status'] );
} elseif ( ! empty( $field['post_status'] ) ) { } elseif ( ! empty( $field['post_status'] ) ) {
$args['post_status'] = acf_get_array( $field['post_status'] ); $args['post_status'] = acf_get_array( $field['post_status'] );
} }
// taxonomy // taxonomy
@ -152,13 +141,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// now create the tax queries // now create the tax queries
foreach ( $terms as $k => $v ) { foreach ( $terms as $k => $v ) {
$args['tax_query'][] = array( $args['tax_query'][] = array(
'taxonomy' => $k, 'taxonomy' => $k,
'field' => 'slug', 'field' => 'slug',
'terms' => $v, 'terms' => $v,
); );
} }
} }
@ -189,28 +176,21 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// convert post objects to post titles // convert post objects to post titles
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search ); $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
} }
// order posts by search // order posts by search
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) { 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'] );
} }
// append to $data // append to $data
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] ); $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
} }
// append to $results // append to $results
$results[] = $data; $results[] = $data;
} }
// optgroup or single // optgroup or single
@ -227,7 +207,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// return // return
return $response; return $response;
} }
@ -258,15 +237,12 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
$pos = strpos( $text, $search ); $pos = strpos( $text, $search );
if ( $pos !== false ) { if ( $pos !== false ) {
$result['description'] = substr( $text, $pos + 2 ); $result['description'] = substr( $text, $pos + 2 );
$result['text'] = substr( $text, 0, $pos ); $result['text'] = substr( $text, 0, $pos );
} }
// return // return
return $result; return $result;
} }
@ -329,7 +305,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
$posts = $this->get_posts( $field['value'], $field ); $posts = $this->get_posts( $field['value'], $field );
if ( $posts ) { if ( $posts ) {
foreach ( array_keys( $posts ) as $i ) { foreach ( array_keys( $posts ) as $i ) {
// vars // vars
@ -337,13 +312,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// append to choices // append to choices
$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field ); $field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
} }
} }
// render // render
acf_render_field( $field ); acf_render_field( $field );
} }
@ -430,7 +403,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
'ui' => 1, 'ui' => 1,
) )
); );
} }
/** /**
@ -490,7 +462,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// return // return
return $value; return $value;
} }
@ -522,21 +493,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// load posts if needed // load posts if needed
if ( $field['return_format'] == 'object' ) { if ( $field['return_format'] == 'object' ) {
$value = $this->get_posts( $value, $field ); $value = $this->get_posts( $value, $field );
} }
// convert back from array if neccessary // convert back from array if neccessary
if ( ! $field['multiple'] && is_array( $value ) ) { if ( ! $field['multiple'] && is_array( $value ) ) {
$value = current( $value ); $value = current( $value );
} }
// return value // return value
return $value; return $value;
} }
@ -610,7 +576,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
// return // return
return $posts; return $posts;
} }
/** /**
@ -785,13 +750,9 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_post_object' ); acf_register_field_type( 'acf_field_post_object' );
endif; // class_exists check endif; // class_exists check

View File

@ -36,7 +36,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
'allow_null' => 0, 'allow_null' => 0,
'return_format' => 'value', 'return_format' => 'value',
); );
} }
@ -372,7 +371,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
// save // save
acf_update_field( $field ); acf_update_field( $field );
} }
} }
@ -401,14 +399,11 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
// must be single value // must be single value
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
$value = array_pop( $value ); $value = array_pop( $value );
} }
// return // return
return $value; return $value;
} }
@ -428,7 +423,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
function translate_field( $field ) { function translate_field( $field ) {
return acf_get_field_type( 'select' )->translate_field( $field ); return acf_get_field_type( 'select' )->translate_field( $field );
} }
@ -451,7 +445,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
function format_value( $value, $post_id, $field ) { function format_value( $value, $post_id, $field ) {
return acf_get_field_type( 'select' )->format_value( $value, $post_id, $field ); return acf_get_field_type( 'select' )->format_value( $value, $post_id, $field );
} }
/** /**
@ -480,13 +473,9 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_radio' ); acf_register_field_type( 'acf_field_radio' );
endif; // class_exists check endif; // class_exists check

View File

@ -34,7 +34,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
); );
} }
@ -275,14 +274,9 @@ if ( ! class_exists( 'acf_field_range' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_range' ); acf_register_field_type( 'acf_field_range' );
endif; // class_exists check endif; // class_exists check

View File

@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// extra // extra
add_action( 'wp_ajax_acf/fields/relationship/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/relationship/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_nopriv_acf/fields/relationship/query', array( $this, 'ajax_query' ) );
} }
@ -89,7 +88,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// return // return
acf_send_ajax_results( $response ); acf_send_ajax_results( $response );
} }
@ -146,33 +144,22 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// update vars // update vars
$args['s'] = $s; $args['s'] = $s;
$is_search = true; $is_search = true;
} }
// post_type // post_type
if ( ! empty( $options['post_type'] ) ) { if ( ! empty( $options['post_type'] ) ) {
$args['post_type'] = acf_get_array( $options['post_type'] ); $args['post_type'] = acf_get_array( $options['post_type'] );
} elseif ( ! empty( $field['post_type'] ) ) { } elseif ( ! empty( $field['post_type'] ) ) {
$args['post_type'] = acf_get_array( $field['post_type'] ); $args['post_type'] = acf_get_array( $field['post_type'] );
} else { } else {
$args['post_type'] = acf_get_post_types(); $args['post_type'] = acf_get_post_types();
} }
// post status // post status
if ( ! empty( $options['post_status'] ) ) { if ( ! empty( $options['post_status'] ) ) {
$args['post_status'] = acf_get_array( $options['post_status'] ); $args['post_status'] = acf_get_array( $options['post_status'] );
} elseif ( ! empty( $field['post_status'] ) ) { } elseif ( ! empty( $field['post_status'] ) ) {
$args['post_status'] = acf_get_array( $field['post_status'] ); $args['post_status'] = acf_get_array( $field['post_status'] );
} }
// taxonomy // taxonomy
@ -190,7 +177,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
'field' => 'slug', 'field' => 'slug',
'terms' => $term['term'], 'terms' => $term['term'],
); );
} elseif ( ! empty( $field['taxonomy'] ) ) { } elseif ( ! empty( $field['taxonomy'] ) ) {
// vars // vars
@ -203,13 +189,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// now create the tax queries // now create the tax queries
foreach ( $terms as $k => $v ) { foreach ( $terms as $k => $v ) {
$args['tax_query'][] = array( $args['tax_query'][] = array(
'taxonomy' => $k, 'taxonomy' => $k,
'field' => 'slug', 'field' => 'slug',
'terms' => $v, 'terms' => $v,
); );
} }
} }
@ -240,35 +224,26 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// convert post objects to post titles // convert post objects to post titles
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] ); $posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
} }
// order posts by search // order posts by search
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) { 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'] );
} }
// append to $data // append to $data
foreach ( array_keys( $posts ) as $post_id ) { foreach ( array_keys( $posts ) as $post_id ) {
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] ); $data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
} }
// append to $results // append to $results
$results[] = $data; $results[] = $data;
} }
// add as optgroup or results // add as optgroup or results
if ( count( $args['post_type'] ) == 1 ) { if ( count( $args['post_type'] ) == 1 ) {
$results = $results[0]['children']; $results = $results[0]['children'];
} }
// vars // vars
@ -279,7 +254,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// return // return
return $response; return $response;
} }
@ -307,7 +281,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// return // return
return $result; return $result;
} }
@ -345,14 +318,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// icon // icon
if ( $thumbnail['type'] == 'icon' ) { if ( $thumbnail['type'] == 'icon' ) {
$class .= ' -' . $thumbnail['type']; $class .= ' -' . $thumbnail['type'];
} }
// append // append
$title = '<div class="' . $class . '">' . $thumbnail['html'] . '</div>' . $title; $title = '<div class="' . $class . '">' . $thumbnail['html'] . '</div>' . $title;
} }
// filters // filters
@ -362,7 +332,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// return // return
return $title; return $title;
} }
@ -392,7 +361,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// post_type filter // post_type filter
if ( in_array( 'post_type', $filters ) ) { if ( in_array( 'post_type', $filters ) ) {
$filter_post_type_choices = array( $filter_post_type_choices = array(
'' => __( 'Select post type', 'acf' ), '' => __( 'Select post type', 'acf' ),
) + acf_get_pretty_post_types( $post_type ); ) + acf_get_pretty_post_types( $post_type );
@ -400,7 +368,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// taxonomy filter // taxonomy filter
if ( in_array( 'taxonomy', $filters ) ) { if ( in_array( 'taxonomy', $filters ) ) {
$term_choices = array(); $term_choices = array();
$filter_taxonomy_choices = array( $filter_taxonomy_choices = array(
'' => __( 'Select taxonomy', 'acf' ), '' => __( 'Select taxonomy', 'acf' ),
@ -431,7 +398,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// append term choices // append term choices
$filter_taxonomy_choices = $filter_taxonomy_choices + $term_choices; $filter_taxonomy_choices = $filter_taxonomy_choices + $term_choices;
} }
// div attributes // div attributes
@ -736,9 +702,7 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// bail early if no value // bail early if no value
if ( empty( $value ) ) { if ( empty( $value ) ) {
return $value; return $value;
} }
// force value to array // force value to array
@ -757,12 +721,10 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
'post_type' => $field['post_type'], 'post_type' => $field['post_type'],
) )
); );
} }
// return // return
return $value; return $value;
} }
@ -783,22 +745,17 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
// default // default
if ( empty( $value ) || ! is_array( $value ) ) { if ( empty( $value ) || ! is_array( $value ) ) {
$value = array(); $value = array();
} }
// min // min
if ( count( $value ) < $field['min'] ) { if ( count( $value ) < $field['min'] ) {
$valid = _n( '%1$s requires at least %2$s selection', '%1$s requires at least %2$s selections', $field['min'], 'acf' ); $valid = _n( '%1$s requires at least %2$s selection', '%1$s requires at least %2$s selections', $field['min'], 'acf' );
$valid = sprintf( $valid, $field['label'], $field['min'] ); $valid = sprintf( $valid, $field['label'], $field['min'] );
} }
// return // return
return $valid; return $valid;
} }
@ -922,13 +879,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_relationship' ); acf_register_field_type( 'acf_field_relationship' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -41,7 +41,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// ajax // ajax
add_action( 'wp_ajax_acf/fields/select/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_acf/fields/select/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/select/query', array( $this, 'ajax_query' ) ); add_action( 'wp_ajax_nopriv_acf/fields/select/query', array( $this, 'ajax_query' ) );
} }
@ -78,25 +77,20 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// attempt to find 3rd party Select2 version // attempt to find 3rd party Select2 version
// - avoid including v3 CSS when v4 JS is already enququed // - avoid including v3 CSS when v4 JS is already enququed
if ( isset( $wp_scripts->registered['select2'] ) ) { if ( isset( $wp_scripts->registered['select2'] ) ) {
$major = (int) $wp_scripts->registered['select2']->ver; $major = (int) $wp_scripts->registered['select2']->ver;
} }
// v4 // v4
if ( $major == 4 ) { if ( $major == 4 ) {
$version = '4.0.13'; $version = '4.0.13';
$script = acf_get_url( "assets/inc/select2/4/select2.full{$min}.js" ); $script = acf_get_url( "assets/inc/select2/4/select2.full{$min}.js" );
$style = acf_get_url( "assets/inc/select2/4/select2{$min}.css" ); $style = acf_get_url( "assets/inc/select2/4/select2{$min}.css" );
// v3 // v3
} else { } else {
$version = '3.5.2'; $version = '3.5.2';
$script = acf_get_url( "assets/inc/select2/3/select2{$min}.js" ); $script = acf_get_url( "assets/inc/select2/3/select2{$min}.js" );
$style = acf_get_url( 'assets/inc/select2/3/select2.css' ); $style = acf_get_url( 'assets/inc/select2/3/select2.css' );
} }
// enqueue // enqueue
@ -150,7 +144,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// return // return
acf_send_ajax_results( $response ); acf_send_ajax_results( $response );
} }
@ -200,7 +193,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// strip slashes (search may be integer) // strip slashes (search may be integer)
$s = strval( $options['s'] ); $s = strval( $options['s'] );
$s = wp_unslash( $s ); $s = wp_unslash( $s );
} }
foreach ( $field['choices'] as $k => $v ) { foreach ( $field['choices'] as $k => $v ) {
@ -218,7 +210,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
'id' => $k, 'id' => $k,
'text' => $v, 'text' => $v,
); );
} }
$response = array( $response = array(
@ -293,7 +284,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// multiple // multiple
if ( $field['multiple'] ) { if ( $field['multiple'] ) {
$select['multiple'] = 'multiple'; $select['multiple'] = 'multiple';
$select['size'] = 5; $select['size'] = 5;
$select['name'] .= '[]'; $select['name'] .= '[]';
@ -339,7 +329,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// render // render
acf_select_input( $select ); acf_select_input( $select );
} }
@ -411,7 +400,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
'ui' => 1, 'ui' => 1,
) )
); );
} }
/** /**
@ -586,7 +574,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// return // return
return $field; return $field;
} }
@ -634,22 +621,18 @@ if ( ! class_exists( 'acf_field_select' ) ) :
// label // label
} elseif ( $field['return_format'] == 'label' ) { } elseif ( $field['return_format'] == 'label' ) {
$value = $label; $value = $label;
// array // array
} elseif ( $field['return_format'] == 'array' ) { } elseif ( $field['return_format'] == 'array' ) {
$value = array( $value = array(
'value' => $value, 'value' => $value,
'label' => $label, 'label' => $label,
); );
} }
// return // return
return $value; return $value;
} }
/** /**
@ -756,13 +739,9 @@ if ( ! class_exists( 'acf_field_select' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_select' ); acf_register_field_type( 'acf_field_select' );
endif; // class_exists check endif; // class_exists check

View File

@ -25,7 +25,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
$this->label = __( 'Separator', 'acf' ); $this->label = __( 'Separator', 'acf' );
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-separator.png'; $this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-separator.png';
$this->category = 'layout'; $this->category = 'layout';
} }
@ -44,7 +43,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
function render_field( $field ) { function render_field( $field ) {
/* do nothing */ /* do nothing */
} }
@ -75,15 +73,10 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
// return // return
return $field; return $field;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_separator' ); acf_register_field_type( 'acf_field_separator' );
endif; // class_exists check endif; // class_exists check

View File

@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
'placement' => 'top', 'placement' => 'top',
'endpoint' => 0, // added in 5.2.8 'endpoint' => 0, // added in 5.2.8
); );
} }
@ -66,7 +65,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
?> ?>
<a <?php echo acf_esc_attrs( $atts ); ?>><?php echo acf_esc_html( $field['label'] ); ?></a> <a <?php echo acf_esc_attrs( $atts ); ?>><?php echo acf_esc_html( $field['label'] ); ?></a>
<?php <?php
} }
@ -128,7 +126,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
'ui' => 1, 'ui' => 1,
) )
); );
} }
@ -161,15 +158,12 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
// return // return
return $field; return $field;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_tab' ); acf_register_field_type( 'acf_field_tab' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -45,7 +45,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// actions // actions
add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 ); add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 );
} }
@ -74,7 +73,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// return // return
acf_send_ajax_results( $response ); acf_send_ajax_results( $response );
} }
@ -132,10 +130,8 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// pagination // pagination
// - don't bother for hierarchial terms, we will need to load all terms anyway // - don't bother for hierarchial terms, we will need to load all terms anyway
if ( $is_pagination && ! $is_hierarchical ) { if ( $is_pagination && ! $is_hierarchical ) {
$args['number'] = $limit; $args['number'] = $limit;
$args['offset'] = $offset; $args['offset'] = $offset;
} }
// search // search
@ -147,7 +143,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// update vars // update vars
$args['search'] = $s; $args['search'] = $s;
$is_search = true; $is_search = true;
} }
// filters // filters
@ -175,17 +170,13 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// check for empty array (possible if parent did not exist within original data) // check for empty array (possible if parent did not exist within original data)
if ( ! empty( $ordered_terms ) ) { if ( ! empty( $ordered_terms ) ) {
$terms = $ordered_terms; $terms = $ordered_terms;
} }
} }
// fake pagination // fake pagination
if ( $is_pagination ) { if ( $is_pagination ) {
$terms = array_slice( $terms, $offset, $limit ); $terms = array_slice( $terms, $offset, $limit );
} }
} }
@ -197,7 +188,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
'id' => $term->term_id, 'id' => $term->term_id,
'text' => $this->get_term_title( $term, $field, $options['post_id'] ), 'text' => $this->get_term_title( $term, $field, $options['post_id'] ),
); );
} }
// vars // vars
@ -208,7 +198,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// return // return
return $response; return $response;
} }
/** /**
@ -260,7 +249,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// load terms in 1 query to save multiple DB calls from following code // load terms in 1 query to save multiple DB calls from following code
if ( count( $value ) > 1 ) { if ( count( $value ) > 1 ) {
$terms = acf_get_terms( $terms = acf_get_terms(
array( array(
'taxonomy' => $taxonomy, 'taxonomy' => $taxonomy,
@ -268,14 +256,11 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
'hide_empty' => false, 'hide_empty' => false,
) )
); );
} }
// update value to include $post // update value to include $post
foreach ( array_keys( $value ) as $i ) { foreach ( array_keys( $value ) as $i ) {
$value[ $i ] = get_term( $value[ $i ], $taxonomy ); $value[ $i ] = get_term( $value[ $i ], $taxonomy );
} }
// filter out null values // filter out null values
@ -336,34 +321,26 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// sort // sort
if ( ! empty( $value ) ) { if ( ! empty( $value ) ) {
$order = array(); $order = array();
foreach ( $term_ids as $i => $v ) { foreach ( $term_ids as $i => $v ) {
$order[ $i ] = array_search( $v, $value ); $order[ $i ] = array_search( $v, $value );
} }
array_multisort( $order, $term_ids ); array_multisort( $order, $term_ids );
} }
// update value // update value
$value = $term_ids; $value = $term_ids;
} }
// convert back from array if neccessary // convert back from array if neccessary
if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) { if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
$value = array_shift( $value ); $value = array_shift( $value );
} }
// return // return
return $value; return $value;
} }
@ -412,7 +389,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
} }
return $value; return $value;
} }
/** /**
@ -483,19 +459,15 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// get posts // get posts
$value = $this->get_terms( $value, $field['taxonomy'] ); $value = $this->get_terms( $value, $field['taxonomy'] );
} }
// convert back from array if neccessary // convert back from array if neccessary
if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) { if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
$value = array_shift( $value ); $value = array_shift( $value );
} }
// return // return
return $value; return $value;
} }
@ -543,31 +515,22 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
endif; endif;
if ( $field['field_type'] == 'select' ) { if ( $field['field_type'] == 'select' ) {
$field['multiple'] = 0; $field['multiple'] = 0;
$this->render_field_select( $field ); $this->render_field_select( $field );
} elseif ( $field['field_type'] == 'multi_select' ) { } elseif ( $field['field_type'] == 'multi_select' ) {
$field['multiple'] = 1; $field['multiple'] = 1;
$this->render_field_select( $field ); $this->render_field_select( $field );
} elseif ( $field['field_type'] == 'radio' ) { } elseif ( $field['field_type'] == 'radio' ) {
$this->render_field_checkbox( $field ); $this->render_field_checkbox( $field );
} elseif ( $field['field_type'] == 'checkbox' ) { } elseif ( $field['field_type'] == 'checkbox' ) {
$this->render_field_checkbox( $field ); $this->render_field_checkbox( $field );
} }
?> ?>
</div> </div>
<?php <?php
} }
@ -599,7 +562,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// set choices // set choices
if ( ! empty( $terms ) ) { if ( ! empty( $terms ) ) {
foreach ( array_keys( $terms ) as $i ) { foreach ( array_keys( $terms ) as $i ) {
// vars // vars
@ -607,14 +569,12 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// append to choices // append to choices
$field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field ); $field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field );
} }
} }
} }
// render select // render select
acf_render_field( $field ); acf_render_field( $field );
} }
@ -637,9 +597,7 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// checkbox saves an array. // checkbox saves an array.
if ( $field['field_type'] == 'checkbox' ) { if ( $field['field_type'] == 'checkbox' ) {
$field['name'] .= '[]'; $field['name'] .= '[]';
} }
// taxonomy. // taxonomy.
@ -669,7 +627,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
</ul> </ul>
</div> </div>
<?php <?php
} }
@ -896,7 +853,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
'term_parent' => $term->parent, 'term_parent' => $term->parent,
) )
); );
} }
?> ?>
@ -912,16 +868,12 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
); );
if ( is_taxonomy_hierarchical( $field['taxonomy'] ) ) { if ( is_taxonomy_hierarchical( $field['taxonomy'] ) ) {
$choices = array(); $choices = array();
$response = $this->get_ajax_query( $args ); $response = $this->get_ajax_query( $args );
if ( $response ) { if ( $response ) {
foreach ( $response['results'] as $v ) { foreach ( $response['results'] as $v ) {
$choices[ $v['id'] ] = $v['text']; $choices[ $v['id'] ] = $v['text'];
} }
} }
@ -935,7 +887,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
'choices' => $choices, 'choices' => $choices,
) )
); );
} }
?> ?>
@ -946,7 +897,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
// die // die
die; die;
} }
/** /**
@ -1010,13 +960,11 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
return $links; return $links;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_taxonomy' ); acf_register_field_type( 'acf_field_taxonomy' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -213,5 +213,4 @@ if ( ! class_exists( 'acf_field_text' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_text' ); acf_register_field_type( 'acf_field_text' );
endif; // class_exists check endif; // class_exists check

View File

@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
'placeholder' => '', 'placeholder' => '',
'rows' => '', 'rows' => '',
); );
} }
@ -80,7 +79,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
// return // return
acf_textarea_input( $atts ); acf_textarea_input( $atts );
} }
@ -195,20 +193,14 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
// bail early if no value or not for template // bail early if no value or not for template
if ( empty( $value ) || ! is_string( $value ) ) { if ( empty( $value ) || ! is_string( $value ) ) {
return $value; return $value;
} }
// new lines // new lines
if ( $field['new_lines'] == 'wpautop' ) { if ( $field['new_lines'] == 'wpautop' ) {
$value = wpautop( $value ); $value = wpautop( $value );
} elseif ( $field['new_lines'] == 'br' ) { } elseif ( $field['new_lines'] == 'br' ) {
$value = nl2br( $value ); $value = nl2br( $value );
} }
// return // return
@ -260,7 +252,4 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_textarea' ); acf_register_field_type( 'acf_field_textarea' );
endif; // class_exists check endif; // class_exists check

View File

@ -31,7 +31,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
'display_format' => 'g:i a', 'display_format' => 'g:i a',
'return_format' => 'g:i a', 'return_format' => 'g:i a',
); );
} }
@ -87,7 +86,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
<?php acf_text_input( $text_input ); ?> <?php acf_text_input( $text_input ); ?>
</div> </div>
<?php <?php
} }
@ -163,7 +161,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
function format_value( $value, $post_id, $field ) { function format_value( $value, $post_id, $field ) {
return acf_format_date( $value, $field['return_format'] ); return acf_format_date( $value, $field['return_format'] );
} }
/** /**
@ -208,7 +205,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
// initialize // initialize
acf_register_field_type( 'acf_field_time_picker' ); acf_register_field_type( 'acf_field_time_picker' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -34,7 +34,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
'ui_on_text' => '', 'ui_on_text' => '',
'ui_off_text' => '', 'ui_off_text' => '',
); );
} }
@ -95,7 +94,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
$switch .= '<span class="acf-switch-off">' . $field['ui_off_text'] . '</span>'; $switch .= '<span class="acf-switch-off">' . $field['ui_off_text'] . '</span>';
$switch .= '<div class="acf-switch-slider"></div>'; $switch .= '<div class="acf-switch-slider"></div>';
$switch .= '</div>'; $switch .= '</div>';
} }
?> ?>
@ -114,7 +112,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
</label> </label>
</div> </div>
<?php <?php
} }
@ -225,7 +222,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
function format_value( $value, $post_id, $field ) { function format_value( $value, $post_id, $field ) {
return empty( $value ) ? false : true; return empty( $value ) ? false : true;
} }
@ -246,21 +242,16 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
// bail early if not required // bail early if not required
if ( ! $field['required'] ) { if ( ! $field['required'] ) {
return $valid; return $valid;
} }
// value may be '0' // value may be '0'
if ( ! $value ) { if ( ! $value ) {
return false; return false;
} }
// return // return
return $valid; return $valid;
} }
@ -286,7 +277,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
// return // return
return $field; return $field;
} }
/** /**
@ -319,13 +309,11 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return (bool) $value; return (bool) $value;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_true_false' ); acf_register_field_type( 'acf_field_true_false' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -30,7 +30,6 @@ if ( ! class_exists( 'acf_field_url' ) ) :
'default_value' => '', 'default_value' => '',
'placeholder' => '', 'placeholder' => '',
); );
} }
@ -78,7 +77,6 @@ if ( ! class_exists( 'acf_field_url' ) ) :
// return // return
echo $html; echo $html;
} }
@ -144,28 +142,21 @@ if ( ! class_exists( 'acf_field_url' ) ) :
// bail early if empty // bail early if empty
if ( empty( $value ) ) { if ( empty( $value ) ) {
return $valid; return $valid;
} }
if ( strpos( $value, '://' ) !== false ) { if ( strpos( $value, '://' ) !== false ) {
// url // url
} elseif ( strpos( $value, '//' ) === 0 ) { } elseif ( strpos( $value, '//' ) === 0 ) {
// protocol relative url // protocol relative url
} else { } else {
$valid = __( 'Value must be a valid URL', 'acf' ); $valid = __( 'Value must be a valid URL', 'acf' );
} }
// return // return
return $valid; return $valid;
} }
/** /**
@ -180,13 +171,9 @@ if ( ! class_exists( 'acf_field_url' ) ) :
return $schema; return $schema;
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_url' ); acf_register_field_type( 'acf_field_url' );
endif; // class_exists check endif; // class_exists check

View File

@ -626,11 +626,9 @@ if ( ! class_exists( 'ACF_Field_User' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return acf_format_numerics( $value ); return acf_format_numerics( $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'ACF_Field_User' ); acf_register_field_type( 'ACF_Field_User' );
endif; // class_exists check endif; // class_exists check

View File

@ -124,7 +124,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
// return // return
return $toolbars; return $toolbars;
} }
@ -200,32 +199,25 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
// detect mode // detect mode
if ( ! user_can_richedit() ) { if ( ! user_can_richedit() ) {
$show_tabs = false; $show_tabs = false;
} elseif ( $field['tabs'] == 'visual' ) { } elseif ( $field['tabs'] == 'visual' ) {
// case: visual tab only // case: visual tab only
$default_editor = 'tinymce'; $default_editor = 'tinymce';
$show_tabs = false; $show_tabs = false;
} elseif ( $field['tabs'] == 'text' ) { } elseif ( $field['tabs'] == 'text' ) {
// case: text tab only // case: text tab only
$show_tabs = false; $show_tabs = false;
} elseif ( wp_default_editor() == 'tinymce' ) { } elseif ( wp_default_editor() == 'tinymce' ) {
// case: both tabs // case: both tabs
$default_editor = 'tinymce'; $default_editor = 'tinymce';
} }
// must be logged in to upload // must be logged in to upload
if ( ! current_user_can( 'upload_files' ) ) { if ( ! current_user_can( 'upload_files' ) ) {
$field['media_upload'] = 0; $field['media_upload'] = 0;
} }
// mode // mode
@ -288,7 +280,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
</div> </div>
</div> </div>
<?php <?php
} }
@ -314,7 +305,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
'name' => 'default_value', 'name' => 'default_value',
) )
); );
} }
/** /**
@ -330,9 +320,7 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
$choices = array(); $choices = array();
if ( ! empty( $toolbars ) ) { if ( ! empty( $toolbars ) ) {
foreach ( $toolbars as $k => $v ) { foreach ( $toolbars as $k => $v ) {
$label = $k; $label = $k;
$name = sanitize_title( $label ); $name = sanitize_title( $label );
$name = str_replace( '-', '_', $name ); $name = str_replace( '-', '_', $name );
@ -424,13 +412,11 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
// Follow the_content function in /wp-includes/post-template.php // Follow the_content function in /wp-includes/post-template.php
return str_replace( ']]>', ']]&gt;', $value ); return str_replace( ']]>', ']]&gt;', $value );
} }
} }
// initialize // initialize
acf_register_field_type( 'acf_field_wysiwyg' ); acf_register_field_type( 'acf_field_wysiwyg' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -1,7 +1,6 @@
<?php <?php
if ( ! class_exists( 'acf_field' ) ) : if ( ! class_exists( 'acf_field' ) ) :
#[AllowDynamicProperties] #[AllowDynamicProperties]
class acf_field { class acf_field {
@ -105,7 +104,6 @@ if ( ! class_exists( 'acf_field' ) ) :
function initialize() { function initialize() {
/* do nothing */ /* do nothing */
} }
@ -134,7 +132,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// add // add
add_filter( $tag, $function_to_add, $priority, $accepted_args ); add_filter( $tag, $function_to_add, $priority, $accepted_args );
} }
@ -161,7 +158,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// add // add
$this->add_filter( $tag, $function_to_add, $priority, $accepted_args ); $this->add_filter( $tag, $function_to_add, $priority, $accepted_args );
} }
@ -190,7 +186,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// add // add
add_action( $tag, $function_to_add, $priority, $accepted_args ); add_action( $tag, $function_to_add, $priority, $accepted_args );
} }
@ -217,7 +212,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// add // add
$this->add_action( $tag, $function_to_add, $priority, $accepted_args ); $this->add_action( $tag, $function_to_add, $priority, $accepted_args );
} }
@ -243,7 +237,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// merge in defaults but keep order of $field keys // merge in defaults but keep order of $field keys
foreach ( $this->defaults as $k => $v ) { foreach ( $this->defaults as $k => $v ) {
if ( ! isset( $field[ $k ] ) ) { if ( ! isset( $field[ $k ] ) ) {
$field[ $k ] = $v; $field[ $k ] = $v;
} }
@ -251,7 +244,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// return // return
return $field; return $field;
} }
@ -280,7 +272,6 @@ if ( ! class_exists( 'acf_field' ) ) :
// return // return
return $l10n; return $l10n;
} }
/** /**
@ -355,9 +346,6 @@ if ( ! class_exists( 'acf_field' ) ) :
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {
return $value; return $value;
} }
} }
endif; // class_exists check endif; // class_exists check

View File

@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_form_attachment' ) ) :
// save // save
add_filter( 'attachment_fields_to_save', array( $this, 'save_attachment' ), 10, 2 ); add_filter( 'attachment_fields_to_save', array( $this, 'save_attachment' ), 10, 2 );
} }
@ -107,7 +106,6 @@ acf.unload.active = 0;
</script> </script>
<?php <?php
} }
@ -163,13 +161,11 @@ acf.unload.active = 0;
// override instruction placement for modal // override instruction placement for modal
if ( ! $is_page ) { if ( ! $is_page ) {
$field_group['instruction_placement'] = 'field'; $field_group['instruction_placement'] = 'field';
} }
// render // render
acf_render_fields( $fields, $post_id, $el, $field_group['instruction_placement'] ); acf_render_fields( $fields, $post_id, $el, $field_group['instruction_placement'] );
} }
// close // close
@ -184,12 +180,10 @@ acf.unload.active = 0;
'input' => 'html', 'input' => 'html',
'html' => $html, 'html' => $html,
); );
} }
// return // return
return $form_fields; return $form_fields;
} }
@ -225,12 +219,9 @@ acf.unload.active = 0;
// return // return
return $post; return $post;
} }
} }
new acf_form_attachment(); new acf_form_attachment();
endif; endif;
?> ?>

View File

@ -42,7 +42,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// save // save
add_action( 'edit_comment', array( $this, 'save_comment' ), 10, 1 ); add_action( 'edit_comment', array( $this, 'save_comment' ), 10, 1 );
add_action( 'comment_post', array( $this, 'save_comment' ), 10, 1 ); add_action( 'comment_post', array( $this, 'save_comment' ), 10, 1 );
} }
@ -66,9 +65,7 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// validate page // validate page
if ( $pagenow == 'comment.php' ) { if ( $pagenow == 'comment.php' ) {
return true; return true;
} }
// return // return
@ -94,9 +91,7 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// validate page // validate page
if ( ! $this->validate_page() ) { if ( ! $this->validate_page() ) {
return; return;
} }
// load acf scripts // load acf scripts
@ -105,7 +100,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// actions // actions
add_action( 'admin_footer', array( $this, 'admin_footer' ), 10, 1 ); add_action( 'admin_footer', array( $this, 'admin_footer' ), 10, 1 );
add_action( 'add_meta_boxes_comment', array( $this, 'edit_comment' ), 10, 1 ); add_action( 'add_meta_boxes_comment', array( $this, 'edit_comment' ), 10, 1 );
} }
@ -163,9 +157,7 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// edit_url // edit_url
if ( $field_group['ID'] && acf_current_user_can_admin() ) { if ( $field_group['ID'] && acf_current_user_can_admin() ) {
$o['edit_url'] = admin_url( 'post.php?post=' . $field_group['ID'] . '&action=edit' ); $o['edit_url'] = admin_url( 'post.php?post=' . $field_group['ID'] . '&action=edit' );
} }
?> ?>
@ -186,7 +178,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
} }
} }
} }
@ -240,11 +231,9 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
echo '<div class="acf-comment-fields acf-fields -clear">'; echo '<div class="acf-comment-fields acf-fields -clear">';
foreach ( $field_groups as $field_group ) { foreach ( $field_groups as $field_group ) {
$fields = acf_get_fields( $field_group ); $fields = acf_get_fields( $field_group );
acf_render_fields( $fields, $post_id, 'p', $field_group['instruction_placement'] ); acf_render_fields( $fields, $post_id, 'p', $field_group['instruction_placement'] );
} }
echo '</div>'; echo '</div>';
@ -255,7 +244,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
// return // return
return $html; return $html;
} }
@ -288,7 +276,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
if ( acf_validate_save_post( true ) ) { if ( acf_validate_save_post( true ) ) {
acf_save_post( "comment_{$comment_id}" ); acf_save_post( "comment_{$comment_id}" );
} }
} }
@ -330,13 +317,10 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
} }
new acf_form_comment(); new acf_form_comment();
endif; endif;
?> ?>

View File

@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
if ( ! class_exists( 'acf_form_customizer' ) ) : if ( ! class_exists( 'acf_form_customizer' ) ) :
#[AllowDynamicProperties] #[AllowDynamicProperties]
class acf_form_customizer { class acf_form_customizer {
@ -37,7 +36,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// save // save
add_filter( 'widget_update_callback', array( $this, 'save_widget' ), 10, 4 ); add_filter( 'widget_update_callback', array( $this, 'save_widget' ), 10, 4 );
} }
@ -66,7 +64,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// actions // actions
add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 ); add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 );
} }
@ -116,7 +113,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// update // update
$data['fields'][ $field['name'] ] = $field['key']; $data['fields'][ $field['name'] ] = $field['key'];
} }
// append data to instance // append data to instance
@ -124,7 +120,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// return // return
return $instance; return $instance;
} }
@ -179,7 +174,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// append // append
$data[] = $setting; $data[] = $setting;
} }
// bail early if no settings // bail early if no settings
@ -189,7 +183,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// return // return
return $data; return $data;
} }
@ -225,7 +218,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// append acf_value to preview_values // append acf_value to preview_values
$this->preview_values[ $data['post_id'] ] = $data['values']; $this->preview_values[ $data['post_id'] ] = $data['values'];
$this->preview_fields[ $data['post_id'] ] = $data['fields']; $this->preview_fields[ $data['post_id'] ] = $data['fields'];
} }
// bail early if no preview_values // bail early if no preview_values
@ -236,7 +228,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// add filters // add filters
add_filter( 'acf/pre_load_value', array( $this, 'pre_load_value' ), 10, 3 ); add_filter( 'acf/pre_load_value', array( $this, 'pre_load_value' ), 10, 3 );
add_filter( 'acf/pre_load_reference', array( $this, 'pre_load_reference' ), 10, 3 ); add_filter( 'acf/pre_load_reference', array( $this, 'pre_load_reference' ), 10, 3 );
} }
/** /**
@ -323,9 +314,7 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// remove [acf] data from saved widget array // remove [acf] data from saved widget array
$id_data = $setting->id_data(); $id_data = $setting->id_data();
add_filter( 'pre_update_option_' . $id_data['base'], array( $this, 'pre_update_option' ), 10, 3 ); add_filter( 'pre_update_option_' . $id_data['base'], array( $this, 'pre_update_option' ), 10, 3 );
} }
} }
@ -360,12 +349,10 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
// remove widget // remove widget
unset( $value[ $i ]['acf'] ); unset( $value[ $i ]['acf'] );
} }
// return // return
return $value; return $value;
} }
@ -459,13 +446,10 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
} }
new acf_form_customizer(); new acf_form_customizer();
endif; endif;
?> ?>

View File

@ -67,7 +67,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// filters // filters
add_filter( 'acf/pre_save_post', array( $this, 'pre_save_post' ), 5, 2 ); add_filter( 'acf/pre_save_post', array( $this, 'pre_save_post' ), 5, 2 );
} }
@ -132,7 +131,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// new post? // new post?
if ( $args['post_id'] === 'new_post' ) { if ( $args['post_id'] === 'new_post' ) {
$args['new_post'] = wp_parse_args( $args['new_post'] = wp_parse_args(
$args['new_post'], $args['new_post'],
array( array(
@ -140,7 +138,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
'post_status' => 'draft', 'post_status' => 'draft',
) )
); );
} }
// filter // filter
@ -148,7 +145,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// return // return
return $args; return $args;
} }
@ -172,7 +168,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// append // append
$this->forms[ $args['id'] ] = $args; $this->forms[ $args['id'] ] = $args;
} }
@ -198,7 +193,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// return // return
return $this->forms[ $id ]; return $this->forms[ $id ];
} }
@ -227,16 +221,13 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// register // register
acf_add_local_field( $field ); acf_add_local_field( $field );
} }
// honeypot // honeypot
if ( ! empty( $_POST['acf']['_validate_email'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Data not used; presence indicates spam. if ( ! empty( $_POST['acf']['_validate_email'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Data not used; presence indicates spam.
acf_add_validation_error( '', __( 'Spam Detected', 'acf' ) ); acf_add_validation_error( '', __( 'Spam Detected', 'acf' ) );
} }
} }
@ -265,32 +256,25 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// update post // update post
$save['ID'] = $post_id; $save['ID'] = $post_id;
} elseif ( $post_id == 'new_post' ) { } elseif ( $post_id == 'new_post' ) {
// merge in new post data // merge in new post data
$save = array_merge( $save, $form['new_post'] ); $save = array_merge( $save, $form['new_post'] );
} else { } else {
// not post // not post
return $post_id; return $post_id;
} }
// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified in check_submit_form(). // phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified in check_submit_form().
// save post_title // save post_title
if ( isset( $_POST['acf']['_post_title'] ) ) { if ( isset( $_POST['acf']['_post_title'] ) ) {
$save['post_title'] = acf_extract_var( $_POST['acf'], '_post_title' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by WP when saved. $save['post_title'] = acf_extract_var( $_POST['acf'], '_post_title' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by WP when saved.
} }
// save post_content // save post_content
if ( isset( $_POST['acf']['_post_content'] ) ) { if ( isset( $_POST['acf']['_post_content'] ) ) {
$save['post_content'] = acf_extract_var( $_POST['acf'], '_post_content' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by WP when saved. $save['post_content'] = acf_extract_var( $_POST['acf'], '_post_content' ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by WP when saved.
} }
// phpcs:enable WordPress.Security.NonceVerification.Missing // phpcs:enable WordPress.Security.NonceVerification.Missing
@ -301,25 +285,18 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// validate // validate
if ( count( $save ) == 1 ) { if ( count( $save ) == 1 ) {
return $post_id; return $post_id;
} }
// save // save
if ( $save['ID'] ) { if ( $save['ID'] ) {
wp_update_post( $save ); wp_update_post( $save );
} else { } else {
$post_id = wp_insert_post( $save ); $post_id = wp_insert_post( $save );
} }
// return // return
return $post_id; return $post_id;
} }
@ -343,7 +320,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// load acf scripts // load acf scripts
acf_enqueue_scripts(); acf_enqueue_scripts();
} }
@ -446,9 +422,7 @@ if ( ! class_exists( 'acf_form_front' ) ) :
// redirect // redirect
wp_redirect( $return ); wp_redirect( $return );
exit; exit;
} }
} }
@ -593,12 +567,10 @@ if ( ! class_exists( 'acf_form_front' ) ) :
</form> </form>
<?php endif; <?php endif;
} }
} }
// initialize // initialize
acf()->form_front = new acf_form_front(); acf()->form_front = new acf_form_front();
endif; // class_exists check endif; // class_exists check
@ -619,25 +591,21 @@ endif; // class_exists check
function acf_form_head() { function acf_form_head() {
acf()->form_front->enqueue_form(); acf()->form_front->enqueue_form();
} }
function acf_form( $args = array() ) { function acf_form( $args = array() ) {
acf()->form_front->render_form( $args ); acf()->form_front->render_form( $args );
} }
function acf_get_form( $id = '' ) { function acf_get_form( $id = '' ) {
return acf()->form_front->get_form( $id ); return acf()->form_front->get_form( $id );
} }
function acf_register_form( $args ) { function acf_register_form( $args ) {
acf()->form_front->add_form( $args ); acf()->form_front->add_form( $args );
} }
?> ?>

View File

@ -186,5 +186,4 @@ if ( ! class_exists( 'ACF_Form_Gutenberg' ) ) :
} }
acf_new_instance( 'ACF_Form_Gutenberg' ); acf_new_instance( 'ACF_Form_Gutenberg' );
endif; endif;

View File

@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
// filters // filters
add_filter( 'wp_get_nav_menu_items', array( $this, 'wp_get_nav_menu_items' ), 10, 3 ); add_filter( 'wp_get_nav_menu_items', array( $this, 'wp_get_nav_menu_items' ), 10, 3 );
add_filter( 'wp_edit_nav_menu_walker', array( $this, 'wp_edit_nav_menu_walker' ), 10, 2 ); add_filter( 'wp_edit_nav_menu_walker', array( $this, 'wp_edit_nav_menu_walker' ), 10, 2 );
} }
@ -62,7 +61,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
// actions // actions
add_action( 'admin_footer', array( $this, 'admin_footer' ), 1 ); add_action( 'admin_footer', array( $this, 'admin_footer' ), 1 );
} }
@ -163,7 +161,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
// save nav menu items // save nav menu items
$this->update_nav_menu_items( $menu_id ); $this->update_nav_menu_items( $menu_id );
} }
@ -190,9 +187,7 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
$posted_values = acf_sanitize_request_args( $_POST['menu-item-acf'] ); $posted_values = acf_sanitize_request_args( $_POST['menu-item-acf'] );
foreach ( $posted_values as $post_id => $values ) { foreach ( $posted_values as $post_id => $values ) {
acf_save_post( $post_id, $values ); acf_save_post( $post_id, $values );
} }
// phpcs:enable WordPress.Security.NonceVerification.Missing // phpcs:enable WordPress.Security.NonceVerification.Missing
} }
@ -267,10 +262,8 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
// validate // validate
acf_validate_values( $values, $prefix ); acf_validate_values( $values, $prefix );
} }
// phpcs:enable // phpcs:disable WordPress.Security.NonceVerification.Missing // phpcs:enable // phpcs:disable WordPress.Security.NonceVerification.Missing
} }
/* /*
@ -317,7 +310,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
// loop // loop
foreach ( $field_groups as $field_group ) { foreach ( $field_groups as $field_group ) {
$fields = acf_get_fields( $field_group ); $fields = acf_get_fields( $field_group );
echo '<div class="acf-menu-settings -' . $field_group['style'] . '">'; echo '<div class="acf-menu-settings -' . $field_group['style'] . '">';
@ -331,7 +323,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} }
} }
@ -386,12 +377,9 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
} }
acf_new_instance( 'acf_form_nav_menu' ); acf_new_instance( 'acf_form_nav_menu' );
endif; endif;
?> ?>

View File

@ -135,7 +135,6 @@ if ( ! class_exists( 'ACF_Form_Post' ) ) :
// Add the meta box. // Add the meta box.
add_meta_box( $id, acf_esc_html( $title ), array( $this, 'render_meta_box' ), $post_type, $context, $priority, array( 'field_group' => $field_group ) ); add_meta_box( $id, acf_esc_html( $title ), array( $this, 'render_meta_box' ), $post_type, $context, $priority, array( 'field_group' => $field_group ) );
} }
// Set style from first field group. // Set style from first field group.
@ -339,7 +338,4 @@ if ( ! class_exists( 'ACF_Form_Post' ) ) :
} }
acf_new_instance( 'ACF_Form_Post' ); acf_new_instance( 'ACF_Form_Post' );
endif; endif;

View File

@ -41,7 +41,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// delete // delete
add_action( 'delete_term', array( $this, 'delete_term' ), 10, 4 ); add_action( 'delete_term', array( $this, 'delete_term' ), 10, 4 );
} }
@ -65,9 +64,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// validate page // validate page
if ( $pagenow === 'edit-tags.php' || $pagenow === 'term.php' ) { if ( $pagenow === 'edit-tags.php' || $pagenow === 'term.php' ) {
return true; return true;
} }
// return // return
@ -93,9 +90,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// validate page // validate page
if ( ! $this->validate_page() ) { if ( ! $this->validate_page() ) {
return; return;
} }
// vars // vars
@ -109,7 +104,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
add_action( 'admin_footer', array( $this, 'admin_footer' ), 10, 1 ); add_action( 'admin_footer', array( $this, 'admin_footer' ), 10, 1 );
add_action( "{$taxonomy}_add_form_fields", array( $this, 'add_term' ), 10, 1 ); add_action( "{$taxonomy}_add_form_fields", array( $this, 'add_term' ), 10, 1 );
add_action( "{$taxonomy}_edit_form", array( $this, 'edit_term' ), 10, 2 ); add_action( "{$taxonomy}_edit_form", array( $this, 'edit_term' ), 10, 2 );
} }
@ -163,9 +157,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// wrap // wrap
echo '</div>'; echo '</div>';
} }
} }
@ -199,7 +191,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// render // render
if ( ! empty( $field_groups ) ) { if ( ! empty( $field_groups ) ) {
acf_form_data( acf_form_data(
array( array(
'screen' => 'taxonomy', 'screen' => 'taxonomy',
@ -219,10 +210,8 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
$fields = acf_get_fields( $field_group ); $fields = acf_get_fields( $field_group );
acf_render_fields( $fields, $post_id, 'tr', 'field' ); acf_render_fields( $fields, $post_id, 'tr', 'field' );
echo '</table>'; echo '</table>';
} }
} }
} }
@ -320,7 +309,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
@ -352,7 +340,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
// save // save
acf_save_post( $post_id ); acf_save_post( $post_id );
} }
@ -396,13 +383,10 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
$_search $_search
) )
); );
} }
} }
new acf_form_taxonomy(); new acf_form_taxonomy();
endif; endif;

View File

@ -301,7 +301,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
@ -383,7 +382,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
// instantiate // instantiate
acf_new_instance( 'ACF_Form_User' ); acf_new_instance( 'ACF_Form_User' );
endif; // class_exists check endif; // class_exists check
?> ?>

View File

@ -11,7 +11,6 @@
*/ */
if ( ! class_exists( 'acf_form_widget' ) ) : if ( ! class_exists( 'acf_form_widget' ) ) :
#[AllowDynamicProperties] #[AllowDynamicProperties]
class acf_form_widget { class acf_form_widget {
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
// filters // filters
add_filter( 'widget_update_callback', array( $this, 'save_widget' ), 10, 4 ); add_filter( 'widget_update_callback', array( $this, 'save_widget' ), 10, 4 );
} }
@ -67,11 +65,8 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
if ( acf_is_screen( 'widgets' ) || acf_is_screen( 'customize' ) ) { if ( acf_is_screen( 'widgets' ) || acf_is_screen( 'customize' ) ) {
// valid // valid
} else { } else {
return; return;
} }
// load acf scripts // load acf scripts
@ -79,7 +74,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
// actions // actions
add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 ); add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 );
} }
@ -139,9 +133,7 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
// get id // get id
if ( $widget->number !== '__i__' ) { if ( $widget->number !== '__i__' ) {
$post_id = "widget_{$widget->id}"; $post_id = "widget_{$widget->id}";
} }
// get field groups // get field groups
@ -184,7 +176,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
// render // render
acf_render_fields( $fields, $post_id, 'div', $field_group['instruction_placement'] ); acf_render_fields( $fields, $post_id, 'div', $field_group['instruction_placement'] );
} }
// wrap // wrap
@ -202,9 +193,7 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
</script> </script>
<?php <?php
endif; endif;
} }
} }
@ -244,7 +233,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
// return // return
return $instance; return $instance;
} }
@ -324,12 +312,10 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
})(jQuery); })(jQuery);
</script> </script>
<?php <?php
} }
} }
new acf_form_widget(); new acf_form_widget();
endif; endif;
?> ?>

View File

@ -122,7 +122,7 @@ function acf_load_textdomain( $domain = 'acf' ) {
return load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) ); return load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
} }
/** /**
* _acf_apply_language_cache_key * _acf_apply_language_cache_key
* *
* Applies the current language to the cache key. * Applies the current language to the cache key.

View File

@ -64,7 +64,6 @@ if ( ! class_exists( 'ACF_Legacy_Locations' ) ) :
return call_user_func_array( 'acf_get_location_type', $arguments ); return call_user_func_array( 'acf_get_location_type', $arguments );
case 'get_locations': case 'get_locations':
return call_user_func_array( 'acf_get_location_rule_types', $arguments ); return call_user_func_array( 'acf_get_location_rule_types', $arguments );
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More