Added dependency plugins
This commit is contained in:
@@ -0,0 +1,367 @@
|
||||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('acf_admin_options_page') ) :
|
||||
|
||||
class acf_admin_options_page {
|
||||
|
||||
/** @var array Contains the current options page */
|
||||
var $page;
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* Initialize filters, action, variables and includes
|
||||
*
|
||||
* @type function
|
||||
* @date 23/06/12
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
||||
// add menu items
|
||||
add_action('admin_menu', array($this,'admin_menu'), 99, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_menu
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
function admin_menu() {
|
||||
|
||||
// vars
|
||||
$pages = acf_get_options_pages();
|
||||
|
||||
|
||||
// bail early if no pages
|
||||
if( empty($pages) ) return;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $pages as $page ) {
|
||||
|
||||
// vars
|
||||
$slug = '';
|
||||
|
||||
|
||||
// parent
|
||||
if( empty($page['parent_slug']) ) {
|
||||
|
||||
$slug = add_menu_page( $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html'), $page['icon_url'], $page['position'] );
|
||||
|
||||
// child
|
||||
} else {
|
||||
|
||||
$slug = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'html') );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// actions
|
||||
add_action("load-{$slug}", array($this,'admin_load'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* load
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 2/02/13
|
||||
* @since 3.6
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function admin_load() {
|
||||
|
||||
// globals
|
||||
global $plugin_page;
|
||||
|
||||
|
||||
// vars
|
||||
$this->page = acf_get_options_page( $plugin_page );
|
||||
|
||||
|
||||
// get post_id (allow lang modification)
|
||||
$this->page['post_id'] = acf_get_valid_post_id($this->page['post_id']);
|
||||
|
||||
|
||||
// verify and remove nonce
|
||||
if( acf_verify_nonce('options') ) {
|
||||
|
||||
// save data
|
||||
if( acf_validate_save_post(true) ) {
|
||||
|
||||
// set autoload
|
||||
acf_update_setting('autoload', $this->page['autoload']);
|
||||
|
||||
|
||||
// save
|
||||
acf_save_post( $this->page['post_id'] );
|
||||
|
||||
|
||||
// redirect
|
||||
wp_redirect( add_query_arg(array('message' => '1')) );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// load acf scripts
|
||||
acf_enqueue_scripts();
|
||||
|
||||
|
||||
// actions
|
||||
add_action( 'acf/input/admin_enqueue_scripts', array($this,'admin_enqueue_scripts') );
|
||||
add_action( 'acf/input/admin_head', array($this,'admin_head') );
|
||||
|
||||
|
||||
// add columns support
|
||||
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_enqueue_scripts
|
||||
*
|
||||
* This function will enqueue the 'post.js' script which adds support for 'Screen Options' column toggle
|
||||
*
|
||||
* @type function
|
||||
* @date 23/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
function admin_enqueue_scripts() {
|
||||
|
||||
wp_enqueue_script('post');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_head
|
||||
*
|
||||
* This action will find and add field groups to the current edit page
|
||||
*
|
||||
* @type action (admin_head)
|
||||
* @date 23/06/12
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function admin_head() {
|
||||
|
||||
// get field groups
|
||||
$field_groups = acf_get_field_groups(array(
|
||||
'options_page' => $this->page['menu_slug']
|
||||
));
|
||||
|
||||
|
||||
// notices
|
||||
if( !empty($_GET['message']) && $_GET['message'] == '1' ) {
|
||||
|
||||
acf_add_admin_notice( $this->page['updated_message'] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// add submit div
|
||||
add_meta_box('submitdiv', __('Publish','acf'), array($this, 'postbox_submitdiv'), 'acf_options_page', 'side', 'high');
|
||||
|
||||
|
||||
|
||||
if( empty($field_groups) ) {
|
||||
|
||||
acf_add_admin_notice( sprintf( __('No Custom Field Groups found for this options page. <a href="%s">Create a Custom Field Group</a>', 'acf'), admin_url() . 'post-new.php?post_type=acf-field-group' ), 'error');
|
||||
|
||||
} else {
|
||||
|
||||
foreach( $field_groups as $i => $field_group ) {
|
||||
|
||||
// vars
|
||||
$id = "acf-{$field_group['key']}";
|
||||
$title = $field_group['title'];
|
||||
$context = $field_group['position'];
|
||||
$priority = 'high';
|
||||
$args = array( 'field_group' => $field_group );
|
||||
|
||||
|
||||
// tweaks to vars
|
||||
if( $context == 'acf_after_title' ) {
|
||||
|
||||
$context = 'normal';
|
||||
|
||||
} elseif( $context == 'side' ) {
|
||||
|
||||
$priority = 'core';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// filter for 3rd party customization
|
||||
$priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
|
||||
|
||||
|
||||
// add meta box
|
||||
add_meta_box( $id, $title, array($this, 'postbox_acf'), 'acf_options_page', $context, $priority, $args );
|
||||
|
||||
|
||||
}
|
||||
// foreach
|
||||
|
||||
}
|
||||
// if
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* postbox_submitdiv
|
||||
*
|
||||
* This function will render the submitdiv metabox
|
||||
*
|
||||
* @type function
|
||||
* @date 23/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function postbox_submitdiv( $post, $args ) {
|
||||
|
||||
?>
|
||||
<div id="major-publishing-actions">
|
||||
|
||||
<div id="publishing-action">
|
||||
<span class="spinner"></span>
|
||||
<input type="submit" accesskey="p" value="<?php echo $this->page['update_button']; ?>" class="button button-primary button-large" id="publish" name="publish">
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_meta_box
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 24/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post (object)
|
||||
* @param $args (array)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function postbox_acf( $post, $args ) {
|
||||
|
||||
// extract args
|
||||
extract( $args ); // all variables from the add_meta_box function
|
||||
extract( $args ); // all variables from the args argument
|
||||
|
||||
|
||||
// vars
|
||||
$o = array(
|
||||
'id' => $id,
|
||||
'key' => $field_group['key'],
|
||||
'style' => $field_group['style'],
|
||||
'label' => $field_group['label_placement'],
|
||||
'edit_url' => '',
|
||||
'edit_title' => __('Edit field group', 'acf'),
|
||||
'visibility' => true
|
||||
);
|
||||
|
||||
|
||||
// edit_url
|
||||
if( $field_group['ID'] && acf_current_user_can_admin() ) {
|
||||
|
||||
$o['edit_url'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit');
|
||||
|
||||
}
|
||||
|
||||
|
||||
// load fields
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
|
||||
// render
|
||||
acf_render_fields( $this->page['post_id'], $fields, 'div', $field_group['instruction_placement'] );
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
|
||||
acf.postbox.render(<?php echo json_encode($o); ?>);
|
||||
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* html
|
||||
*
|
||||
* @description:
|
||||
* @since: 2.0.4
|
||||
* @created: 5/12/12
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
||||
// load view
|
||||
acf_get_view(dirname(__FILE__) . '/views/html-options-page.php', $this->page);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
new acf_admin_options_page();
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,416 @@
|
||||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('acf_admin_settings_updates') ) :
|
||||
|
||||
class acf_admin_settings_updates {
|
||||
|
||||
// vars
|
||||
var $view = array();
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* Initialize filters, action, variables and includes
|
||||
*
|
||||
* @type function
|
||||
* @date 23/06/12
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
||||
// actions
|
||||
add_action('admin_menu', array($this, 'admin_menu'), 20 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* show_notice
|
||||
*
|
||||
* This function will show a notice (only once)
|
||||
*
|
||||
* @type function
|
||||
* @date 11/4/17
|
||||
* @since 5.5.10
|
||||
*
|
||||
* @param $message (string)
|
||||
* @param class (string)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function show_notice( $message = '', $class = '' ){
|
||||
|
||||
// only show one notice
|
||||
if( acf_has_done('acf_admin_settings_updates_notice') ) return false;
|
||||
|
||||
|
||||
// add notice
|
||||
acf_add_admin_notice( $message, $class );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* show_error
|
||||
*
|
||||
* This function will show an error notice (only once)
|
||||
*
|
||||
* @type function
|
||||
* @date 11/4/17
|
||||
* @since 5.5.10
|
||||
*
|
||||
* @param $error (mixed)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function show_error( $error = '' ){
|
||||
|
||||
// error object
|
||||
if( is_wp_error($error) ) {
|
||||
|
||||
$error = __('<b>Error</b>. Could not connect to update server', 'acf') . ' <span class="description">(' . esc_html( $error->get_error_message() ) . ')</span>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// add notice
|
||||
$this->show_notice( $error, 'error' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_changelog_section
|
||||
*
|
||||
* This function will find and return a section of content from a plugin changelog
|
||||
*
|
||||
* @type function
|
||||
* @date 11/4/17
|
||||
* @since 5.5.10
|
||||
*
|
||||
* @param $changelog (string)
|
||||
* @param $h4 (string)
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function get_changelog_section( $changelog, $h4 = '' ) {
|
||||
|
||||
// explode
|
||||
$bits = array_filter( explode('<h4>', $changelog) );
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $bits as $bit ) {
|
||||
|
||||
// vars
|
||||
$bit = explode('</h4>', $bit);
|
||||
$version = trim($bit[0]);
|
||||
$text = trim($bit[1]);
|
||||
|
||||
|
||||
// is relevant?
|
||||
if( version_compare($h4, $version, '==') ) {
|
||||
|
||||
return '<h4>' . esc_html($version) . '</h4>' . acf_esc_html($text);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// update
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_menu
|
||||
*
|
||||
* This function will add the ACF menu item to the WP admin
|
||||
*
|
||||
* @type action (admin_menu)
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function admin_menu() {
|
||||
|
||||
// bail early if no show_admin
|
||||
if( !acf_get_setting('show_admin') ) return;
|
||||
|
||||
|
||||
// bail early if no show_updates
|
||||
if( !acf_get_setting('show_updates') ) return;
|
||||
|
||||
|
||||
// bail early if not a plugin (included in theme)
|
||||
if( !acf_is_plugin_active() ) return;
|
||||
|
||||
|
||||
// add page
|
||||
$page = add_submenu_page('edit.php?post_type=acf-field-group', __('Updates','acf'), __('Updates','acf'), acf_get_setting('capability'), 'acf-settings-updates', array($this,'html') );
|
||||
|
||||
|
||||
// actions
|
||||
add_action('load-' . $page, array($this,'load'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* load
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 7/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function load() {
|
||||
|
||||
// activate
|
||||
if( acf_verify_nonce('activate_pro_licence') ) {
|
||||
|
||||
$this->activate_pro_licence();
|
||||
|
||||
// deactivate
|
||||
} elseif( acf_verify_nonce('deactivate_pro_licence') ) {
|
||||
|
||||
$this->deactivate_pro_licence();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// vars
|
||||
$license = acf_pro_get_license_key();
|
||||
$this->view = array(
|
||||
'license' => $license,
|
||||
'active' => $license ? 1 : 0,
|
||||
'current_version' => acf_get_setting('version'),
|
||||
'remote_version' => '',
|
||||
'update_available' => false,
|
||||
'changelog' => '',
|
||||
'upgrade_notice' => ''
|
||||
);
|
||||
|
||||
|
||||
// vars
|
||||
$info = acf_updates()->get_plugin_info('pro');
|
||||
|
||||
|
||||
// error
|
||||
if( is_wp_error($info) ) {
|
||||
|
||||
return $this->show_error( $info );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// add info to view
|
||||
$this->view['remote_version'] = $info['version'];
|
||||
|
||||
|
||||
// add changelog if the remote version is '>' than the current version
|
||||
$version = acf_get_setting('version');
|
||||
|
||||
|
||||
// check if remote version is higher than current version
|
||||
if( version_compare($info['version'], $version, '>') ) {
|
||||
|
||||
// update view
|
||||
$this->view['update_available'] = true;
|
||||
$this->view['changelog'] = $this->get_changelog_section($info['changelog'], $info['version']);
|
||||
$this->view['upgrade_notice'] = $this->get_changelog_section($info['upgrade_notice'], $info['version']);
|
||||
|
||||
|
||||
// refresh transient
|
||||
// - avoids new version not available in plugin update list
|
||||
// - only request if license is active
|
||||
if( $license ) {
|
||||
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* activate_pro_licence
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function activate_pro_licence() {
|
||||
|
||||
// connect
|
||||
$post = array(
|
||||
'acf_license' => $_POST['acf_pro_licence'],
|
||||
'acf_version' => acf_get_setting('version'),
|
||||
'wp_name' => get_bloginfo('name'),
|
||||
'wp_url' => home_url(),
|
||||
'wp_version' => get_bloginfo('version'),
|
||||
'wp_language' => get_bloginfo('language'),
|
||||
'wp_timezone' => get_option('timezone_string'),
|
||||
);
|
||||
|
||||
|
||||
// connect
|
||||
$response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
|
||||
|
||||
|
||||
// ensure response is expected JSON array (not string)
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
|
||||
// error
|
||||
if( is_wp_error($response) ) {
|
||||
|
||||
return $this->show_error( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// success
|
||||
if( $response['status'] == 1 ) {
|
||||
|
||||
// update license
|
||||
acf_pro_update_license( $response['license'] );
|
||||
|
||||
|
||||
// show message
|
||||
$this->show_notice( $response['message'] );
|
||||
|
||||
} else {
|
||||
|
||||
// show error
|
||||
$this->show_error( $response['message'] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* deactivate_pro_licence
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 16/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function deactivate_pro_licence() {
|
||||
|
||||
// vars
|
||||
$license = acf_pro_get_license_key();
|
||||
|
||||
|
||||
// bail early if no key
|
||||
if( !$license ) return;
|
||||
|
||||
|
||||
// connect
|
||||
$post = array(
|
||||
'acf_license' => $license,
|
||||
'wp_url' => home_url(),
|
||||
);
|
||||
|
||||
|
||||
// connect
|
||||
$response = acf_updates()->request('v2/plugins/deactivate?p=pro', $post);
|
||||
|
||||
|
||||
// ensure response is expected JSON array (not string)
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
|
||||
// error
|
||||
if( is_wp_error($response) ) {
|
||||
|
||||
return $this->show_error( $response );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// clear DB
|
||||
acf_pro_update_license('');
|
||||
|
||||
|
||||
// success
|
||||
if( $response['status'] == 1 ) {
|
||||
|
||||
// show message
|
||||
$this->show_notice( $response['message'] );
|
||||
|
||||
} else {
|
||||
|
||||
// show error
|
||||
$this->show_error( $response['message'] );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* html
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 7/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function html() {
|
||||
|
||||
// load view
|
||||
acf_get_view( dirname(__FILE__) . '/views/html-settings-updates.php', $this->view);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
new acf_admin_settings_updates();
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<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(
|
||||
'post_id' => $post_id,
|
||||
'nonce' => 'options',
|
||||
));
|
||||
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
|
||||
?>
|
||||
|
||||
<div id="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,142 @@
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$active = $license ? true : false;
|
||||
$nonce = $active ? 'deactivate_pro_licence' : 'activate_pro_licence';
|
||||
$input = $active ? 'password' : 'text';
|
||||
$button = $active ? __('Deactivate License', 'acf') : __('Activate License', 'acf');
|
||||
$readonly = $active ? 1 : 0;
|
||||
|
||||
?>
|
||||
<div class="wrap acf-settings-wrap">
|
||||
|
||||
<h1><?php _e('Updates', 'acf'); ?></h1>
|
||||
|
||||
<div class="acf-box" id="acf-license-information">
|
||||
<div class="title">
|
||||
<h3><?php _e('License Information', 'acf'); ?></h3>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<p><?php printf(__('To unlock updates, please enter your license key below. If you don\'t have a licence key, please see <a href="%s" target="_blank">details & pricing</a>.','acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?></p>
|
||||
<form action="" method="post">
|
||||
<div class="acf-hidden">
|
||||
<?php acf_nonce_input($nonce); ?>
|
||||
</div>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label for="acf-field-acf_pro_licence"><?php _e('License Key', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
// render field
|
||||
acf_render_field(array(
|
||||
'type' => $input,
|
||||
'name' => 'acf_pro_licence',
|
||||
'value' => str_repeat('*', strlen($license)),
|
||||
'readonly' => $readonly
|
||||
));
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
<input type="submit" value="<?php echo $button; ?>" class="button button-primary">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="acf-box" id="acf-update-information">
|
||||
<div class="title">
|
||||
<h3><?php _e('Update Information', 'acf'); ?></h3>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php _e('Current Version', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo esc_html( $current_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php _e('Latest Version', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo esc_html( $remote_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php _e('Update Available', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php if( $update_available ): ?>
|
||||
|
||||
<span style="margin-right: 5px;"><?php _e('Yes', 'acf'); ?></span>
|
||||
|
||||
<?php if( $active ): ?>
|
||||
<a class="button button-primary" href="<?php echo admin_url('plugins.php?s=Advanced+Custom+Fields+Pro'); ?>"><?php _e('Update Plugin', 'acf'); ?></a>
|
||||
<?php else: ?>
|
||||
<a class="button" disabled="disabled" href="#"><?php _e('Please enter your license key above to unlock updates', 'acf'); ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<span style="margin-right: 5px;"><?php _e('No', 'acf'); ?></span>
|
||||
<a class="button" href="<?php echo add_query_arg('force-check', 1); ?>"><?php _e('Check Again', 'acf'); ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if( $changelog ): ?>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php _e('Changelog', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo acf_esc_html( $changelog ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if( $upgrade_notice ): ?>
|
||||
<tr>
|
||||
<th>
|
||||
<label><?php _e('Upgrade Notice', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo acf_esc_html( $upgrade_notice ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style type="text/css">
|
||||
#acf_pro_licence {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
#acf-update-information td h4 {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user