Updates to 6.2.7
This commit is contained in:
parent
ef46740af7
commit
6cf14add0e
14
acf.php
14
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.6.1
|
||||
* Version: 6.2.7
|
||||
* 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.6.1';
|
||||
public $version = '6.2.7';
|
||||
|
||||
/**
|
||||
* The plugin settings array.
|
||||
|
|
@ -64,8 +64,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @date 23/06/12
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
// Do nothing.
|
||||
|
|
@ -76,8 +74,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
|
||||
|
|
@ -244,8 +240,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
|
|
@ -402,8 +396,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @date 22/10/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_post_types() {
|
||||
$cap = acf_get_setting( 'capability' );
|
||||
|
|
@ -482,8 +474,6 @@ if ( ! class_exists( 'ACF' ) ) {
|
|||
*
|
||||
* @date 22/10/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_post_status() {
|
||||
|
||||
|
|
|
|||
|
|
@ -1406,6 +1406,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|||
onChangeName: function (e, $el) {
|
||||
// set
|
||||
var name = $el.val();
|
||||
|
||||
// strip any invalid characters.
|
||||
name = name.replace(/[^A-Za-zŽžÀ-ÿ0-9_-]+/g, '-');
|
||||
$el.val(name);
|
||||
this.set('name', name);
|
||||
|
||||
// error
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -6073,11 +6073,15 @@
|
|||
// preview hack allows post to save with no title or content
|
||||
$('#_acf_changed').val(1);
|
||||
if (acf.isGutenbergPostEditor()) {
|
||||
wp.data.dispatch('core/editor').editPost({
|
||||
meta: {
|
||||
_acf_changed: 1
|
||||
}
|
||||
});
|
||||
try {
|
||||
wp.data.dispatch('core/editor').editPost({
|
||||
meta: {
|
||||
_acf_changed: 1
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('ACF: Failed to update _acf_changed meta', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -8326,7 +8330,7 @@
|
|||
if (!options.templateSelection) {
|
||||
options.templateSelection = function (selection) {
|
||||
var $selection = $('<span class="acf-selection"></span>');
|
||||
$selection.html(acf.escHtml(selection.text));
|
||||
$selection.html(acf.strEscape(selection.text));
|
||||
$selection.data('element', selection.element);
|
||||
return $selection;
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -305,6 +305,10 @@
|
|||
},
|
||||
onChangeName: function (e, $el) {
|
||||
var name = $el.val();
|
||||
|
||||
// strip any invalid characters.
|
||||
name = name.replace(/[^A-Za-zŽžÀ-ÿ0-9_-]+/g, '-');
|
||||
$el.val(name);
|
||||
this.set('layoutName', name);
|
||||
this.$el.attr('data-layout-name', name);
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
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.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)})()})();
|
||||
(()=>{var e={805:()=>{!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(805)})()})();
|
||||
|
|
@ -176,7 +176,7 @@ function acf_get_field_post( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param string $id The identifier.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_field_key( $id = '' ) {
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ function acf_get_fields( $parent ) {
|
|||
* @date 18/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param int $id The field group or field id.
|
||||
* @param integer $id The field group or field id.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_raw_fields( $id = 0 ) {
|
||||
|
|
@ -449,7 +449,7 @@ function acf_get_raw_fields( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param array $parent The field group or field array.
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
function acf_get_field_count( $parent ) {
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ function acf_get_field_count( $parent ) {
|
|||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param array $field The field being cloned.
|
||||
* @param array $field The field being cloned.
|
||||
* @param array $clone_field The clone field.
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -571,9 +571,9 @@ acf_add_filter_variations( 'acf/prepare_field', array( 'type', 'name', 'key' ),
|
|||
* @since 5.0.0
|
||||
* @since 5.6.9 Changed parameter order.
|
||||
*
|
||||
* @param array $fields An array of fields.
|
||||
* @param (int|string) $post_id The post ID to load values from.
|
||||
* @param string $element The wrapping element type.
|
||||
* @param array $fields An array of fields.
|
||||
* @param (int|string) $post_id The post ID to load values from.
|
||||
* @param string $element The wrapping element type.
|
||||
* @param string $instruction The instruction render position (label|field).
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -616,10 +616,10 @@ function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = '
|
|||
}
|
||||
|
||||
/**
|
||||
* Fires after fields have been rendered.
|
||||
* Fires after fields have been rendered.
|
||||
*
|
||||
* @date 12/02/2014
|
||||
* @since 5.0.0
|
||||
* @date 12/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $fields An array of fields.
|
||||
* @param (int|string) $post_id The post ID to load values from.
|
||||
|
|
@ -632,10 +632,10 @@ function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = '
|
|||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @param string $element The wrapping element type.
|
||||
* @param string $instruction The instruction render position (label|field).
|
||||
* @param bool $field_setting If a field setting is being rendered.
|
||||
* @param array $field The field array.
|
||||
* @param string $element The wrapping element type.
|
||||
* @param string $instruction The instruction render position (label|field).
|
||||
* @param boolean $field_setting If a field setting is being rendered.
|
||||
* @return void
|
||||
*/
|
||||
function acf_render_field_wrap( $field, $element = 'div', $instruction = 'label', $field_setting = false ) {
|
||||
|
|
@ -744,30 +744,32 @@ function acf_render_field_wrap( $field, $element = 'div', $instruction = 'label'
|
|||
$wrapper['data-conditions'] = $field['conditions'];
|
||||
}
|
||||
|
||||
// Vars for render.
|
||||
// Escaped vars for render.
|
||||
$attributes_html = acf_esc_attrs( $wrapper );
|
||||
$element = esc_attr( $element );
|
||||
$inner_element = esc_attr( $inner_element );
|
||||
|
||||
// Render HTML
|
||||
echo "<$element $attributes_html>" . "\n";
|
||||
echo "<$element $attributes_html>\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
if ( $element !== 'td' ) {
|
||||
echo "<$inner_element class=\"acf-label\">" . "\n";
|
||||
echo "<$inner_element class=\"acf-label\">\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
acf_render_field_label( $field );
|
||||
if ( $instruction == 'label' ) {
|
||||
acf_render_field_instructions( $field, $field_setting );
|
||||
}
|
||||
echo "</$inner_element>" . "\n";
|
||||
echo "</$inner_element>\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
}
|
||||
echo "<$inner_element class=\"acf-input\">" . "\n";
|
||||
echo "<$inner_element class=\"acf-input\">\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
acf_render_field( $field );
|
||||
if ( ! $field_setting && $instruction == 'field' ) {
|
||||
acf_render_field_instructions( $field );
|
||||
}
|
||||
echo "</$inner_element>" . "\n";
|
||||
echo "</$inner_element>\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
|
||||
if ( $field_setting && $instruction == 'field' ) {
|
||||
if ( $field_setting && $instruction === 'field' ) {
|
||||
acf_render_field_instructions( $field );
|
||||
}
|
||||
echo "</$element>" . "\n";
|
||||
echo "</$element>\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -838,7 +840,7 @@ function acf_render_field_label( $field ) {
|
|||
* @date 4/11/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @param array $field The field array.
|
||||
* @param string $context The output context (admin).
|
||||
* @return string The field label in HTML format.
|
||||
*/
|
||||
|
|
@ -887,13 +889,13 @@ function acf_render_field_instructions( $field, $tooltip = false ) {
|
|||
$instructions = acf_esc_html( $field['instructions'] );
|
||||
|
||||
if ( $tooltip ) {
|
||||
printf( '<div class="acf-tip"><i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="%s">?</i></div>', $instructions );
|
||||
printf( '<div class="acf-tip"><i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="%s">?</i></div>', $instructions ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
} else {
|
||||
printf( '<p class="description">%s</p>', $instructions );
|
||||
printf( '<p class="description">%s</p>', $instructions ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
}
|
||||
} elseif ( ! empty( $field['hint'] ) ) {
|
||||
$instructions = acf_esc_html( $field['hint'] );
|
||||
printf( '<p class="description">%s</p>', $instructions );
|
||||
printf( '<p class="description">%s</p>', $instructions ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -905,9 +907,9 @@ function acf_render_field_instructions( $field, $tooltip = false ) {
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @param array $setting The settings field array.
|
||||
* @param bool $global Whether this setting is a global or field type specific one.
|
||||
* @param array $field The field array.
|
||||
* @param array $setting The settings field array.
|
||||
* @param boolean $global Whether this setting is a global or field type specific one.
|
||||
* @return void
|
||||
*/
|
||||
function acf_render_field_setting( $field, $setting, $global = false ) {
|
||||
|
|
@ -971,7 +973,7 @@ function acf_render_field_setting( $field, $setting, $global = false ) {
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @param array $field The field array.
|
||||
* @param array $specific An array of specific field attributes to update.
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -1077,12 +1079,12 @@ acf_add_filter_variations( 'acf/update_field', array( 'type', 'name', 'key' ), 0
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $slug The post slug.
|
||||
* @param int $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param int $post_parent Post parent ID
|
||||
* @param string $original_slug The original post slug.
|
||||
* @param string $slug The post slug.
|
||||
* @param integer $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param integer $post_parent Post parent ID
|
||||
* @param string $original_slug The original post slug.
|
||||
*/
|
||||
function _acf_apply_unique_field_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
||||
|
||||
|
|
@ -1131,7 +1133,7 @@ function acf_flush_field_cache( $field ) {
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @return bool True if field was deleted.
|
||||
* @return boolean True if field was deleted.
|
||||
*/
|
||||
function acf_delete_field( $id = 0 ) {
|
||||
|
||||
|
|
@ -1175,7 +1177,7 @@ acf_add_action_variations( 'acf/delete_field', array( 'type', 'name', 'key' ), 0
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @return bool True if field was trashed.
|
||||
* @return boolean True if field was trashed.
|
||||
*/
|
||||
function acf_trash_field( $id = 0 ) {
|
||||
|
||||
|
|
@ -1213,7 +1215,7 @@ function acf_trash_field( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @return bool True if field was trashed.
|
||||
* @return boolean True if field was trashed.
|
||||
*/
|
||||
function acf_untrash_field( $id = 0 ) {
|
||||
|
||||
|
|
@ -1252,9 +1254,9 @@ function acf_untrash_field( $id = 0 ) {
|
|||
*
|
||||
* @since 5.9.5
|
||||
*
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param int $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param integer $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @return string.
|
||||
*/
|
||||
function _acf_untrash_field_post_status( $new_status, $post_id, $previous_status ) {
|
||||
|
|
@ -1293,7 +1295,7 @@ function acf_prefix_fields( &$fields, $prefix = 'acf' ) {
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param array $field The parent field array.
|
||||
* @return (array|false)
|
||||
*/
|
||||
|
|
@ -1334,7 +1336,7 @@ acf_add_filter_variations( 'acf/get_sub_field', array( 'type' ), 2 );
|
|||
* @date 12/2/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param array $haystack The array of fields.
|
||||
* @return (int|false)
|
||||
*/
|
||||
|
|
@ -1365,8 +1367,8 @@ function acf_search_fields( $id, $fields ) {
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @param mixed $id An optional identifier to search for.
|
||||
* @return bool
|
||||
* @param mixed $id An optional identifier to search for.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_field( $field = false, $id = '' ) {
|
||||
return (
|
||||
|
|
@ -1409,8 +1411,8 @@ function acf_get_field_ancestors( $field ) {
|
|||
* @date 16/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $fields An array of fields.
|
||||
* @param int $parent_id The new parent ID.
|
||||
* @param array $fields An array of fields.
|
||||
* @param integer $parent_id The new parent ID.
|
||||
* @return array
|
||||
*/
|
||||
function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) {
|
||||
|
|
@ -1445,9 +1447,9 @@ function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) {
|
|||
* @date 16/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param int $parent_id The new parent ID.
|
||||
* @return bool True if field was duplicated.
|
||||
* @param (int|string) $id The field ID, key or name.
|
||||
* @param integer $parent_id The new parent ID.
|
||||
* @return boolean True if field was duplicated.
|
||||
*/
|
||||
function acf_duplicate_field( $id = 0, $parent_id = 0 ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ function acf_get_field_group_post( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param string $id The identifier.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_field_group_key( $id = '' ) {
|
||||
return acf_is_internal_post_type_key( $id, 'acf-field-group' );
|
||||
|
|
@ -142,7 +142,7 @@ function acf_get_raw_field_groups() {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field_groups An array of field groups.
|
||||
* @param array $args An array of location args.
|
||||
* @param array $args An array of location args.
|
||||
* @return array
|
||||
*/
|
||||
function acf_filter_field_groups( $field_groups, $args = array() ) {
|
||||
|
|
@ -158,8 +158,8 @@ function acf_filter_field_groups( $field_groups, $args = array() ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field_groups An array of field groups.
|
||||
* @param array $args An array of location args.
|
||||
* @return bool
|
||||
* @param array $args An array of location args.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_get_field_group_visibility( $field_group, $args = array() ) {
|
||||
|
||||
|
|
@ -225,12 +225,12 @@ function acf_update_field_group( $field_group ) {
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $slug The post slug.
|
||||
* @param int $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param int $post_parent Post parent ID
|
||||
* @param string $original_slug The original post slug.
|
||||
* @param string $slug The post slug.
|
||||
* @param integer $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param integer $post_parent Post parent ID
|
||||
* @param string $original_slug The original post slug.
|
||||
*/
|
||||
function _acf_apply_unique_field_group_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ function acf_flush_field_group_cache( $field_group ) {
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param (int|string) $id The field group ID, key or name.
|
||||
* @return bool True if field group was deleted.
|
||||
* @return boolean True if field group was deleted.
|
||||
*/
|
||||
function acf_delete_field_group( $id = 0 ) {
|
||||
return acf_delete_internal_post_type( $id, 'acf-field-group' );
|
||||
|
|
@ -282,7 +282,7 @@ function acf_delete_field_group( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field group ID, key or name.
|
||||
* @return bool True if field group was trashed.
|
||||
* @return boolean True if field group was trashed.
|
||||
*/
|
||||
function acf_trash_field_group( $id = 0 ) {
|
||||
return acf_trash_internal_post_type( $id, 'acf-field-group' );
|
||||
|
|
@ -297,7 +297,7 @@ function acf_trash_field_group( $id = 0 ) {
|
|||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field_group ID, key or name.
|
||||
* @return bool True if field_group was trashed.
|
||||
* @return boolean True if field_group was trashed.
|
||||
*/
|
||||
function acf_untrash_field_group( $id = 0 ) {
|
||||
return acf_untrash_internal_post_type( $id, 'acf-field-group' );
|
||||
|
|
@ -310,9 +310,9 @@ function acf_untrash_field_group( $id = 0 ) {
|
|||
*
|
||||
* @since 5.9.5
|
||||
*
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param int $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param integer $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @return string.
|
||||
*/
|
||||
function _acf_untrash_field_group_post_status( $new_status, $post_id, $previous_status ) {
|
||||
|
|
@ -328,8 +328,8 @@ function _acf_untrash_field_group_post_status( $new_status, $post_id, $previous_
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param array $field_group The field group array.
|
||||
* @param mixed $id An optional identifier to search for.
|
||||
* @return bool
|
||||
* @param mixed $id An optional identifier to search for.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_field_group( $field_group = false ) {
|
||||
return acf_is_internal_post_type( $field_group, 'acf-field-group' );
|
||||
|
|
@ -343,8 +343,8 @@ function acf_is_field_group( $field_group = false ) {
|
|||
* @date 16/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param (int|string) $id The field_group ID, key or name.
|
||||
* @param int $new_post_id Optional post ID to override.
|
||||
* @param (int|string) $id The field_group ID, key or name.
|
||||
* @param integer $new_post_id Optional post ID to override.
|
||||
* @return array The new field group.
|
||||
*/
|
||||
function acf_duplicate_field_group( $id = 0, $new_post_id = 0 ) {
|
||||
|
|
@ -354,9 +354,9 @@ function acf_duplicate_field_group( $id = 0, $new_post_id = 0 ) {
|
|||
/**
|
||||
* Activates or deactivates a field group.
|
||||
*
|
||||
* @param int|string $id The field_group ID, key or name.
|
||||
* @param bool $activate True if the post should be activated.
|
||||
* @return bool
|
||||
* @param integer|string $id The field_group ID, key or name.
|
||||
* @param boolean $activate True if the post should be activated.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_update_field_group_active_status( $id, $activate = true ) {
|
||||
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-field-group' );
|
||||
|
|
@ -428,7 +428,7 @@ function acf_get_field_group_style( $field_group ) {
|
|||
* @date 23/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param int $post_id The field group ID.
|
||||
* @param integer $post_id The field group ID.
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_field_group_edit_link( $post_id ) {
|
||||
|
|
@ -481,14 +481,14 @@ function acf_import_field_group( $field_group ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tabs for the field group settings.
|
||||
* We combine a list of default tabs with filtered tabs.
|
||||
* I.E. Default tabs should be static and should not be changed by the
|
||||
* filtered tabs.
|
||||
* Returns an array of tabs for the field group settings.
|
||||
* We combine a list of default tabs with filtered tabs.
|
||||
* I.E. Default tabs should be static and should not be changed by the
|
||||
* filtered tabs.
|
||||
*
|
||||
* @since 6.1
|
||||
* @since 6.1
|
||||
*
|
||||
* @return array Key/value array of the default settings tabs for field group settings.
|
||||
* @return array Key/value array of the default settings tabs for field group settings.
|
||||
*/
|
||||
function acf_get_combined_field_group_settings_tabs() {
|
||||
$default_field_group_settings_tabs = array(
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@ function acf_form_data( $data = array() ) {
|
|||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param array $values An array of values to override $_POST.
|
||||
* @return bool True if save was successful.
|
||||
* @param integer|string $post_id The post id.
|
||||
* @param array $values An array of values to override $_POST.
|
||||
* @return boolean True if save was successful.
|
||||
*/
|
||||
function acf_save_post( $post_id = 0, $values = null ) {
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ function acf_save_post( $post_id = 0, $values = null ) {
|
|||
* @date 11/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param integer|string $post_id The post id.
|
||||
* @return void
|
||||
*/
|
||||
function _acf_do_save_post( $post_id = 0 ) {
|
||||
|
|
|
|||
|
|
@ -1,38 +1,32 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* acf_is_empty
|
||||
*
|
||||
/**
|
||||
* Returns true if the value provided is considered "empty". Allows numbers such as 0.
|
||||
*
|
||||
* @date 6/7/16
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param mixed $var The value to check.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_empty( $var ) {
|
||||
return ( ! $var && ! is_numeric( $var ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_not_empty
|
||||
*
|
||||
* Returns true if the value provided is considered "not empty". Allows numbers such as 0.
|
||||
*
|
||||
* @date 15/7/19
|
||||
* @since 5.8.1
|
||||
*
|
||||
* @param mixed $var The value to check.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_not_empty( $var ) {
|
||||
return ( $var || is_numeric( $var ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_uniqid
|
||||
*
|
||||
* Returns a unique numeric based id.
|
||||
*
|
||||
* @date 9/1/19
|
||||
|
|
@ -54,8 +48,6 @@ function acf_uniqid( $prefix = 'acf' ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_merge_attributes
|
||||
*
|
||||
* Merges together two arrays but with extra functionality to append class names.
|
||||
*
|
||||
* @date 22/1/19
|
||||
|
|
@ -130,7 +122,7 @@ function acf_request_args( $args = array() ) {
|
|||
* @date 23/10/20
|
||||
* @since 5.9.2
|
||||
*
|
||||
* @param string $key The property name.
|
||||
* @param string $key The property name.
|
||||
* @param mixed $default The default value to fallback to.
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -277,7 +269,7 @@ function acf_enable_filters( $filters = array() ) {
|
|||
* @since 5.7.14
|
||||
*
|
||||
* @param mixed $value A value to parse.
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
function acf_idval( $value ) {
|
||||
|
||||
|
|
@ -372,7 +364,7 @@ function acf_idify( $str = '' ) {
|
|||
* @date 24/12/17
|
||||
* @since 5.6.5
|
||||
*
|
||||
* @param string $str The string to convert.
|
||||
* @param string $str The string to convert.
|
||||
* @param string $glue The glue between each slug piece.
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -418,7 +410,7 @@ function acf_punctify( $str = '' ) {
|
|||
* @since 5.8.1
|
||||
*
|
||||
* @param string $name The name of the event.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_did( $name ) {
|
||||
|
||||
|
|
@ -446,7 +438,7 @@ function acf_did( $name ) {
|
|||
* @since 5.9.0
|
||||
*
|
||||
* @param string $str The string to review.
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
function acf_strlen( $str ) {
|
||||
return mb_strlen( str_replace( "\r\n", "\n", wp_specialchars_decode( wp_unslash( $str ) ) ) );
|
||||
|
|
@ -458,7 +450,7 @@ function acf_strlen( $str ) {
|
|||
* @date 6/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param mixed $value The value.
|
||||
* @param mixed $value The value.
|
||||
* @param mixed $default_value The default value.
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -473,7 +465,7 @@ function acf_with_default( $value, $default_value ) {
|
|||
* @since 5.9.0
|
||||
*
|
||||
* @param string $action The action name.
|
||||
* @return int|bool
|
||||
* @return integer|boolean
|
||||
*/
|
||||
function acf_doing_action( $action ) {
|
||||
global $wp_filter;
|
||||
|
|
@ -505,12 +497,12 @@ function acf_get_current_url() {
|
|||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param string $url The URL to be tagged.
|
||||
* @param string $campaign The campaign tag.
|
||||
* @param string $content The UTM content tag.
|
||||
* @param bool $anchor An optional anchor ID.
|
||||
* @param string $source An optional UTM source tag.
|
||||
* @param string $medium An optional UTM medium tag.
|
||||
* @param string $url The URL to be tagged.
|
||||
* @param string $campaign The campaign tag.
|
||||
* @param string $content The UTM content tag.
|
||||
* @param boolean $anchor An optional anchor ID.
|
||||
* @param string $source An optional UTM source tag.
|
||||
* @param string $medium An optional UTM medium tag.
|
||||
* @return string
|
||||
*/
|
||||
function acf_add_url_utm_tags( $url, $campaign, $content, $anchor = false, $source = '', $medium = '' ) {
|
||||
|
|
@ -549,7 +541,7 @@ function acf_add_url_utm_tags( $url, $campaign, $content, $anchor = false, $sour
|
|||
*
|
||||
* @param mixed $args The data to sanitize.
|
||||
*
|
||||
* @return array|bool|float|int|mixed|string
|
||||
* @return array|boolean|float|integer|mixed|string
|
||||
*/
|
||||
function acf_sanitize_request_args( $args = array() ) {
|
||||
switch ( gettype( $args ) ) {
|
||||
|
|
@ -625,7 +617,7 @@ function acf_sanitize_files_array( array $args = array() ) {
|
|||
*
|
||||
* @since 6.0.5
|
||||
*
|
||||
* @param array $array The file upload array.
|
||||
* @param array $array The file upload array.
|
||||
* @param string $sanitize_function Callback used to sanitize array value.
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ acf_register_store( 'hook-variations' );
|
|||
* @date 26/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $filter The filter name.
|
||||
* @param array $variations An array variation keys.
|
||||
* @param int $index The param index to find variation values.
|
||||
* @param string $filter The filter name.
|
||||
* @param array $variations An array variation keys.
|
||||
* @param integer $index The param index to find variation values.
|
||||
* @return void
|
||||
*/
|
||||
function acf_add_filter_variations( $filter = '', $variations = array(), $index = 0 ) {
|
||||
|
|
@ -41,9 +41,9 @@ function acf_add_filter_variations( $filter = '', $variations = array(), $index
|
|||
* @date 26/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $action The action name.
|
||||
* @param array $variations An array variation keys.
|
||||
* @param int $index The param index to find variation values.
|
||||
* @param string $action The action name.
|
||||
* @param array $variations An array variation keys.
|
||||
* @param integer $index The param index to find variation values.
|
||||
* @return void
|
||||
*/
|
||||
function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) {
|
||||
|
|
@ -129,8 +129,8 @@ acf_register_store( 'deprecated-hooks' );
|
|||
* @date 25/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $deprecated The deprecated hook.
|
||||
* @param string $version The version this hook was deprecated.
|
||||
* @param string $deprecated The deprecated hook.
|
||||
* @param string $version The version this hook was deprecated.
|
||||
* @param string $replacement The replacement hook.
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -159,8 +159,8 @@ function acf_add_deprecated_filter( $deprecated, $version, $replacement ) {
|
|||
* @date 25/1/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param string $deprecated The deprecated hook.
|
||||
* @param string $version The version this hook was deprecated.
|
||||
* @param string $deprecated The deprecated hook.
|
||||
* @param string $version The version this hook was deprecated.
|
||||
* @param string $replacement The replacement hook.
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -207,7 +207,6 @@ function _acf_apply_deprecated_hook() {
|
|||
|
||||
// Log warning.
|
||||
// _deprecated_hook( $deprecated, $version, $hook );
|
||||
|
||||
// Apply the item/do the action.
|
||||
if ( $hook['type'] === 'filter' ) {
|
||||
$args[0] = apply_filters_ref_array( $hook['deprecated'], $args );
|
||||
|
|
|
|||
|
|
@ -86,11 +86,10 @@ function acf_esc_html( $string = '' ) {
|
|||
* @date 16/4/21
|
||||
* @since 5.9.6
|
||||
*
|
||||
* @param array $tags An array of allowed tags.
|
||||
* @param array $tags An array of allowed tags.
|
||||
* @param string $context The context name.
|
||||
* @return array.
|
||||
*/
|
||||
|
||||
function _acf_kses_allowed_html( $tags, $context ) {
|
||||
global $allowedposttags;
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ add_filter( 'wp_kses_allowed_html', '_acf_kses_allowed_html', 0, 2 );
|
|||
* @return string
|
||||
*/
|
||||
function acf_hidden_input( $attrs = array() ) {
|
||||
echo acf_get_hidden_input( $attrs );
|
||||
echo acf_get_hidden_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -159,7 +158,7 @@ function acf_get_hidden_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_text_input( $attrs = array() ) {
|
||||
echo acf_get_text_input( $attrs );
|
||||
echo acf_get_text_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +197,7 @@ function acf_get_text_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_file_input( $attrs = array() ) {
|
||||
echo acf_get_file_input( $attrs );
|
||||
echo acf_get_file_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -263,7 +262,7 @@ function acf_get_file_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_textarea_input( $attrs = array() ) {
|
||||
echo acf_get_textarea_input( $attrs );
|
||||
echo acf_get_textarea_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -298,7 +297,7 @@ function acf_get_textarea_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_checkbox_input( $attrs = array() ) {
|
||||
echo acf_get_checkbox_input( $attrs );
|
||||
echo acf_get_checkbox_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -331,7 +330,7 @@ function acf_get_checkbox_input( $attrs = array() ) {
|
|||
|
||||
// Render.
|
||||
$checked = isset( $attrs['checked'] );
|
||||
return '<label' . ( $checked ? ' class="selected"' : '' ) . '><input ' . acf_esc_attr( $attrs ) . '/> ' . acf_esc_html( $label ) . '</label>';
|
||||
return '<label' . ( $checked ? ' class="selected"' : '' ) . '><input ' . acf_esc_attrs( $attrs ) . '/> ' . acf_esc_html( $label ) . '</label>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -346,7 +345,7 @@ function acf_get_checkbox_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_radio_input( $attrs = array() ) {
|
||||
echo acf_get_radio_input( $attrs );
|
||||
echo acf_get_radio_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -377,7 +376,7 @@ function acf_get_radio_input( $attrs = array() ) {
|
|||
* @return string
|
||||
*/
|
||||
function acf_select_input( $attrs = array() ) {
|
||||
echo acf_get_select_input( $attrs );
|
||||
echo acf_get_select_input( $attrs ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by input generation function.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -410,8 +409,8 @@ function acf_get_select_input( $attrs = array() ) {
|
|||
* @since 5.6.0
|
||||
*
|
||||
* @param array $choices The choices to walk through.
|
||||
* @param array $values The selected choices.
|
||||
* @param array $depth The current walk depth.
|
||||
* @param array $values The selected choices.
|
||||
* @param array $depth The current walk depth.
|
||||
* @return string
|
||||
*/
|
||||
function acf_walk_select_input( $choices = array(), $values = array(), $depth = 0 ) {
|
||||
|
|
@ -446,7 +445,7 @@ function acf_walk_select_input( $choices = array(), $values = array(), $depth =
|
|||
$attrs['selected'] = 'selected';
|
||||
$attrs['data-i'] = $pos;
|
||||
}
|
||||
$html .= sprintf( '<option %s>%s</option>', acf_esc_attr( $attrs ), esc_html( $label ) );
|
||||
$html .= sprintf( '<option %s>%s</option>', acf_esc_attrs( $attrs ), esc_html( $label ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -486,11 +485,10 @@ function acf_esc_atts( $attrs ) {
|
|||
/**
|
||||
* acf_esc_attr
|
||||
*
|
||||
* See acf_esc_attrs().
|
||||
*
|
||||
* @date 13/6/19
|
||||
* @since 5.8.1
|
||||
* @deprecated 5.6.0
|
||||
* @see acf_esc_attrs().
|
||||
*
|
||||
* @param array $attrs The array of attrs.
|
||||
* @return string
|
||||
|
|
@ -509,7 +507,6 @@ function acf_esc_attr( $attrs ) {
|
|||
* @deprecated 5.6.0
|
||||
*
|
||||
* @param array $attrs The array of attrs.
|
||||
* @return string
|
||||
*/
|
||||
function acf_esc_attr_e( $attrs ) {
|
||||
echo acf_esc_attrs( $attrs );
|
||||
|
|
@ -525,7 +522,6 @@ function acf_esc_attr_e( $attrs ) {
|
|||
* @deprecated 5.6.0
|
||||
*
|
||||
* @param array $attrs The array of attrs.
|
||||
* @return string
|
||||
*/
|
||||
function acf_esc_atts_e( $attrs ) {
|
||||
echo acf_esc_attrs( $attrs );
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ function acf_get_internal_post_type_instance( $post_type = 'acf-field-group' ) {
|
|||
/**
|
||||
* Get an ACF CPT object as an array
|
||||
*
|
||||
* @param int $id The post ID being queried.
|
||||
* @param string $post_type The post type being queried.
|
||||
* @param integer $id The post ID being queried.
|
||||
* @param string $post_type The post type being queried.
|
||||
* @return array|false The post type object.
|
||||
*/
|
||||
function acf_get_internal_post_type( $id, $post_type ) {
|
||||
|
|
@ -47,8 +47,8 @@ function acf_get_internal_post_type( $id, $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID.
|
||||
* @param string $post_type The post type name.
|
||||
* @param integer|string $id The post ID.
|
||||
* @param string $post_type The post type name.
|
||||
* @return array|false The internal post type array.
|
||||
*/
|
||||
function acf_get_raw_internal_post_type( $id, $post_type ) {
|
||||
|
|
@ -66,9 +66,9 @@ function acf_get_raw_internal_post_type( $id, $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID, key, or name.
|
||||
* @param string $post_type The post type name.
|
||||
* @return object|bool The post object, or false on failure.
|
||||
* @param integer|string $id The post ID, key, or name.
|
||||
* @param string $post_type The post type name.
|
||||
* @return object|boolean The post object, or false on failure.
|
||||
*/
|
||||
function acf_get_internal_post_type_post( $id, $post_type ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -87,7 +87,7 @@ function acf_get_internal_post_type_post( $id, $post_type ) {
|
|||
*
|
||||
* @param string $id The identifier.
|
||||
* @param string $post_type The ACF post type the key is for.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_internal_post_type_key( $id = '', $post_type = 'acf-field-group' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -105,7 +105,7 @@ function acf_is_internal_post_type_key( $id = '', $post_type = 'acf-field-group'
|
|||
*
|
||||
* @param array $internal_post_type The internal post type array.
|
||||
* @param string $post_type_name The post type name.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_validate_internal_post_type( $internal_post_type, $post_type_name ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type_name );
|
||||
|
|
@ -237,9 +237,9 @@ function acf_flush_internal_post_type_cache( $post, $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The internal post type ID, key or name.
|
||||
* @param string $post_type_name The post type to be deleted.
|
||||
* @return bool True if field group was deleted.
|
||||
* @param integer|string $id The internal post type ID, key or name.
|
||||
* @param string $post_type_name The post type to be deleted.
|
||||
* @return boolean True if field group was deleted.
|
||||
*/
|
||||
function acf_delete_internal_post_type( $id = 0, $post_type_name = '' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type_name );
|
||||
|
|
@ -256,9 +256,9 @@ function acf_delete_internal_post_type( $id = 0, $post_type_name = '' ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The internal post type ID, key, or name.
|
||||
* @param string $post_type_name The post type being trashed.
|
||||
* @return bool True if post was trashed.
|
||||
* @param integer|string $id The internal post type ID, key, or name.
|
||||
* @param string $post_type_name The post type being trashed.
|
||||
* @return boolean True if post was trashed.
|
||||
*/
|
||||
function acf_trash_internal_post_type( $id = 0, $post_type_name = '' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type_name );
|
||||
|
|
@ -275,9 +275,9 @@ function acf_trash_internal_post_type( $id = 0, $post_type_name = '' ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The internal post type ID, key, or name.
|
||||
* @param string $post_type_name The post type being untrashed.
|
||||
* @return bool True if post was untrashed.
|
||||
* @param integer|string $id The internal post type ID, key, or name.
|
||||
* @param string $post_type_name The post type being untrashed.
|
||||
* @return boolean True if post was untrashed.
|
||||
*/
|
||||
function acf_untrash_internal_post_type( $id = 0, $post_type_name = '' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type_name );
|
||||
|
|
@ -296,7 +296,7 @@ function acf_untrash_internal_post_type( $id = 0, $post_type_name = '' ) {
|
|||
*
|
||||
* @param array $post The ACF post array.
|
||||
* @param string $post_type The ACF post type.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_internal_post_type( $post, $post_type ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -313,10 +313,10 @@ function acf_is_internal_post_type( $post, $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The field_group ID, key or name.
|
||||
* @param int $new_post_id Optional ID to override.
|
||||
* @param string $post_type The post type of the post being duplicated.
|
||||
* @return array|bool The new ACF post, or false on failure.
|
||||
* @param integer|string $id The field_group ID, key or name.
|
||||
* @param integer $new_post_id Optional ID to override.
|
||||
* @param string $post_type The post type of the post being duplicated.
|
||||
* @return array|boolean The new ACF post, or false on failure.
|
||||
*/
|
||||
function acf_duplicate_internal_post_type( $id = 0, $new_post_id = 0, $post_type = 'acf-field-group' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -331,10 +331,10 @@ function acf_duplicate_internal_post_type( $id = 0, $new_post_id = 0, $post_type
|
|||
/**
|
||||
* Activates or deactivates an ACF post.
|
||||
*
|
||||
* @param int|string $id The field_group ID, key or name.
|
||||
* @param bool $activate True if the post should be activated.
|
||||
* @param string $post_type The post type being activated/deactivated.
|
||||
* @return bool
|
||||
* @param integer|string $id The field_group ID, key or name.
|
||||
* @param boolean $activate True if the post should be activated.
|
||||
* @param string $post_type The post type being activated/deactivated.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_update_internal_post_type_active_status( $id, $activate = true, $post_type = 'acf-field-group' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -351,8 +351,8 @@ function acf_update_internal_post_type_active_status( $id, $activate = true, $po
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int $post_id The ACF post ID.
|
||||
* @param string $post_type The ACF post type to get the edit link for.
|
||||
* @param integer $post_id The ACF post ID.
|
||||
* @param string $post_type The ACF post type to get the edit link for.
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_internal_post_type_edit_link( $post_id, $post_type ) {
|
||||
|
|
@ -391,7 +391,7 @@ function acf_prepare_internal_post_type_for_export( $post = array(), $post_type
|
|||
*
|
||||
* @param array $post The ACF post array.
|
||||
* @param string $post_type The post type of the ACF post being exported.
|
||||
* @return string|bool
|
||||
* @return string|boolean
|
||||
*/
|
||||
function acf_export_internal_post_type_as_php( $post, $post_type = 'acf-field-group' ) {
|
||||
$instance = acf_get_internal_post_type_instance( $post_type );
|
||||
|
|
@ -445,7 +445,7 @@ function acf_import_internal_post_type( $post, $post_type ) {
|
|||
* Tries to determine the ACF post type for the provided key.
|
||||
*
|
||||
* @param string $key The key to check.
|
||||
* @return string|bool
|
||||
* @return string|boolean
|
||||
*/
|
||||
function acf_determine_internal_post_type( $key ) {
|
||||
$store = acf_get_store( 'internal-post-types' );
|
||||
|
|
@ -623,7 +623,7 @@ function acf_add_internal_post_type_validation_error( $name, $message = '', $pos
|
|||
* @since 6.1.5
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_get_post_type_from_request_args( $action = '' ) {
|
||||
$acf_use_post_type = (int) acf_request_arg( 'use_post_type', 0 );
|
||||
|
|
@ -641,7 +641,7 @@ function acf_get_post_type_from_request_args( $action = '' ) {
|
|||
* @since 6.1.5
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_get_taxonomy_from_request_args( $action = '' ) {
|
||||
$acf_use_taxonomy = (int) acf_request_arg( 'use_taxonomy', 0 );
|
||||
|
|
@ -659,7 +659,7 @@ function acf_get_taxonomy_from_request_args( $action = '' ) {
|
|||
* @since 6.2
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_get_ui_options_page_from_request_args( $action = '' ) {
|
||||
$acf_use_options_page = (int) acf_request_arg( 'use_options_page', 0 );
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@ function acf_get_option_meta( $prefix = '' ) {
|
|||
* @date 16/10/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param bool $hidden If the meta is hidden (starts with an underscore).
|
||||
* @param integer|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param boolean $hidden If the meta is hidden (starts with an underscore).
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -159,12 +159,12 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
|
|||
* @date 16/10/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param mixed $value The meta value.
|
||||
* @param bool $hidden If the meta is hidden (starts with an underscore).
|
||||
* @param integer|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param mixed $value The meta value.
|
||||
* @param boolean $hidden If the meta is hidden (starts with an underscore).
|
||||
*
|
||||
* @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
|
||||
* @return integer|boolean Meta ID if the key didn't exist, true on successful update, false on failure.
|
||||
*/
|
||||
function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = false ) {
|
||||
// Allow filter to short-circuit logic.
|
||||
|
|
@ -204,11 +204,11 @@ function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = f
|
|||
* @date 16/10/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param bool $hidden If the meta is hidden (starts with an underscore).
|
||||
* @param integer|string $post_id The post id.
|
||||
* @param string $name The meta name.
|
||||
* @param boolean $hidden If the meta is hidden (starts with an underscore).
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
|
||||
// Allow filter to short-circuit logic.
|
||||
|
|
@ -249,7 +249,7 @@ function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
|
|||
* @since 5.3.8
|
||||
*
|
||||
* @param (int|string) $from_post_id The post id to copy from.
|
||||
* @param (int|string) $to_post_id The post id to paste to.
|
||||
* @param (int|string) $to_post_id The post id to paste to.
|
||||
* @return void
|
||||
*/
|
||||
function acf_copy_metadata( $from_post_id = 0, $to_post_id = 0 ) {
|
||||
|
|
@ -279,8 +279,8 @@ function acf_copy_metadata( $from_post_id = 0, $to_post_id = 0 ) {
|
|||
* @since 5.3.8
|
||||
* @deprecated 5.7.11
|
||||
*
|
||||
* @param int $from_post_id The post id to copy from.
|
||||
* @param int $to_post_id The post id to paste to.
|
||||
* @param integer $from_post_id The post id to copy from.
|
||||
* @param integer $to_post_id The post id to paste to.
|
||||
* @return void
|
||||
*/
|
||||
function acf_copy_postmeta( $from_post_id = 0, $to_post_id = 0 ) {
|
||||
|
|
@ -296,7 +296,7 @@ function acf_copy_postmeta( $from_post_id = 0, $to_post_id = 0 ) {
|
|||
* @date 21/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $key The meta name (field name).
|
||||
* @param string $key The meta name (field name).
|
||||
* @param (int|string) $post_id The post_id where this field's value is saved.
|
||||
* @return (array|false) The field array.
|
||||
*/
|
||||
|
|
@ -327,7 +327,7 @@ function acf_get_meta_field( $key = 0, $post_id = 0 ) {
|
|||
*
|
||||
* @param (int|string) $post_id The post id.
|
||||
* @param string type The reference type (fields|groups).
|
||||
* @param string $name An optional specific name
|
||||
* @param string $name An optional specific name
|
||||
* @return mixed
|
||||
*/
|
||||
function acf_get_metaref( $post_id = 0, $type = 'fields', $name = '' ) {
|
||||
|
|
@ -358,7 +358,7 @@ function acf_get_metaref( $post_id = 0, $type = 'fields', $name = '' ) {
|
|||
* @date 16/10/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param (int|string) $post_id The post id.
|
||||
* @param (int|string) $post_id The post id.
|
||||
* @param string type The reference type (fields|groups).
|
||||
* @param array $references An array of references.
|
||||
* @return (int|bool) Meta ID if the key didn't exist, true on successful update, false on failure.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* Get an ACF CPT as an array
|
||||
*
|
||||
* @param int|string $id The post ID being queried.
|
||||
* @param integer|string $id The post ID being queried.
|
||||
* @return array|false The post type object.
|
||||
*/
|
||||
function acf_get_post_type( $id ) {
|
||||
|
|
@ -20,7 +20,7 @@ function acf_get_post_type( $id ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID.
|
||||
* @param integer|string $id The post ID.
|
||||
* @return array|false The internal post type array.
|
||||
*/
|
||||
function acf_get_raw_post_type( $id ) {
|
||||
|
|
@ -32,8 +32,8 @@ function acf_get_raw_post_type( $id ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID, key, or name.
|
||||
* @return object|bool The post object, or false on failure.
|
||||
* @param integer|string $id The post ID, key, or name.
|
||||
* @return object|boolean The post object, or false on failure.
|
||||
*/
|
||||
function acf_get_post_type_post( $id ) {
|
||||
return acf_get_internal_post_type_post( $id, 'acf-post-type' );
|
||||
|
|
@ -45,7 +45,7 @@ function acf_get_post_type_post( $id ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param string $id The identifier.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_post_type_key( $id ) {
|
||||
return acf_is_internal_post_type_key( $id, 'acf-post-type' );
|
||||
|
|
@ -57,7 +57,7 @@ function acf_is_post_type_key( $id ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $post_type The ACF post type array.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_validate_post_type( array $post_type = array() ) {
|
||||
return acf_validate_internal_post_type( $post_type, 'acf-post-type' );
|
||||
|
|
@ -140,8 +140,8 @@ function acf_flush_post_type_cache( array $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ACF post type ID, key or name.
|
||||
* @return bool True if post type was deleted.
|
||||
* @param integer|string $id The ACF post type ID, key or name.
|
||||
* @return boolean True if post type was deleted.
|
||||
*/
|
||||
function acf_delete_post_type( $id = 0 ) {
|
||||
return acf_delete_internal_post_type( $id, 'acf-post-type' );
|
||||
|
|
@ -152,8 +152,8 @@ function acf_delete_post_type( $id = 0 ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post type ID, key, or name.
|
||||
* @return bool True if post was trashed.
|
||||
* @param integer|string $id The post type ID, key, or name.
|
||||
* @return boolean True if post was trashed.
|
||||
*/
|
||||
function acf_trash_post_type( $id = 0 ) {
|
||||
return acf_trash_internal_post_type( $id, 'acf-post-type' );
|
||||
|
|
@ -164,8 +164,8 @@ function acf_trash_post_type( $id = 0 ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post type ID, key, or name.
|
||||
* @return bool True if post was untrashed.
|
||||
* @param integer|string $id The post type ID, key, or name.
|
||||
* @return boolean True if post was untrashed.
|
||||
*/
|
||||
function acf_untrash_post_type( $id = 0 ) {
|
||||
return acf_untrash_internal_post_type( $id, 'acf-post-type' );
|
||||
|
|
@ -177,7 +177,7 @@ function acf_untrash_post_type( $id = 0 ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $post_type The ACF post type array.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_post_type( $post_type ) {
|
||||
return acf_is_internal_post_type( $post_type, 'acf-post-type' );
|
||||
|
|
@ -188,9 +188,9 @@ function acf_is_post_type( $post_type ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ACF post type ID, key or name.
|
||||
* @param int $new_post_id Optional ID to override.
|
||||
* @return array|bool The new ACF post type, or false on failure.
|
||||
* @param integer|string $id The ACF post type ID, key or name.
|
||||
* @param integer $new_post_id Optional ID to override.
|
||||
* @return array|boolean The new ACF post type, or false on failure.
|
||||
*/
|
||||
function acf_duplicate_post_type( $id = 0, $new_post_id = 0 ) {
|
||||
return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-post-type' );
|
||||
|
|
@ -199,9 +199,9 @@ function acf_duplicate_post_type( $id = 0, $new_post_id = 0 ) {
|
|||
/**
|
||||
* Activates or deactivates an ACF post type.
|
||||
*
|
||||
* @param int|string $id The ACF post type ID, key or name.
|
||||
* @param bool $activate True if the post type should be activated.
|
||||
* @return bool
|
||||
* @param integer|string $id The ACF post type ID, key or name.
|
||||
* @param boolean $activate True if the post type should be activated.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_update_post_type_active_status( $id, $activate = true ) {
|
||||
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-post-type' );
|
||||
|
|
@ -212,7 +212,7 @@ function acf_update_post_type_active_status( $id, $activate = true ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int $post_id The ACF post type ID.
|
||||
* @param integer $post_id The ACF post type ID.
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_post_type_edit_link( $post_id ) {
|
||||
|
|
@ -237,7 +237,7 @@ function acf_prepare_post_type_for_export( array $post_type = array() ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $post_type The ACF post type array.
|
||||
* @return string|bool
|
||||
* @return string|boolean
|
||||
*/
|
||||
function acf_export_post_type_as_php( array $post_type ) {
|
||||
return acf_export_internal_post_type_as_php( $post_type, 'acf-post-type' );
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* Get an ACF taxonomy as an array
|
||||
*
|
||||
* @param int|string $id The post ID being queried.
|
||||
* @param integer|string $id The post ID being queried.
|
||||
* @return array|false The taxonomy object.
|
||||
*/
|
||||
function acf_get_taxonomy( $id ) {
|
||||
|
|
@ -20,7 +20,7 @@ function acf_get_taxonomy( $id ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID.
|
||||
* @param integer|string $id The post ID.
|
||||
* @return array|false The taxonomy array.
|
||||
*/
|
||||
function acf_get_raw_taxonomy( $id ) {
|
||||
|
|
@ -32,8 +32,8 @@ function acf_get_raw_taxonomy( $id ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID, key, or name.
|
||||
* @return object|bool The post object, or false on failure.
|
||||
* @param integer|string $id The post ID, key, or name.
|
||||
* @return object|boolean The post object, or false on failure.
|
||||
*/
|
||||
function acf_get_taxonomy_post( $id ) {
|
||||
return acf_get_internal_post_type_post( $id, 'acf-taxonomy' );
|
||||
|
|
@ -45,7 +45,7 @@ function acf_get_taxonomy_post( $id ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param string $id The identifier.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_taxonomy_key( $id ) {
|
||||
return acf_is_internal_post_type_key( $id, 'acf-taxonomy' );
|
||||
|
|
@ -57,7 +57,7 @@ function acf_is_taxonomy_key( $id ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $taxonomy The ACF taxonomy array.
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
function acf_validate_taxonomy( array $taxonomy = array() ) {
|
||||
return acf_validate_internal_post_type( $taxonomy, 'acf-taxonomy' );
|
||||
|
|
@ -140,8 +140,8 @@ function acf_flush_taxonomy_cache( array $taxonomy ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ACF taxonomy ID, key or name.
|
||||
* @return bool True if taxonomy was deleted.
|
||||
* @param integer|string $id The ACF taxonomy ID, key or name.
|
||||
* @return boolean True if taxonomy was deleted.
|
||||
*/
|
||||
function acf_delete_taxonomy( $id = 0 ) {
|
||||
return acf_delete_internal_post_type( $id, 'acf-taxonomy' );
|
||||
|
|
@ -152,8 +152,8 @@ function acf_delete_taxonomy( $id = 0 ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The taxonomy ID, key, or name.
|
||||
* @return bool True if taxonomy was trashed.
|
||||
* @param integer|string $id The taxonomy ID, key, or name.
|
||||
* @return boolean True if taxonomy was trashed.
|
||||
*/
|
||||
function acf_trash_taxonomy( $id = 0 ) {
|
||||
return acf_trash_internal_post_type( $id, 'acf-taxonomy' );
|
||||
|
|
@ -164,8 +164,8 @@ function acf_trash_taxonomy( $id = 0 ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The taxonomy ID, key, or name.
|
||||
* @return bool True if taxonomy was untrashed.
|
||||
* @param integer|string $id The taxonomy ID, key, or name.
|
||||
* @return boolean True if taxonomy was untrashed.
|
||||
*/
|
||||
function acf_untrash_taxonomy( $id = 0 ) {
|
||||
return acf_untrash_internal_post_type( $id, 'acf-taxonomy' );
|
||||
|
|
@ -177,7 +177,7 @@ function acf_untrash_taxonomy( $id = 0 ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $taxonomy The ACF taxonomy array.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_is_taxonomy( $taxonomy ) {
|
||||
return acf_is_internal_post_type( $taxonomy, 'acf-taxonomy' );
|
||||
|
|
@ -188,9 +188,9 @@ function acf_is_taxonomy( $taxonomy ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ACF taxonomy ID, key or name.
|
||||
* @param int $new_post_id Optional ID to override.
|
||||
* @return array|bool The new ACF taxonomy, or false on failure.
|
||||
* @param integer|string $id The ACF taxonomy ID, key or name.
|
||||
* @param integer $new_post_id Optional ID to override.
|
||||
* @return array|boolean The new ACF taxonomy, or false on failure.
|
||||
*/
|
||||
function acf_duplicate_taxonomy( $id = 0, $new_post_id = 0 ) {
|
||||
return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-taxonomy' );
|
||||
|
|
@ -199,9 +199,9 @@ function acf_duplicate_taxonomy( $id = 0, $new_post_id = 0 ) {
|
|||
/**
|
||||
* Activates or deactivates an ACF taxonomy.
|
||||
*
|
||||
* @param int|string $id The ACF taxonomy ID, key or name.
|
||||
* @param bool $activate True if the taxonomy should be activated.
|
||||
* @return bool
|
||||
* @param integer|string $id The ACF taxonomy ID, key or name.
|
||||
* @param boolean $activate True if the taxonomy should be activated.
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_update_taxonomy_active_status( $id, $activate = true ) {
|
||||
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-taxonomy' );
|
||||
|
|
@ -212,7 +212,7 @@ function acf_update_taxonomy_active_status( $id, $activate = true ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int $post_id The ACF taxonomy ID.
|
||||
* @param integer $post_id The ACF taxonomy ID.
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_taxonomy_edit_link( $post_id ) {
|
||||
|
|
@ -237,7 +237,7 @@ function acf_prepare_taxonomy_for_export( array $taxonomy = array() ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $taxonomy The ACF taxonomy array.
|
||||
* @return string|bool
|
||||
* @return string|boolean
|
||||
*/
|
||||
function acf_export_taxonomy_as_php( array $taxonomy ) {
|
||||
return acf_export_internal_post_type_as_php( $taxonomy, 'acf-taxonomy' );
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ function acf_get_user_role_labels( $roles = array() ) {
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_allow_unfiltered_html() {
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ function acf_get_store( $name = '' ) {
|
|||
* @date 13/2/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param int $site_id New blog ID.
|
||||
* @param integer $site_id New blog ID.
|
||||
* @param int prev_blog_id Prev blog ID.
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -137,9 +137,7 @@ function acf_get_url( $filename = '' ) {
|
|||
return ACF_URL . ltrim( $filename, '/' );
|
||||
}
|
||||
|
||||
/*
|
||||
* acf_include
|
||||
*
|
||||
/**
|
||||
* Includes a file within the ACF plugin.
|
||||
*
|
||||
* @date 10/3/14
|
||||
|
|
|
|||
|
|
@ -372,10 +372,11 @@ function acf_log_invalid_field_notice( $field, $function ) {
|
|||
}
|
||||
|
||||
$error_text = sprintf(
|
||||
/* translators: %1 plugin name, %2 the URL to the documentation on this error */
|
||||
__( '<strong>%1$s</strong> - We\'ve detected one or more calls to retrieve ACF field values before ACF has been initialized. This is not supported and can result in malformed or missing data. <a href="%2$s" target="_blank">Learn how to fix this</a>.', 'acf' ),
|
||||
acf_get_setting( 'name' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/acf-field-functions/', 'docs', 'early_init_warning' )
|
||||
);
|
||||
_doing_it_wrong( $function, $error_text, '5.11.1' );
|
||||
_doing_it_wrong( esc_html( $function ), acf_esc_html( $error_text ), '5.11.1' );
|
||||
}
|
||||
add_action( 'acf/get_invalid_field_value', 'acf_log_invalid_field_notice', 10, 2 );
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* @date 1/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $object_type The object type (post, term, user, etc).
|
||||
* @param string $object_type The object type (post, term, user, etc).
|
||||
* @param string $object_subtype Optional object subtype (post type, taxonomy).
|
||||
* @return object
|
||||
*/
|
||||
|
|
@ -242,7 +242,7 @@ function acf_get_object_type_rest_base( $type_object ) {
|
|||
* load_fields() callbacks.
|
||||
*
|
||||
* @param WP_Post|WP_User|WP_Term|WP_Comment|array $object
|
||||
* @return int|mixed|null
|
||||
* @return integer|mixed|null
|
||||
*/
|
||||
function acf_get_object_id( $object ) {
|
||||
if ( is_object( $object ) ) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* If this is a pro feature or not.
|
||||
*
|
||||
* @var bool
|
||||
* @var boolean
|
||||
*/
|
||||
public $is_pro_feature = false;
|
||||
|
||||
|
|
@ -114,10 +114,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Constructor for all ACF internal post type admin list pages.
|
||||
*
|
||||
* @date 21/07/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function current_screen() {
|
||||
// Bail early if not the list admin page.
|
||||
|
|
@ -163,10 +160,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Sets up the field groups ready for sync.
|
||||
*
|
||||
* @date 17/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup_sync() {
|
||||
// Review local json files.
|
||||
|
|
@ -204,10 +198,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Enqueues admin scripts.
|
||||
*
|
||||
* @date 18/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
acf_enqueue_script( 'acf' );
|
||||
|
|
@ -243,9 +234,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Returns the disabled post state HTML.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function get_disabled_post_state() {
|
||||
return '<span class="dashicons dashicons-hidden"></span> ' . _x( 'Inactive', 'post status', 'acf' );
|
||||
|
|
@ -254,9 +245,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Returns the registration error state.
|
||||
*
|
||||
* @since 6.1
|
||||
* @since 6.1
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function get_registration_error_state() {
|
||||
return '<span class="acf-js-tooltip dashicons dashicons-warning" title="' .
|
||||
|
|
@ -297,7 +288,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Get the HTML for when there are no post objects found.
|
||||
*
|
||||
* @since 6.0.0
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -334,8 +325,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
* @date 1/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $column_name The name of the column to display.
|
||||
* @param int $post_id The current post ID.
|
||||
* @param string $column_name The name of the column to display.
|
||||
* @param integer $post_id The current post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function admin_table_columns_html( $column_name, $post_id ) {
|
||||
|
|
@ -398,22 +389,22 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
if ( isset( $json[ $post['key'] ] ) ) {
|
||||
if ( isset( $this->sync[ $post['key'] ] ) ) {
|
||||
$url = $this->get_admin_url( '&acfsync=' . $post['key'] . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
|
||||
echo '<strong>' . __( 'Sync available', 'acf' ) . '</strong>';
|
||||
echo '<strong>' . esc_html__( 'Sync available', 'acf' ) . '</strong>';
|
||||
if ( $post['ID'] ) {
|
||||
echo '<div class="row-actions">
|
||||
<span class="sync"><a href="' . esc_url( $url ) . '">' . __( 'Sync', 'acf' ) . '</a> | </span>
|
||||
<span class="review"><a href="#" data-event="review-sync" data-id="' . esc_attr( $post['ID'] ) . '" data-href="' . esc_url( $url ) . '">' . __( 'Review changes', 'acf' ) . '</a></span>
|
||||
<span class="sync"><a href="' . esc_url( $url ) . '">' . esc_html__( 'Sync', 'acf' ) . '</a> | </span>
|
||||
<span class="review"><a href="#" data-event="review-sync" data-id="' . esc_attr( $post['ID'] ) . '" data-href="' . esc_url( $url ) . '">' . esc_html__( 'Review changes', 'acf' ) . '</a></span>
|
||||
</div>';
|
||||
} else {
|
||||
echo '<div class="row-actions">
|
||||
<span class="sync"><a href="' . esc_url( $url ) . '">' . __( 'Import', 'acf' ) . '</a></span>
|
||||
<span class="sync"><a href="' . esc_url( $url ) . '">' . esc_html__( 'Import', 'acf' ) . '</a></span>
|
||||
</div>';
|
||||
}
|
||||
} else {
|
||||
echo __( 'Saved', 'acf' );
|
||||
echo esc_html__( 'Saved', 'acf' );
|
||||
}
|
||||
} else {
|
||||
echo '<span class="acf-secondary-text">' . __( 'Awaiting save', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-secondary-text">' . esc_html__( 'Awaiting save', 'acf' ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +415,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
* @since 5.9.0
|
||||
*
|
||||
* @param array $actions The array of actions HTML.
|
||||
* @param WP_Post $post The post.
|
||||
* @param WP_Post $post The post.
|
||||
* @return array
|
||||
*/
|
||||
public function page_row_actions( $actions, $post ) {
|
||||
|
|
@ -496,8 +487,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @param int $count The number of items the action was performed on.
|
||||
* @param string $action The action being performed.
|
||||
* @param integer $count The number of items the action was performed on.
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_notice_text( $action, $count = 1 ) {
|
||||
|
|
@ -609,10 +600,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Checks for the custom "duplicate" action.
|
||||
*
|
||||
* @date 15/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check_duplicate() {
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Used for redirect notice.
|
||||
|
|
@ -662,10 +650,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Checks for the custom "acfsync" action.
|
||||
*
|
||||
* @date 15/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check_sync() {
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
|
|
@ -769,10 +754,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Prints scripts into the admin footer.
|
||||
*
|
||||
* @date 20/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_footer() {
|
||||
?>
|
||||
|
|
@ -821,10 +803,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Customizes the admin table HTML when viewing "sync" post_status.
|
||||
*
|
||||
* @date 17/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_footer__sync() {
|
||||
global $wp_list_table;
|
||||
|
|
@ -853,12 +832,22 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
if ( in_array( $column_name, $hidden, true ) ) {
|
||||
$classes .= ' hidden';
|
||||
}
|
||||
echo "<$el class=\"$classes\" data-colname=\"$column_label\">";
|
||||
|
||||
printf(
|
||||
'<%s class="%s" data-colname="%s">',
|
||||
esc_attr( $el ),
|
||||
esc_attr( $classes ),
|
||||
esc_attr( $column_label )
|
||||
);
|
||||
|
||||
switch ( $column_name ) {
|
||||
|
||||
// Checkbox.
|
||||
case 'cb':
|
||||
echo '<label for="cb-select-' . esc_attr( $k ) . '" class="screen-reader-text">' . esc_html( sprintf( __( 'Select %s', 'acf' ), $field_group['title'] ) ) . '</label>';
|
||||
echo '<label for="cb-select-' . esc_attr( $k ) . '" class="screen-reader-text">';
|
||||
/* translators: %s: field group title */
|
||||
echo esc_html( sprintf( __( 'Select %s', 'acf' ), $field_group['title'] ) );
|
||||
echo '</label>';
|
||||
echo '<input id="cb-select-' . esc_attr( $k ) . '" type="checkbox" value="' . esc_attr( $k ) . '" name="post[]">';
|
||||
break;
|
||||
|
||||
|
|
@ -868,8 +857,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
if ( ! $field_group['active'] ) {
|
||||
$post_state = ' — <span class="post-state">' . $this->get_disabled_post_state() . '</span>';
|
||||
}
|
||||
echo '<strong><span class="row-title">' . esc_html( $field_group['title'] ) . '</span>' . $post_state . '</strong>';
|
||||
echo '<div class="row-actions"><span class="file acf-secondary-text">' . $this->get_human_readable_file_location( $field_group['local_file'] ) . '</span></div>';
|
||||
echo '<strong><span class="row-title">' . esc_html( $field_group['title'] ) . '</span>' . acf_esc_html( $post_state ) . '</strong>';
|
||||
echo '<div class="row-actions"><span class="file acf-secondary-text">' . esc_html( $this->get_human_readable_file_location( $field_group['local_file'] ) ) . '</span></div>';
|
||||
echo '<button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button>';
|
||||
break;
|
||||
|
||||
|
|
@ -878,7 +867,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
$this->render_admin_table_column( $column_name, $field_group );
|
||||
break;
|
||||
}
|
||||
echo "</$el>";
|
||||
|
||||
printf( '</%s>', esc_attr( $el ) );
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
|
|
@ -897,11 +887,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
/**
|
||||
* Fires when trashing an internal post type.
|
||||
*
|
||||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @return void
|
||||
* @param integer $post_id The post ID.
|
||||
*/
|
||||
public function trashed_post( $post_id ) {
|
||||
if ( get_post_type( $post_id ) === $this->post_type ) {
|
||||
|
|
@ -915,7 +903,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function untrashed_post( $post_id ) {
|
||||
|
|
@ -930,7 +918,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
|
|||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function deleted_post( $post_id ) {
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
|
||||
* @param string $post_type The post type being checked.
|
||||
* @return bool
|
||||
* @param boolean $use_block_editor Whether the post type can be edited or not. Default true.
|
||||
* @param string $post_type The post type being checked.
|
||||
* @return boolean
|
||||
*/
|
||||
public function use_block_editor_for_post_type( $use_block_editor, $post_type ) {
|
||||
if ( $post_type === $this->post_type ) {
|
||||
|
|
@ -82,8 +82,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
* This function is fired when loading the admin page before HTML has been rendered.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function current_screen() {
|
||||
if ( ! acf_is_screen( $this->post_type ) ) {
|
||||
|
|
@ -118,8 +116,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
* Enqueues any scripts necessary for internal post type.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
wp_enqueue_script( 'acf-internal-post-type' );
|
||||
|
|
@ -133,8 +129,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
* Set up functionality for the field group edit page.
|
||||
*
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_head() {
|
||||
// Override as necessary.
|
||||
|
|
@ -143,10 +137,10 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
/**
|
||||
* Adds extra HTML to the acf form data element.
|
||||
*
|
||||
* @since 5.3.8
|
||||
* @since 5.3.8
|
||||
*
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
*/
|
||||
public function form_data( $args ) {
|
||||
// Override as necessary.
|
||||
|
|
@ -156,8 +150,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
* Admin footer third party hook support
|
||||
*
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_footer() {
|
||||
// Override as necessary.
|
||||
|
|
@ -180,10 +172,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int $post_id The ID of the post being saved.
|
||||
* @param integer $post_id The ID of the post being saved.
|
||||
* @param WP_Post $post The post object.
|
||||
*
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function verify_save_post( $post_id, $post ) {
|
||||
// Do not save if this is an auto save routine.
|
||||
|
|
@ -224,8 +215,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
|
|||
* Powers the modal for linking field groups to newly-created CPTs/taxonomies.
|
||||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajax_link_field_groups() {
|
||||
// Disable filters to ensure ACF loads raw data from DB.
|
||||
|
|
|
|||
|
|
@ -45,15 +45,15 @@ if ( ! class_exists( 'ACF_Admin_Notice' ) ) :
|
|||
);
|
||||
|
||||
/**
|
||||
* render
|
||||
* render
|
||||
*
|
||||
* Renders the notice HTML.
|
||||
* Renders the notice HTML.
|
||||
*
|
||||
* @date 27/12/18
|
||||
* @since 5.8.0
|
||||
* @date 27/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function render() {
|
||||
$notice_text = $this->get( 'text' );
|
||||
|
|
@ -75,15 +75,15 @@ if ( ! class_exists( 'ACF_Admin_Notice' ) ) :
|
|||
endif; // class_exists check
|
||||
|
||||
/**
|
||||
* acf_new_admin_notice
|
||||
* acf_new_admin_notice
|
||||
*
|
||||
* Instantiates and returns a new model.
|
||||
* Instantiates and returns a new model.
|
||||
*
|
||||
* @date 23/12/18
|
||||
* @since 5.8.0
|
||||
* @date 23/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param array $data Optional data to set.
|
||||
* @return ACF_Admin_Notice
|
||||
* @param array $data Optional data to set.
|
||||
* @return ACF_Admin_Notice
|
||||
*/
|
||||
function acf_new_admin_notice( $data = false ) {
|
||||
|
||||
|
|
@ -132,10 +132,10 @@ add_action( 'admin_notices', 'acf_render_admin_notices', 99 );
|
|||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $text The admin notice text.
|
||||
* @param string $class The type of notice (warning, error, success, info).
|
||||
* @param string $text The admin notice text.
|
||||
* @param string $class The type of notice (warning, error, success, info).
|
||||
* @param boolean $dismissable Is this notification dismissible (default true) (since 5.11.0)
|
||||
* @param boolean $persisted Store once a notice has been dismissed per user and prevent showing it again. (since 6.1.0)
|
||||
* @param boolean $persisted Store once a notice has been dismissed per user and prevent showing it again. (since 6.1.0)
|
||||
* @return ACF_Admin_Notice
|
||||
*/
|
||||
function acf_add_admin_notice( $text = '', $type = 'info', $dismissible = true, $persisted = false ) {
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the class functionality
|
||||
* This function will setup the class functionality
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
|
@ -36,15 +36,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* register_tool
|
||||
* register_tool
|
||||
*
|
||||
* This function will store a tool tool class
|
||||
* This function will store a tool tool class
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param string $class
|
||||
* @return n/a
|
||||
* @param string $class
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function register_tool( $class ) {
|
||||
|
|
@ -55,15 +55,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* get_tool
|
||||
* get_tool
|
||||
*
|
||||
* This function will return a tool tool class
|
||||
* This function will return a tool tool class
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param string $name
|
||||
* @return n/a
|
||||
* @param string $name
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function get_tool( $name ) {
|
||||
|
|
@ -73,15 +73,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* get_tools
|
||||
* get_tools
|
||||
*
|
||||
* This function will return an array of all tools
|
||||
* This function will return an array of all tools
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return array
|
||||
* @param n/a
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function get_tools() {
|
||||
|
|
@ -90,18 +90,16 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_menu
|
||||
*
|
||||
* This function will add the ACF menu item to the WP admin
|
||||
*
|
||||
* @type action (admin_menu)
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will add the ACF menu item to the WP admin
|
||||
*
|
||||
* @type action (admin_menu)
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function admin_menu() {
|
||||
|
||||
|
|
@ -119,15 +117,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* load
|
||||
* load
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function load() {
|
||||
|
|
@ -161,15 +159,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* include_tools
|
||||
* include_tools
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function include_tools() {
|
||||
|
|
@ -185,15 +183,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* check_submit
|
||||
* check_submit
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function check_submit() {
|
||||
|
|
@ -213,15 +211,15 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* html
|
||||
* html
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
|
@ -260,8 +258,6 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
*
|
||||
* @param mixed $post The post this metabox is being displayed on, should be an empty string always for us on a tools page.
|
||||
* @param array $metabox An array of the metabox attributes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function metabox_html( $post, $metabox ) {
|
||||
$tool = $this->get_tool( $metabox['args']['tool'] );
|
||||
|
|
@ -283,57 +279,48 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
|
|||
endif; // class_exists check
|
||||
|
||||
|
||||
/*
|
||||
* acf_register_admin_tool
|
||||
*
|
||||
* alias of acf()->admin_tools->register_tool()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->admin_tools->register_tool()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_register_admin_tool( $class ) {
|
||||
|
||||
return acf()->admin_tools->register_tool( $class );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_admin_tools_url
|
||||
*
|
||||
* This function will return the admin URL to the tools page
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will return the admin URL to the tools page
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_get_admin_tools_url() {
|
||||
|
||||
return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_admin_tool_url
|
||||
*
|
||||
* This function will return the admin URL to the tools page
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will return the admin URL to the tools page
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_get_admin_tool_url( $tool = '' ) {
|
||||
|
||||
return acf_get_admin_tools_url() . '&tool=' . $tool;
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
public $network_upgrade_needed_transient;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* __construct
|
||||
*
|
||||
* Sets up the class functionality.
|
||||
* Sets up the class functionality.
|
||||
*
|
||||
* @date 31/7/18
|
||||
* @since 5.7.2
|
||||
* @date 31/7/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
|
|
@ -37,15 +37,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* admin_menu
|
||||
* admin_menu
|
||||
*
|
||||
* Setus up logic if DB Upgrade is needed on a single site.
|
||||
* Setus up logic if DB Upgrade is needed on a single site.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function admin_menu() {
|
||||
|
||||
|
|
@ -68,11 +68,8 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
* the “Upgrade Database” submenu under the “Dashboard” network admin
|
||||
* menu item if an ACF upgrade needs to run on any network site.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @since 6.0.0 Reduce memory usage, cache network upgrade checks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function network_admin_menu() {
|
||||
$network_upgrade_needed = get_site_transient( $this->network_upgrade_needed_transient );
|
||||
|
|
@ -112,9 +109,9 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
*
|
||||
* @since 6.0.0
|
||||
* @return string 'yes' if any site in the network requires an upgrade,
|
||||
* otherwise 'no'. String instead of boolean so that
|
||||
* `false` returned from a get_site_transient check can
|
||||
* denote that an upgrade check is needed.
|
||||
* otherwise 'no'. String instead of boolean so that
|
||||
* `false` returned from a get_site_transient check can
|
||||
* denote that an upgrade check is needed.
|
||||
*/
|
||||
public function check_for_network_upgrades() {
|
||||
$network_upgrade_needed = 'no';
|
||||
|
|
@ -156,15 +153,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* admin_load
|
||||
* admin_load
|
||||
*
|
||||
* Runs during the loading of the admin page.
|
||||
* Runs during the loading of the admin page.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
function admin_load() {
|
||||
|
||||
|
|
@ -178,15 +175,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* network_admin_load
|
||||
* network_admin_load
|
||||
*
|
||||
* Runs during the loading of the network admin page.
|
||||
* Runs during the loading of the network admin page.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
function network_admin_load() {
|
||||
|
||||
|
|
@ -213,15 +210,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* admin_notices
|
||||
* admin_notices
|
||||
*
|
||||
* Displays the DB Upgrade prompt.
|
||||
* Displays the DB Upgrade prompt.
|
||||
*
|
||||
* @date 23/8/18
|
||||
* @since 5.7.3
|
||||
* @date 23/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function admin_notices() {
|
||||
|
||||
|
|
@ -237,15 +234,15 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* network_admin_notices
|
||||
* network_admin_notices
|
||||
*
|
||||
* Displays the DB Upgrade prompt on a multi site.
|
||||
* Displays the DB Upgrade prompt on a multi site.
|
||||
*
|
||||
* @date 23/8/18
|
||||
* @since 5.7.3
|
||||
* @date 23/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function network_admin_notices() {
|
||||
|
||||
|
|
@ -261,30 +258,30 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* admin_html
|
||||
* admin_html
|
||||
*
|
||||
* Displays the HTML for the admin page.
|
||||
* Displays the HTML for the admin page.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function admin_html() {
|
||||
acf_get_view( 'upgrade/upgrade' );
|
||||
}
|
||||
|
||||
/**
|
||||
* network_admin_html
|
||||
* network_admin_html
|
||||
*
|
||||
* Displays the HTML for the network upgrade admin page.
|
||||
* Displays the HTML for the network upgrade admin page.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function network_admin_html() {
|
||||
acf_get_view( 'upgrade/network' );
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
* Constructor.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
||||
|
|
@ -51,8 +49,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
* Enqueues global admin styling.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
wp_enqueue_style( 'acf-global' );
|
||||
|
|
@ -212,8 +208,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
* had HTML removed/altered due to unsafe HTML being escaped.
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_show_escaped_html_notice() {
|
||||
// Only show to editors and above.
|
||||
|
|
@ -232,15 +226,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
if ( ! empty( $escaped ) ) {
|
||||
acf_get_view( 'escaped-html-notice', array( 'acf_escaped' => $escaped ) );
|
||||
}
|
||||
|
||||
// Throw a separate notice for HTML that will be escaped in future releases.
|
||||
if ( ! apply_filters( 'acf/the_field/escape_html_optin', false ) ) {
|
||||
$will_escape = _acf_get_will_escape_html_log();
|
||||
|
||||
if ( ! empty( $will_escape ) ) {
|
||||
acf_get_view( 'escaped-html-notice', array( 'acf_will_escape' => $will_escape ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -255,13 +240,7 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
|
|||
return;
|
||||
}
|
||||
|
||||
$to_dismiss = acf_request_arg( 'notice', 'escaped_html' );
|
||||
|
||||
if ( 'escaped_html' === $to_dismiss ) {
|
||||
_acf_delete_escaped_html_log();
|
||||
} else {
|
||||
_acf_delete_will_escape_html_log();
|
||||
}
|
||||
_acf_delete_escaped_html_log();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@
|
|||
/**
|
||||
* ACF Admin Field Group Class
|
||||
*
|
||||
* @class acf_admin_field_group
|
||||
* @class acf_admin_field_group
|
||||
*
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
||||
|
||||
/**
|
||||
* ACF Admin Field Group Class
|
||||
* ACF Admin Field Group Class
|
||||
*
|
||||
* All the logic for editing a field group
|
||||
* All the logic for editing a field group
|
||||
*/
|
||||
class acf_admin_field_group extends ACF_Admin_Internal_Post_Type {
|
||||
|
||||
|
|
@ -36,9 +36,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* Constructs the class.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
|
@ -49,12 +47,12 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* This function will customize the message shown when editing a field group
|
||||
* This function will customize the message shown when editing a field group
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $messages Post type messages.
|
||||
* @return array
|
||||
* @param array $messages Post type messages.
|
||||
* @return array
|
||||
*/
|
||||
public function post_updated_messages( $messages ) {
|
||||
$messages['acf-field-group'] = array(
|
||||
|
|
@ -78,8 +76,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
* Enqueues any scripts necessary for internal post type.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
parent::admin_enqueue_scripts();
|
||||
|
|
@ -142,8 +138,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
* Set up functionality for the field group edit page.
|
||||
*
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_head() {
|
||||
global $post, $field_group;
|
||||
|
|
@ -169,8 +163,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
|
||||
/**
|
||||
* This action will allow ACF to render metaboxes after the title.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function edit_form_after_title() {
|
||||
global $post;
|
||||
|
|
@ -213,9 +205,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* Admin footer third party hook support
|
||||
*
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.2
|
||||
*/
|
||||
public function admin_footer() {
|
||||
$this->include_pro_features();
|
||||
|
|
@ -224,8 +214,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
|
||||
/**
|
||||
* Renders HTML for the ACF PRO features upgrade notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function include_pro_features() {
|
||||
// Bail if on PRO.
|
||||
|
|
@ -269,9 +257,8 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* Sets the "Edit Field Group" screen to use a one-column layout.
|
||||
*
|
||||
* @param int $columns Number of columns for layout.
|
||||
*
|
||||
* @return int
|
||||
* @param integer $columns Number of columns for layout.
|
||||
* @return integer
|
||||
*/
|
||||
public function screen_layout( $columns = 0 ) {
|
||||
return 1;
|
||||
|
|
@ -281,8 +268,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
* This function will customize the publish metabox
|
||||
*
|
||||
* @since 5.2.9
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function post_submitbox_misc_actions() {
|
||||
global $field_group;
|
||||
|
|
@ -302,10 +287,9 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @param WP_Post $post The post object.
|
||||
*
|
||||
* @return int $post_id
|
||||
* @return integer $post_id
|
||||
*/
|
||||
public function save_post( $post_id, $post ) {
|
||||
if ( ! $this->verify_save_post( $post_id, $post ) ) {
|
||||
|
|
@ -349,10 +333,10 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
}
|
||||
|
||||
// delete fields.
|
||||
if ( $_POST['_acf_delete_fields'] ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized below.
|
||||
if ( acf_maybe_get_POST( '_acf_delete_fields', false ) ) { // phpcs:ignore -- Sanitized below, unslash not needed
|
||||
|
||||
// clean.
|
||||
$ids = explode( '|', $_POST['_acf_delete_fields'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized below.
|
||||
$ids = explode( '|', $_POST['_acf_delete_fields'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- Sanitized below, unslash not required.
|
||||
$ids = array_map( 'intval', $ids );
|
||||
|
||||
// loop.
|
||||
|
|
@ -370,11 +354,10 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
|
||||
$_POST['acf_field_group']['ID'] = $post_id;
|
||||
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when saved.
|
||||
$_POST['acf_field_group']['title'] = $_POST['post_title'];
|
||||
$_POST['acf_field_group']['title'] = acf_maybe_get_POST( 'post_title', '' );
|
||||
|
||||
// save field group.
|
||||
acf_update_field_group( $_POST['acf_field_group'] );
|
||||
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
acf_update_field_group( $_POST['acf_field_group'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||
|
||||
return $post_id;
|
||||
|
|
@ -383,9 +366,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* This function will render the HTML for the metabox 'acf-field-group-fields'
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function mb_fields() {
|
||||
global $field_group;
|
||||
|
|
@ -402,8 +383,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
* This function will render the HTML for the metabox 'acf-field-group-pro-features'
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mb_pro_features() {
|
||||
acf_get_view( $this->post_type . '/pro-features' );
|
||||
|
|
@ -413,8 +392,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
* This function will render the HTML for the metabox 'acf-field-group-options'
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mb_options() {
|
||||
global $field_group;
|
||||
|
|
@ -430,9 +407,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* This function can be accessed via an AJAX action and will return the result from the render_location_value function
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function ajax_render_location_rule() {
|
||||
// validate.
|
||||
|
|
@ -445,8 +420,12 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
die();
|
||||
}
|
||||
|
||||
if ( empty( $_POST['rule'] ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
// validate rule.
|
||||
$rule = acf_validate_location_rule( acf_sanitize_request_args( $_POST['rule'] ) );
|
||||
$rule = acf_validate_location_rule( acf_sanitize_request_args( $_POST['rule'] ) ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- values not saved.
|
||||
|
||||
acf_get_view(
|
||||
'acf-field-group/location-rule',
|
||||
|
|
@ -461,9 +440,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* This function will return HTML containing the field's settings based on it's new type
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function ajax_render_field_settings() {
|
||||
// Verify the current request.
|
||||
|
|
@ -503,9 +480,7 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
/**
|
||||
* Move field AJAX function
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void No return, HTML output for AJAX consumption.
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function ajax_move_field() {
|
||||
// disable filters to ensure ACF loads raw data from DB.
|
||||
|
|
@ -553,14 +528,14 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
$link = '<a href="' . admin_url( 'post.php?post=' . $field_group['ID'] . '&action=edit' ) . '" target="_blank">' . esc_html( $field_group['title'] ) . '</a>';
|
||||
|
||||
echo '' .
|
||||
'<p><strong>' . __( 'Move Complete.', 'acf' ) . '</strong></p>' .
|
||||
'<p><strong>' . esc_html__( 'Move Complete.', 'acf' ) . '</strong></p>' .
|
||||
'<p>' . sprintf(
|
||||
/* translators: Confirmation message once a field has been moved to a different field group. */
|
||||
acf_punctify( __( 'The %1$s field can now be found in the %2$s field group', 'acf' ) ),
|
||||
esc_html( $field['label'] ),
|
||||
$link //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
) . '</p>' .
|
||||
'<a href="#" class="button button-primary acf-close-popup">' . __( 'Close Modal', 'acf' ) . '</a>';
|
||||
'<a href="#" class="button button-primary acf-close-popup">' . esc_html__( 'Close Modal', 'acf' ) . '</a>';
|
||||
die();
|
||||
}
|
||||
|
||||
|
|
@ -598,14 +573,14 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
|
|||
)
|
||||
);
|
||||
|
||||
echo '<p>' . __( 'Please select the destination for this field', 'acf' ) . '</p>';
|
||||
echo '<p>' . esc_html__( 'Please select the destination for this field', 'acf' ) . '</p>';
|
||||
|
||||
echo '<form id="acf-move-field-form">';
|
||||
|
||||
// render.
|
||||
acf_render_field_wrap( $field );
|
||||
|
||||
echo '<button type="submit" class="acf-btn">' . __( 'Move Field', 'acf' ) . '</button>';
|
||||
echo '<button type="submit" class="acf-btn">' . esc_html__( 'Move Field', 'acf' ) . '</button>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
|
|
|||
|
|
@ -34,10 +34,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ), 7 );
|
||||
|
|
@ -49,8 +46,6 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
|
||||
/**
|
||||
* Renders HTML for the ACF PRO features upgrade notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function include_pro_features() {
|
||||
// Bail if on PRO.
|
||||
|
|
@ -80,14 +75,11 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
/**
|
||||
* Redirects users from ACF 4.0 admin page.
|
||||
*
|
||||
* @date 17/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @return void
|
||||
* @since 5.7.6
|
||||
*/
|
||||
public function handle_redirection() {
|
||||
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'acf' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
wp_redirect( $this->get_admin_url() );
|
||||
wp_safe_redirect( $this->get_admin_url() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -300,7 +292,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function trashed_post( $post_id ) {
|
||||
|
|
@ -315,7 +307,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function untrashed_post( $post_id ) {
|
||||
|
|
@ -330,7 +322,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
* @date 8/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param integer $post_id The post ID.
|
||||
* @return void
|
||||
*/
|
||||
public function deleted_post( $post_id ) {
|
||||
|
|
@ -344,8 +336,8 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @param int $count The number of items the action was performed on.
|
||||
* @param string $action The action being performed.
|
||||
* @param integer $count The number of items the action was performed on.
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_notice_text( $action, $count = 1 ) {
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@
|
|||
/**
|
||||
* ACF Admin Post Type Class
|
||||
*
|
||||
* @class ACF_Admin_Post_Type
|
||||
* @class ACF_Admin_Post_Type
|
||||
*
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
||||
|
||||
/**
|
||||
* ACF Admin Post Type Class
|
||||
* ACF Admin Post Type Class
|
||||
*
|
||||
* All the logic for editing a post type.
|
||||
* All the logic for editing a post type.
|
||||
*/
|
||||
class ACF_Admin_Post_type extends ACF_Admin_Internal_Post_Type {
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param bool $created True if the post was just created.
|
||||
* @param boolean $created True if the post was just created.
|
||||
* @return string
|
||||
*/
|
||||
public function post_type_created_message( $created = false ) {
|
||||
|
|
@ -113,8 +113,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
* Enqueues any scripts necessary for internal post type.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -138,9 +136,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* Sets up all functionality for the post type edit page to work.
|
||||
*
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.8
|
||||
*/
|
||||
public function admin_head() {
|
||||
|
||||
|
|
@ -178,8 +174,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
|
||||
/**
|
||||
* This action will allow ACF to render metaboxes after the title.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function edit_form_after_title() {
|
||||
|
||||
|
|
@ -200,10 +194,10 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* This function will add extra HTML to the acf form data element
|
||||
*
|
||||
* @since 5.3.8
|
||||
* @since 5.3.8
|
||||
*
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
*/
|
||||
public function form_data( $args ) {
|
||||
do_action( 'acf/post_type/form_data', $args );
|
||||
|
|
@ -224,9 +218,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* Admin footer third party hook support
|
||||
*
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.2
|
||||
*/
|
||||
public function admin_footer() {
|
||||
do_action( 'acf/post_type/admin_footer' );
|
||||
|
|
@ -247,9 +239,8 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* Sets the "Edit Post Type" screen to use a one-column layout.
|
||||
*
|
||||
* @param int $columns Number of columns for layout.
|
||||
*
|
||||
* @return int
|
||||
* @param integer $columns Number of columns for layout.
|
||||
* @return integer
|
||||
*/
|
||||
public function screen_layout( $columns = 0 ) {
|
||||
return 1;
|
||||
|
|
@ -258,8 +249,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* Force basic settings to always be visible
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
* @return array
|
||||
*/
|
||||
public function force_basic_settings( $hidden_metaboxes ) {
|
||||
|
|
@ -273,7 +263,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
* Force advanced settings to be visible
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function force_advanced_settings( $hidden_metaboxes ) {
|
||||
|
|
@ -286,9 +275,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* This function will customize the publish metabox
|
||||
*
|
||||
* @since 5.2.9
|
||||
*
|
||||
* @return void
|
||||
* @since 5.2.9
|
||||
*/
|
||||
public function post_submitbox_misc_actions() {
|
||||
global $acf_post_type;
|
||||
|
|
@ -308,10 +295,9 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param WP_Post $post The post object.
|
||||
*
|
||||
* @return int $post_id
|
||||
* @param integer $post_id The post ID.
|
||||
* @param WP_Post $post The post object.
|
||||
* @return integer $post_id
|
||||
*/
|
||||
public function save_post( $post_id, $post ) {
|
||||
if ( ! $this->verify_save_post( $post_id, $post ) ) {
|
||||
|
|
@ -338,8 +324,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
* Renders HTML for the basic settings metabox.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mb_basic_settings() {
|
||||
global $acf_post_type;
|
||||
|
|
@ -355,9 +339,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
|
|||
/**
|
||||
* Renders the HTML for the advanced settings metabox.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function mb_advanced_settings() {
|
||||
acf_get_view( $this->post_type . '/advanced-settings' );
|
||||
|
|
|
|||
|
|
@ -38,10 +38,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @date 5/03/2014
|
||||
* @since 6.2
|
||||
*
|
||||
* @return void
|
||||
* @since 6.2
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ), 8 );
|
||||
|
|
@ -51,8 +48,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
|
|||
|
||||
/**
|
||||
* Renders HTML for the ACF PRO features upgrade notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function include_pro_features() {
|
||||
// Bail if on PRO.
|
||||
|
|
@ -71,9 +66,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
|
|||
/**
|
||||
* Current screen actions for the post types list admin page.
|
||||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @return void
|
||||
* @since 6.1
|
||||
*/
|
||||
public function current_screen() {
|
||||
// Bail early if not post types admin page.
|
||||
|
|
@ -316,8 +309,8 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @param int $count The number of items the action was performed on.
|
||||
* @param string $action The action being performed.
|
||||
* @param integer $count The number of items the action was performed on.
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_notice_text( $action, $count = 1 ) {
|
||||
|
|
|
|||
|
|
@ -37,11 +37,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @date 5/03/2014
|
||||
* @since 6.2
|
||||
*
|
||||
* @return void
|
||||
* @since 6.2
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
|
||||
|
|
@ -51,8 +47,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
|
||||
/**
|
||||
* Renders HTML for the ACF PRO features upgrade notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function include_pro_features() {
|
||||
// Bail if on PRO.
|
||||
|
|
@ -71,9 +65,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
/**
|
||||
* Current screen actions for the taxonomies list admin page.
|
||||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @return void
|
||||
* @since 6.1
|
||||
*/
|
||||
public function current_screen() {
|
||||
// Bail early if not post types admin page.
|
||||
|
|
@ -323,8 +315,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $action The action being performed.
|
||||
* @param int $count The number of items the action was performed on.
|
||||
* @param string $action The action being performed.
|
||||
* @param integer $count The number of items the action was performed on.
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_notice_text( $action, $count = 1 ) {
|
||||
|
|
@ -368,9 +360,9 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
|
|||
/**
|
||||
* Returns the registration error state.
|
||||
*
|
||||
* @since 6.1
|
||||
* @since 6.1
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function get_registration_error_state() {
|
||||
return '<span class="acf-js-tooltip dashicons dashicons-warning" title="' .
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@
|
|||
/**
|
||||
* ACF Admin Taxonomy Class
|
||||
*
|
||||
* @class ACF_Admin_Taxonomiy
|
||||
* @class ACF_Admin_Taxonomiy
|
||||
*
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
* @package ACF
|
||||
* @subpackage Admin
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
||||
|
||||
/**
|
||||
* ACF Admin Field Group Class
|
||||
* ACF Admin Field Group Class
|
||||
*
|
||||
* All the logic for editing a taxonomy.
|
||||
* All the logic for editing a taxonomy.
|
||||
*/
|
||||
class ACF_Admin_Taxonomy extends ACF_Admin_Internal_Post_Type {
|
||||
|
||||
|
|
@ -34,12 +34,12 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
public $admin_body_class = 'acf-admin-single-taxonomy';
|
||||
|
||||
/**
|
||||
* This function will customize the message shown when editing a field group
|
||||
* This function will customize the message shown when editing a field group
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $messages Post type messages.
|
||||
* @return array
|
||||
* @param array $messages Post type messages.
|
||||
* @return array
|
||||
*/
|
||||
public function post_updated_messages( $messages ) {
|
||||
$messages['acf-taxonomy'] = array(
|
||||
|
|
@ -64,7 +64,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param bool $created True if the post was just created.
|
||||
* @param boolean $created True if the post was just created.
|
||||
* @return string
|
||||
*/
|
||||
public function taxonomy_saved_message( $created = false ) {
|
||||
|
|
@ -115,8 +115,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
* Enqueues any scripts necessary for internal post type.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -138,11 +136,9 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets up all functionality for the taxonomy edit page to work.
|
||||
* Sets up all functionality for the taxonomy edit page to work.
|
||||
*
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.8
|
||||
*/
|
||||
public function admin_head() {
|
||||
|
||||
|
|
@ -180,8 +176,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
|
||||
/**
|
||||
* This action will allow ACF to render metaboxes after the title.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function edit_form_after_title() {
|
||||
|
||||
|
|
@ -202,10 +196,10 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* This function will add extra HTML to the acf form data element
|
||||
*
|
||||
* @since 5.3.8
|
||||
* @since 5.3.8
|
||||
*
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
* @param array $args Arguments array to pass through to action.
|
||||
* @return void
|
||||
*/
|
||||
public function form_data( $args ) {
|
||||
do_action( 'acf/taxonomy/form_data', $args );
|
||||
|
|
@ -226,9 +220,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* Admin footer third party hook support
|
||||
*
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.2
|
||||
*/
|
||||
public function admin_footer() {
|
||||
do_action( 'acf/taxonomy/admin_footer' );
|
||||
|
|
@ -249,9 +241,8 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* Sets the "Edit Field Group" screen to use a one-column layout.
|
||||
*
|
||||
* @param int $columns Number of columns for layout.
|
||||
*
|
||||
* @return int
|
||||
* @param integer $columns Number of columns for layout.
|
||||
* @return integer
|
||||
*/
|
||||
public function screen_layout( $columns = 0 ) {
|
||||
return 1;
|
||||
|
|
@ -260,8 +251,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* Force basic settings to always be visible
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
* @return array
|
||||
*/
|
||||
public function force_basic_settings( $hidden_metaboxes ) {
|
||||
|
|
@ -274,8 +264,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* Force advanced settings to be visible
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
*
|
||||
* @param array $hidden_metaboxes The metaboxes hidden on this page.
|
||||
* @return array
|
||||
*/
|
||||
public function force_advanced_settings( $hidden_metaboxes ) {
|
||||
|
|
@ -286,11 +275,9 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* This function will customize the publish metabox
|
||||
* This function will customize the publish metabox
|
||||
*
|
||||
* @since 5.2.9
|
||||
*
|
||||
* @return void
|
||||
* @since 5.2.9
|
||||
*/
|
||||
public function post_submitbox_misc_actions() {
|
||||
global $acf_taxonomy;
|
||||
|
|
@ -310,10 +297,9 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
* @param WP_Post $post The post object.
|
||||
*
|
||||
* @return int $post_id
|
||||
* @param integer $post_id The post ID.
|
||||
* @param WP_Post $post The post object.
|
||||
* @return integer $post_id
|
||||
*/
|
||||
public function save_post( $post_id, $post ) {
|
||||
if ( ! $this->verify_save_post( $post_id, $post ) ) {
|
||||
|
|
@ -340,8 +326,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
* Renders HTML for the 'acf-taxonomy-fields' metabox.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mb_basic_settings() {
|
||||
global $acf_taxonomy;
|
||||
|
|
@ -357,9 +341,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
|
|||
/**
|
||||
* Renders the HTML for the 'acf-taxonomy-options' metabox.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function mb_advanced_settings() {
|
||||
acf_get_view( $this->post_type . '/advanced-settings' );
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* initialize
|
||||
* initialize
|
||||
*
|
||||
* This function will initialize the admin tool
|
||||
* This function will initialize the admin tool
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
|
@ -42,15 +42,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* submit
|
||||
* submit
|
||||
*
|
||||
* This function will run when the tool's form has been submit
|
||||
* This function will run when the tool's form has been submit
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function submit() {
|
||||
|
|
@ -70,15 +70,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* submit_download
|
||||
* submit_download
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function submit_download() {
|
||||
|
|
@ -98,21 +98,21 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
header( 'Content-Type: application/json; charset=utf-8' );
|
||||
|
||||
// return
|
||||
echo acf_json_encode( $json ) . "\r\n";
|
||||
echo acf_json_encode( $json ) . "\r\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped as JSON export.
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* submit_generate
|
||||
* submit_generate
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function submit_generate() {
|
||||
|
|
@ -129,21 +129,21 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
$url = add_query_arg( 'keys', implode( '+', $keys ), $this->get_url() );
|
||||
|
||||
// redirect
|
||||
wp_redirect( $url );
|
||||
wp_safe_redirect( $url );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load
|
||||
* load
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 21/10/17
|
||||
* @since 5.6.3
|
||||
* @date 21/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function load() {
|
||||
|
|
@ -165,15 +165,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* html
|
||||
* html
|
||||
*
|
||||
* This function will output the metabox HTML
|
||||
* This function will output the metabox HTML
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
|
@ -192,10 +192,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Renders the checkboxes to select items to export.
|
||||
*
|
||||
* @date 24/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function html_field_selection() {
|
||||
// Ensure `l10n_var_export` is always false at the point we're outputting the options.
|
||||
|
|
@ -298,10 +295,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Renders the side panel for selecting ACF items to export via PHP.
|
||||
*
|
||||
* @date 21/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function html_panel_selection() {
|
||||
?>
|
||||
|
|
@ -311,57 +305,17 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* html_panel_settings
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @date 21/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html_panel_settings() {
|
||||
|
||||
?>
|
||||
<div class="acf-panel acf-panel-settings">
|
||||
<h3 class="acf-panel-title"><?php _e( 'Settings', 'acf' ); ?> <i class="dashicons dashicons-arrow-right"></i></h3>
|
||||
<div class="acf-panel-inside">
|
||||
<?php
|
||||
|
||||
/*
|
||||
acf_render_field_wrap(array(
|
||||
'label' => __('Empty settings', 'acf'),
|
||||
'type' => 'select',
|
||||
'name' => 'minimal',
|
||||
'prefix' => false,
|
||||
'value' => '',
|
||||
'choices' => array(
|
||||
'all' => __('Include all settings', 'acf'),
|
||||
'minimal' => __('Ignore empty settings', 'acf'),
|
||||
)
|
||||
));
|
||||
*/
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* html_archive
|
||||
* html_archive
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html_archive() {
|
||||
|
|
@ -376,8 +330,8 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
<?php $this->html_field_selection(); ?>
|
||||
</div>
|
||||
<p class="acf-submit acf-actions-strip">
|
||||
<button type="submit" name="action" class="acf-btn acf-button-primary" value="download"><?php _e( 'Export As JSON', 'acf' ); ?></button>
|
||||
<button type="submit" name="action" class="acf-btn acf-btn-secondary" value="generate"><?php _e( 'Generate PHP', 'acf' ); ?></button>
|
||||
<button type="submit" name="action" class="acf-btn acf-button-primary" value="download"><?php esc_html_e( 'Export As JSON', 'acf' ); ?></button>
|
||||
<button type="submit" name="action" class="acf-btn acf-btn-secondary" value="generate"><?php esc_html_e( 'Generate PHP', 'acf' ); ?></button>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
|
@ -386,10 +340,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Renders the PHP export screen.
|
||||
*
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function html_single() {
|
||||
?>
|
||||
|
|
@ -414,10 +365,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Generates the HTML for the PHP export functionality.
|
||||
*
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function html_generate() {
|
||||
// Prevent default translation and fake __() within string.
|
||||
|
|
@ -469,7 +417,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
echo '</textarea>';
|
||||
?>
|
||||
<p class="acf-submit">
|
||||
<a class="button" id="acf-export-copy"><?php _e( 'Copy to clipboard', 'acf' ); ?></a>
|
||||
<a class="button" id="acf-export-copy"><?php esc_html_e( 'Copy to clipboard', 'acf' ); ?></a>
|
||||
</p>
|
||||
<script type="text/javascript">
|
||||
(function($){
|
||||
|
|
@ -509,10 +457,9 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Return an array of keys that have been selected in the export tool.
|
||||
*
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
public function get_selected_keys() {
|
||||
$key_names = array( 'keys', 'taxonomy_keys', 'post_type_keys', 'ui_options_page_keys' );
|
||||
|
|
@ -538,10 +485,9 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
|
|||
/**
|
||||
* Returns the JSON data for given $_POST args.
|
||||
*
|
||||
* @date 17/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return array|bool
|
||||
* @return array|boolean
|
||||
*/
|
||||
public function get_selected() {
|
||||
$selected = $this->get_selected_keys();
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
|
||||
|
||||
/**
|
||||
* initialize
|
||||
* initialize
|
||||
*
|
||||
* This function will initialize the admin tool
|
||||
* This function will initialize the admin tool
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
|
@ -30,15 +30,15 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* html
|
||||
* html
|
||||
*
|
||||
* This function will output the metabox HTML
|
||||
* This function will output the metabox HTML
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
|
@ -137,15 +137,14 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
|
|||
/**
|
||||
* Imports the selected ACF posts and returns an admin notice on completion.
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @return ACF_Admin_Notice
|
||||
*/
|
||||
public function submit() {
|
||||
//phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified before this function is called.
|
||||
if ( 'cptui' === acf_request_arg( 'import_type', '' ) ) {
|
||||
$import = acf_sanitize_request_args( $_POST['acf_import_cptui'] );
|
||||
if ( 'cptui' === acf_request_arg( 'import_type', '' ) && ! empty( $_POST['acf_import_cptui'] ) ) {
|
||||
$import = acf_sanitize_request_args( $_POST['acf_import_cptui'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- unslash not needed.
|
||||
return $this->import_cpt_ui( $import );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* get_name
|
||||
* get_name
|
||||
*
|
||||
* This function will return the Tool's name
|
||||
* This function will return the Tool's name
|
||||
*
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function get_name() {
|
||||
|
|
@ -43,15 +43,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* get_title
|
||||
* get_title
|
||||
*
|
||||
* This function will return the Tool's title
|
||||
* This function will return the Tool's title
|
||||
*
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function get_title() {
|
||||
|
|
@ -60,15 +60,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* get_url
|
||||
* get_url
|
||||
*
|
||||
* This function will return the Tool's title
|
||||
* This function will return the Tool's title
|
||||
*
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function get_url() {
|
||||
|
|
@ -77,15 +77,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* is_active
|
||||
* is_active
|
||||
*
|
||||
* This function will return true if the tool is active
|
||||
* This function will return true if the tool is active
|
||||
*
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
* @date 19/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return bool
|
||||
* @param n/a
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
function is_active() {
|
||||
|
|
@ -93,18 +93,16 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the class functionality
|
||||
*
|
||||
* @type function
|
||||
* @date 27/6/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the class functionality
|
||||
*
|
||||
* @type function
|
||||
* @date 27/6/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
||||
|
|
@ -114,15 +112,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* initialize
|
||||
* initialize
|
||||
*
|
||||
* This function will initialize the admin tool
|
||||
* This function will initialize the admin tool
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
|
@ -133,15 +131,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* load
|
||||
* load
|
||||
*
|
||||
* This function is called during the admin page load
|
||||
* This function is called during the admin page load
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function load() {
|
||||
|
|
@ -151,15 +149,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* html
|
||||
* html
|
||||
*
|
||||
* This function will output the metabox HTML
|
||||
* This function will output the metabox HTML
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
|
@ -167,15 +165,15 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* submit
|
||||
* submit
|
||||
*
|
||||
* This function will run when the tool's form has been submit
|
||||
* This function will run when the tool's form has been submit
|
||||
*
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
* @date 10/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function submit() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ if ( empty( $field['conditional_logic'] ) ) {
|
|||
<div class="acf-conditional-toggle">
|
||||
<div class="acf-label">
|
||||
<?php $acf_label_for = acf_idify( $field['prefix'] . '[conditional_logic]' ); ?>
|
||||
<label for="<?php echo esc_attr( $acf_label_for ); ?>"><?php _e( 'Conditional Logic', 'acf' ); ?></label>
|
||||
<label for="<?php echo esc_attr( $acf_label_for ); ?>"><?php esc_html_e( 'Conditional Logic', 'acf' ); ?></label>
|
||||
</div>
|
||||
<div class="acf-input">
|
||||
<?php
|
||||
|
|
@ -64,9 +64,9 @@ if ( empty( $field['conditional_logic'] ) ) {
|
|||
$h4 = ( $group_id == 'group_0' ) ? __( 'Show this field if', 'acf' ) : __( 'or', 'acf' );
|
||||
|
||||
?>
|
||||
<div class="rule-group" data-id="<?php echo $group_id; ?>">
|
||||
<div class="rule-group" data-id="<?php echo esc_attr( $group_id ); ?>">
|
||||
|
||||
<h4><?php echo $h4; ?></h4>
|
||||
<h4><?php echo esc_html( $h4 ); ?></h4>
|
||||
|
||||
<table class="acf-table -clear">
|
||||
<tbody>
|
||||
|
|
@ -158,7 +158,7 @@ if ( empty( $field['conditional_logic'] ) ) {
|
|||
?>
|
||||
</td>
|
||||
<td class="add">
|
||||
<a href="#" class="button add-conditional-rule"><?php _e( 'and', 'acf' ); ?></a>
|
||||
<a href="#" class="button add-conditional-rule"><?php esc_html_e( 'and', 'acf' ); ?></a>
|
||||
</td>
|
||||
<td class="remove">
|
||||
<a href="#" class="acf-icon -minus remove-conditional-rule"></a>
|
||||
|
|
@ -171,8 +171,8 @@ if ( empty( $field['conditional_logic'] ) ) {
|
|||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<h4><?php _e( 'or', 'acf' ); ?></h4>
|
||||
<h4><?php esc_html_e( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<a href="#" class="button add-conditional-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
|
||||
<a href="#" class="button add-conditional-group"><?php esc_html_e( 'Add rule group', 'acf' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -68,25 +68,25 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
|
|||
<div class="handle">
|
||||
<ul class="acf-hl acf-tbody">
|
||||
<li class="li-field-order">
|
||||
<span class="acf-icon acf-sortable-handle" title="<?php _e( 'Drag to reorder', 'acf' ); ?>"><?php echo ( $i + 1 ); ?></span>
|
||||
<span class="acf-icon acf-sortable-handle" title="<?php esc_attr_e( 'Drag to reorder', 'acf' ); ?>"><?php echo intval( $i + 1 ); ?></span>
|
||||
</li>
|
||||
<li class="li-field-label">
|
||||
<strong>
|
||||
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
|
||||
<a class="edit-field" title="<?php esc_attr_e( 'Edit field', 'acf' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
|
||||
</strong>
|
||||
<div class="row-options">
|
||||
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php _e( 'Edit', 'acf' ); ?></a>
|
||||
<a class="duplicate-field" title="<?php _e( 'Duplicate field', 'acf' ); ?>" href="#"><?php _e( 'Duplicate', 'acf' ); ?></a>
|
||||
<a class="edit-field" title="<?php esc_attr_e( 'Edit field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Edit', 'acf' ); ?></a>
|
||||
<a class="duplicate-field" title="<?php esc_attr_e( 'Duplicate field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Duplicate', 'acf' ); ?></a>
|
||||
<?php if ( $num_field_groups > 1 ) : ?>
|
||||
<a class="move-field" title="<?php _e( 'Move field to another group', 'acf' ); ?>" href="#"><?php _e( 'Move', 'acf' ); ?></a>
|
||||
<a class="move-field" title="<?php esc_attr_e( 'Move field to another group', 'acf' ); ?>" href="#"><?php esc_html_e( 'Move', 'acf' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<a class="delete-field" title="<?php _e( 'Delete field', 'acf' ); ?>" href="#"><?php _e( 'Delete', 'acf' ); ?></a>
|
||||
<a class="delete-field" title="<?php esc_attr_e( 'Delete field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Delete', 'acf' ); ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="li-field-name"><span class="copyable"><?php echo esc_html( $field['name'] ); ?></span></li>
|
||||
<li class="li-field-key"><span class="copyable"><?php echo esc_html( $field['key'] ); ?></span></li>
|
||||
<li class="li-field-type">
|
||||
<i class="field-type-icon field-type-icon-<?php echo acf_slugify( $field['type'] ); ?>"></i>
|
||||
<i class="field-type-icon field-type-icon-<?php echo esc_attr( acf_slugify( $field['type'] ) ); ?>"></i>
|
||||
<span class="field-type-label">
|
||||
<?php echo acf_esc_html( $field_type_label ); ?>
|
||||
</span>
|
||||
|
|
@ -144,7 +144,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
|
|||
<div class="acf-input">
|
||||
<button class="acf-btn browse-fields">
|
||||
<i class="acf-icon acf-icon-dots-grid"></i>
|
||||
<?php _e( 'Browse Fields', 'acf' ); ?>
|
||||
<?php esc_html_e( 'Browse Fields', 'acf' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -307,7 +307,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
|
|||
|
||||
?>
|
||||
<div class="acf-field-settings-footer">
|
||||
<a class="button close-field edit-field" title="<?php _e( 'Close Field', 'acf' ); ?>" href="#"><?php _e( 'Close Field', 'acf' ); ?></a>
|
||||
<a class="button close-field edit-field" title="<?php esc_attr_e( 'Close Field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Close Field', 'acf' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ if ( $is_subfield ) {
|
|||
?>
|
||||
<?php if ( $parent || $is_subfield ) { ?>
|
||||
<div class="acf-sub-field-list-header">
|
||||
<h3 class="acf-sub-field-list-title"><?php _e( 'Fields', 'acf' ); ?></h3>
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
<h3 class="acf-sub-field-list-title"><?php esc_html_e( 'Fields', 'acf' ); ?></h3>
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'acf' ); ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?>
|
||||
|
|
@ -40,19 +40,19 @@ if ( $is_subfield ) {
|
|||
<li class="li-field-order">
|
||||
<?php
|
||||
/* translators: A symbol (or text, if not available in your locale) meaning "Order Number", in terms of positional placement. */
|
||||
_e( '#', 'acf' );
|
||||
esc_html_e( '#', 'acf' );
|
||||
?>
|
||||
<span class="acf-hidden">
|
||||
<?php
|
||||
/* translators: Hidden accessibility text for the positional order number of the field. */
|
||||
_e( 'Order', 'acf' );
|
||||
esc_html_e( 'Order', 'acf' );
|
||||
?>
|
||||
</span>
|
||||
</li>
|
||||
<li class="li-field-label"><?php _e( 'Label', 'acf' ); ?></li>
|
||||
<li class="li-field-name"><?php _e( 'Name', 'acf' ); ?></li>
|
||||
<li class="li-field-key"><?php _e( 'Key', 'acf' ); ?></li>
|
||||
<li class="li-field-type"><?php _e( 'Type', 'acf' ); ?></li>
|
||||
<li class="li-field-label"><?php esc_html_e( 'Label', 'acf' ); ?></li>
|
||||
<li class="li-field-name"><?php esc_html_e( 'Name', 'acf' ); ?></li>
|
||||
<li class="li-field-key"><?php esc_html_e( 'Key', 'acf' ); ?></li>
|
||||
<li class="li-field-type"><?php esc_html_e( 'Type', 'acf' ); ?></li>
|
||||
</ul>
|
||||
|
||||
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?>
|
||||
|
|
@ -60,17 +60,19 @@ if ( $is_subfield ) {
|
|||
|
||||
<div class="no-fields-message">
|
||||
<div class="no-fields-message-inner">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" />
|
||||
<h2><?php _e( 'Add Your First Field', 'acf' ); ?></h2>
|
||||
<p><?php _e( 'Get started creating new custom fields for your posts, pages, custom post types and other WordPress content.', 'acf' ); ?></p>
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-group.svg' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Add Your First Field', 'acf' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Get started creating new custom fields for your posts, pages, custom post types and other WordPress content.', 'acf' ); ?></p>
|
||||
<a href="#" class="acf-btn acf-btn-primary add-field add-first-field
|
||||
"><i class="acf-icon acf-icon-plus"></i> <?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Field', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to field types list */
|
||||
__( 'Choose from over 30 field types. <a href="%s" target="_blank">Learn more</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/', 'docs', 'empty-field-group', 'field-types' )
|
||||
echo acf_esc_html(
|
||||
sprintf(
|
||||
/* translators: %s url to field types list */
|
||||
__( 'Choose from over 30 field types. <a href="%s" target="_blank">Learn more</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/', 'docs', 'empty-field-group', 'field-types' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
|
@ -96,7 +98,7 @@ if ( $is_subfield ) {
|
|||
|
||||
<ul class="acf-hl acf-tfoot">
|
||||
<li class="acf-fr">
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'acf' ); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,35 @@
|
|||
<script>document.body.classList.add('acf-no-field-groups');</script>
|
||||
<?php
|
||||
/**
|
||||
* The empty list state for an ACF field group
|
||||
*
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
?><script>document.body.classList.add('acf-no-field-groups');</script>
|
||||
<div class="acf-no-field-groups-wrapper">
|
||||
<div class="acf-no-field-groups-inner">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" />
|
||||
<h2><?php _e( 'Add Your First Field Group', 'acf' ); ?></h2>
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-group.svg' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Add Your First Field Group', 'acf' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
echo acf_esc_html(
|
||||
sprintf(
|
||||
/* translators: %s url to creating a field group page */
|
||||
__( 'ACF uses <a href="%s" target="_blank">field groups</a> to group custom fields together, and then attach those fields to edit screens.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/creating-a-field-group/', 'docs', 'no-field-groups' )
|
||||
__( 'ACF uses <a href="%s" target="_blank">field groups</a> to group custom fields together, and then attach those fields to edit screens.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/creating-a-field-group/', 'docs', 'no-field-groups' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<a href="<?php echo admin_url( 'post-new.php?post_type=acf-field-group' ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php _e( 'Add Field Group', 'acf' ); ?></a>
|
||||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-field-group' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Field Group', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
echo acf_esc_html(
|
||||
sprintf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-field-groups' )
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-field-groups' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="rule-group" data-id="<?php echo $group_id; ?>">
|
||||
<div class="rule-group" data-id="<?php echo esc_attr( $group_id ); ?>">
|
||||
|
||||
<h4><?php echo ( $group_id == 'group_0' ) ? __( 'Show this field group if', 'acf' ) : __( 'or', 'acf' ); ?></h4>
|
||||
<h4><?php echo ( $group_id == 'group_0' ) ? esc_html__( 'Show this field group if', 'acf' ) : esc_html__( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<table class="acf-table -clear">
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
$prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . ']';
|
||||
|
||||
?>
|
||||
<tr data-id="<?php echo $rule['id']; ?>">
|
||||
<tr data-id="<?php echo esc_attr( $rule['id'] ); ?>">
|
||||
<td class="param">
|
||||
<?php
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// custom
|
||||
} else {
|
||||
echo $choices;
|
||||
echo acf_esc_html( $choices );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -75,13 +75,13 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
|
|||
|
||||
// custom
|
||||
} else {
|
||||
echo $choices;
|
||||
echo acf_esc_html( $choices );
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="add">
|
||||
<a href="#" class="button add-location-rule"><?php _e( 'and', 'acf' ); ?></a>
|
||||
<a href="#" class="button add-location-rule"><?php esc_html_e( 'and', 'acf' ); ?></a>
|
||||
</td>
|
||||
<td class="remove">
|
||||
<a href="#" class="acf-icon -minus remove-location-rule"></a>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ global $field_group;
|
|||
?>
|
||||
<div class="acf-field">
|
||||
<div class="acf-label">
|
||||
<label><?php _e( 'Rules', 'acf' ); ?></label>
|
||||
<label><?php esc_html_e( 'Rules', 'acf' ); ?></label>
|
||||
<i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Create a set of rules to determine which edit screens will use these advanced custom fields', 'acf' ); ?>">?</i>
|
||||
</div>
|
||||
<div class="acf-input">
|
||||
|
|
@ -32,9 +32,9 @@ global $field_group;
|
|||
endforeach;
|
||||
?>
|
||||
|
||||
<h4><?php _e( 'or', 'acf' ); ?></h4>
|
||||
<h4><?php esc_html_e( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<a href="#" class="button add-location-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
|
||||
<a href="#" class="button add-location-group"><?php esc_html_e( 'Add rule group', 'acf' ); ?></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ do_action( 'acf/render_field_group_settings', $field_group );
|
|||
?>
|
||||
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
|
||||
<input type="hidden" name="acf_field_group[key]" value="<?php echo esc_attr( $field_group['key'] ); ?>" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,12 @@ if ( acf_is_pro() ) {
|
|||
<h1 class="acf-field-group-pro-features-title"><?php echo esc_html( $acf_field_group_pro_features_title ); ?> <div class="acf-pro-label">PRO</div></h1>
|
||||
<p class="acf-field-group-pro-features-desc"><?php esc_html_e( 'Speed up your workflow and develop better websites with features like ACF Blocks and Options Pages, and sophisticated field types like Repeater, Flexible Content, Clone, and Gallery.', 'acf' ); ?></p>
|
||||
<div class="acf-field-group-pro-features-actions">
|
||||
<a target="<?php echo $acf_learn_more_target; ?>" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted acf-pro-features-learn-more"><?php echo esc_html( $acf_learn_more_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="_blank" href="<?php echo $acf_pricing_link; ?>" class="acf-btn acf-pro-features-upgrade"><?php echo esc_html( $acf_pricing_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="<?php echo esc_attr( $acf_learn_more_target ); ?>" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted acf-pro-features-learn-more"><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
<?php echo esc_html( $acf_learn_more_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i>
|
||||
</a>
|
||||
<a target="_blank" href="<?php echo $acf_pricing_link; ?>" class="acf-btn acf-pro-features-upgrade"><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
<?php echo esc_html( $acf_pricing_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -71,7 +75,7 @@ if ( acf_is_pro() ) {
|
|||
?>
|
||||
</div>
|
||||
<div class="acf-more-tools-from-wpengine">
|
||||
<a href="<?php echo $acf_more_tools_link; ?>" target="_blank"><?php esc_html_e( 'More Tools from WP Engine', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a href="<?php echo $acf_more_tools_link; ?>" target="_blank"><?php esc_html_e( 'More Tools from WP Engine', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
|
|||
break;
|
||||
case 'labels':
|
||||
echo '<div class="acf-field acf-regenerate-labels-bar">';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-regenerate-labels"><i class="acf-icon acf-icon-regenerate"></i>' . __( 'Regenerate', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-clear-labels"><i class="acf-icon acf-icon-trash"></i>' . __( 'Clear', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-regenerate-labels"><i class="acf-icon acf-icon-regenerate"></i>' . esc_html__( 'Regenerate', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-clear-labels"><i class="acf-icon acf-icon-trash"></i>' . esc_html__( 'Clear', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-tip acf-labels-tip"><i class="acf-icon acf-icon-help acf-js-tooltip" title="' . esc_attr__( 'Regenerate all labels using the Singular and Plural labels', 'acf' ) . '"></i></span>';
|
||||
echo '</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
<script>document.body.classList.add('acf-no-post-types');</script>
|
||||
<?php
|
||||
/**
|
||||
* The empty list state for an ACF post type.
|
||||
*
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
?><script>document.body.classList.add('acf-no-post-types');</script>
|
||||
<div class="acf-no-post-types-wrapper">
|
||||
<div class="acf-no-post-types-inner">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-post-types.svg' ) ); ?>" />
|
||||
|
|
@ -7,10 +14,12 @@
|
|||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-post-type' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Post Type', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
echo acf_esc_html(
|
||||
sprintf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-post-types' )
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-post-types' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
|
|||
break;
|
||||
case 'labels':
|
||||
echo '<div class="acf-field acf-regenerate-labels-bar">';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-regenerate-labels"><i class="acf-icon acf-icon-regenerate"></i>' . __( 'Regenerate', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-clear-labels"><i class="acf-icon acf-icon-trash"></i>' . __( 'Clear', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-regenerate-labels"><i class="acf-icon acf-icon-regenerate"></i>' . esc_html__( 'Regenerate', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-btn acf-btn-sm acf-btn-clear acf-clear-labels"><i class="acf-icon acf-icon-trash"></i>' . esc_html__( 'Clear', 'acf' ) . '</span>';
|
||||
echo '<span class="acf-tip acf-labels-tip"><i class="acf-icon acf-icon-help acf-js-tooltip" title="' . esc_attr__( 'Regenerate all labels using the Singular and Plural labels', 'acf' ) . '"></i></span>';
|
||||
echo '</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* The empty list state for an ACF taxonomy.
|
||||
*
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
?>
|
||||
<script>document.body.classList.add('acf-no-taxonomies');</script>
|
||||
<div class="acf-no-taxonomies-wrapper">
|
||||
<div class="acf-no-taxonomies-inner">
|
||||
|
|
@ -7,10 +15,12 @@
|
|||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-taxonomy' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Taxonomy', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
echo acf_esc_html(
|
||||
sprintf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-taxonomies' )
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-taxonomies' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ $browse_fields_tabs = $browse_fields_tabs + acf_get_field_categories_i18n();
|
|||
<button class="button acf-cancel acf-modal-close"><?php esc_html_e( 'Cancel', 'acf' ); ?></button>
|
||||
<button class="acf-btn acf-select-field"><?php esc_html_e( 'Select Field', 'acf' ); ?></button>
|
||||
<a target="_blank" data-url-base="<?php echo esc_attr( acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'field-type-modal', '' ) ); ?>" class="acf-btn acf-btn-pro">
|
||||
<?php _e( 'Upgrade to PRO', 'acf' ); ?>
|
||||
<?php esc_html_e( 'Upgrade to PRO', 'acf' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -72,7 +72,7 @@ $browse_fields_tabs = $browse_fields_tabs + acf_get_field_categories_i18n();
|
|||
<h2 class="field-type-name"></h2>
|
||||
<a target="_blank" data-url-base="<?php echo esc_attr( acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'field-type-modal', '' ) ); ?>" class="field-type-upgrade-to-unlock">
|
||||
<i class="acf-icon acf-icon-lock"></i>
|
||||
<?php _e( 'Available with ACF PRO', 'acf' ); ?>
|
||||
<?php esc_html_e( 'Available with ACF PRO', 'acf' ); ?>
|
||||
</a>
|
||||
<p class="field-type-desc"></p>
|
||||
<div class="field-type-preview-container">
|
||||
|
|
|
|||
|
|
@ -3,52 +3,27 @@
|
|||
$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
|
||||
$acf_plugin_name = '<strong>' . $acf_plugin_name . ' —</strong>';
|
||||
$acf_learn_how_to_fix = '<a href="' . acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/escaping-the-field/', 'docs', '6-2-5-security-changes' ) . '" target="_blank">' . __( 'Learn more', 'acf' ) . '</a>';
|
||||
$acf_class = '';
|
||||
$acf_class = 'notice-error';
|
||||
$acf_user_can_acf = false;
|
||||
|
||||
if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
|
||||
$acf_user_can_acf = true;
|
||||
$acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show details', 'acf' ) . '</a>';
|
||||
$acf_class = ' is-dismissible';
|
||||
$acf_class .= ' is-dismissible';
|
||||
} else {
|
||||
$acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' );
|
||||
}
|
||||
|
||||
if ( ! empty( $acf_will_escape ) ) {
|
||||
$acf_escaped = $acf_will_escape;
|
||||
$acf_class .= ' notice-warning acf-will-escape';
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF will soon escape unsafe HTML that is rendered by <code>the_field()</code>. We\'ve detected the output of some of your fields will be modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
} else {
|
||||
$acf_class .= ' notice-error';
|
||||
|
||||
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) {
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by <code>the_field</code> or the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
} else {
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by <code>the_field</code> or the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="acf-admin-notice notice acf-escaped-html-notice<?php echo esc_attr( $acf_class ); ?>">
|
||||
<div class="acf-admin-notice notice acf-escaped-html-notice <?php echo esc_attr( $acf_class ); ?>">
|
||||
<p><?php echo acf_esc_html( $acf_error_msg ); ?></p>
|
||||
<?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?>
|
||||
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
|
||||
|
|
|
|||
|
|
@ -144,12 +144,12 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
|
|||
foreach ( $menu_items as $menu_item ) {
|
||||
$class = ! empty( $menu_item['class'] ) ? $menu_item['class'] : $menu_item['text'];
|
||||
$target = ! empty( $menu_item['target'] ) ? ' target="' . esc_attr( $menu_item['target'] ) . '"' : '';
|
||||
$li_class = ! empty( $menu_item['li_class'] ) ? $menu_item['li_class'] : '';
|
||||
$li_class = ! empty( $menu_item['li_class'] ) ? esc_attr( $menu_item['li_class'] ) : '';
|
||||
|
||||
$html = sprintf(
|
||||
'<a class="acf-tab%s %s" href="%s"%s><i class="acf-icon"></i>%s</a>',
|
||||
! empty( $menu_item['is_active'] ) ? ' is-active' : '',
|
||||
'acf-header-tab-' . acf_slugify( $class ),
|
||||
'acf-header-tab-' . esc_attr( acf_slugify( $class ) ),
|
||||
esc_url( $menu_item['url'] ),
|
||||
$target,
|
||||
acf_esc_html( $menu_item['text'] )
|
||||
|
|
@ -166,20 +166,20 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
|
|||
$section_html .= $html;
|
||||
}
|
||||
|
||||
echo $section_html;
|
||||
echo $section_html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- safely built and escaped HTML above.
|
||||
}
|
||||
?>
|
||||
<div class="acf-admin-toolbar">
|
||||
<div class="acf-admin-toolbar-inner">
|
||||
<div class="acf-nav-wrap">
|
||||
<a href="<?php echo admin_url( 'edit.php?post_type=acf-field-group' ); ?>" class="acf-logo">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.svg' ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
|
||||
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=acf-field-group' ) ); ?>" class="acf-logo">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.svg' ) ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
|
||||
<?php if ( acf_is_pro() && acf_pro_is_license_active() ) { ?>
|
||||
<div class="acf-pro-label">PRO</div>
|
||||
<?php } ?>
|
||||
</a>
|
||||
|
||||
<h2><?php echo acf_get_setting( 'name' ); ?></h2>
|
||||
<h2><?php echo esc_html( acf_get_setting( 'name' ) ); ?></h2>
|
||||
<?php acf_print_menu_section( $core_tabs, 'core' ); ?>
|
||||
<?php if ( $acf_more_items || $more_items ) { ?>
|
||||
<div class="acf-more acf-header-tab-acf-more" tabindex="0">
|
||||
|
|
@ -231,7 +231,7 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $acf_wpengine_logo_link; ?>" target="_blank" class="acf-nav-wpengine-logo">
|
||||
<a href="<?php echo $acf_wpengine_logo_link; ?>" target="_blank" class="acf-nav-wpengine-logo"><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/wp-engine-horizontal-white.svg' ) ); ?>" alt="<?php esc_html_e( 'WP Engine logo', 'acf' ); ?>" />
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ $acf_getting_started = sprintf(
|
|||
<td class="colspanchange" colspan="6">
|
||||
<div class="acf-no-field-groups-wrapper">
|
||||
<div class="acf-no-field-groups-inner acf-field-group-pro-features-content">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-post-types.svg' ); ?>" />
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-post-types.svg' ) ); ?>" />
|
||||
<h2><?php echo acf_esc_html( 'Upgrade to ACF PRO to create options pages in just a few clicks', 'acf' ); ?></h2>
|
||||
<p><?php echo acf_esc_html( $acf_options_pages_desc ); ?></p>
|
||||
<div class="acf-field-group-pro-features-actions">
|
||||
<a target="_blank" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted"><?php esc_html_e( 'Learn More', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="_blank" href="<?php echo $acf_upgrade_button; ?>" class="acf-btn acf-options-pages-preview-upgrade-button"> <?php esc_html_e( 'Upgrade to ACF PRO', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="_blank" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted"><?php esc_html_e( 'Learn More', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
<a target="_blank" href="<?php echo $acf_upgrade_button; ?>" class="acf-btn acf-options-pages-preview-upgrade-button"> <?php esc_html_e( 'Upgrade to ACF PRO', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a><?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped on generation. ?>
|
||||
</div>
|
||||
<p class="acf-small"><?php echo acf_esc_html( $acf_getting_started ); ?></p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* html-admin-tools
|
||||
* View to output admin tools for both archive and single
|
||||
*
|
||||
* View to output admin tools for both archive and single
|
||||
*
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param string $screen_id The screen ID used to display metaboxes
|
||||
* @param string $active The active Tool
|
||||
* @return n/a
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
$class = $active ? 'single' : 'grid';
|
||||
|
|
@ -18,12 +10,12 @@ $tool = $active ? ' tool-' . $active : '';
|
|||
?>
|
||||
<div id="acf-admin-tools" class="wrap<?php echo esc_attr( $tool ); ?>">
|
||||
|
||||
<h1><?php _e( 'Tools', 'acf' ); ?> <?php
|
||||
<h1><?php esc_html_e( 'Tools', 'acf' ); ?> <?php
|
||||
if ( $active ) :
|
||||
?>
|
||||
<a class="page-title-action" href="<?php echo acf_get_admin_tools_url(); ?>"><?php _e( 'Back to all tools', 'acf' ); ?></a><?php endif; ?></h1>
|
||||
<a class="page-title-action" href="<?php echo esc_url( acf_get_admin_tools_url() ); ?>"><?php esc_html_e( 'Back to all tools', 'acf' ); ?></a><?php endif; ?></h1>
|
||||
|
||||
<div class="acf-meta-box-wrap -<?php echo $class; ?>">
|
||||
<div class="acf-meta-box-wrap -<?php echo esc_attr( $class ); ?>">
|
||||
<?php do_meta_boxes( $screen_id, 'normal', '' ); ?>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Network Admin Database Upgrade
|
||||
* Network Admin Database Upgrade
|
||||
*
|
||||
* Shows the databse upgrade process.
|
||||
* Shows the databse upgrade process.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @param void
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
?>
|
||||
|
|
@ -21,10 +18,11 @@
|
|||
</style>
|
||||
<div id="acf-upgrade-wrap" class="wrap">
|
||||
|
||||
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
<h1><?php esc_html_e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
|
||||
<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>
|
||||
<?php // translators: %s The button label name, translated seperately ?>
|
||||
<p><?php printf( esc_html__( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . esc_html__( 'Upgrade Sites', 'acf' ) . '"' ); ?></p>
|
||||
<p><input type="submit" name="upgrade" value="<?php esc_attr_e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p>
|
||||
|
||||
<table class="wp-list-table widefat">
|
||||
<thead>
|
||||
|
|
@ -33,9 +31,9 @@
|
|||
<input type="checkbox" id="sites-select-all">
|
||||
</td>
|
||||
<th class="manage-column" scope="col" style="width:33%;">
|
||||
<label for="sites-select-all"><?php _e( 'Site', 'acf' ); ?></label>
|
||||
<label for="sites-select-all"><?php esc_html_e( 'Site', 'acf' ); ?></label>
|
||||
</th>
|
||||
<th><?php _e( 'Description', 'acf' ); ?></th>
|
||||
<th><?php esc_html_e( 'Description', 'acf' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
|
|
@ -44,9 +42,9 @@
|
|||
<input type="checkbox" id="sites-select-all-2">
|
||||
</td>
|
||||
<th class="manage-column" scope="col">
|
||||
<label for="sites-select-all-2"><?php _e( 'Site', 'acf' ); ?></label>
|
||||
<label for="sites-select-all-2"><?php esc_html_e( 'Site', 'acf' ); ?></label>
|
||||
</th>
|
||||
<th><?php _e( 'Description', 'acf' ); ?></th>
|
||||
<th><?php esc_html_e( 'Description', 'acf' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody id="the-list">
|
||||
|
|
@ -67,17 +65,18 @@
|
|||
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[]">
|
||||
<input type="checkbox" value="<?php echo esc_attr( $site['blog_id'] ); ?>" name="checked[]">
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td>
|
||||
<strong><?php echo get_bloginfo( 'name' ); ?></strong><br /><?php echo home_url(); ?>
|
||||
<strong><?php echo esc_html( get_bloginfo( 'name' ) ); ?></strong><br /><?php echo esc_url( home_url() ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
<span class="response"><?php printf( __( 'Site requires database upgrade from %1$s to %2$s', 'acf' ), acf_get_db_version(), ACF_VERSION ); ?></span>
|
||||
<?php // translators: %1 current db version, %2 available db version ?>
|
||||
<span class="response"><?php echo esc_html( printf( __( 'Site requires database upgrade from %1$s to %2$s', 'acf' ), acf_get_db_version(), ACF_VERSION ) ); ?></span>
|
||||
<?php else : ?>
|
||||
<?php _e( 'Site is up to date', 'acf' ); ?>
|
||||
<?php esc_html_e( 'Site is up to date', 'acf' ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -92,8 +91,9 @@
|
|||
</tbody>
|
||||
</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 printf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p>
|
||||
<p><input type="submit" name="upgrade" value="<?php esc_attr_e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p>
|
||||
<?php // translators: %s admin dashboard url page ?>
|
||||
<p class="show-on-complete"><?php echo acf_esc_html( sprintf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), esc_url( network_admin_url() ) ) ); ?></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
|
@ -113,11 +113,11 @@
|
|||
|
||||
// bail early if no selection
|
||||
if( !this.$inputs().length ) {
|
||||
return alert('<?php _e( 'Please select at least one site to upgrade.', 'acf' ); ?>');
|
||||
return alert('<?php esc_attr_e( 'Please select at least one site to upgrade.', 'acf' ); ?>');
|
||||
}
|
||||
|
||||
// confirm action
|
||||
if( !confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>") ) {
|
||||
if( !confirm("<?php esc_attr_e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>") ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +144,8 @@
|
|||
var success = false;
|
||||
|
||||
// show loading
|
||||
$row.find('.response').html('<i class="acf-loading"></i></span> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?>');
|
||||
<?php // translators: %s the version being upgraded to. ?>
|
||||
$row.find('.response').html('<i class="acf-loading"></i></span> <?php printf( esc_attr__( 'Upgrading data to version %s', 'acf' ), esc_attr( ACF_VERSION ) ); ?>');
|
||||
|
||||
// send ajax request to upgrade DB
|
||||
$.ajax({
|
||||
|
|
@ -158,10 +159,10 @@
|
|||
success: function( json ){
|
||||
success = true;
|
||||
$input.remove();
|
||||
text = '<?php _e( 'Upgrade complete.', 'acf' ); ?>';
|
||||
text = '<?php esc_attr_e( 'Upgrade complete.', 'acf' ); ?>';
|
||||
},
|
||||
error: function( jqXHR, textStatus, errorThrown ){
|
||||
text = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
text = '<?php esc_attr_e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
if( error = acf.getXhrError(jqXHR) ) {
|
||||
text += ' <code>' + error + '</code>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,18 @@ if ( ! acf_get_setting( 'pro' ) ) {
|
|||
<div id="acf-upgrade-notice" class="notice">
|
||||
<div class="notice-container">
|
||||
<div class="col-content">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.png' ); ?>" />
|
||||
<h2><?php _e( 'Database Upgrade Required', 'acf' ); ?></h2>
|
||||
<p><?php printf( __( 'Thank you for updating to %1$s v%2$s!', 'acf' ), acf_get_setting( 'name' ), acf_get_setting( 'version' ) ); ?><br /><?php _e( 'This version contains improvements to your database and requires an upgrade.', 'acf' ); ?></p>
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.png' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Database Upgrade Required', 'acf' ); ?></h2>
|
||||
<?php // translators: %1 plugin name, %2 version number ?>
|
||||
<p><?php echo acf_esc_html( sprintf( __( 'Thank you for updating to %1$s v%2$s!', 'acf' ), acf_get_setting( 'name' ), acf_get_setting( 'version' ) ) ); ?><br />
|
||||
<?php esc_html_e( 'This version contains improvements to your database and requires an upgrade.', 'acf' ); ?></p>
|
||||
<?php if ( ! empty( $plugins ) ) : ?>
|
||||
<p><?php printf( __( 'Please also check all premium add-ons (%s) are updated to the latest version.', 'acf' ), implode( ', ', $plugins ) ); ?></p>
|
||||
<?php // translators: %s a list of plugin ?>
|
||||
<p><?php echo acf_esc_html( sprintf( __( 'Please also check all premium add-ons (%s) are updated to the latest version.', 'acf' ), implode( ', ', $plugins ) ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-actions">
|
||||
<a id="acf-upgrade-button" href="<?php echo $button_url; ?>" class="acf-btn"><?php echo $button_text; ?></a>
|
||||
<a id="acf-upgrade-button" href="<?php echo esc_url( $button_url ); ?>" class="acf-btn"><?php echo esc_html( $button_text ); ?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -40,7 +43,7 @@ if ( ! acf_get_setting( 'pro' ) ) {
|
|||
(function($) {
|
||||
|
||||
$("#acf-upgrade-button").on("click", function(){
|
||||
return confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
|
||||
return confirm("<?php esc_attr_e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Admin Database Upgrade
|
||||
* Admin Database Upgrade
|
||||
*
|
||||
* Shows the databse upgrade process.
|
||||
* Shows the databse upgrade process.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @param void
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
?>
|
||||
|
|
@ -23,14 +20,16 @@
|
|||
</style>
|
||||
<div id="acf-upgrade-wrap" class="wrap">
|
||||
|
||||
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
<h1><?php esc_html_e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
|
||||
<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><?php esc_html_e( 'Reading upgrade tasks...', 'acf' ); ?></p>
|
||||
<?php /* translators: %s the new ACF version */ ?>
|
||||
<p class="step-1"><i class="acf-loading"></i> <?php echo esc_html( sprintf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ) ); ?></p>
|
||||
<p class="step-2"></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>
|
||||
<?php /* translators: %s the url to the field group page. */ ?>
|
||||
<p class="step-3"><?php echo acf_esc_html( sprintf( __( 'Database upgrade complete. <a href="%s">See what\'s new</a>', 'acf' ), esc_url( admin_url( 'edit.php?post_type=acf-field-group' ) ) ) ); ?></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
|
@ -62,7 +61,7 @@
|
|||
success = true;
|
||||
},
|
||||
error: function( jqXHR, textStatus, errorThrown ){
|
||||
response = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
response = '<?php esc_attr_e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
if( error = acf.getXhrError(jqXHR) ) {
|
||||
response += ' <code>' + error + '</code>';
|
||||
}
|
||||
|
|
@ -91,7 +90,7 @@
|
|||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php _e( 'No updates available.', 'acf' ); ?></p>
|
||||
<p><?php esc_html_e( 'No updates available.', 'acf' ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if ( ! class_exists( 'ACF_Ajax_Check_Screen' ) ) :
|
|||
/** @var string The AJAX action name. */
|
||||
var $action = 'acf/ajax/check_screen';
|
||||
|
||||
/** @var bool Prevents access for non-logged in users. */
|
||||
/** @var boolean Prevents access for non-logged in users. */
|
||||
var $public = false;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ if ( ! class_exists( 'ACF_Ajax_Local_JSON_Diff' ) ) :
|
|||
/**
|
||||
* Prevents access for non-logged in users.
|
||||
*
|
||||
* @var bool
|
||||
* @var boolean
|
||||
*/
|
||||
public $public = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
|
|||
// acf_log( $args );
|
||||
// acf_log( '- ', count($users) );
|
||||
// acf_log( '- ', $total_users );
|
||||
|
||||
// If users were found for this query...
|
||||
if ( $users ) {
|
||||
|
||||
|
|
@ -247,8 +246,8 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
|
|||
* @date 9/3/20
|
||||
* @since 5.8.8
|
||||
*
|
||||
* @param array $columns An array of column names to be searched.
|
||||
* @param string $search The search term.
|
||||
* @param array $columns An array of column names to be searched.
|
||||
* @param string $search The search term.
|
||||
* @param WP_User_Query $WP_User_Query The WP_User_Query instance.
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,22 +8,22 @@ if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
|
|||
|
||||
class ACF_Ajax_Query extends ACF_Ajax {
|
||||
|
||||
/** @var bool Prevents access for non-logged in users. */
|
||||
/** @var boolean Prevents access for non-logged in users. */
|
||||
var $public = true;
|
||||
|
||||
/** @var int The page of results to return. */
|
||||
/** @var integer The page of results to return. */
|
||||
var $page = 1;
|
||||
|
||||
/** @var int The number of results per page. */
|
||||
/** @var integer The number of results per page. */
|
||||
var $per_page = 20;
|
||||
|
||||
/** @var bool Signifies whether or not this AJAX query has more pages to load. */
|
||||
/** @var boolean Signifies whether or not this AJAX query has more pages to load. */
|
||||
var $more = false;
|
||||
|
||||
/** @var string The searched term. */
|
||||
var $search = '';
|
||||
|
||||
/** @var bool Signifies whether the current query is a search. */
|
||||
/** @var boolean Signifies whether the current query is a search. */
|
||||
var $is_search = false;
|
||||
|
||||
/** @var (int|string) The post_id being edited. */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if ( ! class_exists( 'ACF_Ajax_User_Setting' ) ) :
|
|||
/** @var string The AJAX action name. */
|
||||
var $action = 'acf/ajax/user_setting';
|
||||
|
||||
/** @var bool Prevents access for non-logged in users. */
|
||||
/** @var boolean Prevents access for non-logged in users. */
|
||||
var $public = true;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ if ( ! class_exists( 'ACF_Ajax' ) ) :
|
|||
/** @var array The $_REQUEST data. */
|
||||
var $request;
|
||||
|
||||
/** @var bool Prevents access for non-logged in users. */
|
||||
/** @var boolean Prevents access for non-logged in users. */
|
||||
var $public = false;
|
||||
|
||||
/**
|
||||
|
|
@ -69,7 +69,7 @@ if ( ! class_exists( 'ACF_Ajax' ) ) :
|
|||
* @date 31/7/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param string $key The data key.
|
||||
* @param string $key The data key.
|
||||
* @param mixed $value The data value.
|
||||
* @return ACF_Ajax
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ function acf_merge_atts( $atts, $extra = array() ) {
|
|||
* @param string $nonce The nonce parameter string.
|
||||
*/
|
||||
function acf_nonce_input( $nonce = '' ) {
|
||||
echo '<input type="hidden" name="_acf_nonce" value="' . wp_create_nonce( $nonce ) . '" />';
|
||||
echo '<input type="hidden" name="_acf_nonce" value="' . esc_attr( wp_create_nonce( $nonce ) ) . '" />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1411,7 +1411,6 @@ function acf_get_post_title( $post = 0, $is_search = false ) {
|
|||
// get ancestors
|
||||
$ancestors = get_ancestors( $post->ID, $post->post_type );
|
||||
$prepend .= str_repeat( '- ', count( $ancestors ) );
|
||||
|
||||
}
|
||||
|
||||
// merge
|
||||
|
|
@ -1672,62 +1671,42 @@ function acf_str_exists( $needle, $haystack ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_debug
|
||||
* A legacy function designed for developer debugging.
|
||||
*
|
||||
* description
|
||||
* @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return false
|
||||
*/
|
||||
function acf_debug() {
|
||||
|
||||
// vars
|
||||
$args = func_get_args();
|
||||
$s = array_shift( $args );
|
||||
$o = '';
|
||||
$nl = "\r\n";
|
||||
|
||||
// start script
|
||||
$o .= '<script type="text/javascript">' . $nl;
|
||||
|
||||
$o .= 'console.log("' . $s . '"';
|
||||
|
||||
if ( ! empty( $args ) ) {
|
||||
foreach ( $args as $arg ) {
|
||||
if ( is_object( $arg ) || is_array( $arg ) ) {
|
||||
$arg = json_encode( $arg );
|
||||
} elseif ( is_bool( $arg ) ) {
|
||||
$arg = $arg ? 'true' : 'false';
|
||||
} elseif ( is_string( $arg ) ) {
|
||||
$arg = '"' . $arg . '"';
|
||||
}
|
||||
|
||||
$o .= ', ' . $arg;
|
||||
}
|
||||
}
|
||||
|
||||
$o .= ');' . $nl;
|
||||
|
||||
// end script
|
||||
$o .= '</script>' . $nl;
|
||||
|
||||
// echo
|
||||
echo $o;
|
||||
_deprecated_function( __FUNCTION__, '6.2.7' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A legacy function designed for developer debugging.
|
||||
*
|
||||
* @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
function acf_debug_start() {
|
||||
|
||||
acf_update_setting( 'debug_start', memory_get_usage() );
|
||||
_deprecated_function( __FUNCTION__, '6.2.7' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A legacy function designed for developer debugging.
|
||||
*
|
||||
* @deprecated 6.2.6 Removed for security, but keeping the definition in case third party devs have it in their code.
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
function acf_debug_end() {
|
||||
|
||||
$start = acf_get_setting( 'debug_start' );
|
||||
$end = memory_get_usage();
|
||||
|
||||
return $end - $start;
|
||||
_deprecated_function( __FUNCTION__, '6.2.7' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2329,6 +2308,10 @@ function acf_isset_termmeta( $taxonomy = '' ) {
|
|||
*/
|
||||
function acf_upload_files( $ancestors = array() ) {
|
||||
|
||||
if ( empty( $_FILES['acf'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$file = acf_sanitize_files_array( $_FILES['acf'] ); // phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified upstream.
|
||||
|
||||
// walk through ancestors.
|
||||
|
|
@ -3305,17 +3288,14 @@ function acf_format_date( $value, $format ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_clear_log
|
||||
* Previously, deletes the debug.log file.
|
||||
*
|
||||
* Deletes the debug.log file.
|
||||
*
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
* @since 5.7.10
|
||||
* @deprecated 6.2.7
|
||||
*/
|
||||
function acf_clear_log() {
|
||||
unlink( WP_CONTENT_DIR . '/debug.log' );
|
||||
_deprecated_function( __FUNCTION__, '6.2.7' );
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -81,19 +81,19 @@ function get_field( $selector, $post_id = false, $format_value = true, $escape_h
|
|||
}
|
||||
|
||||
/**
|
||||
* This function is the same as echo get_field(), but will soon escape the value by default.
|
||||
* This function is the same as echo get_field(), but will escape the value for safe HTML output regardless of parameters.
|
||||
*
|
||||
* @since 1.0.3
|
||||
*
|
||||
* @param string $selector The field name or key.
|
||||
* @param mixed $post_id The post_id of which the value is saved against.
|
||||
* @param boolean $format_value Enable formatting of value.
|
||||
* @param boolean $format_value Enable formatting of value. Default true.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function the_field( $selector, $post_id = false, $format_value = true ) {
|
||||
$field = get_field_object( $selector, $post_id, $format_value, true, false );
|
||||
$value = $field ? $field['value'] : get_field( $selector, $post_id, $format_value, false );
|
||||
$field = get_field_object( $selector, $post_id, $format_value, true, $format_value );
|
||||
$value = $field ? $field['value'] : get_field( $selector, $post_id, $format_value, $format_value );
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
$value = implode( ', ', $value );
|
||||
|
|
@ -104,29 +104,22 @@ function the_field( $selector, $post_id = false, $format_value = true ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// If $format_value is false, we've not been able to apply field level escaping as we're giving the raw DB value. Escape the output with `acf_esc_html`.
|
||||
if ( ! $format_value ) {
|
||||
$value = acf_esc_html( $value );
|
||||
}
|
||||
|
||||
// Get the unescaped value while we're still logging removed_unsafe_html.
|
||||
$unescaped_value = get_field( $selector, $post_id, $format_value, false );
|
||||
if ( is_array( $unescaped_value ) ) {
|
||||
$unescaped_value = implode( ', ', $unescaped_value );
|
||||
}
|
||||
|
||||
$field_type = is_array( $field ) && isset( $field['type'] ) ? $field['type'] : 'text';
|
||||
|
||||
if ( ! apply_filters( 'acf/the_field/allow_unsafe_html', false, $selector, $post_id, $field_type, $field ) ) {
|
||||
$new_value = get_field( $selector, $post_id, $format_value, $format_value );
|
||||
|
||||
if ( is_array( $new_value ) ) {
|
||||
$new_value = implode( ', ', $new_value );
|
||||
}
|
||||
|
||||
// If $format_value is false, we've not been able to apply field level escaping as we're giving the raw DB value. Escape the output with `acf_esc_html`.
|
||||
if ( ! $format_value ) {
|
||||
$new_value = acf_esc_html( $new_value );
|
||||
}
|
||||
|
||||
if ( (string) $value !== (string) $new_value ) {
|
||||
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) {
|
||||
$value = $new_value;
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $selector, $field, $post_id );
|
||||
} else {
|
||||
do_action( 'acf/will_remove_unsafe_html', __FUNCTION__, $selector, $field, $post_id );
|
||||
}
|
||||
}
|
||||
unset( $new_value );
|
||||
if ( apply_filters( 'acf/the_field/allow_unsafe_html', false, $selector, $post_id, $field_type, $field ) ) {
|
||||
$value = $unescaped_value;
|
||||
} elseif ( (string) $value !== (string) $unescaped_value ) {
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $selector, $field, $post_id );
|
||||
}
|
||||
|
||||
echo $value; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by logic above.
|
||||
|
|
@ -177,51 +170,6 @@ function _acf_log_escaped_html( $function, $selector, $field, $post_id ) {
|
|||
}
|
||||
add_action( 'acf/removed_unsafe_html', '_acf_log_escaped_html', 10, 4 );
|
||||
|
||||
/**
|
||||
* Logs instances of where ACF will soon escape HTML using the_field.
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @param string $function The function that resulted in HTML being escaped.
|
||||
* @param string $selector The selector (field key, name, etc.) passed to that function.
|
||||
* @param array $field The field being queried when HTML was escaped.
|
||||
* @param mixed $post_id The post ID the function was called on.
|
||||
* @return void
|
||||
*/
|
||||
function _acf_log_will_escape_html( $function, $selector, $field, $post_id ) {
|
||||
// If the notice isn't shown, no use in logging the errors.
|
||||
if ( apply_filters( 'acf/admin/prevent_escaped_html_notice', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the field isn't set, we've output a non-ACF field, so don't log anything.
|
||||
if ( ! is_array( $field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$will_escape = _acf_get_will_escape_html_log();
|
||||
|
||||
// Only store up to 100 results at a time.
|
||||
if ( count( $will_escape ) >= 100 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Bail if we already logged an error for this field.
|
||||
if ( isset( $will_escape[ $field['key'] ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$will_escape[ $field['key'] ] = array(
|
||||
'selector' => $selector,
|
||||
'function' => $function,
|
||||
'field' => $field['name'],
|
||||
'post_id' => $post_id,
|
||||
);
|
||||
|
||||
_acf_update_will_escape_html_log( $will_escape );
|
||||
}
|
||||
add_action( 'acf/will_remove_unsafe_html', '_acf_log_will_escape_html', 10, 4 );
|
||||
|
||||
/**
|
||||
* Returns an array of instances where HTML was altered due to escaping in the_field or a shortcode.
|
||||
*
|
||||
|
|
@ -248,50 +196,17 @@ function _acf_update_escaped_html_log( $escaped = array() ) {
|
|||
|
||||
/**
|
||||
* Deletes the array of instances where HTML was altered due to escaping in the_field or a shortcode.
|
||||
* Since 6.2.7, also clears the legacy `acf_will_escape_html_log` option to clean up.
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @return boolean True on success, or false on failure.
|
||||
*/
|
||||
function _acf_delete_escaped_html_log() {
|
||||
delete_option( 'acf_will_escape_html_log' );
|
||||
return delete_option( 'acf_escaped_html_log' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of instances where HTML will be escaped in the_field().
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function _acf_get_will_escape_html_log() {
|
||||
$will_escape = get_option( 'acf_will_escape_html_log', array() );
|
||||
return is_array( $will_escape ) ? $will_escape : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the array of instances where HTML will be escaped in the_field().
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @param array $escaped The array of instances.
|
||||
* @return boolean True on success, or false on failure.
|
||||
*/
|
||||
function _acf_update_will_escape_html_log( $escaped = array() ) {
|
||||
return update_option( 'acf_will_escape_html_log', (array) $escaped, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the array of instances where HTML will be escaped in the_field().
|
||||
*
|
||||
* @since 6.2.5
|
||||
*
|
||||
* @return boolean True on success, or false on failure.
|
||||
*/
|
||||
function _acf_delete_will_escape_html_log() {
|
||||
return delete_option( 'acf_will_escape_html_log' );
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return an array containing all the field data for a given field_name.
|
||||
*
|
||||
|
|
@ -791,8 +706,7 @@ function get_row_index() {
|
|||
}
|
||||
|
||||
function the_row_index() {
|
||||
|
||||
echo get_row_index();
|
||||
echo intval( get_row_index() );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -937,15 +851,17 @@ function get_sub_field( $selector = '', $format_value = true, $escape_html = fal
|
|||
|
||||
|
||||
/**
|
||||
* This function is the same as echo get_sub_field
|
||||
* This function is the same as echo get_sub_field(), but will escape the value for safe HTML output.
|
||||
*
|
||||
* @since 1.0.3
|
||||
*
|
||||
* @param string $field_name The field name.
|
||||
* @param boolean $format_value Format the value before output.
|
||||
* @param boolean $format_value Enable formatting of value. When false, the field value will be escaped at this level with `acf_esc_html`. Default true.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function the_sub_field( $field_name, $format_value = true ) {
|
||||
$field = get_sub_field_object( $field_name, $format_value );
|
||||
$field = get_sub_field_object( $field_name, $format_value, true, $format_value );
|
||||
$value = ( is_array( $field ) && isset( $field['value'] ) ) ? $field['value'] : false;
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
|
|
@ -957,30 +873,22 @@ function the_sub_field( $field_name, $format_value = true ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// If $format_value is false, we've not been able to apply field level escaping as we're giving the raw DB value. Escape the output with `acf_esc_html`.
|
||||
if ( ! $format_value ) {
|
||||
$value = acf_esc_html( $value );
|
||||
}
|
||||
|
||||
$unescaped_field = get_sub_field_object( $field_name, $format_value, true, false );
|
||||
$unescaped_value = ( is_array( $unescaped_field ) && isset( $unescaped_field['value'] ) ) ? $unescaped_field['value'] : false;
|
||||
if ( is_array( $unescaped_value ) ) {
|
||||
$unescaped_value = implode( ', ', $unescaped_value );
|
||||
}
|
||||
|
||||
$field_type = is_array( $field ) && isset( $field['type'] ) ? $field['type'] : 'text';
|
||||
|
||||
if ( ! apply_filters( 'acf/the_field/allow_unsafe_html', false, $field_name, 'sub_field', $field_type, $field ) ) {
|
||||
$field = get_sub_field_object( $field_name, $format_value, true, true );
|
||||
$new_value = ( is_array( $field ) && isset( $field['value'] ) ) ? $field['value'] : false;
|
||||
|
||||
if ( is_array( $new_value ) ) {
|
||||
$new_value = implode( ', ', $new_value );
|
||||
}
|
||||
|
||||
// If $format_value is false, we've not been able to apply field level escaping as we're giving the raw DB value. Escape the output with `acf_esc_html`.
|
||||
if ( ! $format_value ) {
|
||||
$new_value = acf_esc_html( $new_value );
|
||||
}
|
||||
|
||||
if ( (string) $value !== (string) $new_value ) {
|
||||
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) {
|
||||
$value = $new_value;
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $field_name, $field, false );
|
||||
} else {
|
||||
do_action( 'acf/will_remove_unsafe_html', __FUNCTION__, $field_name, $field, false );
|
||||
}
|
||||
}
|
||||
unset( $new_value );
|
||||
if ( apply_filters( 'acf/the_field/allow_unsafe_html', false, $field_name, 'sub_field', $field_type, $field ) ) {
|
||||
$value = $unescaped_value;
|
||||
} elseif ( (string) $value !== (string) $unescaped_value ) {
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $field_name, $field, false );
|
||||
}
|
||||
|
||||
echo $value; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped inside get_sub_field_object where necessary.
|
||||
|
|
@ -1081,7 +989,7 @@ function get_row_layout() {
|
|||
*
|
||||
* @param array $atts The shortcode attributes.
|
||||
*
|
||||
* @return string
|
||||
* @return string|void
|
||||
*/
|
||||
function acf_shortcode( $atts ) {
|
||||
// Return if the ACF shortcode is disabled.
|
||||
|
|
@ -1126,18 +1034,30 @@ function acf_shortcode( $atts ) {
|
|||
add_filter( 'acf/prevent_access_to_unknown_fields', '__return_true' );
|
||||
}
|
||||
|
||||
// Get the escaped field value.
|
||||
$field = get_field_object( $atts['field'], $atts['post_id'], $atts['format_value'], true, true );
|
||||
$value = $field ? $field['value'] : get_field( $atts['field'], $atts['post_id'], $atts['format_value'], true );
|
||||
// Decode the post ID for filtering.
|
||||
$post_id = acf_get_valid_post_id( $atts['post_id'] );
|
||||
$decoded_post_id = acf_decode_post_id( $post_id );
|
||||
|
||||
// Try to get the field value, ensuring any non-safe HTML is stripped from wysiwyg fields via `acf_the_content`
|
||||
$field = get_field_object( $atts['field'], $post_id, $atts['format_value'], true, true );
|
||||
$value = $field ? $field['value'] : get_field( $atts['field'], $post_id, $atts['format_value'], true );
|
||||
|
||||
$field_type = is_array( $field ) && isset( $field['type'] ) ? $field['type'] : 'text';
|
||||
|
||||
if ( apply_filters( 'acf/shortcode/prevent_access', false, $atts, $decoded_post_id['id'], $decoded_post_id['type'], $field_type, $field ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
$value = implode( ', ', $value );
|
||||
}
|
||||
|
||||
$field_type = is_array( $field ) && isset( $field['type'] ) ? $field['type'] : 'text';
|
||||
|
||||
// Temporarily always get the unescaped version for action comparison.
|
||||
$unescaped_value = get_field( $atts['field'], $atts['post_id'], $atts['format_value'], false );
|
||||
$unescaped_value = get_field( $atts['field'], $post_id, $atts['format_value'], false );
|
||||
|
||||
if ( $filter_applied ) {
|
||||
remove_filter( 'acf/prevent_access_to_unknown_fields', '__return_true' );
|
||||
}
|
||||
|
||||
// Remove the filter preventing access to unknown filters now we've got all the values.
|
||||
if ( $filter_applied ) {
|
||||
|
|
@ -1152,7 +1072,7 @@ function acf_shortcode( $atts ) {
|
|||
if ( apply_filters( 'acf/shortcode/allow_unsafe_html', false, $atts, $field_type, $field ) ) {
|
||||
$value = $unescaped_value;
|
||||
} elseif ( (string) $value !== (string) $unescaped_value ) {
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $atts['field'], $field, $atts['post_id'] );
|
||||
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $atts['field'], $field, $post_id );
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* acf_get_taxonomies
|
||||
*
|
||||
* Returns an array of taxonomy names.
|
||||
*
|
||||
* @date 7/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $args An array of args used in the get_taxonomies() function.
|
||||
* @return array An array of taxonomy names.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an array of taxonomy names.
|
||||
*
|
||||
* @date 7/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $args An array of args used in the get_taxonomies() function.
|
||||
* @return array An array of taxonomy names.
|
||||
*/
|
||||
function acf_get_taxonomies( $args = array() ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -46,15 +43,15 @@ function acf_get_taxonomies( $args = array() ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_taxonomies_for_post_type
|
||||
* acf_get_taxonomies_for_post_type
|
||||
*
|
||||
* Returns an array of taxonomies for a given post type(s)
|
||||
* Returns an array of taxonomies for a given post type(s)
|
||||
*
|
||||
* @date 7/9/18
|
||||
* @since 5.7.5
|
||||
* @date 7/9/18
|
||||
* @since 5.7.5
|
||||
*
|
||||
* @param string|array $post_types The post types to compare against.
|
||||
* @return array
|
||||
* @param string|array $post_types The post types to compare against.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_taxonomies_for_post_type( $post_types = 'post' ) {
|
||||
|
||||
|
|
@ -76,18 +73,15 @@ function acf_get_taxonomies_for_post_type( $post_types = 'post' ) {
|
|||
return $taxonomies;
|
||||
}
|
||||
|
||||
/*
|
||||
* acf_get_taxonomy_labels
|
||||
*
|
||||
* Returns an array of taxonomies in the format "name => label" for use in a select field.
|
||||
*
|
||||
* @date 3/8/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param array $taxonomies Optional. An array of specific taxonomies to return.
|
||||
* @return array
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an array of taxonomies in the format "name => label" for use in a select field.
|
||||
*
|
||||
* @date 3/8/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param array $taxonomies Optional. An array of specific taxonomies to return.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_taxonomy_labels( $taxonomies = array() ) {
|
||||
|
||||
// default
|
||||
|
|
@ -128,17 +122,16 @@ function acf_get_taxonomy_labels( $taxonomies = array() ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_term_title
|
||||
* acf_get_term_title
|
||||
*
|
||||
* Returns the title for this term object.
|
||||
* Returns the title for this term object.
|
||||
*
|
||||
* @date 10/9/18
|
||||
* @since 5.0.0
|
||||
* @date 10/9/18
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param object $term The WP_Term object.
|
||||
* @return string
|
||||
* @param object $term The WP_Term object.
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function acf_get_term_title( $term ) {
|
||||
$title = $term->name;
|
||||
|
||||
|
|
@ -157,17 +150,16 @@ function acf_get_term_title( $term ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_grouped_terms
|
||||
* acf_get_grouped_terms
|
||||
*
|
||||
* Returns an array of terms for the given query $args and groups by taxonomy name.
|
||||
* Returns an array of terms for the given query $args and groups by taxonomy name.
|
||||
*
|
||||
* @date 2/8/18
|
||||
* @since 5.7.2
|
||||
* @date 2/8/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param array $args An array of args used in the get_terms() function.
|
||||
* @return array
|
||||
* @param array $args An array of args used in the get_terms() function.
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function acf_get_grouped_terms( $args ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -274,19 +266,18 @@ function acf_get_grouped_terms( $args ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* _acf_terms_clauses
|
||||
* _acf_terms_clauses
|
||||
*
|
||||
* Used in the 'terms_clauses' filter to order terms by taxonomy name.
|
||||
* Used in the 'terms_clauses' filter to order terms by taxonomy name.
|
||||
*
|
||||
* @date 2/8/18
|
||||
* @since 5.7.2
|
||||
* @date 2/8/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param array $pieces Terms query SQL clauses.
|
||||
* @param array $taxonomies An array of taxonomies.
|
||||
* @param array $args An array of terms query arguments.
|
||||
* @return array $pieces
|
||||
* @param array $pieces Terms query SQL clauses.
|
||||
* @param array $taxonomies An array of taxonomies.
|
||||
* @param array $args An array of terms query arguments.
|
||||
* @return array $pieces
|
||||
*/
|
||||
|
||||
function _acf_terms_clauses( $pieces, $taxonomies, $args ) {
|
||||
|
||||
// prepend taxonomy to 'orderby' SQL
|
||||
|
|
@ -300,32 +291,30 @@ function _acf_terms_clauses( $pieces, $taxonomies, $args ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_pretty_taxonomies
|
||||
* acf_get_pretty_taxonomies
|
||||
*
|
||||
* Deprecated in favor of acf_get_taxonomy_labels() function.
|
||||
* Deprecated in favor of acf_get_taxonomy_labels() function.
|
||||
*
|
||||
* @date 7/10/13
|
||||
* @since 5.0.0
|
||||
* @deprecated 5.7.2
|
||||
* @date 7/10/13
|
||||
* @since 5.0.0
|
||||
* @deprecated 5.7.2
|
||||
*/
|
||||
|
||||
function acf_get_pretty_taxonomies( $taxonomies = array() ) {
|
||||
return acf_get_taxonomy_labels( $taxonomies );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_term
|
||||
* acf_get_term
|
||||
*
|
||||
* Similar to get_term() but with some extra functionality.
|
||||
* Similar to get_term() but with some extra functionality.
|
||||
*
|
||||
* @date 19/8/18
|
||||
* @since 5.7.3
|
||||
* @date 19/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param mixed $term_id The term ID or a string of "taxonomy:slug".
|
||||
* @param string $taxonomy The taxonomyname.
|
||||
* @return WP_Term
|
||||
* @param mixed $term_id The term ID or a string of "taxonomy:slug".
|
||||
* @param string $taxonomy The taxonomyname.
|
||||
* @return WP_Term
|
||||
*/
|
||||
|
||||
function acf_get_term( $term_id, $taxonomy = '' ) {
|
||||
|
||||
// allow $term_id parameter to be a string of "taxonomy:slug" or "taxonomy:id"
|
||||
|
|
@ -342,30 +331,30 @@ function acf_get_term( $term_id, $taxonomy = '' ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_encode_term
|
||||
* acf_encode_term
|
||||
*
|
||||
* Returns a "taxonomy:slug" string for a given WP_Term.
|
||||
* Returns a "taxonomy:slug" string for a given WP_Term.
|
||||
*
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param WP_Term $term The term object.
|
||||
* @return string
|
||||
* @param WP_Term $term The term object.
|
||||
* @return string
|
||||
*/
|
||||
function acf_encode_term( $term ) {
|
||||
return "{$term->taxonomy}:{$term->slug}";
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_decode_term
|
||||
* acf_decode_term
|
||||
*
|
||||
* Decodes a "taxonomy:slug" string into an array of taxonomy and slug.
|
||||
* Decodes a "taxonomy:slug" string into an array of taxonomy and slug.
|
||||
*
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param WP_Term $term The term object.
|
||||
* @return string
|
||||
* @param WP_Term $term The term object.
|
||||
* @return string
|
||||
*/
|
||||
function acf_decode_term( $string ) {
|
||||
if ( is_string( $string ) && strpos( $string, ':' ) ) {
|
||||
|
|
@ -376,15 +365,15 @@ function acf_decode_term( $string ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_encoded_terms
|
||||
* acf_get_encoded_terms
|
||||
*
|
||||
* Returns an array of WP_Term objects from an array of encoded strings
|
||||
* Returns an array of WP_Term objects from an array of encoded strings
|
||||
*
|
||||
* @date 9/9/18
|
||||
* @since 5.7.5
|
||||
* @date 9/9/18
|
||||
* @since 5.7.5
|
||||
*
|
||||
* @param array $values The array of encoded strings.
|
||||
* @return array
|
||||
* @param array $values The array of encoded strings.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_encoded_terms( $values ) {
|
||||
|
||||
|
|
@ -408,16 +397,16 @@ function acf_get_encoded_terms( $values ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_choices_from_terms
|
||||
* acf_get_choices_from_terms
|
||||
*
|
||||
* Returns an array of choices from the terms provided.
|
||||
* Returns an array of choices from the terms provided.
|
||||
*
|
||||
* @date 8/9/18
|
||||
* @since 5.7.5
|
||||
* @date 8/9/18
|
||||
* @since 5.7.5
|
||||
*
|
||||
* @param array $values and array of WP_Terms objects or encoded strings.
|
||||
* @param string $format The value format (term_id, slug).
|
||||
* @return array
|
||||
* @param array $values and array of WP_Terms objects or encoded strings.
|
||||
* @param string $format The value format (term_id, slug).
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_choices_from_terms( $terms, $format = 'term_id' ) {
|
||||
|
||||
|
|
@ -445,16 +434,16 @@ function acf_get_choices_from_terms( $terms, $format = 'term_id' ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_choices_from_grouped_terms
|
||||
* acf_get_choices_from_grouped_terms
|
||||
*
|
||||
* Returns an array of choices from the grouped terms provided.
|
||||
* Returns an array of choices from the grouped terms provided.
|
||||
*
|
||||
* @date 8/9/18
|
||||
* @since 5.7.5
|
||||
* @date 8/9/18
|
||||
* @since 5.7.5
|
||||
*
|
||||
* @param array $value A grouped array of WP_Terms objects.
|
||||
* @param string $format The value format (term_id, slug).
|
||||
* @return array
|
||||
* @param array $value A grouped array of WP_Terms objects.
|
||||
* @param string $format The value format (term_id, slug).
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_choices_from_grouped_terms( $value, $format = 'term_id' ) {
|
||||
|
||||
|
|
@ -475,16 +464,16 @@ function acf_get_choices_from_grouped_terms( $value, $format = 'term_id' ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* acf_get_choice_from_term
|
||||
* acf_get_choice_from_term
|
||||
*
|
||||
* Returns an array containing the id and text for this item.
|
||||
* Returns an array containing the id and text for this item.
|
||||
*
|
||||
* @date 10/9/18
|
||||
* @since 5.7.6
|
||||
* @date 10/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param object $item The item object such as WP_Post or WP_Term.
|
||||
* @param string $format The value format (term_id, slug)
|
||||
* @return array
|
||||
* @param object $item The item object such as WP_Post or WP_Term.
|
||||
* @param string $format The value format (term_id, slug)
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_choice_from_term( $term, $format = 'term_id' ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
|
|||
* List of enqueue flags.
|
||||
*
|
||||
* @since 5.9.0
|
||||
* @var bool
|
||||
* @var boolean
|
||||
*/
|
||||
private $enqueue = array();
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
|
|||
* @date 10/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $name The method name.
|
||||
* @param string $name The method name.
|
||||
* @param array $arguments The array of arguments.
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
@ -190,10 +190,10 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
|
|||
* @date 28/4/20
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param string $action The action name.
|
||||
* @param string $method The method name.
|
||||
* @param int $priority See add_action().
|
||||
* @param int $accepted_args See add_action().
|
||||
* @param string $action The action name.
|
||||
* @param string $method The method name.
|
||||
* @param integer $priority See add_action().
|
||||
* @param integer $accepted_args See add_action().
|
||||
* @return void
|
||||
*/
|
||||
public function add_action( $action, $method, $priority = 10, $accepted_args = 1 ) {
|
||||
|
|
@ -261,7 +261,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
|
|||
* @since 5.9.0
|
||||
*
|
||||
* @param array $args {
|
||||
* @type bool $uploader Whether or not to enqueue uploader scripts.
|
||||
* @type bool $uploader Whether or not to enqueue uploader scripts.
|
||||
* }
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
/** @var array Storage for data aliases. */
|
||||
var $aliases = array();
|
||||
|
||||
/** @var bool Enables unique data per site. */
|
||||
/** @var boolean Enables unique data per site. */
|
||||
var $multisite = false;
|
||||
|
||||
/**
|
||||
|
|
@ -68,7 +68,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param (string|array) $name The data name or an array of data.
|
||||
* @param (string|array) $name The data name or an array of data.
|
||||
* @param mixed $value The data value.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
|
|
@ -174,7 +174,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param (string|array) $name The data name or an array of data.
|
||||
* @param (string|array) $name The data name or an array of data.
|
||||
* @param mixed $value The data value.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
|
|
@ -258,7 +258,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
function count() {
|
||||
return count( $this->data );
|
||||
|
|
@ -273,7 +273,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return int
|
||||
* @return integer
|
||||
*/
|
||||
function query( $args, $operator = 'AND' ) {
|
||||
return wp_list_filter( $this->data, $args, $operator );
|
||||
|
|
@ -313,7 +313,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
|
|||
* @date 13/2/19
|
||||
* @since 5.7.11
|
||||
*
|
||||
* @param int $site_id New blog ID.
|
||||
* @param integer $site_id New blog ID.
|
||||
* @param int prev_blog_id Prev blog ID.
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|WP_Post $id The post ID being queried.
|
||||
* @return array|bool The main ACF array for the post, or false on failure.
|
||||
* @param integer|WP_Post $id The post ID being queried.
|
||||
* @return array|boolean The main ACF array for the post, or false on failure.
|
||||
*/
|
||||
public function get_post( $id = 0 ) {
|
||||
// Allow WP_Post to be passed.
|
||||
|
|
@ -131,7 +131,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The field ID, key or name.
|
||||
* @param integer|string $id The field ID, key or name.
|
||||
* @return array|false The field group array, or false on failure.
|
||||
*/
|
||||
public function get_raw_post( $id = 0 ) {
|
||||
|
|
@ -164,7 +164,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The post ID, key, or name.
|
||||
* @param integer|string $id The post ID, key, or name.
|
||||
* @return WP_Post|bool The post object, or false on failure.
|
||||
*/
|
||||
public function get_post_object( $id = 0 ) {
|
||||
|
|
@ -224,7 +224,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param string $id The identifier.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_post_key( $id = '' ) {
|
||||
// Check if $id is a string starting with $this->post_key.
|
||||
|
|
@ -287,8 +287,6 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
* Errors are added to the form using acf_add_internal_post_type_validation_error().
|
||||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ajax_validate_values() {}
|
||||
|
||||
|
|
@ -533,12 +531,12 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $slug The post slug.
|
||||
* @param int $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param int $post_parent Post parent ID.
|
||||
* @param string $original_slug The original post slug.
|
||||
* @param string $slug The post slug.
|
||||
* @param integer $post_ID Post ID.
|
||||
* @param string $post_status The post status.
|
||||
* @param string $post_type Post type.
|
||||
* @param integer $post_parent Post parent ID.
|
||||
* @param string $original_slug The original post slug.
|
||||
* @return string
|
||||
*/
|
||||
public function apply_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
||||
|
|
@ -574,8 +572,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ID of the ACF post to delete.
|
||||
* @return bool
|
||||
* @param integer|string $id The ID of the ACF post to delete.
|
||||
* @return boolean
|
||||
*/
|
||||
public function delete_post( $id = 0 ) {
|
||||
// Disable filters to ensure ACF loads data from DB.
|
||||
|
|
@ -611,8 +609,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ID of the ACF post to trash.
|
||||
* @return bool
|
||||
* @param integer|string $id The ID of the ACF post to trash.
|
||||
* @return boolean
|
||||
*/
|
||||
public function trash_post( $id = 0 ) {
|
||||
// Disable filters to ensure ACF loads data from DB.
|
||||
|
|
@ -644,8 +642,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ID of the ACF post to untrash.
|
||||
* @return bool
|
||||
* @param integer|string $id The ID of the ACF post to untrash.
|
||||
* @return boolean
|
||||
*/
|
||||
public function untrash_post( $id = 0 ) {
|
||||
// Disable filters to ensure ACF loads data from DB.
|
||||
|
|
@ -678,9 +676,9 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param int $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @param string $new_status The new status of the post being restored.
|
||||
* @param integer $post_id The ID of the post being restored.
|
||||
* @param string $previous_status The status of the post at the point where it was trashed.
|
||||
* @return string
|
||||
*/
|
||||
public function untrash_post_status( $new_status, $post_id, $previous_status ) {
|
||||
|
|
@ -693,7 +691,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
* @since 6.1
|
||||
*
|
||||
* @param array $post The post array to check.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_post( $post = false ) {
|
||||
return (
|
||||
|
|
@ -708,8 +706,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ID of the post to duplicate.
|
||||
* @param int $new_post_id Optional post ID to override.
|
||||
* @param integer|string $id The ID of the post to duplicate.
|
||||
* @param integer $new_post_id Optional post ID to override.
|
||||
* @return array The new ACF post array.
|
||||
*/
|
||||
public function duplicate_post( $id = 0, $new_post_id = 0 ) {
|
||||
|
|
@ -756,9 +754,9 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int|string $id The ID of the ACF post to activate/deactivate.
|
||||
* @param bool $activate True if the post should be activated.
|
||||
* @return bool
|
||||
* @param integer|string $id The ID of the ACF post to activate/deactivate.
|
||||
* @param boolean $activate True if the post should be activated.
|
||||
* @return boolean
|
||||
*/
|
||||
public function update_post_active_status( $id, $activate = true ) {
|
||||
// Disable filters to ensure ACF loads data from DB.
|
||||
|
|
@ -793,7 +791,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
|
|||
*
|
||||
* @since 6.1
|
||||
*
|
||||
* @param int $post_id The ACF post ID.
|
||||
* @param integer $post_id The ACF post ID.
|
||||
* @return string
|
||||
*/
|
||||
public function get_post_edit_link( $post_id ) {
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
class ACF_Compatibility {
|
||||
|
||||
/**
|
||||
* __construct
|
||||
* __construct
|
||||
*
|
||||
* Sets up the class functionality.
|
||||
* Sets up the class functionality.
|
||||
*
|
||||
* @date 30/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 30/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
* @since 5.7.10
|
||||
*
|
||||
* @param array $wrapper The wrapper attributes array.
|
||||
* @param array $field The field array.
|
||||
* @param array $field The field array.
|
||||
*/
|
||||
function field_wrapper_attributes( $wrapper, $field ) {
|
||||
|
||||
|
|
@ -92,15 +92,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_field
|
||||
* validate_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_field( $field ) {
|
||||
|
||||
|
|
@ -121,15 +121,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_textarea_field
|
||||
* validate_textarea_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_textarea_field( $field ) {
|
||||
|
||||
|
|
@ -144,15 +144,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_relationship_field
|
||||
* validate_relationship_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_relationship_field( $field ) {
|
||||
|
||||
|
|
@ -176,15 +176,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_image_field
|
||||
* validate_image_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_image_field( $field ) {
|
||||
|
||||
|
|
@ -203,15 +203,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_wysiwyg_field
|
||||
* validate_wysiwyg_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_wysiwyg_field( $field ) {
|
||||
|
||||
|
|
@ -227,15 +227,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_date_picker_field
|
||||
* validate_date_picker_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_date_picker_field( $field ) {
|
||||
|
||||
|
|
@ -262,15 +262,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_taxonomy_field
|
||||
* validate_taxonomy_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_taxonomy_field( $field ) {
|
||||
|
||||
|
|
@ -284,15 +284,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_date_time_picker_field
|
||||
* validate_date_time_picker_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_date_time_picker_field( $field ) {
|
||||
|
||||
|
|
@ -324,15 +324,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_user_field
|
||||
* validate_user_field
|
||||
*
|
||||
* Adds compatibility with deprecated settings
|
||||
* Adds compatibility with deprecated settings
|
||||
*
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
* @date 23/04/2014
|
||||
* @since 5.2.7
|
||||
*
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
* @param array $field The field array.
|
||||
* @return array $field
|
||||
*/
|
||||
function validate_user_field( $field ) {
|
||||
|
||||
|
|
@ -357,18 +357,16 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
return $field;
|
||||
}
|
||||
|
||||
/*
|
||||
* validate_field_group
|
||||
*
|
||||
* This function will provide compatibility with ACF4 field groups
|
||||
*
|
||||
* @type function
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $field_group (array)
|
||||
* @return $field_group
|
||||
*/
|
||||
/**
|
||||
* This function will provide compatibility with ACF4 field groups
|
||||
*
|
||||
* @type function
|
||||
* @date 23/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $field_group (array)
|
||||
* @return $field_group
|
||||
*/
|
||||
function validate_field_group( $field_group ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -441,15 +439,15 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_post_taxonomy_location_rule
|
||||
* validate_post_taxonomy_location_rule
|
||||
*
|
||||
* description
|
||||
* description
|
||||
*
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
* @date 27/8/18
|
||||
* @since 5.7.4
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
function validate_post_taxonomy_location_rule( $rule ) {
|
||||
|
||||
|
|
@ -470,16 +468,14 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
|
|||
acf_new_instance( 'ACF_Compatibility' );
|
||||
endif; // class_exists check
|
||||
|
||||
/*
|
||||
* acf_get_compatibility
|
||||
*
|
||||
/**
|
||||
* Returns true if compatibility is enabled for the given component.
|
||||
*
|
||||
* @date 20/1/15
|
||||
* @since 5.1.5
|
||||
*
|
||||
* @param string $name The name of the component to check.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_get_compatibility( $name ) {
|
||||
return apply_filters( "acf/compatibility/{$name}", false );
|
||||
|
|
|
|||
|
|
@ -58,16 +58,14 @@ function acf_render_field_wrap_description( $field ) {
|
|||
acf_render_field_instructions( $field );
|
||||
}
|
||||
|
||||
/*
|
||||
* acf_get_fields_by_id
|
||||
*
|
||||
/**
|
||||
* Returns and array of fields for the given $parent_id.
|
||||
*
|
||||
* @date 27/02/2014
|
||||
* @since 5.0.0.
|
||||
* @deprecated 5.7.11
|
||||
*
|
||||
* @param int $parent_id The parent ID.
|
||||
* @param integer $parent_id The parent ID.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_fields_by_id( $parent_id = 0 ) {
|
||||
|
|
@ -93,10 +91,10 @@ function acf_get_fields_by_id( $parent_id = 0 ) {
|
|||
* @since 5.0.0
|
||||
* @deprecated 5.7.11
|
||||
*
|
||||
* @param string $option The option name.
|
||||
* @param string $value The option value.
|
||||
* @param string $option The option name.
|
||||
* @param string $value The option value.
|
||||
* @param string $autoload An optional autoload value.
|
||||
* @return bool
|
||||
* @return boolean
|
||||
*/
|
||||
function acf_update_option( $option = '', $value = '', $autoload = null ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -12,36 +12,32 @@ if ( ! class_exists( 'acf_fields' ) ) :
|
|||
var $types = array();
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the class functionality
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the class functionality
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* register_field_type
|
||||
*
|
||||
* This function will register a field type instance
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $class (string)
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will register a field type instance
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $class (string)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function register_field_type( $class ) {
|
||||
|
||||
|
|
@ -57,56 +53,49 @@ if ( ! class_exists( 'acf_fields' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_field_type
|
||||
*
|
||||
* This function will return a field type instance
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
/**
|
||||
* This function will return a field type instance
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
|
||||
function get_field_type( $name ) {
|
||||
return isset( $this->types[ $name ] ) ? $this->types[ $name ] : null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* is_field_type
|
||||
*
|
||||
* This function will return true if a field type exists
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
/**
|
||||
* This function will return true if a field type exists
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
|
||||
function is_field_type( $name ) {
|
||||
return isset( $this->types[ $name ] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* register_field_type_info
|
||||
*
|
||||
* This function will store a basic array of info about the field type
|
||||
* to later be overriden by the above register_field_type function
|
||||
*
|
||||
* @type function
|
||||
* @date 29/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $info (array)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will store a basic array of info about the field type
|
||||
* to later be overriden by the above register_field_type function
|
||||
*
|
||||
* @type function
|
||||
* @date 29/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $info (array)
|
||||
* @return n/a
|
||||
*/
|
||||
function register_field_type_info( $info ) {
|
||||
|
||||
// convert to object
|
||||
|
|
@ -115,19 +104,16 @@ if ( ! class_exists( 'acf_fields' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_field_types
|
||||
*
|
||||
* This function will return an array of all field types
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will return an array of all field types
|
||||
*
|
||||
* @type function
|
||||
* @date 6/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $name (string)
|
||||
* @return (mixed)
|
||||
*/
|
||||
function get_field_types() {
|
||||
return $this->types;
|
||||
}
|
||||
|
|
@ -139,73 +125,61 @@ if ( ! class_exists( 'acf_fields' ) ) :
|
|||
endif; // class_exists check
|
||||
|
||||
|
||||
/*
|
||||
* acf_register_field_type
|
||||
*
|
||||
* alias of acf()->fields->register_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->fields->register_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_register_field_type( $class ) {
|
||||
return acf()->fields->register_field_type( $class );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_register_field_type_info
|
||||
*
|
||||
* alias of acf()->fields->register_field_type_info()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->fields->register_field_type_info()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_register_field_type_info( $info ) {
|
||||
return acf()->fields->register_field_type_info( $info );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_field_type
|
||||
*
|
||||
* alias of acf()->fields->get_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->fields->get_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_get_field_type( $name ) {
|
||||
return acf()->fields->get_field_type( $name );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_field_types
|
||||
*
|
||||
* alias of acf()->fields->get_field_types()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->fields->get_field_types()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_get_field_types( $args = array() ) {
|
||||
|
||||
// default
|
||||
|
|
@ -225,17 +199,16 @@ function acf_get_field_types( $args = array() ) {
|
|||
|
||||
|
||||
/**
|
||||
* acf_get_field_types_info
|
||||
* acf_get_field_types_info
|
||||
*
|
||||
* Returns an array containing information about each field type
|
||||
* Returns an array containing information about each field type
|
||||
*
|
||||
* @date 18/6/18
|
||||
* @since 5.6.9
|
||||
* @date 18/6/18
|
||||
* @since 5.6.9
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
|
||||
function acf_get_field_types_info( $args = array() ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -264,56 +237,47 @@ function acf_get_field_types_info( $args = array() ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_is_field_type
|
||||
*
|
||||
* alias of acf()->fields->is_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* alias of acf()->fields->is_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 31/5/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
function acf_is_field_type( $name = '' ) {
|
||||
return acf()->fields->is_field_type( $name );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_field_type_prop
|
||||
*
|
||||
* This function will return a field type's property
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will return a field type's property
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
function acf_get_field_type_prop( $name = '', $prop = '' ) {
|
||||
$type = acf_get_field_type( $name );
|
||||
return ( $type && isset( $type->$prop ) ) ? $type->$prop : null;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_field_type_label
|
||||
*
|
||||
* This function will return the label of a field type
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function will return the label of a field type
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
function acf_get_field_type_label( $name = '' ) {
|
||||
$label = acf_get_field_type_prop( $name, 'label' );
|
||||
return $label ? $label : '<span class="acf-tooltip-js" title="' . __( 'Field type does not exist', 'acf' ) . '">' . __( 'Unknown', 'acf' ) . '</span>';
|
||||
|
|
@ -339,19 +303,18 @@ function acf_field_type_supports( $name = '', $prop = '', $default = false ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_field_type_exists (deprecated)
|
||||
*
|
||||
* deprecated in favour of acf_is_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $type (string)
|
||||
* @return (boolean)
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @see acf_is_field_type()
|
||||
*
|
||||
* @type function
|
||||
* @date 1/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $type (string)
|
||||
* @return (boolean)
|
||||
*/
|
||||
function acf_field_type_exists( $type = '' ) {
|
||||
return acf_is_field_type( $type );
|
||||
}
|
||||
|
|
@ -380,11 +343,11 @@ function acf_get_field_categories_i18n() {
|
|||
|
||||
|
||||
/**
|
||||
* Returns an multi-dimentional array of field types "name => label" grouped by category
|
||||
* Returns an multi-dimentional array of field types "name => label" grouped by category
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_grouped_field_types() {
|
||||
|
||||
|
|
@ -412,14 +375,14 @@ function acf_get_grouped_field_types() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tabs for a field type.
|
||||
* We combine a list of default tabs with filtered tabs.
|
||||
* I.E. Default tabs should be static and should not be changed by the
|
||||
* filtered tabs.
|
||||
* Returns an array of tabs for a field type.
|
||||
* We combine a list of default tabs with filtered tabs.
|
||||
* I.E. Default tabs should be static and should not be changed by the
|
||||
* filtered tabs.
|
||||
*
|
||||
* @since 6.1
|
||||
* @since 6.1
|
||||
*
|
||||
* @return array Key/value array of the default settings tabs for field type settings.
|
||||
* @return array Key/value array of the default settings tabs for field type settings.
|
||||
*/
|
||||
function acf_get_combined_field_type_settings_tabs() {
|
||||
$default_field_type_settings_tabs = array(
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
public $show_in_rest = false;
|
||||
|
||||
/**
|
||||
* initialize
|
||||
* initialize
|
||||
*
|
||||
* This function will setup the field type data
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @date 30/10/17
|
||||
* @since 5.6.3
|
||||
|
|
@ -37,9 +37,9 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* render_field
|
||||
* render_field
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @date 30/10/17
|
||||
* @since 5.6.3
|
||||
|
|
@ -65,18 +65,16 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -113,19 +111,17 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_field()
|
||||
*
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
|
||||
function load_field( $field ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* initialize()
|
||||
* initialize()
|
||||
*
|
||||
* This function will setup the field type data
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
|
@ -37,18 +37,13 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* render_field()
|
||||
* Creates the field's input HTML
|
||||
*
|
||||
* Creates the field's input HTML
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field settings array
|
||||
* @return n/a
|
||||
* @param array $field The field settings array
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
public function render_field( $field ) {
|
||||
|
||||
// vars
|
||||
$html = '';
|
||||
|
|
@ -98,7 +93,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
$html .= acf_get_hidden_input( array( 'name' => $field['name'] ) );
|
||||
|
||||
// open
|
||||
$html .= '<div ' . acf_esc_attr( $div ) . '>';
|
||||
$html .= '<div ' . acf_esc_attrs( $div ) . '>';
|
||||
|
||||
// loop
|
||||
foreach ( $buttons as $button ) {
|
||||
|
|
@ -118,20 +113,20 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
$html .= '</div>';
|
||||
|
||||
// return
|
||||
echo $html;
|
||||
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- safe HTML, escaped by input building functions.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* render_field_settings()
|
||||
* render_field_settings()
|
||||
*
|
||||
* Creates the field's settings HTML
|
||||
* Creates the field's settings HTML
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field settings array
|
||||
* @return n/a
|
||||
* @param array $field The field settings array
|
||||
* @return n/a
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
// Encode choices (convert from array).
|
||||
|
|
@ -220,17 +215,15 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* update_field()
|
||||
*
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function update_field( $field ) {
|
||||
|
||||
|
|
@ -238,19 +231,17 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param mixed $value The value found in the database
|
||||
* @param mixed $post_id The post ID from which the value was loaded from
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param mixed $value The value found in the database
|
||||
* @param mixed $post_id The post ID from which the value was loaded from
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function load_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -258,17 +249,15 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* translate_field
|
||||
*
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function translate_field( $field ) {
|
||||
|
||||
|
|
@ -276,19 +265,17 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param mixed $value The value found in the database
|
||||
* @param mixed $post_id The post ID from which the value was loaded from
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @date 18/9/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param mixed $value The value found in the database
|
||||
* @param mixed $post_id The post ID from which the value was loaded from
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
class acf_field_checkbox extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -40,20 +38,18 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -99,22 +95,20 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
// return
|
||||
echo '<ul ' . acf_esc_attr( $ul ) . '>' . "\n" . $li . '</ul>' . "\n";
|
||||
echo '<ul ' . acf_esc_attrs( $ul ) . '>' . "\n" . $li . '</ul>' . "\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by specific render methods above.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_choices
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function render_field_choices( $field ) {
|
||||
|
||||
|
|
@ -125,17 +119,15 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
/**
|
||||
* Validates values for the checkbox field
|
||||
*
|
||||
* @date 09/12/2022
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param bool $valid If the field is valid.
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $field The main field array.
|
||||
* @param string $input The input element's name attribute.
|
||||
*
|
||||
* @return bool
|
||||
* @param boolean $valid If the field is valid.
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $field The main field array.
|
||||
* @param string $input The input element's name attribute.
|
||||
* @return boolean
|
||||
*/
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
public function validate_value( $valid, $value, $field, $input ) {
|
||||
if ( ! is_array( $value ) || empty( $field['allow_custom'] ) ) {
|
||||
return $valid;
|
||||
}
|
||||
|
|
@ -149,18 +141,16 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
return $valid;
|
||||
}
|
||||
|
||||
/*
|
||||
* render_field_toggle
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function render_field_toggle( $field ) {
|
||||
|
||||
|
|
@ -186,18 +176,16 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_custom
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/7/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function render_field_custom( $field ) {
|
||||
|
||||
|
|
@ -318,18 +306,16 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
// Encode choices (convert from array).
|
||||
$field['choices'] = acf_encode_choices( $field['choices'] );
|
||||
|
|
@ -445,20 +431,18 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* update_field()
|
||||
*
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the field group ID (post_type = acf)
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the field group ID (post_type = acf)
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
|
||||
function update_field( $field ) {
|
||||
|
||||
|
|
@ -469,21 +453,19 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -538,18 +520,16 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* translate_field
|
||||
*
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function translate_field( $field ) {
|
||||
|
||||
|
|
@ -557,21 +537,19 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
class acf_field_color_picker extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -35,18 +33,16 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -102,17 +98,15 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
$text_input = acf_get_sub_array( $field, array( 'id', 'class', 'name', 'value' ) );
|
||||
|
|
@ -134,18 +128,16 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
|
||||
|
|
@ -194,13 +186,11 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
|
|||
* Format the value for use in templates. At this stage, the value has been loaded from the
|
||||
* database and is being returned by an API function such as get_field(), the_field(), etc.
|
||||
*
|
||||
* @since 5.10
|
||||
* @date 15/12/20
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param int $post_id
|
||||
* @param array $field
|
||||
* @since 5.10
|
||||
*
|
||||
* @param mixed $value The field value
|
||||
* @param integer $post_id The post ID
|
||||
* @param array $field The field array
|
||||
* @return string|array
|
||||
*/
|
||||
public function format_value( $value, $post_id, $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
class acf_field_date_picker extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -35,18 +33,16 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -82,17 +78,15 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -153,18 +147,16 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
global $wp_locale;
|
||||
|
||||
|
|
@ -238,21 +230,19 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -267,18 +257,17 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* This filter is applied to the $field after it is loaded from the database
|
||||
* and ensures the return and display values are set.
|
||||
* This filter is applied to the $field after it is loaded from the database
|
||||
* and ensures the return and display values are set.
|
||||
*
|
||||
* @type filter
|
||||
* @since 5.11.0
|
||||
* @date 28/09/21
|
||||
* @type filter
|
||||
* @since 5.11.0
|
||||
* @date 28/09/21
|
||||
*
|
||||
* @param array $field The field array holding all the field options.
|
||||
*
|
||||
* @return array
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @return array
|
||||
*/
|
||||
function load_field( $field ) {
|
||||
public function load_field( $field ) {
|
||||
if ( empty( $field['display_format'] ) ) {
|
||||
$field['display_format'] = $this->defaults['display_format'];
|
||||
}
|
||||
|
|
@ -293,7 +282,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
/**
|
||||
* Return the schema array for the REST API.
|
||||
*
|
||||
* @param array $field
|
||||
* @param array $field The field array
|
||||
* @return array
|
||||
*/
|
||||
public function get_rest_schema( array $field ) {
|
||||
|
|
@ -307,9 +296,9 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
class acf_field_date_and_time_picker extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -35,18 +33,16 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -93,17 +89,15 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -153,18 +147,16 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
global $wp_locale;
|
||||
|
||||
|
|
@ -225,41 +217,33 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
*
|
||||
* @param mixed $value The value which was loaded from the database
|
||||
* @param mixed $post_id The post_id from which the value was loaded
|
||||
* @param array $field The field array holding all the field options
|
||||
* @return mixed $value The modified value
|
||||
*/
|
||||
public function format_value( $value, $post_id, $field ) {
|
||||
return acf_format_date( $value, $field['return_format'] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This filter is applied to the $field after it is loaded from the database
|
||||
* and ensures the return and display values are set.
|
||||
* This filter is applied to the $field after it is loaded from the database
|
||||
* and ensures the return and display values are set.
|
||||
*
|
||||
* @type filter
|
||||
* @since 5.11.0
|
||||
* @date 28/09/21
|
||||
* @type filter
|
||||
* @since 5.11.0
|
||||
*
|
||||
* @param array $field The field array holding all the field options.
|
||||
*
|
||||
* @return array
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @return array
|
||||
*/
|
||||
function load_field( $field ) {
|
||||
public function load_field( $field ) {
|
||||
if ( empty( $field['display_format'] ) ) {
|
||||
$field['display_format'] = $this->defaults['display_format'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
class acf_field_email extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -35,17 +33,15 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -88,22 +84,20 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
$html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>';
|
||||
|
||||
// return
|
||||
echo $html;
|
||||
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- safe HTML escaped by acf_get_text_input
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -161,12 +155,11 @@ if ( ! class_exists( 'acf_field_email' ) ) :
|
|||
* FALSE or a string is returned, the input value is invalid and the user is shown a
|
||||
* notice. If a string is returned, the string is show as the message text.
|
||||
*
|
||||
* @param bool $valid Whether the value is valid.
|
||||
* @param mixed $value The field value.
|
||||
* @param array $field The field array.
|
||||
* @param string $input The request variable name for the inbound field.
|
||||
*
|
||||
* @return bool|string
|
||||
* @param boolean $valid Whether the value is valid.
|
||||
* @param mixed $value The field value.
|
||||
* @param array $field The field array.
|
||||
* @param string $input The request variable name for the inbound field.
|
||||
* @return boolean|string
|
||||
*/
|
||||
public function validate_value( $valid, $value, $field, $input ) {
|
||||
$flags = defined( 'FILTER_FLAG_EMAIL_UNICODE' ) ? FILTER_FLAG_EMAIL_UNICODE : 0;
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
class acf_field_file extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -40,18 +38,16 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -66,17 +62,15 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -146,19 +140,19 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
<strong data-name="title"><?php echo esc_html( $o['title'] ); ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong><?php _e( 'File name', 'acf' ); ?>:</strong>
|
||||
<strong><?php esc_html_e( 'File name', 'acf' ); ?>:</strong>
|
||||
<a data-name="filename" href="<?php echo esc_url( $o['url'] ); ?>" target="_blank"><?php echo esc_html( $o['filename'] ); ?></a>
|
||||
</p>
|
||||
<p>
|
||||
<strong><?php _e( 'File size', 'acf' ); ?>:</strong>
|
||||
<strong><?php esc_html_e( 'File size', 'acf' ); ?>:</strong>
|
||||
<span data-name="filesize"><?php echo esc_html( $o['filesize'] ); ?></span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="acf-actions -hover">
|
||||
<?php if ( $uploader != 'basic' ) : ?>
|
||||
<a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e( 'Edit', 'acf' ); ?>"></a>
|
||||
<a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php esc_attr_e( 'Edit', 'acf' ); ?>"></a>
|
||||
<?php endif; ?>
|
||||
<a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e( 'Remove', 'acf' ); ?>"></a>
|
||||
<a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php esc_attr_e( 'Remove', 'acf' ); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-if-value">
|
||||
|
|
@ -182,7 +176,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php _e( 'No file selected', 'acf' ); ?> <a data-name="add" class="acf-button button" href="#"><?php _e( 'Add File', 'acf' ); ?></a></p>
|
||||
<p><?php esc_html_e( 'No file selected', 'acf' ); ?> <a data-name="add" class="acf-button button" href="#"><?php esc_html_e( 'Add File', 'acf' ); ?></a></p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
@ -191,18 +185,16 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -292,21 +284,19 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -335,18 +325,16 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_media_item_args
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 27/01/13
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param $vars (array)
|
||||
* @return $vars
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 27/01/13
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param $vars (array)
|
||||
* @return $vars
|
||||
*/
|
||||
|
||||
function get_media_item_args( $vars ) {
|
||||
|
||||
|
|
@ -355,21 +343,19 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -389,16 +375,16 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* validate_value
|
||||
* validate_value
|
||||
*
|
||||
* This function will validate a basic file input
|
||||
* This function will validate a basic file input
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
|
||||
|
|
@ -441,11 +427,10 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
/**
|
||||
* Validates file fields updated via the REST API.
|
||||
*
|
||||
* @param bool $valid
|
||||
* @param int $value
|
||||
* @param array $field
|
||||
*
|
||||
* @return bool|WP_Error
|
||||
* @param boolean $valid The current validity booleean
|
||||
* @param integer $value The value of the field
|
||||
* @param array $field The field array
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function validate_rest_value( $valid, $value, $field ) {
|
||||
if ( is_null( $value ) && empty( $field['required'] ) ) {
|
||||
|
|
@ -525,9 +510,9 @@ if ( ! class_exists( 'acf_field_file' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
class acf_field_google_map extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -42,18 +40,16 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -102,17 +98,15 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -155,12 +149,12 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
<div class="title">
|
||||
|
||||
<div class="acf-actions -hover">
|
||||
<a href="#" data-name="search" class="acf-icon -search grey" title="<?php _e( 'Search', 'acf' ); ?>"></a>
|
||||
<a href="#" data-name="clear" class="acf-icon -cancel grey" title="<?php _e( 'Clear location', 'acf' ); ?>"></a>
|
||||
<a href="#" data-name="locate" class="acf-icon -location grey" title="<?php _e( 'Find current location', 'acf' ); ?>"></a>
|
||||
<a href="#" data-name="search" class="acf-icon -search grey" title="<?php esc_attr_e( 'Search', 'acf' ); ?>"></a>
|
||||
<a href="#" data-name="clear" class="acf-icon -cancel grey" title="<?php esc_attr_e( 'Clear location', 'acf' ); ?>"></a>
|
||||
<a href="#" data-name="locate" class="acf-icon -location grey" title="<?php esc_attr_e( 'Find current location', 'acf' ); ?>"></a>
|
||||
</div>
|
||||
|
||||
<input class="search" type="text" placeholder="<?php _e( 'Search for address...', 'acf' ); ?>" value="<?php echo esc_attr( $search ); ?>" />
|
||||
<input class="search" type="text" placeholder="<?php esc_attr_e( 'Search for address...', 'acf' ); ?>" value="<?php echo esc_attr( $search ); ?>" />
|
||||
<i class="acf-loading"></i>
|
||||
|
||||
</div>
|
||||
|
|
@ -172,18 +166,16 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
|
||||
|
|
@ -248,9 +240,9 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
* @date 16/10/19
|
||||
* @since 5.8.1
|
||||
*
|
||||
* @param mixed $value The value loaded from the database.
|
||||
* @param mixed $value The value loaded from the database.
|
||||
* @param mixed $post_id The post ID where the value is saved.
|
||||
* @param array $field The field settings array.
|
||||
* @param array $field The field settings array.
|
||||
* @return (array|false)
|
||||
*/
|
||||
function load_value( $value, $post_id, $field ) {
|
||||
|
|
@ -272,21 +264,19 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
// decode JSON string.
|
||||
|
|
@ -366,9 +356,9 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
class acf_field__group extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -39,19 +37,17 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_field()
|
||||
*
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
|
||||
function load_field( $field ) {
|
||||
|
||||
|
|
@ -68,20 +64,18 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_value()
|
||||
*
|
||||
* This filter is applied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value found in the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This filter is applied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value found in the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function load_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -114,11 +108,10 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
* @type filter
|
||||
* @since 3.6
|
||||
*
|
||||
* @param mixed $value The value which was loaded from the database.
|
||||
* @param mixed $post_id The $post_id from which the value was loaded.
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @param boolean $escape_html Should the field return a HTML safe formatted value.
|
||||
*
|
||||
* @param mixed $value The value which was loaded from the database.
|
||||
* @param mixed $post_id The $post_id from which the value was loaded.
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @param boolean $escape_html Should the field return a HTML safe formatted value.
|
||||
* @return mixed the modified value
|
||||
*/
|
||||
public function format_value( $value, $post_id, $field, $escape_html = false ) {
|
||||
|
|
@ -148,21 +141,19 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -209,18 +200,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* prepare_field_for_db
|
||||
*
|
||||
* This function will modify sub fields ready for update / load
|
||||
*
|
||||
* @type function
|
||||
* @date 4/11/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This function will modify sub fields ready for update / load
|
||||
*
|
||||
* @type function
|
||||
* @date 4/11/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function prepare_field_for_db( $field ) {
|
||||
|
||||
|
|
@ -241,17 +230,15 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -292,18 +279,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_block
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 12/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 12/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function render_field_block( $field ) {
|
||||
|
||||
|
|
@ -311,7 +296,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
$label_placement = ( $field['layout'] == 'block' ) ? 'top' : 'left';
|
||||
|
||||
// html
|
||||
echo '<div class="acf-fields -' . $label_placement . ' -border">';
|
||||
echo '<div class="acf-fields -' . esc_attr( $label_placement ) . ' -border">';
|
||||
|
||||
foreach ( $field['sub_fields'] as $sub_field ) {
|
||||
acf_render_field_wrap( $sub_field );
|
||||
|
|
@ -321,18 +306,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_table
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 12/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 12/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function render_field_table( $field ) {
|
||||
|
||||
|
|
@ -388,18 +371,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
|
||||
|
|
@ -413,7 +394,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
?>
|
||||
<div class="acf-field acf-field-setting-sub_fields" data-setting="group" data-name="sub_fields">
|
||||
<div class="acf-label">
|
||||
<label><?php _e( 'Sub Fields', 'acf' ); ?></label>
|
||||
<label><?php esc_html_e( 'Sub Fields', 'acf' ); ?></label>
|
||||
</div>
|
||||
<div class="acf-input acf-input-sub">
|
||||
<?php
|
||||
|
|
@ -444,18 +425,16 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* validate_value
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
|
||||
|
|
@ -494,19 +473,17 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* duplicate_field()
|
||||
*
|
||||
* This filter is appied to the $field before it is duplicated and saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field before it is duplicated and saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
|
||||
function duplicate_field( $field ) {
|
||||
|
||||
|
|
@ -573,19 +550,17 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* delete_value
|
||||
*
|
||||
* Called when deleting this field's value.
|
||||
*
|
||||
* @date 1/07/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param mixed $post_id The post ID being saved
|
||||
* @param string $meta_key The field name as seen by the DB
|
||||
* @param array $field The field settings
|
||||
* @return void
|
||||
*/
|
||||
/**
|
||||
* Called when deleting this field's value.
|
||||
*
|
||||
* @date 1/07/2015
|
||||
* @since 5.2.3
|
||||
*
|
||||
* @param mixed $post_id The post ID being saved
|
||||
* @param string $meta_key The field name as seen by the DB
|
||||
* @param array $field The field settings
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function delete_value( $post_id, $meta_key, $field ) {
|
||||
|
||||
|
|
@ -604,15 +579,15 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
}
|
||||
|
||||
/**
|
||||
* delete_field
|
||||
* delete_field
|
||||
*
|
||||
* Called when deleting a field of this type.
|
||||
* Called when deleting a field of this type.
|
||||
*
|
||||
* @date 8/11/18
|
||||
* @since 5.8.0
|
||||
* @date 8/11/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param arra $field The field settings.
|
||||
* @return void
|
||||
* @param arra $field The field settings.
|
||||
* @return void
|
||||
*/
|
||||
function delete_field( $field ) {
|
||||
|
||||
|
|
@ -649,9 +624,9 @@ if ( ! class_exists( 'acf_field__group' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param int|string $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param integer|string $post_id
|
||||
* @param array $field
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
class acf_field_image extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -45,18 +43,16 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
|
||||
|
|
@ -136,9 +132,9 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
<img <?php echo acf_esc_attrs( $img_attrs ); ?> />
|
||||
<div class="acf-actions -hover">
|
||||
<?php if ( $uploader !== 'basic' ) : ?>
|
||||
<a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e( 'Edit', 'acf' ); ?>"></a>
|
||||
<a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php esc_attr_e( 'Edit', 'acf' ); ?>"></a>
|
||||
<?php endif; ?>
|
||||
<a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e( 'Remove', 'acf' ); ?>"></a>
|
||||
<a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php esc_attr_e( 'Remove', 'acf' ); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-if-value">
|
||||
|
|
@ -158,7 +154,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
?>
|
||||
</label>
|
||||
<?php else : ?>
|
||||
<p><?php _e( 'No image selected', 'acf' ); ?> <a data-name="add" class="acf-button button" href="#"><?php _e( 'Add Image', 'acf' ); ?></a></p>
|
||||
<p><?php esc_html_e( 'No image selected', 'acf' ); ?> <a data-name="add" class="acf-button button" href="#"><?php esc_html_e( 'Add Image', 'acf' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -166,18 +162,16 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
|
|
@ -341,21 +335,19 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -384,18 +376,16 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_media_item_args
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 27/01/13
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param $vars (array)
|
||||
* @return $vars
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 27/01/13
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param $vars (array)
|
||||
* @return $vars
|
||||
*/
|
||||
|
||||
function get_media_item_args( $vars ) {
|
||||
|
||||
|
|
@ -404,21 +394,19 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -427,29 +415,28 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* validate_value
|
||||
* This function will validate a basic file input
|
||||
*
|
||||
* This function will validate a basic file input
|
||||
* @type function
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param boolean $valid The current validity status.
|
||||
* @param mixed $value The field value.
|
||||
* @param array $field The field array.
|
||||
* @param string $input The name of the input in the POST object.
|
||||
* @return boolean The validity status.
|
||||
*/
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
public function validate_value( $valid, $value, $field, $input ) {
|
||||
return acf_get_field_type( 'file' )->validate_value( $valid, $value, $field, $input );
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional validation for the image field when submitted via REST.
|
||||
*
|
||||
* @param bool $valid
|
||||
* @param int $value
|
||||
* @param array $field
|
||||
*
|
||||
* @return bool|WP_Error
|
||||
* @param boolean $valid The current validity booleean
|
||||
* @param integer $value The value of the field
|
||||
* @param array $field The field array
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function validate_rest_value( $valid, $value, $field ) {
|
||||
return acf_get_field_type( 'file' )->validate_rest_value( $valid, $value, $field );
|
||||
|
|
@ -458,7 +445,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
/**
|
||||
* Return the schema array for the REST API.
|
||||
*
|
||||
* @param array $field
|
||||
* @param array $field The field array
|
||||
* @return array
|
||||
*/
|
||||
public function get_rest_schema( array $field ) {
|
||||
|
|
@ -468,9 +455,9 @@ if ( ! class_exists( 'acf_field_image' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value The field value
|
||||
* @param string|integer $post_id The post ID
|
||||
* @param array $field The field array
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
class acf_field_link extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -33,18 +31,16 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_link
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/5/17
|
||||
* @since 5.5.13
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/5/17
|
||||
* @since 5.5.13
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function get_link( $value = '' ) {
|
||||
|
||||
|
|
@ -74,19 +70,15 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
*/
|
||||
public function render_field( $field ) {
|
||||
|
||||
// vars
|
||||
$div = array(
|
||||
|
|
@ -108,11 +100,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
if ( $link['target'] === '_blank' ) {
|
||||
$div['class'] .= ' -external';
|
||||
}
|
||||
|
||||
/*
|
||||
<textarea id="<?php echo esc_attr($field['id']); ?>-textarea"><?php
|
||||
echo esc_textarea('<a href="'.$link['url'].'" target="'.$link['target'].'">'.$link['title'].'</a>');
|
||||
?></textarea>*/
|
||||
?>
|
||||
<div <?php echo acf_esc_attrs( $div ); ?>>
|
||||
|
||||
|
|
@ -131,12 +118,12 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<a href="#" class="button" data-name="add" target=""><?php _e( 'Select Link', 'acf' ); ?></a>
|
||||
<a href="#" class="button" data-name="add" target=""><?php esc_html_e( 'Select Link', 'acf' ); ?></a>
|
||||
|
||||
<div class="link-wrap">
|
||||
<span class="link-title"><?php echo esc_html( $link['title'] ); ?></span>
|
||||
<a class="link-url" href="<?php echo esc_url( $link['url'] ); ?>" target="_blank"><?php echo esc_html( $link['url'] ); ?></a>
|
||||
<i class="acf-icon -link-ext acf-js-tooltip" title="<?php _e( 'Opens in a new window/tab', 'acf' ); ?>"></i><a class="acf-icon -pencil -clear acf-js-tooltip" data-name="edit" href="#" title="<?php _e( 'Edit', 'acf' ); ?>"></a><a class="acf-icon -cancel -clear acf-js-tooltip" data-name="remove" href="#" title="<?php _e( 'Remove', 'acf' ); ?>"></a>
|
||||
<i class="acf-icon -link-ext acf-js-tooltip" title="<?php esc_attr_e( 'Opens in a new window/tab', 'acf' ); ?>"></i><a class="acf-icon -pencil -clear acf-js-tooltip" data-name="edit" href="#" title="<?php esc_attr_e( 'Edit', 'acf' ); ?>"></a><a class="acf-icon -cancel -clear acf-js-tooltip" data-name="remove" href="#" title="<?php esc_attr_e( 'Remove', 'acf' ); ?>"></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -144,18 +131,16 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -173,21 +158,19 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -209,18 +192,16 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* validate_value
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
|
||||
|
|
@ -239,21 +220,19 @@ if ( ! class_exists( 'acf_field_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
|
||||
public $show_in_rest = false;
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -36,17 +34,15 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -73,18 +69,16 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -123,18 +117,16 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* translate_field
|
||||
*
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function translate_field( $field ) {
|
||||
|
||||
|
|
@ -146,19 +138,17 @@ if ( ! class_exists( 'acf_field_message' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_field()
|
||||
*
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field after it is loaded from the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $field - the field array holding all the field options
|
||||
*/
|
||||
function load_field( $field ) {
|
||||
|
||||
// remove name to avoid caching issue
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
class acf_field_number extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -38,17 +36,15 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -96,22 +92,20 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
$html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>';
|
||||
|
||||
// return
|
||||
echo $html;
|
||||
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by individual html functions above.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
|
||||
|
|
@ -207,18 +201,16 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* validate_value
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 11/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function validate_value( $valid, $value, $field, $input ) {
|
||||
|
||||
|
|
@ -257,21 +249,19 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -319,9 +309,9 @@ if ( ! class_exists( 'acf_field_number' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
class acf_field_oembed extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -28,8 +26,8 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
$this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-oembed.png';
|
||||
$this->doc_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/oembed/', 'docs', 'field-type-selection' );
|
||||
$this->defaults = array(
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
);
|
||||
$this->width = 640;
|
||||
$this->height = 390;
|
||||
|
|
@ -43,18 +41,16 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* prepare_field
|
||||
*
|
||||
* This function will prepare the field for input
|
||||
*
|
||||
* @type function
|
||||
* @date 14/2/17
|
||||
* @since 5.5.8
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return (int)
|
||||
*/
|
||||
/**
|
||||
* This function will prepare the field for input
|
||||
*
|
||||
* @type function
|
||||
* @date 14/2/17
|
||||
* @since 5.5.8
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return (int)
|
||||
*/
|
||||
|
||||
function prepare_field( $field ) {
|
||||
|
||||
|
|
@ -76,9 +72,9 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
* @date 24/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $url The URL that should be embedded.
|
||||
* @param int|string $width Optional maxwidth value passed to the provider URL.
|
||||
* @param int|string $height Optional maxheight value passed to the provider URL.
|
||||
* @param string $url The URL that should be embedded.
|
||||
* @param integer|string $width Optional maxwidth value passed to the provider URL.
|
||||
* @param integer|string $height Optional maxheight value passed to the provider URL.
|
||||
* @return string|false The embedded HTML on success, false on failure.
|
||||
*/
|
||||
function wp_oembed_get( $url = '', $width = 0, $height = 0 ) {
|
||||
|
|
@ -101,18 +97,16 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
return $embed;
|
||||
}
|
||||
|
||||
/*
|
||||
* ajax_query
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function ajax_query() {
|
||||
|
||||
|
|
@ -129,18 +123,16 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_ajax_query
|
||||
*
|
||||
* This function will return an array of data formatted for use in a select2 AJAX response
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/2014
|
||||
* @since 5.0.9
|
||||
*
|
||||
* @param $options (array)
|
||||
* @return (array)
|
||||
*/
|
||||
/**
|
||||
* This function will return an array of data formatted for use in a select2 AJAX response
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/2014
|
||||
* @since 5.0.9
|
||||
*
|
||||
* @param $options (array)
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function get_ajax_query( $args = array() ) {
|
||||
|
||||
|
|
@ -173,17 +165,17 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -193,7 +185,6 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
);
|
||||
|
||||
// <strong><?php _e("Error.", 'acf'); </strong> _e("No embed found for the given URL.", 'acf');
|
||||
|
||||
// value
|
||||
if ( $field['value'] ) {
|
||||
$atts['class'] .= ' has-value';
|
||||
|
|
@ -232,7 +223,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
<div class="canvas-media">
|
||||
<?php
|
||||
if ( $field['value'] ) {
|
||||
echo $this->wp_oembed_get( $field['value'], $field['width'], $field['height'] );
|
||||
echo $this->wp_oembed_get( $field['value'], $field['width'], $field['height'] ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_ombed_get generates HTML safe output.
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
@ -244,18 +235,16 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -289,13 +278,12 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
|
|||
* @type filter
|
||||
* @since 3.6
|
||||
*
|
||||
* @param mixed $value The value which was loaded from the database.
|
||||
* @param mixed $post_id The $post_id from which the value was loaded.
|
||||
* @param array $field The field array holding all the field options.
|
||||
*
|
||||
* @param mixed $value The value which was loaded from the database.
|
||||
* @param mixed $post_id The $post_id from which the value was loaded.
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @return mixed the modified value
|
||||
*/
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
public function format_value( $value, $post_id, $field ) {
|
||||
// bail early if no value
|
||||
if ( empty( $value ) ) {
|
||||
return $value;
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_output' ) ) :
|
|||
class acf_field_output extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -30,20 +28,18 @@ if ( ! class_exists( 'acf_field_output' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -54,7 +50,7 @@ if ( ! class_exists( 'acf_field_output' ) ) :
|
|||
|
||||
// html
|
||||
if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) {
|
||||
echo $field['html'];
|
||||
echo acf_esc_html( $field['html'] );
|
||||
|
||||
// function
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
class acf_field_page_link extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -41,18 +39,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ajax_query
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function ajax_query() {
|
||||
|
||||
|
|
@ -216,19 +212,17 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_post_result
|
||||
*
|
||||
* This function will return an array containing id, text and maybe description data
|
||||
*
|
||||
* @type function
|
||||
* @date 7/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $id (mixed)
|
||||
* @param $text (string)
|
||||
* @return (array)
|
||||
*/
|
||||
/**
|
||||
* This function will return an array containing id, text and maybe description data
|
||||
*
|
||||
* @type function
|
||||
* @date 7/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $id (mixed)
|
||||
* @param $text (string)
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function get_post_result( $id, $text ) {
|
||||
|
||||
|
|
@ -252,20 +246,18 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_post_title
|
||||
*
|
||||
* This function returns the HTML for a result
|
||||
*
|
||||
* @type function
|
||||
* @date 1/11/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post (object)
|
||||
* @param $field (array)
|
||||
* @param $post_id (int) the post_id to which this value is saved to
|
||||
* @return (string)
|
||||
*/
|
||||
/**
|
||||
* This function returns the HTML for a result
|
||||
*
|
||||
* @type function
|
||||
* @date 1/11/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post (object)
|
||||
* @param $field (array)
|
||||
* @param $post_id (int) the post_id to which this value is saved to
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
|
||||
|
||||
|
|
@ -287,18 +279,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_posts
|
||||
*
|
||||
* This function will return an array of posts for a given field value
|
||||
*
|
||||
* @type function
|
||||
* @date 13/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $value (array)
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This function will return an array of posts for a given field value
|
||||
*
|
||||
* @type function
|
||||
* @date 13/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $value (array)
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function get_posts( $value, $field ) {
|
||||
|
||||
|
|
@ -353,17 +343,15 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -404,18 +392,16 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -506,21 +492,19 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -562,21 +546,19 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -604,11 +586,10 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
/**
|
||||
* Validates page link fields updated via the REST API.
|
||||
*
|
||||
* @param bool $valid
|
||||
* @param int $value
|
||||
* @param array $field
|
||||
*
|
||||
* @return bool|WP_Error
|
||||
* @param boolean $valid The current validity booleean
|
||||
* @param integer $value The value of the field
|
||||
* @param array $field The field array
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function validate_rest_value( $valid, $value, $field ) {
|
||||
return acf_get_field_type( 'post_object' )->validate_rest_value( $valid, $value, $field );
|
||||
|
|
@ -647,9 +628,9 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
|
||||
/**
|
||||
* @see \acf_field::get_rest_links()
|
||||
* @param mixed $value The raw (unformatted) field value.
|
||||
* @param int|string $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value The raw (unformatted) field value.
|
||||
* @param integer|string $post_id
|
||||
* @param array $field
|
||||
* @return array
|
||||
*/
|
||||
public function get_rest_links( $value, $post_id, array $field ) {
|
||||
|
|
@ -677,9 +658,9 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_password' ) ) :
|
|||
class acf_field_password extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -34,35 +32,31 @@ if ( ! class_exists( 'acf_field_password' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
acf_get_field_type( 'text' )->render_field( $field );
|
||||
}
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
// TODO: Delete this method?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->name = 'post_object';
|
||||
|
|
@ -35,18 +35,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ajax_query
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function ajax_query() {
|
||||
|
||||
|
|
@ -63,18 +61,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_ajax_query
|
||||
*
|
||||
* This function will return an array of data formatted for use in a select2 AJAX response
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/2014
|
||||
* @since 5.0.9
|
||||
*
|
||||
* @param $options (array)
|
||||
* @return (array)
|
||||
*/
|
||||
/**
|
||||
* This function will return an array of data formatted for use in a select2 AJAX response
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/2014
|
||||
* @since 5.0.9
|
||||
*
|
||||
* @param $options (array)
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function get_ajax_query( $options = array() ) {
|
||||
|
||||
|
|
@ -210,19 +206,17 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_post_result
|
||||
*
|
||||
* This function will return an array containing id, text and maybe description data
|
||||
*
|
||||
* @type function
|
||||
* @date 7/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $id (mixed)
|
||||
* @param $text (string)
|
||||
* @return (array)
|
||||
*/
|
||||
/**
|
||||
* This function will return an array containing id, text and maybe description data
|
||||
*
|
||||
* @type function
|
||||
* @date 7/07/2016
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @param $id (mixed)
|
||||
* @param $text (string)
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function get_post_result( $id, $text ) {
|
||||
|
||||
|
|
@ -246,20 +240,18 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_post_title
|
||||
*
|
||||
* This function returns the HTML for a result
|
||||
*
|
||||
* @type function
|
||||
* @date 1/11/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post (object)
|
||||
* @param $field (array)
|
||||
* @param $post_id (int) the post_id to which this value is saved to
|
||||
* @return (string)
|
||||
*/
|
||||
/**
|
||||
* This function returns the HTML for a result
|
||||
*
|
||||
* @type function
|
||||
* @date 1/11/2013
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post (object)
|
||||
* @param $field (array)
|
||||
* @param $post_id (int) the post_id to which this value is saved to
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function get_post_title( $post, $field, $post_id = 0, $is_search = 0 ) {
|
||||
|
||||
|
|
@ -281,17 +273,15 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -320,18 +310,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
function render_field_settings( $field ) {
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
|
|
@ -438,20 +426,18 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
acf_render_bidirectional_field_settings( $field );
|
||||
}
|
||||
|
||||
/*
|
||||
* load_value()
|
||||
*
|
||||
* This filter is applied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value found in the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This filter is applied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value found in the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function load_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -465,21 +451,19 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -511,11 +495,10 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
*
|
||||
* @since 3.6
|
||||
*
|
||||
* @param mixed $value The value which will be saved in the database.
|
||||
* @param int $post_id The post_id of which the value will be saved.
|
||||
* @param array $field The field array holding all the field options.
|
||||
*
|
||||
* @return mixed $value The modified value.
|
||||
* @param mixed $value The value which will be saved in the database.
|
||||
* @param integer $post_id The post_id of which the value will be saved.
|
||||
* @param array $field The field array holding all the field options.
|
||||
* @return mixed $value The modified value.
|
||||
*/
|
||||
public function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -543,18 +526,16 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_posts
|
||||
*
|
||||
* This function will return an array of posts for a given field value
|
||||
*
|
||||
* @type function
|
||||
* @date 13/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $value (array)
|
||||
* @return $value
|
||||
*/
|
||||
/**
|
||||
* This function will return an array of posts for a given field value
|
||||
*
|
||||
* @type function
|
||||
* @date 13/06/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $value (array)
|
||||
* @return $value
|
||||
*/
|
||||
|
||||
function get_posts( $value, $field ) {
|
||||
|
||||
|
|
@ -581,11 +562,10 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
/**
|
||||
* Validates post object fields updated via the REST API.
|
||||
*
|
||||
* @param bool $valid
|
||||
* @param int $value
|
||||
* @param array $field
|
||||
*
|
||||
* @return bool|WP_Error
|
||||
* @param boolean $valid The current validity booleean
|
||||
* @param integer $value The value of the field
|
||||
* @param array $field The field array
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function validate_rest_value( $valid, $value, $field ) {
|
||||
if ( is_null( $value ) ) {
|
||||
|
|
@ -707,9 +687,9 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
|
||||
/**
|
||||
* @see \acf_field::get_rest_links()
|
||||
* @param mixed $value The raw (unformatted) field value.
|
||||
* @param int|string $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value The raw (unformatted) field value.
|
||||
* @param integer|string $post_id
|
||||
* @param array $field
|
||||
* @return array
|
||||
*/
|
||||
public function get_rest_links( $value, $post_id, array $field ) {
|
||||
|
|
@ -742,9 +722,9 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
|
|||
/**
|
||||
* Apply basic formatting to prepare the value for default REST output.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|int $post_id
|
||||
* @param array $field
|
||||
* @param mixed $value
|
||||
* @param string|integer $post_id
|
||||
* @param array $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function format_value_for_rest( $value, $post_id, array $field ) {
|
||||
|
|
|
|||
|
|
@ -5,18 +5,16 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
class acf_field_radio extends acf_field {
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
|
|
@ -39,20 +37,18 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
/**
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field (array) the $field being rendered
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field (array) the $field being edited
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
|
|
@ -122,7 +118,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
$e .= acf_get_hidden_input( array( 'name' => $field['name'] ) );
|
||||
|
||||
// Open <ul>.
|
||||
$e .= '<ul ' . acf_esc_attr( $ul ) . '>';
|
||||
$e .= '<ul ' . acf_esc_attrs( $ul ) . '>';
|
||||
|
||||
// Loop through choices.
|
||||
foreach ( $field['choices'] as $value => $label ) {
|
||||
|
|
@ -157,29 +153,27 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
// append
|
||||
$e .= '<li><label' . ( $is_selected ? ' class="selected"' : '' ) . '><input ' . acf_esc_attr( $attrs ) . '/>' . acf_esc_html( $label ) . '</label>' . $additional_html . '</li>';
|
||||
$e .= '<li><label' . ( $is_selected ? ' class="selected"' : '' ) . '><input ' . acf_esc_attrs( $attrs ) . '/>' . acf_esc_html( $label ) . '</label>' . $additional_html . '</li>';
|
||||
}
|
||||
|
||||
// Close <ul>.
|
||||
$e .= '</ul>';
|
||||
|
||||
// Output HTML.
|
||||
echo $e;
|
||||
echo $e; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped per attribute above.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
/**
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
// Encode choices (convert from array).
|
||||
|
|
@ -295,20 +289,18 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* update_field()
|
||||
*
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the field group ID (post_type = acf)
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $field before it is saved to the database
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - the field array holding all the field options
|
||||
* @param $post_id - the field group ID (post_type = acf)
|
||||
*
|
||||
* @return $field - the modified field
|
||||
*/
|
||||
|
||||
function update_field( $field ) {
|
||||
|
||||
|
|
@ -320,22 +312,20 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* update_value()
|
||||
*
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
* @todo Fix bug where $field was found via json and has no ID
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the $post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value before it is updated in the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
* @todo Fix bug where $field was found via json and has no ID
|
||||
*
|
||||
* @param $value - the value which will be saved in the database
|
||||
* @param $post_id - the post_id of which the value will be saved
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the modified value
|
||||
*/
|
||||
|
||||
function update_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -379,21 +369,19 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 5.2.9
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value found in the database
|
||||
* @param $post_id - the $post_id from which the value was loaded from
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the value to be saved in te database
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db
|
||||
*
|
||||
* @type filter
|
||||
* @since 5.2.9
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value - the value found in the database
|
||||
* @param $post_id - the post_id from which the value was loaded from
|
||||
* @param $field - the field array holding all the field options
|
||||
*
|
||||
* @return $value - the value to be saved in te database
|
||||
*/
|
||||
|
||||
function load_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
@ -407,18 +395,16 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* translate_field
|
||||
*
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
/**
|
||||
* This function will translate field settings
|
||||
*
|
||||
* @type function
|
||||
* @date 8/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $field (array)
|
||||
* @return $field
|
||||
*/
|
||||
|
||||
function translate_field( $field ) {
|
||||
|
||||
|
|
@ -426,21 +412,19 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* format_value()
|
||||
*
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the $post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
/**
|
||||
* This filter is appied to the $value after it is loaded from the db and before it is returned to the template
|
||||
*
|
||||
* @type filter
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $value (mixed) the value which was loaded from the database
|
||||
* @param $post_id (mixed) the post_id from which the value was loaded
|
||||
* @param $field (array) the field array holding all the field options
|
||||
*
|
||||
* @return $value (mixed) the modified value
|
||||
*/
|
||||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue