Updates to 6.2.4
This commit is contained in:
parent
61bf366867
commit
830e8b94a8
6
acf.php
6
acf.php
|
|
@ -9,7 +9,7 @@
|
|||
* Plugin Name: Advanced Custom Fields PRO
|
||||
* Plugin URI: https://www.advancedcustomfields.com
|
||||
* Description: Customize WordPress with powerful, professional and intuitive fields.
|
||||
* Version: 6.2.3
|
||||
* Version: 6.2.4
|
||||
* Author: WP Engine
|
||||
* 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
|
||||
|
|
@ -36,7 +36,7 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
public $version = '6.2.3';
|
||||
public $version = '6.2.4';
|
||||
|
||||
/**
|
||||
* The plugin settings array.
|
||||
|
|
@ -177,7 +177,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
acf_include( 'includes/loop.php' );
|
||||
acf_include( 'includes/media.php' );
|
||||
acf_include( 'includes/revisions.php' );
|
||||
acf_include( 'includes/updates.php' );
|
||||
acf_include( 'includes/upgrades.php' );
|
||||
acf_include( 'includes/validation.php' );
|
||||
acf_include( 'includes/rest-api.php' );
|
||||
|
|
@ -783,5 +782,4 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
|
||||
// Instantiate.
|
||||
acf();
|
||||
|
||||
} // class_exists check
|
||||
|
|
|
|||
|
|
@ -1610,6 +1610,7 @@ html[dir=rtl] .acf-relationship .selection .values .acf-icon {
|
|||
.acf-tab-wrap {
|
||||
clear: both;
|
||||
z-index: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.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
|
|
@ -4255,7 +4255,6 @@
|
|||
active: false,
|
||||
actions: {
|
||||
refresh: 'onRefresh',
|
||||
resize: 'onRefresh',
|
||||
close_field_object: 'onCloseFieldObject'
|
||||
},
|
||||
data: {
|
||||
|
|
@ -4428,28 +4427,21 @@
|
|||
return tab;
|
||||
},
|
||||
onRefresh: function () {
|
||||
// Don't run on field group tabs.
|
||||
if (['acf_field_settings_tabs', 'acf_field_group_settings_tabs'].includes(this.get('key'))) {
|
||||
// only for left placements
|
||||
if (this.get('placement') !== 'left') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Block editor needs timeout to run after script is finished.
|
||||
setTimeout(() => {
|
||||
const $list = this.$el.children('ul');
|
||||
let $element = this.$el;
|
||||
let attribute = 'height';
|
||||
let height;
|
||||
if (this.get('placement') === 'left') {
|
||||
$element = this.$el.parent();
|
||||
attribute = $element.is('td') ? 'height' : 'min-height';
|
||||
// vars
|
||||
var $parent = this.$el.parent();
|
||||
var $list = this.$el.children('ul');
|
||||
var attribute = $parent.is('td') ? 'height' : 'min-height';
|
||||
|
||||
// Find height (minus 1 for border-bottom).
|
||||
height = $list.position().top + $list.outerHeight(true) - 1;
|
||||
} else {
|
||||
height = Math.ceil($list.outerHeight(true));
|
||||
}
|
||||
$element.css(attribute, height);
|
||||
}, 0);
|
||||
// find height (minus 1 for border-bottom)
|
||||
var height = $list.position().top + $list.outerHeight(true) - 1;
|
||||
|
||||
// add css
|
||||
$parent.css(attribute, height);
|
||||
},
|
||||
onCloseFieldObject: function (fieldObject) {
|
||||
const tab = this.getVisible().find(item => {
|
||||
|
|
@ -6348,13 +6340,11 @@
|
|||
refresh: 'renderGroups'
|
||||
},
|
||||
renderGroups: function () {
|
||||
// Set timeout so the editor fires at the right time.
|
||||
setTimeout(() => {
|
||||
var self = this;
|
||||
$('.acf-fields:visible').each(function () {
|
||||
self.renderGroup($(this));
|
||||
});
|
||||
}, 0);
|
||||
// loop
|
||||
var self = this;
|
||||
$('.acf-fields:visible').each(function () {
|
||||
self.renderGroup($(this));
|
||||
});
|
||||
},
|
||||
renderGroup: function ($el) {
|
||||
// vars
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -88,7 +88,7 @@
|
|||
const fieldGroupTitle = $('.acf-headerbar-title-field').val();
|
||||
const ajaxData = {
|
||||
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) {
|
||||
ajaxData.field_group_title = fieldGroupTitle;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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)})()})();
|
||||
|
|
@ -10,10 +10,10 @@
|
|||
*
|
||||
* @since 6.2
|
||||
*
|
||||
* @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 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 array $target_item_ids The post, user or term IDs which should be updated with the origin item 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 string|false $target_prefix The ACF prefix for a post, user or term ID required for the update_field call for this field type.
|
||||
*/
|
||||
function acf_update_bidirectional_values( $target_item_ids, $post_id, $field, $target_prefix = false ) {
|
||||
|
||||
|
|
@ -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.
|
||||
if ( ! empty( $target_prefix ) ) {
|
||||
$mapper = function( $v ) use ( $target_prefix ) {
|
||||
$mapper = function ( $v ) use ( $target_prefix ) {
|
||||
return $target_prefix . '_' . $v;
|
||||
};
|
||||
$additions = array_map( $mapper, $additions );
|
||||
|
|
@ -89,6 +89,7 @@ function acf_update_bidirectional_values( $target_item_ids, $post_id, $field, $t
|
|||
* @since 6.2
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
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(
|
||||
acf_get_field_groups(),
|
||||
function( $field_group ) {
|
||||
function ( $field_group ) {
|
||||
return $field_group['active'];
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -309,7 +309,6 @@ function acf_translate_field( $field = array() ) {
|
|||
|
||||
// Translate field settings if textdomain is set.
|
||||
if ( $l10n && $l10n_textdomain ) {
|
||||
|
||||
$field['label'] = acf_translate( $field['label'] );
|
||||
$field['instructions'] = acf_translate( $field['instructions'] );
|
||||
|
||||
|
|
@ -470,7 +469,7 @@ function acf_get_field_count( $parent ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param int $count The number of fields.
|
||||
* @param array $parent The field group or field array.
|
||||
* @param array $parent The field group or field array.
|
||||
*/
|
||||
return apply_filters( 'acf/get_field_count', count( $raw_fields ), $parent );
|
||||
}
|
||||
|
|
@ -604,7 +603,6 @@ function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = '
|
|||
// Loop over and render fields.
|
||||
if ( $fields ) {
|
||||
foreach ( $fields as $field ) {
|
||||
|
||||
$field = apply_filters( 'acf/pre_render_field', $field, $post_id );
|
||||
|
||||
// Load value if not already loaded.
|
||||
|
|
@ -1323,7 +1321,6 @@ function acf_get_sub_field( $id, $field ) {
|
|||
|
||||
// return
|
||||
return $sub_field;
|
||||
|
||||
}
|
||||
|
||||
// Register variation.
|
||||
|
|
@ -1588,7 +1585,7 @@ function acf_prepare_fields_for_import( $fields = array() ) {
|
|||
}
|
||||
|
||||
// Iterate.
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -220,4 +220,3 @@ function _acf_apply_deprecated_hook() {
|
|||
// Return first arg.
|
||||
return $args[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ function acf_get_object_id( $object ) {
|
|||
}
|
||||
} elseif ( isset( $object['id'] ) ) {
|
||||
return (int) $object['id'];
|
||||
|
||||
} elseif ( isset( $object['ID'] ) ) {
|
||||
return (int) $object['ID'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -935,7 +935,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
acf_delete_internal_post_type( $post_id, $this->post_type );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif; // Class exists check.
|
||||
|
|
|
|||
|
|
@ -356,7 +356,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif; // Class exists check.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ if ( ! class_exists( 'ACF_Admin_Options_Preview' ) ) :
|
|||
$view = array( 'screen_id' => $screen->id );
|
||||
acf_get_view( 'options-page-preview', $view );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new ACF_Admin_Options_Preview();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ), 15 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +51,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
$instance = new $class();
|
||||
$this->tools[ $instance->name ] = $instance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -71,7 +69,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
function get_tool( $name ) {
|
||||
|
||||
return isset( $this->tools[ $name ] ) ? $this->tools[ $name ] : null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -90,7 +87,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
function get_tools() {
|
||||
|
||||
return $this->tools;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,7 +115,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'load-' . $page, array( $this, 'load' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -150,7 +145,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
// load acf scripts
|
||||
acf_enqueue_scripts();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -187,7 +181,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
// action
|
||||
do_action( 'acf/include_admin_tools' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -216,7 +209,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
$tool->submit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,12 +246,10 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
// 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 ) );
|
||||
|
||||
}
|
||||
|
||||
// view
|
||||
acf_get_view( 'tools/tools', $view );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -286,12 +276,10 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
acf_nonce_input( $tool->name );
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// initialize
|
||||
acf()->admin_tools = new acf_admin_tools();
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
@ -311,7 +299,6 @@ endif; // class_exists check
|
|||
function acf_register_admin_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() {
|
||||
|
||||
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 = '' ) {
|
||||
|
||||
return acf_get_admin_tools_url() . '&tool=' . $tool;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
*/
|
||||
function network_admin_menu() {
|
||||
$network_upgrade_needed = get_site_transient( $this->network_upgrade_needed_transient );
|
||||
|
||||
|
||||
// No transient value exists, so run the upgrade check.
|
||||
if ( $network_upgrade_needed === false ) {
|
||||
$network_upgrade_needed = $this->check_for_network_upgrades();
|
||||
|
|
@ -103,7 +103,7 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
/**
|
||||
* Checks if an ACF database upgrade is required on any site in the
|
||||
* multisite network.
|
||||
*
|
||||
*
|
||||
* Stores the result in `$this->network_upgrade_needed_transient`,
|
||||
* which is version-linked to ACF_UPGRADE_VERSION: the highest ACF
|
||||
* version that requires an upgrade function to run. Bumping
|
||||
|
|
@ -119,7 +119,7 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
public function check_for_network_upgrades() {
|
||||
$network_upgrade_needed = 'no';
|
||||
|
||||
$sites = get_sites(
|
||||
$sites = get_sites(
|
||||
array(
|
||||
'number' => 0,
|
||||
'fields' => 'ids', // Reduces PHP memory usage.
|
||||
|
|
@ -293,5 +293,4 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
|
||||
// instantiate
|
||||
acf_new_instance( 'ACF_Admin_Upgrade' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -303,10 +303,8 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
}
|
||||
return $submenu_file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate.
|
||||
acf_new_instance( 'ACF_Admin' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
array(
|
||||
'fieldTypes' => acf_get_field_types_info(),
|
||||
|
|
@ -619,7 +611,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// initialize.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
|
||||
if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate.
|
||||
acf_new_instance( 'ACF_Admin_Field_Groups' );
|
||||
|
||||
endif; // Class exists check.
|
||||
|
|
|
|||
|
|
@ -362,11 +362,9 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
public function mb_advanced_settings() {
|
||||
acf_get_view( $this->post_type . '/advanced-settings' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new ACF_Admin_Post_Type();
|
||||
|
||||
endif; // Class exists check.
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -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' ) .
|
||||
'"></span> ' . _x( 'Registration Failed', 'post status', 'acf' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate.
|
||||
acf_new_instance( 'ACF_Admin_Post_Types' );
|
||||
|
||||
endif; // Class exists check.
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
}
|
||||
|
||||
$num_terms = wp_count_terms(
|
||||
$taxonomy['taxonomy'],
|
||||
array(
|
||||
'taxonomy' => $taxonomy['taxonomy'],
|
||||
'hide_empty' => false,
|
||||
'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' ) .
|
||||
'"></span> ' . _x( 'Registration Failed', 'post status', 'acf' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Instantiate.
|
||||
acf_new_instance( 'ACF_Admin_Taxonomies' );
|
||||
|
||||
endif; // Class exists check.
|
||||
|
|
|
|||
|
|
@ -364,7 +364,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
public function mb_advanced_settings() {
|
||||
acf_get_view( $this->post_type . '/advanced-settings' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new ACF_Admin_Taxonomy();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
if ( $this->is_active() ) {
|
||||
$this->title .= ' - ' . __( 'Generate PHP', 'acf' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -61,16 +60,12 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
// download
|
||||
if ( $action === 'download' ) {
|
||||
|
||||
$this->submit_download();
|
||||
|
||||
// generate
|
||||
} elseif ( $action === 'generate' ) {
|
||||
|
||||
$this->submit_generate();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -105,7 +100,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
// return
|
||||
echo acf_json_encode( $json ) . "\r\n";
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -137,7 +131,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
// redirect
|
||||
wp_redirect( $url );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -168,7 +161,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
acf_add_admin_notice( $text, 'success' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -188,16 +180,12 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
// single (generate PHP)
|
||||
if ( $this->is_active() ) {
|
||||
|
||||
$this->html_single();
|
||||
|
||||
// archive
|
||||
} else {
|
||||
|
||||
$this->html_archive();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -361,7 +349,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -394,7 +381,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
</p>
|
||||
</div>
|
||||
<?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.
|
||||
$count++;
|
||||
++$count;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
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();
|
||||
|
||||
foreach ( $key_names as $key_name ) {
|
||||
|
|
@ -583,12 +569,10 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
return $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// initialize
|
||||
acf_register_admin_tool( 'ACF_Admin_Tool_Export' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
$this->name = 'import';
|
||||
$this->title = __( 'Import Field Groups', 'acf' );
|
||||
$this->icon = 'dashicons-upload';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -133,7 +132,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -291,12 +289,10 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
|
||||
return acf_add_admin_notice( __( 'Nothing to import', 'acf' ), 'warning' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
acf_register_admin_tool( 'ACF_Admin_Tool_Import' );
|
||||
|
||||
endif; // class_exists check.
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
// initialize
|
||||
$this->initialize();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -129,7 +128,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
function initialize() {
|
||||
|
||||
/* do nothing */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -149,7 +147,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
function load() {
|
||||
|
||||
/* do nothing */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -166,7 +163,6 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
*/
|
||||
|
||||
function html() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -183,12 +179,7 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
*/
|
||||
|
||||
function submit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ $disabled = false;
|
|||
|
||||
// empty
|
||||
if ( empty( $field['conditional_logic'] ) ) {
|
||||
|
||||
$disabled = true;
|
||||
$field['conditional_logic'] = array(
|
||||
|
||||
|
|
@ -43,7 +42,13 @@ if ( empty( $field['conditional_logic'] ) ) {
|
|||
|
||||
</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
|
||||
foreach ( $field['conditional_logic'] as $group_id => $group ) :
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,7 @@ if ( $is_subfield ) {
|
|||
|
||||
<?php
|
||||
if ( $fields ) :
|
||||
|
||||
foreach ( $fields as $i => $field ) :
|
||||
|
||||
acf_get_view(
|
||||
'acf-field-group/field',
|
||||
array(
|
||||
|
|
@ -90,9 +88,7 @@ if ( $is_subfield ) {
|
|||
'num_field_groups' => $num_field_groups,
|
||||
)
|
||||
);
|
||||
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@
|
|||
'rule' => $rule,
|
||||
)
|
||||
);
|
||||
|
||||
endforeach;
|
||||
endforeach;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
|
|
@ -24,7 +23,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
'class' => 'refresh-location-rule',
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -38,7 +36,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
|
|
@ -51,9 +48,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// custom
|
||||
} else {
|
||||
|
||||
echo $choices;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -67,7 +62,6 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
|
|
@ -81,9 +75,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// custom
|
||||
} else {
|
||||
|
||||
echo $choices;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ global $field_group;
|
|||
'group_id' => "group_{$i}",
|
||||
)
|
||||
);
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -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' );
|
||||
|
||||
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_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' ) );
|
||||
|
|
|
|||
|
|
@ -216,9 +216,14 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
|
|||
'key' => 'add_new',
|
||||
'prefix' => 'acf_post_type[labels]',
|
||||
'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' ),
|
||||
'instructions' => __( 'In the post type submenu in the admin dashboard.', 'acf' ),
|
||||
'placeholder' => __( 'Add New', 'acf' ),
|
||||
'placeholder' => __( 'Add New Post', 'acf' ),
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
|
|
@ -1285,4 +1290,3 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
|
|||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
|
|||
'default' => 1,
|
||||
'hide_search' => true,
|
||||
'class' => 'query_var',
|
||||
'conditions' => array(
|
||||
'conditions' => array(
|
||||
'field' => 'publicly_queryable',
|
||||
'operator' => '==',
|
||||
'value' => 1,
|
||||
|
|
|
|||
|
|
@ -212,8 +212,10 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
|
|||
$unlock_text = __( 'Unlock Extra Features with ACF PRO', 'acf' );
|
||||
|
||||
if ( acf_is_pro() ) {
|
||||
$unlock_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' );
|
||||
$unlock_target = '';
|
||||
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_target = '';
|
||||
}
|
||||
|
||||
if ( acf_pro_is_license_expired() ) {
|
||||
$unlock_url = acf_add_url_utm_tags( acf_pro_get_manage_license_url(), 'ACF renewal', 'header' );
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<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>
|
||||
|
||||
<table class="wp-list-table widefat">
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<?php
|
||||
if ( $i % 2 == 0 ) :
|
||||
?>
|
||||
class="alternate"<?php endif; ?>>
|
||||
class="alternate"<?php endif; ?>>
|
||||
<th class="check-column" scope="row">
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
<input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
|
||||
|
|
@ -85,7 +85,6 @@
|
|||
|
||||
// restore
|
||||
restore_current_blog();
|
||||
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
|
|
@ -94,7 +93,7 @@
|
|||
</table>
|
||||
|
||||
<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">
|
||||
(function($) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
$plugins = array();
|
||||
|
||||
if ( ! acf_get_setting( 'pro' ) ) {
|
||||
|
||||
if ( is_plugin_active( 'acf-repeater/acf-repeater.php' ) ) {
|
||||
$plugins[] = __( 'Repeater', 'acf' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<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-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">
|
||||
(function($) {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,4 @@ if ( ! class_exists( 'ACF_Ajax_Check_Screen' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Ajax_Check_Screen' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -95,5 +95,4 @@ if ( ! class_exists( 'ACF_Ajax_Local_JSON_Diff' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Ajax_Local_JSON_Diff' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
|
|||
if ( isset( $args['users_per_page'] ) ) {
|
||||
$this->per_page = intval( $args['users_per_page'] );
|
||||
unset( $args['users_per_page'] );
|
||||
|
||||
} elseif ( isset( $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' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -52,5 +52,4 @@ if ( ! class_exists( 'ACF_Ajax_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Ajax_Upgrade' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -39,5 +39,4 @@ if ( ! class_exists( 'ACF_Ajax_User_Setting' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Ajax_User_Setting' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -228,5 +228,3 @@ if ( ! class_exists( 'ACF_Ajax' ) ) :
|
|||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -27,7 +27,6 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
|
|||
|
||||
// create dummy field
|
||||
if ( ! $field ) {
|
||||
|
||||
$field = acf_get_valid_field(
|
||||
array(
|
||||
'name' => $selector,
|
||||
|
|
@ -38,7 +37,6 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
|
|||
|
||||
// prevent formatting
|
||||
$format_value = false;
|
||||
|
||||
}
|
||||
|
||||
// get value for field
|
||||
|
|
@ -49,12 +47,10 @@ function get_field( $selector, $post_id = false, $format_value = true ) {
|
|||
|
||||
// get value for field
|
||||
$value = acf_format_value( $value, $post_id, $field );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -206,7 +202,6 @@ function acf_maybe_get_sub_field( $selectors, $post_id = false, $strict = true )
|
|||
|
||||
// add to name
|
||||
$field['name'] = $field_name . '_' . ( $sub_i - $offset ) . '_' . $field['name'];
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
|
|
@ -241,14 +236,11 @@ function get_fields( $post_id = false, $format_value = true ) {
|
|||
|
||||
// populate
|
||||
foreach ( $fields as $k => $field ) {
|
||||
|
||||
$meta[ $k ] = $field['value'];
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $meta;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -482,14 +474,13 @@ function the_row( $format = false ) {
|
|||
$i = acf_get_loop( 'active', 'i' );
|
||||
|
||||
// increase
|
||||
$i++;
|
||||
++$i;
|
||||
|
||||
// update
|
||||
acf_update_loop( 'active', 'i', $i );
|
||||
|
||||
// return
|
||||
return get_row( $format );
|
||||
|
||||
}
|
||||
|
||||
function get_row( $format = false ) {
|
||||
|
|
@ -531,13 +522,11 @@ function get_row( $format = false ) {
|
|||
// - no performance issues here thanks to cache
|
||||
$value = acf_format_value( $loop['value'], $loop['post_id'], $field );
|
||||
$value = acf_maybe_get( $value, $loop['i'] );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function get_row_index() {
|
||||
|
|
@ -548,13 +537,11 @@ function get_row_index() {
|
|||
|
||||
// return
|
||||
return $offset + $i;
|
||||
|
||||
}
|
||||
|
||||
function the_row_index() {
|
||||
|
||||
echo get_row_index();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -594,7 +581,6 @@ function get_row_sub_field( $selector ) {
|
|||
|
||||
// return
|
||||
return $sub_field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -623,14 +609,11 @@ function get_row_sub_value( $selector ) {
|
|||
|
||||
// return value
|
||||
if ( isset( $row['value'][ $row['i'] ][ $selector ] ) ) {
|
||||
|
||||
return $row['value'][ $row['i'] ][ $selector ];
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -655,7 +638,6 @@ function reset_rows() {
|
|||
|
||||
// return
|
||||
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 ( $r ) {
|
||||
|
||||
the_row();
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
function has_sub_fields( $field_name, $post_id = false ) {
|
||||
|
||||
return has_sub_field( $field_name, $post_id );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -724,7 +702,6 @@ function get_sub_field( $selector = '', $format_value = true ) {
|
|||
|
||||
// return
|
||||
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 );
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
|
||||
$value = implode( ', ', $value );
|
||||
|
||||
}
|
||||
|
||||
echo $value;
|
||||
|
|
@ -788,9 +763,7 @@ function get_sub_field_object( $selector, $format_value = true, $load_value = tr
|
|||
|
||||
// load value
|
||||
if ( $load_value ) {
|
||||
|
||||
$sub_field['value'] = get_row_sub_value( $sub_field['key'] );
|
||||
|
||||
}
|
||||
|
||||
// format value
|
||||
|
|
@ -798,12 +771,10 @@ function get_sub_field_object( $selector, $format_value = true, $load_value = tr
|
|||
|
||||
// get value for field
|
||||
$sub_field['value'] = acf_format_value( $sub_field['value'], $row['post_id'], $sub_field );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $sub_field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -827,14 +798,11 @@ function get_row_layout() {
|
|||
|
||||
// return
|
||||
if ( isset( $row['acf_fc_layout'] ) ) {
|
||||
|
||||
return $row['acf_fc_layout'];
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -932,7 +900,6 @@ function update_field( $selector, $value, $post_id = false ) {
|
|||
|
||||
// create dummy field
|
||||
if ( ! $field ) {
|
||||
|
||||
$field = acf_get_valid_field(
|
||||
array(
|
||||
'name' => $selector,
|
||||
|
|
@ -940,12 +907,10 @@ function update_field( $selector, $value, $post_id = false ) {
|
|||
'type' => '',
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// save
|
||||
return acf_update_value( $value, $post_id, $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -971,15 +936,11 @@ function update_sub_field( $selector, $value, $post_id = false ) {
|
|||
|
||||
// get sub field
|
||||
if ( is_array( $selector ) ) {
|
||||
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
|
||||
|
||||
} else {
|
||||
|
||||
$post_id = acf_get_loop( 'active', 'post_id' );
|
||||
$sub_field = get_row_sub_field( $selector );
|
||||
|
||||
}
|
||||
|
||||
// bail early if no sub field
|
||||
|
|
@ -989,7 +950,6 @@ function update_sub_field( $selector, $value, $post_id = false ) {
|
|||
|
||||
// update
|
||||
return acf_update_value( $value, $post_id, $sub_field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1017,7 +977,6 @@ function delete_field( $selector, $post_id = false ) {
|
|||
|
||||
// delete
|
||||
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 ) {
|
||||
|
||||
return update_sub_field( $selector, null, $post_id );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1088,7 +1046,6 @@ function add_row( $selector, $row = false, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return count( $value );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1114,15 +1071,11 @@ function add_sub_row( $selector, $row = false, $post_id = false ) {
|
|||
|
||||
// get sub field
|
||||
if ( is_array( $selector ) ) {
|
||||
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
|
||||
|
||||
} else {
|
||||
|
||||
$post_id = acf_get_loop( 'active', 'post_id' );
|
||||
$sub_field = get_row_sub_field( $selector );
|
||||
|
||||
}
|
||||
|
||||
// bail early if no sub field
|
||||
|
|
@ -1144,7 +1097,6 @@ function add_sub_row( $selector, $row = false, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return count( $value );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1195,7 +1147,6 @@ function update_row( $selector, $i = 1, $row = false, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1223,15 +1174,11 @@ function update_sub_row( $selector, $i = 1, $row = false, $post_id = false ) {
|
|||
|
||||
// get sub field
|
||||
if ( is_array( $selector ) ) {
|
||||
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
|
||||
|
||||
} else {
|
||||
|
||||
$post_id = acf_get_loop( 'active', 'post_id' );
|
||||
$sub_field = get_row_sub_field( $selector );
|
||||
|
||||
}
|
||||
|
||||
// bail early if no sub field
|
||||
|
|
@ -1253,7 +1200,6 @@ function update_sub_row( $selector, $i = 1, $row = false, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1308,7 +1254,6 @@ function delete_row( $selector, $i = 1, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1336,15 +1281,11 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
|
|||
|
||||
// get sub field
|
||||
if ( is_array( $selector ) ) {
|
||||
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
$sub_field = acf_maybe_get_sub_field( $selector, $post_id, false );
|
||||
|
||||
} else {
|
||||
|
||||
$post_id = acf_get_loop( 'active', 'post_id' );
|
||||
$sub_field = get_row_sub_field( $selector );
|
||||
|
||||
}
|
||||
|
||||
// bail early if no sub field
|
||||
|
|
@ -1371,7 +1312,6 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
|
|||
|
||||
// return
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1391,37 +1331,29 @@ function delete_sub_row( $selector, $i = 1, $post_id = false ) {
|
|||
function create_field( $field ) {
|
||||
|
||||
acf_render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
acf_render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
function reset_the_repeater_field() {
|
||||
|
||||
return reset_rows();
|
||||
|
||||
}
|
||||
|
||||
function the_repeater_field( $field_name, $post_id = false ) {
|
||||
|
||||
return has_sub_field( $field_name, $post_id );
|
||||
|
||||
}
|
||||
|
||||
function the_flexible_field( $field_name, $post_id = false ) {
|
||||
|
||||
return has_sub_field( $field_name, $post_id );
|
||||
|
||||
}
|
||||
|
||||
function acf_filter_post_id( $post_id ) {
|
||||
|
||||
return acf_get_valid_post_id( $post_id );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ function acf_get_taxonomy_labels( $taxonomies = array() ) {
|
|||
if ( ! isset( $ref[ $label ] ) ) {
|
||||
$ref[ $label ] = 0;
|
||||
}
|
||||
$ref[ $label ]++;
|
||||
++$ref[ $label ];
|
||||
}
|
||||
|
||||
// show taxonomy name next to label for shared labels
|
||||
|
|
|
|||
|
|
@ -547,7 +547,6 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
|
|||
|
||||
// instantiate
|
||||
acf_new_instance( 'ACF_Assets' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
|
||||
if ( ! class_exists( 'ACF_Data' ) ) :
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class ACF_Data {
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
if ( ! empty( $args['active'] ) ) {
|
||||
$posts = array_filter(
|
||||
$posts,
|
||||
function( $post ) {
|
||||
function ( $post ) {
|
||||
return $post['active'];
|
||||
}
|
||||
);
|
||||
|
|
@ -927,7 +927,6 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
|
||||
return $post;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,11 +465,9 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
// return
|
||||
return $rule;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
acf_new_instance( 'ACF_Compatibility' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
|
|||
|
||||
// initialize
|
||||
acf()->fields = new acf_fields();
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
?>
|
||||
<div <?php echo acf_esc_attrs( $atts ); ?>></div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -141,7 +140,6 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
// return
|
||||
return $field;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
'return_format' => 'value',
|
||||
'layout' => 'horizontal',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,7 +77,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
'label' => $_label,
|
||||
'checked' => $checked,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// maybe select initial value
|
||||
|
|
@ -114,7 +112,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
|
||||
// append
|
||||
$html .= acf_get_radio_input( $button );
|
||||
|
||||
}
|
||||
|
||||
// close
|
||||
|
|
@ -122,7 +119,6 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
|
||||
// return
|
||||
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 ) {
|
||||
|
||||
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 ) {
|
||||
|
||||
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 ) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_button_group' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
'return_format' => 'value',
|
||||
'custom_choice_button_text' => __( 'Add new choice', 'acf' ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -101,7 +100,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// return
|
||||
echo '<ul ' . acf_esc_attr( $ul ) . '>' . "\n" . $li . '</ul>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -122,7 +120,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// walk
|
||||
return $this->walk( $field['choices'], $field );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -186,7 +183,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// return
|
||||
return '<li>' . acf_get_checkbox_input( $atts ) . '</li>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -230,7 +226,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// append
|
||||
$html .= '<li><input class="acf-checkbox-custom" type="checkbox" checked="checked" />' . acf_get_text_input( $text_input ) . '</li>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
// append button
|
||||
|
|
@ -238,7 +233,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// return
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -278,7 +272,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// optgroup
|
||||
if ( is_array( $label ) ) {
|
||||
|
||||
$html .= '<ul>' . "\n";
|
||||
$html .= $this->walk( $label, $args, $depth + 1 );
|
||||
$html .= '</ul>';
|
||||
|
|
@ -313,17 +306,14 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// append
|
||||
$html .= acf_get_checkbox_input( $atts );
|
||||
|
||||
}
|
||||
|
||||
// close
|
||||
$html .= '</li>' . "\n";
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -380,7 +370,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -538,17 +527,14 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
// append
|
||||
$field['choices'][ $v ] = $v;
|
||||
|
||||
}
|
||||
|
||||
// save
|
||||
acf_update_field( $field );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -568,7 +554,6 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
function translate_field( $field ) {
|
||||
|
||||
return acf_get_field_type( 'select' )->translate_field( $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -630,13 +615,9 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_checkbox' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -288,7 +288,6 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_color_picker' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -258,14 +258,11 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
|
||||
// save_format - compatibility with ACF < 5.0.0
|
||||
if ( ! empty( $field['save_format'] ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return acf_format_date( $value, $field['return_format'] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -322,13 +319,11 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_date_picker' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
<?php acf_text_input( $text_input ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -245,7 +244,6 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
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'] ),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_date_and_time_picker' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
'prepend' => '',
|
||||
'append' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -58,18 +57,14 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
|
||||
// prepend
|
||||
if ( $field['prepend'] !== '' ) {
|
||||
|
||||
$field['class'] .= ' acf-is-prepended';
|
||||
$html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>';
|
||||
|
||||
}
|
||||
|
||||
// append
|
||||
if ( $field['append'] !== '' ) {
|
||||
|
||||
$field['class'] .= ' acf-is-appended';
|
||||
$html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>';
|
||||
|
||||
}
|
||||
|
||||
// atts (value="123")
|
||||
|
|
@ -94,7 +89,6 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
|
||||
// return
|
||||
echo $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -196,13 +190,9 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_email' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
|
||||
// has value?
|
||||
if ( $field['value'] ) {
|
||||
|
||||
$attachment = acf_get_attachment( $field['value'] );
|
||||
if ( $attachment ) {
|
||||
|
||||
|
|
@ -190,7 +189,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -254,7 +252,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
);
|
||||
|
||||
foreach ( $clear as $k ) {
|
||||
|
||||
if ( empty( $field[ $k ] ) ) {
|
||||
$field[ $k ] = '';
|
||||
}
|
||||
|
|
@ -328,11 +325,8 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
|
||||
// format
|
||||
if ( $field['return_format'] == 'url' ) {
|
||||
|
||||
return wp_get_attachment_url( $value );
|
||||
|
||||
} elseif ( $field['return_format'] == 'array' ) {
|
||||
|
||||
return acf_get_attachment( $value );
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +352,6 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
|
||||
$vars['send'] = true;
|
||||
return( $vars );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -540,13 +533,11 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_file' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
|
|
@ -169,7 +169,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -239,7 +238,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
'placeholder' => $this->default_values['height'],
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -385,7 +383,6 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_google_map' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
// 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_import', array( $this, 'prepare_field_for_import' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -61,14 +60,11 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// append
|
||||
if ( $sub_fields ) {
|
||||
|
||||
$field['sub_fields'] = $sub_fields;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -105,12 +101,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// load
|
||||
$value[ $sub_field['key'] ] = acf_get_value( $post_id, $sub_field );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -151,12 +145,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// append to $row
|
||||
$value[ $sub_field['_name'] ] = $sub_value;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -199,12 +191,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// key (backend)
|
||||
if ( isset( $value[ $sub_field['key'] ] ) ) {
|
||||
|
||||
$v = $value[ $sub_field['key'] ];
|
||||
|
||||
// name (frontend)
|
||||
} elseif ( isset( $value[ $sub_field['_name'] ] ) ) {
|
||||
|
||||
$v = $value[ $sub_field['_name'] ];
|
||||
|
||||
// empty
|
||||
|
|
@ -212,17 +202,14 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// input is not set (hidden by conditioanl logic)
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// update value
|
||||
acf_update_value( $v, $post_id, $sub_field );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -251,12 +238,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// prefix name
|
||||
$sub_field['name'] = $field['name'] . '_' . $sub_field['_name'];
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -287,12 +272,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// this is a normal value
|
||||
$sub_field['value'] = $field['value'][ $sub_field['key'] ];
|
||||
|
||||
} elseif ( isset( $sub_field['default_value'] ) ) {
|
||||
|
||||
// no value, but this sub field has a default value
|
||||
$sub_field['value'] = $sub_field['default_value'];
|
||||
|
||||
}
|
||||
|
||||
// update prefix to allow for nested values
|
||||
|
|
@ -306,15 +289,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// render
|
||||
if ( $field['layout'] == 'table' ) {
|
||||
|
||||
$this->render_field_table( $field );
|
||||
|
||||
} else {
|
||||
|
||||
$this->render_field_block( $field );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -340,13 +318,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
echo '<div class="acf-fields -' . $label_placement . ' -border">';
|
||||
|
||||
foreach ( $field['sub_fields'] as $sub_field ) {
|
||||
|
||||
acf_render_field_wrap( $sub_field );
|
||||
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -389,10 +364,8 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// Add custom width
|
||||
if ( $sub_field['wrapper']['width'] ) {
|
||||
|
||||
$atts['data-width'] = $sub_field['wrapper']['width'];
|
||||
$atts['style'] = 'width: ' . $sub_field['wrapper']['width'] . '%;';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -408,9 +381,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
<?php
|
||||
|
||||
foreach ( $field['sub_fields'] as $sub_field ) {
|
||||
|
||||
acf_render_field_wrap( $sub_field, 'td' );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -418,7 +389,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -475,7 +445,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -522,12 +491,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// validate
|
||||
acf_validate_value( $value[ $k ], $sub_field, "{$input}[{$k}]" );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -558,7 +525,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -606,7 +572,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
// Return array of [field, sub_1, sub_2, ...].
|
||||
return array_merge( array( $field ), $sub_fields );
|
||||
|
||||
}
|
||||
return $field;
|
||||
}
|
||||
|
|
@ -712,13 +677,11 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field__group' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
|
||||
// filters
|
||||
add_filter( 'get_media_item_args', array( $this, 'get_media_item_args' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -375,18 +374,13 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
|
||||
// format
|
||||
if ( $field['return_format'] == 'url' ) {
|
||||
|
||||
return wp_get_attachment_url( $value );
|
||||
|
||||
} elseif ( $field['return_format'] == 'array' ) {
|
||||
|
||||
return acf_get_attachment( $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -407,7 +401,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
|
||||
$vars['send'] = true;
|
||||
return( $vars );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -430,7 +423,6 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
function 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 ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_image' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
$this->defaults = array(
|
||||
'return_format' => 'array',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -58,25 +57,20 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
|
||||
// array (ACF 5.6.0)
|
||||
if ( is_array( $value ) ) {
|
||||
|
||||
$link = array_merge( $link, $value );
|
||||
|
||||
// post id (ACF < 5.6.0)
|
||||
} elseif ( is_numeric( $value ) ) {
|
||||
|
||||
$link['title'] = get_the_title( $value );
|
||||
$link['url'] = get_permalink( $value );
|
||||
|
||||
// string (ACF < 5.6.0)
|
||||
} elseif ( is_string( $value ) ) {
|
||||
|
||||
$link['url'] = $value;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $link;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -147,7 +141,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -178,7 +171,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -209,14 +201,11 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
|
||||
// format value
|
||||
if ( $field['return_format'] == 'url' ) {
|
||||
|
||||
return $link['url'];
|
||||
|
||||
}
|
||||
|
||||
// return link
|
||||
return $link;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -242,14 +231,11 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
|
||||
// URL is required
|
||||
if ( empty( $value ) || empty( $value['url'] ) ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -310,7 +296,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_link' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
'esc_html' => 0,
|
||||
'new_lines' => 'wpautop',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -58,25 +57,18 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
|
||||
// esc_html
|
||||
if ( $field['esc_html'] ) {
|
||||
|
||||
$m = esc_html( $m );
|
||||
|
||||
}
|
||||
|
||||
// new lines
|
||||
if ( $field['new_lines'] == 'wpautop' ) {
|
||||
|
||||
$m = wpautop( $m );
|
||||
|
||||
} elseif ( $field['new_lines'] == 'br' ) {
|
||||
|
||||
$m = nl2br( $m );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
echo acf_esc_html( $m );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -150,7 +142,6 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -184,13 +175,9 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
// return
|
||||
return $field;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_message' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
'prepend' => '',
|
||||
'append' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,18 +65,14 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// prepend
|
||||
if ( $field['prepend'] !== '' ) {
|
||||
|
||||
$field['class'] .= ' acf-is-prepended';
|
||||
$html .= '<div class="acf-input-prepend">' . acf_esc_html( $field['prepend'] ) . '</div>';
|
||||
|
||||
}
|
||||
|
||||
// append
|
||||
if ( $field['append'] !== '' ) {
|
||||
|
||||
$field['class'] .= ' acf-is-appended';
|
||||
$html .= '<div class="acf-input-append">' . acf_esc_html( $field['append'] ) . '</div>';
|
||||
|
||||
}
|
||||
|
||||
// atts (value="123")
|
||||
|
|
@ -102,7 +97,6 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// return
|
||||
echo $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -230,9 +224,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// remove ','
|
||||
if ( acf_str_exists( ',', $value ) ) {
|
||||
|
||||
$value = str_replace( ',', '', $value );
|
||||
|
||||
}
|
||||
|
||||
// if value is not numeric...
|
||||
|
|
@ -240,14 +232,11 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// allow blank to be saved
|
||||
if ( ! empty( $value ) ) {
|
||||
|
||||
$valid = __( 'Value must be a number', 'acf' );
|
||||
|
||||
}
|
||||
|
||||
// return early
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
// convert
|
||||
|
|
@ -255,21 +244,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// min
|
||||
if ( is_numeric( $field['min'] ) && $value < floatval( $field['min'] ) ) {
|
||||
|
||||
$valid = sprintf( __( 'Value must be equal to or higher than %d', 'acf' ), $field['min'] );
|
||||
|
||||
}
|
||||
|
||||
// max
|
||||
if ( is_numeric( $field['max'] ) && $value > floatval( $field['max'] ) ) {
|
||||
|
||||
$valid = sprintf( __( 'Value must be equal to or lower than %d', 'acf' ), $field['max'] );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -293,21 +277,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
|
||||
// no formatting needed for empty value
|
||||
if ( empty( $value ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// remove ','
|
||||
if ( acf_str_exists( ',', $value ) ) {
|
||||
|
||||
$value = str_replace( ',', '', $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -348,13 +327,9 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_number' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
// extra
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,7 +65,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +123,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
|
||||
// return
|
||||
wp_send_json( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -170,7 +167,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
|
||||
// return
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -242,7 +238,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -333,7 +328,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_oembed' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ if ( ! class_exists( 'acf_field_output' ) ) :
|
|||
$this->defaults = array(
|
||||
'html' => false,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -55,24 +54,16 @@ if ( ! class_exists( 'acf_field_output' ) ) :
|
|||
|
||||
// html
|
||||
if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) {
|
||||
|
||||
echo $field['html'];
|
||||
|
||||
// function
|
||||
} else {
|
||||
|
||||
call_user_func_array( $field['html'], array( $field ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_output' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
// extra
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -92,7 +91,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
// update vars
|
||||
$args['s'] = $s;
|
||||
$is_search = true;
|
||||
|
||||
}
|
||||
|
||||
// load field
|
||||
|
|
@ -103,24 +101,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// update $args
|
||||
if ( ! empty( $field['post_type'] ) ) {
|
||||
|
||||
$args['post_type'] = acf_get_array( $field['post_type'] );
|
||||
|
||||
} else {
|
||||
|
||||
$args['post_type'] = acf_get_post_types();
|
||||
|
||||
}
|
||||
|
||||
// post status
|
||||
if ( ! empty( $options['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $options['post_status'] );
|
||||
|
||||
} elseif ( ! empty( $field['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $field['post_status'] );
|
||||
|
||||
}
|
||||
|
||||
// create tax queries
|
||||
|
|
@ -134,13 +124,11 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// now create the tax queries
|
||||
foreach ( $taxonomies as $taxonomy => $terms ) {
|
||||
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => $taxonomy,
|
||||
'field' => 'slug',
|
||||
'terms' => $terms,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +175,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// loop
|
||||
if ( ! empty( $groups ) ) {
|
||||
|
||||
foreach ( array_keys( $groups ) as $group_title ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -201,28 +188,21 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// convert post objects to post titles
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
|
||||
|
||||
}
|
||||
|
||||
// order posts by search
|
||||
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) {
|
||||
|
||||
$posts = acf_order_by_search( $posts, $args['s'] );
|
||||
|
||||
}
|
||||
|
||||
// append to $data
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
|
||||
|
||||
}
|
||||
|
||||
// append to $results
|
||||
$results[] = $data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +213,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
'limit' => $args['posts_per_page'],
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -264,15 +243,12 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
$pos = strpos( $text, $search );
|
||||
|
||||
if ( $pos !== false ) {
|
||||
|
||||
$result['description'] = substr( $text, $pos + 2 );
|
||||
$result['text'] = substr( $text, 0, $pos );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -308,7 +284,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// return
|
||||
return $title;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -334,20 +309,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
$post__in = array();
|
||||
|
||||
foreach ( $value as $k => $v ) {
|
||||
|
||||
if ( is_numeric( $v ) ) {
|
||||
|
||||
// append to $post__in
|
||||
$post__in[] = (int) $v;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// bail early if no posts
|
||||
if ( empty( $post__in ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// get posts
|
||||
|
|
@ -363,7 +334,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// append to $return
|
||||
foreach ( $value as $k => $v ) {
|
||||
|
||||
if ( is_numeric( $v ) ) {
|
||||
|
||||
// extract first post
|
||||
|
|
@ -371,20 +341,15 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// append
|
||||
if ( $post ) {
|
||||
|
||||
$return[] = $post;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$return[] = $v;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// return
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -416,7 +381,6 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// set choices
|
||||
if ( ! empty( $posts ) ) {
|
||||
|
||||
foreach ( array_keys( $posts ) as $i ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -426,12 +390,10 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// append to choices
|
||||
$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
|
||||
|
||||
} else {
|
||||
|
||||
// append to choices
|
||||
$field['choices'][ $post ] = $post;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -564,16 +526,12 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// ACF4 null
|
||||
if ( $value === 'null' ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// bail early if no value
|
||||
if ( empty( $value ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// get posts
|
||||
|
|
@ -587,26 +545,20 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
// convert $post to permalink
|
||||
if ( is_object( $post ) ) {
|
||||
|
||||
$post = get_permalink( $post );
|
||||
|
||||
}
|
||||
|
||||
// append back to $value
|
||||
$value[ $i ] = $post;
|
||||
|
||||
}
|
||||
|
||||
// convert back from array if neccessary
|
||||
if ( ! $field['multiple'] ) {
|
||||
|
||||
$value = array_shift( $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 ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_page_link' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
|
|||
'prepend' => '',
|
||||
'append' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -50,7 +49,6 @@ if ( ! class_exists( 'acf_field_password' ) ) :
|
|||
function render_field( $field ) {
|
||||
|
||||
acf_get_field_type( 'text' )->render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -108,13 +106,9 @@ if ( ! class_exists( 'acf_field_password' ) ) :
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_password' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
// extra
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -61,7 +60,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// return
|
||||
acf_send_ajax_results( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -116,29 +114,20 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
// update vars
|
||||
$args['s'] = $s;
|
||||
$is_search = true;
|
||||
|
||||
}
|
||||
|
||||
// post_type
|
||||
if ( ! empty( $field['post_type'] ) ) {
|
||||
|
||||
$args['post_type'] = acf_get_array( $field['post_type'] );
|
||||
|
||||
} else {
|
||||
|
||||
$args['post_type'] = acf_get_post_types();
|
||||
|
||||
}
|
||||
|
||||
// post status
|
||||
if ( ! empty( $options['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $options['post_status'] );
|
||||
|
||||
} elseif ( ! empty( $field['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $field['post_status'] );
|
||||
|
||||
}
|
||||
|
||||
// taxonomy
|
||||
|
|
@ -152,13 +141,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// now create the tax queries
|
||||
foreach ( $terms as $k => $v ) {
|
||||
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => $k,
|
||||
'field' => 'slug',
|
||||
'terms' => $v,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,28 +176,21 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// convert post objects to post titles
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'], $is_search );
|
||||
|
||||
}
|
||||
|
||||
// order posts by search
|
||||
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) {
|
||||
|
||||
$posts = acf_order_by_search( $posts, $args['s'] );
|
||||
|
||||
}
|
||||
|
||||
// append to $data
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
|
||||
|
||||
}
|
||||
|
||||
// append to $results
|
||||
$results[] = $data;
|
||||
|
||||
}
|
||||
|
||||
// optgroup or single
|
||||
|
|
@ -227,7 +207,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// return
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -258,15 +237,12 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
$pos = strpos( $text, $search );
|
||||
|
||||
if ( $pos !== false ) {
|
||||
|
||||
$result['description'] = substr( $text, $pos + 2 );
|
||||
$result['text'] = substr( $text, 0, $pos );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -329,7 +305,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
$posts = $this->get_posts( $field['value'], $field );
|
||||
|
||||
if ( $posts ) {
|
||||
|
||||
foreach ( array_keys( $posts ) as $i ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -337,13 +312,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// append to choices
|
||||
$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// render
|
||||
acf_render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -430,7 +403,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
'ui' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -490,7 +462,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -522,21 +493,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// load posts if needed
|
||||
if ( $field['return_format'] == 'object' ) {
|
||||
|
||||
$value = $this->get_posts( $value, $field );
|
||||
|
||||
}
|
||||
|
||||
// convert back from array if neccessary
|
||||
if ( ! $field['multiple'] && is_array( $value ) ) {
|
||||
|
||||
$value = current( $value );
|
||||
|
||||
}
|
||||
|
||||
// return value
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -610,7 +576,6 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
// return
|
||||
return $posts;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -785,13 +750,9 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_post_object' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
'allow_null' => 0,
|
||||
'return_format' => 'value',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -372,7 +371,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
|
||||
// save
|
||||
acf_update_field( $field );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -401,14 +399,11 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
|
||||
// must be single value
|
||||
if ( is_array( $value ) ) {
|
||||
|
||||
$value = array_pop( $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -428,7 +423,6 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
function 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 ) {
|
||||
|
||||
return acf_get_field_type( 'select' )->format_value( $value, $post_id, $field );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -480,13 +473,9 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_radio' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
|
|||
'prepend' => '',
|
||||
'append' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -275,14 +274,9 @@ if ( ! class_exists( 'acf_field_range' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_range' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
// extra
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -89,7 +88,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// return
|
||||
acf_send_ajax_results( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -146,33 +144,22 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
// update vars
|
||||
$args['s'] = $s;
|
||||
$is_search = true;
|
||||
|
||||
}
|
||||
|
||||
// post_type
|
||||
if ( ! empty( $options['post_type'] ) ) {
|
||||
|
||||
$args['post_type'] = acf_get_array( $options['post_type'] );
|
||||
|
||||
} elseif ( ! empty( $field['post_type'] ) ) {
|
||||
|
||||
$args['post_type'] = acf_get_array( $field['post_type'] );
|
||||
|
||||
} else {
|
||||
|
||||
$args['post_type'] = acf_get_post_types();
|
||||
|
||||
}
|
||||
|
||||
// post status
|
||||
if ( ! empty( $options['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $options['post_status'] );
|
||||
|
||||
} elseif ( ! empty( $field['post_status'] ) ) {
|
||||
|
||||
$args['post_status'] = acf_get_array( $field['post_status'] );
|
||||
|
||||
}
|
||||
|
||||
// taxonomy
|
||||
|
|
@ -190,7 +177,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
'field' => 'slug',
|
||||
'terms' => $term['term'],
|
||||
);
|
||||
|
||||
} elseif ( ! empty( $field['taxonomy'] ) ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -203,13 +189,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// now create the tax queries
|
||||
foreach ( $terms as $k => $v ) {
|
||||
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => $k,
|
||||
'field' => 'slug',
|
||||
'terms' => $v,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,35 +224,26 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// convert post objects to post titles
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
|
||||
|
||||
}
|
||||
|
||||
// order posts by search
|
||||
if ( $is_search && empty( $args['orderby'] ) && isset( $args['s'] ) ) {
|
||||
|
||||
$posts = acf_order_by_search( $posts, $args['s'] );
|
||||
|
||||
}
|
||||
|
||||
// append to $data
|
||||
foreach ( array_keys( $posts ) as $post_id ) {
|
||||
|
||||
$data['children'][] = $this->get_post_result( $post_id, $posts[ $post_id ] );
|
||||
|
||||
}
|
||||
|
||||
// append to $results
|
||||
$results[] = $data;
|
||||
|
||||
}
|
||||
|
||||
// add as optgroup or results
|
||||
if ( count( $args['post_type'] ) == 1 ) {
|
||||
|
||||
$results = $results[0]['children'];
|
||||
|
||||
}
|
||||
|
||||
// vars
|
||||
|
|
@ -279,7 +254,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// return
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -307,7 +281,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// return
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -345,14 +318,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// icon
|
||||
if ( $thumbnail['type'] == 'icon' ) {
|
||||
|
||||
$class .= ' -' . $thumbnail['type'];
|
||||
|
||||
}
|
||||
|
||||
// append
|
||||
$title = '<div class="' . $class . '">' . $thumbnail['html'] . '</div>' . $title;
|
||||
|
||||
}
|
||||
|
||||
// filters
|
||||
|
|
@ -362,7 +332,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// return
|
||||
return $title;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -392,7 +361,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// post_type filter
|
||||
if ( in_array( 'post_type', $filters ) ) {
|
||||
|
||||
$filter_post_type_choices = array(
|
||||
'' => __( 'Select post type', 'acf' ),
|
||||
) + acf_get_pretty_post_types( $post_type );
|
||||
|
|
@ -400,7 +368,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// taxonomy filter
|
||||
if ( in_array( 'taxonomy', $filters ) ) {
|
||||
|
||||
$term_choices = array();
|
||||
$filter_taxonomy_choices = array(
|
||||
'' => __( 'Select taxonomy', 'acf' ),
|
||||
|
|
@ -431,7 +398,6 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// append term choices
|
||||
$filter_taxonomy_choices = $filter_taxonomy_choices + $term_choices;
|
||||
|
||||
}
|
||||
|
||||
// div attributes
|
||||
|
|
@ -736,9 +702,7 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// bail early if no value
|
||||
if ( empty( $value ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// force value to array
|
||||
|
|
@ -757,12 +721,10 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
'post_type' => $field['post_type'],
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -783,22 +745,17 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
|
||||
// default
|
||||
if ( empty( $value ) || ! is_array( $value ) ) {
|
||||
|
||||
$value = array();
|
||||
|
||||
}
|
||||
|
||||
// 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 = sprintf( $valid, $field['label'], $field['min'] );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -922,13 +879,11 @@ if ( ! class_exists( 'acf_field_relationship' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_relationship' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
// ajax
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,25 +77,20 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
// attempt to find 3rd party Select2 version
|
||||
// - avoid including v3 CSS when v4 JS is already enququed
|
||||
if ( isset( $wp_scripts->registered['select2'] ) ) {
|
||||
|
||||
$major = (int) $wp_scripts->registered['select2']->ver;
|
||||
|
||||
}
|
||||
|
||||
// v4
|
||||
if ( $major == 4 ) {
|
||||
|
||||
$version = '4.0.13';
|
||||
$script = acf_get_url( "assets/inc/select2/4/select2.full{$min}.js" );
|
||||
$style = acf_get_url( "assets/inc/select2/4/select2{$min}.css" );
|
||||
|
||||
// v3
|
||||
} else {
|
||||
|
||||
$version = '3.5.2';
|
||||
$script = acf_get_url( "assets/inc/select2/3/select2{$min}.js" );
|
||||
$style = acf_get_url( 'assets/inc/select2/3/select2.css' );
|
||||
|
||||
}
|
||||
|
||||
// enqueue
|
||||
|
|
@ -150,7 +144,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
// return
|
||||
acf_send_ajax_results( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -200,7 +193,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
// strip slashes (search may be integer)
|
||||
$s = strval( $options['s'] );
|
||||
$s = wp_unslash( $s );
|
||||
|
||||
}
|
||||
|
||||
foreach ( $field['choices'] as $k => $v ) {
|
||||
|
|
@ -218,7 +210,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
'id' => $k,
|
||||
'text' => $v,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$response = array(
|
||||
|
|
@ -293,7 +284,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
// multiple
|
||||
if ( $field['multiple'] ) {
|
||||
|
||||
$select['multiple'] = 'multiple';
|
||||
$select['size'] = 5;
|
||||
$select['name'] .= '[]';
|
||||
|
|
@ -339,7 +329,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
// render
|
||||
acf_select_input( $select );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -411,7 +400,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
'ui' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -586,7 +574,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -634,22 +621,18 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
// label
|
||||
} elseif ( $field['return_format'] == 'label' ) {
|
||||
|
||||
$value = $label;
|
||||
|
||||
// array
|
||||
} elseif ( $field['return_format'] == 'array' ) {
|
||||
|
||||
$value = array(
|
||||
'value' => $value,
|
||||
'label' => $label,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -756,13 +739,9 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_select' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
|
|||
$this->label = __( 'Separator', 'acf' );
|
||||
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-separator.png';
|
||||
$this->category = 'layout';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -44,7 +43,6 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
|
|||
function render_field( $field ) {
|
||||
|
||||
/* do nothing */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -75,15 +73,10 @@ if ( ! class_exists( 'acf_field_separator' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_separator' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
|
|||
'placement' => 'top',
|
||||
'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>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -128,7 +126,6 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
|
|||
'ui' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,15 +158,12 @@ if ( ! class_exists( 'acf_field_tab' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_tab' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -74,7 +73,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// return
|
||||
acf_send_ajax_results( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,10 +130,8 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
// pagination
|
||||
// - don't bother for hierarchial terms, we will need to load all terms anyway
|
||||
if ( $is_pagination && ! $is_hierarchical ) {
|
||||
|
||||
$args['number'] = $limit;
|
||||
$args['offset'] = $offset;
|
||||
|
||||
}
|
||||
|
||||
// search
|
||||
|
|
@ -147,7 +143,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
// update vars
|
||||
$args['search'] = $s;
|
||||
$is_search = true;
|
||||
|
||||
}
|
||||
|
||||
// filters
|
||||
|
|
@ -175,17 +170,13 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// check for empty array (possible if parent did not exist within original data)
|
||||
if ( ! empty( $ordered_terms ) ) {
|
||||
|
||||
$terms = $ordered_terms;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// fake pagination
|
||||
if ( $is_pagination ) {
|
||||
|
||||
$terms = array_slice( $terms, $offset, $limit );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +188,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
'id' => $term->term_id,
|
||||
'text' => $this->get_term_title( $term, $field, $options['post_id'] ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// vars
|
||||
|
|
@ -208,7 +198,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// return
|
||||
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
|
||||
if ( count( $value ) > 1 ) {
|
||||
|
||||
$terms = acf_get_terms(
|
||||
array(
|
||||
'taxonomy' => $taxonomy,
|
||||
|
|
@ -268,14 +256,11 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
'hide_empty' => false,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// update value to include $post
|
||||
foreach ( array_keys( $value ) as $i ) {
|
||||
|
||||
$value[ $i ] = get_term( $value[ $i ], $taxonomy );
|
||||
|
||||
}
|
||||
|
||||
// filter out null values
|
||||
|
|
@ -336,34 +321,26 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// sort
|
||||
if ( ! empty( $value ) ) {
|
||||
|
||||
$order = array();
|
||||
|
||||
foreach ( $term_ids as $i => $v ) {
|
||||
|
||||
$order[ $i ] = array_search( $v, $value );
|
||||
|
||||
}
|
||||
|
||||
array_multisort( $order, $term_ids );
|
||||
|
||||
}
|
||||
|
||||
// update value
|
||||
$value = $term_ids;
|
||||
|
||||
}
|
||||
|
||||
// convert back from array if neccessary
|
||||
if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
|
||||
|
||||
$value = array_shift( $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -412,7 +389,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -483,19 +459,15 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// get posts
|
||||
$value = $this->get_terms( $value, $field['taxonomy'] );
|
||||
|
||||
}
|
||||
|
||||
// convert back from array if neccessary
|
||||
if ( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) {
|
||||
|
||||
$value = array_shift( $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -543,31 +515,22 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
endif;
|
||||
|
||||
if ( $field['field_type'] == 'select' ) {
|
||||
|
||||
$field['multiple'] = 0;
|
||||
|
||||
$this->render_field_select( $field );
|
||||
|
||||
} elseif ( $field['field_type'] == 'multi_select' ) {
|
||||
|
||||
$field['multiple'] = 1;
|
||||
|
||||
$this->render_field_select( $field );
|
||||
|
||||
} elseif ( $field['field_type'] == 'radio' ) {
|
||||
|
||||
$this->render_field_checkbox( $field );
|
||||
|
||||
} elseif ( $field['field_type'] == 'checkbox' ) {
|
||||
|
||||
$this->render_field_checkbox( $field );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -599,7 +562,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// set choices
|
||||
if ( ! empty( $terms ) ) {
|
||||
|
||||
foreach ( array_keys( $terms ) as $i ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -607,14 +569,12 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// append to choices
|
||||
$field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// render select
|
||||
acf_render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -637,9 +597,7 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// checkbox saves an array.
|
||||
if ( $field['field_type'] == 'checkbox' ) {
|
||||
|
||||
$field['name'] .= '[]';
|
||||
|
||||
}
|
||||
|
||||
// taxonomy.
|
||||
|
|
@ -669,7 +627,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -896,7 +853,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
'term_parent' => $term->parent,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -912,16 +868,12 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
);
|
||||
|
||||
if ( is_taxonomy_hierarchical( $field['taxonomy'] ) ) {
|
||||
|
||||
$choices = array();
|
||||
$response = $this->get_ajax_query( $args );
|
||||
|
||||
if ( $response ) {
|
||||
|
||||
foreach ( $response['results'] as $v ) {
|
||||
|
||||
$choices[ $v['id'] ] = $v['text'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -935,7 +887,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
'choices' => $choices,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -946,7 +897,6 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
// die
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1010,13 +960,11 @@ if ( ! class_exists( 'acf_field_taxonomy' ) ) :
|
|||
|
||||
return $links;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_taxonomy' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -213,5 +213,4 @@ if ( ! class_exists( 'acf_field_text' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_text' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
|
|||
'placeholder' => '',
|
||||
'rows' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -80,7 +79,6 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
|
|||
|
||||
// return
|
||||
acf_textarea_input( $atts );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -195,20 +193,14 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
|
|||
|
||||
// bail early if no value or not for template
|
||||
if ( empty( $value ) || ! is_string( $value ) ) {
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
// new lines
|
||||
if ( $field['new_lines'] == 'wpautop' ) {
|
||||
|
||||
$value = wpautop( $value );
|
||||
|
||||
} elseif ( $field['new_lines'] == 'br' ) {
|
||||
|
||||
$value = nl2br( $value );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
|
|
@ -260,7 +252,4 @@ if ( ! class_exists( 'acf_field_textarea' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_textarea' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
|
|||
'display_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 ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -163,7 +161,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
|
|||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
return acf_format_date( $value, $field['return_format'] );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -208,7 +205,6 @@ if ( ! class_exists( 'acf_field_time_picker' ) ) :
|
|||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_time_picker' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
'ui_on_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 .= '<div class="acf-switch-slider"></div>';
|
||||
$switch .= '</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -114,7 +112,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
</label>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -225,7 +222,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
return empty( $value ) ? false : true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -246,21 +242,16 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
|
||||
// bail early if not required
|
||||
if ( ! $field['required'] ) {
|
||||
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
// value may be '0'
|
||||
if ( ! $value ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -286,7 +277,6 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -319,13 +309,11 @@ if ( ! class_exists( 'acf_field_true_false' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return (bool) $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_true_false' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ if ( ! class_exists( 'acf_field_url' ) ) :
|
|||
'default_value' => '',
|
||||
'placeholder' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,7 +77,6 @@ if ( ! class_exists( 'acf_field_url' ) ) :
|
|||
|
||||
// return
|
||||
echo $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -144,28 +142,21 @@ if ( ! class_exists( 'acf_field_url' ) ) :
|
|||
|
||||
// bail early if empty
|
||||
if ( empty( $value ) ) {
|
||||
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
if ( strpos( $value, '://' ) !== false ) {
|
||||
|
||||
// url
|
||||
|
||||
} elseif ( strpos( $value, '//' ) === 0 ) {
|
||||
|
||||
// protocol relative url
|
||||
|
||||
} else {
|
||||
|
||||
$valid = __( 'Value must be a valid URL', 'acf' );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $valid;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -180,13 +171,9 @@ if ( ! class_exists( 'acf_field_url' ) ) :
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_url' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -626,11 +626,9 @@ if ( ! class_exists( 'ACF_Field_User' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return acf_format_numerics( $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'ACF_Field_User' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
|
||||
// return
|
||||
return $toolbars;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -200,32 +199,25 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
|
||||
// detect mode
|
||||
if ( ! user_can_richedit() ) {
|
||||
|
||||
$show_tabs = false;
|
||||
|
||||
} elseif ( $field['tabs'] == 'visual' ) {
|
||||
|
||||
// case: visual tab only
|
||||
$default_editor = 'tinymce';
|
||||
$show_tabs = false;
|
||||
|
||||
} elseif ( $field['tabs'] == 'text' ) {
|
||||
|
||||
// case: text tab only
|
||||
$show_tabs = false;
|
||||
|
||||
} elseif ( wp_default_editor() == 'tinymce' ) {
|
||||
|
||||
// case: both tabs
|
||||
$default_editor = 'tinymce';
|
||||
|
||||
}
|
||||
|
||||
// must be logged in to upload
|
||||
if ( ! current_user_can( 'upload_files' ) ) {
|
||||
|
||||
$field['media_upload'] = 0;
|
||||
|
||||
}
|
||||
|
||||
// mode
|
||||
|
|
@ -288,7 +280,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -314,7 +305,6 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
'name' => 'default_value',
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -330,9 +320,7 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
$choices = array();
|
||||
|
||||
if ( ! empty( $toolbars ) ) {
|
||||
|
||||
foreach ( $toolbars as $k => $v ) {
|
||||
|
||||
$label = $k;
|
||||
$name = sanitize_title( $label );
|
||||
$name = str_replace( '-', '_', $name );
|
||||
|
|
@ -424,13 +412,11 @@ if ( ! class_exists( 'acf_field_wysiwyg' ) ) :
|
|||
// Follow the_content function in /wp-includes/post-template.php
|
||||
return str_replace( ']]>', ']]>', $value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_wysiwyg' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
if ( ! class_exists( 'acf_field' ) ) :
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class acf_field {
|
||||
|
||||
|
|
@ -105,7 +104,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
function initialize() {
|
||||
|
||||
/* do nothing */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -134,7 +132,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// add
|
||||
add_filter( $tag, $function_to_add, $priority, $accepted_args );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,7 +158,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// add
|
||||
$this->add_filter( $tag, $function_to_add, $priority, $accepted_args );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -190,7 +186,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// add
|
||||
add_action( $tag, $function_to_add, $priority, $accepted_args );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -217,7 +212,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// add
|
||||
$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
|
||||
foreach ( $this->defaults as $k => $v ) {
|
||||
|
||||
if ( ! isset( $field[ $k ] ) ) {
|
||||
$field[ $k ] = $v;
|
||||
}
|
||||
|
|
@ -251,7 +244,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -280,7 +272,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
|
||||
// return
|
||||
return $l10n;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -355,9 +346,6 @@ if ( ! class_exists( 'acf_field' ) ) :
|
|||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ if ( ! class_exists( 'acf_form_attachment' ) ) :
|
|||
|
||||
// save
|
||||
add_filter( 'attachment_fields_to_save', array( $this, 'save_attachment' ), 10, 2 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,7 +106,6 @@ acf.unload.active = 0;
|
|||
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -163,13 +161,11 @@ acf.unload.active = 0;
|
|||
|
||||
// override instruction placement for modal
|
||||
if ( ! $is_page ) {
|
||||
|
||||
$field_group['instruction_placement'] = 'field';
|
||||
}
|
||||
|
||||
// render
|
||||
acf_render_fields( $fields, $post_id, $el, $field_group['instruction_placement'] );
|
||||
|
||||
}
|
||||
|
||||
// close
|
||||
|
|
@ -184,12 +180,10 @@ acf.unload.active = 0;
|
|||
'input' => 'html',
|
||||
'html' => $html,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $form_fields;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -225,12 +219,9 @@ acf.unload.active = 0;
|
|||
// return
|
||||
return $post;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
new acf_form_attachment();
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
// save
|
||||
add_action( 'edit_comment', 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
|
||||
if ( $pagenow == 'comment.php' ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
|
|
@ -94,9 +91,7 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
|
||||
// validate page
|
||||
if ( ! $this->validate_page() ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// load acf scripts
|
||||
|
|
@ -105,7 +100,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
// actions
|
||||
add_action( 'admin_footer', array( $this, 'admin_footer' ), 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
|
||||
if ( $field_group['ID'] && acf_current_user_can_admin() ) {
|
||||
|
||||
$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">';
|
||||
|
||||
foreach ( $field_groups as $field_group ) {
|
||||
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
acf_render_fields( $fields, $post_id, 'p', $field_group['instruction_placement'] );
|
||||
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
|
@ -255,7 +244,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
|
||||
// return
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -288,7 +276,6 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
if ( acf_validate_save_post( true ) ) {
|
||||
acf_save_post( "comment_{$comment_id}" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -330,13 +317,10 @@ if ( ! class_exists( 'acf_form_comment' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new acf_form_comment();
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
|
||||
if ( ! class_exists( 'acf_form_customizer' ) ) :
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class acf_form_customizer {
|
||||
|
||||
|
|
@ -37,7 +36,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// save
|
||||
add_filter( 'widget_update_callback', array( $this, 'save_widget' ), 10, 4 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,7 +64,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -116,7 +113,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// update
|
||||
$data['fields'][ $field['name'] ] = $field['key'];
|
||||
|
||||
}
|
||||
|
||||
// append data to instance
|
||||
|
|
@ -124,7 +120,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// return
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -179,7 +174,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// append
|
||||
$data[] = $setting;
|
||||
|
||||
}
|
||||
|
||||
// bail early if no settings
|
||||
|
|
@ -189,7 +183,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
|
||||
// return
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -225,7 +218,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
// append acf_value to preview_values
|
||||
$this->preview_values[ $data['post_id'] ] = $data['values'];
|
||||
$this->preview_fields[ $data['post_id'] ] = $data['fields'];
|
||||
|
||||
}
|
||||
|
||||
// bail early if no preview_values
|
||||
|
|
@ -236,7 +228,6 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
// add filters
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -323,9 +314,7 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
// remove [acf] data from saved widget array
|
||||
$id_data = $setting->id_data();
|
||||
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
|
||||
unset( $value[ $i ]['acf'] );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -459,13 +446,10 @@ if ( ! class_exists( 'acf_form_customizer' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new acf_form_customizer();
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// filters
|
||||
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?
|
||||
if ( $args['post_id'] === 'new_post' ) {
|
||||
|
||||
$args['new_post'] = wp_parse_args(
|
||||
$args['new_post'],
|
||||
array(
|
||||
|
|
@ -140,7 +138,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
'post_status' => 'draft',
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// filter
|
||||
|
|
@ -148,7 +145,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// return
|
||||
return $args;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -172,7 +168,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// append
|
||||
$this->forms[ $args['id'] ] = $args;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -198,7 +193,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// return
|
||||
return $this->forms[ $id ];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -227,16 +221,13 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// register
|
||||
acf_add_local_field( $field );
|
||||
|
||||
}
|
||||
|
||||
// honeypot
|
||||
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' ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -265,32 +256,25 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// update post
|
||||
$save['ID'] = $post_id;
|
||||
|
||||
} elseif ( $post_id == 'new_post' ) {
|
||||
|
||||
// merge in new post data
|
||||
$save = array_merge( $save, $form['new_post'] );
|
||||
|
||||
} else {
|
||||
|
||||
// not post
|
||||
return $post_id;
|
||||
|
||||
}
|
||||
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified in check_submit_form().
|
||||
// save 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_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.
|
||||
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||
|
||||
|
|
@ -301,25 +285,18 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// validate
|
||||
if ( count( $save ) == 1 ) {
|
||||
|
||||
return $post_id;
|
||||
|
||||
}
|
||||
|
||||
// save
|
||||
if ( $save['ID'] ) {
|
||||
|
||||
wp_update_post( $save );
|
||||
|
||||
} else {
|
||||
|
||||
$post_id = wp_insert_post( $save );
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
return $post_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -343,7 +320,6 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
|
||||
// load acf scripts
|
||||
acf_enqueue_scripts();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -446,9 +422,7 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
// redirect
|
||||
wp_redirect( $return );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -593,12 +567,10 @@ if ( ! class_exists( 'acf_form_front' ) ) :
|
|||
</form>
|
||||
<?php endif;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// initialize
|
||||
acf()->form_front = new acf_form_front();
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
|
|
@ -619,25 +591,21 @@ endif; // class_exists check
|
|||
function acf_form_head() {
|
||||
|
||||
acf()->form_front->enqueue_form();
|
||||
|
||||
}
|
||||
|
||||
function acf_form( $args = array() ) {
|
||||
|
||||
acf()->form_front->render_form( $args );
|
||||
|
||||
}
|
||||
|
||||
function acf_get_form( $id = '' ) {
|
||||
|
||||
return acf()->form_front->get_form( $id );
|
||||
|
||||
}
|
||||
|
||||
function acf_register_form( $args ) {
|
||||
|
||||
acf()->form_front->add_form( $args );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -186,5 +186,4 @@ if ( ! class_exists( 'ACF_Form_Gutenberg' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Form_Gutenberg' );
|
||||
|
||||
endif;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
// filters
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -62,7 +61,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'admin_footer', array( $this, 'admin_footer' ), 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -163,7 +161,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
|
||||
// save nav menu items
|
||||
$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'] );
|
||||
|
||||
foreach ( $posted_values as $post_id => $values ) {
|
||||
|
||||
acf_save_post( $post_id, $values );
|
||||
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||
}
|
||||
|
|
@ -267,10 +262,8 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
|
||||
// validate
|
||||
acf_validate_values( $values, $prefix );
|
||||
|
||||
}
|
||||
// phpcs:enable // phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -317,7 +310,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
|
||||
// loop
|
||||
foreach ( $field_groups as $field_group ) {
|
||||
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
echo '<div class="acf-menu-settings -' . $field_group['style'] . '">';
|
||||
|
|
@ -331,7 +323,6 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -386,12 +377,9 @@ if ( ! class_exists( 'acf_form_nav_menu' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
acf_new_instance( 'acf_form_nav_menu' );
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ if ( ! class_exists( 'ACF_Form_Post' ) ) :
|
|||
|
||||
// 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 ) );
|
||||
|
||||
}
|
||||
|
||||
// Set style from first field group.
|
||||
|
|
@ -339,7 +338,4 @@ if ( ! class_exists( 'ACF_Form_Post' ) ) :
|
|||
}
|
||||
|
||||
acf_new_instance( 'ACF_Form_Post' );
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// delete
|
||||
add_action( 'delete_term', array( $this, 'delete_term' ), 10, 4 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -65,9 +64,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// validate page
|
||||
if ( $pagenow === 'edit-tags.php' || $pagenow === 'term.php' ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// return
|
||||
|
|
@ -93,9 +90,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// validate page
|
||||
if ( ! $this->validate_page() ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// vars
|
||||
|
|
@ -109,7 +104,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
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}_edit_form", array( $this, 'edit_term' ), 10, 2 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -163,9 +157,7 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// wrap
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -199,7 +191,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// render
|
||||
if ( ! empty( $field_groups ) ) {
|
||||
|
||||
acf_form_data(
|
||||
array(
|
||||
'screen' => 'taxonomy',
|
||||
|
|
@ -219,10 +210,8 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
$fields = acf_get_fields( $field_group );
|
||||
acf_render_fields( $fields, $post_id, 'tr', 'field' );
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -320,7 +309,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -352,7 +340,6 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
|
||||
// save
|
||||
acf_save_post( $post_id );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -396,13 +383,10 @@ if ( ! class_exists( 'acf_form_taxonomy' ) ) :
|
|||
$_search
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new acf_form_taxonomy();
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -301,7 +301,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -383,7 +382,6 @@ if ( ! class_exists( 'ACF_Form_User' ) ) :
|
|||
|
||||
// instantiate
|
||||
acf_new_instance( 'ACF_Form_User' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
|
||||
if ( ! class_exists( 'acf_form_widget' ) ) :
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class acf_form_widget {
|
||||
|
||||
|
|
@ -43,7 +42,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
|
||||
// filters
|
||||
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' ) ) {
|
||||
|
||||
// valid
|
||||
|
||||
} else {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// load acf scripts
|
||||
|
|
@ -79,7 +74,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
|
||||
// actions
|
||||
add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ), 1 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -139,9 +133,7 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
|
||||
// get id
|
||||
if ( $widget->number !== '__i__' ) {
|
||||
|
||||
$post_id = "widget_{$widget->id}";
|
||||
|
||||
}
|
||||
|
||||
// get field groups
|
||||
|
|
@ -184,7 +176,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
|
||||
// render
|
||||
acf_render_fields( $fields, $post_id, 'div', $field_group['instruction_placement'] );
|
||||
|
||||
}
|
||||
|
||||
// wrap
|
||||
|
|
@ -202,9 +193,7 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
</script>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -244,7 +233,6 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
|
||||
// return
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -324,12 +312,10 @@ if ( ! class_exists( 'acf_form_widget' ) ) :
|
|||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
new acf_form_widget();
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -122,17 +122,17 @@ function acf_load_textdomain( $domain = 'acf' ) {
|
|||
return load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* _acf_apply_language_cache_key
|
||||
*
|
||||
* Applies the current language to the cache key.
|
||||
*
|
||||
* @date 23/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @return string
|
||||
*/
|
||||
/**
|
||||
* _acf_apply_language_cache_key
|
||||
*
|
||||
* Applies the current language to the cache key.
|
||||
*
|
||||
* @date 23/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @return string
|
||||
*/
|
||||
function _acf_apply_language_cache_key( $key ) {
|
||||
|
||||
// Get current language.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue