Completed
Push — master ( 5860df...ed31a0 )
by Md. Mozahidur
02:45
created
includes/acf/admin/views/settings-tools-export.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 // vars
4
-$field_groups = acf_extract_var( $args, 'field_groups');
4
+$field_groups = acf_extract_var($args, 'field_groups');
5 5
 
6 6
 
7 7
 // replace
@@ -32,28 +32,28 @@  discard block
 block discarded – undo
32 32
 			
33 33
 			<textarea class="pre" readonly="true"><?php
34 34
 			
35
-			echo "if( function_exists('acf_add_local_field_group') ):" . "\r\n" . "\r\n";
35
+			echo "if( function_exists('acf_add_local_field_group') ):"."\r\n"."\r\n";
36 36
 			
37
-			foreach( $field_groups as $field_group ) {
37
+			foreach ($field_groups as $field_group) {
38 38
 						
39 39
 				// code
40 40
 				$code = var_export($field_group, true);
41 41
 				
42 42
 				
43 43
 				// change double spaces to tabs
44
-				$code = str_replace( array_keys($str_replace), array_values($str_replace), $code );
44
+				$code = str_replace(array_keys($str_replace), array_values($str_replace), $code);
45 45
 				
46 46
 				
47 47
 				// correctly formats "=> array("
48
-				$code = preg_replace( array_keys($preg_replace), array_values($preg_replace), $code );
48
+				$code = preg_replace(array_keys($preg_replace), array_values($preg_replace), $code);
49 49
 				
50 50
 				
51 51
 				// esc_textarea
52
-				$code = esc_textarea( $code );
52
+				$code = esc_textarea($code);
53 53
 				
54 54
 				
55 55
 				// echo
56
-				echo "acf_add_local_field_group({$code});" . "\r\n" . "\r\n";
56
+				echo "acf_add_local_field_group({$code});"."\r\n"."\r\n";
57 57
 			
58 58
 			}
59 59
 			
Please login to merge, or discard this patch.
includes/acf/admin/views/settings-tools.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 // populate choices
18
-if( $field_groups ) {
18
+if ($field_groups) {
19 19
 	
20
-	foreach( $field_groups as $field_group ) {
20
+	foreach ($field_groups as $field_group) {
21 21
 		
22
-		$field['choices'][ $field_group['key'] ] = $field_group['title'];
22
+		$field['choices'][$field_group['key']] = $field_group['title'];
23 23
 		
24 24
 	}
25 25
 	
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 			
40 40
 			<form method="post" action="">
41 41
 			<div class="acf-hidden">
42
-				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( 'export' ); ?>" />
42
+				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce('export'); ?>" />
43 43
 			</div>
44 44
 			<table class="form-table">
45 45
                 <tbody>
46
-	                <?php acf_render_field_wrap( $field, 'tr' ); ?>
46
+	                <?php acf_render_field_wrap($field, 'tr'); ?>
47 47
 					<tr>
48 48
 						<th></th>
49 49
 						<td>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			
69 69
 			<form method="post" action="" enctype="multipart/form-data">
70 70
 			<div class="acf-hidden">
71
-				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( 'import' ); ?>" />
71
+				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce('import'); ?>" />
72 72
 			</div>
73 73
 			<table class="form-table">
74 74
                 <tbody>
Please login to merge, or discard this patch.
includes/acf/admin/views/update-network.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <div id="acf-upgrade-wrap" class="wrap">
7 7
 	
8
-	<h1><?php _e("Advanced Custom Fields Database Upgrade",'acf'); ?></h1>
8
+	<h1><?php _e("Advanced Custom Fields Database Upgrade", 'acf'); ?></h1>
9 9
 	
10
-	<p><?php _e("The following sites require a DB upgrade. Check the ones you want to update and then click “Upgrade Database”.",'acf'); ?></p>
10
+	<p><?php _e("The following sites require a DB upgrade. Check the ones you want to update and then click “Upgrade Database”.", 'acf'); ?></p>
11 11
 	
12 12
 	<p><input type="submit" name="upgrade" value="Update Sites" class="button" id="upgrade-sites"></p>
13 13
 	
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		
32 32
 		<tbody id="the-list">
33 33
 		
34
-		<?php foreach( $sites as $i => $site ): ?>
34
+		<?php foreach ($sites as $i => $site): ?>
35 35
 			
36
-			<tr<?php if( $i % 2 == 0 ): ?> class="alternate"<?php endif; ?>>
36
+			<tr<?php if ($i % 2 == 0): ?> class="alternate"<?php endif; ?>>
37 37
 				<th class="check-column" scope="row">
38
-				<?php if( $site['updates'] ): ?>
38
+				<?php if ($site['updates']): ?>
39 39
 					<input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
40 40
 				<?php endif; ?>
41 41
 				</th>
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 					<strong><?php echo $site['name']; ?></strong><br /><?php echo $site['url']; ?>
44 44
 				</td>
45 45
 				<td>
46
-				<?php if( $site['updates'] ): ?>
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 48
 				<?php else: ?>
49 49
 					<?php _e("Site is up to date", 'acf'); ?>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	
60 60
 	<p><input type="submit" name="upgrade" value="Update Sites" class="button" id="upgrade-sites-2"></p>
61 61
 	
62
-	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo network_admin_url(); ?>"><?php _e("Return to network dashboard",'acf'); ?></a>.</p>
62
+	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo network_admin_url(); ?>"><?php _e("Return to network dashboard", 'acf'); ?></a>.</p>
63 63
 	
64 64
 	<style type="text/css">
65 65
 		
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,11 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
includes/acf/admin/views/update-notice.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
 		
21 21
 		<div class="content">
22 22
 			
23
-			<h2><?php _e("Database Upgrade Required",'acf'); ?></h2>
23
+			<h2><?php _e("Database Upgrade Required", 'acf'); ?></h2>
24 24
 			
25
-			<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version') ); ?><br /><?php _e("Before you start using the new awesome features, please update your database to the newest version.", 'acf'); ?></p>
25
+			<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version')); ?><br /><?php _e("Before you start using the new awesome features, please update your database to the newest version.", 'acf'); ?></p>
26 26
 			
27 27
 			<p><a id="acf-notice-action" href="<?php echo $button_url; ?>" class="acf-button blue"><?php echo $button_text; ?></a></p>
28 28
 			
29
-		<?php if( $confirm ): ?>
29
+		<?php if ($confirm): ?>
30 30
 			<script type="text/javascript">
31 31
 			(function($) {
32 32
 				
33 33
 				$("#acf-notice-action").on("click", function(){
34 34
 			
35
-					var answer = confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
35
+					var answer = confirm("<?php _e('It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf'); ?>");
36 36
 					return answer;
37 37
 			
38 38
 				});
Please login to merge, or discard this patch.
includes/acf/admin/views/update.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
 ?>
6 6
 <div id="acf-upgrade-wrap" class="wrap">
7 7
 	
8
-	<h1><?php _e("Advanced Custom Fields Database Upgrade",'acf'); ?></h1>
8
+	<h1><?php _e("Advanced Custom Fields Database Upgrade", 'acf'); ?></h1>
9 9
 	
10
-<?php if( !empty($updates) ): ?>
10
+<?php if ( ! empty($updates)): ?>
11 11
 	
12 12
 	<p><?php _e('Reading upgrade tasks...', 'acf'); ?></p>
13 13
 	
14 14
 	<p class="show-on-ajax"><i class="acf-loading"></i> <?php printf(__('Upgrading data to version %s', 'acf'), $plugin_version); ?></p>
15 15
 	
16
-	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info'); ?>"><?php _e("See what's new",'acf'); ?></a>.</p>
16
+	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info'); ?>"><?php _e("See what's new", 'acf'); ?></a>.</p>
17 17
 
18 18
 	<style type="text/css">
19 19
 		
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,9 +105,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/acf/api/api-field-group.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -475,36 +475,36 @@  discard block
 block discarded – undo
475 475
 	
476 476
 	// vars
477 477
 	$data = maybe_serialize( $data );
478
-    $post_status = $extract['active'] ? 'publish' : 'acf-disabled';
478
+	$post_status = $extract['active'] ? 'publish' : 'acf-disabled';
479 479
     
480 480
     
481
-    // save
482
-    $save = array(
483
-    	'ID'			=> $extract['ID'],
484
-    	'post_status'	=> $post_status,
485
-    	'post_type'		=> 'acf-field-group',
486
-    	'post_title'	=> $extract['title'],
487
-    	'post_name'		=> $extract['key'],
488
-    	'post_excerpt'	=> sanitize_title($extract['title']),
489
-    	'post_content'	=> $data,
490
-    	'menu_order'	=> $extract['menu_order'],
491
-    );
481
+	// save
482
+	$save = array(
483
+		'ID'			=> $extract['ID'],
484
+		'post_status'	=> $post_status,
485
+		'post_type'		=> 'acf-field-group',
486
+		'post_title'	=> $extract['title'],
487
+		'post_name'		=> $extract['key'],
488
+		'post_excerpt'	=> sanitize_title($extract['title']),
489
+		'post_content'	=> $data,
490
+		'menu_order'	=> $extract['menu_order'],
491
+	);
492 492
     
493 493
     
494
-    // allow field groups to contain the same name
494
+	// allow field groups to contain the same name
495 495
 	add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 ); 
496 496
 	
497 497
     
498
-    // update the field group and update the ID
499
-    if( $field_group['ID'] ) {
498
+	// update the field group and update the ID
499
+	if( $field_group['ID'] ) {
500 500
 	    
501
-	    wp_update_post( $save );
501
+		wp_update_post( $save );
502 502
 	    
503
-    } else {
503
+	} else {
504 504
 	    
505
-	    $field_group['ID'] = wp_insert_post( $save );
505
+		$field_group['ID'] = wp_insert_post( $save );
506 506
 	    
507
-    }
507
+	}
508 508
 	
509 509
 	
510 510
 	// action for 3rd party customization
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	wp_cache_delete("get_field_groups", 'acf');
518 518
 	
519 519
 	
520
-    // return
521
-    return $field_group;
520
+	// return
521
+	return $field_group;
522 522
 	
523 523
 }
524 524
 
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@  discard block
 block discarded – undo
13 13
 *  @return	(boolean)
14 14
 */
15 15
 
16
-function acf_is_field_group_key( $key = '' ) {
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)) return false;
20 20
 	
21 21
 	
22 22
 	// bail early if is numeric (could be numeric string '123')
23
-	if( is_numeric($key) ) return false;
23
+	if (is_numeric($key)) return false;
24 24
 	
25 25
 	
26 26
 	// look for 'field_' prefix
27
-	if( substr($key, 0, 6) === 'group_' ) return true;
27
+	if (substr($key, 0, 6) === 'group_') return true;
28 28
 	
29 29
 	
30 30
 	// allow local field group key to not start with prefix
31
-	if( acf_is_local_field_group($key) ) return true;
31
+	if (acf_is_local_field_group($key)) return true;
32 32
 	
33 33
 	
34 34
 	// return
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 *  @return	$field_group (array)
51 51
 */
52 52
 
53
-function acf_get_valid_field_group( $field_group = false ) {
53
+function acf_get_valid_field_group($field_group = false) {
54 54
 	
55 55
 	// parse in defaults
56
-	$field_group = acf_parse_args( $field_group, array(
56
+	$field_group = acf_parse_args($field_group, array(
57 57
 		'ID'					=> 0,
58 58
 		'key'					=> '',
59 59
 		'title'					=> '',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	
72 72
 	
73 73
 	// translate
74
-	acf_translate_keys( $field_group, acf_get_setting('l10n_field_group') );
74
+	acf_translate_keys($field_group, acf_get_setting('l10n_field_group'));
75 75
 		
76 76
 	
77 77
 	// filter
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 *  @return	$field_groups (array)
98 98
 */
99 99
 
100
-function acf_get_field_groups( $args = false ) {
100
+function acf_get_field_groups($args = false) {
101 101
 	
102 102
 	// vars
103 103
 	$field_groups = array();
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	
106 106
 	// cache
107 107
 	$found = false;
108
-	$cache = wp_cache_get( 'get_field_groups', 'acf', false, $found );
108
+	$cache = wp_cache_get('get_field_groups', 'acf', false, $found);
109 109
 	
110
-	if( $found ) {
110
+	if ($found) {
111 111
 		
112
-		return acf_filter_field_groups( $cache, $args );
112
+		return acf_filter_field_groups($cache, $args);
113 113
 		
114 114
 	}
115 115
 	
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	
128 128
 	
129 129
 	// loop through and load field groups
130
-	if( $posts ) {
130
+	if ($posts) {
131 131
 		
132
-		foreach( $posts as $post ) {
132
+		foreach ($posts as $post) {
133 133
 			
134 134
 			// add to return array
135
-			$field_groups[] = acf_get_field_group( $post );
135
+			$field_groups[] = acf_get_field_group($post);
136 136
 			
137 137
 		}
138 138
 		
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	
145 145
 	
146 146
 	// set cache
147
-	wp_cache_set( 'get_field_groups', $field_groups, 'acf' );
147
+	wp_cache_set('get_field_groups', $field_groups, 'acf');
148 148
 			
149 149
 	
150 150
 	// return		
151
-	return acf_filter_field_groups( $field_groups, $args );
151
+	return acf_filter_field_groups($field_groups, $args);
152 152
 	
153 153
 }
154 154
 
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 *  @return	$field_groups (array)
168 168
 */
169 169
 
170
-function acf_filter_field_groups( $field_groups, $args = false ) {
170
+function acf_filter_field_groups($field_groups, $args = false) {
171 171
 	
172 172
 	// bail early if empty sargs
173
-	if( empty($args) || empty($field_groups) ) {
173
+	if (empty($args) || empty($field_groups)) {
174 174
 		
175 175
 		return $field_groups;
176 176
 		
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
 	
179 179
 	
180 180
 	// vars
181
-	$keys = array_keys( $field_groups );
181
+	$keys = array_keys($field_groups);
182 182
 	
183 183
 	
184 184
 	// loop through keys
185
-	foreach( $keys as $key ) {
185
+	foreach ($keys as $key) {
186 186
 		
187 187
 		// get visibility
188
-		$visibility = acf_get_field_group_visibility( $field_groups[ $key ], $args );
188
+		$visibility = acf_get_field_group_visibility($field_groups[$key], $args);
189 189
 		
190 190
 		
191 191
 		// unset
192
-		if( !$visibility ) {
192
+		if ( ! $visibility) {
193 193
 			
194
-			unset($field_groups[ $key ]);
194
+			unset($field_groups[$key]);
195 195
 			
196 196
 		}
197 197
 		
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	
200 200
 	
201 201
 	// re assign index
202
-	$field_groups = array_values( $field_groups );
202
+	$field_groups = array_values($field_groups);
203 203
 	
204 204
 	
205 205
 	// return
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 *  @return	$field_group (array)
223 223
 */
224 224
 
225
-function acf_get_field_group( $selector = false ) {
225
+function acf_get_field_group($selector = false) {
226 226
 	
227 227
 	// vars
228 228
 	$field_group = false;
@@ -231,16 +231,16 @@  discard block
 block discarded – undo
231 231
 	
232 232
 	
233 233
 	// $post_id or $key
234
-	if( is_numeric($selector) ) {
234
+	if (is_numeric($selector)) {
235 235
 		
236 236
 		$v = $selector;
237 237
 		
238
-	} elseif( is_string($selector) ) {
238
+	} elseif (is_string($selector)) {
239 239
 		
240 240
 		$k = 'key';
241 241
 		$v = $selector;
242 242
 		
243
-	} elseif( is_object($selector) ) {
243
+	} elseif (is_object($selector)) {
244 244
 		
245 245
 		$v = $selector->ID;
246 246
 		
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 	
258 258
 	// get cache
259 259
 	$found = false;
260
-	$cache = wp_cache_get( $cache_key, 'acf', false, $found );
260
+	$cache = wp_cache_get($cache_key, 'acf', false, $found);
261 261
 	
262
-	if( $found ) return $cache;
262
+	if ($found) return $cache;
263 263
 	
264 264
 	
265 265
 	// get field group from ID or key
266
-	if( $k == 'ID' ) {
266
+	if ($k == 'ID') {
267 267
 		
268
-		$field_group = _acf_get_field_group_by_id( $v );
268
+		$field_group = _acf_get_field_group_by_id($v);
269 269
 		
270 270
 	} else {
271 271
 		
272
-		$field_group = _acf_get_field_group_by_key( $v );
272
+		$field_group = _acf_get_field_group_by_key($v);
273 273
 		
274 274
 	}
275 275
 	
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	
280 280
 	
281 281
 	// set cache
282
-	wp_cache_set( $cache_key, $field_group, 'acf' );
282
+	wp_cache_set($cache_key, $field_group, 'acf');
283 283
 	
284 284
 	
285 285
 	// return
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 *  @return	$field_group (array)
301 301
 */
302 302
 
303
-function _acf_get_field_group_by_id( $post_id = 0 ) {
303
+function _acf_get_field_group_by_id($post_id = 0) {
304 304
 	
305 305
 	// get post
306
-	$post = get_post( $post_id );
306
+	$post = get_post($post_id);
307 307
 	
308 308
 	
309 309
 	// bail early if no post, or is not a field group
310
-	if( empty($post) || $post->post_type != 'acf-field-group' ) {
310
+	if (empty($post) || $post->post_type != 'acf-field-group') {
311 311
 	
312 312
 		return false;
313 313
 		
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	
316 316
 	
317 317
 	// modify post_status (new field-group starts as auto-draft)
318
-	if( $post->post_status == 'auto-draft' ) {
318
+	if ($post->post_status == 'auto-draft') {
319 319
 		
320 320
 		$post->post_status = 'publish';
321 321
 		
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	
324 324
 	
325 325
 	// unserialize data
326
-	$field_group = maybe_unserialize( $post->post_content );
326
+	$field_group = maybe_unserialize($post->post_content);
327 327
 	
328 328
 	
329 329
 	// update attributes
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	
336 336
 	
337 337
 	// is JSON
338
-	if( acf_is_local_field_group( $field_group['key'] ) ) {
338
+	if (acf_is_local_field_group($field_group['key'])) {
339 339
 		
340 340
 		// override
341
-		$field_group = acf_get_local_field_group( $field_group['key'] );
341
+		$field_group = acf_get_local_field_group($field_group['key']);
342 342
 		
343 343
 		
344 344
 		// restore ID
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	
349 349
 		
350 350
 	// validate
351
-	$field_group = acf_get_valid_field_group( $field_group );
351
+	$field_group = acf_get_valid_field_group($field_group);
352 352
 
353 353
 	
354 354
 	// return
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 *  @return	$field_group (array)
371 371
 */
372 372
 
373
-function _acf_get_field_group_by_key( $key = '' ) {
373
+function _acf_get_field_group_by_key($key = '') {
374 374
 	
375 375
 	// vars
376 376
 	$field_group = false;
377 377
 		
378 378
 	
379 379
 	// try JSON before DB to save query time
380
-	if( acf_is_local_field_group( $key ) ) {
380
+	if (acf_is_local_field_group($key)) {
381 381
 		
382
-		$field_group = acf_get_local_field_group( $key );
382
+		$field_group = acf_get_local_field_group($key);
383 383
 		
384 384
 		// validate
385
-		$field_group = acf_get_valid_field_group( $field_group );
385
+		$field_group = acf_get_valid_field_group($field_group);
386 386
 	
387 387
 		// return
388 388
 		return $field_group;
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 	
404 404
 	
405 405
 	// load posts
406
-	$posts = get_posts( $args );
406
+	$posts = get_posts($args);
407 407
 	
408 408
 	
409 409
 	// validate
410
-	if( empty($posts[0]) ) {
410
+	if (empty($posts[0])) {
411 411
 	
412 412
 		return $field_group;
413 413
 			
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	
416 416
 	
417 417
 	// load from ID
418
-	$field_group = _acf_get_field_group_by_id( $posts[0]->ID );
418
+	$field_group = _acf_get_field_group_by_id($posts[0]->ID);
419 419
 	
420 420
 	
421 421
 	// return
@@ -438,22 +438,22 @@  discard block
 block discarded – undo
438 438
 *  @return	$field_group (array)
439 439
 */
440 440
 
441
-function acf_update_field_group( $field_group = array() ) {
441
+function acf_update_field_group($field_group = array()) {
442 442
 	
443 443
 	// validate
444
-	$field_group = acf_get_valid_field_group( $field_group );
444
+	$field_group = acf_get_valid_field_group($field_group);
445 445
 	
446 446
 	
447 447
 	// may have been posted. Remove slashes
448
-	$field_group = wp_unslash( $field_group );
448
+	$field_group = wp_unslash($field_group);
449 449
 	
450 450
 	
451 451
 	// locations may contain 'uniquid' array keys
452
-	$field_group['location'] = array_values( $field_group['location'] );
452
+	$field_group['location'] = array_values($field_group['location']);
453 453
 	
454
-	foreach( $field_group['location'] as $k => $v ) {
454
+	foreach ($field_group['location'] as $k => $v) {
455 455
 		
456
-		$field_group['location'][ $k ] = array_values( $v );
456
+		$field_group['location'][$k] = array_values($v);
457 457
 		
458 458
 	}
459 459
 	
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	
475 475
 	
476 476
 	// vars
477
-	$data = maybe_serialize( $data );
477
+	$data = maybe_serialize($data);
478 478
     $post_status = $extract['active'] ? 'publish' : 'acf-disabled';
479 479
     
480 480
     
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
     
493 493
     
494 494
     // allow field groups to contain the same name
495
-	add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 ); 
495
+	add_filter('wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6); 
496 496
 	
497 497
     
498 498
     // update the field group and update the ID
499
-    if( $field_group['ID'] ) {
499
+    if ($field_group['ID']) {
500 500
 	    
501
-	    wp_update_post( $save );
501
+	    wp_update_post($save);
502 502
 	    
503 503
     } else {
504 504
 	    
505
-	    $field_group['ID'] = wp_insert_post( $save );
505
+	    $field_group['ID'] = wp_insert_post($save);
506 506
 	    
507 507
     }
508 508
 	
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 	
523 523
 }
524 524
 
525
-function acf_update_field_group_wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
525
+function acf_update_field_group_wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
526 526
 		
527
-	if( $post_type == 'acf-field-group' ) {
527
+	if ($post_type == 'acf-field-group') {
528 528
 	
529 529
 		$slug = $original_slug;
530 530
 	
@@ -548,18 +548,18 @@  discard block
 block discarded – undo
548 548
 *  @return	$field_group (array)
549 549
 */
550 550
 
551
-function acf_duplicate_field_group( $selector = 0, $new_post_id = 0 ) {
551
+function acf_duplicate_field_group($selector = 0, $new_post_id = 0) {
552 552
 	
553 553
 	// disable JSON to avoid conflicts between DB and JSON
554 554
 	acf_disable_local();
555 555
 	
556 556
 	
557 557
 	// load the origional field gorup
558
-	$field_group = acf_get_field_group( $selector );
558
+	$field_group = acf_get_field_group($selector);
559 559
 	
560 560
 	
561 561
 	// bail early if field group did not load correctly
562
-	if( empty($field_group) ) {
562
+	if (empty($field_group)) {
563 563
 	
564 564
 		return false;
565 565
 		
@@ -576,23 +576,23 @@  discard block
 block discarded – undo
576 576
 	
577 577
 	
578 578
 	// add (copy)
579
-	if( !$new_post_id ) {
579
+	if ( ! $new_post_id) {
580 580
 		
581
-		$field_group['title'] .= ' (' . __("copy", 'acf') . ')';
581
+		$field_group['title'] .= ' ('.__("copy", 'acf').')';
582 582
 		
583 583
 	}
584 584
 	
585 585
 	
586 586
 	// save
587
-	$field_group = acf_update_field_group( $field_group );
587
+	$field_group = acf_update_field_group($field_group);
588 588
 	
589 589
 	
590 590
 	// get fields
591
-	$fields = acf_get_fields( $orig_field_group );
591
+	$fields = acf_get_fields($orig_field_group);
592 592
 	
593 593
 	
594 594
 	// duplicate fields
595
-	acf_duplicate_fields( $fields, $field_group['ID'] );
595
+	acf_duplicate_fields($fields, $field_group['ID']);
596 596
 	
597 597
 	
598 598
 	// action for 3rd party customization
@@ -618,16 +618,16 @@  discard block
 block discarded – undo
618 618
 *  @return	(int)
619 619
 */
620 620
 
621
-function acf_get_field_count( $field_group ) {
621
+function acf_get_field_count($field_group) {
622 622
 	
623 623
 	// vars
624 624
 	$count = 0;
625 625
 	
626 626
 	
627 627
 	// local
628
-	if( !$field_group['ID'] ) {
628
+	if ( ! $field_group['ID']) {
629 629
 		
630
-		$count = acf_count_local_fields( $field_group['key'] );	
630
+		$count = acf_count_local_fields($field_group['key']);	
631 631
 	
632 632
 	// DB	
633 633
 	} else {
@@ -672,29 +672,29 @@  discard block
 block discarded – undo
672 672
 *  @return	(boolean)
673 673
 */
674 674
 
675
-function acf_delete_field_group( $selector = 0 ) {
675
+function acf_delete_field_group($selector = 0) {
676 676
 	
677 677
 	// disable JSON to avoid conflicts between DB and JSON
678 678
 	acf_disable_local();
679 679
 	
680 680
 	
681 681
 	// load the origional field gorup
682
-	$field_group = acf_get_field_group( $selector );
682
+	$field_group = acf_get_field_group($selector);
683 683
 	
684 684
 	
685 685
 	// bail early if field group did not load correctly
686
-	if( empty($field_group) ) return false;
686
+	if (empty($field_group)) return false;
687 687
 	
688 688
 	
689 689
 	// get fields
690 690
 	$fields = acf_get_fields($field_group);
691 691
 	
692 692
 	
693
-	if( !empty($fields) ) {
693
+	if ( ! empty($fields)) {
694 694
 	
695
-		foreach( $fields as $field ) {
695
+		foreach ($fields as $field) {
696 696
 			
697
-			acf_delete_field( $field['ID'] );
697
+			acf_delete_field($field['ID']);
698 698
 		
699 699
 		}
700 700
 	
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	
703 703
 	
704 704
 	// delete
705
-	wp_delete_post( $field_group['ID'] );
705
+	wp_delete_post($field_group['ID']);
706 706
 	
707 707
 	
708 708
 	// action for 3rd party customization
@@ -727,29 +727,29 @@  discard block
 block discarded – undo
727 727
 *  @return	(boolean)
728 728
 */
729 729
 
730
-function acf_trash_field_group( $selector = 0 ) {
730
+function acf_trash_field_group($selector = 0) {
731 731
 	
732 732
 	// disable JSON to avoid conflicts between DB and JSON
733 733
 	acf_disable_local();
734 734
 	
735 735
 	
736 736
 	// load the origional field gorup
737
-	$field_group = acf_get_field_group( $selector );
737
+	$field_group = acf_get_field_group($selector);
738 738
 	
739 739
 	
740 740
 	// bail early if field group did not load correctly
741
-	if( empty($field_group) ) return false;
741
+	if (empty($field_group)) return false;
742 742
 	
743 743
 	
744 744
 	// get fields
745 745
 	$fields = acf_get_fields($field_group);
746 746
 	
747 747
 	
748
-	if( !empty($fields) ) {
748
+	if ( ! empty($fields)) {
749 749
 	
750
-		foreach( $fields as $field ) {
750
+		foreach ($fields as $field) {
751 751
 			
752
-			acf_trash_field( $field['ID'] );
752
+			acf_trash_field($field['ID']);
753 753
 			
754 754
 		}
755 755
 		
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	
758 758
 	
759 759
 	// delete
760
-	wp_trash_post( $field_group['ID'] );
760
+	wp_trash_post($field_group['ID']);
761 761
 	
762 762
 	
763 763
 	// action for 3rd party customization
@@ -782,29 +782,29 @@  discard block
 block discarded – undo
782 782
 *  @return	(boolean)
783 783
 */
784 784
 
785
-function acf_untrash_field_group( $selector = 0 ) {
785
+function acf_untrash_field_group($selector = 0) {
786 786
 	
787 787
 	// disable JSON to avoid conflicts between DB and JSON
788 788
 	acf_disable_local();
789 789
 	
790 790
 	
791 791
 	// load the origional field gorup
792
-	$field_group = acf_get_field_group( $selector );
792
+	$field_group = acf_get_field_group($selector);
793 793
 	
794 794
 	
795 795
 	// bail early if field group did not load correctly
796
-	if( empty($field_group) ) return false;
796
+	if (empty($field_group)) return false;
797 797
 	
798 798
 	
799 799
 	// get fields
800 800
 	$fields = acf_get_fields($field_group);
801 801
 	
802 802
 	
803
-	if( !empty($fields) ) {
803
+	if ( ! empty($fields)) {
804 804
 	
805
-		foreach( $fields as $field ) {
805
+		foreach ($fields as $field) {
806 806
 			
807
-			acf_untrash_field( $field['ID'] );
807
+			acf_untrash_field($field['ID']);
808 808
 		
809 809
 		}
810 810
 	
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	
813 813
 	
814 814
 	// delete
815
-	wp_untrash_post( $field_group['ID'] );
815
+	wp_untrash_post($field_group['ID']);
816 816
 	
817 817
 	
818 818
 	// action for 3rd party customization
@@ -838,91 +838,91 @@  discard block
 block discarded – undo
838 838
 *  @return	n/a
839 839
 */
840 840
 
841
-function acf_get_field_group_style( $field_group ) {
841
+function acf_get_field_group_style($field_group) {
842 842
 	
843 843
 	// vars
844 844
 	$e = '';
845 845
 	
846 846
 	
847 847
 	// validate
848
-	if( !is_array($field_group['hide_on_screen']) )
848
+	if ( ! is_array($field_group['hide_on_screen']))
849 849
 	{
850 850
 		return $e;
851 851
 	}
852 852
 	
853 853
 	
854 854
 	// add style to html
855
-	if( in_array('permalink',$field_group['hide_on_screen']) )
855
+	if (in_array('permalink', $field_group['hide_on_screen']))
856 856
 	{
857 857
 		$e .= '#edit-slug-box {display: none;} ';
858 858
 	}
859 859
 	
860
-	if( in_array('the_content',$field_group['hide_on_screen']) )
860
+	if (in_array('the_content', $field_group['hide_on_screen']))
861 861
 	{
862 862
 		$e .= '#postdivrich {display: none;} ';
863 863
 	}
864 864
 	
865
-	if( in_array('excerpt',$field_group['hide_on_screen']) )
865
+	if (in_array('excerpt', $field_group['hide_on_screen']))
866 866
 	{
867 867
 		$e .= '#postexcerpt, #screen-meta label[for=postexcerpt-hide] {display: none;} ';
868 868
 	}
869 869
 	
870
-	if( in_array('custom_fields',$field_group['hide_on_screen']) )
870
+	if (in_array('custom_fields', $field_group['hide_on_screen']))
871 871
 	{
872 872
 		$e .= '#postcustom, #screen-meta label[for=postcustom-hide] { display: none; } ';
873 873
 	}
874 874
 	
875
-	if( in_array('discussion',$field_group['hide_on_screen']) )
875
+	if (in_array('discussion', $field_group['hide_on_screen']))
876 876
 	{
877 877
 		$e .= '#commentstatusdiv, #screen-meta label[for=commentstatusdiv-hide] {display: none;} ';
878 878
 	}
879 879
 	
880
-	if( in_array('comments',$field_group['hide_on_screen']) )
880
+	if (in_array('comments', $field_group['hide_on_screen']))
881 881
 	{
882 882
 		$e .= '#commentsdiv, #screen-meta label[for=commentsdiv-hide] {display: none;} ';
883 883
 	}
884 884
 	
885
-	if( in_array('slug',$field_group['hide_on_screen']) )
885
+	if (in_array('slug', $field_group['hide_on_screen']))
886 886
 	{
887 887
 		$e .= '#slugdiv, #screen-meta label[for=slugdiv-hide] {display: none;} ';
888 888
 	}
889 889
 	
890
-	if( in_array('author',$field_group['hide_on_screen']) )
890
+	if (in_array('author', $field_group['hide_on_screen']))
891 891
 	{
892 892
 		$e .= '#authordiv, #screen-meta label[for=authordiv-hide] {display: none;} ';
893 893
 	}
894 894
 	
895
-	if( in_array('format',$field_group['hide_on_screen']) )
895
+	if (in_array('format', $field_group['hide_on_screen']))
896 896
 	{
897 897
 		$e .= '#formatdiv, #screen-meta label[for=formatdiv-hide] {display: none;} ';
898 898
 	}
899 899
 	
900
-	if( in_array('page_attributes',$field_group['hide_on_screen']) )
900
+	if (in_array('page_attributes', $field_group['hide_on_screen']))
901 901
 	{
902 902
 		$e .= '#pageparentdiv {display: none;} ';
903 903
 	}
904 904
 
905
-	if( in_array('featured_image',$field_group['hide_on_screen']) )
905
+	if (in_array('featured_image', $field_group['hide_on_screen']))
906 906
 	{
907 907
 		$e .= '#postimagediv, #screen-meta label[for=postimagediv-hide] {display: none;} ';
908 908
 	}
909 909
 	
910
-	if( in_array('revisions',$field_group['hide_on_screen']) )
910
+	if (in_array('revisions', $field_group['hide_on_screen']))
911 911
 	{
912 912
 		$e .= '#revisionsdiv, #screen-meta label[for=revisionsdiv-hide] {display: none;} ';
913 913
 	}
914 914
 	
915
-	if( in_array('categories',$field_group['hide_on_screen']) )
915
+	if (in_array('categories', $field_group['hide_on_screen']))
916 916
 	{
917 917
 		$e .= '#categorydiv, #screen-meta label[for=categorydiv-hide] {display: none;} ';
918 918
 	}
919 919
 	
920
-	if( in_array('tags',$field_group['hide_on_screen']) )
920
+	if (in_array('tags', $field_group['hide_on_screen']))
921 921
 	{
922 922
 		$e .= '#tagsdiv-post_tag, #screen-meta label[for=tagsdiv-post_tag-hide] {display: none;} ';
923 923
 	}
924 924
 	
925
-	if( in_array('send-trackbacks',$field_group['hide_on_screen']) )
925
+	if (in_array('send-trackbacks', $field_group['hide_on_screen']))
926 926
 	{
927 927
 		$e .= '#trackbacksdiv, #screen-meta label[for=trackbacksdiv-hide] {display: none;} ';
928 928
 	}
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 *  @return	$id (int)
947 947
 */
948 948
 
949
-function acf_import_field_group( $field_group ) {
949
+function acf_import_field_group($field_group) {
950 950
 	
951 951
 	// vars
952 952
 	$ref = array();
@@ -958,24 +958,24 @@  discard block
 block discarded – undo
958 958
 	
959 959
 	
960 960
 	// format fields
961
-	$fields = acf_prepare_fields_for_import( $fields );
961
+	$fields = acf_prepare_fields_for_import($fields);
962 962
 	
963 963
 	
964 964
 	// remove old fields
965
-	if( $field_group['ID'] ) {
965
+	if ($field_group['ID']) {
966 966
 		
967 967
 		// disable local - important as to avoid 'acf_get_fields_by_id' returning fields with ID = 0
968 968
 		acf_disable_local();
969 969
 	
970 970
 		
971 971
 		// load fields
972
-		$db_fields = acf_get_fields_by_id( $field_group['ID'] );
973
-		$db_fields = acf_prepare_fields_for_import( $db_fields );
972
+		$db_fields = acf_get_fields_by_id($field_group['ID']);
973
+		$db_fields = acf_prepare_fields_for_import($db_fields);
974 974
 		
975 975
 		
976 976
 		// get field keys
977 977
 		$keys = array();
978
-		foreach( $fields as $field ) {
978
+		foreach ($fields as $field) {
979 979
 			
980 980
 			$keys[] = $field['key'];
981 981
 			
@@ -983,15 +983,15 @@  discard block
 block discarded – undo
983 983
 		
984 984
 		
985 985
 		// loop over db fields
986
-		foreach( $db_fields as $field ) {
986
+		foreach ($db_fields as $field) {
987 987
 			
988 988
 			// add to ref
989
-			$ref[ $field['key'] ] = $field['ID'];
989
+			$ref[$field['key']] = $field['ID'];
990 990
 			
991 991
 			
992
-			if( !in_array($field['key'], $keys) ) {
992
+			if ( ! in_array($field['key'], $keys)) {
993 993
 				
994
-				acf_delete_field( $field['ID'] );
994
+				acf_delete_field($field['ID']);
995 995
 				
996 996
 			}
997 997
 			
@@ -1005,57 +1005,57 @@  discard block
 block discarded – undo
1005 1005
 	
1006 1006
 			
1007 1007
 	// save field group
1008
-	$field_group = acf_update_field_group( $field_group );
1008
+	$field_group = acf_update_field_group($field_group);
1009 1009
 	
1010 1010
 	
1011 1011
 	// add to ref
1012
-	$ref[ $field_group['key'] ] = $field_group['ID'];
1012
+	$ref[$field_group['key']] = $field_group['ID'];
1013 1013
 	
1014 1014
 	
1015 1015
 	// add to order
1016
-	$order[ $field_group['ID'] ] = 0;
1016
+	$order[$field_group['ID']] = 0;
1017 1017
 	
1018 1018
 	
1019 1019
 	// add fields
1020
-	foreach( $fields as $field ) {
1020
+	foreach ($fields as $field) {
1021 1021
 		
1022 1022
 		// add ID
1023
-		if( !$field['ID'] && isset($ref[ $field['key'] ]) ) {
1023
+		if ( ! $field['ID'] && isset($ref[$field['key']])) {
1024 1024
 			
1025
-			$field['ID'] = $ref[ $field['key'] ];	
1025
+			$field['ID'] = $ref[$field['key']];	
1026 1026
 			
1027 1027
 		}
1028 1028
 		
1029 1029
 		
1030 1030
 		// add parent
1031
-		if( empty($field['parent']) ) {
1031
+		if (empty($field['parent'])) {
1032 1032
 			
1033 1033
 			$field['parent'] = $field_group['ID'];
1034 1034
 			
1035
-		} elseif( isset($ref[ $field['parent'] ]) ) {
1035
+		} elseif (isset($ref[$field['parent']])) {
1036 1036
 			
1037
-			$field['parent'] = $ref[ $field['parent'] ];
1037
+			$field['parent'] = $ref[$field['parent']];
1038 1038
 				
1039 1039
 		}
1040 1040
 		
1041 1041
 		
1042 1042
 		// add field menu_order
1043
-		if( !isset($order[ $field['parent'] ]) ) {
1043
+		if ( ! isset($order[$field['parent']])) {
1044 1044
 			
1045
-			$order[ $field['parent'] ] = 0;
1045
+			$order[$field['parent']] = 0;
1046 1046
 			
1047 1047
 		}
1048 1048
 		
1049
-		$field['menu_order'] = $order[ $field['parent'] ];
1050
-		$order[ $field['parent'] ]++;
1049
+		$field['menu_order'] = $order[$field['parent']];
1050
+		$order[$field['parent']]++;
1051 1051
 		
1052 1052
 		
1053 1053
 		// save field
1054
-		$field = acf_update_field( $field );
1054
+		$field = acf_update_field($field);
1055 1055
 		
1056 1056
 		
1057 1057
 		// add to ref
1058
-		$ref[ $field['key'] ] = $field['ID'];
1058
+		$ref[$field['key']] = $field['ID'];
1059 1059
 		
1060 1060
 	}
1061 1061
 	
@@ -1079,14 +1079,14 @@  discard block
 block discarded – undo
1079 1079
 *  @return	$post_id (int)
1080 1080
 */
1081 1081
 
1082
-function acf_prepare_field_group_for_export( $field_group ) {
1082
+function acf_prepare_field_group_for_export($field_group) {
1083 1083
 	
1084 1084
 	// extract field group ID
1085
-	$id = acf_extract_var( $field_group, 'ID' );
1085
+	$id = acf_extract_var($field_group, 'ID');
1086 1086
 	
1087 1087
 	
1088 1088
 	// prepare fields
1089
-	$field_group['fields'] = acf_prepare_fields_for_export( $field_group['fields'] );
1089
+	$field_group['fields'] = acf_prepare_fields_for_export($field_group['fields']);
1090 1090
 	
1091 1091
 	
1092 1092
 	// filter for 3rd party customization
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,19 +16,27 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/acf/api/api-value.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@
 block discarded – undo
267 267
 	// add or update
268 268
 	if( get_option($option) !== false ) {
269 269
 	
270
-	    $return = update_option( $option, $value );
270
+		$return = update_option( $option, $value );
271 271
 	    
272 272
 	} else {
273 273
 		
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -15,52 +15,52 @@  discard block
 block discarded – undo
15 15
 *  @return	$return (mixed)
16 16
 */
17 17
 
18
-function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
18
+function acf_get_metadata($post_id = 0, $name = '', $hidden = false) {
19 19
 	
20 20
 	// vars
21 21
 	$value = null;
22 22
 	
23 23
 	
24 24
 	// add prefix for hidden meta
25
-	if( $hidden ) {
25
+	if ($hidden) {
26 26
 		
27
-		$name = '_' . $name;
27
+		$name = '_'.$name;
28 28
 		
29 29
 	}
30 30
 	
31 31
 	
32 32
 	// post
33
-	if( is_numeric($post_id) ) {
33
+	if (is_numeric($post_id)) {
34 34
 		
35
-		$meta = get_metadata( 'post', $post_id, $name, false );
35
+		$meta = get_metadata('post', $post_id, $name, false);
36 36
 		
37
-		if( isset($meta[0]) ) {
37
+		if (isset($meta[0])) {
38 38
 		
39 39
 		 	$value = $meta[0];
40 40
 		 	
41 41
 	 	}
42 42
 	
43 43
 	// user
44
-	} elseif( substr($post_id, 0, 5) == 'user_' ) {
44
+	} elseif (substr($post_id, 0, 5) == 'user_') {
45 45
 		
46 46
 		$user_id = (int) substr($post_id, 5);
47 47
 		
48
-		$meta = get_metadata( 'user', $user_id, $name, false );
48
+		$meta = get_metadata('user', $user_id, $name, false);
49 49
 		
50
-		if( isset($meta[0]) ) {
50
+		if (isset($meta[0])) {
51 51
 		
52 52
 		 	$value = $meta[0];
53 53
 		 	
54 54
 	 	}
55 55
 	
56 56
 	// comment
57
-	} elseif( substr($post_id, 0, 8) == 'comment_' ) {
57
+	} elseif (substr($post_id, 0, 8) == 'comment_') {
58 58
 		
59 59
 		$comment_id = (int) substr($post_id, 8);
60 60
 		
61
-		$meta = get_metadata( 'comment', $comment_id, $name, false );
61
+		$meta = get_metadata('comment', $comment_id, $name, false);
62 62
 		
63
-		if( isset($meta[0]) ) {
63
+		if (isset($meta[0])) {
64 64
 		
65 65
 		 	$value = $meta[0];
66 66
 		 	
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	} else {
70 70
 		
71 71
 		// modify prefix for hidden meta
72
-		if( $hidden ) {
72
+		if ($hidden) {
73 73
 			
74
-			$post_id = '_' . $post_id;
74
+			$post_id = '_'.$post_id;
75 75
 			$name = substr($name, 1);
76 76
 			
77 77
 		}
78 78
 		
79
-		$value = get_option( $post_id . '_' . $name, null );
79
+		$value = get_option($post_id.'_'.$name, null);
80 80
 		
81 81
 	}
82 82
 		
@@ -103,34 +103,34 @@  discard block
 block discarded – undo
103 103
 *  @return	$return (boolean)
104 104
 */
105 105
 
106
-function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = false ) {
106
+function acf_update_metadata($post_id = 0, $name = '', $value = '', $hidden = false) {
107 107
 	
108 108
 	// vars
109 109
 	$return = false;
110 110
 	
111 111
 	
112 112
 	// add prefix for hidden meta
113
-	if( $hidden ) {
113
+	if ($hidden) {
114 114
 		
115
-		$name = '_' . $name;
115
+		$name = '_'.$name;
116 116
 		
117 117
 	}
118 118
 	
119 119
 	
120 120
 	// postmeta
121
-	if( is_numeric($post_id) ) {
121
+	if (is_numeric($post_id)) {
122 122
 		
123
-		$return = update_metadata('post', $post_id, $name, $value );
123
+		$return = update_metadata('post', $post_id, $name, $value);
124 124
 	
125 125
 	// usermeta
126
-	} elseif( substr($post_id, 0, 5) == 'user_' ) {
126
+	} elseif (substr($post_id, 0, 5) == 'user_') {
127 127
 		
128 128
 		$user_id = (int) substr($post_id, 5);
129 129
 		
130 130
 		$return = update_metadata('user', $user_id, $name, $value);
131 131
 		
132 132
 	// commentmeta
133
-	} elseif( substr($post_id, 0, 8) == 'comment_' ) {
133
+	} elseif (substr($post_id, 0, 8) == 'comment_') {
134 134
 		
135 135
 		$comment_id = (int) substr($post_id, 8);
136 136
 		
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	} else {
141 141
 		
142 142
 		// modify prefix for hidden meta
143
-		if( $hidden ) {
143
+		if ($hidden) {
144 144
 			
145
-			$post_id = '_' . $post_id;
145
+			$post_id = '_'.$post_id;
146 146
 			$name = substr($name, 1);
147 147
 			
148 148
 		}
149 149
 		
150
-		$return = acf_update_option( $post_id . '_' . $name, $value );
150
+		$return = acf_update_option($post_id.'_'.$name, $value);
151 151
 		
152 152
 	}
153 153
 	
@@ -173,34 +173,34 @@  discard block
 block discarded – undo
173 173
 *  @return	$return (boolean)
174 174
 */
175 175
 
176
-function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
176
+function acf_delete_metadata($post_id = 0, $name = '', $hidden = false) {
177 177
 	
178 178
 	// vars
179 179
 	$return = false;
180 180
 	
181 181
 	
182 182
 	// add prefix for hidden meta
183
-	if( $hidden ) {
183
+	if ($hidden) {
184 184
 		
185
-		$name = '_' . $name;
185
+		$name = '_'.$name;
186 186
 		
187 187
 	}
188 188
 	
189 189
 	
190 190
 	// postmeta
191
-	if( is_numeric($post_id) ) {
191
+	if (is_numeric($post_id)) {
192 192
 		
193
-		$return = delete_metadata('post', $post_id, $name );
193
+		$return = delete_metadata('post', $post_id, $name);
194 194
 	
195 195
 	// usermeta
196
-	} elseif( substr($post_id, 0, 5) == 'user_' ) {
196
+	} elseif (substr($post_id, 0, 5) == 'user_') {
197 197
 		
198 198
 		$user_id = (int) substr($post_id, 5);
199 199
 		
200 200
 		$return = delete_metadata('user', $user_id, $name);
201 201
 		
202 202
 	// commentmeta
203
-	} elseif( substr($post_id, 0, 8) == 'comment_' ) {
203
+	} elseif (substr($post_id, 0, 8) == 'comment_') {
204 204
 		
205 205
 		$comment_id = (int) substr($post_id, 8);
206 206
 		
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
 	} else {
211 211
 		
212 212
 		// modify prefix for hidden meta
213
-		if( $hidden ) {
213
+		if ($hidden) {
214 214
 			
215
-			$post_id = '_' . $post_id;
215
+			$post_id = '_'.$post_id;
216 216
 			$name = substr($name, 1);
217 217
 			
218 218
 		}
219 219
 		
220
-		$return = delete_option( $post_id . '_' . $name );
220
+		$return = delete_option($post_id.'_'.$name);
221 221
 		
222 222
 	}
223 223
 	
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 *  @return	(boolean)
244 244
 */
245 245
 
246
-function acf_update_option( $option = '', $value = '', $autoload = null ) {
246
+function acf_update_option($option = '', $value = '', $autoload = null) {
247 247
 	
248 248
 	// vars
249 249
 	$deprecated = '';
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	
252 252
 	
253 253
 	// autoload
254
-	if( $autoload === null ){
254
+	if ($autoload === null) {
255 255
 		
256 256
 		$autoload = acf_get_setting('autoload') ? 'yes' : 'no';
257 257
 		
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 		
266 266
 		
267 267
 	// add or update
268
-	if( get_option($option) !== false ) {
268
+	if (get_option($option) !== false) {
269 269
 	
270
-	    $return = update_option( $option, $value );
270
+	    $return = update_option($option, $value);
271 271
 	    
272 272
 	} else {
273 273
 		
274
-		$return = add_option( $option, $value, $deprecated, $autoload );
274
+		$return = add_option($option, $value, $deprecated, $autoload);
275 275
 		
276 276
 	}
277 277
 	
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 *  @return	(mixed)
297 297
 */
298 298
 
299
-function acf_get_value( $post_id = 0, $field ) {
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) return null;
303 303
 	
304 304
 	
305 305
 	// try cache
306 306
 	$found = false;
307
-	$cache = wp_cache_get( "load_value/post_id={$post_id}/name={$field['name']}", 'acf', false, $found );
307
+	$cache = wp_cache_get("load_value/post_id={$post_id}/name={$field['name']}", 'acf', false, $found);
308 308
 	
309
-	if( $found ) {
309
+	if ($found) {
310 310
 	
311 311
 		return $cache;
312 312
 		
@@ -314,15 +314,15 @@  discard block
 block discarded – undo
314 314
 	
315 315
 	
316 316
 	// load value
317
-	$value = acf_get_metadata( $post_id, $field['name'] );
317
+	$value = acf_get_metadata($post_id, $field['name']);
318 318
 	
319 319
 	
320 320
 	// if value was duplicated, it may now be a serialized string!
321
-	$value = maybe_unserialize( $value );
321
+	$value = maybe_unserialize($value);
322 322
 	
323 323
 	
324 324
 	// no value? try default_value
325
-	if( $value === null && isset($field['default_value']) ) {
325
+	if ($value === null && isset($field['default_value'])) {
326 326
 		
327 327
 		$value = $field['default_value'];
328 328
 		
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
 	
331 331
 	
332 332
 	// filter for 3rd party customization
333
-	$value = apply_filters( "acf/load_value", $value, $post_id, $field );
334
-	$value = apply_filters( "acf/load_value/type={$field['type']}", $value, $post_id, $field );
335
-	$value = apply_filters( "acf/load_value/name={$field['name']}", $value, $post_id, $field );
336
-	$value = apply_filters( "acf/load_value/key={$field['key']}", $value, $post_id, $field );
333
+	$value = apply_filters("acf/load_value", $value, $post_id, $field);
334
+	$value = apply_filters("acf/load_value/type={$field['type']}", $value, $post_id, $field);
335
+	$value = apply_filters("acf/load_value/name={$field['name']}", $value, $post_id, $field);
336
+	$value = apply_filters("acf/load_value/key={$field['key']}", $value, $post_id, $field);
337 337
 	
338 338
 	
339 339
 	// update cache
340
-	wp_cache_set( "load_value/post_id={$post_id}/name={$field['name']}", $value, 'acf' );
340
+	wp_cache_set("load_value/post_id={$post_id}/name={$field['name']}", $value, 'acf');
341 341
 
342 342
 	
343 343
 	// return
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 *  @return	$value
362 362
 */
363 363
 
364
-function acf_format_value( $value, $post_id, $field ) {
364
+function acf_format_value($value, $post_id, $field) {
365 365
 	
366 366
 	// apply filters
367
-	$value = apply_filters( "acf/format_value", $value, $post_id, $field );
368
-	$value = apply_filters( "acf/format_value/type={$field['type']}", $value, $post_id, $field );
369
-	$value = apply_filters( "acf/format_value/name={$field['name']}", $value, $post_id, $field );
370
-	$value = apply_filters( "acf/format_value/key={$field['key']}", $value, $post_id, $field );
367
+	$value = apply_filters("acf/format_value", $value, $post_id, $field);
368
+	$value = apply_filters("acf/format_value/type={$field['type']}", $value, $post_id, $field);
369
+	$value = apply_filters("acf/format_value/name={$field['name']}", $value, $post_id, $field);
370
+	$value = apply_filters("acf/format_value/key={$field['key']}", $value, $post_id, $field);
371 371
 	
372 372
 	
373 373
 	// return
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
 *  @return	(boolean)
391 391
 */
392 392
 
393
-function acf_update_value( $value = null, $post_id = 0, $field ) {
393
+function acf_update_value($value = null, $post_id = 0, $field) {
394 394
 	
395 395
 	// strip slashes
396
-	if( acf_get_setting('stripslashes') ) {
396
+	if (acf_get_setting('stripslashes')) {
397 397
 		
398 398
 		$value = stripslashes_deep($value);
399 399
 		
@@ -401,22 +401,22 @@  discard block
 block discarded – undo
401 401
 	
402 402
 	
403 403
 	// filter for 3rd party customization
404
-	$value = apply_filters( "acf/update_value", $value, $post_id, $field );
405
-	$value = apply_filters( "acf/update_value/type={$field['type']}", $value, $post_id, $field );
406
-	$value = apply_filters( "acf/update_value/name={$field['name']}", $value, $post_id, $field );
407
-	$value = apply_filters( "acf/update_value/key={$field['key']}", $value, $post_id, $field );
404
+	$value = apply_filters("acf/update_value", $value, $post_id, $field);
405
+	$value = apply_filters("acf/update_value/type={$field['type']}", $value, $post_id, $field);
406
+	$value = apply_filters("acf/update_value/name={$field['name']}", $value, $post_id, $field);
407
+	$value = apply_filters("acf/update_value/key={$field['key']}", $value, $post_id, $field);
408 408
 	
409 409
 
410 410
 	// update value
411
-	$return = acf_update_metadata( $post_id, $field['name'], $value );
411
+	$return = acf_update_metadata($post_id, $field['name'], $value);
412 412
 	
413 413
 	
414 414
 	// update reference
415
-	acf_update_metadata( $post_id, $field['name'], $field['key'], true );
415
+	acf_update_metadata($post_id, $field['name'], $field['key'], true);
416 416
 	
417 417
 	
418 418
 	// clear cache
419
-	wp_cache_delete( "load_value/post_id={$post_id}/name={$field['name']}", 'acf' );
419
+	wp_cache_delete("load_value/post_id={$post_id}/name={$field['name']}", 'acf');
420 420
 
421 421
 	
422 422
 	// return
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 *  @return	(boolean)
440 440
 */
441 441
 
442
-function acf_delete_value( $post_id = 0, $field ) {
442
+function acf_delete_value($post_id = 0, $field) {
443 443
 	
444 444
 	// action for 3rd party customization
445 445
 	do_action("acf/delete_value", $post_id, $field['name'], $field);
@@ -449,15 +449,15 @@  discard block
 block discarded – undo
449 449
 	
450 450
 	
451 451
 	// delete value
452
-	$return = acf_delete_metadata( $post_id, $field['name'] );
452
+	$return = acf_delete_metadata($post_id, $field['name']);
453 453
 	
454 454
 	
455 455
 	// delete reference
456
-	acf_delete_metadata( $post_id, $field['name'], true );
456
+	acf_delete_metadata($post_id, $field['name'], true);
457 457
 	
458 458
 	
459 459
 	// clear cache
460
-	wp_cache_delete( "load_value/post_id={$post_id}/name={$field['name']}", 'acf' );
460
+	wp_cache_delete("load_value/post_id={$post_id}/name={$field['name']}", 'acf');
461 461
 	
462 462
 	
463 463
 	// return
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -299,7 +299,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/acf/core/ajax.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 *  @subpackage	Core
11 11
 */
12 12
 
13
-if( ! class_exists('acf_ajax') ) :
13
+if ( ! class_exists('acf_ajax')) :
14 14
 
15 15
 class acf_ajax {
16 16
 	
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	function __construct() {
32 32
 		
33 33
 		// acf/update_user_setting
34
-		add_action( 'wp_ajax_acf/update_user_setting',			array($this, 'update_user_setting') );
35
-		add_action( 'wp_ajax_nopriv_acf/update_user_setting',	array($this, 'update_user_setting') );
34
+		add_action('wp_ajax_acf/update_user_setting', array($this, 'update_user_setting'));
35
+		add_action('wp_ajax_nopriv_acf/update_user_setting', array($this, 'update_user_setting'));
36 36
 		
37 37
 	}
38 38
 	
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	function update_user_setting() {
54 54
 		
55 55
 		// options
56
-		$options = acf_parse_args( $_POST, array(
56
+		$options = acf_parse_args($_POST, array(
57 57
 			'name'		=> '',
58 58
 			'value'		=> '',
59 59
 			'nonce'		=> '',
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		
62 62
 		
63 63
 		// validate
64
-		if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') || empty($options['name']) ) {
64
+		if ( ! wp_verify_nonce($options['nonce'], 'acf_nonce') || empty($options['name'])) {
65 65
 		
66 66
 			die('0');
67 67
 			
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		
70 70
 		
71 71
 		// upadte setting
72
-		acf_update_user_setting( $options['name'], $options['value'] );
72
+		acf_update_user_setting($options['name'], $options['value']);
73 73
 		
74 74
 		
75 75
 		// return
Please login to merge, or discard this patch.
includes/acf/core/compatibility.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
 	function __construct() {
19 19
 		
20 20
 		// fields
21
-		add_filter('acf/get_valid_field',					array($this, 'get_valid_field'), 20, 1);
22
-		add_filter('acf/get_valid_field/type=textarea',		array($this, 'get_valid_textarea_field'), 20, 1);
23
-		add_filter('acf/get_valid_field/type=relationship',	array($this, 'get_valid_relationship_field'), 20, 1);
24
-		add_filter('acf/get_valid_field/type=post_object',	array($this, 'get_valid_relationship_field'), 20, 1);
25
-		add_filter('acf/get_valid_field/type=page_link',	array($this, 'get_valid_relationship_field'), 20, 1);
26
-		add_filter('acf/get_valid_field/type=image',		array($this, 'get_valid_image_field'), 20, 1);
27
-		add_filter('acf/get_valid_field/type=file',			array($this, 'get_valid_image_field'), 20, 1);
28
-		add_filter('acf/get_valid_field/type=wysiwyg',		array($this, 'get_valid_wysiwyg_field'), 20, 1);
29
-		add_filter('acf/get_valid_field/type=date_picker',	array($this, 'get_valid_date_picker_field'), 20, 1);
30
-		add_filter('acf/get_valid_field/type=taxonomy',		array($this, 'get_valid_taxonomy_field'), 20, 1);
21
+		add_filter('acf/get_valid_field', array($this, 'get_valid_field'), 20, 1);
22
+		add_filter('acf/get_valid_field/type=textarea', array($this, 'get_valid_textarea_field'), 20, 1);
23
+		add_filter('acf/get_valid_field/type=relationship', array($this, 'get_valid_relationship_field'), 20, 1);
24
+		add_filter('acf/get_valid_field/type=post_object', array($this, 'get_valid_relationship_field'), 20, 1);
25
+		add_filter('acf/get_valid_field/type=page_link', array($this, 'get_valid_relationship_field'), 20, 1);
26
+		add_filter('acf/get_valid_field/type=image', array($this, 'get_valid_image_field'), 20, 1);
27
+		add_filter('acf/get_valid_field/type=file', array($this, 'get_valid_image_field'), 20, 1);
28
+		add_filter('acf/get_valid_field/type=wysiwyg', array($this, 'get_valid_wysiwyg_field'), 20, 1);
29
+		add_filter('acf/get_valid_field/type=date_picker', array($this, 'get_valid_date_picker_field'), 20, 1);
30
+		add_filter('acf/get_valid_field/type=taxonomy', array($this, 'get_valid_taxonomy_field'), 20, 1);
31 31
 		
32 32
 		
33 33
 		// field groups
34
-		add_filter('acf/get_valid_field_group',				array($this, 'get_valid_field_group'), 20, 1);
34
+		add_filter('acf/get_valid_field_group', array($this, 'get_valid_field_group'), 20, 1);
35 35
 		
36 36
 		
37 37
 		// settings
38
-		add_filter('acf/settings/show_admin',				array($this, 'settings_acf_lite'), 5, 1);
39
-		add_filter('acf/settings/l10n_textdomain',			array($this, 'settings_export_textdomain'), 5, 1);
40
-		add_filter('acf/settings/l10n_field',				array($this, 'settings_export_translate'), 5, 1);
41
-		add_filter('acf/settings/l10n_field_group',			array($this, 'settings_export_translate'), 5, 1);
38
+		add_filter('acf/settings/show_admin', array($this, 'settings_acf_lite'), 5, 1);
39
+		add_filter('acf/settings/l10n_textdomain', array($this, 'settings_export_textdomain'), 5, 1);
40
+		add_filter('acf/settings/l10n_field', array($this, 'settings_export_translate'), 5, 1);
41
+		add_filter('acf/settings/l10n_field_group', array($this, 'settings_export_translate'), 5, 1);
42 42
 		
43 43
 	}
44 44
 	
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	*  @return	$post_id (int)
57 57
 	*/
58 58
 	
59
-	function settings_acf_lite( $setting ) {
59
+	function settings_acf_lite($setting) {
60 60
 		
61 61
 		// 5.0.0 - removed ACF_LITE
62
-		if( defined('ACF_LITE') && ACF_LITE ) {
62
+		if (defined('ACF_LITE') && ACF_LITE) {
63 63
 			
64 64
 			$setting = false;
65 65
 			
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 		
72 72
 	}
73 73
 	
74
-	function settings_export_textdomain( $setting ) {
74
+	function settings_export_textdomain($setting) {
75 75
 		
76 76
 		// 5.3.3 - changed filter name
77
-		return acf_get_setting( 'export_textdomain', $setting );
77
+		return acf_get_setting('export_textdomain', $setting);
78 78
 		
79 79
 	}
80 80
 	
81
-	function settings_export_translate( $setting ) {
81
+	function settings_export_translate($setting) {
82 82
 		
83 83
 		// 5.3.3 - changed filter name
84
-		return acf_get_setting( 'export_translate', $setting );
84
+		return acf_get_setting('export_translate', $setting);
85 85
 		
86 86
 	}
87 87
 	
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
 	*  @return	$field
100 100
 	*/
101 101
 	
102
-	function get_valid_field( $field ) {
102
+	function get_valid_field($field) {
103 103
 		
104 104
 		// conditional logic has changed
105
-		if( isset($field['conditional_logic']['status']) ) {
105
+		if (isset($field['conditional_logic']['status'])) {
106 106
 			
107 107
 			// extract logic
108
-			$logic = acf_extract_var( $field, 'conditional_logic' );
108
+			$logic = acf_extract_var($field, 'conditional_logic');
109 109
 			
110 110
 			
111 111
 			// disabled
112
-			if( !empty($logic['status']) ) {
112
+			if ( ! empty($logic['status'])) {
113 113
 				
114 114
 				// reset
115 115
 				$field['conditional_logic'] = array();
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 		 		
122 122
 		 		
123 123
 		 		// loop over rules
124
-		 		if( !empty($logic['rules']) ) {
124
+		 		if ( ! empty($logic['rules'])) {
125 125
 			 		
126
-			 		foreach( $logic['rules'] as $rule ) {
126
+			 		foreach ($logic['rules'] as $rule) {
127 127
 				 		
128 128
 					 	// sperate groups?
129
-					 	if( $all_or_any == 'any' ) {
129
+					 	if ($all_or_any == 'any') {
130 130
 					 	
131 131
 						 	$group++;
132 132
 						 	
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 					 	
135 135
 					 	
136 136
 					 	// add to group
137
-					 	$field['conditional_logic'][ $group ][] = $rule;
137
+					 	$field['conditional_logic'][$group][] = $rule;
138 138
 			 	
139 139
 				 	}
140 140
 				 	
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	*  @return	$field
174 174
 	*/
175 175
 	
176
-	function get_valid_relationship_field( $field ) {
176
+	function get_valid_relationship_field($field) {
177 177
 		
178 178
 		// force array
179 179
 		$field['post_type'] = acf_get_array($field['post_type']);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		
182 182
 		
183 183
 		// remove 'all' from post_type
184
-		if( acf_in_array('all', $field['post_type']) ) {
184
+		if (acf_in_array('all', $field['post_type'])) {
185 185
 			
186 186
 			$field['post_type'] = array();
187 187
 			
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		
190 190
 		
191 191
 		// remove 'all' from taxonomy
192
-		if( acf_in_array('all', $field['taxonomy']) ) {
192
+		if (acf_in_array('all', $field['taxonomy'])) {
193 193
 			
194 194
 			$field['taxonomy'] = array();
195 195
 			
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
 		
198 198
 		
199 199
 		// save_format is now return_format
200
-		if( !empty($field['result_elements']) ) {
200
+		if ( ! empty($field['result_elements'])) {
201 201
 			
202
-			$field['elements'] = acf_extract_var( $field, 'result_elements' );
202
+			$field['elements'] = acf_extract_var($field, 'result_elements');
203 203
 			
204 204
 		}
205 205
 		
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 	*  @return	$field
224 224
 	*/
225 225
 	
226
-	function get_valid_textarea_field( $field ) {
226
+	function get_valid_textarea_field($field) {
227 227
 		
228 228
 		// formatting has been removed
229
-		$formatting = acf_extract_var( $field, 'formatting' );
229
+		$formatting = acf_extract_var($field, 'formatting');
230 230
 		
231
-		if( $formatting === 'br' ) {
231
+		if ($formatting === 'br') {
232 232
 			
233 233
 			$field['new_lines'] = 'br';
234 234
 			
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 	*  @return	$field
254 254
 	*/
255 255
 	
256
-	function get_valid_image_field( $field ) {
256
+	function get_valid_image_field($field) {
257 257
 		
258 258
 		// save_format is now return_format
259
-		if( !empty($field['save_format']) ) {
259
+		if ( ! empty($field['save_format'])) {
260 260
 			
261
-			$field['return_format'] = acf_extract_var( $field, 'save_format' );
261
+			$field['return_format'] = acf_extract_var($field, 'save_format');
262 262
 			
263 263
 		}
264 264
 		
265 265
 		
266 266
 		// object is now array
267
-		if( $field['return_format'] == 'object' ) {
267
+		if ($field['return_format'] == 'object') {
268 268
 			
269 269
 			$field['return_format'] = 'array';
270 270
 			
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	*  @return	$field
290 290
 	*/
291 291
 	
292
-	function get_valid_wysiwyg_field( $field ) {
292
+	function get_valid_wysiwyg_field($field) {
293 293
 		
294 294
 		// media_upload is now numeric
295
-		if( $field['media_upload'] === 'yes' ) {
295
+		if ($field['media_upload'] === 'yes') {
296 296
 			
297 297
 			$field['media_upload'] = 1;
298 298
 			
299
-		} elseif( $field['media_upload'] === 'no' ) {
299
+		} elseif ($field['media_upload'] === 'no') {
300 300
 			
301 301
 			$field['media_upload'] = 0;
302 302
 			
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 	*  @return	$field
322 322
 	*/
323 323
 	
324
-	function get_valid_date_picker_field( $field ) {
324
+	function get_valid_date_picker_field($field) {
325 325
 		
326 326
 		// v4 used date_format
327
-		if( !empty($field['date_format']) ) {
327
+		if ( ! empty($field['date_format'])) {
328 328
 			
329 329
 			// extract vars
330
-			$date_format = acf_extract_var( $field, 'date_format' );
331
-			$display_format = acf_extract_var( $field, 'display_format' );
330
+			$date_format = acf_extract_var($field, 'date_format');
331
+			$display_format = acf_extract_var($field, 'display_format');
332 332
 			
333 333
 			
334 334
 			// convert from js to php
335
-			$date_format = acf_convert_date_to_php( $date_format );
336
-			$display_format = acf_convert_date_to_php( $display_format );
335
+			$date_format = acf_convert_date_to_php($date_format);
336
+			$display_format = acf_convert_date_to_php($display_format);
337 337
 			
338 338
 			
339 339
 			// append settings
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 	*  @return	$field
363 363
 	*/
364 364
 	
365
-	function get_valid_taxonomy_field( $field ) {
365
+	function get_valid_taxonomy_field($field) {
366 366
 		
367 367
 		// 5.2.7
368
-		if( isset($field['load_save_terms']) ) {
368
+		if (isset($field['load_save_terms'])) {
369 369
 			
370 370
 			$field['save_terms'] = $field['load_save_terms'];
371 371
 			
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	*  @return	$field_group
392 392
 	*/
393 393
 	
394
-	function get_valid_field_group( $field_group ) {
394
+	function get_valid_field_group($field_group) {
395 395
 		
396 396
 		// global
397 397
 		global $wpdb;
@@ -402,20 +402,20 @@  discard block
 block discarded – undo
402 402
 		
403 403
 		
404 404
 		// add missing 'key' (v5.0.0)
405
-		if( empty($field_group['key']) ) {
405
+		if (empty($field_group['key'])) {
406 406
 			
407 407
 			// update version
408 408
 			$v = 4;
409 409
 			
410 410
 			
411 411
 			// add missing key
412
-			$field_group['key'] = empty($field_group['id']) ? uniqid('group_') : 'group_' . $field_group['id'];
412
+			$field_group['key'] = empty($field_group['id']) ? uniqid('group_') : 'group_'.$field_group['id'];
413 413
 			
414 414
 		}
415 415
 		
416 416
 		
417 417
 		// extract options (v5.0.0)
418
-		if( !empty($field_group['options']) ) {
418
+		if ( ! empty($field_group['options'])) {
419 419
 			
420 420
 			$options = acf_extract_var($field_group, 'options');
421 421
 			$field_group = array_merge($field_group, $options);
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 		
425 425
 		
426 426
 		// location rules changed to groups (v5.0.0)
427
-		if( !empty($field_group['location']['rules']) ) {
427
+		if ( ! empty($field_group['location']['rules'])) {
428 428
 			
429 429
 			// extract location
430
-			$location = acf_extract_var( $field_group, 'location' );
430
+			$location = acf_extract_var($field_group, 'location');
431 431
 			
432 432
 			
433 433
 			// reset location
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
 	 		
441 441
 	 		
442 442
 	 		// loop over rules
443
-	 		if( !empty($location['rules']) ) {
443
+	 		if ( ! empty($location['rules'])) {
444 444
 		 		
445
-		 		foreach( $location['rules'] as $rule ) {
445
+		 		foreach ($location['rules'] as $rule) {
446 446
 			 		
447 447
 				 	// sperate groups?
448
-				 	if( $all_or_any == 'any' ) {
448
+				 	if ($all_or_any == 'any') {
449 449
 				 	
450 450
 					 	$group++;
451 451
 					 	
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 				 	
454 454
 				 	
455 455
 				 	// add to group
456
-				 	$field_group['location'][ $group ][] = $rule;
456
+				 	$field_group['location'][$group][] = $rule;
457 457
 		 	
458 458
 			 	}
459 459
 			 	
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		
468 468
 		
469 469
 		// some location rules have changed (v5.0.0)
470
-		if( !empty($field_group['location']) ) {
470
+		if ( ! empty($field_group['location'])) {
471 471
 			
472 472
 			// param changes
473 473
 		 	$param_replace = array(
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 		 	
481 481
 		 	
482 482
 		 	// remove conflicting param
483
-		 	if( $v == 5 ) {
483
+		 	if ($v == 5) {
484 484
 			 	
485 485
 			 	unset($param_replace['taxonomy']);
486 486
 			 	
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 		 	
489 489
 		 	
490 490
 			// loop over location groups
491
-			foreach( array_keys($field_group['location']) as $i ) {
491
+			foreach (array_keys($field_group['location']) as $i) {
492 492
 				
493 493
 				// extract group
494
-				$group = acf_extract_var( $field_group['location'], $i );
494
+				$group = acf_extract_var($field_group['location'], $i);
495 495
 				
496 496
 				
497 497
 				// bail early if group is empty
498
-				if( empty($group) ) {
498
+				if (empty($group)) {
499 499
 					
500 500
 					continue;
501 501
 					
@@ -503,28 +503,28 @@  discard block
 block discarded – undo
503 503
 				
504 504
 				
505 505
 				// loop over group rules
506
-				foreach( array_keys($group) as $j ) {
506
+				foreach (array_keys($group) as $j) {
507 507
 					
508 508
 					// extract rule
509
-					$rule = acf_extract_var( $group, $j );
509
+					$rule = acf_extract_var($group, $j);
510 510
 					
511 511
 					
512 512
 					// migrate param
513
-					if( isset($param_replace[ $rule['param'] ]) ) {
513
+					if (isset($param_replace[$rule['param']])) {
514 514
 						
515
-						$rule['param'] = $param_replace[ $rule['param'] ];
515
+						$rule['param'] = $param_replace[$rule['param']];
516 516
 						
517 517
 					}
518 518
 					
519 519
 					 	
520 520
 				 	// category / taxonomy terms are saved differently
521
-				 	if( $rule['param'] == 'post_category' || $rule['param'] == 'post_taxonomy' ) {
521
+				 	if ($rule['param'] == 'post_category' || $rule['param'] == 'post_taxonomy') {
522 522
 					 	
523
-					 	if( is_numeric($rule['value']) ) {
523
+					 	if (is_numeric($rule['value'])) {
524 524
 						 	
525 525
 						 	$term_id = $rule['value'];
526
-						 	$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id) );
527
-						 	$term = get_term( $term_id, $taxonomy );
526
+						 	$taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id));
527
+						 	$term = get_term($term_id, $taxonomy);
528 528
 						 	
529 529
 						 	// update rule value
530 530
 						 	$rule['value'] = "{$term->taxonomy}:{$term->slug}";
@@ -535,14 +535,14 @@  discard block
 block discarded – undo
535 535
 				 	
536 536
 				 	
537 537
 				 	// append rule
538
-				 	$group[ $j ] = $rule;
538
+				 	$group[$j] = $rule;
539 539
 				 	
540 540
 				}
541 541
 				// foreach
542 542
 				
543 543
 				
544 544
 				// append group
545
-				$field_group['location'][ $i ] = $group;
545
+				$field_group['location'][$i] = $group;
546 546
 				
547 547
 			}
548 548
 			// foreach
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		
553 553
 		
554 554
 		// change layout to style (v5.0.0)
555
-		if( !empty($field_group['layout']) ) {
555
+		if ( ! empty($field_group['layout'])) {
556 556
 		
557 557
 			$field_group['style'] = acf_extract_var($field_group, 'layout');
558 558
 			
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		
561 561
 		
562 562
 		// change no_box to seamless (v5.0.0)
563
-		if( $field_group['style'] === 'no_box' ) {
563
+		if ($field_group['style'] === 'no_box') {
564 564
 		
565 565
 			$field_group['style'] = 'seamless';
566 566
 			
Please login to merge, or discard this patch.