Merge branch 'release/5.7.10'
This commit is contained in:
commit
6936d20b4d
62
acf.php
62
acf.php
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Advanced Custom Fields PRO
|
||||
Plugin URI: https://www.advancedcustomfields.com/
|
||||
Description: Customize WordPress with powerful, professional and intuitive fields.
|
||||
Version: 5.7.9
|
||||
Version: 5.7.10
|
||||
Author: Elliot Condon
|
||||
Author URI: http://www.elliotcondon.com/
|
||||
Copyright: Elliot Condon
|
||||
|
|
@ -18,7 +18,7 @@ if( ! class_exists('ACF') ) :
|
|||
class ACF {
|
||||
|
||||
/** @var string The plugin version number */
|
||||
var $version = '5.7.9';
|
||||
var $version = '5.7.10';
|
||||
|
||||
/** @var array The plugin settings array */
|
||||
var $settings = array();
|
||||
|
|
@ -130,6 +130,16 @@ class ACF {
|
|||
acf_include('includes/api/api-template.php');
|
||||
acf_include('includes/api/api-term.php');
|
||||
|
||||
// Include models.
|
||||
acf_include('includes/class-acf-data.php');
|
||||
|
||||
// Include functions.
|
||||
acf_include('includes/acf-helper-functions.php');
|
||||
acf_include('includes/acf-data-functions.php');
|
||||
acf_include('includes/acf-form-functions.php');
|
||||
acf_include('includes/acf-user-functions.php');
|
||||
|
||||
|
||||
// fields
|
||||
acf_include('includes/fields.php');
|
||||
acf_include('includes/fields/class-acf-field.php');
|
||||
|
|
@ -145,8 +155,8 @@ class ACF {
|
|||
acf_include('includes/cache.php');
|
||||
acf_include('includes/compatibility.php');
|
||||
acf_include('includes/deprecated.php');
|
||||
acf_include('includes/form.php');
|
||||
acf_include('includes/json.php');
|
||||
acf_include('includes/l10n.php');
|
||||
acf_include('includes/local.php');
|
||||
acf_include('includes/loop.php');
|
||||
acf_include('includes/media.php');
|
||||
|
|
@ -181,6 +191,7 @@ class ACF {
|
|||
acf_include('includes/admin/admin.php');
|
||||
acf_include('includes/admin/admin-field-group.php');
|
||||
acf_include('includes/admin/admin-field-groups.php');
|
||||
acf_include('includes/admin/admin-notices.php');
|
||||
acf_include('includes/admin/admin-tools.php');
|
||||
acf_include('includes/admin/admin-upgrade.php');
|
||||
acf_include('includes/admin/settings-info.php');
|
||||
|
|
@ -190,6 +201,8 @@ class ACF {
|
|||
// pro
|
||||
acf_include('pro/acf-pro.php');
|
||||
|
||||
// Include tests.
|
||||
//acf_include('tests/tests.php');
|
||||
|
||||
// actions
|
||||
add_action('init', array($this, 'init'), 5);
|
||||
|
|
@ -237,7 +250,7 @@ class ACF {
|
|||
|
||||
|
||||
// textdomain
|
||||
$this->load_plugin_textdomain();
|
||||
acf_load_textdomain();
|
||||
|
||||
// include 3rd party support
|
||||
acf_include('includes/third-party.php');
|
||||
|
|
@ -247,11 +260,6 @@ class ACF {
|
|||
acf_include('includes/wpml.php');
|
||||
}
|
||||
|
||||
// include gutenberg
|
||||
if( defined('GUTENBERG_VERSION') ) {
|
||||
acf_include('includes/forms/form-gutenberg.php');
|
||||
}
|
||||
|
||||
// fields
|
||||
acf_include('includes/fields/class-acf-field-text.php');
|
||||
acf_include('includes/fields/class-acf-field-textarea.php');
|
||||
|
|
@ -323,42 +331,6 @@ class ACF {
|
|||
|
||||
// action for 3rd party
|
||||
do_action('acf/init');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* load_plugin_textdomain
|
||||
*
|
||||
* This function will load the textdomain file
|
||||
*
|
||||
* @type function
|
||||
* @date 3/5/17
|
||||
* @since 5.5.13
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function load_plugin_textdomain() {
|
||||
|
||||
// vars
|
||||
$domain = 'acf';
|
||||
$locale = apply_filters( 'plugin_locale', acf_get_locale(), $domain );
|
||||
$mofile = $domain . '-' . $locale . '.mo';
|
||||
|
||||
|
||||
// load from the languages directory first
|
||||
load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile );
|
||||
|
||||
|
||||
// redirect missing translations
|
||||
$mofile = str_replace('fr_CA', 'fr_FR', $mofile);
|
||||
|
||||
|
||||
// load from plugin lang folder
|
||||
load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
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
|
|
@ -2499,10 +2499,10 @@
|
|||
|
||||
})(jQuery);
|
||||
|
||||
// @codekit-prepend "../js/field-group.js";
|
||||
// @codekit-prepend "../js/field-group-field.js";
|
||||
// @codekit-prepend "../js/field-group-settings.js";
|
||||
// @codekit-prepend "../js/field-group-conditions.js";
|
||||
// @codekit-prepend "../js/field-group-fields.js";
|
||||
// @codekit-prepend "../js/field-group-locations.js";
|
||||
// @codekit-prepend "../js/field-group-compatibility.js";
|
||||
// @codekit-prepend "_field-group.js";
|
||||
// @codekit-prepend "_field-group-field.js";
|
||||
// @codekit-prepend "_field-group-settings.js";
|
||||
// @codekit-prepend "_field-group-conditions.js";
|
||||
// @codekit-prepend "_field-group-fields.js";
|
||||
// @codekit-prepend "_field-group-locations.js";
|
||||
// @codekit-prepend "_field-group-compatibility.js";
|
||||
|
|
@ -2100,6 +2100,23 @@
|
|||
return ( window.wp && wp.blocks );
|
||||
};
|
||||
|
||||
/**
|
||||
* acf.objectToArray
|
||||
*
|
||||
* Returns an array of items from the given object.
|
||||
*
|
||||
* @date 20/11/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param object obj The object of items.
|
||||
* @return array
|
||||
*/
|
||||
acf.objectToArray = function( obj ){
|
||||
return Object.keys( obj ).map(function( key ){
|
||||
return obj[key];
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* exists
|
||||
*
|
||||
|
|
@ -3485,7 +3502,15 @@
|
|||
'change form .acf-field': 'startListening',
|
||||
'submit form': 'stopListening'
|
||||
},
|
||||
|
||||
|
||||
enable: function(){
|
||||
this.active = true;
|
||||
},
|
||||
|
||||
disable: function(){
|
||||
this.active = false;
|
||||
},
|
||||
|
||||
reset: function(){
|
||||
this.stopListening();
|
||||
},
|
||||
|
|
@ -3741,12 +3766,7 @@
|
|||
* @return array
|
||||
*/
|
||||
acf.getPostboxes = function(){
|
||||
|
||||
// find all postboxes
|
||||
var $postboxes = $('.acf-postbox');
|
||||
|
||||
// return instances
|
||||
return acf.getInstances( $postboxes );
|
||||
return acf.getInstances( $('.acf-postbox') );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -3782,9 +3802,7 @@
|
|||
key: '',
|
||||
style: 'default',
|
||||
label: 'top',
|
||||
visible: true,
|
||||
edit: '',
|
||||
html: true,
|
||||
edit: ''
|
||||
},
|
||||
|
||||
setup: function( props ){
|
||||
|
|
@ -3805,10 +3823,6 @@
|
|||
return $('#' + this.get('id'));
|
||||
},
|
||||
|
||||
$placeholder: function(){
|
||||
return $('#' + this.get('id') + '-placeholder');
|
||||
},
|
||||
|
||||
$hide: function(){
|
||||
return $('#' + this.get('id') + '-hide');
|
||||
},
|
||||
|
|
@ -3826,11 +3840,7 @@
|
|||
},
|
||||
|
||||
isVisible: function(){
|
||||
return this.get('visible');
|
||||
},
|
||||
|
||||
hasHTML: function(){
|
||||
return this.get('html');
|
||||
return this.$el.hasClass('acf-hidden');
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
|
|
@ -3858,15 +3868,7 @@
|
|||
}
|
||||
|
||||
// Show postbox.
|
||||
if( this.isVisible() ) {
|
||||
this.show();
|
||||
|
||||
// Hide postbox.
|
||||
// Hidden postboxes do not contain HTML and are used as placeholders.
|
||||
} else {
|
||||
this.set('html', false);
|
||||
this.hide();
|
||||
}
|
||||
this.show();
|
||||
},
|
||||
|
||||
show: function(){
|
||||
|
|
@ -3913,9 +3915,6 @@
|
|||
// Update HTML.
|
||||
this.$inside().html( html );
|
||||
|
||||
// Keep a record that this postbox has HTML.
|
||||
this.set('html', true);
|
||||
|
||||
// Do action.
|
||||
acf.doAction('append', this.$el);
|
||||
}
|
||||
|
|
@ -5235,7 +5234,7 @@
|
|||
}
|
||||
|
||||
// add icon
|
||||
$label.prepend('<i class="acf-accordion-icon dashicons dashicons-arrow-' + (this.get('open') ? 'down' : 'right') + '"></i>');
|
||||
$label.prepend( accordionManager.iconHtml({ open: this.get('open') }) );
|
||||
|
||||
// classes
|
||||
// - remove 'inside' which is a #poststuff WP class
|
||||
|
|
@ -5290,11 +5289,24 @@
|
|||
}
|
||||
},
|
||||
|
||||
iconHtml: function( props ){
|
||||
|
||||
// Determine icon.
|
||||
//if( acf.isGutenberg() ) {
|
||||
// var icon = props.open ? 'arrow-up-alt2' : 'arrow-down-alt2';
|
||||
//} else {
|
||||
var icon = props.open ? 'arrow-down' : 'arrow-right';
|
||||
//}
|
||||
|
||||
// Return HTML.
|
||||
return '<i class="acf-accordion-icon dashicons dashicons-' + icon + '"></i>';
|
||||
},
|
||||
|
||||
open: function( $el ){
|
||||
|
||||
// open
|
||||
$el.find('.acf-accordion-content:first').slideDown().css('display', 'block');
|
||||
$el.find('.acf-accordion-icon:first').removeClass('dashicons-arrow-right').addClass('dashicons-arrow-down');
|
||||
$el.find('.acf-accordion-icon:first').replaceWith( this.iconHtml({ open: true }) );
|
||||
$el.addClass('-open');
|
||||
|
||||
// action
|
||||
|
|
@ -5312,7 +5324,7 @@
|
|||
|
||||
// close
|
||||
$el.find('.acf-accordion-content:first').slideUp();
|
||||
$el.find('.acf-accordion-icon:first').removeClass('dashicons-arrow-down').addClass('dashicons-arrow-right');
|
||||
$el.find('.acf-accordion-icon:first').replaceWith( this.iconHtml({ open: false }) );
|
||||
$el.removeClass('-open');
|
||||
|
||||
// action
|
||||
|
|
@ -10857,9 +10869,7 @@
|
|||
|
||||
// add array of existing postboxes to increase performance and reduce JSON HTML
|
||||
acf.getPostboxes().map(function( postbox ){
|
||||
if( postbox.hasHTML() ) {
|
||||
ajaxData.exists.push( postbox.get('key') );
|
||||
}
|
||||
ajaxData.exists.push( postbox.get('key') );
|
||||
});
|
||||
|
||||
// filter
|
||||
|
|
@ -10868,43 +10878,19 @@
|
|||
// success
|
||||
var onSuccess = function( json ){
|
||||
|
||||
// bail early if not success
|
||||
if( !acf.isAjaxSuccess(json) ) {
|
||||
return;
|
||||
// Check success.
|
||||
if( acf.isAjaxSuccess(json) ) {
|
||||
|
||||
// Render post screen.
|
||||
if( acf.get('screen') == 'post' ) {
|
||||
this.renderPostScreen( json.data );
|
||||
|
||||
// Render user screen.
|
||||
} else if( acf.get('screen') == 'user' ) {
|
||||
this.renderUserScreen( json.data );
|
||||
}
|
||||
}
|
||||
|
||||
// vars
|
||||
var visible = [];
|
||||
|
||||
// loop
|
||||
json.data.results.map(function( fieldGroup, i ){
|
||||
|
||||
// vars
|
||||
var id = 'acf-' + fieldGroup.key;
|
||||
var postbox = acf.getPostbox( id );
|
||||
|
||||
// show postbox
|
||||
postbox.showEnable();
|
||||
|
||||
// append
|
||||
visible.push( id );
|
||||
|
||||
// update HTML
|
||||
if( !postbox.hasHTML() && fieldGroup.html ) {
|
||||
postbox.html( fieldGroup.html );
|
||||
}
|
||||
});
|
||||
|
||||
// hide other postboxes
|
||||
acf.getPostboxes().map(function( postbox ){
|
||||
if( visible.indexOf( postbox.get('id') ) === -1 ) {
|
||||
postbox.hideDisable();
|
||||
}
|
||||
});
|
||||
|
||||
// reset style
|
||||
$('#acf-style').html( json.data.style );
|
||||
|
||||
// action
|
||||
acf.doAction('check_screen_complete', json.data, ajaxData);
|
||||
};
|
||||
|
|
@ -10922,6 +10908,162 @@
|
|||
|
||||
onChange: function( e, $el ){
|
||||
this.setTimeout(this.check, 1);
|
||||
},
|
||||
|
||||
renderPostScreen: function( data ){
|
||||
|
||||
// vars
|
||||
var visible = [];
|
||||
|
||||
// Helper function to copy events
|
||||
var copyEvents = function( $from, $to ){
|
||||
var events = $._data($from[0]).events;
|
||||
for( var type in events ) {
|
||||
for( var i = 0; i < events[type].length; i++ ) {
|
||||
$to.on( type, events[type][i].handler );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to sort metabox.
|
||||
var sortMetabox = function( id, ids ){
|
||||
|
||||
// Find position of id within ids.
|
||||
var index = ids.indexOf( id );
|
||||
|
||||
// Bail early if index not found.
|
||||
if( index == -1 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop over metaboxes behind (in reverse order).
|
||||
for( var i = index-1; i >= 0; i-- ) {
|
||||
if( $('#'+ids[i]).length ) {
|
||||
return $('#'+ids[i]).after( $('#'+id) );
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over metaboxes infront.
|
||||
for( var i = index+1; i < ids.length; i++ ) {
|
||||
if( $('#'+ids[i]).length ) {
|
||||
return $('#'+ids[i]).before( $('#'+id) );
|
||||
}
|
||||
}
|
||||
|
||||
// Return false if not sorted.
|
||||
return false;
|
||||
};
|
||||
|
||||
// Show these postboxes.
|
||||
data.results.map(function( result, i ){
|
||||
|
||||
// vars
|
||||
var postbox = acf.getPostbox( result.id );
|
||||
|
||||
// Create postbox if doesn't exist.
|
||||
if( !postbox ) {
|
||||
|
||||
// Create it.
|
||||
var $postbox = $([
|
||||
'<div id="' + result.id + '" class="postbox">',
|
||||
'<button type="button" class="handlediv" aria-expanded="false">',
|
||||
'<span class="screen-reader-text">Toggle panel: ' + result.title + '</span>',
|
||||
'<span class="toggle-indicator" aria-hidden="true"></span>',
|
||||
'</button>',
|
||||
'<h2 class="hndle ui-sortable-handle">',
|
||||
'<span>' + result.title + '</span>',
|
||||
'</h2>',
|
||||
'<div class="inside">',
|
||||
result.html,
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
|
||||
// Create new hide toggle.
|
||||
if( $('#adv-settings').length ) {
|
||||
var $prefs = $('#adv-settings .metabox-prefs');
|
||||
var $label = $([
|
||||
'<label for="' + result.id + '-hide">',
|
||||
'<input class="hide-postbox-tog" name="' + result.id + '-hide" type="checkbox" id="' + result.id + '-hide" value="' + result.id + '" checked="checked">',
|
||||
' ' + result.title,
|
||||
'</label>'
|
||||
].join(''));
|
||||
|
||||
// Copy default WP events onto checkbox.
|
||||
copyEvents( $prefs.find('input').first(), $label.find('input') );
|
||||
|
||||
// Append hide label
|
||||
$prefs.append( $label );
|
||||
}
|
||||
|
||||
// Append metabox to the bottom of "side-sortables".
|
||||
if( result.position === 'side' ) {
|
||||
$('#' + result.position + '-sortables').append( $postbox );
|
||||
|
||||
// Prepend metabox to the top of "normal-sortbables".
|
||||
} else {
|
||||
$('#' + result.position + '-sortables').prepend( $postbox );
|
||||
}
|
||||
|
||||
// Position metabox amongst existing ACF metaboxes within the same location.
|
||||
var order = [];
|
||||
data.results.map(function( _result ){
|
||||
if( result.position === _result.position && $('#' + result.position + '-sortables #' + _result.id).length ) {
|
||||
order.push( _result.id );
|
||||
}
|
||||
});
|
||||
sortMetabox(result.id, order)
|
||||
|
||||
// Check 'sorted' for user preference.
|
||||
if( data.sorted ) {
|
||||
|
||||
// Loop over each position (acf_after_title, side, normal).
|
||||
for( var position in data.sorted ) {
|
||||
|
||||
// Explode string into array of ids.
|
||||
var order = data.sorted[position].split(',');
|
||||
|
||||
// Position metabox relative to order.
|
||||
if( sortMetabox(result.id, order) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Copy default WP events onto metabox.
|
||||
var $submitdiv = $('#submitdiv');
|
||||
if( $('#submitdiv').length ) {
|
||||
copyEvents( $submitdiv.children('.handlediv'), $postbox.children('.handlediv') );
|
||||
copyEvents( $submitdiv.children('.hndle'), $postbox.children('.hndle') );
|
||||
}
|
||||
|
||||
// Trigger action.
|
||||
acf.doAction('append', $postbox);
|
||||
|
||||
// Initalize it.
|
||||
postbox = acf.newPostbox( result );
|
||||
}
|
||||
|
||||
// show postbox
|
||||
postbox.showEnable();
|
||||
|
||||
// append
|
||||
visible.push( result.id );
|
||||
});
|
||||
|
||||
// Hide these postboxes.
|
||||
acf.getPostboxes().map(function( postbox ){
|
||||
if( visible.indexOf( postbox.get('id') ) === -1 ) {
|
||||
postbox.hideDisable();
|
||||
}
|
||||
});
|
||||
|
||||
// Update style.
|
||||
$('#acf-style').html( data.style );
|
||||
},
|
||||
|
||||
renderUserScreen: function( json ){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -11025,7 +11167,10 @@
|
|||
taxonomies.map(function( taxonomy ){
|
||||
|
||||
// Append selected taxonomies to terms object.
|
||||
terms[ taxonomy.slug ] = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomy.rest_base );
|
||||
var postTerms = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomy.rest_base );
|
||||
if( postTerms ) {
|
||||
terms[ taxonomy.slug ] = postTerms;
|
||||
}
|
||||
});
|
||||
|
||||
// return
|
||||
|
|
@ -12558,7 +12703,7 @@
|
|||
acf.lockForm( this.$el );
|
||||
|
||||
// loading callback
|
||||
args.loading( this.$el );
|
||||
args.loading( this.$el, this );
|
||||
|
||||
// update status
|
||||
this.set('status', 'validating');
|
||||
|
|
@ -12572,7 +12717,7 @@
|
|||
}
|
||||
|
||||
// filter
|
||||
var data = acf.applyFilters('validation_complete', json.data, this.$el);
|
||||
var data = acf.applyFilters('validation_complete', json.data, this.$el, this);
|
||||
|
||||
// add errors
|
||||
if( !data.valid ) {
|
||||
|
|
@ -12593,13 +12738,13 @@
|
|||
this.set('status', 'invalid');
|
||||
|
||||
// action
|
||||
acf.doAction('validation_failure', this.$el);
|
||||
acf.doAction('validation_failure', this.$el, this);
|
||||
|
||||
// display errors
|
||||
this.showErrors();
|
||||
|
||||
// failure callback
|
||||
args.failure( this.$el );
|
||||
args.failure( this.$el, this );
|
||||
|
||||
// success
|
||||
} else {
|
||||
|
|
@ -12617,11 +12762,11 @@
|
|||
}
|
||||
|
||||
// action
|
||||
acf.doAction('validation_success', this.$el);
|
||||
acf.doAction('validation_success', this.$el, this);
|
||||
acf.doAction('submit', this.$el);
|
||||
|
||||
// success callback (submit form)
|
||||
args.success( this.$el );
|
||||
args.success( this.$el, this );
|
||||
|
||||
// lock form
|
||||
acf.lockForm( this.$el );
|
||||
|
|
@ -12633,7 +12778,7 @@
|
|||
}
|
||||
|
||||
// complete callback
|
||||
args.complete( this.$el );
|
||||
args.complete( this.$el, this );
|
||||
|
||||
// clear errors
|
||||
this.clearErrors();
|
||||
|
|
@ -12653,6 +12798,9 @@
|
|||
success: onSuccess,
|
||||
complete: onComplete
|
||||
});
|
||||
|
||||
// return false to fail validation and allow AJAX
|
||||
return false
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -12924,6 +13072,7 @@
|
|||
events: {
|
||||
'click input[type="submit"]': 'onClickSubmit',
|
||||
'click button[type="submit"]': 'onClickSubmit',
|
||||
//'click #editor .editor-post-publish-button': 'onClickSubmitGutenberg',
|
||||
'click #save-post': 'onClickSave',
|
||||
'mousedown #post-preview': 'onClickPreview', // use mousedown to hook in before WP click event
|
||||
'submit form': 'onSubmit',
|
||||
|
|
@ -13109,6 +13258,39 @@
|
|||
$('form#post').off('submit.edit-post');
|
||||
},
|
||||
|
||||
/**
|
||||
* onClickSubmitGutenberg
|
||||
*
|
||||
* Custom validation event for the gutenberg editor.
|
||||
*
|
||||
* @date 29/10/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param object e The event object.
|
||||
* @param jQuery $el The input element.
|
||||
* @return void
|
||||
*/
|
||||
onClickSubmitGutenberg: function( e, $el ){
|
||||
|
||||
// validate
|
||||
var valid = acf.validateForm({
|
||||
form: $('#editor'),
|
||||
event: e,
|
||||
reset: true,
|
||||
failure: function( $form, validator ){
|
||||
var $notice = validator.get('notice').$el;
|
||||
$notice.appendTo('.components-notice-list');
|
||||
$notice.find('.acf-notice-dismiss').removeClass('small');
|
||||
}
|
||||
});
|
||||
|
||||
// if not valid, stop event and allow validation to continue
|
||||
if( !valid ) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* onSubmit
|
||||
*
|
||||
|
|
@ -13204,7 +13386,7 @@
|
|||
|
||||
// replace $placeholder children with a single td
|
||||
// fixes "width calculation issues" due to conditional logic hiding some children
|
||||
$placeholder.html('<td style="padding:0;" colspan="100"></td>');
|
||||
$placeholder.html('<td style="padding:0;" colspan="' + $placeholder.children().length + '"></td>');
|
||||
|
||||
// add helper class to remove absolute positioning
|
||||
$item.addClass('acf-sortable-tr-helper');
|
||||
|
|
@ -14249,48 +14431,48 @@
|
|||
|
||||
})(jQuery);
|
||||
|
||||
// @codekit-prepend "../js/acf.js";
|
||||
// @codekit-prepend "../js/acf-hooks.js";
|
||||
// @codekit-prepend "../js/acf-model.js";
|
||||
// @codekit-prepend "../js/acf-popup.js";
|
||||
// @codekit-prepend "../js/acf-unload.js";
|
||||
// @codekit-prepend "../js/acf-panel.js";
|
||||
// @codekit-prepend "../js/acf-notice.js";
|
||||
// @codekit-prepend "../js/acf-postbox.js";
|
||||
// @codekit-prepend "../js/acf-tooltip.js";
|
||||
// @codekit-prepend "../js/acf-field.js";
|
||||
// @codekit-prepend "../js/acf-fields.js";
|
||||
// @codekit-prepend "../js/acf-field-accordion.js";
|
||||
// @codekit-prepend "../js/acf-field-button-group.js";
|
||||
// @codekit-prepend "../js/acf-field-checkbox.js";
|
||||
// @codekit-prepend "../js/acf-field-color-picker.js";
|
||||
// @codekit-prepend "../js/acf-field-date-picker.js";
|
||||
// @codekit-prepend "../js/acf-field-date-time-picker.js";
|
||||
// @codekit-prepend "../js/acf-field-google-map.js";
|
||||
// @codekit-prepend "../js/acf-field-image.js";
|
||||
// @codekit-prepend "../js/acf-field-file.js";
|
||||
// @codekit-prepend "../js/acf-field-link.js";
|
||||
// @codekit-prepend "../js/acf-field-oembed.js";
|
||||
// @codekit-prepend "../js/acf-field-radio.js";
|
||||
// @codekit-prepend "../js/acf-field-range.js";
|
||||
// @codekit-prepend "../js/acf-field-relationship.js";
|
||||
// @codekit-prepend "../js/acf-field-select.js";
|
||||
// @codekit-prepend "../js/acf-field-tab.js";
|
||||
// @codekit-prepend "../js/acf-field-post-object.js";
|
||||
// @codekit-prepend "../js/acf-field-page-link.js";
|
||||
// @codekit-prepend "../js/acf-field-user.js";
|
||||
// @codekit-prepend "../js/acf-field-taxonomy.js";
|
||||
// @codekit-prepend "../js/acf-field-time-picker.js";
|
||||
// @codekit-prepend "../js/acf-field-true-false.js";
|
||||
// @codekit-prepend "../js/acf-field-url.js";
|
||||
// @codekit-prepend "../js/acf-field-wysiwyg.js";
|
||||
// @codekit-prepend "../js/acf-condition.js";
|
||||
// @codekit-prepend "../js/acf-conditions.js";
|
||||
// @codekit-prepend "../js/acf-condition-types.js";
|
||||
// @codekit-prepend "../js/acf-media.js";
|
||||
// @codekit-prepend "../js/acf-screen.js";
|
||||
// @codekit-prepend "../js/acf-select2.js";
|
||||
// @codekit-prepend "../js/acf-tinymce.js";
|
||||
// @codekit-prepend "../js/acf-validation.js";
|
||||
// @codekit-prepend "../js/acf-helpers.js";
|
||||
// @codekit-prepend "../js/acf-compatibility";
|
||||
// @codekit-prepend "_acf.js";
|
||||
// @codekit-prepend "_acf-hooks.js";
|
||||
// @codekit-prepend "_acf-model.js";
|
||||
// @codekit-prepend "_acf-popup.js";
|
||||
// @codekit-prepend "_acf-unload.js";
|
||||
// @codekit-prepend "_acf-panel.js";
|
||||
// @codekit-prepend "_acf-notice.js";
|
||||
// @codekit-prepend "_acf-postbox.js";
|
||||
// @codekit-prepend "_acf-tooltip.js";
|
||||
// @codekit-prepend "_acf-field.js";
|
||||
// @codekit-prepend "_acf-fields.js";
|
||||
// @codekit-prepend "_acf-field-accordion.js";
|
||||
// @codekit-prepend "_acf-field-button-group.js";
|
||||
// @codekit-prepend "_acf-field-checkbox.js";
|
||||
// @codekit-prepend "_acf-field-color-picker.js";
|
||||
// @codekit-prepend "_acf-field-date-picker.js";
|
||||
// @codekit-prepend "_acf-field-date-time-picker.js";
|
||||
// @codekit-prepend "_acf-field-google-map.js";
|
||||
// @codekit-prepend "_acf-field-image.js";
|
||||
// @codekit-prepend "_acf-field-file.js";
|
||||
// @codekit-prepend "_acf-field-link.js";
|
||||
// @codekit-prepend "_acf-field-oembed.js";
|
||||
// @codekit-prepend "_acf-field-radio.js";
|
||||
// @codekit-prepend "_acf-field-range.js";
|
||||
// @codekit-prepend "_acf-field-relationship.js";
|
||||
// @codekit-prepend "_acf-field-select.js";
|
||||
// @codekit-prepend "_acf-field-tab.js";
|
||||
// @codekit-prepend "_acf-field-post-object.js";
|
||||
// @codekit-prepend "_acf-field-page-link.js";
|
||||
// @codekit-prepend "_acf-field-user.js";
|
||||
// @codekit-prepend "_acf-field-taxonomy.js";
|
||||
// @codekit-prepend "_acf-field-time-picker.js";
|
||||
// @codekit-prepend "_acf-field-true-false.js";
|
||||
// @codekit-prepend "_acf-field-url.js";
|
||||
// @codekit-prepend "_acf-field-wysiwyg.js";
|
||||
// @codekit-prepend "_acf-condition.js";
|
||||
// @codekit-prepend "_acf-conditions.js";
|
||||
// @codekit-prepend "_acf-condition-types.js";
|
||||
// @codekit-prepend "_acf-media.js";
|
||||
// @codekit-prepend "_acf-screen.js";
|
||||
// @codekit-prepend "_acf-select2.js";
|
||||
// @codekit-prepend "_acf-tinymce.js";
|
||||
// @codekit-prepend "_acf-validation.js";
|
||||
// @codekit-prepend "_acf-helpers.js";
|
||||
// @codekit-prepend "_acf-compatibility";
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* acf_instances
|
||||
*
|
||||
* Initialize $acf_instances if it has not been set.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function acf_instances() {
|
||||
|
||||
// Globals.
|
||||
global $acf_instances;
|
||||
|
||||
// Initialize only once.
|
||||
if( !isset($acf_instances) ) {
|
||||
$acf_instances = new ACF_Data();
|
||||
}
|
||||
|
||||
// Return.
|
||||
return $acf_instances;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_new_instance
|
||||
*
|
||||
* Creates a new instance of the given class and stores it in the instances data store.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $class The class name.
|
||||
* @return object The instance.
|
||||
*/
|
||||
function acf_new_instance( $class = '' ) {
|
||||
|
||||
// Create instance.
|
||||
$instance = new $class();
|
||||
|
||||
// Register instance.
|
||||
acf_instances()->set( $class, $instance );
|
||||
|
||||
// Return instance.
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_instance
|
||||
*
|
||||
* Returns an instance for the given class.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $class The class name.
|
||||
* @return object The instance.
|
||||
*/
|
||||
function acf_get_instance( $class = '' ) {
|
||||
return acf_instances()->get( $class );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_register_store
|
||||
*
|
||||
* Registers a data store.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $name The store name.
|
||||
* @param array $data Array of data to start the store with.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function acf_register_store( $name = '', $data = false ) {
|
||||
|
||||
// Create store.
|
||||
$store = new ACF_Data( $data );
|
||||
|
||||
// Register store.
|
||||
acf_instances()->set( "ACF_Store_$name", $store );
|
||||
|
||||
// Return store.
|
||||
return $store;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_store
|
||||
*
|
||||
* Returns a data store.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $name The store name.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function acf_get_store( $name = '' ) {
|
||||
return acf_instances()->get( "ACF_Store_$name" );
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
// Register store for form data.
|
||||
acf_register_store( 'form' );
|
||||
|
||||
/**
|
||||
* acf_set_form_data
|
||||
*
|
||||
* Sets data about the current form.
|
||||
*
|
||||
* @date 6/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $name The store name.
|
||||
* @param array $data Array of data to start the store with.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function acf_set_form_data( $name = '', $data = false ) {
|
||||
return acf_get_store( 'form' )->set( $name, $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_form_data
|
||||
*
|
||||
* Gets data about the current form.
|
||||
*
|
||||
* @date 6/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $name The store name.
|
||||
* @return mixed
|
||||
*/
|
||||
function acf_get_form_data( $name = '' ) {
|
||||
return acf_get_store( 'form' )->get( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_form_data
|
||||
*
|
||||
* Called within a form to set important information and render hidden inputs.
|
||||
*
|
||||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function acf_form_data( $data = array() ) {
|
||||
|
||||
// Apply defaults.
|
||||
$data = wp_parse_args($data, array(
|
||||
|
||||
/** @type string The current screen (post, user, taxonomy, etc). */
|
||||
'screen' => 'post',
|
||||
|
||||
/** @type int|string The ID of current post being edited. */
|
||||
'post_id' => 0,
|
||||
|
||||
/** @type bool Enables AJAX validation. */
|
||||
'validation' => true,
|
||||
));
|
||||
|
||||
// Create nonce using screen.
|
||||
$data['nonce'] = wp_create_nonce( $data['screen'] );
|
||||
|
||||
// Append "changed" input used within "_wp_post_revision_fields" action.
|
||||
$data['changed'] = 0;
|
||||
|
||||
// Set data.
|
||||
acf_set_form_data( $data );
|
||||
|
||||
// Render HTML.
|
||||
?>
|
||||
<div id="acf-form-data" class="acf-hidden">
|
||||
<?php
|
||||
|
||||
// Create hidden inputs from $data
|
||||
foreach( $data as $name => $value ) {
|
||||
acf_hidden_input(array(
|
||||
'id' => '_acf_' . $name,
|
||||
'name' => '_acf_' . $name,
|
||||
'value' => $value
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires within the #acf-form-data element to add extra HTML.
|
||||
*
|
||||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*/
|
||||
do_action( 'acf/form_data', $data );
|
||||
do_action( 'acf/input/form_data', $data );
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* acf_save_post
|
||||
*
|
||||
* Saves the $_POST data.
|
||||
*
|
||||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @param array $values An array of values to override $_POST.
|
||||
* @return bool True if save was successful.
|
||||
*/
|
||||
function acf_save_post( $post_id = 0, $values = null ) {
|
||||
|
||||
// Override $_POST data with $values.
|
||||
if( $values !== null ) {
|
||||
$_POST['acf'] = $values;
|
||||
}
|
||||
|
||||
// Bail early if no data to save.
|
||||
if( empty($_POST['acf']) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set form data (useful in various filters/actions).
|
||||
acf_set_form_data( 'post_id', $post_id );
|
||||
|
||||
// Filter $_POST data for users without the 'unfiltered_html' capability.
|
||||
if( !acf_allow_unfiltered_html() ) {
|
||||
$_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
|
||||
}
|
||||
|
||||
// Do generic action.
|
||||
do_action( 'acf/save_post', $post_id );
|
||||
|
||||
// Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* _acf_do_save_post
|
||||
*
|
||||
* Private function hooked into 'acf/save_post' to actually save the $_POST data.
|
||||
* This allows developers to hook in before and after ACF has actually saved the data.
|
||||
*
|
||||
* @date 11/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param int|string $post_id The post id.
|
||||
* @return void
|
||||
*/
|
||||
function _acf_do_save_post( $post_id = 0 ) {
|
||||
|
||||
// Check $_POST data.
|
||||
if( $_POST['acf'] ) {
|
||||
|
||||
// Loop over posted values.
|
||||
foreach( $_POST['acf'] as $key => $value ) {
|
||||
|
||||
// Get field.
|
||||
$field = acf_get_field( $key );
|
||||
|
||||
// Update value.
|
||||
if( $field ) {
|
||||
acf_update_value( $value, $post_id, $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run during generic action.
|
||||
add_action( 'acf/save_post', '_acf_do_save_post' );
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* acf_uniqid
|
||||
*
|
||||
* Returns a unique numeric based id.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $prefix The id prefix. Defaults to 'acf'.
|
||||
* @return string
|
||||
*/
|
||||
function acf_uniqid( $prefix = 'acf' ) {
|
||||
|
||||
// Instantiate global counter.
|
||||
global $acf_uniqid;
|
||||
if( !isset($acf_uniqid) ) {
|
||||
$acf_uniqid = 1;
|
||||
}
|
||||
|
||||
// Return id.
|
||||
return $prefix . '-' . $acf_uniqid++;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* acf_get_users
|
||||
*
|
||||
* Similar to the get_users() function but with extra functionality.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param array $args The query args.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_users( $args = array() ) {
|
||||
|
||||
// Get users.
|
||||
$users = get_users( $args );
|
||||
|
||||
// Maintain order.
|
||||
if( $users && $args['include'] ) {
|
||||
|
||||
// Generate order array.
|
||||
$order = array();
|
||||
foreach( $users as $i => $user ) {
|
||||
$order[ $i ] = array_search($user->ID, $args['include']);
|
||||
}
|
||||
|
||||
// Sort results.
|
||||
array_multisort($order, $users);
|
||||
}
|
||||
|
||||
// Return
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_allow_unfiltered_html
|
||||
*
|
||||
* Returns true if the current user is allowed to save unfiltered HTML.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return bool
|
||||
*/
|
||||
function acf_allow_unfiltered_html() {
|
||||
|
||||
// Check capability.
|
||||
$allow_unfiltered_html = current_user_can('unfiltered_html');
|
||||
|
||||
/**
|
||||
* Filters whether the current user is allowed to save unfiltered HTML.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param bool allow_unfiltered_html The result.
|
||||
*/
|
||||
return apply_filters( 'acf/allow_unfiltered_html', $allow_unfiltered_html );
|
||||
}
|
||||
|
|
@ -145,23 +145,25 @@ class acf_admin_field_groups {
|
|||
|
||||
function check_duplicate() {
|
||||
|
||||
// message
|
||||
// Display notice
|
||||
if( $ids = acf_maybe_get_GET('acfduplicatecomplete') ) {
|
||||
|
||||
// explode
|
||||
$ids = explode(',', $ids);
|
||||
$total = count($ids);
|
||||
|
||||
if( $total == 1 ) {
|
||||
|
||||
acf_add_admin_notice( sprintf(__('Field group duplicated. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>') );
|
||||
|
||||
} else {
|
||||
|
||||
acf_add_admin_notice( sprintf(_n( '%s field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total) );
|
||||
|
||||
}
|
||||
// Generate text.
|
||||
$text = sprintf( _n( 'Field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total );
|
||||
|
||||
// Add links to text.
|
||||
$links = array();
|
||||
foreach( $ids as $id ) {
|
||||
$links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
|
||||
}
|
||||
$text .= ' ' . implode( ', ', $links );
|
||||
|
||||
// Add notice
|
||||
acf_add_admin_notice( $text, 'success' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -230,23 +232,25 @@ class acf_admin_field_groups {
|
|||
|
||||
function check_sync() {
|
||||
|
||||
// message
|
||||
// Display notice
|
||||
if( $ids = acf_maybe_get_GET('acfsynccomplete') ) {
|
||||
|
||||
// explode
|
||||
$ids = explode(',', $ids);
|
||||
$total = count($ids);
|
||||
|
||||
if( $total == 1 ) {
|
||||
|
||||
acf_add_admin_notice( sprintf(__('Field group synchronised. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>') );
|
||||
|
||||
} else {
|
||||
|
||||
acf_add_admin_notice( sprintf(_n( '%s field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total) );
|
||||
|
||||
}
|
||||
// Generate text.
|
||||
$text = sprintf( _n( 'Field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total );
|
||||
|
||||
// Add links to text.
|
||||
$links = array();
|
||||
foreach( $ids as $id ) {
|
||||
$links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
|
||||
}
|
||||
$text .= ' ' . implode( ', ', $links );
|
||||
|
||||
// Add notice
|
||||
acf_add_admin_notice( $text, 'success' );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
/**
|
||||
* ACF Admin Notices
|
||||
*
|
||||
* Functions and classes to manage admin notices.
|
||||
*
|
||||
* @date 10/1/19
|
||||
* @since 5.7.10
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if( !defined('ABSPATH') ) exit;
|
||||
|
||||
// Register notices store.
|
||||
acf_register_store( 'notices' );
|
||||
|
||||
/**
|
||||
* ACF_Admin_Notice
|
||||
*
|
||||
* Class used to create an admin notice.
|
||||
*
|
||||
* @date 10/1/19
|
||||
* @since 5.7.10
|
||||
*/
|
||||
if( ! class_exists('ACF_Admin_Notice') ) :
|
||||
|
||||
class ACF_Admin_Notice extends ACF_Data {
|
||||
|
||||
/** @var array Storage for data. */
|
||||
var $data = array(
|
||||
|
||||
/** @type string Text displayed in notice. */
|
||||
'text' => '',
|
||||
|
||||
/** @type string Optional HTML alternative to text.
|
||||
'html' => '', */
|
||||
|
||||
/** @type string The type of notice (warning, error, success, info). */
|
||||
'type' => 'info',
|
||||
|
||||
/** @type bool If the notice can be dismissed. */
|
||||
'dismissible' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* render
|
||||
*
|
||||
* Renders the notice HTML.
|
||||
*
|
||||
* @date 27/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function render() {
|
||||
|
||||
// Ensure text contains punctuation.
|
||||
// todo: Remove this after updating translations.
|
||||
$text = $this->get('text');
|
||||
if( substr($text, -1) !== '.' && substr($text, -1) !== '>' ) {
|
||||
$text .= '.';
|
||||
}
|
||||
|
||||
// Print HTML.
|
||||
printf('<div class="acf-admin-notice notice notice-%s %s">%s</div>',
|
||||
|
||||
// Type class.
|
||||
$this->get('type'),
|
||||
|
||||
// Dismissible class.
|
||||
$this->get('dismissible') ? 'is-dismissible' : '',
|
||||
|
||||
// InnerHTML
|
||||
$this->has('html') ? $this->get('html') : wpautop($text)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
/**
|
||||
* acf_new_admin_notice
|
||||
*
|
||||
* Instantiates and returns a new model.
|
||||
*
|
||||
* @date 23/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param array $data Optional data to set.
|
||||
* @return ACF_Admin_Notice
|
||||
*/
|
||||
function acf_new_admin_notice( $data = false ) {
|
||||
|
||||
// Create notice.
|
||||
$instance = new ACF_Admin_Notice( $data );
|
||||
|
||||
// Register notice.
|
||||
acf_get_store( 'notices' )->set( $instance->cid, $instance );
|
||||
|
||||
// Return notice.
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_render_admin_notices
|
||||
*
|
||||
* Renders all admin notices HTML.
|
||||
*
|
||||
* @date 10/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function acf_render_admin_notices() {
|
||||
|
||||
// Get notices.
|
||||
$notices = acf_get_store( 'notices' )->get_data();
|
||||
|
||||
// Loop over notices and render.
|
||||
if( $notices ) {
|
||||
foreach( $notices as $notice ) {
|
||||
$notice->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render notices during admin action.
|
||||
add_action('admin_notices', 'acf_render_admin_notices', 99);
|
||||
|
||||
/**
|
||||
* acf_add_admin_notice
|
||||
*
|
||||
* Creates and returns a new notice.
|
||||
*
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $text The admin notice text.
|
||||
* @param string $class The type of notice (warning, error, success, info).
|
||||
* @return ACF_Admin_Notice
|
||||
*/
|
||||
function acf_add_admin_notice( $text = '', $type = 'info' ) {
|
||||
return acf_new_admin_notice( array( 'text' => $text, 'type' => $type ) );
|
||||
}
|
||||
|
|
@ -6,10 +6,6 @@ if( ! class_exists('acf_admin') ) :
|
|||
|
||||
class acf_admin {
|
||||
|
||||
// vars
|
||||
var $notices = array();
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
|
|
@ -28,63 +24,8 @@ class acf_admin {
|
|||
// actions
|
||||
add_action('admin_menu', array($this, 'admin_menu'));
|
||||
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 0);
|
||||
add_action('admin_notices', array($this, 'admin_notices'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* add_notice
|
||||
*
|
||||
* This function will add the notice data to a setting in the acf object for the admin_notices action to use
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $text (string)
|
||||
* @param $class (string)
|
||||
* @param wrap (string)
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function add_notice( $text = '', $class = '', $wrap = 'p' ) {
|
||||
|
||||
// append
|
||||
$this->notices[] = array(
|
||||
'text' => $text,
|
||||
'class' => 'updated ' . $class,
|
||||
'wrap' => $wrap
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_notices
|
||||
*
|
||||
* This function will return an array of admin notices
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function get_notices() {
|
||||
|
||||
// bail early if no notices
|
||||
if( empty($this->notices) ) return false;
|
||||
|
||||
|
||||
// return
|
||||
return $this->notices;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_menu
|
||||
*
|
||||
|
|
@ -138,52 +79,6 @@ class acf_admin {
|
|||
wp_enqueue_style( 'acf-global' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_notices
|
||||
*
|
||||
* This function will render any admin notices
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function admin_notices() {
|
||||
|
||||
// vars
|
||||
$notices = $this->get_notices();
|
||||
|
||||
|
||||
// bail early if no notices
|
||||
if( !$notices ) return;
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $notices as $notice ) {
|
||||
|
||||
$open = '';
|
||||
$close = '';
|
||||
|
||||
if( $notice['wrap'] ) {
|
||||
|
||||
$open = "<{$notice['wrap']}>";
|
||||
$close = "</{$notice['wrap']}>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="acf-admin-notice notice is-dismissible <?php echo esc_attr($notice['class']); ?>"><?php echo $open . $notice['text'] . $close; ?></div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// initialize
|
||||
|
|
@ -191,45 +86,4 @@ acf()->admin = new acf_admin();
|
|||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
/*
|
||||
* acf_add_admin_notice
|
||||
*
|
||||
* This function will add the notice data to a setting in the acf object for the admin_notices action to use
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $text (string)
|
||||
* @param $class (string)
|
||||
* @return (int) message ID (array position)
|
||||
*/
|
||||
|
||||
function acf_add_admin_notice( $text, $class = '', $wrap = 'p' ) {
|
||||
|
||||
return acf()->admin->add_notice($text, $class, $wrap);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_admin_notices
|
||||
*
|
||||
* This function will return an array containing any admin notices
|
||||
*
|
||||
* @type function
|
||||
* @date 17/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function acf_get_admin_notices() {
|
||||
|
||||
return acf()->admin->get_notices();
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<?php
|
||||
|
||||
class acf_settings_addons {
|
||||
|
||||
var $view;
|
||||
|
||||
|
||||
/*
|
||||
* __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' ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
// add page
|
||||
$page = add_submenu_page('edit.php?post_type=acf-field-group', __('Add-ons','acf'), __('Add-ons','acf'), acf_get_setting('capability'),'acf-settings-addons', 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() {
|
||||
|
||||
// vars
|
||||
$this->view = array(
|
||||
'json' => array(),
|
||||
);
|
||||
|
||||
|
||||
// load json
|
||||
$request = wp_remote_post( 'https://assets.advancedcustomfields.com/add-ons/add-ons.json' );
|
||||
|
||||
// validate
|
||||
if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200)
|
||||
{
|
||||
acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view['json'] = json_decode( $request['body'], true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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('settings-addons', $this->view);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
new acf_settings_addons();
|
||||
|
||||
?>
|
||||
|
|
@ -94,7 +94,7 @@ class ACF_Admin_Tool_Export extends ACF_Admin_Tool {
|
|||
|
||||
// validate
|
||||
if( $json === false ) {
|
||||
return acf_add_admin_notice( __("No field groups selected", 'acf') , 'error');
|
||||
return acf_add_admin_notice( __("No field groups selected", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class ACF_Admin_Tool_Export extends ACF_Admin_Tool {
|
|||
|
||||
// validate
|
||||
if( !$keys ) {
|
||||
return acf_add_admin_notice( __("No field groups selected", 'acf') , 'error');
|
||||
return acf_add_admin_notice( __("No field groups selected", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -171,8 +171,8 @@ class ACF_Admin_Tool_Export extends ACF_Admin_Tool {
|
|||
// add notice
|
||||
if( $selected ) {
|
||||
$count = count($selected);
|
||||
$message = sprintf( _n( 'Exported 1 field group.', 'Exported %s field groups.', $count, 'acf' ), $count );
|
||||
acf_add_admin_notice( $message );
|
||||
$text = sprintf( _n( 'Exported 1 field group.', 'Exported %s field groups.', $count, 'acf' ), $count );
|
||||
acf_add_admin_notice( $text, 'success' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,10 +96,7 @@ class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
|
|||
|
||||
// validate
|
||||
if( empty($_FILES['acf_import_file']['size']) ) {
|
||||
|
||||
acf_add_admin_notice( __("No file selected", 'acf') , 'error');
|
||||
return;
|
||||
|
||||
return acf_add_admin_notice( __("No file selected", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -109,19 +106,13 @@ class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
|
|||
|
||||
// validate error
|
||||
if( $file['error'] ) {
|
||||
|
||||
acf_add_admin_notice(__('Error uploading file. Please try again', 'acf'), 'error');
|
||||
return;
|
||||
|
||||
return acf_add_admin_notice( __("Error uploading file. Please try again", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
// validate type
|
||||
if( pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json' ) {
|
||||
|
||||
acf_add_admin_notice(__('Incorrect file type', 'acf'), 'error');
|
||||
return;
|
||||
|
||||
return acf_add_admin_notice( __("Incorrect file type", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -135,10 +126,7 @@ class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
|
|||
|
||||
// validate json
|
||||
if( empty($json) ) {
|
||||
|
||||
acf_add_admin_notice(__('Import file empty', 'acf'), 'error');
|
||||
return;
|
||||
|
||||
return acf_add_admin_notice( __("Import file empty", 'acf'), 'warning' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -260,8 +248,7 @@ class ACF_Admin_Tool_Import extends ACF_Admin_Tool {
|
|||
|
||||
|
||||
// add notice
|
||||
acf_add_admin_notice( $message );
|
||||
|
||||
acf_add_admin_notice( $message, 'success' );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
|||
));
|
||||
|
||||
// vars
|
||||
$json = array(
|
||||
$response = array(
|
||||
'results' => array(),
|
||||
'style' => ''
|
||||
);
|
||||
|
|
@ -45,42 +45,50 @@ class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
|||
|
||||
// loop through field groups
|
||||
if( $field_groups ) {
|
||||
foreach( $field_groups as $i => $field_group ) {
|
||||
|
||||
// vars
|
||||
$item = array(
|
||||
'key' => $field_group['key'],
|
||||
'title' => $field_group['title'],
|
||||
'html' => ''
|
||||
);
|
||||
|
||||
// append first field group's style
|
||||
if( $i == 0 ) {
|
||||
$json['style'] = acf_get_field_group_style( $field_group );
|
||||
foreach( $field_groups as $i => $field_group ) {
|
||||
|
||||
// vars
|
||||
$item = array(
|
||||
'id' => 'acf-' . $field_group['key'],
|
||||
'key' => $field_group['key'],
|
||||
'title' => $field_group['title'],
|
||||
'position' => $field_group['position'],
|
||||
'style' => $field_group['style'],
|
||||
'label' => $field_group['label_placement'],
|
||||
'edit' => acf_get_field_group_edit_link( $field_group['ID'] ),
|
||||
'html' => ''
|
||||
);
|
||||
|
||||
// append html if doesnt already exist on page
|
||||
if( !in_array($field_group['key'], $args['exists']) ) {
|
||||
|
||||
// load fields
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
// get field HTML
|
||||
ob_start();
|
||||
|
||||
// render
|
||||
acf_render_fields( $fields, $args['post_id'], 'div', $field_group['instruction_placement'] );
|
||||
|
||||
$item['html'] = ob_get_clean();
|
||||
}
|
||||
|
||||
// append
|
||||
$response['results'][] = $item;
|
||||
}
|
||||
|
||||
// append html if doesnt already exist on page
|
||||
if( !in_array($field_group['key'], $args['exists']) ) {
|
||||
|
||||
// load fields
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
// get field HTML
|
||||
ob_start();
|
||||
|
||||
// render
|
||||
acf_render_fields( $fields, $args['post_id'], 'div', $field_group['instruction_placement'] );
|
||||
|
||||
$item['html'] = ob_get_clean();
|
||||
}
|
||||
|
||||
// append
|
||||
$json['results'][] = $item;
|
||||
}}
|
||||
// Get style from first field group.
|
||||
$response['style'] = acf_get_field_group_style( $field_groups[0] );
|
||||
}
|
||||
|
||||
// Custom metabox order.
|
||||
if( $this->get('screen') == 'post' ) {
|
||||
$response['sorted'] = get_user_option('meta-box-order_' . $this->get('post_type'));
|
||||
}
|
||||
|
||||
// return
|
||||
return $json;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,41 +243,6 @@ function acf_set_data( $name, $value ) {
|
|||
return acf()->set_data( $name, $value );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* acf_new_instance
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @date 13/2/18
|
||||
* @since 5.6.5
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
|
||||
function acf_new_instance( $class ) {
|
||||
return acf()->new_instance( $class );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* acf_get_instance
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @date 13/2/18
|
||||
* @since 5.6.5
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
|
||||
function acf_get_instance( $class ) {
|
||||
return acf()->get_instance( $class );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_init
|
||||
*
|
||||
|
|
@ -1193,26 +1158,6 @@ function acf_get_full_version( $version = '1' ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_locale
|
||||
*
|
||||
* This function is a wrapper for the get_locale() function
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function acf_get_locale() {
|
||||
|
||||
return is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_terms
|
||||
*
|
||||
|
|
@ -1450,6 +1395,20 @@ function acf_decode_taxonomy_term( $value ) {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_array
|
||||
*
|
||||
* Casts the value into an array.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param mixed $val The value to cast.
|
||||
* @return array
|
||||
*/
|
||||
function acf_array( $val = array() ) {
|
||||
return (array) $val;
|
||||
}
|
||||
|
||||
/*
|
||||
* acf_get_array
|
||||
|
|
@ -2896,6 +2855,12 @@ function acf_in_array( $value = '', $array = false ) {
|
|||
|
||||
function acf_get_valid_post_id( $post_id = 0 ) {
|
||||
|
||||
// allow filter to short-circuit load_value logic
|
||||
$preload = apply_filters( "acf/pre_load_post_id", null, $post_id );
|
||||
if( $preload !== null ) {
|
||||
return $preload;
|
||||
}
|
||||
|
||||
// vars
|
||||
$_post_id = $post_id;
|
||||
|
||||
|
|
@ -3592,29 +3557,17 @@ function acf_get_truncated( $text, $length = 64 ) {
|
|||
/*
|
||||
* acf_get_current_url
|
||||
*
|
||||
* This function will return the current URL
|
||||
* This function will return the current URL.
|
||||
*
|
||||
* @type function
|
||||
* @date 23/01/2015
|
||||
* @since 5.1.5
|
||||
*
|
||||
* @param n/a
|
||||
* @return (string)
|
||||
* @param void
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function acf_get_current_url() {
|
||||
|
||||
// Get url to current request.
|
||||
$url = home_url($_SERVER['REQUEST_URI']);
|
||||
|
||||
// Fix bug where multisite sub-directory path segment is repeated.
|
||||
// Eg. http://multisite.local/sub1/sub1/sample-page/
|
||||
if( is_multisite() ) {
|
||||
$url = acf_str_join( home_url(), $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
// Return url.
|
||||
return $url;
|
||||
return ( is_ssl() ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4577,6 +4530,22 @@ function acf_dev_log() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_test
|
||||
*
|
||||
* Tests a function against an expected result and logs the pass/fail.
|
||||
*
|
||||
* @date 19/11/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param type $var Description. Default.
|
||||
* @return type Description.
|
||||
*/
|
||||
function acf_test( $result, $expected_result ) {
|
||||
$success = ($result === $expected_result);
|
||||
acf_log('ACF Test', $success ? '(Pass)' : '(Fail)', $result, $expected_result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_doing
|
||||
|
|
@ -5383,4 +5352,80 @@ function acf_convert_rules_to_groups( $rules, $anyorall = 'any' ) {
|
|||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_register_ajax
|
||||
*
|
||||
* Regsiters an ajax callback.
|
||||
*
|
||||
* @date 5/10/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param string $name The ajax action name.
|
||||
* @param array $callback The callback function or array.
|
||||
* @param bool $public Whether to allow access to non logged in users.
|
||||
* @return void
|
||||
*/
|
||||
function acf_register_ajax( $name = '', $callback = false, $public = false ) {
|
||||
|
||||
// vars
|
||||
$action = "acf/ajax/$name";
|
||||
|
||||
// add action for logged-in users
|
||||
add_action( "wp_ajax_$action", $callback );
|
||||
|
||||
// add action for non logged-in users
|
||||
if( $public ) {
|
||||
add_action( "wp_ajax_nopriv_$action", $callback );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_str_camel_case
|
||||
*
|
||||
* Converts a string into camelCase.
|
||||
* Thanks to https://stackoverflow.com/questions/31274782/convert-array-keys-from-underscore-case-to-camelcase-recursively
|
||||
*
|
||||
* @date 24/10/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param string $string The string ot convert.
|
||||
* @return string
|
||||
*/
|
||||
function acf_str_camel_case( $string = '' ) {
|
||||
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $string))));
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_array_camel_case
|
||||
*
|
||||
* Converts all aray keys to camelCase.
|
||||
*
|
||||
* @date 24/10/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param array $array The array to convert.
|
||||
* @return array
|
||||
*/
|
||||
function acf_array_camel_case( $array = array() ) {
|
||||
$array2 = array();
|
||||
foreach( $array as $k => $v ) {
|
||||
$array2[ acf_str_camel_case($k) ] = $v;
|
||||
}
|
||||
return $array2;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_is_block_editor
|
||||
*
|
||||
* Returns true if the current screen uses the block editor.
|
||||
*
|
||||
* @date 13/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function acf_is_block_editor() {
|
||||
return get_current_screen()->is_block_editor();
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -206,123 +206,46 @@ function get_fields( $post_id = false, $format_value = true ) {
|
|||
|
||||
function get_field_objects( $post_id = false, $format_value = true, $load_value = true ) {
|
||||
|
||||
// global
|
||||
global $wpdb;
|
||||
|
||||
|
||||
// filter post_id
|
||||
// validate post_id
|
||||
$post_id = acf_get_valid_post_id( $post_id );
|
||||
$info = acf_get_post_id_info( $post_id );
|
||||
|
||||
|
||||
// vars
|
||||
$meta = array();
|
||||
$fields = array();
|
||||
|
||||
|
||||
// get field_names
|
||||
if( $info['type'] == 'post' ) {
|
||||
|
||||
$meta = get_post_meta( $info['id'] );
|
||||
|
||||
} elseif( $info['type'] == 'user' ) {
|
||||
|
||||
$meta = get_user_meta( $info['id'] );
|
||||
|
||||
} elseif( $info['type'] == 'comment' ) {
|
||||
|
||||
$meta = get_comment_meta( $info['id'] );
|
||||
|
||||
} elseif( $info['type'] == 'term' ) {
|
||||
|
||||
$meta = get_term_meta( $info['id'] );
|
||||
|
||||
} else {
|
||||
|
||||
$rows = $wpdb->get_results($wpdb->prepare(
|
||||
"SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
|
||||
$post_id . '_%' ,
|
||||
'_' . $post_id . '_%'
|
||||
), ARRAY_A);
|
||||
|
||||
if( !empty($rows) ) {
|
||||
|
||||
foreach( $rows as $row ) {
|
||||
|
||||
// vars
|
||||
$name = $row['option_name'];
|
||||
$prefix = $post_id . '_';
|
||||
$_prefix = '_' . $prefix;
|
||||
|
||||
|
||||
// remove prefix from name
|
||||
if( strpos($name, $prefix) === 0 ) {
|
||||
|
||||
$name = substr($name, strlen($prefix));
|
||||
|
||||
} elseif( strpos($name, $_prefix) === 0 ) {
|
||||
|
||||
$name = '_' . substr($name, strlen($_prefix));
|
||||
|
||||
}
|
||||
|
||||
$meta[ $name ][] = $row['option_value'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// get meta
|
||||
$meta = acf_get_meta( $post_id );
|
||||
|
||||
// bail early if no meta
|
||||
if( empty($meta) ) return false;
|
||||
|
||||
|
||||
// populate vars
|
||||
foreach( $meta as $k => $v ) {
|
||||
|
||||
// does a field key exist for this value?
|
||||
if( !isset($meta["_{$k}"]) ) continue;
|
||||
$fields = array();
|
||||
foreach( $meta as $key => $value ) {
|
||||
|
||||
// bail if reference key does not exist
|
||||
if( !isset($meta["_$key"]) ) continue;
|
||||
|
||||
// get field
|
||||
$field_key = $meta["_{$k}"][0];
|
||||
$field = acf_maybe_get_field( $field_key );
|
||||
$field = acf_get_field($meta["_$key"]);
|
||||
|
||||
|
||||
// bail early if no field, or if the field's name is different to $k
|
||||
// bail early if no field, or if the field's name is different to $key
|
||||
// - solves problem where sub fields (and clone fields) are incorrectly allowed
|
||||
if( !$field || $field['name'] !== $k ) continue;
|
||||
|
||||
if( !$field || $field['name'] !== $key ) continue;
|
||||
|
||||
// load value
|
||||
if( $load_value ) {
|
||||
|
||||
$field['value'] = acf_get_value( $post_id, $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// format value
|
||||
if( $format_value ) {
|
||||
|
||||
// get value for field
|
||||
$field['value'] = acf_format_value( $field['value'], $post_id, $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// append to $value
|
||||
$fields[ $field['name'] ] = $field;
|
||||
|
||||
$fields[ $key ] = $field;
|
||||
}
|
||||
|
||||
|
||||
// no value
|
||||
if( empty($fields) ) return false;
|
||||
|
||||
|
||||
// return
|
||||
return $fields;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -619,6 +619,97 @@ function acf_preview_value( $value, $post_id, $field ) {
|
|||
|
||||
// return
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_option_meta
|
||||
*
|
||||
* Returns an array of meta for the given wp_option name prefix.
|
||||
*
|
||||
* @date 9/10/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param string $prefix The wp_option name prefix.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_option_meta( $prefix = '' ) {
|
||||
|
||||
// global
|
||||
global $wpdb;
|
||||
|
||||
// vars
|
||||
$meta = array();
|
||||
$search = "{$prefix}_%";
|
||||
$_search = "_{$prefix}_%";
|
||||
|
||||
// escape underscores
|
||||
$search = str_replace('_', '\_', $search);
|
||||
$_search = str_replace('_', '\_', $_search);
|
||||
|
||||
// query
|
||||
$rows = $wpdb->get_results($wpdb->prepare(
|
||||
"SELECT *
|
||||
FROM $wpdb->options
|
||||
WHERE option_name LIKE %s
|
||||
OR option_name LIKE %s",
|
||||
$search,
|
||||
$_search
|
||||
), ARRAY_A);
|
||||
|
||||
// loop
|
||||
$len = strlen("{$prefix}_");
|
||||
foreach( $rows as $row ) {
|
||||
$meta[ substr($row['option_name'], $len) ][] = $row['option_value'];
|
||||
}
|
||||
|
||||
// return unserialized
|
||||
return array_map('maybe_unserialize', $meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_meta
|
||||
*
|
||||
* Returns an array of "ACF only" meta for the given post_id.
|
||||
*
|
||||
* @date 9/10/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param mixed $post_id The post_id for this data.
|
||||
* @return array
|
||||
*/
|
||||
function acf_get_meta( $post_id = 0 ) {
|
||||
|
||||
// allow filter to short-circuit load_value logic
|
||||
$pre = apply_filters( "acf/pre_load_meta", null, $post_id );
|
||||
if( $pre !== null ) {
|
||||
return $pre;
|
||||
}
|
||||
|
||||
// get post_id info
|
||||
extract( acf_get_post_id_info($post_id) );
|
||||
|
||||
// use get_$type_meta() function when possible
|
||||
if( function_exists("get_{$type}_meta") ) {
|
||||
$allmeta = call_user_func("get_{$type}_meta", $id, '', true);
|
||||
|
||||
// default to wp_options
|
||||
} else {
|
||||
$allmeta = acf_get_option_meta( $id );
|
||||
}
|
||||
|
||||
// loop
|
||||
$meta = array();
|
||||
foreach( $allmeta as $key => $value ) {
|
||||
|
||||
// if is value
|
||||
if( isset($allmeta["_$key"]) ) {
|
||||
$meta[ $key ] = $allmeta[ $key ][0];
|
||||
$meta[ "_$key" ] = $allmeta[ "_$key" ][0];
|
||||
}
|
||||
}
|
||||
|
||||
// return
|
||||
return $meta;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
|
||||
|
||||
if( ! class_exists('ACF_Data') ) :
|
||||
|
||||
class ACF_Data {
|
||||
|
||||
/** @var string Unique identifier. */
|
||||
var $cid = '';
|
||||
|
||||
/** @var array Storage for data. */
|
||||
var $data = array();
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* Sets up the class functionality.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param array $data Optional data to set.
|
||||
* @return void
|
||||
*/
|
||||
function __construct( $data = false ) {
|
||||
|
||||
// Set cid.
|
||||
$this->cid = acf_uniqid();
|
||||
|
||||
// Set data.
|
||||
if( $data && is_array($data) ) {
|
||||
$this->data = array_merge($this->data, $data);
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize
|
||||
*
|
||||
* Called during constructor to setup class functionality.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function initialize() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* has
|
||||
*
|
||||
* Returns true if this has data for the given name.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $name The data name.
|
||||
* @return boolean
|
||||
*/
|
||||
function has( $name = '' ) {
|
||||
return isset($this->data[ $name ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* Returns data for the given name of null if doesn't exist.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $name The data name.
|
||||
* @return mixed
|
||||
*/
|
||||
function get( $name = '' ) {
|
||||
return isset($this->data[ $name ]) ? $this->data[ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_data
|
||||
*
|
||||
* Returns an array of all data.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param void
|
||||
* @return array
|
||||
*/
|
||||
function get_data() {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* set
|
||||
*
|
||||
* Sets data for the given name and returns $this for chaining.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param (string|array) $name The data name or an array of data.
|
||||
* @param mixed $value The data value.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function set( $name = '', $value ) {
|
||||
|
||||
// Set multiple.
|
||||
if( is_array($name) ) {
|
||||
$this->data = array_merge($this->data, $name);
|
||||
|
||||
// Set single.
|
||||
} else {
|
||||
$this->data[ $name ] = $value;
|
||||
}
|
||||
|
||||
// Return this for chaining.
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* remove
|
||||
*
|
||||
* Removes data for the given name.
|
||||
*
|
||||
* @date 9/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $name The data name.
|
||||
* @return ACF_Data
|
||||
*/
|
||||
function remove( $name = '' ) {
|
||||
|
||||
// Remove data.
|
||||
unset( $this->data[ $name ] );
|
||||
|
||||
// Return this for chaining.
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
@ -329,45 +329,33 @@ class acf_field_user extends acf_field {
|
|||
|
||||
function render_field( $field ) {
|
||||
|
||||
// Change Field into a select
|
||||
// Change Field into a select.
|
||||
$field['type'] = 'select';
|
||||
$field['ui'] = 1;
|
||||
$field['ajax'] = 1;
|
||||
$field['choices'] = array();
|
||||
|
||||
|
||||
// populate choices
|
||||
if( !empty($field['value']) ) {
|
||||
// Populate choices.
|
||||
if( $field['value'] ) {
|
||||
|
||||
// force value to array
|
||||
$field['value'] = acf_get_array( $field['value'] );
|
||||
// Clean value into an array of IDs.
|
||||
$user_ids = array_map('intval', acf_array($field['value']));
|
||||
|
||||
|
||||
// convert values to int
|
||||
$field['value'] = array_map('intval', $field['value']);
|
||||
|
||||
|
||||
$users = get_users(array(
|
||||
'include' => $field['value']
|
||||
// Find users in database (ensures all results are real).
|
||||
$users = acf_get_users(array(
|
||||
'include' => $user_ids
|
||||
));
|
||||
|
||||
|
||||
if( !empty($users) ) {
|
||||
|
||||
// Append.
|
||||
if( $users ) {
|
||||
foreach( $users as $user ) {
|
||||
|
||||
$field['choices'][ $user->ID ] = $this->get_result( $user, $field );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// render
|
||||
// Render.
|
||||
acf_render_field( $field );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -523,65 +511,65 @@ class acf_field_user extends acf_field {
|
|||
|
||||
function format_value( $value, $post_id, $field ) {
|
||||
|
||||
// bail early if no value
|
||||
if( empty($value) ) {
|
||||
// Bail early if no value.
|
||||
if( !$value ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ensure array
|
||||
$value = acf_get_array( $value );
|
||||
// Clean value into an array of IDs.
|
||||
$user_ids = array_map('intval', acf_array($value));
|
||||
|
||||
// update value
|
||||
foreach( array_keys($value) as $i ) {
|
||||
$value[ $i ] = $this->format_value_single( $value[ $i ], $post_id, $field );
|
||||
// Find users in database (ensures all results are real).
|
||||
$users = acf_get_users(array(
|
||||
'include' => $user_ids
|
||||
));
|
||||
|
||||
// Bail early if no users found.
|
||||
if( !$users ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert to single
|
||||
if( !$field['multiple'] ) {
|
||||
$value = array_shift($value);
|
||||
}
|
||||
|
||||
// return value
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
function format_value_single( $value, $post_id, $field ) {
|
||||
|
||||
// vars
|
||||
$user_id = (int) $value;
|
||||
|
||||
// object
|
||||
if( $field['return_format'] == 'object' ) {
|
||||
$value = get_userdata( $user_id );
|
||||
|
||||
// array
|
||||
} elseif( $field['return_format'] == 'array' ) {
|
||||
$wp_user = get_userdata( $user_id );
|
||||
$value = array(
|
||||
'ID' => $user_id,
|
||||
'user_firstname' => $wp_user->user_firstname,
|
||||
'user_lastname' => $wp_user->user_lastname,
|
||||
'nickname' => $wp_user->nickname,
|
||||
'user_nicename' => $wp_user->user_nicename,
|
||||
'display_name' => $wp_user->display_name,
|
||||
'user_email' => $wp_user->user_email,
|
||||
'user_url' => $wp_user->user_url,
|
||||
'user_registered' => $wp_user->user_registered,
|
||||
'user_description' => $wp_user->user_description,
|
||||
'user_avatar' => get_avatar( $user_id ),
|
||||
);
|
||||
// Format values using field settings.
|
||||
$value = array();
|
||||
foreach( $users as $user ) {
|
||||
|
||||
// id
|
||||
} else {
|
||||
$value = $user_id;
|
||||
// Return object.
|
||||
if( $field['return_format'] == 'object' ) {
|
||||
$item = $user;
|
||||
|
||||
// Return array.
|
||||
} elseif( $field['return_format'] == 'array' ) {
|
||||
$item = array(
|
||||
'ID' => $user->ID,
|
||||
'user_firstname' => $user->user_firstname,
|
||||
'user_lastname' => $user->user_lastname,
|
||||
'nickname' => $user->nickname,
|
||||
'user_nicename' => $user->user_nicename,
|
||||
'display_name' => $user->display_name,
|
||||
'user_email' => $user->user_email,
|
||||
'user_url' => $user->user_url,
|
||||
'user_registered' => $user->user_registered,
|
||||
'user_description' => $user->user_description,
|
||||
'user_avatar' => get_avatar( $user->ID ),
|
||||
);
|
||||
|
||||
// Return ID.
|
||||
} else {
|
||||
$item = $user->ID;
|
||||
}
|
||||
|
||||
// Append item
|
||||
$value[] = $item;
|
||||
}
|
||||
|
||||
// return
|
||||
// Convert to single.
|
||||
if( !$field['multiple'] ) {
|
||||
$value = array_shift( $value );
|
||||
}
|
||||
|
||||
// Return.
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,281 +0,0 @@
|
|||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('ACF_Form') ) :
|
||||
|
||||
class ACF_Form {
|
||||
|
||||
/** @var array Storage for data */
|
||||
var $data = array();
|
||||
|
||||
|
||||
/*
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the class functionality.
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
||||
// actions
|
||||
add_action('acf/save_post', array($this, '_save_post'), 10, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* set_data
|
||||
*
|
||||
* Sets data.
|
||||
*
|
||||
* @type function
|
||||
* @date 4/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param array $data An array of data.
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function set_data( $data = array() ) {
|
||||
|
||||
// defaults
|
||||
$data = wp_parse_args($data, array(
|
||||
'screen' => 'post', // Current screen loaded (post, user, taxonomy, etc)
|
||||
'post_id' => 0, // ID of current post being edited
|
||||
'nonce' => '', // nonce used for $_POST validation (defaults to screen)
|
||||
'validation' => 1, // enables form validation
|
||||
'changed' => 0, // used by revisions and unload to detect change
|
||||
));
|
||||
|
||||
// crete nonce
|
||||
$data['nonce'] = wp_create_nonce($data['screen']);
|
||||
|
||||
// update
|
||||
$this->data = $data;
|
||||
|
||||
// return
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_data
|
||||
*
|
||||
* Returns data.
|
||||
*
|
||||
* @type function
|
||||
* @date 4/03/2016
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param string $name The data anme.
|
||||
* @return mixed The data.
|
||||
*/
|
||||
|
||||
function get_data( $name = false ) {
|
||||
return isset($this->data[ $name ]) ? $this->data[ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* render_data
|
||||
*
|
||||
* Renders the <div id="acf-form-data"> element with hidden "form data" inputs
|
||||
*
|
||||
* @date 17/4/18
|
||||
* @since 5.6.9
|
||||
*
|
||||
* @param array $data An array of data.
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function render_data( $data = array() ) {
|
||||
|
||||
// set form data
|
||||
$data = $this->set_data( $data );
|
||||
|
||||
?>
|
||||
<div id="acf-form-data" class="acf-hidden">
|
||||
<?php
|
||||
|
||||
// loop
|
||||
foreach( $data as $name => $value ) {
|
||||
|
||||
// input
|
||||
acf_hidden_input(array(
|
||||
'id' => '_acf_' . $name,
|
||||
'name' => '_acf_' . $name,
|
||||
'value' => $value
|
||||
));
|
||||
}
|
||||
|
||||
// actions
|
||||
do_action('acf/form_data', $data);
|
||||
do_action('acf/input/form_data', $data);
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* save_post
|
||||
*
|
||||
* Calls the 'acf/save_post' action allowing $_POST data to be saved
|
||||
*
|
||||
* @date 17/4/18
|
||||
* @since 5.6.9
|
||||
*
|
||||
* @param mixed $post_id The $post_id used to save data to the DB
|
||||
* @param array $values Optional. An optional array of data to be saved (modifies $_POST['acf'])
|
||||
* @return boolean Returns true on success.
|
||||
*/
|
||||
|
||||
function save_post( $post_id = 0, $values = null ) {
|
||||
|
||||
// override $_POST
|
||||
if( $values !== null ) {
|
||||
$_POST['acf'] = $values;
|
||||
}
|
||||
|
||||
// bail early if no values
|
||||
if( empty($_POST['acf']) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// set form data
|
||||
$this->set_data(array(
|
||||
'post_id' => $post_id
|
||||
));
|
||||
|
||||
// Filter $_POST data for users without the 'unfiltered_html' capability.
|
||||
if( !current_user_can('unfiltered_html') ) {
|
||||
$_POST['acf'] = wp_kses_post_deep( $_POST['acf'] );
|
||||
}
|
||||
|
||||
// action
|
||||
do_action('acf/save_post', $post_id);
|
||||
|
||||
// return
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _save_post
|
||||
*
|
||||
* Saves the actual $_POST['acf'] data.
|
||||
* Performing this logic within an action allows developers to hook in before and after data is saved.
|
||||
*
|
||||
* @date 24/10/2014
|
||||
* @since 5.0.9
|
||||
*
|
||||
* @param mixed $post_id The $post_id used to save data to the DB
|
||||
* @return void.
|
||||
*/
|
||||
|
||||
function _save_post( $post_id ) {
|
||||
|
||||
// bail early if empty
|
||||
// - post data may have be modified
|
||||
if( empty($_POST['acf']) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// loop
|
||||
foreach( $_POST['acf'] as $key => $value ) {
|
||||
|
||||
// get field
|
||||
$field = acf_get_field( $key );
|
||||
|
||||
// update
|
||||
if( $field ) {
|
||||
acf_update_value( $value, $post_id, $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// instantiate
|
||||
acf_new_instance('ACF_Form');
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_form_data
|
||||
*
|
||||
* alias of acf()->form->get_data()
|
||||
*
|
||||
* @type function
|
||||
* @date 6/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_get_form_data( $name = '' ) {
|
||||
return acf_get_instance('ACF_Form')->get_data( $name );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_set_form_data
|
||||
*
|
||||
* alias of acf()->form->set_data()
|
||||
*
|
||||
* @type function
|
||||
* @date 6/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_set_form_data( $data = array() ) {
|
||||
return acf_get_instance('ACF_Form')->set_data( $data );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_form_data
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function acf_form_data( $data = array() ) {
|
||||
return acf_get_instance('ACF_Form')->render_data( $data );
|
||||
}
|
||||
|
||||
/*
|
||||
* acf_save_post
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 15/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function acf_save_post( $post_id = 0, $values = null ) {
|
||||
return acf_get_instance('ACF_Form')->save_post( $post_id, $values );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -80,13 +80,19 @@ class ACF_Form_Gutenberg {
|
|||
// Manually call 'edit_form_after_title' function.
|
||||
acf_get_instance('ACF_Form_Post')->edit_form_after_title();
|
||||
|
||||
// Move elements around screen.
|
||||
// Add inline script.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
||||
// Move elements around screen.
|
||||
acf.addAction('prepare', function(){
|
||||
$('#normal-sortables').before( $('#acf_after_title-sortables') );
|
||||
}, 1);
|
||||
|
||||
// Disable unload
|
||||
acf.unload.disable();
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ class ACF_Form_Post {
|
|||
/** @var string The first field groups style CSS. */
|
||||
var $style = '';
|
||||
|
||||
/** @var array An arry of postbox data. */
|
||||
var $postboxes = array();
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
|
|
@ -63,9 +60,7 @@ class ACF_Form_Post {
|
|||
));
|
||||
|
||||
// actions
|
||||
add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 10, 2);
|
||||
add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
|
||||
add_filter('hidden_meta_boxes', array($this, 'hidden_meta_boxes'), 10, 3);
|
||||
add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,73 +77,65 @@ class ACF_Form_Post {
|
|||
*/
|
||||
function add_meta_boxes( $post_type, $post ) {
|
||||
|
||||
// vars
|
||||
$postboxes = array();
|
||||
$count = 0;
|
||||
// Get field groups for this screen.
|
||||
$field_groups = acf_get_field_groups(array(
|
||||
'post_id' => $post->ID,
|
||||
'post_type' => $post_type
|
||||
));
|
||||
|
||||
// get all field groups
|
||||
$field_groups = acf_get_field_groups();
|
||||
|
||||
// loop
|
||||
// Loop over field groups.
|
||||
if( $field_groups ) {
|
||||
foreach( $field_groups as $field_group ) {
|
||||
foreach( $field_groups as $field_group ) {
|
||||
|
||||
// vars
|
||||
$id = "acf-{$field_group['key']}"; // acf-group_123
|
||||
$title = $field_group['title']; // Group 1
|
||||
$context = $field_group['position']; // normal, side, acf_after_title
|
||||
$priority = 'high'; // high, core, default, low
|
||||
|
||||
// vars
|
||||
$id = "acf-{$field_group['key']}"; // acf-group_123
|
||||
$title = $field_group['title']; // Group 1
|
||||
$context = $field_group['position']; // normal, side, acf_after_title
|
||||
$priority = 'high'; // high, core, default, low
|
||||
|
||||
// change priority for sidebar metaboxes
|
||||
if( $context == 'side' ) {
|
||||
$priority = 'core';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the metabox priority.
|
||||
*
|
||||
* @date 23/06/12
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @param string $priority The metabox priority (high, core, default, low).
|
||||
* @param array $field_group The field group array.
|
||||
*/
|
||||
$priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
|
||||
|
||||
// set the visibility for this field group
|
||||
$visible = acf_get_field_group_visibility($field_group, array(
|
||||
'post_id' => $post->ID,
|
||||
'post_type' => $post_type
|
||||
));
|
||||
|
||||
// add meta box
|
||||
add_meta_box( $id, $title, array($this, 'render_meta_box'), $post_type, $context, $priority, array('field_group' => $field_group) );
|
||||
|
||||
// append to $postboxes
|
||||
$this->postboxes[ $id ] = array(
|
||||
'id' => $id,
|
||||
'key' => $field_group['key'],
|
||||
'style' => $field_group['style'],
|
||||
'label' => $field_group['label_placement'],
|
||||
'visible' => $visible,
|
||||
'edit' => acf_get_field_group_edit_link( $field_group['ID'] )
|
||||
);
|
||||
|
||||
// increase count for visible
|
||||
if( $visible ) {
|
||||
$count++;
|
||||
|
||||
// find first field group's style
|
||||
if( $count == 1 ) {
|
||||
$this->style = acf_get_field_group_style( $field_group );
|
||||
// Reduce priority for sidebar metaboxes for best position.
|
||||
if( $context == 'side' ) {
|
||||
$priority = 'core';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the metabox priority.
|
||||
*
|
||||
* @date 23/06/12
|
||||
* @since 3.1.8
|
||||
*
|
||||
* @param string $priority The metabox priority (high, core, default, low).
|
||||
* @param array $field_group The field group array.
|
||||
*/
|
||||
$priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
|
||||
|
||||
// Add the meta box.
|
||||
add_meta_box( $id, $title, array($this, 'render_meta_box'), $post_type, $context, $priority, array('field_group' => $field_group) );
|
||||
}
|
||||
}}
|
||||
|
||||
// Get style from first field group.
|
||||
$this->style = acf_get_field_group_style( $field_groups[0] );
|
||||
}
|
||||
|
||||
// remove postcustom metabox (removes expensive SQL query)
|
||||
if( acf_get_setting('remove_wp_meta_box') ) {
|
||||
remove_meta_box( 'postcustom', false, 'normal' );
|
||||
}
|
||||
|
||||
// Add hidden input fields.
|
||||
add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
|
||||
|
||||
/**
|
||||
* Fires after metaboxes have been added.
|
||||
*
|
||||
* @date 13/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param string $post_type The post type.
|
||||
* @param WP_Post $post The post being edited.
|
||||
* @param array $field_groups The field groups added.
|
||||
*/
|
||||
do_action('acf/add_meta_boxes', $post_type, $post, $field_groups);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -175,40 +162,11 @@ class ACF_Form_Post {
|
|||
|
||||
// render 'acf_after_title' metaboxes
|
||||
do_meta_boxes( get_current_screen(), 'acf_after_title', $post );
|
||||
|
||||
// clean up $wp_meta_boxes
|
||||
unset( $wp_meta_boxes['post']['acf_after_title'] );
|
||||
|
||||
// render dynamic field group style
|
||||
echo '<style type="text/css" id="acf-style">' . $this->style . '</style>';
|
||||
}
|
||||
|
||||
/**
|
||||
* hidden_meta_boxes
|
||||
*
|
||||
* Appends the id of all metaboxes that are not visible for WP to hide.
|
||||
*
|
||||
* @date 21/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param array $hidden An array of hidden meta boxes.
|
||||
* @param WP_Screen $screen WP_Screen object of the current screen.
|
||||
* @param bool $use_defaults Whether to show the default meta boxes.
|
||||
* @return array
|
||||
*/
|
||||
function hidden_meta_boxes( $hidden, $screen, $use_defaults ) {
|
||||
|
||||
// loop over visiblity array
|
||||
foreach( $this->postboxes as $id => $postbox ) {
|
||||
if( !$postbox['visible'] ) {
|
||||
$hidden[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
// return
|
||||
return $hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* render_meta_box
|
||||
*
|
||||
|
|
@ -226,19 +184,24 @@ class ACF_Form_Post {
|
|||
// vars
|
||||
$id = $metabox['id'];
|
||||
$field_group = $metabox['args']['field_group'];
|
||||
$postbox = $this->postboxes[ $id ];
|
||||
|
||||
// render fields if visible
|
||||
if( $postbox['visible'] ) {
|
||||
$fields = acf_get_fields( $field_group );
|
||||
acf_render_fields( $fields, $post->ID, 'div', $field_group['instruction_placement'] );
|
||||
}
|
||||
// Render fields.
|
||||
$fields = acf_get_fields( $field_group );
|
||||
acf_render_fields( $fields, $post->ID, 'div', $field_group['instruction_placement'] );
|
||||
|
||||
// Create metabox localized data.
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
'key' => $field_group['key'],
|
||||
'style' => $field_group['style'],
|
||||
'label' => $field_group['label_placement'],
|
||||
'edit' => acf_get_field_group_edit_link( $field_group['ID'] )
|
||||
);
|
||||
|
||||
// inline javascript
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
acf.newPostbox(<?php echo wp_json_encode($postbox); ?>);
|
||||
acf.newPostbox(<?php echo wp_json_encode($data); ?>);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
|
@ -336,10 +299,13 @@ class ACF_Form_Post {
|
|||
return $post_id;
|
||||
}
|
||||
|
||||
// Validate and display errors for published post.
|
||||
// - Allows draft to save without validation.
|
||||
// validate for published post (allow draft to save without validation)
|
||||
if( $post->post_status == 'publish' ) {
|
||||
acf_validate_save_post( true );
|
||||
|
||||
// bail early if validation fails
|
||||
if( !acf_validate_save_post() ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// save
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Determine the current locale desired for the request.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @global string $pagenow
|
||||
*
|
||||
* @return string The determined locale.
|
||||
*/
|
||||
if( !function_exists('determine_locale') ):
|
||||
function determine_locale() {
|
||||
/**
|
||||
* Filters the locale for the current request prior to the default determination process.
|
||||
*
|
||||
* Using this filter allows to override the default logic, effectively short-circuiting the function.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string|null The locale to return and short-circuit, or null as default.
|
||||
*/
|
||||
$determined_locale = apply_filters( 'pre_determine_locale', null );
|
||||
if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) {
|
||||
return $determined_locale;
|
||||
}
|
||||
|
||||
$determined_locale = get_locale();
|
||||
|
||||
if ( is_admin() ) {
|
||||
$determined_locale = get_user_locale();
|
||||
}
|
||||
|
||||
if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) {
|
||||
$determined_locale = get_user_locale();
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
|
||||
$determined_locale = sanitize_text_field( $_GET['wp_lang'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the locale for the current request.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $locale The locale.
|
||||
*/
|
||||
return apply_filters( 'determine_locale', $determined_locale );
|
||||
}
|
||||
endif;
|
||||
|
||||
/*
|
||||
* acf_get_locale
|
||||
*
|
||||
* Returns the current locale.
|
||||
*
|
||||
* @date 16/12/16
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param void
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_locale() {
|
||||
|
||||
// Determine local.
|
||||
$locale = determine_locale();
|
||||
|
||||
// Fallback to parent language for regions without translation.
|
||||
// https://wpastra.com/docs/complete-list-wordpress-locale-codes/
|
||||
$langs = array(
|
||||
'az_TR' => 'az', // Azerbaijani (Turkey)
|
||||
'zh_HK' => 'zh_CN', // Chinese (Hong Kong)
|
||||
'zh_TW' => 'zh_CN', // Chinese (Taiwan)
|
||||
'nl_BE' => 'nl_NL', // Dutch (Belgium)
|
||||
'fr_BE' => 'fr_FR', // French (Belgium)
|
||||
'nn_NO' => 'nb_NO', // Norwegian (Nynorsk)
|
||||
'fa_AF' => 'fa_IR', // Persian (Afghanistan)
|
||||
'ru_UA' => 'ru_RU', // Russian (Ukraine)
|
||||
);
|
||||
if( isset($langs[ $locale ]) ) {
|
||||
$locale = $langs[ $locale ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the determined local.
|
||||
*
|
||||
* @date 8/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $locale The local.
|
||||
*/
|
||||
return apply_filters( 'acf/get_locale', $locale );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_load_textdomain
|
||||
*
|
||||
* Loads the plugin's translated strings similar to load_plugin_textdomain().
|
||||
*
|
||||
* @date 8/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $locale The plugin's current locale.
|
||||
* @return void
|
||||
*/
|
||||
function acf_load_textdomain( $domain = 'acf' ) {
|
||||
|
||||
/**
|
||||
* Filters a plugin's locale.
|
||||
*
|
||||
* @date 8/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $locale The plugin's current locale.
|
||||
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
|
||||
*/
|
||||
$locale = apply_filters( 'plugin_locale', acf_get_locale(), $domain );
|
||||
$mofile = $domain . '-' . $locale . '.mo';
|
||||
|
||||
// Try to load from the languages directory first.
|
||||
if( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Load from plugin lang folder.
|
||||
return load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
|
||||
}
|
||||
Binary file not shown.
4965
lang/acf-cs_CZ.po
4965
lang/acf-cs_CZ.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
2156
lang/acf-fr_FR.po
2156
lang/acf-fr_FR.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -3,14 +3,14 @@ msgstr ""
|
|||
"Project-Id-Version: Advanced Custom Fields Pro v5.2.9\n"
|
||||
"Report-Msgid-Bugs-To: http://support.advancedcustomfields.com\n"
|
||||
"POT-Creation-Date: 2018-08-18 18:25+0300\n"
|
||||
"PO-Revision-Date: 2018-08-18 18:49+0300\n"
|
||||
"Last-Translator: Toniievych Andrii <toniyevych@gmail.com>\n"
|
||||
"PO-Revision-Date: 2019-01-05 10:08+1000\n"
|
||||
"Last-Translator: Elliot Condon <e@elliotcondon.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: ru_RU\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.1.1\n"
|
||||
"X-Generator: Poedit 1.8.1\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
|
@ -1450,7 +1450,8 @@ msgstr "Отношение"
|
|||
msgid "jQuery"
|
||||
msgstr "jQuery"
|
||||
|
||||
#: includes/fields.php:354 includes/fields/class-acf-field-button-group.php:177
|
||||
#: includes/fields.php:354
|
||||
#: includes/fields/class-acf-field-button-group.php:177
|
||||
#: includes/fields/class-acf-field-checkbox.php:389
|
||||
#: includes/fields/class-acf-field-group.php:474
|
||||
#: includes/fields/class-acf-field-radio.php:290
|
||||
|
|
@ -2724,8 +2725,8 @@ msgstr "Редактировать группу полей"
|
|||
msgid "Validate Email"
|
||||
msgstr "Проверка Email"
|
||||
|
||||
#: includes/forms/form-front.php:103 pro/fields/class-acf-field-gallery.php:588
|
||||
#: pro/options-page.php:81
|
||||
#: includes/forms/form-front.php:103
|
||||
#: pro/fields/class-acf-field-gallery.php:588 pro/options-page.php:81
|
||||
msgid "Update"
|
||||
msgstr "Обновить"
|
||||
|
||||
|
|
@ -2921,7 +2922,7 @@ msgstr "Обновление"
|
|||
|
||||
#: pro/admin/views/html-settings-updates.php:7
|
||||
msgid "Deactivate License"
|
||||
msgstr "Декативировать лицензию"
|
||||
msgstr "Деактивировать лицензию"
|
||||
|
||||
#: pro/admin/views/html-settings-updates.php:7
|
||||
msgid "Activate License"
|
||||
|
|
|
|||
526
lang/acf.pot
526
lang/acf.pot
File diff suppressed because it is too large
Load Diff
|
|
@ -35,7 +35,7 @@ class acf_pro {
|
|||
if( is_admin() ) {
|
||||
|
||||
acf_include('pro/admin/admin-options-page.php');
|
||||
acf_include('pro/admin/admin-settings-updates.php');
|
||||
acf_include('pro/admin/admin-updates.php');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,9 +190,7 @@ class acf_admin_options_page {
|
|||
|
||||
// notices
|
||||
if( !empty($_GET['message']) && $_GET['message'] == '1' ) {
|
||||
|
||||
acf_add_admin_notice( $this->page['updated_message'] );
|
||||
|
||||
acf_add_admin_notice( $this->page['updated_message'], 'success' );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -202,8 +200,8 @@ class acf_admin_options_page {
|
|||
|
||||
|
||||
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');
|
||||
|
||||
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') ), 'warning' );
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,418 +0,0 @@
|
|||
<?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' => ''
|
||||
);
|
||||
|
||||
// get plugin updates
|
||||
$force_check = !empty( $_GET['force-check'] );
|
||||
$info = acf_updates()->get_plugin_info('pro', $force_check);
|
||||
|
||||
// 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']);
|
||||
|
||||
// perform update checks if license is active
|
||||
$basename = acf_get_setting('basename');
|
||||
$update = acf_updates()->get_plugin_update( $basename );
|
||||
if( $license ) {
|
||||
|
||||
// display error if no package url
|
||||
// - possible if license key has been modified
|
||||
if( $update && !$update['package'] ) {
|
||||
$this->show_error( __('<b>Error</b>. Could not authenticate update package. Please check again or deactivate and reactivate your ACF PRO license.', 'acf') );
|
||||
$this->view['update_available'] = false;
|
||||
}
|
||||
|
||||
// refresh transient
|
||||
// - if no update exists in the transient
|
||||
// - or if the transient 'new_version' is stale
|
||||
if( !$update || $update['new_version'] !== $info['version'] ) {
|
||||
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'] );
|
||||
|
||||
// refresh transient
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// 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('');
|
||||
|
||||
// refresh transient
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// 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,339 @@
|
|||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('ACF_Admin_Updates') ) :
|
||||
|
||||
class ACF_Admin_Updates {
|
||||
|
||||
/** @var array Data used in the view. */
|
||||
var $view = array();
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* Sets up the class functionality.
|
||||
*
|
||||
* @date 23/06/12
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
// Add actions.
|
||||
add_action( 'admin_menu', array($this, 'admin_menu'), 20 );
|
||||
}
|
||||
|
||||
/**
|
||||
* display_wp_error
|
||||
*
|
||||
* Adds an admin notice using the provided WP_Error.
|
||||
*
|
||||
* @date 14/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param WP_Error $wp_error The error to display.
|
||||
* @return void
|
||||
*/
|
||||
function display_wp_error( $wp_error ) {
|
||||
|
||||
// Only show one error on page.
|
||||
if( acf_has_done('display_wp_error') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new notice.
|
||||
acf_new_admin_notice(array(
|
||||
'text' => __('<b>Error</b>. Could not connect to update server', 'acf') . ' <span class="description">(' . esc_html( $wp_error->get_error_message() ) . ').</span>',
|
||||
'type' => 'error'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* get_changelog_changes
|
||||
*
|
||||
* Finds the specific changes for a given version from the provided changelog snippet.
|
||||
*
|
||||
* @date 14/1/19
|
||||
* @since 5.7.10
|
||||
*
|
||||
* @param string $changelog The changelog text.
|
||||
* @param string $version The version to find.
|
||||
* @return string
|
||||
*/
|
||||
function get_changelog_changes( $changelog = '', $version = '' ) {
|
||||
|
||||
// Explode changelog into sections.
|
||||
$bits = array_filter( explode('<h4>', $changelog) );
|
||||
|
||||
// Loop over each version chunk.
|
||||
foreach( $bits as $bit ) {
|
||||
|
||||
// Find the version number for this chunk.
|
||||
$bit = explode('</h4>', $bit);
|
||||
$bit_version = trim( $bit[0] );
|
||||
$bit_text = trim( $bit[1] );
|
||||
|
||||
// Compare the chunk version number against param and return HTML.
|
||||
if( acf_version_compare($bit_version, '==', $version) ) {
|
||||
return '<h4>' . esc_html($bit_version) . '</h4>' . acf_esc_html($bit_text);
|
||||
}
|
||||
}
|
||||
|
||||
// Return.
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* admin_menu
|
||||
*
|
||||
* Adds the admin menu subpage.
|
||||
*
|
||||
* @date 28/09/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
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 submenu.
|
||||
$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') );
|
||||
|
||||
// Add actions to page.
|
||||
add_action( "load-$page", array($this,'load') );
|
||||
}
|
||||
|
||||
/**
|
||||
* load
|
||||
*
|
||||
* Runs when loading the submenu page.
|
||||
*
|
||||
* @date 7/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function load() {
|
||||
|
||||
// Check activate.
|
||||
if( acf_verify_nonce('activate_pro_licence') ) {
|
||||
$this->activate_pro_licence();
|
||||
|
||||
// Check 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' => ''
|
||||
);
|
||||
|
||||
// get plugin updates
|
||||
$force_check = !empty( $_GET['force-check'] );
|
||||
$info = acf_updates()->get_plugin_info('pro', $force_check);
|
||||
|
||||
// Display error.
|
||||
if( is_wp_error($info) ) {
|
||||
return $this->display_wp_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_changes($info['changelog'], $info['version']);
|
||||
$this->view['upgrade_notice'] = $this->get_changelog_changes($info['upgrade_notice'], $info['version']);
|
||||
|
||||
// perform update checks if license is active
|
||||
$basename = acf_get_setting('basename');
|
||||
$update = acf_updates()->get_plugin_update( $basename );
|
||||
if( $license ) {
|
||||
|
||||
// display error if no package url
|
||||
// - possible if license key has been modified
|
||||
if( $update && !$update['package'] ) {
|
||||
$this->view['update_available'] = false;
|
||||
acf_new_admin_notice(array(
|
||||
'text' => __('<b>Error</b>. Could not authenticate update package. Please check again or deactivate and reactivate your ACF PRO license.', 'acf'),
|
||||
'type' => 'error'
|
||||
));
|
||||
}
|
||||
|
||||
// refresh transient
|
||||
// - if no update exists in the transient
|
||||
// - or if the transient 'new_version' is stale
|
||||
if( !$update || $update['new_version'] !== $info['version'] ) {
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* activate_pro_licence
|
||||
*
|
||||
* Activates the submitted license key.
|
||||
*
|
||||
* @date 16/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function activate_pro_licence() {
|
||||
|
||||
// Connect to API.
|
||||
$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'),
|
||||
);
|
||||
$response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
|
||||
|
||||
// Check response is expected JSON array (not string).
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
// Display error.
|
||||
if( is_wp_error($response) ) {
|
||||
return $this->display_wp_error( $response );
|
||||
}
|
||||
|
||||
// On success.
|
||||
if( $response['status'] == 1 ) {
|
||||
|
||||
// Update license.
|
||||
acf_pro_update_license( $response['license'] );
|
||||
|
||||
// Refresh plugins transient to fetch new update data.
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// Show notice.
|
||||
acf_add_admin_notice( $response['message'], 'success' );
|
||||
|
||||
// On failure.
|
||||
} else {
|
||||
|
||||
// Show notice.
|
||||
acf_add_admin_notice( $response['message'], 'warning' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* activate_pro_licence
|
||||
*
|
||||
* Deactivates the registered license key.
|
||||
*
|
||||
* @date 16/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function deactivate_pro_licence() {
|
||||
|
||||
// Get license key.
|
||||
$license = acf_pro_get_license_key();
|
||||
|
||||
// Bail early if no key.
|
||||
if( !$license ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Connect to API.
|
||||
$post = array(
|
||||
'acf_license' => $license,
|
||||
'wp_url' => home_url(),
|
||||
);
|
||||
$response = acf_updates()->request('v2/plugins/deactivate?p=pro', $post);
|
||||
|
||||
|
||||
// Check response is expected JSON array (not string).
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
// Display error.
|
||||
if( is_wp_error($response) ) {
|
||||
return $this->display_wp_error( $response );
|
||||
}
|
||||
|
||||
// Remove license key from DB.
|
||||
acf_pro_update_license('');
|
||||
|
||||
// Refresh plugins transient to fetch new update data.
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// On success.
|
||||
if( $response['status'] == 1 ) {
|
||||
|
||||
// Show notice.
|
||||
acf_add_admin_notice( $response['message'], 'info' );
|
||||
|
||||
// On failure.
|
||||
} else {
|
||||
|
||||
// Show notice.
|
||||
acf_add_admin_notice( $response['message'], 'warning' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* html
|
||||
*
|
||||
* Displays the submenu page's HTML.
|
||||
*
|
||||
* @date 7/01/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function html() {
|
||||
acf_get_view( dirname(__FILE__) . '/views/html-settings-updates.php', $this->view);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
acf_new_instance('ACF_Admin_Updates');
|
||||
|
||||
endif; // class_exists check
|
||||
|
|
@ -1,64 +1 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Flexible Content
|
||||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
.acf-field-setting-fc_layout .acf-fc-meta {
|
||||
margin: 0 0 10px;
|
||||
padding: 0;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fc-meta li {
|
||||
margin: 0 0 10px;
|
||||
padding: 0;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,
|
||||
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min {
|
||||
float: left;
|
||||
width: 33%;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,
|
||||
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,
|
||||
.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend {
|
||||
min-width: 45px;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-input-wrap.select {
|
||||
border-radius: 0 3px 3px 0 !important;
|
||||
border: #DFDFDF solid 1px;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-input-wrap.select select {
|
||||
margin: 0;
|
||||
border: 0 none;
|
||||
padding: 3px;
|
||||
height: 26px;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fl-actions {
|
||||
visibility: hidden;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout {
|
||||
cursor: move;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fl-actions a {
|
||||
padding: 1px 0;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.acf-field-setting-fc_layout:hover .acf-fl-actions,
|
||||
.acf-field-setting-fc_layout.-hover .acf-fl-actions {
|
||||
visibility: visible;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Clone
|
||||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
.acf-field-object-clone {
|
||||
/* group */
|
||||
/* seamless */
|
||||
}
|
||||
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-instructions,
|
||||
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-layout,
|
||||
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-wrapper,
|
||||
.acf-field-object-clone[data-display="seamless"] .acf-field-setting-conditional_logic {
|
||||
display: none;
|
||||
}
|
||||
.acf-field-setting-fc_layout .acf-fc-meta{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta li{margin:0 0 10px;padding:0}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-min{float:left;width:33%;padding-right:10px}.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-label .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-name .acf-input-prepend,.acf-field-setting-fc_layout .acf-fc-meta .acf-fc-meta-display .acf-input-prepend{min-width:45px}.acf-field-setting-fc_layout .acf-input-wrap.select{border-radius:0 3px 3px 0 !important;border:#DFDFDF solid 1px}.acf-field-setting-fc_layout .acf-input-wrap.select select{margin:0;border:0 none;padding:3px;height:26px}.acf-field-setting-fc_layout .acf-fl-actions{visibility:hidden}.acf-field-setting-fc_layout .acf-fl-actions .reorder-layout{cursor:move}.acf-field-setting-fc_layout .acf-fl-actions a{padding:1px 0;font-size:13px;line-height:20px}.acf-field-setting-fc_layout:hover .acf-fl-actions,.acf-field-setting-fc_layout.-hover .acf-fl-actions{visibility:visible}.acf-field-object-clone[data-display="seamless"] .acf-field-setting-instructions,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-layout,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-wrapper,.acf-field-object-clone[data-display="seamless"] .acf-field-setting-conditional_logic{display:none}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -476,6 +476,6 @@
|
|||
|
||||
})(jQuery);
|
||||
|
||||
// @codekit-prepend "../js/acf-setting-repeater.js
|
||||
// @codekit-prepend "../js/acf-setting-flexible-content.js
|
||||
// @codekit-prepend "../js/acf-setting-clone.js
|
||||
// @codekit-prepend "_acf-setting-repeater.js
|
||||
// @codekit-prepend "_acf-setting-flexible-content.js
|
||||
// @codekit-prepend "_acf-setting-clone.js
|
||||
|
|
@ -1701,6 +1701,6 @@
|
|||
|
||||
})(jQuery);
|
||||
|
||||
// @codekit-prepend "../js/acf-field-repeater.js";
|
||||
// @codekit-prepend "../js/acf-field-flexible-content.js";
|
||||
// @codekit-prepend "../js/acf-field-gallery.js";
|
||||
// @codekit-prepend "_acf-field-repeater.js";
|
||||
// @codekit-prepend "_acf-field-flexible-content.js";
|
||||
// @codekit-prepend "_acf-field-gallery.js";
|
||||
17
readme.txt
17
readme.txt
|
|
@ -66,6 +66,23 @@ From your WordPress dashboard
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 5.7.10 =
|
||||
*Release Date - 16 January 2019*
|
||||
|
||||
* Fix - Fixed bug preventing metaboxes from saving if validation fails within Gutenberg.
|
||||
* Fix - Fixed bug causing unload prompt to show incorrectly within Gutenberg.
|
||||
* Fix - Fixed JS error when selecting taxonomy terms within Gutenberg.
|
||||
* Fix - Fixed bug causing jQuery sortable issues within other plugins.
|
||||
* Tweak - Improved loading translations by adding fallback from region to country when .mo file does not exit.
|
||||
* Tweak - Improved punctuation throughout admin notices.
|
||||
* Tweak - Improved performance and accuracy when loading a user field value.
|
||||
* Dev - Added filter 'acf/get_locale' to customize the locale used to load translations.
|
||||
* Dev - Added filter 'acf/allow_unfiltered_html' to customize if current user can save unfiltered HTML.
|
||||
* Dev - Added new data storage functions `acf_register_store()` and `acf_get_store()`.
|
||||
* Dev - Moved from .less to .scss and minified all css.
|
||||
* i18n - Updated French translation thanks to Maxime Bernard-Jacquet.
|
||||
* i18n - Updated Czech translation thanks to David Rychly.
|
||||
|
||||
= 5.7.9 =
|
||||
*Release Date - 17 December 2018*
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue