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 / compatibility.php
acf-extended / includes Last commit date
admin 1 month ago field-groups 1 month ago fields 1 month ago fields-settings 1 month ago forms 1 month ago locations 1 month ago modules 1 month ago screens 1 month ago acfe-deprecated-functions.php 2 years ago acfe-field-functions.php 1 month ago acfe-field-group-functions.php 1 month ago acfe-file-functions.php 1 year ago acfe-form-functions.php 1 month ago acfe-helper-array-functions.php 1 month ago acfe-helper-functions.php 1 month ago acfe-helper-multi-functions.php 1 month ago acfe-helper-string-functions.php 1 month ago acfe-meta-functions.php 1 month ago acfe-post-functions.php 1 month ago acfe-screen-functions.php 1 month ago acfe-template-functions.php 1 month ago acfe-term-functions.php 1 month ago acfe-user-functions.php 1 month ago acfe-wp-functions.php 3 years ago assets.php 1 month ago compatibility-acf-5.8.php 2 months ago compatibility-acf-5.9.php 2 months ago compatibility-acf-6.5.php 1 month ago compatibility.php 1 month ago field-extend.php 2 months ago field.php 2 months ago hooks.php 1 month ago init.php 2 months ago local-meta.php 3 years ago media.php 1 month ago module-acf.php 1 month ago module-db.php 1 month ago module-l10n.php 1 month ago module-legacy.php 3 years ago module-manager.php 2 months ago module-post.php 1 month ago module-posts.php 2 months ago module-upgrades.php 3 years ago module.php 1 month ago multilang.php 1 month ago revisions.php 2 months ago screen.php 1 month ago settings.php 1 month ago template-tags.php 1 month ago third-party.php 3 years ago upgrades.php 1 month ago
compatibility.php
646 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_compatibility')):
8
9 class acfe_compatibility{
10
11 /**
12 * construct
13 */
14 function __construct(){
15
16 // global
17 add_action('acf/init', array($this, 'acf_init'), 98);
18 add_action('acfe/init', array($this, 'acfe_init'), 99);
19
20 // fields
21 add_filter('acf/validate_field_group', array($this, 'field_group_location_list'), 20);
22 add_filter('acf/validate_field_group', array($this, 'field_group_instruction_tooltip'), 20);
23 add_filter('acf/validate_field_group', array($this, 'field_group_nested_settings'), 20);
24 add_filter('acf/validate_field_group', array($this, 'field_group_nested_settings_legacy'), 20);
25 add_filter('acf/validate_field_group', array($this, 'field_group_display_title'), 20);
26 add_filter('acf/validate_field', array($this, 'field_acfe_update'), 20);
27 add_filter('acf/validate_field/type=group', array($this, 'field_seamless_style'), 20);
28 add_filter('acf/validate_field/type=clone', array($this, 'field_seamless_style'), 20);
29 add_filter('acf/validate_field/type=acfe_dynamic_message', array($this, 'field_dynamic_message'), 20);
30 add_filter('acf/validate_field/type=acfe_column', array($this, 'field_column'), 20);
31 add_filter('acf/validate_field/type=image', array($this, 'field_image'), 20);
32 add_filter('acf/validate_field/type=file', array($this, 'field_image'), 20);
33 add_filter('acf/validate_field/type=acfe_forms', array($this, 'field_forms'), 20);
34 add_filter('acf/validate_field/type=acfe_code_editor', array($this, 'field_code_editor'), 20);
35 add_filter('acfe/load_fields/type=flexible_content', array($this, 'field_flexible_settings_title'), 20, 2);
36 add_filter('acf/prepare_field/name=acfe_flexible_category', array($this, 'field_flexible_layout_categories'), 10, 2);
37
38 }
39
40
41 /**
42 * acf_init
43 *
44 * acf/init:98
45 *
46 * Rename modules
47 *
48 * @since 0.8 (20/10/2019)
49 */
50 function acf_init(){
51
52 /**
53 * acfe/flexible/render/template
54 *
55 * Remove temporary fix for preview get_row() usage provided for ACFE 0.9.0.8
56 */
57 remove_filter('acfe/flexible/render/template', 'acfe_fix_flexible_content_preview_get_row', 0);
58
59 /***
60 * admin_body_class
61 */
62 add_filter('admin_body_class', array($this, 'admin_body_class'));
63
64 // settings list
65 $settings = array(
66 'acfe_php' => 'acfe/php',
67 'php_save' => 'acfe/php_save',
68 'php_load' => 'acfe/php_load',
69 'php_found' => 'acfe/php_found',
70 'acfe/modules/dynamic_block_types' => 'acfe/modules/block_types',
71 'acfe/modules/dynamic_forms' => 'acfe/modules/forms',
72 'acfe/modules/dynamic_options_pages' => 'acfe/modules/options_pages',
73 'acfe/modules/dynamic_post_types' => 'acfe/modules/post_types',
74 'acfe/modules/dynamic_taxonomies' => 'acfe/modules/taxonomies',
75 );
76
77 // loop settings
78 foreach($settings as $old => $new){
79
80 // get old setting 'acfe_php'
81 $value = acf_get_setting($old);
82
83 if($value !== null){
84
85 // deprecated notice
86 acfe_deprecated_setting($old, '0.8', $new);
87
88 // update setting
89 acf_update_setting($new, $value);
90
91 }
92
93 }
94
95 }
96
97
98 /**
99 * admin_body_class
100 *
101 * Add class to admin body to fix acf postbox cog icon breaking line-height in WP 6.5
102 *
103 * @param $classes
104 *
105 * @return mixed|string
106 */
107 function admin_body_class($classes){
108
109 // validate
110 if(!is_string($classes)){
111 return $classes;
112 }
113
114 // wp 6.5+
115 if(acfe_is_wp('6.5')){
116 $classes .= ' acfe-wp-6-5';
117 }
118
119 // wp 7.0+
120 if(acfe_is_wp('7.0') && acfe_get_setting('modules/wp7_ui')){
121 $classes .= ' acfe-wp-7-0';
122 }
123
124 // return
125 return $classes;
126
127 }
128
129
130
131 /**
132 * acfe_init
133 *
134 * acfe/init:99
135 *
136 * @since 0.8.9.3 (03/2023)
137 */
138 function acfe_init(){
139
140 // get old setting
141 $setting = acf_get_setting('acfe/modules/single_meta');
142
143 if($setting !== null){
144
145 // deprecated notice
146 acfe_deprecated_setting('acfe/modules/single_meta', '0.8.9.3', 'acfe/modules/performance');
147
148 // update setting
149 if($setting){
150 acf_update_setting('acfe/modules/performance', 'ultra');
151 }
152
153 }
154
155 }
156
157
158 /**
159 * field_group_location_list
160 *
161 * acf/validate_field_group:20
162 *
163 * Field Group Location: Archive renamed to List
164 *
165 * @since 0.8 (20/10/2019)
166 */
167 function field_group_location_list($field_group){
168
169 if(!acfe_get($field_group, 'location')){
170 return $field_group;
171 }
172
173 foreach($field_group['location'] as &$or){
174
175 foreach($or as &$and){
176
177 if(!isset($and['value'])){
178 continue;
179 }
180
181 // post type list
182 // replace old 'my-post-type_archive'
183 if($and['param'] === 'post_type' && acfe_ends_with($and['value'], '_archive')){
184
185 $and['param'] = 'post_type_list';
186 $and['value'] = substr_replace($and['value'], '', -8);
187
188 // taxonomy list
189 // replace old 'my-taxonomy_archive'
190 }elseif($and['param'] === 'taxonomy' && acfe_ends_with($and['value'], '_archive')){
191
192 $and['param'] = 'taxonomy_list';
193 $and['value'] = substr_replace($and['value'], '', -8);
194
195 }
196
197 }
198
199 }
200
201 return $field_group;
202
203 }
204
205
206 /**
207 * field_group_instruction_tooltip
208 *
209 * Tooltip old parameter name compatibility
210 *
211 * @param $field_group
212 *
213 * @since 0.8.7.5 (11/12/2020)
214 *
215 * @return mixed
216 */
217 function field_group_instruction_tooltip($field_group){
218
219 if(acfe_get($field_group, 'instruction_placement') === 'acfe_instructions_tooltip'){
220 $field_group['instruction_placement'] = 'tooltip';
221 }
222
223 return $field_group;
224
225 }
226
227
228 /**
229 * field_group_nested_settings
230 *
231 * Migrate old ACFE settings to new nested group settings
232 *
233 * @param $field_group
234 *
235 * @since 0.9.2.6
236 *
237 * @return array
238 */
239 function field_group_nested_settings($field_group){
240
241 if(!empty($field_group['acfe_meta'])){
242 $field_group['acfe_meta'] = acfe_as_array($field_group['acfe_meta']);
243 $field_group['acfe_meta'] = acfe_array_rewrite($field_group['acfe_meta'], function($row, $key){
244 return array($key => array(
245 'key' => acfe_get($row, 'acfe_meta_key'),
246 'value' => acfe_get($row, 'acfe_meta_value'),
247 ));
248 });
249 }
250
251
252 if(isset($field_group['acfe_form']) && !acfe_has($field_group, 'acfe.advanced')){
253 acfe_set($field_group, 'acfe.advanced', $field_group['acfe_form']);
254 }
255 unset($field_group['acfe_form']);
256
257 if(isset($field_group['acfe_meta']) && !acfe_has($field_group, 'acfe.meta')){
258 acfe_set($field_group, 'acfe.meta', $field_group['acfe_meta']);
259 }
260 unset($field_group['acfe_meta']);
261
262 if(isset($field_group['acfe_note']) && !acfe_has($field_group, 'acfe.note')){
263 acfe_set($field_group, 'acfe.note', $field_group['acfe_note']);
264 }
265 unset($field_group['acfe_note']);
266
267 if(isset($field_group['acfe_permissions']) && !acfe_has($field_group, 'acfe.permissions')){
268 acfe_set($field_group, 'acfe.permissions', $field_group['acfe_permissions']);
269 }
270 unset($field_group['acfe_permissions']);
271
272 if(isset($field_group['acfe_autosync']) && !acfe_has($field_group, 'acfe.autosync')){
273 acfe_set($field_group, 'acfe.autosync', $field_group['acfe_autosync']);
274 }
275 unset($field_group['acfe_autosync']);
276
277 if(isset($field_group['acfe_display_title']) && !acfe_has($field_group, 'acfe.display_title')){
278 acfe_set($field_group, 'acfe.display_title', $field_group['acfe_display_title']);
279 }
280 unset($field_group['acfe_display_title']);
281
282 // return
283 return $field_group;
284
285 }
286
287
288 /**
289 * field_group_nested_settings_legacy
290 *
291 * @param $field_group
292 *
293 * @return mixed
294 */
295 function field_group_nested_settings_legacy($field_group){
296
297 // check if setting is enabled
298 if(!acfe_get_setting('compatibility/legacy_field_group')){
299 return $field_group;
300 }
301
302 $field_group['acfe_form'] = acfe_get($field_group, 'acfe.advanced');
303 $field_group['acfe_meta'] = acfe_get($field_group, 'acfe.meta');
304 $field_group['acfe_note'] = acfe_get($field_group, 'acfe.note');
305 $field_group['acfe_permissions'] = acfe_get($field_group, 'acfe.permissions');
306 $field_group['acfe_autosync'] = acfe_get($field_group, 'acfe.autosync');
307
308 if(!empty($field_group['acfe_meta'])){
309 $field_group['acfe_meta'] = acfe_as_array($field_group['acfe_meta']);
310 $field_group['acfe_meta'] = acfe_array_rewrite($field_group['acfe_meta'], function($row, $key){
311 return array($key => array(
312 'acfe_meta_key' => acfe_get($row, 'key'),
313 'acfe_meta_value' => acfe_get($row, 'value'),
314 ));
315 });
316 }
317
318 return $field_group;
319
320 }
321
322
323 /**
324 * field_group_display_title
325 *
326 * Migrate ACFE Display Title to native ACF Display Title (added in ACF 6.6+)
327 *
328 * @param $field_group
329 *
330 * @since 0.9.2 (20/11/2025)
331 *
332 * @return mixed
333 */
334 function field_group_display_title($field_group){
335
336 // ACFE 6.6+
337 if(acfe_is_acf('6.6') && acfe_has($field_group, 'acfe.display_title')){
338
339 // check display title wasn't already set
340 if(empty($field_group['display_title'])){
341 $field_group['display_title'] = acfe_get($field_group, 'acfe.display_title'); // assign old ACFE setting to new ACF setting
342 }
343
344 // unset old setting in all case
345 acfe_unset($field_group, 'acfe.display_title');
346 }
347
348 return $field_group;
349
350 }
351
352
353 /**
354 * field_acfe_update
355 *
356 * acf/validate_field:20
357 *
358 * Field Filter Value: Removed
359 *
360 * @since 0.8 (20/10/2019)
361 */
362 function field_acfe_update($field){
363
364 if(isset($field['acfe_update'])){
365 unset($field['acfe_update']);
366 }
367
368 return $field;
369
370 }
371
372
373 /**
374 * field_seamless_style
375 *
376 * acf/validate_field/type=group:20
377 * acf/validate_field/type=clone:20
378 *
379 * Field Group/Clone: Fixed typo 'Seamless'
380 *
381 * @since 0.8.5 (15/03/2020)
382 */
383 function field_seamless_style($field){
384
385 if($seamless = acfe_get($field, 'acfe_seemless_style', false)){
386 $field['acfe_seamless_style'] = $seamless;
387 unset($field['acfe_seemless_style']);
388 }
389
390 return $field;
391
392 }
393
394
395 /**
396 * field_dynamic_message
397 *
398 * acf/validate_field/type=acfe_dynamic_message:20
399 *
400 * Renamed 'Dynamic Message' field to 'Dynamic Render'
401 *
402 * @since 0.8.8.5 (03/09/2021)
403 */
404 function field_dynamic_message($field){
405
406 $field['type'] = 'acfe_dynamic_render';
407
408 return $field;
409
410 }
411
412
413 /**
414 * field_column
415 *
416 * acf/validate_field/type=acfe_column:20
417 *
418 * Changed columns to 12 grid instead of 6
419 *
420 * @since 0.8.7.3 (29/09/2020)
421 */
422 function field_column($field){
423
424 if(acfe_ends_with($field['columns'], '/6')){
425
426 switch($field['columns']){
427
428 case '1/6': {
429 $field['columns'] = '2/12';
430 break;
431 }
432
433 case '2/6': {
434 $field['columns'] = '4/12';
435 break;
436 }
437
438 case '3/6': {
439 $field['columns'] = '6/12';
440 break;
441 }
442
443 case '4/6': {
444 $field['columns'] = '8/12';
445 break;
446 }
447
448 case '5/6': {
449 $field['columns'] = '10/12';
450 break;
451 }
452
453 case '6/6': {
454 $field['columns'] = '12/12';
455 break;
456 }
457
458 }
459
460 }
461
462 return $field;
463
464 }
465
466
467 /**
468 * field_image
469 *
470 * acf/validate_field/type=image:20
471 * acf/validate_field/type=file:20
472 *
473 * Renamed setting 'acfe_uploader' to 'uploader' for image & file
474 *
475 * @since 0.8.7.5 (11/12/2020)
476 */
477 function field_image($field){
478
479 if(acfe_get($field, 'acfe_uploader')){
480
481 $field['uploader'] = $field['acfe_uploader'];
482 unset($field['acfe_uploader']);
483
484 }
485
486 return $field;
487
488 }
489
490
491 /**
492 * field_forms
493 *
494 * acf/validate_field/type=forms:20
495 *
496 * 'forms' argument should return names and not id anymore
497 *
498 * @since 0.9 (07/02/2024)
499 */
500 function field_forms($field){
501
502 if(!is_array($field['forms']) || empty($field['forms']) || !is_numeric($field['forms'][0])){
503 return $field;
504 }
505
506 // loop allowed forms
507 foreach(array_keys($field['forms']) as $k){
508
509 // value
510 $value = $field['forms'][ $k ];
511
512 // deprecated return form id
513 // we need to return form name
514 if(is_numeric($value)){
515
516 // get item
517 $item = acfe_get_module('form')->get_item($value);
518
519 // found item by ID
520 // return name
521 if($item){
522 $field['forms'][ $k ] = $item['name'];
523
524 // not found
525 // remove
526 }else{
527 unset($field['forms'][ $k ]);
528 }
529
530 }
531
532 }
533
534 return $field;
535
536 }
537
538
539 /**
540 * field_code_editor
541 *
542 * acf/validate_field/type=acfe_code_editor:20
543 *
544 * Renamed 'return_entities' to 'return_format' for code editor
545 *
546 * @since 0.8.9.1
547 *
548 * @param $field
549 */
550 function field_code_editor($field){
551
552 if(acfe_get($field, 'return_entities')){
553
554 if(!in_array('htmlentities', $field['return_format'])){
555 $field['return_format'][] = 'htmlentities';
556 }
557
558 unset($field['return_entities']);
559
560 }
561
562 return $field;
563
564 }
565
566
567 /**
568 * field_flexible_settings_title
569 *
570 * acfe/load_fields/type=flexible_content:20
571 *
572 * Field Flexible Content: Fix duplicated "layout_settings" & "layout_title"
573 *
574 * @since 0.8.4.5 (11/02/2020)
575 */
576 function field_flexible_settings_title($fields, $parent){
577
578 // Check if is tool screen
579 if(!acf_is_screen(acfe_get_acf_screen_id('acf-tools'))){
580 return $fields;
581 }
582
583 foreach($fields as $_k => $_field){
584
585 // field name
586 $_field_name = acfe_get($_field, 'name');
587
588 // check 'acfe_flexible_layout_title' & 'layout_settings'
589 if($_field_name !== 'acfe_flexible_layout_title' && $_field_name !== 'layout_settings'){
590 continue;
591 }
592
593 // unset
594 unset($fields[$_k]);
595
596 }
597
598 return $fields;
599
600 }
601
602
603 /**
604 * field_flexible_layout_categories
605 *
606 * acf/prepare_field/name=acfe_flexible_category
607 *
608 * Field Flexible Content: Compatibility for Layout Categories
609 *
610 * @since 0.8.6.7 (16/07/2020)
611 */
612 function field_flexible_layout_categories($field){
613
614 $value = acfe_get($field, 'value');
615
616 if(empty($value)){
617 return $field;
618 }
619
620 if(is_string($value)){
621
622 $explode = explode('|', $value);
623
624 $choices = array();
625
626 foreach($explode as $v){
627
628 $v = trim($v);
629 $choices[ $v ] = $v;
630
631 }
632
633 $field['choices'] = $choices;
634 $field['value'] = $choices;
635
636 }
637
638 return $field;
639
640 }
641
642 }
643
644 new acfe_compatibility();
645
646 endif;