@@ -45,8 +45,11 @@ |
||
45 | 45 | <td> |
46 | 46 | <?php if( $site['updates'] ): ?> |
47 | 47 | <span class="response"><?php printf(__('Site requires database upgrade from %s to %s', 'acf'), $site['acf_version'], $plugin_version); ?></span> |
48 | - <?php else: ?> |
|
49 | - <?php _e("Site is up to date", 'acf'); ?> |
|
48 | + <?php else { |
|
49 | + : ?> |
|
50 | + <?php _e("Site is up to date", 'acf'); |
|
51 | +} |
|
52 | +?> |
|
50 | 53 | <?php endif; ?> |
51 | 54 | </td> |
52 | 55 | </tr> |
@@ -105,9 +105,12 @@ |
||
105 | 105 | })(jQuery); |
106 | 106 | </script> |
107 | 107 | |
108 | -<?php else: ?> |
|
108 | +<?php else { |
|
109 | + : ?> |
|
109 | 110 | |
110 | - <p><?php _e('No updates available', 'acf'); ?>.</p> |
|
111 | + <p><?php _e('No updates available', 'acf'); |
|
112 | +} |
|
113 | +?>.</p> |
|
111 | 114 | |
112 | 115 | <?php endif; ?> |
113 | 116 |
@@ -16,19 +16,27 @@ discard block |
||
16 | 16 | function acf_is_field_group_key( $key = '' ) { |
17 | 17 | |
18 | 18 | // bail early if not string |
19 | - if( !is_string($key) ) return false; |
|
19 | + if( !is_string($key) ) { |
|
20 | + return false; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | |
22 | 24 | // bail early if is numeric (could be numeric string '123') |
23 | - if( is_numeric($key) ) return false; |
|
25 | + if( is_numeric($key) ) { |
|
26 | + return false; |
|
27 | + } |
|
24 | 28 | |
25 | 29 | |
26 | 30 | // look for 'field_' prefix |
27 | - if( substr($key, 0, 6) === 'group_' ) return true; |
|
31 | + if( substr($key, 0, 6) === 'group_' ) { |
|
32 | + return true; |
|
33 | + } |
|
28 | 34 | |
29 | 35 | |
30 | 36 | // allow local field group key to not start with prefix |
31 | - if( acf_is_local_field_group($key) ) return true; |
|
37 | + if( acf_is_local_field_group($key) ) { |
|
38 | + return true; |
|
39 | + } |
|
32 | 40 | |
33 | 41 | |
34 | 42 | // return |
@@ -259,7 +267,9 @@ discard block |
||
259 | 267 | $found = false; |
260 | 268 | $cache = wp_cache_get( $cache_key, 'acf', false, $found ); |
261 | 269 | |
262 | - if( $found ) return $cache; |
|
270 | + if( $found ) { |
|
271 | + return $cache; |
|
272 | + } |
|
263 | 273 | |
264 | 274 | |
265 | 275 | // get field group from ID or key |
@@ -683,7 +693,9 @@ discard block |
||
683 | 693 | |
684 | 694 | |
685 | 695 | // bail early if field group did not load correctly |
686 | - if( empty($field_group) ) return false; |
|
696 | + if( empty($field_group) ) { |
|
697 | + return false; |
|
698 | + } |
|
687 | 699 | |
688 | 700 | |
689 | 701 | // get fields |
@@ -738,7 +750,9 @@ discard block |
||
738 | 750 | |
739 | 751 | |
740 | 752 | // bail early if field group did not load correctly |
741 | - if( empty($field_group) ) return false; |
|
753 | + if( empty($field_group) ) { |
|
754 | + return false; |
|
755 | + } |
|
742 | 756 | |
743 | 757 | |
744 | 758 | // get fields |
@@ -793,7 +807,9 @@ discard block |
||
793 | 807 | |
794 | 808 | |
795 | 809 | // bail early if field group did not load correctly |
796 | - if( empty($field_group) ) return false; |
|
810 | + if( empty($field_group) ) { |
|
811 | + return false; |
|
812 | + } |
|
797 | 813 | |
798 | 814 | |
799 | 815 | // get fields |
@@ -77,7 +77,9 @@ discard block |
||
77 | 77 | |
78 | 78 | |
79 | 79 | // return true if label exists |
80 | - if( $label !== '' ) return true; |
|
80 | + if( $label !== '' ) { |
|
81 | + return true; |
|
82 | + } |
|
81 | 83 | |
82 | 84 | |
83 | 85 | // return |
@@ -102,19 +104,27 @@ discard block |
||
102 | 104 | function acf_is_field_key( $key = '' ) { |
103 | 105 | |
104 | 106 | // bail early if not string |
105 | - if( !is_string($key) ) return false; |
|
107 | + if( !is_string($key) ) { |
|
108 | + return false; |
|
109 | + } |
|
106 | 110 | |
107 | 111 | |
108 | 112 | // bail early if is numeric (could be numeric string '123') |
109 | - if( is_numeric($key) ) return false; |
|
113 | + if( is_numeric($key) ) { |
|
114 | + return false; |
|
115 | + } |
|
110 | 116 | |
111 | 117 | |
112 | 118 | // default - starts with 'field_' |
113 | - if( substr($key, 0, 6) === 'field_' ) return true; |
|
119 | + if( substr($key, 0, 6) === 'field_' ) { |
|
120 | + return true; |
|
121 | + } |
|
114 | 122 | |
115 | 123 | |
116 | 124 | // special - allow local field key to be any string |
117 | - if( acf_is_local_field($key) ) return true; |
|
125 | + if( acf_is_local_field($key) ) { |
|
126 | + return true; |
|
127 | + } |
|
118 | 128 | |
119 | 129 | |
120 | 130 | // return |
@@ -139,11 +149,15 @@ discard block |
||
139 | 149 | function acf_get_valid_field( $field = false ) { |
140 | 150 | |
141 | 151 | // $field must be an array |
142 | - if( !is_array($field) ) $field = array(); |
|
152 | + if( !is_array($field) ) { |
|
153 | + $field = array(); |
|
154 | + } |
|
143 | 155 | |
144 | 156 | |
145 | 157 | // bail ealry if already valid |
146 | - if( !empty($field['_valid']) ) return $field; |
|
158 | + if( !empty($field['_valid']) ) { |
|
159 | + return $field; |
|
160 | + } |
|
147 | 161 | |
148 | 162 | |
149 | 163 | // defaults |
@@ -211,7 +225,9 @@ discard block |
||
211 | 225 | function acf_prepare_field( $field ) { |
212 | 226 | |
213 | 227 | // bail early if already prepared |
214 | - if( $field['_input'] ) return $field; |
|
228 | + if( $field['_input'] ) { |
|
229 | + return $field; |
|
230 | + } |
|
215 | 231 | |
216 | 232 | |
217 | 233 | // _input |
@@ -271,11 +287,15 @@ discard block |
||
271 | 287 | function acf_is_sub_field( $field ) { |
272 | 288 | |
273 | 289 | // local field uses a field instead of ID |
274 | - if( acf_is_field_key($field['parent']) ) return true; |
|
290 | + if( acf_is_field_key($field['parent']) ) { |
|
291 | + return true; |
|
292 | + } |
|
275 | 293 | |
276 | 294 | |
277 | 295 | // attempt to load parent field |
278 | - if( acf_get_field($field['parent']) ) return true; |
|
296 | + if( acf_get_field($field['parent']) ) { |
|
297 | + return true; |
|
298 | + } |
|
279 | 299 | |
280 | 300 | |
281 | 301 | // return |
@@ -342,7 +362,9 @@ discard block |
||
342 | 362 | function acf_render_fields( $post_id = 0, $fields, $el = 'div', $instruction = 'label' ) { |
343 | 363 | |
344 | 364 | // bail early if no fields |
345 | - if( empty($fields) ) return false; |
|
365 | + if( empty($fields) ) { |
|
366 | + return false; |
|
367 | + } |
|
346 | 368 | |
347 | 369 | |
348 | 370 | // remove corrupt fields |
@@ -641,7 +663,9 @@ discard block |
||
641 | 663 | |
642 | 664 | |
643 | 665 | // bail early if no parent |
644 | - if( !$parent ) return false; |
|
666 | + if( !$parent ) { |
|
667 | + return false; |
|
668 | + } |
|
645 | 669 | |
646 | 670 | |
647 | 671 | // vars |
@@ -686,14 +710,18 @@ discard block |
||
686 | 710 | |
687 | 711 | |
688 | 712 | // bail early if no ID |
689 | - if( empty($id) ) return false; |
|
713 | + if( empty($id) ) { |
|
714 | + return false; |
|
715 | + } |
|
690 | 716 | |
691 | 717 | |
692 | 718 | // cache |
693 | 719 | $found = false; |
694 | 720 | $cache = wp_cache_get( 'get_fields/parent=' . $id, 'acf', false, $found ); |
695 | 721 | |
696 | - if( $found ) return $cache; |
|
722 | + if( $found ) { |
|
723 | + return $cache; |
|
724 | + } |
|
697 | 725 | |
698 | 726 | |
699 | 727 | // args |
@@ -787,7 +815,9 @@ discard block |
||
787 | 815 | $found = false; |
788 | 816 | $cache = wp_cache_get( $cache_key, 'acf', false, $found ); |
789 | 817 | |
790 | - if( $found ) return $cache; |
|
818 | + if( $found ) { |
|
819 | + return $cache; |
|
820 | + } |
|
791 | 821 | |
792 | 822 | } |
793 | 823 | |
@@ -941,7 +971,9 @@ discard block |
||
941 | 971 | |
942 | 972 | |
943 | 973 | // bail early if no post_id |
944 | - if( !$post_id ) return false; |
|
974 | + if( !$post_id ) { |
|
975 | + return false; |
|
976 | + } |
|
945 | 977 | |
946 | 978 | |
947 | 979 | // return |
@@ -981,7 +1013,9 @@ discard block |
||
981 | 1013 | |
982 | 1014 | |
983 | 1015 | // bail early if no posts |
984 | - if( empty($posts) ) return false; |
|
1016 | + if( empty($posts) ) { |
|
1017 | + return false; |
|
1018 | + } |
|
985 | 1019 | |
986 | 1020 | |
987 | 1021 | // return |
@@ -1050,7 +1084,9 @@ discard block |
||
1050 | 1084 | |
1051 | 1085 | |
1052 | 1086 | // bail early if no field |
1053 | - if( !$field ) return false; |
|
1087 | + if( !$field ) { |
|
1088 | + return false; |
|
1089 | + } |
|
1054 | 1090 | |
1055 | 1091 | |
1056 | 1092 | // Override name - allows the $selector to be a sub field (images_0_image) |
@@ -1099,7 +1135,9 @@ discard block |
||
1099 | 1135 | |
1100 | 1136 | |
1101 | 1137 | // validate |
1102 | - if( empty($posts) ) return 0; |
|
1138 | + if( empty($posts) ) { |
|
1139 | + return 0; |
|
1140 | + } |
|
1103 | 1141 | |
1104 | 1142 | |
1105 | 1143 | // return |
@@ -1125,7 +1163,9 @@ discard block |
||
1125 | 1163 | function acf_update_field( $field = false, $specific = false ) { |
1126 | 1164 | |
1127 | 1165 | // $field must be an array |
1128 | - if( !is_array($field) ) return false; |
|
1166 | + if( !is_array($field) ) { |
|
1167 | + return false; |
|
1168 | + } |
|
1129 | 1169 | |
1130 | 1170 | |
1131 | 1171 | // validate |
@@ -1306,7 +1346,9 @@ discard block |
||
1306 | 1346 | function acf_duplicate_fields( $fields, $new_parent = 0 ) { |
1307 | 1347 | |
1308 | 1348 | // bail early if no fields |
1309 | - if( empty($fields) ) return; |
|
1349 | + if( empty($fields) ) { |
|
1350 | + return; |
|
1351 | + } |
|
1310 | 1352 | |
1311 | 1353 | |
1312 | 1354 | // create new field keys (for conditional logic fixes) |
@@ -1482,7 +1524,9 @@ discard block |
||
1482 | 1524 | |
1483 | 1525 | |
1484 | 1526 | // bail early if field did not load correctly |
1485 | - if( empty($field) ) return false; |
|
1527 | + if( empty($field) ) { |
|
1528 | + return false; |
|
1529 | + } |
|
1486 | 1530 | |
1487 | 1531 | |
1488 | 1532 | // delete field |
@@ -1529,7 +1573,9 @@ discard block |
||
1529 | 1573 | |
1530 | 1574 | |
1531 | 1575 | // bail early if field did not load correctly |
1532 | - if( empty($field) ) return false; |
|
1576 | + if( empty($field) ) { |
|
1577 | + return false; |
|
1578 | + } |
|
1533 | 1579 | |
1534 | 1580 | |
1535 | 1581 | // delete field |
@@ -1569,7 +1615,9 @@ discard block |
||
1569 | 1615 | |
1570 | 1616 | |
1571 | 1617 | // bail early if field did not load correctly |
1572 | - if( empty($field) ) return false; |
|
1618 | + if( empty($field) ) { |
|
1619 | + return false; |
|
1620 | + } |
|
1573 | 1621 | |
1574 | 1622 | |
1575 | 1623 | // delete field |
@@ -1601,7 +1649,9 @@ discard block |
||
1601 | 1649 | function acf_prepare_fields_for_export( $fields = false ) { |
1602 | 1650 | |
1603 | 1651 | // validate |
1604 | - if( empty($fields) ) return $fields; |
|
1652 | + if( empty($fields) ) { |
|
1653 | + return $fields; |
|
1654 | + } |
|
1605 | 1655 | |
1606 | 1656 | |
1607 | 1657 | // format |
@@ -1674,7 +1724,9 @@ discard block |
||
1674 | 1724 | function acf_prepare_fields_for_import( $fields = false ) { |
1675 | 1725 | |
1676 | 1726 | // validate |
1677 | - if( empty($fields) ) return $fields; |
|
1727 | + if( empty($fields) ) { |
|
1728 | + return $fields; |
|
1729 | + } |
|
1678 | 1730 | |
1679 | 1731 | |
1680 | 1732 | // re-index array |
@@ -123,7 +123,9 @@ discard block |
||
123 | 123 | |
124 | 124 | |
125 | 125 | // return true if already done |
126 | - if( acf_get_setting($setting) ) return true; |
|
126 | + if( acf_get_setting($setting) ) { |
|
127 | + return true; |
|
128 | + } |
|
127 | 129 | |
128 | 130 | |
129 | 131 | // update setting |
@@ -1105,7 +1107,9 @@ discard block |
||
1105 | 1107 | |
1106 | 1108 | |
1107 | 1109 | // bail early i no terms |
1108 | - if( empty($terms) ) continue; |
|
1110 | + if( empty($terms) ) { |
|
1111 | + continue; |
|
1112 | + } |
|
1109 | 1113 | |
1110 | 1114 | |
1111 | 1115 | // sort into hierachial order! |
@@ -1957,7 +1961,7 @@ discard block |
||
1957 | 1961 | |
1958 | 1962 | $arg = $arg ? 'true' : 'false'; |
1959 | 1963 | |
1960 | - }elseif( is_string($arg) ) { |
|
1964 | + } elseif( is_string($arg) ) { |
|
1961 | 1965 | |
1962 | 1966 | $arg = '"' . $arg . '"'; |
1963 | 1967 | |
@@ -3342,7 +3346,7 @@ discard block |
||
3342 | 3346 | // min height |
3343 | 3347 | $errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height ); |
3344 | 3348 | |
3345 | - } elseif( $max_height && $file['height'] > $max_height ) { |
|
3349 | + } elseif( $max_height && $file['height'] > $max_height ) { |
|
3346 | 3350 | |
3347 | 3351 | // min height |
3348 | 3352 | $errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height ); |
@@ -3468,14 +3472,18 @@ discard block |
||
3468 | 3472 | function acf_translate_keys( $array, $keys ) { |
3469 | 3473 | |
3470 | 3474 | // bail early if no keys |
3471 | - if( empty($keys) ) return $array; |
|
3475 | + if( empty($keys) ) { |
|
3476 | + return $array; |
|
3477 | + } |
|
3472 | 3478 | |
3473 | 3479 | |
3474 | 3480 | // translate |
3475 | 3481 | foreach( $keys as $k ) { |
3476 | 3482 | |
3477 | 3483 | // bail ealry if not exists |
3478 | - if( !isset($array[ $k ]) ) continue; |
|
3484 | + if( !isset($array[ $k ]) ) { |
|
3485 | + continue; |
|
3486 | + } |
|
3479 | 3487 | |
3480 | 3488 | |
3481 | 3489 | // translate |
@@ -3507,11 +3515,15 @@ discard block |
||
3507 | 3515 | function acf_translate( $string ) { |
3508 | 3516 | |
3509 | 3517 | // bail early if not enabled |
3510 | - if( !acf_get_setting('l10n') ) return $string; |
|
3518 | + if( !acf_get_setting('l10n') ) { |
|
3519 | + return $string; |
|
3520 | + } |
|
3511 | 3521 | |
3512 | 3522 | |
3513 | 3523 | // bail early if no textdomain |
3514 | - if( !acf_get_setting('l10n_textdomain') ) return $string; |
|
3524 | + if( !acf_get_setting('l10n_textdomain') ) { |
|
3525 | + return $string; |
|
3526 | + } |
|
3515 | 3527 | |
3516 | 3528 | |
3517 | 3529 | // is array |
@@ -3523,11 +3535,15 @@ discard block |
||
3523 | 3535 | |
3524 | 3536 | |
3525 | 3537 | // bail early if not string |
3526 | - if( !is_string($string) ) return $string; |
|
3538 | + if( !is_string($string) ) { |
|
3539 | + return $string; |
|
3540 | + } |
|
3527 | 3541 | |
3528 | 3542 | |
3529 | 3543 | // bail early if empty |
3530 | - if( $string === '' ) return $string; |
|
3544 | + if( $string === '' ) { |
|
3545 | + return $string; |
|
3546 | + } |
|
3531 | 3547 | |
3532 | 3548 | |
3533 | 3549 | // allow for var_export export |
@@ -654,7 +654,9 @@ discard block |
||
654 | 654 | |
655 | 655 | |
656 | 656 | // bail early if no row |
657 | - if( !$row ) return 0; |
|
657 | + if( !$row ) { |
|
658 | + return 0; |
|
659 | + } |
|
658 | 660 | |
659 | 661 | |
660 | 662 | // return |
@@ -683,8 +685,7 @@ discard block |
||
683 | 685 | if( $hard_reset ) |
684 | 686 | { |
685 | 687 | $GLOBALS['acf_field'] = array(); |
686 | - } |
|
687 | - else |
|
688 | + } else |
|
688 | 689 | { |
689 | 690 | // vars |
690 | 691 | $depth = count( $GLOBALS['acf_field'] ) - 1; |
@@ -1749,7 +1750,9 @@ discard block |
||
1749 | 1750 | |
1750 | 1751 | |
1751 | 1752 | // bail early if no field |
1752 | - if( !$field ) return false; |
|
1753 | + if( !$field ) { |
|
1754 | + return false; |
|
1755 | + } |
|
1753 | 1756 | |
1754 | 1757 | |
1755 | 1758 | // update sub fields |
@@ -299,7 +299,9 @@ |
||
299 | 299 | function acf_get_value( $post_id = 0, $field ) { |
300 | 300 | |
301 | 301 | // bail early if no $post_id (acf_form - new_post) |
302 | - if( !$post_id ) return null; |
|
302 | + if( !$post_id ) { |
|
303 | + return null; |
|
304 | + } |
|
303 | 305 | |
304 | 306 | |
305 | 307 | // try cache |
@@ -148,8 +148,7 @@ |
||
148 | 148 | if( isset($l10n[ $this->category ]) ) |
149 | 149 | { |
150 | 150 | $cat = $l10n[ $this->category ]; |
151 | - } |
|
152 | - else |
|
151 | + } else |
|
153 | 152 | { |
154 | 153 | $cat = $this->category; |
155 | 154 | } |
@@ -130,7 +130,9 @@ discard block |
||
130 | 130 | function save_post( $post_id = 0 ) { |
131 | 131 | |
132 | 132 | // bai learly if empty |
133 | - if( empty($_POST['acf']) ) return; |
|
133 | + if( empty($_POST['acf']) ) { |
|
134 | + return; |
|
135 | + } |
|
134 | 136 | |
135 | 137 | |
136 | 138 | // save $_POST data |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | |
142 | 144 | |
143 | 145 | // continue if no field |
144 | - if( !$field ) continue; |
|
146 | + if( !$field ) { |
|
147 | + continue; |
|
148 | + } |
|
145 | 149 | |
146 | 150 | |
147 | 151 | // update |
@@ -348,11 +352,15 @@ discard block |
||
348 | 352 | function acf_enqueue_uploader() { |
349 | 353 | |
350 | 354 | // bail early if doing ajax |
351 | - if( defined('DOING_AJAX') && DOING_AJAX ) return; |
|
355 | + if( defined('DOING_AJAX') && DOING_AJAX ) { |
|
356 | + return; |
|
357 | + } |
|
352 | 358 | |
353 | 359 | |
354 | 360 | // bail ealry if already run |
355 | - if( acf_has_done('enqueue_uploader') ) return; |
|
361 | + if( acf_has_done('enqueue_uploader') ) { |
|
362 | + return; |
|
363 | + } |
|
356 | 364 | |
357 | 365 | |
358 | 366 | // enqueue media if user can upload |
@@ -436,7 +444,9 @@ discard block |
||
436 | 444 | function acf_save_post( $post_id = 0 ) { |
437 | 445 | |
438 | 446 | // bail early if no acf values |
439 | - if( empty($_POST['acf']) ) return false; |
|
447 | + if( empty($_POST['acf']) ) { |
|
448 | + return false; |
|
449 | + } |
|
440 | 450 | |
441 | 451 | |
442 | 452 | // hook for 3rd party customization |
@@ -633,7 +643,9 @@ discard block |
||
633 | 643 | function acf_get_validation_errors() { |
634 | 644 | |
635 | 645 | // bail early if no errors |
636 | - if( empty($GLOBALS['acf_validation_errors']) ) return false; |
|
646 | + if( empty($GLOBALS['acf_validation_errors']) ) { |
|
647 | + return false; |
|
648 | + } |
|
637 | 649 | |
638 | 650 | |
639 | 651 | // return |