edit pages
This commit is contained in:
@ -0,0 +1,278 @@
|
||||
<?php
|
||||
|
||||
global $acf_ui_options_page;
|
||||
|
||||
foreach ( acf_get_combined_options_page_settings_tabs() as $tab_key => $tab_label ) {
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'tab',
|
||||
'label' => $tab_label,
|
||||
'key' => 'acf_ui_options_page_tabs',
|
||||
)
|
||||
);
|
||||
|
||||
$wrapper_class = str_replace( '_', '-', $tab_key );
|
||||
|
||||
echo '<div class="acf-ui-options-page-advanced-settings acf-ui-options-page-' . esc_attr( $wrapper_class ) . '-settings">';
|
||||
|
||||
switch ( $tab_key ) {
|
||||
case 'visibility':
|
||||
$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 options page 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(
|
||||
'label' => __( 'Menu Icon', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'icon_url',
|
||||
'key' => 'icon_url',
|
||||
'class' => 'acf-options-page-menu_icon',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['icon_url'],
|
||||
'instructions' => $acf_menu_icon_instructions,
|
||||
'placeholder' => 'dashicons-admin-generic',
|
||||
'conditions' => array(
|
||||
'field' => 'parent_slug',
|
||||
'operator' => '==',
|
||||
'value' => 'none',
|
||||
),
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Menu Title', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'menu_title',
|
||||
'key' => 'menu_title',
|
||||
'class' => 'acf-options-page-menu_title',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['menu_title'],
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
$acf_menu_position_link = sprintf(
|
||||
'<a href="https://developer.wordpress.org/reference/functions/add_menu_page/#default-bottom-of-menu-structure" target="_blank">%s</a>',
|
||||
__( 'Learn more about menu positions.', 'acf' )
|
||||
);
|
||||
$acf_menu_position_desc = sprintf(
|
||||
/* translators: %s - link to WordPress docs to learn more about menu positions. */
|
||||
__( 'The position in the menu where this page should appear. %s', 'acf' ),
|
||||
$acf_menu_position_link
|
||||
);
|
||||
|
||||
$acf_menu_position_desc_parent = sprintf(
|
||||
/* translators: %s - link to WordPress docs to learn more about menu positions. */
|
||||
__( 'The position in the menu where this page should appear. %s', 'acf' ),
|
||||
$acf_menu_position_link
|
||||
);
|
||||
|
||||
$acf_menu_position_desc_child = __( 'The position in the menu where this child page should appear. The first child page is 0, the next is 1, etc.', 'acf' );
|
||||
|
||||
$acf_menu_position_desc = '<span class="acf-menu-position-desc-parent">' . $acf_menu_position_desc_parent . '</span>';
|
||||
$acf_menu_position_desc .= '<span class="acf-menu-position-desc-child">' . $acf_menu_position_desc_child . '</span>';
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Menu Position', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'position',
|
||||
'key' => 'position',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['position'],
|
||||
'instructions' => $acf_menu_position_desc,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Redirect to Child Page', 'acf' ),
|
||||
'instructions' => __( 'When child pages exist for this parent page, this page will redirect to the first child page.', 'acf' ),
|
||||
'type' => 'true_false',
|
||||
'name' => 'redirect',
|
||||
'key' => 'redirect',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['redirect'],
|
||||
'ui' => 1,
|
||||
'default' => 1,
|
||||
'conditions' => array(
|
||||
'field' => 'parent_slug',
|
||||
'operator' => '==',
|
||||
'value' => 'none',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'description',
|
||||
'key' => 'description',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['description'],
|
||||
'label' => __( 'Description', 'acf' ),
|
||||
'instructions' => __( 'A descriptive summary of the options page.', 'acf' ),
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
break;
|
||||
case 'labels':
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Update Button Label', 'acf' ),
|
||||
'instructions' => __( 'The label used for the submit button which updates the fields on the options page.', 'acf' ),
|
||||
'placeholder' => __( 'Update', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'update_button',
|
||||
'key' => 'update_button',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['update_button'],
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Updated Message', 'acf' ),
|
||||
'instructions' => __( 'The message that is displayed after successfully updating the options page.', 'acf' ),
|
||||
'placeholder' => __( 'Updated Options', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'updated_message',
|
||||
'key' => 'updated_message',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['updated_message'],
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
break;
|
||||
case 'permissions':
|
||||
$acf_all_caps = array();
|
||||
|
||||
foreach ( wp_roles()->roles as $acf_role ) {
|
||||
$acf_all_caps = array_merge( $acf_all_caps, $acf_role['capabilities'] );
|
||||
}
|
||||
|
||||
// Get rid of duplicates and set the keys equal to the values.
|
||||
$acf_all_caps = array_unique( array_keys( $acf_all_caps ) );
|
||||
$acf_all_caps = array_combine( $acf_all_caps, $acf_all_caps );
|
||||
|
||||
// Move the "edit_posts" to the first select option.
|
||||
if ( in_array( 'edit_posts', $acf_all_caps, true ) ) {
|
||||
$acf_all_caps = array_diff( $acf_all_caps, array( 'edit_posts' ) );
|
||||
$acf_all_caps = array_merge( array( 'edit_posts' => 'edit_posts' ), $acf_all_caps );
|
||||
}
|
||||
|
||||
// TODO: Should we AJAX load this? Seems to require UI = true, which breaks our custom template.
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'capability',
|
||||
'key' => 'capability',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['capability'],
|
||||
'label' => __( 'Capability', 'acf' ),
|
||||
'instructions' => __( 'The capability required for this menu to be displayed to the user.', 'acf' ),
|
||||
'choices' => $acf_all_caps,
|
||||
'default' => 'edit_posts',
|
||||
'class' => 'acf-options-page-capability',
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'data_storage',
|
||||
'key' => 'data_storage',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['data_storage'],
|
||||
'label' => __( 'Data Storage', 'acf' ),
|
||||
'instructions' => __( 'By default, the option page stores field data in the options table. You can make the page load field data from a post, user, or term.', 'acf' ),
|
||||
'choices' => array(
|
||||
'options' => __( 'Options', 'acf' ),
|
||||
'post_id' => __( 'Custom Storage', 'acf' ),
|
||||
),
|
||||
'default' => 'options',
|
||||
'hide_search' => true,
|
||||
'class' => 'acf-options-page-data_storage',
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
$acf_custom_storage_url = acf_add_url_utm_tags(
|
||||
'https://www.advancedcustomfields.com/resources/get_field/',
|
||||
'docs',
|
||||
'options_page_ui',
|
||||
'get-a-value-from-different-objects'
|
||||
);
|
||||
|
||||
$acf_custom_storage_link = sprintf(
|
||||
'<a href="%1$s" target="_blank">%2$s</a>',
|
||||
$acf_custom_storage_url,
|
||||
__( 'Learn more about available settings.', 'acf' )
|
||||
);
|
||||
|
||||
$acf_custom_storage_desc = sprintf(
|
||||
/* translators: %s = link to learn more about storage locations. */
|
||||
__( 'Set a custom storage location. Can be a numeric post ID (123), or a string (`user_2`). %s', 'acf' ),
|
||||
$acf_custom_storage_link
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Custom Storage', 'acf' ),
|
||||
'instructions' => $acf_custom_storage_desc,
|
||||
'type' => 'text',
|
||||
'name' => 'post_id',
|
||||
'key' => 'post_id',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['post_id'],
|
||||
'conditions' => array(
|
||||
'field' => 'data_storage',
|
||||
'operator' => '==',
|
||||
'value' => 'post_id',
|
||||
),
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Autoload Options', 'acf' ),
|
||||
'instructions' => __( 'Improve performance by loading the fields in the option records automatically when WordPress loads.', 'acf' ),
|
||||
'type' => 'true_false',
|
||||
'name' => 'autoload',
|
||||
'key' => 'autoload',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['autoload'],
|
||||
'ui' => 1,
|
||||
'default' => 0,
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
do_action( "acf/ui_options_page/render_settings_tab/{$tab_key}", $acf_ui_options_page );
|
||||
|
||||
echo '</div>';
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
global $acf_ui_options_page, $acf_parent_page_options;
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Page Title', 'acf' ),
|
||||
/* translators: example options page name */
|
||||
'placeholder' => __( 'Site Settings', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'page_title',
|
||||
'key' => 'page_title',
|
||||
'class' => 'acf_options_page_title acf_slugify_to_key',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['page_title'],
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Menu Slug', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'menu_slug',
|
||||
'key' => 'menu_slug',
|
||||
'class' => 'acf-options-page-menu_slug acf_slugified_key',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['menu_slug'],
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Parent Page', 'acf' ),
|
||||
'type' => 'select',
|
||||
'name' => 'parent_slug',
|
||||
'key' => 'parent_slug',
|
||||
'class' => 'acf-options-page-parent_slug',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['parent_slug'],
|
||||
'choices' => $acf_parent_page_options,
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
do_action( 'acf/post_type/basic_settings', $acf_ui_options_page );
|
||||
|
||||
acf_render_field_wrap( array( 'type' => 'seperator' ) );
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Advanced Configuration', 'acf' ),
|
||||
'instructions' => __( 'I know what I\'m doing, show me all the options.', 'acf' ),
|
||||
'type' => 'true_false',
|
||||
'name' => 'advanced_configuration',
|
||||
'key' => 'advanced_configuration',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['advanced_configuration'],
|
||||
'ui' => 1,
|
||||
'class' => 'acf-advanced-settings-toggle',
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" name="acf_ui_options_page[key]" value="<?php echo esc_attr( $acf_ui_options_page['key'] ); ?>" />
|
||||
</div>
|
||||
<?php
|
@ -0,0 +1,66 @@
|
||||
<form id="acf-create-options-page-form">
|
||||
<?php
|
||||
|
||||
$acf_options_page_prefilled_title = '';
|
||||
|
||||
if ( ! empty( $field_group_title ) ) {
|
||||
$acf_options_page_prefilled_title = (string) apply_filters( 'acf/options_page_modal/prefill_title', '%s' );
|
||||
$acf_options_page_prefilled_title = sprintf(
|
||||
$acf_options_page_prefilled_title,
|
||||
$field_group_title
|
||||
);
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Page Title', 'acf' ),
|
||||
/* translators: example options page name */
|
||||
'placeholder' => __( 'Site Settings', 'acf' ),
|
||||
'value' => $acf_options_page_prefilled_title,
|
||||
'type' => 'text',
|
||||
'name' => 'page_title',
|
||||
'key' => 'page_title',
|
||||
'class' => 'acf_options_page_title acf_slugify_to_key',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Menu Slug', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'menu_slug',
|
||||
'key' => 'menu_slug',
|
||||
'class' => 'acf-options-page-menu_slug acf_slugified_key',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Parent Page', 'acf' ),
|
||||
'type' => 'select',
|
||||
'name' => 'parent_slug',
|
||||
'key' => 'parent_slug',
|
||||
'class' => 'acf-options-page-parent_slug',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'choices' => $acf_parent_page_choices,
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="acf-actions">
|
||||
<button type="button" class="acf-btn acf-btn-secondary acf-close-popup"><?php esc_html_e( 'Cancel', 'acf' ); ?></button>
|
||||
<button type="submit" class="acf-btn acf-btn-primary"><?php esc_html_e( 'Done', 'acf' ); ?></button>
|
||||
</div>
|
||||
|
||||
</form>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$acf_options_pages_desc = sprintf(
|
||||
/* translators: %s URL to ACF options pages documentation */
|
||||
__( 'ACF <a href="%s" target="_blank">options pages</a> are custom admin pages for managing global settings via fields. You can create multiple pages and sub-pages.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/options-page/', 'docs', 'no-options-pages' )
|
||||
);
|
||||
|
||||
$acf_getting_started = sprintf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-options-pages' )
|
||||
);
|
||||
?>
|
||||
<script>document.body.classList.add('acf-no-options-pages');</script>
|
||||
<div class="acf-no-options-pages-wrapper">
|
||||
<div class="acf-no-options-pages-inner">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-post-types.svg' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Add Your First Options Page', 'acf' ); ?></h2>
|
||||
<p><?php echo acf_esc_html( $acf_options_pages_desc ); ?></p>
|
||||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-ui-options-page' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Options Page', 'acf' ); ?></a>
|
||||
<p class="acf-small"><?php echo acf_esc_html( $acf_getting_started ); ?></p>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,46 @@
|
||||
<div class="wrap acf-settings-wrap">
|
||||
|
||||
<h1><?php echo $page_title; ?></h1>
|
||||
|
||||
<form id="post" method="post" name="post">
|
||||
|
||||
<?php
|
||||
|
||||
// render post data
|
||||
acf_form_data(
|
||||
array(
|
||||
'screen' => 'options',
|
||||
'post_id' => $post_id,
|
||||
)
|
||||
);
|
||||
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
|
||||
?>
|
||||
|
||||
<div id="poststuff" class="poststuff">
|
||||
|
||||
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
||||
|
||||
<div id="postbox-container-1" class="postbox-container">
|
||||
|
||||
<?php do_meta_boxes( 'acf_options_page', 'side', null ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="postbox-container-2" class="postbox-container">
|
||||
|
||||
<?php do_meta_boxes( 'acf_options_page', 'normal', null ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
@ -0,0 +1,302 @@
|
||||
<?php
|
||||
/**
|
||||
* Renders the "License Information" and "Update Information" metaboxes.
|
||||
*
|
||||
* @package ACF
|
||||
*/
|
||||
|
||||
$nonce = $active ? 'deactivate_pro_license' : 'activate_pro_license';
|
||||
$activate_deactivate_btn = $active ? __( 'Deactivate License', 'acf' ) : __( 'Activate License', 'acf' );
|
||||
|
||||
/**
|
||||
* Renders the license status table.
|
||||
*
|
||||
* @since 6.?
|
||||
*
|
||||
* @param array $status The current license status array.
|
||||
* @return void
|
||||
*/
|
||||
function acf_pro_render_license_status_table( $status ) {
|
||||
// Bail early if we don't have a status from the server.
|
||||
if ( acf_pro_get_license_key() && empty( $status['status'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$status['status'] = ! empty( $status['status'] ) ? $status['status'] : 'inactive';
|
||||
$status_text = _x( 'Inactive', 'license status', 'acf' );
|
||||
$is_lifetime = ! empty( $status['lifetime'] );
|
||||
|
||||
if ( 'active' === $status['status'] ) {
|
||||
$status_text = _x( 'Active', 'license status', 'acf' );
|
||||
} elseif ( 'expired' === $status['status'] ) {
|
||||
$status_text = _x( 'Expired', 'license status', 'acf' );
|
||||
} elseif ( 'cancelled' === $status['status'] ) {
|
||||
$status_text = _x( 'Cancelled', 'license status', 'acf' );
|
||||
}
|
||||
|
||||
$indicator = '<span class="acf-license-status ' . esc_attr( $status['status'] ) . '">' . esc_html( $status_text ) . '</span>';
|
||||
?>
|
||||
|
||||
<table class="acf-license-status-table">
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
if ( $is_lifetime || 'inactive' === $status['status'] ) {
|
||||
esc_html_e( 'License Status', 'acf' );
|
||||
} else {
|
||||
esc_html_e( 'Subscription Status', 'acf' );
|
||||
}
|
||||
?>
|
||||
</th>
|
||||
<td><?php echo acf_esc_html( $indicator ); ?></td>
|
||||
</tr>
|
||||
<?php if ( ! empty( $status['name'] ) ) : ?>
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
if ( $is_lifetime ) {
|
||||
esc_html_e( 'License Type', 'acf' );
|
||||
} else {
|
||||
esc_html_e( 'Subscription Type', 'acf' );
|
||||
}
|
||||
?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
if ( $is_lifetime ) {
|
||||
esc_html_e( 'Lifetime - ', 'acf' );
|
||||
}
|
||||
echo esc_html( $status['name'] );
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! $is_lifetime && ! empty( $status['expiry'] ) && is_numeric( $status['expiry'] ) ) : ?>
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
if ( acf_pro_is_license_expired( $status ) ) {
|
||||
esc_html_e( 'Subscription Expired', 'acf' );
|
||||
} else {
|
||||
esc_html_e( 'Subscription Expires', 'acf' );
|
||||
}
|
||||
?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$date_format = get_option( 'date_format', 'F j, Y' );
|
||||
$expiry_date = date_i18n( $date_format, $status['expiry'] );
|
||||
echo esc_html( $expiry_date );
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the "Manage License"/"Renew Subscription" button.
|
||||
*
|
||||
* @since 6.?
|
||||
*
|
||||
* @param array $status The current license status.
|
||||
* @return void
|
||||
*/
|
||||
function acf_pro_render_manage_license_button( $status ) {
|
||||
// Lifetime licenses don't have anything to manage.
|
||||
if ( ! empty( $status['lifetime'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = acf_pro_get_manage_license_url( $status );
|
||||
$url = acf_add_url_utm_tags( $url, 'updates page', 'manage license button' );
|
||||
$text = __( 'Manage License', 'acf' );
|
||||
$class = '';
|
||||
|
||||
if ( acf_pro_is_license_expired( $status ) ) {
|
||||
$text = __( 'Renew Subscription', 'acf' );
|
||||
$class = ' acf-btn acf-renew-subscription';
|
||||
}
|
||||
|
||||
printf(
|
||||
'<a href="%1$s" target="_blank" class="acf-manage-license-btn%2$s">%3$s<i class="acf-icon acf-icon-arrow-up-right"></i></a>',
|
||||
esc_url( $url ),
|
||||
esc_attr( $class ),
|
||||
esc_html( $text )
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="wrap acf-settings-wrap acf-updates">
|
||||
|
||||
<h1><?php esc_html_e( 'Updates', 'acf' ); ?></h1>
|
||||
|
||||
<div class="acf-box" id="acf-license-information">
|
||||
<div class="title">
|
||||
<h3><?php esc_html_e( 'License Information', 'acf' ); ?></h3>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<?php if ( $is_defined_license ) : ?>
|
||||
|
||||
<p class="acf-license-defined">
|
||||
<?php echo acf_esc_html( apply_filters( 'acf/admin/license_key_constant_message', __( 'Your license key is defined in wp-config.php.', 'acf' ) ) ); ?>
|
||||
</p>
|
||||
|
||||
<?php if ( ! $active ) : ?>
|
||||
<div class="acf-retry-activation">
|
||||
<?php
|
||||
$acf_recheck_class = ' acf-btn acf-btn-secondary';
|
||||
|
||||
if ( acf_pro_is_license_expired( $license_status ) ) {
|
||||
acf_pro_render_manage_license_button( $license_status );
|
||||
$acf_recheck_class = '';
|
||||
}
|
||||
|
||||
$acf_recheck_nonce = wp_create_nonce( 'acf_retry_activation' );
|
||||
$acf_recheck_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates&acf_retry_nonce=' . $nonce );
|
||||
$acf_recheck_text = __( 'Recheck License', 'acf' );
|
||||
printf(
|
||||
'<a class="acf-recheck-license%1$s" href="%2$s"><i class="acf-icon acf-icon-regenerate"></i>%3$s</a>',
|
||||
esc_attr( $acf_recheck_class ),
|
||||
esc_url( $acf_recheck_url ),
|
||||
esc_html( $acf_recheck_text )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else : // License is not defined. ?>
|
||||
<form action="" method="post" class="acf-activation-form">
|
||||
<?php acf_nonce_input( $nonce ); ?>
|
||||
<label for="acf-field-acf_pro_license"><?php esc_html_e( 'License Key', 'acf' ); ?></label>
|
||||
<?php
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'acf_pro_license',
|
||||
'value' => str_repeat( '*', strlen( $license ) ),
|
||||
'readonly' => $active ? 1 : 0,
|
||||
)
|
||||
);
|
||||
|
||||
$activate_deactivate_btn_id = $active ? 'id="deactivate-license" ' : '';
|
||||
$activate_deactivate_btn_class = $active ? ' acf-btn-tertiary' : '';
|
||||
?>
|
||||
<input <?php echo $activate_deactivate_btn_id; ?>type="submit" value="<?php echo esc_attr( $activate_deactivate_btn ); ?>" class="acf-btn<?php echo esc_attr( $activate_deactivate_btn_class ); ?>">
|
||||
<?php
|
||||
acf_pro_render_manage_license_button( $license_status );
|
||||
|
||||
if ( acf_pro_is_license_expired( $license_status ) ) {
|
||||
$acf_recheck_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates&acf-recheck-license=true' );
|
||||
$acf_recheck_text = __( 'Recheck License', 'acf' );
|
||||
printf(
|
||||
'<a class="acf-recheck-license" href="%1$s"><i class="acf-icon acf-icon-regenerate"></i>%2$s</a>',
|
||||
esc_url( $acf_recheck_url ),
|
||||
esc_html( $acf_recheck_text )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
</form>
|
||||
<?php endif; // End of license_defined check. ?>
|
||||
<div class="acf-license-status-wrap">
|
||||
<?php
|
||||
acf_pro_render_license_status_table( $license_status );
|
||||
|
||||
if ( ! $active && ! defined( 'ACF_PRO_LICENSE' ) ) :
|
||||
?>
|
||||
<div class="acf-no-license-view-pricing">
|
||||
<span>
|
||||
<?php
|
||||
$acf_view_pricing_text = esc_html__( 'View pricing & purchase', 'acf' );
|
||||
$acf_view_pricing_link = sprintf(
|
||||
'<a href=%s target="_blank">%s <i class="acf-icon acf-icon-arrow-up-right"></i></a>',
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'license activations' ),
|
||||
$acf_view_pricing_text
|
||||
);
|
||||
printf(
|
||||
/* translators: %s - link to ACF website */
|
||||
__( 'Don\'t have an ACF PRO license? %s', 'acf' ),
|
||||
$acf_view_pricing_link
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="acf-box" id="acf-update-information">
|
||||
<div class="title">
|
||||
<h3><?php esc_html_e( 'Update Information', 'acf' ); ?></h3>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php esc_html_e( 'Current Version', 'acf' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo esc_html( $current_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php esc_html_e( 'Latest Version', 'acf' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo esc_html( $remote_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php esc_html_e( 'Update Available', 'acf' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ( $update_available ) : ?>
|
||||
|
||||
<span style="margin-right: 5px;"><?php esc_html_e( 'Yes', 'acf' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span style="margin-right: 5px;"><?php esc_html_e( 'No', 'acf' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( $upgrade_notice ) : ?>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php esc_html_e( 'Upgrade Notice', 'acf' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo acf_esc_html( $upgrade_notice ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php if ( $changelog ) : ?>
|
||||
<div class="acf-update-changelog">
|
||||
<?php echo acf_esc_html( $changelog ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $update_available ) : ?>
|
||||
<?php if ( $wp_not_compatible ) : ?>
|
||||
<a class="button" disabled="disabled" href="#"><?php esc_html_e( 'Please upgrade WordPress to update ACF', 'acf' ); ?></a>
|
||||
<?php elseif ( $license_error ) : ?>
|
||||
<a class="button" disabled="disabled" href="#"><?php esc_html_e( 'Please reactivate your license to unlock updates', 'acf' ); ?></a>
|
||||
<?php elseif ( $active && is_multisite() ) : ?>
|
||||
<a class="button" disabled="disabled" href="#"><?php esc_html_e( 'Update ACF in Network Admin', 'acf' ); ?></a>
|
||||
<?php elseif ( $active ) : ?>
|
||||
<a class="acf-btn" href="<?php echo esc_attr( admin_url( 'plugins.php?s=Advanced+Custom+Fields+Pro' ) ); ?>"><?php esc_html_e( 'Update Plugin', 'acf' ); ?></a>
|
||||
<?php else : ?>
|
||||
<a class="button" disabled="disabled" href="#"><?php esc_html_e( 'Enter your license key to unlock updates', 'acf' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<a class="acf-btn acf-btn-secondary" href="<?php echo esc_attr( add_query_arg( 'force-check', 1 ) ); ?>"><?php esc_html_e( 'Check For Updates', 'acf' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user