Advanced Custom Fields: Extended - Version 0.8.7

Version Description

  • General: ACF 5.9 Compatibility - Modules - Added the ACF 5.9 Header menu
  • General: ACF 5.9 Compatibility - Field Groups - Removed ACFE "Locations" column
  • General: ACF 5.9 Compatibility - Field Groups - Removed ACFE "Json Sync" column
  • General: ACF 5.9 Compatibility - Field Groups - Enlarged "PHP Sync" & "Load" columns
  • General: ACF 5.9 Compatibility - Field Groups - Removed the "Field Group Key" value from row actions
  • General: ACF 5.9 Compatibility - Field Groups - Changed the text color of "Disabled" state
  • General: ACF 5.9 Compatibility - Field Groups - "Description" column is hidden by default
  • General: ACF 5.9 Compatibility - Flexible Content - Removed "Clone" field setting
  • General: ACF 5.9 Compatibility - Flexible Content - Added "Hide: Duplicate Button" setting
  • General: ACF 5.9 Compatibility - Block Type - Added "Inner Block" setting
  • General: ACF 5.9 Compatibility - Block Type - Added "Supports: Align Content" setting
  • General: ACF 5.9 Compatibility - Block Type - Added "Align Content" setting
  • Module: Dynamic Block Type - Fixed Template, Style & Script Render paths during Block Type registration
  • Field: Radio - Enhanced Group display for horizontal layout
Download this release

Release Info

Developer hwk-fr
Plugin Icon 128x128 Advanced Custom Fields: Extended
Version 0.8.7
Comparing to
See all releases

Code changes from version 0.8.6.9 to 0.8.7

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.9
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.9';
20
 
21
  // Settings
22
  var $settings = array();
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
+ * Version: 0.8.7
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.7';
20
 
21
  // Settings
22
  var $settings = array();
assets/acf-extended-fc-control.css CHANGED
@@ -22,15 +22,19 @@
22
 
23
  .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-plus,
24
  .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-minus,
25
- .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-plus,
26
- .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-minus{
 
 
27
  visibility: hidden;
28
  }
29
 
30
  .acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-plus,
31
  .acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-minus,
32
- .acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-plus,
33
- .acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-minus{
 
 
34
  visibility: visible;
35
  }
36
 
22
 
23
  .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-plus,
24
  .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-minus,
25
+ .acf-flexible-content .layout:hover .acf-fc-layout-controls .acf-icon.-duplicate,
26
+ .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-plus,
27
+ .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-minus,
28
+ .acf-flexible-content .layout.-hover .acf-fc-layout-controls .acf-icon.-duplicate {
29
  visibility: hidden;
30
  }
31
 
32
  .acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-plus,
33
  .acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-minus,
34
+ .acf-flexible-content .layout:hover > .acf-fc-layout-controls .acf-icon.-duplicate,
35
+ .acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-plus,
36
+ .acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-minus,
37
+ .acf-flexible-content .layout.-hover > .acf-fc-layout-controls .acf-icon.-duplicate {
38
  visibility: visible;
39
  }
40
 
assets/acf-extended-fc-control.js CHANGED
@@ -302,9 +302,9 @@
302
  });
303
 
304
  // Append Temp Input
305
- var $input = $('<input type="text" style="clip:rect(0,0,0,0);clip-path:rect(0,0,0,0);position:absolute;" value="" />').appendTo($el);
306
  $input.attr('value', data).select();
307
-
308
  // Command: Copy
309
  if(document.execCommand('copy'))
310
  alert('Layout has been transferred to your clipboard');
302
  });
303
 
304
  // Append Temp Input
305
+ var $input = $('<input type="text" style="clip:rect(0,0,0,0);clip-path:rect(0,0,0,0);position:absolute;" value="" />').appendTo($('body'));
306
  $input.attr('value', data).select();
307
+
308
  // Command: Copy
309
  if(document.execCommand('copy'))
310
  alert('Layout has been transferred to your clipboard');
assets/acf-extended-fc-modal-edit.css CHANGED
@@ -1,6 +1,6 @@
1
- /*
2
- * Flexible Edit: Hide Collapse
3
- */
4
- .acf-field-flexible-content[data-acfe-flexible-modal-edition="1"] > .acf-input > .acf-flexible-content > .values > .layout > .acf-fc-layout-controls > a.-collapse{
5
- display:none;
6
  }
1
+ /*
2
+ * Flexible Edit: Hide Collapse
3
+ */
4
+ .acf-field-flexible-content[data-acfe-flexible-modal-edition="1"] > .acf-input > .acf-flexible-content > .values > .layout > .acf-fc-layout-controls > a.-collapse{
5
+ display:none;
6
  }
assets/acf-extended-fc.js CHANGED
@@ -1,445 +1,451 @@
1
- (function($){
2
-
3
- if(typeof acf === 'undefined')
4
- return;
5
-
6
- /*
7
- * Init
8
- */
9
- var flexible = acf.getFieldType('flexible_content');
10
- var model = flexible.prototype;
11
-
12
- /*
13
- * Drag & Drop
14
- */
15
- model.addSortable = function( self ){
16
-
17
- // bail early if max 1 row
18
- if( this.get('max') == 1 ) {
19
- return;
20
- }
21
-
22
- // add sortable
23
- this.$layoutsWrap().sortable({
24
- items: ' > .layout',
25
- handle: '> .acf-fc-layout-handle',
26
- forceHelperSize: false, // Changed to false
27
- forcePlaceholderSize: true,
28
- tolerance: "pointer", // Changed to pointer
29
- scroll: true,
30
- stop: function(event, ui) {
31
- self.render();
32
- },
33
- update: function(event, ui) {
34
- self.$input().trigger('change');
35
- }
36
- });
37
-
38
- };
39
-
40
- /*
41
- * Actions
42
- */
43
- model.acfeOneClick = function(e, $el){
44
-
45
- // Get Flexible
46
- var flexible = this;
47
-
48
- // Vars
49
- var $clones = flexible.$clones();
50
- var $layout_name = $($clones[0]).data('layout');
51
-
52
- // Source
53
- var $layout_source = null;
54
- if($el.hasClass('acf-icon'))
55
- $layout_source = $el.closest('.layout');
56
-
57
- // Add
58
- var $layout_added = flexible.add({
59
- layout: $layout_name,
60
- before: $layout_source
61
- });
62
-
63
- // Hide native tooltip
64
- if($('.acf-fc-popup').length)
65
- $('.acf-fc-popup').hide();
66
-
67
- };
68
-
69
- model.acfeLayoutInit = function($layout){
70
-
71
- // Get Flexible
72
- var flexible = this;
73
-
74
- // Vars
75
- var $controls = $layout.find('> .acf-fc-layout-controls');
76
- var $handle = $layout.find('> .acf-fc-layout-handle');
77
-
78
- // Placeholder
79
- var $placeholder = $layout.find('> .acfe-fc-placeholder');
80
-
81
- // Placeholder: Show
82
- $placeholder.removeClass('acf-hidden');
83
-
84
- // If no modal edition & opened: Hide Placeholder
85
- if(!flexible.has('acfeFlexibleModalEdition') && !flexible.isLayoutClosed($layout)){
86
-
87
- $placeholder.addClass('acf-hidden');
88
-
89
- }
90
-
91
- // Flexible has Preview
92
- if(flexible.isLayoutClosed($layout) && flexible.has('acfeFlexiblePreview') && !$placeholder.hasClass('-loading')){
93
-
94
- $placeholder.addClass('acfe-fc-preview -loading').find('> .acfe-flexible-placeholder').prepend('<span class="spinner"></span>');
95
- $placeholder.find('> .acfe-fc-overlay').addClass('-hover');
96
-
97
- // vars
98
- var $input = $layout.children('input');
99
- var prefix = $input.attr('name').replace('[acf_fc_layout]', '');
100
-
101
- // ajax data
102
- var ajaxData = {
103
- action: 'acfe/flexible/layout_preview',
104
- field_key: flexible.get('key'),
105
- i: $layout.index(),
106
- layout: $layout.data('layout'),
107
- value: acf.serialize($layout, prefix)
108
- };
109
-
110
- acf.doAction('acfe/fields/flexible_content/before_preview', flexible.$el, $layout, ajaxData);
111
- acf.doAction('acfe/fields/flexible_content/before_preview/name=' + flexible.get('name'), flexible.$el, $layout, ajaxData);
112
- acf.doAction('acfe/fields/flexible_content/before_preview/key=' + flexible.get('key'), flexible.$el, $layout, ajaxData);
113
- acf.doAction('acfe/fields/flexible_content/before_preview/name=' + flexible.get('name') + '&layout=' + $layout.data('layout'), flexible.$el, $layout, ajaxData);
114
- acf.doAction('acfe/fields/flexible_content/before_preview/key=' + flexible.get('key') + '&layout=' + $layout.data('layout'), flexible.$el, $layout, ajaxData);
115
-
116
- // ajax
117
- $.ajax({
118
- url: acf.get('ajaxurl'),
119
- data: acf.prepareForAjax(ajaxData),
120
- dataType: 'html',
121
- type: 'post',
122
- success: function(response){
123
-
124
- if(response){
125
-
126
- $placeholder.find('> .acfe-flexible-placeholder').html(response);
127
-
128
- }else{
129
-
130
- $placeholder.removeClass('acfe-fc-preview');
131
-
132
- }
133
-
134
- acf.doAction('acfe/fields/flexible_content/preview', response, flexible.$el, $layout, ajaxData);
135
- acf.doAction('acfe/fields/flexible_content/preview/name=' + flexible.get('name'), response, flexible.$el, $layout, ajaxData);
136
- acf.doAction('acfe/fields/flexible_content/preview/key=' + flexible.get('key'), response, flexible.$el, $layout, ajaxData);
137
- acf.doAction('acfe/fields/flexible_content/preview/name=' + flexible.get('name') + '&layout=' + $layout.data('layout'), response, flexible.$el, $layout, ajaxData);
138
- acf.doAction('acfe/fields/flexible_content/preview/key=' + flexible.get('key') + '&layout=' + $layout.data('layout'), response, flexible.$el, $layout, ajaxData);
139
-
140
- },
141
- complete: function(){
142
-
143
- $placeholder.find('> .acfe-fc-overlay').removeClass('-hover');
144
- $placeholder.removeClass('-loading').find('> .acfe-flexible-placeholder > .spinner').remove();
145
-
146
- }
147
- });
148
-
149
- }
150
-
151
- };
152
-
153
- /*
154
- * WYSIWYG
155
- */
156
- var wysiwyg = acf.getFieldType('wysiwyg').prototype;
157
- wysiwyg.initialize = function(){
158
-
159
- // initializeEditor if no delay
160
- if( !this.has('id') && !this.$control().hasClass('delay') ) {
161
- this.initializeEditor();
162
- }
163
-
164
- };
165
-
166
- var acfeFlexibleDelayInit = function(editor){
167
-
168
- if(editor.has('id') || !editor.$el.is(':visible') || acfe.isFilterEnabled('acfeForceOpen'))
169
- return;
170
-
171
- var $wrap = editor.$control();
172
-
173
- if($wrap.hasClass('delay')){
174
-
175
- $wrap.removeClass('delay');
176
- $wrap.find('.acf-editor-toolbar').remove();
177
-
178
- // initialize
179
- editor.initializeEditor();
180
-
181
- }
182
-
183
- };
184
-
185
- acf.addAction('show_field/type=wysiwyg', acfeFlexibleDelayInit);
186
- acf.addAction('ready_field/type=wysiwyg', acfeFlexibleDelayInit);
187
-
188
- /*
189
- * Spawn
190
- */
191
- acf.addAction('new_field/type=flexible_content', function(flexible){
192
-
193
- // Vars
194
- var $clones = flexible.$clones();
195
- var $layouts = flexible.$layouts();
196
-
197
- // Merge
198
- var $all_layouts = $.merge($layouts, $clones);
199
-
200
- // Do Actions
201
- $layouts.each(function(){
202
-
203
- var $layout = $(this);
204
- var $name = $layout.data('layout');
205
-
206
- acf.doAction('acfe/flexible/layouts', $layout, flexible);
207
- acf.doAction('acfe/flexible/layout/name=' + $name, $layout, flexible);
208
-
209
- });
210
-
211
- // ACFE: 1 layout available - OneClick
212
- if($clones.length === 1){
213
-
214
- // Remove native ACF Tooltip action
215
- flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
216
-
217
- // Add ACF Extended Modal action
218
- flexible.addEvents({'click [data-name="add-layout"]': 'acfeOneClick'});
219
-
220
- }
221
-
222
- flexible.addEvents({'click .acfe-fc-placeholder': 'onClickCollapse'});
223
-
224
- flexible.addEvents({'click .acfe-flexible-opened-actions > a': 'onClickCollapse'});
225
-
226
- // Flexible: Ajax
227
- if(flexible.has('acfeFlexibleAjax')){
228
-
229
- flexible.add = function(args){
230
-
231
- // Get Flexible
232
- var flexible = this;
233
-
234
- // defaults
235
- args = acf.parseArgs(args, {
236
- layout: '',
237
- before: false
238
- });
239
-
240
- // validate
241
- if( !this.allowAdd() ) {
242
- return false;
243
- }
244
-
245
- // ajax
246
- $.ajax({
247
- url: acf.get('ajaxurl'),
248
- data: acf.prepareForAjax({
249
- action: 'acfe/flexible/models',
250
- field_key: this.get('key'),
251
- layout: args.layout,
252
- }),
253
- dataType: 'html',
254
- type: 'post',
255
- beforeSend: function(){
256
- $('body').addClass('-loading');
257
- },
258
- success: function(html){
259
- if(html){
260
-
261
- var $layout = $(html);
262
- var uniqid = acf.uniqid();
263
-
264
- var search = 'acf[' + flexible.get('key') + '][acfcloneindex]';
265
- var replace = flexible.$control().find('> input[type=hidden]').attr('name') + '[' + uniqid + ']';
266
-
267
- // add row
268
- var $el = acf.duplicate({
269
- target: $layout,
270
- search: search,
271
- replace: replace,
272
- append: flexible.proxy(function( $el, $el2 ){
273
-
274
- // append
275
- if( args.before ) {
276
- args.before.before( $el2 );
277
- } else {
278
- flexible.$layoutsWrap().append( $el2 );
279
- }
280
-
281
- // enable
282
- acf.enable( $el2, flexible.cid );
283
-
284
- // render
285
- flexible.render();
286
- })
287
- });
288
-
289
- // Fix data-id
290
- $el.attr('data-id', uniqid);
291
-
292
- // trigger change for validation errors
293
- flexible.$input().trigger('change');
294
-
295
- // return
296
- return $el;
297
-
298
- }
299
- },
300
- 'complete': function(){
301
- $('body').removeClass('-loading');
302
- }
303
- });
304
-
305
- };
306
-
307
- }
308
-
309
- });
310
-
311
- acf.addAction('acfe/flexible/layouts', function($layout, flexible){
312
-
313
- // Layout Closed
314
- if(flexible.isLayoutClosed($layout)){
315
-
316
- // Placeholder
317
- $layout.find('> .acfe-fc-placeholder').removeClass('acf-hidden');
318
-
319
- if(flexible.has('acfeFlexibleOpen')){
320
-
321
- acfe.enableFilter('acfeForceOpen');
322
-
323
- flexible.openLayout($layout);
324
-
325
- acfe.disableFilter('acfeForceOpen');
326
-
327
- }
328
-
329
- }
330
-
331
- });
332
-
333
- acf.addAction('show', function($layout, type){
334
-
335
- if(type !== 'collapse' || !$layout.is('.layout'))
336
- return;
337
-
338
- var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
339
-
340
- // Hide Placeholder
341
- if(!flexible.has('acfeFlexibleModalEdition')){
342
-
343
- // Placeholder
344
- $layout.find('> .acfe-fc-placeholder').addClass('acf-hidden');
345
-
346
- }
347
-
348
- });
349
-
350
- acf.addAction('hide', function($layout, type){
351
-
352
- if(type !== 'collapse' || !$layout.is('.layout') || $layout.is('.acf-clone'))
353
- return;
354
-
355
- // Get Flexible
356
- var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
357
-
358
- // Remove Ajax Title
359
- if(flexible.has('acfeFlexibleRemoveAjaxTitle')){
360
-
361
- flexible.renderLayout = function($layout){};
362
-
363
- }
364
-
365
- // Preview Ajax
366
- flexible.acfeLayoutInit($layout);
367
-
368
- });
369
-
370
- acf.addAction('append', function($el){
371
-
372
- // Bail early if layout is not layout
373
- if(!$el.is('.layout'))
374
- return;
375
-
376
- // Get Flexible
377
- var flexible = acf.getInstance($el.closest('.acf-field-flexible-content'));
378
-
379
- // Open Layout
380
- if(!$el.is('.acfe-layout-duplicated')){
381
-
382
- // Modal Edition: Open
383
- if(flexible.has('acfeFlexibleModalEdition')){
384
-
385
- $el.find('> [data-action="acfe-flexible-modal-edit"]:first').trigger('click');
386
-
387
- }
388
-
389
- // Normal Edition: Open
390
- else{
391
-
392
- flexible.openLayout($el);
393
-
394
- }
395
-
396
- }
397
-
398
- flexible.acfeLayoutInit($el);
399
-
400
- var $modal = flexible.$el.closest('.acfe-modal.-open');
401
-
402
- if($modal.length){
403
-
404
- // Scroll to new layout
405
- $modal.find('> .acfe-modal-wrapper > .acfe-modal-content').animate({
406
- scrollTop: parseInt($el.offset().top) - 200
407
- }, 200);
408
-
409
- }else{
410
-
411
- // Scroll to new layout
412
- $('html, body').animate({
413
- scrollTop: parseInt($el.offset().top) - 200
414
- }, 200);
415
-
416
- }
417
-
418
- });
419
-
420
- /*
421
- * Field Error
422
- */
423
- acf.addAction('invalid_field', function(field){
424
-
425
- field.$el.parents('.layout').addClass('acfe-flexible-modal-edit-error');
426
-
427
- });
428
-
429
- /*
430
- * Field Valid
431
- */
432
- acf.addAction('valid_field', function(field){
433
-
434
- field.$el.parents('.layout').each(function(){
435
-
436
- var $layout = $(this);
437
-
438
- if(!$layout.find('.acf-error').length)
439
- $layout.removeClass('acfe-flexible-modal-edit-error');
440
-
441
- });
442
-
443
- });
444
-
 
 
 
 
 
 
445
  })(jQuery);
1
+ (function($){
2
+
3
+ if(typeof acf === 'undefined')
4
+ return;
5
+
6
+ /*
7
+ * Init
8
+ */
9
+ var flexible = acf.getFieldType('flexible_content');
10
+ var model = flexible.prototype;
11
+
12
+ /*
13
+ * Drag & Drop
14
+ */
15
+ model.addSortable = function( self ){
16
+
17
+ // bail early if max 1 row
18
+ if( this.get('max') == 1 ) {
19
+ return;
20
+ }
21
+
22
+ // add sortable
23
+ this.$layoutsWrap().sortable({
24
+ items: ' > .layout',
25
+ handle: '> .acf-fc-layout-handle',
26
+ forceHelperSize: false, // Changed to false
27
+ forcePlaceholderSize: true,
28
+ tolerance: "pointer", // Changed to pointer
29
+ scroll: true,
30
+ stop: function(event, ui) {
31
+ self.render();
32
+ },
33
+ update: function(event, ui) {
34
+ self.$input().trigger('change');
35
+ }
36
+ });
37
+
38
+ };
39
+
40
+ /*
41
+ * Actions
42
+ */
43
+ model.acfeOneClick = function(e, $el){
44
+
45
+ // Get Flexible
46
+ var flexible = this;
47
+
48
+ // Vars
49
+ var $clones = flexible.$clones();
50
+ var $layout_name = $($clones[0]).data('layout');
51
+
52
+ // Source
53
+ var $layout_source = null;
54
+ if($el.hasClass('acf-icon'))
55
+ $layout_source = $el.closest('.layout');
56
+
57
+ // Add
58
+ var $layout_added = flexible.add({
59
+ layout: $layout_name,
60
+ before: $layout_source
61
+ });
62
+
63
+ // Hide native tooltip
64
+ if($('.acf-fc-popup').length)
65
+ $('.acf-fc-popup').hide();
66
+
67
+ };
68
+
69
+ model.acfeLayoutInit = function($layout){
70
+
71
+ // Get Flexible
72
+ var flexible = this;
73
+
74
+ // Vars
75
+ var $controls = $layout.find('> .acf-fc-layout-controls');
76
+ var $handle = $layout.find('> .acf-fc-layout-handle');
77
+
78
+ // Placeholder
79
+ var $placeholder = $layout.find('> .acfe-fc-placeholder');
80
+
81
+ // Placeholder: Show
82
+ $placeholder.removeClass('acf-hidden');
83
+
84
+ // If no modal edition & opened: Hide Placeholder
85
+ if(!flexible.has('acfeFlexibleModalEdition') && !flexible.isLayoutClosed($layout)){
86
+
87
+ $placeholder.addClass('acf-hidden');
88
+
89
+ }
90
+
91
+ // Flexible has Preview
92
+ if(flexible.isLayoutClosed($layout) && flexible.has('acfeFlexiblePreview') && !$placeholder.hasClass('-loading')){
93
+
94
+ $placeholder.addClass('acfe-fc-preview -loading').find('> .acfe-flexible-placeholder').prepend('<span class="spinner"></span>');
95
+ $placeholder.find('> .acfe-fc-overlay').addClass('-hover');
96
+
97
+ // vars
98
+ var $input = $layout.children('input');
99
+ var prefix = $input.attr('name').replace('[acf_fc_layout]', '');
100
+
101
+ // ajax data
102
+ var ajaxData = {
103
+ action: 'acfe/flexible/layout_preview',
104
+ field_key: flexible.get('key'),
105
+ i: $layout.index(),
106
+ layout: $layout.data('layout'),
107
+ value: acf.serialize($layout, prefix)
108
+ };
109
+
110
+ acf.doAction('acfe/fields/flexible_content/before_preview', flexible.$el, $layout, ajaxData);
111
+ acf.doAction('acfe/fields/flexible_content/before_preview/name=' + flexible.get('name'), flexible.$el, $layout, ajaxData);
112
+ acf.doAction('acfe/fields/flexible_content/before_preview/key=' + flexible.get('key'), flexible.$el, $layout, ajaxData);
113
+ acf.doAction('acfe/fields/flexible_content/before_preview/name=' + flexible.get('name') + '&layout=' + $layout.data('layout'), flexible.$el, $layout, ajaxData);
114
+ acf.doAction('acfe/fields/flexible_content/before_preview/key=' + flexible.get('key') + '&layout=' + $layout.data('layout'), flexible.$el, $layout, ajaxData);
115
+
116
+ // ajax
117
+ $.ajax({
118
+ url: acf.get('ajaxurl'),
119
+ data: acf.prepareForAjax(ajaxData),
120
+ dataType: 'html',
121
+ type: 'post',
122
+ success: function(response){
123
+
124
+ if(response){
125
+
126
+ $placeholder.find('> .acfe-flexible-placeholder').html(response);
127
+
128
+ }else{
129
+
130
+ $placeholder.removeClass('acfe-fc-preview');
131
+
132
+ }
133
+
134
+ acf.doAction('acfe/fields/flexible_content/preview', response, flexible.$el, $layout, ajaxData);
135
+ acf.doAction('acfe/fields/flexible_content/preview/name=' + flexible.get('name'), response, flexible.$el, $layout, ajaxData);
136
+ acf.doAction('acfe/fields/flexible_content/preview/key=' + flexible.get('key'), response, flexible.$el, $layout, ajaxData);
137
+ acf.doAction('acfe/fields/flexible_content/preview/name=' + flexible.get('name') + '&layout=' + $layout.data('layout'), response, flexible.$el, $layout, ajaxData);
138
+ acf.doAction('acfe/fields/flexible_content/preview/key=' + flexible.get('key') + '&layout=' + $layout.data('layout'), response, flexible.$el, $layout, ajaxData);
139
+
140
+ },
141
+ complete: function(){
142
+
143
+ $placeholder.find('> .acfe-fc-overlay').removeClass('-hover');
144
+ $placeholder.removeClass('-loading').find('> .acfe-flexible-placeholder > .spinner').remove();
145
+
146
+ }
147
+ });
148
+
149
+ }
150
+
151
+ };
152
+
153
+ /*
154
+ * WYSIWYG
155
+ */
156
+ var wysiwyg = acf.getFieldType('wysiwyg').prototype;
157
+ wysiwyg.initialize = function(){
158
+
159
+ // initializeEditor if no delay
160
+ if( !this.has('id') && !this.$control().hasClass('delay') ) {
161
+ this.initializeEditor();
162
+ }
163
+
164
+ };
165
+
166
+ var acfeFlexibleDelayInit = function(editor){
167
+
168
+ if(editor.has('id') || !editor.$el.is(':visible') || acfe.isFilterEnabled('acfeForceOpen'))
169
+ return;
170
+
171
+ var $wrap = editor.$control();
172
+
173
+ if($wrap.hasClass('delay')){
174
+
175
+ $wrap.removeClass('delay');
176
+ $wrap.find('.acf-editor-toolbar').remove();
177
+
178
+ // initialize
179
+ editor.initializeEditor();
180
+
181
+ }
182
+
183
+ };
184
+
185
+ acf.addAction('show_field/type=wysiwyg', acfeFlexibleDelayInit);
186
+ acf.addAction('ready_field/type=wysiwyg', acfeFlexibleDelayInit);
187
+
188
+ /*
189
+ * Spawn
190
+ */
191
+ acf.addAction('new_field/type=flexible_content', function(flexible){
192
+
193
+ // Vars
194
+ var $clones = flexible.$clones();
195
+ var $layouts = flexible.$layouts();
196
+
197
+ // Merge
198
+ var $all_layouts = $.merge($layouts, $clones);
199
+
200
+ // Do Actions
201
+ $layouts.each(function(){
202
+
203
+ var $layout = $(this);
204
+ var $name = $layout.data('layout');
205
+
206
+ acf.doAction('acfe/flexible/layouts', $layout, flexible);
207
+ acf.doAction('acfe/flexible/layout/name=' + $name, $layout, flexible);
208
+
209
+ });
210
+
211
+ // ACFE: 1 layout available - OneClick
212
+ if($clones.length === 1){
213
+
214
+ // Remove native ACF Tooltip action
215
+ flexible.removeEvents({'click [data-name="add-layout"]': 'onClickAdd'});
216
+
217
+ // Add ACF Extended Modal action
218
+ flexible.addEvents({'click [data-name="add-layout"]': 'acfeOneClick'});
219
+
220
+ }
221
+
222
+ flexible.addEvents({'click .acfe-fc-placeholder': 'onClickCollapse'});
223
+
224
+ flexible.addEvents({'click .acfe-flexible-opened-actions > a': 'onClickCollapse'});
225
+
226
+ // Flexible: Ajax
227
+ if(flexible.has('acfeFlexibleAjax')){
228
+
229
+ flexible.add = function(args){
230
+
231
+ // Get Flexible
232
+ var flexible = this;
233
+
234
+ // defaults
235
+ args = acf.parseArgs(args, {
236
+ layout: '',
237
+ before: false
238
+ });
239
+
240
+ // validate
241
+ if( !this.allowAdd() ) {
242
+ return false;
243
+ }
244
+
245
+ // ajax
246
+ $.ajax({
247
+ url: acf.get('ajaxurl'),
248
+ data: acf.prepareForAjax({
249
+ action: 'acfe/flexible/models',
250
+ field_key: this.get('key'),
251
+ layout: args.layout,
252
+ }),
253
+ dataType: 'html',
254
+ type: 'post',
255
+ beforeSend: function(){
256
+ $('body').addClass('-loading');
257
+ },
258
+ success: function(html){
259
+ if(html){
260
+
261
+ var $layout = $(html);
262
+ var uniqid = acf.uniqid();
263
+
264
+ var search = 'acf[' + flexible.get('key') + '][acfcloneindex]';
265
+ var replace = flexible.$control().find('> input[type=hidden]').attr('name') + '[' + uniqid + ']';
266
+
267
+ // add row
268
+ var $el = acf.duplicate({
269
+ target: $layout,
270
+ search: search,
271
+ replace: replace,
272
+ append: flexible.proxy(function( $el, $el2 ){
273
+
274
+ // append
275
+ if( args.before ) {
276
+ args.before.before( $el2 );
277
+ } else {
278
+ flexible.$layoutsWrap().append( $el2 );
279
+ }
280
+
281
+ // enable
282
+ acf.enable( $el2, flexible.cid );
283
+
284
+ // render
285
+ flexible.render();
286
+ })
287
+ });
288
+
289
+ // Fix data-id
290
+ $el.attr('data-id', uniqid);
291
+
292
+ // trigger change for validation errors
293
+ flexible.$input().trigger('change');
294
+
295
+ // return
296
+ return $el;
297
+
298
+ }
299
+ },
300
+ 'complete': function(){
301
+ $('body').removeClass('-loading');
302
+ }
303
+ });
304
+
305
+ };
306
+
307
+ }
308
+
309
+ });
310
+
311
+ acf.addAction('acfe/flexible/layouts', function($layout, flexible){
312
+
313
+ // Layout Closed
314
+ if(flexible.isLayoutClosed($layout)){
315
+
316
+ // Placeholder
317
+ $layout.find('> .acfe-fc-placeholder').removeClass('acf-hidden');
318
+
319
+ if(flexible.has('acfeFlexibleOpen')){
320
+
321
+ acfe.enableFilter('acfeForceOpen');
322
+
323
+ flexible.openLayout($layout);
324
+
325
+ acfe.disableFilter('acfeForceOpen');
326
+
327
+ }
328
+
329
+ }
330
+
331
+ });
332
+
333
+ acf.addAction('show', function($layout, type){
334
+
335
+ if(type !== 'collapse' || !$layout.is('.layout'))
336
+ return;
337
+
338
+ var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
339
+
340
+ // Hide Placeholder
341
+ if(!flexible.has('acfeFlexibleModalEdition')){
342
+
343
+ // Placeholder
344
+ $layout.find('> .acfe-fc-placeholder').addClass('acf-hidden');
345
+
346
+ }
347
+
348
+ });
349
+
350
+ acf.addAction('hide', function($layout, type){
351
+
352
+ if(type !== 'collapse' || !$layout.is('.layout') || $layout.is('.acf-clone'))
353
+ return;
354
+
355
+ // Get Flexible
356
+ var flexible = acf.getInstance($layout.closest('.acf-field-flexible-content'));
357
+
358
+ // Remove Ajax Title
359
+ if(flexible.has('acfeFlexibleRemoveAjaxTitle')){
360
+
361
+ flexible.renderLayout = function($layout){};
362
+
363
+ }
364
+
365
+ // Preview Ajax
366
+ flexible.acfeLayoutInit($layout);
367
+
368
+ });
369
+
370
+ acf.addAction('append', function($el){
371
+
372
+ // Bail early if layout is not layout
373
+ if(!$el.is('.layout'))
374
+ return;
375
+
376
+ // Get Flexible
377
+ var flexible = acf.getInstance($el.closest('.acf-field-flexible-content'));
378
+
379
+ // Open Layout
380
+ if(!$el.is('.acfe-layout-duplicated')){
381
+
382
+ // Modal Edition: Open
383
+ if(flexible.has('acfeFlexibleModalEdition')){
384
+
385
+ $el.find('> [data-action="acfe-flexible-modal-edit"]:first').trigger('click');
386
+
387
+ }
388
+
389
+ // Normal Edition: Open
390
+ else{
391
+
392
+ flexible.openLayout($el);
393
+
394
+ }
395
+
396
+ }
397
+
398
+ flexible.acfeLayoutInit($el);
399
+
400
+ var $modal = flexible.$el.closest('.acfe-modal.-open');
401
+
402
+ if($modal.length){
403
+
404
+ // Scroll to new layout
405
+ $modal.find('> .acfe-modal-wrapper > .acfe-modal-content').animate({
406
+ scrollTop: parseInt($el.offset().top) - 200
407
+ }, 200);
408
+
409
+ }else{
410
+
411
+ var acfVersion = parseFloat(acf.get('acf_version'));
412
+
413
+ if(acfVersion < 5.9){
414
+
415
+ // Scroll to new layout
416
+ $('html, body').animate({
417
+ scrollTop: parseInt($el.offset().top) - 200
418
+ }, 200);
419
+
420
+ }
421
+
422
+ }
423
+
424
+ });
425
+
426
+ /*
427
+ * Field Error
428
+ */
429
+ acf.addAction('invalid_field', function(field){
430
+
431
+ field.$el.parents('.layout').addClass('acfe-flexible-modal-edit-error');
432
+
433
+ });
434
+
435
+ /*
436
+ * Field Valid
437
+ */
438
+ acf.addAction('valid_field', function(field){
439
+
440
+ field.$el.parents('.layout').each(function(){
441
+
442
+ var $layout = $(this);
443
+
444
+ if(!$layout.find('.acf-error').length)
445
+ $layout.removeClass('acfe-flexible-modal-edit-error');
446
+
447
+ });
448
+
449
+ });
450
+
451
  })(jQuery);
assets/acf-extended-fg.css CHANGED
@@ -135,12 +135,17 @@ td.acf-field-group-category a{
135
  width:70px;
136
  }
137
 
138
- #acf-field-group-wrap .wp-list-table .column-acf-fg-count{
 
139
  width:70px;
140
  }
141
 
 
 
 
 
142
  .column-acfe-local{
143
- width:50px;
144
  }
145
 
146
  .column-acfe-source{
@@ -149,7 +154,7 @@ td.acf-field-group-category a{
149
 
150
  .column-acfe-autosync-php,
151
  .column-acfe-autosync-json{
152
- width:65px;
153
  text-align:center;
154
  }
155
 
135
  width:70px;
136
  }
137
 
138
+ #acf-field-group-wrap .wp-list-table .column-acf-fg-count,
139
+ .post-type-acf-field-group .wp-list-table .column-acf-count{
140
  width:70px;
141
  }
142
 
143
+ .post-type-acf-field-group .wp-list-table .column-title .post-state{
144
+ color:#a0a5aa;
145
+ }
146
+
147
  .column-acfe-local{
148
+ width:70px;
149
  }
150
 
151
  .column-acfe-source{
154
 
155
  .column-acfe-autosync-php,
156
  .column-acfe-autosync-json{
157
+ width:90px;
158
  text-align:center;
159
  }
160
 
assets/acf-extended-fields.js CHANGED
@@ -1397,7 +1397,7 @@ function acfe_recaptcha(){
1397
 
1398
  $.each(field.get('acfeLabels'), function(group, key){
1399
 
1400
- field.$control().find('input[type=checkbox][value=' + key + ']').closest('ul').before('<strong>' + group + '</strong>');
1401
 
1402
  });
1403
 
@@ -1413,10 +1413,20 @@ function acfe_recaptcha(){
1413
 
1414
  $.each(field.get('acfeLabels'), function(group, key){
1415
 
1416
- field.$control().find('input[type=radio][value=' + key + ']').closest('li').prepend('<strong>' + group + '</strong>');
1417
 
1418
  });
1419
 
 
 
 
 
 
 
 
 
 
 
1420
  });
1421
 
1422
  })(jQuery);
1397
 
1398
  $.each(field.get('acfeLabels'), function(group, key){
1399
 
1400
+ field.$control().find('input[type=checkbox][value="' + key + '"]').closest('ul').before('<strong>' + group + '</strong>');
1401
 
1402
  });
1403
 
1413
 
1414
  $.each(field.get('acfeLabels'), function(group, key){
1415
 
1416
+ field.$control().find('input[type=radio][value="' + key + '"]').closest('li').addClass('parent').prepend('<strong>' + group + '</strong>');
1417
 
1418
  });
1419
 
1420
+ if(field.$control().hasClass('acf-hl')){
1421
+
1422
+ field.$control().find('li.parent').each(function(){
1423
+
1424
+ $(this).nextUntil('li.parent').addBack().wrapAll('<li><ul></ul></li>');
1425
+
1426
+ });
1427
+
1428
+ }
1429
+
1430
  });
1431
 
1432
  })(jQuery);
assets/acf-extended-repeater.js CHANGED
@@ -1,59 +1,59 @@
1
- (function($){
2
-
3
- if(typeof acf === 'undefined')
4
- return;
5
-
6
- /*
7
- * Init
8
- */
9
- var repeater = acf.getFieldType('repeater');
10
- var model = repeater.prototype;
11
-
12
- // Repeater: Lock Layouts
13
- model.acfeOnHover = function(){
14
-
15
- var repeater = this;
16
-
17
- // remove event
18
- repeater.off('mouseover');
19
-
20
- }
21
-
22
- /*
23
- * Spawn
24
- */
25
- acf.addAction('new_field/type=repeater', function(repeater){
26
-
27
- // ACFE: Lock
28
- if(repeater.has('acfeRepeaterLock')){
29
-
30
- repeater.removeEvents({'mouseover': 'onHover'});
31
-
32
- repeater.addEvents({'mouseover': 'acfeOnHover'});
33
-
34
- }
35
-
36
- // ACFE: Remove Actions
37
- if(repeater.has('acfeRepeaterRemoveActions')){
38
-
39
- repeater.$actions().remove();
40
-
41
- repeater.$el.find('thead:first > tr > th.acf-row-handle:last').remove();
42
- repeater.$rows().find('> .acf-row-handle:last').remove();
43
-
44
- repeater.$control().find('> .acfe-repeater-stylised-button').remove();
45
-
46
-
47
- }
48
-
49
- // ACFE: Stylised button
50
- if(repeater.has('acfeRepeaterStylisedButton')){
51
-
52
- repeater.$button().removeClass('button-primary');
53
- repeater.$actions().wrap('<div class="acfe-repeater-stylised-button" />');
54
-
55
- }
56
-
57
- });
58
-
59
  })(jQuery);
1
+ (function($){
2
+
3
+ if(typeof acf === 'undefined')
4
+ return;
5
+
6
+ /*
7
+ * Init
8
+ */
9
+ var repeater = acf.getFieldType('repeater');
10
+ var model = repeater.prototype;
11
+
12
+ // Repeater: Lock Layouts
13
+ model.acfeOnHover = function(){
14
+
15
+ var repeater = this;
16
+
17
+ // remove event
18
+ repeater.off('mouseover');
19
+
20
+ }
21
+
22
+ /*
23
+ * Spawn
24
+ */
25
+ acf.addAction('new_field/type=repeater', function(repeater){
26
+
27
+ // ACFE: Lock
28
+ if(repeater.has('acfeRepeaterLock')){
29
+
30
+ repeater.removeEvents({'mouseover': 'onHover'});
31
+
32
+ repeater.addEvents({'mouseover': 'acfeOnHover'});
33
+
34
+ }
35
+
36
+ // ACFE: Remove Actions
37
+ if(repeater.has('acfeRepeaterRemoveActions')){
38
+
39
+ repeater.$actions().remove();
40
+
41
+ repeater.$el.find('thead:first > tr > th.acf-row-handle:last').remove();
42
+ repeater.$rows().find('> .acf-row-handle:last').remove();
43
+
44
+ repeater.$control().find('> .acfe-repeater-stylised-button').remove();
45
+
46
+
47
+ }
48
+
49
+ // ACFE: Stylised button
50
+ if(repeater.has('acfeRepeaterStylisedButton')){
51
+
52
+ repeater.$button().removeClass('button-primary');
53
+ repeater.$actions().wrap('<div class="acfe-repeater-stylised-button" />');
54
+
55
+ }
56
+
57
+ });
58
+
59
  })(jQuery);
assets/acf-extended-ui.css CHANGED
@@ -1,457 +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
  }
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.css CHANGED
@@ -327,9 +327,8 @@ tr.acf-field.acf-field-clone[data-acfe-clone-modal="1"] > .acf-input > .acfe-mod
327
  /*
328
  * ACF Field: Radio
329
  */
330
- .acf-field-radio .acf-input .acf-radio-list.acf-hl li > strong{
331
- vertical-align: middle;
332
- margin-right: 20px;
333
  }
334
 
335
  .acf-field-radio .acf-input .acf-radio-list.acf-bl li > strong{
327
  /*
328
  * ACF Field: Radio
329
  */
330
+ .acf-field-radio[data-acfe-labels] .acf-input .acf-radio-list.acf-hl li > strong{
331
+ display:block;
 
332
  }
333
 
334
  .acf-field-radio .acf-input .acf-radio-list.acf-bl li > strong{
includes/admin/options.class.php CHANGED
@@ -1,277 +1,277 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('WP_List_Table'))
7
- require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
8
-
9
- class ACFE_Admin_Options_List extends WP_List_Table{
10
-
11
- /**
12
- * Constructor
13
- *
14
- */
15
- public function __construct(){
16
-
17
- parent::__construct(array(
18
- 'singular' => __('Option', 'acfe'),
19
- 'plural' => __('Options', 'acfe'),
20
- 'ajax' => false
21
- ));
22
-
23
- }
24
-
25
-
26
- /**
27
- * Retrieve data from the database
28
- *
29
- * @param int $per_page
30
- * @param int $page_number
31
- *
32
- * @return mixed
33
- */
34
- public static function get_options($per_page = 100, $page_number = 1, $search = ''){
35
-
36
- global $wpdb;
37
-
38
- $sql = "SELECT * FROM {$wpdb->options}";
39
-
40
- if(!empty($search)){
41
-
42
- $sql .= ' WHERE option_name LIKE \'%' . $search . '%\'';
43
-
44
- }
45
-
46
- if(empty($_REQUEST['orderby'])){
47
-
48
- $sql .= ' ORDER BY option_id ASC';
49
-
50
- }
51
-
52
- else{
53
-
54
- $sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);
55
- $sql .= !empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';
56
-
57
- }
58
-
59
- if(empty($search)){
60
-
61
- $sql .= " LIMIT $per_page";
62
- $sql .= ' OFFSET ' . ($page_number - 1) * $per_page;
63
-
64
- }
65
-
66
-
67
- $result = $wpdb->get_results($sql, 'ARRAY_A');
68
-
69
- return $result;
70
-
71
- }
72
-
73
-
74
- /**
75
- * Returns the count of records in the database.
76
- *
77
- * @return null|string
78
- */
79
- public static function record_count($search = ''){
80
-
81
- global $wpdb;
82
-
83
- $sql = "SELECT COUNT(*) FROM {$wpdb->options}";
84
-
85
- if(!empty($search)){
86
-
87
- $sql .= ' WHERE option_name LIKE \'%' . $search . '%\'';
88
-
89
- }
90
-
91
- return $wpdb->get_var($sql);
92
-
93
- }
94
-
95
-
96
- /** Text displayed when no data is available */
97
- public function no_items(){
98
-
99
- _e('No options avaliable.', 'acfe');
100
-
101
- }
102
-
103
-
104
- /**
105
- * Render a column when no column specific method exist.
106
- *
107
- * @param array $item
108
- * @param string $column_name
109
- *
110
- * @return mixed
111
- */
112
- public function column_default($item, $column_name){
113
-
114
- if($column_name === 'option_id'){
115
-
116
- return $item['option_id'];
117
-
118
- }
119
-
120
- elseif($column_name === 'option_value'){
121
-
122
- if(is_serialized($item['option_value']) || $item['option_value'] != strip_tags($item['option_value'])){
123
-
124
- return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(maybe_unserialize($item['option_value']), true) . '</pre>';
125
-
126
- }elseif(acfe_is_json($item['option_value'])){
127
-
128
- return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(json_decode($item['option_value']), true) . '</pre>';
129
-
130
- }
131
-
132
-
133
- return $item['option_value'];
134
-
135
- }
136
-
137
- elseif($column_name === 'autoload'){
138
-
139
- return $item['autoload'];
140
-
141
- }else{
142
-
143
- return print_r($item, true);
144
-
145
- }
146
-
147
- }
148
-
149
- /**
150
- * Render the bulk edit checkbox
151
- *
152
- * @param array $item
153
- *
154
- * @return string
155
- */
156
- public function column_cb($item){
157
-
158
- return sprintf(
159
- '<input type="checkbox" name="bulk-delete[]" value="%s" />', $item['option_id']
160
- );
161
-
162
- }
163
-
164
-
165
- /**
166
- * Method for name column
167
- *
168
- * @param array $item an array of DB data
169
- *
170
- * @return string
171
- */
172
- public function column_option_name($item){
173
-
174
- $delete_nonce = wp_create_nonce('acfe_options_delete_option');
175
-
176
- $title = '<strong>' . $item['option_name'] . '</strong>';
177
-
178
- $actions = array(
179
- 'edit' => sprintf('<a href="?page=%s&action=edit&option=%s">' . __('Edit') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id'])),
180
- 'delete' => sprintf('<a href="?page=%s&action=delete&option=%s&_wpnonce=%s">' . __('Delete') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id']), $delete_nonce),
181
- );
182
-
183
- return $title . $this->row_actions($actions);
184
-
185
- }
186
-
187
-
188
- /**
189
- * Associative array of columns
190
- *
191
- * @return array
192
- */
193
- public function get_columns(){
194
-
195
- $columns = array(
196
- 'cb' => '<input type="checkbox" />',
197
- 'option_id' => __('ID', 'acfe'),
198
- 'option_name' => __('Name', 'acfe'),
199
- 'option_value' => __('Value', 'acfe'),
200
- 'autoload' => __('Autoload', 'acfe'),
201
- );
202
-
203
- return $columns;
204
-
205
- }
206
-
207
-
208
- /**
209
- * Columns to make sortable.
210
- *
211
- * @return array
212
- */
213
- public function get_sortable_columns(){
214
-
215
- $sortable_columns = array(
216
- 'option_id' => array('option_id', true),
217
- 'option_name' => array('option_name', true),
218
- 'option_value' => array('option_value', true),
219
- 'autoload' => array('autoload', true),
220
- );
221
-
222
- return $sortable_columns;
223
-
224
- }
225
-
226
- /**
227
- * Returns an associative array containing the bulk action
228
- *
229
- * @return array
230
- */
231
- public function get_bulk_actions(){
232
-
233
- $actions = array(
234
- 'bulk-delete' => __('Delete')
235
- );
236
-
237
- return $actions;
238
-
239
- }
240
-
241
-
242
- /**
243
- * Handles data query and filter, sorting, and pagination.
244
- */
245
- public function prepare_items(){
246
-
247
- // Get columns
248
- $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
249
-
250
- // Vars
251
- $per_page = $this->get_items_per_page('options_per_page', 100);
252
- $current_page = $this->get_pagenum();
253
-
254
- // Search
255
- $search = (isset( $_REQUEST['s'])) ? $_REQUEST['s'] : false;
256
-
257
- // Get items
258
- $this->items = self::get_options($per_page, $current_page, $search);
259
- /*
260
- foreach($this->items as &$item){
261
- $item = json_encode($item);
262
- }*/
263
-
264
- // Get total
265
- $total_items = self::record_count($search);
266
-
267
- if(!empty($search))
268
- $per_page = $total_items;
269
-
270
- $this->set_pagination_args(array(
271
- 'total_items' => $total_items,
272
- 'per_page' => $per_page
273
- ));
274
-
275
- }
276
-
277
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('WP_List_Table'))
7
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
8
+
9
+ class ACFE_Admin_Options_List extends WP_List_Table{
10
+
11
+ /**
12
+ * Constructor
13
+ *
14
+ */
15
+ public function __construct(){
16
+
17
+ parent::__construct(array(
18
+ 'singular' => __('Option', 'acfe'),
19
+ 'plural' => __('Options', 'acfe'),
20
+ 'ajax' => false
21
+ ));
22
+
23
+ }
24
+
25
+
26
+ /**
27
+ * Retrieve data from the database
28
+ *
29
+ * @param int $per_page
30
+ * @param int $page_number
31
+ *
32
+ * @return mixed
33
+ */
34
+ public static function get_options($per_page = 100, $page_number = 1, $search = ''){
35
+
36
+ global $wpdb;
37
+
38
+ $sql = "SELECT * FROM {$wpdb->options}";
39
+
40
+ if(!empty($search)){
41
+
42
+ $sql .= ' WHERE option_name LIKE \'%' . $search . '%\'';
43
+
44
+ }
45
+
46
+ if(empty($_REQUEST['orderby'])){
47
+
48
+ $sql .= ' ORDER BY option_id ASC';
49
+
50
+ }
51
+
52
+ else{
53
+
54
+ $sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);
55
+ $sql .= !empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';
56
+
57
+ }
58
+
59
+ if(empty($search)){
60
+
61
+ $sql .= " LIMIT $per_page";
62
+ $sql .= ' OFFSET ' . ($page_number - 1) * $per_page;
63
+
64
+ }
65
+
66
+
67
+ $result = $wpdb->get_results($sql, 'ARRAY_A');
68
+
69
+ return $result;
70
+
71
+ }
72
+
73
+
74
+ /**
75
+ * Returns the count of records in the database.
76
+ *
77
+ * @return null|string
78
+ */
79
+ public static function record_count($search = ''){
80
+
81
+ global $wpdb;
82
+
83
+ $sql = "SELECT COUNT(*) FROM {$wpdb->options}";
84
+
85
+ if(!empty($search)){
86
+
87
+ $sql .= ' WHERE option_name LIKE \'%' . $search . '%\'';
88
+
89
+ }
90
+
91
+ return $wpdb->get_var($sql);
92
+
93
+ }
94
+
95
+
96
+ /** Text displayed when no data is available */
97
+ public function no_items(){
98
+
99
+ _e('No options avaliable.', 'acfe');
100
+
101
+ }
102
+
103
+
104
+ /**
105
+ * Render a column when no column specific method exist.
106
+ *
107
+ * @param array $item
108
+ * @param string $column_name
109
+ *
110
+ * @return mixed
111
+ */
112
+ public function column_default($item, $column_name){
113
+
114
+ if($column_name === 'option_id'){
115
+
116
+ return $item['option_id'];
117
+
118
+ }
119
+
120
+ elseif($column_name === 'option_value'){
121
+
122
+ if(is_serialized($item['option_value']) || $item['option_value'] != strip_tags($item['option_value'])){
123
+
124
+ return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(maybe_unserialize($item['option_value']), true) . '</pre>';
125
+
126
+ }elseif(acfe_is_json($item['option_value'])){
127
+
128
+ return '<pre style="max-height:200px; overflow:auto; white-space: pre;">' . print_r(json_decode($item['option_value']), true) . '</pre>';
129
+
130
+ }
131
+
132
+
133
+ return $item['option_value'];
134
+
135
+ }
136
+
137
+ elseif($column_name === 'autoload'){
138
+
139
+ return $item['autoload'];
140
+
141
+ }else{
142
+
143
+ return print_r($item, true);
144
+
145
+ }
146
+
147
+ }
148
+
149
+ /**
150
+ * Render the bulk edit checkbox
151
+ *
152
+ * @param array $item
153
+ *
154
+ * @return string
155
+ */
156
+ public function column_cb($item){
157
+
158
+ return sprintf(
159
+ '<input type="checkbox" name="bulk-delete[]" value="%s" />', $item['option_id']
160
+ );
161
+
162
+ }
163
+
164
+
165
+ /**
166
+ * Method for name column
167
+ *
168
+ * @param array $item an array of DB data
169
+ *
170
+ * @return string
171
+ */
172
+ public function column_option_name($item){
173
+
174
+ $delete_nonce = wp_create_nonce('acfe_options_delete_option');
175
+
176
+ $title = '<strong>' . $item['option_name'] . '</strong>';
177
+
178
+ $actions = array(
179
+ 'edit' => sprintf('<a href="?page=%s&action=edit&option=%s">' . __('Edit') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id'])),
180
+ 'delete' => sprintf('<a href="?page=%s&action=delete&option=%s&_wpnonce=%s">' . __('Delete') . '</a>', esc_attr($_REQUEST['page']), absint($item['option_id']), $delete_nonce),
181
+ );
182
+
183
+ return $title . $this->row_actions($actions);
184
+
185
+ }
186
+
187
+
188
+ /**
189
+ * Associative array of columns
190
+ *
191
+ * @return array
192
+ */
193
+ public function get_columns(){
194
+
195
+ $columns = array(
196
+ 'cb' => '<input type="checkbox" />',
197
+ 'option_id' => __('ID', 'acfe'),
198
+ 'option_name' => __('Name', 'acfe'),
199
+ 'option_value' => __('Value', 'acfe'),
200
+ 'autoload' => __('Autoload', 'acfe'),
201
+ );
202
+
203
+ return $columns;
204
+
205
+ }
206
+
207
+
208
+ /**
209
+ * Columns to make sortable.
210
+ *
211
+ * @return array
212
+ */
213
+ public function get_sortable_columns(){
214
+
215
+ $sortable_columns = array(
216
+ 'option_id' => array('option_id', true),
217
+ 'option_name' => array('option_name', true),
218
+ 'option_value' => array('option_value', true),
219
+ 'autoload' => array('autoload', true),
220
+ );
221
+
222
+ return $sortable_columns;
223
+
224
+ }
225
+
226
+ /**
227
+ * Returns an associative array containing the bulk action
228
+ *
229
+ * @return array
230
+ */
231
+ public function get_bulk_actions(){
232
+
233
+ $actions = array(
234
+ 'bulk-delete' => __('Delete')
235
+ );
236
+
237
+ return $actions;
238
+
239
+ }
240
+
241
+
242
+ /**
243
+ * Handles data query and filter, sorting, and pagination.
244
+ */
245
+ public function prepare_items(){
246
+
247
+ // Get columns
248
+ $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
249
+
250
+ // Vars
251
+ $per_page = $this->get_items_per_page('options_per_page', 100);
252
+ $current_page = $this->get_pagenum();
253
+
254
+ // Search
255
+ $search = (isset( $_REQUEST['s'])) ? $_REQUEST['s'] : false;
256
+
257
+ // Get items
258
+ $this->items = self::get_options($per_page, $current_page, $search);
259
+ /*
260
+ foreach($this->items as &$item){
261
+ $item = json_encode($item);
262
+ }*/
263
+
264
+ // Get total
265
+ $total_items = self::record_count($search);
266
+
267
+ if(!empty($search))
268
+ $per_page = $total_items;
269
+
270
+ $this->set_pagination_args(array(
271
+ 'total_items' => $total_items,
272
+ 'per_page' => $per_page
273
+ ));
274
+
275
+ }
276
+
277
  }
includes/admin/options.php CHANGED
@@ -1,579 +1,579 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- // Check setting
7
- if(!acf_get_setting('acfe/modules/options'))
8
- return;
9
-
10
- /**
11
- * Options WP List Table
12
- *
13
- */
14
- require_once(ACFE_PATH . 'includes/admin/options.class.php');
15
-
16
- /**
17
- * Options Menu
18
- *
19
- */
20
- add_action('admin_menu', 'acfe_options_menu');
21
- function acfe_options_menu(){
22
-
23
- $hook = add_submenu_page(
24
- 'options-general.php',
25
- __('Options'),
26
- __('Options'),
27
- acf_get_setting('capability'),
28
- 'acfe-options'
29
- );
30
-
31
- }
32
-
33
- /**
34
- * Options Screen
35
- *
36
- */
37
- add_filter('set-screen-option', 'acfe_options_screen', 10, 3);
38
- function acfe_options_screen($status, $option, $value){
39
-
40
- return $value;
41
-
42
- }
43
-
44
- /**
45
- * Options Enqueue
46
- *
47
- */
48
- add_action('admin_print_scripts-settings_page_acfe-options', 'acfe_options_enqueue');
49
- function acfe_options_enqueue(){
50
-
51
- wp_enqueue_style('acf-input');
52
- wp_enqueue_script('acf-input');
53
- wp_enqueue_style('acf-extended', plugins_url('assets/acf-extended.css', ACFE_FILE), false, null);
54
-
55
- }
56
-
57
- /**
58
- * Options Load
59
- *
60
- */
61
- add_action('load-settings_page_acfe-options', 'acfe_options_load');
62
- function acfe_options_load(){
63
-
64
- // Messages
65
- if(isset($_REQUEST['message']) && !empty($_REQUEST['message']))
66
- do_action('acfe/options/load/message=' . $_REQUEST['message']);
67
-
68
- // Default Action
69
- $action = 'list';
70
-
71
- // Request Action
72
- if(isset($_REQUEST['action']) && !empty($_REQUEST['action']) && $_REQUEST['action'] != '-1')
73
- $action = $_REQUEST['action'];
74
-
75
- // Request Action2
76
- elseif(isset($_REQUEST['action2']) && !empty($_REQUEST['action2']) && $_REQUEST['action2'] != '-1')
77
- $action = $_REQUEST['action2'];
78
-
79
- // Do Action: Specific
80
- do_action('acfe/options/load/action=' . $action, $action);
81
-
82
- // Do Action
83
- do_action('acfe/options/load', $action);
84
-
85
- }
86
-
87
- /**
88
- * Options HTML
89
- *
90
- */
91
- add_action('settings_page_acfe-options', 'acfe_options_html');
92
- function acfe_options_html(){
93
-
94
- // Default Action
95
- $action = 'list';
96
-
97
- // Request Action
98
- if(isset($_REQUEST['action']) && !empty($_REQUEST['action']) && $_REQUEST['action'] != '-1')
99
- $action = $_REQUEST['action'];
100
-
101
- // Do Action: Specific
102
- do_action('acfe/options/html/action=' . $action, $action);
103
-
104
- // Do Action
105
- do_action('acfe/options/html', $action);
106
-
107
- }
108
-
109
- /**
110
- * Options List: Load
111
- *
112
- */
113
- add_action('acfe/options/load/action=list', 'acfe_options_load_list');
114
- function acfe_options_load_list(){
115
-
116
- add_screen_option('per_page', array(
117
- 'label' => 'Options',
118
- 'default' => 100,
119
- 'option' => 'options_per_page'
120
- ));
121
-
122
- }
123
-
124
- /**
125
- * Options List: HTML
126
- *
127
- */
128
- add_filter('acfe/options/html/action=list', 'acfe_options_html_list');
129
- function acfe_options_html_list(){
130
-
131
- acf_get_view(ACFE_PATH . '/includes/admin/views/html-options-list.php');
132
-
133
- }
134
-
135
- /**
136
- * Options Delete: Load
137
- *
138
- */
139
- add_action('acfe/options/load/action=delete', 'acfe_options_load_delete');
140
- function acfe_options_load_delete(){
141
-
142
- $nonce = esc_attr($_REQUEST['_wpnonce']);
143
-
144
- if(!wp_verify_nonce($nonce, 'acfe_options_delete_option'))
145
- wp_die('Cheatin’, huh?');
146
-
147
- acfe_options_delete_option(absint($_GET['option']));
148
-
149
- wp_redirect(sprintf('?page=%s&message=deleted', esc_attr($_REQUEST['page'])));
150
- exit;
151
-
152
- }
153
-
154
- /**
155
- * Options Delete: Message
156
- *
157
- */
158
- add_action('acfe/options/load/message=deleted', 'acfe_options_load_delete_message');
159
- function acfe_options_load_delete_message(){
160
-
161
- acf_add_admin_notice(__('Option has been deleted'), 'success');
162
-
163
- }
164
-
165
- /**
166
- * Options Bulk Delete: Load
167
- *
168
- */
169
- add_action('acfe/options/load/action=bulk-delete', 'acfe_options_load_bulk_delete');
170
- function acfe_options_load_bulk_delete(){
171
-
172
- $nonce = esc_attr($_REQUEST['_wpnonce']);
173
-
174
- if(!wp_verify_nonce($nonce, 'bulk-options'))
175
- wp_die('Cheatin’, huh?');
176
-
177
- $delete_ids = esc_sql($_REQUEST['bulk-delete']);
178
-
179
- foreach($delete_ids as $id){
180
-
181
- acfe_options_delete_option($id);
182
-
183
- }
184
-
185
- wp_redirect(sprintf('?page=%s&message=bulk-deleted', esc_attr($_REQUEST['page'])));
186
- exit;
187
-
188
- }
189
-
190
- /**
191
- * Options Bulk Delete: Message
192
- *
193
- */
194
- add_action('acfe/options/load/message=bulk-deleted', 'acfe_options_load_bulk_delete_message');
195
- function acfe_options_load_bulk_delete_message(){
196
-
197
- acf_add_admin_notice(__('Options have been deleted'), 'success');
198
-
199
- }
200
-
201
- /**
202
- * Options Delete: Function
203
- *
204
- */
205
- function acfe_options_delete_option($id){
206
-
207
- global $wpdb;
208
-
209
- $wpdb->delete(
210
- "{$wpdb->options}",
211
- array('option_id' => $id),
212
- array('%d')
213
- );
214
-
215
- }
216
-
217
- /**
218
- * Options Edit: Load
219
- *
220
- */
221
- add_action('acfe/options/load/action=edit', 'acfe_options_load_edit');
222
- add_action('acfe/options/load/action=add', 'acfe_options_load_edit');
223
- function acfe_options_load_edit($action){
224
-
225
- // Nonce
226
- if(acf_verify_nonce('acfe-options-edit')){
227
-
228
- // Save data
229
- if(acf_validate_save_post(true)){
230
-
231
- acf_save_post('acfe_options_edit');
232
-
233
- $redirect = add_query_arg(array('message' => 'updated'));
234
-
235
- if($action === 'add')
236
- $redirect = sprintf('?page=%s&message=added', esc_attr($_REQUEST['page']));
237
-
238
- wp_redirect($redirect);
239
- exit;
240
-
241
- }
242
-
243
- }
244
-
245
- // Load acf scripts
246
- acf_enqueue_scripts();
247
-
248
- // Actions
249
- add_action('acf/input/admin_head', 'acfe_options_edit_metabox');
250
-
251
- // Add columns support
252
- add_screen_option('layout_columns', array(
253
- 'max' => 2,
254
- 'default' => 2
255
- ));
256
-
257
- }
258
-
259
- /**
260
- * Options Edit: HTML
261
- *
262
- */
263
- add_filter('acfe/options/html/action=edit', 'acfe_options_html_edit');
264
- add_filter('acfe/options/html/action=add', 'acfe_options_html_edit');
265
- function acfe_options_html_edit(){
266
-
267
- acf_get_view(ACFE_PATH . '/includes/admin/views/html-options-edit.php');
268
-
269
- }
270
-
271
- /**
272
- * Options Edit: Metabox
273
- *
274
- */
275
- function acfe_options_edit_metabox(){
276
-
277
- $option = array(
278
- 'option_id' => 0,
279
- 'option_name' => '',
280
- 'option_value' => '',
281
- 'autoload' => 'no',
282
- );
283
-
284
- if(isset($_REQUEST['option']) && !empty($_REQUEST['option'])){
285
-
286
- $option_id = absint($_REQUEST['option']);
287
-
288
- global $wpdb;
289
-
290
- $get_option = $wpdb->get_row("SELECT * FROM {$wpdb->options} WHERE option_id = '$option_id'", 'ARRAY_A');
291
- if(!empty($get_option))
292
- $option = $get_option;
293
-
294
- }
295
-
296
- $field_group = array(
297
- 'ID' => 0,
298
- 'key' => 'group_acfe_options_edit',
299
- 'style' => 'default',
300
- 'label_placement' => 'left',
301
- 'instruction_placement' => 'label',
302
- 'fields' => array()
303
- );
304
-
305
- $fields = array();
306
-
307
- $fields[] = array(
308
- 'label' => __('Name'),
309
- 'key' => 'field_acfe_options_edit_name',
310
- 'name' => 'field_acfe_options_edit_name',
311
- 'type' => 'text',
312
- 'prefix' => 'acf',
313
- 'instructions' => '',
314
- 'required' => true,
315
- 'conditional_logic' => false,
316
- 'default_value' => '',
317
- 'placeholder' => '',
318
- 'prepend' => '',
319
- 'append' => '',
320
- 'maxlength' => '',
321
- 'value' => $option['option_name'],
322
- 'wrapper' => array(
323
- 'width' => '',
324
- 'class' => '',
325
- 'id' => '',
326
- ),
327
- );
328
-
329
- // Serialized || HTML
330
- if(is_serialized($option['option_value']) || $option['option_value'] != strip_tags($option['option_value'])){
331
-
332
- $type = 'serilized';
333
- $instructions = 'Use this <a href="https://duzun.me/playground/serialize" target="_blank">online tool</a> to unserialize/seriliaze data.';
334
-
335
- if($option['option_value'] != strip_tags($option['option_value'])){
336
-
337
- $type = 'HTML';
338
- $instructions = '';
339
-
340
- }
341
-
342
- $fields[] = array(
343
- 'label' => __('Value <code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">' . $type . '</code>'),
344
- 'key' => 'field_acfe_options_edit_value',
345
- 'name' => 'field_acfe_options_edit_value',
346
- 'type' => 'textarea',
347
- 'prefix' => 'acf',
348
- 'instructions' => $instructions,
349
- 'required' => false,
350
- 'conditional_logic' => false,
351
- 'default_value' => '',
352
- 'placeholder' => '',
353
- 'prepend' => '',
354
- 'append' => '',
355
- 'maxlength' => '',
356
- 'value' => $option['option_value'],
357
- 'class' => 'code',
358
- 'wrapper' => array(
359
- 'width' => '',
360
- 'class' => '',
361
- 'id' => '',
362
- ),
363
- );
364
-
365
- }
366
-
367
- // Serialized || HTML
368
- elseif(acfe_is_json($option['option_value'])){
369
-
370
- $type = 'json';
371
- $instructions = 'Use this <a href="http://solutions.weblite.ca/php2json/" target="_blank">online tool</a> to decode/encode json.';
372
-
373
- $fields[] = array(
374
- 'label' => __('Value <code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">' . $type . '</code>'),
375
- 'key' => 'field_acfe_options_edit_value',
376
- 'name' => 'field_acfe_options_edit_value',
377
- 'type' => 'textarea',
378
- 'prefix' => 'acf',
379
- 'instructions' => $instructions,
380
- 'required' => false,
381
- 'conditional_logic' => false,
382
- 'default_value' => '',
383
- 'placeholder' => '',
384
- 'prepend' => '',
385
- 'append' => '',
386
- 'maxlength' => '',
387
- 'value' => $option['option_value'],
388
- 'class' => 'code',
389
- 'wrapper' => array(
390
- 'width' => '',
391
- 'class' => '',
392
- 'id' => '',
393
- ),
394
- );
395
-
396
- }
397
-
398
- // String
399
- else{
400
-
401
- $type = '';
402
- if(!empty($option['option_value']))
403
- $type = '<code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">string</code>';
404
-
405
- $fields[] = array(
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,
413
- 'conditional_logic' => false,
414
- 'default_value' => '',
415
- 'placeholder' => '',
416
- 'prepend' => '',
417
- 'append' => '',
418
- 'maxlength' => '',
419
- 'value' => $option['option_value'],
420
- 'wrapper' => array(
421
- 'width' => '',
422
- 'class' => '',
423
- 'id' => '',
424
- ),
425
- );
426
-
427
- }
428
-
429
- $fields[] = array(
430
- 'label' => __('Autoload'),
431
- 'key' => 'field_acfe_options_edit_autoload',
432
- 'name' => 'field_acfe_options_edit_autoload',
433
- 'type' => 'select',
434
- 'prefix' => 'acf',
435
- 'instructions' => '',
436
- 'required' => true,
437
- 'conditional_logic' => false,
438
- 'default_value' => '',
439
- 'placeholder' => '',
440
- 'prepend' => '',
441
- 'append' => '',
442
- 'maxlength' => '',
443
- 'value' => $option['autoload'],
444
- 'choices' => array(
445
- 'no' => __('No'),
446
- 'yes' => __('Yes'),
447
- ),
448
- 'wrapper' => array(
449
- 'width' => '',
450
- 'class' => '',
451
- 'id' => '',
452
- ),
453
- );
454
-
455
- $field_group['fields'] = $fields;
456
-
457
- $metabox_submit_title = __('Submit','acf');
458
- $metabox_main_title = __('Add Option');
459
-
460
- if(!empty($option['option_id'])){
461
-
462
- $metabox_submit_title = __('Edit','acf');
463
- $metabox_main_title = __('Edit Option');
464
-
465
- }
466
-
467
- // Submit Metabox
468
- add_meta_box('submitdiv', $metabox_submit_title, function($post, $args) use($option){
469
-
470
- $delete_nonce = wp_create_nonce('acfe_options_delete_option');
471
-
472
- ?>
473
- <div id="major-publishing-actions">
474
-
475
- <?php if(!empty($option['option_id'])){ ?>
476
-
477
- <div id="delete-action">
478
- <a class="submitdelete deletion" style="color:#a00;" href="<?php echo sprintf('?page=%s&action=%s&option=%s&_wpnonce=%s', esc_attr($_REQUEST['page']), 'delete', $option['option_id'], $delete_nonce); ?>"><?php _e('Delete'); ?></a>
479
- </div>
480
-
481
- <?php } ?>
482
-
483
- <div id="publishing-action">
484
- <span class="spinner"></span>
485
- <input type="submit" accesskey="p" value="<?php _e('Update'); ?>" class="button button-primary button-large" id="publish" name="publish">
486
- </div>
487
-
488
- <div class="clear"></div>
489
-
490
- </div>
491
- <?php
492
- }, 'acf_options_page', 'side', 'high');
493
-
494
- // Main Metabox
495
- add_meta_box('acf-group_acfe_options_edit', $metabox_main_title, function($post, $args){
496
-
497
- // extract args
498
- extract($args); // all variables from the add_meta_box function
499
- extract($args); // all variables from the args argument
500
-
501
- // vars
502
- $o = array(
503
- 'id' => $id,
504
- 'key' => $field_group['key'],
505
- 'style' => $field_group['style'],
506
- 'label' => $field_group['label_placement'],
507
- 'editLink' => '',
508
- 'editTitle' => __('Edit field group', 'acf'),
509
- 'visibility' => true
510
- );
511
-
512
- // load fields
513
- $fields = $field_group['fields'];
514
-
515
- // render
516
- acf_render_fields($fields, 'acfe-options-edit', 'div', $field_group['instruction_placement']);
517
-
518
- ?>
519
- <script type="text/javascript">
520
- if(typeof acf !== 'undefined'){
521
-
522
- acf.newPostbox(<?php echo json_encode($o); ?>);
523
-
524
- }
525
- </script>
526
- <?php
527
-
528
- }, 'acf_options_page', 'normal', 'high', array('field_group' => $field_group));
529
-
530
- }
531
-
532
- /**
533
- * Options Edit: Save
534
- *
535
- */
536
- add_action('acf/save_post', 'acfe_options_edit_save_post', 5);
537
- function acfe_options_edit_save_post($post_id){
538
-
539
- // Validate
540
- if($post_id !== 'acfe_options_edit')
541
- return;
542
-
543
- // Vars
544
- $option_name = wp_unslash($_POST['acf']['field_acfe_options_edit_name']);
545
- $option_value = wp_unslash($_POST['acf']['field_acfe_options_edit_value']);
546
- $autoload = $_POST['acf']['field_acfe_options_edit_autoload'];
547
-
548
- // Value serialized?
549
- $option_value = maybe_unserialize($option_value);
550
-
551
- // Update
552
- update_option($option_name, $option_value, $autoload);
553
-
554
- // Flush ACF
555
- $_POST['acf'] = array();
556
-
557
- }
558
-
559
- /**
560
- * Options Edit: Message
561
- *
562
- */
563
- add_action('acfe/options/load/message=updated', 'acfe_options_load_edit_message');
564
- function acfe_options_load_edit_message(){
565
-
566
- acf_add_admin_notice(__('Option has been updated'), 'success');
567
-
568
- }
569
-
570
- /**
571
- * Options Add: Message
572
- *
573
- */
574
- add_action('acfe/options/load/message=added', 'acfe_options_load_add_message');
575
- function acfe_options_load_add_message(){
576
-
577
- acf_add_admin_notice(__('Option has been added'), 'success');
578
-
579
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ // Check setting
7
+ if(!acf_get_setting('acfe/modules/options'))
8
+ return;
9
+
10
+ /**
11
+ * Options WP List Table
12
+ *
13
+ */
14
+ require_once(ACFE_PATH . 'includes/admin/options.class.php');
15
+
16
+ /**
17
+ * Options Menu
18
+ *
19
+ */
20
+ add_action('admin_menu', 'acfe_options_menu');
21
+ function acfe_options_menu(){
22
+
23
+ $hook = add_submenu_page(
24
+ 'options-general.php',
25
+ __('Options'),
26
+ __('Options'),
27
+ acf_get_setting('capability'),
28
+ 'acfe-options'
29
+ );
30
+
31
+ }
32
+
33
+ /**
34
+ * Options Screen
35
+ *
36
+ */
37
+ add_filter('set-screen-option', 'acfe_options_screen', 10, 3);
38
+ function acfe_options_screen($status, $option, $value){
39
+
40
+ return $value;
41
+
42
+ }
43
+
44
+ /**
45
+ * Options Enqueue
46
+ *
47
+ */
48
+ add_action('admin_print_scripts-settings_page_acfe-options', 'acfe_options_enqueue');
49
+ function acfe_options_enqueue(){
50
+
51
+ wp_enqueue_style('acf-input');
52
+ wp_enqueue_script('acf-input');
53
+ wp_enqueue_style('acf-extended', plugins_url('assets/acf-extended.css', ACFE_FILE), false, null);
54
+
55
+ }
56
+
57
+ /**
58
+ * Options Load
59
+ *
60
+ */
61
+ add_action('load-settings_page_acfe-options', 'acfe_options_load');
62
+ function acfe_options_load(){
63
+
64
+ // Messages
65
+ if(isset($_REQUEST['message']) && !empty($_REQUEST['message']))
66
+ do_action('acfe/options/load/message=' . $_REQUEST['message']);
67
+
68
+ // Default Action
69
+ $action = 'list';
70
+
71
+ // Request Action
72
+ if(isset($_REQUEST['action']) && !empty($_REQUEST['action']) && $_REQUEST['action'] != '-1')
73
+ $action = $_REQUEST['action'];
74
+
75
+ // Request Action2
76
+ elseif(isset($_REQUEST['action2']) && !empty($_REQUEST['action2']) && $_REQUEST['action2'] != '-1')
77
+ $action = $_REQUEST['action2'];
78
+
79
+ // Do Action: Specific
80
+ do_action('acfe/options/load/action=' . $action, $action);
81
+
82
+ // Do Action
83
+ do_action('acfe/options/load', $action);
84
+
85
+ }
86
+
87
+ /**
88
+ * Options HTML
89
+ *
90
+ */
91
+ add_action('settings_page_acfe-options', 'acfe_options_html');
92
+ function acfe_options_html(){
93
+
94
+ // Default Action
95
+ $action = 'list';
96
+
97
+ // Request Action
98
+ if(isset($_REQUEST['action']) && !empty($_REQUEST['action']) && $_REQUEST['action'] != '-1')
99
+ $action = $_REQUEST['action'];
100
+
101
+ // Do Action: Specific
102
+ do_action('acfe/options/html/action=' . $action, $action);
103
+
104
+ // Do Action
105
+ do_action('acfe/options/html', $action);
106
+
107
+ }
108
+
109
+ /**
110
+ * Options List: Load
111
+ *
112
+ */
113
+ add_action('acfe/options/load/action=list', 'acfe_options_load_list');
114
+ function acfe_options_load_list(){
115
+
116
+ add_screen_option('per_page', array(
117
+ 'label' => 'Options',
118
+ 'default' => 100,
119
+ 'option' => 'options_per_page'
120
+ ));
121
+
122
+ }
123
+
124
+ /**
125
+ * Options List: HTML
126
+ *
127
+ */
128
+ add_filter('acfe/options/html/action=list', 'acfe_options_html_list');
129
+ function acfe_options_html_list(){
130
+
131
+ acf_get_view(ACFE_PATH . '/includes/admin/views/html-options-list.php');
132
+
133
+ }
134
+
135
+ /**
136
+ * Options Delete: Load
137
+ *
138
+ */
139
+ add_action('acfe/options/load/action=delete', 'acfe_options_load_delete');
140
+ function acfe_options_load_delete(){
141
+
142
+ $nonce = esc_attr($_REQUEST['_wpnonce']);
143
+
144
+ if(!wp_verify_nonce($nonce, 'acfe_options_delete_option'))
145
+ wp_die('Cheatin’, huh?');
146
+
147
+ acfe_options_delete_option(absint($_GET['option']));
148
+
149
+ wp_redirect(sprintf('?page=%s&message=deleted', esc_attr($_REQUEST['page'])));
150
+ exit;
151
+
152
+ }
153
+
154
+ /**
155
+ * Options Delete: Message
156
+ *
157
+ */
158
+ add_action('acfe/options/load/message=deleted', 'acfe_options_load_delete_message');
159
+ function acfe_options_load_delete_message(){
160
+
161
+ acf_add_admin_notice(__('Option has been deleted'), 'success');
162
+
163
+ }
164
+
165
+ /**
166
+ * Options Bulk Delete: Load
167
+ *
168
+ */
169
+ add_action('acfe/options/load/action=bulk-delete', 'acfe_options_load_bulk_delete');
170
+ function acfe_options_load_bulk_delete(){
171
+
172
+ $nonce = esc_attr($_REQUEST['_wpnonce']);
173
+
174
+ if(!wp_verify_nonce($nonce, 'bulk-options'))
175
+ wp_die('Cheatin’, huh?');
176
+
177
+ $delete_ids = esc_sql($_REQUEST['bulk-delete']);
178
+
179
+ foreach($delete_ids as $id){
180
+
181
+ acfe_options_delete_option($id);
182
+
183
+ }
184
+
185
+ wp_redirect(sprintf('?page=%s&message=bulk-deleted', esc_attr($_REQUEST['page'])));
186
+ exit;
187
+
188
+ }
189
+
190
+ /**
191
+ * Options Bulk Delete: Message
192
+ *
193
+ */
194
+ add_action('acfe/options/load/message=bulk-deleted', 'acfe_options_load_bulk_delete_message');
195
+ function acfe_options_load_bulk_delete_message(){
196
+
197
+ acf_add_admin_notice(__('Options have been deleted'), 'success');
198
+
199
+ }
200
+
201
+ /**
202
+ * Options Delete: Function
203
+ *
204
+ */
205
+ function acfe_options_delete_option($id){
206
+
207
+ global $wpdb;
208
+
209
+ $wpdb->delete(
210
+ "{$wpdb->options}",
211
+ array('option_id' => $id),
212
+ array('%d')
213
+ );
214
+
215
+ }
216
+
217
+ /**
218
+ * Options Edit: Load
219
+ *
220
+ */
221
+ add_action('acfe/options/load/action=edit', 'acfe_options_load_edit');
222
+ add_action('acfe/options/load/action=add', 'acfe_options_load_edit');
223
+ function acfe_options_load_edit($action){
224
+
225
+ // Nonce
226
+ if(acf_verify_nonce('acfe-options-edit')){
227
+
228
+ // Save data
229
+ if(acf_validate_save_post(true)){
230
+
231
+ acf_save_post('acfe_options_edit');
232
+
233
+ $redirect = add_query_arg(array('message' => 'updated'));
234
+
235
+ if($action === 'add')
236
+ $redirect = sprintf('?page=%s&message=added', esc_attr($_REQUEST['page']));
237
+
238
+ wp_redirect($redirect);
239
+ exit;
240
+
241
+ }
242
+
243
+ }
244
+
245
+ // Load acf scripts
246
+ acf_enqueue_scripts();
247
+
248
+ // Actions
249
+ add_action('acf/input/admin_head', 'acfe_options_edit_metabox');
250
+
251
+ // Add columns support
252
+ add_screen_option('layout_columns', array(
253
+ 'max' => 2,
254
+ 'default' => 2
255
+ ));
256
+
257
+ }
258
+
259
+ /**
260
+ * Options Edit: HTML
261
+ *
262
+ */
263
+ add_filter('acfe/options/html/action=edit', 'acfe_options_html_edit');
264
+ add_filter('acfe/options/html/action=add', 'acfe_options_html_edit');
265
+ function acfe_options_html_edit(){
266
+
267
+ acf_get_view(ACFE_PATH . '/includes/admin/views/html-options-edit.php');
268
+
269
+ }
270
+
271
+ /**
272
+ * Options Edit: Metabox
273
+ *
274
+ */
275
+ function acfe_options_edit_metabox(){
276
+
277
+ $option = array(
278
+ 'option_id' => 0,
279
+ 'option_name' => '',
280
+ 'option_value' => '',
281
+ 'autoload' => 'no',
282
+ );
283
+
284
+ if(isset($_REQUEST['option']) && !empty($_REQUEST['option'])){
285
+
286
+ $option_id = absint($_REQUEST['option']);
287
+
288
+ global $wpdb;
289
+
290
+ $get_option = $wpdb->get_row("SELECT * FROM {$wpdb->options} WHERE option_id = '$option_id'", 'ARRAY_A');
291
+ if(!empty($get_option))
292
+ $option = $get_option;
293
+
294
+ }
295
+
296
+ $field_group = array(
297
+ 'ID' => 0,
298
+ 'key' => 'group_acfe_options_edit',
299
+ 'style' => 'default',
300
+ 'label_placement' => 'left',
301
+ 'instruction_placement' => 'label',
302
+ 'fields' => array()
303
+ );
304
+
305
+ $fields = array();
306
+
307
+ $fields[] = array(
308
+ 'label' => __('Name'),
309
+ 'key' => 'field_acfe_options_edit_name',
310
+ 'name' => 'field_acfe_options_edit_name',
311
+ 'type' => 'text',
312
+ 'prefix' => 'acf',
313
+ 'instructions' => '',
314
+ 'required' => true,
315
+ 'conditional_logic' => false,
316
+ 'default_value' => '',
317
+ 'placeholder' => '',
318
+ 'prepend' => '',
319
+ 'append' => '',
320
+ 'maxlength' => '',
321
+ 'value' => $option['option_name'],
322
+ 'wrapper' => array(
323
+ 'width' => '',
324
+ 'class' => '',
325
+ 'id' => '',
326
+ ),
327
+ );
328
+
329
+ // Serialized || HTML
330
+ if(is_serialized($option['option_value']) || $option['option_value'] != strip_tags($option['option_value'])){
331
+
332
+ $type = 'serilized';
333
+ $instructions = 'Use this <a href="https://duzun.me/playground/serialize" target="_blank">online tool</a> to unserialize/seriliaze data.';
334
+
335
+ if($option['option_value'] != strip_tags($option['option_value'])){
336
+
337
+ $type = 'HTML';
338
+ $instructions = '';
339
+
340
+ }
341
+
342
+ $fields[] = array(
343
+ 'label' => __('Value <code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">' . $type . '</code>'),
344
+ 'key' => 'field_acfe_options_edit_value',
345
+ 'name' => 'field_acfe_options_edit_value',
346
+ 'type' => 'textarea',
347
+ 'prefix' => 'acf',
348
+ 'instructions' => $instructions,
349
+ 'required' => false,
350
+ 'conditional_logic' => false,
351
+ 'default_value' => '',
352
+ 'placeholder' => '',
353
+ 'prepend' => '',
354
+ 'append' => '',
355
+ 'maxlength' => '',
356
+ 'value' => $option['option_value'],
357
+ 'class' => 'code',
358
+ 'wrapper' => array(
359
+ 'width' => '',
360
+ 'class' => '',
361
+ 'id' => '',
362
+ ),
363
+ );
364
+
365
+ }
366
+
367
+ // Serialized || HTML
368
+ elseif(acfe_is_json($option['option_value'])){
369
+
370
+ $type = 'json';
371
+ $instructions = 'Use this <a href="http://solutions.weblite.ca/php2json/" target="_blank">online tool</a> to decode/encode json.';
372
+
373
+ $fields[] = array(
374
+ 'label' => __('Value <code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">' . $type . '</code>'),
375
+ 'key' => 'field_acfe_options_edit_value',
376
+ 'name' => 'field_acfe_options_edit_value',
377
+ 'type' => 'textarea',
378
+ 'prefix' => 'acf',
379
+ 'instructions' => $instructions,
380
+ 'required' => false,
381
+ 'conditional_logic' => false,
382
+ 'default_value' => '',
383
+ 'placeholder' => '',
384
+ 'prepend' => '',
385
+ 'append' => '',
386
+ 'maxlength' => '',
387
+ 'value' => $option['option_value'],
388
+ 'class' => 'code',
389
+ 'wrapper' => array(
390
+ 'width' => '',
391
+ 'class' => '',
392
+ 'id' => '',
393
+ ),
394
+ );
395
+
396
+ }
397
+
398
+ // String
399
+ else{
400
+
401
+ $type = '';
402
+ if(!empty($option['option_value']))
403
+ $type = '<code style="font-size:11px;float:right; line-height:1.2; margin-top:1px;">string</code>';
404
+
405
+ $fields[] = array(
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,
413
+ 'conditional_logic' => false,
414
+ 'default_value' => '',
415
+ 'placeholder' => '',
416
+ 'prepend' => '',
417
+ 'append' => '',
418
+ 'maxlength' => '',
419
+ 'value' => $option['option_value'],
420
+ 'wrapper' => array(
421
+ 'width' => '',
422
+ 'class' => '',
423
+ 'id' => '',
424
+ ),
425
+ );
426
+
427
+ }
428
+
429
+ $fields[] = array(
430
+ 'label' => __('Autoload'),
431
+ 'key' => 'field_acfe_options_edit_autoload',
432
+ 'name' => 'field_acfe_options_edit_autoload',
433
+ 'type' => 'select',
434
+ 'prefix' => 'acf',
435
+ 'instructions' => '',
436
+ 'required' => true,
437
+ 'conditional_logic' => false,
438
+ 'default_value' => '',
439
+ 'placeholder' => '',
440
+ 'prepend' => '',
441
+ 'append' => '',
442
+ 'maxlength' => '',
443
+ 'value' => $option['autoload'],
444
+ 'choices' => array(
445
+ 'no' => __('No'),
446
+ 'yes' => __('Yes'),
447
+ ),
448
+ 'wrapper' => array(
449
+ 'width' => '',
450
+ 'class' => '',
451
+ 'id' => '',
452
+ ),
453
+ );
454
+
455
+ $field_group['fields'] = $fields;
456
+
457
+ $metabox_submit_title = __('Submit','acf');
458
+ $metabox_main_title = __('Add Option');
459
+
460
+ if(!empty($option['option_id'])){
461
+
462
+ $metabox_submit_title = __('Edit','acf');
463
+ $metabox_main_title = __('Edit Option');
464
+
465
+ }
466
+
467
+ // Submit Metabox
468
+ add_meta_box('submitdiv', $metabox_submit_title, function($post, $args) use($option){
469
+
470
+ $delete_nonce = wp_create_nonce('acfe_options_delete_option');
471
+
472
+ ?>
473
+ <div id="major-publishing-actions">
474
+
475
+ <?php if(!empty($option['option_id'])){ ?>
476
+
477
+ <div id="delete-action">
478
+ <a class="submitdelete deletion" style="color:#a00;" href="<?php echo sprintf('?page=%s&action=%s&option=%s&_wpnonce=%s', esc_attr($_REQUEST['page']), 'delete', $option['option_id'], $delete_nonce); ?>"><?php _e('Delete'); ?></a>
479
+ </div>
480
+
481
+ <?php } ?>
482
+
483
+ <div id="publishing-action">
484
+ <span class="spinner"></span>
485
+ <input type="submit" accesskey="p" value="<?php _e('Update'); ?>" class="button button-primary button-large" id="publish" name="publish">
486
+ </div>
487
+
488
+ <div class="clear"></div>
489
+
490
+ </div>
491
+ <?php
492
+ }, 'acf_options_page', 'side', 'high');
493
+
494
+ // Main Metabox
495
+ add_meta_box('acf-group_acfe_options_edit', $metabox_main_title, function($post, $args){
496
+
497
+ // extract args
498
+ extract($args); // all variables from the add_meta_box function
499
+ extract($args); // all variables from the args argument
500
+
501
+ // vars
502
+ $o = array(
503
+ 'id' => $id,
504
+ 'key' => $field_group['key'],
505
+ 'style' => $field_group['style'],
506
+ 'label' => $field_group['label_placement'],
507
+ 'editLink' => '',
508
+ 'editTitle' => __('Edit field group', 'acf'),
509
+ 'visibility' => true
510
+ );
511
+
512
+ // load fields
513
+ $fields = $field_group['fields'];
514
+
515
+ // render
516
+ acf_render_fields($fields, 'acfe-options-edit', 'div', $field_group['instruction_placement']);
517
+
518
+ ?>
519
+ <script type="text/javascript">
520
+ if(typeof acf !== 'undefined'){
521
+
522
+ acf.newPostbox(<?php echo json_encode($o); ?>);
523
+
524
+ }
525
+ </script>
526
+ <?php
527
+
528
+ }, 'acf_options_page', 'normal', 'high', array('field_group' => $field_group));
529
+
530
+ }
531
+
532
+ /**
533
+ * Options Edit: Save
534
+ *
535
+ */
536
+ add_action('acf/save_post', 'acfe_options_edit_save_post', 5);
537
+ function acfe_options_edit_save_post($post_id){
538
+
539
+ // Validate
540
+ if($post_id !== 'acfe_options_edit')
541
+ return;
542
+
543
+ // Vars
544
+ $option_name = wp_unslash($_POST['acf']['field_acfe_options_edit_name']);
545
+ $option_value = wp_unslash($_POST['acf']['field_acfe_options_edit_value']);
546
+ $autoload = $_POST['acf']['field_acfe_options_edit_autoload'];
547
+
548
+ // Value serialized?
549
+ $option_value = maybe_unserialize($option_value);
550
+
551
+ // Update
552
+ update_option($option_name, $option_value, $autoload);
553
+
554
+ // Flush ACF
555
+ $_POST['acf'] = array();
556
+
557
+ }
558
+
559
+ /**
560
+ * Options Edit: Message
561
+ *
562
+ */
563
+ add_action('acfe/options/load/message=updated', 'acfe_options_load_edit_message');
564
+ function acfe_options_load_edit_message(){
565
+
566
+ acf_add_admin_notice(__('Option has been updated'), 'success');
567
+
568
+ }
569
+
570
+ /**
571
+ * Options Add: Message
572
+ *
573
+ */
574
+ add_action('acfe/options/load/message=added', 'acfe_options_load_add_message');
575
+ function acfe_options_load_add_message(){
576
+
577
+ acf_add_admin_notice(__('Option has been added'), 'success');
578
+
579
  }
includes/admin/plugins.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- /**
7
- * Admin: Plugins Tab
8
- */
9
- add_filter('install_plugins_tabs', 'acfe_admin_plugins_tabs');
10
- function acfe_admin_plugins_tabs($tabs){
11
-
12
- $tabs['acf'] = __('Advanced Custom Fields');
13
-
14
- return $tabs;
15
-
16
- }
17
-
18
- /**
19
- * Admin: Plugins Args
20
- */
21
- add_filter('install_plugins_table_api_args_acf', 'acfe_admin_plugins_args');
22
- function acfe_admin_plugins_args($args){
23
-
24
- global $paged;
25
-
26
- $args['search'] = 'acf';
27
- $args['page'] = $paged;
28
- $args['per_page'] = 12;
29
-
30
- return $args;
31
-
32
- }
33
-
34
- /**
35
- * Admin: Plugins HTML
36
- */
37
- add_action('install_plugins_acf', 'acfe_admin_plugins_html');
38
- function acfe_admin_plugins_html(){
39
-
40
- display_plugins_table();
41
-
42
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * Admin: Plugins Tab
8
+ */
9
+ add_filter('install_plugins_tabs', 'acfe_admin_plugins_tabs');
10
+ function acfe_admin_plugins_tabs($tabs){
11
+
12
+ $tabs['acf'] = __('Advanced Custom Fields');
13
+
14
+ return $tabs;
15
+
16
+ }
17
+
18
+ /**
19
+ * Admin: Plugins Args
20
+ */
21
+ add_filter('install_plugins_table_api_args_acf', 'acfe_admin_plugins_args');
22
+ function acfe_admin_plugins_args($args){
23
+
24
+ global $paged;
25
+
26
+ $args['search'] = 'acf';
27
+ $args['page'] = $paged;
28
+ $args['per_page'] = 12;
29
+
30
+ return $args;
31
+
32
+ }
33
+
34
+ /**
35
+ * Admin: Plugins HTML
36
+ */
37
+ add_action('install_plugins_acf', 'acfe_admin_plugins_html');
38
+ function acfe_admin_plugins_html(){
39
+
40
+ display_plugins_table();
41
+
42
  }
includes/admin/tools/fg-local.php CHANGED
@@ -1,324 +1,324 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('ACFE_Admin_Tool_FG_Local_Export')):
7
-
8
- class ACFE_Admin_Tool_FG_Local extends ACF_Admin_Tool{
9
-
10
- function initialize(){
11
-
12
- // vars
13
- $this->title = __('Export Local Field Groups');
14
- $this->name = 'acfe-fg-local';
15
- $this->icon = 'dashicons-upload';
16
-
17
- }
18
-
19
- function load(){
20
-
21
- if($ids = acf_maybe_get_GET('acfe-fg-local-sync')){
22
-
23
- $ids = explode('+', $ids);
24
-
25
- // Count number of imported field groups.
26
- $total = count($ids);
27
-
28
- // Generate text.
29
- $text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
30
-
31
- // Add links to text.
32
- $links = array();
33
- foreach( $ids as $id ) {
34
- $links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
35
- }
36
- $text .= ' ' . implode( ', ', $links );
37
-
38
- // Add notice
39
- acf_add_admin_notice($text, 'success');
40
-
41
- }
42
-
43
- if($this->is_active()){
44
-
45
- $array = $this->get_selected();
46
- $keys = $this->get_selected_keys();
47
- $action = $this->get_action();
48
-
49
- // validate
50
- if($array === false)
51
- return acf_add_admin_notice(__('No field group selected'), 'warning');
52
-
53
- // Json
54
- if($action === 'json'){
55
-
56
- // Slugs
57
- $slugs = implode('-', $keys);
58
-
59
- // Date
60
- $date = date('Y-m-d');
61
-
62
- // file
63
- $file_name = 'acfe-export-local-' . $slugs . '-' . $date . '.json';
64
-
65
- // headers
66
- header("Content-Description: File Transfer");
67
- header("Content-Disposition: attachment; filename={$file_name}");
68
- header("Content-Type: application/json; charset=utf-8");
69
-
70
- // return
71
- echo acf_json_encode($array);
72
- die;
73
-
74
- }
75
-
76
- // Sync
77
- elseif($action === 'sync'){
78
-
79
- if(isset($array['key']))
80
- $array = array($array);
81
-
82
- // Remeber imported field group ids.
83
- $ids = array();
84
-
85
- // Loop over json
86
- foreach( $array as $field_group ) {
87
-
88
- // Search database for existing field group.
89
- $post = acf_get_field_group_post( $field_group['key'] );
90
- if( $post ) {
91
- $field_group['ID'] = $post->ID;
92
- }
93
-
94
- // Import field group.
95
- $field_group = acf_import_field_group( $field_group );
96
-
97
- // append message
98
- $ids[] = $field_group['ID'];
99
-
100
- }
101
-
102
- // url
103
- $url = add_query_arg('acfe-fg-local-sync', implode('+', $ids), acf_get_admin_tools_url());
104
-
105
- // redirect
106
- wp_redirect($url);
107
- exit;
108
-
109
- }
110
-
111
- }
112
-
113
- }
114
-
115
- function html(){
116
-
117
- if($this->is_active()){
118
-
119
- $array = $this->get_selected();
120
- $action = $this->get_action();
121
-
122
- ?>
123
- <div class="acf-postbox-columns">
124
- <div class="acf-postbox-main">
125
-
126
- <?php
127
- // prevent default translation and fake __() within string
128
- acf_update_setting('l10n_var_export', true);
129
-
130
- // vars
131
- $json = $array;
132
-
133
- $str_replace = array(
134
- " " => "\t",
135
- "'!!__(!!\'" => "__('",
136
- "!!\', !!\'" => "', '",
137
- "!!\')!!'" => "')",
138
- "array (" => "array("
139
- );
140
-
141
- $preg_replace = array(
142
- '/([\t\r\n]+?)array/' => 'array',
143
- '/[0-9]+ => array/' => 'array'
144
- );
145
-
146
-
147
- ?>
148
- <p><?php _e("The following code can be used to register a local version of the selected field group(s). A local field group can provide many benefits such as faster load times, version control & dynamic fields/settings. Simply copy and paste the following code to your theme's functions.php file or include it within an external file.", 'acf'); ?></p>
149
-
150
- <div id="acf-admin-tool-export">
151
-
152
- <textarea id="acf-export-textarea" readonly="true"><?php
153
-
154
- echo "if( function_exists('acf_add_local_field_group') ):" . "\r\n" . "\r\n";
155
-
156
- foreach( $json as $field_group ) {
157
-
158
- // code
159
- $code = var_export($field_group, true);
160
-
161
-
162
- // change double spaces to tabs
163
- $code = str_replace( array_keys($str_replace), array_values($str_replace), $code );
164
-
165
-
166
- // correctly formats "=> array("
167
- $code = preg_replace( array_keys($preg_replace), array_values($preg_replace), $code );
168
-
169
-
170
- // esc_textarea
171
- $code = esc_textarea( $code );
172
-
173
-
174
- // echo
175
- echo "acf_add_local_field_group({$code});" . "\r\n" . "\r\n";
176
-
177
- }
178
-
179
- echo "endif;";
180
-
181
- ?></textarea>
182
-
183
- </div>
184
-
185
- <p class="acf-submit">
186
- <a class="button" id="acf-export-copy"><?php _e( 'Copy to clipboard', 'acf' ); ?></a>
187
- </p>
188
- <script type="text/javascript">
189
- (function($){
190
-
191
- // vars
192
- var $a = $('#acf-export-copy');
193
- var $textarea = $('#acf-export-textarea');
194
-
195
-
196
- // remove $a if 'copy' is not supported
197
- if( !document.queryCommandSupported('copy') ) {
198
- return $a.remove();
199
- }
200
-
201
-
202
- // event
203
- $a.on('click', function( e ){
204
-
205
- // prevent default
206
- e.preventDefault();
207
-
208
-
209
- // select
210
- $textarea.get(0).select();
211
-
212
-
213
- // try
214
- try {
215
-
216
- // copy
217
- var copy = document.execCommand('copy');
218
- if( !copy ) return;
219
-
220
-
221
- // tooltip
222
- acf.newTooltip({
223
- text: "<?php _e('Copied', 'acf' ); ?>",
224
- timeout: 250,
225
- target: $(this),
226
- });
227
-
228
- } catch (err) {
229
-
230
- // do nothing
231
-
232
- }
233
-
234
- });
235
-
236
- })(jQuery);
237
- </script>
238
- </div>
239
- </div>
240
- <?php
241
-
242
- }
243
-
244
- }
245
-
246
- function get_selected(){
247
-
248
- // vars
249
- $selected = $this->get_selected_keys();
250
-
251
- if(!$selected)
252
- return false;
253
-
254
- // Return
255
- $array = array();
256
-
257
- // Enable filters
258
- acf_enable_filters();
259
-
260
- // Disable fitler: clone
261
- acf_disable_filter('clone');
262
-
263
- foreach($selected as $field_group_key){
264
-
265
- $field_group = acf_get_field_group($field_group_key);
266
-
267
- // validate field group
268
- if(empty($field_group))
269
- continue;
270
-
271
- // load fields
272
- $field_group['fields'] = acf_get_fields($field_group);
273
-
274
- // prepare for export
275
- $field_group = acf_prepare_field_group_for_export($field_group);
276
-
277
- $array[] = $field_group;
278
-
279
- }
280
-
281
- // return
282
- return $array;
283
-
284
- }
285
-
286
- function get_selected_keys(){
287
-
288
- // check $_POST
289
- if($keys = acf_maybe_get_POST('keys'))
290
- return (array) $keys;
291
-
292
- // check $_GET
293
- if($keys = acf_maybe_get_GET('keys')){
294
-
295
- $keys = str_replace(' ', '+', $keys);
296
- return explode('+', $keys);
297
-
298
- }
299
-
300
- // return
301
- return false;
302
-
303
- }
304
-
305
- function get_action(){
306
-
307
- // check $_POST
308
- if($action = acf_maybe_get_POST('action'))
309
- return $action;
310
-
311
- // check $_GET
312
- if($action = acf_maybe_get_GET('action'))
313
- return $action;
314
-
315
- // return
316
- return 'json';
317
-
318
- }
319
-
320
- }
321
-
322
- acf_register_admin_tool('ACFE_Admin_Tool_FG_Local');
323
-
324
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('ACFE_Admin_Tool_FG_Local_Export')):
7
+
8
+ class ACFE_Admin_Tool_FG_Local extends ACF_Admin_Tool{
9
+
10
+ function initialize(){
11
+
12
+ // vars
13
+ $this->title = __('Export Local Field Groups');
14
+ $this->name = 'acfe-fg-local';
15
+ $this->icon = 'dashicons-upload';
16
+
17
+ }
18
+
19
+ function load(){
20
+
21
+ if($ids = acf_maybe_get_GET('acfe-fg-local-sync')){
22
+
23
+ $ids = explode('+', $ids);
24
+
25
+ // Count number of imported field groups.
26
+ $total = count($ids);
27
+
28
+ // Generate text.
29
+ $text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total );
30
+
31
+ // Add links to text.
32
+ $links = array();
33
+ foreach( $ids as $id ) {
34
+ $links[] = '<a href="' . get_edit_post_link( $id ) . '">' . get_the_title( $id ) . '</a>';
35
+ }
36
+ $text .= ' ' . implode( ', ', $links );
37
+
38
+ // Add notice
39
+ acf_add_admin_notice($text, 'success');
40
+
41
+ }
42
+
43
+ if($this->is_active()){
44
+
45
+ $array = $this->get_selected();
46
+ $keys = $this->get_selected_keys();
47
+ $action = $this->get_action();
48
+
49
+ // validate
50
+ if($array === false)
51
+ return acf_add_admin_notice(__('No field group selected'), 'warning');
52
+
53
+ // Json
54
+ if($action === 'json'){
55
+
56
+ // Slugs
57
+ $slugs = implode('-', $keys);
58
+
59
+ // Date
60
+ $date = date('Y-m-d');
61
+
62
+ // file
63
+ $file_name = 'acfe-export-local-' . $slugs . '-' . $date . '.json';
64
+
65
+ // headers
66
+ header("Content-Description: File Transfer");
67
+ header("Content-Disposition: attachment; filename={$file_name}");
68
+ header("Content-Type: application/json; charset=utf-8");
69
+
70
+ // return
71
+ echo acf_json_encode($array);
72
+ die;
73
+
74
+ }
75
+
76
+ // Sync
77
+ elseif($action === 'sync'){
78
+
79
+ if(isset($array['key']))
80
+ $array = array($array);
81
+
82
+ // Remeber imported field group ids.
83
+ $ids = array();
84
+
85
+ // Loop over json
86
+ foreach( $array as $field_group ) {
87
+
88
+ // Search database for existing field group.
89
+ $post = acf_get_field_group_post( $field_group['key'] );
90
+ if( $post ) {
91
+ $field_group['ID'] = $post->ID;
92
+ }
93
+
94
+ // Import field group.
95
+ $field_group = acf_import_field_group( $field_group );
96
+
97
+ // append message
98
+ $ids[] = $field_group['ID'];
99
+
100
+ }
101
+
102
+ // url
103
+ $url = add_query_arg('acfe-fg-local-sync', implode('+', $ids), acf_get_admin_tools_url());
104
+
105
+ // redirect
106
+ wp_redirect($url);
107
+ exit;
108
+
109
+ }
110
+
111
+ }
112
+
113
+ }
114
+
115
+ function html(){
116
+
117
+ if($this->is_active()){
118
+
119
+ $array = $this->get_selected();
120
+ $action = $this->get_action();
121
+
122
+ ?>
123
+ <div class="acf-postbox-columns">
124
+ <div class="acf-postbox-main">
125
+
126
+ <?php
127
+ // prevent default translation and fake __() within string
128
+ acf_update_setting('l10n_var_export', true);
129
+
130
+ // vars
131
+ $json = $array;
132
+
133
+ $str_replace = array(
134
+ " " => "\t",
135
+ "'!!__(!!\'" => "__('",
136
+ "!!\', !!\'" => "', '",
137
+ "!!\')!!'" => "')",
138
+ "array (" => "array("
139
+ );
140
+
141
+ $preg_replace = array(
142
+ '/([\t\r\n]+?)array/' => 'array',
143
+ '/[0-9]+ => array/' => 'array'
144
+ );
145
+
146
+
147
+ ?>
148
+ <p><?php _e("The following code can be used to register a local version of the selected field group(s). A local field group can provide many benefits such as faster load times, version control & dynamic fields/settings. Simply copy and paste the following code to your theme's functions.php file or include it within an external file.", 'acf'); ?></p>
149
+
150
+ <div id="acf-admin-tool-export">
151
+
152
+ <textarea id="acf-export-textarea" readonly="true"><?php
153
+
154
+ echo "if( function_exists('acf_add_local_field_group') ):" . "\r\n" . "\r\n";
155
+
156
+ foreach( $json as $field_group ) {
157
+
158
+ // code
159
+ $code = var_export($field_group, true);
160
+
161
+
162
+ // change double spaces to tabs
163
+ $code = str_replace( array_keys($str_replace), array_values($str_replace), $code );
164
+
165
+
166
+ // correctly formats "=> array("
167
+ $code = preg_replace( array_keys($preg_replace), array_values($preg_replace), $code );
168
+
169
+
170
+ // esc_textarea
171
+ $code = esc_textarea( $code );
172
+
173
+
174
+ // echo
175
+ echo "acf_add_local_field_group({$code});" . "\r\n" . "\r\n";
176
+
177
+ }
178
+
179
+ echo "endif;";
180
+
181
+ ?></textarea>
182
+
183
+ </div>
184
+
185
+ <p class="acf-submit">
186
+ <a class="button" id="acf-export-copy"><?php _e( 'Copy to clipboard', 'acf' ); ?></a>
187
+ </p>
188
+ <script type="text/javascript">
189
+ (function($){
190
+
191
+ // vars
192
+ var $a = $('#acf-export-copy');
193
+ var $textarea = $('#acf-export-textarea');
194
+
195
+
196
+ // remove $a if 'copy' is not supported
197
+ if( !document.queryCommandSupported('copy') ) {
198
+ return $a.remove();
199
+ }
200
+
201
+
202
+ // event
203
+ $a.on('click', function( e ){
204
+
205
+ // prevent default
206
+ e.preventDefault();
207
+
208
+
209
+ // select
210
+ $textarea.get(0).select();
211
+
212
+
213
+ // try
214
+ try {
215
+
216
+ // copy
217
+ var copy = document.execCommand('copy');
218
+ if( !copy ) return;
219
+
220
+
221
+ // tooltip
222
+ acf.newTooltip({
223
+ text: "<?php _e('Copied', 'acf' ); ?>",
224
+ timeout: 250,
225
+ target: $(this),
226
+ });
227
+
228
+ } catch (err) {
229
+
230
+ // do nothing
231
+
232
+ }
233
+
234
+ });
235
+
236
+ })(jQuery);
237
+ </script>
238
+ </div>
239
+ </div>
240
+ <?php
241
+
242
+ }
243
+
244
+ }
245
+
246
+ function get_selected(){
247
+
248
+ // vars
249
+ $selected = $this->get_selected_keys();
250
+
251
+ if(!$selected)
252
+ return false;
253
+
254
+ // Return
255
+ $array = array();
256
+
257
+ // Enable filters
258
+ acf_enable_filters();
259
+
260
+ // Disable fitler: clone
261
+ acf_disable_filter('clone');
262
+
263
+ foreach($selected as $field_group_key){
264
+
265
+ $field_group = acf_get_field_group($field_group_key);
266
+
267
+ // validate field group
268
+ if(empty($field_group))
269
+ continue;
270
+
271
+ // load fields
272
+ $field_group['fields'] = acf_get_fields($field_group);
273
+
274
+ // prepare for export
275
+ $field_group = acf_prepare_field_group_for_export($field_group);
276
+
277
+ $array[] = $field_group;
278
+
279
+ }
280
+
281
+ // return
282
+ return $array;
283
+
284
+ }
285
+
286
+ function get_selected_keys(){
287
+
288
+ // check $_POST
289
+ if($keys = acf_maybe_get_POST('keys'))
290
+ return (array) $keys;
291
+
292
+ // check $_GET
293
+ if($keys = acf_maybe_get_GET('keys')){
294
+
295
+ $keys = str_replace(' ', '+', $keys);
296
+ return explode('+', $keys);
297
+
298
+ }
299
+
300
+ // return
301
+ return false;
302
+
303
+ }
304
+
305
+ function get_action(){
306
+
307
+ // check $_POST
308
+ if($action = acf_maybe_get_POST('action'))
309
+ return $action;
310
+
311
+ // check $_GET
312
+ if($action = acf_maybe_get_GET('action'))
313
+ return $action;
314
+
315
+ // return
316
+ return 'json';
317
+
318
+ }
319
+
320
+ }
321
+
322
+ acf_register_admin_tool('ACFE_Admin_Tool_FG_Local');
323
+
324
  endif;
includes/admin/views/html-options-edit.php CHANGED
@@ -1,61 +1,61 @@
1
- <div class="wrap acf-settings-wrap">
2
-
3
- <?php
4
- $title = __('Edit Option');
5
- if($_REQUEST['action'] === 'add')
6
- $title = __('Add Option');
7
- ?>
8
- <h1 class="wp-heading-inline"><?php echo $title; ?></h1>
9
-
10
- <hr class="wp-header-end" />
11
-
12
- <form id="post" method="post" name="post">
13
-
14
- <?php
15
-
16
- // render post data
17
- acf_form_data(array(
18
- 'screen' => 'acfe-options-edit',
19
- 'post_id' => 'acfe_options_edit',
20
- ));
21
-
22
- wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
23
- wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
24
-
25
- ?>
26
-
27
- <div id="poststuff">
28
-
29
- <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
30
-
31
- <!--
32
- <div id="post-body-content">
33
- <div id="titlediv">
34
- <div id="titlewrap">
35
- <input type="text" name="post_title" size="30" value="Post 4" id="title" spellcheck="true" autocomplete="off" />
36
- </div>
37
- </div>
38
- </div>
39
- -->
40
-
41
- <div id="postbox-container-1" class="postbox-container">
42
-
43
- <?php do_meta_boxes('acf_options_page', 'side', null); ?>
44
-
45
- </div>
46
-
47
- <div id="postbox-container-2" class="postbox-container">
48
-
49
- <?php do_meta_boxes('acf_options_page', 'normal', null); ?>
50
-
51
- </div>
52
-
53
- </div>
54
-
55
- <br class="clear" />
56
-
57
- </div>
58
-
59
- </form>
60
-
61
  </div>
1
+ <div class="wrap acf-settings-wrap">
2
+
3
+ <?php
4
+ $title = __('Edit Option');
5
+ if($_REQUEST['action'] === 'add')
6
+ $title = __('Add Option');
7
+ ?>
8
+ <h1 class="wp-heading-inline"><?php echo $title; ?></h1>
9
+
10
+ <hr class="wp-header-end" />
11
+
12
+ <form id="post" method="post" name="post">
13
+
14
+ <?php
15
+
16
+ // render post data
17
+ acf_form_data(array(
18
+ 'screen' => 'acfe-options-edit',
19
+ 'post_id' => 'acfe_options_edit',
20
+ ));
21
+
22
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
23
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
24
+
25
+ ?>
26
+
27
+ <div id="poststuff">
28
+
29
+ <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
30
+
31
+ <!--
32
+ <div id="post-body-content">
33
+ <div id="titlediv">
34
+ <div id="titlewrap">
35
+ <input type="text" name="post_title" size="30" value="Post 4" id="title" spellcheck="true" autocomplete="off" />
36
+ </div>
37
+ </div>
38
+ </div>
39
+ -->
40
+
41
+ <div id="postbox-container-1" class="postbox-container">
42
+
43
+ <?php do_meta_boxes('acf_options_page', 'side', null); ?>
44
+
45
+ </div>
46
+
47
+ <div id="postbox-container-2" class="postbox-container">
48
+
49
+ <?php do_meta_boxes('acf_options_page', 'normal', null); ?>
50
+
51
+ </div>
52
+
53
+ </div>
54
+
55
+ <br class="clear" />
56
+
57
+ </div>
58
+
59
+ </form>
60
+
61
  </div>
includes/admin/views/html-options-list.php CHANGED
@@ -1,38 +1,38 @@
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" />
7
-
8
- <div id="poststuff">
9
-
10
- <div id="post-body" class="metabox-holder">
11
- <div id="post-body-content">
12
- <div class="meta-box-sortables ui-sortable">
13
- <form method="post">
14
-
15
- <?php
16
-
17
- // WP List
18
- $acfe_options_list = new ACFE_Admin_Options_List();
19
-
20
- // Prepare items
21
- $acfe_options_list->prepare_items();
22
-
23
- $acfe_options_list->search_box('Search', 'search');
24
-
25
- $acfe_options_list->display();
26
-
27
- ?>
28
-
29
- </form>
30
- </div>
31
- </div>
32
- </div>
33
-
34
- <br class="clear" />
35
-
36
- </div>
37
-
38
  </div>
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" />
7
+
8
+ <div id="poststuff">
9
+
10
+ <div id="post-body" class="metabox-holder">
11
+ <div id="post-body-content">
12
+ <div class="meta-box-sortables ui-sortable">
13
+ <form method="post">
14
+
15
+ <?php
16
+
17
+ // WP List
18
+ $acfe_options_list = new ACFE_Admin_Options_List();
19
+
20
+ // Prepare items
21
+ $acfe_options_list->prepare_items();
22
+
23
+ $acfe_options_list->search_box('Search', 'search');
24
+
25
+ $acfe_options_list->display();
26
+
27
+ ?>
28
+
29
+ </form>
30
+ </div>
31
+ </div>
32
+ </div>
33
+
34
+ <br class="clear" />
35
+
36
+ </div>
37
+
38
  </div>
includes/core/menu.php CHANGED
@@ -1,106 +1,123 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- add_action('admin_menu', 'acfe_admin_settings_submenu_swap', 999);
7
- function acfe_admin_settings_submenu_swap(){
8
-
9
- global $submenu;
10
-
11
- if(!acf_maybe_get($submenu, 'edit.php?post_type=acf-field-group'))
12
- return;
13
-
14
- $_submenu = $submenu['edit.php?post_type=acf-field-group'];
15
- $array = array();
16
-
17
- foreach($submenu['edit.php?post_type=acf-field-group'] as $k => $item){
18
-
19
- // Field Groups
20
- if($item[2] === 'edit.php?post_type=acf-field-group'){
21
-
22
- $array[0] = $item;
23
- unset($_submenu[$k]);
24
-
25
- }
26
-
27
- // Add New
28
- elseif($item[2] === 'post-new.php?post_type=acf-field-group'){
29
-
30
- $array[1] = $item;
31
- unset($_submenu[$k]);
32
-
33
- }
34
-
35
- // Categories
36
- elseif($item[2] === 'edit-tags.php?taxonomy=acf-field-group-category'){
37
-
38
- $array[2] = $item;
39
- unset($_submenu[$k]);
40
-
41
- }
42
-
43
- // Block Types
44
- elseif($item[2] === 'edit.php?post_type=acfe-dbt'){
45
-
46
- $array[3] = $item;
47
- unset($_submenu[$k]);
48
-
49
- }
50
-
51
- // Forms
52
- elseif($item[2] === 'edit.php?post_type=acfe-form'){
53
-
54
- $array[4] = $item;
55
- unset($_submenu[$k]);
56
-
57
- }
58
-
59
- // Options
60
- elseif($item[2] === 'edit.php?post_type=acfe-dop'){
61
-
62
- $array[5] = $item;
63
- unset($_submenu[$k]);
64
-
65
- }
66
-
67
- // Settings
68
- elseif($item[2] === 'acfe-settings'){
69
-
70
- $array[6] = $item;
71
- unset($_submenu[$k]);
72
-
73
- }
74
-
75
- // Tools
76
- elseif($item[2] === 'acf-tools'){
77
-
78
- $array[7] = $item;
79
- unset($_submenu[$k]);
80
-
81
- }
82
-
83
- // Updates
84
- elseif($item[2] === 'acf-settings-updates'){
85
-
86
- $array[8] = $item;
87
- unset($_submenu[$k]);
88
-
89
- }
90
-
91
- }
92
-
93
- // Sort
94
- ksort($array);
95
-
96
- // Default submenu
97
- $submenu['edit.php?post_type=acf-field-group'] = $array;
98
-
99
- // Add items left
100
- if(!empty($_submenu)){
101
-
102
- $submenu['edit.php?post_type=acf-field-group'] = array_merge($array, $_submenu);
103
-
104
- }
105
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_action('current_screen', 'acfe_screen_header');
7
+ function acfe_screen_header($screen){
8
+
9
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9'))
10
+ return;
11
+
12
+ if(!acf_is_screen(array('edit-acf-field-group-category', 'edit-acfe-dbt', 'acfe-dbt', 'edit-acfe-dop', 'acfe-dop', 'edit-acfe-template', 'acfe-template', 'edit-acfe-form', 'acfe-form')))
13
+ return;
14
+
15
+ add_action('in_admin_header', function(){
16
+
17
+ acf_get_view('html-admin-navigation');
18
+
19
+ });
20
+
21
+ }
22
+
23
+ add_action('admin_menu', 'acfe_admin_settings_submenu_swap', 999);
24
+ function acfe_admin_settings_submenu_swap(){
25
+
26
+ global $submenu;
27
+
28
+ if(!acf_maybe_get($submenu, 'edit.php?post_type=acf-field-group'))
29
+ return;
30
+
31
+ $_submenu = $submenu['edit.php?post_type=acf-field-group'];
32
+ $array = array();
33
+
34
+ foreach($submenu['edit.php?post_type=acf-field-group'] as $k => $item){
35
+
36
+ // Field Groups
37
+ if($item[2] === 'edit.php?post_type=acf-field-group'){
38
+
39
+ $array[0] = $item;
40
+ unset($_submenu[$k]);
41
+
42
+ }
43
+
44
+ // Add New
45
+ elseif($item[2] === 'post-new.php?post_type=acf-field-group'){
46
+
47
+ $array[1] = $item;
48
+ unset($_submenu[$k]);
49
+
50
+ }
51
+
52
+ // Categories
53
+ elseif($item[2] === 'edit-tags.php?taxonomy=acf-field-group-category'){
54
+
55
+ $array[2] = $item;
56
+ unset($_submenu[$k]);
57
+
58
+ }
59
+
60
+ // Block Types
61
+ elseif($item[2] === 'edit.php?post_type=acfe-dbt'){
62
+
63
+ $array[3] = $item;
64
+ unset($_submenu[$k]);
65
+
66
+ }
67
+
68
+ // Forms
69
+ elseif($item[2] === 'edit.php?post_type=acfe-form'){
70
+
71
+ $array[4] = $item;
72
+ unset($_submenu[$k]);
73
+
74
+ }
75
+
76
+ // Options
77
+ elseif($item[2] === 'edit.php?post_type=acfe-dop'){
78
+
79
+ $array[5] = $item;
80
+ unset($_submenu[$k]);
81
+
82
+ }
83
+
84
+ // Settings
85
+ elseif($item[2] === 'acfe-settings'){
86
+
87
+ $array[6] = $item;
88
+ unset($_submenu[$k]);
89
+
90
+ }
91
+
92
+ // Tools
93
+ elseif($item[2] === 'acf-tools'){
94
+
95
+ $array[7] = $item;
96
+ unset($_submenu[$k]);
97
+
98
+ }
99
+
100
+ // Updates
101
+ elseif($item[2] === 'acf-settings-updates'){
102
+
103
+ $array[8] = $item;
104
+ unset($_submenu[$k]);
105
+
106
+ }
107
+
108
+ }
109
+
110
+ // Sort
111
+ ksort($array);
112
+
113
+ // Default submenu
114
+ $submenu['edit.php?post_type=acf-field-group'] = $array;
115
+
116
+ // Add items left
117
+ if(!empty($_submenu)){
118
+
119
+ $submenu['edit.php?post_type=acf-field-group'] = array_merge($array, $_submenu);
120
+
121
+ }
122
+
123
  }
includes/field-groups/field-group-category.php CHANGED
@@ -1,147 +1,147 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- add_action('init', 'acfe_field_group_category_register');
7
- function acfe_field_group_category_register(){
8
-
9
- register_taxonomy('acf-field-group-category', array('acf-field-group'), array(
10
- 'hierarchical' => true,
11
- 'public' => false,
12
- 'show_ui' => 'ACFE',
13
- 'show_admin_column' => true,
14
- 'show_in_menu' => true,
15
- 'show_in_nav_menus' => true,
16
- 'show_tagcloud' => false,
17
- 'rewrite' => false,
18
- 'labels' => array(
19
- 'name' => _x('Categories', 'Category'),
20
- 'singular_name' => _x('Categories', 'Category'),
21
- 'search_items' => __('Search categories', 'acfe'),
22
- 'all_items' => __('All categories', 'acfe'),
23
- 'parent_item' => __('Parent category', 'acfe'),
24
- 'parent_item_colon' => __('Parent category:', 'acfe'),
25
- 'edit_item' => __('Edit category', 'acfe'),
26
- 'update_item' => __('Update category', 'acfe'),
27
- 'add_new_item' => __('Add New category', 'acfe'),
28
- 'new_item_name' => __('New category name', 'acfe'),
29
- 'menu_name' => __('category', 'acfe'),
30
- ),
31
- ));
32
-
33
- }
34
-
35
- add_action('admin_menu', 'acfe_field_group_category_submenu');
36
- function acfe_field_group_category_submenu(){
37
-
38
- if(!acf_get_setting('show_admin'))
39
- return;
40
-
41
- add_submenu_page('edit.php?post_type=acf-field-group', __('Categories'), __('Categories'), acf_get_setting('capability'), 'edit-tags.php?taxonomy=acf-field-group-category');
42
-
43
- }
44
-
45
- add_filter('parent_file', 'acfe_field_group_category_submenu_highlight');
46
- function acfe_field_group_category_submenu_highlight($parent_file){
47
-
48
- global $submenu_file, $current_screen, $pagenow;
49
-
50
- if($current_screen->taxonomy === 'acf-field-group-category' && ($pagenow === 'edit-tags.php' || $pagenow === 'term.php'))
51
- $parent_file = 'edit.php?post_type=acf-field-group';
52
-
53
- return $parent_file;
54
-
55
- }
56
-
57
- add_filter('manage_edit-acf-field-group_columns', 'acfe_field_group_category_column', 11);
58
- function acfe_field_group_category_column($columns){
59
-
60
- $new_columns = array();
61
- foreach($columns as $key => $value) {
62
- if($key === 'title')
63
- $new_columns['acf-field-group-category'] = __('Categories');
64
-
65
- $new_columns[$key] = $value;
66
- }
67
-
68
- return $new_columns;
69
-
70
- }
71
-
72
- add_action('manage_acf-field-group_posts_custom_column' , 'acfe_field_group_category_column_html', 10, 2);
73
- function acfe_field_group_category_column_html($column, $post_id){
74
-
75
- if($column === 'acf-field-group-category'){
76
- if(!$terms = get_the_terms($post_id, 'acf-field-group-category')){
77
- echo '—';
78
- return;
79
- }
80
-
81
- $categories = array();
82
- foreach($terms as $term){
83
- $categories[] = '<a href="' . admin_url('edit.php?acf-field-group-category='.$term->slug.'&post_type=acf-field-group') . '">' . $term->name . '</a>';
84
- }
85
-
86
- echo implode(' ', $categories);
87
- }
88
-
89
- }
90
-
91
- add_filter('views_edit-acf-field-group', 'acfe_field_group_category_views', 9);
92
- function acfe_field_group_category_views($views){
93
-
94
- if(!$terms = get_terms('acf-field-group-category', array('hide_empty' => false)))
95
- return $views;
96
-
97
- foreach($terms as $term){
98
-
99
- $groups = get_posts( array(
100
- 'post_type' => 'acf-field-group',
101
- 'posts_per_page' => -1,
102
- 'suppress_filters' => false,
103
- 'post_status' => array('publish', 'acf-disabled'),
104
- 'taxonomy' => 'acf-field-group-category',
105
- 'term' => $term->slug,
106
- 'fields' => 'ids'
107
- ));
108
-
109
- $count = count($groups);
110
-
111
- $html = '';
112
- if($count > 0)
113
- $html = ' <span class="count">(' . $count . ')</span>';
114
-
115
- global $wp_query;
116
- $class = '';
117
- if(isset($wp_query->query_vars['acf-field-group-category']) && $wp_query->query_vars['acf-field-group-category'] === $term->slug)
118
- $class = ' class="current"';
119
-
120
- $views['category-' . $term->slug] = '<a href="' . admin_url('edit.php?acf-field-group-category=' . $term->slug . '&post_type=acf-field-group') . '"' . $class . '>' . $term->name . $html . '</a>';
121
- }
122
-
123
- return $views;
124
-
125
- }
126
-
127
- /**
128
- * ACF Exclude Field Group Category from available taxonomies
129
- */
130
- add_filter('acf/get_taxonomies', 'acfe_field_group_category_exclude', 10, 2);
131
- function acfe_field_group_category_exclude($taxonomies, $args){
132
-
133
- if(empty($taxonomies))
134
- return $taxonomies;
135
-
136
- foreach($taxonomies as $k => $taxonomy){
137
-
138
- if($taxonomy != 'acf-field-group-category')
139
- continue;
140
-
141
- unset($taxonomies[$k]);
142
-
143
- }
144
-
145
- return $taxonomies;
146
-
147
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_action('init', 'acfe_field_group_category_register');
7
+ function acfe_field_group_category_register(){
8
+
9
+ register_taxonomy('acf-field-group-category', array('acf-field-group'), array(
10
+ 'hierarchical' => true,
11
+ 'public' => false,
12
+ 'show_ui' => 'ACFE',
13
+ 'show_admin_column' => true,
14
+ 'show_in_menu' => true,
15
+ 'show_in_nav_menus' => true,
16
+ 'show_tagcloud' => false,
17
+ 'rewrite' => false,
18
+ 'labels' => array(
19
+ 'name' => _x('Categories', 'Category'),
20
+ 'singular_name' => _x('Categories', 'Category'),
21
+ 'search_items' => __('Search categories', 'acfe'),
22
+ 'all_items' => __('All categories', 'acfe'),
23
+ 'parent_item' => __('Parent category', 'acfe'),
24
+ 'parent_item_colon' => __('Parent category:', 'acfe'),
25
+ 'edit_item' => __('Edit category', 'acfe'),
26
+ 'update_item' => __('Update category', 'acfe'),
27
+ 'add_new_item' => __('Add New category', 'acfe'),
28
+ 'new_item_name' => __('New category name', 'acfe'),
29
+ 'menu_name' => __('category', 'acfe'),
30
+ ),
31
+ ));
32
+
33
+ }
34
+
35
+ add_action('admin_menu', 'acfe_field_group_category_submenu');
36
+ function acfe_field_group_category_submenu(){
37
+
38
+ if(!acf_get_setting('show_admin'))
39
+ return;
40
+
41
+ add_submenu_page('edit.php?post_type=acf-field-group', __('Categories'), __('Categories'), acf_get_setting('capability'), 'edit-tags.php?taxonomy=acf-field-group-category');
42
+
43
+ }
44
+
45
+ add_filter('parent_file', 'acfe_field_group_category_submenu_highlight');
46
+ function acfe_field_group_category_submenu_highlight($parent_file){
47
+
48
+ global $submenu_file, $current_screen, $pagenow;
49
+
50
+ if($current_screen->taxonomy === 'acf-field-group-category' && ($pagenow === 'edit-tags.php' || $pagenow === 'term.php'))
51
+ $parent_file = 'edit.php?post_type=acf-field-group';
52
+
53
+ return $parent_file;
54
+
55
+ }
56
+
57
+ add_filter('manage_edit-acf-field-group_columns', 'acfe_field_group_category_column', 11);
58
+ function acfe_field_group_category_column($columns){
59
+
60
+ $new_columns = array();
61
+ foreach($columns as $key => $value) {
62
+ if($key === 'title')
63
+ $new_columns['acf-field-group-category'] = __('Categories');
64
+
65
+ $new_columns[$key] = $value;
66
+ }
67
+
68
+ return $new_columns;
69
+
70
+ }
71
+
72
+ add_action('manage_acf-field-group_posts_custom_column' , 'acfe_field_group_category_column_html', 10, 2);
73
+ function acfe_field_group_category_column_html($column, $post_id){
74
+
75
+ if($column === 'acf-field-group-category'){
76
+ if(!$terms = get_the_terms($post_id, 'acf-field-group-category')){
77
+ echo '—';
78
+ return;
79
+ }
80
+
81
+ $categories = array();
82
+ foreach($terms as $term){
83
+ $categories[] = '<a href="' . admin_url('edit.php?acf-field-group-category='.$term->slug.'&post_type=acf-field-group') . '">' . $term->name . '</a>';
84
+ }
85
+
86
+ echo implode(' ', $categories);
87
+ }
88
+
89
+ }
90
+
91
+ add_filter('views_edit-acf-field-group', 'acfe_field_group_category_views', 9);
92
+ function acfe_field_group_category_views($views){
93
+
94
+ if(!$terms = get_terms('acf-field-group-category', array('hide_empty' => false)))
95
+ return $views;
96
+
97
+ foreach($terms as $term){
98
+
99
+ $groups = get_posts( array(
100
+ 'post_type' => 'acf-field-group',
101
+ 'posts_per_page' => -1,
102
+ 'suppress_filters' => false,
103
+ 'post_status' => array('publish', 'acf-disabled'),
104
+ 'taxonomy' => 'acf-field-group-category',
105
+ 'term' => $term->slug,
106
+ 'fields' => 'ids'
107
+ ));
108
+
109
+ $count = count($groups);
110
+
111
+ $html = '';
112
+ if($count > 0)
113
+ $html = ' <span class="count">(' . $count . ')</span>';
114
+
115
+ global $wp_query;
116
+ $class = '';
117
+ if(isset($wp_query->query_vars['acf-field-group-category']) && $wp_query->query_vars['acf-field-group-category'] === $term->slug)
118
+ $class = ' class="current"';
119
+
120
+ $views['category-' . $term->slug] = '<a href="' . admin_url('edit.php?acf-field-group-category=' . $term->slug . '&post_type=acf-field-group') . '"' . $class . '>' . $term->name . $html . '</a>';
121
+ }
122
+
123
+ return $views;
124
+
125
+ }
126
+
127
+ /**
128
+ * ACF Exclude Field Group Category from available taxonomies
129
+ */
130
+ add_filter('acf/get_taxonomies', 'acfe_field_group_category_exclude', 10, 2);
131
+ function acfe_field_group_category_exclude($taxonomies, $args){
132
+
133
+ if(empty($taxonomies))
134
+ return $taxonomies;
135
+
136
+ foreach($taxonomies as $k => $taxonomy){
137
+
138
+ if($taxonomy != 'acf-field-group-category')
139
+ continue;
140
+
141
+ unset($taxonomies[$k]);
142
+
143
+ }
144
+
145
+ return $taxonomies;
146
+
147
  }
includes/field-groups/field-groups.php CHANGED
@@ -33,18 +33,39 @@ add_filter('manage_edit-acf-field-group_columns', 'acfe_field_groups_column', 99
33
  function acfe_field_groups_column($columns){
34
 
35
  // Locations
36
- $columns['acfe-locations'] = __('Locations');
37
 
38
- // Load
39
- $columns['acfe-local'] = __('Load');
 
 
 
 
 
 
 
 
40
 
41
  // PHP sync
42
- if(acf_get_setting('acfe/php'))
43
- $columns['acfe-autosync-php'] = __('PHP sync');
 
 
 
 
 
 
 
 
 
 
44
 
45
  // Json sync
46
- if(acf_get_setting('json'))
47
- $columns['acfe-autosync-json'] = __('Json sync');
 
 
 
48
 
49
  // Fix 'Sync' screen columns
50
  if(acf_maybe_get_GET('post_status') === 'sync'){
@@ -289,7 +310,11 @@ function hwk_post_type_exemple_row_actions($actions, $post){
289
  $actions['acfe-export-php'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=php&keys=' . $field_group['key']) . '">PHP</a>';
290
  $actions['acfe-export-json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=json&keys=' . $field_group['key']) . '">Json</a>';
291
 
292
- $actions['acfe-key'] = '<span style="color:#555;"><code style="font-size: 12px;">' . $field_group['key'] . '</code></span>';
 
 
 
 
293
 
294
  //$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
295
 
33
  function acfe_field_groups_column($columns){
34
 
35
  // Locations
36
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
37
 
38
+ $columns['acfe-locations'] = __('Locations');
39
+
40
+ }
41
+
42
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
43
+
44
+ // Load
45
+ $columns['acfe-local'] = __('Load');
46
+
47
+ }
48
 
49
  // PHP sync
50
+ if(acf_get_setting('acfe/php')){
51
+
52
+ $columns['acfe-autosync-php'] = __('PHP Sync');
53
+
54
+ }
55
+
56
+ if(acf_version_compare(acf_get_setting('version'), '>=', '5.9')){
57
+
58
+ // Load
59
+ $columns['acfe-local'] = __('Load');
60
+
61
+ }
62
 
63
  // Json sync
64
+ if(acf_get_setting('json') && acf_version_compare(acf_get_setting('version'), '<', '5.9')){
65
+
66
+ $columns['acfe-autosync-json'] = __('Json Sync');
67
+
68
+ }
69
 
70
  // Fix 'Sync' screen columns
71
  if(acf_maybe_get_GET('post_status') === 'sync'){
310
  $actions['acfe-export-php'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=php&keys=' . $field_group['key']) . '">PHP</a>';
311
  $actions['acfe-export-json'] = '<a href="' . admin_url('edit.php?post_type=acf-field-group&page=acf-tools&tool=export&action=json&keys=' . $field_group['key']) . '">Json</a>';
312
 
313
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
314
+
315
+ $actions['acfe-key'] = '<span style="color:#555;"><code style="font-size: 12px;">' . $field_group['key'] . '</code></span>';
316
+
317
+ }
318
 
319
  //$actions['acfe-id'] = '<span style="color:#555;">ID: ' . $field_group['ID'] . '</span>';
320
 
includes/fields-settings/permissions.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- add_action('acf/render_field_settings', 'acfe_permissions_settings', 999);
7
- function acfe_permissions_settings($field){
8
-
9
- // Settings
10
- acf_render_field_setting($field, array(
11
- 'label' => __('Permissions'),
12
- 'name' => 'acfe_permissions',
13
- 'key' => 'acfe_permissions',
14
- 'instructions' => __('Select user roles that are allowed to view and edit this field. If nothing is selected, then this field will be available to everyone.'),
15
- 'type' => 'checkbox',
16
- 'required' => false,
17
- 'default_value' => false,
18
- 'choices' => acfe_get_roles(),
19
- 'layout' => 'horizontal'
20
- ), true);
21
-
22
- }
23
-
24
- add_filter('acf/prepare_field', 'acfe_roles_prepare_field');
25
- function acfe_roles_prepare_field($field){
26
-
27
- if(!isset($field['acfe_permissions']) || empty($field['acfe_permissions']))
28
- return $field;
29
-
30
- $current_user_roles = acfe_get_current_user_roles();
31
- $render_field = false;
32
-
33
- foreach($current_user_roles as $current_user_role){
34
-
35
- foreach($field['acfe_permissions'] as $field_role){
36
-
37
- if($current_user_role !== $field_role)
38
- continue;
39
-
40
- $render_field = true;
41
- break;
42
-
43
- }
44
-
45
- if($render_field)
46
- break;
47
-
48
- }
49
-
50
- if(!$render_field)
51
- return false;
52
-
53
- return $field;
54
-
55
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_action('acf/render_field_settings', 'acfe_permissions_settings', 999);
7
+ function acfe_permissions_settings($field){
8
+
9
+ // Settings
10
+ acf_render_field_setting($field, array(
11
+ 'label' => __('Permissions'),
12
+ 'name' => 'acfe_permissions',
13
+ 'key' => 'acfe_permissions',
14
+ 'instructions' => __('Select user roles that are allowed to view and edit this field. If nothing is selected, then this field will be available to everyone.'),
15
+ 'type' => 'checkbox',
16
+ 'required' => false,
17
+ 'default_value' => false,
18
+ 'choices' => acfe_get_roles(),
19
+ 'layout' => 'horizontal'
20
+ ), true);
21
+
22
+ }
23
+
24
+ add_filter('acf/prepare_field', 'acfe_roles_prepare_field');
25
+ function acfe_roles_prepare_field($field){
26
+
27
+ if(!isset($field['acfe_permissions']) || empty($field['acfe_permissions']))
28
+ return $field;
29
+
30
+ $current_user_roles = acfe_get_current_user_roles();
31
+ $render_field = false;
32
+
33
+ foreach($current_user_roles as $current_user_role){
34
+
35
+ foreach($field['acfe_permissions'] as $field_role){
36
+
37
+ if($current_user_role !== $field_role)
38
+ continue;
39
+
40
+ $render_field = true;
41
+ break;
42
+
43
+ }
44
+
45
+ if($render_field)
46
+ break;
47
+
48
+ }
49
+
50
+ if(!$render_field)
51
+ return false;
52
+
53
+ return $field;
54
+
55
  }
includes/fields/field-button.php CHANGED
@@ -1,240 +1,240 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_field_button')):
7
-
8
- class acfe_field_button extends acf_field{
9
-
10
- function __construct(){
11
-
12
- $this->name = 'acfe_button';
13
- $this->label = __('Button', 'acfe');
14
- $this->category = 'basic';
15
- $this->defaults = array(
16
- 'button_value' => __('Submit', 'acfe'),
17
- 'button_type' => 'button',
18
- 'button_before' => '',
19
- 'button_after' => '',
20
- 'button_class' => '',
21
- 'button_id' => '',
22
- );
23
-
24
- add_action('wp_ajax_acfe/fields/button', array($this, 'ajax_request'), 99);
25
- add_action('wp_ajax_nopriv_acfe/fields/button', array($this, 'ajax_request'), 99);
26
-
27
- parent::__construct();
28
-
29
- }
30
-
31
- function ajax_request(){
32
-
33
- /**
34
- * @bool/string $_POST['post_id'] Current post ID
35
- * @string $_POST['field_key'] Button's field key
36
- * @string $_POST['field_name'] Button's field name
37
- */
38
-
39
- $field_name = acf_maybe_get_POST('field_name');
40
- $field_key = acf_maybe_get_POST('field_key');
41
- $post_id = acf_maybe_get_POST('post_id');
42
- $field = acf_get_field($field_key);
43
-
44
- do_action('acfe/fields/button', $field, $post_id);
45
- do_action('acfe/fields/button/name=' . $field_name, $field, $post_id);
46
- do_action('acfe/fields/button/key=' . $field_key, $field, $post_id);
47
-
48
- die;
49
-
50
- }
51
-
52
- function render_field_settings($field){
53
-
54
- // Value
55
- acf_render_field_setting($field, array(
56
- 'label' => __('Button value', 'acfe'),
57
- 'instructions' => __('Set a default button value', 'acfe'),
58
- 'type' => 'text',
59
- 'name' => 'button_value',
60
- 'default_value' => __('Submit', 'acfe')
61
- ));
62
-
63
- // Type
64
- acf_render_field_setting($field, array(
65
- 'label' => __('Button value', 'acfe'),
66
- 'instructions' => __('Choose the button type', 'acfe'),
67
- 'type' => 'radio',
68
- 'name' => 'button_type',
69
- 'default_value' => 'button',
70
- 'layout' => 'horizontal',
71
- 'choices' => array(
72
- 'button' => __('Button', 'acfe'),
73
- 'submit' => __('Submit', 'acfe'),
74
- ),
75
- ));
76
-
77
- // class
78
- acf_render_field_setting($field, array(
79
- 'label' => __('Button attributes','acf'),
80
- 'instructions' => '',
81
- 'type' => 'text',
82
- 'name' => 'button_class',
83
- 'prepend' => __('class', 'acf'),
84
- ));
85
-
86
- // id
87
- acf_render_field_setting($field, array(
88
- 'label' => '',
89
- 'instructions' => '',
90
- 'type' => 'text',
91
- 'name' => 'button_id',
92
- 'prepend' => __('id', 'acf'),
93
- '_append' => 'button_class'
94
- ));
95
-
96
- // Before HTML
97
- acf_render_field_setting($field, array(
98
- 'label' => __('Before HTML', 'acfe'),
99
- 'instructions' => __('Custom HTML before the button', 'acfe'),
100
- 'type' => 'acfe_code_editor',
101
- 'name' => 'button_before',
102
- 'rows' => 4,
103
- ));
104
-
105
- // After HTML
106
- acf_render_field_setting($field, array(
107
- 'label' => __('After HTML', 'acfe'),
108
- 'instructions' => __('Custom HTML after the button', 'acfe'),
109
- 'type' => 'acfe_code_editor',
110
- 'name' => 'button_after',
111
- 'rows' => 4,
112
- ));
113
-
114
- // Ajax
115
- acf_render_field_setting($field, array(
116
- 'label' => __('Ajax call', 'acfe'),
117
- 'instructions' => __('Trigger ajax event on click', 'acfe'),
118
- 'name' => 'button_ajax',
119
- 'type' => 'true_false',
120
- 'ui' => 1,
121
- ));
122
-
123
- ob_start();
124
- ?>
125
- Write your own Ajax return data using the following hook:<br /><br />
126
- <pre>
127
- add_action('acfe/fields/button/name=my_button', 'my_acf_button_ajax', 10, 2);
128
- function my_acf_button_ajax($field, $post_id){
129
-
130
- /**
131
- * @array $field Field array
132
- * @bool/string $post_id Current post ID
133
- */
134
-
135
- wp_send_json('Success!');
136
-
137
- }
138
- </pre>
139
- <br />
140
- You can get access to Javascript ajax call using the following JS hooks:<br /><br />
141
- <pre>
142
- acf.addAction('acfe/fields/button/before/name=my_button', function($el, data){
143
-
144
- // $el
145
-
146
- });
147
-
148
- acf.addAction('acfe/fields/button/success/name=my_button', function(response, $el, data){
149
-
150
- // response
151
- // $el
152
- // data
153
-
154
- });
155
-
156
- acf.addAction('acfe/fields/button/complete/name=my_button', function(response, $el, data){
157
-
158
- // response
159
- // $el
160
- // data
161
-
162
- });
163
- </pre>
164
- <?php
165
-
166
- $message = ob_get_clean();
167
-
168
- // ajax instructions
169
- acf_render_field_setting($field, array(
170
- 'label' => __('Ajax instructions','acf'),
171
- 'instructions' => '',
172
- 'type' => 'message',
173
- 'name' => 'instructions',
174
- 'message' => $message,
175
- 'new_lines' => false,
176
- 'conditional_logic' => array(
177
- array(
178
- array(
179
- 'field' => 'button_ajax',
180
- 'operator' => '==',
181
- 'value' => '1',
182
- )
183
- )
184
- )
185
- ));
186
-
187
- }
188
-
189
- function render_field($field){
190
-
191
- // Before
192
- if(isset($field['button_before']) && !empty($field['button_before'])){
193
-
194
- echo $field['button_before'];
195
-
196
- }
197
-
198
- $ajax = false;
199
- $button_ajax = $field['button_ajax'];
200
-
201
- if($button_ajax)
202
- $ajax = 'data-ajax="1"';
203
-
204
- // Button
205
- if($field['button_type'] === 'button'){
206
-
207
- echo '<button
208
- id="' . esc_attr($field['button_id']) . '"
209
- class="' . esc_attr($field['button_class']) . '"
210
- ' . $ajax . '
211
- >' . esc_attr($field['button_value']) . '</button>';
212
-
213
- // Submit
214
- }elseif($field['button_type'] === 'submit'){
215
-
216
- echo '<input
217
- type="submit"
218
- id="' . esc_attr($field['button_id']) . '"
219
- class="' . esc_attr($field['button_class']) . '"
220
- value="' . esc_attr($field['button_value']) . '"
221
- ' . $ajax . '
222
- />';
223
-
224
- }
225
-
226
- // After
227
- if(isset($field['button_after']) && !empty($field['button_after'])){
228
-
229
- echo $field['button_after'];
230
-
231
- }
232
-
233
- }
234
-
235
- }
236
-
237
- // initialize
238
- acf_register_field_type('acfe_field_button');
239
-
240
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_field_button')):
7
+
8
+ class acfe_field_button extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'acfe_button';
13
+ $this->label = __('Button', 'acfe');
14
+ $this->category = 'basic';
15
+ $this->defaults = array(
16
+ 'button_value' => __('Submit', 'acfe'),
17
+ 'button_type' => 'button',
18
+ 'button_before' => '',
19
+ 'button_after' => '',
20
+ 'button_class' => '',
21
+ 'button_id' => '',
22
+ );
23
+
24
+ add_action('wp_ajax_acfe/fields/button', array($this, 'ajax_request'), 99);
25
+ add_action('wp_ajax_nopriv_acfe/fields/button', array($this, 'ajax_request'), 99);
26
+
27
+ parent::__construct();
28
+
29
+ }
30
+
31
+ function ajax_request(){
32
+
33
+ /**
34
+ * @bool/string $_POST['post_id'] Current post ID
35
+ * @string $_POST['field_key'] Button's field key
36
+ * @string $_POST['field_name'] Button's field name
37
+ */
38
+
39
+ $field_name = acf_maybe_get_POST('field_name');
40
+ $field_key = acf_maybe_get_POST('field_key');
41
+ $post_id = acf_maybe_get_POST('post_id');
42
+ $field = acf_get_field($field_key);
43
+
44
+ do_action('acfe/fields/button', $field, $post_id);
45
+ do_action('acfe/fields/button/name=' . $field_name, $field, $post_id);
46
+ do_action('acfe/fields/button/key=' . $field_key, $field, $post_id);
47
+
48
+ die;
49
+
50
+ }
51
+
52
+ function render_field_settings($field){
53
+
54
+ // Value
55
+ acf_render_field_setting($field, array(
56
+ 'label' => __('Button value', 'acfe'),
57
+ 'instructions' => __('Set a default button value', 'acfe'),
58
+ 'type' => 'text',
59
+ 'name' => 'button_value',
60
+ 'default_value' => __('Submit', 'acfe')
61
+ ));
62
+
63
+ // Type
64
+ acf_render_field_setting($field, array(
65
+ 'label' => __('Button value', 'acfe'),
66
+ 'instructions' => __('Choose the button type', 'acfe'),
67
+ 'type' => 'radio',
68
+ 'name' => 'button_type',
69
+ 'default_value' => 'button',
70
+ 'layout' => 'horizontal',
71
+ 'choices' => array(
72
+ 'button' => __('Button', 'acfe'),
73
+ 'submit' => __('Submit', 'acfe'),
74
+ ),
75
+ ));
76
+
77
+ // class
78
+ acf_render_field_setting($field, array(
79
+ 'label' => __('Button attributes','acf'),
80
+ 'instructions' => '',
81
+ 'type' => 'text',
82
+ 'name' => 'button_class',
83
+ 'prepend' => __('class', 'acf'),
84
+ ));
85
+
86
+ // id
87
+ acf_render_field_setting($field, array(
88
+ 'label' => '',
89
+ 'instructions' => '',
90
+ 'type' => 'text',
91
+ 'name' => 'button_id',
92
+ 'prepend' => __('id', 'acf'),
93
+ '_append' => 'button_class'
94
+ ));
95
+
96
+ // Before HTML
97
+ acf_render_field_setting($field, array(
98
+ 'label' => __('Before HTML', 'acfe'),
99
+ 'instructions' => __('Custom HTML before the button', 'acfe'),
100
+ 'type' => 'acfe_code_editor',
101
+ 'name' => 'button_before',
102
+ 'rows' => 4,
103
+ ));
104
+
105
+ // After HTML
106
+ acf_render_field_setting($field, array(
107
+ 'label' => __('After HTML', 'acfe'),
108
+ 'instructions' => __('Custom HTML after the button', 'acfe'),
109
+ 'type' => 'acfe_code_editor',
110
+ 'name' => 'button_after',
111
+ 'rows' => 4,
112
+ ));
113
+
114
+ // Ajax
115
+ acf_render_field_setting($field, array(
116
+ 'label' => __('Ajax call', 'acfe'),
117
+ 'instructions' => __('Trigger ajax event on click', 'acfe'),
118
+ 'name' => 'button_ajax',
119
+ 'type' => 'true_false',
120
+ 'ui' => 1,
121
+ ));
122
+
123
+ ob_start();
124
+ ?>
125
+ Write your own Ajax return data using the following hook:<br /><br />
126
+ <pre>
127
+ add_action('acfe/fields/button/name=my_button', 'my_acf_button_ajax', 10, 2);
128
+ function my_acf_button_ajax($field, $post_id){
129
+
130
+ /**
131
+ * @array $field Field array
132
+ * @bool/string $post_id Current post ID
133
+ */
134
+
135
+ wp_send_json('Success!');
136
+
137
+ }
138
+ </pre>
139
+ <br />
140
+ You can get access to Javascript ajax call using the following JS hooks:<br /><br />
141
+ <pre>
142
+ acf.addAction('acfe/fields/button/before/name=my_button', function($el, data){
143
+
144
+ // $el
145
+
146
+ });
147
+
148
+ acf.addAction('acfe/fields/button/success/name=my_button', function(response, $el, data){
149
+
150
+ // response
151
+ // $el
152
+ // data
153
+
154
+ });
155
+
156
+ acf.addAction('acfe/fields/button/complete/name=my_button', function(response, $el, data){
157
+
158
+ // response
159
+ // $el
160
+ // data
161
+
162
+ });
163
+ </pre>
164
+ <?php
165
+
166
+ $message = ob_get_clean();
167
+
168
+ // ajax instructions
169
+ acf_render_field_setting($field, array(
170
+ 'label' => __('Ajax instructions','acf'),
171
+ 'instructions' => '',
172
+ 'type' => 'message',
173
+ 'name' => 'instructions',
174
+ 'message' => $message,
175
+ 'new_lines' => false,
176
+ 'conditional_logic' => array(
177
+ array(
178
+ array(
179
+ 'field' => 'button_ajax',
180
+ 'operator' => '==',
181
+ 'value' => '1',
182
+ )
183
+ )
184
+ )
185
+ ));
186
+
187
+ }
188
+
189
+ function render_field($field){
190
+
191
+ // Before
192
+ if(isset($field['button_before']) && !empty($field['button_before'])){
193
+
194
+ echo $field['button_before'];
195
+
196
+ }
197
+
198
+ $ajax = false;
199
+ $button_ajax = $field['button_ajax'];
200
+
201
+ if($button_ajax)
202
+ $ajax = 'data-ajax="1"';
203
+
204
+ // Button
205
+ if($field['button_type'] === 'button'){
206
+
207
+ echo '<button
208
+ id="' . esc_attr($field['button_id']) . '"
209
+ class="' . esc_attr($field['button_class']) . '"
210
+ ' . $ajax . '
211
+ >' . esc_attr($field['button_value']) . '</button>';
212
+
213
+ // Submit
214
+ }elseif($field['button_type'] === 'submit'){
215
+
216
+ echo '<input
217
+ type="submit"
218
+ id="' . esc_attr($field['button_id']) . '"
219
+ class="' . esc_attr($field['button_class']) . '"
220
+ value="' . esc_attr($field['button_value']) . '"
221
+ ' . $ajax . '
222
+ />';
223
+
224
+ }
225
+
226
+ // After
227
+ if(isset($field['button_after']) && !empty($field['button_after'])){
228
+
229
+ echo $field['button_after'];
230
+
231
+ }
232
+
233
+ }
234
+
235
+ }
236
+
237
+ // initialize
238
+ acf_register_field_type('acfe_field_button');
239
+
240
  endif;
includes/fields/field-column.php CHANGED
@@ -1,128 +1,128 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_field_column')):
7
-
8
- class acfe_field_column extends acf_field{
9
-
10
- function __construct(){
11
-
12
- $this->name = 'acfe_column';
13
- $this->label = __('Column', 'acfe');
14
- $this->category = 'layout';
15
- $this->defaults = array(
16
- 'columns' => '3/6',
17
- 'endpoint' => false,
18
- );
19
-
20
- add_filter('acfe/field_wrapper_attributes/type=acfe_column', array($this, 'field_wrapper_attributes'), 10, 2);
21
-
22
- parent::__construct();
23
-
24
- }
25
-
26
- function render_field_settings($field){
27
-
28
- // columns
29
- acf_render_field_setting( $field, array(
30
- 'label' => __('Columns', 'acfe'),
31
- 'instructions' => '',
32
- 'type' => 'select',
33
- 'name' => 'columns',
34
- 'choices' => array(
35
- '1/6' => '1/6',
36
- '2/6' => '2/6',
37
- '3/6' => '3/6',
38
- '4/6' => '4/6',
39
- '5/6' => '5/6',
40
- '6/6' => '6/6'
41
- ),
42
- 'conditional_logic' => array(
43
- array(
44
- array(
45
- 'field' => 'endpoint',
46
- 'operator' => '!=',
47
- 'value' => '1',
48
- )
49
- )
50
- )
51
- ));
52
-
53
- // endpoint
54
- acf_render_field_setting( $field, array(
55
- 'label' => __('Endpoint','acf'),
56
- 'instructions' => __('Define an endpoint for the previous tabs to stop. This will start a new group of columns.', 'acf'),
57
- 'name' => 'endpoint',
58
- 'type' => 'true_false',
59
- 'ui' => 1,
60
- ));
61
-
62
- }
63
-
64
- function field_wrapper_attributes($wrapper, $field){
65
-
66
- if($field['endpoint']){
67
-
68
- $wrapper['data-endpoint'] = $field['endpoint'];
69
-
70
- }
71
-
72
- elseif($field['columns']){
73
-
74
- $wrapper['data-columns'] = $field['columns'];
75
-
76
- }
77
-
78
- return $wrapper;
79
-
80
- }
81
-
82
-
83
- function render_field($field){
84
-
85
- // vars
86
- $atts = array(
87
- 'class' => 'acf-fields',
88
- );
89
-
90
- ?>
91
- <div <?php acf_esc_attr_e($atts); ?>></div>
92
- <?php
93
-
94
- }
95
-
96
- function load_field($field){
97
-
98
- $columns = '';
99
- if($field['columns'])
100
- $columns = ' ' . $field['columns'];
101
-
102
- if($field['endpoint'])
103
- $columns = ' endpoint';
104
-
105
- $field['label'] = '(Column' . $columns .')';
106
- $field['name'] = '';
107
- $field['instructions'] = '';
108
- $field['required'] = 0;
109
- $field['value'] = false;
110
-
111
- return $field;
112
-
113
- }
114
-
115
- function prepare_field($field){
116
-
117
- $field['label'] = false;
118
-
119
- return $field;
120
-
121
- }
122
-
123
- }
124
-
125
- // initialize
126
- acf_register_field_type('acfe_field_column');
127
-
128
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_field_column')):
7
+
8
+ class acfe_field_column extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'acfe_column';
13
+ $this->label = __('Column', 'acfe');
14
+ $this->category = 'layout';
15
+ $this->defaults = array(
16
+ 'columns' => '3/6',
17
+ 'endpoint' => false,
18
+ );
19
+
20
+ add_filter('acfe/field_wrapper_attributes/type=acfe_column', array($this, 'field_wrapper_attributes'), 10, 2);
21
+
22
+ parent::__construct();
23
+
24
+ }
25
+
26
+ function render_field_settings($field){
27
+
28
+ // columns
29
+ acf_render_field_setting( $field, array(
30
+ 'label' => __('Columns', 'acfe'),
31
+ 'instructions' => '',
32
+ 'type' => 'select',
33
+ 'name' => 'columns',
34
+ 'choices' => array(
35
+ '1/6' => '1/6',
36
+ '2/6' => '2/6',
37
+ '3/6' => '3/6',
38
+ '4/6' => '4/6',
39
+ '5/6' => '5/6',
40
+ '6/6' => '6/6'
41
+ ),
42
+ 'conditional_logic' => array(
43
+ array(
44
+ array(
45
+ 'field' => 'endpoint',
46
+ 'operator' => '!=',
47
+ 'value' => '1',
48
+ )
49
+ )
50
+ )
51
+ ));
52
+
53
+ // endpoint
54
+ acf_render_field_setting( $field, array(
55
+ 'label' => __('Endpoint','acf'),
56
+ 'instructions' => __('Define an endpoint for the previous tabs to stop. This will start a new group of columns.', 'acf'),
57
+ 'name' => 'endpoint',
58
+ 'type' => 'true_false',
59
+ 'ui' => 1,
60
+ ));
61
+
62
+ }
63
+
64
+ function field_wrapper_attributes($wrapper, $field){
65
+
66
+ if($field['endpoint']){
67
+
68
+ $wrapper['data-endpoint'] = $field['endpoint'];
69
+
70
+ }
71
+
72
+ elseif($field['columns']){
73
+
74
+ $wrapper['data-columns'] = $field['columns'];
75
+
76
+ }
77
+
78
+ return $wrapper;
79
+
80
+ }
81
+
82
+
83
+ function render_field($field){
84
+
85
+ // vars
86
+ $atts = array(
87
+ 'class' => 'acf-fields',
88
+ );
89
+
90
+ ?>
91
+ <div <?php acf_esc_attr_e($atts); ?>></div>
92
+ <?php
93
+
94
+ }
95
+
96
+ function load_field($field){
97
+
98
+ $columns = '';
99
+ if($field['columns'])
100
+ $columns = ' ' . $field['columns'];
101
+
102
+ if($field['endpoint'])
103
+ $columns = ' endpoint';
104
+
105
+ $field['label'] = '(Column' . $columns .')';
106
+ $field['name'] = '';
107
+ $field['instructions'] = '';
108
+ $field['required'] = 0;
109
+ $field['value'] = false;
110
+
111
+ return $field;
112
+
113
+ }
114
+
115
+ function prepare_field($field){
116
+
117
+ $field['label'] = false;
118
+
119
+ return $field;
120
+
121
+ }
122
+
123
+ }
124
+
125
+ // initialize
126
+ acf_register_field_type('acfe_field_column');
127
+
128
  endif;
includes/fields/field-dynamic-message.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_field_dynamic_message')):
7
-
8
- class acfe_field_dynamic_message extends acf_field{
9
-
10
- function __construct(){
11
-
12
- $this->name = 'acfe_dynamic_message';
13
- $this->label = __('Dynamic Message', 'acfe');
14
- $this->category = 'layout';
15
-
16
- parent::__construct();
17
-
18
- }
19
-
20
- function render_field_settings($field){
21
-
22
- $field_name = 'field_name';
23
- if(acf_maybe_get($field, 'name'))
24
- $field_name = $field['name'];
25
-
26
- ob_start();
27
- ?>
28
- Write your own PHP/HTML content using the following hook:<br /><br />
29
- <pre>
30
- add_action('acf/render_field/name=<?php echo $field_name; ?>', 'my_acf_dynamic_message');
31
- function my_acf_dynamic_message(){
32
-
33
- echo 'Hello World';
34
-
35
- }
36
- </pre>
37
- <?php
38
-
39
- $message = ob_get_clean();
40
-
41
- // field_type
42
- acf_render_field_setting($field, array(
43
- 'label' => __('Instructions','acf'),
44
- 'instructions' => '',
45
- 'type' => 'message',
46
- 'name' => 'instructions',
47
- 'message' => $message,
48
- 'new_lines' => false
49
- ));
50
-
51
- }
52
-
53
- }
54
-
55
- // initialize
56
- acf_register_field_type('acfe_field_dynamic_message');
57
-
58
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_field_dynamic_message')):
7
+
8
+ class acfe_field_dynamic_message extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'acfe_dynamic_message';
13
+ $this->label = __('Dynamic Message', 'acfe');
14
+ $this->category = 'layout';
15
+
16
+ parent::__construct();
17
+
18
+ }
19
+
20
+ function render_field_settings($field){
21
+
22
+ $field_name = 'field_name';
23
+ if(acf_maybe_get($field, 'name'))
24
+ $field_name = $field['name'];
25
+
26
+ ob_start();
27
+ ?>
28
+ Write your own PHP/HTML content using the following hook:<br /><br />
29
+ <pre>
30
+ add_action('acf/render_field/name=<?php echo $field_name; ?>', 'my_acf_dynamic_message');
31
+ function my_acf_dynamic_message(){
32
+
33
+ echo 'Hello World';
34
+
35
+ }
36
+ </pre>
37
+ <?php
38
+
39
+ $message = ob_get_clean();
40
+
41
+ // field_type
42
+ acf_render_field_setting($field, array(
43
+ 'label' => __('Instructions','acf'),
44
+ 'instructions' => '',
45
+ 'type' => 'message',
46
+ 'name' => 'instructions',
47
+ 'message' => $message,
48
+ 'new_lines' => false
49
+ ));
50
+
51
+ }
52
+
53
+ }
54
+
55
+ // initialize
56
+ acf_register_field_type('acfe_field_dynamic_message');
57
+
58
  endif;
includes/fields/field-flexible-content.php CHANGED
@@ -432,29 +432,33 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
432
  )
433
  )
434
  ));
435
-
436
- // Layouts: Clone
437
- acf_render_field_setting($field, array(
438
- 'label' => __('Layouts: Clone'),
439
- 'name' => 'acfe_flexible_clone',
440
- 'key' => 'acfe_flexible_clone',
441
- 'instructions' => __('Allow clone layouts function'),
442
- 'type' => 'true_false',
443
- 'message' => '',
444
- 'default_value' => false,
445
- 'ui' => true,
446
- 'ui_on_text' => '',
447
- 'ui_off_text' => '',
448
- 'conditional_logic' => array(
449
- array(
 
450
  array(
451
- 'field' => 'acfe_flexible_advanced',
452
- 'operator' => '==',
453
- 'value' => '1',
454
- ),
 
 
455
  )
456
- )
457
- ));
 
458
 
459
  // Layouts: Copy/Paste
460
  acf_render_field_setting($field, array(
@@ -530,7 +534,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
530
  )
531
  ));
532
 
533
- // Remove: Add Button
534
  acf_render_field_setting($field, array(
535
  'label' => __('Hide: Add layout button'),
536
  'name' => 'acfe_flexible_remove_add_button',
@@ -552,8 +556,35 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
552
  )
553
  )
554
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
- // Remove: Delete Button
 
 
557
  acf_render_field_setting($field, array(
558
  'label' => __('Hide: Delete layout button'),
559
  'name' => 'acfe_flexible_remove_delete_button',
@@ -770,7 +801,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
770
  )
771
  ));
772
 
773
- // Layouts: Remove Collapse
774
  acf_render_field_setting($field, array(
775
  'label' => __('Layouts: Remove Collapse'),
776
  'name' => 'acfe_flexible_layouts_remove_collapse',
@@ -1088,6 +1119,7 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
1088
  'acfe_flexible_toggle' => 0,
1089
  'acfe_flexible_close_button' => 0,
1090
  'acfe_flexible_remove_add_button' => 0,
 
1091
  'acfe_flexible_remove_delete_button' => 0,
1092
  'acfe_flexible_lock' => 0,
1093
 
@@ -1975,13 +2007,27 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
1975
  * Render Layout Icons
1976
  */
1977
  function render_layout_icons($layout, $field){
 
 
 
 
 
 
 
 
 
1978
 
1979
- // icons
1980
- $icons = array(
1981
- 'add' => '<a class="acf-icon -plus small light acf-js-tooltip" href="#" data-name="add-layout" title="' . __('Add layout','acf') . '"></a>',
1982
- 'delete' => '<a class="acf-icon -minus small light acf-js-tooltip" href="#" data-name="remove-layout" title="' . __('Remove layout','acf') . '"></a>',
1983
- 'collapse' => '<a class="acf-icon -collapse small acf-js-tooltip" href="#" data-name="collapse-layout" title="' . __('Click to toggle','acf') . '"></a>'
1984
- );
 
 
 
 
 
1985
 
1986
  $icons = apply_filters('acfe/flexible/layouts/icons', $icons, $layout, $field);
1987
  $icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'], $icons, $layout, $field);
@@ -2349,17 +2395,21 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
2349
  $icons = array_merge($new_icons, $icons);
2350
 
2351
  }
2352
-
2353
- // Clone
2354
- if($field['acfe_flexible_clone']){
2355
-
2356
  // Clone
2357
- $new_icons = array(
2358
- 'clone' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' . $layout['name'] . '"></a>'
2359
- );
2360
-
2361
- $icons = array_merge($new_icons, $icons);
2362
-
 
 
 
 
 
2363
  }
2364
 
2365
  // Toggle
@@ -2384,6 +2434,9 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
2384
 
2385
  // Add
2386
  if(isset($icons['add'])) unset($icons['add']);
 
 
 
2387
 
2388
  // Delete
2389
  if(isset($icons['delete'])) unset($icons['delete']);
@@ -2396,21 +2449,28 @@ class acfe_field_flexible_content extends acf_field_flexible_content{
2396
 
2397
  }
2398
 
2399
- // Remove: Add button
2400
  if($field['acfe_flexible_remove_add_button'] && isset($icons['add'])){
2401
 
2402
  unset($icons['add']);
2403
 
2404
  }
 
 
 
 
 
 
 
2405
 
2406
- // Remove: Delete button
2407
  if($field['acfe_flexible_remove_delete_button'] && isset($icons['delete'])){
2408
 
2409
  unset($icons['delete']);
2410
 
2411
  }
2412
 
2413
- // Remove: Toggle
2414
  if(($field['acfe_flexible_modal_edition'] || $field['acfe_flexible_layouts_remove_collapse']) && isset($icons['collapse'])){
2415
 
2416
  unset($icons['collapse']);
432
  )
433
  )
434
  ));
435
+
436
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
437
+
438
+ // Layouts: Clone
439
+ acf_render_field_setting($field, array(
440
+ 'label' => __('Layouts: Clone'),
441
+ 'name' => 'acfe_flexible_clone',
442
+ 'key' => 'acfe_flexible_clone',
443
+ 'instructions' => __('Allow clone layouts function'),
444
+ 'type' => 'true_false',
445
+ 'message' => '',
446
+ 'default_value' => false,
447
+ 'ui' => true,
448
+ 'ui_on_text' => '',
449
+ 'ui_off_text' => '',
450
+ 'conditional_logic' => array(
451
  array(
452
+ array(
453
+ 'field' => 'acfe_flexible_advanced',
454
+ 'operator' => '==',
455
+ 'value' => '1',
456
+ ),
457
+ )
458
  )
459
+ ));
460
+
461
+ }
462
 
463
  // Layouts: Copy/Paste
464
  acf_render_field_setting($field, array(
534
  )
535
  ));
536
 
537
+ // Hide: Add Button
538
  acf_render_field_setting($field, array(
539
  'label' => __('Hide: Add layout button'),
540
  'name' => 'acfe_flexible_remove_add_button',
556
  )
557
  )
558
  ));
559
+
560
+ if(acf_version_compare(acf_get_setting('version'), '>=', '5.9')){
561
+
562
+ // Hide: Duplicate Button
563
+ acf_render_field_setting($field, array(
564
+ 'label' => __('Hide: Duplicate layout button'),
565
+ 'name' => 'acfe_flexible_remove_duplicate_button',
566
+ 'key' => 'acfe_flexible_remove_duplicate_button',
567
+ 'instructions' => __('Hide the "Duplicate layout" button'),
568
+ 'type' => 'true_false',
569
+ 'message' => '',
570
+ 'default_value' => false,
571
+ 'ui' => true,
572
+ 'ui_on_text' => '',
573
+ 'ui_off_text' => '',
574
+ 'conditional_logic' => array(
575
+ array(
576
+ array(
577
+ 'field' => 'acfe_flexible_advanced',
578
+ 'operator' => '==',
579
+ 'value' => '1',
580
+ ),
581
+ )
582
+ )
583
+ ));
584
 
585
+ }
586
+
587
+ // Hide: Delete Button
588
  acf_render_field_setting($field, array(
589
  'label' => __('Hide: Delete layout button'),
590
  'name' => 'acfe_flexible_remove_delete_button',
801
  )
802
  ));
803
 
804
+ // Hide: Collapse Button
805
  acf_render_field_setting($field, array(
806
  'label' => __('Layouts: Remove Collapse'),
807
  'name' => 'acfe_flexible_layouts_remove_collapse',
1119
  'acfe_flexible_toggle' => 0,
1120
  'acfe_flexible_close_button' => 0,
1121
  'acfe_flexible_remove_add_button' => 0,
1122
+ 'acfe_flexible_remove_duplicate_button' => 0,
1123
  'acfe_flexible_remove_delete_button' => 0,
1124
  'acfe_flexible_lock' => 0,
1125
 
2007
  * Render Layout Icons
2008
  */
2009
  function render_layout_icons($layout, $field){
2010
+
2011
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
2012
+
2013
+ // icons
2014
+ $icons = array(
2015
+ 'add' => '<a class="acf-icon -plus small light acf-js-tooltip" href="#" data-name="add-layout" title="' . __('Add layout','acf') . '"></a>',
2016
+ 'delete' => '<a class="acf-icon -minus small light acf-js-tooltip" href="#" data-name="remove-layout" title="' . __('Remove layout','acf') . '"></a>',
2017
+ 'collapse' => '<a class="acf-icon -collapse small acf-js-tooltip" href="#" data-name="collapse-layout" title="' . __('Click to toggle','acf') . '"></a>'
2018
+ );
2019
 
2020
+ }else{
2021
+
2022
+ // icons
2023
+ $icons = array(
2024
+ 'add' => '<a class="acf-icon -plus small light acf-js-tooltip" href="#" data-name="add-layout" title="' . __('Add layout','acf') . '"></a>',
2025
+ 'duplicate' => '<a class="acf-icon -duplicate small light acf-js-tooltip" href="#" data-name="duplicate-layout" title="' . __('Duplicate layout','acf') . '"></a>',
2026
+ 'delete' => '<a class="acf-icon -minus small light acf-js-tooltip" href="#" data-name="remove-layout" title="' . __('Remove layout','acf') . '"></a>',
2027
+ 'collapse' => '<a class="acf-icon -collapse small acf-js-tooltip" href="#" data-name="collapse-layout" title="' . __('Click to toggle','acf') . '"></a>'
2028
+ );
2029
+
2030
+ }
2031
 
2032
  $icons = apply_filters('acfe/flexible/layouts/icons', $icons, $layout, $field);
2033
  $icons = apply_filters('acfe/flexible/layouts/icons/name=' . $field['_name'], $icons, $layout, $field);
2395
  $icons = array_merge($new_icons, $icons);
2396
 
2397
  }
2398
+
2399
+ if(acf_version_compare(acf_get_setting('version'), '<', '5.9')){
2400
+
 
2401
  // Clone
2402
+ if($field['acfe_flexible_clone']){
2403
+
2404
+ // Clone
2405
+ $new_icons = array(
2406
+ 'clone' => '<a class="acf-icon small light acf-js-tooltip acfe-flexible-icon dashicons dashicons-admin-page" href="#" title="Clone layout" data-acfe-flexible-control-clone="' . $layout['name'] . '"></a>'
2407
+ );
2408
+
2409
+ $icons = array_merge($new_icons, $icons);
2410
+
2411
+ }
2412
+
2413
  }
2414
 
2415
  // Toggle
2434
 
2435
  // Add
2436
  if(isset($icons['add'])) unset($icons['add']);
2437
+
2438
+ // Duplicate
2439
+ if(isset($icons['duplicate'])) unset($icons['duplicate']);
2440
 
2441
  // Delete
2442
  if(isset($icons['delete'])) unset($icons['delete']);
2449
 
2450
  }
2451
 
2452
+ // Hide: Add button
2453
  if($field['acfe_flexible_remove_add_button'] && isset($icons['add'])){
2454
 
2455
  unset($icons['add']);
2456
 
2457
  }
2458
+
2459
+ // Hide: Duplicate button
2460
+ if($field['acfe_flexible_remove_duplicate_button'] && isset($icons['duplicate'])){
2461
+
2462
+ unset($icons['duplicate']);
2463
+
2464
+ }
2465
 
2466
+ // Hide: Delete button
2467
  if($field['acfe_flexible_remove_delete_button'] && isset($icons['delete'])){
2468
 
2469
  unset($icons['delete']);
2470
 
2471
  }
2472
 
2473
+ // Hide: Collapse
2474
  if(($field['acfe_flexible_modal_edition'] || $field['acfe_flexible_layouts_remove_collapse']) && isset($icons['collapse'])){
2475
 
2476
  unset($icons['collapse']);
includes/fields/field-hidden.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_field_hidden')):
7
-
8
- class acfe_field_hidden extends acf_field{
9
-
10
- function __construct(){
11
-
12
- $this->name = 'acfe_hidden';
13
- $this->label = __('Hidden', 'acfe');
14
- $this->category = 'basic';
15
- $this->defaults = array(
16
- 'default_value' => ''
17
- );
18
-
19
- parent::__construct();
20
-
21
- }
22
-
23
- function render_field($field){
24
-
25
- ?>
26
- <input type="hidden" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" />
27
- <?php
28
-
29
- }
30
-
31
- function render_field_settings($field){
32
-
33
- // default_value
34
- acf_render_field_setting( $field, array(
35
- 'label' => __('Value','acf'),
36
- 'instructions' => __('Default value in the hidden input','acf'),
37
- 'type' => 'text',
38
- 'name' => 'default_value',
39
- ));
40
-
41
- }
42
-
43
- }
44
-
45
- // initialize
46
- acf_register_field_type('acfe_field_hidden');
47
-
48
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_field_hidden')):
7
+
8
+ class acfe_field_hidden extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'acfe_hidden';
13
+ $this->label = __('Hidden', 'acfe');
14
+ $this->category = 'basic';
15
+ $this->defaults = array(
16
+ 'default_value' => ''
17
+ );
18
+
19
+ parent::__construct();
20
+
21
+ }
22
+
23
+ function render_field($field){
24
+
25
+ ?>
26
+ <input type="hidden" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" />
27
+ <?php
28
+
29
+ }
30
+
31
+ function render_field_settings($field){
32
+
33
+ // default_value
34
+ acf_render_field_setting( $field, array(
35
+ 'label' => __('Value','acf'),
36
+ 'instructions' => __('Default value in the hidden input','acf'),
37
+ 'type' => 'text',
38
+ 'name' => 'default_value',
39
+ ));
40
+
41
+ }
42
+
43
+ }
44
+
45
+ // initialize
46
+ acf_register_field_type('acfe_field_hidden');
47
+
48
  endif;
includes/fields/field-repeater.php CHANGED
@@ -1,62 +1,62 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- /**
7
- * Add Settings
8
- */
9
- add_action('acf/render_field_settings/type=repeater', 'acfe_repeater_settings', 0);
10
- function acfe_repeater_settings($field){
11
-
12
- // Stylised button
13
- acf_render_field_setting($field, array(
14
- 'label' => __('Stylised Button'),
15
- 'name' => 'acfe_repeater_stylised_button',
16
- 'key' => 'acfe_repeater_stylised_button',
17
- 'instructions' => __('Better row button integration'),
18
- 'type' => 'true_false',
19
- 'message' => '',
20
- 'default_value' => false,
21
- 'ui' => true,
22
- ));
23
-
24
- }
25
-
26
- add_filter('acfe/field_wrapper_attributes/type=repeater', 'acfe_repeater_wrapper', 10, 2);
27
- function acfe_repeater_wrapper($wrapper, $field){
28
-
29
- // Stylised button
30
- if(isset($field['acfe_repeater_stylised_button']) && !empty($field['acfe_repeater_stylised_button'])){
31
-
32
- $wrapper['data-acfe-repeater-stylised-button'] = 1;
33
-
34
- }
35
-
36
- // Lock sortable
37
- $acfe_repeater_lock_sortable = false;
38
- $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock', $acfe_repeater_lock_sortable, $field);
39
- $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/name=' . $field['_name'], $acfe_repeater_lock_sortable, $field);
40
- $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/key=' . $field['key'], $acfe_repeater_lock_sortable, $field);
41
-
42
- if($acfe_repeater_lock_sortable){
43
-
44
- $wrapper['data-acfe-repeater-lock'] = 1;
45
-
46
- }
47
-
48
- // Remove actions
49
- $acfe_repeater_remove_actions = false;
50
- $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions', $acfe_repeater_remove_actions, $field);
51
- $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/name=' . $field['_name'], $acfe_repeater_remove_actions, $field);
52
- $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/key=' . $field['key'], $acfe_repeater_remove_actions, $field);
53
-
54
- if($acfe_repeater_remove_actions){
55
-
56
- $wrapper['data-acfe-repeater-remove-actions'] = 1;
57
-
58
- }
59
-
60
- return $wrapper;
61
-
62
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * Add Settings
8
+ */
9
+ add_action('acf/render_field_settings/type=repeater', 'acfe_repeater_settings', 0);
10
+ function acfe_repeater_settings($field){
11
+
12
+ // Stylised button
13
+ acf_render_field_setting($field, array(
14
+ 'label' => __('Stylised Button'),
15
+ 'name' => 'acfe_repeater_stylised_button',
16
+ 'key' => 'acfe_repeater_stylised_button',
17
+ 'instructions' => __('Better row button integration'),
18
+ 'type' => 'true_false',
19
+ 'message' => '',
20
+ 'default_value' => false,
21
+ 'ui' => true,
22
+ ));
23
+
24
+ }
25
+
26
+ add_filter('acfe/field_wrapper_attributes/type=repeater', 'acfe_repeater_wrapper', 10, 2);
27
+ function acfe_repeater_wrapper($wrapper, $field){
28
+
29
+ // Stylised button
30
+ if(isset($field['acfe_repeater_stylised_button']) && !empty($field['acfe_repeater_stylised_button'])){
31
+
32
+ $wrapper['data-acfe-repeater-stylised-button'] = 1;
33
+
34
+ }
35
+
36
+ // Lock sortable
37
+ $acfe_repeater_lock_sortable = false;
38
+ $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock', $acfe_repeater_lock_sortable, $field);
39
+ $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/name=' . $field['_name'], $acfe_repeater_lock_sortable, $field);
40
+ $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/key=' . $field['key'], $acfe_repeater_lock_sortable, $field);
41
+
42
+ if($acfe_repeater_lock_sortable){
43
+
44
+ $wrapper['data-acfe-repeater-lock'] = 1;
45
+
46
+ }
47
+
48
+ // Remove actions
49
+ $acfe_repeater_remove_actions = false;
50
+ $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions', $acfe_repeater_remove_actions, $field);
51
+ $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/name=' . $field['_name'], $acfe_repeater_remove_actions, $field);
52
+ $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/key=' . $field['key'], $acfe_repeater_remove_actions, $field);
53
+
54
+ if($acfe_repeater_remove_actions){
55
+
56
+ $wrapper['data-acfe-repeater-remove-actions'] = 1;
57
+
58
+ }
59
+
60
+ return $wrapper;
61
+
62
  }
includes/fields/field-slug.php CHANGED
@@ -1,105 +1,105 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_field_slug')):
7
-
8
- class acfe_field_slug extends acf_field{
9
-
10
- function __construct(){
11
-
12
- $this->name = 'acfe_slug';
13
- $this->label = __('Slug', 'acfe');
14
- $this->category = 'basic';
15
- $this->defaults = array(
16
- 'default_value' => '',
17
- 'maxlength' => '',
18
- 'placeholder' => '',
19
- 'prepend' => '',
20
- 'append' => ''
21
- );
22
-
23
- parent::__construct();
24
-
25
- }
26
-
27
- function render_field($field){
28
-
29
- $field['type'] = 'text';
30
-
31
- acf_get_field_type('text')->render_field($field);
32
-
33
- }
34
-
35
- function render_field_settings($field){
36
-
37
- // default_value
38
- acf_render_field_setting($field, array(
39
- 'label' => __('Default Value','acf'),
40
- 'instructions' => __('Appears when creating a new post','acf'),
41
- 'type' => 'text',
42
- 'name' => 'default_value',
43
- ));
44
-
45
-
46
- // placeholder
47
- acf_render_field_setting($field, array(
48
- 'label' => __('Placeholder Text','acf'),
49
- 'instructions' => __('Appears within the input','acf'),
50
- 'type' => 'text',
51
- 'name' => 'placeholder',
52
- ));
53
-
54
-
55
- // prepend
56
- acf_render_field_setting($field, array(
57
- 'label' => __('Prepend','acf'),
58
- 'instructions' => __('Appears before the input','acf'),
59
- 'type' => 'text',
60
- 'name' => 'prepend',
61
- ));
62
-
63
-
64
- // append
65
- acf_render_field_setting($field, array(
66
- 'label' => __('Append','acf'),
67
- 'instructions' => __('Appears after the input','acf'),
68
- 'type' => 'text',
69
- 'name' => 'append',
70
- ));
71
-
72
-
73
- // maxlength
74
- acf_render_field_setting($field, array(
75
- 'label' => __('Character Limit','acf'),
76
- 'instructions' => __('Leave blank for no limit','acf'),
77
- 'type' => 'number',
78
- 'name' => 'maxlength',
79
- ));
80
-
81
- }
82
-
83
- function validate_value($valid, $value, $field, $input){
84
-
85
- $value = sanitize_title($value);
86
-
87
- if($field['maxlength'] && mb_strlen(wp_unslash($value)) > $field['maxlength'])
88
- return sprintf(__('Value must not exceed %d characters', 'acf'), $field['maxlength']);
89
-
90
- return $valid;
91
-
92
- }
93
-
94
- function update_value($value, $post_id, $field){
95
-
96
- return sanitize_title($value);
97
-
98
- }
99
-
100
- }
101
-
102
- // initialize
103
- acf_register_field_type('acfe_field_slug');
104
-
105
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_field_slug')):
7
+
8
+ class acfe_field_slug extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'acfe_slug';
13
+ $this->label = __('Slug', 'acfe');
14
+ $this->category = 'basic';
15
+ $this->defaults = array(
16
+ 'default_value' => '',
17
+ 'maxlength' => '',
18
+ 'placeholder' => '',
19
+ 'prepend' => '',
20
+ 'append' => ''
21
+ );
22
+
23
+ parent::__construct();
24
+
25
+ }
26
+
27
+ function render_field($field){
28
+
29
+ $field['type'] = 'text';
30
+
31
+ acf_get_field_type('text')->render_field($field);
32
+
33
+ }
34
+
35
+ function render_field_settings($field){
36
+
37
+ // default_value
38
+ acf_render_field_setting($field, array(
39
+ 'label' => __('Default Value','acf'),
40
+ 'instructions' => __('Appears when creating a new post','acf'),
41
+ 'type' => 'text',
42
+ 'name' => 'default_value',
43
+ ));
44
+
45
+
46
+ // placeholder
47
+ acf_render_field_setting($field, array(
48
+ 'label' => __('Placeholder Text','acf'),
49
+ 'instructions' => __('Appears within the input','acf'),
50
+ 'type' => 'text',
51
+ 'name' => 'placeholder',
52
+ ));
53
+
54
+
55
+ // prepend
56
+ acf_render_field_setting($field, array(
57
+ 'label' => __('Prepend','acf'),
58
+ 'instructions' => __('Appears before the input','acf'),
59
+ 'type' => 'text',
60
+ 'name' => 'prepend',
61
+ ));
62
+
63
+
64
+ // append
65
+ acf_render_field_setting($field, array(
66
+ 'label' => __('Append','acf'),
67
+ 'instructions' => __('Appears after the input','acf'),
68
+ 'type' => 'text',
69
+ 'name' => 'append',
70
+ ));
71
+
72
+
73
+ // maxlength
74
+ acf_render_field_setting($field, array(
75
+ 'label' => __('Character Limit','acf'),
76
+ 'instructions' => __('Leave blank for no limit','acf'),
77
+ 'type' => 'number',
78
+ 'name' => 'maxlength',
79
+ ));
80
+
81
+ }
82
+
83
+ function validate_value($valid, $value, $field, $input){
84
+
85
+ $value = sanitize_title($value);
86
+
87
+ if($field['maxlength'] && mb_strlen(wp_unslash($value)) > $field['maxlength'])
88
+ return sprintf(__('Value must not exceed %d characters', 'acf'), $field['maxlength']);
89
+
90
+ return $valid;
91
+
92
+ }
93
+
94
+ function update_value($value, $post_id, $field){
95
+
96
+ return sanitize_title($value);
97
+
98
+ }
99
+
100
+ }
101
+
102
+ // initialize
103
+ acf_register_field_type('acfe_field_slug');
104
+
105
  endif;
includes/fields/field-textarea.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- // Settings
7
- add_action('acf/render_field_settings/type=textarea', 'acfe_field_textarea_settings');
8
- function acfe_field_textarea_settings($field){
9
-
10
- acf_render_field_setting($field, array(
11
- 'label' => __('Code mode'),
12
- 'name' => 'acfe_textarea_code',
13
- 'key' => 'acfe_textarea_code',
14
- 'instructions' => __('Switch font family to monospace and allow tab indent. For a more advanced code editor, please use the <code>Code Editor</code> field type'),
15
- 'type' => 'true_false',
16
- 'ui' => 1,
17
- ));
18
-
19
- }
20
-
21
- // Field wrapper
22
- add_filter('acfe/field_wrapper_attributes/type=textarea', 'acfe_field_textarea_wrapper', 10, 2);
23
- function acfe_field_textarea_wrapper($wrapper, $field){
24
-
25
- if(acf_maybe_get($field, 'acfe_textarea_code')){
26
-
27
- $wrapper['data-acfe-textarea-code'] = 1;
28
-
29
- }
30
-
31
- return $wrapper;
32
-
33
- }
34
-
35
- add_filter('acf/prepare_field/name=new_lines', 'acfe_field_textarea_new_lines');
36
- function acfe_field_textarea_new_lines($field){
37
-
38
- $field['conditional_logic'] = array(
39
- array(
40
- array(
41
- 'field' => 'acfe_textarea_code',
42
- 'operator' => '!=',
43
- 'value' => '1'
44
- )
45
- )
46
- );
47
-
48
- return $field;
49
-
50
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ // Settings
7
+ add_action('acf/render_field_settings/type=textarea', 'acfe_field_textarea_settings');
8
+ function acfe_field_textarea_settings($field){
9
+
10
+ acf_render_field_setting($field, array(
11
+ 'label' => __('Code mode'),
12
+ 'name' => 'acfe_textarea_code',
13
+ 'key' => 'acfe_textarea_code',
14
+ 'instructions' => __('Switch font family to monospace and allow tab indent. For a more advanced code editor, please use the <code>Code Editor</code> field type'),
15
+ 'type' => 'true_false',
16
+ 'ui' => 1,
17
+ ));
18
+
19
+ }
20
+
21
+ // Field wrapper
22
+ add_filter('acfe/field_wrapper_attributes/type=textarea', 'acfe_field_textarea_wrapper', 10, 2);
23
+ function acfe_field_textarea_wrapper($wrapper, $field){
24
+
25
+ if(acf_maybe_get($field, 'acfe_textarea_code')){
26
+
27
+ $wrapper['data-acfe-textarea-code'] = 1;
28
+
29
+ }
30
+
31
+ return $wrapper;
32
+
33
+ }
34
+
35
+ add_filter('acf/prepare_field/name=new_lines', 'acfe_field_textarea_new_lines');
36
+ function acfe_field_textarea_new_lines($field){
37
+
38
+ $field['conditional_logic'] = array(
39
+ array(
40
+ array(
41
+ 'field' => 'acfe_textarea_code',
42
+ 'operator' => '!=',
43
+ 'value' => '1'
44
+ )
45
+ )
46
+ );
47
+
48
+ return $field;
49
+
50
  }
includes/locations/post-type-all.php CHANGED
@@ -1,39 +1,39 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- /**
7
- * ACFE Location: Post Type All Choices
8
- */
9
- add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_all_choices');
10
- function acfe_location_post_type_all_choices($choices){
11
-
12
- $choices = array_merge(array('all' => __('All', 'acf')), $choices);
13
-
14
- return $choices;
15
-
16
- }
17
-
18
- /**
19
- * ACFE Location: Post Type All Matching
20
- */
21
- add_filter('acf/location/rule_match/post_type', 'acfe_location_post_type_all_match', 10, 3);
22
- function acfe_location_post_type_all_match($match, $rule, $options){
23
-
24
- if($rule['value'] !== 'all')
25
- return $match;
26
-
27
- if(!acf_maybe_get($options, 'post_type'))
28
- return $match;
29
-
30
- $post_types = acf_get_post_types();
31
-
32
- $match = in_array($options['post_type'], $post_types);
33
-
34
- if($rule['operator'] === '!=')
35
- $match = !$match;
36
-
37
- return $match;
38
-
39
  }
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * ACFE Location: Post Type All Choices
8
+ */
9
+ add_filter('acf/location/rule_values/post_type', 'acfe_location_post_type_all_choices');
10
+ function acfe_location_post_type_all_choices($choices){
11
+
12
+ $choices = array_merge(array('all' => __('All', 'acf')), $choices);
13
+
14
+ return $choices;
15
+
16
+ }
17
+
18
+ /**
19
+ * ACFE Location: Post Type All Matching
20
+ */
21
+ add_filter('acf/location/rule_match/post_type', 'acfe_location_post_type_all_match', 10, 3);
22
+ function acfe_location_post_type_all_match($match, $rule, $options){
23
+
24
+ if($rule['value'] !== 'all')
25
+ return $match;
26
+
27
+ if(!acf_maybe_get($options, 'post_type'))
28
+ return $match;
29
+
30
+ $post_types = acf_get_post_types();
31
+
32
+ $match = in_array($options['post_type'], $post_types);
33
+
34
+ if($rule['operator'] === '!=')
35
+ $match = !$match;
36
+
37
+ return $match;
38
+
39
  }
includes/locations/post-type-list.php CHANGED
@@ -1,428 +1,428 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_location_post_type_list')):
7
-
8
- class acfe_location_post_type_list{
9
-
10
- public $post_type;
11
-
12
- public $field_groups;
13
-
14
- function __construct(){
15
-
16
- add_action('load-edit.php', array($this, 'load'));
17
-
18
- add_filter('acf/location/rule_types', array($this, 'location_types'));
19
- add_filter('acf/location/rule_values/post_type_list', array($this, 'location_values'));
20
- add_filter('acf/location/rule_match/post_type_list', array($this, 'location_match'), 10, 3);
21
-
22
- }
23
-
24
- function load(){
25
-
26
- // Get post type
27
- global $typenow;
28
-
29
- $get_post_types = acf_get_post_types(array(
30
- 'show_ui' => 1,
31
- 'exclude' => array('attachment')
32
- ));
33
-
34
- // Check post type
35
- if(!in_array($typenow, $get_post_types))
36
- return;
37
-
38
- // vars
39
- $this->post_type = $typenow;
40
-
41
- $this->post_id = acf_get_valid_post_id($this->post_type . '_options');
42
-
43
- $this->field_groups = acf_get_field_groups(array(
44
- 'post_type_list' => $this->post_type
45
- ));
46
-
47
- if(empty($this->field_groups))
48
- return;
49
-
50
- // Submit
51
- if(acf_verify_nonce('post_type_list')){
52
-
53
- // Validate
54
- if(acf_validate_save_post(true)){
55
-
56
- // Autoload
57
- acf_update_setting('autoload', false);
58
-
59
- // Save
60
- acf_save_post($this->post_id);
61
-
62
- // Redirect
63
- wp_redirect(add_query_arg(array('message' => 'acfe_post_type_list')));
64
- exit;
65
-
66
- }
67
-
68
- }
69
-
70
- // Enqueue ACF JS
71
- acf_enqueue_scripts();
72
-
73
- // Success message
74
- if(isset($_GET['message']) && $_GET['message'] === 'acfe_post_type_list'){
75
-
76
- $object = get_post_type_object($this->post_type);
77
-
78
- acf_add_admin_notice($object->label . ' List Saved.', 'success');
79
-
80
- }
81
-
82
- add_action('in_admin_header', array($this, 'in_admin_header'));
83
-
84
- add_action('admin_footer', array($this, 'admin_footer'));
85
-
86
- }
87
-
88
- function admin_footer(){
89
-
90
- // Init field groups by position
91
- $field_groups = array();
92
-
93
- foreach($this->field_groups as $field_group){
94
-
95
- $field_groups[$field_group['position']][] = $field_group;
96
-
97
- }
98
-
99
- // Position: After Title
100
- if(acf_maybe_get($field_groups, 'acf_after_title')){
101
-
102
- $total = count($field_groups['acf_after_title']);
103
-
104
- $current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
105
-
106
- add_meta_box(
107
-
108
- // ID
109
- 'acf-' . $field_group['ID'],
110
-
111
- // Title
112
- $field_group['title'],
113
-
114
- // Render
115
- array($this, 'metabox_render'),
116
-
117
- // Screen
118
- 'edit',
119
-
120
- // Position
121
- $field_group['position'],
122
-
123
- // Priority
124
- 'default',
125
-
126
- // Args
127
- array(
128
- 'total' => $total,
129
- 'current' => $current,
130
- 'field_group' => $field_group
131
- )
132
-
133
- );
134
-
135
- }
136
-
137
- ?>
138
- <div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
139
- <form class="acf-form" action="" method="post">
140
-
141
- <div id="poststuff" style="padding-top:0;">
142
-
143
- <?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
144
-
145
- </div>
146
-
147
- </form>
148
- </div>
149
- <script type="text/javascript">
150
- (function($){
151
-
152
- // add after title
153
- $('.subsubsub').before($('#tmpl-acf-after-title'));
154
-
155
- })(jQuery);
156
- </script>
157
- <?php
158
-
159
- }
160
-
161
- // Position: Normal
162
- if(acf_maybe_get($field_groups, 'normal')){
163
-
164
- $total = count($field_groups['normal']);
165
-
166
- $current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
167
-
168
- add_meta_box(
169
-
170
- // ID
171
- 'acf-' . $field_group['ID'],
172
-
173
- // Title
174
- $field_group['title'],
175
-
176
- // Render
177
- array($this, 'metabox_render'),
178
-
179
- // Screen
180
- 'edit',
181
-
182
- // Position
183
- $field_group['position'],
184
-
185
- // Priority
186
- 'default',
187
-
188
- // Args
189
- array(
190
- 'total' => $total,
191
- 'current' => $current,
192
- 'field_group' => $field_group
193
- )
194
-
195
- );
196
-
197
- }
198
-
199
- ?>
200
- <div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
201
- <form class="acf-form" action="" method="post">
202
-
203
- <div id="poststuff">
204
-
205
- <?php do_meta_boxes('edit', 'normal', array()); ?>
206
-
207
- </div>
208
-
209
- </form>
210
- </div>
211
- <script type="text/javascript">
212
- (function($){
213
-
214
- // add normal
215
- $('#posts-filter').after($('#tmpl-acf-normal'));
216
-
217
- })(jQuery);
218
- </script>
219
- <?php
220
-
221
- }
222
-
223
- // Position: Side
224
- if(acf_maybe_get($field_groups, 'side')){
225
-
226
- $total = count($field_groups['side']);
227
-
228
- $current = 0; foreach($field_groups['side'] as $field_group){ $current++;
229
-
230
- add_meta_box(
231
-
232
- // ID
233
- 'acf-' . $field_group['ID'],
234
-
235
- // Title
236
- $field_group['title'],
237
-
238
- // Render
239
- array($this, 'metabox_render'),
240
-
241
- // Screen
242
- 'edit',
243
-
244
- // Position
245
- $field_group['position'],
246
-
247
- // Priority
248
- 'default',
249
-
250
- // Args
251
- array(
252
- 'total' => $total,
253
- 'current' => $current,
254
- 'field_group' => $field_group
255
- )
256
-
257
- );
258
-
259
- }
260
-
261
- ?>
262
- <div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
263
- <div class="acf-column-2">
264
- <form class="acf-form" action="" method="post">
265
-
266
- <div id="poststuff" style="padding-top:0; min-width:auto;">
267
-
268
- <?php do_meta_boxes('edit', 'side', array()); ?>
269
-
270
- </div>
271
-
272
- </form>
273
- </div>
274
- </div>
275
- <script type="text/javascript">
276
- (function($){
277
-
278
- // wrap form
279
- $('#posts-filter').wrap('<div class="acf-columns-2" />');
280
-
281
- // Move subsubsub inside column
282
- $('#posts-filter').prepend($('.subsubsub'));
283
-
284
- // Move After title field group
285
- $('#posts-filter').prepend($('#tmpl-acf-after-title'));
286
-
287
- // Move Normal field group
288
- $('#posts-filter').append($('#tmpl-acf-normal'));
289
-
290
- // add column main
291
- $('#posts-filter').addClass('acf-column-1');
292
-
293
- // add column side
294
- $('#posts-filter').after($('#tmpl-acf-side'));
295
-
296
- })(jQuery);
297
- </script>
298
- <?php
299
-
300
- }
301
-
302
- }
303
-
304
- function metabox_render($array, $args){
305
-
306
- $total = $args['args']['total'];
307
- $current = $args['args']['current'];
308
- $field_group = $args['args']['field_group'];
309
-
310
- // Set post_id
311
- $post_id = $this->post_id;
312
-
313
- // Set form data
314
- acf_form_data(array(
315
- 'screen' => 'post_type_list',
316
- 'post_id' => $post_id,
317
- ));
318
-
319
- // Get fields
320
- $fields = acf_get_fields($field_group);
321
-
322
- // Render fields
323
- acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
324
-
325
- if($current === $total){ ?>
326
-
327
- <?php
328
- $id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
329
- $style = ($field_group['style'] === 'seamless') ? 'padding:0 12px;' : '';
330
- ?>
331
-
332
- <div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
333
-
334
- <div id="publishing-action">
335
-
336
- <div class="acf-form-submit">
337
- <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
338
- <span class="acf-spinner"></span>
339
- </div>
340
-
341
- </div>
342
- <div class="clear"></div>
343
-
344
- </div>
345
-
346
- <?php }
347
-
348
- // Create metabox localized data.
349
- $data = array(
350
- 'id' => 'acf-' . $field_group['ID'],
351
- 'key' => $field_group['key'],
352
- 'style' => $field_group['style'],
353
- 'label' => $field_group['label_placement'],
354
- 'edit' => acf_get_field_group_edit_link($field_group['ID'])
355
- );
356
-
357
- ?>
358
- <script type="text/javascript">
359
- if( typeof acf !== 'undefined' ) {
360
- acf.newPostbox(<?php echo wp_json_encode($data); ?>);
361
- }
362
- </script>
363
-
364
- <?php
365
-
366
- }
367
-
368
- function in_admin_header(){
369
-
370
- acf_enqueue_uploader();
371
-
372
- }
373
-
374
- function location_types($choices){
375
-
376
- $name = __('Post', 'acf');
377
-
378
- $choices[$name] = acfe_array_insert_after('post_type', $choices[$name], 'post_type_list', __('Post Type List'));
379
-
380
- return $choices;
381
-
382
- }
383
-
384
-
385
- function location_values($choices){
386
-
387
- $post_types = acf_get_post_types(array(
388
- 'show_ui' => 1,
389
- 'exclude' => array('attachment')
390
- ));
391
-
392
- $pretty_post_types = array();
393
-
394
- if(!empty($post_types)){
395
-
396
- $pretty_post_types = acf_get_pretty_post_types($post_types);
397
-
398
- }
399
-
400
- $choices = array('all' => __('All', 'acf'));
401
- $choices = array_merge($choices, $pretty_post_types);
402
-
403
- return $choices;
404
-
405
- }
406
-
407
- function location_match($match, $rule, $screen){
408
-
409
- if(!acf_maybe_get($screen, 'post_type_list') || !acf_maybe_get($rule, 'value'))
410
- return $match;
411
-
412
- $match = ($screen['post_type_list'] === $rule['value']);
413
-
414
- if($rule['value'] === 'all')
415
- $match = true;
416
-
417
- if($rule['operator'] === '!=')
418
- $match = !$match;
419
-
420
- return $match;
421
-
422
- }
423
-
424
- }
425
-
426
- new acfe_location_post_type_list();
427
-
428
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_location_post_type_list')):
7
+
8
+ class acfe_location_post_type_list{
9
+
10
+ public $post_type;
11
+
12
+ public $field_groups;
13
+
14
+ function __construct(){
15
+
16
+ add_action('load-edit.php', array($this, 'load'));
17
+
18
+ add_filter('acf/location/rule_types', array($this, 'location_types'));
19
+ add_filter('acf/location/rule_values/post_type_list', array($this, 'location_values'));
20
+ add_filter('acf/location/rule_match/post_type_list', array($this, 'location_match'), 10, 3);
21
+
22
+ }
23
+
24
+ function load(){
25
+
26
+ // Get post type
27
+ global $typenow;
28
+
29
+ $get_post_types = acf_get_post_types(array(
30
+ 'show_ui' => 1,
31
+ 'exclude' => array('attachment')
32
+ ));
33
+
34
+ // Check post type
35
+ if(!in_array($typenow, $get_post_types))
36
+ return;
37
+
38
+ // vars
39
+ $this->post_type = $typenow;
40
+
41
+ $this->post_id = acf_get_valid_post_id($this->post_type . '_options');
42
+
43
+ $this->field_groups = acf_get_field_groups(array(
44
+ 'post_type_list' => $this->post_type
45
+ ));
46
+
47
+ if(empty($this->field_groups))
48
+ return;
49
+
50
+ // Submit
51
+ if(acf_verify_nonce('post_type_list')){
52
+
53
+ // Validate
54
+ if(acf_validate_save_post(true)){
55
+
56
+ // Autoload
57
+ acf_update_setting('autoload', false);
58
+
59
+ // Save
60
+ acf_save_post($this->post_id);
61
+
62
+ // Redirect
63
+ wp_redirect(add_query_arg(array('message' => 'acfe_post_type_list')));
64
+ exit;
65
+
66
+ }
67
+
68
+ }
69
+
70
+ // Enqueue ACF JS
71
+ acf_enqueue_scripts();
72
+
73
+ // Success message
74
+ if(isset($_GET['message']) && $_GET['message'] === 'acfe_post_type_list'){
75
+
76
+ $object = get_post_type_object($this->post_type);
77
+
78
+ acf_add_admin_notice($object->label . ' List Saved.', 'success');
79
+
80
+ }
81
+
82
+ add_action('in_admin_header', array($this, 'in_admin_header'));
83
+
84
+ add_action('admin_footer', array($this, 'admin_footer'));
85
+
86
+ }
87
+
88
+ function admin_footer(){
89
+
90
+ // Init field groups by position
91
+ $field_groups = array();
92
+
93
+ foreach($this->field_groups as $field_group){
94
+
95
+ $field_groups[$field_group['position']][] = $field_group;
96
+
97
+ }
98
+
99
+ // Position: After Title
100
+ if(acf_maybe_get($field_groups, 'acf_after_title')){
101
+
102
+ $total = count($field_groups['acf_after_title']);
103
+
104
+ $current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
105
+
106
+ add_meta_box(
107
+
108
+ // ID
109
+ 'acf-' . $field_group['ID'],
110
+
111
+ // Title
112
+ $field_group['title'],
113
+
114
+ // Render
115
+ array($this, 'metabox_render'),
116
+
117
+ // Screen
118
+ 'edit',
119
+
120
+ // Position
121
+ $field_group['position'],
122
+
123
+ // Priority
124
+ 'default',
125
+
126
+ // Args
127
+ array(
128
+ 'total' => $total,
129
+ 'current' => $current,
130
+ 'field_group' => $field_group
131
+ )
132
+
133
+ );
134
+
135
+ }
136
+
137
+ ?>
138
+ <div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
139
+ <form class="acf-form" action="" method="post">
140
+
141
+ <div id="poststuff" style="padding-top:0;">
142
+
143
+ <?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
144
+
145
+ </div>
146
+
147
+ </form>
148
+ </div>
149
+ <script type="text/javascript">
150
+ (function($){
151
+
152
+ // add after title
153
+ $('.subsubsub').before($('#tmpl-acf-after-title'));
154
+
155
+ })(jQuery);
156
+ </script>
157
+ <?php
158
+
159
+ }
160
+
161
+ // Position: Normal
162
+ if(acf_maybe_get($field_groups, 'normal')){
163
+
164
+ $total = count($field_groups['normal']);
165
+
166
+ $current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
167
+
168
+ add_meta_box(
169
+
170
+ // ID
171
+ 'acf-' . $field_group['ID'],
172
+
173
+ // Title
174
+ $field_group['title'],
175
+
176
+ // Render
177
+ array($this, 'metabox_render'),
178
+
179
+ // Screen
180
+ 'edit',
181
+
182
+ // Position
183
+ $field_group['position'],
184
+
185
+ // Priority
186
+ 'default',
187
+
188
+ // Args
189
+ array(
190
+ 'total' => $total,
191
+ 'current' => $current,
192
+ 'field_group' => $field_group
193
+ )
194
+
195
+ );
196
+
197
+ }
198
+
199
+ ?>
200
+ <div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
201
+ <form class="acf-form" action="" method="post">
202
+
203
+ <div id="poststuff">
204
+
205
+ <?php do_meta_boxes('edit', 'normal', array()); ?>
206
+
207
+ </div>
208
+
209
+ </form>
210
+ </div>
211
+ <script type="text/javascript">
212
+ (function($){
213
+
214
+ // add normal
215
+ $('#posts-filter').after($('#tmpl-acf-normal'));
216
+
217
+ })(jQuery);
218
+ </script>
219
+ <?php
220
+
221
+ }
222
+
223
+ // Position: Side
224
+ if(acf_maybe_get($field_groups, 'side')){
225
+
226
+ $total = count($field_groups['side']);
227
+
228
+ $current = 0; foreach($field_groups['side'] as $field_group){ $current++;
229
+
230
+ add_meta_box(
231
+
232
+ // ID
233
+ 'acf-' . $field_group['ID'],
234
+
235
+ // Title
236
+ $field_group['title'],
237
+
238
+ // Render
239
+ array($this, 'metabox_render'),
240
+
241
+ // Screen
242
+ 'edit',
243
+
244
+ // Position
245
+ $field_group['position'],
246
+
247
+ // Priority
248
+ 'default',
249
+
250
+ // Args
251
+ array(
252
+ 'total' => $total,
253
+ 'current' => $current,
254
+ 'field_group' => $field_group
255
+ )
256
+
257
+ );
258
+
259
+ }
260
+
261
+ ?>
262
+ <div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
263
+ <div class="acf-column-2">
264
+ <form class="acf-form" action="" method="post">
265
+
266
+ <div id="poststuff" style="padding-top:0; min-width:auto;">
267
+
268
+ <?php do_meta_boxes('edit', 'side', array()); ?>
269
+
270
+ </div>
271
+
272
+ </form>
273
+ </div>
274
+ </div>
275
+ <script type="text/javascript">
276
+ (function($){
277
+
278
+ // wrap form
279
+ $('#posts-filter').wrap('<div class="acf-columns-2" />');
280
+
281
+ // Move subsubsub inside column
282
+ $('#posts-filter').prepend($('.subsubsub'));
283
+
284
+ // Move After title field group
285
+ $('#posts-filter').prepend($('#tmpl-acf-after-title'));
286
+
287
+ // Move Normal field group
288
+ $('#posts-filter').append($('#tmpl-acf-normal'));
289
+
290
+ // add column main
291
+ $('#posts-filter').addClass('acf-column-1');
292
+
293
+ // add column side
294
+ $('#posts-filter').after($('#tmpl-acf-side'));
295
+
296
+ })(jQuery);
297
+ </script>
298
+ <?php
299
+
300
+ }
301
+
302
+ }
303
+
304
+ function metabox_render($array, $args){
305
+
306
+ $total = $args['args']['total'];
307
+ $current = $args['args']['current'];
308
+ $field_group = $args['args']['field_group'];
309
+
310
+ // Set post_id
311
+ $post_id = $this->post_id;
312
+
313
+ // Set form data
314
+ acf_form_data(array(
315
+ 'screen' => 'post_type_list',
316
+ 'post_id' => $post_id,
317
+ ));
318
+
319
+ // Get fields
320
+ $fields = acf_get_fields($field_group);
321
+
322
+ // Render fields
323
+ acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
324
+
325
+ if($current === $total){ ?>
326
+
327
+ <?php
328
+ $id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
329
+ $style = ($field_group['style'] === 'seamless') ? 'padding:0 12px;' : '';
330
+ ?>
331
+
332
+ <div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
333
+
334
+ <div id="publishing-action">
335
+
336
+ <div class="acf-form-submit">
337
+ <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
338
+ <span class="acf-spinner"></span>
339
+ </div>
340
+
341
+ </div>
342
+ <div class="clear"></div>
343
+
344
+ </div>
345
+
346
+ <?php }
347
+
348
+ // Create metabox localized data.
349
+ $data = array(
350
+ 'id' => 'acf-' . $field_group['ID'],
351
+ 'key' => $field_group['key'],
352
+ 'style' => $field_group['style'],
353
+ 'label' => $field_group['label_placement'],
354
+ 'edit' => acf_get_field_group_edit_link($field_group['ID'])
355
+ );
356
+
357
+ ?>
358
+ <script type="text/javascript">
359
+ if( typeof acf !== 'undefined' ) {
360
+ acf.newPostbox(<?php echo wp_json_encode($data); ?>);
361
+ }
362
+ </script>
363
+
364
+ <?php
365
+
366
+ }
367
+
368
+ function in_admin_header(){
369
+
370
+ acf_enqueue_uploader();
371
+
372
+ }
373
+
374
+ function location_types($choices){
375
+
376
+ $name = __('Post', 'acf');
377
+
378
+ $choices[$name] = acfe_array_insert_after('post_type', $choices[$name], 'post_type_list', __('Post Type List'));
379
+
380
+ return $choices;
381
+
382
+ }
383
+
384
+
385
+ function location_values($choices){
386
+
387
+ $post_types = acf_get_post_types(array(
388
+ 'show_ui' => 1,
389
+ 'exclude' => array('attachment')
390
+ ));
391
+
392
+ $pretty_post_types = array();
393
+
394
+ if(!empty($post_types)){
395
+
396
+ $pretty_post_types = acf_get_pretty_post_types($post_types);
397
+
398
+ }
399
+
400
+ $choices = array('all' => __('All', 'acf'));
401
+ $choices = array_merge($choices, $pretty_post_types);
402
+
403
+ return $choices;
404
+
405
+ }
406
+
407
+ function location_match($match, $rule, $screen){
408
+
409
+ if(!acf_maybe_get($screen, 'post_type_list') || !acf_maybe_get($rule, 'value'))
410
+ return $match;
411
+
412
+ $match = ($screen['post_type_list'] === $rule['value']);
413
+
414
+ if($rule['value'] === 'all')
415
+ $match = true;
416
+
417
+ if($rule['operator'] === '!=')
418
+ $match = !$match;
419
+
420
+ return $match;
421
+
422
+ }
423
+
424
+ }
425
+
426
+ new acfe_location_post_type_list();
427
+
428
  endif;
includes/locations/taxonomy-list.php CHANGED
@@ -1,405 +1,405 @@
1
- <?php
2
-
3
- if(!defined('ABSPATH'))
4
- exit;
5
-
6
- if(!class_exists('acfe_location_taxonomy_list')):
7
-
8
- class acfe_location_taxonomy_list{
9
-
10
- public $taxonomy;
11
-
12
- public $field_groups;
13
-
14
- function __construct(){
15
-
16
- add_action('load-edit-tags.php', array($this, 'load'));
17
-
18
- add_filter('acf/location/rule_types', array($this, 'location_types'));
19
- add_filter('acf/location/rule_values/taxonomy_list', array($this, 'location_values'));
20
- add_filter('acf/location/rule_match/taxonomy_list', array($this, 'location_match'), 10, 3);
21
-
22
- }
23
-
24
- function load(){
25
-
26
- // Get page
27
- global $pagenow;
28
-
29
- if($pagenow === 'term.php')
30
- return;
31
-
32
- // Get taxonomy
33
- global $taxnow;
34
-
35
- // Check taxonomies
36
- if(!in_array($taxnow, acf_get_taxonomies()))
37
- return;
38
-
39
- $this->taxonomy = $taxnow;
40
-
41
- $this->post_id = acf_get_valid_post_id('tax_' . $this->taxonomy . '_options');
42
-
43
- $this->field_groups = acf_get_field_groups(array(
44
- 'taxonomy_list' => $this->taxonomy
45
- ));
46
-
47
- if(empty($this->field_groups))
48
- return;
49
-
50
- // Submit
51
- if(acf_verify_nonce('taxonomy_list')){
52
-
53
- // Validate
54
- if(acf_validate_save_post(true)){
55
-
56
- // Autoload
57
- acf_update_setting('autoload', false);
58
-
59
- // Save
60
- acf_save_post($this->post_id);
61
-
62
- // Redirect
63
- wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_list')));
64
- exit;
65
-
66
- }
67
-
68
- }
69
-
70
- // Enqueue ACF JS
71
- acf_enqueue_scripts();
72
-
73
- // Success message
74
- if(isset($_GET['message']) && $_GET['message'] === 'acfe_taxonomy_list'){
75
-
76
- $object = get_taxonomy($this->taxonomy);
77
-
78
- acf_add_admin_notice($object->label . ' List Saved.', 'success');
79
-
80
- }
81
-
82
- add_action('in_admin_header', array($this, 'in_admin_header'));
83
-
84
- add_action('admin_footer', array($this, 'admin_footer'));
85
-
86
- }
87
-
88
- function admin_footer(){
89
-
90
- // Init field groups by position
91
- $field_groups = array();
92
-
93
- foreach($this->field_groups as $field_group){
94
-
95
- $field_groups[$field_group['position']][] = $field_group;
96
-
97
- }
98
-
99
- // Position: After Title
100
- if(acf_maybe_get($field_groups, 'acf_after_title')){
101
-
102
- $total = count($field_groups['acf_after_title']);
103
-
104
- $current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
105
-
106
- add_meta_box(
107
-
108
- // ID
109
- 'acf-' . $field_group['ID'],
110
-
111
- // Title
112
- $field_group['title'],
113
-
114
- // Render
115
- array($this, 'metabox_render'),
116
-
117
- // Screen
118
- 'edit',
119
-
120
- // Position
121
- $field_group['position'],
122
-
123
- // Priority
124
- 'default',
125
-
126
- // Args
127
- array(
128
- 'total' => $total,
129
- 'current' => $current,
130
- 'field_group' => $field_group
131
- )
132
-
133
- );
134
-
135
- }
136
-
137
- ?>
138
- <div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
139
- <form class="acf-form" action="" method="post">
140
-
141
- <div id="poststuff">
142
-
143
- <?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
144
-
145
- </div>
146
-
147
- </form>
148
- </div>
149
- <script type="text/javascript">
150
- (function($){
151
-
152
- // add after title
153
- $('.search-form').before($('#tmpl-acf-after-title'));
154
-
155
- })(jQuery);
156
- </script>
157
- <?php
158
-
159
- }
160
-
161
- // Position: Normal
162
- if(acf_maybe_get($field_groups, 'normal')){
163
-
164
- $total = count($field_groups['normal']);
165
-
166
- $current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
167
-
168
- add_meta_box(
169
-
170
- // ID
171
- 'acf-' . $field_group['ID'],
172
-
173
- // Title
174
- $field_group['title'],
175
-
176
- // Render
177
- array($this, 'metabox_render'),
178
-
179
- // Screen
180
- 'edit',
181
-
182
- // Position
183
- $field_group['position'],
184
-
185
- // Priority
186
- 'default',
187
-
188
- // Args
189
- array(
190
- 'total' => $total,
191
- 'current' => $current,
192
- 'field_group' => $field_group
193
- )
194
-
195
- );
196
-
197
- }
198
-
199
- ?>
200
- <div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
201
- <form class="acf-form" action="" method="post">
202
-
203
- <div id="poststuff">
204
-
205
- <?php do_meta_boxes('edit', 'normal', array()); ?>
206
-
207
- </div>
208
-
209
- </form>
210
- </div>
211
- <script type="text/javascript">
212
- (function($){
213
-
214
- // add normal
215
- $('#posts-filter').after($('#tmpl-acf-normal'));
216
-
217
- })(jQuery);
218
- </script>
219
- <?php
220
-
221
- }
222
-
223
- // Position: Side
224
- if(acf_maybe_get($field_groups, 'side')){
225
-
226
- $total = count($field_groups['side']);
227
-
228
- $current = 0; foreach($field_groups['side'] as $field_group){ $current++;
229
-
230
- add_meta_box(
231
-
232
- // ID
233
- 'acf-' . $field_group['ID'],
234
-
235
- // Title
236
- $field_group['title'],
237
-
238
- // Render
239
- array($this, 'metabox_render'),
240
-
241
- // Screen
242
- 'edit',
243
-
244
- // Position
245
- $field_group['position'],
246
-
247
- // Priority
248
- 'default',
249
-
250
- // Args
251
- array(
252
- 'total' => $total,
253
- 'current' => $current,
254
- 'field_group' => $field_group
255
- )
256
-
257
- );
258
-
259
- }
260
-
261
- ?>
262
- <div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
263
- <div class="acf-column-2">
264
- <form class="acf-form" action="" method="post">
265
-
266
- <div id="poststuff" style="padding-top:0; min-width:auto;">
267
-
268
- <?php do_meta_boxes('edit', 'side', array()); ?>
269
-
270
- </div>
271
-
272
- </form>
273
- </div>
274
- </div>
275
- <script type="text/javascript">
276
- (function($){
277
-
278
- // Wrap form
279
- $('.search-form').next('#col-container').andSelf().wrapAll('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
280
-
281
- // Move After title field group
282
- $('.acf-column-1').prepend($('#tmpl-acf-after-title'));
283
-
284
- // Add column side
285
- $('.acf-column-1').after($('#tmpl-acf-side'));
286
-
287
- })(jQuery);
288
- </script>
289
- <?php
290
-
291
- }
292
-
293
- }
294
-
295
- function metabox_render($array, $args){
296
-
297
- $total = $args['args']['total'];
298
- $current = $args['args']['current'];
299
- $field_group = $args['args']['field_group'];
300
-
301
- // Set post_id
302
- $post_id = $this->post_id;
303
-
304
- // Set form data
305
- acf_form_data(array(
306
- 'screen' => 'taxonomy_list',
307
- 'post_id' => $post_id,
308
- ));
309
-
310
- // Get fields
311
- $fields = acf_get_fields($field_group);
312
-
313
- // Render fields
314
- acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
315
-
316
- if($current === $total){ ?>
317
-
318
- <?php
319
- $id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
320
- $style = ($field_group['style'] === 'seamless') ? 'padding:0 12px;' : '';
321
- ?>
322
-
323
- <div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
324
-
325
- <div id="publishing-action">
326
-
327
- <div class="acf-form-submit">
328
- <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
329
- <span class="acf-spinner"></span>
330
- </div>
331
-
332
- </div>
333
- <div class="clear"></div>
334
-
335
- </div>
336
-
337
- <?php }
338
-
339
- // Create metabox localized data.
340
- $data = array(
341
- 'id' => 'acf-' . $field_group['ID'],
342
- 'key' => $field_group['key'],
343
- 'style' => $field_group['style'],
344
- 'label' => $field_group['label_placement'],
345
- 'edit' => acf_get_field_group_edit_link($field_group['ID'])
346
- );
347
-
348
- ?>
349
- <script type="text/javascript">
350
- if( typeof acf !== 'undefined' ) {
351
- acf.newPostbox(<?php echo wp_json_encode($data); ?>);
352
- }
353
- </script>
354
-
355
- <?php
356
-
357
- }
358
-
359
- function in_admin_header(){
360
-
361
- acf_enqueue_uploader();
362
-
363
- }
364
-
365
- function location_types($choices){
366
-
367
- $name = __('Forms', 'acf');
368
-
369
- $choices[$name] = acfe_array_insert_after('taxonomy', $choices[$name], 'taxonomy_list', __('Taxonomy List'));
370
-
371
- return $choices;
372
-
373
- }
374
-
375
- function location_values($choices){
376
-
377
- $choices = array('all' => __('All', 'acf'));
378
- $choices = array_merge($choices, acf_get_taxonomy_labels());
379
-
380
- return $choices;
381
-
382
- }
383
-
384
- function location_match($match, $rule, $screen){
385
-
386
- if(!acf_maybe_get($screen, 'taxonomy_list') || !acf_maybe_get($rule, 'value'))
387
- return $match;
388
-
389
- $match = ($screen['taxonomy_list'] === $rule['value']);
390
-
391
- if($rule['value'] === 'all')
392
- $match = true;
393
-
394
- if($rule['operator'] === '!=')
395
- $match = !$match;
396
-
397
- return $match;
398
-
399
- }
400
-
401
- }
402
-
403
- new acfe_location_taxonomy_list();
404
-
405
  endif;
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ if(!class_exists('acfe_location_taxonomy_list')):
7
+
8
+ class acfe_location_taxonomy_list{
9
+
10
+ public $taxonomy;
11
+
12
+ public $field_groups;
13
+
14
+ function __construct(){
15
+
16
+ add_action('load-edit-tags.php', array($this, 'load'));
17
+
18
+ add_filter('acf/location/rule_types', array($this, 'location_types'));
19
+ add_filter('acf/location/rule_values/taxonomy_list', array($this, 'location_values'));
20
+ add_filter('acf/location/rule_match/taxonomy_list', array($this, 'location_match'), 10, 3);
21
+
22
+ }
23
+
24
+ function load(){
25
+
26
+ // Get page
27
+ global $pagenow;
28
+
29
+ if($pagenow === 'term.php')
30
+ return;
31
+
32
+ // Get taxonomy
33
+ global $taxnow;
34
+
35
+ // Check taxonomies
36
+ if(!in_array($taxnow, acf_get_taxonomies()))
37
+ return;
38
+
39
+ $this->taxonomy = $taxnow;
40
+
41
+ $this->post_id = acf_get_valid_post_id('tax_' . $this->taxonomy . '_options');
42
+
43
+ $this->field_groups = acf_get_field_groups(array(
44
+ 'taxonomy_list' => $this->taxonomy
45
+ ));
46
+
47
+ if(empty($this->field_groups))
48
+ return;
49
+
50
+ // Submit
51
+ if(acf_verify_nonce('taxonomy_list')){
52
+
53
+ // Validate
54
+ if(acf_validate_save_post(true)){
55
+
56
+ // Autoload
57
+ acf_update_setting('autoload', false);
58
+
59
+ // Save
60
+ acf_save_post($this->post_id);
61
+
62
+ // Redirect
63
+ wp_redirect(add_query_arg(array('message' => 'acfe_taxonomy_list')));
64
+ exit;
65
+
66
+ }
67
+
68
+ }
69
+
70
+ // Enqueue ACF JS
71
+ acf_enqueue_scripts();
72
+
73
+ // Success message
74
+ if(isset($_GET['message']) && $_GET['message'] === 'acfe_taxonomy_list'){
75
+
76
+ $object = get_taxonomy($this->taxonomy);
77
+
78
+ acf_add_admin_notice($object->label . ' List Saved.', 'success');
79
+
80
+ }
81
+
82
+ add_action('in_admin_header', array($this, 'in_admin_header'));
83
+
84
+ add_action('admin_footer', array($this, 'admin_footer'));
85
+
86
+ }
87
+
88
+ function admin_footer(){
89
+
90
+ // Init field groups by position
91
+ $field_groups = array();
92
+
93
+ foreach($this->field_groups as $field_group){
94
+
95
+ $field_groups[$field_group['position']][] = $field_group;
96
+
97
+ }
98
+
99
+ // Position: After Title
100
+ if(acf_maybe_get($field_groups, 'acf_after_title')){
101
+
102
+ $total = count($field_groups['acf_after_title']);
103
+
104
+ $current = 0; foreach($field_groups['acf_after_title'] as $field_group){ $current++;
105
+
106
+ add_meta_box(
107
+
108
+ // ID
109
+ 'acf-' . $field_group['ID'],
110
+
111
+ // Title
112
+ $field_group['title'],
113
+
114
+ // Render
115
+ array($this, 'metabox_render'),
116
+
117
+ // Screen
118
+ 'edit',
119
+
120
+ // Position
121
+ $field_group['position'],
122
+
123
+ // Priority
124
+ 'default',
125
+
126
+ // Args
127
+ array(
128
+ 'total' => $total,
129
+ 'current' => $current,
130
+ 'field_group' => $field_group
131
+ )
132
+
133
+ );
134
+
135
+ }
136
+
137
+ ?>
138
+ <div id="tmpl-acf-after-title" class="acfe-postbox acfe-postbox-no-handle">
139
+ <form class="acf-form" action="" method="post">
140
+
141
+ <div id="poststuff">
142
+
143
+ <?php do_meta_boxes('edit', 'acf_after_title', array()); ?>
144
+
145
+ </div>
146
+
147
+ </form>
148
+ </div>
149
+ <script type="text/javascript">
150
+ (function($){
151
+
152
+ // add after title
153
+ $('.search-form').before($('#tmpl-acf-after-title'));
154
+
155
+ })(jQuery);
156
+ </script>
157
+ <?php
158
+
159
+ }
160
+
161
+ // Position: Normal
162
+ if(acf_maybe_get($field_groups, 'normal')){
163
+
164
+ $total = count($field_groups['normal']);
165
+
166
+ $current = 0; foreach($field_groups['normal'] as $field_group){ $current++;
167
+
168
+ add_meta_box(
169
+
170
+ // ID
171
+ 'acf-' . $field_group['ID'],
172
+
173
+ // Title
174
+ $field_group['title'],
175
+
176
+ // Render
177
+ array($this, 'metabox_render'),
178
+
179
+ // Screen
180
+ 'edit',
181
+
182
+ // Position
183
+ $field_group['position'],
184
+
185
+ // Priority
186
+ 'default',
187
+
188
+ // Args
189
+ array(
190
+ 'total' => $total,
191
+ 'current' => $current,
192
+ 'field_group' => $field_group
193
+ )
194
+
195
+ );
196
+
197
+ }
198
+
199
+ ?>
200
+ <div id="tmpl-acf-normal" class="acfe-postbox acfe-postbox-no-handle">
201
+ <form class="acf-form" action="" method="post">
202
+
203
+ <div id="poststuff">
204
+
205
+ <?php do_meta_boxes('edit', 'normal', array()); ?>
206
+
207
+ </div>
208
+
209
+ </form>
210
+ </div>
211
+ <script type="text/javascript">
212
+ (function($){
213
+
214
+ // add normal
215
+ $('#posts-filter').after($('#tmpl-acf-normal'));
216
+
217
+ })(jQuery);
218
+ </script>
219
+ <?php
220
+
221
+ }
222
+
223
+ // Position: Side
224
+ if(acf_maybe_get($field_groups, 'side')){
225
+
226
+ $total = count($field_groups['side']);
227
+
228
+ $current = 0; foreach($field_groups['side'] as $field_group){ $current++;
229
+
230
+ add_meta_box(
231
+
232
+ // ID
233
+ 'acf-' . $field_group['ID'],
234
+
235
+ // Title
236
+ $field_group['title'],
237
+
238
+ // Render
239
+ array($this, 'metabox_render'),
240
+
241
+ // Screen
242
+ 'edit',
243
+
244
+ // Position
245
+ $field_group['position'],
246
+
247
+ // Priority
248
+ 'default',
249
+
250
+ // Args
251
+ array(
252
+ 'total' => $total,
253
+ 'current' => $current,
254
+ 'field_group' => $field_group
255
+ )
256
+
257
+ );
258
+
259
+ }
260
+
261
+ ?>
262
+ <div id="tmpl-acf-side" class="acfe-postbox acfe-postbox-no-handle">
263
+ <div class="acf-column-2">
264
+ <form class="acf-form" action="" method="post">
265
+
266
+ <div id="poststuff" style="padding-top:0; min-width:auto;">
267
+
268
+ <?php do_meta_boxes('edit', 'side', array()); ?>
269
+
270
+ </div>
271
+
272
+ </form>
273
+ </div>
274
+ </div>
275
+ <script type="text/javascript">
276
+ (function($){
277
+
278
+ // Wrap form
279
+ $('.search-form').next('#col-container').andSelf().wrapAll('<div class="acf-columns-2"><div class="acf-column-1"></div></div>');
280
+
281
+ // Move After title field group
282
+ $('.acf-column-1').prepend($('#tmpl-acf-after-title'));
283
+
284
+ // Add column side
285
+ $('.acf-column-1').after($('#tmpl-acf-side'));
286
+
287
+ })(jQuery);
288
+ </script>
289
+ <?php
290
+
291
+ }
292
+
293
+ }
294
+
295
+ function metabox_render($array, $args){
296
+
297
+ $total = $args['args']['total'];
298
+ $current = $args['args']['current'];
299
+ $field_group = $args['args']['field_group'];
300
+
301
+ // Set post_id
302
+ $post_id = $this->post_id;
303
+
304
+ // Set form data
305
+ acf_form_data(array(
306
+ 'screen' => 'taxonomy_list',
307
+ 'post_id' => $post_id,
308
+ ));
309
+
310
+ // Get fields
311
+ $fields = acf_get_fields($field_group);
312
+
313
+ // Render fields
314
+ acf_render_fields($fields, $post_id, 'div', $field_group['instruction_placement']);
315
+
316
+ if($current === $total){ ?>
317
+
318
+ <?php
319
+ $id = ($field_group['style'] != 'seamless') ? 'major-publishing-actions' : '';
320
+ $style = ($field_group['style'] === 'seamless') ? 'padding:0 12px;' : '';
321
+ ?>
322
+
323
+ <div id="<?php echo $id; ?>" style="<?php echo $style; ?>">
324
+
325
+ <div id="publishing-action">
326
+
327
+ <div class="acf-form-submit">
328
+ <input type="submit" class="acf-button button button-primary button-large" value="<?php _e('Update', 'acfe'); ?>" />
329
+ <span class="acf-spinner"></span>
330
+ </div>
331
+
332
+ </div>
333
+ <div class="clear"></div>
334
+
335
+ </div>
336
+
337
+ <?php }
338
+
339
+ // Create metabox localized data.
340
+ $data = array(
341
+ 'id' => 'acf-' . $field_group['ID'],
342
+ 'key' => $field_group['key'],
343
+ 'style' => $field_group['style'],
344
+ 'label' => $field_group['label_placement'],
345
+ 'edit' => acf_get_field_group_edit_link($field_group['ID'])
346
+ );
347
+
348
+ ?>
349
+ <script type="text/javascript">
350
+ if( typeof acf !== 'undefined' ) {
351
+ acf.newPostbox(<?php echo wp_json_encode($data); ?>);
352
+ }
353
+ </script>
354
+
355
+ <?php
356
+
357
+ }
358
+
359
+ function in_admin_header(){
360
+
361
+ acf_enqueue_uploader();
362
+
363
+ }
364
+
365
+ function location_types($choices){
366
+
367
+ $name = __('Forms', 'acf');
368
+
369
+ $choices[$name] = acfe_array_insert_after('taxonomy', $choices[$name], 'taxonomy_list', __('Taxonomy List'));
370
+
371
+ return $choices;
372
+
373
+ }
374
+
375
+ function location_values($choices){
376
+
377
+ $choices = array('all' => __('All', 'acf'));
378
+ $choices = array_merge($choices, acf_get_taxonomy_labels());
379
+
380
+ return $choices;
381
+
382
+ }
383
+
384
+ function location_match($match, $rule, $screen){
385
+
386
+ if(!acf_maybe_get($screen, 'taxonomy_list') || !acf_maybe_get($rule, 'value'))
387
+ return $match;
388
+
389
+ $match = ($screen['taxonomy_list'] === $rule['value']);
390
+
391
+ if($rule['value'] === 'all')
392
+ $match = true;
393
+
394
+ if($rule['operator'] === '!=')
395
+ $match = !$match;
396
+
397
+ return $match;
398
+
399
+ }
400
+
401
+ }
402
+
403
+ new acfe_location_taxonomy_list();
404
+
405
  endif;
includes/modules/dynamic-block-type.php CHANGED
@@ -113,8 +113,55 @@ function acfe_dbt_registers(){
113
  acfe__($args['description'], 'Description', $textdomain);
114
 
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- // Register: Execute
 
 
 
 
 
 
 
 
 
 
 
 
118
  acf_register_block_type($args);
119
 
120
  }
@@ -177,6 +224,7 @@ function acfe_dbt_filter_save($post_id){
177
  $post_types = acf_get_array(get_field('post_types', $post_id));
178
  $mode = get_field('mode', $post_id);
179
  $align = get_field('align', $post_id);
 
180
  $render_template = get_field('render_template', $post_id);
181
  $render_callback = get_field('render_callback', $post_id);
182
  $enqueue_style = get_field('enqueue_style', $post_id);
@@ -193,6 +241,7 @@ function acfe_dbt_filter_save($post_id){
193
  'post_types' => $post_types,
194
  'mode' => $mode,
195
  'align' => $align,
 
196
  'render_template' => $render_template,
197
  'render_callback' => $render_callback,
198
  'enqueue_style' => $enqueue_style,
@@ -201,14 +250,14 @@ function acfe_dbt_filter_save($post_id){
201
  );
202
 
203
  // Align
204
- if($align == 'none')
205
  $register_args['align'] = '';
206
 
207
  // Icon
208
  $icon_type = get_field('icon_type', $post_id);
209
 
210
  // Icon: Simple
211
- if($icon_type == 'simple'){
212
 
213
  $icon_text = get_field('icon_text', $post_id);
214
 
@@ -260,6 +309,20 @@ function acfe_dbt_filter_save($post_id){
260
  if(!empty($supports_multiple))
261
  $register_args['supports']['multiple'] = true;
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
  // Get ACFE option
265
  $option = acfe_settings('modules.dynamic_block_type.data');
@@ -314,7 +377,7 @@ function acfe_dbt_filter_status_publish($post){
314
  if(get_post_type($post->ID) !== 'acfe-dbt')
315
  return;
316
 
317
- acfe_dop_filter_save($post->ID);
318
 
319
  }
320
 
@@ -777,6 +840,92 @@ function acfe_dbt_get_fields_labels_recursive(&$array, $field){
777
 
778
  }
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  /**
781
  * Add Local Field Group
782
  */
@@ -1392,6 +1541,13 @@ full',
1392
  'rows' => '',
1393
  'new_lines' => '',
1394
  ),
 
 
 
 
 
 
 
1395
  array(
1396
  'key' => 'field_acfe_dbt_supports_mode',
1397
  'label' => 'Mode',
113
  acfe__($args['description'], 'Description', $textdomain);
114
 
115
  }
116
+
117
+ // Template
118
+ $render_template = $args['render_template'];
119
+
120
+ if(!empty($render_template)){
121
+
122
+ $template = acfe_locate_file_path($render_template);
123
+
124
+ if(!empty($template)){
125
+
126
+ $args['render_template'] = $template;
127
+
128
+ }
129
+
130
+ }
131
+
132
+
133
+ // Style
134
+ $enqueue_style = $args['enqueue_style'];
135
+
136
+ if(!empty($enqueue_style)){
137
+
138
+ $style = acfe_locate_file_url($enqueue_style);
139
+
140
+ if(!empty($style)){
141
+
142
+ $args['enqueue_style'] = $style;
143
+
144
+ }
145
+
146
+ }
147
+
148
+
149
+ // Script
150
+ $enqueue_script = $args['enqueue_script'];
151
 
152
+ if(!empty($enqueue_script)){
153
+
154
+ $script = acfe_locate_file_url($enqueue_script);
155
+
156
+ if(!empty($script)){
157
+
158
+ $args['enqueue_script'] = $script;
159
+
160
+ }
161
+
162
+ }
163
+
164
+ // Register Block Type
165
  acf_register_block_type($args);
166
 
167
  }
224
  $post_types = acf_get_array(get_field('post_types', $post_id));
225
  $mode = get_field('mode', $post_id);
226
  $align = get_field('align', $post_id);
227
+ $align_content = get_field('align_content', $post_id);
228
  $render_template = get_field('render_template', $post_id);
229
  $render_callback = get_field('render_callback', $post_id);
230
  $enqueue_style = get_field('enqueue_style', $post_id);
241
  'post_types' => $post_types,
242
  'mode' => $mode,
243
  'align' => $align,
244
+ 'align_content' => $align_content,
245
  'render_template' => $render_template,
246
  'render_callback' => $render_callback,
247
  'enqueue_style' => $enqueue_style,
250
  );
251
 
252
  // Align
253
+ if($align === 'none')
254
  $register_args['align'] = '';
255
 
256
  // Icon
257
  $icon_type = get_field('icon_type', $post_id);
258
 
259
  // Icon: Simple
260
+ if($icon_type === 'simple'){
261
 
262
  $icon_text = get_field('icon_text', $post_id);
263
 
309
  if(!empty($supports_multiple))
310
  $register_args['supports']['multiple'] = true;
311
 
312
+ // Supports: Experimental JSX
313
+ $experimental_jsx = get_field('supports_experimental_jsx', $post_id);
314
+
315
+ $register_args['supports']['__experimental_jsx'] = false;
316
+ if(!empty($experimental_jsx))
317
+ $register_args['supports']['__experimental_jsx'] = true;
318
+
319
+ // Supports: Align Content
320
+ $supports_align_content = get_field('supports_align_content', $post_id);
321
+
322
+ $register_args['supports']['align_content'] = false;
323
+ if(!empty($supports_align_content))
324
+ $register_args['supports']['align_content'] = true;
325
+
326
 
327
  // Get ACFE option
328
  $option = acfe_settings('modules.dynamic_block_type.data');
377
  if(get_post_type($post->ID) !== 'acfe-dbt')
378
  return;
379
 
380
+ acfe_dbt_filter_save($post->ID);
381
 
382
  }
383
 
840
 
841
  }
842
 
843
+ //$__experimental_jsx = array();
844
+ $experimental_jsx = array();
845
+ $align_content = array();
846
+ $supports_align_content = array();
847
+
848
+ if(acf_version_compare(acf_get_setting('version'), '>=', '5.9')){
849
+
850
+ $experimental_jsx = array(
851
+ 'key' => 'field_acfe_dbt_supports_experimental_jsx',
852
+ 'label' => 'Inner Block',
853
+ 'name' => 'supports_experimental_jsx',
854
+ 'type' => 'true_false',
855
+ 'instructions' => 'Enable inner block feature. Defaults to false.',
856
+ 'required' => 0,
857
+ 'conditional_logic' => 0,
858
+ 'wrapper' => array(
859
+ 'width' => '',
860
+ 'class' => '',
861
+ 'id' => '',
862
+ ),
863
+ 'acfe_validate' => '',
864
+ 'acfe_update' => '',
865
+ 'acfe_permissions' => '',
866
+ 'message' => '',
867
+ 'default_value' => 0,
868
+ 'ui' => 1,
869
+ 'ui_on_text' => 'True',
870
+ 'ui_off_text' => 'False',
871
+ );
872
+
873
+ $supports_align_content = array(
874
+ 'key' => 'field_acfe_dbt_supports_align_content',
875
+ 'label' => 'Align Content',
876
+ 'name' => 'supports_align_content',
877
+ 'type' => 'true_false',
878
+ 'instructions' => 'Set the "xy" position of content using a 3×3 matrix grid. Defaults to false.',
879
+ 'required' => 0,
880
+ 'conditional_logic' => 0,
881
+ 'wrapper' => array(
882
+ 'width' => '',
883
+ 'class' => '',
884
+ 'id' => '',
885
+ ),
886
+ 'acfe_validate' => '',
887
+ 'acfe_update' => '',
888
+ 'acfe_permissions' => '',
889
+ 'message' => '',
890
+ 'default_value' => 0,
891
+ 'ui' => 1,
892
+ 'ui_on_text' => 'True',
893
+ 'ui_off_text' => 'False',
894
+ );
895
+
896
+ $align_content = array(
897
+ 'key' => 'field_acfe_dbt_align_content',
898
+ 'label' => 'Align content',
899
+ 'name' => 'align_content',
900
+ 'type' => 'text',
901
+ 'instructions' => 'Specifies the default attribute value.',
902
+ 'required' => 0,
903
+ 'conditional_logic' => array(
904
+ array(
905
+ array(
906
+ 'field' => 'field_acfe_dbt_supports_align_content',
907
+ 'operator' => '==',
908
+ 'value' => '1',
909
+ ),
910
+ ),
911
+ ),
912
+ 'wrapper' => array(
913
+ 'width' => '',
914
+ 'class' => '',
915
+ 'id' => '',
916
+ ),
917
+ 'acfe_validate' => '',
918
+ 'acfe_update' => '',
919
+ 'acfe_permissions' => '',
920
+ 'default_value' => '',
921
+ 'placeholder' => '',
922
+ 'prepend' => '',
923
+ 'append' => '',
924
+ 'maxlength' => '',
925
+ );
926
+
927
+ }
928
+
929
  /**
930
  * Add Local Field Group
931
  */
1541
  'rows' => '',
1542
  'new_lines' => '',
1543
  ),
1544
+
1545
+ $experimental_jsx,
1546
+
1547
+ $supports_align_content,
1548
+
1549
+ $align_content,
1550
+
1551
  array(
1552
  'key' => 'field_acfe_dbt_supports_mode',
1553
  'label' => 'Mode',
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
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -866,6 +866,22 @@ function my_acfe_modules(){
866
 
867
  == Changelog ==
868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869
  = 0.8.6.9 =
870
  * Field: Flexible Content - Dynamic Render - External Layout Style & Script files now check for current domain before trying to automatically enqueue `{file}-preview.css` in Preview Mode
871
  * Field: Flexible Content - Dynamic Render - Fixed `$field`, `$layout` & `$is_preview` variables which weren't correctly passed to the Layout Template file
5
  Requires at least: 4.9
6
  Tested up to: 5.4
7
  Requires PHP: 5.6
8
+ Stable tag: 0.8.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
866
 
867
  == Changelog ==
868
 
869
+ = 0.8.7 =
870
+ * General: ACF 5.9 Compatibility - Modules - Added the ACF 5.9 Header menu
871
+ * General: ACF 5.9 Compatibility - Field Groups - Removed ACFE "Locations" column
872
+ * General: ACF 5.9 Compatibility - Field Groups - Removed ACFE "Json Sync" column
873
+ * General: ACF 5.9 Compatibility - Field Groups - Enlarged "PHP Sync" & "Load" columns
874
+ * General: ACF 5.9 Compatibility - Field Groups - Removed the "Field Group Key" value from row actions
875
+ * General: ACF 5.9 Compatibility - Field Groups - Changed the text color of "Disabled" state
876
+ * General: ACF 5.9 Compatibility - Field Groups - "Description" column is hidden by default
877
+ * General: ACF 5.9 Compatibility - Flexible Content - Removed "Clone" field setting
878
+ * General: ACF 5.9 Compatibility - Flexible Content - Added "Hide: Duplicate Button" setting
879
+ * General: ACF 5.9 Compatibility - Block Type - Added "Inner Block" setting
880
+ * General: ACF 5.9 Compatibility - Block Type - Added "Supports: Align Content" setting
881
+ * General: ACF 5.9 Compatibility - Block Type - Added "Align Content" setting
882
+ * Module: Dynamic Block Type - Fixed Template, Style & Script Render paths during Block Type registration
883
+ * Field: Radio - Enhanced Group display for horizontal layout
884
+
885
  = 0.8.6.9 =
886
  * Field: Flexible Content - Dynamic Render - External Layout Style & Script files now check for current domain before trying to automatically enqueue `{file}-preview.css` in Preview Mode
887
  * Field: Flexible Content - Dynamic Render - Fixed `$field`, `$layout` & `$is_preview` variables which weren't correctly passed to the Layout Template file