plugin install

This commit is contained in:
Tony Volpe
2024-06-18 17:29:05 -04:00
parent e1aaedd1ae
commit 41f50eacc4
5880 changed files with 1057631 additions and 39681 deletions

View File

@@ -139,8 +139,19 @@ if ( empty( $field['conditional_logic'] ) ) {
</td>
<td class="value">
<?php
$conditional_field = get_field_object( $rule['field'] );
/**
* Filters the choices available for a conditional logic rule.
*
* @since 6.3.0
*
* @param array $choices The available choices.
* @param array $conditional_field The field object for the conditional field.
* @param mixed $value The value of the rule.
*/
$choices = apply_filters( 'acf/conditional_logic/choices', array( $rule['value'] => $rule['value'] ), $conditional_field, $rule['value'] );
// create field
acf_render_field(
array(
'type' => 'select',
@@ -149,12 +160,9 @@ if ( empty( $field['conditional_logic'] ) ) {
'class' => 'condition-rule-value',
'disabled' => $disabled,
'value' => $rule['value'],
'choices' => array(
$rule['value'] => $rule['value'],
),
'choices' => $choices,
)
);
?>
</td>
<td class="add">

View File

@@ -34,7 +34,7 @@ if ( acf_is_pro() && acf_get_field_type_prop( $field['type'], 'pro' ) ) {
}
if ( acf_is_pro() && acf_get_field_type_prop( $field['type'], 'pro' ) && ! acf_pro_is_license_active() ) {
$field_type_label .= '<span class="acf-pro-label acf-pro-label-field-type">PRO</span>';
$field_type_label .= '<span class="acf-pro-label-field-type"><img src="' . esc_url( acf_get_url( 'assets/images/pro-chip.svg' ) ) . '" alt="' . esc_attr__( 'ACF PRO Logo', 'acf' ) . '"></span>';
if ( ! acf_pro_is_license_expired() ) {
$inactive_field_class = ' acf-js-tooltip';
@@ -217,7 +217,7 @@ if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic
$field,
array(
'label' => __( 'Instructions', 'acf' ),
'instructions' => __( 'Instructions for authors. Shown when submitting data', 'acf' ),
'instructions' => __( 'Instructions for content editors. Shown when submitting data.', 'acf' ),
'type' => 'textarea',
'name' => 'instructions',
'rows' => 5,

View File

@@ -22,9 +22,9 @@ if ( acf_is_pro() ) {
?>
<div id="tmpl-acf-field-group-pro-features">
<div class="acf-field-group-pro-features-wrapper">
<h1 class="acf-field-group-pro-features-title-sm"><?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-sm"><?php echo esc_html( $acf_field_group_pro_features_title ); ?> <div class="acf-pro-label"><img src="<?php echo esc_url( acf_get_url( 'assets/images/pro-chip.svg' ) ); ?>" alt="<?php esc_attr_e( 'ACF PRO logo', 'acf' ); ?>"></div></h1>
<div class="acf-field-group-pro-features-content">
<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"><img src="<?php echo esc_url( acf_get_url( 'assets/images/pro-chip.svg' ) ); ?>" alt="<?php esc_attr_e( 'ACF PRO logo', 'acf' ); ?>"></div></h1>
<p class="acf-field-group-pro-features-desc"><?php esc_html_e( 'Speed up your workflow and develop better websites with features like ACF Blocks and Options Pages, and sophisticated field types like Repeater, Flexible Content, Clone, and Gallery.', 'acf' ); ?></p>
<div class="acf-field-group-pro-features-actions">
<a target="<?php echo 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. ?>

View File

@@ -747,15 +747,6 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
)
);
$acf_dashicon_class_name = __( 'Dashicon class name', 'acf' );
$acf_dashicon_link = '<a href="https://developer.wordpress.org/resource/dashicons/" target="_blank">' . $acf_dashicon_class_name . '</a>';
$acf_menu_icon_instructions = sprintf(
/* translators: %s = "dashicon class name", link to the WordPress dashicon documentation. */
__( 'The icon used for the post type menu item in the admin dashboard. Can be a URL or %s to use for the icon.', 'acf' ),
$acf_dashicon_link
);
acf_render_field_wrap(
array(
'type' => 'text',
@@ -795,20 +786,52 @@ foreach ( acf_get_combined_post_type_settings_tabs() as $tab_key => $tab_label )
'field'
);
// Set the default value for the icon field.
$acf_default_icon_value = array(
'type' => 'dashicons',
'value' => 'dashicons-admin-post',
);
if ( empty( $acf_post_type['menu_icon'] ) ) {
$acf_post_type['menu_icon'] = $acf_default_icon_value;
}
// Backwards compatibility for before the icon picker was introduced.
if ( is_string( $acf_post_type['menu_icon'] ) ) {
// If the old value was a string that starts with dashicons-, assume it's a dashicon.
if ( false !== strpos( $acf_post_type['menu_icon'], 'dashicons-' ) ) {
$acf_post_type['menu_icon'] = array(
'type' => 'dashicons',
'value' => $acf_post_type['menu_icon'],
);
} else {
$acf_post_type['menu_icon'] = array(
'type' => 'url',
'value' => $acf_post_type['menu_icon'],
);
}
}
acf_render_field_wrap(
array(
'type' => 'text',
'name' => 'menu_icon',
'key' => 'menu_icon',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['menu_icon'],
'label' => __( 'Menu Icon', 'acf' ),
'placeholder' => 'dashicons-admin-post',
'instructions' => $acf_menu_icon_instructions,
'conditions' => array(
'field' => 'show_in_menu',
'operator' => '==',
'value' => 1,
'type' => 'icon_picker',
'name' => 'menu_icon',
'key' => 'menu_icon',
'prefix' => 'acf_post_type',
'value' => $acf_post_type['menu_icon'],
'label' => __( 'Menu Icon', 'acf' ),
'placeholder' => 'dashicons-admin-post',
'conditions' => array(
array(
'field' => 'show_in_menu',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'admin_menu_parent',
'operator' => '==',
'value' => '',
),
),
),
'div',

View File

@@ -2,44 +2,67 @@
$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
$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 how to fix this', '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 = 'notice-error';
$acf_user_can_acf = false;
if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
$acf_user_can_acf = true;
$acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show&nbsp;details', 'acf' ) . '</a>';
$acf_class .= ' is-dismissible';
$acf_dismiss_url = add_query_arg( array( 'acf-dismiss-esc-html-notice' => wp_create_nonce( 'acf/dismiss_escaped_html_notice' ) ) );
// "Show/Hide Details" is a button for accessibility purposes, because it isn't a link. But since the design shows a link, we need to make it look like a link.
$acf_style_button_as_link = trim(
'display: inline;
padding: 0;
background: none;
border: none;
color: #0073aa;
text-decoration: underline;
cursor: pointer;'
);
$acf_show_details = '<button style="' . esc_attr( $acf_style_button_as_link ) . '" class="acf-show-more-details">' . __( 'Show&nbsp;details', 'acf' ) . '</button>';
$acf_show_details .= ' | <a class="acf-dismiss-permanently-button" href="' . esc_url( $acf_dismiss_url ) . '">' . __( 'Dismiss permanently', 'acf' ) . '</a>';
} else {
$acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' );
}
$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.', 'acf' ),
$acf_plugin_name,
$acf_learn_how_to_fix,
$acf_show_details
$acf_learn_how_to_fix
);
?>
<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 style="margin-bottom: 0.5em; padding-bottom: 2px;"><?php echo acf_esc_html( $acf_error_msg ); ?></p>
<p style="margin: 0.5em 0; padding: 2px;"><?php echo acf_esc_html( $acf_show_details ); ?></p>
<?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?>
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
<?php
foreach ( $acf_escaped as $acf_field_key => $acf_data ) {
$acf_error = sprintf(
/* translators: %1$s - The selector used %2$s The field name 3%$s The parent function name */
__( '%1$s (%2$s) - rendered via %3$s', 'acf' ),
$acf_data['selector'],
$acf_data['field'],
$acf_data['function']
);
<div 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;">
<?php
foreach ( $acf_escaped as $acf_field_key => $acf_data ) {
$acf_error = sprintf(
/* translators: %1$s - The selector used %2$s The field name 3%$s The parent function name */
__( '%1$s (%2$s) - rendered via %3$s', 'acf' ),
$acf_data['selector'],
$acf_data['field'],
$acf_data['function']
);
echo '<li>' . esc_html( $acf_error ) . '</li>';
}
echo '<li>' . esc_html( $acf_error ) . '</li>';
}
?>
</ul>
<p style="margin: 0.5em 0; padding: 2px;">
<?php
$acf_clear_logs_url = add_query_arg( array( 'acf-clear-esc-html-log' => wp_create_nonce( 'acf/clear_escaped_html_log' ) ) );
// translators: %s - The clear log button opening HTML tag. %s - The closing HTML tag.
echo acf_esc_html( '<i>' . sprintf( __( 'This data is logged as we detect values that have been changed during output. %1$sClear log and dismiss%2$s after escaping the values in your code. The notice will reappear if we detect changed values again.', 'acf' ), '<a class="acf-clear-log-button" href="' . esc_url( $acf_clear_logs_url ) . '">', '</a>' ) . '</i>' );
?>
</ul>
</p>
</div>
<?php endif; ?>
</div>

View File

@@ -40,15 +40,18 @@ if ( 'acf-field-group' === $acf_post_type ) {
if ( empty( $acf_title ) && $acf_prefilled_title ) {
$acf_title = $acf_prefilled_title;
}
} elseif ( in_array( $acf_post_type, array( 'acf-post-type', 'acf-taxonomy' ) ) ) {
$acf_duplicate_post_type = acf_get_post_type_from_request_args( 'acfduplicate' );
$acf_duplicate_taxonomy = acf_get_taxonomy_from_request_args( 'acfduplicate' );
$acf_duplicated_from_label = '';
} elseif ( in_array( $acf_post_type, array( 'acf-post-type', 'acf-taxonomy', 'acf-ui-options-page' ), true ) ) {
$acf_duplicate_post_type = acf_get_post_type_from_request_args( 'acfduplicate' );
$acf_duplicate_taxonomy = acf_get_taxonomy_from_request_args( 'acfduplicate' );
$acf_duplicate_ui_options_page = acf_get_ui_options_page_from_request_args( 'acfduplicate' );
$acf_duplicated_from_label = '';
if ( $acf_duplicate_post_type && ! empty( $acf_duplicate_post_type['labels']['singular_name'] ) ) {
$acf_duplicated_from_label = $acf_duplicate_post_type['labels']['singular_name'];
} elseif ( $acf_duplicate_taxonomy && ! empty( $acf_duplicate_taxonomy['labels']['singular_name'] ) ) {
$acf_duplicated_from_label = $acf_duplicate_taxonomy['labels']['singular_name'];
} elseif ( $acf_duplicate_ui_options_page && ! empty( $acf_duplicate_ui_options_page['page_title'] ) ) {
$acf_duplicated_from_label = $acf_duplicate_ui_options_page['page_title'];
}
if ( ! empty( $acf_duplicated_from_label ) ) {

View File

@@ -24,7 +24,7 @@ if ( $page_title ) {
echo esc_html( $page_title );
?>
<?php if ( $acf_is_options_page_preview ) { ?>
<div class="acf-pro-label">PRO</div>
<div class="acf-pro-label"><img src="<?php echo esc_url( acf_get_url( 'assets/images/pro-chip.svg' ) ); ?>" alt="<?php esc_attr_e( 'ACF PRO logo', 'acf' ); ?>"></div>
<?php
}
?>

View File

@@ -172,12 +172,15 @@ function acf_print_menu_section( $menu_items, $section = '' ) {
<div class="acf-admin-toolbar">
<div class="acf-admin-toolbar-inner">
<div class="acf-nav-wrap">
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=acf-field-group' ) ); ?>" class="acf-logo">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.svg' ) ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
<?php if ( acf_is_pro() && acf_pro_is_license_active() ) { ?>
<div class="acf-pro-label">PRO</div>
<?php } ?>
</a>
<?php if ( acf_is_pro() && acf_pro_is_license_active() ) { ?>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=acf-field-group' ) ); ?>" class="acf-logo pro">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-pro-logo.svg' ) ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
</a>
<?php } else { ?>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=acf-field-group' ) ); ?>" class="acf-logo">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.svg' ) ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
</a>
<?php } ?>
<h2><?php echo esc_html( acf_get_setting( 'name' ) ); ?></h2>
<?php acf_print_menu_section( $core_tabs, 'core' ); ?>

View File

@@ -22,7 +22,7 @@ if ( ! acf_get_setting( 'pro' ) ) {
<div id="acf-upgrade-notice" class="notice">
<div class="notice-container">
<div class="col-content">
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.png' ) ); ?>" />
<img src="<?php echo esc_url( acf_get_url( 'assets/images/acf-logo.svg' ) ); ?>" />
<h2><?php esc_html_e( 'Database Upgrade Required', 'acf' ); ?></h2>
<?php // translators: %1 plugin name, %2 version number ?>
<p><?php echo acf_esc_html( sprintf( __( 'Thank you for updating to %1$s v%2$s!', 'acf' ), acf_get_setting( 'name' ), acf_get_setting( 'version' ) ) ); ?><br />