plugin updates

This commit is contained in:
Tony Volpe
2024-10-29 13:49:07 -04:00
parent 66268c4512
commit 9000316050
41 changed files with 916 additions and 570 deletions

View File

@@ -312,6 +312,15 @@ if ( ! class_exists( 'ACF_Admin_Post_Type' ) ) :
$_POST['acf_post_type']['ID'] = $post_id;
$_POST['acf_post_type']['title'] = isset( $_POST['acf_post_type']['labels']['name'] ) ? $_POST['acf_post_type']['labels']['name'] : '';
if ( ! acf_get_setting( 'enable_meta_box_cb_edit' ) ) {
$_POST['acf_post_type']['register_meta_box_cb'] = '';
$existing_post = acf_maybe_unserialize( $post->post_content );
if ( ! empty( $existing_post['register_meta_box_cb'] ) ) {
$_POST['acf_post_type']['register_meta_box_cb'] = $existing_post['register_meta_box_cb'];
}
}
// Save the post type.
acf_update_internal_post_type( $_POST['acf_post_type'], $this->post_type ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Validated in verify_save_post
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

View File

@@ -314,6 +314,29 @@ if ( ! class_exists( 'ACF_Admin_Taxonomy' ) ) :
$_POST['acf_taxonomy']['ID'] = $post_id;
$_POST['acf_taxonomy']['title'] = isset( $_POST['acf_taxonomy']['labels']['name'] ) ? $_POST['acf_taxonomy']['labels']['name'] : '';
if ( ! acf_get_setting( 'enable_meta_box_cb_edit' ) ) {
$_POST['acf_taxonomy']['meta_box_cb'] = '';
$_POST['acf_taxonomy']['meta_box_sanitize_cb'] = '';
if ( ! empty( $_POST['acf_taxonomy']['meta_box'] ) && 'custom' === $_POST['acf_taxonomy']['meta_box'] ) {
$_POST['acf_taxonomy']['meta_box'] = 'default';
}
$existing_post = acf_maybe_unserialize( $post->post_content );
if ( ! empty( $existing_post['meta_box'] ) ) {
$_POST['acf_taxonomy']['meta_box'] = $existing_post['meta_box'];
}
if ( ! empty( $existing_post['meta_box_cb'] ) ) {
$_POST['acf_taxonomy']['meta_box_cb'] = $existing_post['meta_box_cb'];
}
if ( ! empty( $existing_post['meta_box_sanitize_cb'] ) ) {
$_POST['acf_taxonomy']['meta_box_sanitize_cb'] = $existing_post['meta_box_sanitize_cb'];
}
}
// Save the taxonomy.
acf_update_internal_post_type( $_POST['acf_taxonomy'], $this->post_type ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Validated in verify_save_post
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized

View File

@@ -319,6 +319,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
?>
<div class="acf-field-settings-footer">
<a class="button close-field edit-field" title="<?php esc_attr_e( 'Close Field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Close Field', 'acf' ); ?></a>
<a class="acf-btn acf-btn-secondary close-add-field" title="<?php esc_attr_e( 'Close and Add Field', 'acf' ); ?>" href="#"><?php esc_html_e( 'Close and Add Field', 'acf' ); ?></a>
</div>
</div>
</div>

View File

@@ -98,7 +98,7 @@ if ( $is_subfield ) {
<ul class="acf-hl acf-tfoot">
<li class="acf-fr">
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'acf' ); ?></a>
<a href="#" class="acf-btn acf-btn-sm add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'acf' ); ?></a>
</li>
</ul>

View File

@@ -838,24 +838,39 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'field'
);
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'register_meta_box_cb',
'key' => 'register_meta_box_cb',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['register_meta_box_cb'],
'label' => __( 'Custom Meta Box Callback', 'acf' ),
'instructions' => __( 'A PHP function name to be called when setting up the meta boxes for the edit screen. For security, this callback will be executed in a special context without access to any superglobals like $_POST or $_GET.', 'acf' ),
'conditions' => array(
'field' => 'show_ui',
'operator' => '==',
'value' => '1',
$acf_enable_meta_box_cb_edit = acf_get_setting( 'enable_meta_box_cb_edit' );
$acf_meta_box_cb_instructions = __( 'A PHP function name to be called when setting up the meta boxes for the edit screen. For security, this callback will be executed in a special context without access to any superglobals like $_POST or $_GET.', 'acf' );
// Only show if user is allowed to update, or if it already has a value.
if ( $acf_enable_meta_box_cb_edit || ! empty( $acf_post_type['register_meta_box_cb'] ) ) {
if ( ! $acf_enable_meta_box_cb_edit ) {
if ( is_multisite() ) {
$acf_meta_box_cb_instructions .= ' ' . __( 'By default only super admin users can edit this setting.', 'acf' );
} else {
$acf_meta_box_cb_instructions .= ' ' . __( 'By default only admin users can edit this setting.', 'acf' );
}
}
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'register_meta_box_cb',
'key' => 'register_meta_box_cb',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['register_meta_box_cb'],
'label' => __( 'Custom Meta Box Callback', 'acf' ),
'instructions' => $acf_meta_box_cb_instructions,
'readonly' => ! $acf_enable_meta_box_cb_edit,
'conditions' => array(
'field' => 'show_ui',
'operator' => '==',
'value' => '1',
),
),
),
'div',
'field'
);
'div',
'field'
);
}
acf_render_field_wrap(
array(

View File

@@ -745,6 +745,16 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
$acf_tags_meta_box_text = __( 'Tags Meta Box', 'acf' );
$acf_categories_meta_box_text = __( 'Categories Meta Box', 'acf' );
$acf_default_meta_box_text = empty( $acf_taxonomy['hierarchical'] ) ? $acf_tags_meta_box_text : $acf_categories_meta_box_text;
$acf_enable_meta_box_cb_edit = acf_get_setting( 'enable_meta_box_cb_edit' );
$acf_meta_box_choices = array(
'default' => $acf_default_meta_box_text,
'custom' => __( 'Custom Meta Box', 'acf' ),
'disabled' => __( 'No Meta Box', 'acf' ),
);
if ( ! $acf_enable_meta_box_cb_edit && 'custom' !== $acf_taxonomy['meta_box'] ) {
unset( $acf_meta_box_choices['custom'] );
}
acf_render_field_wrap(
array(
@@ -757,11 +767,7 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
'label' => __( 'Meta Box', 'acf' ),
'instructions' => __( 'Controls the meta box on the content editor screen. By default, the Categories meta box is shown for hierarchical taxonomies, and the Tags meta box is shown for non-hierarchical taxonomies.', 'acf' ),
'hide_search' => true,
'choices' => array(
'default' => $acf_default_meta_box_text,
'custom' => __( 'Custom Meta Box', 'acf' ),
'disabled' => __( 'No Meta Box', 'acf' ),
),
'choices' => $acf_meta_box_choices,
'data' => array(
'tags_meta_box' => __( 'Tags Meta Box', 'acf' ),
'categories_meta_box' => __( 'Categories Meta Box', 'acf' ),
@@ -794,54 +800,68 @@ foreach ( acf_get_combined_taxonomy_settings_tabs() as $tab_key => $tab_label )
)
);
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'meta_box_cb',
'key' => 'meta_box_cb',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['meta_box_cb'],
'label' => __( 'Register Meta Box Callback', 'acf' ),
'instructions' => __( 'A PHP function name to be called to handle the content of a meta box on your taxonomy. For security, this callback will be executed in a special context without access to any superglobals like $_POST or $_GET.', 'acf' ),
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
),
),
'div',
'field'
);
if ( $acf_enable_meta_box_cb_edit || 'custom' === $acf_taxonomy['meta_box'] ) {
$acf_meta_box_cb_instructions = __( 'A PHP function name to be called to handle the content of a meta box on your taxonomy. For security, this callback will be executed in a special context without access to any superglobals like $_POST or $_GET.', 'acf' );
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'meta_box_sanitize_cb',
'key' => 'meta_box_sanitize_cb',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['meta_box_sanitize_cb'],
'label' => __( 'Meta Box Sanitization Callback', 'acf' ),
'instructions' => __( 'A PHP function name to be called for sanitizing taxonomy data saved from a meta box.', 'acf' ),
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
),
),
'div',
'field'
);
if ( ! $acf_enable_meta_box_cb_edit ) {
if ( is_multisite() ) {
$acf_meta_box_cb_instructions .= ' ' . __( 'By default only super admin users can edit this setting.', 'acf' );
} else {
$acf_meta_box_cb_instructions .= ' ' . __( 'By default only admin users can edit this setting.', 'acf' );
}
}
acf_render_field_wrap(
array(
'type' => 'seperator',
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'meta_box_cb',
'key' => 'meta_box_cb',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['meta_box_cb'],
'label' => __( 'Register Meta Box Callback', 'acf' ),
'instructions' => $acf_meta_box_cb_instructions,
'readonly' => ! $acf_enable_meta_box_cb_edit,
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
),
),
)
);
'div',
'field'
);
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'meta_box_sanitize_cb',
'key' => 'meta_box_sanitize_cb',
'prefix' => 'acf_taxonomy',
'value' => $acf_taxonomy['meta_box_sanitize_cb'],
'label' => __( 'Meta Box Sanitization Callback', 'acf' ),
'instructions' => __( 'A PHP function name to be called for sanitizing taxonomy data saved from a meta box.', 'acf' ),
'readonly' => ! $acf_enable_meta_box_cb_edit,
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
),
),
'div',
'field'
);
acf_render_field_wrap(
array(
'type' => 'seperator',
'conditions' => array(
'field' => 'meta_box',
'operator' => '==',
'value' => 'custom',
),
)
);
}
acf_render_field_wrap(
array(