Completed
Push — master ( af0f5c...e208fb )
by Md. Mozahidur
03:34
created
includes/acf/admin/views/field-group-options.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,46 +2,46 @@  discard block
 block discarded – undo
2 2
 
3 3
 // active
4 4
 acf_render_field_wrap(array(
5
-	'label'			=> __('Status','acf'),
5
+	'label'			=> __('Status', 'acf'),
6 6
 	'instructions'	=> '',
7 7
 	'type'			=> 'select',
8 8
 	'name'			=> 'active',
9 9
 	'prefix'		=> 'acf_field_group',
10 10
 	'value'			=> $field_group['active'],
11 11
 	'choices' 		=> array(
12
-		1				=>	__("Active",'acf'),
13
-		0				=>	__("Disabled",'acf'),
12
+		1				=>	__("Active", 'acf'),
13
+		0				=>	__("Disabled", 'acf'),
14 14
 	)
15 15
 ));
16 16
 
17 17
 
18 18
 // style
19 19
 acf_render_field_wrap(array(
20
-	'label'			=> __('Style','acf'),
20
+	'label'			=> __('Style', 'acf'),
21 21
 	'instructions'	=> '',
22 22
 	'type'			=> 'select',
23 23
 	'name'			=> 'style',
24 24
 	'prefix'		=> 'acf_field_group',
25 25
 	'value'			=> $field_group['style'],
26 26
 	'choices' 		=> array(
27
-		'default'			=>	__("Standard (WP metabox)",'acf'),
28
-		'seamless'			=>	__("Seamless (no metabox)",'acf'),
27
+		'default'			=>	__("Standard (WP metabox)", 'acf'),
28
+		'seamless'			=>	__("Seamless (no metabox)", 'acf'),
29 29
 	)
30 30
 ));
31 31
 
32 32
 
33 33
 // position
34 34
 acf_render_field_wrap(array(
35
-	'label'			=> __('Position','acf'),
35
+	'label'			=> __('Position', 'acf'),
36 36
 	'instructions'	=> '',
37 37
 	'type'			=> 'select',
38 38
 	'name'			=> 'position',
39 39
 	'prefix'		=> 'acf_field_group',
40 40
 	'value'			=> $field_group['position'],
41 41
 	'choices' 		=> array(
42
-		'acf_after_title'	=> __("High (after title)",'acf'),
43
-		'normal'			=> __("Normal (after content)",'acf'),
44
-		'side' 				=> __("Side",'acf'),
42
+		'acf_after_title'	=> __("High (after title)", 'acf'),
43
+		'normal'			=> __("Normal (after content)", 'acf'),
44
+		'side' 				=> __("Side", 'acf'),
45 45
 	),
46 46
 	'default_value'	=> 'normal'
47 47
 ));
@@ -49,38 +49,38 @@  discard block
 block discarded – undo
49 49
 
50 50
 // label_placement
51 51
 acf_render_field_wrap(array(
52
-	'label'			=> __('Label placement','acf'),
52
+	'label'			=> __('Label placement', 'acf'),
53 53
 	'instructions'	=> '',
54 54
 	'type'			=> 'select',
55 55
 	'name'			=> 'label_placement',
56 56
 	'prefix'		=> 'acf_field_group',
57 57
 	'value'			=> $field_group['label_placement'],
58 58
 	'choices' 		=> array(
59
-		'top'			=>	__("Top aligned",'acf'),
60
-		'left'			=>	__("Left Aligned",'acf'),
59
+		'top'			=>	__("Top aligned", 'acf'),
60
+		'left'			=>	__("Left Aligned", 'acf'),
61 61
 	)
62 62
 ));
63 63
 
64 64
 
65 65
 // instruction_placement
66 66
 acf_render_field_wrap(array(
67
-	'label'			=> __('Instruction placement','acf'),
67
+	'label'			=> __('Instruction placement', 'acf'),
68 68
 	'instructions'	=> '',
69 69
 	'type'			=> 'select',
70 70
 	'name'			=> 'instruction_placement',
71 71
 	'prefix'		=> 'acf_field_group',
72 72
 	'value'			=> $field_group['instruction_placement'],
73 73
 	'choices' 		=> array(
74
-		'label'		=>	__("Below labels",'acf'),
75
-		'field'		=>	__("Below fields",'acf'),
74
+		'label'		=>	__("Below labels", 'acf'),
75
+		'field'		=>	__("Below fields", 'acf'),
76 76
 	)
77 77
 ));
78 78
 
79 79
 
80 80
 // menu_order
81 81
 acf_render_field_wrap(array(
82
-	'label'			=> __('Order No.','acf'),
83
-	'instructions'	=> __('Field groups with a lower order will appear first','acf'),
82
+	'label'			=> __('Order No.', 'acf'),
83
+	'instructions'	=> __('Field groups with a lower order will appear first', 'acf'),
84 84
 	'type'			=> 'number',
85 85
 	'name'			=> 'menu_order',
86 86
 	'prefix'		=> 'acf_field_group',
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
 // description
92 92
 acf_render_field_wrap(array(
93
-	'label'			=> __('Description','acf'),
94
-	'instructions'	=> __('Shown in field group list','acf'),
93
+	'label'			=> __('Description', 'acf'),
94
+	'instructions'	=> __('Shown in field group list', 'acf'),
95 95
 	'type'			=> 'text',
96 96
 	'name'			=> 'description',
97 97
 	'prefix'		=> 'acf_field_group',
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 
102 102
 // hide on screen
103 103
 acf_render_field_wrap(array(
104
-	'label'			=> __('Hide on screen','acf'),
105
-	'instructions'	=> __('<b>Select</b> items to <b>hide</b> them from the edit screen.','acf') . '<br /><br />' . __("If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)",'acf'),
104
+	'label'			=> __('Hide on screen', 'acf'),
105
+	'instructions'	=> __('<b>Select</b> items to <b>hide</b> them from the edit screen.', 'acf').'<br /><br />'.__("If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)", 'acf'),
106 106
 	'type'			=> 'checkbox',
107 107
 	'name'			=> 'hide_on_screen',
108 108
 	'prefix'		=> 'acf_field_group',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	'toggle'		=> true,
111 111
 	'choices' => array(
112 112
 		'permalink'			=>	__("Permalink", 'acf'),
113
-		'the_content'		=>	__("Content Editor",'acf'),
113
+		'the_content'		=>	__("Content Editor", 'acf'),
114 114
 		'excerpt'			=>	__("Excerpt", 'acf'),
115 115
 		'custom_fields'		=>	__("Custom Fields", 'acf'),
116 116
 		'discussion'		=>	__("Discussion", 'acf'),
Please login to merge, or discard this patch.
includes/acf/admin/views/settings-addons.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
 				
17 17
 				$addon = acf_parse_args($addon, array(
18 18
 					"title"			=> "",
19
-			        "slug"			=> "",
20
-			        "description"	=> "",
21
-			        "thumbnail"		=> "",
22
-			        "url"			=> "",
23
-			        "btn"			=> __("Download & Install",'acf'),
24
-			        "btn_color"		=> ""
19
+					"slug"			=> "",
20
+					"description"	=> "",
21
+					"thumbnail"		=> "",
22
+					"url"			=> "",
23
+					"btn"			=> __("Download & Install",'acf'),
24
+					"btn_color"		=> ""
25 25
 				));
26 26
 				
27 27
 				?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 // vars
4
-$json = acf_extract_var( $args, 'json');
4
+$json = acf_extract_var($args, 'json');
5 5
 
6 6
 ?>
7 7
 <div class="wrap acf-settings-wrap">
8 8
 	
9
-	<h1><?php _e("Add-ons",'acf'); ?></h1>
9
+	<h1><?php _e("Add-ons", 'acf'); ?></h1>
10 10
 	
11 11
 	<div class="add-ons-list acf-cf">
12 12
 		
13
-		<?php if( !empty($json) ): ?>
13
+		<?php if ( ! empty($json)): ?>
14 14
 			
15
-			<?php foreach( $json as $addon ): 
15
+			<?php foreach ($json as $addon): 
16 16
 				
17 17
 				$addon = acf_parse_args($addon, array(
18 18
 					"title"			=> "",
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			        "description"	=> "",
21 21
 			        "thumbnail"		=> "",
22 22
 			        "url"			=> "",
23
-			        "btn"			=> __("Download & Install",'acf'),
23
+			        "btn"			=> __("Download & Install", 'acf'),
24 24
 			        "btn_color"		=> ""
25 25
 				));
26 26
 				
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 						<p><?php echo $addon['description']; ?></p>
39 39
 					</div>
40 40
 					<div class="footer">
41
-						<?php if( apply_filters("acf/is_add_on_active/slug={$addon['slug']}", false ) ): ?>
42
-							<a class="acf-button" disabled="disabled"><?php _e("Installed",'acf'); ?></a>
41
+						<?php if (apply_filters("acf/is_add_on_active/slug={$addon['slug']}", false)): ?>
42
+							<a class="acf-button" disabled="disabled"><?php _e("Installed", 'acf'); ?></a>
43 43
 						<?php else: ?>
44 44
 							<a class="acf-button <?php echo $addon['btn_color']; ?>" target="_blank" href="<?php echo $addon['url']; ?>" ><?php _e($addon['btn']); ?></a>
45 45
 						<?php endif; ?>
46 46
 						
47
-						<?php if( !empty($addon['footer']) ): ?>
47
+						<?php if ( ! empty($addon['footer'])): ?>
48 48
 							<p><?php echo $addon['footer']; ?></p>
49 49
 						<?php endif; ?>
50 50
 					</div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,11 @@
 block discarded – undo
40 40
 					<div class="footer">
41 41
 						<?php if( apply_filters("acf/is_add_on_active/slug={$addon['slug']}", false ) ): ?>
42 42
 							<a class="acf-button" disabled="disabled"><?php _e("Installed",'acf'); ?></a>
43
-						<?php else: ?>
44
-							<a class="acf-button <?php echo $addon['btn_color']; ?>" target="_blank" href="<?php echo $addon['url']; ?>" ><?php _e($addon['btn']); ?></a>
43
+						<?php else {
44
+	: ?>
45
+							<a class="acf-button <?php echo $addon['btn_color'];
46
+}
47
+?>" target="_blank" href="<?php echo $addon['url']; ?>" ><?php _e($addon['btn']); ?></a>
45 48
 						<?php endif; ?>
46 49
 						
47 50
 						<?php if( !empty($addon['footer']) ): ?>
Please login to merge, or discard this patch.
includes/acf/admin/views/settings-info.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@  discard block
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 // extract args
4
-extract( $args );
4
+extract($args);
5 5
 
6 6
 ?>
7 7
 <div class="wrap about-wrap acf-wrap">
8 8
 	
9
-	<h1><?php _e("Welcome to Advanced Custom Fields",'acf'); ?> <?php echo $version; ?></h1>
9
+	<h1><?php _e("Welcome to Advanced Custom Fields", 'acf'); ?> <?php echo $version; ?></h1>
10 10
 	<div class="about-text"><?php printf(__("Thank you for updating! ACF %s is bigger and better than ever before. We hope you like it.", 'acf'), $version); ?></div>
11 11
 	<div class="acf-icon logo">
12 12
 		<i class="acf-sprite-logo"></i>
13 13
 	</div>
14 14
 	
15 15
 	<h2 class="nav-tab-wrapper">
16
-		<?php foreach( $tabs as $tab_slug => $tab_title ): ?>
17
-			<a class="nav-tab<?php if( $active == $tab_slug ): ?> nav-tab-active<?php endif; ?>" href="<?php echo admin_url("edit.php?post_type=acf-field-group&page=acf-settings-info&tab={$tab_slug}"); ?>"><?php echo $tab_title; ?></a>
16
+		<?php foreach ($tabs as $tab_slug => $tab_title): ?>
17
+			<a class="nav-tab<?php if ($active == $tab_slug): ?> nav-tab-active<?php endif; ?>" href="<?php echo admin_url("edit.php?post_type=acf-field-group&page=acf-settings-info&tab={$tab_slug}"); ?>"><?php echo $tab_title; ?></a>
18 18
 		<?php endforeach; ?>
19 19
 	</h2>
20 20
 	
21
-<?php if( $active == 'new' ): ?>
21
+<?php if ($active == 'new'): ?>
22 22
 	
23 23
 	<h2 class="about-headline-callout"><?php _e("A smoother custom field experience", 'acf'); ?></h2>
24 24
 	
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 		
161 161
 	
162 162
 	
163
-<?php elseif( $active == 'changelog' ): ?>
163
+<?php elseif ($active == 'changelog'): ?>
164 164
 	
165 165
 	<p class="about-description"><?php printf(__("We think you'll love the changes in %s.", 'acf'), $version); ?></p>
166 166
 	
167 167
 	<?php
168 168
 		
169
-	$items = file_get_contents( acf_get_path('readme.txt') );
170
-	$items = explode('= ' . $version . ' =', $items);
169
+	$items = file_get_contents(acf_get_path('readme.txt'));
170
+	$items = explode('= '.$version.' =', $items);
171 171
 	
172
-	$items = end( $items );
173
-	$items = current( explode("\n\n", $items) );
174
-	$items = array_filter( array_map('trim', explode("*", $items)) );
172
+	$items = end($items);
173
+	$items = current(explode("\n\n", $items));
174
+	$items = array_filter(array_map('trim', explode("*", $items)));
175 175
 	
176 176
 	?>
177 177
 	<ul class="changelog">
178
-	<?php foreach( $items as $item ): 
178
+	<?php foreach ($items as $item): 
179 179
 		
180 180
 		$item = explode('http', $item);
181 181
 			
182 182
 		?>
183
-		<li><?php echo $item[0]; ?><?php if( isset($item[1]) ): ?><a href="http<?php echo $item[1]; ?>" target="_blank">[...]</a><?php endif; ?></li>
183
+		<li><?php echo $item[0]; ?><?php if (isset($item[1])): ?><a href="http<?php echo $item[1]; ?>" target="_blank">[...]</a><?php endif; ?></li>
184 184
 	<?php endforeach; ?>
185 185
 	</ul>
186 186
 
Please login to merge, or discard this patch.
includes/acf/admin/views/settings-tools-export.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php 
2 2
 
3 3
 // vars
4
-$field_groups = acf_extract_var( $args, 'field_groups');
4
+$field_groups = acf_extract_var($args, 'field_groups');
5 5
 
6 6
 
7 7
 // replace
@@ -32,28 +32,28 @@  discard block
 block discarded – undo
32 32
 			
33 33
 			<textarea class="pre" readonly="true"><?php
34 34
 			
35
-			echo "if( function_exists('acf_add_local_field_group') ):" . "\r\n" . "\r\n";
35
+			echo "if( function_exists('acf_add_local_field_group') ):"."\r\n"."\r\n";
36 36
 			
37
-			foreach( $field_groups as $field_group ) {
37
+			foreach ($field_groups as $field_group) {
38 38
 						
39 39
 				// code
40 40
 				$code = var_export($field_group, true);
41 41
 				
42 42
 				
43 43
 				// change double spaces to tabs
44
-				$code = str_replace( array_keys($str_replace), array_values($str_replace), $code );
44
+				$code = str_replace(array_keys($str_replace), array_values($str_replace), $code);
45 45
 				
46 46
 				
47 47
 				// correctly formats "=> array("
48
-				$code = preg_replace( array_keys($preg_replace), array_values($preg_replace), $code );
48
+				$code = preg_replace(array_keys($preg_replace), array_values($preg_replace), $code);
49 49
 				
50 50
 				
51 51
 				// esc_textarea
52
-				$code = esc_textarea( $code );
52
+				$code = esc_textarea($code);
53 53
 				
54 54
 				
55 55
 				// echo
56
-				echo "acf_add_local_field_group({$code});" . "\r\n" . "\r\n";
56
+				echo "acf_add_local_field_group({$code});"."\r\n"."\r\n";
57 57
 			
58 58
 			}
59 59
 			
Please login to merge, or discard this patch.
includes/acf/admin/views/settings-tools.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 // populate choices
18
-if( $field_groups ) {
18
+if ($field_groups) {
19 19
 	
20
-	foreach( $field_groups as $field_group ) {
20
+	foreach ($field_groups as $field_group) {
21 21
 		
22
-		$field['choices'][ $field_group['key'] ] = $field_group['title'];
22
+		$field['choices'][$field_group['key']] = $field_group['title'];
23 23
 		
24 24
 	}
25 25
 	
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 			
40 40
 			<form method="post" action="">
41 41
 			<div class="acf-hidden">
42
-				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( 'export' ); ?>" />
42
+				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce('export'); ?>" />
43 43
 			</div>
44 44
 			<table class="form-table">
45 45
                 <tbody>
46
-	                <?php acf_render_field_wrap( $field, 'tr' ); ?>
46
+	                <?php acf_render_field_wrap($field, 'tr'); ?>
47 47
 					<tr>
48 48
 						<th></th>
49 49
 						<td>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			
69 69
 			<form method="post" action="" enctype="multipart/form-data">
70 70
 			<div class="acf-hidden">
71
-				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( 'import' ); ?>" />
71
+				<input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce('import'); ?>" />
72 72
 			</div>
73 73
 			<table class="form-table">
74 74
                 <tbody>
Please login to merge, or discard this patch.
includes/acf/admin/views/update-network.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <div id="acf-upgrade-wrap" class="wrap">
7 7
 	
8
-	<h1><?php _e("Advanced Custom Fields Database Upgrade",'acf'); ?></h1>
8
+	<h1><?php _e("Advanced Custom Fields Database Upgrade", 'acf'); ?></h1>
9 9
 	
10
-	<p><?php _e("The following sites require a DB upgrade. Check the ones you want to update and then click “Upgrade Database”.",'acf'); ?></p>
10
+	<p><?php _e("The following sites require a DB upgrade. Check the ones you want to update and then click “Upgrade Database”.", 'acf'); ?></p>
11 11
 	
12 12
 	<p><input type="submit" name="upgrade" value="Update Sites" class="button" id="upgrade-sites"></p>
13 13
 	
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		
32 32
 		<tbody id="the-list">
33 33
 		
34
-		<?php foreach( $sites as $i => $site ): ?>
34
+		<?php foreach ($sites as $i => $site): ?>
35 35
 			
36
-			<tr<?php if( $i % 2 == 0 ): ?> class="alternate"<?php endif; ?>>
36
+			<tr<?php if ($i % 2 == 0): ?> class="alternate"<?php endif; ?>>
37 37
 				<th class="check-column" scope="row">
38
-				<?php if( $site['updates'] ): ?>
38
+				<?php if ($site['updates']): ?>
39 39
 					<input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
40 40
 				<?php endif; ?>
41 41
 				</th>
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 					<strong><?php echo $site['name']; ?></strong><br /><?php echo $site['url']; ?>
44 44
 				</td>
45 45
 				<td>
46
-				<?php if( $site['updates'] ): ?>
46
+				<?php if ($site['updates']): ?>
47 47
 					<span class="response"><?php printf(__('Site requires database upgrade from %s to %s', 'acf'), $site['acf_version'], $plugin_version); ?></span>
48 48
 				<?php else: ?>
49 49
 					<?php _e("Site is up to date", 'acf'); ?>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	
60 60
 	<p><input type="submit" name="upgrade" value="Update Sites" class="button" id="upgrade-sites-2"></p>
61 61
 	
62
-	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo network_admin_url(); ?>"><?php _e("Return to network dashboard",'acf'); ?></a>.</p>
62
+	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo network_admin_url(); ?>"><?php _e("Return to network dashboard", 'acf'); ?></a>.</p>
63 63
 	
64 64
 	<style type="text/css">
65 65
 		
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,11 @@
 block discarded – undo
45 45
 				<td>
46 46
 				<?php if( $site['updates'] ): ?>
47 47
 					<span class="response"><?php printf(__('Site requires database upgrade from %s to %s', 'acf'), $site['acf_version'], $plugin_version); ?></span>
48
-				<?php else: ?>
49
-					<?php _e("Site is up to date", 'acf'); ?>
48
+				<?php else {
49
+	: ?>
50
+					<?php _e("Site is up to date", 'acf');
51
+}
52
+?>
50 53
 				<?php endif; ?>
51 54
 				</td>
52 55
 			</tr>
Please login to merge, or discard this patch.
includes/acf/admin/views/update-notice.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
 		
21 21
 		<div class="content">
22 22
 			
23
-			<h2><?php _e("Database Upgrade Required",'acf'); ?></h2>
23
+			<h2><?php _e("Database Upgrade Required", 'acf'); ?></h2>
24 24
 			
25
-			<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version') ); ?><br /><?php _e("Before you start using the new awesome features, please update your database to the newest version.", 'acf'); ?></p>
25
+			<p><?php printf(__("Thank you for updating to %s v%s!", 'acf'), acf_get_setting('name'), acf_get_setting('version')); ?><br /><?php _e("Before you start using the new awesome features, please update your database to the newest version.", 'acf'); ?></p>
26 26
 			
27 27
 			<p><a id="acf-notice-action" href="<?php echo $button_url; ?>" class="acf-button blue"><?php echo $button_text; ?></a></p>
28 28
 			
29
-		<?php if( $confirm ): ?>
29
+		<?php if ($confirm): ?>
30 30
 			<script type="text/javascript">
31 31
 			(function($) {
32 32
 				
33 33
 				$("#acf-notice-action").on("click", function(){
34 34
 			
35
-					var answer = confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
35
+					var answer = confirm("<?php _e('It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf'); ?>");
36 36
 					return answer;
37 37
 			
38 38
 				});
Please login to merge, or discard this patch.
includes/acf/admin/views/update.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
 ?>
6 6
 <div id="acf-upgrade-wrap" class="wrap">
7 7
 	
8
-	<h1><?php _e("Advanced Custom Fields Database Upgrade",'acf'); ?></h1>
8
+	<h1><?php _e("Advanced Custom Fields Database Upgrade", 'acf'); ?></h1>
9 9
 	
10
-<?php if( !empty($updates) ): ?>
10
+<?php if ( ! empty($updates)): ?>
11 11
 	
12 12
 	<p><?php _e('Reading upgrade tasks...', 'acf'); ?></p>
13 13
 	
14 14
 	<p class="show-on-ajax"><i class="acf-loading"></i> <?php printf(__('Upgrading data to version %s', 'acf'), $plugin_version); ?></p>
15 15
 	
16
-	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info'); ?>"><?php _e("See what's new",'acf'); ?></a>.</p>
16
+	<p class="show-on-complete"><?php _e('Database Upgrade complete', 'acf'); ?>. <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info'); ?>"><?php _e("See what's new", 'acf'); ?></a>.</p>
17 17
 
18 18
 	<style type="text/css">
19 19
 		
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,9 +105,12 @@
 block discarded – undo
105 105
 	})(jQuery);	
106 106
 	</script>
107 107
 	
108
-<?php else: ?>
108
+<?php else {
109
+	: ?>
109 110
 
110
-	<p><?php _e('No updates available', 'acf'); ?>.</p>
111
+	<p><?php _e('No updates available', 'acf');
112
+}
113
+?>.</p>
111 114
 	
112 115
 <?php endif; ?>
113 116
 
Please login to merge, or discard this patch.
includes/acf/api/api-field-group.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -475,36 +475,36 @@  discard block
 block discarded – undo
475 475
 	
476 476
 	// vars
477 477
 	$data = maybe_serialize( $data );
478
-    $post_status = $extract['active'] ? 'publish' : 'acf-disabled';
478
+	$post_status = $extract['active'] ? 'publish' : 'acf-disabled';
479 479
     
480 480
     
481
-    // save
482
-    $save = array(
483
-    	'ID'			=> $extract['ID'],
484
-    	'post_status'	=> $post_status,
485
-    	'post_type'		=> 'acf-field-group',
486
-    	'post_title'	=> $extract['title'],
487
-    	'post_name'		=> $extract['key'],
488
-    	'post_excerpt'	=> sanitize_title($extract['title']),
489
-    	'post_content'	=> $data,
490
-    	'menu_order'	=> $extract['menu_order'],
491
-    );
481
+	// save
482
+	$save = array(
483
+		'ID'			=> $extract['ID'],
484
+		'post_status'	=> $post_status,
485
+		'post_type'		=> 'acf-field-group',
486
+		'post_title'	=> $extract['title'],
487
+		'post_name'		=> $extract['key'],
488
+		'post_excerpt'	=> sanitize_title($extract['title']),
489
+		'post_content'	=> $data,
490
+		'menu_order'	=> $extract['menu_order'],
491
+	);
492 492
     
493 493
     
494
-    // allow field groups to contain the same name
494
+	// allow field groups to contain the same name
495 495
 	add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 ); 
496 496
 	
497 497
     
498
-    // update the field group and update the ID
499
-    if( $field_group['ID'] ) {
498
+	// update the field group and update the ID
499
+	if( $field_group['ID'] ) {
500 500
 	    
501
-	    wp_update_post( $save );
501
+		wp_update_post( $save );
502 502
 	    
503
-    } else {
503
+	} else {
504 504
 	    
505
-	    $field_group['ID'] = wp_insert_post( $save );
505
+		$field_group['ID'] = wp_insert_post( $save );
506 506
 	    
507
-    }
507
+	}
508 508
 	
509 509
 	
510 510
 	// action for 3rd party customization
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	wp_cache_delete("get_field_groups", 'acf');
518 518
 	
519 519
 	
520
-    // return
521
-    return $field_group;
520
+	// return
521
+	return $field_group;
522 522
 	
523 523
 }
524 524
 
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@  discard block
 block discarded – undo
13 13
 *  @return	(boolean)
14 14
 */
15 15
 
16
-function acf_is_field_group_key( $key = '' ) {
16
+function acf_is_field_group_key($key = '') {
17 17
 	
18 18
 	// bail early if not string
19
-	if( !is_string($key) ) return false;
19
+	if ( ! is_string($key)) return false;
20 20
 	
21 21
 	
22 22
 	// bail early if is numeric (could be numeric string '123')
23
-	if( is_numeric($key) ) return false;
23
+	if (is_numeric($key)) return false;
24 24
 	
25 25
 	
26 26
 	// look for 'field_' prefix
27
-	if( substr($key, 0, 6) === 'group_' ) return true;
27
+	if (substr($key, 0, 6) === 'group_') return true;
28 28
 	
29 29
 	
30 30
 	// allow local field group key to not start with prefix
31
-	if( acf_is_local_field_group($key) ) return true;
31
+	if (acf_is_local_field_group($key)) return true;
32 32
 	
33 33
 	
34 34
 	// return
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 *  @return	$field_group (array)
51 51
 */
52 52
 
53
-function acf_get_valid_field_group( $field_group = false ) {
53
+function acf_get_valid_field_group($field_group = false) {
54 54
 	
55 55
 	// parse in defaults
56
-	$field_group = acf_parse_args( $field_group, array(
56
+	$field_group = acf_parse_args($field_group, array(
57 57
 		'ID'					=> 0,
58 58
 		'key'					=> '',
59 59
 		'title'					=> '',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	
72 72
 	
73 73
 	// translate
74
-	acf_translate_keys( $field_group, acf_get_setting('l10n_field_group') );
74
+	acf_translate_keys($field_group, acf_get_setting('l10n_field_group'));
75 75
 		
76 76
 	
77 77
 	// filter
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 *  @return	$field_groups (array)
98 98
 */
99 99
 
100
-function acf_get_field_groups( $args = false ) {
100
+function acf_get_field_groups($args = false) {
101 101
 	
102 102
 	// vars
103 103
 	$field_groups = array();
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	
106 106
 	// cache
107 107
 	$found = false;
108
-	$cache = wp_cache_get( 'get_field_groups', 'acf', false, $found );
108
+	$cache = wp_cache_get('get_field_groups', 'acf', false, $found);
109 109
 	
110
-	if( $found ) {
110
+	if ($found) {
111 111
 		
112
-		return acf_filter_field_groups( $cache, $args );
112
+		return acf_filter_field_groups($cache, $args);
113 113
 		
114 114
 	}
115 115
 	
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	
128 128
 	
129 129
 	// loop through and load field groups
130
-	if( $posts ) {
130
+	if ($posts) {
131 131
 		
132
-		foreach( $posts as $post ) {
132
+		foreach ($posts as $post) {
133 133
 			
134 134
 			// add to return array
135
-			$field_groups[] = acf_get_field_group( $post );
135
+			$field_groups[] = acf_get_field_group($post);
136 136
 			
137 137
 		}
138 138
 		
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	
145 145
 	
146 146
 	// set cache
147
-	wp_cache_set( 'get_field_groups', $field_groups, 'acf' );
147
+	wp_cache_set('get_field_groups', $field_groups, 'acf');
148 148
 			
149 149
 	
150 150
 	// return		
151
-	return acf_filter_field_groups( $field_groups, $args );
151
+	return acf_filter_field_groups($field_groups, $args);
152 152
 	
153 153
 }
154 154
 
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 *  @return	$field_groups (array)
168 168
 */
169 169
 
170
-function acf_filter_field_groups( $field_groups, $args = false ) {
170
+function acf_filter_field_groups($field_groups, $args = false) {
171 171
 	
172 172
 	// bail early if empty sargs
173
-	if( empty($args) || empty($field_groups) ) {
173
+	if (empty($args) || empty($field_groups)) {
174 174
 		
175 175
 		return $field_groups;
176 176
 		
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
 	
179 179
 	
180 180
 	// vars
181
-	$keys = array_keys( $field_groups );
181
+	$keys = array_keys($field_groups);
182 182
 	
183 183
 	
184 184
 	// loop through keys
185
-	foreach( $keys as $key ) {
185
+	foreach ($keys as $key) {
186 186
 		
187 187
 		// get visibility
188
-		$visibility = acf_get_field_group_visibility( $field_groups[ $key ], $args );
188
+		$visibility = acf_get_field_group_visibility($field_groups[$key], $args);
189 189
 		
190 190
 		
191 191
 		// unset
192
-		if( !$visibility ) {
192
+		if ( ! $visibility) {
193 193
 			
194
-			unset($field_groups[ $key ]);
194
+			unset($field_groups[$key]);
195 195
 			
196 196
 		}
197 197
 		
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	
200 200
 	
201 201
 	// re assign index
202
-	$field_groups = array_values( $field_groups );
202
+	$field_groups = array_values($field_groups);
203 203
 	
204 204
 	
205 205
 	// return
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 *  @return	$field_group (array)
223 223
 */
224 224
 
225
-function acf_get_field_group( $selector = false ) {
225
+function acf_get_field_group($selector = false) {
226 226
 	
227 227
 	// vars
228 228
 	$field_group = false;
@@ -231,16 +231,16 @@  discard block
 block discarded – undo
231 231
 	
232 232
 	
233 233
 	// $post_id or $key
234
-	if( is_numeric($selector) ) {
234
+	if (is_numeric($selector)) {
235 235
 		
236 236
 		$v = $selector;
237 237
 		
238
-	} elseif( is_string($selector) ) {
238
+	} elseif (is_string($selector)) {
239 239
 		
240 240
 		$k = 'key';
241 241
 		$v = $selector;
242 242
 		
243
-	} elseif( is_object($selector) ) {
243
+	} elseif (is_object($selector)) {
244 244
 		
245 245
 		$v = $selector->ID;
246 246
 		
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 	
258 258
 	// get cache
259 259
 	$found = false;
260
-	$cache = wp_cache_get( $cache_key, 'acf', false, $found );
260
+	$cache = wp_cache_get($cache_key, 'acf', false, $found);
261 261
 	
262
-	if( $found ) return $cache;
262
+	if ($found) return $cache;
263 263
 	
264 264
 	
265 265
 	// get field group from ID or key
266
-	if( $k == 'ID' ) {
266
+	if ($k == 'ID') {
267 267
 		
268
-		$field_group = _acf_get_field_group_by_id( $v );
268
+		$field_group = _acf_get_field_group_by_id($v);
269 269
 		
270 270
 	} else {
271 271
 		
272
-		$field_group = _acf_get_field_group_by_key( $v );
272
+		$field_group = _acf_get_field_group_by_key($v);
273 273
 		
274 274
 	}
275 275
 	
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	
280 280
 	
281 281
 	// set cache
282
-	wp_cache_set( $cache_key, $field_group, 'acf' );
282
+	wp_cache_set($cache_key, $field_group, 'acf');
283 283
 	
284 284
 	
285 285
 	// return
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 *  @return	$field_group (array)
301 301
 */
302 302
 
303
-function _acf_get_field_group_by_id( $post_id = 0 ) {
303
+function _acf_get_field_group_by_id($post_id = 0) {
304 304
 	
305 305
 	// get post
306
-	$post = get_post( $post_id );
306
+	$post = get_post($post_id);
307 307
 	
308 308
 	
309 309
 	// bail early if no post, or is not a field group
310
-	if( empty($post) || $post->post_type != 'acf-field-group' ) {
310
+	if (empty($post) || $post->post_type != 'acf-field-group') {
311 311
 	
312 312
 		return false;
313 313
 		
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	
316 316
 	
317 317
 	// modify post_status (new field-group starts as auto-draft)
318
-	if( $post->post_status == 'auto-draft' ) {
318
+	if ($post->post_status == 'auto-draft') {
319 319
 		
320 320
 		$post->post_status = 'publish';
321 321
 		
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	
324 324
 	
325 325
 	// unserialize data
326
-	$field_group = maybe_unserialize( $post->post_content );
326
+	$field_group = maybe_unserialize($post->post_content);
327 327
 	
328 328
 	
329 329
 	// update attributes
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	
336 336
 	
337 337
 	// is JSON
338
-	if( acf_is_local_field_group( $field_group['key'] ) ) {
338
+	if (acf_is_local_field_group($field_group['key'])) {
339 339
 		
340 340
 		// override
341
-		$field_group = acf_get_local_field_group( $field_group['key'] );
341
+		$field_group = acf_get_local_field_group($field_group['key']);
342 342
 		
343 343
 		
344 344
 		// restore ID
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	
349 349
 		
350 350
 	// validate
351
-	$field_group = acf_get_valid_field_group( $field_group );
351
+	$field_group = acf_get_valid_field_group($field_group);
352 352
 
353 353
 	
354 354
 	// return
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 *  @return	$field_group (array)
371 371
 */
372 372
 
373
-function _acf_get_field_group_by_key( $key = '' ) {
373
+function _acf_get_field_group_by_key($key = '') {
374 374
 	
375 375
 	// vars
376 376
 	$field_group = false;
377 377
 		
378 378
 	
379 379
 	// try JSON before DB to save query time
380
-	if( acf_is_local_field_group( $key ) ) {
380
+	if (acf_is_local_field_group($key)) {
381 381
 		
382
-		$field_group = acf_get_local_field_group( $key );
382
+		$field_group = acf_get_local_field_group($key);
383 383
 		
384 384
 		// validate
385
-		$field_group = acf_get_valid_field_group( $field_group );
385
+		$field_group = acf_get_valid_field_group($field_group);
386 386
 	
387 387
 		// return
388 388
 		return $field_group;
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 	
404 404
 	
405 405
 	// load posts
406
-	$posts = get_posts( $args );
406
+	$posts = get_posts($args);
407 407
 	
408 408
 	
409 409
 	// validate
410
-	if( empty($posts[0]) ) {
410
+	if (empty($posts[0])) {
411 411
 	
412 412
 		return $field_group;
413 413
 			
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	
416 416
 	
417 417
 	// load from ID
418
-	$field_group = _acf_get_field_group_by_id( $posts[0]->ID );
418
+	$field_group = _acf_get_field_group_by_id($posts[0]->ID);
419 419
 	
420 420
 	
421 421
 	// return
@@ -438,22 +438,22 @@  discard block
 block discarded – undo
438 438
 *  @return	$field_group (array)
439 439
 */
440 440
 
441
-function acf_update_field_group( $field_group = array() ) {
441
+function acf_update_field_group($field_group = array()) {
442 442
 	
443 443
 	// validate
444
-	$field_group = acf_get_valid_field_group( $field_group );
444
+	$field_group = acf_get_valid_field_group($field_group);
445 445
 	
446 446
 	
447 447
 	// may have been posted. Remove slashes
448
-	$field_group = wp_unslash( $field_group );
448
+	$field_group = wp_unslash($field_group);
449 449
 	
450 450
 	
451 451
 	// locations may contain 'uniquid' array keys
452
-	$field_group['location'] = array_values( $field_group['location'] );
452
+	$field_group['location'] = array_values($field_group['location']);
453 453
 	
454
-	foreach( $field_group['location'] as $k => $v ) {
454
+	foreach ($field_group['location'] as $k => $v) {
455 455
 		
456
-		$field_group['location'][ $k ] = array_values( $v );
456
+		$field_group['location'][$k] = array_values($v);
457 457
 		
458 458
 	}
459 459
 	
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	
475 475
 	
476 476
 	// vars
477
-	$data = maybe_serialize( $data );
477
+	$data = maybe_serialize($data);
478 478
     $post_status = $extract['active'] ? 'publish' : 'acf-disabled';
479 479
     
480 480
     
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
     
493 493
     
494 494
     // allow field groups to contain the same name
495
-	add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 ); 
495
+	add_filter('wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6); 
496 496
 	
497 497
     
498 498
     // update the field group and update the ID
499
-    if( $field_group['ID'] ) {
499
+    if ($field_group['ID']) {
500 500
 	    
501
-	    wp_update_post( $save );
501
+	    wp_update_post($save);
502 502
 	    
503 503
     } else {
504 504
 	    
505
-	    $field_group['ID'] = wp_insert_post( $save );
505
+	    $field_group['ID'] = wp_insert_post($save);
506 506
 	    
507 507
     }
508 508
 	
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 	
523 523
 }
524 524
 
525
-function acf_update_field_group_wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
525
+function acf_update_field_group_wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
526 526
 		
527
-	if( $post_type == 'acf-field-group' ) {
527
+	if ($post_type == 'acf-field-group') {
528 528
 	
529 529
 		$slug = $original_slug;
530 530
 	
@@ -548,18 +548,18 @@  discard block
 block discarded – undo
548 548
 *  @return	$field_group (array)
549 549
 */
550 550
 
551
-function acf_duplicate_field_group( $selector = 0, $new_post_id = 0 ) {
551
+function acf_duplicate_field_group($selector = 0, $new_post_id = 0) {
552 552
 	
553 553
 	// disable JSON to avoid conflicts between DB and JSON
554 554
 	acf_disable_local();
555 555
 	
556 556
 	
557 557
 	// load the origional field gorup
558
-	$field_group = acf_get_field_group( $selector );
558
+	$field_group = acf_get_field_group($selector);
559 559
 	
560 560
 	
561 561
 	// bail early if field group did not load correctly
562
-	if( empty($field_group) ) {
562
+	if (empty($field_group)) {
563 563
 	
564 564
 		return false;
565 565
 		
@@ -576,23 +576,23 @@  discard block
 block discarded – undo
576 576
 	
577 577
 	
578 578
 	// add (copy)
579
-	if( !$new_post_id ) {
579
+	if ( ! $new_post_id) {
580 580
 		
581
-		$field_group['title'] .= ' (' . __("copy", 'acf') . ')';
581
+		$field_group['title'] .= ' ('.__("copy", 'acf').')';
582 582
 		
583 583
 	}
584 584
 	
585 585
 	
586 586
 	// save
587
-	$field_group = acf_update_field_group( $field_group );
587
+	$field_group = acf_update_field_group($field_group);
588 588
 	
589 589
 	
590 590
 	// get fields
591
-	$fields = acf_get_fields( $orig_field_group );
591
+	$fields = acf_get_fields($orig_field_group);
592 592
 	
593 593
 	
594 594
 	// duplicate fields
595
-	acf_duplicate_fields( $fields, $field_group['ID'] );
595
+	acf_duplicate_fields($fields, $field_group['ID']);
596 596
 	
597 597
 	
598 598
 	// action for 3rd party customization
@@ -618,16 +618,16 @@  discard block
 block discarded – undo
618 618
 *  @return	(int)
619 619
 */
620 620
 
621
-function acf_get_field_count( $field_group ) {
621
+function acf_get_field_count($field_group) {
622 622
 	
623 623
 	// vars
624 624
 	$count = 0;
625 625
 	
626 626
 	
627 627
 	// local
628
-	if( !$field_group['ID'] ) {
628
+	if ( ! $field_group['ID']) {
629 629
 		
630
-		$count = acf_count_local_fields( $field_group['key'] );	
630
+		$count = acf_count_local_fields($field_group['key']);	
631 631
 	
632 632
 	// DB	
633 633
 	} else {
@@ -672,29 +672,29 @@  discard block
 block discarded – undo
672 672
 *  @return	(boolean)
673 673
 */
674 674
 
675
-function acf_delete_field_group( $selector = 0 ) {
675
+function acf_delete_field_group($selector = 0) {
676 676
 	
677 677
 	// disable JSON to avoid conflicts between DB and JSON
678 678
 	acf_disable_local();
679 679
 	
680 680
 	
681 681
 	// load the origional field gorup
682
-	$field_group = acf_get_field_group( $selector );
682
+	$field_group = acf_get_field_group($selector);
683 683
 	
684 684
 	
685 685
 	// bail early if field group did not load correctly
686
-	if( empty($field_group) ) return false;
686
+	if (empty($field_group)) return false;
687 687
 	
688 688
 	
689 689
 	// get fields
690 690
 	$fields = acf_get_fields($field_group);
691 691
 	
692 692
 	
693
-	if( !empty($fields) ) {
693
+	if ( ! empty($fields)) {
694 694
 	
695
-		foreach( $fields as $field ) {
695
+		foreach ($fields as $field) {
696 696
 			
697
-			acf_delete_field( $field['ID'] );
697
+			acf_delete_field($field['ID']);
698 698
 		
699 699
 		}
700 700
 	
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	
703 703
 	
704 704
 	// delete
705
-	wp_delete_post( $field_group['ID'] );
705
+	wp_delete_post($field_group['ID']);
706 706
 	
707 707
 	
708 708
 	// action for 3rd party customization
@@ -727,29 +727,29 @@  discard block
 block discarded – undo
727 727
 *  @return	(boolean)
728 728
 */
729 729
 
730
-function acf_trash_field_group( $selector = 0 ) {
730
+function acf_trash_field_group($selector = 0) {
731 731
 	
732 732
 	// disable JSON to avoid conflicts between DB and JSON
733 733
 	acf_disable_local();
734 734
 	
735 735
 	
736 736
 	// load the origional field gorup
737
-	$field_group = acf_get_field_group( $selector );
737
+	$field_group = acf_get_field_group($selector);
738 738
 	
739 739
 	
740 740
 	// bail early if field group did not load correctly
741
-	if( empty($field_group) ) return false;
741
+	if (empty($field_group)) return false;
742 742
 	
743 743
 	
744 744
 	// get fields
745 745
 	$fields = acf_get_fields($field_group);
746 746
 	
747 747
 	
748
-	if( !empty($fields) ) {
748
+	if ( ! empty($fields)) {
749 749
 	
750
-		foreach( $fields as $field ) {
750
+		foreach ($fields as $field) {
751 751
 			
752
-			acf_trash_field( $field['ID'] );
752
+			acf_trash_field($field['ID']);
753 753
 			
754 754
 		}
755 755
 		
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	
758 758
 	
759 759
 	// delete
760
-	wp_trash_post( $field_group['ID'] );
760
+	wp_trash_post($field_group['ID']);
761 761
 	
762 762
 	
763 763
 	// action for 3rd party customization
@@ -782,29 +782,29 @@  discard block
 block discarded – undo
782 782
 *  @return	(boolean)
783 783
 */
784 784
 
785
-function acf_untrash_field_group( $selector = 0 ) {
785
+function acf_untrash_field_group($selector = 0) {
786 786
 	
787 787
 	// disable JSON to avoid conflicts between DB and JSON
788 788
 	acf_disable_local();
789 789
 	
790 790
 	
791 791
 	// load the origional field gorup
792
-	$field_group = acf_get_field_group( $selector );
792
+	$field_group = acf_get_field_group($selector);
793 793
 	
794 794
 	
795 795
 	// bail early if field group did not load correctly
796
-	if( empty($field_group) ) return false;
796
+	if (empty($field_group)) return false;
797 797
 	
798 798
 	
799 799
 	// get fields
800 800
 	$fields = acf_get_fields($field_group);
801 801
 	
802 802
 	
803
-	if( !empty($fields) ) {
803
+	if ( ! empty($fields)) {
804 804
 	
805
-		foreach( $fields as $field ) {
805
+		foreach ($fields as $field) {
806 806
 			
807
-			acf_untrash_field( $field['ID'] );
807
+			acf_untrash_field($field['ID']);
808 808
 		
809 809
 		}
810 810
 	
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	
813 813
 	
814 814
 	// delete
815
-	wp_untrash_post( $field_group['ID'] );
815
+	wp_untrash_post($field_group['ID']);
816 816
 	
817 817
 	
818 818
 	// action for 3rd party customization
@@ -838,91 +838,91 @@  discard block
 block discarded – undo
838 838
 *  @return	n/a
839 839
 */
840 840
 
841
-function acf_get_field_group_style( $field_group ) {
841
+function acf_get_field_group_style($field_group) {
842 842
 	
843 843
 	// vars
844 844
 	$e = '';
845 845
 	
846 846
 	
847 847
 	// validate
848
-	if( !is_array($field_group['hide_on_screen']) )
848
+	if ( ! is_array($field_group['hide_on_screen']))
849 849
 	{
850 850
 		return $e;
851 851
 	}
852 852
 	
853 853
 	
854 854
 	// add style to html
855
-	if( in_array('permalink',$field_group['hide_on_screen']) )
855
+	if (in_array('permalink', $field_group['hide_on_screen']))
856 856
 	{
857 857
 		$e .= '#edit-slug-box {display: none;} ';
858 858
 	}
859 859
 	
860
-	if( in_array('the_content',$field_group['hide_on_screen']) )
860
+	if (in_array('the_content', $field_group['hide_on_screen']))
861 861
 	{
862 862
 		$e .= '#postdivrich {display: none;} ';
863 863
 	}
864 864
 	
865
-	if( in_array('excerpt',$field_group['hide_on_screen']) )
865
+	if (in_array('excerpt', $field_group['hide_on_screen']))
866 866
 	{
867 867
 		$e .= '#postexcerpt, #screen-meta label[for=postexcerpt-hide] {display: none;} ';
868 868
 	}
869 869
 	
870
-	if( in_array('custom_fields',$field_group['hide_on_screen']) )
870
+	if (in_array('custom_fields', $field_group['hide_on_screen']))
871 871
 	{
872 872
 		$e .= '#postcustom, #screen-meta label[for=postcustom-hide] { display: none; } ';
873 873
 	}
874 874
 	
875
-	if( in_array('discussion',$field_group['hide_on_screen']) )
875
+	if (in_array('discussion', $field_group['hide_on_screen']))
876 876
 	{
877 877
 		$e .= '#commentstatusdiv, #screen-meta label[for=commentstatusdiv-hide] {display: none;} ';
878 878
 	}
879 879
 	
880
-	if( in_array('comments',$field_group['hide_on_screen']) )
880
+	if (in_array('comments', $field_group['hide_on_screen']))
881 881
 	{
882 882
 		$e .= '#commentsdiv, #screen-meta label[for=commentsdiv-hide] {display: none;} ';
883 883
 	}
884 884
 	
885
-	if( in_array('slug',$field_group['hide_on_screen']) )
885
+	if (in_array('slug', $field_group['hide_on_screen']))
886 886
 	{
887 887
 		$e .= '#slugdiv, #screen-meta label[for=slugdiv-hide] {display: none;} ';
888 888
 	}
889 889
 	
890
-	if( in_array('author',$field_group['hide_on_screen']) )
890
+	if (in_array('author', $field_group['hide_on_screen']))
891 891
 	{
892 892
 		$e .= '#authordiv, #screen-meta label[for=authordiv-hide] {display: none;} ';
893 893
 	}
894 894
 	
895
-	if( in_array('format',$field_group['hide_on_screen']) )
895
+	if (in_array('format', $field_group['hide_on_screen']))
896 896
 	{
897 897
 		$e .= '#formatdiv, #screen-meta label[for=formatdiv-hide] {display: none;} ';
898 898
 	}
899 899
 	
900
-	if( in_array('page_attributes',$field_group['hide_on_screen']) )
900
+	if (in_array('page_attributes', $field_group['hide_on_screen']))
901 901
 	{
902 902
 		$e .= '#pageparentdiv {display: none;} ';
903 903
 	}
904 904
 
905
-	if( in_array('featured_image',$field_group['hide_on_screen']) )
905
+	if (in_array('featured_image', $field_group['hide_on_screen']))
906 906
 	{
907 907
 		$e .= '#postimagediv, #screen-meta label[for=postimagediv-hide] {display: none;} ';
908 908
 	}
909 909
 	
910
-	if( in_array('revisions',$field_group['hide_on_screen']) )
910
+	if (in_array('revisions', $field_group['hide_on_screen']))
911 911
 	{
912 912
 		$e .= '#revisionsdiv, #screen-meta label[for=revisionsdiv-hide] {display: none;} ';
913 913
 	}
914 914
 	
915
-	if( in_array('categories',$field_group['hide_on_screen']) )
915
+	if (in_array('categories', $field_group['hide_on_screen']))
916 916
 	{
917 917
 		$e .= '#categorydiv, #screen-meta label[for=categorydiv-hide] {display: none;} ';
918 918
 	}
919 919
 	
920
-	if( in_array('tags',$field_group['hide_on_screen']) )
920
+	if (in_array('tags', $field_group['hide_on_screen']))
921 921
 	{
922 922
 		$e .= '#tagsdiv-post_tag, #screen-meta label[for=tagsdiv-post_tag-hide] {display: none;} ';
923 923
 	}
924 924
 	
925
-	if( in_array('send-trackbacks',$field_group['hide_on_screen']) )
925
+	if (in_array('send-trackbacks', $field_group['hide_on_screen']))
926 926
 	{
927 927
 		$e .= '#trackbacksdiv, #screen-meta label[for=trackbacksdiv-hide] {display: none;} ';
928 928
 	}
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 *  @return	$id (int)
947 947
 */
948 948
 
949
-function acf_import_field_group( $field_group ) {
949
+function acf_import_field_group($field_group) {
950 950
 	
951 951
 	// vars
952 952
 	$ref = array();
@@ -958,24 +958,24 @@  discard block
 block discarded – undo
958 958
 	
959 959
 	
960 960
 	// format fields
961
-	$fields = acf_prepare_fields_for_import( $fields );
961
+	$fields = acf_prepare_fields_for_import($fields);
962 962
 	
963 963
 	
964 964
 	// remove old fields
965
-	if( $field_group['ID'] ) {
965
+	if ($field_group['ID']) {
966 966
 		
967 967
 		// disable local - important as to avoid 'acf_get_fields_by_id' returning fields with ID = 0
968 968
 		acf_disable_local();
969 969
 	
970 970
 		
971 971
 		// load fields
972
-		$db_fields = acf_get_fields_by_id( $field_group['ID'] );
973
-		$db_fields = acf_prepare_fields_for_import( $db_fields );
972
+		$db_fields = acf_get_fields_by_id($field_group['ID']);
973
+		$db_fields = acf_prepare_fields_for_import($db_fields);
974 974
 		
975 975
 		
976 976
 		// get field keys
977 977
 		$keys = array();
978
-		foreach( $fields as $field ) {
978
+		foreach ($fields as $field) {
979 979
 			
980 980
 			$keys[] = $field['key'];
981 981
 			
@@ -983,15 +983,15 @@  discard block
 block discarded – undo
983 983
 		
984 984
 		
985 985
 		// loop over db fields
986
-		foreach( $db_fields as $field ) {
986
+		foreach ($db_fields as $field) {
987 987
 			
988 988
 			// add to ref
989
-			$ref[ $field['key'] ] = $field['ID'];
989
+			$ref[$field['key']] = $field['ID'];
990 990
 			
991 991
 			
992
-			if( !in_array($field['key'], $keys) ) {
992
+			if ( ! in_array($field['key'], $keys)) {
993 993
 				
994
-				acf_delete_field( $field['ID'] );
994
+				acf_delete_field($field['ID']);
995 995
 				
996 996
 			}
997 997
 			
@@ -1005,57 +1005,57 @@  discard block
 block discarded – undo
1005 1005
 	
1006 1006
 			
1007 1007
 	// save field group
1008
-	$field_group = acf_update_field_group( $field_group );
1008
+	$field_group = acf_update_field_group($field_group);
1009 1009
 	
1010 1010
 	
1011 1011
 	// add to ref
1012
-	$ref[ $field_group['key'] ] = $field_group['ID'];
1012
+	$ref[$field_group['key']] = $field_group['ID'];
1013 1013
 	
1014 1014
 	
1015 1015
 	// add to order
1016
-	$order[ $field_group['ID'] ] = 0;
1016
+	$order[$field_group['ID']] = 0;
1017 1017
 	
1018 1018
 	
1019 1019
 	// add fields
1020
-	foreach( $fields as $field ) {
1020
+	foreach ($fields as $field) {
1021 1021
 		
1022 1022
 		// add ID
1023
-		if( !$field['ID'] && isset($ref[ $field['key'] ]) ) {
1023
+		if ( ! $field['ID'] && isset($ref[$field['key']])) {
1024 1024
 			
1025
-			$field['ID'] = $ref[ $field['key'] ];	
1025
+			$field['ID'] = $ref[$field['key']];	
1026 1026
 			
1027 1027
 		}
1028 1028
 		
1029 1029
 		
1030 1030
 		// add parent
1031
-		if( empty($field['parent']) ) {
1031
+		if (empty($field['parent'])) {
1032 1032
 			
1033 1033
 			$field['parent'] = $field_group['ID'];
1034 1034
 			
1035
-		} elseif( isset($ref[ $field['parent'] ]) ) {
1035
+		} elseif (isset($ref[$field['parent']])) {
1036 1036
 			
1037
-			$field['parent'] = $ref[ $field['parent'] ];
1037
+			$field['parent'] = $ref[$field['parent']];
1038 1038
 				
1039 1039
 		}
1040 1040
 		
1041 1041
 		
1042 1042
 		// add field menu_order
1043
-		if( !isset($order[ $field['parent'] ]) ) {
1043
+		if ( ! isset($order[$field['parent']])) {
1044 1044
 			
1045
-			$order[ $field['parent'] ] = 0;
1045
+			$order[$field['parent']] = 0;
1046 1046
 			
1047 1047
 		}
1048 1048
 		
1049
-		$field['menu_order'] = $order[ $field['parent'] ];
1050
-		$order[ $field['parent'] ]++;
1049
+		$field['menu_order'] = $order[$field['parent']];
1050
+		$order[$field['parent']]++;
1051 1051
 		
1052 1052
 		
1053 1053
 		// save field
1054
-		$field = acf_update_field( $field );
1054
+		$field = acf_update_field($field);
1055 1055
 		
1056 1056
 		
1057 1057
 		// add to ref
1058
-		$ref[ $field['key'] ] = $field['ID'];
1058
+		$ref[$field['key']] = $field['ID'];
1059 1059
 		
1060 1060
 	}
1061 1061
 	
@@ -1079,14 +1079,14 @@  discard block
 block discarded – undo
1079 1079
 *  @return	$post_id (int)
1080 1080
 */
1081 1081
 
1082
-function acf_prepare_field_group_for_export( $field_group ) {
1082
+function acf_prepare_field_group_for_export($field_group) {
1083 1083
 	
1084 1084
 	// extract field group ID
1085
-	$id = acf_extract_var( $field_group, 'ID' );
1085
+	$id = acf_extract_var($field_group, 'ID');
1086 1086
 	
1087 1087
 	
1088 1088
 	// prepare fields
1089
-	$field_group['fields'] = acf_prepare_fields_for_export( $field_group['fields'] );
1089
+	$field_group['fields'] = acf_prepare_fields_for_export($field_group['fields']);
1090 1090
 	
1091 1091
 	
1092 1092
 	// filter for 3rd party customization
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,19 +16,27 @@  discard block
 block discarded – undo
16 16
 function acf_is_field_group_key( $key = '' ) {
17 17
 	
18 18
 	// bail early if not string
19
-	if( !is_string($key) ) return false;
19
+	if( !is_string($key) ) {
20
+		return false;
21
+	}
20 22
 	
21 23
 	
22 24
 	// bail early if is numeric (could be numeric string '123')
23
-	if( is_numeric($key) ) return false;
25
+	if( is_numeric($key) ) {
26
+		return false;
27
+	}
24 28
 	
25 29
 	
26 30
 	// look for 'field_' prefix
27
-	if( substr($key, 0, 6) === 'group_' ) return true;
31
+	if( substr($key, 0, 6) === 'group_' ) {
32
+		return true;
33
+	}
28 34
 	
29 35
 	
30 36
 	// allow local field group key to not start with prefix
31
-	if( acf_is_local_field_group($key) ) return true;
37
+	if( acf_is_local_field_group($key) ) {
38
+		return true;
39
+	}
32 40
 	
33 41
 	
34 42
 	// return
@@ -259,7 +267,9 @@  discard block
 block discarded – undo
259 267
 	$found = false;
260 268
 	$cache = wp_cache_get( $cache_key, 'acf', false, $found );
261 269
 	
262
-	if( $found ) return $cache;
270
+	if( $found ) {
271
+		return $cache;
272
+	}
263 273
 	
264 274
 	
265 275
 	// get field group from ID or key
@@ -683,7 +693,9 @@  discard block
 block discarded – undo
683 693
 	
684 694
 	
685 695
 	// bail early if field group did not load correctly
686
-	if( empty($field_group) ) return false;
696
+	if( empty($field_group) ) {
697
+		return false;
698
+	}
687 699
 	
688 700
 	
689 701
 	// get fields
@@ -738,7 +750,9 @@  discard block
 block discarded – undo
738 750
 	
739 751
 	
740 752
 	// bail early if field group did not load correctly
741
-	if( empty($field_group) ) return false;
753
+	if( empty($field_group) ) {
754
+		return false;
755
+	}
742 756
 	
743 757
 	
744 758
 	// get fields
@@ -793,7 +807,9 @@  discard block
 block discarded – undo
793 807
 	
794 808
 	
795 809
 	// bail early if field group did not load correctly
796
-	if( empty($field_group) ) return false;
810
+	if( empty($field_group) ) {
811
+		return false;
812
+	}
797 813
 	
798 814
 	
799 815
 	// get fields
Please login to merge, or discard this patch.