Version Description
- Module - Enhanced UI - Added WP User & WP Settings UI enhancements
- Module - Enhanced UI - Taxonomies UI enhancements were moved in the to general Enhancement module. The setting
acf_update_setting('acfe/modules/taxonomies')
has been replaced byacf_update_setting('acfe/modules/ui')
- Module: Dev Mode - Added "Field Type" column on ACF meta overview
- Module: Dev Mode - Added "Autoload" column on Options meta overview
- Module: Dev Mode - Added "Delete" action for each meta & options fields
- Module: Dev Mode - Added "Bulk Delete" action
- Module: Single Meta Save - Reworked codebase
- Module: Single Meta Save - Added Options pages compatibility (disabled by default. See
filter('acfe/modules/single_meta/options')
usage in the readme to enable specific Options ID) - Module: Single Meta Save - Added
filter('acfe/modules/single_meta/post_types')
to allow specific post types only (default to: all) - Module: Single Meta Save - Added
filter('acfe/modules/single_meta/taxonomies')
to allow specific taxonomies only (default to: all) - Module: Single Meta Save - Fixed bidirectional setting which wasn't working when Single Meta Save was enabled
- Fields settings: Bidirectional - Added Self-bidirectional setting, allowing to link a field on itself
- Fields settings: Bidirectional - Added Multi-bidirectional setting, allowing to link multiple fields
- Field: Taxonomy Terms - Fixed a bug with last childs choices not being correctly rendered
- Field: Code Editor - Fixed duplicated field from the Field Group UI when user cloned the field
Download this release
Release Info
Developer | hwk-fr |
Plugin | Advanced Custom Fields: Extended |
Version | 0.8.6.3 |
Comparing to | |
See all releases |
Code changes from version 0.8.6.1 to 0.8.6.3
- acf-extended.php +5 -3
- assets/acf-extended-admin.css +20 -0
- assets/acf-extended-fg.js +1 -1
- assets/acf-extended-fields.js +15 -1
- assets/acf-extended-taxonomies.css +0 -125
- assets/acf-extended-ui.css +457 -0
- assets/acf-extended.js +176 -4
- includes/admin/options.php +1 -1
- includes/admin/views/html-options-list.php +1 -1
- includes/core/compatibility.php +10 -2
- includes/core/enqueue.php +2 -2
- includes/fields-settings/bidirectional.php +576 -477
- includes/fields/field-taxonomy-terms.php +3 -5
- includes/modules/dev.php +307 -99
- includes/modules/settings.php +97 -0
- includes/modules/single-meta.php +336 -211
- includes/modules/taxonomy.php +15 -10
- includes/modules/user.php +143 -0
- readme.txt +100 -8
acf-extended.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
-
* Version: 0.8.6.
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
@@ -16,7 +16,7 @@ if(!class_exists('ACFE')):
|
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
-
var $version = '0.8.6.
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
@@ -62,7 +62,7 @@ class ACFE{
|
|
62 |
'acfe/modules/dynamic_taxonomies' => true,
|
63 |
'acfe/modules/options' => true,
|
64 |
'acfe/modules/single_meta' => false,
|
65 |
-
'acfe/modules/
|
66 |
);
|
67 |
|
68 |
// Init
|
@@ -175,8 +175,10 @@ class ACFE{
|
|
175 |
acfe_include('includes/modules/dynamic-options-page.php');
|
176 |
acfe_include('includes/modules/dynamic-post-type.php');
|
177 |
acfe_include('includes/modules/dynamic-taxonomy.php');
|
|
|
178 |
acfe_include('includes/modules/single-meta.php');
|
179 |
acfe_include('includes/modules/taxonomy.php');
|
|
|
180 |
|
181 |
}
|
182 |
|
2 |
/**
|
3 |
* Plugin Name: Advanced Custom Fields: Extended
|
4 |
* Description: Enhancement Suite which improves Advanced Custom Fields administration
|
5 |
+
* Version: 0.8.6.3
|
6 |
* Author: ACF Extended
|
7 |
* Author URI: https://www.acf-extended.com
|
8 |
* Text Domain: acfe
|
16 |
class ACFE{
|
17 |
|
18 |
// Version
|
19 |
+
var $version = '0.8.6.3';
|
20 |
|
21 |
// Settings
|
22 |
var $settings = array();
|
62 |
'acfe/modules/dynamic_taxonomies' => true,
|
63 |
'acfe/modules/options' => true,
|
64 |
'acfe/modules/single_meta' => false,
|
65 |
+
'acfe/modules/ui' => true,
|
66 |
);
|
67 |
|
68 |
// Init
|
175 |
acfe_include('includes/modules/dynamic-options-page.php');
|
176 |
acfe_include('includes/modules/dynamic-post-type.php');
|
177 |
acfe_include('includes/modules/dynamic-taxonomy.php');
|
178 |
+
acfe_include('includes/modules/settings.php');
|
179 |
acfe_include('includes/modules/single-meta.php');
|
180 |
acfe_include('includes/modules/taxonomy.php');
|
181 |
+
acfe_include('includes/modules/user.php');
|
182 |
|
183 |
}
|
184 |
|
assets/acf-extended-admin.css
CHANGED
@@ -417,6 +417,26 @@ body.post-type-acfe-form.post-new-php #major-publishing-actions{
|
|
417 |
margin:0;
|
418 |
}
|
419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
/*
|
421 |
* Select2: WP 5.2 Fix
|
422 |
*/
|
417 |
margin:0;
|
418 |
}
|
419 |
|
420 |
+
.postbox#acfe-wp-custom-fields + .tablenav,
|
421 |
+
.postbox#acfe-acf-custom-fields + .tablenav{
|
422 |
+
padding-top:0;
|
423 |
+
margin-top:-8px;
|
424 |
+
}
|
425 |
+
|
426 |
+
.postbox#acfe-wp-custom-fields em,
|
427 |
+
.postbox#acfe-acf-custom-fields em{
|
428 |
+
color:#aaa;
|
429 |
+
}
|
430 |
+
|
431 |
+
.acfe_dev_meta_count{
|
432 |
+
background: #72777c;
|
433 |
+
padding: 1px 5px;
|
434 |
+
border-radius: 4px;
|
435 |
+
color: #fff;
|
436 |
+
margin-left: 3px;
|
437 |
+
font-size: 12px;
|
438 |
+
}
|
439 |
+
|
440 |
/*
|
441 |
* Select2: WP 5.2 Fix
|
442 |
*/
|
assets/acf-extended-fg.js
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
|
25 |
field.$('.acf-button').removeClass('button-primary');
|
26 |
|
27 |
-
}
|
28 |
|
29 |
acf.addAction('new_field/name=acfe_meta', acfe_repeater_remove_primary_class);
|
30 |
acf.addAction('new_field/name=acfe_settings', acfe_repeater_remove_primary_class);
|
24 |
|
25 |
field.$('.acf-button').removeClass('button-primary');
|
26 |
|
27 |
+
};
|
28 |
|
29 |
acf.addAction('new_field/name=acfe_meta', acfe_repeater_remove_primary_class);
|
30 |
acf.addAction('new_field/name=acfe_settings', acfe_repeater_remove_primary_class);
|
assets/acf-extended-fields.js
CHANGED
@@ -234,7 +234,7 @@ function acfe_recaptcha(){
|
|
234 |
|
235 |
}
|
236 |
|
237 |
-
}
|
238 |
|
239 |
});
|
240 |
|
@@ -246,6 +246,20 @@ function acfe_recaptcha(){
|
|
246 |
acf.registerConditionForFieldType('contains', 'acfe_code_editor');
|
247 |
acf.registerConditionForFieldType('hasValue', 'acfe_code_editor');
|
248 |
acf.registerConditionForFieldType('hasNoValue', 'acfe_code_editor');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
/*
|
251 |
var preCodeMirror = new acf.Model({
|
234 |
|
235 |
}
|
236 |
|
237 |
+
},
|
238 |
|
239 |
});
|
240 |
|
246 |
acf.registerConditionForFieldType('contains', 'acfe_code_editor');
|
247 |
acf.registerConditionForFieldType('hasValue', 'acfe_code_editor');
|
248 |
acf.registerConditionForFieldType('hasNoValue', 'acfe_code_editor');
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Field Group Admin: Code Editor
|
252 |
+
* Fix duplicate action
|
253 |
+
*/
|
254 |
+
acf.addAction('append_field_object', function(field){
|
255 |
+
|
256 |
+
if(field.get('type') !== 'acfe_code_editor')
|
257 |
+
return;
|
258 |
+
|
259 |
+
field.$setting('default_value').find('> .acf-input > .acf-input-wrap > .CodeMirror:last').remove();
|
260 |
+
field.$setting('placeholder').find('> .acf-input > .acf-input-wrap > .CodeMirror:last').remove();
|
261 |
+
|
262 |
+
});
|
263 |
|
264 |
/*
|
265 |
var preCodeMirror = new acf.Model({
|
assets/acf-extended-taxonomies.css
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* ACFE: Better Taxonomy - Archive
|
3 |
-
*/
|
4 |
-
.edit-tags-php #col-container #col-right{
|
5 |
-
float:none;
|
6 |
-
width:auto;
|
7 |
-
}
|
8 |
-
|
9 |
-
.edit-tags-php #col-container #col-right .col-wrap{
|
10 |
-
padding:0;
|
11 |
-
}
|
12 |
-
|
13 |
-
.edit-tags-php #col-left.acfe-bt{
|
14 |
-
float:none;
|
15 |
-
width:100%;
|
16 |
-
}
|
17 |
-
|
18 |
-
.edit-tags-php #col-left.acfe-bt .col-wrap{
|
19 |
-
padding:0;
|
20 |
-
}
|
21 |
-
|
22 |
-
.edit-tags-php #col-left.acfe-bt #poststuff{
|
23 |
-
min-width:100%;
|
24 |
-
}
|
25 |
-
|
26 |
-
.edit-tags-php #acfe-bt-form .submit.acf-field{
|
27 |
-
display:block !important;
|
28 |
-
margin: 0;
|
29 |
-
}
|
30 |
-
|
31 |
-
/*
|
32 |
-
* ACFE: Better Taxonomy - Edit
|
33 |
-
*/
|
34 |
-
.term-php #edittag{
|
35 |
-
max-width:100%;
|
36 |
-
width: 100%;
|
37 |
-
float:left;
|
38 |
-
}
|
39 |
-
|
40 |
-
.term-php #edittag .form-table{
|
41 |
-
background:#fff;
|
42 |
-
width:100%;
|
43 |
-
border: 1px solid #E1E1E1;
|
44 |
-
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
45 |
-
margin-bottom: 15px; /* Fix for Yoast / Rank Math Metaboxes below the term */
|
46 |
-
}
|
47 |
-
|
48 |
-
.term-php #edittag .form-table > tbody > tr > td{
|
49 |
-
background: #fff;
|
50 |
-
border-top: 1px solid #E1E1E1;
|
51 |
-
position:initial;
|
52 |
-
}
|
53 |
-
|
54 |
-
.term-php #edittag .form-table > tbody > tr:first-of-type > td,
|
55 |
-
.term-php #edittag .form-table > tbody > tr:first-of-type > th{
|
56 |
-
border-top: 1px solid #E1E1E1;
|
57 |
-
}
|
58 |
-
|
59 |
-
.term-php #edittag .form-table > tbody > tr > td p{
|
60 |
-
font-size:13px;
|
61 |
-
}
|
62 |
-
|
63 |
-
.term-php #edittag .form-table > tbody > tr > th,
|
64 |
-
.term-php #edittag .form-table > tbody > tr > td.acf-label{
|
65 |
-
border-top: 1px solid #E1E1E1;
|
66 |
-
border-right: 1px solid #E1E1E1;
|
67 |
-
background: #F9F9F9;
|
68 |
-
padding:15px 12px;
|
69 |
-
width:20%;
|
70 |
-
font-size:13px;
|
71 |
-
position:initial;
|
72 |
-
}
|
73 |
-
|
74 |
-
.term-php #edittag .form-table > tbody > tr.acf-field{
|
75 |
-
position: initial;
|
76 |
-
}
|
77 |
-
|
78 |
-
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td{
|
79 |
-
background: #F9F9F9;
|
80 |
-
padding:15px 0 0 0;
|
81 |
-
}
|
82 |
-
|
83 |
-
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group{
|
84 |
-
border-bottom:0;
|
85 |
-
padding:0 0 0 20%;
|
86 |
-
}
|
87 |
-
|
88 |
-
.term-php #edittag .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a{
|
89 |
-
background: #fff;
|
90 |
-
}
|
91 |
-
|
92 |
-
.term-php #poststuff.acfe-acfe-bt-admin-column{
|
93 |
-
min-width:auto;
|
94 |
-
padding:0;
|
95 |
-
}
|
96 |
-
|
97 |
-
.term-php #poststuff.acfe-acfe-bt-admin-column .inside{
|
98 |
-
margin: 0;
|
99 |
-
padding: 0;
|
100 |
-
}
|
101 |
-
|
102 |
-
.acf-fields.-left > .acf-field.acfe-bt-no-label{
|
103 |
-
padding-left: 20%;
|
104 |
-
}
|
105 |
-
|
106 |
-
/*
|
107 |
-
* ACFE: Better Taxonomy - Edit (Fix ACF)
|
108 |
-
*/
|
109 |
-
.term-php #edittag .acf-fields.-left > .acf-field {
|
110 |
-
padding-left: 0;
|
111 |
-
}
|
112 |
-
|
113 |
-
.term-php #edittag .acf-fields.-left > .acf-field:before {
|
114 |
-
width:20%;
|
115 |
-
}
|
116 |
-
|
117 |
-
.term-php #edittag .acf-fields.-left > .acf-field > .acf-label {
|
118 |
-
width: 20%;
|
119 |
-
margin-left: 0;
|
120 |
-
padding: 0 12px;
|
121 |
-
}
|
122 |
-
|
123 |
-
.term-php #edittag .acf-fields.-left > .acf-field > .acf-input {
|
124 |
-
padding: 0 12px;
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/acf-extended-ui.css
ADDED
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* ACFE: UI Enhanced
|
3 |
+
*/
|
4 |
+
.term-php .wrap > form,
|
5 |
+
.profile-php .wrap > form,
|
6 |
+
.user-edit-php .wrap > form,
|
7 |
+
.user-new-php .wrap > form,
|
8 |
+
.options-general-php .wrap > form,
|
9 |
+
.options-writing-php .wrap > form,
|
10 |
+
.options-reading-php .wrap > form,
|
11 |
+
.options-discussion-php .wrap > form,
|
12 |
+
.options-media-php .wrap > form,
|
13 |
+
.options-permalink-php .wrap > form
|
14 |
+
{
|
15 |
+
max-width:100% !important;
|
16 |
+
width: 100%;
|
17 |
+
float:left;
|
18 |
+
}
|
19 |
+
|
20 |
+
.term-php .wrap > form > div > div > h2,
|
21 |
+
.profile-php .wrap > form > div > div > h2,
|
22 |
+
.user-edit-php .wrap > form > div > div > h2,
|
23 |
+
.user-new-php .wrap > form > div > div > h2,
|
24 |
+
.options-general-php .wrap > form > div > div > h2,
|
25 |
+
.options-writing-php .wrap > form > div > div > h2,
|
26 |
+
.options-reading-php .wrap > form > div > div > h2,
|
27 |
+
.options-discussion-php .wrap > form > div > div > h2,
|
28 |
+
.options-media-php .wrap > form > div > div > h2,
|
29 |
+
.options-permalink-php .wrap > form > div > div > h2
|
30 |
+
{
|
31 |
+
background:#fff;
|
32 |
+
border: 1px solid #ccd0d4;
|
33 |
+
border-bottom: 0;
|
34 |
+
margin:0;
|
35 |
+
color: #23282d;
|
36 |
+
font-size: 14px;
|
37 |
+
padding: 8px 12px;
|
38 |
+
line-height: 1.4;
|
39 |
+
}
|
40 |
+
|
41 |
+
.term-php .wrap > form > div > div > h2 + p,
|
42 |
+
.profile-php .wrap > form > div > div > h2 + p,
|
43 |
+
.user-edit-php .wrap > form > div > div > h2 + p,
|
44 |
+
.user-new-php .wrap > form > div > div > h2 + p,
|
45 |
+
.options-general-php .wrap > form > div > div > h2 + p,
|
46 |
+
.options-writing-php .wrap > form > div > div > h2 + p,
|
47 |
+
.options-reading-php .wrap > form > div > div > h2 + p,
|
48 |
+
.options-discussion-php .wrap > form > div > div > h2 + p,
|
49 |
+
.options-media-php .wrap > form > div > div > h2 + p,
|
50 |
+
.options-permalink-php .wrap > form > div > div > h2 + p
|
51 |
+
{
|
52 |
+
margin:0;
|
53 |
+
border: 1px solid #ccd0d4;
|
54 |
+
border-bottom:0;
|
55 |
+
padding:15px 12px;
|
56 |
+
}
|
57 |
+
|
58 |
+
.term-php .wrap > form > div > div > h2 + .form-table,
|
59 |
+
.term-php .wrap > form > div > div > h2 + p + .form-table,
|
60 |
+
|
61 |
+
.profile-php .wrap > form > div > div > h2 + .form-table,
|
62 |
+
.profile-php .wrap > form > div > div > h2 + p + .form-table,
|
63 |
+
|
64 |
+
.user-edit-php .wrap > form > div > div > h2 + .form-table,
|
65 |
+
.user-edit-php .wrap > form > div > div > h2 + p + .form-table,
|
66 |
+
|
67 |
+
.user-new-php .wrap > form > div > div > h2 + .form-table,
|
68 |
+
.user-new-php .wrap > form > div > div > h2 + p + .form-table,
|
69 |
+
|
70 |
+
.options-general-php .wrap > form > div > div > h2 + .form-table,
|
71 |
+
.options-general-php .wrap > form > div > div > h2 + p + .form-table,
|
72 |
+
|
73 |
+
.options-writing-php .wrap > form > div > div > h2 + .form-table,
|
74 |
+
.options-writing-php .wrap > form > div > div > h2 + p + .form-table,
|
75 |
+
|
76 |
+
.options-reading-php .wrap > form > div > div > h2 + .form-table,
|
77 |
+
.options-reading-php .wrap > form > div > div > h2 + p + .form-table,
|
78 |
+
|
79 |
+
.options-discussion-php .wrap > form > div > div > h2 + .form-table,
|
80 |
+
.options-discussion-php .wrap > form > div > div > h2 + p + .form-table,
|
81 |
+
|
82 |
+
.options-media-php .wrap > form > div > div > h2 + .form-table,
|
83 |
+
.options-media-php .wrap > form > div > div > h2 + p + .form-table,
|
84 |
+
|
85 |
+
.options-permalink-php .wrap > form > div > div > h2 + .form-table,
|
86 |
+
.options-permalink-php .wrap > form > div > div > h2 + p + .form-table
|
87 |
+
{
|
88 |
+
margin-top:0;
|
89 |
+
}
|
90 |
+
|
91 |
+
.term-php .wrap > form .form-table,
|
92 |
+
.profile-php .wrap > form .form-table,
|
93 |
+
.user-edit-php .wrap > form .form-table,
|
94 |
+
.user-new-php .wrap > form .form-table,
|
95 |
+
.options-general-php .wrap > form .form-table,
|
96 |
+
.options-writing-php .wrap > form .form-table,
|
97 |
+
.options-reading-php .wrap > form .form-table,
|
98 |
+
.options-discussion-php .wrap > form .form-table,
|
99 |
+
.options-media-php .wrap > form .form-table,
|
100 |
+
.options-permalink-php .wrap > form .form-table
|
101 |
+
{
|
102 |
+
background:#fff;
|
103 |
+
width:100%;
|
104 |
+
border: 1px solid #ccd0d4;
|
105 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
106 |
+
margin-bottom: 20px; /* Fix for Yoast & Rank Math Metaboxes below the term */
|
107 |
+
}
|
108 |
+
|
109 |
+
.term-php .wrap > form .form-table > tbody > tr > td,
|
110 |
+
.profile-php .wrap > form .form-table > tbody > tr > td,
|
111 |
+
.user-edit-php .wrap > form .form-table > tbody > tr > td,
|
112 |
+
.user-new-php .wrap > form .form-table > tbody > tr > td,
|
113 |
+
.options-general-php .wrap > form .form-table > tbody > tr > td,
|
114 |
+
.options-writing-php .wrap > form .form-table > tbody > tr > td,
|
115 |
+
.options-reading-php .wrap > form .form-table > tbody > tr > td,
|
116 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr > td,
|
117 |
+
.options-media-php .wrap > form .form-table > tbody > tr > td,
|
118 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr > td
|
119 |
+
{
|
120 |
+
background: #fff;
|
121 |
+
border-top: 1px solid #E1E1E1;
|
122 |
+
position:initial;
|
123 |
+
}
|
124 |
+
|
125 |
+
.term-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
126 |
+
.term-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
127 |
+
|
128 |
+
.profile-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
129 |
+
.profile-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
130 |
+
|
131 |
+
.user-edit-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
132 |
+
.user-edit-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
133 |
+
|
134 |
+
.user-new-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
135 |
+
.user-new-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
136 |
+
|
137 |
+
.options-general-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
138 |
+
.options-general-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
139 |
+
|
140 |
+
.options-writing-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
141 |
+
.options-writing-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
142 |
+
|
143 |
+
.options-reading-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
144 |
+
.options-reading-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
145 |
+
|
146 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
147 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
148 |
+
|
149 |
+
.options-media-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
150 |
+
.options-media-php .wrap > form .form-table > tbody > tr:first-of-type > th,
|
151 |
+
|
152 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr:first-of-type > td,
|
153 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr:first-of-type > th
|
154 |
+
{
|
155 |
+
border-top: 1px solid #ccd0d4;
|
156 |
+
}
|
157 |
+
|
158 |
+
.term-php .wrap > form .form-table > tbody > tr > td p,
|
159 |
+
.profile-php .wrap > form .form-table > tbody > tr > td p,
|
160 |
+
.user-edit-php .wrap > form .form-table > tbody > tr > td p,
|
161 |
+
.user-new-php .wrap > form .form-table > tbody > tr > td p,
|
162 |
+
.options-general-php .wrap > form .form-table > tbody > tr > td p,
|
163 |
+
.options-writing-php .wrap > form .form-table > tbody > tr > td p,
|
164 |
+
.options-reading-php .wrap > form .form-table > tbody > tr > td p,
|
165 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr > td p,
|
166 |
+
.options-media-php .wrap > form .form-table > tbody > tr > td p,
|
167 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr > td p
|
168 |
+
{
|
169 |
+
font-size:13px;
|
170 |
+
}
|
171 |
+
|
172 |
+
.term-php .wrap > form .form-table > tbody > tr > th,
|
173 |
+
.term-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
174 |
+
|
175 |
+
.profile-php .wrap > form .form-table > tbody > tr > th,
|
176 |
+
.profile-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
177 |
+
|
178 |
+
.user-edit-php .wrap > form .form-table > tbody > tr > th,
|
179 |
+
.user-edit-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
180 |
+
|
181 |
+
.user-new-php .wrap > form .form-table > tbody > tr > th,
|
182 |
+
.user-new-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
183 |
+
|
184 |
+
.options-general-php .wrap > form .form-table > tbody > tr > th,
|
185 |
+
.options-general-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
186 |
+
|
187 |
+
.options-writing-php .wrap > form .form-table > tbody > tr > th,
|
188 |
+
.options-writing-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
189 |
+
|
190 |
+
.options-reading-php .wrap > form .form-table > tbody > tr > th,
|
191 |
+
.options-reading-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
192 |
+
|
193 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr > th,
|
194 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
195 |
+
|
196 |
+
.options-media-php .wrap > form .form-table > tbody > tr > th,
|
197 |
+
.options-media-php .wrap > form .form-table > tbody > tr > td.acf-label,
|
198 |
+
|
199 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr > th,
|
200 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr > td.acf-label
|
201 |
+
{
|
202 |
+
border-top: 1px solid #E1E1E1;
|
203 |
+
border-right: 1px solid #E1E1E1;
|
204 |
+
background: #F9F9F9;
|
205 |
+
padding:15px 12px;
|
206 |
+
width:20%;
|
207 |
+
font-size:13px;
|
208 |
+
position:initial;
|
209 |
+
color:#444;
|
210 |
+
}
|
211 |
+
|
212 |
+
.term-php .wrap > form .form-table > tbody > tr > td.td-full,
|
213 |
+
.profile-php .wrap > form .form-table > tbody > tr > td.td-full,
|
214 |
+
.user-edit-php .wrap > form .form-table > tbody > tr > td.td-full,
|
215 |
+
.user-new-php .wrap > form .form-table > tbody > tr > td.td-full,
|
216 |
+
.options-general-php .wrap > form .form-table > tbody > tr > td.td-full,
|
217 |
+
.options-writing-php .wrap > form .form-table > tbody > tr > td.td-full,
|
218 |
+
.options-reading-php .wrap > form .form-table > tbody > tr > td.td-full,
|
219 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr > td.td-full,
|
220 |
+
.options-media-php .wrap > form .form-table > tbody > tr > td.td-full,
|
221 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr > td.td-full
|
222 |
+
{
|
223 |
+
padding:15px 12px;
|
224 |
+
}
|
225 |
+
|
226 |
+
.term-php .wrap > form .form-table > tbody > tr.acf-field,
|
227 |
+
.profile-php .wrap > form .form-table > tbody > tr.acf-field,
|
228 |
+
.user-edit-php .wrap > form .form-table > tbody > tr.acf-field,
|
229 |
+
.user-new-php .wrap > form .form-table > tbody > tr.acf-field,
|
230 |
+
.options-general-php .wrap > form .form-table > tbody > tr.acf-field,
|
231 |
+
.options-writing-php .wrap > form .form-table > tbody > tr.acf-field,
|
232 |
+
.options-reading-php .wrap > form .form-table > tbody > tr.acf-field,
|
233 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr.acf-field,
|
234 |
+
.options-media-php .wrap > form .form-table > tbody > tr.acf-field,
|
235 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr.acf-field
|
236 |
+
{
|
237 |
+
position: initial;
|
238 |
+
}
|
239 |
+
|
240 |
+
.term-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
241 |
+
.profile-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
242 |
+
.user-edit-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
243 |
+
.user-new-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
244 |
+
.options-general-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
245 |
+
.options-writing-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
246 |
+
.options-reading-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
247 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
248 |
+
.options-media-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td,
|
249 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td
|
250 |
+
{
|
251 |
+
background: #F9F9F9;
|
252 |
+
padding:15px 0 0 0;
|
253 |
+
}
|
254 |
+
|
255 |
+
.term-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
256 |
+
.profile-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
257 |
+
.user-edit-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
258 |
+
.user-new-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
259 |
+
.options-general-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
260 |
+
.options-writing-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
261 |
+
.options-reading-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
262 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
263 |
+
.options-media-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group,
|
264 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group
|
265 |
+
{
|
266 |
+
border-bottom:0;
|
267 |
+
padding:0 0 0 20%;
|
268 |
+
}
|
269 |
+
|
270 |
+
.term-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
271 |
+
.profile-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
272 |
+
.user-edit-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
273 |
+
.user-new-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
274 |
+
.options-general-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
275 |
+
.options-writing-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
276 |
+
.options-reading-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
277 |
+
.options-discussion-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
278 |
+
.options-media-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a,
|
279 |
+
.options-permalink-php .wrap > form .form-table > tbody > tr.acf-tab-wrap > td ul.acf-tab-group > li.active a
|
280 |
+
{
|
281 |
+
background: #fff;
|
282 |
+
}
|
283 |
+
|
284 |
+
.term-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
285 |
+
.profile-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
286 |
+
.user-edit-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
287 |
+
.user-new-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
288 |
+
.options-general-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
289 |
+
.options-writing-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
290 |
+
.options-reading-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
291 |
+
.options-discussion-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
292 |
+
.options-media-php .wrap > form #poststuff.acfe-acfe-bt-admin-column,
|
293 |
+
.options-permalink-php .wrap > form #poststuff.acfe-acfe-bt-admin-column
|
294 |
+
{
|
295 |
+
min-width:auto;
|
296 |
+
padding:0;
|
297 |
+
}
|
298 |
+
|
299 |
+
.term-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
300 |
+
.profile-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
301 |
+
.user-edit-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
302 |
+
.user-new-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
303 |
+
.options-general-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
304 |
+
.options-writing-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
305 |
+
.options-reading-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
306 |
+
.options-discussion-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
307 |
+
.options-media-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside,
|
308 |
+
.options-permalink-php .wrap > form #poststuff.acfe-acfe-bt-admin-column .inside
|
309 |
+
{
|
310 |
+
margin: 0;
|
311 |
+
padding: 0;
|
312 |
+
}
|
313 |
+
|
314 |
+
/*
|
315 |
+
* ACFE: UI Enhanced (Fix ACF)
|
316 |
+
*/
|
317 |
+
.term-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
318 |
+
.profile-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
319 |
+
.user-edit-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
320 |
+
.user-new-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
321 |
+
.options-general-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
322 |
+
.options-writing-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
323 |
+
.options-reading-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
324 |
+
.options-discussion-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
325 |
+
.options-media-php .wrap .form-table > tbody>.acf-field > .acf-label label,
|
326 |
+
.options-permalink-php .wrap .form-table > tbody>.acf-field > .acf-label label
|
327 |
+
{
|
328 |
+
font-size: 13px;
|
329 |
+
color: #444;
|
330 |
+
}
|
331 |
+
|
332 |
+
.term-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
333 |
+
.profile-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
334 |
+
.user-edit-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
335 |
+
.user-new-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
336 |
+
.options-general-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
337 |
+
.options-writing-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
338 |
+
.options-reading-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
339 |
+
.options-discussion-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
340 |
+
.options-media-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label,
|
341 |
+
.options-permalink-php .wrap .acf-fields.-left > .acf-field.acfe-bt-no-label
|
342 |
+
{
|
343 |
+
padding-left: 20%;
|
344 |
+
}
|
345 |
+
|
346 |
+
.term-php .wrap > form .acf-fields.-left > .acf-field,
|
347 |
+
.profile-php .wrap > form .acf-fields.-left > .acf-field,
|
348 |
+
.user-edit-php .wrap > form .acf-fields.-left > .acf-field,
|
349 |
+
.user-new-php .wrap > form .acf-fields.-left > .acf-field,
|
350 |
+
.options-general-php .wrap > form .acf-fields.-left > .acf-field,
|
351 |
+
.options-writing-php .wrap > form .acf-fields.-left > .acf-field,
|
352 |
+
.options-reading-php .wrap > form .acf-fields.-left > .acf-field,
|
353 |
+
.options-discussion-php .wrap > form .acf-fields.-left > .acf-field,
|
354 |
+
.options-media-php .wrap > form .acf-fields.-left > .acf-field,
|
355 |
+
.options-permalink-php .wrap > form .acf-fields.-left > .acf-field
|
356 |
+
{
|
357 |
+
padding-left: 0;
|
358 |
+
}
|
359 |
+
|
360 |
+
.term-php .wrap > form .acf-fields.-left > .acf-field:before,
|
361 |
+
.profile-php .wrap > form .acf-fields.-left > .acf-field:before,
|
362 |
+
.user-edit-php .wrap > form .acf-fields.-left > .acf-field:before,
|
363 |
+
.user-new-php .wrap > form .acf-fields.-left > .acf-field:before,
|
364 |
+
.options-general-php .wrap > form .acf-fields.-left > .acf-field:before,
|
365 |
+
.options-writing-php .wrap > form .acf-fields.-left > .acf-field:before,
|
366 |
+
.options-reading-php .wrap > form .acf-fields.-left > .acf-field:before,
|
367 |
+
.options-discussion-php .wrap > form .acf-fields.-left > .acf-field:before,
|
368 |
+
.options-media-php .wrap > form .acf-fields.-left > .acf-field:before,
|
369 |
+
.options-permalink-php .wrap > form .acf-fields.-left > .acf-field:before
|
370 |
+
{
|
371 |
+
width:20%;
|
372 |
+
}
|
373 |
+
|
374 |
+
.term-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
375 |
+
.profile-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
376 |
+
.user-edit-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
377 |
+
.user-new-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
378 |
+
.options-general-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
379 |
+
.options-writing-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
380 |
+
.options-reading-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
381 |
+
.options-discussion-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
382 |
+
.options-media-php .wrap > form .acf-fields.-left > .acf-field > .acf-label,
|
383 |
+
.options-permalink-php .wrap > form .acf-fields.-left > .acf-field > .acf-label
|
384 |
+
{
|
385 |
+
width: 20%;
|
386 |
+
margin-left: 0;
|
387 |
+
padding: 0 12px;
|
388 |
+
}
|
389 |
+
|
390 |
+
.term-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
391 |
+
.profile-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
392 |
+
.user-edit-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
393 |
+
.user-new-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
394 |
+
.options-general-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
395 |
+
.options-writing-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
396 |
+
.options-reading-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
397 |
+
.options-discussion-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
398 |
+
.options-media-php .wrap > form .acf-fields.-left > .acf-field > .acf-input,
|
399 |
+
.options-permalink-php .wrap > form .acf-fields.-left > .acf-field > .acf-input
|
400 |
+
{
|
401 |
+
padding: 0 12px;
|
402 |
+
}
|
403 |
+
|
404 |
+
.term-php .wrap > form p.submit,
|
405 |
+
.profile-php .wrap > form p.submit,
|
406 |
+
.user-edit-php .wrap > form p.submit,
|
407 |
+
.user-new-php .wrap > form p.submit,
|
408 |
+
.options-general-php .wrap > form p.submit,
|
409 |
+
.options-writing-php .wrap > form p.submit,
|
410 |
+
.options-reading-php .wrap > form p.submit,
|
411 |
+
.options-discussion-php .wrap > form p.submit,
|
412 |
+
.options-media-php .wrap > form p.submit,
|
413 |
+
.options-permalink-php .wrap > form p.submit
|
414 |
+
{
|
415 |
+
display:none;
|
416 |
+
}
|
417 |
+
|
418 |
+
/*
|
419 |
+
* ACFE: UI - Term Single
|
420 |
+
*/
|
421 |
+
.term-php .wrap > form{
|
422 |
+
margin-top:13px;
|
423 |
+
}
|
424 |
+
|
425 |
+
/*
|
426 |
+
* ACFE: UI - Terms List
|
427 |
+
*/
|
428 |
+
.edit-tags-php #col-left{
|
429 |
+
display:none;
|
430 |
+
}
|
431 |
+
|
432 |
+
.edit-tags-php #col-container #col-right{
|
433 |
+
float:none;
|
434 |
+
width:auto;
|
435 |
+
}
|
436 |
+
|
437 |
+
.edit-tags-php #col-container #col-right .col-wrap{
|
438 |
+
padding:0;
|
439 |
+
}
|
440 |
+
|
441 |
+
.edit-tags-php #col-left.acfe-bt{
|
442 |
+
float:none;
|
443 |
+
width:100%;
|
444 |
+
}
|
445 |
+
|
446 |
+
.edit-tags-php #col-left.acfe-bt .col-wrap{
|
447 |
+
padding:0;
|
448 |
+
}
|
449 |
+
|
450 |
+
.edit-tags-php #col-left.acfe-bt #poststuff{
|
451 |
+
min-width:100%;
|
452 |
+
}
|
453 |
+
|
454 |
+
.edit-tags-php #acfe-bt-form .submit.acf-field{
|
455 |
+
display:block !important;
|
456 |
+
margin: 0;
|
457 |
+
}
|
assets/acf-extended.js
CHANGED
@@ -207,21 +207,21 @@
|
|
207 |
|
208 |
});
|
209 |
|
210 |
-
acfe_form_move_instructions_above = function(field){
|
211 |
|
212 |
var $instructions = field.$el.find('> .acf-label > .description');
|
213 |
|
214 |
field.$el.find('> .acf-input').prepend($instructions);
|
215 |
|
216 |
-
}
|
217 |
|
218 |
-
acfe_form_move_instructions_below = function(field){
|
219 |
|
220 |
var $instructions = field.$el.find('> .acf-label > .description');
|
221 |
|
222 |
field.$el.find('> .acf-input').append($instructions);
|
223 |
|
224 |
-
}
|
225 |
|
226 |
acf.addAction('new_field/name=acfe_form_updated_message', acfe_form_move_instructions_below);
|
227 |
acf.addAction('new_field/name=acfe_form_return', acfe_form_move_instructions_below);
|
@@ -251,5 +251,177 @@
|
|
251 |
field.$el.find('> .acf-input > .acf-repeater > .acf-actions > .acf-button').removeClass('button-primary');
|
252 |
|
253 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
})(jQuery);
|
207 |
|
208 |
});
|
209 |
|
210 |
+
var acfe_form_move_instructions_above = function(field){
|
211 |
|
212 |
var $instructions = field.$el.find('> .acf-label > .description');
|
213 |
|
214 |
field.$el.find('> .acf-input').prepend($instructions);
|
215 |
|
216 |
+
};
|
217 |
|
218 |
+
var acfe_form_move_instructions_below = function(field){
|
219 |
|
220 |
var $instructions = field.$el.find('> .acf-label > .description');
|
221 |
|
222 |
field.$el.find('> .acf-input').append($instructions);
|
223 |
|
224 |
+
};
|
225 |
|
226 |
acf.addAction('new_field/name=acfe_form_updated_message', acfe_form_move_instructions_below);
|
227 |
acf.addAction('new_field/name=acfe_form_return', acfe_form_move_instructions_below);
|
251 |
field.$el.find('> .acf-input > .acf-repeater > .acf-actions > .acf-button').removeClass('button-primary');
|
252 |
|
253 |
});
|
254 |
+
|
255 |
+
function acfe_dev_meta_count(){
|
256 |
+
|
257 |
+
var $wp_meta_count = $('#acfe-wp-custom-fields .acfe_dev_meta_count');
|
258 |
+
var $acf_meta_count = $('#acfe-acf-custom-fields .acfe_dev_meta_count');
|
259 |
+
|
260 |
+
$wp_meta_count.text($('#acfe-wp-custom-fields tbody tr').length);
|
261 |
+
$acf_meta_count.text($('#acfe-acf-custom-fields tbody tr').length);
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
acf.addAction('prepare', function(){
|
266 |
+
|
267 |
+
// Move Bulk Button
|
268 |
+
$('#acfe-wp-custom-fields .tablenav.bottom').insertAfter($('#acfe-wp-custom-fields'));
|
269 |
+
$('#acfe-acf-custom-fields .tablenav.bottom').insertAfter($('#acfe-acf-custom-fields'));
|
270 |
+
|
271 |
+
// Bulk Delete
|
272 |
+
$('#acfe_bulk_deleta_meta_submit').click(function(e){
|
273 |
+
|
274 |
+
e.preventDefault();
|
275 |
+
var $this = $(this);
|
276 |
+
|
277 |
+
var action = $this.prevAll('.acfe_bulk_delete_meta_action').val();
|
278 |
+
var type = $this.prevAll('.acfe_bulk_delete_meta_type').val();
|
279 |
+
var nonce = $this.prevAll('.acfe_bulk_delete_meta_nonce').val();
|
280 |
+
|
281 |
+
if(action === 'delete'){
|
282 |
+
|
283 |
+
var ids = [];
|
284 |
+
var trs = [];
|
285 |
+
|
286 |
+
$('#acfe-wp-custom-fields input.acfe_bulk_delete_meta:checked').each(function(){
|
287 |
+
|
288 |
+
ids.push($(this).val());
|
289 |
+
trs.push($(this).closest('tr'));
|
290 |
+
|
291 |
+
});
|
292 |
+
|
293 |
+
$('#acfe-acf-custom-fields input.acfe_bulk_delete_meta:checked').each(function(){
|
294 |
+
|
295 |
+
ids.push($(this).val());
|
296 |
+
trs.push($(this).closest('tr'));
|
297 |
+
|
298 |
+
});
|
299 |
+
|
300 |
+
if(ids.length){
|
301 |
+
|
302 |
+
var ajaxData = {
|
303 |
+
action: 'acfe/bulk_delete_meta',
|
304 |
+
ids: ids,
|
305 |
+
type: type,
|
306 |
+
_wpnonce: nonce,
|
307 |
+
};
|
308 |
+
|
309 |
+
$.ajax({
|
310 |
+
url: acf.get('ajaxurl'),
|
311 |
+
data: ajaxData,
|
312 |
+
type: 'post',
|
313 |
+
beforeSend: function(){
|
314 |
+
|
315 |
+
$.each(trs, function(){
|
316 |
+
|
317 |
+
$(this).css({backgroundColor:'#faafaa'}).fadeOut(350, function(){
|
318 |
+
$(this).remove();
|
319 |
+
});
|
320 |
+
|
321 |
+
});
|
322 |
+
|
323 |
+
setTimeout(function(){
|
324 |
+
|
325 |
+
if(!$('#acfe-wp-custom-fields tbody tr').length){
|
326 |
+
|
327 |
+
$('#acfe-wp-custom-fields').remove();
|
328 |
+
|
329 |
+
}
|
330 |
+
|
331 |
+
if(!$('#acfe-acf-custom-fields tbody tr').length){
|
332 |
+
|
333 |
+
$('#acfe-acf-custom-fields').remove();
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
if(!$('#acfe-wp-custom-fields tbody tr').length && !$('#acfe-acf-custom-fields tbody tr').length){
|
338 |
+
|
339 |
+
$('.acfe_dev_bulk_actions').remove();
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
acfe_dev_meta_count();
|
344 |
+
|
345 |
+
}, 351);
|
346 |
+
|
347 |
+
},
|
348 |
+
success: function(response){
|
349 |
+
|
350 |
+
if(response !== '1'){
|
351 |
+
|
352 |
+
}
|
353 |
+
|
354 |
+
}
|
355 |
+
});
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
}
|
360 |
+
|
361 |
+
});
|
362 |
+
|
363 |
+
// Single Delete
|
364 |
+
$('.acfe_delete_meta').click(function(e){
|
365 |
+
|
366 |
+
e.preventDefault();
|
367 |
+
var $this = $(this);
|
368 |
+
var $tr = $this.closest('tr');
|
369 |
+
var $tbody = $this.closest('tbody');
|
370 |
+
var $postbox = $this.closest('.postbox');
|
371 |
+
|
372 |
+
var ajaxData = {
|
373 |
+
action: 'acfe/delete_meta',
|
374 |
+
id: $this.attr('data-meta-id'),
|
375 |
+
key: $this.attr('data-meta-key'),
|
376 |
+
type: $this.attr('data-type'),
|
377 |
+
_wpnonce: $this.attr('data-nonce'),
|
378 |
+
};
|
379 |
+
|
380 |
+
$.ajax({
|
381 |
+
url: acf.get('ajaxurl'),
|
382 |
+
data: ajaxData,
|
383 |
+
type: 'post',
|
384 |
+
beforeSend: function(){
|
385 |
+
|
386 |
+
var $tr = $this.closest('tr');
|
387 |
+
|
388 |
+
$tr.css({backgroundColor:'#faafaa'}).fadeOut(350, function(){
|
389 |
+
$(this).remove();
|
390 |
+
});
|
391 |
+
|
392 |
+
setTimeout(function(){
|
393 |
+
|
394 |
+
if(!$tbody.find('tr').length){
|
395 |
+
|
396 |
+
$postbox.remove();
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
if(!$('#acfe-wp-custom-fields tbody tr').length && !$('#acfe-acf-custom-fields tbody tr').length){
|
401 |
+
|
402 |
+
$('.acfe_dev_bulk_actions').remove();
|
403 |
+
|
404 |
+
}
|
405 |
+
|
406 |
+
acfe_dev_meta_count();
|
407 |
+
|
408 |
+
}, 351);
|
409 |
+
|
410 |
+
},
|
411 |
+
success: function(response){
|
412 |
+
|
413 |
+
if(response !== '1'){
|
414 |
+
|
415 |
+
$tr.css({backgroundColor:''});
|
416 |
+
$tr.show();
|
417 |
+
|
418 |
+
}
|
419 |
+
|
420 |
+
}
|
421 |
+
});
|
422 |
+
|
423 |
+
});
|
424 |
+
|
425 |
+
});
|
426 |
|
427 |
})(jQuery);
|
includes/admin/options.php
CHANGED
@@ -406,7 +406,7 @@ function acfe_options_edit_metabox(){
|
|
406 |
'label' => __('Value ' . $type),
|
407 |
'key' => 'field_acfe_options_edit_value',
|
408 |
'name' => 'field_acfe_options_edit_value',
|
409 |
-
'type' => '
|
410 |
'prefix' => 'acf',
|
411 |
'instructions' => '',
|
412 |
'required' => false,
|
406 |
'label' => __('Value ' . $type),
|
407 |
'key' => 'field_acfe_options_edit_value',
|
408 |
'name' => 'field_acfe_options_edit_value',
|
409 |
+
'type' => 'textarea',
|
410 |
'prefix' => 'acf',
|
411 |
'instructions' => '',
|
412 |
'required' => false,
|
includes/admin/views/html-options-list.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<div class="wrap" id="acfe-admin-options">
|
2 |
|
3 |
-
<h1 class="wp-heading-inline"><?php _e('Options'); ?></h1>
|
4 |
<a href="<?php echo sprintf('?page=%s&action=add', esc_attr($_REQUEST['page'])); ?>" class="page-title-action"><?php _e('Add New'); ?></a>
|
5 |
|
6 |
<hr class="wp-header-end" />
|
1 |
<div class="wrap" id="acfe-admin-options">
|
2 |
|
3 |
+
<h1 class="wp-heading-inline"><?php _e('Options'); ?></h1>
|
4 |
<a href="<?php echo sprintf('?page=%s&action=add', esc_attr($_REQUEST['page'])); ?>" class="page-title-action"><?php _e('Add New'); ?></a>
|
5 |
|
6 |
<hr class="wp-header-end" />
|
includes/core/compatibility.php
CHANGED
@@ -9,17 +9,25 @@ class acfe_compatibility{
|
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
-
add_action('acf/init', array($this, 'init'),
|
13 |
|
14 |
add_filter('pll_get_post_types', array($this, 'polylang'), 10, 2);
|
15 |
|
16 |
}
|
17 |
|
18 |
function init(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
/**
|
21 |
* ACF Extended: 0.8
|
22 |
-
* Settings: Renamed acfe_php* to acfe/php*
|
23 |
*/
|
24 |
if(acf_get_setting('acfe_php') !== null){
|
25 |
acf_update_setting('acfe/php', acf_get_setting('acfe_php'));
|
9 |
|
10 |
function __construct(){
|
11 |
|
12 |
+
add_action('acf/init', array($this, 'init'), 98);
|
13 |
|
14 |
add_filter('pll_get_post_types', array($this, 'polylang'), 10, 2);
|
15 |
|
16 |
}
|
17 |
|
18 |
function init(){
|
19 |
+
|
20 |
+
/**
|
21 |
+
* ACF Extended: 0.8.6.3
|
22 |
+
* Settings: Renamed 'acfe/modules/taxonomies' to 'acfe/modules/ui'
|
23 |
+
*/
|
24 |
+
if(acf_get_setting('acfe/modules/taxonomies') !== null){
|
25 |
+
acf_update_setting('acfe/modules/ui', acf_get_setting('acfe/modules/taxonomies'));
|
26 |
+
}
|
27 |
|
28 |
/**
|
29 |
* ACF Extended: 0.8
|
30 |
+
* Settings: Renamed 'acfe_php*' to 'acfe/php*'
|
31 |
*/
|
32 |
if(acf_get_setting('acfe_php') !== null){
|
33 |
acf_update_setting('acfe/php', acf_get_setting('acfe_php'));
|
includes/core/enqueue.php
CHANGED
@@ -19,9 +19,9 @@ function acfe_enqueue_admin_scripts(){
|
|
19 |
wp_enqueue_style('acf-extended-admin', acfe_get_url('assets/acf-extended-admin.css'), false, ACFE_VERSION);
|
20 |
|
21 |
// Better Taxonomies
|
22 |
-
if(acf_get_setting('acfe/modules/
|
23 |
|
24 |
-
wp_enqueue_style('acf-extended-
|
25 |
|
26 |
}
|
27 |
|
19 |
wp_enqueue_style('acf-extended-admin', acfe_get_url('assets/acf-extended-admin.css'), false, ACFE_VERSION);
|
20 |
|
21 |
// Better Taxonomies
|
22 |
+
if(acf_get_setting('acfe/modules/ui')){
|
23 |
|
24 |
+
wp_enqueue_style('acf-extended-ui', acfe_get_url('assets/acf-extended-ui.css'), false, ACFE_VERSION);
|
25 |
|
26 |
}
|
27 |
|
includes/fields-settings/bidirectional.php
CHANGED
@@ -3,606 +3,705 @@
|
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
'
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
),
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
'
|
59 |
-
'
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
),
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
array(
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
76 |
),
|
77 |
),
|
78 |
),
|
79 |
),
|
80 |
-
)
|
81 |
-
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Field Setting: Ajax Handler
|
87 |
-
*/
|
88 |
-
add_action('wp_ajax_acf/fields/select/query', 'acfe_bidirectional_ajax', 0);
|
89 |
-
add_action('wp_ajax_nopriv_acf/fields/select/query', 'acfe_bidirectional_ajax', 0);
|
90 |
-
function acfe_bidirectional_ajax(){
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
'paged' => 1
|
101 |
-
));
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
|
107 |
-
|
108 |
|
109 |
-
|
110 |
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Field Setting: Ajax Query
|
115 |
-
*/
|
116 |
-
function acfe_bidirectional_ajax_query($options = array()){
|
117 |
-
|
118 |
-
// Current field group
|
119 |
-
$field_group = acf_get_field_group($options['post_id']);
|
120 |
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
127 |
|
128 |
-
|
129 |
|
130 |
-
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
// Bypass ACFE native groups
|
137 |
-
if(in_array($r_field_group['key'], array('group_acfe_author', 'group_acfe_dynamic_post_type', 'group_acfe_dynamic_taxonomy')))
|
138 |
-
continue;
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
|
150 |
-
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
// vars
|
155 |
-
$results = array();
|
156 |
-
$s = null;
|
157 |
|
158 |
-
|
|
|
|
|
159 |
|
160 |
-
|
161 |
-
|
|
|
|
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
-
|
175 |
|
176 |
-
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
|
187 |
-
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
|
|
|
|
|
194 |
}
|
195 |
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
}
|
203 |
-
|
204 |
-
function acfe_bidirectional_setting_find_related($r_field, $r_field_group, &$choices){
|
205 |
|
206 |
-
|
207 |
-
|
208 |
|
209 |
-
|
210 |
-
|
211 |
|
212 |
-
|
213 |
|
214 |
-
|
215 |
-
|
216 |
|
217 |
-
|
218 |
|
219 |
-
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
// Allow only specific fields
|
224 |
-
$allowed_fields_types = array('relationship', 'post_object', 'user', 'taxonomy');
|
225 |
-
if(!in_array($r_field['type'], $allowed_fields_types))
|
226 |
-
return false;
|
227 |
-
|
228 |
-
$choices[$r_field_group['title']][$r_field['key']] = (!empty($r_field['label']) ? $r_field['label'] : $r_field['name']) . ' (' . $r_field['key'] . ')';
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Field Setting: Default Value
|
234 |
-
*/
|
235 |
-
add_filter('acf/prepare_field/name=acfe_bidirectional_related', 'acfe_bidirectional_setting_value');
|
236 |
-
function acfe_bidirectional_setting_value($field){
|
237 |
-
|
238 |
-
if(!isset($field['value']) || empty($field['value']))
|
239 |
-
return $field;
|
240 |
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
-
|
245 |
-
if(!$r_field){
|
246 |
-
|
247 |
-
// Unset & updatevalue
|
248 |
-
$field['value'] = false;
|
249 |
-
acf_update_field($field);
|
250 |
-
|
251 |
-
return $field;
|
252 |
|
253 |
}
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
return $field;
|
260 |
-
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Field Setting Update
|
265 |
-
*/
|
266 |
-
add_filter('acf/update_field/type=relationship', 'acfe_bidirectional_setting_update');
|
267 |
-
add_filter('acf/update_field/type=post_object', 'acfe_bidirectional_setting_update');
|
268 |
-
add_filter('acf/update_field/type=user', 'acfe_bidirectional_setting_update');
|
269 |
-
add_filter('acf/update_field/type=taxonomy', 'acfe_bidirectional_setting_update');
|
270 |
-
function acfe_bidirectional_setting_update($field){
|
271 |
-
|
272 |
-
$do_update = apply_filters('acfe/bidirectional/setting/update', true);
|
273 |
-
if(!$do_update)
|
274 |
-
return $field;
|
275 |
-
|
276 |
-
// Previous setting values
|
277 |
-
$_field = acf_get_field($field['key']);
|
278 |
-
|
279 |
-
// Turning off - Remove related field
|
280 |
-
if(acfe_has_field_bidirectional($_field) && !acfe_has_field_bidirectional($field)){
|
281 |
|
282 |
-
|
283 |
-
|
284 |
|
285 |
-
|
286 |
-
$
|
287 |
-
$
|
288 |
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
-
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
-
|
|
|
|
|
|
|
|
|
295 |
|
296 |
return $field;
|
297 |
|
298 |
}
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
$r_field = acf_get_field($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
305 |
-
|
306 |
-
// Reset related bidirectional related
|
307 |
-
$r_field['acfe_bidirectional']['acfe_bidirectional_enabled'] = true;
|
308 |
-
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = $field['key'];
|
309 |
-
|
310 |
-
add_filter('acfe/bidirectional/setting/update', '__return_false');
|
311 |
-
|
312 |
-
// Update related bidirectional
|
313 |
-
acf_update_field($r_field);
|
314 |
|
315 |
-
|
|
|
|
|
316 |
|
317 |
-
|
|
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
// Return
|
322 |
-
return $field;
|
323 |
-
|
324 |
-
}
|
325 |
-
|
326 |
-
/**
|
327 |
-
* Field Setting Deleted
|
328 |
-
*/
|
329 |
-
add_action('acf/delete_field/type=relationship', 'acfe_bidirectional_setting_delete');
|
330 |
-
add_filter('acf/delete_field/type=post_object', 'acfe_bidirectional_setting_delete');
|
331 |
-
add_filter('acf/delete_field/type=user', 'acfe_bidirectional_setting_delete');
|
332 |
-
add_filter('acf/delete_field/type=taxonomy', 'acfe_bidirectional_setting_delete');
|
333 |
-
function acfe_bidirectional_setting_delete($field){
|
334 |
-
|
335 |
-
if(!acfe_has_field_bidirectional($field))
|
336 |
-
return;
|
337 |
-
|
338 |
-
// Get related bidirectional related
|
339 |
-
$r_field = acf_get_field($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
340 |
-
|
341 |
-
// Reset related bidirectional related
|
342 |
-
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = false;
|
343 |
-
|
344 |
-
// Update related bidirectional
|
345 |
-
acf_update_field($r_field);
|
346 |
-
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Update Value
|
351 |
-
*/
|
352 |
-
add_filter('acf/update_value/type=relationship', 'acfe_bidirectional_update_value', 11, 3);
|
353 |
-
add_filter('acf/update_value/type=post_object', 'acfe_bidirectional_update_value', 11, 3);
|
354 |
-
add_filter('acf/update_value/type=user', 'acfe_bidirectional_update_value', 11, 3);
|
355 |
-
add_filter('acf/update_value/type=taxonomy', 'acfe_bidirectional_update_value', 11, 3);
|
356 |
-
function acfe_bidirectional_update_value($value, $post_id, $field){
|
357 |
-
|
358 |
-
$ignore = apply_filters('acfe/bidirectional/ignore', false, $value, $post_id, $field);
|
359 |
-
if($ignore)
|
360 |
-
return $value;
|
361 |
-
|
362 |
-
// Check if bidirectional
|
363 |
-
if(!acfe_get_field_bidirectional($field))
|
364 |
-
return $value;
|
365 |
-
|
366 |
-
// Decode current post_id (ie: user_1)
|
367 |
-
$request = acf_decode_post_id($post_id);
|
368 |
-
|
369 |
-
// Values
|
370 |
-
$old_values = acf_get_array(acf_get_metadata($post_id, $field['name']));
|
371 |
-
$new_values = acf_get_array($value);
|
372 |
-
|
373 |
-
// Bail early if no difference
|
374 |
-
// if($old_values === $new_values)
|
375 |
-
// return $value;
|
376 |
-
|
377 |
-
// Values have been removed
|
378 |
-
if(!empty($old_values)){
|
379 |
-
foreach($old_values as $r_id){
|
380 |
|
381 |
-
|
382 |
-
|
383 |
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
}
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
if(!empty($new_values)){
|
391 |
-
foreach($new_values as $r_id){
|
392 |
|
393 |
-
|
394 |
-
|
395 |
|
396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
|
398 |
}
|
|
|
|
|
|
|
|
|
399 |
}
|
400 |
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
$force_update = apply_filters('acfe/bidirectional/force_update/key=' . $field['key'], $force_update, $field, $post_id);
|
406 |
-
|
407 |
-
if($force_update){
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
412 |
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
}
|
|
|
416 |
}
|
417 |
|
418 |
}
|
419 |
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
/**
|
425 |
-
* Establish Relationship
|
426 |
-
*
|
427 |
-
* $type: add|remove
|
428 |
-
* $r_id: the post_id to add the relationship to
|
429 |
-
* $p_field: the parent field
|
430 |
-
* $p_id: the relationship to add
|
431 |
-
*/
|
432 |
-
function acfe_bidirectional_relationship($type = 'add', $r_id, $p_field, $p_value){
|
433 |
-
|
434 |
-
// Get Related Field Configuration
|
435 |
-
$r_field = acf_get_field($p_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
436 |
-
|
437 |
-
// Get if bidirectional is active
|
438 |
-
if(!acfe_get_field_bidirectional($r_field))
|
439 |
-
return;
|
440 |
-
|
441 |
-
// Get Related Data Type ({post_id}, user_{id} ...)
|
442 |
-
$r_mtype = '';
|
443 |
-
if($p_field['type'] === 'user')
|
444 |
-
$r_mtype = 'user_';
|
445 |
-
elseif($p_field['type'] === 'taxonomy')
|
446 |
-
$r_mtype = 'term_';
|
447 |
-
|
448 |
-
// Get Related Field Ancestors
|
449 |
-
$r_field_ancestors = acf_get_field_ancestors($r_field);
|
450 |
-
|
451 |
-
// Ancestors - Complexe field (group|clone)
|
452 |
-
if(!empty($r_field_ancestors)){
|
453 |
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
|
458 |
-
//
|
459 |
-
$
|
460 |
-
|
461 |
|
462 |
-
//
|
463 |
-
$
|
464 |
|
465 |
-
//
|
466 |
-
|
|
|
467 |
|
468 |
-
//
|
469 |
-
$
|
|
|
470 |
|
471 |
-
//
|
472 |
-
if(!empty($
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
}
|
482 |
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
484 |
|
485 |
-
|
486 |
-
|
|
|
|
|
487 |
|
488 |
-
|
489 |
-
$
|
|
|
|
|
|
|
490 |
|
491 |
-
|
492 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
|
494 |
}
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
501 |
|
502 |
-
|
503 |
-
|
504 |
|
505 |
-
|
506 |
-
|
507 |
-
// Remove Value
|
508 |
-
elseif($type === 'remove'){
|
509 |
|
510 |
-
|
511 |
-
foreach($r_values as $r_value){
|
512 |
|
513 |
-
if
|
|
|
514 |
continue;
|
515 |
|
516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
}
|
519 |
|
520 |
-
$r_values = $r_new_values;
|
521 |
-
|
522 |
}
|
523 |
|
524 |
-
|
525 |
-
* Post Object & User 'Allow Multiple' Disabled
|
526 |
-
* Value must not be inside array
|
527 |
-
*/
|
528 |
-
if(($r_ref_field['type'] === 'post_object' || $r_ref_field['type'] === 'user') && empty($r_ref_field['multiple']) && isset($r_values[0])){
|
529 |
|
530 |
-
|
531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
|
533 |
}
|
534 |
|
535 |
-
|
536 |
-
* Remove potential empty serialized array in meta value 'a:0:{}'
|
537 |
-
*/
|
538 |
-
if(empty($r_values))
|
539 |
-
$r_values = false;
|
540 |
-
|
541 |
-
/*
|
542 |
-
* Construct a value array in case of ancestors. ie:
|
543 |
-
* $related_values = Array(
|
544 |
-
* [field_aaa] => Array(
|
545 |
-
* [field_bbb] => Array(
|
546 |
-
* [0] => xxxx
|
547 |
-
* )
|
548 |
-
* )
|
549 |
-
* )
|
550 |
-
*/
|
551 |
-
if(!empty($r_field_ancestors)){
|
552 |
|
553 |
-
|
554 |
-
$r_values = array($r_values_query[$i] => $r_values);
|
555 |
-
}
|
556 |
|
557 |
}
|
558 |
-
|
559 |
-
// Filter acf_update_value (to avoid infinite loop)
|
560 |
-
add_filter('acfe/bidirectional/ignore', '__return_true');
|
561 |
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
}
|
569 |
-
|
570 |
-
function acfe_get_value_from_ancestor($r_ref_values, $r_field){
|
571 |
|
572 |
-
|
573 |
|
574 |
-
if($
|
575 |
-
|
576 |
-
if(is_array($r_ref_value))
|
577 |
-
return acfe_get_value_from_ancestor($r_ref_value, $r_field);
|
578 |
-
|
579 |
return false;
|
580 |
-
|
581 |
-
}
|
582 |
|
583 |
-
return $
|
584 |
|
585 |
}
|
586 |
|
587 |
}
|
588 |
|
589 |
-
|
590 |
-
|
591 |
-
return isset($field['acfe_bidirectional']['acfe_bidirectional_enabled']) && !empty($field['acfe_bidirectional']['acfe_bidirectional_enabled']);
|
592 |
-
|
593 |
-
}
|
594 |
-
|
595 |
-
function acfe_has_field_bidirectional($field){
|
596 |
-
|
597 |
-
return isset($field['acfe_bidirectional']['acfe_bidirectional_related']) && !empty($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
598 |
-
|
599 |
-
}
|
600 |
|
601 |
-
|
602 |
-
|
603 |
-
if(!acfe_is_field_bidirectional($field) || !acfe_has_field_bidirectional($field))
|
604 |
-
return false;
|
605 |
-
|
606 |
-
return $field['acfe_bidirectional']['acfe_bidirectional_related'];
|
607 |
-
|
608 |
-
}
|
3 |
if(!defined('ABSPATH'))
|
4 |
exit;
|
5 |
|
6 |
+
if(!class_exists('acfe_bidirectional')):
|
7 |
+
|
8 |
+
class acfe_bidirectional{
|
9 |
+
|
10 |
+
var $allowed_types = array('relationship', 'post_object', 'user', 'taxonomy');
|
11 |
+
|
12 |
+
function __construct(){
|
13 |
+
|
14 |
+
foreach($this->allowed_types as $allowed_type){
|
15 |
+
|
16 |
+
add_action('acf/render_field_settings/type=' . $allowed_type, array($this, 'field_settings_render'));
|
17 |
+
add_filter('acf/update_field/type=' . $allowed_type, array($this, 'field_settings_update'));
|
18 |
+
add_action('acf/delete_field/type=' . $allowed_type, array($this, 'field_settings_delete'));
|
19 |
+
|
20 |
+
add_filter('acf/update_value/type=' . $allowed_type, array($this, 'update_value'), 11, 3);
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
add_action('wp_ajax_acfe/fields_settings/bidirectional/query', array($this, 'ajax_query'));
|
25 |
+
add_action('wp_ajax_nopriv_acfe/fields_settings/bidirectional/query', array($this, 'ajax_query'));
|
26 |
+
|
27 |
+
add_filter('acf/prepare_field/name=acfe_bidirectional_related', array($this, 'field_settings_default_value'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/*
|
32 |
+
* Field Settings
|
33 |
+
*/
|
34 |
+
function field_settings_render($field){
|
35 |
+
|
36 |
+
// Settings
|
37 |
+
acf_render_field_setting($field, array(
|
38 |
+
'label' => __('Bidirectional'),
|
39 |
+
'key' => 'acfe_bidirectional',
|
40 |
+
'name' => 'acfe_bidirectional',
|
41 |
+
'instructions' => __('Set the field as bidirectional'),
|
42 |
+
'type' => 'group',
|
43 |
+
'required' => false,
|
44 |
+
'conditional_logic' => false,
|
45 |
+
'wrapper' => array(
|
46 |
+
'width' => '',
|
47 |
+
'class' => '',
|
48 |
+
'id' => '',
|
49 |
),
|
50 |
+
'layout' => 'block',
|
51 |
+
'sub_fields' => array(
|
52 |
+
array(
|
53 |
+
'label' => false,
|
54 |
+
'key' => 'acfe_bidirectional_enabled',
|
55 |
+
'name' => 'acfe_bidirectional_enabled',
|
56 |
+
'type' => 'true_false',
|
57 |
+
'instructions' => '',
|
58 |
+
'required' => false,
|
59 |
+
'wrapper' => array(
|
60 |
+
'width' => '15',
|
61 |
+
'class' => 'acfe_width_auto',
|
62 |
+
'id' => '',
|
63 |
+
),
|
64 |
+
'message' => '',
|
65 |
+
'default_value' => false,
|
66 |
+
'ui' => true,
|
67 |
+
'ui_on_text' => '',
|
68 |
+
'ui_off_text' => '',
|
69 |
+
'conditional_logic' => false,
|
70 |
),
|
71 |
+
array(
|
72 |
+
'label' => false,
|
73 |
+
'key' => 'acfe_bidirectional_related',
|
74 |
+
'name' => 'acfe_bidirectional_related',
|
75 |
+
'type' => 'select',
|
76 |
+
'instructions' => '',
|
77 |
+
'required' => false,
|
78 |
+
'wrapper' => array(
|
79 |
+
'width' => 50,
|
80 |
+
'class' => '',
|
81 |
+
'id' => '',
|
82 |
+
),
|
83 |
+
'choices' => array(),
|
84 |
+
'default_value' => array(),
|
85 |
+
'allow_null' => 1,
|
86 |
+
'multiple' => 1,
|
87 |
+
'ui' => 1,
|
88 |
+
'ajax' => 1,
|
89 |
+
'ajax_action' => 'acfe/fields_settings/bidirectional/query',
|
90 |
+
'return_format' => 'value',
|
91 |
+
'placeholder' => '',
|
92 |
+
'conditional_logic' => array(
|
93 |
array(
|
94 |
+
array(
|
95 |
+
'field' => 'acfe_bidirectional_enabled',
|
96 |
+
'operator' => '==',
|
97 |
+
'value' => '1',
|
98 |
+
),
|
99 |
),
|
100 |
),
|
101 |
),
|
102 |
),
|
103 |
+
));
|
104 |
+
|
105 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
/*
|
108 |
+
* Field Settings: Ajax Query
|
109 |
+
*/
|
110 |
+
function ajax_query(){
|
111 |
|
112 |
+
// validate
|
113 |
+
if (!acf_verify_ajax()){
|
114 |
+
die();
|
115 |
+
}
|
|
|
|
|
116 |
|
117 |
+
$options = acf_parse_args($_POST, array(
|
118 |
+
'post_id' => 0,
|
119 |
+
's' => '',
|
120 |
+
'field_key' => '',
|
121 |
+
'paged' => 1
|
122 |
+
));
|
123 |
|
124 |
+
$response = $this->ajax_results($options);
|
125 |
|
126 |
+
acf_send_ajax_results($response);
|
127 |
|
128 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
+
/*
|
131 |
+
* Field Settings: Ajax Results
|
132 |
+
*/
|
133 |
+
function ajax_results($options = array()){
|
134 |
+
|
135 |
+
// Disable Filters
|
136 |
+
acf_disable_filters();
|
137 |
|
138 |
+
// Get field groups
|
139 |
+
$r_field_groups = acf_get_field_groups();
|
140 |
+
|
141 |
+
if(empty($r_field_groups))
|
142 |
+
return false;
|
143 |
|
144 |
+
$choices = array();
|
145 |
|
146 |
+
foreach($r_field_groups as $r_field_group){
|
147 |
|
148 |
+
// Bypass ACFE native groups
|
149 |
+
if(in_array($r_field_group['key'], array('group_acfe_author', 'group_acfe_dynamic_post_type', 'group_acfe_dynamic_taxonomy')))
|
150 |
+
continue;
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
// Get related fields
|
153 |
+
$r_fields = acf_get_fields($r_field_group['key']);
|
154 |
+
if(empty($r_fields))
|
155 |
+
continue;
|
156 |
|
157 |
+
// Filter & find possible related fields
|
158 |
+
foreach($r_fields as $r_field){
|
159 |
|
160 |
+
$this->get_related_settings($r_field, $r_field_group, $choices);
|
161 |
|
162 |
+
}
|
163 |
|
164 |
+
}
|
|
|
|
|
|
|
|
|
165 |
|
166 |
+
// vars
|
167 |
+
$results = array();
|
168 |
+
$s = null;
|
169 |
|
170 |
+
if(!empty($choices)){
|
171 |
+
|
172 |
+
// search
|
173 |
+
if($options['s'] !== ''){
|
174 |
|
175 |
+
// strip slashes (search may be integer)
|
176 |
+
$s = strval($options['s']);
|
177 |
+
$s = wp_unslash($s);
|
178 |
|
179 |
+
}
|
180 |
|
181 |
+
foreach($choices as $field_group_title => $childs){
|
182 |
|
183 |
+
$field_group_title = strval($field_group_title);
|
184 |
|
185 |
+
$childrens = array();
|
186 |
+
foreach($childs as $child_key => $child_label){
|
187 |
|
188 |
+
$child_label = strval($child_label);
|
189 |
|
190 |
+
// if searching, but doesn't exist
|
191 |
+
if(is_string($s) && stripos($child_label, $s) === false && stripos($field_group_title, $s) === false)
|
192 |
+
continue(2);
|
193 |
|
194 |
+
$childrens[] = array(
|
195 |
+
'id' => $child_key,
|
196 |
+
'text' => $child_label,
|
197 |
+
);
|
198 |
|
199 |
+
}
|
200 |
|
201 |
+
$results[] = array(
|
202 |
+
'text' => $field_group_title,
|
203 |
+
'children' => $childrens
|
204 |
+
);
|
205 |
|
206 |
+
}
|
207 |
+
|
208 |
}
|
209 |
|
210 |
+
return array(
|
211 |
+
'results' => $results
|
212 |
+
);
|
213 |
+
|
214 |
}
|
215 |
|
216 |
+
/*
|
217 |
+
* Field Setting: Get Related Settings
|
218 |
+
*/
|
219 |
+
function get_related_settings($r_field, $r_field_group, &$choices){
|
|
|
|
|
|
|
220 |
|
221 |
+
if(in_array($r_field['type'], array('repeater', 'flexible_content')))
|
222 |
+
return;
|
223 |
|
224 |
+
// Recursive search for sub_fields (groups & clones)
|
225 |
+
if(isset($r_field['sub_fields']) && !empty($r_field['sub_fields'])){
|
226 |
|
227 |
+
foreach($r_field['sub_fields'] as $r_sub_field){
|
228 |
|
229 |
+
// Recursive call
|
230 |
+
$this->get_related_settings($r_sub_field, $r_field_group, $choices);
|
231 |
|
232 |
+
}
|
233 |
|
234 |
+
return;
|
235 |
|
236 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
+
// Allow only specific fields
|
239 |
+
if(!in_array($r_field['type'], $this->allowed_types))
|
240 |
+
return false;
|
241 |
|
242 |
+
$choices[$r_field_group['title']][$r_field['key']] = (!empty($r_field['label']) ? $r_field['label'] : $r_field['name']) . ' (' . $r_field['key'] . ')';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
}
|
245 |
|
246 |
+
/*
|
247 |
+
* Field Setting: Default Value
|
248 |
+
*/
|
249 |
+
function field_settings_default_value($field){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
+
if(!isset($field['value']) || empty($field['value']))
|
252 |
+
return $field;
|
253 |
|
254 |
+
$values = acf_get_array($field['value']);
|
255 |
+
$r_fields = array();
|
256 |
+
$r_field_update = false;
|
257 |
|
258 |
+
foreach($values as $i => $value){
|
259 |
+
|
260 |
+
$r_field = acf_get_field($value);
|
261 |
+
|
262 |
+
if($r_field){
|
263 |
+
|
264 |
+
$r_fields[] = $r_field;
|
265 |
+
|
266 |
+
}else{
|
267 |
+
|
268 |
+
// Unset
|
269 |
+
unset($values[$i]);
|
270 |
+
|
271 |
+
$r_field_update = true;
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
}
|
276 |
|
277 |
+
if($r_field_update){
|
278 |
+
|
279 |
+
$field['value'] = $values;
|
280 |
+
|
281 |
+
acf_update_field($field);
|
282 |
+
|
283 |
+
}
|
284 |
|
285 |
+
foreach($r_fields as $r_field){
|
286 |
+
|
287 |
+
$field['choices'][$r_field['key']] = (!empty($r_field['label']) ? $r_field['label'] : $r_field['name']) . ' (' . $r_field['key'] . ')';
|
288 |
+
|
289 |
+
}
|
290 |
|
291 |
return $field;
|
292 |
|
293 |
}
|
294 |
|
295 |
+
/*
|
296 |
+
* Field Setting Update
|
297 |
+
*/
|
298 |
+
function field_settings_update($field){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
+
$bypass = acf_is_filter_enabled('acfe/bidirectional_setting');
|
301 |
+
if($bypass)
|
302 |
+
return $field;
|
303 |
|
304 |
+
// Previous setting values
|
305 |
+
$_field = acf_get_field($field['key']);
|
306 |
|
307 |
+
// Turning off - Remove related field
|
308 |
+
if($this->has_field_bidirectional($_field) && !$this->has_field_bidirectional($field)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
+
// Get related bidirectional related
|
311 |
+
$r_fields = acf_get_array($_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
312 |
|
313 |
+
foreach($r_fields as $r_field_key){
|
314 |
+
|
315 |
+
$r_field = acf_get_field($r_field_key);
|
316 |
+
|
317 |
+
if(!$this->has_field_bidirectional($r_field))
|
318 |
+
continue;
|
319 |
+
|
320 |
+
$r_field_related = acf_get_array($r_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
321 |
+
|
322 |
+
if(in_array($field['key'], $r_field_related)){
|
323 |
+
|
324 |
+
foreach($r_field_related as $i => $r_field_r){
|
325 |
+
|
326 |
+
if($r_field_r !== $field['key'])
|
327 |
+
continue;
|
328 |
+
|
329 |
+
unset($r_field_related[$i]);
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = $r_field_related;
|
334 |
+
|
335 |
+
if(empty($r_field_related)){
|
336 |
+
|
337 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_enabled'] = false;
|
338 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = false;
|
339 |
+
|
340 |
+
}
|
341 |
+
|
342 |
+
acf_enable_filter('acfe/bidirectional_setting');
|
343 |
+
|
344 |
+
// Update related bidirectional
|
345 |
+
acf_update_field($r_field);
|
346 |
+
|
347 |
+
acf_disable_filter('acfe/bidirectional_setting');
|
348 |
+
|
349 |
+
}
|
350 |
+
|
351 |
+
}
|
352 |
|
353 |
}
|
354 |
+
|
355 |
+
// Turning on (or already on) - Add related field
|
356 |
+
elseif(($this->has_field_bidirectional($_field) && $this->has_field_bidirectional($field)) || (!$this->has_field_bidirectional($_field) && $this->has_field_bidirectional($field))){
|
|
|
|
|
357 |
|
358 |
+
// Get related bidirectional related
|
359 |
+
$r_fields = acf_get_array($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
360 |
|
361 |
+
foreach($r_fields as $r_field_key){
|
362 |
+
|
363 |
+
$r_field = acf_get_field($r_field_key);
|
364 |
+
|
365 |
+
// Reset related bidirectional related
|
366 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_enabled'] = true;
|
367 |
+
|
368 |
+
$r_field_related = acf_get_array($r_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
369 |
+
|
370 |
+
if(!in_array($field['key'], $r_field_related)){
|
371 |
+
|
372 |
+
$r_field_related[] = $field['key'];
|
373 |
+
|
374 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = $r_field_related;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
acf_enable_filter('acfe/bidirectional_setting');
|
379 |
+
|
380 |
+
// Update related bidirectional
|
381 |
+
acf_update_field($r_field);
|
382 |
+
|
383 |
+
acf_disable_filter('acfe/bidirectional_setting');
|
384 |
+
|
385 |
+
}
|
386 |
|
387 |
}
|
388 |
+
|
389 |
+
// Return
|
390 |
+
return $field;
|
391 |
+
|
392 |
}
|
393 |
|
394 |
+
/*
|
395 |
+
* Field Setting: Delete
|
396 |
+
*/
|
397 |
+
function field_settings_delete($field){
|
|
|
|
|
|
|
398 |
|
399 |
+
if(!$this->has_field_bidirectional($field))
|
400 |
+
return;
|
401 |
+
|
402 |
+
// Get related bidirectional related
|
403 |
+
$r_fields = acf_get_array($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
404 |
+
|
405 |
+
foreach($r_fields as $r_field_key){
|
406 |
+
|
407 |
+
$r_field = acf_get_field($r_field_key);
|
408 |
+
|
409 |
+
$r_field_related = acf_get_array($r_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
410 |
+
|
411 |
+
if(in_array($field['key'], $r_field_related)){
|
412 |
|
413 |
+
foreach($r_field_related as $i => $r_field_r){
|
414 |
+
|
415 |
+
if($r_field_r !== $field['key'])
|
416 |
+
continue;
|
417 |
+
|
418 |
+
unset($r_field_related[$i]);
|
419 |
+
|
420 |
+
}
|
421 |
+
|
422 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = $r_field_related;
|
423 |
+
|
424 |
+
if(empty($r_field_related)){
|
425 |
+
|
426 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_enabled'] = false;
|
427 |
+
$r_field['acfe_bidirectional']['acfe_bidirectional_related'] = false;
|
428 |
+
|
429 |
+
}
|
430 |
+
|
431 |
+
// Update related bidirectional
|
432 |
+
acf_update_field($r_field);
|
433 |
|
434 |
}
|
435 |
+
|
436 |
}
|
437 |
|
438 |
}
|
439 |
|
440 |
+
/*
|
441 |
+
* Update Value
|
442 |
+
*/
|
443 |
+
function update_value($value, $post_id, $field){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
|
445 |
+
$bypass = acf_is_filter_enabled('acfe/bidirectional');
|
446 |
+
if($bypass)
|
447 |
+
return $value;
|
448 |
|
449 |
+
// Check if bidirectional
|
450 |
+
if(!$this->get_field_bidirectional($field))
|
451 |
+
return $value;
|
452 |
|
453 |
+
// Decode current post_id (ie: user_1)
|
454 |
+
$request = acf_decode_post_id($post_id);
|
455 |
|
456 |
+
// Values
|
457 |
+
$old_values = acf_get_array(acf_get_metadata($post_id, $field['name']));
|
458 |
+
$new_values = acf_get_array($value);
|
459 |
|
460 |
+
// Bail early if no difference
|
461 |
+
// if($old_values === $new_values)
|
462 |
+
// return $value;
|
463 |
|
464 |
+
// Values have been removed
|
465 |
+
if(!empty($old_values)){
|
466 |
+
foreach($old_values as $r_id){
|
467 |
+
|
468 |
+
if(in_array($r_id, $new_values))
|
469 |
+
continue;
|
470 |
+
|
471 |
+
$this->relationship('remove', $r_id, $field, $request['id']);
|
472 |
+
|
473 |
+
}
|
474 |
}
|
475 |
|
476 |
+
// Values have been added
|
477 |
+
if(!empty($new_values)){
|
478 |
+
foreach($new_values as $r_id){
|
479 |
+
|
480 |
+
if(in_array($r_id, $old_values))
|
481 |
+
continue;
|
482 |
|
483 |
+
$this->relationship('add', $r_id, $field, $request['id']);
|
484 |
+
|
485 |
+
}
|
486 |
+
}
|
487 |
|
488 |
+
$force_update = false;
|
489 |
+
$force_update = apply_filters('acfe/bidirectional/force_update', $force_update, $field, $post_id);
|
490 |
+
$force_update = apply_filters('acfe/bidirectional/force_update/type=' . $field['type'], $force_update, $field, $post_id);
|
491 |
+
$force_update = apply_filters('acfe/bidirectional/force_update/name=' . $field['name'], $force_update, $field, $post_id);
|
492 |
+
$force_update = apply_filters('acfe/bidirectional/force_update/key=' . $field['key'], $force_update, $field, $post_id);
|
493 |
|
494 |
+
if($force_update){
|
495 |
+
|
496 |
+
// Force new values to be saved
|
497 |
+
if(!empty($new_values)){
|
498 |
+
foreach($new_values as $r_id){
|
499 |
+
|
500 |
+
$this->relationship('add', $r_id, $field, $request['id']);
|
501 |
+
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
}
|
506 |
+
|
507 |
+
return $value;
|
508 |
|
509 |
}
|
510 |
|
511 |
+
/**
|
512 |
+
* Establish Relationship
|
513 |
+
*
|
514 |
+
* $type: add|remove
|
515 |
+
* $r_id: the post_id to add the relationship to
|
516 |
+
* $p_field: the parent field
|
517 |
+
* $p_id: the relationship to add
|
518 |
+
*/
|
519 |
+
function relationship($type = 'add', $r_id, $p_field, $p_value){
|
520 |
|
521 |
+
// Get Related Field Configuration
|
522 |
+
$r_fields = acf_get_array($p_field['acfe_bidirectional']['acfe_bidirectional_related']);
|
523 |
|
524 |
+
foreach($r_fields as $r_field_key){
|
|
|
|
|
|
|
525 |
|
526 |
+
$r_field = acf_get_field($r_field_key);
|
|
|
527 |
|
528 |
+
// Get if bidirectional is active
|
529 |
+
if(!$this->get_field_bidirectional($r_field))
|
530 |
continue;
|
531 |
|
532 |
+
// Get Related Data Type ({post_id}, user_{id} ...)
|
533 |
+
$r_mtype = '';
|
534 |
+
if($p_field['type'] === 'user')
|
535 |
+
$r_mtype = 'user_';
|
536 |
+
elseif($p_field['type'] === 'taxonomy')
|
537 |
+
$r_mtype = 'term_';
|
538 |
+
|
539 |
+
// Get Related Field Ancestors
|
540 |
+
$r_field_ancestors = acf_get_field_ancestors($r_field);
|
541 |
+
|
542 |
+
// Ancestors - Complexe field (group|clone)
|
543 |
+
if(!empty($r_field_ancestors)){
|
544 |
+
|
545 |
+
// Get ancestors
|
546 |
+
$r_field_ancestors = array_reverse($r_field_ancestors);
|
547 |
+
$r_field_ancestors_fields = array_map('acf_get_field', $r_field_ancestors);
|
548 |
+
|
549 |
+
// Get top ancestor
|
550 |
+
$r_ref_field = $r_field_ancestors_fields[0];
|
551 |
+
$r_ref_values = acf_get_array(acf_get_value($r_mtype.$r_id, $r_ref_field));
|
552 |
+
|
553 |
+
// Get values
|
554 |
+
$r_values = acf_get_array($this->get_value_from_ancestor($r_ref_values, $r_field));
|
555 |
+
|
556 |
+
// Unset top ancestor for update (not needed)
|
557 |
+
unset($r_field_ancestors_fields[0]);
|
558 |
+
|
559 |
+
// Add related field to get
|
560 |
+
$r_values_query = array($r_field['key']);
|
561 |
+
|
562 |
+
// If > 1 ancestors, return ancestors keys only
|
563 |
+
if(!empty($r_field_ancestors_fields)){
|
564 |
+
|
565 |
+
$r_field_ancestors_keys = array_map(function($field){
|
566 |
+
return $field['key'];
|
567 |
+
}, $r_field_ancestors_fields);
|
568 |
+
|
569 |
+
// Add ancestors to get
|
570 |
+
$r_values_query = array_merge($r_field_ancestors_keys, $r_values_query);
|
571 |
+
|
572 |
+
}
|
573 |
+
|
574 |
+
}
|
575 |
+
|
576 |
+
// No Ancestors - Simple field
|
577 |
+
else{
|
578 |
+
|
579 |
+
// Refence field
|
580 |
+
$r_ref_field = $r_field;
|
581 |
+
|
582 |
+
// Values
|
583 |
+
$r_values = acf_get_array(acf_get_value($r_mtype.$r_id, $r_field));
|
584 |
+
|
585 |
+
}
|
586 |
+
|
587 |
+
// Convert strings to integers
|
588 |
+
$r_values = acf_parse_types($r_values);
|
589 |
+
|
590 |
+
// Add Value
|
591 |
+
if($type === 'add'){
|
592 |
+
|
593 |
+
if(!in_array($p_value, $r_values))
|
594 |
+
$r_values[] = $p_value;
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
// Remove Value
|
599 |
+
elseif($type === 'remove'){
|
600 |
+
|
601 |
+
$r_new_values = array();
|
602 |
+
foreach($r_values as $r_value){
|
603 |
+
|
604 |
+
if($r_value === $p_value)
|
605 |
+
continue;
|
606 |
+
|
607 |
+
$r_new_values[] = $r_value;
|
608 |
+
|
609 |
+
}
|
610 |
+
|
611 |
+
$r_values = $r_new_values;
|
612 |
+
|
613 |
+
}
|
614 |
+
|
615 |
+
/*
|
616 |
+
* Post Object & User 'Allow Multiple' Disabled
|
617 |
+
* Value must not be inside array
|
618 |
+
*/
|
619 |
+
if(($r_ref_field['type'] === 'post_object' || $r_ref_field['type'] === 'user') && empty($r_ref_field['multiple']) && isset($r_values[0])){
|
620 |
+
|
621 |
+
// Get latest value
|
622 |
+
$r_values = end($r_values);
|
623 |
+
|
624 |
+
}
|
625 |
+
|
626 |
+
/*
|
627 |
+
* Remove potential empty serialized array in meta value 'a:0:{}'
|
628 |
+
*/
|
629 |
+
if(empty($r_values))
|
630 |
+
$r_values = false;
|
631 |
+
|
632 |
+
/*
|
633 |
+
* Construct a value array in case of ancestors. ie:
|
634 |
+
* $related_values = Array(
|
635 |
+
* [field_aaa] => Array(
|
636 |
+
* [field_bbb] => Array(
|
637 |
+
* [0] => xxxx
|
638 |
+
* )
|
639 |
+
* )
|
640 |
+
* )
|
641 |
+
*/
|
642 |
+
if(!empty($r_field_ancestors)){
|
643 |
+
|
644 |
+
for($i = count($r_values_query)-1; $i>=0; $i--){
|
645 |
+
$r_values = array($r_values_query[$i] => $r_values);
|
646 |
+
}
|
647 |
+
|
648 |
+
}
|
649 |
+
|
650 |
+
// Filter acf_update_value (to avoid infinite loop)
|
651 |
+
acf_enable_filter('acfe/bidirectional');
|
652 |
+
|
653 |
+
// Update Related Field
|
654 |
+
acf_update_value($r_values, $r_mtype.$r_id, $r_ref_field);
|
655 |
+
|
656 |
+
// Remove acf_update_value filter
|
657 |
+
acf_disable_filter('acfe/bidirectional');
|
658 |
|
659 |
}
|
660 |
|
|
|
|
|
661 |
}
|
662 |
|
663 |
+
function get_value_from_ancestor($r_ref_values, $r_field){
|
|
|
|
|
|
|
|
|
664 |
|
665 |
+
foreach($r_ref_values as $r_ref_key => $r_ref_value){
|
666 |
+
|
667 |
+
if($r_ref_key != $r_field['key']){
|
668 |
+
|
669 |
+
if(is_array($r_ref_value))
|
670 |
+
return $this->get_value_from_ancestor($r_ref_value, $r_field);
|
671 |
+
|
672 |
+
return false;
|
673 |
+
|
674 |
+
}
|
675 |
+
|
676 |
+
return $r_ref_value;
|
677 |
+
|
678 |
+
}
|
679 |
|
680 |
}
|
681 |
|
682 |
+
function is_field_bidirectional($field){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
+
return isset($field['acfe_bidirectional']['acfe_bidirectional_enabled']) && !empty($field['acfe_bidirectional']['acfe_bidirectional_enabled']);
|
|
|
|
|
685 |
|
686 |
}
|
|
|
|
|
|
|
687 |
|
688 |
+
function has_field_bidirectional($field){
|
689 |
+
|
690 |
+
return isset($field['acfe_bidirectional']['acfe_bidirectional_related']) && !empty($field['acfe_bidirectional']['acfe_bidirectional_related']);
|
691 |
+
|
692 |
+
}
|
|
|
|
|
|
|
|
|
693 |
|
694 |
+
function get_field_bidirectional($field){
|
695 |
|
696 |
+
if(!$this->is_field_bidirectional($field) || !$this->has_field_bidirectional($field))
|
|
|
|
|
|
|
|
|
697 |
return false;
|
|
|
|
|
698 |
|
699 |
+
return $field['acfe_bidirectional']['acfe_bidirectional_related'];
|
700 |
|
701 |
}
|
702 |
|
703 |
}
|
704 |
|
705 |
+
new acfe_bidirectional();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
|
707 |
+
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/fields/field-taxonomy-terms.php
CHANGED
@@ -215,10 +215,10 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
215 |
|
216 |
if(!empty($all_terms)){
|
217 |
|
218 |
-
foreach($all_terms as $term_id => &$
|
219 |
|
220 |
-
$level = acfe_get_term_level($
|
221 |
-
$
|
222 |
|
223 |
}
|
224 |
|
@@ -299,8 +299,6 @@ class acfe_field_taxonomy_terms extends acf_field{
|
|
299 |
|
300 |
$terms = array_merge($terms, acf_array($keep));
|
301 |
|
302 |
-
|
303 |
-
|
304 |
}
|
305 |
|
306 |
// Term
|
215 |
|
216 |
if(!empty($all_terms)){
|
217 |
|
218 |
+
foreach($all_terms as $term_id => &$_term){
|
219 |
|
220 |
+
$level = acfe_get_term_level($_term->term_id, $_term->taxonomy);
|
221 |
+
$_term->level = $level;
|
222 |
|
223 |
}
|
224 |
|
299 |
|
300 |
$terms = array_merge($terms, acf_array($keep));
|
301 |
|
|
|
|
|
302 |
}
|
303 |
|
304 |
// Term
|
includes/modules/dev.php
CHANGED
@@ -31,8 +31,11 @@ class acfe_dev{
|
|
31 |
add_action('show_user_profile', array($this, 'load_user'));
|
32 |
add_action('edit_user_profile', array($this, 'load_user'));
|
33 |
|
34 |
-
//
|
35 |
-
add_action('acf/options_page/submitbox_before_major_actions',
|
|
|
|
|
|
|
36 |
|
37 |
}
|
38 |
|
@@ -140,120 +143,158 @@ class acfe_dev{
|
|
140 |
// Get Meta
|
141 |
$this->get_meta($post_id);
|
142 |
|
|
|
|
|
143 |
// WP Metabox
|
144 |
if(!empty($this->wp_meta)){
|
145 |
|
|
|
|
|
|
|
146 |
$id = 'acfe-wp-custom-fields';
|
147 |
-
$title = 'WP Custom fields
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
$context = 'normal';
|
149 |
$priority = 'low';
|
150 |
|
151 |
-
add_meta_box($id, $title, array($this, '
|
152 |
|
153 |
}
|
154 |
|
155 |
// ACF Metabox
|
156 |
if(!empty($this->acf_meta)){
|
157 |
|
|
|
|
|
|
|
158 |
$id = 'acfe-acf-custom-fields';
|
159 |
-
$title = 'ACF Custom fields
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
$context = 'normal';
|
161 |
$priority = 'low';
|
162 |
|
163 |
-
add_meta_box($id, $title, array($this, '
|
164 |
|
165 |
}
|
166 |
|
167 |
}
|
168 |
|
169 |
-
function
|
170 |
|
171 |
-
|
172 |
-
|
|
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
<th scope="col" style="width:30%;">Name</th>
|
177 |
-
<th scope="col" style="width:auto;">Value</th>
|
178 |
-
</tr>
|
179 |
-
</thead>
|
180 |
-
|
181 |
-
<tbody>
|
182 |
-
|
183 |
-
<?php foreach($this->wp_meta as $meta_key => $meta_value){ ?>
|
184 |
-
|
185 |
-
<?php
|
186 |
-
$value_display = $this->render_meta_value($meta_value);
|
187 |
-
?>
|
188 |
-
|
189 |
-
<tr>
|
190 |
-
<td><strong><?php echo esc_attr($meta_key); ?></strong></td>
|
191 |
-
<td><?php echo $value_display; ?></td>
|
192 |
-
</tr>
|
193 |
-
|
194 |
-
<?php } ?>
|
195 |
-
|
196 |
-
</tbody>
|
197 |
-
|
198 |
-
</table>
|
199 |
-
<?php
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
204 |
|
205 |
?>
|
206 |
<table class="wp-list-table widefat fixed striped" style="border:0;">
|
207 |
|
208 |
<thead>
|
209 |
<tr>
|
|
|
|
|
|
|
|
|
|
|
210 |
<th scope="col" style="width:30%;">Name</th>
|
211 |
<th scope="col" style="width:auto;">Value</th>
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
</tr>
|
214 |
</thead>
|
215 |
|
216 |
<tbody>
|
217 |
|
218 |
-
<?php foreach($
|
219 |
|
220 |
<?php
|
221 |
|
222 |
-
//
|
223 |
-
$field = $meta['field'];
|
224 |
$meta_key = $meta['key'];
|
225 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
-
// Field Group
|
228 |
-
$field_group_display = __('Local', 'acf');
|
229 |
-
$field_group = $meta['field_group'];
|
230 |
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
-
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
if($post_status === 'publish' || $post_status === 'acf-disabled'){
|
240 |
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
-
}
|
244 |
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
-
}
|
248 |
-
|
249 |
-
$value_display = $this->render_meta_value($meta['value']);
|
250 |
-
|
251 |
-
?>
|
252 |
-
|
253 |
-
<tr>
|
254 |
-
<td><strong><?php echo esc_attr($meta_key); ?></strong></td>
|
255 |
-
<td><?php echo $value_display; ?></td>
|
256 |
-
<td><?php echo $field_group_display; ?></td>
|
257 |
</tr>
|
258 |
|
259 |
<?php } ?>
|
@@ -261,6 +302,35 @@ class acfe_dev{
|
|
261 |
</tbody>
|
262 |
|
263 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
<?php
|
265 |
|
266 |
}
|
@@ -352,11 +422,12 @@ class acfe_dev{
|
|
352 |
|
353 |
$search = "{$id}_%";
|
354 |
$_search = "_{$id}_%";
|
|
|
355 |
|
356 |
$search = str_replace('_', '\_', $search);
|
357 |
$_search = str_replace('_', '\_', $_search);
|
358 |
|
359 |
-
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s", $search, $_search));
|
360 |
|
361 |
}
|
362 |
|
@@ -364,66 +435,122 @@ class acfe_dev{
|
|
364 |
return;
|
365 |
|
366 |
$wp_meta = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
usort($get_meta, function($a, $b){
|
372 |
return strcmp($a->meta_key, $b->meta_key);
|
373 |
});
|
374 |
-
|
375 |
foreach($get_meta as $meta){
|
376 |
-
|
377 |
-
$wp_meta[$meta->meta_key] = $meta->meta_value;
|
378 |
-
|
379 |
-
}
|
380 |
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
|
|
|
|
|
|
384 |
usort($get_meta, function($a, $b){
|
385 |
-
return strcmp($a->
|
386 |
});
|
387 |
-
|
388 |
foreach($get_meta as $meta){
|
389 |
-
|
390 |
-
$wp_meta[$meta->
|
391 |
-
|
|
|
|
|
|
|
|
|
|
|
392 |
}
|
393 |
-
|
394 |
}
|
395 |
|
396 |
$acf_meta = array();
|
397 |
|
398 |
-
foreach($wp_meta as $key => $
|
399 |
|
400 |
// ACF Meta
|
401 |
if(isset($wp_meta["_$key"])){
|
402 |
|
403 |
$field = false;
|
404 |
-
$
|
|
|
405 |
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
-
$field = acf_get_field($wp_meta["_$key"]);
|
409 |
$field_group = acfe_get_field_group_from_field($field);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
}
|
412 |
|
413 |
-
$
|
414 |
-
|
415 |
-
|
416 |
-
'field' => $field,
|
417 |
-
'field_group' => $field_group,
|
418 |
-
);
|
419 |
|
420 |
-
$acf_meta[] =
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
|
|
426 |
|
|
|
427 |
unset($wp_meta["_$key"]);
|
428 |
unset($wp_meta[$key]);
|
429 |
|
@@ -436,6 +563,87 @@ class acfe_dev{
|
|
436 |
|
437 |
}
|
438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
}
|
440 |
|
441 |
new acfe_dev();
|
31 |
add_action('show_user_profile', array($this, 'load_user'));
|
32 |
add_action('edit_user_profile', array($this, 'load_user'));
|
33 |
|
34 |
+
// Options
|
35 |
+
add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_admin'));
|
36 |
+
|
37 |
+
add_action('wp_ajax_acfe/delete_meta', array($this, 'ajax_delete_meta'));
|
38 |
+
add_action('wp_ajax_acfe/bulk_delete_meta', array($this, 'ajax_bulk_delete_meta'));
|
39 |
|
40 |
}
|
41 |
|
143 |
// Get Meta
|
144 |
$this->get_meta($post_id);
|
145 |
|
146 |
+
$render_bulk = false;
|
147 |
+
|
148 |
// WP Metabox
|
149 |
if(!empty($this->wp_meta)){
|
150 |
|
151 |
+
if(empty($this->acf_meta))
|
152 |
+
$render_bulk = true;
|
153 |
+
|
154 |
$id = 'acfe-wp-custom-fields';
|
155 |
+
$title = 'WP Custom fields';
|
156 |
+
|
157 |
+
if($object_type === 'acf_options_page'){
|
158 |
+
$title = 'WP Options';
|
159 |
+
}
|
160 |
+
|
161 |
+
$title .= '<span class="acfe_dev_meta_count">' . count($this->wp_meta) . '</span>';
|
162 |
$context = 'normal';
|
163 |
$priority = 'low';
|
164 |
|
165 |
+
add_meta_box($id, $title, array($this, 'render_meta_box'), $object_type, $context, $priority, array('table_type' => 'wp', 'object_type' => $object_type, 'render_bulk' => $render_bulk));
|
166 |
|
167 |
}
|
168 |
|
169 |
// ACF Metabox
|
170 |
if(!empty($this->acf_meta)){
|
171 |
|
172 |
+
if(!$render_bulk)
|
173 |
+
$render_bulk = true;
|
174 |
+
|
175 |
$id = 'acfe-acf-custom-fields';
|
176 |
+
$title = 'ACF Custom fields';
|
177 |
+
|
178 |
+
if($object_type === 'acf_options_page'){
|
179 |
+
$title = 'ACF Options';
|
180 |
+
}
|
181 |
+
|
182 |
+
$title .= '<span class="acfe_dev_meta_count">' . count($this->acf_meta) . '</span>';
|
183 |
$context = 'normal';
|
184 |
$priority = 'low';
|
185 |
|
186 |
+
add_meta_box($id, $title, array($this, 'render_meta_box'), $object_type, $context, $priority, array('table_type' => 'acf', 'object_type' => $object_type, 'render_bulk' => $render_bulk));
|
187 |
|
188 |
}
|
189 |
|
190 |
}
|
191 |
|
192 |
+
function render_meta_box($post, $metabox){
|
193 |
|
194 |
+
$table_type = $metabox['args']['table_type'];
|
195 |
+
$object_type = $metabox['args']['object_type'];
|
196 |
+
$render_bulk = $metabox['args']['render_bulk'];
|
197 |
|
198 |
+
$is_options = ($object_type === 'acf_options_page');
|
199 |
+
$is_acf = ($table_type === 'acf');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
$metas = $this->wp_meta;
|
202 |
+
|
203 |
+
if($is_acf)
|
204 |
+
$metas = $this->acf_meta;
|
205 |
|
206 |
?>
|
207 |
<table class="wp-list-table widefat fixed striped" style="border:0;">
|
208 |
|
209 |
<thead>
|
210 |
<tr>
|
211 |
+
|
212 |
+
<?php if(current_user_can(acf_get_setting('capability'))){ ?>
|
213 |
+
<td scope="col" class="check-column"><input type="checkbox" /></td>
|
214 |
+
<?php } ?>
|
215 |
+
|
216 |
<th scope="col" style="width:30%;">Name</th>
|
217 |
<th scope="col" style="width:auto;">Value</th>
|
218 |
+
|
219 |
+
<?php if($is_acf){ ?>
|
220 |
+
<th scope="col" style="width:100px;">Field Type</th>
|
221 |
+
<th scope="col" style="width:120px;">Field group</th>
|
222 |
+
<?php } ?>
|
223 |
+
|
224 |
+
<?php if($is_options){ ?>
|
225 |
+
<th scope="col" style="width:65px;">Autoload</th>
|
226 |
+
<?php } ?>
|
227 |
+
|
228 |
</tr>
|
229 |
</thead>
|
230 |
|
231 |
<tbody>
|
232 |
|
233 |
+
<?php foreach($metas as $meta){ ?>
|
234 |
|
235 |
<?php
|
236 |
|
237 |
+
// WP Meta
|
|
|
238 |
$meta_key = $meta['key'];
|
239 |
+
$meta_id = $meta['id'];
|
240 |
+
$value = $this->render_meta_value($meta['value']);
|
241 |
+
$type = $meta['type'];
|
242 |
+
|
243 |
+
// ACF Meta
|
244 |
+
if($is_acf){
|
245 |
+
|
246 |
+
$field_type = acf_maybe_get($meta, 'field_type');
|
247 |
+
|
248 |
+
}
|
249 |
|
|
|
|
|
|
|
250 |
|
251 |
+
$field_group = acf_maybe_get($meta, 'field_group');
|
252 |
+
|
253 |
+
$nonce = wp_create_nonce('acfe_delete_meta_' . $meta_id);
|
254 |
+
?>
|
255 |
+
|
256 |
+
<tr class="acfe_dev_meta_<?php echo $is_options ? $meta_key : $meta_id; ?>">
|
257 |
|
258 |
+
<?php if(current_user_can(acf_get_setting('capability'))){ ?>
|
259 |
+
<th scope="row" class="check-column">
|
260 |
+
<input type="checkbox" class="acfe_bulk_delete_meta" value="<?php echo $is_options ? $meta_key : $meta_id; ?>" />
|
261 |
+
</th>
|
262 |
+
<?php } ?>
|
263 |
|
264 |
+
<td>
|
265 |
+
<strong><?php echo esc_attr($meta_key); ?></strong>
|
266 |
+
|
267 |
+
<?php if(current_user_can(acf_get_setting('capability'))){ ?>
|
|
|
268 |
|
269 |
+
<div class="row-actions">
|
270 |
+
|
271 |
+
<?php if($is_options){ ?>
|
272 |
+
<span class="edit">
|
273 |
+
<a href="<?php echo admin_url('options-general.php?page=acfe-options&action=edit&option=' . $meta_id); ?>>"><?php _e('Edit'); ?></a> |
|
274 |
+
</span>
|
275 |
+
<?php } ?>
|
276 |
+
|
277 |
+
<span class="delete">
|
278 |
+
<a href="#" class="acfe_delete_meta" data-meta-id="<?php echo $meta_id; ?>" data-meta-key="<?php echo $meta_key; ?>" data-type="<?php echo $type; ?>" data-nonce="<?php echo $nonce; ?>"><?php _e('Delete'); ?></a>
|
279 |
+
</span>
|
280 |
+
|
281 |
+
</div>
|
282 |
|
283 |
+
<?php } ?>
|
284 |
|
285 |
+
</td>
|
286 |
+
|
287 |
+
<td><?php echo $value; ?></td>
|
288 |
+
|
289 |
+
<?php if($is_acf){ ?>
|
290 |
+
<td><?php echo $field_type; ?></td>
|
291 |
+
<td><?php echo $field_group; ?></td>
|
292 |
+
<?php } ?>
|
293 |
+
|
294 |
+
<?php if($is_options){ ?>
|
295 |
+
<td><?php echo $meta['autoload']; ?></td>
|
296 |
+
<?php } ?>
|
297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
</tr>
|
299 |
|
300 |
<?php } ?>
|
302 |
</tbody>
|
303 |
|
304 |
</table>
|
305 |
+
|
306 |
+
<?php if(current_user_can(acf_get_setting('capability')) && $render_bulk){ ?>
|
307 |
+
|
308 |
+
<div class="acfe_dev_bulk_actions tablenav bottom">
|
309 |
+
|
310 |
+
<div class="alignleft actions bulkactions">
|
311 |
+
|
312 |
+
<label for="bulk-action-selector-bottom" class="screen-reader-text"><?php _e('Select bulk action'); ?></label>
|
313 |
+
|
314 |
+
<input type="hidden" class="acfe_bulk_delete_meta_type" value="<?php echo $type; ?>" />
|
315 |
+
|
316 |
+
<?php $nonce = wp_create_nonce('acfe_bulk_delete_meta'); ?>
|
317 |
+
<input type="hidden" class="acfe_bulk_delete_meta_nonce" value="<?php echo $nonce; ?>" />
|
318 |
+
|
319 |
+
<select class="acfe_bulk_delete_meta_action">
|
320 |
+
<option value="-1"><?php _e('Bulk Actions'); ?></option>
|
321 |
+
<option value="delete"><?php _e('Delete'); ?></option>
|
322 |
+
</select>
|
323 |
+
|
324 |
+
<input type="submit" id="acfe_bulk_deleta_meta_submit" class="button action" value="<?php _e('Apply'); ?>">
|
325 |
+
|
326 |
+
</div>
|
327 |
+
|
328 |
+
<br class="clear">
|
329 |
+
|
330 |
+
</div>
|
331 |
+
|
332 |
+
<?php } ?>
|
333 |
+
|
334 |
<?php
|
335 |
|
336 |
}
|
422 |
|
423 |
$search = "{$id}_%";
|
424 |
$_search = "_{$id}_%";
|
425 |
+
$search_single = "{$id}";
|
426 |
|
427 |
$search = str_replace('_', '\_', $search);
|
428 |
$_search = str_replace('_', '\_', $_search);
|
429 |
|
430 |
+
$get_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s OR option_name = %s", $search, $_search, $search_single));
|
431 |
|
432 |
}
|
433 |
|
435 |
return;
|
436 |
|
437 |
$wp_meta = array();
|
438 |
+
|
439 |
+
// Option
|
440 |
+
if($info['type'] === 'option'){
|
441 |
+
|
442 |
+
usort($get_meta, function($a, $b){
|
443 |
+
return strcmp($a->option_name, $b->option_name);
|
444 |
+
});
|
445 |
+
|
446 |
+
foreach($get_meta as $meta){
|
447 |
|
448 |
+
$wp_meta[$meta->option_name] = array(
|
449 |
+
'id' => $meta->option_id,
|
450 |
+
'key' => $meta->option_name,
|
451 |
+
'value' => $meta->option_value,
|
452 |
+
'autoload' => $meta->autoload,
|
453 |
+
'type' => $info['type'],
|
454 |
+
);
|
455 |
+
|
456 |
+
}
|
457 |
+
|
458 |
+
// Post / Term
|
459 |
+
}elseif($info['type'] === 'post' || $info['type'] === 'term'){
|
460 |
+
|
461 |
usort($get_meta, function($a, $b){
|
462 |
return strcmp($a->meta_key, $b->meta_key);
|
463 |
});
|
464 |
+
|
465 |
foreach($get_meta as $meta){
|
|
|
|
|
|
|
|
|
466 |
|
467 |
+
$wp_meta[$meta->meta_key] = array(
|
468 |
+
'id' => $meta->meta_id,
|
469 |
+
'key' => $meta->meta_key,
|
470 |
+
'value' => $meta->meta_value,
|
471 |
+
'type' => $info['type'],
|
472 |
+
);
|
473 |
+
|
474 |
+
}
|
475 |
|
476 |
+
// User
|
477 |
+
}elseif($info['type'] === 'user'){
|
478 |
+
|
479 |
usort($get_meta, function($a, $b){
|
480 |
+
return strcmp($a->meta_key, $b->meta_key);
|
481 |
});
|
482 |
+
|
483 |
foreach($get_meta as $meta){
|
484 |
+
|
485 |
+
$wp_meta[$meta->meta_key] = array(
|
486 |
+
'id' => $meta->umeta_id,
|
487 |
+
'key' => $meta->meta_key,
|
488 |
+
'value' => $meta->meta_value,
|
489 |
+
'type' => $info['type'],
|
490 |
+
);
|
491 |
+
|
492 |
}
|
493 |
+
|
494 |
}
|
495 |
|
496 |
$acf_meta = array();
|
497 |
|
498 |
+
foreach($wp_meta as $key => $meta){
|
499 |
|
500 |
// ACF Meta
|
501 |
if(isset($wp_meta["_$key"])){
|
502 |
|
503 |
$field = false;
|
504 |
+
$field_type_display = false;
|
505 |
+
$field_group_display = false;
|
506 |
|
507 |
+
// Value = field_abcde123456?
|
508 |
+
if(acf_is_field_key($wp_meta["_$key"]['value'])){
|
509 |
+
|
510 |
+
$field = acf_get_field($wp_meta["_$key"]['value']);
|
511 |
+
|
512 |
+
$field_type = acf_get_field_type($field['type']);
|
513 |
+
$field_type_display = '<em>Undefined</em>';
|
514 |
+
|
515 |
+
if(isset($field_type->label))
|
516 |
+
$field_type_display = $field_type->label;
|
517 |
|
|
|
518 |
$field_group = acfe_get_field_group_from_field($field);
|
519 |
+
$field_group_display = '<em>Undefined</em>';
|
520 |
+
|
521 |
+
if($field_group){
|
522 |
+
|
523 |
+
$field_group_display = $field_group['title'];
|
524 |
+
|
525 |
+
if(!empty($field_group['ID'])){
|
526 |
+
|
527 |
+
$post_status = get_post_status($field_group['ID']);
|
528 |
+
|
529 |
+
if($post_status === 'publish' || $post_status === 'acf-disabled'){
|
530 |
+
|
531 |
+
$field_group_display = '<a href="' . admin_url('post.php?post=' . $field_group['ID'] . '&action=edit') . '">' . $field_group['title'] . '</a>';
|
532 |
+
|
533 |
+
}
|
534 |
+
|
535 |
+
}
|
536 |
+
|
537 |
+
}
|
538 |
|
539 |
}
|
540 |
|
541 |
+
$_meta = $wp_meta["_$key"];
|
542 |
+
$_meta['field_type'] = $field_type_display;
|
543 |
+
$_meta['field_group'] = $field_group_display;
|
|
|
|
|
|
|
544 |
|
545 |
+
$acf_meta[] = $_meta;
|
546 |
+
|
547 |
+
$_meta = $wp_meta[$key];
|
548 |
+
$_meta['field_type'] = $field_type_display;
|
549 |
+
$_meta['field_group'] = $field_group_display;
|
550 |
+
|
551 |
+
$acf_meta[] = $_meta;
|
552 |
|
553 |
+
// Unset WP Meta
|
554 |
unset($wp_meta["_$key"]);
|
555 |
unset($wp_meta[$key]);
|
556 |
|
563 |
|
564 |
}
|
565 |
|
566 |
+
function ajax_delete_meta(){
|
567 |
+
|
568 |
+
// Vars
|
569 |
+
$id = acf_maybe_get_POST('id');
|
570 |
+
$key = acf_maybe_get_POST('key');
|
571 |
+
$type = acf_maybe_get_POST('type');
|
572 |
+
|
573 |
+
// Check vars
|
574 |
+
if(!$id || !$key || !$type)
|
575 |
+
wp_die(0);
|
576 |
+
|
577 |
+
// Check referer
|
578 |
+
check_ajax_referer("acfe_delete_meta_$id");
|
579 |
+
|
580 |
+
if(!current_user_can(acf_get_setting('capability'))){
|
581 |
+
wp_die(-1);
|
582 |
+
}
|
583 |
+
|
584 |
+
// Delete option
|
585 |
+
if($type === 'option'){
|
586 |
+
|
587 |
+
if(delete_option($key))
|
588 |
+
wp_die(1);
|
589 |
+
|
590 |
+
// Delete meta
|
591 |
+
}else{
|
592 |
+
|
593 |
+
if(delete_metadata_by_mid($type, $id))
|
594 |
+
wp_die(1);
|
595 |
+
|
596 |
+
}
|
597 |
+
|
598 |
+
wp_die(0);
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
function ajax_bulk_delete_meta(){
|
603 |
+
|
604 |
+
// Vars
|
605 |
+
$ids = acf_maybe_get_POST('ids');
|
606 |
+
$type = acf_maybe_get_POST('type');
|
607 |
+
|
608 |
+
// Check vars
|
609 |
+
if(!$ids || !$type)
|
610 |
+
wp_die(0);
|
611 |
+
|
612 |
+
// Check referer
|
613 |
+
check_ajax_referer('acfe_bulk_delete_meta');
|
614 |
+
|
615 |
+
if(!current_user_can(acf_get_setting('capability'))){
|
616 |
+
wp_die(-1);
|
617 |
+
}
|
618 |
+
|
619 |
+
// Delete option
|
620 |
+
if($type === 'option'){
|
621 |
+
|
622 |
+
foreach($ids as $key){
|
623 |
+
|
624 |
+
delete_option($key);
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
wp_die(1);
|
629 |
+
|
630 |
+
// Delete meta
|
631 |
+
}else{
|
632 |
+
|
633 |
+
foreach($ids as $id){
|
634 |
+
|
635 |
+
delete_metadata_by_mid($type, $id);
|
636 |
+
|
637 |
+
}
|
638 |
+
|
639 |
+
wp_die(1);
|
640 |
+
|
641 |
+
}
|
642 |
+
|
643 |
+
wp_die(0);
|
644 |
+
|
645 |
+
}
|
646 |
+
|
647 |
}
|
648 |
|
649 |
new acfe_dev();
|
includes/modules/settings.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
// Check setting
|
7 |
+
if(!acf_get_setting('acfe/modules/ui'))
|
8 |
+
return;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* General Options
|
12 |
+
*/
|
13 |
+
add_action('admin_footer-options-general.php', 'acfe_better_options_general_admin_footer');
|
14 |
+
add_action('admin_footer-options-writing.php', 'acfe_better_options_general_admin_footer');
|
15 |
+
add_action('admin_footer-options-reading.php', 'acfe_better_options_general_admin_footer');
|
16 |
+
add_action('admin_footer-options-discussion.php', 'acfe_better_options_general_admin_footer');
|
17 |
+
add_action('admin_footer-options-media.php', 'acfe_better_options_general_admin_footer');
|
18 |
+
add_action('admin_footer-options-permalink.php', 'acfe_better_options_general_admin_footer');
|
19 |
+
function acfe_better_options_general_admin_footer(){
|
20 |
+
|
21 |
+
global $pagenow;
|
22 |
+
|
23 |
+
?>
|
24 |
+
<script type="text/html" id="tmpl-acf-column-2">
|
25 |
+
<div class="acf-column-2">
|
26 |
+
|
27 |
+
<div id="poststuff" class="acfe-acfe-bt-admin-column">
|
28 |
+
|
29 |
+
<div class="postbox">
|
30 |
+
|
31 |
+
<h2 class="hndle ui-sortable-handle"><span><?php _e('Settings'); ?></span></h2>
|
32 |
+
|
33 |
+
<div class="inside">
|
34 |
+
<div class="submitbox">
|
35 |
+
|
36 |
+
<div id="major-publishing-actions">
|
37 |
+
|
38 |
+
<div id="publishing-action">
|
39 |
+
|
40 |
+
<div class="acfe-form-submit">
|
41 |
+
<input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Save Changes'); ?>" />
|
42 |
+
<span class="acf-spinner"></span>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
</div>
|
46 |
+
<div class="clear"></div>
|
47 |
+
|
48 |
+
</div>
|
49 |
+
|
50 |
+
</div>
|
51 |
+
|
52 |
+
</div>
|
53 |
+
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<?php do_meta_boxes(get_current_screen(), 'side', array()); ?>
|
57 |
+
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
</script>
|
61 |
+
<script type="text/javascript">
|
62 |
+
(function($){
|
63 |
+
|
64 |
+
// ACF Extended UI
|
65 |
+
$('.wrap').addClass('acfe-ui');
|
66 |
+
|
67 |
+
// wrap form
|
68 |
+
$('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
|
69 |
+
|
70 |
+
// add column side
|
71 |
+
$('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
72 |
+
|
73 |
+
<?php if(!in_array($pagenow, array('options-permalink.php', 'options-media.php'))){ ?>
|
74 |
+
|
75 |
+
// add title
|
76 |
+
var title = $('.wrap > h1').text();
|
77 |
+
$('.acfe-ui > form > div > div > table:first').before('<h2>' + title + '</h2>');
|
78 |
+
|
79 |
+
<?php } ?>
|
80 |
+
|
81 |
+
$('.acfe-ui > h1').css('margin-bottom', '13px');
|
82 |
+
|
83 |
+
if($('#ping_sites').length){
|
84 |
+
|
85 |
+
$('#ping_sites').wrap('<table class="form-table"><tbody><td class="td-full"></td></tbody></table>');
|
86 |
+
$('#ping_sites').css('width', '100%');
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
// Hide native button
|
91 |
+
$('.acfe-ui > form p.submit').hide();
|
92 |
+
|
93 |
+
})(jQuery);
|
94 |
+
</script>
|
95 |
+
<?php
|
96 |
+
|
97 |
+
}
|
includes/modules/single-meta.php
CHANGED
@@ -16,267 +16,254 @@ class acfe_single_meta{
|
|
16 |
|
17 |
public $data = array();
|
18 |
public $restricted = array();
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
|
22 |
$this->restricted = array('acf-field-group', 'acf-field', 'attachment', 'acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form');
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
//
|
29 |
-
add_filter('acf/
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
// Settings
|
33 |
add_action('acf/render_field_settings', array($this, 'field_setting'));
|
34 |
|
35 |
// Post
|
36 |
-
add_action('load-post.php',
|
37 |
-
|
38 |
|
39 |
// Term
|
40 |
-
add_action('load-edit-tags.php',
|
41 |
-
add_action('load-term.php',
|
42 |
|
43 |
// User
|
44 |
-
add_action('load-user-new.php',
|
45 |
-
add_action('load-user-edit.php',
|
46 |
-
add_action('load-profile.php',
|
|
|
|
|
|
|
47 |
|
48 |
-
|
49 |
|
50 |
/*
|
51 |
-
*
|
52 |
*/
|
53 |
-
function
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
// return null;
|
58 |
|
59 |
// Validate Post ID
|
60 |
$validate = $this->validate_post_id($post_id);
|
61 |
|
62 |
if(!$validate)
|
63 |
-
return $
|
64 |
-
|
65 |
-
$is_save_post = false;
|
66 |
-
|
67 |
-
// Submitting acf/save_post
|
68 |
-
if(acf_maybe_get_POST('acf'))
|
69 |
-
$is_save_post = true;
|
70 |
|
71 |
// Get store
|
72 |
-
$store =
|
|
|
73 |
|
74 |
-
//
|
75 |
-
if(
|
76 |
-
|
77 |
-
// Get Store: ACF meta
|
78 |
-
$acf = $store->get("$post_id:acf");
|
79 |
|
80 |
-
//
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
// Submitting acf/save_post
|
85 |
-
if($is_save_post){
|
86 |
-
|
87 |
-
// Resetting values to empty
|
88 |
-
$acf = array();
|
89 |
-
|
90 |
-
// Single field update
|
91 |
-
}else{
|
92 |
-
|
93 |
-
// Get ACF meta
|
94 |
-
$acf = acf_get_metadata($post_id, 'acf');
|
95 |
-
|
96 |
-
}
|
97 |
-
*/
|
98 |
-
|
99 |
-
// Get ACF meta
|
100 |
-
$acf = acf_get_metadata($post_id, 'acf');
|
101 |
|
102 |
-
//
|
103 |
-
$
|
104 |
|
105 |
}
|
106 |
|
107 |
-
|
108 |
-
$acf[$field['name']] = $value;
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
116 |
|
117 |
-
|
118 |
-
$store->set("$post_id:acf", $acf);
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
return null;
|
126 |
|
127 |
}
|
128 |
-
|
129 |
/*
|
130 |
-
*
|
131 |
*/
|
132 |
-
function
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
return $value;
|
137 |
|
138 |
// Validate Post ID
|
139 |
$validate = $this->validate_post_id($post_id);
|
140 |
|
141 |
if(!$validate)
|
142 |
-
return $
|
143 |
-
|
144 |
-
// Check store.
|
145 |
-
$store = acf_get_store('acfe/meta');
|
146 |
|
147 |
-
//
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
152 |
|
153 |
-
//
|
154 |
-
|
155 |
-
|
156 |
-
// Get ACF meta
|
157 |
-
$acf = acf_get_metadata($post_id, 'acf');
|
158 |
-
|
159 |
-
// Set Store: ACF meta
|
160 |
-
$store->set("$post_id:acf", $acf);
|
161 |
-
|
162 |
-
}
|
163 |
|
164 |
-
//
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
-
|
|
|
|
|
|
|
171 |
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
}
|
175 |
|
176 |
-
|
|
|
177 |
|
178 |
}
|
179 |
-
|
180 |
/*
|
181 |
-
*
|
182 |
*/
|
183 |
-
function
|
184 |
-
|
185 |
-
if(!$hidden)
|
186 |
-
return $value;
|
187 |
|
|
|
|
|
|
|
188 |
// Validate Post ID
|
189 |
$validate = $this->validate_post_id($post_id);
|
190 |
-
|
191 |
if(!$validate)
|
192 |
-
return $
|
193 |
-
|
194 |
-
//
|
195 |
-
$store =
|
|
|
196 |
|
197 |
-
//
|
198 |
-
if(
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
202 |
|
203 |
-
//
|
204 |
-
|
|
|
|
|
205 |
|
206 |
-
//
|
207 |
-
$acf
|
208 |
|
209 |
-
//
|
210 |
$store->set("$post_id:acf", $acf);
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
213 |
|
214 |
-
|
215 |
-
return $value;
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
$value = $acf["_{$name}"];
|
220 |
-
|
221 |
-
}
|
222 |
|
223 |
-
|
|
|
|
|
|
|
224 |
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
// Validate ID
|
233 |
-
if(!$id)
|
234 |
-
return false;
|
235 |
|
236 |
-
//
|
237 |
-
|
238 |
-
return false;
|
239 |
|
240 |
-
|
241 |
-
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
$
|
247 |
-
|
248 |
-
//
|
249 |
-
|
250 |
-
|
251 |
-
// Get Store: Allowed
|
252 |
-
$allowed = $store->get("$post_id:allowed");
|
253 |
-
|
254 |
-
// Allowed not found
|
255 |
-
}else{
|
256 |
-
|
257 |
-
$post_type = get_post_type($id);
|
258 |
-
|
259 |
-
if(!in_array($post_type, $this->restricted)){
|
260 |
-
|
261 |
-
$allowed = true;
|
262 |
-
|
263 |
-
}
|
264 |
-
|
265 |
-
$store->set("$post_id:allowed", $allowed);
|
266 |
-
|
267 |
-
}
|
268 |
-
|
269 |
-
if(!$allowed)
|
270 |
-
return false;
|
271 |
|
272 |
}
|
273 |
|
274 |
-
return true;
|
275 |
-
|
276 |
}
|
277 |
|
278 |
/*
|
279 |
-
*
|
280 |
*/
|
281 |
function save_post($post_id = 0){
|
282 |
|
@@ -286,7 +273,7 @@ class acfe_single_meta{
|
|
286 |
if(!$validate)
|
287 |
return;
|
288 |
|
289 |
-
//
|
290 |
$store = acf_get_store('acfe/meta');
|
291 |
|
292 |
// Store found
|
@@ -295,9 +282,24 @@ class acfe_single_meta{
|
|
295 |
|
296 |
// Get Store: ACF meta
|
297 |
$acf = $store->get("$post_id:acf");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
-
|
300 |
-
|
|
|
301 |
|
302 |
if(acf_maybe_get_POST('acfe_clean_meta')){
|
303 |
|
@@ -305,13 +307,16 @@ class acfe_single_meta{
|
|
305 |
|
306 |
if(empty($meta))
|
307 |
return;
|
|
|
|
|
308 |
|
309 |
foreach($meta as $key => $value){
|
310 |
|
311 |
-
// bail if
|
312 |
if(!isset($meta["_$key"]))
|
313 |
continue;
|
314 |
|
|
|
315 |
if(isset($acf[$key]))
|
316 |
continue;
|
317 |
|
@@ -319,9 +324,106 @@ class acfe_single_meta{
|
|
319 |
acf_delete_metadata($post_id, $key, true);
|
320 |
|
321 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
324 |
|
|
|
|
|
325 |
}
|
326 |
|
327 |
/*
|
@@ -354,14 +456,19 @@ class acfe_single_meta{
|
|
354 |
|
355 |
function load_post(){
|
356 |
|
|
|
|
|
|
|
357 |
// globals
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
|
|
365 |
|
366 |
// actions
|
367 |
add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 10, 2);
|
@@ -375,9 +482,15 @@ class acfe_single_meta{
|
|
375 |
}
|
376 |
|
377 |
function load_term(){
|
|
|
|
|
|
|
378 |
|
379 |
$screen = get_current_screen();
|
380 |
-
|
|
|
|
|
|
|
381 |
|
382 |
// actions
|
383 |
add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 20, 2);
|
@@ -392,7 +505,19 @@ class acfe_single_meta{
|
|
392 |
|
393 |
function load_user(){
|
394 |
|
395 |
-
add_meta_box('acfe-clean-meta', 'ACF Single Meta', array($this, 'render_metabox'), 'edit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
|
397 |
}
|
398 |
|
@@ -400,23 +525,23 @@ class acfe_single_meta{
|
|
400 |
|
401 |
$field = array(
|
402 |
'key' => false,
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
);
|
421 |
|
422 |
acf_render_field_wrap($field);
|
@@ -424,11 +549,11 @@ class acfe_single_meta{
|
|
424 |
?>
|
425 |
<script type="text/javascript">
|
426 |
if( typeof acf !== 'undefined' ) {
|
427 |
-
|
428 |
acf.newPostbox({
|
429 |
'id': 'acfe-clean-meta',
|
430 |
'label': 'top'
|
431 |
-
});
|
432 |
|
433 |
}
|
434 |
</script>
|
16 |
|
17 |
public $data = array();
|
18 |
public $restricted = array();
|
19 |
+
public $post_types = array();
|
20 |
+
public $taxonomies = array();
|
21 |
+
public $options = array();
|
22 |
|
23 |
+
function __construct(){
|
24 |
|
25 |
$this->restricted = array('acf-field-group', 'acf-field', 'attachment', 'acfe-dbt', 'acfe-dop', 'acfe-dpt', 'acfe-dt', 'acfe-form');
|
26 |
|
27 |
+
$this->post_types = apply_filters('acfe/modules/single_meta/post_types', array());
|
28 |
+
$this->taxonomies = apply_filters('acfe/modules/single_meta/taxonomies', array());
|
29 |
+
$this->options = apply_filters('acfe/modules/single_meta/options', false);
|
30 |
|
31 |
+
// Values
|
32 |
+
add_filter('acf/pre_load_metadata', array($this, 'load_metadata'), 999, 4);
|
33 |
+
add_filter('acf/update_value', array($this, 'update_value'), 999, 3);
|
34 |
+
add_filter('acf/pre_update_metadata', array($this, 'update_metadata'), 999, 5);
|
35 |
+
add_filter('acf/pre_delete_metadata', array($this, 'delete_metadata'), 999, 4);
|
36 |
+
|
37 |
+
// Save Post
|
38 |
+
add_action('acf/save_post', array($this, 'pre_save_post'), 0);
|
39 |
+
add_action('acf/save_post', array($this, 'save_post'), 999);
|
40 |
|
41 |
// Settings
|
42 |
add_action('acf/render_field_settings', array($this, 'field_setting'));
|
43 |
|
44 |
// Post
|
45 |
+
add_action('load-post.php', array($this, 'load_post'));
|
46 |
+
add_action('load-post-new.php', array($this, 'load_post'));
|
47 |
|
48 |
// Term
|
49 |
+
add_action('load-edit-tags.php', array($this, 'load_term'));
|
50 |
+
add_action('load-term.php', array($this, 'load_term'));
|
51 |
|
52 |
// User
|
53 |
+
add_action('load-user-new.php', array($this, 'load_user'));
|
54 |
+
add_action('load-user-edit.php', array($this, 'load_user'));
|
55 |
+
add_action('load-profile.php', array($this, 'load_user'));
|
56 |
+
|
57 |
+
// Options
|
58 |
+
add_action('acf/options_page/submitbox_before_major_actions', array($this, 'load_options'));
|
59 |
|
60 |
+
}
|
61 |
|
62 |
/*
|
63 |
+
* Load Metadata
|
64 |
*/
|
65 |
+
function load_metadata($return, $post_id, $name, $hidden){
|
66 |
|
67 |
+
if($name === 'acf')
|
68 |
+
return $return;
|
|
|
69 |
|
70 |
// Validate Post ID
|
71 |
$validate = $this->validate_post_id($post_id);
|
72 |
|
73 |
if(!$validate)
|
74 |
+
return $return;
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
// Get store
|
77 |
+
$store = $this->get_store($post_id);
|
78 |
+
$acf = $store->get("$post_id:acf");
|
79 |
|
80 |
+
// Bail early if empty
|
81 |
+
if(empty($acf))
|
82 |
+
return $return;
|
|
|
|
|
83 |
|
84 |
+
// Prefix
|
85 |
+
$prefix = $hidden ? '_' : '';
|
86 |
+
|
87 |
+
if(isset($acf["{$prefix}{$name}"])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
+
// Value
|
90 |
+
$return = $acf["{$prefix}{$name}"];
|
91 |
|
92 |
}
|
93 |
|
94 |
+
return $return;
|
|
|
95 |
|
96 |
+
}
|
97 |
+
|
98 |
+
/*
|
99 |
+
* Update Value
|
100 |
+
*/
|
101 |
+
function update_value($value, $post_id, $field){
|
102 |
+
|
103 |
+
acf_enable_filter('acfe/save');
|
104 |
|
105 |
+
if(acf_maybe_get($field, 'acfe_save_meta')){
|
|
|
106 |
|
107 |
+
acf_disable_filter('acfe/save');
|
108 |
+
|
109 |
+
}
|
110 |
|
111 |
+
return $value;
|
|
|
112 |
|
113 |
}
|
114 |
+
|
115 |
/*
|
116 |
+
* Update Metadata
|
117 |
*/
|
118 |
+
function update_metadata($return, $post_id, $name, $value, $hidden){
|
119 |
+
|
120 |
+
if($name === 'acf')
|
121 |
+
return $return;
|
|
|
122 |
|
123 |
// Validate Post ID
|
124 |
$validate = $this->validate_post_id($post_id);
|
125 |
|
126 |
if(!$validate)
|
127 |
+
return $return;
|
|
|
|
|
|
|
128 |
|
129 |
+
// Get store
|
130 |
+
$store = $this->get_store($post_id);
|
131 |
+
$acf = $store->get("$post_id:acf");
|
132 |
+
|
133 |
+
// Decode $post_id for $type and $id.
|
134 |
+
extract(acf_decode_post_id($post_id));
|
135 |
|
136 |
+
// Prefix
|
137 |
+
$prefix = $hidden ? '_' : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
+
// Value
|
140 |
+
$acf["{$prefix}{$name}"] = $value;
|
141 |
+
|
142 |
+
// Update store
|
143 |
+
$store->set("$post_id:acf", $acf);
|
144 |
+
|
145 |
+
// Single field update: Save to ACF meta
|
146 |
+
if(!acf_maybe_get_POST('acf') || acf_is_filter_enabled('acfe/bidirectional')){
|
147 |
+
|
148 |
+
// Update option
|
149 |
+
if($type === 'option'){
|
150 |
+
|
151 |
+
$acf = wp_unslash($acf);
|
152 |
+
$autoload = (bool) acf_get_setting('autoload');
|
153 |
+
|
154 |
+
update_option($id, $acf, $autoload);
|
155 |
|
156 |
+
// Update meta
|
157 |
+
}else{
|
158 |
+
|
159 |
+
acf_update_metadata($post_id, 'acf', $acf);
|
160 |
+
|
161 |
+
}
|
162 |
|
163 |
+
}
|
164 |
+
|
165 |
+
// Delete Native ACF field
|
166 |
+
if(acf_is_filter_enabled('acfe/save')){
|
167 |
|
168 |
+
acf_enable_filter('acfe/delete');
|
169 |
+
|
170 |
+
acf_delete_metadata($post_id, "{$name}", $hidden);
|
171 |
+
|
172 |
+
acf_disable_filter('acfe/delete');
|
173 |
+
|
174 |
+
// Do not save as meta
|
175 |
+
return true;
|
176 |
|
177 |
}
|
178 |
|
179 |
+
// Save normally
|
180 |
+
return null;
|
181 |
|
182 |
}
|
183 |
+
|
184 |
/*
|
185 |
+
* Delete Metadata
|
186 |
*/
|
187 |
+
function delete_metadata($return, $post_id, $name, $hidden){
|
|
|
|
|
|
|
188 |
|
189 |
+
if($name === 'acf' || acf_is_filter_enabled('acfe/delete'))
|
190 |
+
return $return;
|
191 |
+
|
192 |
// Validate Post ID
|
193 |
$validate = $this->validate_post_id($post_id);
|
194 |
+
|
195 |
if(!$validate)
|
196 |
+
return $return;
|
197 |
+
|
198 |
+
// Get store
|
199 |
+
$store = $this->get_store($post_id);
|
200 |
+
$acf = $store->get("$post_id:acf");
|
201 |
|
202 |
+
// Bail early if empty
|
203 |
+
if(empty($acf))
|
204 |
+
return $return;
|
205 |
+
|
206 |
+
// Decode $post_id for $type and $id.
|
207 |
+
extract(acf_decode_post_id($post_id));
|
208 |
|
209 |
+
// Prefix
|
210 |
+
$prefix = $hidden ? '_' : '';
|
211 |
+
|
212 |
+
if(isset($acf["{$prefix}{$name}"])){
|
213 |
|
214 |
+
// Value
|
215 |
+
unset($acf["{$prefix}{$name}"]);
|
216 |
|
217 |
+
// Update store
|
218 |
$store->set("$post_id:acf", $acf);
|
219 |
+
|
220 |
+
// Update option
|
221 |
+
if($type === 'option'){
|
222 |
+
|
223 |
+
$acf = wp_unslash($acf);
|
224 |
+
$autoload = (bool) acf_get_setting('autoload');
|
225 |
|
226 |
+
update_option($id, $acf, $autoload);
|
|
|
227 |
|
228 |
+
// Update meta
|
229 |
+
}else{
|
|
|
|
|
|
|
230 |
|
231 |
+
acf_update_metadata($post_id, 'acf', $acf);
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
|
236 |
+
}
|
237 |
+
|
238 |
+
return $return;
|
239 |
+
|
240 |
}
|
241 |
|
242 |
+
/*
|
243 |
+
* Pre acf/save_post
|
244 |
+
*/
|
245 |
+
function pre_save_post($post_id = 0){
|
|
|
|
|
|
|
|
|
246 |
|
247 |
+
// Validate Post ID
|
248 |
+
$validate = $this->validate_post_id($post_id);
|
|
|
249 |
|
250 |
+
if(!$validate)
|
251 |
+
return;
|
252 |
|
253 |
+
if(acf_maybe_get_POST('acfe_clean_meta')){
|
254 |
+
|
255 |
+
// Get store
|
256 |
+
$store = acf_get_store('acfe/meta');
|
257 |
+
|
258 |
+
// Set store as empty
|
259 |
+
$store->set("$post_id:acf", array());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
}
|
262 |
|
|
|
|
|
263 |
}
|
264 |
|
265 |
/*
|
266 |
+
* acf/save_post
|
267 |
*/
|
268 |
function save_post($post_id = 0){
|
269 |
|
273 |
if(!$validate)
|
274 |
return;
|
275 |
|
276 |
+
// Get store
|
277 |
$store = acf_get_store('acfe/meta');
|
278 |
|
279 |
// Store found
|
282 |
|
283 |
// Get Store: ACF meta
|
284 |
$acf = $store->get("$post_id:acf");
|
285 |
+
|
286 |
+
// Type + ID
|
287 |
+
extract(acf_decode_post_id($post_id));
|
288 |
+
|
289 |
+
// Update option
|
290 |
+
if($type === 'option'){
|
291 |
+
|
292 |
+
$acf = wp_unslash($acf);
|
293 |
+
$autoload = (bool) acf_get_setting('autoload');
|
294 |
+
|
295 |
+
update_option($id, $acf, $autoload);
|
296 |
+
|
297 |
+
// Update meta
|
298 |
+
}else{
|
299 |
|
300 |
+
acf_update_metadata($post_id, 'acf', $acf);
|
301 |
+
|
302 |
+
}
|
303 |
|
304 |
if(acf_maybe_get_POST('acfe_clean_meta')){
|
305 |
|
307 |
|
308 |
if(empty($meta))
|
309 |
return;
|
310 |
+
|
311 |
+
acf_enable_filter('acfe/delete');
|
312 |
|
313 |
foreach($meta as $key => $value){
|
314 |
|
315 |
+
// bail if not ACF field
|
316 |
if(!isset($meta["_$key"]))
|
317 |
continue;
|
318 |
|
319 |
+
// Bail early if exists in Single Value array
|
320 |
if(isset($acf[$key]))
|
321 |
continue;
|
322 |
|
324 |
acf_delete_metadata($post_id, $key, true);
|
325 |
|
326 |
}
|
327 |
+
|
328 |
+
acf_disable_filter('acfe/delete');
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
function validate_post_id($post_id){
|
335 |
+
|
336 |
+
// Type + ID
|
337 |
+
extract(acf_decode_post_id($post_id));
|
338 |
+
|
339 |
+
// Validate ID
|
340 |
+
if(!$id)
|
341 |
+
return false;
|
342 |
+
|
343 |
+
// Post Type
|
344 |
+
if($type === 'post'){
|
345 |
+
|
346 |
+
if($this->post_types === false)
|
347 |
+
return false;
|
348 |
+
|
349 |
+
$post_type = get_post_type($id);
|
350 |
+
|
351 |
+
if(in_array($post_type, $this->restricted))
|
352 |
+
return false;
|
353 |
+
|
354 |
+
if(!empty($this->post_types) && !in_array($post_type, $this->post_types))
|
355 |
+
return false;
|
356 |
+
|
357 |
+
return true;
|
358 |
+
|
359 |
+
// Taxonomy
|
360 |
+
}elseif($type === 'term'){
|
361 |
+
|
362 |
+
if($this->taxonomies === false)
|
363 |
+
return false;
|
364 |
+
|
365 |
+
$term = get_term($id);
|
366 |
+
|
367 |
+
if(is_a($term, 'WP_Term')){
|
368 |
+
|
369 |
+
$taxonomy = $term->taxonomy;
|
370 |
+
|
371 |
+
if(!empty($this->taxonomies) && !in_array($taxonomy, $this->taxonomies))
|
372 |
+
return false;
|
373 |
+
|
374 |
+
return true;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
// Option
|
379 |
+
}elseif($type === 'option'){
|
380 |
+
|
381 |
+
if($this->options === false)
|
382 |
+
return false;
|
383 |
+
|
384 |
+
if(!empty($this->options) && !in_array($id, $this->options))
|
385 |
+
return false;
|
386 |
+
|
387 |
+
return true;
|
388 |
+
|
389 |
+
}
|
390 |
+
|
391 |
+
|
392 |
|
393 |
+
return false;
|
394 |
+
|
395 |
+
}
|
396 |
+
|
397 |
+
function get_store($post_id){
|
398 |
+
|
399 |
+
// Check store.
|
400 |
+
$store = acf_get_store('acfe/meta');
|
401 |
+
|
402 |
+
// Store found
|
403 |
+
if(!$store->has("$post_id:acf")){
|
404 |
+
|
405 |
+
// Decode $post_id for $type and $id.
|
406 |
+
extract(acf_decode_post_id($post_id));
|
407 |
+
|
408 |
+
// Get option
|
409 |
+
if($type === 'option'){
|
410 |
+
|
411 |
+
$acf = get_option($id, null);
|
412 |
+
|
413 |
+
// Get meta
|
414 |
+
}else{
|
415 |
+
|
416 |
+
$acf = acf_get_metadata($post_id, 'acf');
|
417 |
+
|
418 |
+
}
|
419 |
+
|
420 |
+
// Set Store: ACF meta
|
421 |
+
$store->set("$post_id:acf", $acf);
|
422 |
+
|
423 |
}
|
424 |
|
425 |
+
return $store;
|
426 |
+
|
427 |
}
|
428 |
|
429 |
/*
|
456 |
|
457 |
function load_post(){
|
458 |
|
459 |
+
if($this->post_types === false)
|
460 |
+
return;
|
461 |
+
|
462 |
// globals
|
463 |
+
global $typenow;
|
464 |
+
|
465 |
+
$post_type = $typenow;
|
466 |
+
|
467 |
+
if(in_array($post_type, $this->restricted))
|
468 |
+
return;
|
469 |
+
|
470 |
+
if(!empty($this->post_types) && !in_array($post_type, $this->post_types))
|
471 |
+
return;
|
472 |
|
473 |
// actions
|
474 |
add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 10, 2);
|
482 |
}
|
483 |
|
484 |
function load_term(){
|
485 |
+
|
486 |
+
if($this->taxonomies === false)
|
487 |
+
return;
|
488 |
|
489 |
$screen = get_current_screen();
|
490 |
+
$taxonomy = $screen->taxonomy;
|
491 |
+
|
492 |
+
if(!empty($this->taxonomies) && !in_array($taxonomy, $this->taxonomies))
|
493 |
+
return;
|
494 |
|
495 |
// actions
|
496 |
add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 20, 2);
|
505 |
|
506 |
function load_user(){
|
507 |
|
508 |
+
add_meta_box('acfe-clean-meta', 'ACF Single Meta', array($this, 'render_metabox'), 'user-edit', 'side', 'default');
|
509 |
+
|
510 |
+
}
|
511 |
+
|
512 |
+
function load_options($page){
|
513 |
+
|
514 |
+
if($this->options === false)
|
515 |
+
return;
|
516 |
+
|
517 |
+
if(!empty($this->options) && !in_array($page['post_id'], $this->options))
|
518 |
+
return;
|
519 |
+
|
520 |
+
add_meta_box('acfe-clean-meta', 'ACF Single Meta', array($this, 'render_metabox'), 'acf_options_page', 'side', 'default');
|
521 |
|
522 |
}
|
523 |
|
525 |
|
526 |
$field = array(
|
527 |
'key' => false,
|
528 |
+
'label' => false,
|
529 |
+
'name' => 'acfe_clean_meta',
|
530 |
+
'prefix' => false,
|
531 |
+
'type' => 'true_false',
|
532 |
+
'instructions' => '',
|
533 |
+
'required' => 0,
|
534 |
+
'conditional_logic' => 0,
|
535 |
+
'wrapper' => array(
|
536 |
+
'width' => '',
|
537 |
+
'class' => '',
|
538 |
+
'id' => '',
|
539 |
+
),
|
540 |
+
'message' => 'Clean orphan meta data',
|
541 |
+
'default_value' => 0,
|
542 |
+
'ui' => 0,
|
543 |
+
'ui_on_text' => '',
|
544 |
+
'ui_off_text' => '',
|
545 |
);
|
546 |
|
547 |
acf_render_field_wrap($field);
|
549 |
?>
|
550 |
<script type="text/javascript">
|
551 |
if( typeof acf !== 'undefined' ) {
|
552 |
+
|
553 |
acf.newPostbox({
|
554 |
'id': 'acfe-clean-meta',
|
555 |
'label': 'top'
|
556 |
+
});
|
557 |
|
558 |
}
|
559 |
</script>
|
includes/modules/taxonomy.php
CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH'))
|
|
4 |
exit;
|
5 |
|
6 |
// Check setting
|
7 |
-
if(!acf_get_setting('acfe/modules/
|
8 |
return;
|
9 |
|
10 |
/**
|
@@ -155,17 +155,22 @@ function acfe_better_taxonomy_edit_admin_footer(){
|
|
155 |
</script>
|
156 |
<script type="text/javascript">
|
157 |
(function($){
|
158 |
-
|
|
|
|
|
|
|
159 |
// wrap form
|
160 |
-
$('
|
161 |
-
|
162 |
// add column side
|
163 |
-
$('
|
164 |
-
|
165 |
-
//
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
169 |
|
170 |
})(jQuery);
|
171 |
</script>
|
4 |
exit;
|
5 |
|
6 |
// Check setting
|
7 |
+
if(!acf_get_setting('acfe/modules/ui'))
|
8 |
return;
|
9 |
|
10 |
/**
|
155 |
</script>
|
156 |
<script type="text/javascript">
|
157 |
(function($){
|
158 |
+
|
159 |
+
// ACF Extended UI
|
160 |
+
$('.wrap').addClass('acfe-ui');
|
161 |
+
|
162 |
// wrap form
|
163 |
+
$('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
|
164 |
+
|
165 |
// add column side
|
166 |
+
$('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
167 |
+
|
168 |
+
// add title
|
169 |
+
var title = $('.wrap > h1').text();
|
170 |
+
$('.acfe-ui > form > div > div > table:first').before('<h2>' + title + '</h2>');
|
171 |
+
|
172 |
+
// Hide native button
|
173 |
+
$('.acfe-ui > form .edit-tag-actions').hide();
|
174 |
|
175 |
})(jQuery);
|
176 |
</script>
|
includes/modules/user.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!defined('ABSPATH'))
|
4 |
+
exit;
|
5 |
+
|
6 |
+
// Check setting
|
7 |
+
if(!acf_get_setting('acfe/modules/ui'))
|
8 |
+
return;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* User Edit View
|
12 |
+
*/
|
13 |
+
add_action('admin_footer-profile.php', 'acfe_better_user_edit_admin_footer');
|
14 |
+
add_action('admin_footer-user-edit.php', 'acfe_better_user_edit_admin_footer');
|
15 |
+
function acfe_better_user_edit_admin_footer(){
|
16 |
+
|
17 |
+
?>
|
18 |
+
<script type="text/html" id="tmpl-acf-column-2">
|
19 |
+
<div class="acf-column-2">
|
20 |
+
|
21 |
+
<div id="poststuff" class="acfe-acfe-bt-admin-column">
|
22 |
+
|
23 |
+
<div class="postbox">
|
24 |
+
|
25 |
+
<h2 class="hndle ui-sortable-handle"><span><?php _e('Edit', 'acfe'); ?></span></h2>
|
26 |
+
|
27 |
+
<div class="inside">
|
28 |
+
<div class="submitbox">
|
29 |
+
|
30 |
+
<div id="major-publishing-actions">
|
31 |
+
|
32 |
+
<div id="publishing-action">
|
33 |
+
|
34 |
+
<div class="acfe-form-submit">
|
35 |
+
<input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
|
36 |
+
<span class="acf-spinner"></span>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
</div>
|
40 |
+
<div class="clear"></div>
|
41 |
+
|
42 |
+
</div>
|
43 |
+
|
44 |
+
</div>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<?php do_meta_boxes('user-edit', 'side', array()); ?>
|
51 |
+
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</script>
|
55 |
+
<script type="text/javascript">
|
56 |
+
(function($){
|
57 |
+
|
58 |
+
// ACF Extended UI
|
59 |
+
$('.wrap').addClass('acfe-ui');
|
60 |
+
|
61 |
+
// wrap form
|
62 |
+
$('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
|
63 |
+
|
64 |
+
// add column side
|
65 |
+
$('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
66 |
+
|
67 |
+
// hide native button
|
68 |
+
$('.acfe-ui > form p.submit').hide();
|
69 |
+
|
70 |
+
})(jQuery);
|
71 |
+
</script>
|
72 |
+
<?php
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* User Add View
|
78 |
+
*/
|
79 |
+
add_action('admin_footer-user-new.php', 'acfe_better_user_new_admin_footer');
|
80 |
+
function acfe_better_user_new_admin_footer(){
|
81 |
+
|
82 |
+
?>
|
83 |
+
<script type="text/html" id="tmpl-acf-column-2">
|
84 |
+
<div class="acf-column-2">
|
85 |
+
|
86 |
+
<div id="poststuff" class="acfe-acfe-bt-admin-column">
|
87 |
+
|
88 |
+
<div class="postbox">
|
89 |
+
|
90 |
+
<h2 class="hndle ui-sortable-handle"><span><?php _e('Edit', 'acfe'); ?></span></h2>
|
91 |
+
|
92 |
+
<div class="inside">
|
93 |
+
<div class="submitbox">
|
94 |
+
|
95 |
+
<div id="major-publishing-actions">
|
96 |
+
|
97 |
+
<div id="publishing-action">
|
98 |
+
|
99 |
+
<div class="acfe-form-submit">
|
100 |
+
<input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Add New User'); ?>" />
|
101 |
+
<span class="acf-spinner"></span>
|
102 |
+
</div>
|
103 |
+
|
104 |
+
</div>
|
105 |
+
<div class="clear"></div>
|
106 |
+
|
107 |
+
</div>
|
108 |
+
|
109 |
+
</div>
|
110 |
+
|
111 |
+
</div>
|
112 |
+
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<?php do_meta_boxes(get_current_screen(), 'side', array()); ?>
|
116 |
+
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
</script>
|
120 |
+
<script type="text/javascript">
|
121 |
+
(function($){
|
122 |
+
|
123 |
+
// ACF Extended UI
|
124 |
+
$('.wrap').addClass('acfe-ui');
|
125 |
+
|
126 |
+
// wrap form
|
127 |
+
$('.acfe-ui > form').wrapInner('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
|
128 |
+
|
129 |
+
// add column side
|
130 |
+
$('.acfe-ui > form .acf-columns-2').append($('#tmpl-acf-column-2').html());
|
131 |
+
|
132 |
+
// add title
|
133 |
+
var title = $('.wrap > h1').text();
|
134 |
+
$('.acfe-ui > form > div > div > table:first').before('<h2>' + title + '</h2>');
|
135 |
+
|
136 |
+
// Hide native button
|
137 |
+
$('.acfe-ui > form p.submit').hide();
|
138 |
+
|
139 |
+
})(jQuery);
|
140 |
+
</script>
|
141 |
+
<?php
|
142 |
+
|
143 |
+
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: acf, custom fields, meta, admin, fields, form, repeater, content
|
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 0.8.6.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -20,7 +20,7 @@ All-in-one enhancement suite that improves WordPress & Advanced Custom Fields.
|
|
20 |
* New Field Groups Locations
|
21 |
* 14+ New ACF Fields
|
22 |
* 10+ ACF Fields Enhanced
|
23 |
-
* Bidirectional Fields
|
24 |
* Advanced Fields Validation
|
25 |
* Flexible Content as Page Builder
|
26 |
* Compress ACF values into a single metadata
|
@@ -151,6 +151,8 @@ Sync local field groups back to the database and edit their fields just like any
|
|
151 |
* **Bidirectional fields**
|
152 |
An advanced bidirectional setting (also called post-to-post) is available for the following fields: Relationship, Post object, User & Taxonomy terms.
|
153 |
Fields will work bidirectionally and automatically update each others. Works in groups & clones (prefixed field names must be turned off).
|
|
|
|
|
154 |
[Usage example is available in the FAQ](#faq)
|
155 |
|
156 |
* **Advanced settings**
|
@@ -277,9 +279,9 @@ Create and manage taxonomies from your WordPress administration (Tools > Taxonom
|
|
277 |
|
278 |
The native WP Author Metabox has been replaced with a dynamic version allowing to manage thousands of users without slowing down the post administration.
|
279 |
|
280 |
-
= WordPress:
|
281 |
|
282 |
-
Taxonomies list
|
283 |
|
284 |
= WordPress: Options =
|
285 |
|
@@ -301,6 +303,7 @@ Display all ACF Extended settings in one page.
|
|
301 |
View all custom Posts, Terms, Users & Options meta in a readable format
|
302 |
|
303 |
* Print Arrays & Json values
|
|
|
304 |
* ACF fields meta are grouped together
|
305 |
* ACF field groups related to fields are displayed when available
|
306 |
* Dev mode also enable `SCRIPT_DEBUG`
|
@@ -375,9 +378,9 @@ Manage ACF Forms from your WordPress administration. All ACF Form settings are a
|
|
375 |
|
376 |
= ACF: Single Meta Save (Beta) =
|
377 |
|
378 |
-
Compress all fields values from the current post, term or
|
379 |
|
380 |
-
To monitor the process, it is possible to enable the "ACF Extended: Dev Mode" which will display all WP & ACF meta data on every Posts, Terms &
|
381 |
|
382 |
This feature also enables a new setting available in every fields: "Save as individual meta". If this setting is turned ON on a specific field, then the value will be saved individually. `WP Queries` and `Meta Queries` can be used just like before.
|
383 |
|
@@ -390,6 +393,45 @@ function my_acfe_modules(){
|
|
390 |
// Enable Single Meta Save
|
391 |
acf_update_setting('acfe/modules/single_meta', true);
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
`
|
395 |
|
@@ -639,6 +681,39 @@ function acf_flexible_layout_render_script($script, $field, $layout, $is_preview
|
|
639 |
}
|
640 |
`
|
641 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
= How to disable specific ACF Extended modules? (Dynamic Post Types, Taxonomies, Options Pages etc...) =
|
643 |
|
644 |
You can use the following action:
|
@@ -668,8 +743,8 @@ function my_acfe_modules(){
|
|
668 |
// Disable Settings > Options
|
669 |
acf_update_setting('acfe/modules/options', false);
|
670 |
|
671 |
-
// Disable Taxonomies
|
672 |
-
acf_update_setting('acfe/modules/
|
673 |
|
674 |
}
|
675 |
`
|
@@ -689,6 +764,23 @@ function my_acfe_modules(){
|
|
689 |
|
690 |
== Changelog ==
|
691 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
692 |
= 0.8.6.1 =
|
693 |
* Module: Dynamic Post Types/Taxonomies/Block Types/Options Pages - Slugs can now to edited & updated from the UI
|
694 |
* Module: Dynamic Options Pages - Added a configuration icon on top of options page to easily switch to options page settings
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 0.8.6.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
20 |
* New Field Groups Locations
|
21 |
* 14+ New ACF Fields
|
22 |
* 10+ ACF Fields Enhanced
|
23 |
+
* Self/Multi/Bidirectional Fields
|
24 |
* Advanced Fields Validation
|
25 |
* Flexible Content as Page Builder
|
26 |
* Compress ACF values into a single metadata
|
151 |
* **Bidirectional fields**
|
152 |
An advanced bidirectional setting (also called post-to-post) is available for the following fields: Relationship, Post object, User & Taxonomy terms.
|
153 |
Fields will work bidirectionally and automatically update each others. Works in groups & clones (prefixed field names must be turned off).
|
154 |
+
|
155 |
+
It is possible to link a field on itself, allowing self-bidirectional save.
|
156 |
[Usage example is available in the FAQ](#faq)
|
157 |
|
158 |
* **Advanced settings**
|
279 |
|
280 |
The native WP Author Metabox has been replaced with a dynamic version allowing to manage thousands of users without slowing down the post administration.
|
281 |
|
282 |
+
= WordPress: Enhanced UI =
|
283 |
|
284 |
+
Taxonomies list/edit, User edit/add and General Settings views have been enhanced for a more consistent administration experience, using CSS/JS only.
|
285 |
|
286 |
= WordPress: Options =
|
287 |
|
303 |
View all custom Posts, Terms, Users & Options meta in a readable format
|
304 |
|
305 |
* Print Arrays & Json values
|
306 |
+
* Delete/Bulk delete any meta
|
307 |
* ACF fields meta are grouped together
|
308 |
* ACF field groups related to fields are displayed when available
|
309 |
* Dev mode also enable `SCRIPT_DEBUG`
|
378 |
|
379 |
= ACF: Single Meta Save (Beta) =
|
380 |
|
381 |
+
Compress all fields values from the current post, term, user or options into one single meta data. This process lighten the database load as values are saved and read from one single row. Once activated and after saving a post/term/user in the administration, all old meta data will be removed and packed together in a meta called `acf`.
|
382 |
|
383 |
+
To monitor the process, it is possible to enable the "ACF Extended: Dev Mode" which will display all WP & ACF meta data on every Posts, Terms, Users & Options.
|
384 |
|
385 |
This feature also enables a new setting available in every fields: "Save as individual meta". If this setting is turned ON on a specific field, then the value will be saved individually. `WP Queries` and `Meta Queries` can be used just like before.
|
386 |
|
393 |
// Enable Single Meta Save
|
394 |
acf_update_setting('acfe/modules/single_meta', true);
|
395 |
|
396 |
+
}
|
397 |
+
|
398 |
+
// Enable Single Meta Save on specific Post Types only (default: all)
|
399 |
+
add_filter('acfe/modules/single_meta/post_types', 'my_acfe_single_meta_post_types');
|
400 |
+
function my_acfe_single_meta_post_types($post_types){
|
401 |
+
|
402 |
+
$post_types = array('page', 'my-post-type');
|
403 |
+
|
404 |
+
// Disable all post types:
|
405 |
+
// return false;
|
406 |
+
|
407 |
+
return $post_types;
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
// Enable Single Meta Save on specific Taxonomies only (default: all)
|
412 |
+
add_filter('acfe/modules/single_meta/taxonomies', 'my_acfe_single_meta_taxonomies');
|
413 |
+
function my_acfe_single_meta_taxonomies($taxonomies){
|
414 |
+
|
415 |
+
$taxonomies = array('category', 'my-taxonomy');
|
416 |
+
|
417 |
+
// Disable all taxonomies:
|
418 |
+
// return false;
|
419 |
+
|
420 |
+
return $taxonomies;
|
421 |
+
|
422 |
+
}
|
423 |
+
|
424 |
+
// Enable Single Meta Save on specific Options ID (default: disabled)
|
425 |
+
add_filter('acfe/modules/single_meta/options', 'my_acfe_single_meta_options');
|
426 |
+
function my_acfe_single_meta_options($options_ids){
|
427 |
+
|
428 |
+
$options_ids = array('options', 'my-option-id');
|
429 |
+
|
430 |
+
// Disable all options id (default):
|
431 |
+
// return false;
|
432 |
+
|
433 |
+
return $options_ids;
|
434 |
+
|
435 |
}
|
436 |
`
|
437 |
|
681 |
}
|
682 |
`
|
683 |
|
684 |
+
= How to change PHP AutoSync Load/Save paths? =
|
685 |
+
|
686 |
+
PHP AutoSync settings are very similar to the native ACF Json settings. To alter load/save paths, you can use the following method:
|
687 |
+
|
688 |
+
`
|
689 |
+
// PHP Autosync: Save path
|
690 |
+
add_filter('acf/settings/acfe/php_save', 'my_acfe_php_save_point');
|
691 |
+
function my_acfe_php_save_point($path){
|
692 |
+
|
693 |
+
// update path
|
694 |
+
$path = get_stylesheet_directory() . '/my-custom-folder';
|
695 |
+
|
696 |
+
// return
|
697 |
+
return $path;
|
698 |
+
|
699 |
+
}
|
700 |
+
|
701 |
+
// PHP Autosync: Load paths
|
702 |
+
add_filter('acf/settings/acfe/php_load', 'my_acfe_php_load_point');
|
703 |
+
function my_acfe_php_load_point($paths){
|
704 |
+
|
705 |
+
// remove original path (optional)
|
706 |
+
unset($paths[0]);
|
707 |
+
|
708 |
+
// append path
|
709 |
+
$paths[] = get_stylesheet_directory() . '/my-custom-folder';
|
710 |
+
|
711 |
+
// return
|
712 |
+
return $paths;
|
713 |
+
|
714 |
+
}
|
715 |
+
`
|
716 |
+
|
717 |
= How to disable specific ACF Extended modules? (Dynamic Post Types, Taxonomies, Options Pages etc...) =
|
718 |
|
719 |
You can use the following action:
|
743 |
// Disable Settings > Options
|
744 |
acf_update_setting('acfe/modules/options', false);
|
745 |
|
746 |
+
// Disable Enhanced UI (Taxonomies, Users, Settings)
|
747 |
+
acf_update_setting('acfe/modules/ui', false);
|
748 |
|
749 |
}
|
750 |
`
|
764 |
|
765 |
== Changelog ==
|
766 |
|
767 |
+
= 0.8.6.3 =
|
768 |
+
* Module - Enhanced UI - Added WP User & WP Settings UI enhancements
|
769 |
+
* Module - Enhanced UI - Taxonomies UI enhancements were moved in the to general Enhancement module. The setting `acf_update_setting('acfe/modules/taxonomies')` has been replaced by `acf_update_setting('acfe/modules/ui')`
|
770 |
+
* Module: Dev Mode - Added "Field Type" column on ACF meta overview
|
771 |
+
* Module: Dev Mode - Added "Autoload" column on Options meta overview
|
772 |
+
* Module: Dev Mode - Added "Delete" action for each meta & options fields
|
773 |
+
* Module: Dev Mode - Added "Bulk Delete" action
|
774 |
+
* Module: Single Meta Save - Reworked codebase
|
775 |
+
* Module: Single Meta Save - Added Options pages compatibility (disabled by default. See `filter('acfe/modules/single_meta/options')` usage in the readme to enable specific Options ID)
|
776 |
+
* Module: Single Meta Save - Added `filter('acfe/modules/single_meta/post_types')` to allow specific post types only (default to: all)
|
777 |
+
* Module: Single Meta Save - Added `filter('acfe/modules/single_meta/taxonomies')` to allow specific taxonomies only (default to: all)
|
778 |
+
* Module: Single Meta Save - Fixed bidirectional setting which wasn't working when Single Meta Save was enabled
|
779 |
+
* Fields settings: Bidirectional - Added Self-bidirectional setting, allowing to link a field on itself
|
780 |
+
* Fields settings: Bidirectional - Added Multi-bidirectional setting, allowing to link multiple fields
|
781 |
+
* Field: Taxonomy Terms - Fixed a bug with last childs choices not being correctly rendered
|
782 |
+
* Field: Code Editor - Fixed duplicated field from the Field Group UI when user cloned the field
|
783 |
+
|
784 |
= 0.8.6.1 =
|
785 |
* Module: Dynamic Post Types/Taxonomies/Block Types/Options Pages - Slugs can now to edited & updated from the UI
|
786 |
* Module: Dynamic Options Pages - Added a configuration icon on top of options page to easily switch to options page settings
|