Merge branch 'release/5.7.8' into develop
This commit is contained in:
commit
3e3dfad261
7
acf.php
7
acf.php
|
|
@ -2,8 +2,8 @@
|
|||
/*
|
||||
Plugin Name: Advanced Custom Fields PRO
|
||||
Plugin URI: https://www.advancedcustomfields.com/
|
||||
Description: Customise WordPress with powerful, professional and intuitive fields.
|
||||
Version: 5.7.6
|
||||
Description: Customize WordPress with powerful, professional and intuitive fields.
|
||||
Version: 5.7.8
|
||||
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.6';
|
||||
var $version = '5.7.8';
|
||||
|
||||
/** @var array The plugin settings array */
|
||||
var $settings = array();
|
||||
|
|
@ -120,6 +120,7 @@ class ACF {
|
|||
$this->define( 'ACF_PATH', $path );
|
||||
//$this->define( 'ACF_DEV', true );
|
||||
|
||||
|
||||
// api
|
||||
include_once( ACF_PATH . 'includes/api/api-helpers.php');
|
||||
acf_include('includes/api/api-input.php');
|
||||
|
|
|
|||
|
|
@ -1052,7 +1052,8 @@ html[dir="rtl"] #acf-popup .acf-popup-box .title .acf-icon {
|
|||
}
|
||||
#acf-upgrade-notice .col-content {
|
||||
float: left;
|
||||
width: 65%;
|
||||
width: 55%;
|
||||
padding-left: 90px;
|
||||
}
|
||||
#acf-upgrade-notice .col-actions {
|
||||
float: right;
|
||||
|
|
@ -1063,19 +1064,28 @@ html[dir="rtl"] #acf-popup .acf-popup-box .title .acf-icon {
|
|||
float: left;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
margin: 0 20px 0 0;
|
||||
margin: 0 0 0 -90px;
|
||||
}
|
||||
#acf-upgrade-notice h2 {
|
||||
font-size: 16px;
|
||||
margin: 0;
|
||||
margin: 2px 0 6.5px;
|
||||
}
|
||||
#acf-upgrade-notice p {
|
||||
padding: 0;
|
||||
margin-bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
#acf-upgrade-notice .button:before {
|
||||
margin-top: 11px;
|
||||
}
|
||||
@media screen and (max-width: 640px) {
|
||||
#acf-upgrade-notice .col-content,
|
||||
#acf-upgrade-notice .col-actions {
|
||||
float: none;
|
||||
padding-left: 90px;
|
||||
width: auto;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Welcome
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@
|
|||
background: #fff3e6;
|
||||
color: #d16226;
|
||||
}
|
||||
.acf-fieldtd,
|
||||
.acf-fieldtr {
|
||||
td.acf-field,
|
||||
tr.acf-field {
|
||||
margin: 0;
|
||||
}
|
||||
.acf-field[data-width] {
|
||||
|
|
@ -106,8 +106,8 @@ html[dir="rtl"] .acf-field[data-width] + .acf-field[data-width] {
|
|||
border-left: none;
|
||||
border-right: 1px solid #eeeeee;
|
||||
}
|
||||
.acf-field[data-width]td,
|
||||
.acf-field[data-width]tr {
|
||||
td.acf-field[data-width],
|
||||
tr.acf-field[data-width] {
|
||||
float: none;
|
||||
}
|
||||
.acf-field.-c0 {
|
||||
|
|
@ -267,6 +267,10 @@ html[dir="rtl"] .acf-fields.-left > .acf-field > .acf-input {
|
|||
margin: 0;
|
||||
border-left-color: #E1E1E1;
|
||||
}
|
||||
.acf-sortable-tr-helper {
|
||||
position: relative !important;
|
||||
display: table-row !important;
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* acf-postbox
|
||||
|
|
@ -344,10 +348,6 @@ html[dir="rtl"] .acf-fields.-left > .acf-field > .acf-input {
|
|||
padding: 0;
|
||||
}
|
||||
}
|
||||
/* override WP CSS */
|
||||
.metabox-prefs label.acf-hidden {
|
||||
display: none;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Inputs
|
||||
|
|
@ -2678,31 +2678,3 @@ p.submit .acf-spinner {
|
|||
.acf-postbox.acf-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Gutenberg
|
||||
*
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/*
|
||||
#editor {
|
||||
|
||||
.edit-post-layout__metaboxes {
|
||||
//border-top: none;
|
||||
}
|
||||
|
||||
.edit-post-meta-boxes-area {
|
||||
max-width: 80%;
|
||||
|
||||
.postbox {
|
||||
border: #e2e4e7 solid 1px;
|
||||
border-bottom: none;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
input {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2506,4 +2506,3 @@
|
|||
// @codekit-prepend "../js/field-group-fields.js";
|
||||
// @codekit-prepend "../js/field-group-locations.js";
|
||||
// @codekit-prepend "../js/field-group-compatibility.js";
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -3718,70 +3718,220 @@
|
|||
|
||||
(function($, undefined){
|
||||
|
||||
/**
|
||||
* acf.getPostbox
|
||||
*
|
||||
* Returns a postbox instance.
|
||||
*
|
||||
* @date 23/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param mixed $el Either a jQuery element or the postbox id.
|
||||
* @return object
|
||||
*/
|
||||
acf.getPostbox = function( $el ){
|
||||
|
||||
// allow string parameter
|
||||
if( typeof arguments[0] == 'string' ) {
|
||||
$el = $('#' + arguments[0]);
|
||||
}
|
||||
|
||||
// return instance
|
||||
return acf.getInstance( $el );
|
||||
};
|
||||
|
||||
/**
|
||||
* acf.getPostboxes
|
||||
*
|
||||
* Returns an array of postbox instances.
|
||||
*
|
||||
* @date 23/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param void
|
||||
* @return array
|
||||
*/
|
||||
acf.getPostboxes = function(){
|
||||
|
||||
// find all postboxes
|
||||
var $postboxes = $('.acf-postbox');
|
||||
|
||||
// return instances
|
||||
return acf.getInstances( $postboxes );
|
||||
};
|
||||
|
||||
/**
|
||||
* acf.newPostbox
|
||||
*
|
||||
* Returns a new postbox instance for the given props.
|
||||
*
|
||||
* @date 20/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param object props The postbox properties.
|
||||
* @return object
|
||||
*/
|
||||
acf.newPostbox = function( props ){
|
||||
return new acf.models.Postbox( props );
|
||||
};
|
||||
|
||||
/**
|
||||
* acf.models.Postbox
|
||||
*
|
||||
* The postbox model.
|
||||
*
|
||||
* @date 20/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
acf.models.Postbox = acf.Model.extend({
|
||||
|
||||
data: {
|
||||
id: '',
|
||||
id: '',
|
||||
key: '',
|
||||
style: 'default',
|
||||
label: 'top',
|
||||
editLink: '',
|
||||
editTitle: '',
|
||||
visibility: true
|
||||
visible: true,
|
||||
edit: '',
|
||||
html: true,
|
||||
},
|
||||
|
||||
setup: function( props ){
|
||||
|
||||
// compatibilty
|
||||
if( props.editLink ) {
|
||||
props.edit = props.editLink;
|
||||
}
|
||||
|
||||
// extend data
|
||||
$.extend(this.data, props);
|
||||
|
||||
// set $el
|
||||
this.$el = this.$postbox();
|
||||
},
|
||||
|
||||
$postbox: function(){
|
||||
return $('#' + this.get('id'));
|
||||
},
|
||||
|
||||
$placeholder: function(){
|
||||
return $('#' + this.get('id') + '-placeholder');
|
||||
},
|
||||
|
||||
$hide: function(){
|
||||
return $('#' + this.get('id') + '-hide');
|
||||
},
|
||||
|
||||
$hideLabel: function(){
|
||||
return this.$hide().parent();
|
||||
},
|
||||
|
||||
$hndle: function(){
|
||||
return this.$('> .hndle');
|
||||
},
|
||||
|
||||
$inside: function(){
|
||||
return this.$('> .inside');
|
||||
},
|
||||
|
||||
isVisible: function(){
|
||||
return this.get('visible');
|
||||
},
|
||||
|
||||
hasHTML: function(){
|
||||
return this.get('html');
|
||||
},
|
||||
|
||||
initialize: function(){
|
||||
|
||||
// vars
|
||||
var id = this.get('id');
|
||||
var $postbox = $('#' + id);
|
||||
var $toggle = $('#' + id + '-hide');
|
||||
var $label = $toggle.parent();
|
||||
// Add default class.
|
||||
this.$el.addClass('acf-postbox');
|
||||
|
||||
// add class
|
||||
$postbox.addClass('acf-postbox');
|
||||
$label.addClass('acf-postbox-toggle');
|
||||
// Remove 'hide-if-js class.
|
||||
// This class is added by WP to postboxes that are hidden via the "Screen Options" tab.
|
||||
this.$el.removeClass('hide-if-js');
|
||||
|
||||
// remove class
|
||||
$postbox.removeClass('hide-if-js');
|
||||
$label.removeClass('hide-if-js');
|
||||
|
||||
// field group style
|
||||
// Add field group style class.
|
||||
var style = this.get('style');
|
||||
if( style !== 'default' ) {
|
||||
$postbox.addClass( style );
|
||||
this.$el.addClass( style );
|
||||
}
|
||||
|
||||
// .inside class
|
||||
$postbox.children('.inside').addClass('acf-fields').addClass('-' + this.get('label'));
|
||||
// Add .inside class.
|
||||
this.$inside().addClass('acf-fields').addClass('-' + this.get('label'));
|
||||
|
||||
// Append edit link.
|
||||
var edit = this.get('edit');
|
||||
if( edit ) {
|
||||
this.$hndle().append('<a href="' + edit + '" class="dashicons dashicons-admin-generic acf-hndle-cog acf-js-tooltip" title="' + acf.__('Edit field group') + '"></a>');
|
||||
}
|
||||
|
||||
// visibility
|
||||
if( this.get('visibility') ) {
|
||||
$toggle.prop('checked', true);
|
||||
// Show postbox.
|
||||
if( this.isVisible() ) {
|
||||
this.show();
|
||||
|
||||
// Hide postbox.
|
||||
// Hidden postboxes do not contain HTML and are used as placeholders.
|
||||
} else {
|
||||
$postbox.addClass('acf-hidden');
|
||||
$label.addClass('acf-hidden');
|
||||
this.set('html', false);
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
||||
// edit link
|
||||
var editLink = this.get('editLink');
|
||||
var editTitle = this.get('editTitle');
|
||||
if( editLink ) {
|
||||
show: function(){
|
||||
|
||||
$postbox.children('.hndle').append('<a href="' + editLink + '" class="dashicons dashicons-admin-generic acf-hndle-cog acf-js-tooltip" title="' + editTitle + '"></a>');
|
||||
}
|
||||
// Show label.
|
||||
this.$hideLabel().show();
|
||||
|
||||
// toggle on checkbox
|
||||
this.$hide().prop('checked', true);
|
||||
|
||||
// Show postbox
|
||||
this.$el.show().removeClass('acf-hidden');
|
||||
},
|
||||
|
||||
enable: function(){
|
||||
acf.enable( this.$el, 'postbox' );
|
||||
},
|
||||
|
||||
showEnable: function(){
|
||||
this.show();
|
||||
this.enable();
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
|
||||
// Hide label.
|
||||
this.$hideLabel().hide();
|
||||
|
||||
// Hide postbox
|
||||
this.$el.hide().addClass('acf-hidden');
|
||||
},
|
||||
|
||||
disable: function(){
|
||||
acf.disable( this.$el, 'postbox' );
|
||||
},
|
||||
|
||||
hideDisable: function(){
|
||||
this.hide();
|
||||
this.disable();
|
||||
},
|
||||
|
||||
html: function( html ){
|
||||
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
|
||||
acf.newPostbox = function( props ){
|
||||
return new acf.models.Postbox( props );
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function($, undefined){
|
||||
|
|
@ -8626,6 +8776,9 @@
|
|||
var oldId = $textarea.attr('id');
|
||||
var newId = acf.uniqueId('acf-editor-');
|
||||
|
||||
// store copy of textarea data
|
||||
var data = $textarea.data();
|
||||
|
||||
// rename
|
||||
acf.rename({
|
||||
target: $wrap,
|
||||
|
|
@ -8639,6 +8792,10 @@
|
|||
|
||||
// initialize
|
||||
acf.tinymce.initialize( newId, args );
|
||||
|
||||
// apply data to new textarea (acf.rename creates a new textarea element due to destructive mode)
|
||||
// fixes bug where conditional logic "disabled" is lost during "screen_check"
|
||||
this.$input().data(data);
|
||||
},
|
||||
|
||||
onMousedown: function( e ){
|
||||
|
|
@ -10494,22 +10651,6 @@
|
|||
|
||||
initialize: function(){
|
||||
|
||||
/*
|
||||
// disable if not active
|
||||
if( !this.active ) {
|
||||
this.events = {};
|
||||
}
|
||||
|
||||
// bail early if not for post
|
||||
if( acf.get('screen') !== 'post' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
'check_screen_data'
|
||||
|
||||
'check_screen_events'
|
||||
|
||||
*/
|
||||
},
|
||||
/*
|
||||
|
||||
|
|
@ -10670,7 +10811,7 @@
|
|||
var ajaxData = acf.parseArgs(this.data, {
|
||||
action: 'acf/ajax/check_screen',
|
||||
screen: acf.get('screen'),
|
||||
exclude: []
|
||||
exists: []
|
||||
});
|
||||
|
||||
// post id
|
||||
|
|
@ -10703,11 +10844,16 @@
|
|||
ajaxData.post_terms = postTerms;
|
||||
}
|
||||
|
||||
// exclude existing postboxes
|
||||
$('.acf-postbox').not('.acf-hidden').each(function(){
|
||||
ajaxData.exclude.push( $(this).attr('id').substr(4) );
|
||||
// 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') );
|
||||
}
|
||||
});
|
||||
|
||||
// filter
|
||||
ajaxData = acf.applyFilters('check_screen_args', ajaxData);
|
||||
|
||||
// success
|
||||
var onSuccess = function( json ){
|
||||
|
||||
|
|
@ -10716,51 +10862,40 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// hide
|
||||
$('.acf-postbox').addClass('acf-hidden');
|
||||
$('.acf-postbox-toggle').addClass('acf-hidden');
|
||||
|
||||
// reset style
|
||||
$('#acf-style').html('');
|
||||
// vars
|
||||
var visible = [];
|
||||
|
||||
// loop
|
||||
json.data.map(function( fieldGroup, i ){
|
||||
json.data.results.map(function( fieldGroup, i ){
|
||||
|
||||
// vars
|
||||
var $postbox = $('#acf-' + fieldGroup.key);
|
||||
var $toggle = $('#acf-' + fieldGroup.key + '-hide');
|
||||
var $label = $toggle.parent();
|
||||
var id = 'acf-' + fieldGroup.key;
|
||||
var postbox = acf.getPostbox( id );
|
||||
|
||||
// show
|
||||
// use show() to force display when postbox has been hidden by 'Show on screen' toggle
|
||||
$postbox.removeClass('acf-hidden hide-if-js').show();
|
||||
$label.removeClass('acf-hidden hide-if-js').show();
|
||||
$toggle.prop('checked', true);
|
||||
// show postbox
|
||||
postbox.showEnable();
|
||||
|
||||
// replace HTML if needed
|
||||
var $replace = $postbox.find('.acf-replace-with-fields');
|
||||
if( $replace.exists() ) {
|
||||
$replace.replaceWith( fieldGroup.html );
|
||||
acf.doAction('append', $postbox);
|
||||
// append
|
||||
visible.push( id );
|
||||
|
||||
// update HTML
|
||||
if( !postbox.hasHTML() && fieldGroup.html ) {
|
||||
postbox.html( fieldGroup.html );
|
||||
}
|
||||
});
|
||||
|
||||
// update style if needed
|
||||
if( i === 0 ) {
|
||||
$('#acf-style').html( fieldGroup.style );
|
||||
// hide other postboxes
|
||||
acf.getPostboxes().map(function( postbox ){
|
||||
if( visible.indexOf( postbox.get('id') ) === -1 ) {
|
||||
postbox.hideDisable();
|
||||
}
|
||||
|
||||
// enable inputs
|
||||
acf.enable( $postbox, 'postbox' );
|
||||
});
|
||||
};
|
||||
|
||||
// complete
|
||||
var onComplete = function( json ){
|
||||
// reset style
|
||||
$('#acf-style').html( json.data.style );
|
||||
|
||||
// disable inputs
|
||||
$('.acf-postbox.acf-hidden').each(function(){
|
||||
acf.disable( $(this), 'postbox' );
|
||||
});
|
||||
// action
|
||||
acf.doAction('check_screen_complete', json.data, ajaxData);
|
||||
};
|
||||
|
||||
// ajax
|
||||
|
|
@ -10770,8 +10905,7 @@
|
|||
type: 'post',
|
||||
dataType: 'json',
|
||||
context: this,
|
||||
success: onSuccess,
|
||||
complete: onComplete
|
||||
success: onSuccess
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -12991,19 +13125,23 @@
|
|||
// if $item is a tr, apply some css to the elements
|
||||
if( $item.is('tr') ) {
|
||||
|
||||
// temp set as relative to find widths
|
||||
$item.css('position', 'relative');
|
||||
// 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>');
|
||||
|
||||
// set widths for td children
|
||||
// add helper class to remove absolute positioning
|
||||
$item.addClass('acf-sortable-tr-helper');
|
||||
|
||||
// set fixed widths for children
|
||||
$item.children().each(function(){
|
||||
$(this).width($(this).width());
|
||||
$(this).width( $(this).width() );
|
||||
});
|
||||
|
||||
// revert position css
|
||||
$item.css('position', 'absolute');
|
||||
// mimic height
|
||||
$placeholder.height( $item.height() + 'px' );
|
||||
|
||||
// add markup to the placeholder
|
||||
$placeholder.html('<td style="height:' + $item.height() + 'px; padding:0;" colspan="' + $item.children('td').length + '"></td>');
|
||||
// remove class
|
||||
$item.removeClass('acf-sortable-tr-helper');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -14079,5 +14217,3 @@
|
|||
// @codekit-prepend "../js/acf-validation.js";
|
||||
// @codekit-prepend "../js/acf-helpers.js";
|
||||
// @codekit-prepend "../js/acf-compatibility";
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -43,9 +43,27 @@ class acf_admin_field_group {
|
|||
|
||||
// filters
|
||||
add_filter('post_updated_messages', array($this, 'post_updated_messages'));
|
||||
|
||||
add_filter('use_block_editor_for_post_type', array($this, 'use_block_editor_for_post_type'), 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* use_block_editor_for_post_type
|
||||
*
|
||||
* Prevents the block editor from loading when editing an ACF field group.
|
||||
*
|
||||
* @date 7/12/18
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
|
||||
* @param string $post_type The post type being checked.
|
||||
* @return bool
|
||||
*/
|
||||
function use_block_editor_for_post_type( $use_block_editor, $post_type ) {
|
||||
if( $post_type === 'acf-field-group' ) {
|
||||
return false;
|
||||
}
|
||||
return $use_block_editor;
|
||||
}
|
||||
|
||||
/*
|
||||
* post_updated_messages
|
||||
|
|
@ -440,9 +458,16 @@ class acf_admin_field_group {
|
|||
return $post_id;
|
||||
}
|
||||
|
||||
// Bail early if request came from an unauthorised user.
|
||||
if( !current_user_can(acf_get_setting('capability')) ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
|
||||
// disable filters to ensure ACF loads raw data from DB
|
||||
acf_disable_filters();
|
||||
|
||||
|
||||
// save fields
|
||||
if( !empty($_POST['acf_fields']) ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,26 @@ class acf_admin_field_groups {
|
|||
add_action('trashed_post', array($this, 'trashed_post'));
|
||||
add_action('untrashed_post', array($this, 'untrashed_post'));
|
||||
add_action('deleted_post', array($this, 'deleted_post'));
|
||||
|
||||
add_action('load-edit.php', array($this, 'maybe_redirect_edit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* maybe_redirect_edit
|
||||
*
|
||||
* Redirects the user from the old ACF4 edit page to the new ACF5 edit page
|
||||
*
|
||||
* @date 17/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function maybe_redirect_edit() {
|
||||
if( acf_maybe_get_GET('post_type') == 'acf' ) {
|
||||
wp_redirect( admin_url($this->url) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* current_screen
|
||||
|
|
@ -60,9 +77,7 @@ class acf_admin_field_groups {
|
|||
|
||||
// validate screen
|
||||
if( !acf_is_screen('edit-acf-field-group') ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -604,7 +619,7 @@ class acf_admin_field_groups {
|
|||
<div class="acf-box">
|
||||
<div class="inner">
|
||||
<h2><?php echo acf_get_setting('name'); ?></h2>
|
||||
<p><?php _e('Customise WordPress with powerful, professional and intuitive fields.','acf'); ?></p>
|
||||
<p><?php _e('Customize WordPress with powerful, professional and intuitive fields.','acf'); ?></p>
|
||||
|
||||
<h3><?php _e("Changelog",'acf'); ?></h3>
|
||||
<p><?php
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if( !acf_get_setting('pro') ) {
|
|||
<h2><?php _e("Database Upgrade Required",'acf'); ?></h2>
|
||||
<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version') ); ?><br /><?php _e("This version contains improvements to your database and requires an upgrade.", 'acf'); ?></p>
|
||||
<?php if( !empty($plugins) ): ?>
|
||||
<p><?php printf(__("Please also ensure any premium add-ons (%s) have first been updated to the latest version.", 'acf'), implode(', ', $plugins) ); ?></p>
|
||||
<p><?php printf(__("Please also check all premium add-ons (%s) are updated to the latest version.", 'acf'), implode(', ', $plugins) ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,17 @@ class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
|||
|
||||
// vars
|
||||
$args = acf_parse_args($this->request, array(
|
||||
'screen' => '',
|
||||
'post_id' => 0,
|
||||
'ajax' => 1,
|
||||
'exclude' => array()
|
||||
'exists' => array()
|
||||
));
|
||||
|
||||
// vars
|
||||
$json = array();
|
||||
$json = array(
|
||||
'results' => array(),
|
||||
'style' => ''
|
||||
);
|
||||
|
||||
// get field groups
|
||||
$field_groups = acf_get_field_groups( $args );
|
||||
|
|
@ -47,17 +51,16 @@ class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
|||
$item = array(
|
||||
'key' => $field_group['key'],
|
||||
'title' => $field_group['title'],
|
||||
'html' => '',
|
||||
'style' => ''
|
||||
'html' => ''
|
||||
);
|
||||
|
||||
// style
|
||||
// append first field group's style
|
||||
if( $i == 0 ) {
|
||||
$item['style'] = acf_get_field_group_style( $field_group );
|
||||
$json['style'] = acf_get_field_group_style( $field_group );
|
||||
}
|
||||
|
||||
// html
|
||||
if( !in_array($field_group['key'], $args['exclude']) ) {
|
||||
// append html if doesnt already exist on page
|
||||
if( !in_array($field_group['key'], $args['exists']) ) {
|
||||
|
||||
// load fields
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
|
@ -72,9 +75,10 @@ class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
|||
}
|
||||
|
||||
// append
|
||||
$json[] = $item;
|
||||
$json['results'][] = $item;
|
||||
}}
|
||||
|
||||
|
||||
// return
|
||||
return $json;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1216,5 +1216,23 @@ function acf_prepare_field_group_for_export( $field_group ) {
|
|||
return $field_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_field_group_edit_link
|
||||
*
|
||||
* Checks if the current user can edit the field group and returns the edit url.
|
||||
*
|
||||
* @date 23/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param int $post_id The field group ID.
|
||||
* @return string
|
||||
*/
|
||||
function acf_get_field_group_edit_link( $post_id ) {
|
||||
if( $post_id && acf_current_user_can_admin() ) {
|
||||
return admin_url('post.php?post=' . $post_id . '&action=edit');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -161,10 +161,6 @@ class ACF_Assets {
|
|||
add_action($actions['admin_footer'], 'acf_enqueue_uploader', 5);
|
||||
}
|
||||
|
||||
// enqueue
|
||||
wp_enqueue_script('acf-input');
|
||||
wp_enqueue_style('acf-input');
|
||||
|
||||
// localize text
|
||||
acf_localize_text(array(
|
||||
|
||||
|
|
@ -205,10 +201,10 @@ class ACF_Assets {
|
|||
'Value is less than' => __('Value is less than', 'acf'),
|
||||
'Selection is greater than' => __('Selection is greater than', 'acf'),
|
||||
'Selection is less than' => __('Selection is less than', 'acf'),
|
||||
));
|
||||
|
||||
// action
|
||||
do_action('acf/enqueue_scripts');
|
||||
// misc
|
||||
'Edit field group' => __('Edit field group', 'acf'),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -226,10 +222,15 @@ class ACF_Assets {
|
|||
|
||||
function admin_enqueue_scripts() {
|
||||
|
||||
// enqueue
|
||||
wp_enqueue_script('acf-input');
|
||||
wp_enqueue_style('acf-input');
|
||||
|
||||
// vars
|
||||
$text = array();
|
||||
|
||||
// actions
|
||||
do_action('acf/enqueue_scripts');
|
||||
do_action('acf/admin_enqueue_scripts');
|
||||
do_action('acf/input/admin_enqueue_scripts');
|
||||
|
||||
|
|
|
|||
|
|
@ -91,37 +91,38 @@ class acf_field_date_picker extends acf_field {
|
|||
|
||||
function render_field( $field ) {
|
||||
|
||||
// format value
|
||||
// vars
|
||||
$hidden_value = '';
|
||||
$display_value = '';
|
||||
|
||||
// format value
|
||||
if( $field['value'] ) {
|
||||
|
||||
$hidden_value = acf_format_date( $field['value'], 'Ymd' );
|
||||
$display_value = acf_format_date( $field['value'], $field['display_format'] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// vars
|
||||
// elements
|
||||
$div = array(
|
||||
'class' => 'acf-date-picker acf-input-wrap',
|
||||
'data-date_format' => acf_convert_date_to_js($field['display_format']),
|
||||
'data-first_day' => $field['first_day'],
|
||||
);
|
||||
|
||||
$hidden_input = array(
|
||||
'id' => $field['id'],
|
||||
'class' => 'input-alt',
|
||||
'name' => $field['name'],
|
||||
'value' => $hidden_value,
|
||||
);
|
||||
|
||||
$text_input = array(
|
||||
'class' => 'input',
|
||||
'value' => $display_value,
|
||||
);
|
||||
|
||||
// special attributes
|
||||
foreach( array( 'readonly', 'disabled', 'required' ) as $k ) {
|
||||
if( !empty($field[ $k ]) ) {
|
||||
$hidden_input[ $k ] = $text_input[ $k ] = $k;
|
||||
}
|
||||
}
|
||||
|
||||
// save_format - compatibility with ACF < 5.0.0
|
||||
if( !empty($field['save_format']) ) {
|
||||
|
|
@ -134,10 +135,8 @@ class acf_field_date_picker extends acf_field {
|
|||
|
||||
// remove formatted value (will do this via JS)
|
||||
$text_input['value'] = '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// html
|
||||
?>
|
||||
<div <?php acf_esc_attr_e( $div ); ?>>
|
||||
|
|
@ -145,7 +144,6 @@ class acf_field_date_picker extends acf_field {
|
|||
<?php acf_text_input( $text_input ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ class acf_field_google_map extends acf_field {
|
|||
'client' => acf_get_setting('google_api_client'),
|
||||
'libraries' => 'places',
|
||||
'ver' => 3,
|
||||
'callback' => ''
|
||||
'callback' => '',
|
||||
'language' => acf_get_locale()
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -230,7 +231,7 @@ class acf_field_google_map extends acf_field {
|
|||
// allow_null
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Height','acf'),
|
||||
'instructions' => __('Customise the map height','acf'),
|
||||
'instructions' => __('Customize the map height','acf'),
|
||||
'type' => 'text',
|
||||
'name' => 'height',
|
||||
'append' => 'px',
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ class ACF_Form {
|
|||
* @return boolean Returns true on success.
|
||||
*/
|
||||
|
||||
|
||||
function save_post( $post_id = 0, $values = null ) {
|
||||
|
||||
// override $_POST
|
||||
|
|
@ -155,6 +154,11 @@ class ACF_Form {
|
|||
'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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,527 +1,359 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* ACF Post Form Class
|
||||
*
|
||||
* All the logic for adding fields to posts
|
||||
*
|
||||
* @class acf_form_post
|
||||
* @package ACF
|
||||
* @subpackage Forms
|
||||
*/
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('ACF_Form_Post') ) :
|
||||
|
||||
class ACF_Form_Post {
|
||||
|
||||
var $post_id = 0,
|
||||
$typenow = '',
|
||||
$style = '';
|
||||
/** @var string The first field groups style CSS. */
|
||||
var $style = '';
|
||||
|
||||
/** @var array An arry of postbox data. */
|
||||
var $postboxes = array();
|
||||
|
||||
/*
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* This function will setup the class functionality
|
||||
* Sets up the class functionality.
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function __construct() {
|
||||
|
||||
// actions
|
||||
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
||||
|
||||
// initialize on post edit screens
|
||||
add_action('load-post.php', array($this, 'initialize'));
|
||||
add_action('load-post-new.php', array($this, 'initialize'));
|
||||
|
||||
// save
|
||||
add_filter('wp_insert_post_empty_content', array($this, 'wp_insert_post_empty_content'), 10, 2);
|
||||
add_action('save_post', array($this, 'save_post'), 10, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* validate_page
|
||||
/**
|
||||
* initialize
|
||||
*
|
||||
* This function will check if the current page is for a post/page edit form
|
||||
* Sets up Form functionality.
|
||||
*
|
||||
* @type function
|
||||
* @date 23/06/12
|
||||
* @since 3.1.8
|
||||
* @date 19/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param n/a
|
||||
* @return (boolean)
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
function initialize() {
|
||||
|
||||
function validate_page() {
|
||||
|
||||
// global
|
||||
global $post, $pagenow, $typenow;
|
||||
|
||||
|
||||
// vars
|
||||
$return = false;
|
||||
|
||||
|
||||
// validate page
|
||||
if( in_array($pagenow, array('post.php', 'post-new.php')) ) {
|
||||
|
||||
$return = true;
|
||||
// globals
|
||||
global $typenow;
|
||||
|
||||
// restrict specific post types
|
||||
$restricted = array('acf-field-group', 'attachment');
|
||||
if( in_array($typenow, $restricted) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// update vars
|
||||
if( !empty($post) ) {
|
||||
|
||||
$this->post_id = (int) $post->ID;
|
||||
$this->typenow = $typenow;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// validate post type
|
||||
if( in_array($typenow, array('acf-field-group', 'attachment')) ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// validate page (Shopp)
|
||||
if( $pagenow == "admin.php" && isset( $_GET['page'] ) && $_GET['page'] == "shopp-products" && isset( $_GET['id'] ) ) {
|
||||
|
||||
$return = true;
|
||||
|
||||
$this->post_id = absint( $_GET['id'] );
|
||||
$this->typenow = 'shopp_product';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_enqueue_scripts
|
||||
*
|
||||
* This action is run after post query but before any admin script / head actions.
|
||||
* It is a good place to register all actions.
|
||||
*
|
||||
* @type action (admin_enqueue_scripts)
|
||||
* @date 26/01/13
|
||||
* @since 3.6.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function admin_enqueue_scripts() {
|
||||
|
||||
// validate page
|
||||
if( !$this->validate_page() ) return;
|
||||
|
||||
|
||||
// load acf scripts
|
||||
// enqueue scripts
|
||||
acf_enqueue_scripts(array(
|
||||
'uploader' => true,
|
||||
));
|
||||
|
||||
|
||||
// actions
|
||||
add_action('acf/input/admin_head', array($this,'admin_head'));
|
||||
add_action('acf/input/admin_footer', array($this,'admin_footer'));
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_head
|
||||
/**
|
||||
* add_meta_boxes
|
||||
*
|
||||
* This action will find and add field groups to the current edit page
|
||||
* Adds ACF metaboxes for the given $post_type and $post.
|
||||
*
|
||||
* @type action (admin_head)
|
||||
* @date 23/06/12
|
||||
* @since 3.1.8
|
||||
* @date 19/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param string $post_type The post type.
|
||||
* @param WP_Post $post The post being edited.
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function admin_head() {
|
||||
function add_meta_boxes( $post_type, $post ) {
|
||||
|
||||
// vars
|
||||
$style_found = false;
|
||||
$postboxes = array();
|
||||
$count = 0;
|
||||
|
||||
|
||||
// get field groups
|
||||
// get all field groups
|
||||
$field_groups = acf_get_field_groups();
|
||||
|
||||
// loop
|
||||
if( $field_groups ) {
|
||||
foreach( $field_groups as $field_group ) {
|
||||
|
||||
// add meta boxes
|
||||
if( !empty($field_groups) ) {
|
||||
|
||||
foreach( $field_groups as $i => $field_group ) {
|
||||
|
||||
// vars
|
||||
$id = "acf-{$field_group['key']}";
|
||||
$title = $field_group['title'];
|
||||
$context = $field_group['position'];
|
||||
$priority = 'high';
|
||||
$args = array(
|
||||
'field_group' => $field_group,
|
||||
'visibility' => false
|
||||
);
|
||||
|
||||
|
||||
// tweaks to vars
|
||||
if( $context == 'side' ) {
|
||||
|
||||
$priority = 'core';
|
||||
|
||||
}
|
||||
|
||||
|
||||
// filter for 3rd party customization
|
||||
$priority = apply_filters('acf/input/meta_box_priority', $priority, $field_group);
|
||||
|
||||
|
||||
// visibility
|
||||
$args['visibility'] = acf_get_field_group_visibility( $field_group, array(
|
||||
'post_id' => $this->post_id,
|
||||
'post_type' => $this->typenow
|
||||
));
|
||||
|
||||
|
||||
// add meta box
|
||||
add_meta_box( $id, $title, array($this, 'render_meta_box'), $this->typenow, $context, $priority, $args );
|
||||
|
||||
|
||||
// update style
|
||||
if( !$style_found && $args['visibility'] ) {
|
||||
|
||||
$style_found = true;
|
||||
|
||||
$this->style = acf_get_field_group_style( $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
|
||||
|
||||
// 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
|
||||
));
|
||||
|
||||
// Allow 'acf_after_title' metabox position
|
||||
add_action('edit_form_after_title', array($this, 'edit_form_after_title'));
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
// remove postcustom metabox (removes expensive SQL query)
|
||||
if( acf_get_setting('remove_wp_meta_box') ) {
|
||||
|
||||
remove_meta_box( 'postcustom', false, 'normal' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// remove ACF values from meta postbox ()
|
||||
add_filter('is_protected_meta', array($this, 'is_protected_meta'), 10, 3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* edit_form_after_title
|
||||
*
|
||||
* This action will allow ACF to render metaboxes after the title
|
||||
* Called after the title adn before the content editor.
|
||||
*
|
||||
* @type action
|
||||
* @date 17/08/13
|
||||
* @date 19/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function edit_form_after_title() {
|
||||
|
||||
// globals
|
||||
global $post, $wp_meta_boxes;
|
||||
|
||||
|
||||
// render post data
|
||||
acf_form_data(array(
|
||||
'screen' => 'post',
|
||||
'post_id' => $this->post_id,
|
||||
'ajax' => 1
|
||||
'post_id' => $post->ID
|
||||
));
|
||||
|
||||
// render 'acf_after_title' metaboxes
|
||||
do_meta_boxes( get_current_screen(), 'acf_after_title', $post );
|
||||
|
||||
// render
|
||||
do_meta_boxes( get_current_screen(), 'acf_after_title', $post);
|
||||
|
||||
|
||||
// clean up
|
||||
// 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
|
||||
*
|
||||
* description
|
||||
* Renders the ACF metabox HTML.
|
||||
*
|
||||
* @type function
|
||||
* @date 20/10/13
|
||||
* @since 5.0.0
|
||||
* @date 19/9/18
|
||||
* @since 5.7.6
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param WP_Post $post The post being edited.
|
||||
* @param array metabox The add_meta_box() args.
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function render_meta_box( $post, $args ) {
|
||||
|
||||
// extract args
|
||||
extract( $args ); // all variables from the add_meta_box function
|
||||
extract( $args ); // all variables from the args argument
|
||||
|
||||
function render_meta_box( $post, $metabox ) {
|
||||
|
||||
// vars
|
||||
$o = array(
|
||||
'id' => $id,
|
||||
'key' => $field_group['key'],
|
||||
'style' => $field_group['style'],
|
||||
'label' => $field_group['label_placement'],
|
||||
'editLink' => '',
|
||||
'editTitle' => __('Edit field group', 'acf'),
|
||||
'visibility' => $visibility
|
||||
);
|
||||
$id = $metabox['id'];
|
||||
$field_group = $metabox['args']['field_group'];
|
||||
$postbox = $this->postboxes[ $id ];
|
||||
|
||||
|
||||
// edit_url
|
||||
if( $field_group['ID'] && acf_current_user_can_admin() ) {
|
||||
|
||||
$o['editLink'] = admin_url('post.php?post=' . $field_group['ID'] . '&action=edit');
|
||||
|
||||
}
|
||||
|
||||
|
||||
// load and render fields
|
||||
if( $visibility ) {
|
||||
|
||||
// load fields
|
||||
// render fields if visible
|
||||
if( $postbox['visible'] ) {
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
|
||||
// render
|
||||
acf_render_fields( $fields, $this->post_id, 'div', $field_group['instruction_placement'] );
|
||||
|
||||
// render replace-me div
|
||||
} else {
|
||||
|
||||
echo '<div class="acf-replace-with-fields"><div class="acf-loading"></div></div>';
|
||||
|
||||
acf_render_fields( $fields, $post->ID, 'div', $field_group['instruction_placement'] );
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
|
||||
acf.newPostbox(<?php echo json_encode($o); ?>);
|
||||
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
// inline javascript
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
acf.newPostbox(<?php echo wp_json_encode($postbox); ?>);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* admin_footer
|
||||
*
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 21/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function admin_footer(){
|
||||
|
||||
// get style of first field group
|
||||
echo '<style type="text/css" id="acf-style">' . $this->style . '</style>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* wp_insert_post_empty_content
|
||||
*
|
||||
* This function will allow WP to insert a new post without title / content if ACF data exists
|
||||
* Allows WP to insert a new post without title or post_content if ACF data exists.
|
||||
*
|
||||
* @type function
|
||||
* @date 16/07/2014
|
||||
* @since 5.0.1
|
||||
*
|
||||
* @param $maybe_empty (bool) whether the post should be considered "empty"
|
||||
* @param $postarr (array) Array of post data
|
||||
* @return $maybe_empty
|
||||
* @param bool $maybe_empty Whether the post should be considered "empty".
|
||||
* @param array $postarr Array of post data.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function wp_insert_post_empty_content( $maybe_empty, $postarr ) {
|
||||
|
||||
// return false and allow insert if '_acf_changed' exists
|
||||
if( $maybe_empty && acf_maybe_get_POST('_acf_changed') ) {
|
||||
|
||||
$maybe_empty = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $maybe_empty;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* allow_save_post
|
||||
*
|
||||
* This function will return true if the post is allowed to be saved
|
||||
* Checks if the $post is allowed to be saved.
|
||||
* Used to avoid triggering "acf/save_post" on dynamically created posts during save.
|
||||
*
|
||||
* @type function
|
||||
* @date 26/06/2016
|
||||
* @since 5.3.8
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param WP_Post $post The post to check.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function allow_save_post( $post ) {
|
||||
|
||||
// vars
|
||||
$allow = true;
|
||||
|
||||
// restrict post types
|
||||
$restrict = array( 'auto-draft', 'revision', 'acf-field', 'acf-field-group' );
|
||||
if( in_array($post->post_type, $restrict) ) {
|
||||
$allow = false;
|
||||
}
|
||||
|
||||
// disallow if is post type
|
||||
$post_types = array( 'auto-draft', 'revision', 'acf-field', 'acf-field-group' );
|
||||
if( in_array($post->post_type, $post_types) ) $allow = false;
|
||||
|
||||
|
||||
// disallow if not the form post
|
||||
// disallow if the $_POST ID value does not match the $post->ID
|
||||
$form_post_id = (int) acf_maybe_get_POST('post_ID');
|
||||
if( $form_post_id && $form_post_id !== $post->ID ) $allow = false;
|
||||
|
||||
if( $form_post_id && $form_post_id !== $post->ID ) {
|
||||
$allow = false;
|
||||
}
|
||||
|
||||
// revision (preview)
|
||||
if( $post->post_type == 'revision' ) {
|
||||
|
||||
// allow if doing preview
|
||||
if( acf_maybe_get_POST('wp-preview') == 'dopreview' ) $allow = true;
|
||||
|
||||
|
||||
// disallow if not a revision of the form post
|
||||
if( $form_post_id && $form_post_id !== $post->post_parent ) $allow = false;
|
||||
|
||||
// allow if doing preview and this $post is a child of the $_POST ID
|
||||
if( acf_maybe_get_POST('wp-preview') == 'dopreview' && $form_post_id === $post->post_parent) {
|
||||
$allow = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $allow;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* save_post
|
||||
*
|
||||
* This function will validate and save the $_POST data
|
||||
* Triggers during the 'save_post' action to save the $_POST data.
|
||||
*
|
||||
* @type function
|
||||
* @date 23/06/12
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param int $post_id The post ID
|
||||
* @param WP_POST $post the post object.
|
||||
* @return int
|
||||
*/
|
||||
|
||||
function save_post( $post_id, $post ) {
|
||||
|
||||
// bail ealry if no allowed to save this post type
|
||||
if( !$this->allow_save_post($post) ) return $post_id;
|
||||
|
||||
if( !$this->allow_save_post($post) ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
// verify nonce
|
||||
if( !acf_verify_nonce('post') ) return $post_id;
|
||||
|
||||
if( !acf_verify_nonce('post') ) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
// validate for published post (allow draft to save without validation)
|
||||
if( $post->post_status == 'publish' ) {
|
||||
|
||||
// show errors
|
||||
acf_validate_save_post( true );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// save
|
||||
acf_save_post( $post_id );
|
||||
|
||||
|
||||
// save revision
|
||||
if( post_type_supports($post->post_type, 'revisions') ) {
|
||||
|
||||
acf_save_post_revision( $post_id );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $post_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* is_protected_meta
|
||||
*
|
||||
* This function will remove any ACF meta from showing in the meta postbox
|
||||
*
|
||||
* @type function
|
||||
* @date 12/04/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function is_protected_meta( $protected, $meta_key, $meta_type ) {
|
||||
|
||||
// if acf_get_reference returns a valid key, this is an acf value, so protect it!
|
||||
if( !$protected ) {
|
||||
|
||||
$reference = acf_get_reference( $meta_key, $this->post_id );
|
||||
|
||||
if( acf_is_field_key($reference) ) {
|
||||
|
||||
$protected = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $protected;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
acf_new_instance('ACF_Form_Post');
|
||||
|
|
|
|||
|
|
@ -43,8 +43,14 @@ function acf_has_upgrade() {
|
|||
*/
|
||||
function acf_upgrade_all() {
|
||||
|
||||
// increase time limit
|
||||
@set_time_limit(600);
|
||||
|
||||
// start timer
|
||||
timer_start();
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_all');
|
||||
acf_dev_log('ACF Upgrade Begin.');
|
||||
|
||||
// vars
|
||||
$db_version = acf_get_db_version();
|
||||
|
|
@ -61,6 +67,10 @@ function acf_upgrade_all() {
|
|||
|
||||
// upgrade DB version once all updates are complete
|
||||
acf_update_db_version( ACF_VERSION );
|
||||
|
||||
// log
|
||||
global $wpdb;
|
||||
acf_dev_log('ACF Upgrade Complete.', $wpdb->num_queries, timer_stop(0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -107,7 +117,7 @@ function acf_update_db_version( $version = '' ) {
|
|||
function acf_upgrade_500() {
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_500');
|
||||
acf_dev_log('ACF Upgrade 5.0.0.');
|
||||
|
||||
// action
|
||||
do_action('acf/upgrade_500');
|
||||
|
|
@ -133,7 +143,7 @@ function acf_upgrade_500() {
|
|||
function acf_upgrade_500_field_groups() {
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_500_field_groups');
|
||||
acf_dev_log('ACF Upgrade 5.0.0 Field Groups.');
|
||||
|
||||
// get old field groups
|
||||
$ofgs = get_posts(array(
|
||||
|
|
@ -165,6 +175,9 @@ function acf_upgrade_500_field_groups() {
|
|||
*/
|
||||
function acf_upgrade_500_field_group( $ofg ) {
|
||||
|
||||
// log
|
||||
acf_dev_log('ACF Upgrade 5.0.0 Field Group.', $ofg);
|
||||
|
||||
// vars
|
||||
$nfg = array(
|
||||
'ID' => 0,
|
||||
|
|
@ -201,12 +214,12 @@ function acf_upgrade_500_field_group( $ofg ) {
|
|||
// acf_upgrade_field_group will call the acf_get_valid_field_group function and apply 'compatibility' changes
|
||||
$nfg = acf_update_field_group( $nfg );
|
||||
|
||||
// log
|
||||
acf_dev_log('> Complete.', $nfg);
|
||||
|
||||
// action for 3rd party
|
||||
do_action('acf/upgrade_500_field_group', $nfg, $ofg);
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_500_field_group', $ofg, $nfg);
|
||||
|
||||
// upgrade fields
|
||||
acf_upgrade_500_fields( $ofg, $nfg );
|
||||
|
||||
|
|
@ -233,6 +246,9 @@ function acf_upgrade_500_field_group( $ofg ) {
|
|||
*/
|
||||
function acf_upgrade_500_fields( $ofg, $nfg ) {
|
||||
|
||||
// log
|
||||
acf_dev_log('ACF Upgrade 5.0.0 Fields.');
|
||||
|
||||
// global
|
||||
global $wpdb;
|
||||
|
||||
|
|
@ -279,6 +295,9 @@ function acf_upgrade_500_fields( $ofg, $nfg ) {
|
|||
*/
|
||||
function acf_upgrade_500_field( $field ) {
|
||||
|
||||
// log
|
||||
acf_dev_log('ACF Upgrade 5.0.0 Field.', $field);
|
||||
|
||||
// order_no is now menu_order
|
||||
$field['menu_order'] = acf_extract_var( $field, 'order_no', 0 );
|
||||
|
||||
|
|
@ -332,7 +351,7 @@ function acf_upgrade_500_field( $field ) {
|
|||
$field = acf_update_field( $field );
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_500_field', $field);
|
||||
acf_dev_log('> Complete.', $field);
|
||||
|
||||
// sub fields
|
||||
if( $sub_fields ) {
|
||||
|
|
@ -363,7 +382,7 @@ function acf_upgrade_500_field( $field ) {
|
|||
function acf_upgrade_550() {
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_550');
|
||||
acf_dev_log('ACF Upgrade 5.5.0.');
|
||||
|
||||
// action
|
||||
do_action('acf/upgrade_550');
|
||||
|
|
@ -389,7 +408,7 @@ function acf_upgrade_550() {
|
|||
function acf_upgrade_550_termmeta() {
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_550_termmeta');
|
||||
acf_dev_log('ACF Upgrade 5.5.0 Termmeta.');
|
||||
|
||||
// bail early if no wp_termmeta table
|
||||
if( get_option('db_version') < 34370 ) {
|
||||
|
|
@ -444,7 +463,7 @@ add_action( 'wp_upgrade', 'acf_wp_upgrade_550_termmeta', 10, 2 );
|
|||
function acf_upgrade_550_taxonomy( $taxonomy ) {
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_550_taxonomy', $taxonomy);
|
||||
acf_dev_log('ACF Upgrade 5.5.0 Taxonomy.', $taxonomy);
|
||||
|
||||
// global
|
||||
global $wpdb;
|
||||
|
|
@ -489,19 +508,27 @@ function acf_upgrade_550_taxonomy( $taxonomy ) {
|
|||
|
||||
// vars
|
||||
$term_id = $matches[2];
|
||||
$meta_name = $matches[1] . $matches[3];
|
||||
$meta_key = $matches[1] . $matches[3];
|
||||
$meta_value = $row['option_value'];
|
||||
|
||||
// log
|
||||
acf_dev_log('acf_upgrade_550_term', $term_id, $meta_name, $meta_value);
|
||||
|
||||
// update
|
||||
update_metadata( 'term', $term_id, $meta_name, $meta_value );
|
||||
// memory usage reduced by 50% by using a manual insert vs update_metadata() function.
|
||||
//update_metadata( 'term', $term_id, $meta_name, $meta_value );
|
||||
$wpdb->insert( $wpdb->termmeta, array(
|
||||
'term_id' => $term_id,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value
|
||||
));
|
||||
|
||||
// log
|
||||
acf_dev_log('ACF Upgrade 5.5.0 Term.', $term_id, $meta_key);
|
||||
|
||||
// action
|
||||
do_action('acf/upgrade_550_taxonomy_term', $term_id);
|
||||
}}
|
||||
|
||||
// action for 3rd party
|
||||
do_action('acf/upgrade_550_taxonomy', $taxonomy);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
2252
lang/acf-tr_TR.po
2252
lang/acf-tr_TR.po
File diff suppressed because it is too large
Load Diff
|
|
@ -261,6 +261,15 @@ class acf_admin_options_page {
|
|||
|
||||
function postbox_submitdiv( $post, $args ) {
|
||||
|
||||
/**
|
||||
* Fires before the major-publishing-actions div.
|
||||
*
|
||||
* @date 24/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param array $page The current options page.
|
||||
*/
|
||||
do_action( 'acf/options_page/submitbox_before_major_actions', $this->page );
|
||||
?>
|
||||
<div id="major-publishing-actions">
|
||||
|
||||
|
|
@ -269,11 +278,21 @@ class acf_admin_options_page {
|
|||
<input type="submit" accesskey="p" value="<?php echo $this->page['update_button']; ?>" class="button button-primary button-large" id="publish" name="publish">
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Fires before the major-publishing-actions div.
|
||||
*
|
||||
* @date 24/9/18
|
||||
* @since 5.7.7
|
||||
*
|
||||
* @param array $page The current options page.
|
||||
*/
|
||||
do_action( 'acf/options_page/submitbox_major_actions', $this->page );
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -227,12 +227,21 @@ class acf_admin_settings_updates {
|
|||
$this->view['changelog'] = $this->get_changelog_section($info['changelog'], $info['version']);
|
||||
$this->view['upgrade_notice'] = $this->get_changelog_section($info['upgrade_notice'], $info['version']);
|
||||
|
||||
// refresh transient if:
|
||||
// a) A license is active (can get update)
|
||||
// b) No update exists, or the update version is stale
|
||||
// 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();
|
||||
}
|
||||
|
|
@ -291,6 +300,8 @@ class acf_admin_settings_updates {
|
|||
// update license
|
||||
acf_pro_update_license( $response['license'] );
|
||||
|
||||
// refresh transient
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// show message
|
||||
$this->show_notice( $response['message'] );
|
||||
|
|
@ -356,6 +367,8 @@ class acf_admin_settings_updates {
|
|||
// clear DB
|
||||
acf_pro_update_license('');
|
||||
|
||||
// refresh transient
|
||||
acf_updates()->refresh_plugins_transient();
|
||||
|
||||
// success
|
||||
if( $response['status'] == 1 ) {
|
||||
|
|
@ -363,6 +376,7 @@ class acf_admin_settings_updates {
|
|||
// show message
|
||||
$this->show_notice( $response['message'] );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// show error
|
||||
|
|
|
|||
|
|
@ -479,4 +479,3 @@
|
|||
// @codekit-prepend "../js/acf-setting-repeater.js
|
||||
// @codekit-prepend "../js/acf-setting-flexible-content.js
|
||||
// @codekit-prepend "../js/acf-setting-clone.js
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!function($){var e=acf.FieldSetting.extend({type:"repeater",name:"collapsed",events:{"focus select":"onFocus"},onFocus:function(e,t){var i=t,a=[];a.push({label:i.find('option[value=""]').text(),value:""});var l=this.fieldObject.$(".acf-field-list:first");acf.getFieldObjects({list:l}).map(function(e){a.push({label:e.prop("label"),value:e.prop("key")})}),acf.renderSelect(i,a)}});acf.registerFieldSetting(e)}(jQuery),function($){var e=acf.FieldSetting.extend({type:"flexible_content",name:"fc_layout",events:{"blur .layout-label":"onChangeLabel","click .add-layout":"onClickAdd","click .duplicate-layout":"onClickDuplicate","click .delete-layout":"onClickDelete"},$input:function(e){return $("#"+this.getInputId()+"-"+e)},$list:function(){return this.$(".acf-field-list:first")},getInputId:function(){return this.fieldObject.getInputId()+"-layouts-"+this.field.get("id")},getFields:function(){return acf.getFieldObjects({parent:this.$el})},getChildren:function(){return acf.getFieldObjects({list:this.$list()})},initialize:function(){var e=this.$el.parent();e.hasClass("ui-sortable")||e.sortable({items:"> .acf-field-setting-fc_layout",handle:".reorder-layout",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:this.proxy(function(e,t){this.fieldObject.save()})}),this.updateFieldLayouts()},updateFieldLayouts:function(){this.getChildren().map(this.updateFieldLayout,this)},updateFieldLayout:function(e){e.prop("parent_layout",this.get("id"))},onChangeLabel:function(e,t){var i=t.val(),a=this.$input("name");""==a.val()&&acf.val(a,acf.strSanitize(i))},onClickAdd:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a,after:function(e,t){var i=t.find(".acf-field-list:first");i.children(".acf-field-object").remove(),i.addClass("-empty"),t.find(".acf-fc-meta input").val("")}}),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDuplicate:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a});var l=acf.getFieldObjects({parent:$layout});l.length&&(l.map(function(e){e.wipe(),e.updateParent()}),acf.doAction("duplicate_field_objects",l,this.fieldObject,this.fieldObject)),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDelete:function(e,t){this.$el.addClass("-hover");var i=acf.newTooltip({confirmRemove:!0,target:t,context:this,confirm:function(){this.delete()},cancel:function(){this.$el.removeClass("-hover")}})},delete:function(){if(!this.$el.siblings(".acf-field-setting-fc_layout").length)return alert(acf.__("Flexible Content requires at least 1 layout")),!1;this.getFields().map(function(e){e.delete({animate:!1})}),acf.remove(this.$el),this.fieldObject.save()}});acf.registerFieldSetting(e);var t=new acf.Model({actions:{sortstop_field_object:"updateParentLayout",change_field_object_parent:"updateParentLayout"},updateParentLayout:function(e){var t=e.getParent();if(!t||"flexible_content"!==t.prop("type"))return void e.prop("parent_layout",null);var i=e.$el.closest(".acf-field-setting-fc_layout"),a=acf.getFieldSetting(i);e.has("parent_layout")||e.prop("parent_layout",0),e.prop("parent_layout",a.get("id"))}})}(jQuery),function($){var e=acf.FieldSetting.extend({type:"clone",name:"display",render:function(){var e=this.field.val();this.$fieldObject.attr("data-display",e)}});acf.registerFieldSetting(e);var t=acf.FieldSetting.extend({type:"clone",name:"prefix_label",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("label")+" "),this.$("code").html(e+"%field_label%")}});acf.registerFieldSetting(t);var i=acf.FieldSetting.extend({type:"clone",name:"prefix_name",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("name")+"_"),this.$("code").html(e+"%field_name%")}});acf.registerFieldSetting(i);var a=new acf.Model({filters:{select2_args:"select2Args"},select2Args:function(e,t,i,a,l){return"acf/fields/clone/query"==i.ajaxAction&&(e.closeOnSelect=!1,l.data.ajaxData=this.ajaxData),e},ajaxData:function(e){return e.fields={},acf.getFieldObjects().map(function(t){e.fields[t.prop("key")]={key:t.prop("key"),type:t.prop("type"),label:t.prop("label"),ancestors:t.getParents().length}}),e.title=$("#title").val(),e}})}(jQuery);
|
||||
!function(e){var t=acf.FieldSetting.extend({type:"repeater",name:"collapsed",events:{"focus select":"onFocus"},onFocus:function(e,t){var i=t,a=[];a.push({label:i.find('option[value=""]').text(),value:""});var l=this.fieldObject.$(".acf-field-list:first"),n;acf.getFieldObjects({list:l}).map(function(e){a.push({label:e.prop("label"),value:e.prop("key")})}),acf.renderSelect(i,a)}});acf.registerFieldSetting(t)}(jQuery),function(t){var e=acf.FieldSetting.extend({type:"flexible_content",name:"fc_layout",events:{"blur .layout-label":"onChangeLabel","click .add-layout":"onClickAdd","click .duplicate-layout":"onClickDuplicate","click .delete-layout":"onClickDelete"},$input:function(e){return t("#"+this.getInputId()+"-"+e)},$list:function(){return this.$(".acf-field-list:first")},getInputId:function(){return this.fieldObject.getInputId()+"-layouts-"+this.field.get("id")},getFields:function(){return acf.getFieldObjects({parent:this.$el})},getChildren:function(){return acf.getFieldObjects({list:this.$list()})},initialize:function(){var e=this.$el.parent();e.hasClass("ui-sortable")||e.sortable({items:"> .acf-field-setting-fc_layout",handle:".reorder-layout",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,stop:this.proxy(function(e,t){this.fieldObject.save()})}),this.updateFieldLayouts()},updateFieldLayouts:function(){this.getChildren().map(this.updateFieldLayout,this)},updateFieldLayout:function(e){e.prop("parent_layout",this.get("id"))},onChangeLabel:function(e,t){var i=t.val(),a=this.$input("name");""==a.val()&&acf.val(a,acf.strSanitize(i))},onClickAdd:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_"),l;$layout=acf.duplicate({$el:this.$el,search:i,replace:a,after:function(e,t){var i=t.find(".acf-field-list:first");i.children(".acf-field-object").remove(),i.addClass("-empty"),t.find(".acf-fc-meta input").val("")}}),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDuplicate:function(e,t){var i=this.get("id"),a=acf.uniqid("layout_");$layout=acf.duplicate({$el:this.$el,search:i,replace:a});var l=acf.getFieldObjects({parent:$layout}),n;l.length&&(l.map(function(e){e.wipe(),e.updateParent()}),acf.doAction("duplicate_field_objects",l,this.fieldObject,this.fieldObject)),acf.getFieldSetting($layout).$input("key").val(a),this.fieldObject.save()},onClickDelete:function(e,t){this.$el.addClass("-hover");var i=acf.newTooltip({confirmRemove:!0,target:t,context:this,confirm:function(){this.delete()},cancel:function(){this.$el.removeClass("-hover")}})},delete:function(){var e;if(!this.$el.siblings(".acf-field-setting-fc_layout").length)return alert(acf.__("Flexible Content requires at least 1 layout")),!1;this.getFields().map(function(e){e.delete({animate:!1})}),acf.remove(this.$el),this.fieldObject.save()}});acf.registerFieldSetting(e);var i=new acf.Model({actions:{sortstop_field_object:"updateParentLayout",change_field_object_parent:"updateParentLayout"},updateParentLayout:function(e){var t=e.getParent();if(t&&"flexible_content"===t.prop("type")){var i=e.$el.closest(".acf-field-setting-fc_layout"),a=acf.getFieldSetting(i);e.has("parent_layout")||e.prop("parent_layout",0),e.prop("parent_layout",a.get("id"))}else e.prop("parent_layout",null)}})}(jQuery),function(e){var t=acf.FieldSetting.extend({type:"clone",name:"display",render:function(){var e=this.field.val();this.$fieldObject.attr("data-display",e)}});acf.registerFieldSetting(t);var i=acf.FieldSetting.extend({type:"clone",name:"prefix_label",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("label")+" "),this.$("code").html(e+"%field_label%")}});acf.registerFieldSetting(i);var a=acf.FieldSetting.extend({type:"clone",name:"prefix_name",render:function(){var e="";this.field.val()&&(e=this.fieldObject.prop("name")+"_"),this.$("code").html(e+"%field_name%")}});acf.registerFieldSetting(a);var l=new acf.Model({filters:{select2_args:"select2Args"},select2Args:function(e,t,i,a,l){return"acf/fields/clone/query"==i.ajaxAction&&(e.closeOnSelect=!1,l.data.ajaxData=this.ajaxData),e},ajaxData:function(t){return t.fields={},acf.getFieldObjects().map(function(e){t.fields[e.prop("key")]={key:e.prop("key"),type:e.prop("type"),label:e.prop("label"),ancestors:e.getParents().length}}),t.title=e("#title").val(),t}})}(jQuery);
|
||||
|
|
@ -1704,4 +1704,3 @@
|
|||
// @codekit-prepend "../js/acf-field-repeater.js";
|
||||
// @codekit-prepend "../js/acf-field-flexible-content.js";
|
||||
// @codekit-prepend "../js/acf-field-gallery.js";
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -100,7 +100,9 @@ class acf_field_gallery extends acf_field {
|
|||
|
||||
|
||||
// validate
|
||||
if( !wp_verify_nonce($options['nonce'], 'acf_nonce') ) die();
|
||||
if( !acf_verify_ajax() ) {
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
// bail early if no id
|
||||
|
|
|
|||
36
readme.txt
36
readme.txt
|
|
@ -4,9 +4,9 @@ Tags: acf, advanced, custom, field, fields, form, repeater, content
|
|||
Requires at least: 4.4.0
|
||||
Tested up to: 4.9.9
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Customise WordPress with powerful, professional and intuitive fields.
|
||||
Customize WordPress with powerful, professional and intuitive fields.
|
||||
|
||||
== Description ==
|
||||
|
||||
|
|
@ -50,9 +50,9 @@ From your WordPress dashboard
|
|||
|
||||
= What kind of support do you provide? =
|
||||
|
||||
**Help Desk.** Support is currently provided via our email help desk. Questions are generally answered within 24 hours, with the exception of weekends and holidays. We answer questions related to ACF, it’s usage and provide minor customization guidance. We cannot guarantee support for questions which include custom theme code, or 3rd party plugin conflicts & compatibility. [Open a Support Ticket](http://support.advancedcustomfields.com/new-ticket/)
|
||||
**Help Desk.** Support is currently provided via our email help desk. Questions are generally answered within 24 hours, with the exception of weekends and holidays. We answer questions related to ACF, its usage and provide minor customization guidance. We cannot guarantee support for questions which include custom theme code, or 3rd party plugin conflicts & compatibility. [Open a Support Ticket](https://www.advancedcustomfields.com/support/)
|
||||
|
||||
**Support Forums.** Our Community Forums provide a great resource for searching and finding previously answered and asked support questions. You may create a new thread on these forums, however, it is not guaranteed that you will receive an answer from our support team. This is more of an area for developers to talk to one another, post ideas, plugins and provide basic help. [View the Support Forum](http://support.advancedcustomfields.com)
|
||||
**Support Forums.** Our Community Forums provide a great resource for searching and finding previously answered and asked support questions. You may create a new thread on these forums, however, it is not guaranteed that you will receive an answer from our support team. This is more of an area for developers to talk to one another, post ideas, plugins and provide basic help. [View the Support Forum](https://support.advancedcustomfields.com/)
|
||||
|
||||
|
||||
== Screenshots ==
|
||||
|
|
@ -66,6 +66,28 @@ From your WordPress dashboard
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 5.7.8 =
|
||||
*Release Date - 7 December 2018*
|
||||
|
||||
* Fix - Fixed vulnerability allowing author role to save unfiltered HTML values.
|
||||
* Fix - Fixed all metaboxes appearing when editing a post in WP 5.0.
|
||||
* i18n - Updated Polish translation thanks to Dariusz Zielonka.
|
||||
* i18n - Updated Czech translation thanks to Veronika Hanzlíková.
|
||||
* i18n - Update Turkish translation thanks to Emre Erkan.
|
||||
* i18n - Updated Portuguese language thanks to Pedro Mendonça.
|
||||
|
||||
= 5.7.7 =
|
||||
*Release Date - 1 October 2018*
|
||||
|
||||
* Fix - Fixed various plugin update issues.
|
||||
* Tweak - Added 'language' to Google Maps API url.
|
||||
* Dev - Major improvements to the `acf.models.Postbox` model.
|
||||
* Dev - Added JS filter 'check_screen_args'.
|
||||
* Dev - Added JS action 'check_screen_complete'.
|
||||
* Dev - Added action 'acf/options_page/submitbox_before_major_actions'.
|
||||
* Dev - Added action 'acf/options_page/submitbox_major_actions'.
|
||||
* i18n - Updated Portuguese language thanks to Pedro Mendonça
|
||||
|
||||
= 5.7.6 =
|
||||
*Release Date - 12 September 2018*
|
||||
|
||||
|
|
@ -108,7 +130,7 @@ From your WordPress dashboard
|
|||
= 5.7.2 =
|
||||
*Release Date - 6 August 2018*
|
||||
|
||||
* Fix - Fixed bug preventing the Google Maps Field address from being customised.
|
||||
* Fix - Fixed bug preventing the Google Maps Field address from being customized.
|
||||
* Fix - Improved logic to request and cache plugin update information.
|
||||
* Fix - Fixed bug preventing JS initialization when editing widgets in accessibility mode.
|
||||
* Fix - Added missing $parent argument to term_exists() function when adding a new term via taxonomy field popup.
|
||||
|
|
@ -333,7 +355,7 @@ From your WordPress dashboard
|
|||
|
||||
= 5.5.1 =
|
||||
* Select field: Fixed bug preventing some field settings from being selected
|
||||
* Date picker field: Improved compatibility with customised values
|
||||
* Date picker field: Improved compatibility with customized values
|
||||
* Core: Added new 'enqueue_datepicker' setting which can be used to prevent the library from being enqueued
|
||||
* Core: Added new 'enqueue_datetimepicker' setting which can be used to prevent the library from being enqueued
|
||||
* Core: Minor fixes and improvements
|
||||
|
|
@ -434,7 +456,7 @@ View full changelog: https://www.advancedcustomfields.com/changelog/
|
|||
== Upgrade Notice ==
|
||||
|
||||
= 5.2.7 =
|
||||
* Field class names have changed slightly in v5.2.7 from `field_type-{$type}` to `acf-field-{$type}`. This change was introduced to better optimise JS performance. The previous class names can be added back in with the following filter: https://www.advancedcustomfields.com/resources/acfcompatibility/
|
||||
* Field class names have changed slightly in v5.2.7 from `field_type-{$type}` to `acf-field-{$type}`. This change was introduced to better optimize JS performance. The previous class names can be added back in with the following filter: https://www.advancedcustomfields.com/resources/acfcompatibility/
|
||||
|
||||
= 3.0.0 =
|
||||
* Editor is broken in WordPress 3.3
|
||||
|
|
|
|||
Loading…
Reference in New Issue