Updates to 6.2.7

This commit is contained in:
ACF 2024-02-28 10:16:23 +00:00
parent ef46740af7
commit 6cf14add0e
284 changed files with 25531 additions and 14883 deletions

14
acf.php
View File

@ -9,7 +9,7 @@
* Plugin Name: Advanced Custom Fields PRO * Plugin Name: Advanced Custom Fields PRO
* Plugin URI: https://www.advancedcustomfields.com * Plugin URI: https://www.advancedcustomfields.com
* Description: Customize WordPress with powerful, professional and intuitive fields. * Description: Customize WordPress with powerful, professional and intuitive fields.
* Version: 6.2.6.1 * Version: 6.2.7
* Author: WP Engine * Author: WP Engine
* Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields * Author URI: https://wpengine.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=plugin_directory&utm_content=advanced_custom_fields
* Update URI: https://www.advancedcustomfields.com/pro * Update URI: https://www.advancedcustomfields.com/pro
@ -36,7 +36,7 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @var string * @var string
*/ */
public $version = '6.2.6.1'; public $version = '6.2.7';
/** /**
* The plugin settings array. * The plugin settings array.
@ -64,8 +64,6 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @date 23/06/12 * @date 23/06/12
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function __construct() { public function __construct() {
// Do nothing. // Do nothing.
@ -76,8 +74,6 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @date 28/09/13 * @date 28/09/13
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function initialize() { public function initialize() {
@ -244,8 +240,6 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @date 28/09/13 * @date 28/09/13
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function init() { public function init() {
@ -402,8 +396,6 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @date 22/10/2015 * @date 22/10/2015
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function register_post_types() { public function register_post_types() {
$cap = acf_get_setting( 'capability' ); $cap = acf_get_setting( 'capability' );
@ -482,8 +474,6 @@ if ( ! class_exists( 'ACF' ) ) {
* *
* @date 22/10/2015 * @date 22/10/2015
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function register_post_status() { public function register_post_status() {

View File

@ -1406,6 +1406,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
onChangeName: function (e, $el) { onChangeName: function (e, $el) {
// set // set
var name = $el.val(); var name = $el.val();
// strip any invalid characters.
name = name.replace(/[^A-Za-zŽžÀ-ÿ0-9_-]+/g, '-');
$el.val(name);
this.set('name', name); this.set('name', name);
// error // error

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6073,11 +6073,15 @@
// preview hack allows post to save with no title or content // preview hack allows post to save with no title or content
$('#_acf_changed').val(1); $('#_acf_changed').val(1);
if (acf.isGutenbergPostEditor()) { if (acf.isGutenbergPostEditor()) {
try {
wp.data.dispatch('core/editor').editPost({ wp.data.dispatch('core/editor').editPost({
meta: { meta: {
_acf_changed: 1 _acf_changed: 1
} }
}); });
} catch (error) {
console.log('ACF: Failed to update _acf_changed meta', error);
}
} }
} }
}); });
@ -8326,7 +8330,7 @@
if (!options.templateSelection) { if (!options.templateSelection) {
options.templateSelection = function (selection) { options.templateSelection = function (selection) {
var $selection = $('<span class="acf-selection"></span>'); var $selection = $('<span class="acf-selection"></span>');
$selection.html(acf.escHtml(selection.text)); $selection.html(acf.strEscape(selection.text));
$selection.data('element', selection.element); $selection.data('element', selection.element);
return $selection; 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

View File

@ -305,6 +305,10 @@
}, },
onChangeName: function (e, $el) { onChangeName: function (e, $el) {
var name = $el.val(); 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.set('layoutName', name);
this.$el.attr('data-layout-name', 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

View File

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

View File

@ -176,7 +176,7 @@ function acf_get_field_post( $id = 0 ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param string $id The identifier. * @param string $id The identifier.
* @return bool * @return boolean
*/ */
function acf_is_field_key( $id = '' ) { function acf_is_field_key( $id = '' ) {
@ -394,7 +394,7 @@ function acf_get_fields( $parent ) {
* @date 18/1/19 * @date 18/1/19
* @since 5.7.10 * @since 5.7.10
* *
* @param int $id The field group or field id. * @param integer $id The field group or field id.
* @return array * @return array
*/ */
function acf_get_raw_fields( $id = 0 ) { function acf_get_raw_fields( $id = 0 ) {
@ -449,7 +449,7 @@ function acf_get_raw_fields( $id = 0 ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param array $parent The field group or field array. * @param array $parent The field group or field array.
* @return int * @return integer
*/ */
function acf_get_field_count( $parent ) { function acf_get_field_count( $parent ) {
@ -635,7 +635,7 @@ function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = '
* @param array $field The field array. * @param array $field The field array.
* @param string $element The wrapping element type. * @param string $element The wrapping element type.
* @param string $instruction The instruction render position (label|field). * @param string $instruction The instruction render position (label|field).
* @param bool $field_setting If a field setting is being rendered. * @param boolean $field_setting If a field setting is being rendered.
* @return void * @return void
*/ */
function acf_render_field_wrap( $field, $element = 'div', $instruction = 'label', $field_setting = false ) { 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']; $wrapper['data-conditions'] = $field['conditions'];
} }
// Vars for render. // Escaped vars for render.
$attributes_html = acf_esc_attrs( $wrapper ); $attributes_html = acf_esc_attrs( $wrapper );
$element = esc_attr( $element );
$inner_element = esc_attr( $inner_element );
// Render HTML // 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' ) { 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 ); acf_render_field_label( $field );
if ( $instruction == 'label' ) { if ( $instruction == 'label' ) {
acf_render_field_instructions( $field, $field_setting ); 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 ); acf_render_field( $field );
if ( ! $field_setting && $instruction == 'field' ) { if ( ! $field_setting && $instruction == 'field' ) {
acf_render_field_instructions( $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 ); acf_render_field_instructions( $field );
} }
echo "</$element>" . "\n"; echo "</$element>\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped earlier in function.
} }
/** /**
@ -887,13 +889,13 @@ function acf_render_field_instructions( $field, $tooltip = false ) {
$instructions = acf_esc_html( $field['instructions'] ); $instructions = acf_esc_html( $field['instructions'] );
if ( $tooltip ) { 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 { } 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'] ) ) { } elseif ( ! empty( $field['hint'] ) ) {
$instructions = acf_esc_html( $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.
} }
} }
@ -907,7 +909,7 @@ function acf_render_field_instructions( $field, $tooltip = false ) {
* *
* @param array $field The field array. * @param array $field The field array.
* @param array $setting The settings field array. * @param array $setting The settings field array.
* @param bool $global Whether this setting is a global or field type specific one. * @param boolean $global Whether this setting is a global or field type specific one.
* @return void * @return void
*/ */
function acf_render_field_setting( $field, $setting, $global = false ) { function acf_render_field_setting( $field, $setting, $global = false ) {
@ -1078,10 +1080,10 @@ acf_add_filter_variations( 'acf/update_field', array( 'type', 'name', 'key' ), 0
* @since 5.7.10 * @since 5.7.10
* *
* @param string $slug The post slug. * @param string $slug The post slug.
* @param int $post_ID Post ID. * @param integer $post_ID Post ID.
* @param string $post_status The post status. * @param string $post_status The post status.
* @param string $post_type Post type. * @param string $post_type Post type.
* @param int $post_parent Post parent ID * @param integer $post_parent Post parent ID
* @param string $original_slug The original post slug. * @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 ) { 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 * @since 5.7.10
* *
* @param (int|string) $id The field ID, key or name. * @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 ) { 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 * @since 5.0.0
* *
* @param (int|string) $id The field ID, key or name. * @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 ) { function acf_trash_field( $id = 0 ) {
@ -1213,7 +1215,7 @@ function acf_trash_field( $id = 0 ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param (int|string) $id The field ID, key or name. * @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 ) { function acf_untrash_field( $id = 0 ) {
@ -1253,7 +1255,7 @@ function acf_untrash_field( $id = 0 ) {
* @since 5.9.5 * @since 5.9.5
* *
* @param string $new_status The new status of the post being restored. * @param string $new_status The new status of the post being restored.
* @param int $post_id The ID 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. * @param string $previous_status The status of the post at the point where it was trashed.
* @return string. * @return string.
*/ */
@ -1366,7 +1368,7 @@ function acf_search_fields( $id, $fields ) {
* *
* @param array $field The field array. * @param array $field The field array.
* @param mixed $id An optional identifier to search for. * @param mixed $id An optional identifier to search for.
* @return bool * @return boolean
*/ */
function acf_is_field( $field = false, $id = '' ) { function acf_is_field( $field = false, $id = '' ) {
return ( return (
@ -1410,7 +1412,7 @@ function acf_get_field_ancestors( $field ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param array $fields An array of fields. * @param array $fields An array of fields.
* @param int $parent_id The new parent ID. * @param integer $parent_id The new parent ID.
* @return array * @return array
*/ */
function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) { function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) {
@ -1446,8 +1448,8 @@ function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param (int|string) $id The field ID, key or name. * @param (int|string) $id The field ID, key or name.
* @param int $parent_id The new parent ID. * @param integer $parent_id The new parent ID.
* @return bool True if field was duplicated. * @return boolean True if field was duplicated.
*/ */
function acf_duplicate_field( $id = 0, $parent_id = 0 ) { function acf_duplicate_field( $id = 0, $parent_id = 0 ) {

View File

@ -54,7 +54,7 @@ function acf_get_field_group_post( $id = 0 ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param string $id The identifier. * @param string $id The identifier.
* @return bool * @return boolean
*/ */
function acf_is_field_group_key( $id = '' ) { function acf_is_field_group_key( $id = '' ) {
return acf_is_internal_post_type_key( $id, 'acf-field-group' ); return acf_is_internal_post_type_key( $id, 'acf-field-group' );
@ -159,7 +159,7 @@ function acf_filter_field_groups( $field_groups, $args = array() ) {
* *
* @param array $field_groups An array of field groups. * @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 bool * @return boolean
*/ */
function acf_get_field_group_visibility( $field_group, $args = array() ) { function acf_get_field_group_visibility( $field_group, $args = array() ) {
@ -226,10 +226,10 @@ function acf_update_field_group( $field_group ) {
* @since 5.7.10 * @since 5.7.10
* *
* @param string $slug The post slug. * @param string $slug The post slug.
* @param int $post_ID Post ID. * @param integer $post_ID Post ID.
* @param string $post_status The post status. * @param string $post_status The post status.
* @param string $post_type Post type. * @param string $post_type Post type.
* @param int $post_parent Post parent ID * @param integer $post_parent Post parent ID
* @param string $original_slug The original post slug. * @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 ) { 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 * @since 5.7.10
* *
* @param (int|string) $id The field group ID, key or name. * @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 ) { function acf_delete_field_group( $id = 0 ) {
return acf_delete_internal_post_type( $id, 'acf-field-group' ); 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 * @since 5.0.0
* *
* @param (int|string) $id The field group ID, key or name. * @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 ) { function acf_trash_field_group( $id = 0 ) {
return acf_trash_internal_post_type( $id, 'acf-field-group' ); 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 * @since 5.0.0
* *
* @param (int|string) $id The field_group ID, key or name. * @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 ) { function acf_untrash_field_group( $id = 0 ) {
return acf_untrash_internal_post_type( $id, 'acf-field-group' ); return acf_untrash_internal_post_type( $id, 'acf-field-group' );
@ -311,7 +311,7 @@ function acf_untrash_field_group( $id = 0 ) {
* @since 5.9.5 * @since 5.9.5
* *
* @param string $new_status The new status of the post being restored. * @param string $new_status The new status of the post being restored.
* @param int $post_id The ID 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. * @param string $previous_status The status of the post at the point where it was trashed.
* @return string. * @return string.
*/ */
@ -329,7 +329,7 @@ function _acf_untrash_field_group_post_status( $new_status, $post_id, $previous_
* *
* @param array $field_group The field group array. * @param array $field_group The field group array.
* @param mixed $id An optional identifier to search for. * @param mixed $id An optional identifier to search for.
* @return bool * @return boolean
*/ */
function acf_is_field_group( $field_group = false ) { function acf_is_field_group( $field_group = false ) {
return acf_is_internal_post_type( $field_group, 'acf-field-group' ); return acf_is_internal_post_type( $field_group, 'acf-field-group' );
@ -344,7 +344,7 @@ function acf_is_field_group( $field_group = false ) {
* @since 5.0.0 * @since 5.0.0
* *
* @param (int|string) $id The field_group ID, key or name. * @param (int|string) $id The field_group ID, key or name.
* @param int $new_post_id Optional post ID to override. * @param integer $new_post_id Optional post ID to override.
* @return array The new field group. * @return array The new field group.
*/ */
function acf_duplicate_field_group( $id = 0, $new_post_id = 0 ) { 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. * Activates or deactivates a field group.
* *
* @param int|string $id The field_group ID, key or name. * @param integer|string $id The field_group ID, key or name.
* @param bool $activate True if the post should be activated. * @param boolean $activate True if the post should be activated.
* @return bool * @return boolean
*/ */
function acf_update_field_group_active_status( $id, $activate = true ) { function acf_update_field_group_active_status( $id, $activate = true ) {
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-field-group' ); 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 * @date 23/9/18
* @since 5.7.7 * @since 5.7.7
* *
* @param int $post_id The field group ID. * @param integer $post_id The field group ID.
* @return string * @return string
*/ */
function acf_get_field_group_edit_link( $post_id ) { function acf_get_field_group_edit_link( $post_id ) {

View File

@ -113,9 +113,9 @@ function acf_form_data( $data = array() ) {
* @date 15/10/13 * @date 15/10/13
* @since 5.0.0 * @since 5.0.0
* *
* @param int|string $post_id The post id. * @param integer|string $post_id The post id.
* @param array $values An array of values to override $_POST. * @param array $values An array of values to override $_POST.
* @return bool True if save was successful. * @return boolean True if save was successful.
*/ */
function acf_save_post( $post_id = 0, $values = null ) { 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 * @date 11/1/19
* @since 5.7.10 * @since 5.7.10
* *
* @param int|string $post_id The post id. * @param integer|string $post_id The post id.
* @return void * @return void
*/ */
function _acf_do_save_post( $post_id = 0 ) { function _acf_do_save_post( $post_id = 0 ) {

View File

@ -1,38 +1,32 @@
<?php <?php
/* /**
* acf_is_empty
*
* Returns true if the value provided is considered "empty". Allows numbers such as 0. * Returns true if the value provided is considered "empty". Allows numbers such as 0.
* *
* @date 6/7/16 * @date 6/7/16
* @since 5.4.0 * @since 5.4.0
* *
* @param mixed $var The value to check. * @param mixed $var The value to check.
* @return bool * @return boolean
*/ */
function acf_is_empty( $var ) { function acf_is_empty( $var ) {
return ( ! $var && ! is_numeric( $var ) ); return ( ! $var && ! is_numeric( $var ) );
} }
/** /**
* acf_not_empty
*
* Returns true if the value provided is considered "not empty". Allows numbers such as 0. * Returns true if the value provided is considered "not empty". Allows numbers such as 0.
* *
* @date 15/7/19 * @date 15/7/19
* @since 5.8.1 * @since 5.8.1
* *
* @param mixed $var The value to check. * @param mixed $var The value to check.
* @return bool * @return boolean
*/ */
function acf_not_empty( $var ) { function acf_not_empty( $var ) {
return ( $var || is_numeric( $var ) ); return ( $var || is_numeric( $var ) );
} }
/** /**
* acf_uniqid
*
* Returns a unique numeric based id. * Returns a unique numeric based id.
* *
* @date 9/1/19 * @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. * Merges together two arrays but with extra functionality to append class names.
* *
* @date 22/1/19 * @date 22/1/19
@ -277,7 +269,7 @@ function acf_enable_filters( $filters = array() ) {
* @since 5.7.14 * @since 5.7.14
* *
* @param mixed $value A value to parse. * @param mixed $value A value to parse.
* @return int * @return integer
*/ */
function acf_idval( $value ) { function acf_idval( $value ) {
@ -418,7 +410,7 @@ function acf_punctify( $str = '' ) {
* @since 5.8.1 * @since 5.8.1
* *
* @param string $name The name of the event. * @param string $name The name of the event.
* @return bool * @return boolean
*/ */
function acf_did( $name ) { function acf_did( $name ) {
@ -446,7 +438,7 @@ function acf_did( $name ) {
* @since 5.9.0 * @since 5.9.0
* *
* @param string $str The string to review. * @param string $str The string to review.
* @return int * @return integer
*/ */
function acf_strlen( $str ) { function acf_strlen( $str ) {
return mb_strlen( str_replace( "\r\n", "\n", wp_specialchars_decode( wp_unslash( $str ) ) ) ); return mb_strlen( str_replace( "\r\n", "\n", wp_specialchars_decode( wp_unslash( $str ) ) ) );
@ -473,7 +465,7 @@ function acf_with_default( $value, $default_value ) {
* @since 5.9.0 * @since 5.9.0
* *
* @param string $action The action name. * @param string $action The action name.
* @return int|bool * @return integer|boolean
*/ */
function acf_doing_action( $action ) { function acf_doing_action( $action ) {
global $wp_filter; global $wp_filter;
@ -508,7 +500,7 @@ function acf_get_current_url() {
* @param string $url The URL to be tagged. * @param string $url The URL to be tagged.
* @param string $campaign The campaign tag. * @param string $campaign The campaign tag.
* @param string $content The UTM content tag. * @param string $content The UTM content tag.
* @param bool $anchor An optional anchor ID. * @param boolean $anchor An optional anchor ID.
* @param string $source An optional UTM source tag. * @param string $source An optional UTM source tag.
* @param string $medium An optional UTM medium tag. * @param string $medium An optional UTM medium tag.
* @return string * @return string
@ -549,7 +541,7 @@ function acf_add_url_utm_tags( $url, $campaign, $content, $anchor = false, $sour
* *
* @param mixed $args The data to sanitize. * @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() ) { function acf_sanitize_request_args( $args = array() ) {
switch ( gettype( $args ) ) { switch ( gettype( $args ) ) {

View File

@ -13,7 +13,7 @@ acf_register_store( 'hook-variations' );
* *
* @param string $filter The filter name. * @param string $filter The filter name.
* @param array $variations An array variation keys. * @param array $variations An array variation keys.
* @param int $index The param index to find variation values. * @param integer $index The param index to find variation values.
* @return void * @return void
*/ */
function acf_add_filter_variations( $filter = '', $variations = array(), $index = 0 ) { function acf_add_filter_variations( $filter = '', $variations = array(), $index = 0 ) {
@ -43,7 +43,7 @@ function acf_add_filter_variations( $filter = '', $variations = array(), $index
* *
* @param string $action The action name. * @param string $action The action name.
* @param array $variations An array variation keys. * @param array $variations An array variation keys.
* @param int $index The param index to find variation values. * @param integer $index The param index to find variation values.
* @return void * @return void
*/ */
function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) { function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) {
@ -207,7 +207,6 @@ function _acf_apply_deprecated_hook() {
// Log warning. // Log warning.
// _deprecated_hook( $deprecated, $version, $hook ); // _deprecated_hook( $deprecated, $version, $hook );
// Apply the item/do the action. // Apply the item/do the action.
if ( $hook['type'] === 'filter' ) { if ( $hook['type'] === 'filter' ) {
$args[0] = apply_filters_ref_array( $hook['deprecated'], $args ); $args[0] = apply_filters_ref_array( $hook['deprecated'], $args );

View File

@ -90,7 +90,6 @@ function acf_esc_html( $string = '' ) {
* @param string $context The context name. * @param string $context The context name.
* @return array. * @return array.
*/ */
function _acf_kses_allowed_html( $tags, $context ) { function _acf_kses_allowed_html( $tags, $context ) {
global $allowedposttags; global $allowedposttags;
@ -129,7 +128,7 @@ add_filter( 'wp_kses_allowed_html', '_acf_kses_allowed_html', 0, 2 );
* @return string * @return string
*/ */
function acf_hidden_input( $attrs = array() ) { 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 * @return string
*/ */
function acf_text_input( $attrs = array() ) { 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 * @return string
*/ */
function acf_file_input( $attrs = array() ) { 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 * @return string
*/ */
function acf_textarea_input( $attrs = array() ) { 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 * @return string
*/ */
function acf_checkbox_input( $attrs = array() ) { 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. // Render.
$checked = isset( $attrs['checked'] ); $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 * @return string
*/ */
function acf_radio_input( $attrs = array() ) { 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 * @return string
*/ */
function acf_select_input( $attrs = array() ) { 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.
} }
/** /**
@ -446,7 +445,7 @@ function acf_walk_select_input( $choices = array(), $values = array(), $depth =
$attrs['selected'] = 'selected'; $attrs['selected'] = 'selected';
$attrs['data-i'] = $pos; $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 * acf_esc_attr
* *
* See acf_esc_attrs().
*
* @date 13/6/19 * @date 13/6/19
* @since 5.8.1 * @since 5.8.1
* @deprecated 5.6.0 * @deprecated 5.6.0
* @see acf_esc_attrs().
* *
* @param array $attrs The array of attrs. * @param array $attrs The array of attrs.
* @return string * @return string
@ -509,7 +507,6 @@ function acf_esc_attr( $attrs ) {
* @deprecated 5.6.0 * @deprecated 5.6.0
* *
* @param array $attrs The array of attrs. * @param array $attrs The array of attrs.
* @return string
*/ */
function acf_esc_attr_e( $attrs ) { function acf_esc_attr_e( $attrs ) {
echo acf_esc_attrs( $attrs ); echo acf_esc_attrs( $attrs );
@ -525,7 +522,6 @@ function acf_esc_attr_e( $attrs ) {
* @deprecated 5.6.0 * @deprecated 5.6.0
* *
* @param array $attrs The array of attrs. * @param array $attrs The array of attrs.
* @return string
*/ */
function acf_esc_atts_e( $attrs ) { function acf_esc_atts_e( $attrs ) {
echo acf_esc_attrs( $attrs ); echo acf_esc_attrs( $attrs );

View File

@ -28,7 +28,7 @@ function acf_get_internal_post_type_instance( $post_type = 'acf-field-group' ) {
/** /**
* Get an ACF CPT object as an array * Get an ACF CPT object as an array
* *
* @param int $id The post ID being queried. * @param integer $id The post ID being queried.
* @param string $post_type The post type being queried. * @param string $post_type The post type being queried.
* @return array|false The post type object. * @return array|false The post type object.
*/ */
@ -47,7 +47,7 @@ function acf_get_internal_post_type( $id, $post_type ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post ID. * @param integer|string $id The post ID.
* @param string $post_type The post type name. * @param string $post_type The post type name.
* @return array|false The internal post type array. * @return array|false The internal post type array.
*/ */
@ -66,9 +66,9 @@ function acf_get_raw_internal_post_type( $id, $post_type ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post ID, key, or name. * @param integer|string $id The post ID, key, or name.
* @param string $post_type The post type name. * @param string $post_type The post type name.
* @return object|bool The post object, or false on failure. * @return object|boolean The post object, or false on failure.
*/ */
function acf_get_internal_post_type_post( $id, $post_type ) { function acf_get_internal_post_type_post( $id, $post_type ) {
$instance = acf_get_internal_post_type_instance( $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 $id The identifier.
* @param string $post_type The ACF post type the key is for. * @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' ) { function acf_is_internal_post_type_key( $id = '', $post_type = 'acf-field-group' ) {
$instance = acf_get_internal_post_type_instance( $post_type ); $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 array $internal_post_type The internal post type array.
* @param string $post_type_name The post type name. * @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 ) { function acf_validate_internal_post_type( $internal_post_type, $post_type_name ) {
$instance = acf_get_internal_post_type_instance( $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 * @since 6.1
* *
* @param int|string $id The internal post type ID, key or name. * @param integer|string $id The internal post type ID, key or name.
* @param string $post_type_name The post type to be deleted. * @param string $post_type_name The post type to be deleted.
* @return bool True if field group was deleted. * @return boolean True if field group was deleted.
*/ */
function acf_delete_internal_post_type( $id = 0, $post_type_name = '' ) { function acf_delete_internal_post_type( $id = 0, $post_type_name = '' ) {
$instance = acf_get_internal_post_type_instance( $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 * @since 6.1
* *
* @param int|string $id The internal post type ID, key, or name. * @param integer|string $id The internal post type ID, key, or name.
* @param string $post_type_name The post type being trashed. * @param string $post_type_name The post type being trashed.
* @return bool True if post was trashed. * @return boolean True if post was trashed.
*/ */
function acf_trash_internal_post_type( $id = 0, $post_type_name = '' ) { function acf_trash_internal_post_type( $id = 0, $post_type_name = '' ) {
$instance = acf_get_internal_post_type_instance( $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 * @since 6.1
* *
* @param int|string $id The internal post type ID, key, or name. * @param integer|string $id The internal post type ID, key, or name.
* @param string $post_type_name The post type being untrashed. * @param string $post_type_name The post type being untrashed.
* @return bool True if post was untrashed. * @return boolean True if post was untrashed.
*/ */
function acf_untrash_internal_post_type( $id = 0, $post_type_name = '' ) { function acf_untrash_internal_post_type( $id = 0, $post_type_name = '' ) {
$instance = acf_get_internal_post_type_instance( $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 array $post The ACF post array.
* @param string $post_type The ACF post type. * @param string $post_type The ACF post type.
* @return bool * @return boolean
*/ */
function acf_is_internal_post_type( $post, $post_type ) { function acf_is_internal_post_type( $post, $post_type ) {
$instance = acf_get_internal_post_type_instance( $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 * @since 6.1
* *
* @param int|string $id The field_group ID, key or name. * @param integer|string $id The field_group ID, key or name.
* @param int $new_post_id Optional ID to override. * @param integer $new_post_id Optional ID to override.
* @param string $post_type The post type of the post being duplicated. * @param string $post_type The post type of the post being duplicated.
* @return array|bool The new ACF post, or false on failure. * @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' ) { 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 ); $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. * Activates or deactivates an ACF post.
* *
* @param int|string $id The field_group ID, key or name. * @param integer|string $id The field_group ID, key or name.
* @param bool $activate True if the post should be activated. * @param boolean $activate True if the post should be activated.
* @param string $post_type The post type being activated/deactivated. * @param string $post_type The post type being activated/deactivated.
* @return bool * @return boolean
*/ */
function acf_update_internal_post_type_active_status( $id, $activate = true, $post_type = 'acf-field-group' ) { 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 ); $instance = acf_get_internal_post_type_instance( $post_type );
@ -351,7 +351,7 @@ function acf_update_internal_post_type_active_status( $id, $activate = true, $po
* *
* @since 6.1 * @since 6.1
* *
* @param int $post_id The ACF post ID. * @param integer $post_id The ACF post ID.
* @param string $post_type The ACF post type to get the edit link for. * @param string $post_type The ACF post type to get the edit link for.
* @return string * @return string
*/ */
@ -391,7 +391,7 @@ function acf_prepare_internal_post_type_for_export( $post = array(), $post_type
* *
* @param array $post The ACF post array. * @param array $post The ACF post array.
* @param string $post_type The post type of the ACF post being exported. * @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' ) { function acf_export_internal_post_type_as_php( $post, $post_type = 'acf-field-group' ) {
$instance = acf_get_internal_post_type_instance( $post_type ); $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. * Tries to determine the ACF post type for the provided key.
* *
* @param string $key The key to check. * @param string $key The key to check.
* @return string|bool * @return string|boolean
*/ */
function acf_determine_internal_post_type( $key ) { function acf_determine_internal_post_type( $key ) {
$store = acf_get_store( 'internal-post-types' ); $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 * @since 6.1.5
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @return array|bool * @return array|boolean
*/ */
function acf_get_post_type_from_request_args( $action = '' ) { function acf_get_post_type_from_request_args( $action = '' ) {
$acf_use_post_type = (int) acf_request_arg( 'use_post_type', 0 ); $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 * @since 6.1.5
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @return array|bool * @return array|boolean
*/ */
function acf_get_taxonomy_from_request_args( $action = '' ) { function acf_get_taxonomy_from_request_args( $action = '' ) {
$acf_use_taxonomy = (int) acf_request_arg( 'use_taxonomy', 0 ); $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 * @since 6.2
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @return array|bool * @return array|boolean
*/ */
function acf_get_ui_options_page_from_request_args( $action = '' ) { function acf_get_ui_options_page_from_request_args( $action = '' ) {
$acf_use_options_page = (int) acf_request_arg( 'use_options_page', 0 ); $acf_use_options_page = (int) acf_request_arg( 'use_options_page', 0 );

View File

@ -116,9 +116,9 @@ function acf_get_option_meta( $prefix = '' ) {
* @date 16/10/2015 * @date 16/10/2015
* @since 5.2.3 * @since 5.2.3
* *
* @param int|string $post_id The post id. * @param integer|string $post_id The post id.
* @param string $name The meta name. * @param string $name The meta name.
* @param bool $hidden If the meta is hidden (starts with an underscore). * @param boolean $hidden If the meta is hidden (starts with an underscore).
* *
* @return mixed * @return mixed
*/ */
@ -159,12 +159,12 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
* @date 16/10/2015 * @date 16/10/2015
* @since 5.2.3 * @since 5.2.3
* *
* @param int|string $post_id The post id. * @param integer|string $post_id The post id.
* @param string $name The meta name. * @param string $name The meta name.
* @param mixed $value The meta value. * @param mixed $value The meta value.
* @param bool $hidden If the meta is hidden (starts with an underscore). * @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 ) { function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = false ) {
// Allow filter to short-circuit logic. // 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 * @date 16/10/2015
* @since 5.2.3 * @since 5.2.3
* *
* @param int|string $post_id The post id. * @param integer|string $post_id The post id.
* @param string $name The meta name. * @param string $name The meta name.
* @param bool $hidden If the meta is hidden (starts with an underscore). * @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 ) { function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
// Allow filter to short-circuit logic. // Allow filter to short-circuit logic.
@ -279,8 +279,8 @@ function acf_copy_metadata( $from_post_id = 0, $to_post_id = 0 ) {
* @since 5.3.8 * @since 5.3.8
* @deprecated 5.7.11 * @deprecated 5.7.11
* *
* @param int $from_post_id The post id to copy from. * @param integer $from_post_id The post id to copy from.
* @param int $to_post_id The post id to paste to. * @param integer $to_post_id The post id to paste to.
* @return void * @return void
*/ */
function acf_copy_postmeta( $from_post_id = 0, $to_post_id = 0 ) { function acf_copy_postmeta( $from_post_id = 0, $to_post_id = 0 ) {

View File

@ -8,7 +8,7 @@
/** /**
* Get an ACF CPT as an array * 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. * @return array|false The post type object.
*/ */
function acf_get_post_type( $id ) { function acf_get_post_type( $id ) {
@ -20,7 +20,7 @@ function acf_get_post_type( $id ) {
* *
* @since 6.1 * @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. * @return array|false The internal post type array.
*/ */
function acf_get_raw_post_type( $id ) { function acf_get_raw_post_type( $id ) {
@ -32,8 +32,8 @@ function acf_get_raw_post_type( $id ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post ID, key, or name. * @param integer|string $id The post ID, key, or name.
* @return object|bool The post object, or false on failure. * @return object|boolean The post object, or false on failure.
*/ */
function acf_get_post_type_post( $id ) { function acf_get_post_type_post( $id ) {
return acf_get_internal_post_type_post( $id, 'acf-post-type' ); 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 * @since 6.1
* *
* @param string $id The identifier. * @param string $id The identifier.
* @return bool * @return boolean
*/ */
function acf_is_post_type_key( $id ) { function acf_is_post_type_key( $id ) {
return acf_is_internal_post_type_key( $id, 'acf-post-type' ); 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 * @since 6.1
* *
* @param array $post_type The ACF post type array. * @param array $post_type The ACF post type array.
* @return array|bool * @return array|boolean
*/ */
function acf_validate_post_type( array $post_type = array() ) { function acf_validate_post_type( array $post_type = array() ) {
return acf_validate_internal_post_type( $post_type, 'acf-post-type' ); 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 * @since 6.1
* *
* @param int|string $id The ACF post type ID, key or name. * @param integer|string $id The ACF post type ID, key or name.
* @return bool True if post type was deleted. * @return boolean True if post type was deleted.
*/ */
function acf_delete_post_type( $id = 0 ) { function acf_delete_post_type( $id = 0 ) {
return acf_delete_internal_post_type( $id, 'acf-post-type' ); return acf_delete_internal_post_type( $id, 'acf-post-type' );
@ -152,8 +152,8 @@ function acf_delete_post_type( $id = 0 ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post type ID, key, or name. * @param integer|string $id The post type ID, key, or name.
* @return bool True if post was trashed. * @return boolean True if post was trashed.
*/ */
function acf_trash_post_type( $id = 0 ) { function acf_trash_post_type( $id = 0 ) {
return acf_trash_internal_post_type( $id, 'acf-post-type' ); return acf_trash_internal_post_type( $id, 'acf-post-type' );
@ -164,8 +164,8 @@ function acf_trash_post_type( $id = 0 ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post type ID, key, or name. * @param integer|string $id The post type ID, key, or name.
* @return bool True if post was untrashed. * @return boolean True if post was untrashed.
*/ */
function acf_untrash_post_type( $id = 0 ) { function acf_untrash_post_type( $id = 0 ) {
return acf_untrash_internal_post_type( $id, 'acf-post-type' ); return acf_untrash_internal_post_type( $id, 'acf-post-type' );
@ -177,7 +177,7 @@ function acf_untrash_post_type( $id = 0 ) {
* @since 6.1 * @since 6.1
* *
* @param array $post_type The ACF post type array. * @param array $post_type The ACF post type array.
* @return bool * @return boolean
*/ */
function acf_is_post_type( $post_type ) { function acf_is_post_type( $post_type ) {
return acf_is_internal_post_type( $post_type, 'acf-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 * @since 6.1
* *
* @param int|string $id The ACF post type ID, key or name. * @param integer|string $id The ACF post type ID, key or name.
* @param int $new_post_id Optional ID to override. * @param integer $new_post_id Optional ID to override.
* @return array|bool The new ACF post type, or false on failure. * @return array|boolean The new ACF post type, or false on failure.
*/ */
function acf_duplicate_post_type( $id = 0, $new_post_id = 0 ) { function acf_duplicate_post_type( $id = 0, $new_post_id = 0 ) {
return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-post-type' ); 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. * Activates or deactivates an ACF post type.
* *
* @param int|string $id The ACF post type ID, key or name. * @param integer|string $id The ACF post type ID, key or name.
* @param bool $activate True if the post type should be activated. * @param boolean $activate True if the post type should be activated.
* @return bool * @return boolean
*/ */
function acf_update_post_type_active_status( $id, $activate = true ) { function acf_update_post_type_active_status( $id, $activate = true ) {
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-post-type' ); 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 * @since 6.1
* *
* @param int $post_id The ACF post type ID. * @param integer $post_id The ACF post type ID.
* @return string * @return string
*/ */
function acf_get_post_type_edit_link( $post_id ) { 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 * @since 6.1
* *
* @param array $post_type The ACF post type array. * @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 ) { function acf_export_post_type_as_php( array $post_type ) {
return acf_export_internal_post_type_as_php( $post_type, 'acf-post-type' ); return acf_export_internal_post_type_as_php( $post_type, 'acf-post-type' );

View File

@ -8,7 +8,7 @@
/** /**
* Get an ACF taxonomy as an array * 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. * @return array|false The taxonomy object.
*/ */
function acf_get_taxonomy( $id ) { function acf_get_taxonomy( $id ) {
@ -20,7 +20,7 @@ function acf_get_taxonomy( $id ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post ID. * @param integer|string $id The post ID.
* @return array|false The taxonomy array. * @return array|false The taxonomy array.
*/ */
function acf_get_raw_taxonomy( $id ) { function acf_get_raw_taxonomy( $id ) {
@ -32,8 +32,8 @@ function acf_get_raw_taxonomy( $id ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The post ID, key, or name. * @param integer|string $id The post ID, key, or name.
* @return object|bool The post object, or false on failure. * @return object|boolean The post object, or false on failure.
*/ */
function acf_get_taxonomy_post( $id ) { function acf_get_taxonomy_post( $id ) {
return acf_get_internal_post_type_post( $id, 'acf-taxonomy' ); return acf_get_internal_post_type_post( $id, 'acf-taxonomy' );
@ -45,7 +45,7 @@ function acf_get_taxonomy_post( $id ) {
* @since 6.1 * @since 6.1
* *
* @param string $id The identifier. * @param string $id The identifier.
* @return bool * @return boolean
*/ */
function acf_is_taxonomy_key( $id ) { function acf_is_taxonomy_key( $id ) {
return acf_is_internal_post_type_key( $id, 'acf-taxonomy' ); return acf_is_internal_post_type_key( $id, 'acf-taxonomy' );
@ -57,7 +57,7 @@ function acf_is_taxonomy_key( $id ) {
* @since 6.1 * @since 6.1
* *
* @param array $taxonomy The ACF taxonomy array. * @param array $taxonomy The ACF taxonomy array.
* @return array|bool * @return array|boolean
*/ */
function acf_validate_taxonomy( array $taxonomy = array() ) { function acf_validate_taxonomy( array $taxonomy = array() ) {
return acf_validate_internal_post_type( $taxonomy, 'acf-taxonomy' ); return acf_validate_internal_post_type( $taxonomy, 'acf-taxonomy' );
@ -140,8 +140,8 @@ function acf_flush_taxonomy_cache( array $taxonomy ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ACF taxonomy ID, key or name. * @param integer|string $id The ACF taxonomy ID, key or name.
* @return bool True if taxonomy was deleted. * @return boolean True if taxonomy was deleted.
*/ */
function acf_delete_taxonomy( $id = 0 ) { function acf_delete_taxonomy( $id = 0 ) {
return acf_delete_internal_post_type( $id, 'acf-taxonomy' ); return acf_delete_internal_post_type( $id, 'acf-taxonomy' );
@ -152,8 +152,8 @@ function acf_delete_taxonomy( $id = 0 ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The taxonomy ID, key, or name. * @param integer|string $id The taxonomy ID, key, or name.
* @return bool True if taxonomy was trashed. * @return boolean True if taxonomy was trashed.
*/ */
function acf_trash_taxonomy( $id = 0 ) { function acf_trash_taxonomy( $id = 0 ) {
return acf_trash_internal_post_type( $id, 'acf-taxonomy' ); return acf_trash_internal_post_type( $id, 'acf-taxonomy' );
@ -164,8 +164,8 @@ function acf_trash_taxonomy( $id = 0 ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The taxonomy ID, key, or name. * @param integer|string $id The taxonomy ID, key, or name.
* @return bool True if taxonomy was untrashed. * @return boolean True if taxonomy was untrashed.
*/ */
function acf_untrash_taxonomy( $id = 0 ) { function acf_untrash_taxonomy( $id = 0 ) {
return acf_untrash_internal_post_type( $id, 'acf-taxonomy' ); return acf_untrash_internal_post_type( $id, 'acf-taxonomy' );
@ -177,7 +177,7 @@ function acf_untrash_taxonomy( $id = 0 ) {
* @since 6.1 * @since 6.1
* *
* @param array $taxonomy The ACF taxonomy array. * @param array $taxonomy The ACF taxonomy array.
* @return bool * @return boolean
*/ */
function acf_is_taxonomy( $taxonomy ) { function acf_is_taxonomy( $taxonomy ) {
return acf_is_internal_post_type( $taxonomy, 'acf-taxonomy' ); return acf_is_internal_post_type( $taxonomy, 'acf-taxonomy' );
@ -188,9 +188,9 @@ function acf_is_taxonomy( $taxonomy ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ACF taxonomy ID, key or name. * @param integer|string $id The ACF taxonomy ID, key or name.
* @param int $new_post_id Optional ID to override. * @param integer $new_post_id Optional ID to override.
* @return array|bool The new ACF taxonomy, or false on failure. * @return array|boolean The new ACF taxonomy, or false on failure.
*/ */
function acf_duplicate_taxonomy( $id = 0, $new_post_id = 0 ) { function acf_duplicate_taxonomy( $id = 0, $new_post_id = 0 ) {
return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-taxonomy' ); 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. * Activates or deactivates an ACF taxonomy.
* *
* @param int|string $id The ACF taxonomy ID, key or name. * @param integer|string $id The ACF taxonomy ID, key or name.
* @param bool $activate True if the taxonomy should be activated. * @param boolean $activate True if the taxonomy should be activated.
* @return bool * @return boolean
*/ */
function acf_update_taxonomy_active_status( $id, $activate = true ) { function acf_update_taxonomy_active_status( $id, $activate = true ) {
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-taxonomy' ); 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 * @since 6.1
* *
* @param int $post_id The ACF taxonomy ID. * @param integer $post_id The ACF taxonomy ID.
* @return string * @return string
*/ */
function acf_get_taxonomy_edit_link( $post_id ) { function acf_get_taxonomy_edit_link( $post_id ) {
@ -237,7 +237,7 @@ function acf_prepare_taxonomy_for_export( array $taxonomy = array() ) {
* @since 6.1 * @since 6.1
* *
* @param array $taxonomy The ACF taxonomy array. * @param array $taxonomy The ACF taxonomy array.
* @return string|bool * @return string|boolean
*/ */
function acf_export_taxonomy_as_php( array $taxonomy ) { function acf_export_taxonomy_as_php( array $taxonomy ) {
return acf_export_internal_post_type_as_php( $taxonomy, 'acf-taxonomy' ); return acf_export_internal_post_type_as_php( $taxonomy, 'acf-taxonomy' );

View File

@ -100,7 +100,7 @@ function acf_get_user_role_labels( $roles = array() ) {
* @since 5.7.10 * @since 5.7.10
* *
* @param void * @param void
* @return bool * @return boolean
*/ */
function acf_allow_unfiltered_html() { function acf_allow_unfiltered_html() {

View File

@ -89,7 +89,7 @@ function acf_get_store( $name = '' ) {
* @date 13/2/19 * @date 13/2/19
* @since 5.7.11 * @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. * @param int prev_blog_id Prev blog ID.
* @return void * @return void
*/ */
@ -137,9 +137,7 @@ function acf_get_url( $filename = '' ) {
return ACF_URL . ltrim( $filename, '/' ); return ACF_URL . ltrim( $filename, '/' );
} }
/* /**
* acf_include
*
* Includes a file within the ACF plugin. * Includes a file within the ACF plugin.
* *
* @date 10/3/14 * @date 10/3/14

View File

@ -372,10 +372,11 @@ function acf_log_invalid_field_notice( $field, $function ) {
} }
$error_text = sprintf( $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' ), __( '<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_get_setting( 'name' ),
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/acf-field-functions/', 'docs', 'early_init_warning' ) 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 ); add_action( 'acf/get_invalid_field_value', 'acf_log_invalid_field_notice', 10, 2 );

View File

@ -242,7 +242,7 @@ function acf_get_object_type_rest_base( $type_object ) {
* load_fields() callbacks. * load_fields() callbacks.
* *
* @param WP_Post|WP_User|WP_Term|WP_Comment|array $object * @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 ) { function acf_get_object_id( $object ) {
if ( is_object( $object ) ) { if ( is_object( $object ) ) {

View File

@ -59,7 +59,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
/** /**
* If this is a pro feature or not. * If this is a pro feature or not.
* *
* @var bool * @var boolean
*/ */
public $is_pro_feature = false; 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. * Constructor for all ACF internal post type admin list pages.
* *
* @date 21/07/2014
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function current_screen() { public function current_screen() {
// Bail early if not the list admin page. // 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. * Sets up the field groups ready for sync.
* *
* @date 17/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function setup_sync() { public function setup_sync() {
// Review local json files. // Review local json files.
@ -204,10 +198,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
/** /**
* Enqueues admin scripts. * Enqueues admin scripts.
* *
* @date 18/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
acf_enqueue_script( 'acf' ); acf_enqueue_script( 'acf' );
@ -335,7 +326,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
* @since 5.9.0 * @since 5.9.0
* *
* @param string $column_name The name of the column to display. * @param string $column_name The name of the column to display.
* @param int $post_id The current post ID. * @param integer $post_id The current post ID.
* @return void * @return void
*/ */
public function admin_table_columns_html( $column_name, $post_id ) { 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( $json[ $post['key'] ] ) ) {
if ( isset( $this->sync[ $post['key'] ] ) ) { if ( isset( $this->sync[ $post['key'] ] ) ) {
$url = $this->get_admin_url( '&acfsync=' . $post['key'] . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) ); $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'] ) { if ( $post['ID'] ) {
echo '<div class="row-actions"> echo '<div class="row-actions">
<span class="sync"><a href="' . esc_url( $url ) . '">' . __( 'Sync', '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 ) . '">' . __( 'Review changes', '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>'; </div>';
} else { } else {
echo '<div class="row-actions"> 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>'; </div>';
} }
} else { } else {
echo __( 'Saved', 'acf' ); echo esc_html__( 'Saved', 'acf' );
} }
} else { } else {
echo '<span class="acf-secondary-text">' . __( 'Awaiting save', 'acf' ) . '</span>'; echo '<span class="acf-secondary-text">' . esc_html__( 'Awaiting save', 'acf' ) . '</span>';
} }
} }
@ -497,7 +488,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
* @since 6.1 * @since 6.1
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @param int $count The number of items the action was performed on. * @param integer $count The number of items the action was performed on.
* @return string * @return string
*/ */
public function get_action_notice_text( $action, $count = 1 ) { 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. * Checks for the custom "duplicate" action.
* *
* @date 15/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function check_duplicate() { public function check_duplicate() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Used for redirect notice. // 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. * Checks for the custom "acfsync" action.
* *
* @date 15/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function check_sync() { public function check_sync() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended // 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. * Prints scripts into the admin footer.
* *
* @date 20/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function admin_footer() { 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. * Customizes the admin table HTML when viewing "sync" post_status.
* *
* @date 17/4/20
* @since 5.9.0 * @since 5.9.0
*
* @return void
*/ */
public function admin_footer__sync() { public function admin_footer__sync() {
global $wp_list_table; global $wp_list_table;
@ -853,12 +832,22 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
if ( in_array( $column_name, $hidden, true ) ) { if ( in_array( $column_name, $hidden, true ) ) {
$classes .= ' hidden'; $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 ) { switch ( $column_name ) {
// Checkbox. // Checkbox.
case 'cb': 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[]">'; echo '<input id="cb-select-' . esc_attr( $k ) . '" type="checkbox" value="' . esc_attr( $k ) . '" name="post[]">';
break; break;
@ -868,8 +857,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
if ( ! $field_group['active'] ) { if ( ! $field_group['active'] ) {
$post_state = ' — <span class="post-state">' . $this->get_disabled_post_state() . '</span>'; $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 '<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">' . $this->get_human_readable_file_location( $field_group['local_file'] ) . '</span></div>'; 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>'; echo '<button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button>';
break; break;
@ -878,7 +867,8 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
$this->render_admin_table_column( $column_name, $field_group ); $this->render_admin_table_column( $column_name, $field_group );
break; break;
} }
echo "</$el>";
printf( '</%s>', esc_attr( $el ) );
} }
echo '</tr>'; echo '</tr>';
} }
@ -897,11 +887,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
/** /**
* Fires when trashing an internal post type. * 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. * @param integer $post_id The post ID.
* @return void
*/ */
public function trashed_post( $post_id ) { public function trashed_post( $post_id ) {
if ( get_post_type( $post_id ) === $this->post_type ) { 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 * @date 8/01/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param int $post_id The post ID. * @param integer $post_id The post ID.
* @return void * @return void
*/ */
public function untrashed_post( $post_id ) { public function untrashed_post( $post_id ) {
@ -930,7 +918,7 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type_List' ) ) :
* @date 8/01/2014 * @date 8/01/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param int $post_id The post ID. * @param integer $post_id The post ID.
* @return void * @return void
*/ */
public function deleted_post( $post_id ) { public function deleted_post( $post_id ) {

View File

@ -54,9 +54,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
* *
* @since 5.8.0 * @since 5.8.0
* *
* @param bool $use_block_editor Whether the post type can be edited or not. Default true. * @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. * @param string $post_type The post type being checked.
* @return bool * @return boolean
*/ */
public function use_block_editor_for_post_type( $use_block_editor, $post_type ) { public function use_block_editor_for_post_type( $use_block_editor, $post_type ) {
if ( $post_type === $this->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. * This function is fired when loading the admin page before HTML has been rendered.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function current_screen() { public function current_screen() {
if ( ! acf_is_screen( $this->post_type ) ) { 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. * Enqueues any scripts necessary for internal post type.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
wp_enqueue_script( 'acf-internal-post-type' ); 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. * Set up functionality for the field group edit page.
* *
* @since 3.1.8 * @since 3.1.8
*
* @return void
*/ */
public function admin_head() { public function admin_head() {
// Override as necessary. // Override as necessary.
@ -156,8 +150,6 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
* Admin footer third party hook support * Admin footer third party hook support
* *
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function admin_footer() { public function admin_footer() {
// Override as necessary. // Override as necessary.
@ -180,10 +172,9 @@ if ( ! class_exists( 'ACF_Admin_Internal_Post_Type' ) ) :
* *
* @since 6.1 * @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. * @param WP_Post $post The post object.
* * @return boolean
* @return bool
*/ */
public function verify_save_post( $post_id, $post ) { public function verify_save_post( $post_id, $post ) {
// Do not save if this is an auto save routine. // 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. * Powers the modal for linking field groups to newly-created CPTs/taxonomies.
* *
* @since 6.1 * @since 6.1
*
* @return void
*/ */
public function ajax_link_field_groups() { public function ajax_link_field_groups() {
// Disable filters to ensure ACF loads raw data from DB. // Disable filters to ensure ACF loads raw data from DB.

View File

@ -90,9 +90,7 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
} }
/* /**
* admin_menu
*
* This function will add the ACF menu item to the WP admin * This function will add the ACF menu item to the WP admin
* *
* @type action (admin_menu) * @type action (admin_menu)
@ -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 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. * @param array $metabox An array of the metabox attributes.
*
* @return void
*/ */
public function metabox_html( $post, $metabox ) { public function metabox_html( $post, $metabox ) {
$tool = $this->get_tool( $metabox['args']['tool'] ); $tool = $this->get_tool( $metabox['args']['tool'] );
@ -283,57 +279,48 @@ if ( ! class_exists( 'acf_admin_tools' ) ) :
endif; // class_exists check endif; // class_exists check
/* /**
* acf_register_admin_tool * alias of acf()->admin_tools->register_tool()
* *
* alias of acf()->admin_tools->register_tool() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_register_admin_tool( $class ) { function acf_register_admin_tool( $class ) {
return acf()->admin_tools->register_tool( $class ); return acf()->admin_tools->register_tool( $class );
} }
/* /**
* acf_get_admin_tools_url * This function will return the admin URL to the tools page
* *
* This function will return the admin URL to the tools page * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_get_admin_tools_url() { function acf_get_admin_tools_url() {
return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' ); return admin_url( 'edit.php?post_type=acf-field-group&page=acf-tools' );
} }
/* /**
* acf_get_admin_tool_url * This function will return the admin URL to the tools page
* *
* This function will return the admin URL to the tools page * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_get_admin_tool_url( $tool = '' ) { function acf_get_admin_tool_url( $tool = '' ) {
return acf_get_admin_tools_url() . '&tool=' . $tool; return acf_get_admin_tools_url() . '&tool=' . $tool;

View File

@ -68,11 +68,8 @@ if ( ! class_exists( 'ACF_Admin_Upgrade' ) ) :
* the “Upgrade Database” submenu under the “Dashboard” network admin * the “Upgrade Database” submenu under the “Dashboard” network admin
* menu item if an ACF upgrade needs to run on any network site. * menu item if an ACF upgrade needs to run on any network site.
* *
* @date 24/8/18
* @since 5.7.4 * @since 5.7.4
* @since 6.0.0 Reduce memory usage, cache network upgrade checks. * @since 6.0.0 Reduce memory usage, cache network upgrade checks.
*
* @return void
*/ */
function network_admin_menu() { function network_admin_menu() {
$network_upgrade_needed = get_site_transient( $this->network_upgrade_needed_transient ); $network_upgrade_needed = get_site_transient( $this->network_upgrade_needed_transient );

View File

@ -12,8 +12,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
* Constructor. * Constructor.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function __construct() { public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ) ); add_action( 'admin_menu', array( $this, 'admin_menu' ) );
@ -51,8 +49,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
* Enqueues global admin styling. * Enqueues global admin styling.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
wp_enqueue_style( 'acf-global' ); wp_enqueue_style( 'acf-global' );
@ -212,8 +208,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
* had HTML removed/altered due to unsafe HTML being escaped. * had HTML removed/altered due to unsafe HTML being escaped.
* *
* @since 6.2.5 * @since 6.2.5
*
* @return void
*/ */
public function maybe_show_escaped_html_notice() { public function maybe_show_escaped_html_notice() {
// Only show to editors and above. // Only show to editors and above.
@ -232,15 +226,6 @@ if ( ! class_exists( 'ACF_Admin' ) ) :
if ( ! empty( $escaped ) ) { if ( ! empty( $escaped ) ) {
acf_get_view( 'escaped-html-notice', array( 'acf_escaped' => $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; return;
} }
$to_dismiss = acf_request_arg( 'notice', 'escaped_html' );
if ( 'escaped_html' === $to_dismiss ) {
_acf_delete_escaped_html_log(); _acf_delete_escaped_html_log();
} else {
_acf_delete_will_escape_html_log();
}
} }
/** /**

View File

@ -37,8 +37,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* Constructs the class. * Constructs the class.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
@ -78,8 +76,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* Enqueues any scripts necessary for internal post type. * Enqueues any scripts necessary for internal post type.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
parent::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. * Set up functionality for the field group edit page.
* *
* @since 3.1.8 * @since 3.1.8
*
* @return void
*/ */
public function admin_head() { public function admin_head() {
global $post, $field_group; 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. * This action will allow ACF to render metaboxes after the title.
*
* @return void
*/ */
public function edit_form_after_title() { public function edit_form_after_title() {
global $post; global $post;
@ -214,8 +206,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* Admin footer third party hook support * Admin footer third party hook support
* *
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function admin_footer() { public function admin_footer() {
$this->include_pro_features(); $this->include_pro_features();
@ -224,8 +214,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
/** /**
* Renders HTML for the ACF PRO features upgrade notice. * Renders HTML for the ACF PRO features upgrade notice.
*
* @return void
*/ */
public function include_pro_features() { public function include_pro_features() {
// Bail if on PRO. // 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. * Sets the "Edit Field Group" screen to use a one-column layout.
* *
* @param int $columns Number of columns for layout. * @param integer $columns Number of columns for layout.
* * @return integer
* @return int
*/ */
public function screen_layout( $columns = 0 ) { public function screen_layout( $columns = 0 ) {
return 1; return 1;
@ -281,8 +268,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* This function will customize the publish metabox * This function will customize the publish metabox
* *
* @since 5.2.9 * @since 5.2.9
*
* @return void
*/ */
public function post_submitbox_misc_actions() { public function post_submitbox_misc_actions() {
global $field_group; global $field_group;
@ -302,10 +287,9 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* *
* @since 1.0.0 * @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. * @param WP_Post $post The post object.
* * @return integer $post_id
* @return int $post_id
*/ */
public function save_post( $post_id, $post ) { public function save_post( $post_id, $post ) {
if ( ! $this->verify_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. // 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. // 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 ); $ids = array_map( 'intval', $ids );
// loop. // loop.
@ -370,11 +354,10 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
$_POST['acf_field_group']['ID'] = $post_id; $_POST['acf_field_group']['ID'] = $post_id;
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized when saved. // 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. // save field group.
acf_update_field_group( $_POST['acf_field_group'] ); acf_update_field_group( $_POST['acf_field_group'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
// phpcs:enable WordPress.Security.NonceVerification.Missing // phpcs:enable WordPress.Security.NonceVerification.Missing
return $post_id; return $post_id;
@ -384,8 +367,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* This function will render the HTML for the metabox 'acf-field-group-fields' * This function will render the HTML for the metabox 'acf-field-group-fields'
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_fields() { public function mb_fields() {
global $field_group; 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' * This function will render the HTML for the metabox 'acf-field-group-pro-features'
* *
* @since 6.0.0 * @since 6.0.0
*
* @return void
*/ */
public function mb_pro_features() { public function mb_pro_features() {
acf_get_view( $this->post_type . '/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' * This function will render the HTML for the metabox 'acf-field-group-options'
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_options() { public function mb_options() {
global $field_group; global $field_group;
@ -431,8 +408,6 @@ 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 * This function can be accessed via an AJAX action and will return the result from the render_location_value function
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function ajax_render_location_rule() { public function ajax_render_location_rule() {
// validate. // validate.
@ -445,8 +420,12 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
die(); die();
} }
if ( empty( $_POST['rule'] ) ) {
die();
}
// validate rule. // 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_get_view(
'acf-field-group/location-rule', 'acf-field-group/location-rule',
@ -462,8 +441,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* This function will return HTML containing the field's settings based on it's new type * This function will return HTML containing the field's settings based on it's new type
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function ajax_render_field_settings() { public function ajax_render_field_settings() {
// Verify the current request. // Verify the current request.
@ -504,8 +481,6 @@ if ( ! class_exists( 'acf_admin_field_group' ) ) :
* Move field AJAX function * Move field AJAX function
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void No return, HTML output for AJAX consumption.
*/ */
public function ajax_move_field() { public function ajax_move_field() {
// disable filters to ensure ACF loads raw data from DB. // 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>'; $link = '<a href="' . admin_url( 'post.php?post=' . $field_group['ID'] . '&action=edit' ) . '" target="_blank">' . esc_html( $field_group['title'] ) . '</a>';
echo '' . echo '' .
'<p><strong>' . __( 'Move Complete.', 'acf' ) . '</strong></p>' . '<p><strong>' . esc_html__( 'Move Complete.', 'acf' ) . '</strong></p>' .
'<p>' . sprintf( '<p>' . sprintf(
/* translators: Confirmation message once a field has been moved to a different field group. */ /* 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' ) ), acf_punctify( __( 'The %1$s field can now be found in the %2$s field group', 'acf' ) ),
esc_html( $field['label'] ), esc_html( $field['label'] ),
$link //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $link //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
) . '</p>' . ) . '</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(); 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">'; echo '<form id="acf-move-field-form">';
// render. // render.
acf_render_field_wrap( $field ); 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>'; echo '</form>';

View File

@ -34,10 +34,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
/** /**
* Constructor. * Constructor.
* *
* @date 5/03/2014
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function __construct() { public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ), 7 ); 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. * Renders HTML for the ACF PRO features upgrade notice.
*
* @return void
*/ */
public function include_pro_features() { public function include_pro_features() {
// Bail if on PRO. // Bail if on PRO.
@ -80,14 +75,11 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
/** /**
* Redirects users from ACF 4.0 admin page. * Redirects users from ACF 4.0 admin page.
* *
* @date 17/9/18
* @since 5.7.6 * @since 5.7.6
*
* @return void
*/ */
public function handle_redirection() { public function handle_redirection() {
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'acf' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 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; exit;
} }
} }
@ -300,7 +292,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
* @date 8/01/2014 * @date 8/01/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param int $post_id The post ID. * @param integer $post_id The post ID.
* @return void * @return void
*/ */
public function trashed_post( $post_id ) { public function trashed_post( $post_id ) {
@ -315,7 +307,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
* @date 8/01/2014 * @date 8/01/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param int $post_id The post ID. * @param integer $post_id The post ID.
* @return void * @return void
*/ */
public function untrashed_post( $post_id ) { public function untrashed_post( $post_id ) {
@ -330,7 +322,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
* @date 8/01/2014 * @date 8/01/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param int $post_id The post ID. * @param integer $post_id The post ID.
* @return void * @return void
*/ */
public function deleted_post( $post_id ) { public function deleted_post( $post_id ) {
@ -345,7 +337,7 @@ if ( ! class_exists( 'ACF_Admin_Field_Groups' ) ) :
* @since 6.1 * @since 6.1
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @param int $count The number of items the action was performed on. * @param integer $count The number of items the action was performed on.
* @return string * @return string
*/ */
public function get_action_notice_text( $action, $count = 1 ) { public function get_action_notice_text( $action, $count = 1 ) {

View File

@ -64,7 +64,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* *
* @since 6.1 * @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 * @return string
*/ */
public function post_type_created_message( $created = false ) { 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. * Enqueues any scripts necessary for internal post type.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
@ -139,8 +137,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* Sets up all functionality for the post type edit page to work. * Sets up all functionality for the post type edit page to work.
* *
* @since 3.1.8 * @since 3.1.8
*
* @return void
*/ */
public function admin_head() { 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. * This action will allow ACF to render metaboxes after the title.
*
* @return void
*/ */
public function edit_form_after_title() { public function edit_form_after_title() {
@ -225,8 +219,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* Admin footer third party hook support * Admin footer third party hook support
* *
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function admin_footer() { public function admin_footer() {
do_action( 'acf/post_type/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. * Sets the "Edit Post Type" screen to use a one-column layout.
* *
* @param int $columns Number of columns for layout. * @param integer $columns Number of columns for layout.
* * @return integer
* @return int
*/ */
public function screen_layout( $columns = 0 ) { public function screen_layout( $columns = 0 ) {
return 1; return 1;
@ -259,7 +250,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* Force basic settings to always be visible * 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 * @return array
*/ */
public function force_basic_settings( $hidden_metaboxes ) { public function force_basic_settings( $hidden_metaboxes ) {
@ -273,7 +263,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* Force advanced settings to be visible * 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 * @return array
*/ */
public function force_advanced_settings( $hidden_metaboxes ) { public function force_advanced_settings( $hidden_metaboxes ) {
@ -287,8 +276,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* This function will customize the publish metabox * This function will customize the publish metabox
* *
* @since 5.2.9 * @since 5.2.9
*
* @return void
*/ */
public function post_submitbox_misc_actions() { public function post_submitbox_misc_actions() {
global $acf_post_type; global $acf_post_type;
@ -308,10 +295,9 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* *
* @since 1.0.0 * @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. * @param WP_Post $post The post object.
* * @return integer $post_id
* @return int $post_id
*/ */
public function save_post( $post_id, $post ) { public function save_post( $post_id, $post ) {
if ( ! $this->verify_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. * Renders HTML for the basic settings metabox.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_basic_settings() { public function mb_basic_settings() {
global $acf_post_type; global $acf_post_type;
@ -356,8 +340,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
* Renders the HTML for the advanced settings metabox. * Renders the HTML for the advanced settings metabox.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_advanced_settings() { public function mb_advanced_settings() {
acf_get_view( $this->post_type . '/advanced-settings' ); acf_get_view( $this->post_type . '/advanced-settings' );

View File

@ -38,10 +38,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
/** /**
* Constructor. * Constructor.
* *
* @date 5/03/2014
* @since 6.2 * @since 6.2
*
* @return void
*/ */
public function __construct() { public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ), 8 ); 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. * Renders HTML for the ACF PRO features upgrade notice.
*
* @return void
*/ */
public function include_pro_features() { public function include_pro_features() {
// Bail if on PRO. // Bail if on PRO.
@ -72,8 +67,6 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
* Current screen actions for the post types list admin page. * Current screen actions for the post types list admin page.
* *
* @since 6.1 * @since 6.1
*
* @return void
*/ */
public function current_screen() { public function current_screen() {
// Bail early if not post types admin page. // Bail early if not post types admin page.
@ -317,7 +310,7 @@ if ( ! class_exists( 'ACF_Admin_Post_Types' ) ) :
* @since 6.1 * @since 6.1
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @param int $count The number of items the action was performed on. * @param integer $count The number of items the action was performed on.
* @return string * @return string
*/ */
public function get_action_notice_text( $action, $count = 1 ) { public function get_action_notice_text( $action, $count = 1 ) {

View File

@ -37,11 +37,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
/** /**
* Constructor. * Constructor.
*
* @date 5/03/2014
* @since 6.2 * @since 6.2
*
* @return void
*/ */
public function __construct() { public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); 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. * Renders HTML for the ACF PRO features upgrade notice.
*
* @return void
*/ */
public function include_pro_features() { public function include_pro_features() {
// Bail if on PRO. // Bail if on PRO.
@ -72,8 +66,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
* Current screen actions for the taxonomies list admin page. * Current screen actions for the taxonomies list admin page.
* *
* @since 6.1 * @since 6.1
*
* @return void
*/ */
public function current_screen() { public function current_screen() {
// Bail early if not post types admin page. // Bail early if not post types admin page.
@ -324,7 +316,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomies' ) ) :
* @since 6.1 * @since 6.1
* *
* @param string $action The action being performed. * @param string $action The action being performed.
* @param int $count The number of items the action was performed on. * @param integer $count The number of items the action was performed on.
* @return string * @return string
*/ */
public function get_action_notice_text( $action, $count = 1 ) { public function get_action_notice_text( $action, $count = 1 ) {

View File

@ -64,7 +64,7 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* *
* @since 6.1 * @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 * @return string
*/ */
public function taxonomy_saved_message( $created = false ) { 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. * Enqueues any scripts necessary for internal post type.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function admin_enqueue_scripts() { public function admin_enqueue_scripts() {
@ -141,8 +139,6 @@ 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 * @since 3.1.8
*
* @return void
*/ */
public function admin_head() { 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. * This action will allow ACF to render metaboxes after the title.
*
* @return void
*/ */
public function edit_form_after_title() { public function edit_form_after_title() {
@ -227,8 +221,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* Admin footer third party hook support * Admin footer third party hook support
* *
* @since 5.3.2 * @since 5.3.2
*
* @return void
*/ */
public function admin_footer() { public function admin_footer() {
do_action( 'acf/taxonomy/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. * Sets the "Edit Field Group" screen to use a one-column layout.
* *
* @param int $columns Number of columns for layout. * @param integer $columns Number of columns for layout.
* * @return integer
* @return int
*/ */
public function screen_layout( $columns = 0 ) { public function screen_layout( $columns = 0 ) {
return 1; return 1;
@ -261,7 +252,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* Force basic settings to always be visible * 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 * @return array
*/ */
public function force_basic_settings( $hidden_metaboxes ) { public function force_basic_settings( $hidden_metaboxes ) {
@ -275,7 +265,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* Force advanced settings to be visible * 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 * @return array
*/ */
public function force_advanced_settings( $hidden_metaboxes ) { public function force_advanced_settings( $hidden_metaboxes ) {
@ -289,8 +278,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* This function will customize the publish metabox * This function will customize the publish metabox
* *
* @since 5.2.9 * @since 5.2.9
*
* @return void
*/ */
public function post_submitbox_misc_actions() { public function post_submitbox_misc_actions() {
global $acf_taxonomy; global $acf_taxonomy;
@ -310,10 +297,9 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* *
* @since 1.0.0 * @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. * @param WP_Post $post The post object.
* * @return integer $post_id
* @return int $post_id
*/ */
public function save_post( $post_id, $post ) { public function save_post( $post_id, $post ) {
if ( ! $this->verify_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. * Renders HTML for the 'acf-taxonomy-fields' metabox.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_basic_settings() { public function mb_basic_settings() {
global $acf_taxonomy; global $acf_taxonomy;
@ -358,8 +342,6 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
* Renders the HTML for the 'acf-taxonomy-options' metabox. * Renders the HTML for the 'acf-taxonomy-options' metabox.
* *
* @since 5.0.0 * @since 5.0.0
*
* @return void
*/ */
public function mb_advanced_settings() { public function mb_advanced_settings() {
acf_get_view( $this->post_type . '/advanced-settings' ); acf_get_view( $this->post_type . '/advanced-settings' );

View File

@ -98,7 +98,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
header( 'Content-Type: application/json; charset=utf-8' ); header( 'Content-Type: application/json; charset=utf-8' );
// return // 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; die;
} }
@ -129,7 +129,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
$url = add_query_arg( 'keys', implode( '+', $keys ), $this->get_url() ); $url = add_query_arg( 'keys', implode( '+', $keys ), $this->get_url() );
// redirect // redirect
wp_redirect( $url ); wp_safe_redirect( $url );
exit; exit;
} }
@ -192,10 +192,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
/** /**
* Renders the checkboxes to select items to export. * Renders the checkboxes to select items to export.
* *
* @date 24/10/17
* @since 5.6.3 * @since 5.6.3
*
* @return void
*/ */
public function html_field_selection() { public function html_field_selection() {
// Ensure `l10n_var_export` is always false at the point we're outputting the options. // 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. * Renders the side panel for selecting ACF items to export via PHP.
* *
* @date 21/10/17
* @since 5.6.3 * @since 5.6.3
*
* @return void
*/ */
public function html_panel_selection() { public function html_panel_selection() {
?> ?>
@ -311,46 +305,6 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
<?php <?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
@ -376,8 +330,8 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
<?php $this->html_field_selection(); ?> <?php $this->html_field_selection(); ?>
</div> </div>
<p class="acf-submit acf-actions-strip"> <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-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 _e( 'Generate PHP', 'acf' ); ?></button> <button type="submit" name="action" class="acf-btn acf-btn-secondary" value="generate"><?php esc_html_e( 'Generate PHP', 'acf' ); ?></button>
</p> </p>
</div> </div>
<?php <?php
@ -386,10 +340,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
/** /**
* Renders the PHP export screen. * Renders the PHP export screen.
* *
* @date 20/10/17
* @since 5.6.3 * @since 5.6.3
*
* @return void
*/ */
public function html_single() { public function html_single() {
?> ?>
@ -414,10 +365,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
/** /**
* Generates the HTML for the PHP export functionality. * Generates the HTML for the PHP export functionality.
* *
* @date 17/10/17
* @since 5.6.3 * @since 5.6.3
*
* @return void
*/ */
public function html_generate() { public function html_generate() {
// Prevent default translation and fake __() within string. // Prevent default translation and fake __() within string.
@ -469,7 +417,7 @@ if ( ! class_exists( 'ACF_Admin_Tool_Export' ) ) :
echo '</textarea>'; echo '</textarea>';
?> ?>
<p class="acf-submit"> <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> </p>
<script type="text/javascript"> <script type="text/javascript">
(function($){ (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. * Return an array of keys that have been selected in the export tool.
* *
* @date 20/10/17
* @since 5.6.3 * @since 5.6.3
* *
* @return array|bool * @return array|boolean
*/ */
public function get_selected_keys() { public function get_selected_keys() {
$key_names = array( 'keys', 'taxonomy_keys', 'post_type_keys', 'ui_options_page_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. * Returns the JSON data for given $_POST args.
* *
* @date 17/10/17
* @since 5.6.3 * @since 5.6.3
* *
* @return array|bool * @return array|boolean
*/ */
public function get_selected() { public function get_selected() {
$selected = $this->get_selected_keys(); $selected = $this->get_selected_keys();

View File

@ -137,15 +137,14 @@ if ( ! class_exists( 'ACF_Admin_Tool_Import' ) ) :
/** /**
* Imports the selected ACF posts and returns an admin notice on completion. * Imports the selected ACF posts and returns an admin notice on completion.
* *
* @date 10/10/17
* @since 5.6.3 * @since 5.6.3
* *
* @return ACF_Admin_Notice * @return ACF_Admin_Notice
*/ */
public function submit() { public function submit() {
//phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified before this function is called. //phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified before this function is called.
if ( 'cptui' === acf_request_arg( 'import_type', '' ) ) { if ( 'cptui' === acf_request_arg( 'import_type', '' ) && ! empty( $_POST['acf_import_cptui'] ) ) {
$import = acf_sanitize_request_args( $_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 ); return $this->import_cpt_ui( $import );
} }

View File

@ -85,7 +85,7 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
* @since 5.6.3 * @since 5.6.3
* *
* @param n/a * @param n/a
* @return bool * @return boolean
*/ */
function is_active() { function is_active() {
@ -93,9 +93,7 @@ if ( ! class_exists( 'ACF_Admin_Tool' ) ) :
} }
/* /**
* __construct
*
* This function will setup the class functionality * This function will setup the class functionality
* *
* @type function * @type function

View File

@ -22,7 +22,7 @@ if ( empty( $field['conditional_logic'] ) ) {
<div class="acf-conditional-toggle"> <div class="acf-conditional-toggle">
<div class="acf-label"> <div class="acf-label">
<?php $acf_label_for = acf_idify( $field['prefix'] . '[conditional_logic]' ); ?> <?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>
<div class="acf-input"> <div class="acf-input">
<?php <?php
@ -64,9 +64,9 @@ if ( empty( $field['conditional_logic'] ) ) {
$h4 = ( $group_id == 'group_0' ) ? __( 'Show this field if', 'acf' ) : __( 'or', 'acf' ); $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"> <table class="acf-table -clear">
<tbody> <tbody>
@ -158,7 +158,7 @@ if ( empty( $field['conditional_logic'] ) ) {
?> ?>
</td> </td>
<td class="add"> <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>
<td class="remove"> <td class="remove">
<a href="#" class="acf-icon -minus remove-conditional-rule"></a> <a href="#" class="acf-icon -minus remove-conditional-rule"></a>
@ -171,8 +171,8 @@ if ( empty( $field['conditional_logic'] ) ) {
</div> </div>
<?php endforeach; ?> <?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>
</div> </div>

View File

@ -68,25 +68,25 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
<div class="handle"> <div class="handle">
<ul class="acf-hl acf-tbody"> <ul class="acf-hl acf-tbody">
<li class="li-field-order"> <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>
<li class="li-field-label"> <li class="li-field-label">
<strong> <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> </strong>
<div class="row-options"> <div class="row-options">
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php _e( 'Edit', '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 _e( 'Duplicate field', 'acf' ); ?>" href="#"><?php _e( 'Duplicate', '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 ) : ?> <?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; ?> <?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> </div>
</li> </li>
<li class="li-field-name"><span class="copyable"><?php echo esc_html( $field['name'] ); ?></span></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-key"><span class="copyable"><?php echo esc_html( $field['key'] ); ?></span></li>
<li class="li-field-type"> <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"> <span class="field-type-label">
<?php echo acf_esc_html( $field_type_label ); ?> <?php echo acf_esc_html( $field_type_label ); ?>
</span> </span>
@ -144,7 +144,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
<div class="acf-input"> <div class="acf-input">
<button class="acf-btn browse-fields"> <button class="acf-btn browse-fields">
<i class="acf-icon acf-icon-dots-grid"></i> <i class="acf-icon acf-icon-dots-grid"></i>
<?php _e( 'Browse Fields', 'acf' ); ?> <?php esc_html_e( 'Browse Fields', 'acf' ); ?>
</button> </button>
</div> </div>
</div> </div>
@ -307,7 +307,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
?> ?>
<div class="acf-field-settings-footer"> <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> </div>
</div> </div>

View File

@ -29,8 +29,8 @@ if ( $is_subfield ) {
?> ?>
<?php if ( $parent || $is_subfield ) { ?> <?php if ( $parent || $is_subfield ) { ?>
<div class="acf-sub-field-list-header"> <div class="acf-sub-field-list-header">
<h3 class="acf-sub-field-list-title"><?php _e( 'Fields', 'acf' ); ?></h3> <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 _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>
</div> </div>
<?php } ?> <?php } ?>
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?> <?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?>
@ -40,19 +40,19 @@ if ( $is_subfield ) {
<li class="li-field-order"> <li class="li-field-order">
<?php <?php
/* translators: A symbol (or text, if not available in your locale) meaning "Order Number", in terms of positional placement. */ /* 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"> <span class="acf-hidden">
<?php <?php
/* translators: Hidden accessibility text for the positional order number of the field. */ /* translators: Hidden accessibility text for the positional order number of the field. */
_e( 'Order', 'acf' ); esc_html_e( 'Order', 'acf' );
?> ?>
</span> </span>
</li> </li>
<li class="li-field-label"><?php _e( 'Label', 'acf' ); ?></li> <li class="li-field-label"><?php esc_html_e( 'Label', 'acf' ); ?></li>
<li class="li-field-name"><?php _e( 'Name', 'acf' ); ?></li> <li class="li-field-name"><?php esc_html_e( 'Name', 'acf' ); ?></li>
<li class="li-field-key"><?php _e( 'Key', 'acf' ); ?></li> <li class="li-field-key"><?php esc_html_e( 'Key', 'acf' ); ?></li>
<li class="li-field-type"><?php _e( 'Type', 'acf' ); ?></li> <li class="li-field-type"><?php esc_html_e( 'Type', 'acf' ); ?></li>
</ul> </ul>
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?> <?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">
<div class="no-fields-message-inner"> <div class="no-fields-message-inner">
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" /> <img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-group.svg' ) ); ?>" />
<h2><?php _e( 'Add Your First Field', 'acf' ); ?></h2> <h2><?php esc_html_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> <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 <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"> <p class="acf-small">
<?php <?php
printf( echo acf_esc_html(
sprintf(
/* translators: %s url to field types list */ /* translators: %s url to field types list */
__( 'Choose from over 30 field types. <a href="%s" target="_blank">Learn more</a>.', 'acf' ), __( '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' ) acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/', 'docs', 'empty-field-group', 'field-types' )
)
); );
?> ?>
</p> </p>
@ -96,7 +98,7 @@ if ( $is_subfield ) {
<ul class="acf-hl acf-tfoot"> <ul class="acf-hl acf-tfoot">
<li class="acf-fr"> <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> </li>
</ul> </ul>

View File

@ -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-wrapper">
<div class="acf-no-field-groups-inner"> <div class="acf-no-field-groups-inner">
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" /> <img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-group.svg' ) ); ?>" />
<h2><?php _e( 'Add Your First Field Group', 'acf' ); ?></h2> <h2><?php esc_html_e( 'Add Your First Field Group', 'acf' ); ?></h2>
<p> <p>
<?php <?php
printf( echo acf_esc_html(
sprintf(
/* translators: %s url to creating a field group page */ /* 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 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_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/creating-a-field-group/', 'docs', 'no-field-groups' )
)
); );
?> ?>
</p> </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"> <p class="acf-small">
<?php <?php
printf( echo acf_esc_html(
sprintf(
/* translators: %s url to getting started guide */ /* 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' ), __( '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' ) acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-field-groups' )
)
); );
?> ?>
</p> </p>

View File

@ -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"> <table class="acf-table -clear">
<tbody> <tbody>

View File

@ -4,7 +4,7 @@
$prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . ']'; $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"> <td class="param">
<?php <?php
@ -48,7 +48,7 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// custom // custom
} else { } else {
echo $choices; echo acf_esc_html( $choices );
} }
?> ?>
@ -75,13 +75,13 @@ $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . '
// custom // custom
} else { } else {
echo $choices; echo acf_esc_html( $choices );
} }
?> ?>
</td> </td>
<td class="add"> <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>
<td class="remove"> <td class="remove">
<a href="#" class="acf-icon -minus remove-location-rule"></a> <a href="#" class="acf-icon -minus remove-location-rule"></a>

View File

@ -6,7 +6,7 @@ global $field_group;
?> ?>
<div class="acf-field"> <div class="acf-field">
<div class="acf-label"> <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> <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>
<div class="acf-input"> <div class="acf-input">
@ -32,9 +32,9 @@ global $field_group;
endforeach; 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>
</div> </div>

View File

@ -283,7 +283,7 @@ do_action( 'acf/render_field_group_settings', $field_group );
?> ?>
<div class="acf-hidden"> <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> </div>
<script type="text/javascript"> <script type="text/javascript">
if( typeof acf !== 'undefined' ) { if( typeof acf !== 'undefined' ) {

View File

@ -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> <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> <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"> <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="<?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. ?>
<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> <?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>
</div> </div>
@ -71,7 +75,7 @@ if ( acf_is_pro() ) {
?> ?>
</div> </div>
<div class="acf-more-tools-from-wpengine"> <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> </div>
</div> </div>

View File

@ -85,8 +85,8 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
break; break;
case 'labels': case 'labels':
echo '<div class="acf-field acf-regenerate-labels-bar">'; 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-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>' . __( 'Clear', '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 '<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>'; echo '</div>';

View File

@ -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-wrapper">
<div class="acf-no-post-types-inner"> <div class="acf-no-post-types-inner">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-post-types.svg' ) ); ?>" /> <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> <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"> <p class="acf-small">
<?php <?php
printf( echo acf_esc_html(
sprintf(
/* translators: %s url to getting started guide */ /* 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' ), __( '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' ) acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-post-types' )
)
); );
?> ?>
</p> </p>

View File

@ -137,8 +137,8 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
break; break;
case 'labels': case 'labels':
echo '<div class="acf-field acf-regenerate-labels-bar">'; 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-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>' . __( 'Clear', '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 '<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>'; echo '</div>';

View File

@ -1,3 +1,11 @@
<?php
/**
* The empty list state for an ACF taxonomy.
*
* @package ACF
*/
?>
<script>document.body.classList.add('acf-no-taxonomies');</script> <script>document.body.classList.add('acf-no-taxonomies');</script>
<div class="acf-no-taxonomies-wrapper"> <div class="acf-no-taxonomies-wrapper">
<div class="acf-no-taxonomies-inner"> <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> <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"> <p class="acf-small">
<?php <?php
printf( echo acf_esc_html(
sprintf(
/* translators: %s url to getting started guide */ /* 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' ), __( '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' ) acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-taxonomies' )
)
); );
?> ?>
</p> </p>

View File

@ -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="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> <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"> <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> </a>
</div> </div>
</div> </div>
@ -72,7 +72,7 @@ $browse_fields_tabs = $browse_fields_tabs + acf_get_field_categories_i18n();
<h2 class="field-type-name"></h2> <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"> <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> <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> </a>
<p class="field-type-desc"></p> <p class="field-type-desc"></p>
<div class="field-type-preview-container"> <div class="field-type-preview-container">

View File

@ -3,52 +3,27 @@
$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF'; $acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
$acf_plugin_name = '<strong>' . $acf_plugin_name . ' &mdash;</strong>'; $acf_plugin_name = '<strong>' . $acf_plugin_name . ' &mdash;</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&nbsp;more', 'acf' ) . '</a>'; $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&nbsp;more', 'acf' ) . '</a>';
$acf_class = ''; $acf_class = 'notice-error';
$acf_user_can_acf = false; $acf_user_can_acf = false;
if ( current_user_can( acf_get_setting( 'capability' ) ) ) { if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
$acf_user_can_acf = true; $acf_user_can_acf = true;
$acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show&nbsp;details', 'acf' ) . '</a>'; $acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show&nbsp;details', 'acf' ) . '</a>';
$acf_class = ' is-dismissible'; $acf_class .= ' is-dismissible';
} else { } else {
$acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' ); $acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' );
} }
if ( ! empty( $acf_will_escape ) ) { $acf_error_msg = sprintf(
$acf_escaped = $acf_will_escape; /* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
$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' ), __( '%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_plugin_name,
$acf_learn_how_to_fix, $acf_learn_how_to_fix,
$acf_show_details $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
);
}
}
?> ?>
<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> <p><?php echo acf_esc_html( $acf_error_msg ); ?></p>
<?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?> <?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?>
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;"> <ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">

View File

@ -144,12 +144,12 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
foreach ( $menu_items as $menu_item ) { foreach ( $menu_items as $menu_item ) {
$class = ! empty( $menu_item['class'] ) ? $menu_item['class'] : $menu_item['text']; $class = ! empty( $menu_item['class'] ) ? $menu_item['class'] : $menu_item['text'];
$target = ! empty( $menu_item['target'] ) ? ' target="' . esc_attr( $menu_item['target'] ) . '"' : ''; $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( $html = sprintf(
'<a class="acf-tab%s %s" href="%s"%s><i class="acf-icon"></i>%s</a>', '<a class="acf-tab%s %s" href="%s"%s><i class="acf-icon"></i>%s</a>',
! empty( $menu_item['is_active'] ) ? ' is-active' : '', ! 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'] ), esc_url( $menu_item['url'] ),
$target, $target,
acf_esc_html( $menu_item['text'] ) acf_esc_html( $menu_item['text'] )
@ -166,20 +166,20 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
$section_html .= $html; $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">
<div class="acf-admin-toolbar-inner"> <div class="acf-admin-toolbar-inner">
<div class="acf-nav-wrap"> <div class="acf-nav-wrap">
<a href="<?php echo admin_url( 'edit.php?post_type=acf-field-group' ); ?>" class="acf-logo"> <a href="<?php echo esc_url( 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' ); ?>"> <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() ) { ?> <?php if ( acf_is_pro() && acf_pro_is_license_active() ) { ?>
<div class="acf-pro-label">PRO</div> <div class="acf-pro-label">PRO</div>
<?php } ?> <?php } ?>
</a> </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 acf_print_menu_section( $core_tabs, 'core' ); ?>
<?php if ( $acf_more_items || $more_items ) { ?> <?php if ( $acf_more_items || $more_items ) { ?>
<div class="acf-more acf-header-tab-acf-more" tabindex="0"> <div class="acf-more acf-header-tab-acf-more" tabindex="0">
@ -231,7 +231,7 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
<?php <?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' ); ?>" /> <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> </a>
</div> </div>

View File

@ -22,12 +22,12 @@ $acf_getting_started = sprintf(
<td class="colspanchange" colspan="6"> <td class="colspanchange" colspan="6">
<div class="acf-no-field-groups-wrapper"> <div class="acf-no-field-groups-wrapper">
<div class="acf-no-field-groups-inner acf-field-group-pro-features-content"> <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> <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> <p><?php echo acf_esc_html( $acf_options_pages_desc ); ?></p>
<div class="acf-field-group-pro-features-actions"> <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_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> <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> </div>
<p class="acf-small"><?php echo acf_esc_html( $acf_getting_started ); ?></p> <p class="acf-small"><?php echo acf_esc_html( $acf_getting_started ); ?></p>
</div> </div>

View File

@ -1,16 +1,8 @@
<?php <?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 * @package ACF
* @since 5.6.3
*
* @param string $screen_id The screen ID used to display metaboxes
* @param string $active The active Tool
* @return n/a
*/ */
$class = $active ? 'single' : 'grid'; $class = $active ? 'single' : 'grid';
@ -18,12 +10,12 @@ $tool = $active ? ' tool-' . $active : '';
?> ?>
<div id="acf-admin-tools" class="wrap<?php echo esc_attr( $tool ); ?>"> <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 ) : 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', '' ); ?> <?php do_meta_boxes( $screen_id, 'normal', '' ); ?>
</div> </div>

View File

@ -1,13 +1,10 @@
<?php <?php
/** /**
* Network Admin Database Upgrade * Network Admin Database Upgrade
* *
* Shows the databse upgrade process. * Shows the databse upgrade process.
* *
* @date 24/8/18 * @package ACF
* @since 5.7.4
* @param void
*/ */
?> ?>
@ -21,10 +18,11 @@
</style> </style>
<div id="acf-upgrade-wrap" class="wrap"> <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> <?php // translators: %s The button label name, translated seperately ?>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p> <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"> <table class="wp-list-table widefat">
<thead> <thead>
@ -33,9 +31,9 @@
<input type="checkbox" id="sites-select-all"> <input type="checkbox" id="sites-select-all">
</td> </td>
<th class="manage-column" scope="col" style="width:33%;"> <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>
<th><?php _e( 'Description', 'acf' ); ?></th> <th><?php esc_html_e( 'Description', 'acf' ); ?></th>
</tr> </tr>
</thead> </thead>
<tfoot> <tfoot>
@ -44,9 +42,9 @@
<input type="checkbox" id="sites-select-all-2"> <input type="checkbox" id="sites-select-all-2">
</td> </td>
<th class="manage-column" scope="col"> <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>
<th><?php _e( 'Description', 'acf' ); ?></th> <th><?php esc_html_e( 'Description', 'acf' ); ?></th>
</tr> </tr>
</tfoot> </tfoot>
<tbody id="the-list"> <tbody id="the-list">
@ -67,17 +65,18 @@
class="alternate"<?php endif; ?>> class="alternate"<?php endif; ?>>
<th class="check-column" scope="row"> <th class="check-column" scope="row">
<?php if ( acf_has_upgrade() ) : ?> <?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; ?> <?php endif; ?>
</th> </th>
<td> <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>
<td> <td>
<?php if ( acf_has_upgrade() ) : ?> <?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 else : ?>
<?php _e( 'Site is up to date', 'acf' ); ?> <?php esc_html_e( 'Site is up to date', 'acf' ); ?>
<?php endif; ?> <?php endif; ?>
</td> </td>
</tr> </tr>
@ -92,8 +91,9 @@
</tbody> </tbody>
</table> </table>
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p> <p><input type="submit" name="upgrade" value="<?php esc_attr_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> <?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"> <script type="text/javascript">
(function($) { (function($) {
@ -113,11 +113,11 @@
// bail early if no selection // bail early if no selection
if( !this.$inputs().length ) { 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 // 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; return;
} }
@ -144,7 +144,8 @@
var success = false; var success = false;
// show loading // 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 // send ajax request to upgrade DB
$.ajax({ $.ajax({
@ -158,10 +159,10 @@
success: function( json ){ success: function( json ){
success = true; success = true;
$input.remove(); $input.remove();
text = '<?php _e( 'Upgrade complete.', 'acf' ); ?>'; text = '<?php esc_attr_e( 'Upgrade complete.', 'acf' ); ?>';
}, },
error: function( jqXHR, textStatus, errorThrown ){ error: function( jqXHR, textStatus, errorThrown ){
text = '<?php _e( 'Upgrade failed.', 'acf' ); ?>'; text = '<?php esc_attr_e( 'Upgrade failed.', 'acf' ); ?>';
if( error = acf.getXhrError(jqXHR) ) { if( error = acf.getXhrError(jqXHR) ) {
text += ' <code>' + error + '</code>'; text += ' <code>' + error + '</code>';
} }

View File

@ -22,15 +22,18 @@ if ( ! acf_get_setting( 'pro' ) ) {
<div id="acf-upgrade-notice" class="notice"> <div id="acf-upgrade-notice" class="notice">
<div class="notice-container"> <div class="notice-container">
<div class="col-content"> <div class="col-content">
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.png' ); ?>" /> <img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.png' ) ); ?>" />
<h2><?php _e( 'Database Upgrade Required', 'acf' ); ?></h2> <h2><?php esc_html_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> <?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 ) ) : ?> <?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; ?> <?php endif; ?>
</div> </div>
<div class="col-actions"> <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>
</div> </div>
@ -40,7 +43,7 @@ if ( ! acf_get_setting( 'pro' ) ) {
(function($) { (function($) {
$("#acf-upgrade-button").on("click", 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); })(jQuery);

View File

@ -1,13 +1,10 @@
<?php <?php
/** /**
* Admin Database Upgrade * Admin Database Upgrade
* *
* Shows the databse upgrade process. * Shows the databse upgrade process.
* *
* @date 24/8/18 * @package ACF
* @since 5.7.4
* @param void
*/ */
?> ?>
@ -23,14 +20,16 @@
</style> </style>
<div id="acf-upgrade-wrap" class="wrap"> <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() ) : ?> <?php if ( acf_has_upgrade() ) : ?>
<p><?php _e( 'Reading upgrade tasks...', 'acf' ); ?></p> <p><?php esc_html_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> <?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-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"> <script type="text/javascript">
(function($) { (function($) {
@ -62,7 +61,7 @@
success = true; success = true;
}, },
error: function( jqXHR, textStatus, errorThrown ){ error: function( jqXHR, textStatus, errorThrown ){
response = '<?php _e( 'Upgrade failed.', 'acf' ); ?>'; response = '<?php esc_attr_e( 'Upgrade failed.', 'acf' ); ?>';
if( error = acf.getXhrError(jqXHR) ) { if( error = acf.getXhrError(jqXHR) ) {
response += ' <code>' + error + '</code>'; response += ' <code>' + error + '</code>';
} }
@ -91,7 +90,7 @@
<?php else : ?> <?php else : ?>
<p><?php _e( 'No updates available.', 'acf' ); ?></p> <p><?php esc_html_e( 'No updates available.', 'acf' ); ?></p>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -11,7 +11,7 @@ if ( ! class_exists( 'ACF_Ajax_Check_Screen' ) ) :
/** @var string The AJAX action name. */ /** @var string The AJAX action name. */
var $action = 'acf/ajax/check_screen'; 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; var $public = false;
/** /**

View File

@ -18,7 +18,7 @@ if ( ! class_exists( 'ACF_Ajax_Local_JSON_Diff' ) ) :
/** /**
* Prevents access for non-logged in users. * Prevents access for non-logged in users.
* *
* @var bool * @var boolean
*/ */
public $public = false; public $public = false;

View File

@ -160,7 +160,6 @@ if ( ! class_exists( 'ACF_Ajax_Query_Users' ) ) :
// acf_log( $args ); // acf_log( $args );
// acf_log( '- ', count($users) ); // acf_log( '- ', count($users) );
// acf_log( '- ', $total_users ); // acf_log( '- ', $total_users );
// If users were found for this query... // If users were found for this query...
if ( $users ) { if ( $users ) {

View File

@ -8,22 +8,22 @@ if ( ! class_exists( 'ACF_Ajax_Query' ) ) :
class ACF_Ajax_Query extends ACF_Ajax { 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 $public = true;
/** @var int The page of results to return. */ /** @var integer The page of results to return. */
var $page = 1; var $page = 1;
/** @var int The number of results per page. */ /** @var integer The number of results per page. */
var $per_page = 20; 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 $more = false;
/** @var string The searched term. */ /** @var string The searched term. */
var $search = ''; 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 $is_search = false;
/** @var (int|string) The post_id being edited. */ /** @var (int|string) The post_id being edited. */

View File

@ -11,7 +11,7 @@ if ( ! class_exists( 'ACF_Ajax_User_Setting' ) ) :
/** @var string The AJAX action name. */ /** @var string The AJAX action name. */
var $action = 'acf/ajax/user_setting'; 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; var $public = true;
/** /**

View File

@ -14,7 +14,7 @@ if ( ! class_exists( 'ACF_Ajax' ) ) :
/** @var array The $_REQUEST data. */ /** @var array The $_REQUEST data. */
var $request; var $request;
/** @var bool Prevents access for non-logged in users. */ /** @var boolean Prevents access for non-logged in users. */
var $public = false; var $public = false;
/** /**

View File

@ -396,7 +396,7 @@ function acf_merge_atts( $atts, $extra = array() ) {
* @param string $nonce The nonce parameter string. * @param string $nonce The nonce parameter string.
*/ */
function acf_nonce_input( $nonce = '' ) { 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 // get ancestors
$ancestors = get_ancestors( $post->ID, $post->post_type ); $ancestors = get_ancestors( $post->ID, $post->post_type );
$prepend .= str_repeat( '- ', count( $ancestors ) ); $prepend .= str_repeat( '- ', count( $ancestors ) );
} }
// merge // 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 false
* @return $post_id (int)
*/ */
function acf_debug() { function acf_debug() {
_deprecated_function( __FUNCTION__, '6.2.7' );
// vars return false;
$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;
} }
/**
* 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() { function acf_debug_start() {
_deprecated_function( __FUNCTION__, '6.2.7' );
acf_update_setting( 'debug_start', memory_get_usage() ); 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() { function acf_debug_end() {
_deprecated_function( __FUNCTION__, '6.2.7' );
$start = acf_get_setting( 'debug_start' ); return false;
$end = memory_get_usage();
return $end - $start;
} }
/** /**
@ -2329,6 +2308,10 @@ function acf_isset_termmeta( $taxonomy = '' ) {
*/ */
function acf_upload_files( $ancestors = array() ) { 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. $file = acf_sanitize_files_array( $_FILES['acf'] ); // phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified upstream.
// walk through ancestors. // 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 * @since 5.7.10
* * @deprecated 6.2.7
* @param type $var Description. Default.
* @return type Description.
*/ */
function acf_clear_log() { function acf_clear_log() {
unlink( WP_CONTENT_DIR . '/debug.log' ); _deprecated_function( __FUNCTION__, '6.2.7' );
return false;
} }
/** /**

View File

@ -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 * @since 1.0.3
* *
* @param string $selector The field name or key. * @param string $selector The field name or key.
* @param mixed $post_id The post_id of which the value is saved against. * @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 * @return void
*/ */
function the_field( $selector, $post_id = false, $format_value = true ) { function the_field( $selector, $post_id = false, $format_value = true ) {
$field = get_field_object( $selector, $post_id, $format_value, true, false ); $field = get_field_object( $selector, $post_id, $format_value, true, $format_value );
$value = $field ? $field['value'] : get_field( $selector, $post_id, $format_value, false ); $value = $field ? $field['value'] : get_field( $selector, $post_id, $format_value, $format_value );
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
$value = implode( ', ', $value ); $value = implode( ', ', $value );
@ -104,29 +104,22 @@ function the_field( $selector, $post_id = false, $format_value = true ) {
return; return;
} }
$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 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 ) { if ( ! $format_value ) {
$new_value = acf_esc_html( $new_value ); $value = acf_esc_html( $value );
} }
if ( (string) $value !== (string) $new_value ) { // Get the unescaped value while we're still logging removed_unsafe_html.
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) { $unescaped_value = get_field( $selector, $post_id, $format_value, false );
$value = $new_value; 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 ) ) {
$value = $unescaped_value;
} elseif ( (string) $value !== (string) $unescaped_value ) {
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $selector, $field, $post_id ); 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 );
} }
echo $value; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped by logic above. 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 ); 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. * 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. * 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 * @since 6.2.5
* *
* @return boolean True on success, or false on failure. * @return boolean True on success, or false on failure.
*/ */
function _acf_delete_escaped_html_log() { function _acf_delete_escaped_html_log() {
delete_option( 'acf_will_escape_html_log' );
return delete_option( 'acf_escaped_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. * 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() { function the_row_index() {
echo intval( get_row_index() );
echo 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 * @since 1.0.3
* *
* @param string $field_name The field name. * @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 ) { 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; $value = ( is_array( $field ) && isset( $field['value'] ) ) ? $field['value'] : false;
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
@ -957,30 +873,22 @@ function the_sub_field( $field_name, $format_value = true ) {
return; return;
} }
$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 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 ) { if ( ! $format_value ) {
$new_value = acf_esc_html( $new_value ); $value = acf_esc_html( $value );
} }
if ( (string) $value !== (string) $new_value ) { $unescaped_field = get_sub_field_object( $field_name, $format_value, true, false );
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) { $unescaped_value = ( is_array( $unescaped_field ) && isset( $unescaped_field['value'] ) ) ? $unescaped_field['value'] : false;
$value = $new_value; 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 ) ) {
$value = $unescaped_value;
} elseif ( (string) $value !== (string) $unescaped_value ) {
do_action( 'acf/removed_unsafe_html', __FUNCTION__, $field_name, $field, false ); 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 );
} }
echo $value; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped inside get_sub_field_object where necessary. 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. * @param array $atts The shortcode attributes.
* *
* @return string * @return string|void
*/ */
function acf_shortcode( $atts ) { function acf_shortcode( $atts ) {
// Return if the ACF shortcode is disabled. // 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' ); add_filter( 'acf/prevent_access_to_unknown_fields', '__return_true' );
} }
// Get the escaped field value. // Decode the post ID for filtering.
$field = get_field_object( $atts['field'], $atts['post_id'], $atts['format_value'], true, true ); $post_id = acf_get_valid_post_id( $atts['post_id'] );
$value = $field ? $field['value'] : get_field( $atts['field'], $atts['post_id'], $atts['format_value'], true ); $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 ) ) { if ( is_array( $value ) ) {
$value = implode( ', ', $value ); $value = implode( ', ', $value );
} }
$field_type = is_array( $field ) && isset( $field['type'] ) ? $field['type'] : 'text';
// Temporarily always get the unescaped version for action comparison. // 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. // Remove the filter preventing access to unknown filters now we've got all the values.
if ( $filter_applied ) { if ( $filter_applied ) {
@ -1152,7 +1072,7 @@ function acf_shortcode( $atts ) {
if ( apply_filters( 'acf/shortcode/allow_unsafe_html', false, $atts, $field_type, $field ) ) { if ( apply_filters( 'acf/shortcode/allow_unsafe_html', false, $atts, $field_type, $field ) ) {
$value = $unescaped_value; $value = $unescaped_value;
} elseif ( (string) $value !== (string) $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; return $value;

View File

@ -1,17 +1,14 @@
<?php <?php
/* /**
* acf_get_taxonomies * Returns an array of taxonomy names.
* *
* Returns an array of taxonomy names. * @date 7/10/13
* * @since 5.0.0
* @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.
* @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() ) { function acf_get_taxonomies( $args = array() ) {
// vars // vars
@ -76,18 +73,15 @@ function acf_get_taxonomies_for_post_type( $post_types = 'post' ) {
return $taxonomies; return $taxonomies;
} }
/* /**
* acf_get_taxonomy_labels * Returns an array of taxonomies in the format "name => label" for use in a select field.
* *
* Returns an array of taxonomies in the format "name => label" for use in a select field. * @date 3/8/18
* * @since 5.7.2
* @date 3/8/18 *
* @since 5.7.2 * @param array $taxonomies Optional. An array of specific taxonomies to return.
* * @return array
* @param array $taxonomies Optional. An array of specific taxonomies to return. */
* @return array
*/
function acf_get_taxonomy_labels( $taxonomies = array() ) { function acf_get_taxonomy_labels( $taxonomies = array() ) {
// default // default
@ -138,7 +132,6 @@ function acf_get_taxonomy_labels( $taxonomies = array() ) {
* @param object $term The WP_Term object. * @param object $term The WP_Term object.
* @return string * @return string
*/ */
function acf_get_term_title( $term ) { function acf_get_term_title( $term ) {
$title = $term->name; $title = $term->name;
@ -167,7 +160,6 @@ function acf_get_term_title( $term ) {
* @param array $args An array of args used in the get_terms() function. * @param array $args An array of args used in the get_terms() function.
* @return array * @return array
*/ */
function acf_get_grouped_terms( $args ) { function acf_get_grouped_terms( $args ) {
// vars // vars
@ -286,7 +278,6 @@ function acf_get_grouped_terms( $args ) {
* @param array $args An array of terms query arguments. * @param array $args An array of terms query arguments.
* @return array $pieces * @return array $pieces
*/ */
function _acf_terms_clauses( $pieces, $taxonomies, $args ) { function _acf_terms_clauses( $pieces, $taxonomies, $args ) {
// prepend taxonomy to 'orderby' SQL // prepend taxonomy to 'orderby' SQL
@ -308,7 +299,6 @@ function _acf_terms_clauses( $pieces, $taxonomies, $args ) {
* @since 5.0.0 * @since 5.0.0
* @deprecated 5.7.2 * @deprecated 5.7.2
*/ */
function acf_get_pretty_taxonomies( $taxonomies = array() ) { function acf_get_pretty_taxonomies( $taxonomies = array() ) {
return acf_get_taxonomy_labels( $taxonomies ); return acf_get_taxonomy_labels( $taxonomies );
} }
@ -325,7 +315,6 @@ function acf_get_pretty_taxonomies( $taxonomies = array() ) {
* @param string $taxonomy The taxonomyname. * @param string $taxonomy The taxonomyname.
* @return WP_Term * @return WP_Term
*/ */
function acf_get_term( $term_id, $taxonomy = '' ) { function acf_get_term( $term_id, $taxonomy = '' ) {
// allow $term_id parameter to be a string of "taxonomy:slug" or "taxonomy:id" // allow $term_id parameter to be a string of "taxonomy:slug" or "taxonomy:id"

View File

@ -28,7 +28,7 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
* List of enqueue flags. * List of enqueue flags.
* *
* @since 5.9.0 * @since 5.9.0
* @var bool * @var boolean
*/ */
private $enqueue = array(); private $enqueue = array();
@ -192,8 +192,8 @@ if ( ! class_exists( 'ACF_Assets' ) ) :
* *
* @param string $action The action name. * @param string $action The action name.
* @param string $method The method name. * @param string $method The method name.
* @param int $priority See add_action(). * @param integer $priority See add_action().
* @param int $accepted_args See add_action(). * @param integer $accepted_args See add_action().
* @return void * @return void
*/ */
public function add_action( $action, $method, $priority = 10, $accepted_args = 1 ) { public function add_action( $action, $method, $priority = 10, $accepted_args = 1 ) {

View File

@ -17,7 +17,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
/** @var array Storage for data aliases. */ /** @var array Storage for data aliases. */
var $aliases = array(); var $aliases = array();
/** @var bool Enables unique data per site. */ /** @var boolean Enables unique data per site. */
var $multisite = false; var $multisite = false;
/** /**
@ -258,7 +258,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
* @since 5.7.10 * @since 5.7.10
* *
* @param void * @param void
* @return int * @return integer
*/ */
function count() { function count() {
return count( $this->data ); return count( $this->data );
@ -273,7 +273,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
* @since 5.7.10 * @since 5.7.10
* *
* @param void * @param void
* @return int * @return integer
*/ */
function query( $args, $operator = 'AND' ) { function query( $args, $operator = 'AND' ) {
return wp_list_filter( $this->data, $args, $operator ); return wp_list_filter( $this->data, $args, $operator );
@ -313,7 +313,7 @@ if ( ! class_exists( 'ACF_Data' ) ) :
* @date 13/2/19 * @date 13/2/19
* @since 5.7.11 * @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. * @param int prev_blog_id Prev blog ID.
* @return void * @return void
*/ */

View File

@ -81,8 +81,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|WP_Post $id The post ID being queried. * @param integer|WP_Post $id The post ID being queried.
* @return array|bool The main ACF array for the post, or false on failure. * @return array|boolean The main ACF array for the post, or false on failure.
*/ */
public function get_post( $id = 0 ) { public function get_post( $id = 0 ) {
// Allow WP_Post to be passed. // Allow WP_Post to be passed.
@ -131,7 +131,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @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. * @return array|false The field group array, or false on failure.
*/ */
public function get_raw_post( $id = 0 ) { public function get_raw_post( $id = 0 ) {
@ -164,7 +164,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @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. * @return WP_Post|bool The post object, or false on failure.
*/ */
public function get_post_object( $id = 0 ) { public function get_post_object( $id = 0 ) {
@ -224,7 +224,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* @since 6.1 * @since 6.1
* *
* @param string $id The identifier. * @param string $id The identifier.
* @return bool * @return boolean
*/ */
public function is_post_key( $id = '' ) { public function is_post_key( $id = '' ) {
// Check if $id is a string starting with $this->post_key. // 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(). * Errors are added to the form using acf_add_internal_post_type_validation_error().
* *
* @since 6.1 * @since 6.1
*
* @return bool
*/ */
public function ajax_validate_values() {} public function ajax_validate_values() {}
@ -534,10 +532,10 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* @since 6.1 * @since 6.1
* *
* @param string $slug The post slug. * @param string $slug The post slug.
* @param int $post_ID Post ID. * @param integer $post_ID Post ID.
* @param string $post_status The post status. * @param string $post_status The post status.
* @param string $post_type Post type. * @param string $post_type Post type.
* @param int $post_parent Post parent ID. * @param integer $post_parent Post parent ID.
* @param string $original_slug The original post slug. * @param string $original_slug The original post slug.
* @return string * @return string
*/ */
@ -574,8 +572,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ID of the ACF post to delete. * @param integer|string $id The ID of the ACF post to delete.
* @return bool * @return boolean
*/ */
public function delete_post( $id = 0 ) { public function delete_post( $id = 0 ) {
// Disable filters to ensure ACF loads data from DB. // Disable filters to ensure ACF loads data from DB.
@ -611,8 +609,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ID of the ACF post to trash. * @param integer|string $id The ID of the ACF post to trash.
* @return bool * @return boolean
*/ */
public function trash_post( $id = 0 ) { public function trash_post( $id = 0 ) {
// Disable filters to ensure ACF loads data from DB. // Disable filters to ensure ACF loads data from DB.
@ -644,8 +642,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ID of the ACF post to untrash. * @param integer|string $id The ID of the ACF post to untrash.
* @return bool * @return boolean
*/ */
public function untrash_post( $id = 0 ) { public function untrash_post( $id = 0 ) {
// Disable filters to ensure ACF loads data from DB. // Disable filters to ensure ACF loads data from DB.
@ -679,7 +677,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* @since 6.1 * @since 6.1
* *
* @param string $new_status The new status of the post being restored. * @param string $new_status The new status of the post being restored.
* @param int $post_id The ID 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. * @param string $previous_status The status of the post at the point where it was trashed.
* @return string * @return string
*/ */
@ -693,7 +691,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* @since 6.1 * @since 6.1
* *
* @param array $post The post array to check. * @param array $post The post array to check.
* @return bool * @return boolean
*/ */
public function is_post( $post = false ) { public function is_post( $post = false ) {
return ( return (
@ -708,8 +706,8 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ID of the post to duplicate. * @param integer|string $id The ID of the post to duplicate.
* @param int $new_post_id Optional post ID to override. * @param integer $new_post_id Optional post ID to override.
* @return array The new ACF post array. * @return array The new ACF post array.
*/ */
public function duplicate_post( $id = 0, $new_post_id = 0 ) { public function duplicate_post( $id = 0, $new_post_id = 0 ) {
@ -756,9 +754,9 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int|string $id The ID of the ACF post to activate/deactivate. * @param integer|string $id The ID of the ACF post to activate/deactivate.
* @param bool $activate True if the post should be activated. * @param boolean $activate True if the post should be activated.
* @return bool * @return boolean
*/ */
public function update_post_active_status( $id, $activate = true ) { public function update_post_active_status( $id, $activate = true ) {
// Disable filters to ensure ACF loads data from DB. // Disable filters to ensure ACF loads data from DB.
@ -793,7 +791,7 @@ if ( ! class_exists( 'ACF_Internal_Post_Type' ) ) {
* *
* @since 6.1 * @since 6.1
* *
* @param int $post_id The ACF post ID. * @param integer $post_id The ACF post ID.
* @return string * @return string
*/ */
public function get_post_edit_link( $post_id ) { public function get_post_edit_link( $post_id ) {

View File

@ -357,9 +357,7 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
return $field; return $field;
} }
/* /**
* validate_field_group
*
* This function will provide compatibility with ACF4 field groups * This function will provide compatibility with ACF4 field groups
* *
* @type function * @type function
@ -470,16 +468,14 @@ if ( ! class_exists( 'ACF_Compatibility' ) ) :
acf_new_instance( 'ACF_Compatibility' ); acf_new_instance( 'ACF_Compatibility' );
endif; // class_exists check endif; // class_exists check
/* /**
* acf_get_compatibility
*
* Returns true if compatibility is enabled for the given component. * Returns true if compatibility is enabled for the given component.
* *
* @date 20/1/15 * @date 20/1/15
* @since 5.1.5 * @since 5.1.5
* *
* @param string $name The name of the component to check. * @param string $name The name of the component to check.
* @return bool * @return boolean
*/ */
function acf_get_compatibility( $name ) { function acf_get_compatibility( $name ) {
return apply_filters( "acf/compatibility/{$name}", false ); return apply_filters( "acf/compatibility/{$name}", false );

View File

@ -58,16 +58,14 @@ function acf_render_field_wrap_description( $field ) {
acf_render_field_instructions( $field ); acf_render_field_instructions( $field );
} }
/* /**
* acf_get_fields_by_id
*
* Returns and array of fields for the given $parent_id. * Returns and array of fields for the given $parent_id.
* *
* @date 27/02/2014 * @date 27/02/2014
* @since 5.0.0. * @since 5.0.0.
* @deprecated 5.7.11 * @deprecated 5.7.11
* *
* @param int $parent_id The parent ID. * @param integer $parent_id The parent ID.
* @return array * @return array
*/ */
function acf_get_fields_by_id( $parent_id = 0 ) { function acf_get_fields_by_id( $parent_id = 0 ) {
@ -96,7 +94,7 @@ function acf_get_fields_by_id( $parent_id = 0 ) {
* @param string $option The option name. * @param string $option The option name.
* @param string $value The option value. * @param string $value The option value.
* @param string $autoload An optional autoload value. * @param string $autoload An optional autoload value.
* @return bool * @return boolean
*/ */
function acf_update_option( $option = '', $value = '', $autoload = null ) { function acf_update_option( $option = '', $value = '', $autoload = null ) {

View File

@ -12,9 +12,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
var $types = array(); var $types = array();
/* /**
* __construct
*
* This function will setup the class functionality * This function will setup the class functionality
* *
* @type function * @type function
@ -30,9 +28,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
} }
/* /**
* register_field_type
*
* This function will register a field type instance * This function will register a field type instance
* *
* @type function * @type function
@ -57,9 +53,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
} }
/* /**
* get_field_type
*
* This function will return a field type instance * This function will return a field type instance
* *
* @type function * @type function
@ -75,9 +69,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
} }
/* /**
* is_field_type
*
* This function will return true if a field type exists * This function will return true if a field type exists
* *
* @type function * @type function
@ -93,9 +85,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
} }
/* /**
* register_field_type_info
*
* This function will store a basic array of info about the field type * This function will store a basic array of info about the field type
* to later be overriden by the above register_field_type function * to later be overriden by the above register_field_type function
* *
@ -106,7 +96,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
* @param $info (array) * @param $info (array)
* @return n/a * @return n/a
*/ */
function register_field_type_info( $info ) { function register_field_type_info( $info ) {
// convert to object // convert to object
@ -115,9 +104,7 @@ if ( ! class_exists( 'acf_fields' ) ) :
} }
/* /**
* get_field_types
*
* This function will return an array of all field types * This function will return an array of all field types
* *
* @type function * @type function
@ -127,7 +114,6 @@ if ( ! class_exists( 'acf_fields' ) ) :
* @param $name (string) * @param $name (string)
* @return (mixed) * @return (mixed)
*/ */
function get_field_types() { function get_field_types() {
return $this->types; return $this->types;
} }
@ -139,73 +125,61 @@ if ( ! class_exists( 'acf_fields' ) ) :
endif; // class_exists check endif; // class_exists check
/* /**
* acf_register_field_type * alias of acf()->fields->register_field_type()
* *
* alias of acf()->fields->register_field_type() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_register_field_type( $class ) { function acf_register_field_type( $class ) {
return acf()->fields->register_field_type( $class ); return acf()->fields->register_field_type( $class );
} }
/* /**
* acf_register_field_type_info * alias of acf()->fields->register_field_type_info()
* *
* alias of acf()->fields->register_field_type_info() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_register_field_type_info( $info ) { function acf_register_field_type_info( $info ) {
return acf()->fields->register_field_type_info( $info ); return acf()->fields->register_field_type_info( $info );
} }
/* /**
* acf_get_field_type * alias of acf()->fields->get_field_type()
* *
* alias of acf()->fields->get_field_type() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_get_field_type( $name ) { function acf_get_field_type( $name ) {
return acf()->fields->get_field_type( $name ); return acf()->fields->get_field_type( $name );
} }
/* /**
* acf_get_field_types * alias of acf()->fields->get_field_types()
* *
* alias of acf()->fields->get_field_types() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_get_field_types( $args = array() ) { function acf_get_field_types( $args = array() ) {
// default // default
@ -235,7 +209,6 @@ function acf_get_field_types( $args = array() ) {
* @param type $var Description. Default. * @param type $var Description. Default.
* @return type Description. * @return type Description.
*/ */
function acf_get_field_types_info( $args = array() ) { function acf_get_field_types_info( $args = array() ) {
// vars // vars
@ -264,56 +237,47 @@ function acf_get_field_types_info( $args = array() ) {
} }
/* /**
* acf_is_field_type * alias of acf()->fields->is_field_type()
* *
* alias of acf()->fields->is_field_type() * @type function
* * @date 31/5/17
* @type function * @since 5.6.0
* @date 31/5/17 *
* @since 5.6.0 * @param n/a
* * @return n/a
* @param n/a */
* @return n/a
*/
function acf_is_field_type( $name = '' ) { function acf_is_field_type( $name = '' ) {
return acf()->fields->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
* *
* This function will return a field type's property * @type function
* * @date 1/10/13
* @type function * @since 5.0.0
* @date 1/10/13 *
* @since 5.0.0 * @param n/a
* * @return (array)
* @param n/a */
* @return (array)
*/
function acf_get_field_type_prop( $name = '', $prop = '' ) { function acf_get_field_type_prop( $name = '', $prop = '' ) {
$type = acf_get_field_type( $name ); $type = acf_get_field_type( $name );
return ( $type && isset( $type->$prop ) ) ? $type->$prop : null; return ( $type && isset( $type->$prop ) ) ? $type->$prop : null;
} }
/* /**
* acf_get_field_type_label * This function will return the label of a field type
* *
* This function will return the label of a field type * @type function
* * @date 1/10/13
* @type function * @since 5.0.0
* @date 1/10/13 *
* @since 5.0.0 * @param n/a
* * @return (array)
* @param n/a */
* @return (array)
*/
function acf_get_field_type_label( $name = '' ) { function acf_get_field_type_label( $name = '' ) {
$label = acf_get_field_type_prop( $name, 'label' ); $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>'; 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
* deprecated in favour of acf_is_field_type() * @see acf_is_field_type()
* *
* @type function * @type function
* @date 1/10/13 * @date 1/10/13
* @since 5.0.0 * @since 5.0.0
* *
* @param $type (string) * @param $type (string)
* @return (boolean) * @return (boolean)
*/ */
function acf_field_type_exists( $type = '' ) { function acf_field_type_exists( $type = '' ) {
return acf_is_field_type( $type ); return acf_is_field_type( $type );
} }

View File

@ -65,9 +65,7 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -113,9 +111,7 @@ if ( ! class_exists( 'acf_field__accordion' ) ) :
} }
/* /**
* load_field()
*
* This filter is appied to the $field after it is loaded from the database * This filter is appied to the $field after it is loaded from the database
* *
* @type filter * @type filter

View File

@ -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
* *
* @date 18/9/17
* @since 5.6.3 * @since 5.6.3
* *
* @param array $field The field settings array * @param array $field The field settings array
* @return n/a
*/ */
public function render_field( $field ) {
function render_field( $field ) {
// vars // vars
$html = ''; $html = '';
@ -98,7 +93,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
$html .= acf_get_hidden_input( array( 'name' => $field['name'] ) ); $html .= acf_get_hidden_input( array( 'name' => $field['name'] ) );
// open // open
$html .= '<div ' . acf_esc_attr( $div ) . '>'; $html .= '<div ' . acf_esc_attrs( $div ) . '>';
// loop // loop
foreach ( $buttons as $button ) { foreach ( $buttons as $button ) {
@ -118,7 +113,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
$html .= '</div>'; $html .= '</div>';
// return // return
echo $html; echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- safe HTML, escaped by input building functions.
} }
@ -220,9 +215,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
); );
} }
/* /**
* update_field()
*
* This filter is appied to the $field before it is saved to the database * This filter is appied to the $field before it is saved to the database
* *
* @date 18/9/17 * @date 18/9/17
@ -238,9 +231,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
} }
/* /**
* load_value()
*
* This filter is appied to the $value after it is loaded from the db * This filter is appied to the $value after it is loaded from the db
* *
* @date 18/9/17 * @date 18/9/17
@ -258,9 +249,7 @@ if ( ! class_exists( 'acf_field_button_group' ) ) :
} }
/* /**
* translate_field
*
* This function will translate field settings * This function will translate field settings
* *
* @date 18/9/17 * @date 18/9/17
@ -276,9 +265,7 @@ 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 * 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 * @date 18/9/17

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
class acf_field_checkbox extends acf_field { class acf_field_checkbox extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -40,9 +38,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field (array) the $field being rendered * @param $field (array) the $field being rendered
@ -99,13 +95,11 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
} }
// return // 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 * description
* *
* @type function * @type function
@ -125,17 +119,15 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
/** /**
* Validates values for the checkbox field * Validates values for the checkbox field
* *
* @date 09/12/2022
* @since 6.0.0 * @since 6.0.0
* *
* @param bool $valid If the field is valid. * @param boolean $valid If the field is valid.
* @param mixed $value The value to validate. * @param mixed $value The value to validate.
* @param array $field The main field array. * @param array $field The main field array.
* @param string $input The input element's name attribute. * @param string $input The input element's name attribute.
* * @return boolean
* @return bool
*/ */
function validate_value( $valid, $value, $field, $input ) { public function validate_value( $valid, $value, $field, $input ) {
if ( ! is_array( $value ) || empty( $field['allow_custom'] ) ) { if ( ! is_array( $value ) || empty( $field['allow_custom'] ) ) {
return $valid; return $valid;
} }
@ -149,9 +141,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
return $valid; return $valid;
} }
/* /**
* render_field_toggle
*
* description * description
* *
* @type function * @type function
@ -186,9 +176,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
} }
/* /**
* render_field_custom
*
* description * description
* *
* @type function * @type function
@ -318,9 +306,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -445,9 +431,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
); );
} }
/* /**
* update_field()
*
* This filter is appied to the $field before it is saved to the database * This filter is appied to the $field before it is saved to the database
* *
* @type filter * @type filter
@ -469,9 +453,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -479,7 +461,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -538,9 +520,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
} }
/* /**
* translate_field
*
* This function will translate field settings * This function will translate field settings
* *
* @type function * @type function
@ -557,9 +537,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -567,7 +545,7 @@ if ( ! class_exists( 'acf_field_checkbox' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
class acf_field_color_picker extends acf_field { class acf_field_color_picker extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -35,9 +33,7 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -102,9 +98,7 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -134,9 +128,7 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -195,12 +187,10 @@ if ( ! class_exists( 'acf_field_color_picker' ) ) :
* database and is being returned by an API function such as get_field(), the_field(), etc. * database and is being returned by an API function such as get_field(), the_field(), etc.
* *
* @since 5.10 * @since 5.10
* @date 15/12/20
*
* @param mixed $value
* @param int $post_id
* @param array $field
* *
* @param mixed $value The field value
* @param integer $post_id The post ID
* @param array $field The field array
* @return string|array * @return string|array
*/ */
public function format_value( $value, $post_id, $field ) { public function format_value( $value, $post_id, $field ) {

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
class acf_field_date_picker extends acf_field { class acf_field_date_picker extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -35,9 +33,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -82,9 +78,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -153,9 +147,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -238,9 +230,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -248,7 +238,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -275,10 +265,9 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* @date 28/09/21 * @date 28/09/21
* *
* @param array $field The field array holding all the field options. * @param array $field The field array holding all the field options.
*
* @return array * @return array
*/ */
function load_field( $field ) { public function load_field( $field ) {
if ( empty( $field['display_format'] ) ) { if ( empty( $field['display_format'] ) ) {
$field['display_format'] = $this->defaults['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. * Return the schema array for the REST API.
* *
* @param array $field * @param array $field The field array
* @return array * @return array
*/ */
public function get_rest_schema( array $field ) { public function get_rest_schema( array $field ) {
@ -308,7 +297,7 @@ if ( ! class_exists( 'acf_field_date_picker' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
class acf_field_date_and_time_picker extends acf_field { class acf_field_date_and_time_picker extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -35,9 +33,7 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -93,9 +89,7 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -153,9 +147,7 @@ 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. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -225,24 +217,18 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
* @since 3.6 * @since 3.6
* @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @param mixed $value The value which was loaded from the database
* @param $post_id (mixed) the $post_id from which the value was loaded * @param mixed $post_id The post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param array $field The field array holding all the field options
* * @return mixed $value The modified value
* @return $value (mixed) the modified value
*/ */
public function format_value( $value, $post_id, $field ) {
function format_value( $value, $post_id, $field ) {
return acf_format_date( $value, $field['return_format'] ); return acf_format_date( $value, $field['return_format'] );
} }
@ -253,13 +239,11 @@ if ( ! class_exists( 'acf_field_date_and_time_picker' ) ) :
* *
* @type filter * @type filter
* @since 5.11.0 * @since 5.11.0
* @date 28/09/21
* *
* @param array $field The field array holding all the field options. * @param array $field The field array holding all the field options.
*
* @return array * @return array
*/ */
function load_field( $field ) { public function load_field( $field ) {
if ( empty( $field['display_format'] ) ) { if ( empty( $field['display_format'] ) ) {
$field['display_format'] = $this->defaults['display_format']; $field['display_format'] = $this->defaults['display_format'];
} }

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_email' ) ) :
class acf_field_email extends acf_field { class acf_field_email extends acf_field {
/* /**
* initialize
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -35,9 +33,7 @@ if ( ! class_exists( 'acf_field_email' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -88,13 +84,11 @@ if ( ! class_exists( 'acf_field_email' ) ) :
$html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>'; $html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>';
// return // 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. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $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 * 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. * notice. If a string is returned, the string is show as the message text.
* *
* @param bool $valid Whether the value is valid. * @param boolean $valid Whether the value is valid.
* @param mixed $value The field value. * @param mixed $value The field value.
* @param array $field The field array. * @param array $field The field array.
* @param string $input The request variable name for the inbound field. * @param string $input The request variable name for the inbound field.
* * @return boolean|string
* @return bool|string
*/ */
public function validate_value( $valid, $value, $field, $input ) { public function validate_value( $valid, $value, $field, $input ) {
$flags = defined( 'FILTER_FLAG_EMAIL_UNICODE' ) ? FILTER_FLAG_EMAIL_UNICODE : 0; $flags = defined( 'FILTER_FLAG_EMAIL_UNICODE' ) ? FILTER_FLAG_EMAIL_UNICODE : 0;

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
class acf_field_file extends acf_field { class acf_field_file extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -40,9 +38,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -66,9 +62,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -146,19 +140,19 @@ if ( ! class_exists( 'acf_field_file' ) ) :
<strong data-name="title"><?php echo esc_html( $o['title'] ); ?></strong> <strong data-name="title"><?php echo esc_html( $o['title'] ); ?></strong>
</p> </p>
<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> <a data-name="filename" href="<?php echo esc_url( $o['url'] ); ?>" target="_blank"><?php echo esc_html( $o['filename'] ); ?></a>
</p> </p>
<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> <span data-name="filesize"><?php echo esc_html( $o['filesize'] ); ?></span>
</p> </p>
</div> </div>
<div class="acf-actions -hover"> <div class="acf-actions -hover">
<?php if ( $uploader != 'basic' ) : ?> <?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; ?> <?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> </div>
<div class="hide-if-value"> <div class="hide-if-value">
@ -182,7 +176,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
<?php else : ?> <?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; ?> <?php endif; ?>
@ -191,9 +185,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
<?php <?php
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -292,9 +284,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -302,7 +292,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -335,9 +325,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
} }
/* /**
* get_media_item_args
*
* description * description
* *
* @type function * @type function
@ -355,9 +343,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -365,7 +351,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -441,11 +427,10 @@ if ( ! class_exists( 'acf_field_file' ) ) :
/** /**
* Validates file fields updated via the REST API. * Validates file fields updated via the REST API.
* *
* @param bool $valid * @param boolean $valid The current validity booleean
* @param int $value * @param integer $value The value of the field
* @param array $field * @param array $field The field array
* * @return boolean|WP_Error
* @return bool|WP_Error
*/ */
public function validate_rest_value( $valid, $value, $field ) { public function validate_rest_value( $valid, $value, $field ) {
if ( is_null( $value ) && empty( $field['required'] ) ) { if ( is_null( $value ) && empty( $field['required'] ) ) {
@ -526,7 +511,7 @@ if ( ! class_exists( 'acf_field_file' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
class acf_field_google_map extends acf_field { class acf_field_google_map extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -42,9 +40,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -102,9 +98,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -155,12 +149,12 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
<div class="title"> <div class="title">
<div class="acf-actions -hover"> <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="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 _e( 'Clear location', '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 _e( 'Find current location', 'acf' ); ?>"></a> <a href="#" data-name="locate" class="acf-icon -location grey" title="<?php esc_attr_e( 'Find current location', 'acf' ); ?>"></a>
</div> </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> <i class="acf-loading"></i>
</div> </div>
@ -172,9 +166,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -272,9 +264,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -282,7 +272,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -367,7 +357,7 @@ if ( ! class_exists( 'acf_field_google_map' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
class acf_field__group extends acf_field { class acf_field__group extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -39,9 +37,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* load_field()
*
* This filter is appied to the $field after it is loaded from the database * This filter is appied to the $field after it is loaded from the database
* *
* @type filter * @type filter
@ -68,9 +64,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* load_value()
*
* This filter is applied to the $value after it is loaded from the db * This filter is applied to the $value after it is loaded from the db
* *
* @type filter * @type filter
@ -78,7 +72,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value found in the database * @param $value (mixed) the value found in the database
* @param $post_id (mixed) the $post_id from which the value was loaded * @param $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* @return $value * @return $value
*/ */
@ -118,7 +112,6 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* @param mixed $post_id The $post_id from which the value was loaded. * @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 array $field The field array holding all the field options.
* @param boolean $escape_html Should the field return a HTML safe formatted value. * @param boolean $escape_html Should the field return a HTML safe formatted value.
*
* @return mixed the modified value * @return mixed the modified value
*/ */
public function format_value( $value, $post_id, $field, $escape_html = false ) { public function format_value( $value, $post_id, $field, $escape_html = false ) {
@ -148,9 +141,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -159,7 +150,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* *
* @param $value - the value which will be saved in the database * @param $value - the value which will be saved in the database
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* @param $post_id - the $post_id of which the value will be saved * @param $post_id - the post_id of which the value will be saved
* *
* @return $value - the modified value * @return $value - the modified value
*/ */
@ -209,9 +200,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* prepare_field_for_db
*
* This function will modify sub fields ready for update / load * This function will modify sub fields ready for update / load
* *
* @type function * @type function
@ -241,9 +230,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -292,9 +279,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* render_field_block
*
* description * description
* *
* @type function * @type function
@ -311,7 +296,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
$label_placement = ( $field['layout'] == 'block' ) ? 'top' : 'left'; $label_placement = ( $field['layout'] == 'block' ) ? 'top' : 'left';
// html // 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 ) { foreach ( $field['sub_fields'] as $sub_field ) {
acf_render_field_wrap( $sub_field ); acf_render_field_wrap( $sub_field );
@ -321,9 +306,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* render_field_table
*
* description * description
* *
* @type function * @type function
@ -388,9 +371,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $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-field acf-field-setting-sub_fields" data-setting="group" data-name="sub_fields">
<div class="acf-label"> <div class="acf-label">
<label><?php _e( 'Sub Fields', 'acf' ); ?></label> <label><?php esc_html_e( 'Sub Fields', 'acf' ); ?></label>
</div> </div>
<div class="acf-input acf-input-sub"> <div class="acf-input acf-input-sub">
<?php <?php
@ -444,9 +425,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* validate_value
*
* description * description
* *
* @type function * @type function
@ -494,9 +473,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* duplicate_field()
*
* This filter is appied to the $field before it is duplicated and saved to the database * This filter is appied to the $field before it is duplicated and saved to the database
* *
* @type filter * @type filter
@ -573,9 +550,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
} }
/* /**
* delete_value
*
* Called when deleting this field's value. * Called when deleting this field's value.
* *
* @date 1/07/2015 * @date 1/07/2015
@ -650,7 +625,7 @@ if ( ! class_exists( 'acf_field__group' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param int|string $post_id * @param integer|string $post_id
* @param array $field * @param array $field
* @return array|mixed * @return array|mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
class acf_field_image extends acf_field { class acf_field_image extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -45,9 +43,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
} }
/* /**
* input_admin_enqueue_scripts
*
* description * description
* *
* @type function * @type function
@ -136,9 +132,9 @@ if ( ! class_exists( 'acf_field_image' ) ) :
<img <?php echo acf_esc_attrs( $img_attrs ); ?> /> <img <?php echo acf_esc_attrs( $img_attrs ); ?> />
<div class="acf-actions -hover"> <div class="acf-actions -hover">
<?php if ( $uploader !== 'basic' ) : ?> <?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; ?> <?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> </div>
<div class="hide-if-value"> <div class="hide-if-value">
@ -158,7 +154,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
?> ?>
</label> </label>
<?php else : ?> <?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; ?> <?php endif; ?>
</div> </div>
</div> </div>
@ -166,9 +162,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -341,9 +335,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -351,7 +343,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -384,9 +376,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
} }
/* /**
* get_media_item_args
*
* description * description
* *
* @type function * @type function
@ -404,9 +394,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -414,7 +402,7 @@ if ( ! class_exists( 'acf_field_image' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -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 * @type function
* @date 11/02/2014
* @since 5.0.0 * @since 5.0.0
* *
* @param $post_id (int) * @param boolean $valid The current validity status.
* @return $post_id (int) * @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 ); return acf_get_field_type( 'file' )->validate_value( $valid, $value, $field, $input );
} }
/** /**
* Additional validation for the image field when submitted via REST. * Additional validation for the image field when submitted via REST.
* *
* @param bool $valid * @param boolean $valid The current validity booleean
* @param int $value * @param integer $value The value of the field
* @param array $field * @param array $field The field array
* * @return boolean|WP_Error
* @return bool|WP_Error
*/ */
public function validate_rest_value( $valid, $value, $field ) { public function validate_rest_value( $valid, $value, $field ) {
return acf_get_field_type( 'file' )->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. * Return the schema array for the REST API.
* *
* @param array $field * @param array $field The field array
* @return array * @return array
*/ */
public function get_rest_schema( array $field ) { 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. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value The field value
* @param string|int $post_id * @param string|integer $post_id The post ID
* @param array $field * @param array $field The field array
* @return mixed * @return mixed
*/ */
public function format_value_for_rest( $value, $post_id, array $field ) { public function format_value_for_rest( $value, $post_id, array $field ) {

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
class acf_field_link extends acf_field { class acf_field_link extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -33,9 +31,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
} }
/* /**
* get_link
*
* description * description
* *
* @type function * @type function
@ -74,19 +70,15 @@ if ( ! class_exists( 'acf_field_link' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
* *
* @type action * @type action
* @since 3.6 * @since 3.6
* @date 23/01/13
*/ */
public function render_field( $field ) {
function render_field( $field ) {
// vars // vars
$div = array( $div = array(
@ -108,11 +100,6 @@ if ( ! class_exists( 'acf_field_link' ) ) :
if ( $link['target'] === '_blank' ) { if ( $link['target'] === '_blank' ) {
$div['class'] .= ' -external'; $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 ); ?>> <div <?php echo acf_esc_attrs( $div ); ?>>
@ -131,12 +118,12 @@ if ( ! class_exists( 'acf_field_link' ) ) :
<?php endforeach; ?> <?php endforeach; ?>
</div> </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"> <div class="link-wrap">
<span class="link-title"><?php echo esc_html( $link['title'] ); ?></span> <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> <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>
</div> </div>
@ -144,9 +131,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -173,9 +158,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -183,7 +166,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -209,9 +192,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
} }
/* /**
* validate_value
*
* description * description
* *
* @type function * @type function
@ -239,9 +220,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -249,7 +228,7 @@ if ( ! class_exists( 'acf_field_link' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value

View File

@ -6,9 +6,7 @@ if ( ! class_exists( 'acf_field_message' ) ) :
public $show_in_rest = false; public $show_in_rest = false;
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -36,9 +34,7 @@ if ( ! class_exists( 'acf_field_message' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -73,9 +69,7 @@ if ( ! class_exists( 'acf_field_message' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -123,9 +117,7 @@ if ( ! class_exists( 'acf_field_message' ) ) :
); );
} }
/* /**
* translate_field
*
* This function will translate field settings * This function will translate field settings
* *
* @type function * @type function
@ -146,9 +138,7 @@ if ( ! class_exists( 'acf_field_message' ) ) :
} }
/* /**
* load_field()
*
* This filter is appied to the $field after it is loaded from the database * This filter is appied to the $field after it is loaded from the database
* *
* @type filter * @type filter

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
class acf_field_number extends acf_field { class acf_field_number extends acf_field {
/* /**
* initialize
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -38,9 +36,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -96,13 +92,11 @@ if ( ! class_exists( 'acf_field_number' ) ) :
$html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>'; $html .= '<div class="acf-input-wrap">' . acf_get_text_input( $atts ) . '</div>';
// return // 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. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -207,9 +201,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
); );
} }
/* /**
* validate_value
*
* description * description
* *
* @type function * @type function
@ -257,9 +249,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -268,7 +258,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
* *
* @param $value - the value which will be saved in the database * @param $value - the value which will be saved in the database
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* @param $post_id - the $post_id of which the value will be saved * @param $post_id - the post_id of which the value will be saved
* *
* @return $value - the modified value * @return $value - the modified value
*/ */
@ -320,7 +310,7 @@ if ( ! class_exists( 'acf_field_number' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
class acf_field_oembed extends acf_field { class acf_field_oembed extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -43,9 +41,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
} }
/* /**
* prepare_field
*
* This function will prepare the field for input * This function will prepare the field for input
* *
* @type function * @type function
@ -77,8 +73,8 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @since 5.0.0 * @since 5.0.0
* *
* @param string $url The URL that should be embedded. * @param string $url The URL that should be embedded.
* @param int|string $width Optional maxwidth value passed to the provider URL. * @param integer|string $width Optional maxwidth value passed to the provider URL.
* @param int|string $height Optional maxheight 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. * @return string|false The embedded HTML on success, false on failure.
*/ */
function wp_oembed_get( $url = '', $width = 0, $height = 0 ) { function wp_oembed_get( $url = '', $width = 0, $height = 0 ) {
@ -101,9 +97,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
return $embed; return $embed;
} }
/* /**
* ajax_query
*
* description * description
* *
* @type function * @type function
@ -129,9 +123,7 @@ 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 * This function will return an array of data formatted for use in a select2 AJAX response
* *
* @type function * @type function
@ -173,7 +165,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
} }
/* /**
* render_field() * render_field()
* *
* Create the HTML interface for your field * Create the HTML interface for your 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'); // <strong><?php _e("Error.", 'acf'); </strong> _e("No embed found for the given URL.", 'acf');
// value // value
if ( $field['value'] ) { if ( $field['value'] ) {
$atts['class'] .= ' has-value'; $atts['class'] .= ' has-value';
@ -232,7 +223,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
<div class="canvas-media"> <div class="canvas-media">
<?php <?php
if ( $field['value'] ) { 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> </div>
@ -244,9 +235,7 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -292,10 +281,9 @@ if ( ! class_exists( 'acf_field_oembed' ) ) :
* @param mixed $value The value which was loaded from the database. * @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 mixed $post_id The $post_id from which the value was loaded.
* @param array $field The field array holding all the field options. * @param array $field The field array holding all the field options.
*
* @return mixed the modified value * @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 // bail early if no value
if ( empty( $value ) ) { if ( empty( $value ) ) {
return $value; return $value;

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_output' ) ) :
class acf_field_output extends acf_field { class acf_field_output extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -30,9 +28,7 @@ if ( ! class_exists( 'acf_field_output' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field (array) the $field being rendered * @param $field (array) the $field being rendered
@ -54,7 +50,7 @@ if ( ! class_exists( 'acf_field_output' ) ) :
// html // html
if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) { if ( is_string( $field['html'] ) && ! function_exists( $field['html'] ) ) {
echo $field['html']; echo acf_esc_html( $field['html'] );
// function // function
} else { } else {

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
class acf_field_page_link extends acf_field { class acf_field_page_link extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -41,9 +39,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* ajax_query
*
* description * description
* *
* @type function * @type function
@ -216,9 +212,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* get_post_result
*
* This function will return an array containing id, text and maybe description data * This function will return an array containing id, text and maybe description data
* *
* @type function * @type function
@ -252,9 +246,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* get_post_title
*
* This function returns the HTML for a result * This function returns the HTML for a result
* *
* @type function * @type function
@ -287,9 +279,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* get_posts
*
* This function will return an array of posts for a given field value * This function will return an array of posts for a given field value
* *
* @type function * @type function
@ -353,9 +343,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -404,9 +392,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -506,9 +492,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -516,7 +500,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -562,9 +546,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -572,7 +554,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value which will be saved in the database * @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 $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -604,11 +586,10 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
/** /**
* Validates page link fields updated via the REST API. * Validates page link fields updated via the REST API.
* *
* @param bool $valid * @param boolean $valid The current validity booleean
* @param int $value * @param integer $value The value of the field
* @param array $field * @param array $field The field array
* * @return boolean|WP_Error
* @return bool|WP_Error
*/ */
public function validate_rest_value( $valid, $value, $field ) { public function validate_rest_value( $valid, $value, $field ) {
return acf_get_field_type( 'post_object' )->validate_rest_value( $valid, $value, $field ); return acf_get_field_type( 'post_object' )->validate_rest_value( $valid, $value, $field );
@ -648,7 +629,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
/** /**
* @see \acf_field::get_rest_links() * @see \acf_field::get_rest_links()
* @param mixed $value The raw (unformatted) field value. * @param mixed $value The raw (unformatted) field value.
* @param int|string $post_id * @param integer|string $post_id
* @param array $field * @param array $field
* @return array * @return array
*/ */
@ -678,7 +659,7 @@ if ( ! class_exists( 'acf_field_page_link' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_password' ) ) :
class acf_field_password extends acf_field { class acf_field_password extends acf_field {
/* /**
* initialize
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -34,9 +32,7 @@ if ( ! class_exists( 'acf_field_password' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -51,9 +47,7 @@ if ( ! class_exists( 'acf_field_password' ) ) :
acf_get_field_type( 'text' )->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. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *

View File

@ -35,9 +35,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* ajax_query
*
* description * description
* *
* @type function * @type function
@ -63,9 +61,7 @@ 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 * This function will return an array of data formatted for use in a select2 AJAX response
* *
* @type function * @type function
@ -210,9 +206,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* get_post_result
*
* This function will return an array containing id, text and maybe description data * This function will return an array containing id, text and maybe description data
* *
* @type function * @type function
@ -246,9 +240,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* get_post_title
*
* This function returns the HTML for a result * This function returns the HTML for a result
* *
* @type function * @type function
@ -281,9 +273,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -320,9 +310,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -438,9 +426,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
acf_render_bidirectional_field_settings( $field ); acf_render_bidirectional_field_settings( $field );
} }
/* /**
* load_value()
*
* This filter is applied to the $value after it is loaded from the db * This filter is applied to the $value after it is loaded from the db
* *
* @type filter * @type filter
@ -448,7 +434,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value found in the database * @param $value (mixed) the value found in the database
* @param $post_id (mixed) the $post_id from which the value was loaded * @param $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* @return $value * @return $value
*/ */
@ -465,9 +451,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -475,7 +459,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value
@ -512,9 +496,8 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
* @since 3.6 * @since 3.6
* *
* @param mixed $value The value which will be saved in the database. * @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 integer $post_id The post_id of which the value will be saved.
* @param array $field The field array holding all the field options. * @param array $field The field array holding all the field options.
*
* @return mixed $value The modified value. * @return mixed $value The modified value.
*/ */
public function update_value( $value, $post_id, $field ) { public function update_value( $value, $post_id, $field ) {
@ -543,9 +526,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
} }
/* /**
* get_posts
*
* This function will return an array of posts for a given field value * This function will return an array of posts for a given field value
* *
* @type function * @type function
@ -581,11 +562,10 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/** /**
* Validates post object fields updated via the REST API. * Validates post object fields updated via the REST API.
* *
* @param bool $valid * @param boolean $valid The current validity booleean
* @param int $value * @param integer $value The value of the field
* @param array $field * @param array $field The field array
* * @return boolean|WP_Error
* @return bool|WP_Error
*/ */
public function validate_rest_value( $valid, $value, $field ) { public function validate_rest_value( $valid, $value, $field ) {
if ( is_null( $value ) ) { if ( is_null( $value ) ) {
@ -708,7 +688,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
/** /**
* @see \acf_field::get_rest_links() * @see \acf_field::get_rest_links()
* @param mixed $value The raw (unformatted) field value. * @param mixed $value The raw (unformatted) field value.
* @param int|string $post_id * @param integer|string $post_id
* @param array $field * @param array $field
* @return array * @return array
*/ */
@ -743,7 +723,7 @@ if ( ! class_exists( 'acf_field_post_object' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
class acf_field_radio extends acf_field { class acf_field_radio extends acf_field {
/* /**
* __construct
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -39,9 +37,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field (array) the $field being rendered * @param $field (array) the $field being rendered
@ -122,7 +118,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
$e .= acf_get_hidden_input( array( 'name' => $field['name'] ) ); $e .= acf_get_hidden_input( array( 'name' => $field['name'] ) );
// Open <ul>. // Open <ul>.
$e .= '<ul ' . acf_esc_attr( $ul ) . '>'; $e .= '<ul ' . acf_esc_attrs( $ul ) . '>';
// Loop through choices. // Loop through choices.
foreach ( $field['choices'] as $value => $label ) { foreach ( $field['choices'] as $value => $label ) {
@ -157,20 +153,18 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
} }
// append // 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>. // Close <ul>.
$e .= '</ul>'; $e .= '</ul>';
// Output HTML. // 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. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -295,9 +289,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
); );
} }
/* /**
* update_field()
*
* This filter is appied to the $field before it is saved to the database * This filter is appied to the $field before it is saved to the database
* *
* @type filter * @type filter
@ -320,9 +312,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
} }
/* /**
* update_value()
*
* This filter is appied to the $value before it is updated in the db * This filter is appied to the $value before it is updated in the db
* *
* @type filter * @type filter
@ -331,7 +321,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @todo Fix bug where $field was found via json and has no ID * @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 $value - the value which will be saved in the database
* @param $post_id - the $post_id of which the value will be saved * @param $post_id - the post_id of which the value will be saved
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the modified value * @return $value - the modified value
@ -379,9 +369,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
} }
/* /**
* load_value()
*
* This filter is appied to the $value after it is loaded from the db * This filter is appied to the $value after it is loaded from the db
* *
* @type filter * @type filter
@ -389,7 +377,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value - the value found in the database * @param $value - the value found in the database
* @param $post_id - the $post_id from which the value was loaded from * @param $post_id - the post_id from which the value was loaded from
* @param $field - the field array holding all the field options * @param $field - the field array holding all the field options
* *
* @return $value - the value to be saved in te database * @return $value - the value to be saved in te database
@ -407,9 +395,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
} }
/* /**
* translate_field
*
* This function will translate field settings * This function will translate field settings
* *
* @type function * @type function
@ -426,9 +412,7 @@ 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 * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
* *
* @type filter * @type filter
@ -436,7 +420,7 @@ if ( ! class_exists( 'acf_field_radio' ) ) :
* @date 23/01/13 * @date 23/01/13
* *
* @param $value (mixed) the value which was loaded from the database * @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 $post_id (mixed) the post_id from which the value was loaded
* @param $field (array) the field array holding all the field options * @param $field (array) the field array holding all the field options
* *
* @return $value (mixed) the modified value * @return $value (mixed) the modified value

View File

@ -5,9 +5,7 @@ if ( ! class_exists( 'acf_field_range' ) ) :
class acf_field_range extends acf_field_number { class acf_field_range extends acf_field_number {
/* /**
* initialize
*
* This function will setup the field type data * This function will setup the field type data
* *
* @type function * @type function
@ -37,9 +35,7 @@ if ( ! class_exists( 'acf_field_range' ) ) :
} }
/* /**
* render_field()
*
* Create the HTML interface for your field * Create the HTML interface for your field
* *
* @param $field - an array holding all the field's data * @param $field - an array holding all the field's data
@ -55,7 +51,6 @@ if ( ! class_exists( 'acf_field_range' ) ) :
$atts = array(); $atts = array();
$keys = array( 'type', 'id', 'class', 'name', 'value', 'min', 'max', 'step' ); $keys = array( 'type', 'id', 'class', 'name', 'value', 'min', 'max', 'step' );
$keys2 = array( 'readonly', 'disabled', 'required' ); $keys2 = array( 'readonly', 'disabled', 'required' );
$html = '';
// step // step
if ( ! $field['step'] ) { if ( ! $field['step'] ) {
@ -97,7 +92,7 @@ if ( ! class_exists( 'acf_field_range' ) ) :
$atts = acf_clean_atts( $atts ); $atts = acf_clean_atts( $atts );
// open // open
$html .= '<div class="acf-range-wrap">'; $html = '<div class="acf-range-wrap">';
// prepend // prepend
if ( $field['prepend'] !== '' ) { if ( $field['prepend'] !== '' ) {
@ -139,13 +134,11 @@ if ( ! class_exists( 'acf_field_range' ) ) :
$html .= '</div>'; $html .= '</div>';
// return // return
echo $html; echo $html; //phpcs:ignore WordPress.Security.EscapeOutput -- Only populated with already escaped HTML.
} }
/* /**
* render_field_settings()
*
* Create extra options for your field. This is rendered when editing a field. * 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 * The value of $field['name'] can be used (like bellow) to save extra data to the $field
* *
@ -267,7 +260,7 @@ if ( ! class_exists( 'acf_field_range' ) ) :
* Apply basic formatting to prepare the value for default REST output. * Apply basic formatting to prepare the value for default REST output.
* *
* @param mixed $value * @param mixed $value
* @param string|int $post_id * @param string|integer $post_id
* @param array $field * @param array $field
* @return mixed * @return mixed
*/ */

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