PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / trunk
Advanced Custom Fields: Extended vtrunk
0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / admin / settings.php
acf-extended / includes / admin Last commit date
tools 1 month ago views 4 years ago admin.php 1 month ago menu.php 1 month ago plugins.php 1 month ago settings.php 1 month ago
settings.php
876 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_admin_settings')):
8
9 class acfe_admin_settings{
10
11 // vars
12 public $defaults = array();
13 public $updated = array();
14 public $fields = array();
15
16 /**
17 * construct
18 */
19 function __construct(){
20
21 add_action('acf/init', array($this, 'acf_pre_init'), 1);
22 add_action('acf/init', array($this, 'acf_post_init'), 100);
23
24 $this->register_fields();
25
26 }
27
28
29 /**
30 * acf_pre_init
31 */
32 function acf_pre_init(){
33 $this->defaults = acf()->settings;
34 }
35
36
37 /**
38 * acf_post_init
39 */
40 function acf_post_init(){
41
42 $settings = acfe_as_array(acf()->settings);
43
44 foreach($settings as $name => $value){
45
46 // pass thru acf/settings filter
47 $this->updated[ $name ] = acf_get_setting($name, $value);
48 }
49
50 }
51
52
53 /**
54 * register_fields
55 */
56 function register_fields(){
57
58 $this->fields = array(
59
60 // ACF
61 'acf' => array(
62
63 array(
64 'label' => 'Path',
65 'name' => 'path',
66 'type' => 'text',
67 'description' => 'Absolute path to ACF plugin folder including trailing slash.<br />Defaults to plugin_dir_path',
68 'category' => 'acf',
69 ),
70 array(
71 'label' => 'URL',
72 'name' => 'url',
73 'type' => 'text',
74 'description' => 'URL to ACF plugin folder including trailing slash. Defaults to plugin_dir_url',
75 'category' => 'acf',
76 ),
77 array(
78 'label' => 'Show admin',
79 'name' => 'show_admin',
80 'type' => 'true_false',
81 'description' => 'Show/hide ACF menu item. Defaults to true',
82 'category' => 'acf',
83 ),
84 array(
85 'label' => 'Strip slashes',
86 'name' => 'stripslashes',
87 'type' => 'true_false',
88 'description' => 'Runs the function stripslashes on all $_POST data. Some servers / WP instals may require this extra functionality. Defaults to false',
89 'category' => 'acf',
90 ),
91 array(
92 'label' => 'Local',
93 'name' => 'local',
94 'type' => 'true_false',
95 'description' => 'Enable/Disable local (PHP/json) fields. Defaults to true',
96 'category' => 'acf',
97 ),
98 array(
99 'label' => 'Json',
100 'name' => 'json',
101 'type' => 'true_false',
102 'description' => 'Enable/Disable json fields. Defaults to true',
103 'category' => 'acf',
104 ),
105 array(
106 'label' => 'Json folder (save)',
107 'name' => 'save_json',
108 'type' => 'text',
109 'description' => 'Absolute path to folder where json files will be created when field groups are saved.<br />Defaults to ‘acf-json’ folder within current theme',
110 'category' => 'acf',
111 ),
112 array(
113 'label' => 'Json folder (load)',
114 'name' => 'load_json',
115 'type' => 'text',
116 'description' => 'Array of absolutes paths to folders where field group json files can be read.<br />Defaults to an array containing at index 0, the ‘acf-json’ folder within current theme',
117 'category' => 'acf',
118 'format' => 'array',
119 ),
120 array(
121 'label' => 'Default language',
122 'name' => 'default_language',
123 'type' => 'true_false',
124 'description' => 'Language code of the default language. Defaults to ”.<br />If WPML is active, ACF will default this to the WPML default language setting',
125 'category' => 'acf',
126 ),
127 array(
128 'label' => 'Current language',
129 'name' => 'current_language',
130 'type' => 'true_false',
131 'description' => 'Language code of the current post’s language. Defaults to ”.<br />If WPML is active, ACF will default this to the WPML current language',
132 'category' => 'acf',
133 ),
134 array(
135 'label' => 'Capability',
136 'name' => 'capability',
137 'type' => 'text',
138 'description' => 'Capability used for ACF post types and if the current user can see the ACF menu item.<br />Defaults to ‘manage_options’.',
139 'category' => 'acf',
140 ),
141 array(
142 'label' => 'Show updates',
143 'name' => 'show_updates',
144 'type' => 'true_false',
145 'description' => 'Enable/Disable updates to appear in plugin list and show/hide the ACF updates admin page.<br />Defaults to true.',
146 'category' => 'acf',
147 ),
148 array(
149 'label' => 'Auto load',
150 'name' => 'autoload',
151 'type' => 'true_false',
152 'description' => 'Sets the text domain used when translating field and field group settings.<br />Defaults to ”. Strings will not be translated if this setting is empty',
153 'category' => 'acf',
154 ),
155 array(
156 'label' => 'l10n',
157 'name' => 'l10n',
158 'type' => 'true_false',
159 'description' => 'Allows ACF to translate field and field group settings using the __() function.<br />Defaults to true. Useful to override translation without modifying the textdomain',
160 'category' => 'acf',
161 ),
162 array(
163 'label' => 'l10n textdomain',
164 'name' => 'l10n_textdomain',
165 'type' => 'text',
166 'description' => 'Sets the text domain used when translating field and field group settings.<br />Defaults to ”. Strings will not be translated if this setting is empty',
167 'category' => 'acf',
168 ),
169 array(
170 'label' => 'Google API key',
171 'name' => 'google_api_key',
172 'type' => 'text',
173 'description' => 'Specify a Google Maps API authentication key to prevent usage limits.<br />Defaults to ”',
174 'category' => 'acf',
175 ),
176 array(
177 'label' => 'Google API client',
178 'name' => 'google_api_client',
179 'type' => 'text',
180 'description' => 'Specify a Google Maps API Client ID to prevent usage limits.<br />Not needed if using <code>google_api_key</code>. Defaults to ”',
181 'category' => 'acf',
182 ),
183 array(
184 'label' => 'Enqueue Google Maps',
185 'name' => 'enqueue_google_maps',
186 'type' => 'true_false',
187 'description' => 'Allows ACF to enqueue and load the Google Maps API JS library.<br />Defaults to true',
188 'category' => 'acf',
189 ),
190 array(
191 'label' => 'Enqueue Select2',
192 'name' => 'enqueue_select2',
193 'type' => 'true_false',
194 'description' => 'Allows ACF to enqueue and load the Select2 JS/CSS library.<br />Defaults to true',
195 'category' => 'acf',
196 ),
197 array(
198 'label' => 'Select2 version',
199 'name' => 'select2_version',
200 'type' => 'text',
201 'description' => 'Defines which version of Select2 library to enqueue. Either 3 or 4.<br />Defaults to 4 since ACF 5.6.0',
202 'category' => 'acf',
203 ),
204 array(
205 'label' => 'Enqueue Date picker',
206 'name' => 'enqueue_datepicker',
207 'type' => 'true_false',
208 'description' => 'Allows ACF to enqueue and load the WP datepicker JS/CSS library.<br />Defaults to true',
209 'category' => 'acf',
210 ),
211 array(
212 'label' => 'Enqueue Date Time picker',
213 'name' => 'enqueue_datetimepicker',
214 'type' => 'true_false',
215 'description' => 'Allows ACF to enqueue and load the datetimepicker JS/CSS library.<br />Defaults to true',
216 'category' => 'acf',
217 ),
218 array(
219 'label' => 'Row index offset',
220 'name' => 'row_index_offset',
221 'type' => 'text',
222 'description' => 'Defines the starting index used in all ‘loop’ and ‘row’ functions.<br />Defaults to 1 (1 is the first row), can be changed to 0 (0 is the first row)',
223 'category' => 'acf',
224 ),
225 array(
226 'label' => 'Remove WP meta box',
227 'name' => 'remove_wp_meta_box',
228 'type' => 'true_false',
229 'description' => 'Allows ACF to remove the default WP custom fields metabox. Defaults to true',
230 'category' => 'acf',
231 ),
232 array(
233 'label' => 'Rest API enabled',
234 'name' => 'rest_api_enabled',
235 'type' => 'true_false',
236 'description' => 'Enables/disables the ACF REST API integration.. Defaults to true',
237 'category' => 'acf',
238 ),
239 array(
240 'label' => 'Rest API format',
241 'name' => 'rest_api_format',
242 'type' => 'text',
243 'description' => 'Defines how ACF formats field values in the REST API. Defaults to light',
244 'category' => 'acf',
245 ),
246 array(
247 'label' => 'Rest API Embed Links',
248 'name' => 'rest_api_embed_links',
249 'type' => 'true_false',
250 'description' => 'Enables/disables embed links for ACF fields in the REST API. Defaults to true',
251 'category' => 'acf',
252 ),
253 array(
254 'label' => 'Preload Blocks',
255 'name' => 'preload_blocks',
256 'type' => 'true_false',
257 'description' => 'Allows ACF to preload the initial render html of ACF Blocks into the block editor. Defaults to true',
258 'category' => 'acf',
259 ),
260 array(
261 'label' => 'Enable Shortcode',
262 'name' => 'enable_shortcode',
263 'type' => 'true_false',
264 'description' => 'Enable the ACF shortcode. Defaults to true',
265 'category' => 'acf',
266 ),
267
268 ),
269
270
271 // ACFE
272 'acfe' => array(
273
274 array(
275 'label' => 'Theme Folder',
276 'name' => 'acfe/theme_folder',
277 'type' => 'text',
278 'description' => 'Detected Theme Folder',
279 'category' => 'acfe',
280 ),
281 array(
282 'label' => 'Theme Path',
283 'name' => 'acfe/theme_path',
284 'type' => 'text',
285 'description' => 'Detected Theme Path',
286 'category' => 'acfe',
287 ),
288 array(
289 'label' => 'Theme URL',
290 'name' => 'acfe/theme_url',
291 'type' => 'text',
292 'description' => 'Detected Theme URL',
293 'category' => 'acfe',
294 ),
295
296 ),
297
298 // AutoSync
299 'autosync' => array(
300
301 array(
302 'label' => 'Json',
303 'name' => 'acfe/json',
304 'type' => 'true_false',
305 'description' => 'Whenever Json AutoSync is enabled',
306 'category' => 'autosync',
307 ),
308 array(
309 'label' => 'Json: Load',
310 'name' => 'acfe/json_load',
311 'type' => 'text',
312 'description' => 'Json AutoSync load paths (array)',
313 'category' => 'autosync',
314 'format' => 'array',
315 ),
316 array(
317 'label' => 'Json: Save',
318 'name' => 'acfe/json_save',
319 'type' => 'text',
320 'description' => 'Json AutoSync saving path',
321 'category' => 'autosync',
322 ),
323 array(
324 'label' => 'PHP',
325 'name' => 'acfe/php',
326 'type' => 'true_false',
327 'description' => 'Whenever PHP AutoSync is enabled',
328 'category' => 'autosync',
329 ),
330 array(
331 'label' => 'PHP: Load',
332 'name' => 'acfe/php_load',
333 'type' => 'text',
334 'description' => 'PHP AutoSync load paths (array)',
335 'category' => 'autosync',
336 'format' => 'array',
337 ),
338 array(
339 'label' => 'PHP: Save',
340 'name' => 'acfe/php_save',
341 'type' => 'text',
342 'description' => 'PHP AutoSync saving path',
343 'category' => 'autosync',
344 ),
345
346 ),
347
348 // Modules
349 'modules' => array(
350
351 array(
352 'label' => 'Author',
353 'name' => 'acfe/modules/author',
354 'type' => 'true_false',
355 'description' => 'Show/hide the Author module. Defaults to true',
356 'category' => 'modules',
357 ),
358 array(
359 'label' => 'Block Types',
360 'name' => 'acfe/modules/block_types',
361 'type' => 'true_false',
362 'description' => 'Show/hide the Block Types module. Defaults to true',
363 'category' => 'modules',
364 ),
365 array(
366 'label' => 'Categories',
367 'name' => 'acfe/modules/categories',
368 'type' => 'true_false',
369 'description' => 'Enable/disable the Field Group Categories taxonomy. Defaults to true',
370 'category' => 'modules',
371 ),
372 array(
373 'label' => 'Developer mode',
374 'name' => 'acfe/dev',
375 'type' => 'true_false',
376 'description' => 'Show/hide the advanced WP post meta box. Defaults to false',
377 'category' => 'modules',
378 ),
379 array(
380 'label' => 'Forms',
381 'name' => 'acfe/modules/forms',
382 'type' => 'true_false',
383 'description' => 'Show/hide the Forms module. Defaults to true',
384 'category' => 'modules',
385 ),
386 array(
387 'label' => 'Forms: Top Level',
388 'name' => 'acfe/modules/forms/top_level',
389 'type' => 'true_false',
390 'description' => 'Show/hide the Forms module as top level menu. Defaults to false',
391 'category' => 'modules',
392 ),
393 array(
394 'label' => 'Multilangual',
395 'name' => 'acfe/modules/multilang',
396 'type' => 'true_false',
397 'description' => 'Enable/disable Multilang compatibility module for WPML & Polylang. Defaults to true',
398 'category' => 'modules',
399 ),
400 array(
401 'label' => 'Options',
402 'name' => 'acfe/modules/options',
403 'type' => 'true_false',
404 'description' => 'Show/hide the Options module. Defaults to true',
405 'category' => 'modules',
406 ),
407 array(
408 'label' => 'Options Pages',
409 'name' => 'acfe/modules/options_pages',
410 'type' => 'true_false',
411 'description' => 'Show/hide the Options Pages module. Defaults to true',
412 'category' => 'modules',
413 ),
414 array(
415 'label' => 'Performance',
416 'name' => 'acfe/modules/performance',
417 'type' => 'text',
418 'description' => 'Enable/disable Performance module. Defaults to false',
419 'category' => 'modules',
420 ),
421 array(
422 'label' => 'Post Types',
423 'name' => 'acfe/modules/post_types',
424 'type' => 'true_false',
425 'description' => 'Show/hide the Post Types module. Defaults to true',
426 'category' => 'modules',
427 ),
428 array(
429 'label' => 'Taxonomies',
430 'name' => 'acfe/modules/taxonomies',
431 'type' => 'true_false',
432 'description' => 'Show/hide the Taxonomies module. Defaults to true',
433 'category' => 'modules',
434 ),
435 array(
436 'label' => 'UI Enhancements',
437 'name' => 'acfe/modules/ui',
438 'type' => 'true_false',
439 'description' => 'Show/hide All UI enhancements module. Defaults to true',
440 'category' => 'modules',
441 ),
442 array(
443 'label' => 'UI Enhancements: Attachment',
444 'name' => 'acfe/modules/attachment_ui',
445 'type' => 'true_false',
446 'description' => 'Show/hide the Attachment UI enhancements module. Defaults to true',
447 'category' => 'modules',
448 ),
449 array(
450 'label' => 'UI Enhancements: Settings',
451 'name' => 'acfe/modules/settings_ui',
452 'type' => 'true_false',
453 'description' => 'Show/hide the WP Settings UI enhancements module. Defaults to true',
454 'category' => 'modules',
455 ),
456 array(
457 'label' => 'UI Enhancements: Term',
458 'name' => 'acfe/modules/term_ui',
459 'type' => 'true_false',
460 'description' => 'Show/hide the Term UI enhancements module. Defaults to true',
461 'category' => 'modules',
462 ),
463 array(
464 'label' => 'UI Enhancements: User',
465 'name' => 'acfe/modules/user_ui',
466 'type' => 'true_false',
467 'description' => 'Show/hide the User UI enhancements module. Defaults to true',
468 'category' => 'modules',
469 ),
470 array(
471 'label' => 'UI Enhancements: WP 7.0',
472 'name' => 'acfe/modules/wp7_ui',
473 'type' => 'true_false',
474 'description' => 'Enable the WordPress 7.0 UI enhancements module. Defaults to true',
475 'category' => 'modules',
476 ),
477
478 ),
479
480 // Fields
481 'fields' => array(
482
483 array(
484 'label' => 'reCaptcha: Secret key',
485 'name' => 'acfe/field/recaptcha/secret_key',
486 'type' => 'text',
487 'description' => 'The default reCaptcha secret key',
488 'category' => 'fields',
489 ),
490 array(
491 'label' => 'reCaptcha: Site key',
492 'name' => 'acfe/field/recaptcha/site_key',
493 'type' => 'text',
494 'description' => 'The default reCaptcha site key',
495 'category' => 'fields',
496 ),
497 array(
498 'label' => 'reCaptcha: Version',
499 'name' => 'acfe/field/recaptcha/version',
500 'type' => 'text',
501 'description' => 'The default reCaptcha version',
502 'category' => 'fields',
503 ),
504 array(
505 'label' => 'reCaptcha: V2 size',
506 'name' => 'acfe/field/recaptcha/v2/size',
507 'type' => 'text',
508 'description' => 'The default reCaptcha v2 size',
509 'category' => 'fields',
510 ),
511 array(
512 'label' => 'reCaptcha: V2 theme',
513 'name' => 'acfe/field/recaptcha/v2/theme',
514 'type' => 'text',
515 'description' => 'The default reCaptcha v2 theme',
516 'category' => 'fields',
517 ),
518 array(
519 'label' => 'reCaptcha: V3 hide logo',
520 'name' => 'acfe/field/recaptcha/v3/hide_logo',
521 'type' => 'true_false',
522 'description' => 'Show/hide reCaptcha v3 logo',
523 'category' => 'fields',
524 ),
525 array(
526 'label' => 'Compatibility: Field Group',
527 'name' => 'acfe/compatibility/legacy_field_group',
528 'type' => 'true_false',
529 'description' => 'Enforce legacy Field Group settings structure when migrating to ACFE 0.9.2.6+',
530 'category' => 'fields',
531 ),
532 array(
533 'label' => 'Compatibility: Title/Toggle',
534 'name' => 'acfe/compatibility/legacy_title_toggle',
535 'type' => 'true_false',
536 'description' => 'Enforce legacy Flexible Content Title/Toggle settings when migrating to ACF 6.5+',
537 'category' => 'fields',
538 ),
539
540 ),
541
542 );
543
544 }
545
546 }
547
548 // instantiate
549 acf_new_instance('acfe_admin_settings');
550
551 endif;
552
553 if(!class_exists('acfe_admin_settings_ui')):
554
555 class acfe_admin_settings_ui{
556
557 // vars
558 public $defaults = array();
559 public $updated = array();
560 public $fields = array();
561
562 /**
563 * construct
564 */
565 function __construct(){
566
567 add_action('admin_menu', array($this, 'admin_menu'));
568 add_action('acfe/admin_settings/load', array($this, 'load'));
569 add_action('acfe/admin_settings/html', array($this, 'html'));
570
571 }
572
573
574 /**
575 * admin_menu
576 */
577 function admin_menu(){
578
579 if(!acf_get_setting('show_admin')){
580 return;
581 }
582
583 $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Settings'), __('Settings'), acf_get_setting('capability'), 'acfe-settings', array($this, 'menu_html'));
584
585 add_action("load-{$page}", array($this, 'menu_load'));
586
587 }
588
589
590 /**
591 * menu_load
592 */
593 function menu_load(){
594 do_action('acfe/admin_settings/load');
595 }
596
597
598 /**
599 * menu_html
600 */
601 function menu_html(){
602 do_action('acfe/admin_settings/html');
603 }
604
605
606 /**
607 * load
608 */
609 function load(){
610
611 $acfe_admin_settings = acf_get_instance('acfe_admin_settings');
612
613 $this->defaults = $acfe_admin_settings->defaults;
614 $this->updated = $acfe_admin_settings->updated;
615 $this->fields = $acfe_admin_settings->fields;
616
617 // Enqueue
618 acf_enqueue_scripts();
619
620 add_action('admin_footer', array($this, 'admin_footer'));
621
622 }
623
624
625 /**
626 * admin_footer
627 */
628 function admin_footer(){
629 ?>
630 <script type="text/javascript">
631 (function($) {
632 $('body').removeClass('post-type-acf-field-group');
633 })(jQuery);
634 </script>
635 <?php
636 }
637
638
639 /**
640 * prepare_setting
641 *
642 * @param $setting
643 *
644 * @return array|false
645 */
646 function prepare_setting($setting){
647
648 $setting = wp_parse_args($setting, array(
649 'label' => '',
650 'name' => '',
651 'type' => '',
652 'description' => '',
653 'category' => '',
654 'format' => '',
655 'default' => '',
656 'updated' => '',
657 'diff' => false,
658 ));
659
660 $name = $setting['name'];
661 $type = $setting['type'];
662
663 // setting doesn't exist in default acf settings
664 // probably an older version of acf
665 if(!isset($this->defaults[ $name ])){
666 return false;
667 }
668
669 $format = $setting['format'];
670 $default = $this->defaults[ $name ];
671 $updated = $this->updated[ $name ];
672
673 $vars = array(
674 'default' => $this->defaults[ $name ],
675 'updated' => $this->updated[ $name ]
676 );
677
678 foreach($vars as $v => $var){
679
680 $result = $var;
681
682 if($type === 'true_false'){
683
684 $result = $var ? '<span class="dashicons dashicons-saved"></span>' : '<span class="dashicons dashicons-no-alt"></span>';
685
686 }elseif($type === 'text'){
687
688 $result = '<span class="dashicons dashicons-no-alt"></span>';
689
690 if($format === 'array' && empty($var) && $v === 'updated' && $default !== $updated){
691 $var = array('(empty)');
692 }
693
694 if(!empty($var)){
695
696 if(!is_array($var)){
697 $var = explode(',', $var);
698 }
699
700 foreach($var as $k => &$r){
701 if(is_array($r)){
702 $encode = json_encode($r);
703 $r = '<div class="acfe-settings-text"><code>' . $encode . '</code></div>';
704 }else{
705
706 if(!is_numeric($k)){
707 $r = "{$k} = {$r}";
708 }
709
710 $r = '<div class="acf-js-tooltip acfe-settings-text" title="' . $r . '"><code>' . $r . '</code></div>';
711 }
712 }
713
714 $result = implode('', $var);
715
716 }
717
718 }
719
720 $setting[$v] = $result;
721
722 }
723
724 // Local Changes
725 if($default !== $updated){
726
727 $setting['updated'] .= '<span style="color:#888; margin-left:7px;vertical-align: 6px;font-size:11px;">(Local code)</span>';
728 $setting['diff'] = true;
729
730 }
731
732 return $setting;
733
734 }
735
736
737 /**
738 * html
739 */
740 function html(){
741 ?>
742 <div class="wrap" id="acfe-admin-settings">
743
744 <h1><?php _e('Settings'); ?></h1>
745
746 <div id="poststuff">
747 <div id="post-body" class="metabox-holder">
748
749 <!-- Metabox -->
750 <div id="postbox-container-2" class="postbox-container">
751
752 <div class="postbox acf-postbox">
753 <div class="postbox-header">
754 <h2 class="hndle ui-sortable-handle"><span><?php _e('Settings'); ?></span></h2>
755 </div>
756 <div class="inside acf-fields -left">
757
758 <?php $this->render_fields(); ?>
759
760 <script type="text/javascript">
761 if(typeof acf !== 'undefined'){
762 acf.newPostbox({
763 'id': 'acfe-settings',
764 'label': 'left'
765 });
766 }
767 </script>
768 </div>
769 </div>
770
771 </div>
772
773 </div>
774 </div>
775
776 </div>
777 <?php
778 }
779
780
781 /**
782 * render_fields
783 */
784 function render_fields(){
785
786 foreach(array('ACF', 'ACFE', 'AutoSync', 'Modules', 'Fields') as $tab){
787
788 // Category
789 $category = sanitize_title($tab);
790
791 if(isset($this->fields[$category])){
792
793 $fields = array();
794 $count = 0;
795
796 foreach($this->fields[$category] as $field){
797
798 $field = $this->prepare_setting($field);
799
800 // make sure the setting exists
801 if($field){
802 $fields[] = $field;
803 }
804
805 }
806
807 foreach($fields as $field){
808
809 if(!$field['diff']) continue;
810 $count++;
811
812 }
813
814 $class = $count > 0 ? 'acfe-tab-badge' : 'acfe-tab-badge acf-hidden';
815 $tab .= ' <span class="' . $class . '">' . $count . '</span>';
816
817 // Tab
818 acf_render_field_wrap(array(
819 'type' => 'tab',
820 'label' => $tab,
821 'key' => 'field_acfe_settings_tabs',
822 'wrapper' => array(
823 'data-no-preference' => true,
824 ),
825 ));
826
827 // Thead
828 acf_render_field_wrap(array(
829 'type' => 'acfe_dynamic_render',
830 'label' => '',
831 'key' => 'field_acfe_settings_thead_' . $category,
832 'wrapper' => array(
833 'class' => 'acfe-settings-thead'
834 ),
835 'render' => function($field){
836 ?>
837 <div>Default</div>
838 <div>Registered</div>
839 <?php
840 }
841 ));
842
843 $icon = acf_version_compare('wp', '>=', '5.5') ? 'dashicons-info-outline' : 'dashicons-info';
844
845 foreach($fields as $field){ ?>
846
847 <div class="acf-field">
848 <div class="acf-label">
849 <span class="acfe-field-tooltip acfe-js-tooltip dashicons <?php echo $icon; ?>" title="<?php echo $field['name']; ?>"></span>
850 <label><?php echo $field['label']; ?></label>
851 <?php if($field['description']){ ?>
852 <p class="description"><?php echo $field['description']; ?></p>
853 <?php } ?>
854 </div>
855 <div class="acf-input">
856
857 <div><?php echo $field['default']; ?></div>
858 <div><?php echo $field['updated']; ?></div>
859
860 </div>
861 </div>
862
863 <?php
864 }
865
866 }
867
868 }
869
870 }
871
872 }
873
874 acf_new_instance('acfe_admin_settings_ui');
875
876 endif;