Completed
Push — master ( af0f5c...e208fb )
by Md. Mozahidur
03:34
created
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.
includes/acf/api/api-template.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -15,6 +15,9 @@  discard block
 block discarded – undo
15 15
 *  @return	$reference (string)	a string containing the field_key
16 16
 */
17 17
 
18
+/**
19
+ * @return string
20
+ */
18 21
 function acf_get_field_reference( $field_name, $post_id ) {
19 22
 	
20 23
 	// try cache
@@ -857,6 +860,9 @@  discard block
 block discarded – undo
857 860
 *  @return	(array)	
858 861
 */
859 862
 
863
+/**
864
+ * @param string $selector
865
+ */
860 866
 function get_sub_field_object( $selector, $format_value = true, $load_value = true ) {
861 867
 	
862 868
 	// vars
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -994,23 +994,23 @@
 block discarded – undo
994 994
 	if( acf_verify_nonce('acf_form') ) {
995 995
 		
996 996
 		// validate data
997
-	    if( acf_validate_save_post(true) ) {
997
+		if( acf_validate_save_post(true) ) {
998 998
 	    	
999
-	    	// form
1000
-	    	$GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form');
1001
-	    	$GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true);
999
+			// form
1000
+			$GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form');
1001
+			$GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true);
1002 1002
 	    	
1003 1003
 	    	
1004
-	    	// validate
1005
-	    	if( empty($GLOBALS['acf_form']) ) {
1004
+			// validate
1005
+			if( empty($GLOBALS['acf_form']) ) {
1006 1006
 		    	
1007
-		    	return;
1007
+				return;
1008 1008
 		    	
1009
-	    	}
1009
+			}
1010 1010
 	    	
1011 1011
 	    	
1012
-	    	// vars
1013
-	    	$post_id = acf_maybe_get( $GLOBALS['acf_form'], 'post_id', 0 );
1012
+			// vars
1013
+			$post_id = acf_maybe_get( $GLOBALS['acf_form'], 'post_id', 0 );
1014 1014
 			
1015 1015
 			
1016 1016
 			// allow for custom save
Please login to merge, or discard this patch.
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 *  @return	$reference (string)	a string containing the field_key
16 16
 */
17 17
 
18
-function acf_get_field_reference( $field_name, $post_id ) {
18
+function acf_get_field_reference($field_name, $post_id) {
19 19
 	
20 20
 	// try cache
21 21
 	$found = false;
22
-	$cache = wp_cache_get( "field_reference/post_id={$post_id}/name={$field_name}", 'acf', false, $found );
22
+	$cache = wp_cache_get("field_reference/post_id={$post_id}/name={$field_name}", 'acf', false, $found);
23 23
 	
24
-	if( $found ) {
24
+	if ($found) {
25 25
 		
26 26
 		return $cache;
27 27
 		
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 			
30 30
 	
31 31
 	// get reference
32
-	$reference = acf_get_metadata( $post_id, $field_name, true );
32
+	$reference = acf_get_metadata($post_id, $field_name, true);
33 33
 	
34 34
 	
35 35
 	//update cache
36
-	wp_cache_set( "field_reference/post_id={$post_id}/name={$field_name}", $reference, 'acf' );
36
+	wp_cache_set("field_reference/post_id={$post_id}/name={$field_name}", $reference, 'acf');
37 37
 	
38 38
 	
39 39
 	// return
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 *  @return	n/a
57 57
 */
58 58
 
59
-function the_field( $selector, $post_id = false, $format_value = true ) {
59
+function the_field($selector, $post_id = false, $format_value = true) {
60 60
 	
61 61
 	$value = get_field($selector, $post_id, $format_value);
62 62
 	
63
-	if( is_array($value) ) {
63
+	if (is_array($value)) {
64 64
 		
65
-		$value = @implode( ', ', $value );
65
+		$value = @implode(', ', $value);
66 66
 		
67 67
 	}
68 68
 	
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 *  @return	(mixed)
89 89
 */
90 90
  
91
-function get_field( $selector, $post_id = false, $format_value = true ) {
91
+function get_field($selector, $post_id = false, $format_value = true) {
92 92
 	
93 93
 	// filter post_id
94
-	$post_id = acf_get_valid_post_id( $post_id );
94
+	$post_id = acf_get_valid_post_id($post_id);
95 95
 	
96 96
 	
97 97
 	// get field
98
-	$field = acf_maybe_get_field( $selector, $post_id );
98
+	$field = acf_maybe_get_field($selector, $post_id);
99 99
 	
100 100
 	
101 101
 	// create dummy field
102
-	if( !$field ) {
102
+	if ( ! $field) {
103 103
 		
104 104
 		$field = acf_get_valid_field(array(
105 105
 			'name'	=> $selector,
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	
116 116
 	
117 117
 	// get value for field
118
-	$value = acf_get_value( $post_id, $field );
118
+	$value = acf_get_value($post_id, $field);
119 119
 	
120 120
 	
121 121
 	// format value
122
-	if( $format_value ) {
122
+	if ($format_value) {
123 123
 		
124 124
 		// get value for field
125
-		$value = acf_format_value( $value, $post_id, $field );
125
+		$value = acf_format_value($value, $post_id, $field);
126 126
 		
127 127
 	}
128 128
 	
@@ -149,26 +149,26 @@  discard block
 block discarded – undo
149 149
 *  @return	$field (array)
150 150
 */
151 151
 
152
-function get_field_object( $selector, $post_id = false, $format_value = true, $load_value = true ) {
152
+function get_field_object($selector, $post_id = false, $format_value = true, $load_value = true) {
153 153
 	
154 154
 	// compatibilty
155
-	if( is_array($format_value) ) {
155
+	if (is_array($format_value)) {
156 156
 		
157
-		extract( $format_value );
157
+		extract($format_value);
158 158
 		
159 159
 	}
160 160
 	
161 161
 	
162 162
 	// get valid post_id
163
-	$post_id = acf_get_valid_post_id( $post_id );
163
+	$post_id = acf_get_valid_post_id($post_id);
164 164
 	
165 165
 	
166 166
 	// get field key
167
-	$field = acf_maybe_get_field( $selector, $post_id );
167
+	$field = acf_maybe_get_field($selector, $post_id);
168 168
 	
169 169
 	
170 170
 	// bail early if no field found
171
-	if( !$field ) {
171
+	if ( ! $field) {
172 172
 		
173 173
 		return false;
174 174
 		
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 	
177 177
 	
178 178
 	// load value
179
-	if( $load_value ) {
179
+	if ($load_value) {
180 180
 	
181
-		$field['value'] = acf_get_value( $post_id, $field );
181
+		$field['value'] = acf_get_value($post_id, $field);
182 182
 		
183 183
 	}
184 184
 	
185 185
 	
186 186
 	// format value
187
-	if( $format_value ) {
187
+	if ($format_value) {
188 188
 		
189 189
 		// get value for field
190
-		$field['value'] = acf_format_value( $field['value'], $post_id, $field );
190
+		$field['value'] = acf_format_value($field['value'], $post_id, $field);
191 191
 		
192 192
 	}
193 193
 	
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 *  @return	(array)	associative array where field name => field value
214 214
 */
215 215
 
216
-function get_fields( $post_id = false, $format_value = true ) {
216
+function get_fields($post_id = false, $format_value = true) {
217 217
 	
218 218
 	// vars
219
-	$fields = get_field_objects( $post_id, $format_value );
219
+	$fields = get_field_objects($post_id, $format_value);
220 220
 	$return = array();
221 221
 	
222 222
 	
223 223
 	// populate
224
-	if( is_array($fields) ) {
224
+	if (is_array($fields)) {
225 225
 		
226
-		foreach( $fields as $k => $field ) {
226
+		foreach ($fields as $k => $field) {
227 227
 		
228
-			$return[ $k ] = $field['value'];
228
+			$return[$k] = $field['value'];
229 229
 			
230 230
 		}
231 231
 		
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
 *  @return	(array)	associative array where field name => field
254 254
 */
255 255
 
256
-function get_field_objects( $post_id = false, $format_value = true, $load_value = true ) {
256
+function get_field_objects($post_id = false, $format_value = true, $load_value = true) {
257 257
 	
258 258
 	// global
259 259
 	global $wpdb;
260 260
 	
261 261
 	
262 262
 	// filter post_id
263
-	$post_id = acf_get_valid_post_id( $post_id );
263
+	$post_id = acf_get_valid_post_id($post_id);
264 264
 
265 265
 
266 266
 	// vars
@@ -269,35 +269,35 @@  discard block
 block discarded – undo
269 269
 	
270 270
 				
271 271
 	// get field_names
272
-	if( is_numeric($post_id) ) {
272
+	if (is_numeric($post_id)) {
273 273
 		
274
-		$meta = get_post_meta( $post_id );
274
+		$meta = get_post_meta($post_id);
275 275
 	
276
-	} elseif( strpos($post_id, 'user_') !== false ) {
276
+	} elseif (strpos($post_id, 'user_') !== false) {
277 277
 		
278 278
 		$user_id = (int) str_replace('user_', '', $post_id);
279 279
 		
280
-		$meta = get_user_meta( $user_id );
280
+		$meta = get_user_meta($user_id);
281 281
 		
282
-	} elseif( strpos($post_id, 'comment_') !== false ) {
282
+	} elseif (strpos($post_id, 'comment_') !== false) {
283 283
 		
284 284
 		$comment_id = (int) str_replace('comment_', '', $post_id);
285 285
 		
286
-		$meta = get_comment_meta( $comment_id );
286
+		$meta = get_comment_meta($comment_id);
287 287
 		
288 288
 	} else {
289 289
 		
290 290
 		$rows = $wpdb->get_results($wpdb->prepare(
291 291
 			"SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE %s OR option_name LIKE %s",
292
-			$post_id . '_%' ,
293
-			'_' . $post_id . '_%' 
292
+			$post_id.'_%',
293
+			'_'.$post_id.'_%' 
294 294
 		), ARRAY_A);
295 295
 		
296
-		if( !empty($rows) ) {
296
+		if ( ! empty($rows)) {
297 297
 			
298
-			foreach( $rows as $row ) {
298
+			foreach ($rows as $row) {
299 299
 				
300
-				$meta[ $row['option_name'] ][] = $row['option_value'];
300
+				$meta[$row['option_name']][] = $row['option_value'];
301 301
 				
302 302
 			}
303 303
 			
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	
308 308
 	
309 309
 	// bail early if no meta
310
-	if( empty($meta) ) {
310
+	if (empty($meta)) {
311 311
 		
312 312
 		return false;
313 313
 		
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 	
316 316
 	
317 317
 	// populate vars
318
-	foreach( $meta as $k => $v ) {
318
+	foreach ($meta as $k => $v) {
319 319
 		
320 320
 		// Hopefuly improve efficiency: bail early if $k does start with an '_'
321
-		if( $k[0] === '_' ) {
321
+		if ($k[0] === '_') {
322 322
 			
323 323
 			continue;
324 324
 			
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		
327 327
 		
328 328
 		// does a field key exist for this value?
329
-		if( !array_key_exists("_{$k}", $meta) ) {
329
+		if ( ! array_key_exists("_{$k}", $meta)) {
330 330
 			
331 331
 			continue;
332 332
 			
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 		
336 336
 		// get field
337 337
 		$field_key = $meta["_{$k}"][0];
338
-		$field = acf_get_field( $field_key );
338
+		$field = acf_get_field($field_key);
339 339
 		
340 340
 		
341 341
 		// bail early if not a parent field
342
-		if( !$field || acf_is_sub_field($field) ) {
342
+		if ( ! $field || acf_is_sub_field($field)) {
343 343
 			
344 344
 			continue;
345 345
 			
@@ -347,30 +347,30 @@  discard block
 block discarded – undo
347 347
 		
348 348
 		
349 349
 		// load value
350
-		if( $load_value ) {
350
+		if ($load_value) {
351 351
 		
352
-			$field['value'] = acf_get_value( $post_id, $field );
352
+			$field['value'] = acf_get_value($post_id, $field);
353 353
 			
354 354
 		}
355 355
 		
356 356
 		
357 357
 		// format value
358
-		if( $format_value ) {
358
+		if ($format_value) {
359 359
 			
360 360
 			// get value for field
361
-			$field['value'] = acf_format_value( $field['value'], $post_id, $field );
361
+			$field['value'] = acf_format_value($field['value'], $post_id, $field);
362 362
 			
363 363
 		}
364 364
 		
365 365
 					
366 366
 		// append to $value
367
-		$fields[ $field['name'] ] = $field;
367
+		$fields[$field['name']] = $field;
368 368
 		
369 369
 	}
370 370
  	
371 371
  	 	
372 372
 	// no value
373
-	if( empty($fields) ) {
373
+	if (empty($fields)) {
374 374
 	
375 375
 		return false;
376 376
 	
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 *  @return	(boolean)
398 398
 */
399 399
 
400
-function have_rows( $selector, $post_id = false ) {
400
+function have_rows($selector, $post_id = false) {
401 401
 	
402 402
 	// vars
403 403
 	$row = array();
@@ -412,14 +412,14 @@  discard block
 block discarded – undo
412 412
 	
413 413
 	
414 414
 	// filter post_id
415
-	$post_id = acf_get_valid_post_id( $post_id );
415
+	$post_id = acf_get_valid_post_id($post_id);
416 416
 	
417 417
 	
418 418
 	// empty?
419
-	if( empty($GLOBALS['acf_field']) ) {
419
+	if (empty($GLOBALS['acf_field'])) {
420 420
 		
421 421
 		// reset
422
-		reset_rows( true );
422
+		reset_rows(true);
423 423
 		
424 424
 		
425 425
 		// create a new loop
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
 	} else {
429 429
 		
430 430
 		// vars
431
-		$row = end( $GLOBALS['acf_field'] );
432
-		$prev = prev( $GLOBALS['acf_field'] );
431
+		$row = end($GLOBALS['acf_field']);
432
+		$prev = prev($GLOBALS['acf_field']);
433 433
 		$change = false;
434 434
 		
435 435
 		
436 436
 		// detect change
437
-		if( $post_id != $row['post_id'] ) {
437
+		if ($post_id != $row['post_id']) {
438 438
 			
439 439
 			$change = 'post_id';
440 440
 				
441
-		} elseif( $selector != $row['selector'] ) {
441
+		} elseif ($selector != $row['selector']) {
442 442
 			
443 443
 			$change = 'selector';
444 444
 				
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
 		
447 447
 		
448 448
 		// attempt to find sub field
449
-		if( $change ) {
449
+		if ($change) {
450 450
 			
451 451
 			$sub_field = acf_get_sub_field($selector, $row['field']);
452 452
 			
453
-			if( $sub_field ) {
453
+			if ($sub_field) {
454 454
 				
455
-				$sub_exists = isset($row['value'][ $row['i'] ][ $sub_field['key'] ]);
455
+				$sub_exists = isset($row['value'][$row['i']][$sub_field['key']]);
456 456
 				
457 457
 			}
458 458
 			
@@ -460,15 +460,15 @@  discard block
 block discarded – undo
460 460
 		
461 461
 		
462 462
 		// If post_id has changed, this is most likely an archive loop
463
-		if( $change == 'post_id' ) {
463
+		if ($change == 'post_id') {
464 464
 			
465
-			if( empty($_post_id) && $sub_exists ) {
465
+			if (empty($_post_id) && $sub_exists) {
466 466
 				
467 467
 				// case: Change in $post_id was due to this being a nested loop and not specifying the $post_id
468 468
 				// action: move down one level into a new loop
469 469
 				$new_child_loop = true;
470 470
 			
471
-			} elseif( $prev && $prev['post_id'] == $post_id ) {
471
+			} elseif ($prev && $prev['post_id'] == $post_id) {
472 472
 				
473 473
 				// case: Change in $post_id was due to a nested loop ending
474 474
 				// action: move up one level through the loops
@@ -482,15 +482,15 @@  discard block
 block discarded – undo
482 482
 				
483 483
 			}
484 484
 			
485
-		} elseif( $change == 'selector' ) {
485
+		} elseif ($change == 'selector') {
486 486
 			
487
-			if( $prev && $prev['selector'] == $selector && $prev['post_id'] == $post_id ) {
487
+			if ($prev && $prev['selector'] == $selector && $prev['post_id'] == $post_id) {
488 488
 				
489 489
 				// case: Change in $field_name was due to a nested loop ending
490 490
 				// action: move up one level through the loops
491 491
 				reset_rows();
492 492
 				
493
-			} elseif( $sub_exists ) {
493
+			} elseif ($sub_exists) {
494 494
 				
495 495
 				// case: Change in $field_name was due to this being a nested loop
496 496
 				// action: move down one level into a new loop
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 	}
510 510
 	
511 511
 	
512
-	if( $new_parent_loop ) {
512
+	if ($new_parent_loop) {
513 513
 		
514 514
 		// vars
515
-		$field = get_field_object( $selector, $post_id, false );
516
-		$value = acf_extract_var( $field, 'value' );
515
+		$field = get_field_object($selector, $post_id, false);
516
+		$value = acf_extract_var($field, 'value');
517 517
 		
518 518
 		
519 519
 		// add row
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
 			'post_id'	=> $post_id,
527 527
 		);
528 528
 		
529
-	} elseif( $new_child_loop ) {
529
+	} elseif ($new_child_loop) {
530 530
 		
531 531
 		// vars
532
-		$value = $row['value'][ $row['i'] ][ $sub_field['key'] ];
532
+		$value = $row['value'][$row['i']][$sub_field['key']];
533 533
 		
534 534
 		$GLOBALS['acf_field'][] = array(
535 535
 			'selector'	=> $selector,
536
-			'name'		=> $row['name'] . '_' . $row['i'], // used by update_sub_field
536
+			'name'		=> $row['name'].'_'.$row['i'], // used by update_sub_field
537 537
 			'value'		=> $value,
538 538
 			'field'		=> $sub_field,
539 539
 			'i'			=> -1,
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
 	
545 545
 	
546 546
 	// update vars
547
-	$row = end( $GLOBALS['acf_field'] );
547
+	$row = end($GLOBALS['acf_field']);
548 548
 	
549 549
 	
550 550
 	
551 551
 	// return true if next row exists
552
-	if( is_array($row['value']) && array_key_exists($row['i']+1, $row['value']) ) {
552
+	if (is_array($row['value']) && array_key_exists($row['i'] + 1, $row['value'])) {
553 553
 		
554 554
 		return true;
555 555
 		
@@ -579,29 +579,29 @@  discard block
 block discarded – undo
579 579
 *  @return	(array) the current row data
580 580
 */
581 581
 
582
-function the_row( $format = false ) {
582
+function the_row($format = false) {
583 583
 	
584 584
 	// vars
585 585
 	$depth = count($GLOBALS['acf_field']) - 1;
586 586
 
587 587
 	
588 588
 	// increase i of current row
589
-	$GLOBALS['acf_field'][ $depth ]['i']++;
589
+	$GLOBALS['acf_field'][$depth]['i']++;
590 590
 	
591 591
 	
592 592
 	// return
593
-	return get_row( $format );
593
+	return get_row($format);
594 594
 	
595 595
 }
596 596
 
597
-function get_row( $format = false ) {
597
+function get_row($format = false) {
598 598
 	
599 599
 	// vars
600 600
 	$row = acf_get_row();
601 601
 	
602 602
 	
603 603
 	// bail early if no row
604
-	if( !$row ) {
604
+	if ( ! $row) {
605 605
 		
606 606
 		return false;
607 607
 		
@@ -609,17 +609,17 @@  discard block
 block discarded – undo
609 609
 	
610 610
 	
611 611
 	// get value
612
-	$value = $row['value'][ $row['i'] ];
612
+	$value = $row['value'][$row['i']];
613 613
 	
614 614
 	
615 615
 	// format
616
-	if( $format ) {
616
+	if ($format) {
617 617
 		
618 618
 		// temp wrap value in array
619
-		$value = array( $value );
619
+		$value = array($value);
620 620
 		
621 621
 		// format the value (1 row of data)
622
-		$value = acf_format_value( $value, $row['post_id'], $row['field'] );
622
+		$value = acf_format_value($value, $row['post_id'], $row['field']);
623 623
 		
624 624
 		// extract value from array
625 625
 		$value = $value[0];
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
 function acf_get_row() {
636 636
 	
637 637
 	// check and return row
638
-	if( !empty($GLOBALS['acf_field']) ) {
638
+	if ( ! empty($GLOBALS['acf_field'])) {
639 639
 		
640
-		return end( $GLOBALS['acf_field'] );
640
+		return end($GLOBALS['acf_field']);
641 641
 		
642 642
 	}
643 643
 	
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	
655 655
 	
656 656
 	// bail early if no row
657
-	if( !$row ) return 0;
657
+	if ( ! $row) return 0;
658 658
 	
659 659
 	
660 660
 	// return
@@ -677,21 +677,21 @@  discard block
 block discarded – undo
677 677
 *  @return	(boolean)
678 678
 */
679 679
 
680
-function reset_rows( $hard_reset = false ) {
680
+function reset_rows($hard_reset = false) {
681 681
 	
682 682
 	// completely destroy?
683
-	if( $hard_reset )
683
+	if ($hard_reset)
684 684
 	{
685 685
 		$GLOBALS['acf_field'] = array();
686 686
 	}
687 687
 	else
688 688
 	{
689 689
 		// vars
690
-		$depth = count( $GLOBALS['acf_field'] ) - 1;
690
+		$depth = count($GLOBALS['acf_field']) - 1;
691 691
 		
692 692
 		
693 693
 		// remove
694
-		unset( $GLOBALS['acf_field'][$depth] );
694
+		unset($GLOBALS['acf_field'][$depth]);
695 695
 		
696 696
 		
697 697
 		// refresh index
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 *  @return	(boolean)
723 723
 */
724 724
 
725
-function has_sub_field( $field_name, $post_id = false ) {
725
+function has_sub_field($field_name, $post_id = false) {
726 726
 	
727 727
 	// vars
728
-	$r = have_rows( $field_name, $post_id );
728
+	$r = have_rows($field_name, $post_id);
729 729
 	
730 730
 	
731 731
 	// if has rows, progress through 1 row for the while loop to work
732
-	if( $r ) {
732
+	if ($r) {
733 733
 		
734 734
 		the_row();
735 735
 		
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
 	
742 742
 }
743 743
 
744
-function has_sub_fields( $field_name, $post_id = false ) {
744
+function has_sub_fields($field_name, $post_id = false) {
745 745
 	
746
-	return has_sub_field( $field_name, $post_id );
746
+	return has_sub_field($field_name, $post_id);
747 747
 	
748 748
 }
749 749
 
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 *  @return	(mixed)
762 762
 */
763 763
 
764
-function get_sub_field( $selector, $format_value = true ) {
764
+function get_sub_field($selector, $format_value = true) {
765 765
 	
766 766
 	// vars
767 767
 	$row = acf_get_row();
768 768
 	
769 769
 	
770 770
 	// bail early if no row
771
-	if( !$row ) {
771
+	if ( ! $row) {
772 772
 		
773 773
 		return false;
774 774
 		
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	
781 781
 	
782 782
 	// update selector
783
-	if( $sub_field ) {
783
+	if ($sub_field) {
784 784
 		
785 785
 		$selector = $sub_field['key'];
786 786
 		
@@ -792,16 +792,16 @@  discard block
 block discarded – undo
792 792
 	
793 793
 	
794 794
 	// return value
795
-	if( isset($row['value'][ $row['i'] ][ $selector ]) ) {
795
+	if (isset($row['value'][$row['i']][$selector])) {
796 796
 		
797 797
 		// get
798
-		$value = $row['value'][ $row['i'] ][ $selector ];
798
+		$value = $row['value'][$row['i']][$selector];
799 799
 		
800 800
 		
801 801
 		// format
802
-		if( $format_value ) {
802
+		if ($format_value) {
803 803
 			
804
-			$value = acf_format_value( $value, $row['post_id'], $sub_field );
804
+			$value = acf_format_value($value, $row['post_id'], $sub_field);
805 805
 			
806 806
 		}
807 807
 		
@@ -830,13 +830,13 @@  discard block
 block discarded – undo
830 830
 *  @return	n/a
831 831
 */
832 832
 
833
-function the_sub_field( $field_name, $format_value = true ) {
833
+function the_sub_field($field_name, $format_value = true) {
834 834
 	
835
-	$value = get_sub_field( $field_name, $format_value );
835
+	$value = get_sub_field($field_name, $format_value);
836 836
 	
837
-	if( is_array($value) ) {
837
+	if (is_array($value)) {
838 838
 		
839
-		$value = implode(', ',$value);
839
+		$value = implode(', ', $value);
840 840
 		
841 841
 	}
842 842
 	
@@ -857,14 +857,14 @@  discard block
 block discarded – undo
857 857
 *  @return	(array)	
858 858
 */
859 859
 
860
-function get_sub_field_object( $selector, $format_value = true, $load_value = true ) {
860
+function get_sub_field_object($selector, $format_value = true, $load_value = true) {
861 861
 	
862 862
 	// vars
863 863
 	$row = acf_get_row();
864 864
 	
865 865
 	
866 866
 	// bail early if no row
867
-	if( !$row ) {
867
+	if ( ! $row) {
868 868
 		
869 869
 		return false;
870 870
 		
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
 
877 877
 	
878 878
 	// get sub field
879
-	$sub_field = acf_get_sub_field( $selector, $parent );
879
+	$sub_field = acf_get_sub_field($selector, $parent);
880 880
 	
881 881
 	
882 882
 	// bail early if no sub field
883
-	if( !$sub_field ) {
883
+	if ( ! $sub_field) {
884 884
 		
885 885
 		return false;
886 886
 		
@@ -888,9 +888,9 @@  discard block
 block discarded – undo
888 888
 	
889 889
 	
890 890
 	// load value
891
-	if( $load_value ) {
891
+	if ($load_value) {
892 892
 	
893
-		$sub_field['value'] = get_sub_field( $sub_field['name'], $format_value );
893
+		$sub_field['value'] = get_sub_field($sub_field['name'], $format_value);
894 894
 		
895 895
 	}
896 896
 	
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	
922 922
 	
923 923
 	// return
924
-	if( isset($row['acf_fc_layout']) ) {
924
+	if (isset($row['acf_fc_layout'])) {
925 925
 		
926 926
 		return $row['acf_fc_layout'];
927 927
 		
@@ -950,29 +950,29 @@  discard block
 block discarded – undo
950 950
 *  @return	(string)
951 951
 */
952 952
 
953
-function acf_shortcode( $atts )
953
+function acf_shortcode($atts)
954 954
 {
955 955
 	// extract attributs
956
-	extract( shortcode_atts( array(
956
+	extract(shortcode_atts(array(
957 957
 		'field'			=> '',
958 958
 		'post_id'		=> false,
959 959
 		'format_value'	=> true
960
-	), $atts ) );
960
+	), $atts));
961 961
 	
962 962
 	
963 963
 	// get value and return it
964
-	$value = get_field( $field, $post_id, $format_value );
964
+	$value = get_field($field, $post_id, $format_value);
965 965
 	
966 966
 	
967
-	if( is_array($value) )
967
+	if (is_array($value))
968 968
 	{
969
-		$value = @implode( ', ', $value );
969
+		$value = @implode(', ', $value);
970 970
 	}
971 971
 	
972 972
 	
973 973
 	return $value;
974 974
 }
975
-add_shortcode( 'acf', 'acf_shortcode' );
975
+add_shortcode('acf', 'acf_shortcode');
976 976
 
977 977
 
978 978
 /*
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 function acf_form_head() {
992 992
 	
993 993
 	// verify nonce
994
-	if( acf_verify_nonce('acf_form') ) {
994
+	if (acf_verify_nonce('acf_form')) {
995 995
 		
996 996
 		// validate data
997
-	    if( acf_validate_save_post(true) ) {
997
+	    if (acf_validate_save_post(true)) {
998 998
 	    	
999 999
 	    	// form
1000 1000
 	    	$GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form');
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 	    	
1003 1003
 	    	
1004 1004
 	    	// validate
1005
-	    	if( empty($GLOBALS['acf_form']) ) {
1005
+	    	if (empty($GLOBALS['acf_form'])) {
1006 1006
 		    	
1007 1007
 		    	return;
1008 1008
 		    	
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	    	
1011 1011
 	    	
1012 1012
 	    	// vars
1013
-	    	$post_id = acf_maybe_get( $GLOBALS['acf_form'], 'post_id', 0 );
1013
+	    	$post_id = acf_maybe_get($GLOBALS['acf_form'], 'post_id', 0);
1014 1014
 			
1015 1015
 			
1016 1016
 			// allow for custom save
@@ -1018,22 +1018,22 @@  discard block
 block discarded – undo
1018 1018
 			
1019 1019
 			
1020 1020
 			// save
1021
-			acf_save_post( $post_id );
1021
+			acf_save_post($post_id);
1022 1022
 			
1023 1023
 			
1024 1024
 			// vars
1025
-			$return = acf_maybe_get( $GLOBALS['acf_form'], 'return', '' );
1025
+			$return = acf_maybe_get($GLOBALS['acf_form'], 'return', '');
1026 1026
 			
1027 1027
 			
1028 1028
 			// redirect
1029
-			if( $return ) {
1029
+			if ($return) {
1030 1030
 				
1031 1031
 				// update %placeholders%
1032 1032
 				$return = str_replace('%post_url%', get_permalink($post_id), $return);
1033 1033
 				
1034 1034
 				
1035 1035
 				// redirect
1036
-				wp_redirect( $return );
1036
+				wp_redirect($return);
1037 1037
 				exit;
1038 1038
 			}
1039 1039
 			
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 function _validate_save_post() {
1069 1069
 	
1070 1070
 	// save post_title
1071
-	if( isset($_POST['acf']['_post_title']) ) {
1071
+	if (isset($_POST['acf']['_post_title'])) {
1072 1072
 		
1073 1073
 		// get field
1074 1074
 		$field = acf_get_valid_field(array(
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 		
1081 1081
 		
1082 1082
 		// validate
1083
-		acf_validate_value( $_POST['acf']['_post_title'], $field, "acf[_post_title]" );
1083
+		acf_validate_value($_POST['acf']['_post_title'], $field, "acf[_post_title]");
1084 1084
 	
1085 1085
 	}
1086 1086
 	
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 add_filter('acf/pre_save_post', '_acf_pre_save_post', 0, 2);
1104 1104
 
1105
-function _acf_pre_save_post( $post_id, $form ) {
1105
+function _acf_pre_save_post($post_id, $form) {
1106 1106
 	
1107 1107
 	// vars
1108 1108
 	$save = array(
@@ -1111,15 +1111,15 @@  discard block
 block discarded – undo
1111 1111
 	
1112 1112
 	
1113 1113
 	// determine save data
1114
-	if( is_numeric($post_id) ) {
1114
+	if (is_numeric($post_id)) {
1115 1115
 		
1116 1116
 		// update post
1117 1117
 		$save['ID'] = $post_id;
1118 1118
 		
1119
-	} elseif( $post_id == 'new_post' ) {
1119
+	} elseif ($post_id == 'new_post') {
1120 1120
 		
1121 1121
 		// new post
1122
-		$form['new_post'] = acf_parse_args( $form['new_post'], array(
1122
+		$form['new_post'] = acf_parse_args($form['new_post'], array(
1123 1123
 			'post_type' 	=> 'post',
1124 1124
 			'post_status'	=> 'draft',
1125 1125
 		));
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 	
1138 1138
 	
1139 1139
 	// save post_title
1140
-	if( isset($_POST['acf']['_post_title']) ) {
1140
+	if (isset($_POST['acf']['_post_title'])) {
1141 1141
 		
1142 1142
 		$save['post_title'] = acf_extract_var($_POST['acf'], '_post_title');
1143 1143
 	
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 	
1146 1146
 	
1147 1147
 	// save post_content
1148
-	if( isset($_POST['acf']['_post_content']) ) {
1148
+	if (isset($_POST['acf']['_post_content'])) {
1149 1149
 		
1150 1150
 		$save['post_content'] = acf_extract_var($_POST['acf'], '_post_content');
1151 1151
 		
@@ -1153,20 +1153,20 @@  discard block
 block discarded – undo
1153 1153
 	
1154 1154
 	
1155 1155
 	// validate
1156
-	if( count($save) == 1 ) {
1156
+	if (count($save) == 1) {
1157 1157
 		
1158 1158
 		return $post_id;
1159 1159
 		
1160 1160
 	}
1161 1161
 	
1162 1162
 	
1163
-	if( $save['ID'] ) {
1163
+	if ($save['ID']) {
1164 1164
 		
1165
-		wp_update_post( $save );
1165
+		wp_update_post($save);
1166 1166
 		
1167 1167
 	} else {
1168 1168
 		
1169
-		$post_id = wp_insert_post( $save );
1169
+		$post_id = wp_insert_post($save);
1170 1170
 		
1171 1171
 	}
1172 1172
 		
@@ -1201,14 +1201,14 @@  discard block
 block discarded – undo
1201 1201
 *  @return	N/A
1202 1202
 */
1203 1203
 
1204
-function acf_form( $args = array() ) {
1204
+function acf_form($args = array()) {
1205 1205
 	
1206 1206
 	// vars
1207 1207
 	$url = acf_get_current_url();
1208 1208
 	
1209 1209
 	
1210 1210
 	// defaults
1211
-	$args = wp_parse_args( $args, array(
1211
+	$args = wp_parse_args($args, array(
1212 1212
 		'id'					=> 'acf-form',
1213 1213
 		'post_id'				=> false,
1214 1214
 		'new_post'				=> false,
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 		'post_content'			=> false,
1219 1219
 		'form'					=> true,
1220 1220
 		'form_attributes'		=> array(),
1221
-		'return'				=> add_query_arg( 'updated', 'true', $url ),
1221
+		'return'				=> add_query_arg('updated', 'true', $url),
1222 1222
 		'html_before_fields'	=> '',
1223 1223
 		'html_after_fields'		=> '',
1224 1224
 		'submit_value'			=> __("Update", 'acf'),
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 		'uploader'				=> 'wp'
1230 1230
 	));
1231 1231
 	
1232
-	$args['form_attributes'] = wp_parse_args( $args['form_attributes'], array(
1232
+	$args['form_attributes'] = wp_parse_args($args['form_attributes'], array(
1233 1233
 		'id'					=> 'post',
1234 1234
 		'class'					=> '',
1235 1235
 		'action'				=> '',
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	
1239 1239
 	
1240 1240
 	// filter post_id
1241
-	$args['post_id'] = acf_get_valid_post_id( $args['post_id'] );
1241
+	$args['post_id'] = acf_get_valid_post_id($args['post_id']);
1242 1242
 	
1243 1243
 	
1244 1244
 	// load values from this post
@@ -1246,14 +1246,14 @@  discard block
 block discarded – undo
1246 1246
 	
1247 1247
 	
1248 1248
 	// new post?
1249
-	if( $post_id == 'new_post' ) {
1249
+	if ($post_id == 'new_post') {
1250 1250
 		
1251 1251
 		// dont load values
1252 1252
 		$post_id = false;
1253 1253
 		
1254 1254
 		
1255 1255
 		// new post defaults
1256
-		$args['new_post'] = acf_parse_args( $args['new_post'], array(
1256
+		$args['new_post'] = acf_parse_args($args['new_post'], array(
1257 1257
 			'post_type' 	=> 'post',
1258 1258
 			'post_status'	=> 'draft',
1259 1259
 		));
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 	
1272 1272
 	
1273 1273
 	// post_title
1274
-	if( $args['post_title'] ) {
1274
+	if ($args['post_title']) {
1275 1275
 		
1276 1276
 		$fields[] = acf_get_valid_field(array(
1277 1277
 			'name'		=> '_post_title',
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 	
1286 1286
 	
1287 1287
 	// post_content
1288
-	if( $args['post_content'] ) {
1288
+	if ($args['post_content']) {
1289 1289
 		
1290 1290
 		$fields[] = acf_get_valid_field(array(
1291 1291
 			'name'		=> '_post_content',
@@ -1298,24 +1298,24 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	// specific fields
1301
-	if( $args['fields'] ) {
1301
+	if ($args['fields']) {
1302 1302
 		
1303
-		foreach( $args['fields'] as $selector ) {
1303
+		foreach ($args['fields'] as $selector) {
1304 1304
 			
1305 1305
 			// append field ($strict = false to allow for better compatibility with field names)
1306
-			$fields[] = acf_maybe_get_field( $selector, $post_id, false );
1306
+			$fields[] = acf_maybe_get_field($selector, $post_id, false);
1307 1307
 			
1308 1308
 		}
1309 1309
 		
1310
-	} elseif( $args['field_groups'] ) {
1310
+	} elseif ($args['field_groups']) {
1311 1311
 		
1312
-		foreach( $args['field_groups'] as $selector ) {
1312
+		foreach ($args['field_groups'] as $selector) {
1313 1313
 		
1314
-			$field_groups[] = acf_get_field_group( $selector );
1314
+			$field_groups[] = acf_get_field_group($selector);
1315 1315
 			
1316 1316
 		}
1317 1317
 		
1318
-	} elseif( $args['post_id'] == 'new_post' ) {
1318
+	} elseif ($args['post_id'] == 'new_post') {
1319 1319
 		
1320 1320
 		$field_groups = acf_get_field_groups(array(
1321 1321
 			'post_type' => $args['new_post']['post_type']
@@ -1331,15 +1331,15 @@  discard block
 block discarded – undo
1331 1331
 	
1332 1332
 	
1333 1333
 	//load fields based on field groups
1334
-	if( !empty($field_groups) ) {
1334
+	if ( ! empty($field_groups)) {
1335 1335
 		
1336
-		foreach( $field_groups as $field_group ) {
1336
+		foreach ($field_groups as $field_group) {
1337 1337
 			
1338
-			$field_group_fields = acf_get_fields( $field_group );
1338
+			$field_group_fields = acf_get_fields($field_group);
1339 1339
 			
1340
-			if( !empty($field_group_fields) ) {
1340
+			if ( ! empty($field_group_fields)) {
1341 1341
 				
1342
-				foreach( array_keys($field_group_fields) as $i ) {
1342
+				foreach (array_keys($field_group_fields) as $i) {
1343 1343
 					
1344 1344
 					$fields[] = acf_extract_var($field_group_fields, $i);
1345 1345
 				}
@@ -1352,9 +1352,9 @@  discard block
 block discarded – undo
1352 1352
 	
1353 1353
 	
1354 1354
 	// updated message
1355
-	if( !empty($_GET['updated']) && $args['updated_message'] ) {
1355
+	if ( ! empty($_GET['updated']) && $args['updated_message']) {
1356 1356
 	
1357
-		echo '<div id="message" class="updated"><p>' . $args['updated_message'] . '</p></div>';
1357
+		echo '<div id="message" class="updated"><p>'.$args['updated_message'].'</p></div>';
1358 1358
 		
1359 1359
 	}
1360 1360
 	
@@ -1364,9 +1364,9 @@  discard block
 block discarded – undo
1364 1364
 	
1365 1365
 	
1366 1366
 	// display form
1367
-	if( $args['form'] ): ?>
1367
+	if ($args['form']): ?>
1368 1368
 	
1369
-	<form <?php acf_esc_attr_e( $args['form_attributes']); ?>>
1369
+	<form <?php acf_esc_attr_e($args['form_attributes']); ?>>
1370 1370
 	
1371 1371
 	<?php endif; 
1372 1372
 		
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 	
1380 1380
 	?>
1381 1381
 	<div class="acf-hidden">
1382
-		<?php acf_hidden_input(array( 'name' => '_acf_form', 'value' => base64_encode(json_encode($args)) )); ?>
1382
+		<?php acf_hidden_input(array('name' => '_acf_form', 'value' => base64_encode(json_encode($args)))); ?>
1383 1383
 	</div>
1384 1384
 	<div class="acf-fields acf-form-fields -<?php echo $args['label_placement']; ?>">
1385 1385
 	
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 		
1391 1391
 		
1392 1392
 		// render
1393
-		acf_render_fields( $post_id, $fields, $args['field_el'], $args['instruction_placement'] );
1393
+		acf_render_fields($post_id, $fields, $args['field_el'], $args['instruction_placement']);
1394 1394
 		
1395 1395
 		
1396 1396
 		// html after fields
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 		?>
1400 1400
 	
1401 1401
 	</div><!-- acf-form-fields -->
1402
-	<?php if( $args['form'] ): ?>
1402
+	<?php if ($args['form']): ?>
1403 1403
 	
1404 1404
 	<!-- Submit -->
1405 1405
 	<div class="acf-form-submit">
@@ -1430,18 +1430,18 @@  discard block
 block discarded – undo
1430 1430
 *  @return	(boolean)
1431 1431
 */
1432 1432
 
1433
-function update_field( $selector, $value, $post_id = false ) {
1433
+function update_field($selector, $value, $post_id = false) {
1434 1434
 	
1435 1435
 	// filter post_id
1436
-	$post_id = acf_get_valid_post_id( $post_id );
1436
+	$post_id = acf_get_valid_post_id($post_id);
1437 1437
 	
1438 1438
 	
1439 1439
 	// get field
1440
-	$field = acf_maybe_get_field( $selector, $post_id );
1440
+	$field = acf_maybe_get_field($selector, $post_id);
1441 1441
 	
1442 1442
 	
1443 1443
 	// create dummy field
1444
-	if( !$field )
1444
+	if ( ! $field)
1445 1445
 	{
1446 1446
 		$field = acf_get_valid_field(array(
1447 1447
 			'name'	=> $selector,
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 	
1453 1453
 	
1454 1454
 	// save
1455
-	return acf_update_value( $value, $post_id, $field );
1455
+	return acf_update_value($value, $post_id, $field);
1456 1456
 		
1457 1457
 }
1458 1458
 
@@ -1472,10 +1472,10 @@  discard block
 block discarded – undo
1472 1472
 *  @return	(boolean)
1473 1473
 */
1474 1474
 
1475
-function update_sub_field( $selector, $value, $post_id = false ) {
1475
+function update_sub_field($selector, $value, $post_id = false) {
1476 1476
 	
1477 1477
 	// filter post_id
1478
-	$post_id = acf_get_valid_post_id( $post_id );
1478
+	$post_id = acf_get_valid_post_id($post_id);
1479 1479
 	
1480 1480
 	
1481 1481
 	// vars
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 	
1484 1484
 	
1485 1485
 	// within a have_rows loop
1486
-	if( is_string($selector) ) {
1486
+	if (is_string($selector)) {
1487 1487
 		
1488 1488
 		// get current row
1489 1489
 		$row = acf_get_row();
@@ -1494,11 +1494,11 @@  discard block
 block discarded – undo
1494 1494
 		
1495 1495
 		
1496 1496
 		// get sub field
1497
-		$field = get_sub_field_object( $selector, false, false );
1497
+		$field = get_sub_field_object($selector, false, false);
1498 1498
 		
1499 1499
 		
1500 1500
 		// create dummy field
1501
-		if( !$field ) {
1501
+		if ( ! $field) {
1502 1502
 		
1503 1503
 			$field = acf_get_valid_field(array(
1504 1504
 				'name'	=> $selector,
@@ -1513,10 +1513,10 @@  discard block
 block discarded – undo
1513 1513
 		$field['name'] = "{$row['name']}_{$row['i']}_{$field['name']}";
1514 1514
 		
1515 1515
 		
1516
-	} elseif( is_array($selector) ) {
1516
+	} elseif (is_array($selector)) {
1517 1517
 		
1518 1518
 		// validate
1519
-		if( count($selector) < 3 ) {
1519
+		if (count($selector) < 3) {
1520 1520
 			
1521 1521
 			return false;
1522 1522
 			
@@ -1524,11 +1524,11 @@  discard block
 block discarded – undo
1524 1524
 		
1525 1525
 		
1526 1526
 		// vars
1527
-		$parent_name = acf_extract_var( $selector, 0 );
1527
+		$parent_name = acf_extract_var($selector, 0);
1528 1528
 		
1529 1529
 		
1530 1530
 		// load parent
1531
-		$field = acf_maybe_get_field( $parent_name, $post_id );
1531
+		$field = acf_maybe_get_field($parent_name, $post_id);
1532 1532
 		
1533 1533
 		
1534 1534
 		// add to name
@@ -1536,9 +1536,9 @@  discard block
 block discarded – undo
1536 1536
 		
1537 1537
 		
1538 1538
 		// sub fields
1539
-		foreach( $selector as $s ) {
1539
+		foreach ($selector as $s) {
1540 1540
 				
1541
-			if( is_numeric($s) ) {
1541
+			if (is_numeric($s)) {
1542 1542
 				
1543 1543
 				// get row index
1544 1544
 				$row_i = intval($s) - 1;
@@ -1549,11 +1549,11 @@  discard block
 block discarded – undo
1549 1549
 			} else {
1550 1550
 				
1551 1551
 				// update parent
1552
-				$field = acf_get_sub_field( $s, $field );
1552
+				$field = acf_get_sub_field($s, $field);
1553 1553
 				
1554 1554
 				
1555 1555
 				// create dummy field
1556
-				if( !$field ) {
1556
+				if ( ! $field) {
1557 1557
 				
1558 1558
 					$field = acf_get_valid_field(array(
1559 1559
 						'name'	=> $s,
@@ -1582,15 +1582,15 @@  discard block
 block discarded – undo
1582 1582
 	
1583 1583
 	
1584 1584
 	// delete
1585
-	if( $value === null ) {
1585
+	if ($value === null) {
1586 1586
 		
1587
-		return acf_delete_value( $post_id, $field );
1587
+		return acf_delete_value($post_id, $field);
1588 1588
 		
1589 1589
 	}
1590 1590
 	
1591 1591
 	
1592 1592
 	// update
1593
-	return acf_update_value( $value, $post_id, $field );
1593
+	return acf_update_value($value, $post_id, $field);
1594 1594
 		
1595 1595
 }
1596 1596
 
@@ -1609,18 +1609,18 @@  discard block
 block discarded – undo
1609 1609
 *  @return	(boolean)
1610 1610
 */
1611 1611
 
1612
-function delete_field( $selector, $post_id = false ) {
1612
+function delete_field($selector, $post_id = false) {
1613 1613
 	
1614 1614
 	// filter post_id
1615
-	$post_id = acf_get_valid_post_id( $post_id );
1615
+	$post_id = acf_get_valid_post_id($post_id);
1616 1616
 	
1617 1617
 	
1618 1618
 	// get field
1619
-	$field = acf_maybe_get_field( $selector, $post_id );
1619
+	$field = acf_maybe_get_field($selector, $post_id);
1620 1620
 	
1621 1621
 	
1622 1622
 	// delete
1623
-	return acf_delete_value( $post_id, $field );
1623
+	return acf_delete_value($post_id, $field);
1624 1624
 	
1625 1625
 }
1626 1626
 
@@ -1640,9 +1640,9 @@  discard block
 block discarded – undo
1640 1640
 *  @return	(boolean)
1641 1641
 */
1642 1642
 
1643
-function delete_sub_field( $selector, $post_id = false ) {
1643
+function delete_sub_field($selector, $post_id = false) {
1644 1644
 	
1645
-	return update_sub_field( $selector, null, $post_id );
1645
+	return update_sub_field($selector, null, $post_id);
1646 1646
 		
1647 1647
 }
1648 1648
 
@@ -1660,18 +1660,18 @@  discard block
 block discarded – undo
1660 1660
 *  @return	$post_id (int)
1661 1661
 */
1662 1662
 
1663
-function add_row( $selector, $value, $post_id = false ) {
1663
+function add_row($selector, $value, $post_id = false) {
1664 1664
 	
1665 1665
 	// filter post_id
1666
-	$post_id = acf_get_valid_post_id( $post_id );
1666
+	$post_id = acf_get_valid_post_id($post_id);
1667 1667
 	
1668 1668
 	
1669 1669
 	// get field
1670
-	$field = acf_maybe_get_field( $selector, $post_id );
1670
+	$field = acf_maybe_get_field($selector, $post_id);
1671 1671
 	
1672 1672
 	
1673 1673
 	// bail early if no field
1674
-	if( !$field ) {
1674
+	if ( ! $field) {
1675 1675
 		
1676 1676
 		return false;
1677 1677
 		
@@ -1679,14 +1679,14 @@  discard block
 block discarded – undo
1679 1679
 	
1680 1680
 	
1681 1681
 	// get row count
1682
-	$i = (int) acf_get_metadata( $post_id, $field['name'] );
1682
+	$i = (int) acf_get_metadata($post_id, $field['name']);
1683 1683
 	
1684 1684
 	
1685 1685
 	// if no rows, save this field via update_field() so that the reference field is created
1686
-	if( !$i ) {
1686
+	if ( ! $i) {
1687 1687
 		
1688 1688
 		// acf_update_value will return boolean, simply convert this to int for 1 | 0 (the number of rows!)
1689
-		return (int) acf_update_value( array( $value ), $post_id, $field );
1689
+		return (int) acf_update_value(array($value), $post_id, $field);
1690 1690
 		
1691 1691
 	}
1692 1692
 	
@@ -1696,15 +1696,15 @@  discard block
 block discarded – undo
1696 1696
 	
1697 1697
 	
1698 1698
 	// update meta
1699
-	$result = acf_update_metadata( $post_id, $field['name'], $i );
1699
+	$result = acf_update_metadata($post_id, $field['name'], $i);
1700 1700
 	
1701 1701
 	
1702 1702
 	// update sub fields
1703
-	if( $value ) {
1703
+	if ($value) {
1704 1704
 		
1705
-		foreach( $value as $k => $v ) {
1705
+		foreach ($value as $k => $v) {
1706 1706
 		
1707
-			update_sub_field( array( $field['key'], $i, $k ), $v, $post_id );
1707
+			update_sub_field(array($field['key'], $i, $k), $v, $post_id);
1708 1708
 			
1709 1709
 		}
1710 1710
 	
@@ -1730,10 +1730,10 @@  discard block
 block discarded – undo
1730 1730
 *  @return	$post_id (int)
1731 1731
 */
1732 1732
 
1733
-function update_row( $selector, $row = 1, $value = false, $post_id = false ) {
1733
+function update_row($selector, $row = 1, $value = false, $post_id = false) {
1734 1734
 	
1735 1735
 	// bail early if no value
1736
-	if( empty($value) ) {
1736
+	if (empty($value)) {
1737 1737
 		
1738 1738
 		return false;
1739 1739
 		
@@ -1741,21 +1741,21 @@  discard block
 block discarded – undo
1741 1741
 	
1742 1742
 	
1743 1743
 	// filter post_id
1744
-	$post_id = acf_get_valid_post_id( $post_id );
1744
+	$post_id = acf_get_valid_post_id($post_id);
1745 1745
 	
1746 1746
 	
1747 1747
 	// get field
1748
-	$field = acf_maybe_get_field( $selector, $post_id );
1748
+	$field = acf_maybe_get_field($selector, $post_id);
1749 1749
 	
1750 1750
 	
1751 1751
 	// bail early if no field
1752
-	if( !$field ) return false;
1752
+	if ( ! $field) return false;
1753 1753
 	
1754 1754
 	
1755 1755
 	// update sub fields
1756
-	foreach( $value as $k => $v ) {
1756
+	foreach ($value as $k => $v) {
1757 1757
 		
1758
-		update_sub_field( array( $field['key'], $row, $k ), $v, $post_id );
1758
+		update_sub_field(array($field['key'], $row, $k), $v, $post_id);
1759 1759
 		
1760 1760
 	}
1761 1761
 	
@@ -1779,18 +1779,18 @@  discard block
 block discarded – undo
1779 1779
 *  @return	$post_id (int)
1780 1780
 */
1781 1781
 
1782
-function delete_row( $selector, $row = 1, $post_id = false ) {
1782
+function delete_row($selector, $row = 1, $post_id = false) {
1783 1783
 	
1784 1784
 	// filter post_id
1785
-	$post_id = acf_get_valid_post_id( $post_id );
1785
+	$post_id = acf_get_valid_post_id($post_id);
1786 1786
 	
1787 1787
 	
1788 1788
 	// get field
1789
-	$field = acf_maybe_get_field( $selector, $post_id );
1789
+	$field = acf_maybe_get_field($selector, $post_id);
1790 1790
 	
1791 1791
 	
1792 1792
 	// bail early if no field
1793
-	if( !$field ) {
1793
+	if ( ! $field) {
1794 1794
 		
1795 1795
 		return false;
1796 1796
 		
@@ -1798,11 +1798,11 @@  discard block
 block discarded – undo
1798 1798
 	
1799 1799
 	
1800 1800
 	// get value
1801
-	$rows = acf_get_value( $post_id, $field );
1801
+	$rows = acf_get_value($post_id, $field);
1802 1802
 	
1803 1803
 	
1804 1804
 	// bail early if no value
1805
-	if( empty($rows) ) {
1805
+	if (empty($rows)) {
1806 1806
 		
1807 1807
 		return false;
1808 1808
 		
@@ -1810,17 +1810,17 @@  discard block
 block discarded – undo
1810 1810
 	
1811 1811
 	
1812 1812
 	// deincrement
1813
-	if( $row = count($rows) ) {
1813
+	if ($row = count($rows)) {
1814 1814
 		
1815
-		acf_update_metadata( $post_id, $field['name'], $row-1 );
1815
+		acf_update_metadata($post_id, $field['name'], $row - 1);
1816 1816
 		
1817 1817
 	}
1818 1818
 	
1819 1819
 	
1820 1820
 	// update sub field values
1821
-	foreach( $rows[0] as $k => $v ) {
1821
+	foreach ($rows[0] as $k => $v) {
1822 1822
 		
1823
-		update_sub_field( array( $field['key'], $row, $k ), null, $post_id );
1823
+		update_sub_field(array($field['key'], $row, $k), null, $post_id);
1824 1824
 		
1825 1825
 	}
1826 1826
 	
@@ -1845,14 +1845,14 @@  discard block
 block discarded – undo
1845 1845
 *  @return	N/A
1846 1846
 */
1847 1847
 
1848
-function create_field( $field ) {
1848
+function create_field($field) {
1849 1849
 
1850
-	acf_render_field( $field );
1850
+	acf_render_field($field);
1851 1851
 }
1852 1852
 
1853
-function render_field( $field ) {
1853
+function render_field($field) {
1854 1854
 
1855
-	acf_render_field( $field );
1855
+	acf_render_field($field);
1856 1856
 }
1857 1857
 
1858 1858
 
@@ -1871,10 +1871,10 @@  discard block
 block discarded – undo
1871 1871
 *  @return	N/A
1872 1872
 */
1873 1873
 
1874
-function acf_convert_field_names_to_keys( $value, $field ) {
1874
+function acf_convert_field_names_to_keys($value, $field) {
1875 1875
 	
1876 1876
 	// only if $field has sub fields
1877
-	if( !isset($field['sub_fields']) ) {
1877
+	if ( ! isset($field['sub_fields'])) {
1878 1878
 		
1879 1879
 		return $value;
1880 1880
 		
@@ -1883,11 +1883,11 @@  discard block
 block discarded – undo
1883 1883
 
1884 1884
 	// define sub field keys
1885 1885
 	$sub_fields = array();
1886
-	if( $field['sub_fields'] ) {
1886
+	if ($field['sub_fields']) {
1887 1887
 		
1888
-		foreach( $field['sub_fields'] as $sub_field ) {
1888
+		foreach ($field['sub_fields'] as $sub_field) {
1889 1889
 			
1890
-			$sub_fields[ $sub_field['name'] ] = $sub_field;
1890
+			$sub_fields[$sub_field['name']] = $sub_field;
1891 1891
 			
1892 1892
 		}
1893 1893
 		
@@ -1895,16 +1895,16 @@  discard block
 block discarded – undo
1895 1895
 	
1896 1896
 	
1897 1897
 	// loop through the values and format the array to use sub field keys
1898
-	if( is_array($value) ) {
1898
+	if (is_array($value)) {
1899 1899
 		
1900
-		foreach( $value as $row_i => $row) {
1900
+		foreach ($value as $row_i => $row) {
1901 1901
 			
1902
-			if( $row ) {
1902
+			if ($row) {
1903 1903
 				
1904
-				foreach( $row as $sub_field_name => $sub_field_value ) {
1904
+				foreach ($row as $sub_field_name => $sub_field_value) {
1905 1905
 					
1906 1906
 					// sub field must exist!
1907
-					if( !isset($sub_fields[ $sub_field_name ]) ) {
1907
+					if ( ! isset($sub_fields[$sub_field_name])) {
1908 1908
 						
1909 1909
 						continue;
1910 1910
 						
@@ -1912,16 +1912,16 @@  discard block
 block discarded – undo
1912 1912
 					
1913 1913
 					
1914 1914
 					// vars
1915
-					$sub_field = $sub_fields[ $sub_field_name ];
1916
-					$sub_field_value = acf_convert_field_names_to_keys( $sub_field_value, $sub_field );
1915
+					$sub_field = $sub_fields[$sub_field_name];
1916
+					$sub_field_value = acf_convert_field_names_to_keys($sub_field_value, $sub_field);
1917 1917
 					
1918 1918
 					
1919 1919
 					// set new value
1920
-					$value[$row_i][ $sub_field['key'] ] = $sub_field_value;
1920
+					$value[$row_i][$sub_field['key']] = $sub_field_value;
1921 1921
 					
1922 1922
 					
1923 1923
 					// unset old value
1924
-					unset( $value[$row_i][$sub_field_name] );
1924
+					unset($value[$row_i][$sub_field_name]);
1925 1925
 						
1926 1926
 					
1927 1927
 				}
@@ -1956,10 +1956,10 @@  discard block
 block discarded – undo
1956 1956
 *  @return	$post_id (int)
1957 1957
 */
1958 1958
 
1959
-function register_field_group( $field_group ) {
1959
+function register_field_group($field_group) {
1960 1960
 	
1961 1961
 	// add local
1962
-	acf_add_local_field_group( $field_group );
1962
+	acf_add_local_field_group($field_group);
1963 1963
 	
1964 1964
 }
1965 1965
 
@@ -1983,21 +1983,21 @@  discard block
 block discarded – undo
1983 1983
 	
1984 1984
 }
1985 1985
 
1986
-function the_repeater_field( $field_name, $post_id = false ) {
1986
+function the_repeater_field($field_name, $post_id = false) {
1987 1987
 	
1988
-	return has_sub_field( $field_name, $post_id );
1988
+	return has_sub_field($field_name, $post_id);
1989 1989
 	
1990 1990
 }
1991 1991
 
1992
-function the_flexible_field( $field_name, $post_id = false ) {
1992
+function the_flexible_field($field_name, $post_id = false) {
1993 1993
 	
1994
-	return has_sub_field( $field_name, $post_id );
1994
+	return has_sub_field($field_name, $post_id);
1995 1995
 	
1996 1996
 }
1997 1997
 
1998
-function acf_filter_post_id( $post_id ) {
1998
+function acf_filter_post_id($post_id) {
1999 1999
 	
2000
-	return acf_get_valid_post_id( $post_id );
2000
+	return acf_get_valid_post_id($post_id);
2001 2001
 	
2002 2002
 }
2003 2003
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -654,7 +654,9 @@  discard block
 block discarded – undo
654 654
 	
655 655
 	
656 656
 	// bail early if no row
657
-	if( !$row ) return 0;
657
+	if( !$row ) {
658
+		return 0;
659
+	}
658 660
 	
659 661
 	
660 662
 	// return
@@ -683,8 +685,7 @@  discard block
 block discarded – undo
683 685
 	if( $hard_reset )
684 686
 	{
685 687
 		$GLOBALS['acf_field'] = array();
686
-	}
687
-	else
688
+	} else
688 689
 	{
689 690
 		// vars
690 691
 		$depth = count( $GLOBALS['acf_field'] ) - 1;
@@ -1749,7 +1750,9 @@  discard block
 block discarded – undo
1749 1750
 	
1750 1751
 	
1751 1752
 	// bail early if no field
1752
-	if( !$field ) return false;
1753
+	if( !$field ) {
1754
+		return false;
1755
+	}
1753 1756
 	
1754 1757
 	
1755 1758
 	// update sub fields
Please login to merge, or discard this patch.
includes/acf/forms/user.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -207,6 +207,9 @@
 block discarded – undo
207 207
 	*  @return	n/a
208 208
 	*/
209 209
 	
210
+	/**
211
+	 * @param string $user_form
212
+	 */
210 213
 	function render( $user_id, $user_form, $el = 'tr' ) {
211 214
 		
212 215
 		// vars
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -382,8 +382,8 @@
 block discarded – undo
382 382
 		}
383 383
 		
384 384
 	    
385
-	    // save data
386
-	    if( acf_validate_save_post(true) ) {
385
+		// save data
386
+		if( acf_validate_save_post(true) ) {
387 387
 	    	
388 388
 			acf_save_post( "user_{$user_id}" );
389 389
 		
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 *  @subpackage	Forms
11 11
 */
12 12
 
13
-if( ! class_exists('acf_form_user') ) :
13
+if ( ! class_exists('acf_form_user')) :
14 14
 
15 15
 class acf_form_user {
16 16
 	
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 	function __construct() {
34 34
 		
35 35
 		// actions
36
-		add_action('admin_enqueue_scripts',			array($this, 'admin_enqueue_scripts'));
37
-		add_action('login_form_register', 			array($this, 'admin_enqueue_scripts'));
36
+		add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
37
+		add_action('login_form_register', array($this, 'admin_enqueue_scripts'));
38 38
 		
39 39
 		// render
40
-		add_action('show_user_profile', 			array($this, 'edit_user'));
41
-		add_action('edit_user_profile',				array($this, 'edit_user'));
42
-		add_action('user_new_form',					array($this, 'user_new_form'));
43
-		add_action('register_form',					array($this, 'register_user'));
40
+		add_action('show_user_profile', array($this, 'edit_user'));
41
+		add_action('edit_user_profile', array($this, 'edit_user'));
42
+		add_action('user_new_form', array($this, 'user_new_form'));
43
+		add_action('register_form', array($this, 'register_user'));
44 44
 		
45 45
 		// save
46 46
 		//add_action('edit_user_profile_update',	array($this, 'save_user'));
47 47
 		//add_action('personal_options_update',		array($this, 'save_user'));
48
-		add_action('user_register',					array($this, 'save_user'));
49
-		add_action('profile_update',				array($this, 'save_user'));
48
+		add_action('user_register', array($this, 'save_user'));
49
+		add_action('profile_update', array($this, 'save_user'));
50 50
 		
51 51
 	}
52 52
 	
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		
72 72
 		
73 73
 		// validate page
74
-		if( in_array( $pagenow, array('profile.php', 'user-edit.php', 'user-new.php', 'wp-login.php') ) ) {
74
+		if (in_array($pagenow, array('profile.php', 'user-edit.php', 'user-new.php', 'wp-login.php'))) {
75 75
 			
76 76
 			return true;
77 77
 		
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	function admin_enqueue_scripts() {
101 101
 		
102 102
 		// validate page
103
-		if( ! $this->validate_page() ) {
103
+		if ( ! $this->validate_page()) {
104 104
 		
105 105
 			return;
106 106
 			
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		
138 138
 		
139 139
 		// render
140
-		$this->render( 0, 'register', 'div' );
140
+		$this->render(0, 'register', 'div');
141 141
 		
142 142
 	}
143 143
 	
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 	*  @return	$post_id (int)
156 156
 	*/
157 157
 	
158
-	function edit_user( $user ) {
158
+	function edit_user($user) {
159 159
 		
160 160
 		// update vars
161 161
 		$this->form = '#your-profile';
162 162
 		
163 163
 		
164 164
 		// render
165
-		$this->render( $user->ID, 'edit', 'tr' );
165
+		$this->render($user->ID, 'edit', 'tr');
166 166
 		
167 167
 	}
168 168
 	
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		
188 188
 		
189 189
 		// render
190
-		$this->render( 0, 'add', 'tr' );
190
+		$this->render(0, 'add', 'tr');
191 191
 		
192 192
 	}
193 193
 	
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	*  @return	n/a
208 208
 	*/
209 209
 	
210
-	function render( $user_id, $user_form, $el = 'tr' ) {
210
+	function render($user_id, $user_form, $el = 'tr') {
211 211
 		
212 212
 		// vars
213 213
 		$post_id = "user_{$user_id}";
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		
216 216
 		
217 217
 		// show title
218
-		if( $user_form == 'register' ) {
218
+		if ($user_form == 'register') {
219 219
 			
220 220
 			$show_title = false;
221 221
 		
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			'user_form'	=> $user_form
229 229
 		);
230 230
 		
231
-		if( $user_id ) {
231
+		if ($user_id) {
232 232
 		
233 233
 			$args['user_id'] = $user_id;
234 234
 			
@@ -236,34 +236,34 @@  discard block
 block discarded – undo
236 236
 		
237 237
 		
238 238
 		// get field groups
239
-		$field_groups = acf_get_field_groups( $args );
239
+		$field_groups = acf_get_field_groups($args);
240 240
 		
241 241
 		
242 242
 		// render
243
-		if( !empty($field_groups) ) {
243
+		if ( ! empty($field_groups)) {
244 244
 			
245 245
 			acf_form_data(array( 
246 246
 				'post_id'	=> $post_id, 
247 247
 				'nonce'		=> 'user' 
248 248
 			));
249 249
 			
250
-			foreach( $field_groups as $field_group ) {
250
+			foreach ($field_groups as $field_group) {
251 251
 				
252
-				$fields = acf_get_fields( $field_group );
252
+				$fields = acf_get_fields($field_group);
253 253
 
254 254
 				?>
255
-				<?php if( $show_title && $field_group['style'] == 'default' ): ?>
255
+				<?php if ($show_title && $field_group['style'] == 'default'): ?>
256 256
 					<h3><?php echo $field_group['title']; ?></h3>
257 257
 				<?php endif; ?>
258 258
 				
259
-				<?php if( $el == 'tr' ): ?>
259
+				<?php if ($el == 'tr'): ?>
260 260
 					<table class="form-table">
261 261
 						<tbody>
262 262
 				<?php endif; ?>
263 263
 				
264
-					<?php acf_render_fields( $post_id, $fields, $el, 'field' ); ?>
264
+					<?php acf_render_fields($post_id, $fields, $el, 'field'); ?>
265 265
 				
266
-				<?php if( $el == 'tr' ): ?>
266
+				<?php if ($el == 'tr'): ?>
267 267
 						</tbody>
268 268
 					</table>
269 269
 				<?php endif; ?>
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 ?>
295 295
 <style type="text/css">
296 296
 
297
-<?php if( is_admin() ): ?>
297
+<?php if (is_admin()): ?>
298 298
 
299 299
 /* override for user css */
300 300
 .acf-field input[type="text"],
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	*  @return	$post_id (int)
373 373
 	*/
374 374
 	
375
-	function save_user( $user_id ) {
375
+	function save_user($user_id) {
376 376
 		
377 377
 		// verify and remove nonce
378
-		if( ! acf_verify_nonce('user') ) {
378
+		if ( ! acf_verify_nonce('user')) {
379 379
 			
380 380
 			return $user_id;
381 381
 		
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 		
384 384
 	    
385 385
 	    // save data
386
-	    if( acf_validate_save_post(true) ) {
386
+	    if (acf_validate_save_post(true)) {
387 387
 	    	
388
-			acf_save_post( "user_{$user_id}" );
388
+			acf_save_post("user_{$user_id}");
389 389
 		
390 390
 		}
391 391
 			
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -324,13 +324,16 @@
 block discarded – undo
324 324
     width: 100%;
325 325
 }
326 326
 
327
-<?php else: ?>
327
+<?php else {
328
+	: ?>
328 329
 
329 330
 #registerform p.submit {
330 331
 	text-align: right;
331 332
 }
332 333
 
333
-<?php endif; ?>
334
+<?php endif;
335
+}
336
+?>
334 337
 
335 338
 </style>
336 339
 <script type="text/javascript">
Please login to merge, or discard this patch.
includes/acf/pro/api/api-pro.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -72,6 +72,9 @@
 block discarded – undo
72 72
 *  @return	$post_id (int)
73 73
 */
74 74
 
75
+/**
76
+ * @return string
77
+ */
75 78
 function acf_pro_get_remote_response( $action = '', $post = array() ) {
76 79
 	
77 80
 	// vars
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 	
86 86
 	
87 87
 	// return body
88
-    if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
88
+	if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
89 89
     	
90
-        return $request['body'];
90
+		return $request['body'];
91 91
     
92
-    }
92
+	}
93 93
     
94 94
     
95
-    // return
96
-    return 0;
95
+	// return
96
+	return 0;
97 97
     
98 98
 }
99 99
 
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 	
128 128
     
129
-    // return false if the external version is '<=' the current version
129
+	// return false if the external version is '<=' the current version
130 130
 	if( version_compare($info['version'], $version, '<=') ) {
131 131
 		
132
-    	return false;
132
+		return false;
133 133
     
134
-    }
134
+	}
135 135
     
136 136
 	
137 137
 	// return
@@ -187,20 +187,20 @@  discard block
 block discarded – undo
187 187
 	$timeout = 12 * HOUR_IN_SECONDS;
188 188
 	
189 189
 	
190
-    // decode
191
-    if( !empty($info) ) {
190
+	// decode
191
+	if( !empty($info) ) {
192 192
     	
193 193
 		$info = json_decode($info, true);
194 194
 		
195 195
 		// fake info version
196
-        //$info['version'] = '6.0.0';
196
+		//$info['version'] = '6.0.0';
197 197
         
198
-    } else {
198
+	} else {
199 199
 	    
200
-	    $info = 0; // allow transient to be returned, but empty to validate
201
-	    $timeout = 2 * HOUR_IN_SECONDS;
200
+		$info = 0; // allow transient to be returned, but empty to validate
201
+		$timeout = 2 * HOUR_IN_SECONDS;
202 202
 	    
203
-    }
203
+	}
204 204
         
205 205
         
206 206
 	// update transient
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 *  @return	n/a
15 15
 */
16 16
 
17
-function acf_pro_get_view( $view_name = '', $args = array() ) {
17
+function acf_pro_get_view($view_name = '', $args = array()) {
18 18
 	
19 19
 	// vars
20 20
 	$path = acf_get_path("pro/admin/views/{$view_name}.php");
21 21
 	
22 22
 	
23
-	if( file_exists($path) ) {
23
+	if (file_exists($path)) {
24 24
 		
25
-		include( $path );
25
+		include($path);
26 26
 		
27 27
 	}
28 28
 	
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 *  @return	$post_id (int)
43 43
 */
44 44
 
45
-function acf_pro_get_remote_url( $action = '', $args = array() ) {
45
+function acf_pro_get_remote_url($action = '', $args = array()) {
46 46
 	
47 47
 	// defaults
48 48
 	$args['a'] = $action;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	
51 51
 	
52 52
 	// vars
53
-	$url = "http://connect.advancedcustomfields.com/index.php?" . build_query($args);
53
+	$url = "http://connect.advancedcustomfields.com/index.php?".build_query($args);
54 54
 	
55 55
 	
56 56
 	// return
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 *  @return	$post_id (int)
73 73
 */
74 74
 
75
-function acf_pro_get_remote_response( $action = '', $post = array() ) {
75
+function acf_pro_get_remote_response($action = '', $post = array()) {
76 76
 	
77 77
 	// vars
78
-	$url = acf_pro_get_remote_url( $action );
78
+	$url = acf_pro_get_remote_url($action);
79 79
 	
80 80
 	
81 81
 	// connect
82
-	$request = wp_remote_post( $url, array(
82
+	$request = wp_remote_post($url, array(
83 83
 		'body' => $post
84 84
 	));
85 85
 	
86 86
 	
87 87
 	// return body
88
-    if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
88
+    if ( ! is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) {
89 89
     	
90 90
         return $request['body'];
91 91
     
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 
120 120
 	
121 121
 	// return false if no info
122
-	if( empty($info['version']) ) {
122
+	if (empty($info['version'])) {
123 123
 		
124 124
 		return false;
125 125
 		
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	
128 128
     
129 129
     // return false if the external version is '<=' the current version
130
-	if( version_compare($info['version'], $version, '<=') ) {
130
+	if (version_compare($info['version'], $version, '<=')) {
131 131
 		
132 132
     	return false;
133 133
     
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 function acf_pro_get_remote_info() {
157 157
 	
158 158
 	// clear transient if force check is enabled
159
-	if( !empty($_GET['force-check']) ) {
159
+	if ( ! empty($_GET['force-check'])) {
160 160
 		
161 161
 		// only allow transient to be deleted once per page load
162
-		if( empty($_GET['acf-ignore-force-check']) ) {
162
+		if (empty($_GET['acf-ignore-force-check'])) {
163 163
 			
164
-			delete_transient( 'acf_pro_get_remote_info' );
164
+			delete_transient('acf_pro_get_remote_info');
165 165
 			
166 166
 		}
167 167
 		
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	
174 174
 	
175 175
 	// get transient
176
-	$transient = get_transient( 'acf_pro_get_remote_info' );
176
+	$transient = get_transient('acf_pro_get_remote_info');
177 177
 
178
-	if( $transient !== false ) {
178
+	if ($transient !== false) {
179 179
 	
180 180
 		return $transient;
181 181
 	
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	
189 189
 	
190 190
     // decode
191
-    if( !empty($info) ) {
191
+    if ( ! empty($info)) {
192 192
     	
193 193
 		$info = json_decode($info, true);
194 194
 		
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         
205 205
         
206 206
 	// update transient
207
-	set_transient('acf_pro_get_remote_info', $info, $timeout );
207
+	set_transient('acf_pro_get_remote_info', $info, $timeout);
208 208
 	
209 209
 	
210 210
 	// return
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 function acf_pro_is_license_active() {
216 216
 	
217 217
 	// vars
218
-	$data = acf_pro_get_license( true );
218
+	$data = acf_pro_get_license(true);
219 219
 	$url = home_url();
220 220
 	
221
-	if( !empty($data['url']) && !empty($data['key']) && $data['url'] == $url ) {
221
+	if ( ! empty($data['url']) && ! empty($data['key']) && $data['url'] == $url) {
222 222
 		
223 223
 		return true;
224 224
 		
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	
230 230
 }
231 231
 
232
-function acf_pro_get_license( $all = false ) {
232
+function acf_pro_get_license($all = false) {
233 233
 	
234 234
 	// get option
235 235
 	$data = get_option('acf_pro_license');
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 	
241 241
 	
242 242
 	// attempt deserialize
243
-	if( is_serialized( $data ) )
243
+	if (is_serialized($data))
244 244
 	{
245 245
 		$data = maybe_unserialize($data);
246 246
 		
247 247
 		// $all
248
-		if( !$all )
248
+		if ( ! $all)
249 249
 		{
250 250
 			$data = $data['key'];
251 251
 		}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 
262 262
 
263
-function acf_pro_update_license( $license ) {
263
+function acf_pro_update_license($license) {
264 264
 	
265 265
 	$save = array(
266 266
 		'key'	=> $license,
Please login to merge, or discard this patch.
functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  * as indicating support for post thumbnails.
17 17
  */
18 18
 function lighthouse_setup() {
19
-    // This theme styles the visual editor to resemble the theme style.
19
+	// This theme styles the visual editor to resemble the theme style.
20 20
 	$font_url = 'https://fonts.googleapis.com/css?family=Questrial';
21 21
 	add_editor_style( 
22 22
 		array( 
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package Lighthouse
8 8
  */
9 9
 
10
-if ( ! function_exists( 'lighthouse_setup' ) ) :
10
+if ( ! function_exists('lighthouse_setup')) :
11 11
 /**
12 12
  * Sets up theme defaults and registers support for various WordPress features.
13 13
  *
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	add_editor_style( 
27 27
 		array( 
28
-			'style.css', str_replace( ',', '%2C', $font_url_Questrial), str_replace( ',', '%2C', $font_url_Raleway), str_replace( ',', '%2C', $font_url_Montserrat)
28
+			'style.css', str_replace(',', '%2C', $font_url_Questrial), str_replace(',', '%2C', $font_url_Raleway), str_replace(',', '%2C', $font_url_Montserrat)
29 29
 			) 
30 30
 		);
31 31
 	/*
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * If you're building a theme based on Lighthouse, use a find and replace
35 35
 	 * to change 'lighthouse' to the name of your theme in all the template files.
36 36
 	 */
37
-	load_theme_textdomain( 'lighthouse', get_template_directory() . '/languages' );
37
+	load_theme_textdomain('lighthouse', get_template_directory().'/languages');
38 38
 
39 39
 	// Add default posts and comments RSS feed links to head.
40
-	add_theme_support( 'automatic-feed-links' );
40
+	add_theme_support('automatic-feed-links');
41 41
 
42 42
 	/*
43 43
 	 * Let WordPress manage the document title.
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 	 * hard-coded <title> tag in the document head, and expect WordPress to
46 46
 	 * provide it for us.
47 47
 	 */
48
-	add_theme_support( 'title-tag' );
48
+	add_theme_support('title-tag');
49 49
 
50 50
 	/*
51 51
 	 * Enable support for Post Thumbnails on posts and pages.
52 52
 	 *
53 53
 	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
54 54
 	 */
55
-	add_theme_support( 'post-thumbnails' );
55
+	add_theme_support('post-thumbnails');
56 56
 
57
-	add_image_size( 'lighthouse_feature_img', 1000, 310, array( 'center', 'center' ) );
57
+	add_image_size('lighthouse_feature_img', 1000, 310, array('center', 'center'));
58 58
 
59
-	add_image_size( 'lighthouse_blog_listing', 714, 274, array( 'center', 'center' ) );
59
+	add_image_size('lighthouse_blog_listing', 714, 274, array('center', 'center'));
60 60
 
61
-	add_image_size( 'lighthouse_related_post', 475, 280, array( 'center', 'center' ) );
61
+	add_image_size('lighthouse_related_post', 475, 280, array('center', 'center'));
62 62
 
63 63
 
64 64
 	/*
@@ -72,45 +72,45 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @link https://codex.wordpress.org/Function_Reference/get_search_form
74 74
 	 */
75
-	add_theme_support( 'html5', array( 'search-form' ) ); 
75
+	add_theme_support('html5', array('search-form')); 
76 76
 
77 77
 	// This theme uses wp_nav_menu() in one location.
78
-	register_nav_menus( array(
79
-		'primary' => esc_html__( 'Primary', 'lighthouse' ),
80
-		) );
78
+	register_nav_menus(array(
79
+		'primary' => esc_html__('Primary', 'lighthouse'),
80
+		));
81 81
 
82 82
 	/*
83 83
 	 * Switch default core markup for search form, comment form, and comments
84 84
 	 * to output valid HTML5.
85 85
 	 */
86
-	add_theme_support( 'html5', array(
86
+	add_theme_support('html5', array(
87 87
 		'search-form',
88 88
 		'comment-form',
89 89
 		'comment-list',
90 90
 		'gallery',
91 91
 		'caption',
92
-		) );
92
+		));
93 93
 
94 94
 	/*
95 95
 	 * Enable support for Post Formats.
96 96
 	 * See https://developer.wordpress.org/themes/functionality/post-formats/
97 97
 	 */
98
-	add_theme_support( 'post-formats', array(
98
+	add_theme_support('post-formats', array(
99 99
 		'aside',
100 100
 		'image',
101 101
 		'video',
102 102
 		'quote',
103 103
 		'link',
104
-		) );
104
+		));
105 105
 
106 106
 	// Set up the WordPress core custom background feature.
107
-	add_theme_support( 'custom-background', apply_filters( 'lighthouse_custom_background_args', array(
107
+	add_theme_support('custom-background', apply_filters('lighthouse_custom_background_args', array(
108 108
 		'default-color' => 'ffffff',
109 109
 		'default-image' => '',
110
-		) ) );
110
+		)));
111 111
 }
112 112
 endif;
113
-add_action( 'after_setup_theme', 'lighthouse_setup' );
113
+add_action('after_setup_theme', 'lighthouse_setup');
114 114
 
115 115
 /**
116 116
  * Set the content width in pixels, based on the theme's design and stylesheet.
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
  * @global int $content_width
121 121
  */
122 122
 function lighthouse_content_width() {
123
-	$GLOBALS['content_width'] = apply_filters( 'lighthouse_content_width', 640 );
123
+	$GLOBALS['content_width'] = apply_filters('lighthouse_content_width', 640);
124 124
 }
125
-add_action( 'after_setup_theme', 'lighthouse_content_width', 0 );
125
+add_action('after_setup_theme', 'lighthouse_content_width', 0);
126 126
 
127 127
 /**
128 128
  * Enqueue scripts and styles.
129 129
  */
130 130
 function lighthouse_scripts() {
131 131
 
132
-	wp_enqueue_style( 'lighthouse-style', get_stylesheet_uri() );
132
+	wp_enqueue_style('lighthouse-style', get_stylesheet_uri());
133 133
 
134 134
 	wp_enqueue_style('lighthouse-google-fonts-questrial', 'https://fonts.googleapis.com/css?family=Questrial');
135 135
 
@@ -137,53 +137,53 @@  discard block
 block discarded – undo
137 137
 
138 138
 	wp_enqueue_style('lighthouse-google-fonts-montserrat', 'https://fonts.googleapis.com/css?family=Montserrat:400,700');
139 139
 
140
-	wp_enqueue_script( 'lighthouse-classList-js', 'https://cdnjs.cloudflare.com/ajax/libs/classlist/2014.01.31/classList.min.js', array('jquery'), '');
140
+	wp_enqueue_script('lighthouse-classList-js', 'https://cdnjs.cloudflare.com/ajax/libs/classlist/2014.01.31/classList.min.js', array('jquery'), '');
141 141
 
142
-	wp_enqueue_script( 'lighthouse-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );
142
+	wp_enqueue_script('lighthouse-bootstrap-js', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery'), '', true);
143 143
 
144
-	wp_enqueue_script( 'lighthouse-material-menu-js', get_template_directory_uri() . '/js/materialMenu.min.js', array('jquery'), '', true );
144
+	wp_enqueue_script('lighthouse-material-menu-js', get_template_directory_uri().'/js/materialMenu.min.js', array('jquery'), '', true);
145 145
 
146
-	wp_enqueue_script( 'lighthouse-owl-carousel-js', get_template_directory_uri() . '/js/owl-carousel.min.js', array('jquery'), '', true );
146
+	wp_enqueue_script('lighthouse-owl-carousel-js', get_template_directory_uri().'/js/owl-carousel.min.js', array('jquery'), '', true);
147 147
 
148
-	wp_enqueue_script( 'lighthouse-match-height-js', get_template_directory_uri() . '/js/jquery.matchHeight-min.js', array('jquery'), '', true );
148
+	wp_enqueue_script('lighthouse-match-height-js', get_template_directory_uri().'/js/jquery.matchHeight-min.js', array('jquery'), '', true);
149 149
 
150
-	wp_enqueue_script( 'lighthouse-navigation', get_template_directory_uri() . '/js/navigation.min.js', array(), '20120206', true );
150
+	wp_enqueue_script('lighthouse-navigation', get_template_directory_uri().'/js/navigation.min.js', array(), '20120206', true);
151 151
 
152
-	wp_enqueue_script( 'lighthouse-settings-js', get_template_directory_uri() . '/js/lighthouse-settings.min.js', array('jquery'), '20160220', true );
152
+	wp_enqueue_script('lighthouse-settings-js', get_template_directory_uri().'/js/lighthouse-settings.min.js', array('jquery'), '20160220', true);
153 153
 
154
-	wp_enqueue_script( 'lighthouse-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.min.js', array(), '20130115', true );
154
+	wp_enqueue_script('lighthouse-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.min.js', array(), '20130115', true);
155 155
 
156
-	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
157
-		wp_enqueue_script( 'comment-reply' );
156
+	if (is_singular() && comments_open() && get_option('thread_comments')) {
157
+		wp_enqueue_script('comment-reply');
158 158
 	}
159 159
 }
160
-add_action( 'wp_enqueue_scripts', 'lighthouse_scripts' );
160
+add_action('wp_enqueue_scripts', 'lighthouse_scripts');
161 161
 
162 162
 
163 163
 /**
164 164
  * Implement the Custom Header feature.
165 165
  */
166
-require get_template_directory() . '/inc/custom-header.php';
166
+require get_template_directory().'/inc/custom-header.php';
167 167
 
168 168
 /**
169 169
  * Custom template tags for this theme.
170 170
  */
171
-require get_template_directory() . '/inc/template-tags.php';
171
+require get_template_directory().'/inc/template-tags.php';
172 172
 
173 173
 /**
174 174
  * Custom functions that act independently of the theme templates.
175 175
  */
176
-require get_template_directory() . '/inc/extras.php';
176
+require get_template_directory().'/inc/extras.php';
177 177
 
178 178
 /**
179 179
  * Customizer additions.
180 180
  */
181
-require get_template_directory() . '/inc/customizer.php';
181
+require get_template_directory().'/inc/customizer.php';
182 182
 
183 183
 /**
184 184
  * Load Jetpack compatibility file.
185 185
  */
186
-require get_template_directory() . '/inc/jetpack.php';
186
+require get_template_directory().'/inc/jetpack.php';
187 187
 
188 188
 
189 189
 /**
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
  */
192 192
 
193 193
 // ACF
194
-include_once( get_stylesheet_directory() . '/includes/acf/acf.php' );
194
+include_once(get_stylesheet_directory().'/includes/acf/acf.php');
195 195
 
196 196
 // ACF Settings
197
-include_once( get_stylesheet_directory() . '/includes/acf-settings.php' );
197
+include_once(get_stylesheet_directory().'/includes/acf-settings.php');
198 198
 
199 199
 // Widgets
200
-include_once( get_stylesheet_directory() . '/includes/widgets.php' );
200
+include_once(get_stylesheet_directory().'/includes/widgets.php');
201 201
 
202 202
 // Menus
203
-include_once( get_stylesheet_directory() . '/includes/menus.php' );
203
+include_once(get_stylesheet_directory().'/includes/menus.php');
204 204
 
205 205
 // Theme Settings
206
-include_once( get_stylesheet_directory() . '/includes/theme-settings.php' );
206
+include_once(get_stylesheet_directory().'/includes/theme-settings.php');
207 207
 
208 208
 // Shortcodes
209
-include_once( get_stylesheet_directory() . '/includes/shortcodes.php' );
209
+include_once(get_stylesheet_directory().'/includes/shortcodes.php');
Please login to merge, or discard this patch.
inc/template-tags.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,69 +7,69 @@  discard block
 block discarded – undo
7 7
  * @package Lighthouse
8 8
  */
9 9
 
10
-if ( ! function_exists( 'lighthouse_posted_on' ) ) :
10
+if ( ! function_exists('lighthouse_posted_on')) :
11 11
 /**
12 12
  * Prints HTML with meta information for the current post-date/time and author.
13 13
  */
14 14
 function lighthouse_posted_on() {
15 15
 	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
16
-	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
16
+	if (get_the_time('U') !== get_the_modified_time('U')) {
17 17
 		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
18 18
 	}
19 19
 
20
-	$time_string = sprintf( $time_string,
21
-		esc_attr( get_the_date( 'c' ) ),
22
-		esc_html( get_the_date() ),
23
-		esc_attr( get_the_modified_date( 'c' ) ),
24
-		esc_html( get_the_modified_date() )
20
+	$time_string = sprintf($time_string,
21
+		esc_attr(get_the_date('c')),
22
+		esc_html(get_the_date()),
23
+		esc_attr(get_the_modified_date('c')),
24
+		esc_html(get_the_modified_date())
25 25
 	);
26 26
 
27 27
 	$posted_on = sprintf(
28
-		esc_html_x( 'Posted on %s', 'post date', 'lighthouse' ),
29
-		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
28
+		esc_html_x('Posted on %s', 'post date', 'lighthouse'),
29
+		'<a href="'.esc_url(get_permalink()).'" rel="bookmark">'.$time_string.'</a>'
30 30
 	);
31 31
 
32 32
 	$byline = sprintf(
33
-		esc_html_x( 'by %s', 'post author', 'lighthouse' ),
34
-		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
33
+		esc_html_x('by %s', 'post author', 'lighthouse'),
34
+		'<span class="author vcard"><a class="url fn n" href="'.esc_url(get_author_posts_url(get_the_author_meta('ID'))).'">'.esc_html(get_the_author()).'</a></span>'
35 35
 	);
36 36
 
37
-	echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
37
+	echo '<span class="posted-on">'.$posted_on.'</span><span class="byline"> '.$byline.'</span>'; // WPCS: XSS OK.
38 38
 
39 39
 }
40 40
 endif;
41 41
 
42
-if ( ! function_exists( 'lighthouse_entry_footer' ) ) :
42
+if ( ! function_exists('lighthouse_entry_footer')) :
43 43
 /**
44 44
  * Prints HTML with meta information for the categories, tags and comments.
45 45
  */
46 46
 function lighthouse_entry_footer() {
47 47
 	// Hide category and tag text for pages.
48
-	if ( 'post' === get_post_type() ) {
48
+	if ('post' === get_post_type()) {
49 49
 		/* translators: used between list items, there is a space after the comma */
50
-		$categories_list = get_the_category_list( esc_html__( ', ', 'lighthouse' ) );
51
-		if ( $categories_list && lighthouse_categorized_blog() ) {
52
-			printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'lighthouse' ) . '</span>', $categories_list ); // WPCS: XSS OK.
50
+		$categories_list = get_the_category_list(esc_html__(', ', 'lighthouse'));
51
+		if ($categories_list && lighthouse_categorized_blog()) {
52
+			printf('<span class="cat-links">'.esc_html__('Posted in %1$s', 'lighthouse').'</span>', $categories_list); // WPCS: XSS OK.
53 53
 		}
54 54
 
55 55
 		/* translators: used between list items, there is a space after the comma */
56
-		$tags_list = get_the_tag_list( '', esc_html__( ', ', 'lighthouse' ) );
57
-		if ( $tags_list ) {
58
-			printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'lighthouse' ) . '</span>', $tags_list ); // WPCS: XSS OK.
56
+		$tags_list = get_the_tag_list('', esc_html__(', ', 'lighthouse'));
57
+		if ($tags_list) {
58
+			printf('<span class="tags-links">'.esc_html__('Tagged %1$s', 'lighthouse').'</span>', $tags_list); // WPCS: XSS OK.
59 59
 		}
60 60
 	}
61 61
 
62
-	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
62
+	if ( ! is_single() && ! post_password_required() && (comments_open() || get_comments_number())) {
63 63
 		echo '<span class="comments-link">';
64
-		comments_popup_link( esc_html__( 'Leave a comment', 'lighthouse' ), esc_html__( '1 Comment', 'lighthouse' ), esc_html__( '% Comments', 'lighthouse' ) );
64
+		comments_popup_link(esc_html__('Leave a comment', 'lighthouse'), esc_html__('1 Comment', 'lighthouse'), esc_html__('% Comments', 'lighthouse'));
65 65
 		echo '</span>';
66 66
 	}
67 67
 
68 68
 	edit_post_link(
69 69
 		sprintf(
70 70
 			/* translators: %s: Name of current post */
71
-			esc_html__( 'Edit %s', 'lighthouse' ),
72
-			the_title( '<span class="screen-reader-text">"', '"</span>', false )
71
+			esc_html__('Edit %s', 'lighthouse'),
72
+			the_title('<span class="screen-reader-text">"', '"</span>', false)
73 73
 		),
74 74
 		'<span class="edit-link">',
75 75
 		'</span>'
@@ -83,22 +83,22 @@  discard block
 block discarded – undo
83 83
  * @return bool
84 84
  */
85 85
 function lighthouse_categorized_blog() {
86
-	if ( false === ( $all_the_cool_cats = get_transient( 'lighthouse_categories' ) ) ) {
86
+	if (false === ($all_the_cool_cats = get_transient('lighthouse_categories'))) {
87 87
 		// Create an array of all the categories that are attached to posts.
88
-		$all_the_cool_cats = get_categories( array(
88
+		$all_the_cool_cats = get_categories(array(
89 89
 			'fields'     => 'ids',
90 90
 			'hide_empty' => 1,
91 91
 			// We only need to know if there is more than one category.
92 92
 			'number'     => 2,
93
-		) );
93
+		));
94 94
 
95 95
 		// Count the number of categories that are attached to the posts.
96
-		$all_the_cool_cats = count( $all_the_cool_cats );
96
+		$all_the_cool_cats = count($all_the_cool_cats);
97 97
 
98
-		set_transient( 'lighthouse_categories', $all_the_cool_cats );
98
+		set_transient('lighthouse_categories', $all_the_cool_cats);
99 99
 	}
100 100
 
101
-	if ( $all_the_cool_cats > 1 ) {
101
+	if ($all_the_cool_cats > 1) {
102 102
 		// This blog has more than 1 category so lighthouse_categorized_blog should return true.
103 103
 		return true;
104 104
 	} else {
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
  * Flush out the transients used in lighthouse_categorized_blog.
112 112
  */
113 113
 function lighthouse_category_transient_flusher() {
114
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
114
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
115 115
 		return;
116 116
 	}
117 117
 	// Like, beat it. Dig?
118
-	delete_transient( 'lighthouse_categories' );
118
+	delete_transient('lighthouse_categories');
119 119
 }
120
-add_action( 'edit_category', 'lighthouse_category_transient_flusher' );
121
-add_action( 'save_post',     'lighthouse_category_transient_flusher' );
122 120
\ No newline at end of file
121
+add_action('edit_category', 'lighthouse_category_transient_flusher');
122
+add_action('save_post', 'lighthouse_category_transient_flusher');
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
includes/acf-settings.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  
9 9
 function my_acf_settings_path( $path ) {
10 10
  
11
-    // update path
12
-    $path = get_stylesheet_directory() . '/includes/acf/';
11
+	// update path
12
+	$path = get_stylesheet_directory() . '/includes/acf/';
13 13
     
14
-    // return
15
-    return $path;
14
+	// return
15
+	return $path;
16 16
 }
17 17
 
18 18
 // Customize ACF dir
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
  
21 21
 function my_acf_settings_dir( $dir ) {
22 22
  
23
-    // update path
24
-    $dir = get_stylesheet_directory_uri() . '/includes/acf/';
23
+	// update path
24
+	$dir = get_stylesheet_directory_uri() . '/includes/acf/';
25 25
     
26
-    // return
27
-    return $dir;
26
+	// return
27
+	return $dir;
28 28
 }
29 29
 
30 30
 // Save ACF field as JSON
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
  
33 33
 function my_acf_json_save_point( $path ) {
34 34
     
35
-    // update path
36
-    $path = get_stylesheet_directory() . '/includes/acf-json';
35
+	// update path
36
+	$path = get_stylesheet_directory() . '/includes/acf-json';
37 37
     
38
-    // return
39
-    return $path; 
38
+	// return
39
+	return $path; 
40 40
 }
41 41
 
42 42
 // Load ACF field from JSON
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 
45 45
 function my_acf_json_load_point( $paths ) {
46 46
     
47
-    // remove original path (optional)
48
-    unset($paths[0]);
47
+	// remove original path (optional)
48
+	unset($paths[0]);
49 49
     
50
-    // append path
51
-    $paths[] = get_stylesheet_directory() . '/includes/acf-json';
50
+	// append path
51
+	$paths[] = get_stylesheet_directory() . '/includes/acf-json';
52 52
     
53
-    // return
54
-    return $paths;
53
+	// return
54
+	return $paths;
55 55
 }
56 56
 
57 57
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 // Customize ACF path
7 7
 add_filter('acf/settings/path', 'my_acf_settings_path');
8 8
  
9
-function my_acf_settings_path( $path ) {
9
+function my_acf_settings_path($path) {
10 10
  
11 11
     // update path
12
-    $path = get_stylesheet_directory() . '/includes/acf/';
12
+    $path = get_stylesheet_directory().'/includes/acf/';
13 13
     
14 14
     // return
15 15
     return $path;
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 // Customize ACF dir
19 19
 add_filter('acf/settings/dir', 'my_acf_settings_dir');
20 20
  
21
-function my_acf_settings_dir( $dir ) {
21
+function my_acf_settings_dir($dir) {
22 22
  
23 23
     // update path
24
-    $dir = get_stylesheet_directory_uri() . '/includes/acf/';
24
+    $dir = get_stylesheet_directory_uri().'/includes/acf/';
25 25
     
26 26
     // return
27 27
     return $dir;
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 // Save ACF field as JSON
31 31
 add_filter('acf/settings/save_json', 'my_acf_json_save_point');
32 32
  
33
-function my_acf_json_save_point( $path ) {
33
+function my_acf_json_save_point($path) {
34 34
     
35 35
     // update path
36
-    $path = get_stylesheet_directory() . '/includes/acf-json';
36
+    $path = get_stylesheet_directory().'/includes/acf-json';
37 37
     
38 38
     // return
39 39
     return $path; 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 // Load ACF field from JSON
43 43
 add_filter('acf/settings/load_json', 'my_acf_json_load_point');
44 44
 
45
-function my_acf_json_load_point( $paths ) {
45
+function my_acf_json_load_point($paths) {
46 46
     
47 47
     // remove original path (optional)
48 48
     unset($paths[0]);
49 49
     
50 50
     // append path
51
-    $paths[] = get_stylesheet_directory() . '/includes/acf-json';
51
+    $paths[] = get_stylesheet_directory().'/includes/acf-json';
52 52
     
53 53
     // return
54 54
     return $paths;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 /**************
59 59
   Options Page
60 60
 ***************/
61
-if( function_exists('acf_add_options_page') ) {
61
+if (function_exists('acf_add_options_page')) {
62 62
 	
63 63
 	acf_add_options_page(array(
64 64
 		'page_title' 	=> 'Lighthouse General Settings',
Please login to merge, or discard this patch.
includes/acf/acf.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -263,16 +263,16 @@  discard block
 block discarded – undo
263 263
 		// register post type 'acf-field-group'
264 264
 		register_post_type('acf-field-group', array(
265 265
 			'labels'			=> array(
266
-			    'name'					=> __( 'Field Groups', 'acf' ),
266
+				'name'					=> __( 'Field Groups', 'acf' ),
267 267
 				'singular_name'			=> __( 'Field Group', 'acf' ),
268
-			    'add_new'				=> __( 'Add New' , 'acf' ),
269
-			    'add_new_item'			=> __( 'Add New Field Group' , 'acf' ),
270
-			    'edit_item'				=> __( 'Edit Field Group' , 'acf' ),
271
-			    'new_item'				=> __( 'New Field Group' , 'acf' ),
272
-			    'view_item'				=> __( 'View Field Group', 'acf' ),
273
-			    'search_items'			=> __( 'Search Field Groups', 'acf' ),
274
-			    'not_found'				=> __( 'No Field Groups found', 'acf' ),
275
-			    'not_found_in_trash'	=> __( 'No Field Groups found in Trash', 'acf' ), 
268
+				'add_new'				=> __( 'Add New' , 'acf' ),
269
+				'add_new_item'			=> __( 'Add New Field Group' , 'acf' ),
270
+				'edit_item'				=> __( 'Edit Field Group' , 'acf' ),
271
+				'new_item'				=> __( 'New Field Group' , 'acf' ),
272
+				'view_item'				=> __( 'View Field Group', 'acf' ),
273
+				'search_items'			=> __( 'Search Field Groups', 'acf' ),
274
+				'not_found'				=> __( 'No Field Groups found', 'acf' ),
275
+				'not_found_in_trash'	=> __( 'No Field Groups found in Trash', 'acf' ), 
276 276
 			),
277 277
 			'public'			=> false,
278 278
 			'show_ui'			=> true,
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
 		// register post type 'acf-field'
296 296
 		register_post_type('acf-field', array(
297 297
 			'labels'			=> array(
298
-			    'name'					=> __( 'Fields', 'acf' ),
298
+				'name'					=> __( 'Fields', 'acf' ),
299 299
 				'singular_name'			=> __( 'Field', 'acf' ),
300
-			    'add_new'				=> __( 'Add New' , 'acf' ),
301
-			    'add_new_item'			=> __( 'Add New Field' , 'acf' ),
302
-			    'edit_item'				=> __( 'Edit Field' , 'acf' ),
303
-			    'new_item'				=> __( 'New Field' , 'acf' ),
304
-			    'view_item'				=> __( 'View Field', 'acf' ),
305
-			    'search_items'			=> __( 'Search Fields', 'acf' ),
306
-			    'not_found'				=> __( 'No Fields found', 'acf' ),
307
-			    'not_found_in_trash'	=> __( 'No Fields found in Trash', 'acf' ), 
300
+				'add_new'				=> __( 'Add New' , 'acf' ),
301
+				'add_new_item'			=> __( 'Add New Field' , 'acf' ),
302
+				'edit_item'				=> __( 'Edit Field' , 'acf' ),
303
+				'new_item'				=> __( 'New Field' , 'acf' ),
304
+				'view_item'				=> __( 'View Field', 'acf' ),
305
+				'search_items'			=> __( 'Search Fields', 'acf' ),
306
+				'not_found'				=> __( 'No Fields found', 'acf' ),
307
+				'not_found_in_trash'	=> __( 'No Fields found in Trash', 'acf' ), 
308 308
 			),
309 309
 			'public'			=> false,
310 310
 			'show_ui'			=> false,
@@ -413,27 +413,27 @@  discard block
 block discarded – undo
413 413
 		
414 414
 			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
415 415
 			
416
-	    }
416
+		}
417 417
 	    
418 418
 	    
419
-	    // acf_field_name
420
-	    if( $field_name = $wp_query->get('acf_field_name') ) {
419
+		// acf_field_name
420
+		if( $field_name = $wp_query->get('acf_field_name') ) {
421 421
 	    
422 422
 			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
423 423
 			
424
-	    }
424
+		}
425 425
 	    
426 426
 	    
427
-	    // acf_group_key
427
+		// acf_group_key
428 428
 		if( $group_key = $wp_query->get('acf_group_key') ) {
429 429
 		
430 430
 			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
431 431
 			
432
-	    }
432
+		}
433 433
 	    
434 434
 	    
435
-	    // return
436
-	    return $where;
435
+		// return
436
+		return $where;
437 437
 	    
438 438
 	}
439 439
 	
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 Domain Path: /lang
12 12
 */
13 13
 
14
-if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly
15 15
 
16
-if( ! class_exists('acf') ) :
16
+if ( ! class_exists('acf')) :
17 17
 
18 18
 class acf {
19 19
 	
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 			'version'			=> '5.3.3.1',
65 65
 						
66 66
 			// urls
67
-			'basename'			=> plugin_basename( __FILE__ ),
68
-			'path'				=> plugin_dir_path( __FILE__ ),
69
-			'dir'				=> plugin_dir_url( __FILE__ ),
67
+			'basename'			=> plugin_basename(__FILE__),
68
+			'path'				=> plugin_dir_path(__FILE__),
69
+			'dir'				=> plugin_dir_url(__FILE__),
70 70
 			
71 71
 			// options
72 72
 			'show_admin'		=> true,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		
123 123
 		
124 124
 		// admin
125
-		if( is_admin() ) {
125
+		if (is_admin()) {
126 126
 			
127 127
 			acf_include('admin/admin.php');
128 128
 			acf_include('admin/field-group.php');
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 		
140 140
 		
141 141
 		// actions
142
-		add_action('init',	array($this, 'init'), 5);
143
-		add_action('init',	array($this, 'register_post_types'), 5);
144
-		add_action('init',	array($this, 'register_post_status'), 5);
145
-		add_action('init',	array($this, 'register_assets'), 5);
142
+		add_action('init', array($this, 'init'), 5);
143
+		add_action('init', array($this, 'register_post_types'), 5);
144
+		add_action('init', array($this, 'register_post_status'), 5);
145
+		add_action('init', array($this, 'register_assets'), 5);
146 146
 		
147 147
 		
148 148
 		// filters
149
-		add_filter('posts_where',		array($this, 'posts_where'), 10, 2 );
149
+		add_filter('posts_where', array($this, 'posts_where'), 10, 2);
150 150
 		//add_filter('posts_request',	array($this, 'posts_request'), 10, 1 );
151 151
 		
152 152
 	}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	function init() {
169 169
 		
170 170
 		// bail early if a plugin called get_field early
171
-		if( !did_action('plugins_loaded') ) return;
171
+		if ( ! did_action('plugins_loaded')) return;
172 172
 		
173 173
 		
174 174
 		// bail early if already init
175
-		if( acf_get_setting('init') ) return;
175
+		if (acf_get_setting('init')) return;
176 176
 		
177 177
 		
178 178
 		// only run once
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
 		
181 181
 		
182 182
 		// vars
183
-		$major = intval( acf_get_setting('version') );
183
+		$major = intval(acf_get_setting('version'));
184 184
 		
185 185
 		
186 186
 		// redeclare dir
187 187
 		// - allow another plugin to modify dir (maybe force SSL)
188
-		acf_update_setting('dir', plugin_dir_url( __FILE__ ));
188
+		acf_update_setting('dir', plugin_dir_url(__FILE__));
189 189
 		
190 190
 		
191 191
 		// set text domain
192
-		load_textdomain( 'acf', acf_get_path( 'lang/acf-' . get_locale() . '.mo' ) );
192
+		load_textdomain('acf', acf_get_path('lang/acf-'.get_locale().'.mo'));
193 193
 		
194 194
 		
195 195
 		// include wpml support
196
-		if( defined('ICL_SITEPRESS_VERSION') ) {
196
+		if (defined('ICL_SITEPRESS_VERSION')) {
197 197
 		
198 198
 			acf_include('core/wpml.php');
199 199
 			
@@ -263,16 +263,16 @@  discard block
 block discarded – undo
263 263
 		// register post type 'acf-field-group'
264 264
 		register_post_type('acf-field-group', array(
265 265
 			'labels'			=> array(
266
-			    'name'					=> __( 'Field Groups', 'acf' ),
267
-				'singular_name'			=> __( 'Field Group', 'acf' ),
268
-			    'add_new'				=> __( 'Add New' , 'acf' ),
269
-			    'add_new_item'			=> __( 'Add New Field Group' , 'acf' ),
270
-			    'edit_item'				=> __( 'Edit Field Group' , 'acf' ),
271
-			    'new_item'				=> __( 'New Field Group' , 'acf' ),
272
-			    'view_item'				=> __( 'View Field Group', 'acf' ),
273
-			    'search_items'			=> __( 'Search Field Groups', 'acf' ),
274
-			    'not_found'				=> __( 'No Field Groups found', 'acf' ),
275
-			    'not_found_in_trash'	=> __( 'No Field Groups found in Trash', 'acf' ), 
266
+			    'name'					=> __('Field Groups', 'acf'),
267
+				'singular_name'			=> __('Field Group', 'acf'),
268
+			    'add_new'				=> __('Add New', 'acf'),
269
+			    'add_new_item'			=> __('Add New Field Group', 'acf'),
270
+			    'edit_item'				=> __('Edit Field Group', 'acf'),
271
+			    'new_item'				=> __('New Field Group', 'acf'),
272
+			    'view_item'				=> __('View Field Group', 'acf'),
273
+			    'search_items'			=> __('Search Field Groups', 'acf'),
274
+			    'not_found'				=> __('No Field Groups found', 'acf'),
275
+			    'not_found_in_trash'	=> __('No Field Groups found in Trash', 'acf'), 
276 276
 			),
277 277
 			'public'			=> false,
278 278
 			'show_ui'			=> true,
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
 		// register post type 'acf-field'
296 296
 		register_post_type('acf-field', array(
297 297
 			'labels'			=> array(
298
-			    'name'					=> __( 'Fields', 'acf' ),
299
-				'singular_name'			=> __( 'Field', 'acf' ),
300
-			    'add_new'				=> __( 'Add New' , 'acf' ),
301
-			    'add_new_item'			=> __( 'Add New Field' , 'acf' ),
302
-			    'edit_item'				=> __( 'Edit Field' , 'acf' ),
303
-			    'new_item'				=> __( 'New Field' , 'acf' ),
304
-			    'view_item'				=> __( 'View Field', 'acf' ),
305
-			    'search_items'			=> __( 'Search Fields', 'acf' ),
306
-			    'not_found'				=> __( 'No Fields found', 'acf' ),
307
-			    'not_found_in_trash'	=> __( 'No Fields found in Trash', 'acf' ), 
298
+			    'name'					=> __('Fields', 'acf'),
299
+				'singular_name'			=> __('Field', 'acf'),
300
+			    'add_new'				=> __('Add New', 'acf'),
301
+			    'add_new_item'			=> __('Add New Field', 'acf'),
302
+			    'edit_item'				=> __('Edit Field', 'acf'),
303
+			    'new_item'				=> __('New Field', 'acf'),
304
+			    'view_item'				=> __('View Field', 'acf'),
305
+			    'search_items'			=> __('Search Fields', 'acf'),
306
+			    'not_found'				=> __('No Fields found', 'acf'),
307
+			    'not_found_in_trash'	=> __('No Fields found in Trash', 'acf'), 
308 308
 			),
309 309
 			'public'			=> false,
310 310
 			'show_ui'			=> false,
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 		
344 344
 		// acf-disabled
345 345
 		register_post_status('acf-disabled', array(
346
-			'label'                     => __( 'Disabled', 'acf' ),
346
+			'label'                     => __('Disabled', 'acf'),
347 347
 			'public'                    => true,
348 348
 			'exclude_from_search'       => false,
349 349
 			'show_in_admin_all_list'    => true,
350 350
 			'show_in_admin_status_list' => true,
351
-			'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf' ),
351
+			'label_count'               => _n_noop('Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf'),
352 352
 		));
353 353
 		
354 354
 	}
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 		
377 377
 		
378 378
 		// scripts
379
-		wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version );
380
-		wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version );
379
+		wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version);
380
+		wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version);
381 381
 		
382 382
 		
383 383
 		// styles
384
-		wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version );
385
-		wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version );
386
-		wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version );
384
+		wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version);
385
+		wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version);
386
+		wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version);
387 387
 		
388 388
 	}
389 389
 	
@@ -402,32 +402,32 @@  discard block
 block discarded – undo
402 402
 	*  @return	$where (string)
403 403
 	*/
404 404
 	
405
-	function posts_where( $where, $wp_query ) {
405
+	function posts_where($where, $wp_query) {
406 406
 		
407 407
 		// global
408 408
 		global $wpdb;
409 409
 		
410 410
 		
411 411
 		// acf_field_key
412
-		if( $field_key = $wp_query->get('acf_field_key') ) {
412
+		if ($field_key = $wp_query->get('acf_field_key')) {
413 413
 		
414
-			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key );
414
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key);
415 415
 			
416 416
 	    }
417 417
 	    
418 418
 	    
419 419
 	    // acf_field_name
420
-	    if( $field_name = $wp_query->get('acf_field_name') ) {
420
+	    if ($field_name = $wp_query->get('acf_field_name')) {
421 421
 	    
422
-			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name );
422
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name);
423 423
 			
424 424
 	    }
425 425
 	    
426 426
 	    
427 427
 	    // acf_group_key
428
-		if( $group_key = $wp_query->get('acf_group_key') ) {
428
+		if ($group_key = $wp_query->get('acf_group_key')) {
429 429
 		
430
-			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key );
430
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key);
431 431
 			
432 432
 	    }
433 433
 	    
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 	global $acf;
470 470
 	
471
-	if( !isset($acf) ) {
471
+	if ( ! isset($acf)) {
472 472
 	
473 473
 		$acf = new acf();
474 474
 		
Please login to merge, or discard this patch.
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,10 @@  discard block
 block discarded – undo
11 11
 Domain Path: /lang
12 12
 */
13 13
 
14
-if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
+if( ! defined( 'ABSPATH' ) ) {
15
+	exit;
16
+}
17
+// Exit if accessed directly
15 18
 
16 19
 if( ! class_exists('acf') ) :
17 20
 
@@ -168,11 +171,15 @@  discard block
 block discarded – undo
168 171
 	function init() {
169 172
 		
170 173
 		// bail early if a plugin called get_field early
171
-		if( !did_action('plugins_loaded') ) return;
174
+		if( !did_action('plugins_loaded') ) {
175
+			return;
176
+		}
172 177
 		
173 178
 		
174 179
 		// bail early if already init
175
-		if( acf_get_setting('init') ) return;
180
+		if( acf_get_setting('init') ) {
181
+			return;
182
+		}
176 183
 		
177 184
 		
178 185
 		// only run once
Please login to merge, or discard this patch.
includes/acf/admin/admin.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	function __construct() {
19 19
 	
20 20
 		// actions
21
-		add_action('admin_menu', 			array($this, 'admin_menu'));
22
-		add_action('admin_enqueue_scripts',	array($this, 'admin_enqueue_scripts'), 0);
23
-		add_action('admin_notices', 		array($this, 'admin_notices'));
21
+		add_action('admin_menu', array($this, 'admin_menu'));
22
+		add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 0);
23
+		add_action('admin_notices', array($this, 'admin_notices'));
24 24
 		
25 25
 	}
26 26
 	
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	function admin_menu() {
42 42
 		
43 43
 		// bail early if no show_admin
44
-		if( !acf_get_setting('show_admin') ) {
44
+		if ( ! acf_get_setting('show_admin')) {
45 45
 			
46 46
 			return;
47 47
 			
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 		
55 55
 		
56 56
 		// add parent
57
-		add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025');
57
+		add_menu_page(__("Custom Fields", 'acf'), __("Custom Fields", 'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025');
58 58
 		
59 59
 		
60 60
 		// add children
61
-		add_submenu_page($slug, __('Field Groups','acf'), __('Field Groups','acf'), $cap, $slug );
62
-		add_submenu_page($slug, __('Add New','acf'), __('Add New','acf'), $cap, 'post-new.php?post_type=acf-field-group' );
61
+		add_submenu_page($slug, __('Field Groups', 'acf'), __('Field Groups', 'acf'), $cap, $slug);
62
+		add_submenu_page($slug, __('Add New', 'acf'), __('Add New', 'acf'), $cap, 'post-new.php?post_type=acf-field-group');
63 63
 		
64 64
 	}
65 65
 	
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	
80 80
 	function admin_enqueue_scripts() {
81 81
 		
82
-		wp_enqueue_style( 'acf-global' );
82
+		wp_enqueue_style('acf-global');
83 83
 		
84 84
 	}
85 85
 	
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 		
105 105
 		
106 106
 		// bail early if no notices
107
-		if( empty($admin_notices) ) {
107
+		if (empty($admin_notices)) {
108 108
 			
109 109
 			return;
110 110
 			
111 111
 		}
112 112
 		
113 113
 		
114
-		foreach( $admin_notices as $notice ) {
114
+		foreach ($admin_notices as $notice) {
115 115
 			
116 116
 			$open = '';
117 117
 			$close = '';
118 118
 				
119
-			if( $notice['wrap'] ) {
119
+			if ($notice['wrap']) {
120 120
 				
121 121
 				$open = "<{$notice['wrap']}>";
122 122
 				$close = "</{$notice['wrap']}>";
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			}
125 125
 				
126 126
 			?>
127
-			<div class="notice is-dismissible <?php echo $notice['class']; ?>"><?php echo $open . $notice['text'] . $close; ?></div>
127
+			<div class="notice is-dismissible <?php echo $notice['class']; ?>"><?php echo $open.$notice['text'].$close; ?></div>
128 128
 			<?php
129 129
 				
130 130
 		}
Please login to merge, or discard this patch.