Completed
Push — master ( 5860df...ed31a0 )
by Md. Mozahidur
02:45
created
inc/custom-header.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
  * @uses lighthouse_header_style()
22 22
  */
23 23
 function lighthouse_custom_header_setup() {
24
-	add_theme_support( 'custom-header', apply_filters( 'lighthouse_custom_header_args', array(
24
+	add_theme_support('custom-header', apply_filters('lighthouse_custom_header_args', array(
25 25
 		'default-image'          => '',
26 26
 		'default-text-color'     => '000000',
27 27
 		'width'                  => 1000,
28 28
 		'height'                 => 250,
29 29
 		'flex-height'            => true,
30 30
 		'wp-head-callback'       => 'lighthouse_header_style',
31
-	) ) );
31
+	)));
32 32
 }
33
-add_action( 'after_setup_theme', 'lighthouse_custom_header_setup' );
33
+add_action('after_setup_theme', 'lighthouse_custom_header_setup');
34 34
 
35
-if ( ! function_exists( 'lighthouse_header_style' ) ) :
35
+if ( ! function_exists('lighthouse_header_style')) :
36 36
 /**
37 37
  * Styles the header image and text displayed on the blog.
38 38
  *
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * If no custom options for text are set, let's bail.
46 46
 	 * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: HEADER_TEXTCOLOR.
47 47
 	 */
48
-	if ( HEADER_TEXTCOLOR === $header_text_color ) {
48
+	if (HEADER_TEXTCOLOR === $header_text_color) {
49 49
 		return;
50 50
 	}
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	<style type="text/css">
55 55
 	<?php
56 56
 		// Has the text been hidden?
57
-		if ( ! display_header_text() ) :
57
+		if ( ! display_header_text()) :
58 58
 	?>
59 59
 		.site-title,
60 60
 		.site-description {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	?>
68 68
 		.site-title a,
69 69
 		.site-description {
70
-			color: #<?php echo esc_attr( $header_text_color ); ?>;
70
+			color: #<?php echo esc_attr($header_text_color); ?>;
71 71
 		}
72 72
 	<?php endif; ?>
73 73
 	</style>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,11 +63,14 @@
 block discarded – undo
63 63
 		}
64 64
 	<?php
65 65
 		// If the user has set a custom color for the text use that.
66
-		else :
66
+		else {
67
+			:
67 68
 	?>
68 69
 		.site-title a,
69 70
 		.site-description {
70
-			color: #<?php echo esc_attr( $header_text_color ); ?>;
71
+			color: #<?php echo esc_attr( $header_text_color );
72
+		}
73
+		?>;
71 74
 		}
72 75
 	<?php endif; ?>
73 76
 	</style>
Please login to merge, or discard this patch.
footer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 	<div class="footer-normal">
18 18
 		<div class="container">
19 19
 			<div class="row widget">
20
-				<div class="col-sm-6 col-md-3 widget-col widget-col-1"><?php dynamic_sidebar( 'footer_widgets_1' ); ?></div>
21
-				<div class="col-sm-6 col-md-3 widget-col widget-col-2"><?php dynamic_sidebar( 'footer_widgets_2' ); ?></div>
22
-				<div class="col-sm-6 col-md-3 widget-col widget-col-3"><?php dynamic_sidebar( 'footer_widgets_3' ); ?></div>
23
-				<div class="col-sm-6 col-md-3 widget-col widget-col-4"><?php dynamic_sidebar( 'footer_widgets_4' ); ?></div>
20
+				<div class="col-sm-6 col-md-3 widget-col widget-col-1"><?php dynamic_sidebar('footer_widgets_1'); ?></div>
21
+				<div class="col-sm-6 col-md-3 widget-col widget-col-2"><?php dynamic_sidebar('footer_widgets_2'); ?></div>
22
+				<div class="col-sm-6 col-md-3 widget-col widget-col-3"><?php dynamic_sidebar('footer_widgets_3'); ?></div>
23
+				<div class="col-sm-6 col-md-3 widget-col widget-col-4"><?php dynamic_sidebar('footer_widgets_4'); ?></div>
24 24
 			</div>
25 25
 		</div>
26 26
 	</div>
Please login to merge, or discard this patch.
page-template/page-vc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 <div class="container">
10 10
   <div class="row">
11 11
     <main id="main" class="site-main" role="main">
12
-      <?php while ( have_posts() ) : the_post(); ?>
12
+      <?php while (have_posts()) : the_post(); ?>
13 13
         <section class="home-content">
14 14
           <?php the_content(); ?>
15 15
         </section>
Please login to merge, or discard this patch.
page.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
 		<div class="row">
19 19
 			<main id="main" class="site-main" role="main">
20 20
 				<?php
21
-				while ( have_posts() ) : the_post();
21
+				while (have_posts()) : the_post();
22 22
 
23
-					get_template_part( 'template-parts/content', 'page' );
23
+					get_template_part('template-parts/content', 'page');
24 24
 
25 25
 					// If comments are open or we have at least one comment, load up the comment template.
26
-					if ( comments_open() || get_comments_number() ) :
26
+					if (comments_open() || get_comments_number()) :
27 27
 						comments_template();
28 28
 					endif;
29 29
 
Please login to merge, or discard this patch.
single.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 							<?php
69 69
 							 $postslist = get_posts('numberposts=99&order=DESC&orderby=date');
70 70
 							 foreach ($postslist as $post) :
71
-							    setup_postdata($post);
71
+								setup_postdata($post);
72 72
 							 ?>
73 73
 							 <div class="col-xs-12">
74 74
 							 <div class="entry">
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 				<main id="main" class="site-main" role="main">
26 26
 
27 27
 				<?php
28
-				while ( have_posts() ) : the_post();
28
+				while (have_posts()) : the_post();
29 29
 
30
-					$thumb_feature = wp_get_attachment_image_src( get_post_thumbnail_id(), 'lighthouse_feature_img');
30
+					$thumb_feature = wp_get_attachment_image_src(get_post_thumbnail_id(), 'lighthouse_feature_img');
31 31
 					$url_feature = $thumb_feature[0];
32 32
 				?> 
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				</div>
37 37
 
38 38
 				<?php
39
-				get_template_part( 'template-parts/content', get_post_format() );
39
+				get_template_part('template-parts/content', get_post_format());
40 40
 
41 41
 					//the_post_navigation();
42 42
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 								<div class="thumbnail thumbnail-hover">
67 67
 								<?php
68
-									$thumb_post = wp_get_attachment_image_src( get_post_thumbnail_id(), 'lighthouse_related_post');
68
+									$thumb_post = wp_get_attachment_image_src(get_post_thumbnail_id(), 'lighthouse_related_post');
69 69
 									$url_post = $thumb_post[0];
70 70
 								?>
71 71
 									<img class="img-responsive" src="<?php echo $url_post; ?>">
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 			</div><!-- .blog-listing -->
89 89
 		<div class="col-md-3 sidebar" role="complementary">
90
-			<?php dynamic_sidebar( 'blog_widgets' ); ?>
90
+			<?php dynamic_sidebar('blog_widgets'); ?>
91 91
 		</div>
92 92
 		</div><!-- .row -->
93 93
 	</div><!-- #primary -->
Please login to merge, or discard this patch.
template-parts/content-search.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 
12 12
 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
13 13
 	<header class="entry-header">
14
-		<?php the_title( sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' ); ?>
14
+		<?php the_title(sprintf('<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>'); ?>
15 15
 
16
-		<?php if ( 'post' === get_post_type() ) : ?>
16
+		<?php if ('post' === get_post_type()) : ?>
17 17
 		<div class="entry-meta">
18 18
 			<?php lighthouse_posted_on(); ?>
19 19
 		</div><!-- .entry-meta -->
Please login to merge, or discard this patch.
search.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
 			<div class="col-md-9 content-listing">
23 23
 				<main id="main" class="site-main search-results" role="main">
24 24
 
25
-				<?php query_posts($query_string . '&showposts=99');
26
-				if ( have_posts() ) : ?>
25
+				<?php query_posts($query_string.'&showposts=99');
26
+				if (have_posts()) : ?>
27 27
 
28 28
 					<header class="page-header">
29 29
 						<div class="search-inner-page">
30
-							<form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
30
+							<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
31 31
 							    <div class="search-wrap">
32
-							    	<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'presentation' ); ?></label>
33
-							        <input type="search" placeholder="<?php echo esc_attr( 'Search', 'presentation' ); ?>" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" autocomplete="off"/>
32
+							    	<label class="screen-reader-text" for="s"><?php _e('Search for:', 'presentation'); ?></label>
33
+							        <input type="search" placeholder="<?php echo esc_attr('Search', 'presentation'); ?>" name="s" value="<?php echo esc_attr(get_search_query()); ?>" autocomplete="off"/>
34 34
 							         <button type="submit">
35 35
 						                Search
36 36
 						            </button>
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 							</form>
39 39
 						</div>
40 40
 
41
-						<h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'lighthouse' ), '<span>“' . get_search_query() . '”</span>' ); ?></h1>
41
+						<h1 class="page-title"><?php printf(esc_html__('Search Results for: %s', 'lighthouse'), '<span>“'.get_search_query().'”</span>'); ?></h1>
42 42
 
43 43
 					</header><!-- .page-header -->
44 44
 
45 45
 					<?php
46 46
 					/* Start the Loop */
47
-					while ( have_posts() ) : the_post();
47
+					while (have_posts()) : the_post();
48 48
 
49 49
 						/**
50 50
 						 * Run the loop for the search to output the results.
51 51
 						 * If you want to overload this in a child theme then include a file
52 52
 						 * called content-search.php and that will be used instead.
53 53
 						 */
54
-						get_template_part( 'template-parts/content', 'search' );
54
+						get_template_part('template-parts/content', 'search');
55 55
 
56 56
 					endwhile;
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 				else :
61 61
 
62
-					get_template_part( 'template-parts/content', 'none' );
62
+					get_template_part('template-parts/content', 'none');
63 63
 
64 64
 				endif; ?>
65 65
 				</main><!-- #main -->
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 				</div>
70 70
 			</div><!-- .blog-listing -->
71 71
 		<div class="col-md-3 sidebar" role="complementary">
72
-			<?php dynamic_sidebar( 'blog_widgets' ); ?>
72
+			<?php dynamic_sidebar('blog_widgets'); ?>
73 73
 		</div>
74 74
 		</div><!-- .row -->
75 75
 	</div><!-- #primary -->
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,9 +57,11 @@
 block discarded – undo
57 57
 
58 58
 					the_posts_navigation();
59 59
 
60
-				else :
60
+				else {
61
+					:
61 62
 
62 63
 					get_template_part( 'template-parts/content', 'none' );
64
+				}
63 65
 
64 66
 				endif; ?>
65 67
 				</main><!-- #main -->
Please login to merge, or discard this patch.
includes/acf/api/api-field.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -679,6 +679,9 @@
 block discarded – undo
679 679
 *  @return	$fields (array)
680 680
 */
681 681
 
682
+/**
683
+ * @return boolean
684
+ */
682 685
 function acf_get_fields_by_id( $id = 0 ) {
683 686
 	
684 687
 	// vars
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1209,69 +1209,69 @@
 block discarded – undo
1209 1209
 	$data = maybe_serialize( $data );
1210 1210
     
1211 1211
     
1212
-    // save
1213
-    $save = array(
1214
-    	'ID'			=> $extract['ID'],
1215
-    	'post_status'	=> 'publish',
1216
-    	'post_type'		=> 'acf-field',
1217
-    	'post_title'	=> $extract['label'],
1218
-    	'post_name'		=> $extract['key'],
1219
-    	'post_excerpt'	=> $extract['name'],
1220
-    	'post_content'	=> $data,
1221
-    	'post_parent'	=> $extract['parent'],
1222
-    	'menu_order'	=> $extract['menu_order'],
1223
-    );
1212
+	// save
1213
+	$save = array(
1214
+		'ID'			=> $extract['ID'],
1215
+		'post_status'	=> 'publish',
1216
+		'post_type'		=> 'acf-field',
1217
+		'post_title'	=> $extract['label'],
1218
+		'post_name'		=> $extract['key'],
1219
+		'post_excerpt'	=> $extract['name'],
1220
+		'post_content'	=> $data,
1221
+		'post_parent'	=> $extract['parent'],
1222
+		'menu_order'	=> $extract['menu_order'],
1223
+	);
1224 1224
     
1225 1225
     
1226
-    // $specific
1227
-    if( !empty($specific) ) {
1226
+	// $specific
1227
+	if( !empty($specific) ) {
1228 1228
 	    
1229
-	    // prepend ID
1230
-    	array_unshift( $specific, 'ID' );
1229
+		// prepend ID
1230
+		array_unshift( $specific, 'ID' );
1231 1231
     	
1232 1232
     	
1233
-	    // vars
1234
-	    $_save = $save;
1233
+		// vars
1234
+		$_save = $save;
1235 1235
 	    
1236 1236
 	    
1237
-	    // reset
1238
-	    $save = array();
1237
+		// reset
1238
+		$save = array();
1239 1239
 	    
1240 1240
     	
1241
-    	// appen data
1242
-    	foreach( $specific as $key ) {
1241
+		// appen data
1242
+		foreach( $specific as $key ) {
1243 1243
 	    	
1244
-	    	$save[ $key ] = $_save[ $key ];
1244
+			$save[ $key ] = $_save[ $key ];
1245 1245
 	    	
1246
-    	}
1246
+		}
1247 1247
     	
1248
-    }
1248
+	}
1249 1249
     
1250 1250
     
1251
-    // allow fields to contain the same name
1251
+	// allow fields to contain the same name
1252 1252
 	add_filter( 'wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 100, 6 ); 
1253 1253
 	
1254 1254
 	
1255
-    // update the field and update the ID
1256
-    if( $field['ID'] ) {
1255
+	// update the field and update the ID
1256
+	if( $field['ID'] ) {
1257 1257
 	    
1258
-	    wp_update_post( $save );
1258
+		wp_update_post( $save );
1259 1259
 	    
1260
-    } else  {
1260
+	} else  {
1261 1261
 	    
1262
-	    $field['ID'] = wp_insert_post( $save );
1262
+		$field['ID'] = wp_insert_post( $save );
1263 1263
 	    
1264
-    }
1264
+	}
1265 1265
 	
1266 1266
     
1267
-    // clear cache
1267
+	// clear cache
1268 1268
 	wp_cache_delete( "get_field/ID={$field['ID']}", 'acf' );
1269 1269
 	wp_cache_delete( "get_field/key={$field['key']}", 'acf' );
1270 1270
 	wp_cache_delete( "get_fields/parent={$field['parent']}", 'acf' );
1271 1271
 	
1272 1272
 	
1273
-    // return
1274
-    return $field;
1273
+	// return
1274
+	return $field;
1275 1275
 	
1276 1276
 }
1277 1277
 
Please login to merge, or discard this patch.
Spacing   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
 *  @return	(array)
34 34
 */
35 35
 
36
-function acf_get_field_type_label( $field_type ) {
36
+function acf_get_field_type_label($field_type) {
37 37
 
38 38
 	// vars
39 39
 	$field_types = acf_get_field_types();
40 40
 	
41 41
 	
42 42
 	// loop through categories
43
-	foreach( $field_types as $category ) {
43
+	foreach ($field_types as $category) {
44 44
 		
45
-		if( isset( $category[ $field_type ] ) ) {
45
+		if (isset($category[$field_type])) {
46 46
 		
47
-			return $category[ $field_type ];
47
+			return $category[$field_type];
48 48
 			
49 49
 		}
50 50
 		
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 *  @return	(boolean)
71 71
 */
72 72
 
73
-function acf_field_type_exists( $field_type ) {
73
+function acf_field_type_exists($field_type) {
74 74
 
75 75
 	// vars
76
-	$label = acf_get_field_type_label( $field_type );
76
+	$label = acf_get_field_type_label($field_type);
77 77
 	
78 78
 	
79 79
 	// return true if label exists
80
-	if( $label !== '' ) return true;
80
+	if ($label !== '') return true;
81 81
 		
82 82
 	
83 83
 	// return
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
 *  @return	(boolean)
100 100
 */
101 101
 
102
-function acf_is_field_key( $key = '' ) {
102
+function acf_is_field_key($key = '') {
103 103
 	
104 104
 	// bail early if not string
105
-	if( !is_string($key) ) return false;
105
+	if ( ! is_string($key)) return false;
106 106
 	
107 107
 	
108 108
 	// bail early if is numeric (could be numeric string '123')
109
-	if( is_numeric($key) ) return false;
109
+	if (is_numeric($key)) return false;
110 110
 	
111 111
 	
112 112
 	// default - starts with 'field_'
113
-	if( substr($key, 0, 6) === 'field_' ) return true;
113
+	if (substr($key, 0, 6) === 'field_') return true;
114 114
 	
115 115
 	
116 116
 	// special - allow local field key to be any string
117
-	if( acf_is_local_field($key) ) return true;
117
+	if (acf_is_local_field($key)) return true;
118 118
 	
119 119
 	
120 120
 	// return
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 *  @return	$field (array)
137 137
 */
138 138
 
139
-function acf_get_valid_field( $field = false ) {
139
+function acf_get_valid_field($field = false) {
140 140
 	
141 141
 	// $field must be an array
142
-	if( !is_array($field) ) $field = array();
142
+	if ( ! is_array($field)) $field = array();
143 143
 	
144 144
 	
145 145
 	// bail ealry if already valid
146
-	if( !empty($field['_valid']) ) return $field;
146
+	if ( ! empty($field['_valid'])) return $field;
147 147
 	
148 148
 	
149 149
 	// defaults
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 	
179 179
 	
180 180
 	// translate
181
-	acf_translate_keys( $field, acf_get_setting('l10n_field') );
181
+	acf_translate_keys($field, acf_get_setting('l10n_field'));
182 182
 	
183 183
 	
184 184
 	// field specific defaults
185
-	$field = apply_filters( "acf/get_valid_field", $field );
186
-	$field = apply_filters( "acf/get_valid_field/type={$field['type']}", $field );
185
+	$field = apply_filters("acf/get_valid_field", $field);
186
+	$field = apply_filters("acf/get_valid_field/type={$field['type']}", $field);
187 187
 	
188 188
 	
189 189
 	// field is now valid
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 *  @return	$field (array)
209 209
 */
210 210
 
211
-function acf_prepare_field( $field ) {
211
+function acf_prepare_field($field) {
212 212
 	
213 213
 	// bail early if already prepared
214
-	if( $field['_input'] ) return $field;
214
+	if ($field['_input']) return $field;
215 215
 	
216 216
 	
217 217
 	// _input
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	
220 220
 
221 221
 	// _input: key overrides name
222
-	if( $field['key'] ) {
222
+	if ($field['key']) {
223 223
 		
224 224
 		$field['_input'] = $field['key'];
225 225
 		
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 	
229 229
 	// _input: prefix prepends name
230
-	if( $field['prefix'] ) {
230
+	if ($field['prefix']) {
231 231
 		
232 232
 		$field['_input'] = "{$field['prefix']}[{$field['_input']}]";
233 233
 		
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	
236 236
 	
237 237
 	// add id (may be custom set)
238
-	if( !$field['id'] ) {
238
+	if ( ! $field['id']) {
239 239
 		
240 240
 		$field['id'] = str_replace(array('][', '[', ']'), array('-', '-', ''), $field['_input']);
241 241
 		
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	
244 244
 	
245 245
 	// filter to 3rd party customization
246
-	$field = apply_filters( "acf/prepare_field", $field );
247
-	$field = apply_filters( "acf/prepare_field/type={$field['type']}", $field );
248
-	$field = apply_filters( "acf/prepare_field/name={$field['name']}", $field );
249
-	$field = apply_filters( "acf/prepare_field/key={$field['key']}", $field );
246
+	$field = apply_filters("acf/prepare_field", $field);
247
+	$field = apply_filters("acf/prepare_field/type={$field['type']}", $field);
248
+	$field = apply_filters("acf/prepare_field/name={$field['name']}", $field);
249
+	$field = apply_filters("acf/prepare_field/key={$field['key']}", $field);
250 250
 	
251 251
 	
252 252
 	// return
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 *  @return	(boolean)
269 269
 */
270 270
 
271
-function acf_is_sub_field( $field ) {
271
+function acf_is_sub_field($field) {
272 272
 	
273 273
 	// local field uses a field instead of ID
274
-	if( acf_is_field_key($field['parent']) ) return true;
274
+	if (acf_is_field_key($field['parent'])) return true;
275 275
 	
276 276
 	
277 277
 	// attempt to load parent field
278
-	if( acf_get_field($field['parent']) ) return true;
278
+	if (acf_get_field($field['parent'])) return true;
279 279
 	
280 280
 	
281 281
 	// return
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 *  @return	$label (string)
298 298
 */
299 299
 
300
-function acf_get_field_label( $field ) {
300
+function acf_get_field_label($field) {
301 301
 	
302 302
 	// vars
303 303
 	$label = $field['label'];
304 304
 	
305 305
 	
306
-	if( $field['required'] ) {
306
+	if ($field['required']) {
307 307
 		
308 308
 		$label .= ' <span class="acf-required">*</span>';
309 309
 		
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 
316 316
 }
317 317
 
318
-function acf_the_field_label( $field ) {
318
+function acf_the_field_label($field) {
319 319
 	
320
-	echo acf_get_field_label( $field );
320
+	echo acf_get_field_label($field);
321 321
 	
322 322
 }
323 323
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 *  @return	n/a
340 340
 */
341 341
 
342
-function acf_render_fields( $post_id = 0, $fields, $el = 'div', $instruction = 'label' ) {
342
+function acf_render_fields($post_id = 0, $fields, $el = 'div', $instruction = 'label') {
343 343
 	
344 344
 	// bail early if no fields
345
-	if( empty($fields) ) return false;
345
+	if (empty($fields)) return false;
346 346
 	
347 347
 		
348 348
 	// remove corrupt fields
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
 	
351 351
 	
352 352
 	// loop through fields
353
-	foreach( $fields as $field ) {
353
+	foreach ($fields as $field) {
354 354
 		
355 355
 		// load value
356
-		if( $field['value'] === null ) {
356
+		if ($field['value'] === null) {
357 357
 			
358
-			$field['value'] = acf_get_value( $post_id, $field );
358
+			$field['value'] = acf_get_value($post_id, $field);
359 359
 			
360 360
 		} 
361 361
 		
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 		
366 366
 		
367 367
 		// render
368
-		acf_render_field_wrap( $field, $el, $instruction );
368
+		acf_render_field_wrap($field, $el, $instruction);
369 369
 		
370 370
 	}
371 371
 	
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 *  @return	n/a
386 386
 */
387 387
 
388
-function acf_render_field( $field = false ) {
388
+function acf_render_field($field = false) {
389 389
 	
390 390
 	// get valid field
391
-	$field = acf_get_valid_field( $field );
391
+	$field = acf_get_valid_field($field);
392 392
 	
393 393
 	
394 394
 	// prepare field for input
395
-	$field = acf_prepare_field( $field );
395
+	$field = acf_prepare_field($field);
396 396
 	
397 397
 	
398 398
 	// update $field['name']
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 		
401 401
 	
402 402
 	// create field specific html
403
-	do_action( "acf/render_field", $field );
404
-	do_action( "acf/render_field/type={$field['type']}", $field );
403
+	do_action("acf/render_field", $field);
404
+	do_action("acf/render_field/type={$field['type']}", $field);
405 405
 	
406 406
 }
407 407
 
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 *  @return	N/A
423 423
 */
424 424
 
425
-function acf_render_field_wrap( $field, $el = 'div', $instruction = 'label' ) {
425
+function acf_render_field_wrap($field, $el = 'div', $instruction = 'label') {
426 426
 	
427 427
 	// get valid field
428
-	$field = acf_get_valid_field( $field );
428
+	$field = acf_get_valid_field($field);
429 429
 	
430 430
 	
431 431
 	// prepare field for input
432
-	$field = acf_prepare_field( $field );
432
+	$field = acf_prepare_field($field);
433 433
 	
434 434
 	
435 435
 	// el
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	
445 445
 	
446 446
 	// validate $el
447
-	if( !array_key_exists($el, $elements) ) {
447
+	if ( ! array_key_exists($el, $elements)) {
448 448
 		
449 449
 		$el = 'div';
450 450
 	
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	
465 465
 	
466 466
 	// add required
467
-	if( $field['required'] ) {
467
+	if ($field['required']) {
468 468
 		
469 469
 		$wrapper['data-required'] = 1;
470 470
 		
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 	
477 477
 	
478 478
 	// add key
479
-	if( $field['key'] ) {
479
+	if ($field['key']) {
480 480
 		
481 481
 		$wrapper['class'] .= " acf-field-{$field['key']}";
482 482
 		$wrapper['data-key'] = $field['key'];
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	
491 491
 	
492 492
 	// wrap classes have changed (5.2.7)
493
-	if( acf_get_compatibility('field_wrapper_class') ) {
493
+	if (acf_get_compatibility('field_wrapper_class')) {
494 494
 		
495 495
 		$wrapper['class'] .= " field_type-{$field['type']}";
496 496
 		
497
-		if( $field['key'] ) {
497
+		if ($field['key']) {
498 498
 			
499 499
 			$wrapper['class'] .= " field_key-{$field['key']}";
500 500
 			
@@ -504,17 +504,17 @@  discard block
 block discarded – undo
504 504
 	
505 505
 	
506 506
 	// merge in atts
507
-	$wrapper = acf_merge_atts( $wrapper, $field['wrapper'] );
507
+	$wrapper = acf_merge_atts($wrapper, $field['wrapper']);
508 508
 	
509 509
 	
510 510
 	// add width
511
-	$width = (int) acf_extract_var( $wrapper, 'width' );
511
+	$width = (int) acf_extract_var($wrapper, 'width');
512 512
 	
513
-	if( $el == 'tr' || $el == 'td' ) {
513
+	if ($el == 'tr' || $el == 'td') {
514 514
 		
515 515
 		$width = 0;
516 516
 		
517
-	} elseif( $width > 0 && $width < 100 ) {
517
+	} elseif ($width > 0 && $width < 100) {
518 518
 		
519 519
 		$wrapper['data-width'] = $width;
520 520
 		$wrapper['style'] .= " width:{$width}%;";
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 	
524 524
 	
525 525
 	// remove empty attributes
526
-	foreach( $wrapper as $k => $v ) {
526
+	foreach ($wrapper as $k => $v) {
527 527
 		
528
-		if( $v == '' ) {
528
+		if ($v == '') {
529 529
 			
530 530
 			unset($wrapper[$k]);
531 531
 			
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	// vars
538 538
 	$show_label = true;
539 539
 	
540
-	if( $el == 'td' ) {
540
+	if ($el == 'td') {
541 541
 		
542 542
 		$show_label = false;
543 543
 		
@@ -545,22 +545,22 @@  discard block
 block discarded – undo
545 545
 	
546 546
 	
547 547
 ?><<?php echo $el; ?> <?php echo acf_esc_attr($wrapper); ?>>
548
-<?php if( $show_label ): ?>
549
-	<<?php echo $elements[ $el ]; ?> class="acf-label">
548
+<?php if ($show_label): ?>
549
+	<<?php echo $elements[$el]; ?> class="acf-label">
550 550
 		<label for="<?php echo $field['id']; ?>"><?php echo acf_get_field_label($field); ?></label>
551
-<?php if( $instruction == 'label' && $field['instructions'] ): ?>
551
+<?php if ($instruction == 'label' && $field['instructions']): ?>
552 552
 		<p class="description"><?php echo $field['instructions']; ?></p>
553 553
 <?php endif; ?>
554
-	</<?php echo $elements[ $el ]; ?>>
554
+	</<?php echo $elements[$el]; ?>>
555 555
 <?php endif; ?>
556
-	<<?php echo $elements[ $el ]; ?> class="acf-input">
557
-		<?php acf_render_field( $field ); ?>
556
+	<<?php echo $elements[$el]; ?> class="acf-input">
557
+		<?php acf_render_field($field); ?>
558 558
 		
559
-<?php if( $instruction == 'field' && $field['instructions'] ): ?>
559
+<?php if ($instruction == 'field' && $field['instructions']): ?>
560 560
 		<p class="description"><?php echo $field['instructions']; ?></p>
561 561
 <?php endif; ?>
562
-	</<?php echo $elements[ $el ]; ?>>
563
-<?php if( !empty($field['conditional_logic'])): ?>
562
+	</<?php echo $elements[$el]; ?>>
563
+<?php if ( ! empty($field['conditional_logic'])): ?>
564 564
 	<script type="text/javascript">
565 565
 		if(typeof acf !== 'undefined'){ acf.conditional_logic.add( '<?php echo $field['key']; ?>', <?php echo json_encode($field['conditional_logic']); ?>); }
566 566
 	</script>
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 *  @return	n/a
586 586
 */
587 587
 
588
-function acf_render_field_setting( $field, $setting, $global = false ) {
588
+function acf_render_field_setting($field, $setting, $global = false) {
589 589
 	
590 590
 	// validate
591
-	$setting = acf_get_valid_field( $setting );
591
+	$setting = acf_get_valid_field($setting);
592 592
 	
593 593
 	
594 594
 	// if this setting is not global, add a data attribute
595
-	if( !$global ) {
595
+	if ( ! $global) {
596 596
 		
597 597
 		$setting['wrapper']['data-setting'] = $field['type'];
598 598
 		
@@ -604,15 +604,15 @@  discard block
 block discarded – undo
604 604
 		
605 605
 		
606 606
 	// copy across the $setting value
607
-	if( isset($field[ $setting['name'] ]) ) {
607
+	if (isset($field[$setting['name']])) {
608 608
 		
609
-		$setting['value'] = $field[ $setting['name'] ];
609
+		$setting['value'] = $field[$setting['name']];
610 610
 		
611 611
 	}
612 612
 	
613 613
 	
614 614
 	// render
615
-	acf_render_field_wrap( $setting, 'tr', 'label' );
615
+	acf_render_field_wrap($setting, 'tr', 'label');
616 616
 	
617 617
 }
618 618
 
@@ -630,18 +630,18 @@  discard block
 block discarded – undo
630 630
 *  @return	(array)
631 631
 */
632 632
 
633
-function acf_get_fields( $parent = false ) {
633
+function acf_get_fields($parent = false) {
634 634
 	
635 635
 	// allow $parent to be a field group ID
636
-	if( !is_array($parent) ) {
636
+	if ( ! is_array($parent)) {
637 637
 		
638
-		$parent = acf_get_field_group( $parent );
638
+		$parent = acf_get_field_group($parent);
639 639
 	
640 640
 	}
641 641
 	
642 642
 	
643 643
 	// bail early if no parent
644
-	if( !$parent ) return false;
644
+	if ( ! $parent) return false;
645 645
 	
646 646
 	
647 647
 	// vars
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
 	
650 650
 	
651 651
 	// try JSON before DB to save query time
652
-	if( acf_have_local_fields( $parent['key'] ) ) {
652
+	if (acf_have_local_fields($parent['key'])) {
653 653
 		
654
-		$fields = acf_get_local_fields( $parent['key'] );
654
+		$fields = acf_get_local_fields($parent['key']);
655 655
 		
656 656
 	} else {
657 657
 		
658
-		$fields = acf_get_fields_by_id( $parent['ID'] );
658
+		$fields = acf_get_fields_by_id($parent['ID']);
659 659
 	
660 660
 	}
661 661
 	
@@ -679,21 +679,21 @@  discard block
 block discarded – undo
679 679
 *  @return	$fields (array)
680 680
 */
681 681
 
682
-function acf_get_fields_by_id( $id = 0 ) {
682
+function acf_get_fields_by_id($id = 0) {
683 683
 	
684 684
 	// vars
685 685
 	$fields = array();
686 686
 	
687 687
 	
688 688
 	// bail early if no ID
689
-	if( empty($id) ) return false;
689
+	if (empty($id)) return false;
690 690
 	
691 691
 	
692 692
 	// cache
693 693
 	$found = false;
694
-	$cache = wp_cache_get( 'get_fields/parent=' . $id, 'acf', false, $found );
694
+	$cache = wp_cache_get('get_fields/parent='.$id, 'acf', false, $found);
695 695
 	
696
-	if( $found ) return $cache;
696
+	if ($found) return $cache;
697 697
 	
698 698
 	
699 699
 	// args
@@ -710,13 +710,13 @@  discard block
 block discarded – undo
710 710
 		
711 711
 	
712 712
 	// load fields
713
-	$posts = get_posts( $args );
713
+	$posts = get_posts($args);
714 714
 	
715
-	if( $posts ) {
715
+	if ($posts) {
716 716
 		
717
-		foreach( $posts as $post ) {
717
+		foreach ($posts as $post) {
718 718
 			
719
-			$fields[] = acf_get_field( $post->ID );
719
+			$fields[] = acf_get_field($post->ID);
720 720
 			
721 721
 		}
722 722
 			
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	
725 725
 	
726 726
 	// set cache
727
-	wp_cache_set( 'get_fields/parent=' . $id, $fields, 'acf' );
727
+	wp_cache_set('get_fields/parent='.$id, $fields, 'acf');
728 728
 		
729 729
 	
730 730
 	// return
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 *  @return	$field (array)
748 748
 */
749 749
 
750
-function acf_get_field( $selector = null, $db_only = false ) {
750
+function acf_get_field($selector = null, $db_only = false) {
751 751
 	
752 752
 	// vars
753 753
 	$field = false;
@@ -755,17 +755,17 @@  discard block
 block discarded – undo
755 755
 	
756 756
 	
757 757
 	// is $selector an ID
758
-	if( is_numeric($selector) ) {
758
+	if (is_numeric($selector)) {
759 759
 		
760 760
 		// do nothing
761 761
 	
762 762
 	// is $selector a string (name|key)	
763
-	} elseif( is_string($selector) ) {
763
+	} elseif (is_string($selector)) {
764 764
 		
765 765
 		$type = acf_is_field_key($selector) ? 'key' : 'name';
766 766
 	
767 767
 	// is $selector an object
768
-	} elseif( is_object($selector) ) {
768
+	} elseif (is_object($selector)) {
769 769
 		
770 770
 		$selector = $selector->ID;
771 771
 	
@@ -782,34 +782,34 @@  discard block
 block discarded – undo
782 782
 	
783 783
 	
784 784
 	// get cache
785
-	if( !$db_only ) {
785
+	if ( ! $db_only) {
786 786
 		
787 787
 		$found = false;
788
-		$cache = wp_cache_get( $cache_key, 'acf', false, $found );
788
+		$cache = wp_cache_get($cache_key, 'acf', false, $found);
789 789
 		
790
-		if( $found ) return $cache;
790
+		if ($found) return $cache;
791 791
 		
792 792
 	}
793 793
 	
794 794
 	
795 795
 	// get field group from ID or key
796
-	if( $type == 'ID' ) {
796
+	if ($type == 'ID') {
797 797
 		
798
-		$field = _acf_get_field_by_id( $selector, $db_only );
798
+		$field = _acf_get_field_by_id($selector, $db_only);
799 799
 		
800
-	} elseif( $type == 'name' ) {
800
+	} elseif ($type == 'name') {
801 801
 		
802
-		$field = _acf_get_field_by_name( $selector, $db_only );
802
+		$field = _acf_get_field_by_name($selector, $db_only);
803 803
 		
804 804
 	} else {
805 805
 		
806
-		$field = _acf_get_field_by_key( $selector, $db_only );
806
+		$field = _acf_get_field_by_key($selector, $db_only);
807 807
 		
808 808
 	}
809 809
 	
810 810
 	
811 811
 	// bail early if db only value (no need to update cache)
812
-	if( $db_only ) {
812
+	if ($db_only) {
813 813
 		
814 814
 		return $field;
815 815
 		
@@ -817,18 +817,18 @@  discard block
 block discarded – undo
817 817
 	
818 818
 	
819 819
 	// filter for 3rd party customization
820
-	if( $field ) {
820
+	if ($field) {
821 821
 		
822
-		$field = apply_filters( "acf/load_field", $field);
823
-		$field = apply_filters( "acf/load_field/type={$field['type']}", $field );
824
-		$field = apply_filters( "acf/load_field/name={$field['name']}", $field );
825
-		$field = apply_filters( "acf/load_field/key={$field['key']}", $field );
822
+		$field = apply_filters("acf/load_field", $field);
823
+		$field = apply_filters("acf/load_field/type={$field['type']}", $field);
824
+		$field = apply_filters("acf/load_field/name={$field['name']}", $field);
825
+		$field = apply_filters("acf/load_field/key={$field['key']}", $field);
826 826
 		
827 827
 	}
828 828
 	
829 829
 	
830 830
 	// set cache
831
-	wp_cache_set( $cache_key, $field, 'acf' );
831
+	wp_cache_set($cache_key, $field, 'acf');
832 832
 
833 833
 	
834 834
 	// return
@@ -850,14 +850,14 @@  discard block
 block discarded – undo
850 850
 *  @return	$field (array)
851 851
 */
852 852
 
853
-function _acf_get_field_by_id( $post_id = 0, $db_only = false ) {
853
+function _acf_get_field_by_id($post_id = 0, $db_only = false) {
854 854
 	
855 855
 	// get post
856
-	$post = get_post( $post_id );
856
+	$post = get_post($post_id);
857 857
 	
858 858
 	
859 859
 	// bail early if no post, or is not a field
860
-	if( empty($post) || $post->post_type != 'acf-field' ) {
860
+	if (empty($post) || $post->post_type != 'acf-field') {
861 861
 	
862 862
 		return false;
863 863
 		
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 	
866 866
 	
867 867
 	// unserialize
868
-	$field = maybe_unserialize( $post->post_content );
868
+	$field = maybe_unserialize($post->post_content);
869 869
 	
870 870
 	
871 871
 	// update attributes
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 
879 879
 
880 880
 	// override with JSON
881
-	if( !$db_only && acf_is_local_field($field['key']) ) {
881
+	if ( ! $db_only && acf_is_local_field($field['key'])) {
882 882
 		
883 883
 		// extract some args
884 884
 		$backup = acf_extract_vars($field, array(
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 		
889 889
 
890 890
 		// load JSON field
891
-		$field = acf_get_local_field( $field['key'] );
891
+		$field = acf_get_local_field($field['key']);
892 892
 		
893 893
 		
894 894
 		// merge in backup
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 	
899 899
 	
900 900
 	// validate
901
-	$field = acf_get_valid_field( $field );
901
+	$field = acf_get_valid_field($field);
902 902
 	
903 903
 	
904 904
 	// return
@@ -920,15 +920,15 @@  discard block
 block discarded – undo
920 920
 *  @return	$field (array)
921 921
 */
922 922
 
923
-function _acf_get_field_by_key( $key = '', $db_only = false ) {
923
+function _acf_get_field_by_key($key = '', $db_only = false) {
924 924
 	
925 925
 	// try JSON before DB to save query time
926
-	if( !$db_only && acf_is_local_field( $key ) ) {
926
+	if ( ! $db_only && acf_is_local_field($key)) {
927 927
 		
928
-		$field = acf_get_local_field( $key );
928
+		$field = acf_get_local_field($key);
929 929
 		
930 930
 		// validate
931
-		$field = acf_get_valid_field( $field );
931
+		$field = acf_get_valid_field($field);
932 932
 	
933 933
 		// return
934 934
 		return $field;
@@ -937,15 +937,15 @@  discard block
 block discarded – undo
937 937
 	
938 938
 	
939 939
 	// vars
940
-	$post_id = acf_get_field_id( $key );
940
+	$post_id = acf_get_field_id($key);
941 941
 	
942 942
 	
943 943
 	// bail early if no post_id
944
-	if( !$post_id ) return false;
944
+	if ( ! $post_id) return false;
945 945
 		
946 946
 	
947 947
 	// return
948
-	return _acf_get_field_by_id( $post_id, $db_only );
948
+	return _acf_get_field_by_id($post_id, $db_only);
949 949
 	
950 950
 }
951 951
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 *  @return	$field (array)
964 964
 */
965 965
 
966
-function _acf_get_field_by_name( $name = '', $db_only = false ) {
966
+function _acf_get_field_by_name($name = '', $db_only = false) {
967 967
 	
968 968
 	// vars
969 969
 	$args = array(
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
 	
978 978
 	
979 979
 	// load posts
980
-	$posts = get_posts( $args );
980
+	$posts = get_posts($args);
981 981
 	
982 982
 	
983 983
 	// bail early if no posts
984
-	if( empty($posts) ) return false;
984
+	if (empty($posts)) return false;
985 985
 	
986 986
 	
987 987
 	// return
988
-	return _acf_get_field_by_id( $posts[0]->ID, $db_only );
988
+	return _acf_get_field_by_id($posts[0]->ID, $db_only);
989 989
 	
990 990
 }
991 991
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 *  @return	$field (array)
1007 1007
 */
1008 1008
 
1009
-function acf_maybe_get_field( $selector, $post_id = false, $strict = true ) {
1009
+function acf_maybe_get_field($selector, $post_id = false, $strict = true) {
1010 1010
 	
1011 1011
 	// complete init
1012 1012
 	// this function may be used in a theme file before the init action has been run
@@ -1018,25 +1018,25 @@  discard block
 block discarded – undo
1018 1018
 	
1019 1019
 	
1020 1020
 	// get valid post_id
1021
-	$post_id = acf_get_valid_post_id( $post_id );
1021
+	$post_id = acf_get_valid_post_id($post_id);
1022 1022
 	
1023 1023
 	
1024 1024
 	// load field reference if not a field_key
1025
-	if( !acf_is_field_key($selector) ) {
1025
+	if ( ! acf_is_field_key($selector)) {
1026 1026
 		
1027 1027
 		// save selector as field_name (could be sub field name)
1028 1028
 		$field_name = $selector;
1029 1029
 			
1030 1030
 			
1031 1031
 		// get reference
1032
-		$field_key = acf_get_field_reference( $selector, $post_id );
1032
+		$field_key = acf_get_field_reference($selector, $post_id);
1033 1033
 		
1034 1034
 		
1035
-		if( $field_key ) {
1035
+		if ($field_key) {
1036 1036
 			
1037 1037
 			$selector = $field_key;
1038 1038
 			
1039
-		} elseif( $strict ) {
1039
+		} elseif ($strict) {
1040 1040
 			
1041 1041
 			return false;
1042 1042
 			
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
 	
1047 1047
 	
1048 1048
 	// get field key
1049
-	$field = acf_get_field( $selector );
1049
+	$field = acf_get_field($selector);
1050 1050
 	
1051 1051
 	
1052 1052
 	// bail early if no field
1053
-	if( !$field ) return false;
1053
+	if ( ! $field) return false;
1054 1054
 	
1055 1055
 	
1056 1056
 	// Override name - allows the $selector to be a sub field (images_0_image)
1057
-	if( $field_name ) {
1057
+	if ($field_name) {
1058 1058
 	
1059 1059
 		$field['name'] = $field_name;	
1060 1060
 		
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 *  @return	$post_id (int)
1082 1082
 */
1083 1083
 
1084
-function acf_get_field_id( $key = '' ) {
1084
+function acf_get_field_id($key = '') {
1085 1085
 	
1086 1086
 	// vars
1087 1087
 	$args = array(
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 	
1096 1096
 	
1097 1097
 	// load posts
1098
-	$posts = get_posts( $args );
1098
+	$posts = get_posts($args);
1099 1099
 	
1100 1100
 	
1101 1101
 	// validate
1102
-	if( empty($posts) ) return 0;
1102
+	if (empty($posts)) return 0;
1103 1103
 	
1104 1104
 	
1105 1105
 	// return
@@ -1122,25 +1122,25 @@  discard block
 block discarded – undo
1122 1122
 *  @return	$field (array)
1123 1123
 */
1124 1124
 
1125
-function acf_update_field( $field = false, $specific = false ) {
1125
+function acf_update_field($field = false, $specific = false) {
1126 1126
 	
1127 1127
 	// $field must be an array
1128
-	if( !is_array($field) ) return false;
1128
+	if ( ! is_array($field)) return false;
1129 1129
 	
1130 1130
 	
1131 1131
 	// validate
1132
-	$field = acf_get_valid_field( $field );
1132
+	$field = acf_get_valid_field($field);
1133 1133
 	
1134 1134
 	
1135 1135
 	// may have been posted. Remove slashes
1136
-	$field = wp_unslash( $field );
1136
+	$field = wp_unslash($field);
1137 1137
 	
1138 1138
 	
1139 1139
 	// clean up conditional logic keys
1140
-	if( !empty($field['conditional_logic']) ) {
1140
+	if ( ! empty($field['conditional_logic'])) {
1141 1141
 		
1142 1142
 		// extract groups
1143
-		$groups = acf_extract_var( $field, 'conditional_logic' );
1143
+		$groups = acf_extract_var($field, 'conditional_logic');
1144 1144
 		
1145 1145
 		
1146 1146
 		// clean array
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
 		
1150 1150
 		
1151 1151
 		// clean rules
1152
-		foreach( array_keys($groups) as $i ) {
1152
+		foreach (array_keys($groups) as $i) {
1153 1153
 			
1154
-			$groups[ $i ] = array_filter($groups[ $i ]);
1155
-			$groups[ $i ] = array_values($groups[ $i ]);
1154
+			$groups[$i] = array_filter($groups[$i]);
1155
+			$groups[$i] = array_values($groups[$i]);
1156 1156
 			
1157 1157
 		}
1158 1158
 		
@@ -1164,23 +1164,23 @@  discard block
 block discarded – undo
1164 1164
 	
1165 1165
 	
1166 1166
 	// find correct parent
1167
-	if( acf_is_field_key($field['parent']) ) {
1167
+	if (acf_is_field_key($field['parent'])) {
1168 1168
 		
1169 1169
 		// get parent
1170
-		$parent = acf_get_field( $field['parent'] );
1170
+		$parent = acf_get_field($field['parent']);
1171 1171
 		
1172 1172
 
1173 1173
 		// update to ID
1174
-		$field['parent'] = acf_maybe_get( $parent, 'ID', 0 );
1174
+		$field['parent'] = acf_maybe_get($parent, 'ID', 0);
1175 1175
 		
1176 1176
 	}
1177 1177
 	
1178 1178
 	
1179 1179
 	// filter for 3rd party customization
1180
-	$field = apply_filters( "acf/update_field", $field);
1181
-	$field = apply_filters( "acf/update_field/type={$field['type']}", $field );
1182
-	$field = apply_filters( "acf/update_field/name={$field['name']}", $field );
1183
-	$field = apply_filters( "acf/update_field/key={$field['key']}", $field );
1180
+	$field = apply_filters("acf/update_field", $field);
1181
+	$field = apply_filters("acf/update_field/type={$field['type']}", $field);
1182
+	$field = apply_filters("acf/update_field/name={$field['name']}", $field);
1183
+	$field = apply_filters("acf/update_field/key={$field['key']}", $field);
1184 1184
 	
1185 1185
 	
1186 1186
 	// store origional field for return
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 	
1207 1207
 	
1208 1208
 	// serialize for DB
1209
-	$data = maybe_serialize( $data );
1209
+	$data = maybe_serialize($data);
1210 1210
     
1211 1211
     
1212 1212
     // save
@@ -1224,10 +1224,10 @@  discard block
 block discarded – undo
1224 1224
     
1225 1225
     
1226 1226
     // $specific
1227
-    if( !empty($specific) ) {
1227
+    if ( ! empty($specific)) {
1228 1228
 	    
1229 1229
 	    // prepend ID
1230
-    	array_unshift( $specific, 'ID' );
1230
+    	array_unshift($specific, 'ID');
1231 1231
     	
1232 1232
     	
1233 1233
 	    // vars
@@ -1239,9 +1239,9 @@  discard block
 block discarded – undo
1239 1239
 	    
1240 1240
     	
1241 1241
     	// appen data
1242
-    	foreach( $specific as $key ) {
1242
+    	foreach ($specific as $key) {
1243 1243
 	    	
1244
-	    	$save[ $key ] = $_save[ $key ];
1244
+	    	$save[$key] = $_save[$key];
1245 1245
 	    	
1246 1246
     	}
1247 1247
     	
@@ -1249,25 +1249,25 @@  discard block
 block discarded – undo
1249 1249
     
1250 1250
     
1251 1251
     // allow fields to contain the same name
1252
-	add_filter( 'wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 100, 6 ); 
1252
+	add_filter('wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 100, 6); 
1253 1253
 	
1254 1254
 	
1255 1255
     // update the field and update the ID
1256
-    if( $field['ID'] ) {
1256
+    if ($field['ID']) {
1257 1257
 	    
1258
-	    wp_update_post( $save );
1258
+	    wp_update_post($save);
1259 1259
 	    
1260
-    } else  {
1260
+    } else {
1261 1261
 	    
1262
-	    $field['ID'] = wp_insert_post( $save );
1262
+	    $field['ID'] = wp_insert_post($save);
1263 1263
 	    
1264 1264
     }
1265 1265
 	
1266 1266
     
1267 1267
     // clear cache
1268
-	wp_cache_delete( "get_field/ID={$field['ID']}", 'acf' );
1269
-	wp_cache_delete( "get_field/key={$field['key']}", 'acf' );
1270
-	wp_cache_delete( "get_fields/parent={$field['parent']}", 'acf' );
1268
+	wp_cache_delete("get_field/ID={$field['ID']}", 'acf');
1269
+	wp_cache_delete("get_field/key={$field['key']}", 'acf');
1270
+	wp_cache_delete("get_fields/parent={$field['parent']}", 'acf');
1271 1271
 	
1272 1272
 	
1273 1273
     // return
@@ -1275,9 +1275,9 @@  discard block
 block discarded – undo
1275 1275
 	
1276 1276
 }
1277 1277
 
1278
-function acf_update_field_wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
1278
+function acf_update_field_wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
1279 1279
 		
1280
-	if( $post_type == 'acf-field' ) {
1280
+	if ($post_type == 'acf-field') {
1281 1281
 	
1282 1282
 		$slug = $original_slug;
1283 1283
 	
@@ -1303,28 +1303,28 @@  discard block
 block discarded – undo
1303 1303
 *  @return	n/a
1304 1304
 */
1305 1305
 
1306
-function acf_duplicate_fields( $fields, $new_parent = 0 ) {
1306
+function acf_duplicate_fields($fields, $new_parent = 0) {
1307 1307
 	
1308 1308
 	// bail early if no fields
1309
-	if( empty($fields) ) return;
1309
+	if (empty($fields)) return;
1310 1310
 	
1311 1311
 	
1312 1312
 	// create new field keys (for conditional logic fixes)
1313
-	foreach( $fields as $field ) {
1313
+	foreach ($fields as $field) {
1314 1314
 		
1315 1315
 		// ensure a delay for unique ID
1316 1316
 		usleep(1);
1317 1317
 		
1318
-		acf_update_setting( 'duplicate_key_' . $field['key'] , uniqid('field_') );
1318
+		acf_update_setting('duplicate_key_'.$field['key'], uniqid('field_'));
1319 1319
 		
1320 1320
 	}
1321 1321
 	
1322 1322
 	
1323 1323
 	// duplicate fields
1324
-	foreach( $fields as $field ) {
1324
+	foreach ($fields as $field) {
1325 1325
 	
1326 1326
 		// duplicate
1327
-		acf_duplicate_field( $field['ID'], $new_parent );
1327
+		acf_duplicate_field($field['ID'], $new_parent);
1328 1328
 		
1329 1329
 	}
1330 1330
 	
@@ -1345,18 +1345,18 @@  discard block
 block discarded – undo
1345 1345
 *  @return	$field (array) the new field
1346 1346
 */
1347 1347
 
1348
-function acf_duplicate_field( $selector = 0, $new_parent = 0 ){
1348
+function acf_duplicate_field($selector = 0, $new_parent = 0) {
1349 1349
 	
1350 1350
 	// disable JSON to avoid conflicts between DB and JSON
1351 1351
 	acf_disable_local();
1352 1352
 	
1353 1353
 	
1354 1354
 	// load the origional field
1355
-	$field = acf_get_field( $selector );
1355
+	$field = acf_get_field($selector);
1356 1356
 	
1357 1357
 	
1358 1358
 	// bail early if field did not load correctly
1359
-	if( empty($field) ) {
1359
+	if (empty($field)) {
1360 1360
 	
1361 1361
 		return false;
1362 1362
 		
@@ -1368,11 +1368,11 @@  discard block
 block discarded – undo
1368 1368
 	
1369 1369
 	
1370 1370
 	// try duplicate keys
1371
-	$field['key'] = acf_get_setting( 'duplicate_key_' . $field['key'] );
1371
+	$field['key'] = acf_get_setting('duplicate_key_'.$field['key']);
1372 1372
 	
1373 1373
 	
1374 1374
 	// default key
1375
-	if( empty($field['key']) ) {
1375
+	if (empty($field['key'])) {
1376 1376
 		
1377 1377
 		$field['key'] = uniqid('field_');
1378 1378
 			
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 	
1381 1381
 	
1382 1382
 	// update parent
1383
-	if( $new_parent ) {
1383
+	if ($new_parent) {
1384 1384
 	
1385 1385
 		$field['parent'] = $new_parent;
1386 1386
 		
@@ -1388,21 +1388,21 @@  discard block
 block discarded – undo
1388 1388
 	
1389 1389
 	
1390 1390
 	// update conditional logic references (because field keys have changed)
1391
-	if( !empty($field['conditional_logic']) ) {
1391
+	if ( ! empty($field['conditional_logic'])) {
1392 1392
 	
1393 1393
 		// extract groups
1394
-		$groups = acf_extract_var( $field, 'conditional_logic' );
1394
+		$groups = acf_extract_var($field, 'conditional_logic');
1395 1395
 		
1396 1396
 		
1397 1397
 		// loop over groups
1398
-		foreach( array_keys($groups) as $g ) {
1398
+		foreach (array_keys($groups) as $g) {
1399 1399
 			
1400 1400
 			// extract group
1401
-			$group = acf_extract_var( $groups, $g );
1401
+			$group = acf_extract_var($groups, $g);
1402 1402
 			
1403 1403
 			
1404 1404
 			// bail early if empty
1405
-			if( empty($group) ) {
1405
+			if (empty($group)) {
1406 1406
 				
1407 1407
 				continue;
1408 1408
 				
@@ -1410,18 +1410,18 @@  discard block
 block discarded – undo
1410 1410
 			
1411 1411
 			
1412 1412
 			// loop over rules
1413
-			foreach( array_keys($group) as $r ) {
1413
+			foreach (array_keys($group) as $r) {
1414 1414
 				
1415 1415
 				// extract rule
1416
-				$rule = acf_extract_var( $group, $r );
1416
+				$rule = acf_extract_var($group, $r);
1417 1417
 				
1418 1418
 				
1419 1419
 				// vars
1420
-				$new_key = acf_get_setting( 'duplicate_key_' . $rule['field'] );
1420
+				$new_key = acf_get_setting('duplicate_key_'.$rule['field']);
1421 1421
 				
1422 1422
 				
1423 1423
 				// update rule with new key
1424
-				if( $new_key ) {
1424
+				if ($new_key) {
1425 1425
 					
1426 1426
 					$rule['field'] = $new_key;
1427 1427
 					
@@ -1429,13 +1429,13 @@  discard block
 block discarded – undo
1429 1429
 				
1430 1430
 				
1431 1431
 				// append to group
1432
-				$group[ $r ] = $rule;
1432
+				$group[$r] = $rule;
1433 1433
 				
1434 1434
 			}
1435 1435
 			
1436 1436
 			
1437 1437
 			// append to groups
1438
-			$groups[ $g ] = $group;
1438
+			$groups[$g] = $group;
1439 1439
 			
1440 1440
 		}
1441 1441
 		
@@ -1448,12 +1448,12 @@  discard block
 block discarded – undo
1448 1448
 	
1449 1449
 	
1450 1450
 	// filter for 3rd party customization
1451
-	$field = apply_filters( "acf/duplicate_field", $field);
1452
-	$field = apply_filters( "acf/duplicate_field/type={$field['type']}", $field );
1451
+	$field = apply_filters("acf/duplicate_field", $field);
1452
+	$field = apply_filters("acf/duplicate_field/type={$field['type']}", $field);
1453 1453
 	
1454 1454
 	
1455 1455
 	// save
1456
-	return acf_update_field( $field );
1456
+	return acf_update_field($field);
1457 1457
 	
1458 1458
 }
1459 1459
 
@@ -1471,33 +1471,33 @@  discard block
 block discarded – undo
1471 1471
 *  @return	(boolean)
1472 1472
 */
1473 1473
 
1474
-function acf_delete_field( $selector = 0 ) {
1474
+function acf_delete_field($selector = 0) {
1475 1475
 	
1476 1476
 	// disable JSON to avoid conflicts between DB and JSON
1477 1477
 	acf_disable_local();
1478 1478
 	
1479 1479
 	
1480 1480
 	// load the origional field gorup
1481
-	$field = acf_get_field( $selector );
1481
+	$field = acf_get_field($selector);
1482 1482
 	
1483 1483
 	
1484 1484
 	// bail early if field did not load correctly
1485
-	if( empty($field) ) return false;
1485
+	if (empty($field)) return false;
1486 1486
 	
1487 1487
 	
1488 1488
 	// delete field
1489
-	wp_delete_post( $field['ID'], true );
1489
+	wp_delete_post($field['ID'], true);
1490 1490
 	
1491 1491
 	
1492 1492
 	// action for 3rd party customisation
1493
-	do_action( "acf/delete_field", $field);
1494
-	do_action( "acf/delete_field/type={$field['type']}", $field );
1493
+	do_action("acf/delete_field", $field);
1494
+	do_action("acf/delete_field/type={$field['type']}", $field);
1495 1495
 	
1496 1496
 	
1497 1497
 	// clear cache
1498
-	wp_cache_delete( "get_field/ID={$field['ID']}", 'acf' );
1499
-	wp_cache_delete( "get_field/key={$field['key']}", 'acf' );
1500
-	wp_cache_delete( "get_fields/parent={$field['parent']}", 'acf' );
1498
+	wp_cache_delete("get_field/ID={$field['ID']}", 'acf');
1499
+	wp_cache_delete("get_field/key={$field['key']}", 'acf');
1500
+	wp_cache_delete("get_fields/parent={$field['parent']}", 'acf');
1501 1501
 	
1502 1502
 	
1503 1503
 	// return
@@ -1518,26 +1518,26 @@  discard block
 block discarded – undo
1518 1518
 *  @return	(boolean)
1519 1519
 */
1520 1520
 
1521
-function acf_trash_field( $selector = 0 ) {
1521
+function acf_trash_field($selector = 0) {
1522 1522
 	
1523 1523
 	// disable JSON to avoid conflicts between DB and JSON
1524 1524
 	acf_disable_local();
1525 1525
 	
1526 1526
 	
1527 1527
 	// load the origional field gorup
1528
-	$field = acf_get_field( $selector );
1528
+	$field = acf_get_field($selector);
1529 1529
 	
1530 1530
 	
1531 1531
 	// bail early if field did not load correctly
1532
-	if( empty($field) ) return false;
1532
+	if (empty($field)) return false;
1533 1533
 	
1534 1534
 	
1535 1535
 	// delete field
1536
-	wp_trash_post( $field['ID'] );
1536
+	wp_trash_post($field['ID']);
1537 1537
 	
1538 1538
 	
1539 1539
 	// action for 3rd party customisation
1540
-	do_action( 'acf/trash_field', $field );
1540
+	do_action('acf/trash_field', $field);
1541 1541
 	
1542 1542
 	
1543 1543
 	// return
@@ -1558,26 +1558,26 @@  discard block
 block discarded – undo
1558 1558
 *  @return	(boolean)
1559 1559
 */
1560 1560
 
1561
-function acf_untrash_field( $selector = 0 ) {
1561
+function acf_untrash_field($selector = 0) {
1562 1562
 	
1563 1563
 	// disable JSON to avoid conflicts between DB and JSON
1564 1564
 	acf_disable_local();
1565 1565
 	
1566 1566
 	
1567 1567
 	// load the origional field gorup
1568
-	$field = acf_get_field( $selector );
1568
+	$field = acf_get_field($selector);
1569 1569
 	
1570 1570
 	
1571 1571
 	// bail early if field did not load correctly
1572
-	if( empty($field) ) return false;
1572
+	if (empty($field)) return false;
1573 1573
 	
1574 1574
 	
1575 1575
 	// delete field
1576
-	wp_untrash_post( $field['ID'] );
1576
+	wp_untrash_post($field['ID']);
1577 1577
 	
1578 1578
 	
1579 1579
 	// action for 3rd party customisation
1580
-	do_action( 'acf/untrash_field', $field );
1580
+	do_action('acf/untrash_field', $field);
1581 1581
 	
1582 1582
 	
1583 1583
 	// return
@@ -1598,17 +1598,17 @@  discard block
 block discarded – undo
1598 1598
 *  @return	$post_id (int)
1599 1599
 */
1600 1600
 
1601
-function acf_prepare_fields_for_export( $fields = false ) {
1601
+function acf_prepare_fields_for_export($fields = false) {
1602 1602
 	
1603 1603
 	// validate
1604
-	if( empty($fields) ) return $fields;
1604
+	if (empty($fields)) return $fields;
1605 1605
 	
1606 1606
 	
1607 1607
 	// format
1608
-	foreach( array_keys($fields) as $i ) {
1608
+	foreach (array_keys($fields) as $i) {
1609 1609
 		
1610 1610
 		// prepare
1611
-		$fields[ $i ] = acf_prepare_field_for_export( $fields[ $i ] );
1611
+		$fields[$i] = acf_prepare_field_for_export($fields[$i]);
1612 1612
 				
1613 1613
 	}
1614 1614
 	
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 *  @return	$post_id (int)
1633 1633
 */
1634 1634
 
1635
-function acf_prepare_field_for_export( $field ) {
1635
+function acf_prepare_field_for_export($field) {
1636 1636
 	
1637 1637
 	// extract some args
1638 1638
 	$extract = acf_extract_vars($field, array(
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 	
1651 1651
 	
1652 1652
 	// filter for 3rd party customization
1653
-	$field = apply_filters( "acf/prepare_field_for_export", $field );
1653
+	$field = apply_filters("acf/prepare_field_for_export", $field);
1654 1654
 	
1655 1655
 	
1656 1656
 	// return
@@ -1671,10 +1671,10 @@  discard block
 block discarded – undo
1671 1671
 *  @return	$post_id (int)
1672 1672
 */
1673 1673
 
1674
-function acf_prepare_fields_for_import( $fields = false ) {
1674
+function acf_prepare_fields_for_import($fields = false) {
1675 1675
 	
1676 1676
 	// validate
1677
-	if( empty($fields) ) return $fields;
1677
+	if (empty($fields)) return $fields;
1678 1678
 	
1679 1679
 	
1680 1680
 	// re-index array
@@ -1686,14 +1686,14 @@  discard block
 block discarded – undo
1686 1686
 	
1687 1687
 	
1688 1688
 	// format
1689
-	while( $i < count($fields) ) {
1689
+	while ($i < count($fields)) {
1690 1690
 		
1691 1691
 		// prepare field
1692
-		$field = acf_prepare_field_for_import( $fields[ $i ] );
1692
+		$field = acf_prepare_field_for_import($fields[$i]);
1693 1693
 		
1694 1694
 		
1695 1695
 		// $field may be an array of multiple fields (including sub fields)
1696
-		if( !isset($field['key']) ) {
1696
+		if ( ! isset($field['key'])) {
1697 1697
 			
1698 1698
 			$extra = $field;
1699 1699
 			
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		}
1704 1704
 		
1705 1705
 		// prepare
1706
-		$fields[ $i ] = $field;
1706
+		$fields[$i] = $field;
1707 1707
 		
1708 1708
 		
1709 1709
 		// $i
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 *  @return	$post_id (int)
1735 1735
 */
1736 1736
 
1737
-function acf_prepare_field_for_import( $field ) {
1737
+function acf_prepare_field_for_import($field) {
1738 1738
 	
1739 1739
 	// extract some args
1740 1740
 	$extract = acf_extract_vars($field, array(
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 	
1749 1749
 	
1750 1750
 	// filter for 3rd party customization
1751
-	$field = apply_filters( "acf/prepare_field_for_import", $field );
1751
+	$field = apply_filters("acf/prepare_field_for_import", $field);
1752 1752
 	
1753 1753
 	
1754 1754
 	// return
@@ -1770,19 +1770,19 @@  discard block
 block discarded – undo
1770 1770
 *  @return	$field (array)
1771 1771
 */
1772 1772
 
1773
-function acf_get_sub_field( $selector, $field ) {
1773
+function acf_get_sub_field($selector, $field) {
1774 1774
 	
1775 1775
 	// sub fields
1776
-	if( $field['type'] == 'repeater' ) {
1776
+	if ($field['type'] == 'repeater') {
1777 1777
 		
1778 1778
 		// extract sub fields
1779
-		$sub_fields = acf_extract_var( $field, 'sub_fields');
1779
+		$sub_fields = acf_extract_var($field, 'sub_fields');
1780 1780
 		
1781
-		if( !empty($sub_fields) ) {
1781
+		if ( ! empty($sub_fields)) {
1782 1782
 		
1783
-			foreach( $sub_fields as $sub_field ) {
1783
+			foreach ($sub_fields as $sub_field) {
1784 1784
 				
1785
-				if( $sub_field['name'] == $selector || $sub_field['key'] == $selector ) {
1785
+				if ($sub_field['name'] == $selector || $sub_field['key'] == $selector) {
1786 1786
 					
1787 1787
 					// return
1788 1788
 					return $sub_field;
@@ -1796,19 +1796,19 @@  discard block
 block discarded – undo
1796 1796
 		}
1797 1797
 		// if
1798 1798
 		
1799
-	} elseif( $field['type'] == 'flexible_content' ) {
1799
+	} elseif ($field['type'] == 'flexible_content') {
1800 1800
 		
1801 1801
 		// vars
1802
-		$layouts = acf_extract_var( $field, 'layouts');
1802
+		$layouts = acf_extract_var($field, 'layouts');
1803 1803
 		$current = get_row_layout();
1804 1804
 		
1805 1805
 		
1806
-		if( !empty($layouts) ) {
1806
+		if ( ! empty($layouts)) {
1807 1807
 			
1808
-			foreach( $layouts as $layout ) {
1808
+			foreach ($layouts as $layout) {
1809 1809
 				
1810 1810
 				// skip layout if the current layout key does not match
1811
-				if( $current && $current !== $layout['name'] ) {
1811
+				if ($current && $current !== $layout['name']) {
1812 1812
 					
1813 1813
 					continue;
1814 1814
 					
@@ -1816,13 +1816,13 @@  discard block
 block discarded – undo
1816 1816
 				
1817 1817
 				
1818 1818
 				// extract sub fields
1819
-				$sub_fields = acf_extract_var( $layout, 'sub_fields');
1819
+				$sub_fields = acf_extract_var($layout, 'sub_fields');
1820 1820
 				
1821
-				if( !empty($sub_fields) ) {
1821
+				if ( ! empty($sub_fields)) {
1822 1822
 					
1823
-					foreach( $sub_fields as $sub_field ) {
1823
+					foreach ($sub_fields as $sub_field) {
1824 1824
 						
1825
-						if( $sub_field['name'] == $selector || $sub_field['key'] == $selector ) {
1825
+						if ($sub_field['name'] == $selector || $sub_field['key'] == $selector) {
1826 1826
 							
1827 1827
 							// return
1828 1828
 							return $sub_field;
Please login to merge, or discard this patch.
Braces   +78 added lines, -26 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/acf/api/api-helpers.php 4 patches
Doc Comments   +34 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@  discard block
 block discarded – undo
13 13
 *  @return	(mixed)
14 14
 */
15 15
 
16
+/**
17
+ * @param string $name
18
+ */
16 19
 function acf_get_setting( $name, $default = null ) {
17 20
 	
18 21
 	// vars
@@ -46,6 +49,9 @@  discard block
 block discarded – undo
46 49
 *  @return	(boolean)
47 50
 */
48 51
 
52
+/**
53
+ * @param string $name
54
+ */
49 55
 function acf_get_compatibility( $name ) {
50 56
 	
51 57
 	return apply_filters( "acf/compatibility/{$name}", false );
@@ -67,6 +73,9 @@  discard block
 block discarded – undo
67 73
 *  @return	n/a
68 74
 */
69 75
 
76
+/**
77
+ * @param string $name
78
+ */
70 79
 function acf_update_setting( $name, $value ) {
71 80
 	
72 81
 	acf()->settings[ $name ] = $value;
@@ -88,6 +97,10 @@  discard block
 block discarded – undo
88 97
 *  @return	n/a
89 98
 */
90 99
 
100
+/**
101
+ * @param string $name
102
+ * @param string $value
103
+ */
91 104
 function acf_append_setting( $name, $value ) {
92 105
 	
93 106
 	// createa array if needed
@@ -116,6 +129,9 @@  discard block
 block discarded – undo
116 129
 *  @return	(boolean)
117 130
 */
118 131
 
132
+/**
133
+ * @param string $name
134
+ */
119 135
 function acf_has_done( $name ) {
120 136
 	
121 137
 	// vars
@@ -189,6 +205,9 @@  discard block
 block discarded – undo
189 205
 *  @return	$post_id (int)
190 206
 */
191 207
 
208
+/**
209
+ * @param string $file
210
+ */
192 211
 function acf_include( $file ) {
193 212
 	
194 213
 	$path = acf_get_path( $file );
@@ -523,6 +542,9 @@  discard block
 block discarded – undo
523 542
 *  @return	(mixed)
524 543
 */
525 544
 
545
+/**
546
+ * @param string $default
547
+ */
526 548
 function acf_extract_var( &$array, $key, $default = null ) {
527 549
 	
528 550
 	// check if exists
@@ -560,6 +582,9 @@  discard block
 block discarded – undo
560 582
 *  @return	$post_id (int)
561 583
 */
562 584
 
585
+/**
586
+ * @param string[] $keys
587
+ */
563 588
 function acf_extract_vars( &$array, $keys ) {
564 589
 	
565 590
 	$r = array();
@@ -713,6 +738,9 @@  discard block
 block discarded – undo
713 738
 *  @return	(boolean)
714 739
 */
715 740
 
741
+/**
742
+ * @param string $value
743
+ */
716 744
 function acf_verify_nonce( $value, $post_id = 0 ) {
717 745
 	
718 746
 	// vars
@@ -1903,6 +1931,9 @@  discard block
 block discarded – undo
1903 1931
 *  @return	(boolean)
1904 1932
 */
1905 1933
 
1934
+/**
1935
+ * @param string $needle
1936
+ */
1906 1937
 function acf_str_exists( $needle, $haystack ) {
1907 1938
 	
1908 1939
 	// return true if $haystack contains the $needle
@@ -2376,6 +2407,9 @@  discard block
 block discarded – undo
2376 2407
 *  @return	$post_id (int)
2377 2408
 */
2378 2409
 
2410
+/**
2411
+ * @return string
2412
+ */
2379 2413
 function acf_get_user_setting( $name = '', $default = false ) {
2380 2414
 	
2381 2415
 	// get current user id
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 	}
1476 1476
 	
1477 1477
     
1478
-    // get bits
1478
+	// get bits
1479 1479
 	$glue = 'AND';
1480 1480
 	$bits = explode($glue, $sql);
1481 1481
 	
@@ -1496,8 +1496,8 @@  discard block
 block discarded – undo
1496 1496
 	$sql = implode($glue, $bits);
1497 1497
     
1498 1498
     
1499
-    // return
1500
-    return $sql;
1499
+	// return
1500
+	return $sql;
1501 1501
     
1502 1502
 }
1503 1503
 
@@ -1831,60 +1831,60 @@  discard block
 block discarded – undo
1831 1831
 	
1832 1832
 	
1833 1833
 	// http://snipplr.com/view.php?codeview&id=60559
1834
-    $result      = '';
1835
-    $pos         = 0;
1836
-    $strLen      = strlen($json);
1837
-    $indentStr   = "    ";
1838
-    $newLine     = "\n";
1839
-    $prevChar    = '';
1840
-    $outOfQuotes = true;
1841
-
1842
-    for ($i=0; $i<=$strLen; $i++) {
1843
-
1844
-        // Grab the next character in the string.
1845
-        $char = substr($json, $i, 1);
1846
-
1847
-        // Are we inside a quoted string?
1848
-        if ($char == '"' && $prevChar != '\\') {
1849
-            $outOfQuotes = !$outOfQuotes;
1834
+	$result      = '';
1835
+	$pos         = 0;
1836
+	$strLen      = strlen($json);
1837
+	$indentStr   = "    ";
1838
+	$newLine     = "\n";
1839
+	$prevChar    = '';
1840
+	$outOfQuotes = true;
1841
+
1842
+	for ($i=0; $i<=$strLen; $i++) {
1843
+
1844
+		// Grab the next character in the string.
1845
+		$char = substr($json, $i, 1);
1846
+
1847
+		// Are we inside a quoted string?
1848
+		if ($char == '"' && $prevChar != '\\') {
1849
+			$outOfQuotes = !$outOfQuotes;
1850 1850
         
1851
-        // If this character is the end of an element, 
1852
-        // output a new line and indent the next line.
1853
-        } else if(($char == '}' || $char == ']') && $outOfQuotes) {
1854
-            $result .= $newLine;
1855
-            $pos --;
1856
-            for ($j=0; $j<$pos; $j++) {
1857
-                $result .= $indentStr;
1858
-            }
1859
-        }
1851
+		// If this character is the end of an element, 
1852
+		// output a new line and indent the next line.
1853
+		} else if(($char == '}' || $char == ']') && $outOfQuotes) {
1854
+			$result .= $newLine;
1855
+			$pos --;
1856
+			for ($j=0; $j<$pos; $j++) {
1857
+				$result .= $indentStr;
1858
+			}
1859
+		}
1860 1860
         
1861
-        // Add the character to the result string.
1862
-        $result .= $char;
1861
+		// Add the character to the result string.
1862
+		$result .= $char;
1863 1863
 		
1864 1864
 		// If this character is ':' adda space after it
1865
-        if($char == ':' && $outOfQuotes) {
1866
-            $result .= ' ';
1867
-        }
1865
+		if($char == ':' && $outOfQuotes) {
1866
+			$result .= ' ';
1867
+		}
1868 1868
         
1869
-        // If the last character was the beginning of an element, 
1870
-        // output a new line and indent the next line.
1871
-        if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
1872
-            $result .= $newLine;
1873
-            if ($char == '{' || $char == '[') {
1874
-                $pos ++;
1875
-            }
1869
+		// If the last character was the beginning of an element, 
1870
+		// output a new line and indent the next line.
1871
+		if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
1872
+			$result .= $newLine;
1873
+			if ($char == '{' || $char == '[') {
1874
+				$pos ++;
1875
+			}
1876 1876
             
1877
-            for ($j = 0; $j < $pos; $j++) {
1878
-                $result .= $indentStr;
1879
-            }
1880
-        }
1877
+			for ($j = 0; $j < $pos; $j++) {
1878
+				$result .= $indentStr;
1879
+			}
1880
+		}
1881 1881
         
1882
-        $prevChar = $char;
1883
-    }
1882
+		$prevChar = $char;
1883
+	}
1884 1884
 	
1885 1885
 	
1886 1886
 	// return
1887
-    return $result;
1887
+	return $result;
1888 1888
 	
1889 1889
 }
1890 1890
 
@@ -2035,21 +2035,21 @@  discard block
 block discarded – undo
2035 2035
 	
2036 2036
 	$dir = opendir( $path );
2037 2037
 
2038
-    while(false !== ( $file = readdir($dir)) ) {
2038
+	while(false !== ( $file = readdir($dir)) ) {
2039 2039
     
2040
-    	// only php files
2041
-    	if( substr($file, -4) !== '.php' ) {
2040
+		// only php files
2041
+		if( substr($file, -4) !== '.php' ) {
2042 2042
     	
2043
-	    	continue;
2043
+			continue;
2044 2044
 	    	
2045
-    	}
2045
+		}
2046 2046
     	
2047 2047
     	
2048
-    	// get version number
2049
-    	$update_version = substr($file, 0, -4);
2048
+		// get version number
2049
+		$update_version = substr($file, 0, -4);
2050 2050
     	
2051 2051
     	
2052
-    	// ignore if update is for a future version. May exist for testing
2052
+		// ignore if update is for a future version. May exist for testing
2053 2053
 		if( version_compare( $update_version, $plugin_version, '>') ) {
2054 2054
 		
2055 2055
 			continue;
@@ -2064,14 +2064,14 @@  discard block
 block discarded – undo
2064 2064
 		}
2065 2065
 		
2066 2066
 		
2067
-    	// append
2068
-        $updates[] = $update_version;
2067
+		// append
2068
+		$updates[] = $update_version;
2069 2069
         
2070
-    }
2070
+	}
2071 2071
     
2072 2072
     
2073
-    // return
2074
-    return $updates;
2073
+	// return
2074
+	return $updates;
2075 2075
 	
2076 2076
 }
2077 2077
 
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
 		
2995 2995
 		if( $pos !== false ) {
2996 2996
 			
2997
-		    $url = substr_replace($url, '', $pos, $length);
2997
+			$url = substr_replace($url, '', $pos, $length);
2998 2998
 		    
2999 2999
 		}
3000 3000
 				
@@ -3592,8 +3592,8 @@  discard block
 block discarded – undo
3592 3592
 function _acf_settings_slug( $v ) {
3593 3593
 	
3594 3594
 	$basename = acf_get_setting('basename');
3595
-    $slug = explode('/', $basename);
3596
-    $slug = current($slug);
3595
+	$slug = explode('/', $basename);
3596
+	$slug = current($slug);
3597 3597
 	
3598 3598
 	return $slug;
3599 3599
 }
Please login to merge, or discard this patch.
Spacing   +448 added lines, -448 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 *  @return	(mixed)
14 14
 */
15 15
 
16
-function acf_get_setting( $name, $default = null ) {
16
+function acf_get_setting($name, $default = null) {
17 17
 	
18 18
 	// vars
19 19
 	$settings = acf()->settings;
20 20
 	
21 21
 	
22 22
 	// find setting
23
-	$setting = acf_maybe_get( $settings, $name, $default );
23
+	$setting = acf_maybe_get($settings, $name, $default);
24 24
 	
25 25
 	
26 26
 	// filter for 3rd party customization
27
-	$setting = apply_filters( "acf/settings/{$name}", $setting );
27
+	$setting = apply_filters("acf/settings/{$name}", $setting);
28 28
 	
29 29
 	
30 30
 	// return
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 *  @return	(boolean)
47 47
 */
48 48
 
49
-function acf_get_compatibility( $name ) {
49
+function acf_get_compatibility($name) {
50 50
 	
51
-	return apply_filters( "acf/compatibility/{$name}", false );
51
+	return apply_filters("acf/compatibility/{$name}", false);
52 52
 	
53 53
 }
54 54
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 *  @return	n/a
68 68
 */
69 69
 
70
-function acf_update_setting( $name, $value ) {
70
+function acf_update_setting($name, $value) {
71 71
 	
72
-	acf()->settings[ $name ] = $value;
72
+	acf()->settings[$name] = $value;
73 73
 	
74 74
 }
75 75
 
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 *  @return	n/a
89 89
 */
90 90
 
91
-function acf_append_setting( $name, $value ) {
91
+function acf_append_setting($name, $value) {
92 92
 	
93 93
 	// createa array if needed
94
-	if( !isset(acf()->settings[ $name ]) ) {
94
+	if ( ! isset(acf()->settings[$name])) {
95 95
 		
96
-		acf()->settings[ $name ] = array();
96
+		acf()->settings[$name] = array();
97 97
 		
98 98
 	}
99 99
 	
100 100
 	
101 101
 	// append to array
102
-	acf()->settings[ $name ][] = $value;
102
+	acf()->settings[$name][] = $value;
103 103
 }
104 104
 
105 105
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 *  @return	(boolean)
117 117
 */
118 118
 
119
-function acf_has_done( $name ) {
119
+function acf_has_done($name) {
120 120
 	
121 121
 	// vars
122
-	$setting = 'has_done_' . $name;
122
+	$setting = 'has_done_'.$name;
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)) return true;
127 127
 	
128 128
 	
129 129
 	// update setting
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 *  @return	(string)
150 150
 */
151 151
 
152
-function acf_get_path( $path ) {
152
+function acf_get_path($path) {
153 153
 	
154
-	return acf_get_setting('path') . $path;
154
+	return acf_get_setting('path').$path;
155 155
 	
156 156
 }
157 157
 
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 *  @return	(string)
170 170
 */
171 171
 
172
-function acf_get_dir( $path ) {
172
+function acf_get_dir($path) {
173 173
 	
174
-	return acf_get_setting('dir') . $path;
174
+	return acf_get_setting('dir').$path;
175 175
 	
176 176
 }
177 177
 
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 *  @return	$post_id (int)
190 190
 */
191 191
 
192
-function acf_include( $file ) {
192
+function acf_include($file) {
193 193
 	
194
-	$path = acf_get_path( $file );
194
+	$path = acf_get_path($file);
195 195
 	
196
-	if( file_exists($path) ) {
196
+	if (file_exists($path)) {
197 197
 		
198
-		include_once( $path );
198
+		include_once($path);
199 199
 		
200 200
 	}
201 201
 	
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 *  @return	$args (array)
217 217
 */
218 218
 
219
-function acf_parse_args( $args, $defaults = array() ) {
219
+function acf_parse_args($args, $defaults = array()) {
220 220
 	
221 221
 	// $args may not be na array!
222
-	if( !is_array($args) ) {
222
+	if ( ! is_array($args)) {
223 223
 		
224 224
 		$args = array();
225 225
 		
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	
228 228
 	
229 229
 	// parse args
230
-	$args = wp_parse_args( $args, $defaults );
230
+	$args = wp_parse_args($args, $defaults);
231 231
 	
232 232
 	
233 233
 	// parse types
234
-	$args = acf_parse_types( $args );
234
+	$args = acf_parse_types($args);
235 235
 	
236 236
 	
237 237
 	// return
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 *  @return	$var (mixed)
254 254
 */
255 255
 
256
-function acf_parse_types( $array ) {
256
+function acf_parse_types($array) {
257 257
 	
258 258
 	// some keys are restricted
259 259
 	$restricted = array(
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 	
267 267
 	
268 268
 	// loop
269
-	foreach( array_keys($array) as $k ) {
269
+	foreach (array_keys($array) as $k) {
270 270
 		
271 271
 		// parse type if not restricted
272
-		if( !in_array($k, $restricted, true) ) {
272
+		if ( ! in_array($k, $restricted, true)) {
273 273
 			
274
-			$array[ $k ] = acf_parse_type( $array[ $k ] );
274
+			$array[$k] = acf_parse_type($array[$k]);
275 275
 			
276 276
 		}
277 277
 
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
 *  @return	$post_id (int)
296 296
 */
297 297
 
298
-function acf_parse_type( $v ) {
298
+function acf_parse_type($v) {
299 299
 	
300 300
 	// test for array
301
-	if( is_array($v) ) {
301
+	if (is_array($v)) {
302 302
 		
303 303
 		return acf_parse_types($v);
304 304
 	}
305 305
 	
306 306
 	
307 307
 	// bail early if not string
308
-	if( !is_string($v) ) {
308
+	if ( ! is_string($v)) {
309 309
 		
310 310
 		return $v;
311 311
 				
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	
318 318
 	
319 319
 	// numbers
320
-	if( is_numeric($v) && strval((int)$v) === $v ) {
320
+	if (is_numeric($v) && strval((int) $v) === $v) {
321 321
 		
322
-		$v = intval( $v );
322
+		$v = intval($v);
323 323
 		
324 324
 	}
325 325
 	
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 *  @return	n/a
345 345
 */
346 346
 
347
-function acf_get_view( $view_name = '', $args = array() ) {
347
+function acf_get_view($view_name = '', $args = array()) {
348 348
 
349 349
 	// vars
350 350
 	$path = acf_get_path("admin/views/{$view_name}.php");
351 351
 	
352
-	if( file_exists($path) ) {
352
+	if (file_exists($path)) {
353 353
 		
354
-		include( $path );
354
+		include($path);
355 355
 		
356 356
 	}
357 357
 	
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 *  @return	$post_id (int)
372 372
 */
373 373
 
374
-function acf_merge_atts( $atts, $extra = array() ) {
374
+function acf_merge_atts($atts, $extra = array()) {
375 375
 	
376 376
 	// bail ealry if no $extra
377
-	if( empty($extra) ) {
377
+	if (empty($extra)) {
378 378
 		
379 379
 		return $atts;
380 380
 		
@@ -382,21 +382,21 @@  discard block
 block discarded – undo
382 382
 	
383 383
 	
384 384
 	// merge in new atts
385
-	foreach( $extra as $k => $v ) {
385
+	foreach ($extra as $k => $v) {
386 386
 			
387
-		if( $k == 'class' || $k == 'style' ) {
387
+		if ($k == 'class' || $k == 'style') {
388 388
 			
389
-			if( $v === '' ) {
389
+			if ($v === '') {
390 390
 				
391 391
 				continue;
392 392
 				
393 393
 			}
394 394
 			
395
-			$v = $atts[ $k ] . ' ' . $v;
395
+			$v = $atts[$k].' '.$v;
396 396
 			
397 397
 		}
398 398
 		
399
-		$atts[ $k ] = $v;
399
+		$atts[$k] = $v;
400 400
 		
401 401
 	}
402 402
 	
@@ -420,19 +420,19 @@  discard block
 block discarded – undo
420 420
 *  @return	n/a
421 421
 */
422 422
 
423
-function acf_esc_attr( $atts ) {
423
+function acf_esc_attr($atts) {
424 424
 	
425 425
 	// is string?
426
-	if( is_string($atts) ) {
426
+	if (is_string($atts)) {
427 427
 		
428
-		$atts = trim( $atts );
429
-		return esc_attr( $atts );
428
+		$atts = trim($atts);
429
+		return esc_attr($atts);
430 430
 		
431 431
 	}
432 432
 	
433 433
 	
434 434
 	// validate
435
-	if( empty($atts) ) {
435
+	if (empty($atts)) {
436 436
 		
437 437
 		return '';
438 438
 		
@@ -444,20 +444,20 @@  discard block
 block discarded – undo
444 444
 	
445 445
 	
446 446
 	// loop through and render
447
-	foreach( $atts as $k => $v ) {
447
+	foreach ($atts as $k => $v) {
448 448
 		
449 449
 		// object
450
-		if( is_array($v) || is_object($v) ) {
450
+		if (is_array($v) || is_object($v)) {
451 451
 			
452 452
 			$v = json_encode($v);
453 453
 		
454 454
 		// boolean	
455
-		} elseif( is_bool($v) ) {
455
+		} elseif (is_bool($v)) {
456 456
 			
457 457
 			$v = $v ? 1 : 0;
458 458
 		
459 459
 		// string
460
-		} elseif( is_string($v) ) {
460
+		} elseif (is_string($v)) {
461 461
 			
462 462
 			$v = trim($v);
463 463
 			
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		
466 466
 		
467 467
 		// append
468
-		$e[] = $k . '="' . esc_attr( $v ) . '"';
468
+		$e[] = $k.'="'.esc_attr($v).'"';
469 469
 	}
470 470
 	
471 471
 	
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	
475 475
 }
476 476
 
477
-function acf_esc_attr_e( $atts ) {
477
+function acf_esc_attr_e($atts) {
478 478
 	
479
-	echo acf_esc_attr( $atts );
479
+	echo acf_esc_attr($atts);
480 480
 	
481 481
 }
482 482
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 *  @return	$post_id (int)
495 495
 */
496 496
 
497
-function acf_get_hidden_input( $atts ) {
497
+function acf_get_hidden_input($atts) {
498 498
 	
499 499
 	$atts['type'] = 'hidden';
500 500
 	
501
-	return '<input ' . acf_esc_attr( $atts ) . ' />';
501
+	return '<input '.acf_esc_attr($atts).' />';
502 502
 	
503 503
 }
504 504
 
505
-function acf_hidden_input( $atts ) {
505
+function acf_hidden_input($atts) {
506 506
 	
507
-	echo acf_get_hidden_input( $atts );
507
+	echo acf_get_hidden_input($atts);
508 508
 	
509 509
 }
510 510
 
@@ -523,17 +523,17 @@  discard block
 block discarded – undo
523 523
 *  @return	(mixed)
524 524
 */
525 525
 
526
-function acf_extract_var( &$array, $key, $default = null ) {
526
+function acf_extract_var(&$array, $key, $default = null) {
527 527
 	
528 528
 	// check if exists
529
-	if( is_array($array) && array_key_exists($key, $array) ) {
529
+	if (is_array($array) && array_key_exists($key, $array)) {
530 530
 		
531 531
 		// store value
532
-		$v = $array[ $key ];
532
+		$v = $array[$key];
533 533
 		
534 534
 		
535 535
 		// unset
536
-		unset( $array[ $key ] );
536
+		unset($array[$key]);
537 537
 		
538 538
 		
539 539
 		// return
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
 *  @return	$post_id (int)
561 561
 */
562 562
 
563
-function acf_extract_vars( &$array, $keys ) {
563
+function acf_extract_vars(&$array, $keys) {
564 564
 	
565 565
 	$r = array();
566 566
 	
567
-	foreach( $keys as $key ) {
567
+	foreach ($keys as $key) {
568 568
 		
569
-		$r[ $key ] = acf_extract_var( $array, $key );
569
+		$r[$key] = acf_extract_var($array, $key);
570 570
 		
571 571
 	}
572 572
 	
@@ -588,26 +588,26 @@  discard block
 block discarded – undo
588 588
 *  @return	(array)
589 589
 */
590 590
 
591
-function acf_get_post_types( $exclude = array(), $include = array() ) {
591
+function acf_get_post_types($exclude = array(), $include = array()) {
592 592
 	
593 593
 	// get all custom post types
594 594
 	$post_types = get_post_types();
595 595
 	
596 596
 	
597 597
 	// core exclude
598
-	$exclude = wp_parse_args( $exclude, array('acf-field', 'acf-field-group', 'revision', 'nav_menu_item') );
598
+	$exclude = wp_parse_args($exclude, array('acf-field', 'acf-field-group', 'revision', 'nav_menu_item'));
599 599
 	
600 600
 	
601 601
 	// include
602
-	if( !empty($include) ) {
602
+	if ( ! empty($include)) {
603 603
 		
604
-		foreach( array_keys($include) as $i ) {
604
+		foreach (array_keys($include) as $i) {
605 605
 			
606
-			$post_type = $include[ $i ];
606
+			$post_type = $include[$i];
607 607
 			
608
-			if( post_type_exists($post_type) ) {	
608
+			if (post_type_exists($post_type)) {	
609 609
 									
610
-				$post_types[ $post_type ] = $post_type;
610
+				$post_types[$post_type] = $post_type;
611 611
 				
612 612
 			}
613 613
 			
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
 	
618 618
 	
619 619
 	// exclude
620
-	foreach( array_values($exclude) as $i ) {
620
+	foreach (array_values($exclude) as $i) {
621 621
 		
622
-		unset( $post_types[ $i ] );
622
+		unset($post_types[$i]);
623 623
 		
624 624
 	}
625 625
 	
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 }
635 635
 
636 636
 
637
-function acf_get_pretty_post_types( $post_types = array() ) {
637
+function acf_get_pretty_post_types($post_types = array()) {
638 638
 	
639 639
 	// get post types
640
-	if( empty($post_types) ) {
640
+	if (empty($post_types)) {
641 641
 		
642 642
 		// get all custom post types
643 643
 		$post_types = acf_get_post_types();
@@ -649,14 +649,14 @@  discard block
 block discarded – undo
649 649
 	$ref = array();
650 650
 	$r = array();
651 651
 	
652
-	foreach( $post_types as $post_type ) {
652
+	foreach ($post_types as $post_type) {
653 653
 		
654 654
 		// vars
655 655
 		$label = $post_type;
656 656
 		
657 657
 		
658 658
 		// check that object exists (case exists when importing field group from another install and post type does not exist)
659
-		if( post_type_exists($post_type) ) {
659
+		if (post_type_exists($post_type)) {
660 660
 			
661 661
 			$obj = get_post_type_object($post_type);
662 662
 			$label = $obj->labels->singular_name;
@@ -665,29 +665,29 @@  discard block
 block discarded – undo
665 665
 		
666 666
 		
667 667
 		// append to r
668
-		$r[ $post_type ] = $label;
668
+		$r[$post_type] = $label;
669 669
 		
670 670
 		
671 671
 		// increase counter
672
-		if( !isset($ref[ $label ]) ) {
672
+		if ( ! isset($ref[$label])) {
673 673
 			
674
-			$ref[ $label ] = 0;
674
+			$ref[$label] = 0;
675 675
 			
676 676
 		}
677 677
 		
678
-		$ref[ $label ]++;
678
+		$ref[$label]++;
679 679
 	}
680 680
 	
681 681
 	
682 682
 	// get slugs
683
-	foreach( array_keys($r) as $i ) {
683
+	foreach (array_keys($r) as $i) {
684 684
 		
685 685
 		// vars
686
-		$post_type = $r[ $i ];
686
+		$post_type = $r[$i];
687 687
 		
688
-		if( $ref[ $post_type ] > 1 ) {
688
+		if ($ref[$post_type] > 1) {
689 689
 			
690
-			$r[ $i ] .= ' (' . $i . ')';
690
+			$r[$i] .= ' ('.$i.')';
691 691
 			
692 692
 		}
693 693
 		
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 *  @return	(boolean)
714 714
 */
715 715
 
716
-function acf_verify_nonce( $value, $post_id = 0 ) {
716
+function acf_verify_nonce($value, $post_id = 0) {
717 717
 	
718 718
 	// vars
719
-	$nonce = acf_maybe_get( $_POST, '_acfnonce' );
719
+	$nonce = acf_maybe_get($_POST, '_acfnonce');
720 720
 	
721 721
 	
722 722
 	// bail early if no nonce or if nonce does not match (post|user|comment|term)
723
-	if( !$nonce || !wp_verify_nonce($nonce, $value) ) {
723
+	if ( ! $nonce || ! wp_verify_nonce($nonce, $value)) {
724 724
 		
725 725
 		return false;
726 726
 		
@@ -728,25 +728,25 @@  discard block
 block discarded – undo
728 728
 	
729 729
 	
730 730
 	// if saving specific post
731
-	if( $post_id ) {
731
+	if ($post_id) {
732 732
 		
733 733
 		// vars
734
-		$form_post_id = (int) acf_maybe_get( $_POST, 'post_ID' );
735
-		$post_parent = wp_is_post_revision( $post_id );
734
+		$form_post_id = (int) acf_maybe_get($_POST, 'post_ID');
735
+		$post_parent = wp_is_post_revision($post_id);
736 736
 		
737 737
 			
738 738
 		// 1. no $_POST['post_id'] (shopp plugin)
739
-		if( !$form_post_id ) {
739
+		if ( ! $form_post_id) {
740 740
 			
741 741
 			// do nothing (don't remove this if statement!)
742 742
 			
743 743
 		// 2. direct match (this is the post we were editing)
744
-		} elseif( $post_id === $form_post_id ) {
744
+		} elseif ($post_id === $form_post_id) {
745 745
 			
746 746
 			// do nothing (don't remove this if statement!)
747 747
 			
748 748
 		// 3. revision (this post is a revision of the post we were editing)
749
-		} elseif( $post_parent === $form_post_id ) {
749
+		} elseif ($post_parent === $form_post_id) {
750 750
 			
751 751
 			// return true early and prevent $_POST['_acfnonce'] from being reset
752 752
 			// this will allow another save_post to save the real post
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 function acf_verify_ajax() {
792 792
 	
793 793
 	// bail early if not acf action
794
-	if( empty($_POST['action']) || substr($_POST['action'], 0, 3) !== 'acf' ) {
794
+	if (empty($_POST['action']) || substr($_POST['action'], 0, 3) !== 'acf') {
795 795
 		
796 796
 		return false;
797 797
 		
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	
800 800
 	
801 801
 	// bail early if not acf nonce
802
-	if( empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'acf_nonce') ) {
802
+	if (empty($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'acf_nonce')) {
803 803
 	
804 804
 		return false;
805 805
 		
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 *  @return	(int) message ID (array position)
831 831
 */
832 832
 
833
-function acf_add_admin_notice( $text, $class = '', $wrap = 'p' )
833
+function acf_add_admin_notice($text, $class = '', $wrap = 'p')
834 834
 {
835 835
 	// vars
836 836
 	$admin_notices = acf_get_admin_notices();
@@ -845,11 +845,11 @@  discard block
 block discarded – undo
845 845
 	
846 846
 	
847 847
 	// update
848
-	acf_update_setting( 'admin_notices', $admin_notices );
848
+	acf_update_setting('admin_notices', $admin_notices);
849 849
 	
850 850
 	
851 851
 	// return
852
-	return ( count( $admin_notices ) - 1 );
852
+	return (count($admin_notices) - 1);
853 853
 	
854 854
 }
855 855
 
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 function acf_get_admin_notices()
871 871
 {
872 872
 	// vars
873
-	$admin_notices = acf_get_setting( 'admin_notices' );
873
+	$admin_notices = acf_get_setting('admin_notices');
874 874
 	
875 875
 	
876 876
 	// validate
877
-	if( !$admin_notices )
877
+	if ( ! $admin_notices)
878 878
 	{
879 879
 		$admin_notices = array();
880 880
 	}
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 	
907 907
 	// vars
908 908
 	$sizes = array(
909
-		'thumbnail'	=>	__("Thumbnail",'acf'),
910
-		'medium'	=>	__("Medium",'acf'),
911
-		'large'		=>	__("Large",'acf')
909
+		'thumbnail'	=>	__("Thumbnail", 'acf'),
910
+		'medium'	=>	__("Medium", 'acf'),
911
+		'large'		=>	__("Large", 'acf')
912 912
 	);
913 913
 	
914 914
 	
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 	
918 918
 	
919 919
 	// add extra registered sizes
920
-	if( !empty($all_sizes) ) {
920
+	if ( ! empty($all_sizes)) {
921 921
 		
922
-		foreach( $all_sizes as $size ) {
922
+		foreach ($all_sizes as $size) {
923 923
 			
924 924
 			// bail early if already in array
925
-			if( isset($sizes[ $size ]) ) {
925
+			if (isset($sizes[$size])) {
926 926
 			
927 927
 				continue;
928 928
 				
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
 			
932 932
 			// append to array
933 933
 			$label = str_replace('-', ' ', $size);
934
-			$label = ucwords( $label );
935
-			$sizes[ $size ] = $label;
934
+			$label = ucwords($label);
935
+			$sizes[$size] = $label;
936 936
 			
937 937
 		}
938 938
 		
@@ -940,15 +940,15 @@  discard block
 block discarded – undo
940 940
 	
941 941
 	
942 942
 	// add sizes
943
-	foreach( array_keys($sizes) as $s ) {
943
+	foreach (array_keys($sizes) as $s) {
944 944
 		
945 945
 		// vars
946
-		$w = isset($_wp_additional_image_sizes[$s]['width']) ? $_wp_additional_image_sizes[$s]['width'] : get_option( "{$s}_size_w" );
947
-		$h = isset($_wp_additional_image_sizes[$s]['height']) ? $_wp_additional_image_sizes[$s]['height'] : get_option( "{$s}_size_h" );
946
+		$w = isset($_wp_additional_image_sizes[$s]['width']) ? $_wp_additional_image_sizes[$s]['width'] : get_option("{$s}_size_w");
947
+		$h = isset($_wp_additional_image_sizes[$s]['height']) ? $_wp_additional_image_sizes[$s]['height'] : get_option("{$s}_size_h");
948 948
 		
949
-		if( $w && $h ) {
949
+		if ($w && $h) {
950 950
 			
951
-			$sizes[ $s ] .= " ({$w} x {$h})";
951
+			$sizes[$s] .= " ({$w} x {$h})";
952 952
 			
953 953
 		}
954 954
 		
@@ -956,11 +956,11 @@  discard block
 block discarded – undo
956 956
 	
957 957
 	
958 958
 	// add full end
959
-	$sizes['full'] = __("Full Size",'acf');
959
+	$sizes['full'] = __("Full Size", 'acf');
960 960
 	
961 961
 	
962 962
 	// filter for 3rd party customization
963
-	$sizes = apply_filters( 'acf/get_image_sizes', $sizes );
963
+	$sizes = apply_filters('acf/get_image_sizes', $sizes);
964 964
 	
965 965
 	
966 966
 	// return
@@ -985,21 +985,21 @@  discard block
 block discarded – undo
985 985
 function acf_get_taxonomies() {
986 986
 
987 987
 	// get all taxonomies
988
-	$taxonomies = get_taxonomies( false, 'objects' );
989
-	$ignore = array( 'nav_menu', 'link_category' );
988
+	$taxonomies = get_taxonomies(false, 'objects');
989
+	$ignore = array('nav_menu', 'link_category');
990 990
 	$r = array();
991 991
 	
992 992
 	
993 993
 	// populate $r
994
-	foreach( $taxonomies as $taxonomy )
994
+	foreach ($taxonomies as $taxonomy)
995 995
 	{
996
-		if( in_array($taxonomy->name, $ignore) )
996
+		if (in_array($taxonomy->name, $ignore))
997 997
 		{
998 998
 			continue;
999 999
 		
1000 1000
 		}
1001 1001
 		
1002
-		$r[ $taxonomy->name ] = $taxonomy->name; //"{$taxonomy->labels->singular_name}"; // ({$taxonomy->name})
1002
+		$r[$taxonomy->name] = $taxonomy->name; //"{$taxonomy->labels->singular_name}"; // ({$taxonomy->name})
1003 1003
 	}
1004 1004
 	
1005 1005
 	
@@ -1009,10 +1009,10 @@  discard block
 block discarded – undo
1009 1009
 }
1010 1010
 
1011 1011
 
1012
-function acf_get_pretty_taxonomies( $taxonomies = array() ) {
1012
+function acf_get_pretty_taxonomies($taxonomies = array()) {
1013 1013
 	
1014 1014
 	// get post types
1015
-	if( empty($taxonomies) ) {
1015
+	if (empty($taxonomies)) {
1016 1016
 		
1017 1017
 		// get all custom post types
1018 1018
 		$taxonomies = acf_get_taxonomies();
@@ -1024,38 +1024,38 @@  discard block
 block discarded – undo
1024 1024
 	$ref = array();
1025 1025
 	$r = array();
1026 1026
 	
1027
-	foreach( array_keys($taxonomies) as $i ) {
1027
+	foreach (array_keys($taxonomies) as $i) {
1028 1028
 		
1029 1029
 		// vars
1030
-		$taxonomy = acf_extract_var( $taxonomies, $i);
1031
-		$obj = get_taxonomy( $taxonomy );
1030
+		$taxonomy = acf_extract_var($taxonomies, $i);
1031
+		$obj = get_taxonomy($taxonomy);
1032 1032
 		$name = $obj->labels->singular_name;
1033 1033
 		
1034 1034
 		
1035 1035
 		// append to r
1036
-		$r[ $taxonomy ] = $name;
1036
+		$r[$taxonomy] = $name;
1037 1037
 		
1038 1038
 		
1039 1039
 		// increase counter
1040
-		if( !isset($ref[ $name ]) ) {
1040
+		if ( ! isset($ref[$name])) {
1041 1041
 			
1042
-			$ref[ $name ] = 0;
1042
+			$ref[$name] = 0;
1043 1043
 			
1044 1044
 		}
1045 1045
 		
1046
-		$ref[ $name ]++;
1046
+		$ref[$name]++;
1047 1047
 	}
1048 1048
 	
1049 1049
 	
1050 1050
 	// get slugs
1051
-	foreach( array_keys($r) as $i ) {
1051
+	foreach (array_keys($r) as $i) {
1052 1052
 		
1053 1053
 		// vars
1054
-		$taxonomy = $r[ $i ];
1054
+		$taxonomy = $r[$i];
1055 1055
 		
1056
-		if( $ref[ $taxonomy ] > 1 ) {
1056
+		if ($ref[$taxonomy] > 1) {
1057 1057
 			
1058
-			$r[ $i ] .= ' (' . $i . ')';
1058
+			$r[$i] .= ' ('.$i.')';
1059 1059
 			
1060 1060
 		}
1061 1061
 		
@@ -1081,14 +1081,14 @@  discard block
 block discarded – undo
1081 1081
 *  @return	(array)
1082 1082
 */
1083 1083
 
1084
-function acf_get_taxonomy_terms( $taxonomies = array() ) {
1084
+function acf_get_taxonomy_terms($taxonomies = array()) {
1085 1085
 	
1086 1086
 	// force array
1087
-	$taxonomies = acf_get_array( $taxonomies );
1087
+	$taxonomies = acf_get_array($taxonomies);
1088 1088
 	
1089 1089
 	
1090 1090
 	// get pretty taxonomy names
1091
-	$taxonomies = acf_get_pretty_taxonomies( $taxonomies );
1091
+	$taxonomies = acf_get_pretty_taxonomies($taxonomies);
1092 1092
 	
1093 1093
 	
1094 1094
 	// vars
@@ -1096,35 +1096,35 @@  discard block
 block discarded – undo
1096 1096
 	
1097 1097
 	
1098 1098
 	// populate $r
1099
-	foreach( array_keys($taxonomies) as $taxonomy ) {
1099
+	foreach (array_keys($taxonomies) as $taxonomy) {
1100 1100
 		
1101 1101
 		// vars
1102
-		$label = $taxonomies[ $taxonomy ];
1103
-		$terms = get_terms( $taxonomy, array( 'hide_empty' => false ) );
1104
-		$is_hierarchical = is_taxonomy_hierarchical( $taxonomy );
1102
+		$label = $taxonomies[$taxonomy];
1103
+		$terms = get_terms($taxonomy, array('hide_empty' => false));
1104
+		$is_hierarchical = is_taxonomy_hierarchical($taxonomy);
1105 1105
 		
1106 1106
 		
1107 1107
 		// bail early i no terms
1108
-		if( empty($terms) ) continue;
1108
+		if (empty($terms)) continue;
1109 1109
 		
1110 1110
 		
1111 1111
 		// sort into hierachial order!
1112
-		if( $is_hierarchical ) {
1112
+		if ($is_hierarchical) {
1113 1113
 			
1114
-			$terms = _get_term_children( 0, $terms, $taxonomy );
1114
+			$terms = _get_term_children(0, $terms, $taxonomy);
1115 1115
 			
1116 1116
 		}
1117 1117
 		
1118 1118
 		
1119 1119
 		// add placeholder		
1120
-		$r[ $label ] = array();
1120
+		$r[$label] = array();
1121 1121
 		
1122 1122
 		
1123 1123
 		// add choices
1124
-		foreach( $terms as $term ) {
1124
+		foreach ($terms as $term) {
1125 1125
 		
1126 1126
 			$k = "{$taxonomy}:{$term->slug}"; 
1127
-			$r[ $label ][ $k ] = acf_get_term_title( $term );
1127
+			$r[$label][$k] = acf_get_term_title($term);
1128 1128
 			
1129 1129
 		}
1130 1130
 		
@@ -1137,14 +1137,14 @@  discard block
 block discarded – undo
1137 1137
 }
1138 1138
 
1139 1139
 
1140
-function acf_get_term_title( $term ) {
1140
+function acf_get_term_title($term) {
1141 1141
 	
1142 1142
 	// title
1143 1143
 	$title = $term->name;
1144 1144
 	
1145 1145
 	
1146 1146
 	// empty
1147
-	if( $title === '' ) {
1147
+	if ($title === '') {
1148 1148
 		
1149 1149
 		$title = __('(no title)', 'acf');
1150 1150
 		
@@ -1152,11 +1152,11 @@  discard block
 block discarded – undo
1152 1152
 	
1153 1153
 	
1154 1154
 	// ancestors
1155
-	if( is_taxonomy_hierarchical($term->taxonomy) ) {
1155
+	if (is_taxonomy_hierarchical($term->taxonomy)) {
1156 1156
 		
1157
-		$ancestors = get_ancestors( $term->term_id, $term->taxonomy );
1157
+		$ancestors = get_ancestors($term->term_id, $term->taxonomy);
1158 1158
 		
1159
-		$title = str_repeat('- ', count($ancestors)) . $title;
1159
+		$title = str_repeat('- ', count($ancestors)).$title;
1160 1160
 		
1161 1161
 	}
1162 1162
 	
@@ -1180,10 +1180,10 @@  discard block
 block discarded – undo
1180 1180
 *  @return	(array)
1181 1181
 */
1182 1182
 
1183
-function acf_decode_taxonomy_terms( $terms = false ) {
1183
+function acf_decode_taxonomy_terms($terms = false) {
1184 1184
 	
1185 1185
 	// load all taxonomies if not specified in args
1186
-	if( !$terms ) {
1186
+	if ( ! $terms) {
1187 1187
 		
1188 1188
 		$terms = acf_get_taxonomy_terms();
1189 1189
 		
@@ -1194,21 +1194,21 @@  discard block
 block discarded – undo
1194 1194
 	$r = array();
1195 1195
 	
1196 1196
 	
1197
-	foreach( $terms as $term ) {
1197
+	foreach ($terms as $term) {
1198 1198
 		
1199 1199
 		// vars
1200
-		$data = acf_decode_taxonomy_term( $term );
1200
+		$data = acf_decode_taxonomy_term($term);
1201 1201
 		
1202 1202
 		
1203 1203
 		// create empty array
1204
-		if( !array_key_exists($data['taxonomy'], $r) )
1204
+		if ( ! array_key_exists($data['taxonomy'], $r))
1205 1205
 		{
1206
-			$r[ $data['taxonomy'] ] = array();
1206
+			$r[$data['taxonomy']] = array();
1207 1207
 		}
1208 1208
 		
1209 1209
 		
1210 1210
 		// append to taxonomy
1211
-		$r[ $data['taxonomy'] ][] = $data['term'];
1211
+		$r[$data['taxonomy']][] = $data['term'];
1212 1212
 		
1213 1213
 	}
1214 1214
 	
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 *  @return	(array)
1233 1233
 */
1234 1234
 
1235
-function acf_decode_taxonomy_term( $string ) {
1235
+function acf_decode_taxonomy_term($string) {
1236 1236
 	
1237 1237
 	// vars
1238 1238
 	$r = array();
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 	
1247 1247
 	// check data
1248
-	if( isset($data[1]) ) {
1248
+	if (isset($data[1])) {
1249 1249
 		
1250 1250
 		$taxonomy = $data[0];
1251 1251
 		$term = $data[1];
@@ -1322,10 +1322,10 @@  discard block
 block discarded – undo
1322 1322
 *  @return	(array)
1323 1323
 */
1324 1324
 
1325
-function acf_get_array( $var = false, $delimiter = ',' ) {
1325
+function acf_get_array($var = false, $delimiter = ',') {
1326 1326
 	
1327 1327
 	// is array?
1328
-	if( is_array($var) ) {
1328
+	if (is_array($var)) {
1329 1329
 	
1330 1330
 		return $var;
1331 1331
 	
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 	
1334 1334
 	
1335 1335
 	// bail early if empty
1336
-	if( empty($var) && !is_numeric($var) ) {
1336
+	if (empty($var) && ! is_numeric($var)) {
1337 1337
 		
1338 1338
 		return array();
1339 1339
 		
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 	
1342 1342
 	
1343 1343
 	// string 
1344
-	if( is_string($var) && $delimiter ) {
1344
+	if (is_string($var) && $delimiter) {
1345 1345
 		
1346 1346
 		return explode($delimiter, $var);
1347 1347
 		
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 	
1350 1350
 	
1351 1351
 	// place in array
1352
-	return array( $var );
1352
+	return array($var);
1353 1353
 	
1354 1354
 } 
1355 1355
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 *  @return	(array)
1368 1368
 */
1369 1369
 
1370
-function acf_get_posts( $args = array() ) {
1370
+function acf_get_posts($args = array()) {
1371 1371
 	
1372 1372
 	// vars
1373 1373
 	$posts = array();
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 	
1376 1376
 	// defaults
1377 1377
 	// leave suppress_filters as true becuase we don't want any plugins to modify the query as we know exactly what 
1378
-	$args = acf_parse_args( $args, array(
1378
+	$args = acf_parse_args($args, array(
1379 1379
 		'posts_per_page'	=> -1,
1380 1380
 		'post_type'			=> '',
1381 1381
 		'post_status'		=> 'any'
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	
1384 1384
 
1385 1385
 	// post type
1386
-	if( empty($args['post_type']) ) {
1386
+	if (empty($args['post_type'])) {
1387 1387
 		
1388 1388
 		$args['post_type'] = acf_get_post_types();
1389 1389
 		
@@ -1391,10 +1391,10 @@  discard block
 block discarded – undo
1391 1391
 	
1392 1392
 	
1393 1393
 	// validate post__in
1394
-	if( $args['post__in'] ) {
1394
+	if ($args['post__in']) {
1395 1395
 		
1396 1396
 		// force value to array
1397
-		$args['post__in'] = acf_get_array( $args['post__in'] );
1397
+		$args['post__in'] = acf_get_array($args['post__in']);
1398 1398
 		
1399 1399
 		
1400 1400
 		// convert to int
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
 	
1422 1422
 	
1423 1423
 	// validate order
1424
-	if( $posts && $args['post__in'] ) {
1424
+	if ($posts && $args['post__in']) {
1425 1425
 		
1426 1426
 		// vars
1427 1427
 		$order = array();
1428 1428
 		
1429 1429
 		
1430 1430
 		// generate sort order
1431
-		foreach( $posts as $i => $post ) {
1431
+		foreach ($posts as $i => $post) {
1432 1432
 			
1433
-			$order[ $i ] = array_search($post->ID, $args['post__in']);
1433
+			$order[$i] = array_search($post->ID, $args['post__in']);
1434 1434
 			
1435 1435
 		}
1436 1436
 		
@@ -1461,14 +1461,14 @@  discard block
 block discarded – undo
1461 1461
 *  @return	$sql
1462 1462
 */
1463 1463
 
1464
-function _acf_query_remove_post_type( $sql ) {
1464
+function _acf_query_remove_post_type($sql) {
1465 1465
 	
1466 1466
 	// global
1467 1467
 	global $wpdb;
1468 1468
 	
1469 1469
 	
1470 1470
 	// bail ealry if no 'wp_posts.ID IN'
1471
-	if( strpos($sql, "$wpdb->posts.ID IN") === false ) {
1471
+	if (strpos($sql, "$wpdb->posts.ID IN") === false) {
1472 1472
 		
1473 1473
 		return $sql;
1474 1474
 		
@@ -1481,11 +1481,11 @@  discard block
 block discarded – undo
1481 1481
 	
1482 1482
     
1483 1483
 	// loop through $where and remove any post_type queries
1484
-	foreach( $bits as $i => $bit ) {
1484
+	foreach ($bits as $i => $bit) {
1485 1485
 		
1486
-		if( strpos($bit, "$wpdb->posts.post_type") !== false ) {
1486
+		if (strpos($bit, "$wpdb->posts.post_type") !== false) {
1487 1487
 			
1488
-			unset( $bits[ $i ] );
1488
+			unset($bits[$i]);
1489 1489
 			
1490 1490
 		}
1491 1491
 		
@@ -1516,14 +1516,14 @@  discard block
 block discarded – undo
1516 1516
 *  @return	(array)
1517 1517
 */
1518 1518
 
1519
-function acf_get_grouped_posts( $args ) {
1519
+function acf_get_grouped_posts($args) {
1520 1520
 	
1521 1521
 	// vars
1522 1522
 	$r = array();
1523 1523
 	
1524 1524
 	
1525 1525
 	// defaults
1526
-	$args = acf_parse_args( $args, array(
1526
+	$args = acf_parse_args($args, array(
1527 1527
 		'posts_per_page'			=> -1,
1528 1528
 		'paged'						=> 0,
1529 1529
 		'post_type'					=> 'post',
@@ -1536,12 +1536,12 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 	
1538 1538
 	// find array of post_type
1539
-	$post_types = acf_get_array( $args['post_type'] );
1539
+	$post_types = acf_get_array($args['post_type']);
1540 1540
 	$post_types_labels = acf_get_pretty_post_types($post_types);
1541 1541
 	
1542 1542
 	
1543 1543
 	// attachment doesn't work if it is the only item in an array
1544
-	if( count($post_types) == 1 ) {
1544
+	if (count($post_types) == 1) {
1545 1545
 	
1546 1546
 		$args['post_type'] = current($post_types);
1547 1547
 		
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 	
1554 1554
 	
1555 1555
 	// get posts
1556
-	$posts = get_posts( $args );
1556
+	$posts = get_posts($args);
1557 1557
 	
1558 1558
 	
1559 1559
 	// remove this filter (only once)
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 	
1562 1562
 	
1563 1563
 	// loop
1564
-	foreach( $post_types as $post_type ) {
1564
+	foreach ($post_types as $post_type) {
1565 1565
 		
1566 1566
 		// vars
1567 1567
 		$this_posts = array();
@@ -1569,11 +1569,11 @@  discard block
 block discarded – undo
1569 1569
 		
1570 1570
 		
1571 1571
 		// populate $this_posts
1572
-		foreach( array_keys($posts) as $key ) {
1572
+		foreach (array_keys($posts) as $key) {
1573 1573
 		
1574
-			if( $posts[ $key ]->post_type == $post_type ) {
1574
+			if ($posts[$key]->post_type == $post_type) {
1575 1575
 				
1576
-				$this_posts[] = acf_extract_var( $posts, $key );
1576
+				$this_posts[] = acf_extract_var($posts, $key);
1577 1577
 				
1578 1578
 			}
1579 1579
 			
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
 		
1582 1582
 		
1583 1583
 		// bail early if no posts for this post type
1584
-		if( empty($this_posts) ) {
1584
+		if (empty($this_posts)) {
1585 1585
 		
1586 1586
 			continue;
1587 1587
 			
@@ -1590,13 +1590,13 @@  discard block
 block discarded – undo
1590 1590
 		
1591 1591
 		// sort into hierachial order!
1592 1592
 		// this will fail if a search has taken place because parents wont exist
1593
-		if( is_post_type_hierarchical($post_type) && empty($args['s'])) {
1593
+		if (is_post_type_hierarchical($post_type) && empty($args['s'])) {
1594 1594
 			
1595 1595
 			// vars
1596
-			$match_id = $this_posts[ 0 ]->ID;
1596
+			$match_id = $this_posts[0]->ID;
1597 1597
 			$offset = 0;
1598 1598
 			$length = count($this_posts);
1599
-			$parent = acf_maybe_get( $args, 'post_parent', 0 );
1599
+			$parent = acf_maybe_get($args, 'post_parent', 0);
1600 1600
 			
1601 1601
 			
1602 1602
 			// reset $this_posts
@@ -1610,13 +1610,13 @@  discard block
 block discarded – undo
1610 1610
 				'post_type'			=> $post_type
1611 1611
 			));
1612 1612
 			
1613
-			$all_posts = get_posts( $all_args );
1613
+			$all_posts = get_posts($all_args);
1614 1614
 			
1615 1615
 			
1616 1616
 			// loop over posts and update $offset
1617
-			foreach( $all_posts as $offset => $p ) {
1617
+			foreach ($all_posts as $offset => $p) {
1618 1618
 				
1619
-				if( $p->ID == $match_id ) {
1619
+				if ($p->ID == $match_id) {
1620 1620
 					
1621 1621
 					break;
1622 1622
 					
@@ -1626,13 +1626,13 @@  discard block
 block discarded – undo
1626 1626
 			
1627 1627
 			
1628 1628
 			// order posts
1629
-			$all_posts = get_page_children( $parent, $all_posts );
1629
+			$all_posts = get_page_children($parent, $all_posts);
1630 1630
 			
1631 1631
 			
1632 1632
 			// append
1633
-			for( $i = $offset; $i < ($offset + $length); $i++ ) {
1633
+			for ($i = $offset; $i < ($offset + $length); $i++) {
1634 1634
 				
1635
-				$this_posts[] = acf_extract_var( $all_posts, $i);
1635
+				$this_posts[] = acf_extract_var($all_posts, $i);
1636 1636
 				
1637 1637
 			}			
1638 1638
 			
@@ -1640,23 +1640,23 @@  discard block
 block discarded – undo
1640 1640
 		
1641 1641
 				
1642 1642
 		// populate $this_posts
1643
-		foreach( array_keys($this_posts) as $key ) {
1643
+		foreach (array_keys($this_posts) as $key) {
1644 1644
 			
1645 1645
 			// extract post
1646
-			$post = acf_extract_var( $this_posts, $key );
1646
+			$post = acf_extract_var($this_posts, $key);
1647 1647
 			
1648 1648
 			
1649 1649
 			
1650 1650
 			// add to group
1651
-			$this_group[ $post->ID ] = $post;
1651
+			$this_group[$post->ID] = $post;
1652 1652
 			
1653 1653
 		}
1654 1654
 		
1655 1655
 		
1656 1656
 		// group by post type
1657
-		$post_type_name = $post_types_labels[ $post_type ];
1657
+		$post_type_name = $post_types_labels[$post_type];
1658 1658
 		
1659
-		$r[ $post_type_name ] = $this_group;
1659
+		$r[$post_type_name] = $this_group;
1660 1660
 					
1661 1661
 	}
1662 1662
 	
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 	
1667 1667
 }
1668 1668
 
1669
-function _acf_orderby_post_type( $ordeby, $wp_query ) {
1669
+function _acf_orderby_post_type($ordeby, $wp_query) {
1670 1670
 	
1671 1671
 	// global
1672 1672
 	global $wpdb;
@@ -1677,10 +1677,10 @@  discard block
 block discarded – undo
1677 1677
 	
1678 1678
 
1679 1679
 	// prepend SQL
1680
-	if( is_array($post_types) ) {
1680
+	if (is_array($post_types)) {
1681 1681
 		
1682 1682
 		$post_types = implode("','", $post_types);
1683
-		$ordeby = "FIELD({$wpdb->posts}.post_type,'$post_types')," . $ordeby;
1683
+		$ordeby = "FIELD({$wpdb->posts}.post_type,'$post_types'),".$ordeby;
1684 1684
 		
1685 1685
 	}
1686 1686
 	
@@ -1691,10 +1691,10 @@  discard block
 block discarded – undo
1691 1691
 }
1692 1692
 
1693 1693
 
1694
-function acf_get_post_title( $post = 0 ) {
1694
+function acf_get_post_title($post = 0) {
1695 1695
 	
1696 1696
 	// load post if given an ID
1697
-	if( is_numeric($post) ) {
1697
+	if (is_numeric($post)) {
1698 1698
 		
1699 1699
 		$post = get_post($post);
1700 1700
 		
@@ -1702,11 +1702,11 @@  discard block
 block discarded – undo
1702 1702
 	
1703 1703
 	
1704 1704
 	// title
1705
-	$title = get_the_title( $post->ID );
1705
+	$title = get_the_title($post->ID);
1706 1706
 	
1707 1707
 	
1708 1708
 	// empty
1709
-	if( $title === '' ) {
1709
+	if ($title === '') {
1710 1710
 		
1711 1711
 		$title = __('(no title)', 'acf');
1712 1712
 		
@@ -1714,19 +1714,19 @@  discard block
 block discarded – undo
1714 1714
 	
1715 1715
 	
1716 1716
 	// ancestors
1717
-	if( $post->post_type != 'attachment' ) {
1717
+	if ($post->post_type != 'attachment') {
1718 1718
 		
1719
-		$ancestors = get_ancestors( $post->ID, $post->post_type );
1719
+		$ancestors = get_ancestors($post->ID, $post->post_type);
1720 1720
 		
1721
-		$title = str_repeat('- ', count($ancestors)) . $title;
1721
+		$title = str_repeat('- ', count($ancestors)).$title;
1722 1722
 		
1723 1723
 	}
1724 1724
 	
1725 1725
 	
1726 1726
 	// status
1727
-	if( get_post_status( $post->ID ) != "publish" ) {
1727
+	if (get_post_status($post->ID) != "publish") {
1728 1728
 		
1729
-		$title .= ' (' . get_post_status( $post->ID ) . ')';
1729
+		$title .= ' ('.get_post_status($post->ID).')';
1730 1730
 		
1731 1731
 	}
1732 1732
 	
@@ -1737,39 +1737,39 @@  discard block
 block discarded – undo
1737 1737
 }
1738 1738
 
1739 1739
 
1740
-function acf_order_by_search( $array, $search ) {
1740
+function acf_order_by_search($array, $search) {
1741 1741
 	
1742 1742
 	// vars
1743 1743
 	$weights = array();
1744
-	$needle = strtolower( $search );
1744
+	$needle = strtolower($search);
1745 1745
 	
1746 1746
 	
1747 1747
 	// add key prefix
1748
-	foreach( array_keys($array) as $k ) {
1748
+	foreach (array_keys($array) as $k) {
1749 1749
 		
1750
-		$array[ '_' . $k ] = acf_extract_var( $array, $k );
1750
+		$array['_'.$k] = acf_extract_var($array, $k);
1751 1751
 		
1752 1752
 	}
1753 1753
 
1754 1754
 
1755 1755
 	// add search weight
1756
-	foreach( $array as $k => $v ) {
1756
+	foreach ($array as $k => $v) {
1757 1757
 	
1758 1758
 		// vars
1759 1759
 		$weight = 0;
1760
-		$haystack = strtolower( $v );
1761
-		$strpos = strpos( $haystack, $needle );
1760
+		$haystack = strtolower($v);
1761
+		$strpos = strpos($haystack, $needle);
1762 1762
 		
1763 1763
 		
1764 1764
 		// detect search match
1765
-		if( $strpos !== false ) {
1765
+		if ($strpos !== false) {
1766 1766
 			
1767 1767
 			// set eright to length of match
1768
-			$weight = strlen( $search );
1768
+			$weight = strlen($search);
1769 1769
 			
1770 1770
 			
1771 1771
 			// increase weight if match starts at begining of string
1772
-			if( $strpos == 0 ) {
1772
+			if ($strpos == 0) {
1773 1773
 				
1774 1774
 				$weight++;
1775 1775
 				
@@ -1779,19 +1779,19 @@  discard block
 block discarded – undo
1779 1779
 		
1780 1780
 		
1781 1781
 		// append to wights
1782
-		$weights[ $k ] = $weight;
1782
+		$weights[$k] = $weight;
1783 1783
 		
1784 1784
 	}
1785 1785
 	
1786 1786
 	
1787 1787
 	// sort the array with menu_order ascending
1788
-	array_multisort( $weights, SORT_DESC, $array );
1788
+	array_multisort($weights, SORT_DESC, $array);
1789 1789
 	
1790 1790
 	
1791 1791
 	// remove key prefix
1792
-	foreach( array_keys($array) as $k ) {
1792
+	foreach (array_keys($array) as $k) {
1793 1793
 		
1794
-		$array[ substr($k,1) ] = acf_extract_var( $array, $k );
1794
+		$array[substr($k, 1)] = acf_extract_var($array, $k);
1795 1795
 		
1796 1796
 	}
1797 1797
 		
@@ -1815,10 +1815,10 @@  discard block
 block discarded – undo
1815 1815
 *  @return	(string)
1816 1816
 */
1817 1817
 
1818
-function acf_json_encode( $json ) {
1818
+function acf_json_encode($json) {
1819 1819
 	
1820 1820
 	// PHP at least 5.4
1821
-	if( version_compare(PHP_VERSION, '5.4.0', '>=') ) {
1821
+	if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
1822 1822
 		
1823 1823
 		return json_encode($json, JSON_PRETTY_PRINT);
1824 1824
 		
@@ -1839,21 +1839,21 @@  discard block
 block discarded – undo
1839 1839
     $prevChar    = '';
1840 1840
     $outOfQuotes = true;
1841 1841
 
1842
-    for ($i=0; $i<=$strLen; $i++) {
1842
+    for ($i = 0; $i <= $strLen; $i++) {
1843 1843
 
1844 1844
         // Grab the next character in the string.
1845 1845
         $char = substr($json, $i, 1);
1846 1846
 
1847 1847
         // Are we inside a quoted string?
1848 1848
         if ($char == '"' && $prevChar != '\\') {
1849
-            $outOfQuotes = !$outOfQuotes;
1849
+            $outOfQuotes = ! $outOfQuotes;
1850 1850
         
1851 1851
         // If this character is the end of an element, 
1852 1852
         // output a new line and indent the next line.
1853
-        } else if(($char == '}' || $char == ']') && $outOfQuotes) {
1853
+        } else if (($char == '}' || $char == ']') && $outOfQuotes) {
1854 1854
             $result .= $newLine;
1855
-            $pos --;
1856
-            for ($j=0; $j<$pos; $j++) {
1855
+            $pos--;
1856
+            for ($j = 0; $j < $pos; $j++) {
1857 1857
                 $result .= $indentStr;
1858 1858
             }
1859 1859
         }
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
         $result .= $char;
1863 1863
 		
1864 1864
 		// If this character is ':' adda space after it
1865
-        if($char == ':' && $outOfQuotes) {
1865
+        if ($char == ':' && $outOfQuotes) {
1866 1866
             $result .= ' ';
1867 1867
         }
1868 1868
         
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
         if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
1872 1872
             $result .= $newLine;
1873 1873
             if ($char == '{' || $char == '[') {
1874
-                $pos ++;
1874
+                $pos++;
1875 1875
             }
1876 1876
             
1877 1877
             for ($j = 0; $j < $pos; $j++) {
@@ -1903,10 +1903,10 @@  discard block
 block discarded – undo
1903 1903
 *  @return	(boolean)
1904 1904
 */
1905 1905
 
1906
-function acf_str_exists( $needle, $haystack ) {
1906
+function acf_str_exists($needle, $haystack) {
1907 1907
 	
1908 1908
 	// return true if $haystack contains the $needle
1909
-	if( is_string($haystack) && strpos($haystack, $needle) !== false ) {
1909
+	if (is_string($haystack) && strpos($haystack, $needle) !== false) {
1910 1910
 		
1911 1911
 		return true;
1912 1912
 		
@@ -1941,38 +1941,38 @@  discard block
 block discarded – undo
1941 1941
 	
1942 1942
 	
1943 1943
 	// start script
1944
-	$o .= '<script type="text/javascript">' . $nl;
1944
+	$o .= '<script type="text/javascript">'.$nl;
1945 1945
 	
1946
-	$o .= 'console.log("' . $s . '"';
1946
+	$o .= 'console.log("'.$s.'"';
1947 1947
 	
1948
-	if( !empty($args) ) {
1948
+	if ( ! empty($args)) {
1949 1949
 		
1950
-		foreach( $args as $arg ) {
1950
+		foreach ($args as $arg) {
1951 1951
 			
1952
-			if( is_object($arg) || is_array($arg) ) {
1952
+			if (is_object($arg) || is_array($arg)) {
1953 1953
 				
1954 1954
 				$arg = json_encode($arg);
1955 1955
 				
1956
-			} elseif( is_bool($arg) ) {
1956
+			} elseif (is_bool($arg)) {
1957 1957
 				
1958 1958
 				$arg = $arg ? 'true' : 'false';
1959 1959
 				
1960
-			}elseif( is_string($arg) ) {
1960
+			}elseif (is_string($arg)) {
1961 1961
 				
1962
-				$arg = '"' . $arg . '"';
1962
+				$arg = '"'.$arg.'"';
1963 1963
 				
1964 1964
 			}
1965 1965
 			
1966
-			$o .= ', ' . $arg;
1966
+			$o .= ', '.$arg;
1967 1967
 			
1968 1968
 		}
1969 1969
 	}
1970 1970
 	
1971
-	$o .= ');' . $nl;
1971
+	$o .= ');'.$nl;
1972 1972
 	
1973 1973
 	
1974 1974
 	// end script
1975
-	$o .= '</script>' . $nl;
1975
+	$o .= '</script>'.$nl;
1976 1976
 	
1977 1977
 	
1978 1978
 	// echo
@@ -1981,13 +1981,13 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
 function acf_debug_start() {
1983 1983
 	
1984
-	acf_update_setting( 'debug_start', memory_get_usage());
1984
+	acf_update_setting('debug_start', memory_get_usage());
1985 1985
 	
1986 1986
 }
1987 1987
 
1988 1988
 function acf_debug_end() {
1989 1989
 	
1990
-	$start = acf_get_setting( 'debug_start' );
1990
+	$start = acf_get_setting('debug_start');
1991 1991
 	$end = memory_get_usage();
1992 1992
 	
1993 1993
 	return $end - $start;
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
 	
2019 2019
 	
2020 2020
 	// bail early if no version (not activated)
2021
-	if( !$acf_version ) {
2021
+	if ( ! $acf_version) {
2022 2022
 		
2023 2023
 		return false;
2024 2024
 		
@@ -2026,19 +2026,19 @@  discard block
 block discarded – undo
2026 2026
 	
2027 2027
 	
2028 2028
 	// check that path exists
2029
-	if( !file_exists( $path ) ) {
2029
+	if ( ! file_exists($path)) {
2030 2030
 	
2031 2031
 		return false;
2032 2032
 		
2033 2033
 	}
2034 2034
 	
2035 2035
 	
2036
-	$dir = opendir( $path );
2036
+	$dir = opendir($path);
2037 2037
 
2038
-    while(false !== ( $file = readdir($dir)) ) {
2038
+    while (false !== ($file = readdir($dir))) {
2039 2039
     
2040 2040
     	// only php files
2041
-    	if( substr($file, -4) !== '.php' ) {
2041
+    	if (substr($file, -4) !== '.php') {
2042 2042
     	
2043 2043
 	    	continue;
2044 2044
 	    	
@@ -2050,14 +2050,14 @@  discard block
 block discarded – undo
2050 2050
     	
2051 2051
     	
2052 2052
     	// ignore if update is for a future version. May exist for testing
2053
-		if( version_compare( $update_version, $plugin_version, '>') ) {
2053
+		if (version_compare($update_version, $plugin_version, '>')) {
2054 2054
 		
2055 2055
 			continue;
2056 2056
 			
2057 2057
 		}
2058 2058
 		
2059 2059
 		// ignore if update has already been run
2060
-		if( version_compare( $update_version, $acf_version, '<=') ) {
2060
+		if (version_compare($update_version, $acf_version, '<=')) {
2061 2061
 		
2062 2062
 			continue;
2063 2063
 			
@@ -2089,10 +2089,10 @@  discard block
 block discarded – undo
2089 2089
 *  @return	$post_id (int)
2090 2090
 */
2091 2091
 
2092
-function acf_encode_choices( $array = array() ) {
2092
+function acf_encode_choices($array = array()) {
2093 2093
 	
2094 2094
 	// bail early if not array
2095
-	if( !is_array($array) ) {
2095
+	if ( ! is_array($array)) {
2096 2096
 		
2097 2097
 		return $array;
2098 2098
 		
@@ -2103,13 +2103,13 @@  discard block
 block discarded – undo
2103 2103
 	$string = '';
2104 2104
 	
2105 2105
 	
2106
-	if( !empty($array) ) {
2106
+	if ( ! empty($array)) {
2107 2107
 		
2108
-		foreach( $array as $k => $v ) { 
2108
+		foreach ($array as $k => $v) { 
2109 2109
 			
2110
-			if( $k !== $v ) {
2110
+			if ($k !== $v) {
2111 2111
 				
2112
-				$array[ $k ] = $k . ' : ' . $v;
2112
+				$array[$k] = $k.' : '.$v;
2113 2113
 				
2114 2114
 			}
2115 2115
 			
@@ -2125,20 +2125,20 @@  discard block
 block discarded – undo
2125 2125
 	
2126 2126
 }
2127 2127
 
2128
-function acf_decode_choices( $string = '' ) {
2128
+function acf_decode_choices($string = '') {
2129 2129
 	
2130 2130
 	// validate
2131
-	if( $string === '') {
2131
+	if ($string === '') {
2132 2132
 		
2133 2133
 		return array();
2134 2134
 		
2135 2135
 	// force array on single numeric values
2136
-	} elseif( is_numeric($string) ) {
2136
+	} elseif (is_numeric($string)) {
2137 2137
 		
2138 2138
 		// allow
2139 2139
 	
2140 2140
 	// bail early if not a a string
2141
-	} elseif( !is_string($string) ) {
2141
+	} elseif ( ! is_string($string)) {
2142 2142
 		
2143 2143
 		return $string;
2144 2144
 		
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	
2155 2155
 	
2156 2156
 	// key => value
2157
-	foreach( $lines as $line ) {
2157
+	foreach ($lines as $line) {
2158 2158
 		
2159 2159
 		// vars
2160 2160
 		$k = trim($line);
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
 		
2163 2163
 		
2164 2164
 		// look for ' : '
2165
-		if( acf_str_exists(' : ', $line) ) {
2165
+		if (acf_str_exists(' : ', $line)) {
2166 2166
 		
2167 2167
 			$line = explode(' : ', $line);
2168 2168
 			
@@ -2173,7 +2173,7 @@  discard block
 block discarded – undo
2173 2173
 		
2174 2174
 		
2175 2175
 		// append
2176
-		$array[ $k ] = $v;
2176
+		$array[$k] = $v;
2177 2177
 		
2178 2178
 	}
2179 2179
 	
@@ -2201,30 +2201,30 @@  discard block
 block discarded – undo
2201 2201
 acf_update_setting('php_to_js_date_formats', array(
2202 2202
 
2203 2203
 	// Year
2204
-	'Y'	=> 'yy',	// Numeric, 4 digits 								1999, 2003
2205
-	'y'	=> 'y',		// Numeric, 2 digits 								99, 03
2204
+	'Y'	=> 'yy', // Numeric, 4 digits 								1999, 2003
2205
+	'y'	=> 'y', // Numeric, 2 digits 								99, 03
2206 2206
 	
2207 2207
 	
2208 2208
 	// Month
2209
-	'm'	=> 'mm',	// Numeric, with leading zeros  					01–12
2210
-	'n'	=> 'm',		// Numeric, without leading zeros  					1–12
2211
-	'F'	=> 'MM',	// Textual full   									January – December
2212
-	'M'	=> 'M',		// Textual three letters    						Jan - Dec 
2209
+	'm'	=> 'mm', // Numeric, with leading zeros  					01–12
2210
+	'n'	=> 'm', // Numeric, without leading zeros  					1–12
2211
+	'F'	=> 'MM', // Textual full   									January – December
2212
+	'M'	=> 'M', // Textual three letters    						Jan - Dec 
2213 2213
 	
2214 2214
 	
2215 2215
 	// Weekday
2216
-	'l'	=> 'DD',	// Full name  (lowercase 'L') 						Sunday – Saturday
2217
-	'D'	=> 'D',		// Three letter name 	 							Mon – Sun 
2216
+	'l'	=> 'DD', // Full name  (lowercase 'L') 						Sunday – Saturday
2217
+	'D'	=> 'D', // Three letter name 	 							Mon – Sun 
2218 2218
 	
2219 2219
 	
2220 2220
 	// Day of Month
2221
-	'd'	=> 'dd',	// Numeric, with leading zeros						01–31
2222
-	'j'	=> 'd',		// Numeric, without leading zeros 					1–31
2223
-	'S'	=> '',		// The English suffix for the day of the month  	st, nd or th in the 1st, 2nd or 15th. 
2221
+	'd'	=> 'dd', // Numeric, with leading zeros						01–31
2222
+	'j'	=> 'd', // Numeric, without leading zeros 					1–31
2223
+	'S'	=> '', // The English suffix for the day of the month  	st, nd or th in the 1st, 2nd or 15th. 
2224 2224
 
2225 2225
 ));
2226 2226
 
2227
-function acf_convert_date_to_php( $date ) {
2227
+function acf_convert_date_to_php($date) {
2228 2228
 	
2229 2229
 	// vars
2230 2230
 	$ignore = array();
@@ -2235,10 +2235,10 @@  discard block
 block discarded – undo
2235 2235
 	
2236 2236
 	
2237 2237
 	// loop over conversions
2238
-	foreach( $php_to_js as $replace => $search ) {
2238
+	foreach ($php_to_js as $replace => $search) {
2239 2239
 		
2240 2240
 		// ignore this replace?
2241
-		if( in_array($search, $ignore) ) {
2241
+		if (in_array($search, $ignore)) {
2242 2242
 			
2243 2243
 			continue;
2244 2244
 			
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 *  @return	$post_id (int)
2273 2273
 */
2274 2274
 
2275
-function acf_convert_date_to_js( $date ) {
2275
+function acf_convert_date_to_js($date) {
2276 2276
 	
2277 2277
 	// vars
2278 2278
 	$ignore = array();
@@ -2283,10 +2283,10 @@  discard block
 block discarded – undo
2283 2283
 	
2284 2284
 	
2285 2285
 	// loop over conversions
2286
-	foreach( $php_to_js as $search => $replace ) {
2286
+	foreach ($php_to_js as $search => $replace) {
2287 2287
 		
2288 2288
 		// ignore this replace?
2289
-		if( in_array($search, $ignore) ) {
2289
+		if (in_array($search, $ignore)) {
2290 2290
 			
2291 2291
 			continue;
2292 2292
 			
@@ -2321,18 +2321,18 @@  discard block
 block discarded – undo
2321 2321
 *  @return	$post_id (int)
2322 2322
 */
2323 2323
 
2324
-function acf_update_user_setting( $name, $value ) {
2324
+function acf_update_user_setting($name, $value) {
2325 2325
 	
2326 2326
 	// get current user id
2327 2327
 	$user_id = get_current_user_id();
2328 2328
 	
2329 2329
 	
2330 2330
 	// get user settings
2331
-	$settings = get_user_meta( $user_id, 'acf_user_settings', false );
2331
+	$settings = get_user_meta($user_id, 'acf_user_settings', false);
2332 2332
 	
2333 2333
 	
2334 2334
 	// find settings
2335
-	if( isset($settings[0]) ) {
2335
+	if (isset($settings[0])) {
2336 2336
 	
2337 2337
 		$settings = $settings[0];
2338 2338
 	
@@ -2344,14 +2344,14 @@  discard block
 block discarded – undo
2344 2344
 	
2345 2345
 	
2346 2346
 	// delete setting (allow 0 to save)
2347
-	if( !$value && !is_numeric($value) ) {
2347
+	if ( ! $value && ! is_numeric($value)) {
2348 2348
 		
2349
-		unset($settings[ $name ]);
2349
+		unset($settings[$name]);
2350 2350
 	
2351 2351
 	// append setting	
2352 2352
 	} else {
2353 2353
 		
2354
-		$settings[ $name ] = $value;
2354
+		$settings[$name] = $value;
2355 2355
 		
2356 2356
 	}
2357 2357
 	
@@ -2376,18 +2376,18 @@  discard block
 block discarded – undo
2376 2376
 *  @return	$post_id (int)
2377 2377
 */
2378 2378
 
2379
-function acf_get_user_setting( $name = '', $default = false ) {
2379
+function acf_get_user_setting($name = '', $default = false) {
2380 2380
 	
2381 2381
 	// get current user id
2382 2382
 	$user_id = get_current_user_id();
2383 2383
 	
2384 2384
 	
2385 2385
 	// get user settings
2386
-	$settings = get_user_meta( $user_id, 'acf_user_settings', false );
2386
+	$settings = get_user_meta($user_id, 'acf_user_settings', false);
2387 2387
 	
2388 2388
 	
2389 2389
 	// bail arly if no settings
2390
-	if( !isset($settings[0][$name]) ) {
2390
+	if ( ! isset($settings[0][$name])) {
2391 2391
 		
2392 2392
 		return $default;
2393 2393
 		
@@ -2413,10 +2413,10 @@  discard block
 block discarded – undo
2413 2413
 *  @return	$post_id (int)
2414 2414
 */
2415 2415
 
2416
-function acf_in_array( $value, $array ) {
2416
+function acf_in_array($value, $array) {
2417 2417
 	
2418 2418
 	// bail early if not array
2419
-	if( !is_array($array) ) {
2419
+	if ( ! is_array($array)) {
2420 2420
 		
2421 2421
 		return false;
2422 2422
 		
@@ -2442,10 +2442,10 @@  discard block
 block discarded – undo
2442 2442
 *  @return	$post_id (mixed)
2443 2443
 */
2444 2444
 
2445
-function acf_get_valid_post_id( $post_id = 0 ) {
2445
+function acf_get_valid_post_id($post_id = 0) {
2446 2446
 	
2447 2447
 	// set post_id to global
2448
-	if( !$post_id ) {
2448
+	if ( ! $post_id) {
2449 2449
 	
2450 2450
 		$post_id = (int) get_the_ID();
2451 2451
 		
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 	
2454 2454
 	
2455 2455
 	// allow for option == options
2456
-	if( $post_id == 'option' ) {
2456
+	if ($post_id == 'option') {
2457 2457
 	
2458 2458
 		$post_id = 'options';
2459 2459
 		
@@ -2461,21 +2461,21 @@  discard block
 block discarded – undo
2461 2461
 	
2462 2462
 	
2463 2463
 	// $post_id may be an object
2464
-	if( is_object($post_id) ) {
2464
+	if (is_object($post_id)) {
2465 2465
 		
2466
-		if( isset($post_id->roles, $post_id->ID) ) {
2466
+		if (isset($post_id->roles, $post_id->ID)) {
2467 2467
 		
2468
-			$post_id = 'user_' . $post_id->ID;
2468
+			$post_id = 'user_'.$post_id->ID;
2469 2469
 			
2470
-		} elseif( isset($post_id->taxonomy, $post_id->term_id) ) {
2470
+		} elseif (isset($post_id->taxonomy, $post_id->term_id)) {
2471 2471
 		
2472
-			$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
2472
+			$post_id = $post_id->taxonomy.'_'.$post_id->term_id;
2473 2473
 			
2474
-		} elseif( isset($post_id->comment_ID) ) {
2474
+		} elseif (isset($post_id->comment_ID)) {
2475 2475
 		
2476
-			$post_id = 'comment_' . $post_id->comment_ID;
2476
+			$post_id = 'comment_'.$post_id->comment_ID;
2477 2477
 			
2478
-		} elseif( isset($post_id->ID) ) {
2478
+		} elseif (isset($post_id->ID)) {
2479 2479
 		
2480 2480
 			$post_id = $post_id->ID;
2481 2481
 			
@@ -2485,14 +2485,14 @@  discard block
 block discarded – undo
2485 2485
 	
2486 2486
 	
2487 2487
 	// append language code
2488
-	if( $post_id == 'options' ) {
2488
+	if ($post_id == 'options') {
2489 2489
 		
2490 2490
 		$dl = acf_get_setting('default_language');
2491 2491
 		$cl = acf_get_setting('current_language');
2492 2492
 		
2493
-		if( $cl && $cl !== $dl ) {
2493
+		if ($cl && $cl !== $dl) {
2494 2494
 			
2495
-			$post_id .= '_' . $cl;
2495
+			$post_id .= '_'.$cl;
2496 2496
 			
2497 2497
 		}
2498 2498
 		
@@ -2510,11 +2510,11 @@  discard block
 block discarded – undo
2510 2510
 	*  the user wants to load data from a completely different post_id
2511 2511
 	*/
2512 2512
 	
2513
-	if( isset($_GET['preview_id']) ) {
2513
+	if (isset($_GET['preview_id'])) {
2514 2514
 	
2515
-		$autosave = wp_get_post_autosave( $_GET['preview_id'] );
2515
+		$autosave = wp_get_post_autosave($_GET['preview_id']);
2516 2516
 		
2517
-		if( $autosave && $autosave->post_parent == $post_id ) {
2517
+		if ($autosave && $autosave->post_parent == $post_id) {
2518 2518
 		
2519 2519
 			$post_id = (int) $autosave->ID;
2520 2520
 			
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
 *  @return	n/a
2543 2543
 */
2544 2544
 	
2545
-function acf_upload_files( $ancestors = array() ) {
2545
+function acf_upload_files($ancestors = array()) {
2546 2546
 	
2547 2547
 	// vars
2548 2548
 	$file = array(
@@ -2555,21 +2555,21 @@  discard block
 block discarded – undo
2555 2555
 	
2556 2556
 	
2557 2557
 	// populate with $_FILES data
2558
-	foreach( array_keys($file) as $k ) {
2558
+	foreach (array_keys($file) as $k) {
2559 2559
 		
2560
-		$file[ $k ] = $_FILES['acf'][ $k ];
2560
+		$file[$k] = $_FILES['acf'][$k];
2561 2561
 		
2562 2562
 	}
2563 2563
 	
2564 2564
 	
2565 2565
 	// walk through ancestors
2566
-	if( !empty($ancestors) ) {
2566
+	if ( ! empty($ancestors)) {
2567 2567
 		
2568
-		foreach( $ancestors as $a ) {
2568
+		foreach ($ancestors as $a) {
2569 2569
 			
2570
-			foreach( array_keys($file) as $k ) {
2570
+			foreach (array_keys($file) as $k) {
2571 2571
 				
2572
-				$file[ $k ] = $file[ $k ][ $a ];
2572
+				$file[$k] = $file[$k][$a];
2573 2573
 				
2574 2574
 			}
2575 2575
 			
@@ -2579,13 +2579,13 @@  discard block
 block discarded – undo
2579 2579
 	
2580 2580
 	
2581 2581
 	// is array?
2582
-	if( is_array($file['name']) ) {
2582
+	if (is_array($file['name'])) {
2583 2583
 		
2584
-		foreach( array_keys($file['name']) as $k ) {
2584
+		foreach (array_keys($file['name']) as $k) {
2585 2585
 				
2586 2586
 			$_ancestors = array_merge($ancestors, array($k));
2587 2587
 			
2588
-			acf_upload_files( $_ancestors );
2588
+			acf_upload_files($_ancestors);
2589 2589
 			
2590 2590
 		}
2591 2591
 		
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
 	
2596 2596
 	
2597 2597
 	// bail ealry if file has error (no file uploaded)
2598
-	if( $file['error'] ) {
2598
+	if ($file['error']) {
2599 2599
 		
2600 2600
 		return;
2601 2601
 		
@@ -2607,12 +2607,12 @@  discard block
 block discarded – undo
2607 2607
 	
2608 2608
 	
2609 2609
 	// file found!
2610
-	$attachment_id = acf_upload_file( $file );
2610
+	$attachment_id = acf_upload_file($file);
2611 2611
 	
2612 2612
 	
2613 2613
 	// update $_POST
2614 2614
 	array_unshift($ancestors, 'acf');
2615
-	acf_update_nested_array( $_POST, $ancestors, $attachment_id );
2615
+	acf_update_nested_array($_POST, $ancestors, $attachment_id);
2616 2616
 	
2617 2617
 }
2618 2618
 
@@ -2630,24 +2630,24 @@  discard block
 block discarded – undo
2630 2630
 *  @return	$id (int) new attachment ID
2631 2631
 */
2632 2632
 
2633
-function acf_upload_file( $uploaded_file ) {
2633
+function acf_upload_file($uploaded_file) {
2634 2634
 	
2635 2635
 	// required
2636
-	require_once( ABSPATH . "/wp-load.php" );
2637
-	require_once( ABSPATH . "/wp-admin/includes/file.php" );
2638
-	require_once( ABSPATH . "/wp-admin/includes/image.php" );
2636
+	require_once(ABSPATH."/wp-load.php");
2637
+	require_once(ABSPATH."/wp-admin/includes/file.php");
2638
+	require_once(ABSPATH."/wp-admin/includes/image.php");
2639 2639
 	 
2640 2640
 	 
2641 2641
 	// required for wp_handle_upload() to upload the file
2642
-	$upload_overrides = array( 'test_form' => false );
2642
+	$upload_overrides = array('test_form' => false);
2643 2643
 	
2644 2644
 	
2645 2645
 	// upload
2646
-	$file = wp_handle_upload( $uploaded_file, $upload_overrides );
2646
+	$file = wp_handle_upload($uploaded_file, $upload_overrides);
2647 2647
 	
2648 2648
 	
2649 2649
 	// bail ealry if upload failed
2650
-	if( isset($file['error']) ) {
2650
+	if (isset($file['error'])) {
2651 2651
 		
2652 2652
 		return $file['error'];
2653 2653
 		
@@ -2673,10 +2673,10 @@  discard block
 block discarded – undo
2673 2673
 	$id = wp_insert_attachment($object, $file);
2674 2674
 
2675 2675
 	// Add the meta-data
2676
-	wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
2676
+	wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
2677 2677
 	
2678 2678
 	/** This action is documented in wp-admin/custom-header.php */
2679
-	do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
2679
+	do_action('wp_create_file_in_uploads', $file, $id); // For replication
2680 2680
 	
2681 2681
 	// return new ID
2682 2682
 	return $id;
@@ -2699,10 +2699,10 @@  discard block
 block discarded – undo
2699 2699
 *  @return	(boolean)
2700 2700
 */
2701 2701
 
2702
-function acf_update_nested_array( &$array, $ancestors, $value ) {
2702
+function acf_update_nested_array(&$array, $ancestors, $value) {
2703 2703
 	
2704 2704
 	// if no more ancestors, update the current var
2705
-	if( empty($ancestors) ) {
2705
+	if (empty($ancestors)) {
2706 2706
 		
2707 2707
 		$array = $value;
2708 2708
 		
@@ -2713,13 +2713,13 @@  discard block
 block discarded – undo
2713 2713
 	
2714 2714
 	
2715 2715
 	// shift the next ancestor from the array
2716
-	$k = array_shift( $ancestors );
2716
+	$k = array_shift($ancestors);
2717 2717
 	
2718 2718
 	
2719 2719
 	// if exists
2720
-	if( isset($array[ $k ]) ) {
2720
+	if (isset($array[$k])) {
2721 2721
 		
2722
-		return acf_update_nested_array( $array[ $k ], $ancestors, $value );
2722
+		return acf_update_nested_array($array[$k], $ancestors, $value);
2723 2723
 		
2724 2724
 	}
2725 2725
 		
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
 *  @return	$post_id (int)
2743 2743
 */
2744 2744
 
2745
-function acf_is_screen( $id = '' ) {
2745
+function acf_is_screen($id = '') {
2746 2746
 	
2747 2747
 	// vars
2748 2748
 	$current_screen = get_current_screen();
@@ -2769,17 +2769,17 @@  discard block
 block discarded – undo
2769 2769
 *  @return	$post_id (int)
2770 2770
 */
2771 2771
 
2772
-function acf_maybe_get( $array, $key, $default = null ) {
2772
+function acf_maybe_get($array, $key, $default = null) {
2773 2773
 	
2774 2774
 	// vars
2775 2775
 	$keys = explode('/', $key);
2776 2776
 	
2777 2777
 	
2778 2778
 	// loop through keys
2779
-	foreach( $keys as $k ) {
2779
+	foreach ($keys as $k) {
2780 2780
 		
2781 2781
 		// return default if does not exist
2782
-		if( !isset($array[ $k ]) ) {
2782
+		if ( ! isset($array[$k])) {
2783 2783
 			
2784 2784
 			return $default;
2785 2785
 			
@@ -2787,7 +2787,7 @@  discard block
 block discarded – undo
2787 2787
 		
2788 2788
 		
2789 2789
 		// update $array
2790
-		$array = $array[ $k ];
2790
+		$array = $array[$k];
2791 2791
 		
2792 2792
 	}
2793 2793
 	
@@ -2811,10 +2811,10 @@  discard block
 block discarded – undo
2811 2811
 *  @return	(array)
2812 2812
 */
2813 2813
 
2814
-function acf_get_attachment( $post ) {
2814
+function acf_get_attachment($post) {
2815 2815
 	
2816 2816
 	// get post
2817
-	if ( !$post = get_post( $post ) ) {
2817
+	if ( ! $post = get_post($post)) {
2818 2818
 		
2819 2819
 		return false;
2820 2820
 		
@@ -2828,8 +2828,8 @@  discard block
 block discarded – undo
2828 2828
 		'ID'			=> $id,
2829 2829
 		'id'			=> $id,
2830 2830
 		'title'       	=> $post->post_title,
2831
-		'filename'    	=> wp_basename( $post->guid ),
2832
-		'url'			=> wp_get_attachment_url( $id ),
2831
+		'filename'    	=> wp_basename($post->guid),
2832
+		'url'			=> wp_get_attachment_url($id),
2833 2833
 		'alt'			=> get_post_meta($id, '_wp_attachment_image_alt', true),
2834 2834
 		'author'		=> $post->post_author,
2835 2835
 		'description'	=> $post->post_content,
@@ -2838,28 +2838,28 @@  discard block
 block discarded – undo
2838 2838
 		'date'			=> $post->post_date_gmt,
2839 2839
 		'modified'		=> $post->post_modified_gmt,
2840 2840
 		'mime_type'		=> $post->post_mime_type,
2841
-		'type'			=> acf_maybe_get( explode('/', $post->post_mime_type), 0, '' ),
2842
-		'icon'			=> wp_mime_type_icon( $id )
2841
+		'type'			=> acf_maybe_get(explode('/', $post->post_mime_type), 0, ''),
2842
+		'icon'			=> wp_mime_type_icon($id)
2843 2843
 	);
2844 2844
 	
2845 2845
 	
2846 2846
 	// video may use featured image
2847
-	if( $a['type'] === 'image' ) {
2847
+	if ($a['type'] === 'image') {
2848 2848
 		
2849 2849
 		$thumb_id = $id;
2850
-		$src = wp_get_attachment_image_src( $id, 'full' );
2850
+		$src = wp_get_attachment_image_src($id, 'full');
2851 2851
 		
2852 2852
 		$a['url'] = $src[0];
2853 2853
 		$a['width'] = $src[1];
2854 2854
 		$a['height'] = $src[2];
2855 2855
 		
2856 2856
 		
2857
-	} elseif( $a['type'] === 'audio' || $a['type'] === 'video' ) {
2857
+	} elseif ($a['type'] === 'audio' || $a['type'] === 'video') {
2858 2858
 		
2859 2859
 		// video dimentions
2860
-		if( $a['type'] == 'video' ) {
2860
+		if ($a['type'] == 'video') {
2861 2861
 			
2862
-			$meta = wp_get_attachment_metadata( $id );
2862
+			$meta = wp_get_attachment_metadata($id);
2863 2863
 			$a['width'] = acf_maybe_get($meta, 'width', 0);
2864 2864
 			$a['height'] = acf_maybe_get($meta, 'height', 0);
2865 2865
 		
@@ -2867,7 +2867,7 @@  discard block
 block discarded – undo
2867 2867
 		
2868 2868
 		
2869 2869
 		// feature image
2870
-		if( $featured_id = get_post_thumbnail_id($id) ) {
2870
+		if ($featured_id = get_post_thumbnail_id($id)) {
2871 2871
 		
2872 2872
 			$thumb_id = $featured_id;
2873 2873
 			
@@ -2877,22 +2877,22 @@  discard block
 block discarded – undo
2877 2877
 	
2878 2878
 	
2879 2879
 	// sizes
2880
-	if( $thumb_id ) {
2880
+	if ($thumb_id) {
2881 2881
 		
2882 2882
 		// find all image sizes
2883
-		if( $sizes = get_intermediate_image_sizes() ) {
2883
+		if ($sizes = get_intermediate_image_sizes()) {
2884 2884
 			
2885 2885
 			$a['sizes'] = array();
2886 2886
 			
2887
-			foreach( $sizes as $size ) {
2887
+			foreach ($sizes as $size) {
2888 2888
 				
2889 2889
 				// url
2890
-				$src = wp_get_attachment_image_src( $thumb_id, $size );
2890
+				$src = wp_get_attachment_image_src($thumb_id, $size);
2891 2891
 				
2892 2892
 				// add src
2893
-				$a['sizes'][ $size ] = $src[0];
2894
-				$a['sizes'][ $size . '-width' ] = $src[1];
2895
-				$a['sizes'][ $size . '-height' ] = $src[2];
2893
+				$a['sizes'][$size] = $src[0];
2894
+				$a['sizes'][$size.'-width'] = $src[1];
2895
+				$a['sizes'][$size.'-height'] = $src[2];
2896 2896
 				
2897 2897
 			}
2898 2898
 			
@@ -2921,19 +2921,19 @@  discard block
 block discarded – undo
2921 2921
 *  @return	(string)
2922 2922
 */
2923 2923
 
2924
-function acf_get_truncated( $text, $length = 64 ) {
2924
+function acf_get_truncated($text, $length = 64) {
2925 2925
 	
2926 2926
 	// vars
2927 2927
 	$text = trim($text);
2928
-	$the_length = strlen( $text );
2928
+	$the_length = strlen($text);
2929 2929
 	
2930 2930
 	
2931 2931
 	// cut
2932
-	$return = substr( $text, 0, ($length - 3) );
2932
+	$return = substr($text, 0, ($length - 3));
2933 2933
 	
2934 2934
 	
2935 2935
 	// ...
2936
-	if( $the_length > ($length - 3) ) {
2936
+	if ($the_length > ($length - 3)) {
2937 2937
 	
2938 2938
 		$return .= '...';
2939 2939
 		
@@ -2986,13 +2986,13 @@  discard block
 block discarded – undo
2986 2986
 	
2987 2987
 	
2988 2988
 	// handle sub folder
2989
-	if( !empty($bits[3]) ) {
2989
+	if ( ! empty($bits[3])) {
2990 2990
 		
2991
-		$find = '/' . $bits[3];
2991
+		$find = '/'.$bits[3];
2992 2992
 		$pos = strpos($url, $find);
2993 2993
 		$length = strlen($find);
2994 2994
 		
2995
-		if( $pos !== false ) {
2995
+		if ($pos !== false) {
2996 2996
 			
2997 2997
 		    $url = substr_replace($url, '', $pos, $length);
2998 2998
 		    
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
 
3023 3023
 function acf_current_user_can_admin() {
3024 3024
 	
3025
-	if( acf_get_setting('show_admin') && current_user_can(acf_get_setting('capability')) ) {
3025
+	if (acf_get_setting('show_admin') && current_user_can(acf_get_setting('capability'))) {
3026 3026
 		
3027 3027
 		return true;
3028 3028
 		
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
 *  @return	(int)
3049 3049
 */
3050 3050
 
3051
-function acf_get_filesize( $size = 1 ) {
3051
+function acf_get_filesize($size = 1) {
3052 3052
 	
3053 3053
 	// vars
3054 3054
 	$unit = 'MB';
@@ -3061,14 +3061,14 @@  discard block
 block discarded – undo
3061 3061
 	
3062 3062
 	
3063 3063
 	// look for $unit within the $size parameter (123 KB)
3064
-	if( is_string($size) ) {
3064
+	if (is_string($size)) {
3065 3065
 		
3066 3066
 		// vars
3067
-		$custom = strtoupper( substr($size, -2) );
3067
+		$custom = strtoupper(substr($size, -2));
3068 3068
 		
3069
-		foreach( $units as $k => $v ) {
3069
+		foreach ($units as $k => $v) {
3070 3070
 			
3071
-			if( $custom === $k ) {
3071
+			if ($custom === $k) {
3072 3072
 				
3073 3073
 				$unit = $k;
3074 3074
 				$size = substr($size, 0, -2);
@@ -3103,10 +3103,10 @@  discard block
 block discarded – undo
3103 3103
 *  @return	(int)
3104 3104
 */
3105 3105
 
3106
-function acf_format_filesize( $size = 1 ) {
3106
+function acf_format_filesize($size = 1) {
3107 3107
 	
3108 3108
 	// convert
3109
-	$bytes = acf_get_filesize( $size );
3109
+	$bytes = acf_get_filesize($size);
3110 3110
 	
3111 3111
 	
3112 3112
 	// vars
@@ -3119,13 +3119,13 @@  discard block
 block discarded – undo
3119 3119
 	
3120 3120
 	
3121 3121
 	// loop through units
3122
-	foreach( $units as $k => $v ) {
3122
+	foreach ($units as $k => $v) {
3123 3123
 		
3124 3124
 		$result = $bytes / pow(1024, $v);
3125 3125
 		
3126
-		if( $result >= 1 ) {
3126
+		if ($result >= 1) {
3127 3127
 			
3128
-			return $result . ' ' . $k;
3128
+			return $result.' '.$k;
3129 3129
 			
3130 3130
 		}
3131 3131
 		
@@ -3133,7 +3133,7 @@  discard block
 block discarded – undo
3133 3133
 	
3134 3134
 	
3135 3135
 	// return
3136
-	return $bytes . ' B';
3136
+	return $bytes.' B';
3137 3137
 		
3138 3138
 }
3139 3139
 
@@ -3152,10 +3152,10 @@  discard block
 block discarded – undo
3152 3152
 *  @return	$terms
3153 3153
 */
3154 3154
 
3155
-function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
3155
+function acf_get_valid_terms($terms = false, $taxonomy = 'category') {
3156 3156
 	
3157 3157
 	// bail early if function does not yet exist or
3158
-	if( !function_exists('wp_get_split_term') || empty($terms) ) {
3158
+	if ( ! function_exists('wp_get_split_term') || empty($terms)) {
3159 3159
 		
3160 3160
 		return $terms;
3161 3161
 		
@@ -3167,7 +3167,7 @@  discard block
 block discarded – undo
3167 3167
 	
3168 3168
 	
3169 3169
 	// force into array
3170
-	$terms = acf_get_array( $terms );
3170
+	$terms = acf_get_array($terms);
3171 3171
 	
3172 3172
 	
3173 3173
 	// force ints
@@ -3175,13 +3175,13 @@  discard block
 block discarded – undo
3175 3175
 	
3176 3176
 	
3177 3177
 	// attempt to find new terms
3178
-	foreach( $terms as $i => $term_id ) {
3178
+	foreach ($terms as $i => $term_id) {
3179 3179
 		
3180 3180
 		$new_term_id = wp_get_split_term($term_id, $taxonomy);
3181 3181
 		
3182
-		if( $new_term_id ) {
3182
+		if ($new_term_id) {
3183 3183
 			
3184
-			$terms[ $i ] = $new_term_id;
3184
+			$terms[$i] = $new_term_id;
3185 3185
 			
3186 3186
 		}
3187 3187
 		
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
 	
3190 3190
 	
3191 3191
 	// revert array if needed
3192
-	if( !$is_array ) {
3192
+	if ( ! $is_array) {
3193 3193
 		
3194 3194
 		$terms = $terms[0];
3195 3195
 		
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
 *  @return	$errors (array)
3265 3265
 */
3266 3266
 
3267
-function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
3267
+function acf_validate_attachment($attachment, $field, $context = 'prepare') {
3268 3268
 	
3269 3269
 	// vars
3270 3270
 	$errors = array();
@@ -3277,13 +3277,13 @@  discard block
 block discarded – undo
3277 3277
 	
3278 3278
 	
3279 3279
 	// upload
3280
-	if( $context == 'upload' ) {
3280
+	if ($context == 'upload') {
3281 3281
 		
3282 3282
 		// vars
3283 3283
 		$file['type'] = pathinfo($attachment['name'], PATHINFO_EXTENSION);
3284 3284
 		$file['size'] = filesize($attachment['tmp_name']);
3285 3285
 		
3286
-		if( strpos($attachment['type'], 'image') !== false ) {
3286
+		if (strpos($attachment['type'], 'image') !== false) {
3287 3287
 			
3288 3288
 			$size = getimagesize($attachment['tmp_name']);
3289 3289
 			$file['width'] = acf_maybe_get($size, 0);
@@ -3292,7 +3292,7 @@  discard block
 block discarded – undo
3292 3292
 		}
3293 3293
 	
3294 3294
 	// prepare
3295
-	} elseif( $context == 'prepare' ) {
3295
+	} elseif ($context == 'prepare') {
3296 3296
 		
3297 3297
 		$file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
3298 3298
 		$file['size'] = acf_maybe_get($attachment, 'filesizeInBytes', 0);
@@ -3308,23 +3308,23 @@  discard block
 block discarded – undo
3308 3308
 	
3309 3309
 	
3310 3310
 	// image
3311
-	if( $file['width'] || $file['height'] ) {
3311
+	if ($file['width'] || $file['height']) {
3312 3312
 		
3313 3313
 		// width
3314 3314
 		$min_width = (int) acf_maybe_get($field, 'min_width', 0);
3315 3315
 		$max_width = (int) acf_maybe_get($field, 'max_width', 0);
3316 3316
 		
3317
-		if( $file['width'] ) {
3317
+		if ($file['width']) {
3318 3318
 			
3319
-			if( $min_width && $file['width'] < $min_width ) {
3319
+			if ($min_width && $file['width'] < $min_width) {
3320 3320
 				
3321 3321
 				// min width
3322
-				$errors['min_width'] = sprintf(__('Image width must be at least %dpx.', 'acf'), $min_width );
3322
+				$errors['min_width'] = sprintf(__('Image width must be at least %dpx.', 'acf'), $min_width);
3323 3323
 				
3324
-			} elseif( $max_width && $file['width'] > $max_width ) {
3324
+			} elseif ($max_width && $file['width'] > $max_width) {
3325 3325
 				
3326 3326
 				// min width
3327
-				$errors['max_width'] = sprintf(__('Image width must not exceed %dpx.', 'acf'), $max_width );
3327
+				$errors['max_width'] = sprintf(__('Image width must not exceed %dpx.', 'acf'), $max_width);
3328 3328
 				
3329 3329
 			}
3330 3330
 			
@@ -3335,17 +3335,17 @@  discard block
 block discarded – undo
3335 3335
 		$min_height = (int) acf_maybe_get($field, 'min_height', 0);
3336 3336
 		$max_height = (int) acf_maybe_get($field, 'max_height', 0);
3337 3337
 		
3338
-		if( $file['height'] ) {
3338
+		if ($file['height']) {
3339 3339
 			
3340
-			if( $min_height && $file['height'] < $min_height ) {
3340
+			if ($min_height && $file['height'] < $min_height) {
3341 3341
 				
3342 3342
 				// min height
3343
-				$errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height );
3343
+				$errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height);
3344 3344
 				
3345
-			}  elseif( $max_height && $file['height'] > $max_height ) {
3345
+			}  elseif ($max_height && $file['height'] > $max_height) {
3346 3346
 				
3347 3347
 				// min height
3348
-				$errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height );
3348
+				$errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height);
3349 3349
 				
3350 3350
 			}
3351 3351
 			
@@ -3355,20 +3355,20 @@  discard block
 block discarded – undo
3355 3355
 	
3356 3356
 	
3357 3357
 	// file size
3358
-	if( $file['size'] ) {
3358
+	if ($file['size']) {
3359 3359
 		
3360 3360
 		$min_size = acf_maybe_get($field, 'min_size', 0);
3361 3361
 		$max_size = acf_maybe_get($field, 'max_size', 0);
3362 3362
 		
3363
-		if( $min_size && $file['size'] < acf_get_filesize($min_size) ) {
3363
+		if ($min_size && $file['size'] < acf_get_filesize($min_size)) {
3364 3364
 				
3365 3365
 			// min width
3366
-			$errors['min_size'] = sprintf(__('File size must be at least %s.', 'acf'), acf_format_filesize($min_size) );
3366
+			$errors['min_size'] = sprintf(__('File size must be at least %s.', 'acf'), acf_format_filesize($min_size));
3367 3367
 			
3368
-		} elseif( $max_size && $file['size'] > acf_get_filesize($max_size) ) {
3368
+		} elseif ($max_size && $file['size'] > acf_get_filesize($max_size)) {
3369 3369
 				
3370 3370
 			// min width
3371
-			$errors['max_size'] = sprintf(__('File size must must not exceed %s.', 'acf'), acf_format_filesize($max_size) );
3371
+			$errors['max_size'] = sprintf(__('File size must must not exceed %s.', 'acf'), acf_format_filesize($max_size));
3372 3372
 			
3373 3373
 		}
3374 3374
 	
@@ -3376,7 +3376,7 @@  discard block
 block discarded – undo
3376 3376
 	
3377 3377
 	
3378 3378
 	// file type
3379
-	if( $file['type'] ) {
3379
+	if ($file['type']) {
3380 3380
 		
3381 3381
 		$mime_types = acf_maybe_get($field, 'mime_types', '');
3382 3382
 		
@@ -3390,19 +3390,19 @@  discard block
 block discarded – undo
3390 3390
 		$mime_types = explode(',', $mime_types); // split pieces
3391 3391
 		$mime_types = array_filter($mime_types); // remove empty pieces
3392 3392
 		
3393
-		if( !empty($mime_types) && !in_array($file['type'], $mime_types) ) {
3393
+		if ( ! empty($mime_types) && ! in_array($file['type'], $mime_types)) {
3394 3394
 			
3395 3395
 			// glue together last 2 types
3396
-			if( count($mime_types) > 1 ) {
3396
+			if (count($mime_types) > 1) {
3397 3397
 				
3398 3398
 				$last1 = array_pop($mime_types);
3399 3399
 				$last2 = array_pop($mime_types);
3400 3400
 				
3401
-				$mime_types[] = $last2 . ' ' . __('or', 'acf') . ' ' . $last1;
3401
+				$mime_types[] = $last2.' '.__('or', 'acf').' '.$last1;
3402 3402
 				
3403 3403
 			}
3404 3404
 			
3405
-			$errors['mime_types'] = sprintf(__('File type must be %s.', 'acf'), implode(', ', $mime_types) );
3405
+			$errors['mime_types'] = sprintf(__('File type must be %s.', 'acf'), implode(', ', $mime_types));
3406 3406
 			
3407 3407
 		}
3408 3408
 				
@@ -3411,9 +3411,9 @@  discard block
 block discarded – undo
3411 3411
 	
3412 3412
 	// filter for 3rd party customization
3413 3413
 	$errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field);
3414
-	$errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field );
3415
-	$errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field );
3416
-	$errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field );
3414
+	$errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field);
3415
+	$errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field);
3416
+	$errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field);
3417 3417
 	
3418 3418
 	
3419 3419
 	// return
@@ -3437,10 +3437,10 @@  discard block
 block discarded – undo
3437 3437
 
3438 3438
 add_filter('acf/settings/uploader', '_acf_settings_uploader');
3439 3439
 
3440
-function _acf_settings_uploader( $uploader ) {
3440
+function _acf_settings_uploader($uploader) {
3441 3441
 	
3442 3442
 	// if can't upload files
3443
-	if( !current_user_can('upload_files') ) {
3443
+	if ( ! current_user_can('upload_files')) {
3444 3444
 		
3445 3445
 		$uploader = 'basic';
3446 3446
 		
@@ -3465,21 +3465,21 @@  discard block
 block discarded – undo
3465 3465
 *  @return	$post_id (int)
3466 3466
 */
3467 3467
 
3468
-function acf_translate_keys( $array, $keys ) {
3468
+function acf_translate_keys($array, $keys) {
3469 3469
 	
3470 3470
 	// bail early if no keys
3471
-	if( empty($keys) ) return $array;
3471
+	if (empty($keys)) return $array;
3472 3472
 	
3473 3473
 	
3474 3474
 	// translate
3475
-	foreach( $keys as $k ) {
3475
+	foreach ($keys as $k) {
3476 3476
 		
3477 3477
 		// bail ealry if not exists
3478
-		if( !isset($array[ $k ]) ) continue;
3478
+		if ( ! isset($array[$k])) continue;
3479 3479
 		
3480 3480
 		
3481 3481
 		// translate
3482
-		$array[ $k ] = acf_translate( $array[ $k ] );
3482
+		$array[$k] = acf_translate($array[$k]);
3483 3483
 		
3484 3484
 	}
3485 3485
 	
@@ -3504,18 +3504,18 @@  discard block
 block discarded – undo
3504 3504
 *  @return	$string
3505 3505
 */
3506 3506
 
3507
-function acf_translate( $string ) {
3507
+function acf_translate($string) {
3508 3508
 	
3509 3509
 	// bail early if not enabled
3510
-	if( !acf_get_setting('l10n') ) return $string;
3510
+	if ( ! acf_get_setting('l10n')) return $string;
3511 3511
 	
3512 3512
 	
3513 3513
 	// bail early if no textdomain
3514
-	if( !acf_get_setting('l10n_textdomain') ) return $string;
3514
+	if ( ! acf_get_setting('l10n_textdomain')) return $string;
3515 3515
 	
3516 3516
 	
3517 3517
 	// is array
3518
-	if( is_array($string) ) {
3518
+	if (is_array($string)) {
3519 3519
 		
3520 3520
 		return array_map('acf_translate', $string);
3521 3521
 		
@@ -3523,23 +3523,23 @@  discard block
 block discarded – undo
3523 3523
 	
3524 3524
 	
3525 3525
 	// bail early if not string
3526
-	if( !is_string($string) ) return $string;
3526
+	if ( ! is_string($string)) return $string;
3527 3527
 	
3528 3528
 	
3529 3529
 	// bail early if empty
3530
-	if( $string === '' ) return $string;
3530
+	if ($string === '') return $string;
3531 3531
 	
3532 3532
 	
3533 3533
 	// allow for var_export export
3534
-	if( acf_get_setting('l10n_var_export') ){
3534
+	if (acf_get_setting('l10n_var_export')) {
3535 3535
 		
3536
-		return "!!__(!!'" .  $string . "!!', !!'" . acf_get_setting('l10n_textdomain') . "!!')!!";
3536
+		return "!!__(!!'".$string."!!', !!'".acf_get_setting('l10n_textdomain')."!!')!!";
3537 3537
 			
3538 3538
 	}
3539 3539
 	
3540 3540
 	
3541 3541
 	// vars
3542
-	return __( $string, acf_get_setting('l10n_textdomain') );
3542
+	return __($string, acf_get_setting('l10n_textdomain'));
3543 3543
 	
3544 3544
 }
3545 3545
 
@@ -3557,17 +3557,17 @@  discard block
 block discarded – undo
3557 3557
 *  @return	$post_id (int)
3558 3558
 */
3559 3559
 
3560
-function acf_maybe_add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
3560
+function acf_maybe_add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
3561 3561
 	
3562 3562
 	// if action has already run, execute it
3563
-	if( did_action($tag) ) {
3563
+	if (did_action($tag)) {
3564 3564
 			
3565
-		call_user_func( $function_to_add );
3565
+		call_user_func($function_to_add);
3566 3566
 	
3567 3567
 	// if action has not yet run, add it
3568 3568
 	} else {
3569 3569
 		
3570
-		add_action( $tag, $function_to_add, $priority, $accepted_args );
3570
+		add_action($tag, $function_to_add, $priority, $accepted_args);
3571 3571
 		
3572 3572
 	}
3573 3573
 	
@@ -3589,7 +3589,7 @@  discard block
 block discarded – undo
3589 3589
 
3590 3590
 add_filter("acf/settings/slug", '_acf_settings_slug');
3591 3591
 
3592
-function _acf_settings_slug( $v ) {
3592
+function _acf_settings_slug($v) {
3593 3593
 	
3594 3594
 	$basename = acf_get_setting('basename');
3595 3595
     $slug = explode('/', $basename);
Please login to merge, or discard this patch.
Braces   +26 added lines, -10 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.