5.7.3
This commit is contained in:
parent
069c5a2f2e
commit
118498c966
5
acf.php
5
acf.php
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Advanced Custom Fields PRO
|
||||
Plugin URI: https://www.advancedcustomfields.com/
|
||||
Description: Customise WordPress with powerful, professional and intuitive fields.
|
||||
Version: 5.7.2
|
||||
Version: 5.7.3
|
||||
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.2';
|
||||
var $version = '5.7.3';
|
||||
|
||||
/** @var array The plugin settings array */
|
||||
var $settings = array();
|
||||
|
|
@ -155,6 +155,7 @@ class ACF {
|
|||
|
||||
// ajax
|
||||
acf_include('includes/ajax/class-acf-ajax.php');
|
||||
acf_include('includes/ajax/class-acf-ajax-check-screen.php');
|
||||
acf_include('includes/ajax/class-acf-ajax-user-setting.php');
|
||||
acf_include('includes/ajax/class-acf-ajax-query.php');
|
||||
acf_include('includes/ajax/class-acf-ajax-query-terms.php');
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
.acf-box{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-box .footer,.acf-box .title{border-color:#23282d}.acf-box h2{color:#bbc8d4}.acf-box table,.acf-box tbody,.acf-box tr{background:0 0!important}.acf-thead{color:#bbc8d4;border-color:#191f25}.acf-tfoot{background-color:#2d3136;border-color:#23282d}.acf-table.-clear,.acf-table.-clear tr{background:0 0!important}.acf-loading-overlay{background:rgba(0,0,0,.5)}.acf-fields>.acf-field{border-color:#23282d}.acf-fields.-left>.acf-field:before{background:rgba(0,0,0,.1);border-color:#23282d}.acf-fields.-border{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-field[data-width]+.acf-field[data-width]{border-color:#23282d}.acf-input-append,.acf-input-prepend{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-fields>.acf-tab-wrap{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-fields>.acf-tab-wrap .acf-tab-group{background-color:#2d3136;border-color:#23282d}.acf-fields>.acf-tab-wrap .acf-tab-group li a{background-color:#2d3136;border-color:#23282d}.acf-fields>.acf-tab-wrap .acf-tab-group li a:hover{background-color:#2d3136;border-color:#23282d;color:#bbc8d4}.acf-fields>.acf-tab-wrap .acf-tab-group li.active a{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-file-uploader .show-if-value{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-file-uploader .show-if-value .file-icon{background-color:#2d3136;border-color:#23282d}.acf-oembed{background-color:#2d3136;border-color:#23282d}.acf-oembed .title{background-color:#50626f;border-color:#191f25;color:#fff}.acf-gallery{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-main{background:#23282d}.acf-gallery .acf-gallery-attachment .margin{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-side{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-side .acf-gallery-side-info{background-color:#2d3136;border-color:#23282d}.acf-gallery .acf-gallery-toolbar{background-color:#2d3136;border-color:#23282d}.acf-button-group label:not(.selected){background-color:#2d3136;border-color:#23282d}.acf-switch:not(.-on){background-color:#2d3136;border-color:#23282d}.acf-switch:not(.-on) .acf-switch-slider{background-color:#50626f;border-color:#191f25;color:#fff}.acf-link .link-wrap{background-color:#2d3136;border-color:#23282d}.acf-relationship .filters{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-relationship .selection{background-color:#2d3136;border-color:#23282d}.acf-relationship .selection .choices,.acf-relationship .selection .choices-list,.acf-relationship .selection .values{background-color:#2d3136;border-color:#23282d}.acf-taxonomy-field .categorychecklist-holder{background-color:#2d3136;border-color:#23282d}.acf-google-map{background-color:#2d3136;border-color:#23282d}.acf-google-map .title{background-color:#50626f;border-color:#191f25;color:#fff}.acf-accordion{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-field.acf-accordion .acf-accordion-content>.acf-fields{border-color:#191f25}.acf-flexible-content .layout{background-color:#32373c;border-color:#191f25;color:#bbc8d4}.acf-flexible-content .layout .acf-fc-layout-handle{background-color:#2d3136;border-color:#23282d}#wpbody .acf-repeater>.acf-table{background-color:#2d3136;border-color:#23282d}#wpbody .acf-repeater>.acf-table>tbody>tr,#wpbody .acf-repeater>.acf-table>thead>tr{background:0 0}#wpbody .acf-repeater>.acf-table>tbody>tr>td,#wpbody .acf-repeater>.acf-table>tbody>tr>th,#wpbody .acf-repeater>.acf-table>thead>tr>td,#wpbody .acf-repeater>.acf-table>thead>tr>th{border-color:#191f25}#acf-field-group-fields .acf-field-list-wrap{background-color:#32373c;border-color:#191f25;color:#bbc8d4}#acf-field-group-fields .acf-field-object{background-color:#32373c;border-color:#191f25;color:#bbc8d4;border-color:#23282d}#acf-field-group-fields .acf-field-object table,#acf-field-group-fields .acf-field-object tbody,#acf-field-group-fields .acf-field-object td,#acf-field-group-fields .acf-field-object th,#acf-field-group-fields .acf-field-object tr{background:0 0;border-color:#23282d}#acf-field-group-fields .acf-field-object .acf-field .acf-label{background-color:#2d3136;border-color:#23282d}#acf-field-group-fields .acf-field-object.ui-sortable-helper{border-color:#191f25;box-shadow:none}#acf-field-group-fields .acf-field-object.ui-sortable-placeholder{background-color:#2d3136;border-color:#23282d;box-shadow:none}#acf-field-group-fields .acf-field-object+.acf-field-object-accordion::before,#acf-field-group-fields .acf-field-object+.acf-field-object-tab::before{background-color:#2d3136;border-color:#23282d}.acf-meta-box-wrap .acf-fields{background-color:#50626f;border-color:#191f25;color:#fff;background:0 0}
|
||||
|
|
@ -600,7 +600,6 @@ a.acf-icon.-cancel.grey:hover {
|
|||
border-bottom: 1px solid #EEEEEE;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
.acf-box .title h3 {
|
||||
font-size: 14px;
|
||||
|
|
@ -631,7 +630,6 @@ a.acf-icon.-cancel.grey:hover {
|
|||
margin-top: -1px;
|
||||
}
|
||||
.acf-box .footer {
|
||||
background: #fff;
|
||||
border-top: 1px solid #eee;
|
||||
padding: 12px;
|
||||
font-size: 13px;
|
||||
|
|
@ -906,14 +904,13 @@ html[dir="rtl"] .acf-columns-2 .acf-column-2 {
|
|||
line-height: 14px;
|
||||
}
|
||||
.acf-thead {
|
||||
background: #FFFFFF;
|
||||
border-bottom: #E1E1E1 solid 1px;
|
||||
color: #23282d;
|
||||
}
|
||||
.acf-thead > li {
|
||||
font-size: 14px;
|
||||
line-height: 1.4em;
|
||||
font-family: "Open Sans", sans-serif;
|
||||
color: #222222;
|
||||
font-weight: bold;
|
||||
}
|
||||
.acf-tfoot {
|
||||
|
|
@ -925,10 +922,6 @@ html[dir="rtl"] .acf-columns-2 .acf-column-2 {
|
|||
font-size: 12px;
|
||||
line-height: 27px;
|
||||
}
|
||||
.acf-tfoot > li.comic-sans {
|
||||
font-family: Comic Sans MS, sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Settings
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@
|
|||
|
||||
// extra
|
||||
' ': '_',
|
||||
'\'': '',
|
||||
"'": '',
|
||||
'?': '',
|
||||
'/': '',
|
||||
'\\': '',
|
||||
|
|
@ -496,7 +496,7 @@
|
|||
// vars
|
||||
var nonWord = /\W/g;
|
||||
var mapping = function (c) {
|
||||
return map[c] || c;
|
||||
return (map[c] !== undefined) ? map[c] : c;
|
||||
};
|
||||
|
||||
// replace
|
||||
|
|
@ -684,7 +684,7 @@
|
|||
*/
|
||||
|
||||
var buildObject = function( obj, name, value ){
|
||||
//console.log('buildObject', obj, name);
|
||||
|
||||
// replace [] with placeholder
|
||||
name = name.replace('[]', '[%%index%%]');
|
||||
|
||||
|
|
@ -731,15 +731,14 @@
|
|||
// crawl
|
||||
ref = ref[ key ];
|
||||
}
|
||||
//console.log('ref:', ref);
|
||||
}
|
||||
};
|
||||
|
||||
acf.serialize = function( $el, prefix ){
|
||||
//console.time('serialize');
|
||||
|
||||
// vars
|
||||
var obj = {};
|
||||
var inputs = $el.find('select, textarea, input').serializeArray();
|
||||
var inputs = acf.serializeArray( $el );
|
||||
|
||||
// prefix
|
||||
if( prefix !== undefined ) {
|
||||
|
|
@ -757,12 +756,90 @@
|
|||
for( var i = 0; i < inputs.length; i++ ) {
|
||||
buildObject( obj, inputs[i].name, inputs[i].value );
|
||||
}
|
||||
//console.timeEnd('serialize');
|
||||
|
||||
// return
|
||||
return obj;
|
||||
};
|
||||
|
||||
/**
|
||||
* acf.serializeArray
|
||||
*
|
||||
* Similar to $.serializeArray() but works with a parent wrapping element.
|
||||
*
|
||||
* @date 19/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param jQuery $el The element or form to serialize.
|
||||
* @return array
|
||||
*/
|
||||
|
||||
acf.serializeArray = function( $el ){
|
||||
return $el.find('select, textarea, input').serializeArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* acf.serializeAjax
|
||||
*
|
||||
* Returns an object containing name => value data ready to be encoded for Ajax.
|
||||
*
|
||||
* @date 15/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param jQUery $el The element or form to serialize.
|
||||
* @param string prefix The input prefix to scope to.
|
||||
* @return object
|
||||
*/
|
||||
|
||||
/*
|
||||
acf.serializeAjax = function( $el, prefix ){
|
||||
|
||||
// vars
|
||||
var data = {};
|
||||
var index = {};
|
||||
var inputs = $el.find('select, textarea, input').serializeArray();
|
||||
|
||||
// remove prefix
|
||||
if( prefix !== undefined ) {
|
||||
|
||||
// filter and modify
|
||||
inputs = inputs.filter(function( item ){
|
||||
return item.name.indexOf(prefix) === 0;
|
||||
}).map(function( item ){
|
||||
|
||||
// remove prefix from name
|
||||
item.name = item.name.slice(prefix.length);
|
||||
|
||||
// fix [foo][bar] to foo[bar]
|
||||
if( item.name.slice(0, 1) == '[' ) {
|
||||
item.name = item.name.slice(1).replace(']', '');
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
// build object
|
||||
inputs.map(function( item ){
|
||||
|
||||
// fix foo[] to foo[0], foo[1], etc
|
||||
if( item.name.slice(-2) === '[]' ) {
|
||||
|
||||
// ensure index exists
|
||||
index[ item.name ] = index[ item.name ] || 0;
|
||||
index[ item.name ]++;
|
||||
|
||||
// replace [] with [0]
|
||||
item.name = item.name.replace('[]', '[' + (index[ item.name ]-1) + ']');
|
||||
}
|
||||
|
||||
// append to data
|
||||
data[ item.name ] = item.value;
|
||||
});
|
||||
|
||||
// return
|
||||
return data;
|
||||
};
|
||||
*/
|
||||
|
||||
/**
|
||||
* addAction
|
||||
|
|
@ -1451,7 +1528,7 @@
|
|||
acf.updateUserSetting = function( name, value ){
|
||||
|
||||
var ajaxData = {
|
||||
action: 'acf/update_user_setting',
|
||||
action: 'acf/ajax/user_setting',
|
||||
name: name,
|
||||
value: value
|
||||
};
|
||||
|
|
@ -1757,7 +1834,7 @@
|
|||
|
||||
acf.isset = function( obj /*, level1, level2, ... */ ) {
|
||||
for( var i = 1; i < arguments.length; i++ ) {
|
||||
if( !obj.hasOwnProperty(arguments[i]) ) {
|
||||
if( !obj || !obj.hasOwnProperty(arguments[i]) ) {
|
||||
return false;
|
||||
}
|
||||
obj = obj[ arguments[i] ];
|
||||
|
|
@ -1779,7 +1856,7 @@
|
|||
|
||||
acf.isget = function( obj /*, level1, level2, ... */ ) {
|
||||
for( var i = 1; i < arguments.length; i++ ) {
|
||||
if( !obj.hasOwnProperty(arguments[i]) ) {
|
||||
if( !obj || !obj.hasOwnProperty(arguments[i]) ) {
|
||||
return null;
|
||||
}
|
||||
obj = obj[ arguments[i] ];
|
||||
|
|
@ -5657,8 +5734,8 @@
|
|||
val[ $(this).data('name') ] = $(this).val();
|
||||
});
|
||||
|
||||
// return false if no address
|
||||
if( !val.address ) {
|
||||
// return false if no lat/lng
|
||||
if( !val.lat || !val.lng ) {
|
||||
val = false;
|
||||
}
|
||||
|
||||
|
|
@ -5680,8 +5757,8 @@
|
|||
acf.val( this.$input(name), val[name] );
|
||||
}
|
||||
|
||||
// return false if no address
|
||||
if( !val.address ) {
|
||||
// return false if no lat/lng
|
||||
if( !val.lat || !val.lng ) {
|
||||
val = false;
|
||||
}
|
||||
|
||||
|
|
@ -9332,7 +9409,7 @@
|
|||
type: 'contains',
|
||||
operator: '==contains',
|
||||
label: __('Value contains'),
|
||||
fieldTypes: [ 'text', 'textarea', 'number', 'email', 'url', 'password', 'wysiwyg', 'oembed' ],
|
||||
fieldTypes: [ 'text', 'textarea', 'number', 'email', 'url', 'password', 'wysiwyg', 'oembed', 'select' ],
|
||||
match: function( rule, field ){
|
||||
return containsString( field.val(), rule.value );
|
||||
},
|
||||
|
|
@ -10391,34 +10468,184 @@
|
|||
|
||||
xhr: false,
|
||||
|
||||
wait: 'ready',
|
||||
timeout: false,
|
||||
|
||||
wait: 'load',
|
||||
|
||||
events: {
|
||||
'change #page_template': 'onChangeTemplate',
|
||||
'change #parent_id': 'onChangeParent',
|
||||
'change #post-formats-select input': 'onChangeFormat',
|
||||
'change .categorychecklist input': 'onChangeTerm',
|
||||
'change .categorychecklist select': 'onChangeTerm',
|
||||
'change .acf-taxonomy-field[data-save="1"] input': 'onChangeTerm',
|
||||
'change .acf-taxonomy-field[data-save="1"] select': 'onChangeTerm'
|
||||
'change #page_template': 'onChange',
|
||||
'change #parent_id': 'onChange',
|
||||
'change #post-formats-select': 'onChange',
|
||||
'change .categorychecklist': 'onChange',
|
||||
'change .tagsdiv': 'onChange',
|
||||
'change .acf-taxonomy-field[data-save="1"]': 'onChange',
|
||||
'change #product-type': 'onChange'
|
||||
},
|
||||
|
||||
data: {
|
||||
//'post_id': 0,
|
||||
//'page_template': 0,
|
||||
//'page_parent': 0,
|
||||
//'page_type': 0,
|
||||
//'post_format': 0,
|
||||
//'post_taxonomy': 0
|
||||
},
|
||||
initialize: function(){
|
||||
|
||||
fetch: function(){
|
||||
|
||||
// bail early if not active
|
||||
/*
|
||||
// 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'
|
||||
|
||||
*/
|
||||
},
|
||||
/*
|
||||
|
||||
checkScreenEvents: function(){
|
||||
|
||||
// vars
|
||||
var events = [
|
||||
'change #page_template',
|
||||
'change #parent_id',
|
||||
'change #post-formats-select input',
|
||||
'change .categorychecklist input',
|
||||
'change .categorychecklist select',
|
||||
'change .acf-taxonomy-field[data-save="1"] input',
|
||||
'change .acf-taxonomy-field[data-save="1"] select',
|
||||
'change #product-type'
|
||||
];
|
||||
|
||||
acf.screen.on('change', '#product-type', 'fetch');
|
||||
},
|
||||
*/
|
||||
|
||||
|
||||
isPost: function(){
|
||||
return acf.get('screen') === 'post';
|
||||
},
|
||||
|
||||
isUser: function(){
|
||||
return acf.get('screen') === 'user';
|
||||
},
|
||||
|
||||
isTaxonomy: function(){
|
||||
return acf.get('screen') === 'taxonomy';
|
||||
},
|
||||
|
||||
isAttachment: function(){
|
||||
return acf.get('screen') === 'attachment';
|
||||
},
|
||||
|
||||
isNavMenu: function(){
|
||||
return acf.get('screen') === 'nav_menu';
|
||||
},
|
||||
|
||||
isWidget: function(){
|
||||
return acf.get('screen') === 'widget';
|
||||
},
|
||||
|
||||
isComment: function(){
|
||||
return acf.get('screen') === 'comment';
|
||||
},
|
||||
|
||||
getPageTemplate: function(){
|
||||
var $el = $('#page_template');
|
||||
return $el.length ? $el.val() : null;
|
||||
},
|
||||
|
||||
getPageParent: function( e, $el ){
|
||||
var $el = $('#parent_id');
|
||||
return $el.length ? $el.val() : null;
|
||||
},
|
||||
|
||||
getPageType: function( e, $el ){
|
||||
return this.getPageParent() ? 'child' : 'parent';
|
||||
},
|
||||
|
||||
getPostFormat: function( e, $el ){
|
||||
var $el = $('#post-formats-select input:checked');
|
||||
if( $el.length ) {
|
||||
var val = $el.val();
|
||||
return (val == '0') ? 'standard' : val;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getPostTerms: function(){
|
||||
|
||||
// vars
|
||||
var terms = {};
|
||||
|
||||
// serialize WP taxonomy postboxes
|
||||
var data = acf.serialize( $('.categorydiv, .tagsdiv') );
|
||||
|
||||
// use tax_input (tag, custom-taxonomy) when possible.
|
||||
// this data is already formatted in taxonomy => [terms].
|
||||
if( data.tax_input ) {
|
||||
terms = data.tax_input;
|
||||
}
|
||||
|
||||
// append "category" which uses a different name
|
||||
if( data.post_category ) {
|
||||
terms.category = data.post_category;
|
||||
}
|
||||
|
||||
// convert any string values (tags) into array format
|
||||
for( var tax in terms ) {
|
||||
if( !acf.isArray(terms[tax]) ) {
|
||||
terms[tax] = terms[tax].split(', ');
|
||||
}
|
||||
}
|
||||
|
||||
// loop over taxonomy fields and add their values
|
||||
acf.getFields({type: 'taxonomy'}).map(function( field ){
|
||||
|
||||
// ignore fields that don't save
|
||||
if( !field.get('save') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// vars
|
||||
var val = field.val();
|
||||
var tax = field.get('taxonomy');
|
||||
|
||||
// check val
|
||||
if( val ) {
|
||||
|
||||
// ensure terms exists
|
||||
terms[ tax ] = terms[ tax ] || [];
|
||||
|
||||
// ensure val is an array
|
||||
val = acf.isArray(val) ? val : [val];
|
||||
|
||||
// append
|
||||
terms[ tax ] = terms[ tax ].concat( val );
|
||||
}
|
||||
});
|
||||
|
||||
// add WC product type
|
||||
if( (productType = this.getProductType()) !== null ) {
|
||||
terms.product_type = [productType];
|
||||
}
|
||||
|
||||
// remove duplicate values
|
||||
for( var tax in terms ) {
|
||||
terms[tax] = acf.uniqueArray(terms[tax]);
|
||||
}
|
||||
|
||||
// return
|
||||
return terms;
|
||||
},
|
||||
|
||||
getProductType: function(){
|
||||
var $el = $('#product-type');
|
||||
return $el.length ? $el.val() : null;
|
||||
},
|
||||
|
||||
check: function(){
|
||||
|
||||
// bail early if not for post
|
||||
if( acf.get('screen') !== 'post' ) {
|
||||
return;
|
||||
|
|
@ -10431,16 +10658,44 @@
|
|||
|
||||
// vars
|
||||
var ajaxData = acf.parseArgs(this.data, {
|
||||
post_id: acf.get('post_id')
|
||||
action: 'acf/ajax/check_screen',
|
||||
screen: acf.get('screen'),
|
||||
exclude: []
|
||||
});
|
||||
|
||||
// add action url
|
||||
ajaxData.action = 'acf/post/get_field_groups';
|
||||
// post id
|
||||
if( this.isPost() ) {
|
||||
ajaxData.post_id = acf.get('post_id');
|
||||
}
|
||||
|
||||
// add ignore
|
||||
ajaxData.exists = [];
|
||||
// page template
|
||||
if( (pageTemplate = this.getPageTemplate()) !== null ) {
|
||||
ajaxData.page_template = pageTemplate;
|
||||
}
|
||||
|
||||
// page parent
|
||||
if( (pageParent = this.getPageParent()) !== null ) {
|
||||
ajaxData.page_parent = pageParent;
|
||||
}
|
||||
|
||||
// page type
|
||||
if( (pageType = this.getPageType()) !== null ) {
|
||||
ajaxData.page_type = pageType;
|
||||
}
|
||||
|
||||
// post format
|
||||
if( (postFormat = this.getPostFormat()) !== null ) {
|
||||
ajaxData.post_format = postFormat;
|
||||
}
|
||||
|
||||
// post terms
|
||||
if( (postTerms = this.getPostTerms()) !== null ) {
|
||||
ajaxData.post_terms = postTerms;
|
||||
}
|
||||
|
||||
// exclude existing postboxes
|
||||
$('.acf-postbox').not('.acf-hidden').each(function(){
|
||||
ajaxData.exists.push( $(this).attr('id').substr(4) );
|
||||
ajaxData.exclude.push( $(this).attr('id').substr(4) );
|
||||
});
|
||||
|
||||
// success
|
||||
|
|
@ -10510,141 +10765,53 @@
|
|||
});
|
||||
},
|
||||
|
||||
syncTaxonomyTerms: function(){
|
||||
|
||||
// vars
|
||||
var values = [''];
|
||||
|
||||
// loop over term lists
|
||||
$('.categorychecklist, .acf-taxonomy-field').each(function(){
|
||||
|
||||
// vars
|
||||
var $el = $(this),
|
||||
$checkbox = $el.find('input[type="checkbox"]').not(':disabled'),
|
||||
$radio = $el.find('input[type="radio"]').not(':disabled'),
|
||||
$select = $el.find('select').not(':disabled'),
|
||||
$hidden = $el.find('input[type="hidden"]').not(':disabled');
|
||||
|
||||
|
||||
// bail early if not a field which saves taxonomy terms to post
|
||||
if( $el.is('.acf-taxonomy-field') && $el.attr('data-save') != '1' ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// bail early if in attachment
|
||||
if( $el.closest('.media-frame').exists() ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// checkbox
|
||||
if( $checkbox.exists() ) {
|
||||
|
||||
$checkbox.filter(':checked').each(function(){
|
||||
|
||||
values.push( $(this).val() );
|
||||
|
||||
});
|
||||
|
||||
} else if( $radio.exists() ) {
|
||||
|
||||
$radio.filter(':checked').each(function(){
|
||||
|
||||
values.push( $(this).val() );
|
||||
|
||||
});
|
||||
|
||||
} else if( $select.exists() ) {
|
||||
|
||||
$select.find('option:selected').each(function(){
|
||||
|
||||
values.push( $(this).val() );
|
||||
|
||||
});
|
||||
|
||||
} else if( $hidden.exists() ) {
|
||||
|
||||
$hidden.each(function(){
|
||||
|
||||
// ignor blank values
|
||||
if( ! $(this).val() ) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
values.push( $(this).val() );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// filter duplicates
|
||||
values = values.filter(function(item, pos, self) {
|
||||
return self.indexOf(item) == pos;
|
||||
});
|
||||
|
||||
|
||||
// update screen
|
||||
this.set( 'post_taxonomy', values ).fetch();
|
||||
},
|
||||
|
||||
onChangeTemplate: function( e, $el ){
|
||||
|
||||
// update & fetch
|
||||
this.set('page_template', $el.val()).fetch();
|
||||
},
|
||||
|
||||
onChangeParent: function( e, $el ){
|
||||
|
||||
// vars
|
||||
var pageType = 'parent';
|
||||
var pageParent = 0;
|
||||
|
||||
// if is child
|
||||
if( $el.val() != "" ) {
|
||||
pageType = 'child';
|
||||
pageParent = $el.val();
|
||||
}
|
||||
|
||||
// update & fetch
|
||||
this.set('page_type', pageType).set('page_parent', pageParent).fetch();
|
||||
},
|
||||
|
||||
onChangeFormat: function( e, $el ){
|
||||
|
||||
// vars
|
||||
var postFormat = $el.val();
|
||||
|
||||
// default
|
||||
if( postFormat == '0' ) {
|
||||
postFormat = 'standard';
|
||||
}
|
||||
|
||||
// update & fetch
|
||||
this.set('post_format', postFormat).fetch();
|
||||
},
|
||||
|
||||
onChangeTerm: function( e, $el ){
|
||||
|
||||
// bail early if within media popup
|
||||
if( $el.closest('.media-frame').exists() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set timeout to fix issue with chrome which does not register the change has yet happened
|
||||
this.setTimeout(this.syncTaxonomyTerms, 1);
|
||||
onChange: function( e, $el ){
|
||||
this.setTimeout(this.check, 1);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
// tests
|
||||
acf.registerScreenChange('#page_template', function( e, $el ){
|
||||
return $('#page_template').val();
|
||||
});
|
||||
|
||||
acf.registerScreenData({
|
||||
name: 'page_template',
|
||||
change: '#page_template',
|
||||
val: function(){
|
||||
var $input = $(this.el);
|
||||
return $input.length ? $input.val() : null;
|
||||
}
|
||||
});
|
||||
|
||||
acf.registerScreenData({
|
||||
name: 'post_terms',
|
||||
change: '.acf-taxonomy-field[data-save="1"]',
|
||||
val: function(){
|
||||
var $input = $(this.el);
|
||||
return $input.length ? $input.val() : null;
|
||||
}
|
||||
});
|
||||
|
||||
acf.registerScreenData({
|
||||
name: 'post_terms',
|
||||
change: '#product-type',
|
||||
val: function( terms ){
|
||||
var $select = $('#product-type');
|
||||
if( $select.length ) {
|
||||
terms.push('product_cat:'+$select.val());
|
||||
}
|
||||
return terms;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
acf.screen.get('post_terms');
|
||||
acf.screen.getPostTerms();
|
||||
|
||||
*/
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function($, undefined){
|
||||
|
|
@ -11548,7 +11715,7 @@
|
|||
|
||||
// toolbar
|
||||
var toolbar = args.toolbar;
|
||||
if( toolbar && typeof toolbars[toolbar] !== 'undefined' ) {
|
||||
if( toolbar && toolbars && toolbars[toolbar] ) {
|
||||
|
||||
for( var i = 1; i <= 4; i++ ) {
|
||||
init[ 'toolbar' + i ] = toolbars[toolbar][i] || '';
|
||||
|
|
@ -12708,6 +12875,11 @@
|
|||
$row = $();
|
||||
}
|
||||
|
||||
// rtl
|
||||
if( acf.get('rtl') ) {
|
||||
thisLeft = Math.ceil( $field.parent().width() - (position.left + $field.outerWidth()) );
|
||||
}
|
||||
|
||||
// add classes
|
||||
if( thisTop == 0 ) {
|
||||
$field.addClass('-r0');
|
||||
|
|
@ -13486,7 +13658,8 @@
|
|||
acf.newCompatibility(acf.screen, {
|
||||
update: function(){
|
||||
return this.set.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
fetch: acf.screen.check
|
||||
});
|
||||
_acf.ajax = acf.screen;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if( ! class_exists('ACF_Ajax_Check_Screen') ) :
|
||||
|
||||
class ACF_Ajax_Check_Screen extends ACF_Ajax {
|
||||
|
||||
/** @var string The AJAX action name */
|
||||
var $action = 'acf/ajax/check_screen';
|
||||
|
||||
/** @var bool Prevents access for non-logged in users */
|
||||
var $public = false;
|
||||
|
||||
/**
|
||||
* get_response
|
||||
*
|
||||
* The actual logic for this AJAX request.
|
||||
*
|
||||
* @date 31/7/18
|
||||
* @since 5.7.2
|
||||
*
|
||||
* @param void
|
||||
* @return mixed The response data to send back or WP_Error.
|
||||
*/
|
||||
|
||||
function response() {
|
||||
|
||||
// vars
|
||||
$args = acf_parse_args($this->request, array(
|
||||
'post_id' => 0,
|
||||
'ajax' => 1,
|
||||
'exclude' => array()
|
||||
));
|
||||
|
||||
// vars
|
||||
$json = array();
|
||||
|
||||
// get field groups
|
||||
$field_groups = acf_get_field_groups( $args );
|
||||
|
||||
// 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' => '',
|
||||
'style' => ''
|
||||
);
|
||||
|
||||
// style
|
||||
if( $i == 0 ) {
|
||||
$item['style'] = acf_get_field_group_style( $field_group );
|
||||
}
|
||||
|
||||
// html
|
||||
if( !in_array($field_group['key'], $args['exclude']) ) {
|
||||
|
||||
// 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[] = $item;
|
||||
}}
|
||||
|
||||
// return
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
|
||||
acf_new_instance('ACF_Ajax_Check_Screen');
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
@ -4,10 +4,10 @@ if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
|
||||
if( ! class_exists('ACF_Ajax_User_Setting') ) :
|
||||
|
||||
class ACF_Ajax_User_Setting extends ACF_Ajax{
|
||||
class ACF_Ajax_User_Setting extends ACF_Ajax {
|
||||
|
||||
/** @var string The AJAX action name */
|
||||
var $action = 'acf/update_user_setting';
|
||||
var $action = 'acf/ajax/user_setting';
|
||||
|
||||
/** @var bool Prevents access for non-logged in users */
|
||||
var $public = true;
|
||||
|
|
|
|||
|
|
@ -4859,7 +4859,7 @@ function acf_send_ajax_results( $response ) {
|
|||
|
||||
// validate
|
||||
$response = wp_parse_args($response, array(
|
||||
'results' => false,
|
||||
'results' => array(),
|
||||
'more' => false,
|
||||
'limit' => 0
|
||||
));
|
||||
|
|
|
|||
|
|
@ -233,4 +233,31 @@ function acf_get_pretty_taxonomies( $taxonomies = array() ) {
|
|||
return acf_get_taxonomy_labels( $taxonomies );
|
||||
}
|
||||
|
||||
/**
|
||||
* acf_get_term
|
||||
*
|
||||
* Similar to get_term() but with some extra functionality.
|
||||
*
|
||||
* @date 19/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param mixed $term_id The term ID or a string of "slug:taxonomy".
|
||||
* @param string $taxonomy The taxonomyname.
|
||||
* @return WP_Term
|
||||
*/
|
||||
|
||||
function acf_get_term( $term_id, $taxonomy = '' ) {
|
||||
|
||||
// allow $term_id parameter to be a string of "slug:taxonomy" of "slug:id"
|
||||
if( is_string($term_id) && strpos($term_id, ':') ) {
|
||||
list( $taxonomy, $term_id ) = explode(':', $term_id);
|
||||
$term = get_term_by( 'slug', $term_id, $taxonomy );
|
||||
if( $term ) return $term;
|
||||
}
|
||||
|
||||
// return
|
||||
return get_term( $term_id, $taxonomy );
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -396,6 +396,9 @@ acf.doAction('prepare');
|
|||
<?php wp_editor( '', 'acf_content' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
// action
|
||||
do_action('acf/enqueue_uploader');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,8 +101,11 @@ class acf_field_range extends acf_field_number {
|
|||
// range
|
||||
$html .= acf_get_text_input( $atts );
|
||||
|
||||
// input
|
||||
// calculate input width based on character length (+1 char if using decimals)
|
||||
$len = strlen( (string) $field['max'] );
|
||||
if( $atts['step'] < 1 ) $len++;
|
||||
|
||||
// input
|
||||
$html .= acf_get_text_input(array(
|
||||
'type' => 'number',
|
||||
'id' => $atts['id'] . '-alt',
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ class acf_field_wysiwyg extends acf_field {
|
|||
|
||||
// add acf_the_content filters
|
||||
$this->add_filters();
|
||||
|
||||
// actions
|
||||
add_action('acf/enqueue_uploader', array($this, 'acf_enqueue_uploader'));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -104,41 +107,28 @@ class acf_field_wysiwyg extends acf_field {
|
|||
*/
|
||||
|
||||
function get_toolbars() {
|
||||
|
||||
// vars
|
||||
$editor_id = 'acf_content';
|
||||
|
||||
|
||||
// toolbars
|
||||
$toolbars = array();
|
||||
$mce_buttons = 'formatselect, bold, italic, bullist, numlist, blockquote, alignleft, aligncenter, alignright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
|
||||
$mce_buttons_2 = 'strikethrough, hr, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help';
|
||||
$teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, alignleft, aligncenter, alignright, undo, redo, link, unlink, fullscreen';
|
||||
|
||||
|
||||
// WP < 3.9
|
||||
if( acf_version_compare('wp', '<', '3.9') ) {
|
||||
|
||||
$mce_buttons = 'bold, italic, strikethrough, bullist, numlist, blockquote, justifyleft, justifycenter, justifyright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
|
||||
$mce_buttons_2 = 'formatselect, underline, justifyfull, forecolor, pastetext, pasteword, removeformat, charmap, outdent, indent, undo, redo, wp_help';
|
||||
$teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen';
|
||||
|
||||
// WP < 4.7
|
||||
} elseif( acf_version_compare('wp', '<', '4.7') ) {
|
||||
|
||||
$mce_buttons = 'bold, italic, strikethrough, bullist, numlist, blockquote, hr, alignleft, aligncenter, alignright, link, unlink, wp_more, spellchecker, fullscreen, wp_adv';
|
||||
$mce_buttons_2 = 'formatselect, underline, alignjustify, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help';
|
||||
//$teeny_mce_buttons = 'bold, italic, underline, blockquote, strikethrough, bullist, numlist, alignleft, aligncenter, alignright, undo, redo, link, unlink, fullscreen';
|
||||
|
||||
|
||||
// vars
|
||||
$editor_id = 'acf_content';
|
||||
$toolbars = array();
|
||||
|
||||
|
||||
// mce buttons (Full)
|
||||
$mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' );
|
||||
$mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
|
||||
|
||||
// mce buttons (Basic)
|
||||
$teeny_mce_buttons = array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'fullscreen');
|
||||
|
||||
|
||||
// WP < 4.7
|
||||
if( acf_version_compare('wp', '<', '4.7') ) {
|
||||
|
||||
$mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' );
|
||||
$mce_buttons_2 = array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
|
||||
}
|
||||
|
||||
|
||||
// explode
|
||||
$mce_buttons = explode(', ', $mce_buttons);
|
||||
$mce_buttons_2 = explode(', ', $mce_buttons_2);
|
||||
$teeny_mce_buttons = explode(', ', $teeny_mce_buttons);
|
||||
|
||||
|
||||
|
||||
|
||||
// Full
|
||||
$toolbars['Full'] = array(
|
||||
1 => apply_filters('mce_buttons', $mce_buttons, $editor_id),
|
||||
|
|
@ -165,32 +155,26 @@ class acf_field_wysiwyg extends acf_field {
|
|||
|
||||
|
||||
/*
|
||||
* input_admin_enqueue_scripts
|
||||
* acf_enqueue_uploader
|
||||
*
|
||||
* description
|
||||
* Registers toolbars data for the WYSIWYG field.
|
||||
*
|
||||
* @type function
|
||||
* @date 16/12/2015
|
||||
* @since 5.3.2
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function input_admin_enqueue_scripts() {
|
||||
function acf_enqueue_uploader() {
|
||||
|
||||
// vars
|
||||
$data = array();
|
||||
$toolbars = $this->get_toolbars();
|
||||
|
||||
|
||||
// bail ealry if no toolbars
|
||||
if( empty($toolbars) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// loop
|
||||
if( $toolbars ) {
|
||||
foreach( $toolbars as $label => $rows ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -207,7 +191,7 @@ class acf_field_wysiwyg extends acf_field {
|
|||
$data[ $key ][ $i ] = implode(',', $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
// localize
|
||||
acf_localize_data(array(
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ class acf_form_customizer {
|
|||
}
|
||||
|
||||
// return
|
||||
return $value;
|
||||
return $field_key;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,6 @@ class ACF_Form_Post {
|
|||
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);
|
||||
|
||||
|
||||
// ajax
|
||||
add_action('wp_ajax_acf/post/get_field_groups', array($this, 'get_field_groups'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -364,106 +360,7 @@ if( typeof acf !== 'undefined' ) {
|
|||
echo '<style type="text/css" id="acf-style">' . $this->style . '</style>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_field_groups
|
||||
*
|
||||
* This function will return all the JSON data needed to render new metaboxes
|
||||
*
|
||||
* @type function
|
||||
* @date 21/10/13
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function get_field_groups() {
|
||||
|
||||
// options
|
||||
$options = acf_parse_args($_POST, array(
|
||||
'nonce' => '',
|
||||
'post_id' => 0,
|
||||
'ajax' => 1,
|
||||
'exists' => array()
|
||||
));
|
||||
|
||||
|
||||
// vars
|
||||
$json = array();
|
||||
$exists = acf_extract_var( $options, 'exists' );
|
||||
|
||||
|
||||
// verify nonce
|
||||
if( !acf_verify_ajax() ) die();
|
||||
|
||||
|
||||
// get field groups
|
||||
$field_groups = acf_get_field_groups( $options );
|
||||
|
||||
|
||||
// bail early if no field groups
|
||||
if( empty($field_groups) ) {
|
||||
|
||||
wp_send_json_success( $json );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// loop through field groups
|
||||
foreach( $field_groups as $i => $field_group ) {
|
||||
|
||||
// vars
|
||||
$item = array(
|
||||
//'ID' => $field_group['ID'], - JSON does not have ID (not used by JS anyway)
|
||||
'key' => $field_group['key'],
|
||||
'title' => $field_group['title'],
|
||||
'html' => '',
|
||||
'style' => ''
|
||||
);
|
||||
|
||||
|
||||
// style
|
||||
if( $i == 0 ) {
|
||||
|
||||
$item['style'] = acf_get_field_group_style( $field_group );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// html
|
||||
if( !in_array($field_group['key'], $exists) ) {
|
||||
|
||||
// load fields
|
||||
$fields = acf_get_fields( $field_group );
|
||||
|
||||
|
||||
// get field HTML
|
||||
ob_start();
|
||||
|
||||
|
||||
// render
|
||||
acf_render_fields( $fields, $options['post_id'], 'div', $field_group['instruction_placement'] );
|
||||
|
||||
|
||||
$item['html'] = ob_get_clean();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// append
|
||||
$json[] = $item;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
wp_send_json_success( $json );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* wp_insert_post_empty_content
|
||||
|
|
|
|||
|
|
@ -154,6 +154,11 @@ class ACF_Form_User {
|
|||
|
||||
function render_new() {
|
||||
|
||||
// Multisite uses a different 'user-new.php' form. Don't render fields here
|
||||
if( is_multisite() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// render
|
||||
$this->render(array(
|
||||
'user_id' => 0,
|
||||
|
|
|
|||
|
|
@ -48,74 +48,43 @@ class acf_location_post_taxonomy extends acf_location {
|
|||
|
||||
// vars
|
||||
$post_id = acf_maybe_get( $screen, 'post_id' );
|
||||
$terms = acf_maybe_get( $screen, 'post_taxonomy' );
|
||||
|
||||
$post_terms = acf_maybe_get( $screen, 'post_terms' );
|
||||
|
||||
// bail early if not a post
|
||||
if( !$post_id ) return false;
|
||||
|
||||
|
||||
// get term data
|
||||
$data = acf_decode_taxonomy_term( $rule['value'] );
|
||||
$term = get_term_by( 'slug', $data['term'], $data['taxonomy'] );
|
||||
|
||||
|
||||
// attempt get term via ID (ACF4 uses ID)
|
||||
if( !$term && is_numeric($data['term']) ) {
|
||||
|
||||
$term = get_term_by( 'id', $data['term'], $data['taxonomy'] );
|
||||
|
||||
}
|
||||
|
||||
// get selected term from rule
|
||||
$term = acf_get_term( $rule['value'] );
|
||||
|
||||
// bail early if no term
|
||||
if( !$term ) return false;
|
||||
if( !$term || is_wp_error($term) ) return false;
|
||||
|
||||
// if ajax, find the terms for the correct category
|
||||
if( $post_terms !== null ) {
|
||||
$post_terms = acf_maybe_get( $post_terms, $term->taxonomy, array() );
|
||||
|
||||
// not ajax, load real post's terms
|
||||
if( $terms === null ) {
|
||||
|
||||
$terms = wp_get_post_terms( $post_id, $term->taxonomy, array('fields' => 'ids') );
|
||||
|
||||
// if not ajax, load post's terms
|
||||
} else {
|
||||
$post_terms = wp_get_post_terms( $post_id, $term->taxonomy, array('fields' => 'ids') );
|
||||
}
|
||||
|
||||
|
||||
// If no terms, this is a new post and should be treated as if it has the "Uncategorized" (1) category ticked
|
||||
if( empty($terms) ) {
|
||||
|
||||
// get post type
|
||||
$post_type = get_post_type( $post_id );
|
||||
|
||||
|
||||
// if is category
|
||||
if( is_object_in_taxonomy($post_type, 'category') ) {
|
||||
|
||||
$terms = array( 1 );
|
||||
|
||||
}
|
||||
|
||||
if( !$post_terms && $term->taxonomy == 'category' ) {
|
||||
$post_terms = array( 1 );
|
||||
}
|
||||
|
||||
|
||||
// match
|
||||
if( !empty($terms) ) {
|
||||
|
||||
$result = in_array( $term->term_id, $terms );
|
||||
|
||||
// compare term IDs and slugs
|
||||
if( in_array($term->term_id, $post_terms) || in_array($term->slug, $post_terms) ) {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
|
||||
// reverse if 'not equal to'
|
||||
if( $rule['operator'] === '!=' ) {
|
||||
|
||||
$result = !$result;
|
||||
|
||||
// reverse if 'not equal to'
|
||||
if( $rule['operator'] == '!=' ) {
|
||||
$result = !$result;
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ class acf_third_party {
|
|||
if( function_exists('espresso_version') ) {
|
||||
add_filter('acf/get_post_types', array($this, 'ee_get_post_types'), 10, 2);
|
||||
}
|
||||
|
||||
// Dark Mode
|
||||
if( class_exists('Dark_Mode') ) {
|
||||
add_action('doing_dark_mode', array($this, 'doing_dark_mode'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -182,7 +187,23 @@ class acf_third_party {
|
|||
// return
|
||||
return $pages;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* doing_dark_mode
|
||||
*
|
||||
* Runs during 'admin_enqueue_scripts' if dark mode is enabled
|
||||
*
|
||||
* @date 13/8/18
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function doing_dark_mode() {
|
||||
wp_enqueue_style('acf-dark', acf_get_url('assets/css/acf-dark.css'), array(), ACF_VERSION );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
12
readme.txt
12
readme.txt
|
|
@ -66,6 +66,18 @@ From your WordPress dashboard
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 5.7.3 =
|
||||
*Release Date - 20 August 2018*
|
||||
|
||||
* New - Added Dark Mode styles for the [Dark Mode Plugin](https://en-au.wordpress.org/plugins/dark-mode/).
|
||||
* New - Added "Value Contains" condition to the Select field type.
|
||||
* New - Added support for the WooCommerce product type dropdown to trigger "update metaboxes".
|
||||
* Tweak - Improved acf.screen model responsible for "updating metaboxes" when changing post data.
|
||||
* Tweak - Removed user fields from the multisite "Add New User" page.
|
||||
* Fix - Fixed bug preventing some tinymce customizations from working.
|
||||
* Fix - Fixed JS bug throwing "preference" error in console.
|
||||
* Dev - Added action 'acf/enqueue_uploader' triggered after the hidden "ACF Content" editor is rendered.
|
||||
|
||||
= 5.7.2 =
|
||||
*Release Date - 6 August 2018*
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue