Completed
Push — master ( 423b35...e79207 )
by Md. Mozahidur
02:17
created
includes/acf/fields/message.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_message') ) :
14
+if ( ! class_exists('acf_field_message')) :
15 15
 
16 16
 class acf_field_message extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'message';
36
-		$this->label = __("Message",'acf');
36
+		$this->label = __("Message", 'acf');
37 37
 		$this->category = 'layout';
38 38
 		$this->defaults = array(
39 39
 			'value'			=> false, // prevents acf_render_fields() from attempting to load value
@@ -60,30 +60,30 @@  discard block
 block discarded – undo
60 60
 	*  @date	23/01/13
61 61
 	*/
62 62
 	
63
-	function render_field( $field ) {
63
+	function render_field($field) {
64 64
 		
65 65
 		// vars
66 66
 		$m = $field['message'];
67 67
 		
68 68
 		
69 69
 		// wptexturize (improves "quotes")
70
-		$m = wptexturize( $m );
70
+		$m = wptexturize($m);
71 71
 		
72 72
 		
73 73
 		// esc_html
74
-		if( $field['esc_html'] ) {
74
+		if ($field['esc_html']) {
75 75
 			
76
-			$m = esc_html( $m );
76
+			$m = esc_html($m);
77 77
 			
78 78
 		}
79 79
 		
80 80
 		
81 81
 		// new lines
82
-		if( $field['new_lines'] == 'wpautop' ) {
82
+		if ($field['new_lines'] == 'wpautop') {
83 83
 			
84 84
 			$m = wpautop($m);
85 85
 			
86
-		} elseif( $field['new_lines'] == 'br' ) {
86
+		} elseif ($field['new_lines'] == 'br') {
87 87
 			
88 88
 			$m = nl2br($m);
89 89
 			
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	*  @date	23/01/13
110 110
 	*/
111 111
 	
112
-	function render_field_settings( $field ) {
112
+	function render_field_settings($field) {
113 113
 		
114 114
 		// default_value
115
-		acf_render_field_setting( $field, array(
116
-			'label'			=> __('Message','acf'),
115
+		acf_render_field_setting($field, array(
116
+			'label'			=> __('Message', 'acf'),
117 117
 			'instructions'	=> '',
118 118
 			'type'			=> 'textarea',
119 119
 			'name'			=> 'message',
@@ -121,28 +121,28 @@  discard block
 block discarded – undo
121 121
 		
122 122
 		
123 123
 		// formatting
124
-		acf_render_field_setting( $field, array(
125
-			'label'			=> __('New Lines','acf'),
126
-			'instructions'	=> __('Controls how new lines are rendered','acf'),
124
+		acf_render_field_setting($field, array(
125
+			'label'			=> __('New Lines', 'acf'),
126
+			'instructions'	=> __('Controls how new lines are rendered', 'acf'),
127 127
 			'type'			=> 'select',
128 128
 			'name'			=> 'new_lines',
129 129
 			'choices'		=> array(
130
-				'wpautop'		=> __("Automatically add paragraphs",'acf'),
131
-				'br'			=> __("Automatically add <br>",'acf'),
132
-				''				=> __("No Formatting",'acf')
130
+				'wpautop'		=> __("Automatically add paragraphs", 'acf'),
131
+				'br'			=> __("Automatically add <br>", 'acf'),
132
+				''				=> __("No Formatting", 'acf')
133 133
 			)
134 134
 		));
135 135
 		
136 136
 		
137 137
 		// HTML
138
-		acf_render_field_setting( $field, array(
139
-			'label'			=> __('Escape HTML','acf'),
140
-			'instructions'	=> __('Allow HTML markup to display as visible text instead of rendering','acf'),
138
+		acf_render_field_setting($field, array(
139
+			'label'			=> __('Escape HTML', 'acf'),
140
+			'instructions'	=> __('Allow HTML markup to display as visible text instead of rendering', 'acf'),
141 141
 			'type'			=> 'radio',
142 142
 			'name'			=> 'esc_html',
143 143
 			'choices'		=> array(
144
-				1				=> __("Yes",'acf'),
145
-				0				=> __("No",'acf'),
144
+				1				=> __("Yes", 'acf'),
145
+				0				=> __("No", 'acf'),
146 146
 			),
147 147
 			'layout'	=>	'horizontal',
148 148
 		));
Please login to merge, or discard this patch.
includes/acf/fields/number.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_number') ) :
14
+if ( ! class_exists('acf_field_number')) :
15 15
 
16 16
 class acf_field_number extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'number';
36
-		$this->label = __("Number",'acf');
36
+		$this->label = __("Number", 'acf');
37 37
 		$this->defaults = array(
38 38
 			'default_value'	=> '',
39 39
 			'min'			=> '',
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 	*  @date	23/01/13
65 65
 	*/
66 66
 	
67
-	function render_field( $field ) {
67
+	function render_field($field) {
68 68
 		
69 69
 		// vars
70
-		$o = array( 'type', 'id', 'class', 'min', 'max', 'step', 'name', 'value', 'placeholder' );
70
+		$o = array('type', 'id', 'class', 'min', 'max', 'step', 'name', 'value', 'placeholder');
71 71
 		$e = '';
72 72
 		
73 73
 		
74 74
 		// step
75
-		if( !$field['step'] ) {
75
+		if ( ! $field['step']) {
76 76
 		
77 77
 			$field['step'] = 'any';
78 78
 			
@@ -80,38 +80,38 @@  discard block
 block discarded – undo
80 80
 		
81 81
 		
82 82
 		// prepend
83
-		if( $field['prepend'] !== "" ) {
83
+		if ($field['prepend'] !== "") {
84 84
 		
85 85
 			$field['class'] .= ' acf-is-prepended';
86
-			$e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>';
86
+			$e .= '<div class="acf-input-prepend">'.$field['prepend'].'</div>';
87 87
 			
88 88
 		}
89 89
 		
90 90
 		
91 91
 		// append
92
-		if( $field['append'] !== "" ) {
92
+		if ($field['append'] !== "") {
93 93
 		
94 94
 			$field['class'] .= ' acf-is-appended';
95
-			$e .= '<div class="acf-input-append">' . $field['append'] . '</div>';
95
+			$e .= '<div class="acf-input-append">'.$field['append'].'</div>';
96 96
 			
97 97
 		}
98 98
 		
99 99
 		
100 100
 		// populate atts
101 101
 		$atts = array();
102
-		foreach( $o as $k ) {
102
+		foreach ($o as $k) {
103 103
 		
104
-			$atts[ $k ] = $field[ $k ];	
104
+			$atts[$k] = $field[$k];	
105 105
 			
106 106
 		}
107 107
 		
108 108
 		
109 109
 		// special atts
110
-		foreach( array( 'readonly', 'disabled' ) as $k ) {
110
+		foreach (array('readonly', 'disabled') as $k) {
111 111
 		
112
-			if( $field[ $k ] ) {
112
+			if ($field[$k]) {
113 113
 			
114
-				$atts[ $k ] = $k;
114
+				$atts[$k] = $k;
115 115
 				
116 116
 			}
117 117
 			
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		
121 121
 		// render
122 122
 		$e .= '<div class="acf-input-wrap">';
123
-		$e .= '<input ' . acf_esc_attr( $atts ) . ' />';
123
+		$e .= '<input '.acf_esc_attr($atts).' />';
124 124
 		$e .= '</div>';
125 125
 		
126 126
 		
@@ -143,47 +143,47 @@  discard block
 block discarded – undo
143 143
 	*  @param	$field	- an array holding all the field's data
144 144
 	*/
145 145
 	
146
-	function render_field_settings( $field ) {
146
+	function render_field_settings($field) {
147 147
 		
148 148
 		// default_value
149
-		acf_render_field_setting( $field, array(
150
-			'label'			=> __('Default Value','acf'),
151
-			'instructions'	=> __('Appears when creating a new post','acf'),
149
+		acf_render_field_setting($field, array(
150
+			'label'			=> __('Default Value', 'acf'),
151
+			'instructions'	=> __('Appears when creating a new post', 'acf'),
152 152
 			'type'			=> 'text',
153 153
 			'name'			=> 'default_value',
154 154
 		));
155 155
 		
156 156
 		
157 157
 		// placeholder
158
-		acf_render_field_setting( $field, array(
159
-			'label'			=> __('Placeholder Text','acf'),
160
-			'instructions'	=> __('Appears within the input','acf'),
158
+		acf_render_field_setting($field, array(
159
+			'label'			=> __('Placeholder Text', 'acf'),
160
+			'instructions'	=> __('Appears within the input', 'acf'),
161 161
 			'type'			=> 'text',
162 162
 			'name'			=> 'placeholder',
163 163
 		));
164 164
 		
165 165
 		
166 166
 		// prepend
167
-		acf_render_field_setting( $field, array(
168
-			'label'			=> __('Prepend','acf'),
169
-			'instructions'	=> __('Appears before the input','acf'),
167
+		acf_render_field_setting($field, array(
168
+			'label'			=> __('Prepend', 'acf'),
169
+			'instructions'	=> __('Appears before the input', 'acf'),
170 170
 			'type'			=> 'text',
171 171
 			'name'			=> 'prepend',
172 172
 		));
173 173
 		
174 174
 		
175 175
 		// append
176
-		acf_render_field_setting( $field, array(
177
-			'label'			=> __('Append','acf'),
178
-			'instructions'	=> __('Appears after the input','acf'),
176
+		acf_render_field_setting($field, array(
177
+			'label'			=> __('Append', 'acf'),
178
+			'instructions'	=> __('Appears after the input', 'acf'),
179 179
 			'type'			=> 'text',
180 180
 			'name'			=> 'append',
181 181
 		));
182 182
 		
183 183
 		
184 184
 		// min
185
-		acf_render_field_setting( $field, array(
186
-			'label'			=> __('Minimum Value','acf'),
185
+		acf_render_field_setting($field, array(
186
+			'label'			=> __('Minimum Value', 'acf'),
187 187
 			'instructions'	=> '',
188 188
 			'type'			=> 'number',
189 189
 			'name'			=> 'min',
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 		
192 192
 		
193 193
 		// max
194
-		acf_render_field_setting( $field, array(
195
-			'label'			=> __('Maximum Value','acf'),
194
+		acf_render_field_setting($field, array(
195
+			'label'			=> __('Maximum Value', 'acf'),
196 196
 			'instructions'	=> '',
197 197
 			'type'			=> 'number',
198 198
 			'name'			=> 'max',
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 		
201 201
 		
202 202
 		// max
203
-		acf_render_field_setting( $field, array(
204
-			'label'			=> __('Step Size','acf'),
203
+		acf_render_field_setting($field, array(
204
+			'label'			=> __('Step Size', 'acf'),
205 205
 			'instructions'	=> '',
206 206
 			'type'			=> 'number',
207 207
 			'name'			=> 'step',
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	*  @return	$post_id (int)
224 224
 	*/
225 225
 	
226
-	function validate_value( $valid, $value, $field, $input ){
226
+	function validate_value($valid, $value, $field, $input) {
227 227
 		
228 228
 		// remove ','
229
-		if( acf_str_exists(',', $value) ) {
229
+		if (acf_str_exists(',', $value)) {
230 230
 			
231 231
 			$value = str_replace(',', '', $value);
232 232
 			
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 				
235 235
 		
236 236
 		// if value is not numeric...
237
-		if( !is_numeric($value) ) {
237
+		if ( ! is_numeric($value)) {
238 238
 			
239 239
 			// allow blank to be saved
240
-			if( !empty($value) ) {
240
+			if ( ! empty($value)) {
241 241
 				
242 242
 				$valid = __('Value must be a number', 'acf');
243 243
 				
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 		
256 256
 		
257 257
 		// min
258
-		if( is_numeric($field['min']) && $value < floatval($field['min'])) {
258
+		if (is_numeric($field['min']) && $value < floatval($field['min'])) {
259 259
 			
260
-			$valid = sprintf(__('Value must be equal to or higher than %d', 'acf'), $field['min'] );
260
+			$valid = sprintf(__('Value must be equal to or higher than %d', 'acf'), $field['min']);
261 261
 			
262 262
 		}
263 263
 		
264 264
 		
265 265
 		// max
266
-		if( is_numeric($field['max']) && $value > floatval($field['max']) ) {
266
+		if (is_numeric($field['max']) && $value > floatval($field['max'])) {
267 267
 			
268
-			$valid = sprintf(__('Value must be equal to or lower than %d', 'acf'), $field['max'] );
268
+			$valid = sprintf(__('Value must be equal to or lower than %d', 'acf'), $field['max']);
269 269
 			
270 270
 		}
271 271
 		
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 	*  @return	$value - the modified value
293 293
 	*/
294 294
 	
295
-	function update_value( $value, $post_id, $field ) {
295
+	function update_value($value, $post_id, $field) {
296 296
 		
297 297
 		// no formatting needed for empty value
298
-		if( empty($value) ) {
298
+		if (empty($value)) {
299 299
 			
300 300
 			return $value;
301 301
 			
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		
304 304
 		
305 305
 		// remove ','
306
-		if( acf_str_exists(',', $value) ) {
306
+		if (acf_str_exists(',', $value)) {
307 307
 			
308 308
 			$value = str_replace(',', '', $value);
309 309
 			
Please login to merge, or discard this patch.
includes/acf/fields/oembed.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_oembed') ) :
14
+if ( ! class_exists('acf_field_oembed')) :
15 15
 
16 16
 class acf_field_oembed extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'oembed';
36
-		$this->label = __("oEmbed",'acf');
36
+		$this->label = __("oEmbed", 'acf');
37 37
 		$this->category = 'content';
38 38
 		$this->defaults = array(
39 39
 			'width'		=> '',
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 		
48 48
 		// extra
49
-		add_action('wp_ajax_acf/fields/oembed/search',			array($this, 'ajax_search'));
50
-		add_action('wp_ajax_nopriv_acf/fields/oembed/search',	array($this, 'ajax_search'));
49
+		add_action('wp_ajax_acf/fields/oembed/search', array($this, 'ajax_search'));
50
+		add_action('wp_ajax_nopriv_acf/fields/oembed/search', array($this, 'ajax_search'));
51 51
 		
52 52
 		
53 53
 		// do not delete!
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	*  @return	$post_id (int)
70 70
 	*/
71 71
 	
72
-	function wp_oembed_get( $url = '', $width = 0, $height = 0 ) {
72
+	function wp_oembed_get($url = '', $width = 0, $height = 0) {
73 73
 		
74 74
 		// vars
75 75
 		$embed = '';
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		
81 81
 		
82 82
 		// get emebed
83
-		$embed = @wp_oembed_get( $url, $res );
83
+		$embed = @wp_oembed_get($url, $res);
84 84
 		
85 85
 		
86 86
 		// try shortcode
87
-		if( !$embed ) {
87
+		if ( ! $embed) {
88 88
 			
89 89
 			 // global
90 90
 			global $wp_embed;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	function ajax_search() {
118 118
 		
119 119
    		// options
120
-   		$args = acf_parse_args( $_POST, array(
120
+   		$args = acf_parse_args($_POST, array(
121 121
 			's'			=> '',
122 122
 			'nonce'		=> '',
123 123
 			'width'		=> 0,
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 		
127 127
 		
128 128
 		// width and height
129
-		if( !$args['width'] ) {
129
+		if ( ! $args['width']) {
130 130
 		
131 131
 			$args['width'] = $this->default_values['width'];
132 132
 			
133 133
 		}
134 134
 		
135
-		if( !$args['height'] ) {
135
+		if ( ! $args['height']) {
136 136
 		
137 137
 			$args['height'] = $this->default_values['height'];
138 138
 			
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		
141 141
 		
142 142
 		// validate
143
-		if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) {
143
+		if ( ! wp_verify_nonce($args['nonce'], 'acf_nonce')) {
144 144
 		
145 145
 			die();
146 146
 			
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 	*  @date	23/01/13
170 170
 	*/
171 171
 	
172
-	function render_field( $field ) {
172
+	function render_field($field) {
173 173
 		
174 174
 		// default options
175
-		foreach( $this->default_values as $k => $v ) {
175
+		foreach ($this->default_values as $k => $v) {
176 176
 		
177
-			if( empty($field[ $k ]) ) {
177
+			if (empty($field[$k])) {
178 178
 			
179
-				$field[ $k ] = $v;
179
+				$field[$k] = $v;
180 180
 				
181 181
 			}
182 182
 			
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			'data-height'	=> $field['height']
191 191
 		);
192 192
 		
193
-		if( $field['value'] ) {
193
+		if ($field['value']) {
194 194
 		
195 195
 			$atts['class'] .= ' has-value';
196 196
 			
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		</div>
227 227
 		
228 228
 		<div class="canvas-media" data-name="value-embed">
229
-			<?php if( !empty( $field['value'] ) ): ?>
229
+			<?php if ( ! empty($field['value'])): ?>
230 230
 				<?php echo $this->wp_oembed_get($field['value'], $field['width'], $field['height']); ?>
231 231
 			<?php endif; ?>
232 232
 		</div>
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 	*  @date	23/01/13
255 255
 	*/
256 256
 	
257
-	function render_field_settings( $field ) {
257
+	function render_field_settings($field) {
258 258
 		
259 259
 		// width
260
-		acf_render_field_setting( $field, array(
261
-			'label'			=> __('Embed Size','acf'),
260
+		acf_render_field_setting($field, array(
261
+			'label'			=> __('Embed Size', 'acf'),
262 262
 			'type'			=> 'text',
263 263
 			'name'			=> 'width',
264 264
 			'prepend'		=> __('Width', 'acf'),
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 		
269 269
 		
270 270
 		// height
271
-		acf_render_field_setting( $field, array(
272
-			'label'			=> __('Embed Size','acf'),
271
+		acf_render_field_setting($field, array(
272
+			'label'			=> __('Embed Size', 'acf'),
273 273
 			'type'			=> 'text',
274 274
 			'name'			=> 'height',
275 275
 			'prepend'		=> __('Height', 'acf'),
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	*  @return	$value (mixed) the modified value
300 300
 	*/
301 301
 	
302
-	function format_value( $value, $post_id, $field ) {
302
+	function format_value($value, $post_id, $field) {
303 303
 		
304 304
 		// bail early if no value
305
-		if( empty($value) ) {
305
+		if (empty($value)) {
306 306
 			
307 307
 			return $value;
308 308
 		
Please login to merge, or discard this patch.
includes/acf/fields/page_link.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_page_link') ) :
14
+if ( ! class_exists('acf_field_page_link')) :
15 15
 
16 16
 class acf_field_page_link extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'page_link';
36
-		$this->label = __("Page Link",'acf');
36
+		$this->label = __("Page Link", 'acf');
37 37
 		$this->category = 'relational';
38 38
 		$this->defaults = array(
39 39
 			'post_type'		=> array(),
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 		
45 45
 		
46 46
 		// extra
47
-		add_action('wp_ajax_acf/fields/page_link/query',			array($this, 'ajax_query'));
48
-		add_action('wp_ajax_nopriv_acf/fields/page_link/query',		array($this, 'ajax_query'));
47
+		add_action('wp_ajax_acf/fields/page_link/query', array($this, 'ajax_query'));
48
+		add_action('wp_ajax_nopriv_acf/fields/page_link/query', array($this, 'ajax_query'));
49 49
 		
50 50
 		
51 51
 		// do not delete!
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	*  @return	(array)
68 68
 	*/
69 69
 	
70
-	function get_choices( $options = array() ) {
70
+	function get_choices($options = array()) {
71 71
 		
72 72
 		// defaults
73 73
    		$options = acf_parse_args($options, array(
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
    		
91 91
    		
92 92
 		// load field
93
-		$field = acf_get_field( $options['field_key'] );
93
+		$field = acf_get_field($options['field_key']);
94 94
 		
95
-		if( !$field ) {
95
+		if ( ! $field) {
96 96
 		
97 97
 			return false;
98 98
 			
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 		
101 101
 		
102 102
 		// update $args
103
-		if( !empty($field['post_type']) ) {
103
+		if ( ! empty($field['post_type'])) {
104 104
 		
105
-			$args['post_type'] = acf_get_array( $field['post_type'] );
105
+			$args['post_type'] = acf_get_array($field['post_type']);
106 106
 			
107 107
 		} else {
108 108
 			
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 		
113 113
 		// create tax queries
114
-		if( !empty($field['taxonomy']) ) {
114
+		if ( ! empty($field['taxonomy'])) {
115 115
 			
116 116
 			// append to $args
117 117
 			$args['tax_query'] = array();
118 118
 			
119 119
 			
120 120
 			// decode terms
121
-			$taxonomies = acf_decode_taxonomy_terms( $field['taxonomy'] );
121
+			$taxonomies = acf_decode_taxonomy_terms($field['taxonomy']);
122 122
 			
123 123
 			
124 124
 			// now create the tax queries
125
-			foreach( $taxonomies as $taxonomy => $terms ) {
125
+			foreach ($taxonomies as $taxonomy => $terms) {
126 126
 			
127 127
 				$args['tax_query'][] = array(
128 128
 					'taxonomy'	=> $taxonomy,
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		
136 136
 				
137 137
 		// search
138
-		if( $options['s'] ) {
138
+		if ($options['s']) {
139 139
 		
140 140
 			$args['s'] = $options['s'];
141 141
 			
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 		
145 145
 		// filters
146 146
 		$args = apply_filters('acf/fields/page_link/query', $args, $field, $options['post_id']);
147
-		$args = apply_filters('acf/fields/page_link/query/name=' . $field['name'], $args, $field, $options['post_id'] );
148
-		$args = apply_filters('acf/fields/page_link/query/key=' . $field['key'], $args, $field, $options['post_id'] );
147
+		$args = apply_filters('acf/fields/page_link/query/name='.$field['name'], $args, $field, $options['post_id']);
148
+		$args = apply_filters('acf/fields/page_link/query/key='.$field['key'], $args, $field, $options['post_id']);
149 149
 		
150 150
 		
151 151
 		// add archives to $r
152
-		if( $args['paged'] == 1 ) {
152
+		if ($args['paged'] == 1) {
153 153
 			
154 154
 			$archives = array();
155 155
 			$archives[] = array(
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 				'text'	=> home_url()
158 158
 			);
159 159
 			
160
-			foreach( $args['post_type'] as $post_type ) {
160
+			foreach ($args['post_type'] as $post_type) {
161 161
 				
162
-				$archive_link = get_post_type_archive_link( $post_type );
162
+				$archive_link = get_post_type_archive_link($post_type);
163 163
 				
164
-				if( $archive_link ) {
164
+				if ($archive_link) {
165 165
 				
166 166
 					$archives[] = array(
167 167
 						'id'	=> $archive_link,
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 			
175 175
 			
176 176
 			// search
177
-			if( !empty($args['s']) ) {
177
+			if ( ! empty($args['s'])) {
178 178
 				
179
-				foreach( array_keys($archives) as $i ) {
179
+				foreach (array_keys($archives) as $i) {
180 180
 					
181
-					if( strpos( $archives[$i]['text'], $args['s'] ) === false ) {
181
+					if (strpos($archives[$i]['text'], $args['s']) === false) {
182 182
 						
183 183
 						unset($archives[$i]);
184 184
 						
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			}
192 192
 			
193 193
 			
194
-			if( !empty($archives) ) {
194
+			if ( ! empty($archives)) {
195 195
 				
196 196
 				$r[] = array(
197 197
 					'text'		=> __('Archives', 'acf'),
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 		
205 205
 		
206 206
 		// get posts grouped by post type
207
-		$groups = acf_get_grouped_posts( $args );
207
+		$groups = acf_get_grouped_posts($args);
208 208
 		
209
-		if( !empty($groups) ) {
209
+		if ( ! empty($groups)) {
210 210
 			
211
-			foreach( array_keys($groups) as $group_title ) {
211
+			foreach (array_keys($groups) as $group_title) {
212 212
 				
213 213
 				// vars
214
-				$posts = acf_extract_var( $groups, $group_title );
214
+				$posts = acf_extract_var($groups, $group_title);
215 215
 				$titles = array();
216 216
 				
217 217
 				
@@ -222,28 +222,28 @@  discard block
 block discarded – undo
222 222
 				);
223 223
 				
224 224
 				
225
-				foreach( array_keys($posts) as $post_id ) {
225
+				foreach (array_keys($posts) as $post_id) {
226 226
 					
227 227
 					// override data
228
-					$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
228
+					$posts[$post_id] = $this->get_post_title($posts[$post_id], $field, $options['post_id']);
229 229
 					
230 230
 				};
231 231
 				
232 232
 				
233 233
 				// order by search
234
-				if( !empty($args['s']) ) {
234
+				if ( ! empty($args['s'])) {
235 235
 					
236
-					$posts = acf_order_by_search( $posts, $args['s'] );
236
+					$posts = acf_order_by_search($posts, $args['s']);
237 237
 					
238 238
 				}
239 239
 				
240 240
 				
241 241
 				// append to $data
242
-				foreach( array_keys($posts) as $post_id ) {
242
+				foreach (array_keys($posts) as $post_id) {
243 243
 					
244 244
 					$data['children'][] = array(
245 245
 						'id'	=> $post_id,
246
-						'text'	=> $posts[ $post_id ]
246
+						'text'	=> $posts[$post_id]
247 247
 					);
248 248
 					
249 249
 				}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	function ajax_query() {
280 280
 		
281 281
 		// validate
282
-		if( !acf_verify_ajax() ) {
282
+		if ( ! acf_verify_ajax()) {
283 283
 		
284 284
 			die();
285 285
 			
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 		
288 288
 		
289 289
 		// get choices
290
-		$choices = $this->get_choices( $_POST );
290
+		$choices = $this->get_choices($_POST);
291 291
 		
292 292
 		
293 293
 		// validate
294
-		if( !$choices ) {
294
+		if ( ! $choices) {
295 295
 			
296 296
 			die();
297 297
 			
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		
300 300
 		
301 301
 		// return JSON
302
-		echo json_encode( $choices );
302
+		echo json_encode($choices);
303 303
 		die();
304 304
 			
305 305
 	}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	*  @return	(string)
321 321
 	*/
322 322
 	
323
-	function get_post_title( $post, $field, $post_id = 0 ) {
323
+	function get_post_title($post, $field, $post_id = 0) {
324 324
 		
325 325
 		// get post_id
326
-		if( !$post_id ) {
326
+		if ( ! $post_id) {
327 327
 			
328 328
 			$form_data = acf_get_setting('form_data');
329 329
 			
330
-			if( !empty($form_data['post_id']) ) {
330
+			if ( ! empty($form_data['post_id'])) {
331 331
 				
332 332
 				$post_id = $form_data['post_id'];
333 333
 				
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 		
342 342
 		
343 343
 		// vars
344
-		$title = acf_get_post_title( $post );
344
+		$title = acf_get_post_title($post);
345 345
 			
346 346
 		
347 347
 		// filters
348 348
 		$title = apply_filters('acf/fields/page_link/result', $title, $post, $field, $post_id);
349
-		$title = apply_filters('acf/fields/page_link/result/name=' . $field['_name'], $title, $post, $field, $post_id);
350
-		$title = apply_filters('acf/fields/page_link/result/key=' . $field['key'], $title, $post, $field, $post_id);
349
+		$title = apply_filters('acf/fields/page_link/result/name='.$field['_name'], $title, $post, $field, $post_id);
350
+		$title = apply_filters('acf/fields/page_link/result/key='.$field['key'], $title, $post, $field, $post_id);
351 351
 		
352 352
 		
353 353
 		// return
@@ -368,18 +368,18 @@  discard block
 block discarded – undo
368 368
 	*  @return	$value
369 369
 	*/
370 370
 	
371
-	function get_posts( $value, $field ) {
371
+	function get_posts($value, $field) {
372 372
 		
373 373
 		// force value to array
374
-		$value = acf_get_array( $value );
374
+		$value = acf_get_array($value);
375 375
 		
376 376
 		
377 377
 		// get selected post ID's
378 378
 		$post__in = array();
379 379
 		
380
-		foreach( $value as $k => $v ) {
380
+		foreach ($value as $k => $v) {
381 381
 			
382
-			if( is_numeric($v) ) {
382
+			if (is_numeric($v)) {
383 383
 				
384 384
 				// append to $post__in
385 385
 				$post__in[] = (int) $v;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 		
391 391
 		
392 392
 		// bail early if no posts
393
-		if( empty($post__in) ) {
393
+		if (empty($post__in)) {
394 394
 			
395 395
 			return $value;
396 396
 			
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
 		
410 410
 		
411 411
 		// append to $return
412
-		foreach( $value as $k => $v ) {
412
+		foreach ($value as $k => $v) {
413 413
 			
414
-			if( is_numeric($v) ) {
414
+			if (is_numeric($v)) {
415 415
 				
416 416
 				// extract first post
417
-				$post = array_shift( $posts );
417
+				$post = array_shift($posts);
418 418
 				
419 419
 				
420 420
 				// append
421
-				if( $post ) {
421
+				if ($post) {
422 422
 					
423 423
 					$return[] = $post;
424 424
 					
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	*  @date	23/01/13
452 452
 	*/
453 453
 	
454
-	function render_field( $field ){
454
+	function render_field($field) {
455 455
 		
456 456
 		// Change Field into a select
457 457
 		$field['type'] = 'select';
@@ -461,30 +461,30 @@  discard block
 block discarded – undo
461 461
 		
462 462
 		
463 463
 		// populate choices if value exists
464
-		if( !empty($field['value']) ) {
464
+		if ( ! empty($field['value'])) {
465 465
 			
466 466
 			// get posts
467
-			$posts = $this->get_posts( $field['value'], $field );
467
+			$posts = $this->get_posts($field['value'], $field);
468 468
 			
469 469
 			
470 470
 			// set choices
471
-			if( !empty($posts) ) {
471
+			if ( ! empty($posts)) {
472 472
 				
473
-				foreach( array_keys($posts) as $i ) {
473
+				foreach (array_keys($posts) as $i) {
474 474
 					
475 475
 					// vars
476
-					$post = acf_extract_var( $posts, $i );
476
+					$post = acf_extract_var($posts, $i);
477 477
 					
478 478
 					
479
-					if( is_object($post) ) {
479
+					if (is_object($post)) {
480 480
 						
481 481
 						// append to choices
482
-						$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
482
+						$field['choices'][$post->ID] = $this->get_post_title($post, $field);
483 483
 					
484 484
 					} else {
485 485
 						
486 486
 						// append to choices
487
-						$field['choices'][ $post ] = $post;
487
+						$field['choices'][$post] = $post;
488 488
 												
489 489
 					}
490 490
 					
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		
497 497
 		
498 498
 		// render
499
-		acf_render_field( $field );
499
+		acf_render_field($field);
500 500
 	}
501 501
 	
502 502
 	
@@ -513,11 +513,11 @@  discard block
 block discarded – undo
513 513
 	*  @param	$field	- an array holding all the field's data
514 514
 	*/
515 515
 	
516
-	function render_field_settings( $field ) {
516
+	function render_field_settings($field) {
517 517
 		
518 518
 		// post_type
519
-		acf_render_field_setting( $field, array(
520
-			'label'			=> __('Filter by Post Type','acf'),
519
+		acf_render_field_setting($field, array(
520
+			'label'			=> __('Filter by Post Type', 'acf'),
521 521
 			'instructions'	=> '',
522 522
 			'type'			=> 'select',
523 523
 			'name'			=> 'post_type',
@@ -525,13 +525,13 @@  discard block
 block discarded – undo
525 525
 			'multiple'		=> 1,
526 526
 			'ui'			=> 1,
527 527
 			'allow_null'	=> 1,
528
-			'placeholder'	=> __("All post types",'acf'),
528
+			'placeholder'	=> __("All post types", 'acf'),
529 529
 		));
530 530
 		
531 531
 		
532 532
 		// taxonomy
533
-		acf_render_field_setting( $field, array(
534
-			'label'			=> __('Filter by Taxonomy','acf'),
533
+		acf_render_field_setting($field, array(
534
+			'label'			=> __('Filter by Taxonomy', 'acf'),
535 535
 			'instructions'	=> '',
536 536
 			'type'			=> 'select',
537 537
 			'name'			=> 'taxonomy',
@@ -539,33 +539,33 @@  discard block
 block discarded – undo
539 539
 			'multiple'		=> 1,
540 540
 			'ui'			=> 1,
541 541
 			'allow_null'	=> 1,
542
-			'placeholder'	=> __("All taxonomies",'acf'),
542
+			'placeholder'	=> __("All taxonomies", 'acf'),
543 543
 		));
544 544
 		
545 545
 		
546 546
 		// allow_null
547
-		acf_render_field_setting( $field, array(
548
-			'label'			=> __('Allow Null?','acf'),
547
+		acf_render_field_setting($field, array(
548
+			'label'			=> __('Allow Null?', 'acf'),
549 549
 			'instructions'	=> '',
550 550
 			'type'			=> 'radio',
551 551
 			'name'			=> 'allow_null',
552 552
 			'choices'		=> array(
553
-				1				=> __("Yes",'acf'),
554
-				0				=> __("No",'acf'),
553
+				1				=> __("Yes", 'acf'),
554
+				0				=> __("No", 'acf'),
555 555
 			),
556 556
 			'layout'	=>	'horizontal',
557 557
 		));
558 558
 		
559 559
 		
560 560
 		// multiple
561
-		acf_render_field_setting( $field, array(
562
-			'label'			=> __('Select multiple values?','acf'),
561
+		acf_render_field_setting($field, array(
562
+			'label'			=> __('Select multiple values?', 'acf'),
563 563
 			'instructions'	=> '',
564 564
 			'type'			=> 'radio',
565 565
 			'name'			=> 'multiple',
566 566
 			'choices'		=> array(
567
-				1				=> __("Yes",'acf'),
568
-				0				=> __("No",'acf'),
567
+				1				=> __("Yes", 'acf'),
568
+				0				=> __("No", 'acf'),
569 569
 			),
570 570
 			'layout'	=>	'horizontal',
571 571
 		));
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
 	*  @return	$value (mixed) the modified value
590 590
 	*/
591 591
 	
592
-	function format_value( $value, $post_id, $field ) {
592
+	function format_value($value, $post_id, $field) {
593 593
 		
594 594
 		// ACF4 null
595
-		if( $value === 'null' ) {
595
+		if ($value === 'null') {
596 596
 		
597 597
 			return false;
598 598
 			
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 		
601 601
 		
602 602
 		// bail early if no value
603
-		if( empty($value) ) {
603
+		if (empty($value)) {
604 604
 			
605 605
 			return $value;
606 606
 		
@@ -608,32 +608,32 @@  discard block
 block discarded – undo
608 608
 		
609 609
 		
610 610
 		// get posts
611
-		$value = $this->get_posts( $value, $field );
611
+		$value = $this->get_posts($value, $field);
612 612
 		
613 613
 		
614 614
 		// set choices
615
-		foreach( array_keys($value) as $i ) {
615
+		foreach (array_keys($value) as $i) {
616 616
 			
617 617
 			// vars
618
-			$post = acf_extract_var( $value, $i );
618
+			$post = acf_extract_var($value, $i);
619 619
 			
620 620
 			
621 621
 			// convert $post to permalink
622
-			if( is_object($post) ) {
622
+			if (is_object($post)) {
623 623
 				
624
-				$post = get_permalink( $post );
624
+				$post = get_permalink($post);
625 625
 			
626 626
 			}
627 627
 			
628 628
 			
629 629
 			// append back to $value
630
-			$value[ $i ] = $post;
630
+			$value[$i] = $post;
631 631
 			
632 632
 		}
633 633
 		
634 634
 			
635 635
 		// convert back from array if neccessary
636
-		if( !$field['multiple'] ) {
636
+		if ( ! $field['multiple']) {
637 637
 		
638 638
 			$value = array_shift($value);
639 639
 			
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 	*  @return	$value - the modified value
663 663
 	*/
664 664
 	
665
-	function update_value( $value, $post_id, $field ) {
665
+	function update_value($value, $post_id, $field) {
666 666
 		
667 667
 		// validate
668
-		if( empty($value) ) {
668
+		if (empty($value)) {
669 669
 		
670 670
 			return $value;
671 671
 			
@@ -673,15 +673,15 @@  discard block
 block discarded – undo
673 673
 		
674 674
 		
675 675
 		// format
676
-		if( is_array($value) ) {
676
+		if (is_array($value)) {
677 677
 			
678 678
 			// array
679
-			foreach( $value as $k => $v ){
679
+			foreach ($value as $k => $v) {
680 680
 			
681 681
 				// object?
682
-				if( is_object($v) && isset($v->ID) )
682
+				if (is_object($v) && isset($v->ID))
683 683
 				{
684
-					$value[ $k ] = $v->ID;
684
+					$value[$k] = $v->ID;
685 685
 				}
686 686
 			}
687 687
 			
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 			// save value as strings, so we can clearly search for them in SQL LIKE statements
690 690
 			$value = array_map('strval', $value);
691 691
 			
692
-		} elseif( is_object($value) && isset($value->ID) ) {
692
+		} elseif (is_object($value) && isset($value->ID)) {
693 693
 			
694 694
 			// object
695 695
 			$value = $value->ID;
Please login to merge, or discard this patch.
includes/acf/fields/password.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_password') ) :
14
+if ( ! class_exists('acf_field_password')) :
15 15
 
16 16
 class acf_field_password extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'password';
36
-		$this->label = __("Password",'acf');
36
+		$this->label = __("Password", 'acf');
37 37
 		$this->defaults = array(
38 38
 			'placeholder'	=> '',
39 39
 			'prepend'		=> '',
@@ -60,46 +60,46 @@  discard block
 block discarded – undo
60 60
 	*  @date	23/01/13
61 61
 	*/
62 62
 	
63
-	function render_field( $field ) {
63
+	function render_field($field) {
64 64
 		
65 65
 		// vars
66
-		$o = array( 'type', 'id', 'class', 'name', 'value', 'placeholder' );
66
+		$o = array('type', 'id', 'class', 'name', 'value', 'placeholder');
67 67
 		$e = '';
68 68
 		
69 69
 		
70 70
 		// prepend
71
-		if( $field['prepend'] !== "" ) {
71
+		if ($field['prepend'] !== "") {
72 72
 		
73 73
 			$field['class'] .= ' acf-is-prepended';
74
-			$e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>';
74
+			$e .= '<div class="acf-input-prepend">'.$field['prepend'].'</div>';
75 75
 			
76 76
 		}
77 77
 		
78 78
 		
79 79
 		// append
80
-		if( $field['append'] !== "" ) {
80
+		if ($field['append'] !== "") {
81 81
 		
82 82
 			$field['class'] .= ' acf-is-appended';
83
-			$e .= '<div class="acf-input-append">' . $field['append'] . '</div>';
83
+			$e .= '<div class="acf-input-append">'.$field['append'].'</div>';
84 84
 			
85 85
 		}
86 86
 		
87 87
 		
88 88
 		// populate atts
89 89
 		$atts = array();
90
-		foreach( $o as $k ) {
90
+		foreach ($o as $k) {
91 91
 		
92
-			$atts[ $k ] = $field[ $k ];	
92
+			$atts[$k] = $field[$k];	
93 93
 			
94 94
 		}
95 95
 		
96 96
 		
97 97
 		// special atts
98
-		foreach( array( 'readonly', 'disabled' ) as $k ) {
98
+		foreach (array('readonly', 'disabled') as $k) {
99 99
 		
100
-			if( $field[ $k ] ) {
100
+			if ($field[$k]) {
101 101
 			
102
-				$atts[ $k ] = $k;
102
+				$atts[$k] = $k;
103 103
 				
104 104
 			}
105 105
 			
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		
109 109
 		// render
110 110
 		$e .= '<div class="acf-input-wrap">';
111
-		$e .= '<input ' . acf_esc_attr( $atts ) . ' />';
111
+		$e .= '<input '.acf_esc_attr($atts).' />';
112 112
 		$e .= '</div>';
113 113
 		
114 114
 		
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
 	*  @param	$field	- an array holding all the field's data
131 131
 	*/
132 132
 	
133
-	function render_field_settings( $field ) {
133
+	function render_field_settings($field) {
134 134
 		
135 135
 		// placeholder
136
-		acf_render_field_setting( $field, array(
137
-			'label'			=> __('Placeholder Text','acf'),
138
-			'instructions'	=> __('Appears within the input','acf'),
136
+		acf_render_field_setting($field, array(
137
+			'label'			=> __('Placeholder Text', 'acf'),
138
+			'instructions'	=> __('Appears within the input', 'acf'),
139 139
 			'type'			=> 'text',
140 140
 			'name'			=> 'placeholder',
141 141
 		));
142 142
 		
143 143
 		
144 144
 		// prepend
145
-		acf_render_field_setting( $field, array(
146
-			'label'			=> __('Prepend','acf'),
147
-			'instructions'	=> __('Appears before the input','acf'),
145
+		acf_render_field_setting($field, array(
146
+			'label'			=> __('Prepend', 'acf'),
147
+			'instructions'	=> __('Appears before the input', 'acf'),
148 148
 			'type'			=> 'text',
149 149
 			'name'			=> 'prepend',
150 150
 		));
151 151
 		
152 152
 		
153 153
 		// append
154
-		acf_render_field_setting( $field, array(
155
-			'label'			=> __('Append','acf'),
156
-			'instructions'	=> __('Appears after the input','acf'),
154
+		acf_render_field_setting($field, array(
155
+			'label'			=> __('Append', 'acf'),
156
+			'instructions'	=> __('Appears after the input', 'acf'),
157 157
 			'type'			=> 'text',
158 158
 			'name'			=> 'append',
159 159
 		));
Please login to merge, or discard this patch.
includes/acf/fields/post_object.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_post_object') ) :
14
+if ( ! class_exists('acf_field_post_object')) :
15 15
 
16 16
 class acf_field_post_object extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'post_object';
36
-		$this->label = __("Post Object",'acf');
36
+		$this->label = __("Post Object", 'acf');
37 37
 		$this->category = 'relational';
38 38
 		$this->defaults = array(
39 39
 			'post_type'		=> array(),
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		
47 47
 		
48 48
 		// extra
49
-		add_action('wp_ajax_acf/fields/post_object/query',			array($this, 'ajax_query'));
50
-		add_action('wp_ajax_nopriv_acf/fields/post_object/query',	array($this, 'ajax_query'));
49
+		add_action('wp_ajax_acf/fields/post_object/query', array($this, 'ajax_query'));
50
+		add_action('wp_ajax_nopriv_acf/fields/post_object/query', array($this, 'ajax_query'));
51 51
 		
52 52
 		
53 53
 		// do not delete!
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	*  @return	(array)
70 70
 	*/
71 71
 	
72
-	function get_choices( $options = array() ) {
72
+	function get_choices($options = array()) {
73 73
 		
74 74
 		// defaults
75 75
    		$options = acf_parse_args($options, array(
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
    		
92 92
    		
93 93
 		// load field
94
-		$field = acf_get_field( $options['field_key'] );
94
+		$field = acf_get_field($options['field_key']);
95 95
 		
96
-		if( !$field ) {
96
+		if ( ! $field) {
97 97
 		
98 98
 			return false;
99 99
 			
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 		
102 102
 		
103 103
 		// update $args
104
-		if( !empty($field['post_type']) ) {
104
+		if ( ! empty($field['post_type'])) {
105 105
 		
106
-			$args['post_type'] = acf_get_array( $field['post_type'] );
106
+			$args['post_type'] = acf_get_array($field['post_type']);
107 107
 			
108 108
 		} else {
109 109
 			
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 
114 114
 		
115 115
 		// create tax queries
116
-		if( !empty($field['taxonomy']) ) {
116
+		if ( ! empty($field['taxonomy'])) {
117 117
 			
118 118
 			// append to $args
119 119
 			$args['tax_query'] = array();
120 120
 			
121 121
 			
122 122
 			// decode terms
123
-			$taxonomies = acf_decode_taxonomy_terms( $field['taxonomy'] );
123
+			$taxonomies = acf_decode_taxonomy_terms($field['taxonomy']);
124 124
 			
125 125
 			
126 126
 			// now create the tax queries
127
-			foreach( $taxonomies as $taxonomy => $terms ) {
127
+			foreach ($taxonomies as $taxonomy => $terms) {
128 128
 			
129 129
 				$args['tax_query'][] = array(
130 130
 					'taxonomy'	=> $taxonomy,
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		
139 139
 		
140 140
 		// search
141
-		if( $options['s'] ) {
141
+		if ($options['s']) {
142 142
 		
143 143
 			$args['s'] = $options['s'];
144 144
 			
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 		
148 148
 		// filters
149 149
 		$args = apply_filters('acf/fields/post_object/query', $args, $field, $options['post_id']);
150
-		$args = apply_filters('acf/fields/post_object/query/name=' . $field['name'], $args, $field, $options['post_id'] );
151
-		$args = apply_filters('acf/fields/post_object/query/key=' . $field['key'], $args, $field, $options['post_id'] );
150
+		$args = apply_filters('acf/fields/post_object/query/name='.$field['name'], $args, $field, $options['post_id']);
151
+		$args = apply_filters('acf/fields/post_object/query/key='.$field['key'], $args, $field, $options['post_id']);
152 152
 		
153 153
 		
154 154
 		// get posts grouped by post type
155
-		$groups = acf_get_grouped_posts( $args );
155
+		$groups = acf_get_grouped_posts($args);
156 156
 		
157
-		if( !empty($groups) ) {
157
+		if ( ! empty($groups)) {
158 158
 			
159
-			foreach( array_keys($groups) as $group_title ) {
159
+			foreach (array_keys($groups) as $group_title) {
160 160
 				
161 161
 				// vars
162
-				$posts = acf_extract_var( $groups, $group_title );
162
+				$posts = acf_extract_var($groups, $group_title);
163 163
 				$titles = array();
164 164
 				
165 165
 				
@@ -170,28 +170,28 @@  discard block
 block discarded – undo
170 170
 				);
171 171
 				
172 172
 				
173
-				foreach( array_keys($posts) as $post_id ) {
173
+				foreach (array_keys($posts) as $post_id) {
174 174
 					
175 175
 					// override data
176
-					$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
176
+					$posts[$post_id] = $this->get_post_title($posts[$post_id], $field, $options['post_id']);
177 177
 					
178 178
 				};
179 179
 				
180 180
 				
181 181
 				// order by search
182
-				if( !empty($args['s']) ) {
182
+				if ( ! empty($args['s'])) {
183 183
 					
184
-					$posts = acf_order_by_search( $posts, $args['s'] );
184
+					$posts = acf_order_by_search($posts, $args['s']);
185 185
 					
186 186
 				}
187 187
 				
188 188
 				
189 189
 				// append to $data
190
-				foreach( array_keys($posts) as $post_id ) {
190
+				foreach (array_keys($posts) as $post_id) {
191 191
 					
192 192
 					$data['children'][] = array(
193 193
 						'id'	=> $post_id,
194
-						'text'	=> $posts[ $post_id ]
194
+						'text'	=> $posts[$post_id]
195 195
 					);
196 196
 					
197 197
 				}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			
205 205
 			
206 206
 			// optgroup or single
207
-			if( count($args['post_type']) == 1 ) {
207
+			if (count($args['post_type']) == 1) {
208 208
 				
209 209
 				$r = $r[0]['children'];
210 210
 				
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	function ajax_query() {
236 236
 		
237 237
 		// validate
238
-		if( !acf_verify_ajax() ) {
238
+		if ( ! acf_verify_ajax()) {
239 239
 		
240 240
 			die();
241 241
 			
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 		
244 244
 		
245 245
 		// get choices
246
-		$choices = $this->get_choices( $_POST );
246
+		$choices = $this->get_choices($_POST);
247 247
 		
248 248
 		
249 249
 		// validate
250
-		if( !$choices ) {
250
+		if ( ! $choices) {
251 251
 			
252 252
 			die();
253 253
 			
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		
256 256
 		
257 257
 		// return JSON
258
-		echo json_encode( $choices );
258
+		echo json_encode($choices);
259 259
 		die();
260 260
 			
261 261
 	}
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 	*  @return	(string)
277 277
 	*/
278 278
 	
279
-	function get_post_title( $post, $field, $post_id = 0 ) {
279
+	function get_post_title($post, $field, $post_id = 0) {
280 280
 		
281 281
 		// get post_id
282
-		if( !$post_id ) {
282
+		if ( ! $post_id) {
283 283
 			
284 284
 			$form_data = acf_get_setting('form_data');
285 285
 			
286
-			if( !empty($form_data['post_id']) ) {
286
+			if ( ! empty($form_data['post_id'])) {
287 287
 				
288 288
 				$post_id = $form_data['post_id'];
289 289
 				
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 		
298 298
 		
299 299
 		// vars
300
-		$title = acf_get_post_title( $post );
300
+		$title = acf_get_post_title($post);
301 301
 			
302 302
 		
303 303
 		// filters
304 304
 		$title = apply_filters('acf/fields/post_object/result', $title, $post, $field, $post_id);
305
-		$title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id);
306
-		$title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id);
305
+		$title = apply_filters('acf/fields/post_object/result/name='.$field['_name'], $title, $post, $field, $post_id);
306
+		$title = apply_filters('acf/fields/post_object/result/key='.$field['key'], $title, $post, $field, $post_id);
307 307
 		
308 308
 		
309 309
 		// return
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	*  @date	23/01/13
324 324
 	*/
325 325
 	
326
-	function render_field( $field ) {
326
+	function render_field($field) {
327 327
 		
328 328
 		// Change Field into a select
329 329
 		$field['type'] = 'select';
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		
334 334
 		
335 335
 		// populate choices if value exists
336
-		if( !empty($field['value']) ) {
336
+		if ( ! empty($field['value'])) {
337 337
 			
338 338
 			// get posts
339 339
 			$posts = acf_get_posts(array(
@@ -343,16 +343,16 @@  discard block
 block discarded – undo
343 343
 			
344 344
 			
345 345
 			// set choices
346
-			if( !empty($posts) ) {
346
+			if ( ! empty($posts)) {
347 347
 				
348
-				foreach( array_keys($posts) as $i ) {
348
+				foreach (array_keys($posts) as $i) {
349 349
 					
350 350
 					// vars
351
-					$post = acf_extract_var( $posts, $i );
351
+					$post = acf_extract_var($posts, $i);
352 352
 					
353 353
 					
354 354
 					// append to choices
355
-					$field['choices'][ $post->ID ] = $this->get_post_title( $post, $field );
355
+					$field['choices'][$post->ID] = $this->get_post_title($post, $field);
356 356
 					
357 357
 				}
358 358
 				
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 
363 363
 		
364 364
 		// render
365
-		acf_render_field( $field );
365
+		acf_render_field($field);
366 366
 	}
367 367
 	
368 368
 	
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 	*  @param	$field	- an array holding all the field's data
380 380
 	*/
381 381
 	
382
-	function render_field_settings( $field ) {
382
+	function render_field_settings($field) {
383 383
 		
384 384
 		// default_value
385
-		acf_render_field_setting( $field, array(
386
-			'label'			=> __('Filter by Post Type','acf'),
385
+		acf_render_field_setting($field, array(
386
+			'label'			=> __('Filter by Post Type', 'acf'),
387 387
 			'instructions'	=> '',
388 388
 			'type'			=> 'select',
389 389
 			'name'			=> 'post_type',
@@ -391,13 +391,13 @@  discard block
 block discarded – undo
391 391
 			'multiple'		=> 1,
392 392
 			'ui'			=> 1,
393 393
 			'allow_null'	=> 1,
394
-			'placeholder'	=> __("All post types",'acf'),
394
+			'placeholder'	=> __("All post types", 'acf'),
395 395
 		));
396 396
 		
397 397
 		
398 398
 		// default_value
399
-		acf_render_field_setting( $field, array(
400
-			'label'			=> __('Filter by Taxonomy','acf'),
399
+		acf_render_field_setting($field, array(
400
+			'label'			=> __('Filter by Taxonomy', 'acf'),
401 401
 			'instructions'	=> '',
402 402
 			'type'			=> 'select',
403 403
 			'name'			=> 'taxonomy',
@@ -405,47 +405,47 @@  discard block
 block discarded – undo
405 405
 			'multiple'		=> 1,
406 406
 			'ui'			=> 1,
407 407
 			'allow_null'	=> 1,
408
-			'placeholder'	=> __("All taxonomies",'acf'),
408
+			'placeholder'	=> __("All taxonomies", 'acf'),
409 409
 		));
410 410
 		
411 411
 		
412 412
 		// allow_null
413
-		acf_render_field_setting( $field, array(
414
-			'label'			=> __('Allow Null?','acf'),
413
+		acf_render_field_setting($field, array(
414
+			'label'			=> __('Allow Null?', 'acf'),
415 415
 			'instructions'	=> '',
416 416
 			'type'			=> 'radio',
417 417
 			'name'			=> 'allow_null',
418 418
 			'choices'		=> array(
419
-				1				=> __("Yes",'acf'),
420
-				0				=> __("No",'acf'),
419
+				1				=> __("Yes", 'acf'),
420
+				0				=> __("No", 'acf'),
421 421
 			),
422 422
 			'layout'	=>	'horizontal',
423 423
 		));
424 424
 		
425 425
 		
426 426
 		// multiple
427
-		acf_render_field_setting( $field, array(
428
-			'label'			=> __('Select multiple values?','acf'),
427
+		acf_render_field_setting($field, array(
428
+			'label'			=> __('Select multiple values?', 'acf'),
429 429
 			'instructions'	=> '',
430 430
 			'type'			=> 'radio',
431 431
 			'name'			=> 'multiple',
432 432
 			'choices'		=> array(
433
-				1				=> __("Yes",'acf'),
434
-				0				=> __("No",'acf'),
433
+				1				=> __("Yes", 'acf'),
434
+				0				=> __("No", 'acf'),
435 435
 			),
436 436
 			'layout'	=>	'horizontal',
437 437
 		));
438 438
 		
439 439
 		
440 440
 		// return_format
441
-		acf_render_field_setting( $field, array(
442
-			'label'			=> __('Return Format','acf'),
441
+		acf_render_field_setting($field, array(
442
+			'label'			=> __('Return Format', 'acf'),
443 443
 			'instructions'	=> '',
444 444
 			'type'			=> 'radio',
445 445
 			'name'			=> 'return_format',
446 446
 			'choices'		=> array(
447
-				'object'		=> __("Post Object",'acf'),
448
-				'id'			=> __("Post ID",'acf'),
447
+				'object'		=> __("Post Object", 'acf'),
448
+				'id'			=> __("Post ID", 'acf'),
449 449
 			),
450 450
 			'layout'	=>	'horizontal',
451 451
 		));
@@ -468,10 +468,10 @@  discard block
 block discarded – undo
468 468
 	*  @return	$value
469 469
 	*/
470 470
 	
471
-	function load_value( $value, $post_id, $field ) {
471
+	function load_value($value, $post_id, $field) {
472 472
 		
473 473
 		// ACF4 null
474
-		if( $value === 'null' ) {
474
+		if ($value === 'null') {
475 475
 		
476 476
 			return false;
477 477
 			
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 	*  @return	$value (mixed) the modified value
500 500
 	*/
501 501
 	
502
-	function format_value( $value, $post_id, $field ) {
502
+	function format_value($value, $post_id, $field) {
503 503
 		
504 504
 		// bail early if no value
505
-		if( empty($value) ) {
505
+		if (empty($value)) {
506 506
 			
507 507
 			return $value;
508 508
 		
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 		
511 511
 		
512 512
 		// force value to array
513
-		$value = acf_get_array( $value );
513
+		$value = acf_get_array($value);
514 514
 		
515 515
 		
516 516
 		// convert values to int
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		
519 519
 		
520 520
 		// load posts if needed
521
-		if( $field['return_format'] == 'object' ) {
521
+		if ($field['return_format'] == 'object') {
522 522
 			
523 523
 			// get posts
524 524
 			$value = acf_get_posts(array(
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		
531 531
 		
532 532
 		// convert back from array if neccessary
533
-		if( !$field['multiple'] ) {
533
+		if ( ! $field['multiple']) {
534 534
 		
535 535
 			$value = array_shift($value);
536 536
 			
@@ -559,10 +559,10 @@  discard block
 block discarded – undo
559 559
 	*  @return	$value - the modified value
560 560
 	*/
561 561
 	
562
-	function update_value( $value, $post_id, $field ) {
562
+	function update_value($value, $post_id, $field) {
563 563
 		
564 564
 		// validate
565
-		if( empty($value) ) {
565
+		if (empty($value)) {
566 566
 		
567 567
 			return $value;
568 568
 			
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
 		
571 571
 		
572 572
 		// format
573
-		if( is_array($value) ) {
573
+		if (is_array($value)) {
574 574
 			
575 575
 			// array
576
-			foreach( $value as $k => $v ){
576
+			foreach ($value as $k => $v) {
577 577
 			
578 578
 				// object?
579
-				if( is_object($v) && isset($v->ID) ) {
579
+				if (is_object($v) && isset($v->ID)) {
580 580
 					
581
-					$value[ $k ] = $v->ID;
581
+					$value[$k] = $v->ID;
582 582
 				
583 583
 				}
584 584
 			
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			// save value as strings, so we can clearly search for them in SQL LIKE statements
589 589
 			$value = array_map('strval', $value);
590 590
 			
591
-		} elseif( is_object($value) && isset($value->ID) ) {
591
+		} elseif (is_object($value) && isset($value->ID)) {
592 592
 			
593 593
 			// object
594 594
 			$value = $value->ID;
Please login to merge, or discard this patch.
includes/acf/fields/radio.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_radio') ) :
14
+if ( ! class_exists('acf_field_radio')) :
15 15
 
16 16
 class acf_field_radio extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'radio';
36
-		$this->label = __("Radio Button",'acf');
36
+		$this->label = __("Radio Button", 'acf');
37 37
 		$this->category = 'choice';
38 38
 		$this->defaults = array(
39 39
 			'layout'			=> 'vertical',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	*  @return	n/a
66 66
 	*/
67 67
 	
68
-	function render_field( $field ) {
68
+	function render_field($field) {
69 69
 		
70 70
 		// vars
71 71
 		$i = 0;
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
 		
80 80
 		// e
81
-		$e = '<ul ' . acf_esc_attr(array( 'class' => $field['class'] )) . '>';
81
+		$e = '<ul '.acf_esc_attr(array('class' => $field['class'])).'>';
82 82
 		
83 83
 		
84 84
 		// other choice
85
-		if( $field['other_choice'] ) {
85
+		if ($field['other_choice']) {
86 86
 			
87 87
 			// vars
88 88
 			$input = array(
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			
95 95
 			
96 96
 			// select other choice if value is not a valid choice
97
-			if( !isset($field['choices'][ $field['value'] ]) ) {
97
+			if ( ! isset($field['choices'][$field['value']])) {
98 98
 				
99 99
 				unset($input['disabled']);
100 100
 				$input['value'] = $field['value'];
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 			}
104 104
 			
105 105
 			
106
-			$field['choices']['other'] = '</label><input type="text" ' . acf_esc_attr($input) . ' /><label>';
106
+			$field['choices']['other'] = '</label><input type="text" '.acf_esc_attr($input).' /><label>';
107 107
 		
108 108
 		}
109 109
 		
110 110
 		
111 111
 		// require choices
112
-		if( !empty($field['choices']) ) {
112
+		if ( ! empty($field['choices'])) {
113 113
 			
114 114
 			// select first choice if value is not a valid choice
115
-			if( !isset($field['choices'][ $field['value'] ]) ) {
115
+			if ( ! isset($field['choices'][$field['value']])) {
116 116
 				
117 117
 				$field['value'] = key($field['choices']);
118 118
 				
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			
121 121
 			
122 122
 			// foreach choices
123
-			foreach( $field['choices'] as $value => $label ) {
123
+			foreach ($field['choices'] as $value => $label) {
124 124
 				
125 125
 				// increase counter
126 126
 				$i++;
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 				);
136 136
 				
137 137
 				
138
-				if( strval($value) === strval($field['value']) ) {
138
+				if (strval($value) === strval($field['value'])) {
139 139
 					
140 140
 					$atts['checked'] = 'checked';
141 141
 					$checked = true;
142 142
 					
143 143
 				}
144 144
 				
145
-				if( isset($field['disabled']) && acf_in_array($value, $field['disabled']) ) {
145
+				if (isset($field['disabled']) && acf_in_array($value, $field['disabled'])) {
146 146
 				
147 147
 					$atts['disabled'] = 'disabled';
148 148
 					
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 				
151 151
 				
152 152
 				// each input ID is generated with the $key, however, the first input must not use $key so that it matches the field's label for attribute
153
-				if( $i > 1 ) {
153
+				if ($i > 1) {
154 154
 				
155
-					$atts['id'] .= '-' . $value;
155
+					$atts['id'] .= '-'.$value;
156 156
 					
157 157
 				}
158 158
 				
159
-				$e .= '<li><label><input ' . acf_esc_attr( $atts ) . '/>' . $label . '</label></li>';
159
+				$e .= '<li><label><input '.acf_esc_attr($atts).'/>'.$label.'</label></li>';
160 160
 			}
161 161
 		
162 162
 		}
@@ -182,24 +182,24 @@  discard block
 block discarded – undo
182 182
 	*  @param	$field	- an array holding all the field's data
183 183
 	*/
184 184
 	
185
-	function render_field_settings( $field ) {
185
+	function render_field_settings($field) {
186 186
 		
187 187
 		// encode choices (convert from array)
188 188
 		$field['choices'] = acf_encode_choices($field['choices']);
189 189
 		
190 190
 		
191 191
 		// choices
192
-		acf_render_field_setting( $field, array(
193
-			'label'			=> __('Choices','acf'),
194
-			'instructions'	=> __('Enter each choice on a new line.','acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:','acf'). '<br /><br />' . __('red : Red','acf'),
192
+		acf_render_field_setting($field, array(
193
+			'label'			=> __('Choices', 'acf'),
194
+			'instructions'	=> __('Enter each choice on a new line.', 'acf').'<br /><br />'.__('For more control, you may specify both a value and label like this:', 'acf').'<br /><br />'.__('red : Red', 'acf'),
195 195
 			'type'			=> 'textarea',
196 196
 			'name'			=> 'choices',
197 197
 		));
198 198
 		
199 199
 		
200 200
 		// other_choice
201
-		acf_render_field_setting( $field, array(
202
-			'label'			=> __('Other','acf'),
201
+		acf_render_field_setting($field, array(
202
+			'label'			=> __('Other', 'acf'),
203 203
 			'instructions'	=> '',
204 204
 			'type'			=> 'true_false',
205 205
 			'name'			=> 'other_choice',
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 		
209 209
 		
210 210
 		// save_other_choice
211
-		acf_render_field_setting( $field, array(
212
-			'label'			=> __('Save Other','acf'),
211
+		acf_render_field_setting($field, array(
212
+			'label'			=> __('Save Other', 'acf'),
213 213
 			'instructions'	=> '',
214 214
 			'type'			=> 'true_false',
215 215
 			'name'			=> 'save_other_choice',
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
 		
219 219
 		
220 220
 		// default_value
221
-		acf_render_field_setting( $field, array(
222
-			'label'			=> __('Default Value','acf'),
223
-			'instructions'	=> __('Appears when creating a new post','acf'),
221
+		acf_render_field_setting($field, array(
222
+			'label'			=> __('Default Value', 'acf'),
223
+			'instructions'	=> __('Appears when creating a new post', 'acf'),
224 224
 			'type'			=> 'text',
225 225
 			'name'			=> 'default_value',
226 226
 		));
227 227
 		
228 228
 		
229 229
 		// layout
230
-		acf_render_field_setting( $field, array(
231
-			'label'			=> __('Layout','acf'),
230
+		acf_render_field_setting($field, array(
231
+			'label'			=> __('Layout', 'acf'),
232 232
 			'instructions'	=> '',
233 233
 			'type'			=> 'radio',
234 234
 			'name'			=> 'layout',
235 235
 			'layout'		=> 'horizontal', 
236 236
 			'choices'		=> array(
237
-				'vertical'		=> __("Vertical",'acf'), 
238
-				'horizontal'	=> __("Horizontal",'acf')
237
+				'vertical'		=> __("Vertical", 'acf'), 
238
+				'horizontal'	=> __("Horizontal", 'acf')
239 239
 			)
240 240
 		));
241 241
 		
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	*  @return	$field - the modified field
259 259
 	*/
260 260
 
261
-	function update_field( $field ) {
261
+	function update_field($field) {
262 262
 		
263 263
 		// decode choices (convert to array)
264 264
 		$field['choices'] = acf_decode_choices($field['choices']);
@@ -286,24 +286,24 @@  discard block
 block discarded – undo
286 286
 	*  @return	$value - the modified value
287 287
 	*/
288 288
 	
289
-	function update_value( $value, $post_id, $field ) {
289
+	function update_value($value, $post_id, $field) {
290 290
 		
291 291
 		// save_other_choice
292
-		if( $field['save_other_choice'] ) {
292
+		if ($field['save_other_choice']) {
293 293
 			
294 294
 			// value isn't in choices yet
295
-			if( !isset($field['choices'][ $value ]) ) {
295
+			if ( ! isset($field['choices'][$value])) {
296 296
 				
297 297
 				// get ID if local
298
-				if( !$field['ID'] ) {
298
+				if ( ! $field['ID']) {
299 299
 					
300
-					$field = acf_get_field( $field['key'], true );
300
+					$field = acf_get_field($field['key'], true);
301 301
 					
302 302
 				}
303 303
 				
304 304
 				
305 305
 				// bail early if no ID
306
-				if( !$field['ID'] ) {
306
+				if ( ! $field['ID']) {
307 307
 					
308 308
 					return $value;
309 309
 					
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 				
312 312
 				
313 313
 				// update $field
314
-				$field['choices'][ $value ] = $value;
314
+				$field['choices'][$value] = $value;
315 315
 				
316 316
 				
317 317
 				// save
318
-				acf_update_field( $field );
318
+				acf_update_field($field);
319 319
 				
320 320
 			}
321 321
 			
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	*  @return	$value - the value to be saved in te database
344 344
 	*/
345 345
 	
346
-	function load_value( $value, $post_id, $field ) {
346
+	function load_value($value, $post_id, $field) {
347 347
 		
348 348
 		// must be single value
349
-		if( is_array($value) ) {
349
+		if (is_array($value)) {
350 350
 			
351 351
 			$value = array_pop($value);
352 352
 			
Please login to merge, or discard this patch.
includes/acf/fields/relationship.php 1 patch
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_relationship') ) :
14
+if ( ! class_exists('acf_field_relationship')) :
15 15
 
16 16
 class acf_field_relationship extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'relationship';
36
-		$this->label = __("Relationship",'acf');
36
+		$this->label = __("Relationship", 'acf');
37 37
 		$this->category = 'relational';
38 38
 		$this->defaults = array(
39 39
 			'post_type'			=> array(),
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 			'return_format'		=> 'object'
46 46
 		);
47 47
 		$this->l10n = array(
48
-			'min'		=> __("Minimum values reached ( {min} values )",'acf'),
49
-			'max'		=> __("Maximum values reached ( {max} values )",'acf'),
50
-			'loading'	=> __('Loading','acf'),
51
-			'empty'		=> __('No matches found','acf'),
48
+			'min'		=> __("Minimum values reached ( {min} values )", 'acf'),
49
+			'max'		=> __("Maximum values reached ( {max} values )", 'acf'),
50
+			'loading'	=> __('Loading', 'acf'),
51
+			'empty'		=> __('No matches found', 'acf'),
52 52
 		);
53 53
 		
54 54
 		
55 55
 		// extra
56
-		add_action('wp_ajax_acf/fields/relationship/query',			array($this, 'ajax_query'));
57
-		add_action('wp_ajax_nopriv_acf/fields/relationship/query',	array($this, 'ajax_query'));
56
+		add_action('wp_ajax_acf/fields/relationship/query', array($this, 'ajax_query'));
57
+		add_action('wp_ajax_nopriv_acf/fields/relationship/query', array($this, 'ajax_query'));
58 58
 		
59 59
 		
60 60
 		// do not delete!
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	*  @return	(array)
77 77
 	*/
78 78
 	
79
-	function get_choices( $options = array() ) {
79
+	function get_choices($options = array()) {
80 80
 		
81 81
    		// defaults
82 82
    		$options = acf_parse_args($options, array(
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
    		
102 102
 		
103 103
 		// load field
104
-		$field = acf_get_field( $options['field_key'] );
104
+		$field = acf_get_field($options['field_key']);
105 105
 		
106
-		if( !$field ) {
106
+		if ( ! $field) {
107 107
 		
108 108
 			return false;
109 109
 			
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 		
112 112
 		
113 113
 		// update $args
114
-		if( !empty($options['post_type']) ) {
114
+		if ( ! empty($options['post_type'])) {
115 115
 			
116
-			$args['post_type'] = acf_get_array( $options['post_type'] );
116
+			$args['post_type'] = acf_get_array($options['post_type']);
117 117
 		
118
-		} elseif( !empty($field['post_type']) ) {
118
+		} elseif ( ! empty($field['post_type'])) {
119 119
 		
120
-			$args['post_type'] = acf_get_array( $field['post_type'] );
120
+			$args['post_type'] = acf_get_array($field['post_type']);
121 121
 			
122 122
 		} else {
123 123
 			
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		// update taxonomy
129 129
 		$taxonomies = array();
130 130
 		
131
-		if( !empty($options['taxonomy']) ) {
131
+		if ( ! empty($options['taxonomy'])) {
132 132
 			
133 133
 			$term = acf_decode_taxonomy_term($options['taxonomy']);
134 134
 			
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 			);
145 145
 			
146 146
 			
147
-		} elseif( !empty($field['taxonomy']) ) {
147
+		} elseif ( ! empty($field['taxonomy'])) {
148 148
 			
149
-			$taxonomies = acf_decode_taxonomy_terms( $field['taxonomy'] );
149
+			$taxonomies = acf_decode_taxonomy_terms($field['taxonomy']);
150 150
 			
151 151
 			// append to $args
152 152
 			$args['tax_query'] = array();
153 153
 			
154 154
 			
155 155
 			// now create the tax queries
156
-			foreach( $taxonomies as $taxonomy => $terms ) {
156
+			foreach ($taxonomies as $taxonomy => $terms) {
157 157
 			
158 158
 				$args['tax_query'][] = array(
159 159
 					'taxonomy'	=> $taxonomy,
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		
168 168
 		
169 169
 		// search
170
-		if( $options['s'] ) {
170
+		if ($options['s']) {
171 171
 		
172 172
 			$args['s'] = $options['s'];
173 173
 			
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 		
177 177
 		// filters
178 178
 		$args = apply_filters('acf/fields/relationship/query', $args, $field, $options['post_id']);
179
-		$args = apply_filters('acf/fields/relationship/query/name=' . $field['name'], $args, $field, $options['post_id'] );
180
-		$args = apply_filters('acf/fields/relationship/query/key=' . $field['key'], $args, $field, $options['post_id'] );
179
+		$args = apply_filters('acf/fields/relationship/query/name='.$field['name'], $args, $field, $options['post_id']);
180
+		$args = apply_filters('acf/fields/relationship/query/key='.$field['key'], $args, $field, $options['post_id']);
181 181
 		
182 182
 		
183 183
 		// get posts grouped by post type
184
-		$groups = acf_get_grouped_posts( $args );
184
+		$groups = acf_get_grouped_posts($args);
185 185
 		
186
-		if( !empty($groups) ) {
186
+		if ( ! empty($groups)) {
187 187
 			
188
-			foreach( array_keys($groups) as $group_title ) {
188
+			foreach (array_keys($groups) as $group_title) {
189 189
 				
190 190
 				// vars
191
-				$posts = acf_extract_var( $groups, $group_title );
191
+				$posts = acf_extract_var($groups, $group_title);
192 192
 				$titles = array();
193 193
 				
194 194
 				
@@ -199,28 +199,28 @@  discard block
 block discarded – undo
199 199
 				);
200 200
 				
201 201
 				
202
-				foreach( array_keys($posts) as $post_id ) {
202
+				foreach (array_keys($posts) as $post_id) {
203 203
 					
204 204
 					// override data
205
-					$posts[ $post_id ] = $this->get_post_title( $posts[ $post_id ], $field, $options['post_id'] );
205
+					$posts[$post_id] = $this->get_post_title($posts[$post_id], $field, $options['post_id']);
206 206
 					
207 207
 				};
208 208
 				
209 209
 				
210 210
 				// order by search
211
-				if( !empty($args['s']) ) {
211
+				if ( ! empty($args['s'])) {
212 212
 					
213
-					$posts = acf_order_by_search( $posts, $args['s'] );
213
+					$posts = acf_order_by_search($posts, $args['s']);
214 214
 					
215 215
 				}
216 216
 				
217 217
 				
218 218
 				// append to $data
219
-				foreach( array_keys($posts) as $post_id ) {
219
+				foreach (array_keys($posts) as $post_id) {
220 220
 					
221 221
 					$data['children'][] = array(
222 222
 						'id'	=> $post_id,
223
-						'text'	=> $posts[ $post_id ]
223
+						'text'	=> $posts[$post_id]
224 224
 					);
225 225
 					
226 226
 				}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			
234 234
 			
235 235
 			// add as optgroup or results
236
-			if( count($args['post_type']) == 1 ) {
236
+			if (count($args['post_type']) == 1) {
237 237
 				
238 238
 				$r = $r[0]['children'];
239 239
 				
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	function ajax_query() {
265 265
 		
266 266
 		// validate
267
-		if( !acf_verify_ajax() ) {
267
+		if ( ! acf_verify_ajax()) {
268 268
 		
269 269
 			die();
270 270
 			
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 		
273 273
 		
274 274
 		// get posts
275
-		$posts = $this->get_choices( $_POST );
275
+		$posts = $this->get_choices($_POST);
276 276
 		
277 277
 		
278 278
 		// validate
279
-		if( !$posts ) {
279
+		if ( ! $posts) {
280 280
 			
281 281
 			die();
282 282
 			
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		
285 285
 		
286 286
 		// return JSON
287
-		echo json_encode( $posts );
287
+		echo json_encode($posts);
288 288
 		die();
289 289
 			
290 290
 	}
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	*  @return	(string)
306 306
 	*/
307 307
 	
308
-	function get_post_title( $post, $field, $post_id = 0 ) {
308
+	function get_post_title($post, $field, $post_id = 0) {
309 309
 		
310 310
 		// get post_id
311
-		if( !$post_id ) {
311
+		if ( ! $post_id) {
312 312
 			
313 313
 			$post_id = acf_get_setting('form_data/post_id', get_the_ID());
314 314
 			
@@ -316,28 +316,28 @@  discard block
 block discarded – undo
316 316
 		
317 317
 		
318 318
 		// vars
319
-		$title = acf_get_post_title( $post );
319
+		$title = acf_get_post_title($post);
320 320
 		
321 321
 		
322 322
 		// elements
323
-		if( !empty($field['elements']) ) {
323
+		if ( ! empty($field['elements'])) {
324 324
 			
325
-			if( in_array('featured_image', $field['elements']) ) {
325
+			if (in_array('featured_image', $field['elements'])) {
326 326
 				
327 327
 				$image = '';
328 328
 				
329
-				if( $post->post_type == 'attachment' ) {
329
+				if ($post->post_type == 'attachment') {
330 330
 					
331
-					$image = wp_get_attachment_image( $post->ID, array(17, 17) );
331
+					$image = wp_get_attachment_image($post->ID, array(17, 17));
332 332
 					
333 333
 				} else {
334 334
 					
335
-					$image = get_the_post_thumbnail( $post->ID, array(17, 17) );
335
+					$image = get_the_post_thumbnail($post->ID, array(17, 17));
336 336
 					
337 337
 				}
338 338
 				
339 339
 				
340
-				$title = '<div class="thumbnail">' . $image . '</div>' . $title;
340
+				$title = '<div class="thumbnail">'.$image.'</div>'.$title;
341 341
 			}
342 342
 			
343 343
 		}
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 		
346 346
 		// filters
347 347
 		$title = apply_filters('acf/fields/relationship/result', $title, $post, $field, $post_id);
348
-		$title = apply_filters('acf/fields/relationship/result/name=' . $field['_name'], $title, $post, $field, $post_id);
349
-		$title = apply_filters('acf/fields/relationship/result/key=' . $field['key'], $title, $post, $field, $post_id);
348
+		$title = apply_filters('acf/fields/relationship/result/name='.$field['_name'], $title, $post, $field, $post_id);
349
+		$title = apply_filters('acf/fields/relationship/result/key='.$field['key'], $title, $post, $field, $post_id);
350 350
 		
351 351
 		
352 352
 		// return
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	*  @date	23/01/13
368 368
 	*/
369 369
 	
370
-	function render_field( $field ) {
370
+	function render_field($field) {
371 371
 		
372 372
 		// vars
373 373
 		$values = array();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		
385 385
 		
386 386
 		// Lang
387
-		if( defined('ICL_LANGUAGE_CODE') ) {
387
+		if (defined('ICL_LANGUAGE_CODE')) {
388 388
 		
389 389
 			$atts['data-lang'] = ICL_LANGUAGE_CODE;
390 390
 			
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 		
393 393
 		
394 394
 		// data types
395
-		$field['post_type'] = acf_get_array( $field['post_type'] );
396
-		$field['taxonomy'] = acf_get_array( $field['taxonomy'] );
395
+		$field['post_type'] = acf_get_array($field['post_type']);
396
+		$field['taxonomy'] = acf_get_array($field['taxonomy']);
397 397
 		
398 398
 		
399 399
 		// width for select filters
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			'taxonomy'	=> 0
404 404
 		);
405 405
 		
406
-		if( !empty($field['filters']) ) {
406
+		if ( ! empty($field['filters'])) {
407 407
 			
408 408
 			$width = array(
409 409
 				'search'	=> 50,
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 				'taxonomy'	=> 25
412 412
 			);
413 413
 			
414
-			foreach( array_keys($width) as $k ) {
414
+			foreach (array_keys($width) as $k) {
415 415
 				
416
-				if( ! in_array($k, $field['filters']) ) {
416
+				if ( ! in_array($k, $field['filters'])) {
417 417
 				
418
-					$width[ $k ] = 0;
418
+					$width[$k] = 0;
419 419
 					
420 420
 				}
421 421
 				
@@ -423,33 +423,33 @@  discard block
 block discarded – undo
423 423
 			
424 424
 			
425 425
 			// search
426
-			if( $width['search'] == 0 ) {
426
+			if ($width['search'] == 0) {
427 427
 			
428
-				$width['post_type'] = ( $width['post_type'] == 0 ) ? 0 : 50;
429
-				$width['taxonomy'] = ( $width['taxonomy'] == 0 ) ? 0 : 50;
428
+				$width['post_type'] = ($width['post_type'] == 0) ? 0 : 50;
429
+				$width['taxonomy'] = ($width['taxonomy'] == 0) ? 0 : 50;
430 430
 				
431 431
 			}
432 432
 			
433 433
 			// post_type
434
-			if( $width['post_type'] == 0 ) {
434
+			if ($width['post_type'] == 0) {
435 435
 			
436
-				$width['taxonomy'] = ( $width['taxonomy'] == 0 ) ? 0 : 50;
436
+				$width['taxonomy'] = ($width['taxonomy'] == 0) ? 0 : 50;
437 437
 				
438 438
 			}
439 439
 			
440 440
 			
441 441
 			// taxonomy
442
-			if( $width['taxonomy'] == 0 ) {
442
+			if ($width['taxonomy'] == 0) {
443 443
 			
444
-				$width['post_type'] = ( $width['post_type'] == 0 ) ? 0 : 50;
444
+				$width['post_type'] = ($width['post_type'] == 0) ? 0 : 50;
445 445
 				
446 446
 			}
447 447
 			
448 448
 			
449 449
 			// search
450
-			if( $width['post_type'] == 0 && $width['taxonomy'] == 0 ) {
450
+			if ($width['post_type'] == 0 && $width['taxonomy'] == 0) {
451 451
 			
452
-				$width['search'] = ( $width['search'] == 0 ) ? 0 : 100;
452
+				$width['search'] = ($width['search'] == 0) ? 0 : 100;
453 453
 				
454 454
 			}
455 455
 		}
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 		// post type filter
459 459
 		$post_types = array();
460 460
 		
461
-		if( $width['post_type'] ) {
461
+		if ($width['post_type']) {
462 462
 			
463
-			if( !empty($field['post_type']) ) {
463
+			if ( ! empty($field['post_type'])) {
464 464
 			
465 465
 				$post_types = $field['post_type'];
466 466
 	
@@ -480,36 +480,36 @@  discard block
 block discarded – undo
480 480
 		$taxonomies = array();
481 481
 		$term_groups = array();
482 482
 		
483
-		if( $width['taxonomy'] ) {
483
+		if ($width['taxonomy']) {
484 484
 			
485 485
 			// taxonomies
486
-			if( !empty($field['taxonomy']) ) {
486
+			if ( ! empty($field['taxonomy'])) {
487 487
 				
488 488
 				// get the field's terms
489
-				$term_groups = acf_get_array( $field['taxonomy'] );
490
-				$term_groups = acf_decode_taxonomy_terms( $term_groups );
489
+				$term_groups = acf_get_array($field['taxonomy']);
490
+				$term_groups = acf_decode_taxonomy_terms($term_groups);
491 491
 				
492 492
 				
493 493
 				// update taxonomies
494 494
 				$taxonomies = array_keys($term_groups);
495 495
 			
496
-			} elseif( !empty($field['post_type']) ) {
496
+			} elseif ( ! empty($field['post_type'])) {
497 497
 				
498 498
 				// loop over post types and find connected taxonomies
499
-				foreach( $field['post_type'] as $post_type ) {
499
+				foreach ($field['post_type'] as $post_type) {
500 500
 					
501
-					$post_taxonomies = get_object_taxonomies( $post_type );
501
+					$post_taxonomies = get_object_taxonomies($post_type);
502 502
 					
503 503
 					// bail early if no taxonomies
504
-					if( empty($post_taxonomies) ) {
504
+					if (empty($post_taxonomies)) {
505 505
 						
506 506
 						continue;
507 507
 						
508 508
 					}
509 509
 						
510
-					foreach( $post_taxonomies as $post_taxonomy ) {
510
+					foreach ($post_taxonomies as $post_taxonomy) {
511 511
 						
512
-						if( !in_array($post_taxonomy, $taxonomies) ) {
512
+						if ( ! in_array($post_taxonomy, $taxonomies)) {
513 513
 							
514 514
 							$taxonomies[] = $post_taxonomy;
515 515
 							
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
 			
528 528
 			
529 529
 			// terms
530
-			$term_groups = acf_get_taxonomy_terms( $taxonomies );
530
+			$term_groups = acf_get_taxonomy_terms($taxonomies);
531 531
 			
532 532
 			
533 533
 			// update $term_groups with specific terms
534
-			if( !empty($field['taxonomy']) ) {
534
+			if ( ! empty($field['taxonomy'])) {
535 535
 				
536
-				foreach( array_keys($term_groups) as $taxonomy ) {
536
+				foreach (array_keys($term_groups) as $taxonomy) {
537 537
 					
538
-					foreach( array_keys($term_groups[ $taxonomy ]) as $term ) {
538
+					foreach (array_keys($term_groups[$taxonomy]) as $term) {
539 539
 						
540
-						if( ! in_array($term, $field['taxonomy']) ) {
540
+						if ( ! in_array($term, $field['taxonomy'])) {
541 541
 							
542
-							unset($term_groups[ $taxonomy ][ $term ]);
542
+							unset($term_groups[$taxonomy][$term]);
543 543
 							
544 544
 						}
545 545
 						
@@ -559,25 +559,25 @@  discard block
 block discarded – undo
559 559
 		<input type="hidden" name="<?php echo $field['name']; ?>" value="" />
560 560
 	</div>
561 561
 	
562
-	<?php if( $width['search'] || $width['post_type'] || $width['taxonomy'] ): ?>
562
+	<?php if ($width['search'] || $width['post_type'] || $width['taxonomy']): ?>
563 563
 	<div class="filters">
564 564
 		
565 565
 		<ul class="acf-hl">
566 566
 		
567
-			<?php if( $width['search'] ): ?>
567
+			<?php if ($width['search']): ?>
568 568
 			<li style="width:<?php echo $width['search']; ?>%;">
569 569
 				<div class="inner">
570
-				<input class="filter" data-filter="s" placeholder="<?php _e("Search...",'acf'); ?>" type="text" />
570
+				<input class="filter" data-filter="s" placeholder="<?php _e("Search...", 'acf'); ?>" type="text" />
571 571
 				</div>
572 572
 			</li>
573 573
 			<?php endif; ?>
574 574
 			
575
-			<?php if( $width['post_type'] ): ?>
575
+			<?php if ($width['post_type']): ?>
576 576
 			<li style="width:<?php echo $width['post_type']; ?>%;">
577 577
 				<div class="inner">
578 578
 				<select class="filter" data-filter="post_type">
579
-					<option value=""><?php _e('Select post type','acf'); ?></option>
580
-					<?php foreach( $post_types as $k => $v ): ?>
579
+					<option value=""><?php _e('Select post type', 'acf'); ?></option>
580
+					<?php foreach ($post_types as $k => $v): ?>
581 581
 						<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
582 582
 					<?php endforeach; ?>
583 583
 				</select>
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 			</li>
586 586
 			<?php endif; ?>
587 587
 			
588
-			<?php if( $width['taxonomy'] ): ?>
588
+			<?php if ($width['taxonomy']): ?>
589 589
 			<li style="width:<?php echo $width['taxonomy']; ?>%;">
590 590
 				<div class="inner">
591 591
 				<select class="filter" data-filter="taxonomy">
592
-					<option value=""><?php _e('Select taxonomy','acf'); ?></option>
593
-					<?php foreach( $term_groups as $k_opt => $v_opt ): ?>
592
+					<option value=""><?php _e('Select taxonomy', 'acf'); ?></option>
593
+					<?php foreach ($term_groups as $k_opt => $v_opt): ?>
594 594
 						<optgroup label="<?php echo $k_opt; ?>">
595
-							<?php foreach( $v_opt as $k => $v ): ?>
595
+							<?php foreach ($v_opt as $k => $v): ?>
596 596
 								<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
597 597
 							<?php endforeach; ?>
598 598
 						</optgroup>
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 		
619 619
 			<ul class="acf-bl list">
620 620
 			
621
-				<?php if( !empty($field['value']) ): 
621
+				<?php if ( ! empty($field['value'])): 
622 622
 					
623 623
 					// get posts
624 624
 					$posts = acf_get_posts(array(
@@ -628,18 +628,18 @@  discard block
 block discarded – undo
628 628
 					
629 629
 					
630 630
 					// set choices
631
-					if( !empty($posts) ):
631
+					if ( ! empty($posts)):
632 632
 						
633
-						foreach( array_keys($posts) as $i ):
633
+						foreach (array_keys($posts) as $i):
634 634
 							
635 635
 							// vars
636
-							$post = acf_extract_var( $posts, $i );
636
+							$post = acf_extract_var($posts, $i);
637 637
 							
638 638
 							
639 639
 							?><li>
640 640
 								<input type="hidden" name="<?php echo $field['name']; ?>[]" value="<?php echo $post->ID; ?>" />
641 641
 								<span data-id="<?php echo $post->ID; ?>" class="acf-rel-item">
642
-									<?php echo $this->get_post_title( $post, $field ); ?>
642
+									<?php echo $this->get_post_title($post, $field); ?>
643 643
 									<a href="#" class="acf-icon -minus small dark" data-name="remove_item"></a>
644 644
 								</span>
645 645
 							</li><?php
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	*  @param	$field	- an array holding all the field's data
678 678
 	*/
679 679
 	
680
-	function render_field_settings( $field ) {
680
+	function render_field_settings($field) {
681 681
 		
682 682
 		// vars
683 683
 		$field['min'] = empty($field['min']) ? '' : $field['min'];
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 		
686 686
 		
687 687
 		// post_type
688
-		acf_render_field_setting( $field, array(
689
-			'label'			=> __('Filter by Post Type','acf'),
688
+		acf_render_field_setting($field, array(
689
+			'label'			=> __('Filter by Post Type', 'acf'),
690 690
 			'instructions'	=> '',
691 691
 			'type'			=> 'select',
692 692
 			'name'			=> 'post_type',
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 			'multiple'		=> 1,
695 695
 			'ui'			=> 1,
696 696
 			'allow_null'	=> 1,
697
-			'placeholder'	=> __("All post types",'acf'),
697
+			'placeholder'	=> __("All post types", 'acf'),
698 698
 		));
699 699
 		
700 700
 		
701 701
 		// taxonomy
702
-		acf_render_field_setting( $field, array(
703
-			'label'			=> __('Filter by Taxonomy','acf'),
702
+		acf_render_field_setting($field, array(
703
+			'label'			=> __('Filter by Taxonomy', 'acf'),
704 704
 			'instructions'	=> '',
705 705
 			'type'			=> 'select',
706 706
 			'name'			=> 'taxonomy',
@@ -708,39 +708,39 @@  discard block
 block discarded – undo
708 708
 			'multiple'		=> 1,
709 709
 			'ui'			=> 1,
710 710
 			'allow_null'	=> 1,
711
-			'placeholder'	=> __("All taxonomies",'acf'),
711
+			'placeholder'	=> __("All taxonomies", 'acf'),
712 712
 		));
713 713
 		
714 714
 		
715 715
 		// filters
716
-		acf_render_field_setting( $field, array(
717
-			'label'			=> __('Filters','acf'),
716
+		acf_render_field_setting($field, array(
717
+			'label'			=> __('Filters', 'acf'),
718 718
 			'instructions'	=> '',
719 719
 			'type'			=> 'checkbox',
720 720
 			'name'			=> 'filters',
721 721
 			'choices'		=> array(
722
-				'search'		=> __("Search",'acf'),
723
-				'post_type'		=> __("Post Type",'acf'),
724
-				'taxonomy'		=> __("Taxonomy",'acf'),
722
+				'search'		=> __("Search", 'acf'),
723
+				'post_type'		=> __("Post Type", 'acf'),
724
+				'taxonomy'		=> __("Taxonomy", 'acf'),
725 725
 			),
726 726
 		));
727 727
 		
728 728
 		
729 729
 		// filters
730
-		acf_render_field_setting( $field, array(
731
-			'label'			=> __('Elements','acf'),
732
-			'instructions'	=> __('Selected elements will be displayed in each result','acf'),
730
+		acf_render_field_setting($field, array(
731
+			'label'			=> __('Elements', 'acf'),
732
+			'instructions'	=> __('Selected elements will be displayed in each result', 'acf'),
733 733
 			'type'			=> 'checkbox',
734 734
 			'name'			=> 'elements',
735 735
 			'choices'		=> array(
736
-				'featured_image'	=> __("Featured Image",'acf'),
736
+				'featured_image'	=> __("Featured Image", 'acf'),
737 737
 			),
738 738
 		));
739 739
 		
740 740
 		
741 741
 		// min
742
-		acf_render_field_setting( $field, array(
743
-			'label'			=> __('Minimum posts','acf'),
742
+		acf_render_field_setting($field, array(
743
+			'label'			=> __('Minimum posts', 'acf'),
744 744
 			'instructions'	=> '',
745 745
 			'type'			=> 'number',
746 746
 			'name'			=> 'min',
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 		
749 749
 		
750 750
 		// max
751
-		acf_render_field_setting( $field, array(
752
-			'label'			=> __('Maximum posts','acf'),
751
+		acf_render_field_setting($field, array(
752
+			'label'			=> __('Maximum posts', 'acf'),
753 753
 			'instructions'	=> '',
754 754
 			'type'			=> 'number',
755 755
 			'name'			=> 'max',
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 		
760 760
 		
761 761
 		// return_format
762
-		acf_render_field_setting( $field, array(
763
-			'label'			=> __('Return Format','acf'),
762
+		acf_render_field_setting($field, array(
763
+			'label'			=> __('Return Format', 'acf'),
764 764
 			'instructions'	=> '',
765 765
 			'type'			=> 'radio',
766 766
 			'name'			=> 'return_format',
767 767
 			'choices'		=> array(
768
-				'object'		=> __("Post Object",'acf'),
769
-				'id'			=> __("Post ID",'acf'),
768
+				'object'		=> __("Post Object", 'acf'),
769
+				'id'			=> __("Post ID", 'acf'),
770 770
 			),
771 771
 			'layout'	=>	'horizontal',
772 772
 		));
@@ -791,10 +791,10 @@  discard block
 block discarded – undo
791 791
 	*  @return	$value (mixed) the modified value
792 792
 	*/
793 793
 	
794
-	function format_value( $value, $post_id, $field ) {
794
+	function format_value($value, $post_id, $field) {
795 795
 		
796 796
 		// bail early if no value
797
-		if( empty($value) ) {
797
+		if (empty($value)) {
798 798
 		
799 799
 			return $value;
800 800
 			
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 		
803 803
 		
804 804
 		// force value to array
805
-		$value = acf_get_array( $value );
805
+		$value = acf_get_array($value);
806 806
 		
807 807
 		
808 808
 		// convert to int
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		
811 811
 		
812 812
 		// load posts if needed
813
-		if( $field['return_format'] == 'object' ) {
813
+		if ($field['return_format'] == 'object') {
814 814
 			
815 815
 			// get posts
816 816
 			$value = acf_get_posts(array(
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 	*  @return	$post_id (int)
841 841
 	*/
842 842
 	
843
-	function validate_value( $valid, $value, $field, $input ){
843
+	function validate_value($valid, $value, $field, $input) {
844 844
 		
845 845
 		// default
846
-		if( empty($value) || !is_array($value) ) {
846
+		if (empty($value) || ! is_array($value)) {
847 847
 		
848 848
 			$value = array();
849 849
 			
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		
853 853
 		// min
854
-		if( count($value) < $field['min'] ) {
854
+		if (count($value) < $field['min']) {
855 855
 		
856
-			$valid = _n( '%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf' );
857
-			$valid = sprintf( $valid, $field['label'], $field['min'] );
856
+			$valid = _n('%s requires at least %s selection', '%s requires at least %s selections', $field['min'], 'acf');
857
+			$valid = sprintf($valid, $field['label'], $field['min']);
858 858
 			
859 859
 		}
860 860
 		
@@ -881,10 +881,10 @@  discard block
 block discarded – undo
881 881
 	*  @return	$value - the modified value
882 882
 	*/
883 883
 	
884
-	function update_value( $value, $post_id, $field ) {
884
+	function update_value($value, $post_id, $field) {
885 885
 		
886 886
 		// validate
887
-		if( empty($value) ) {
887
+		if (empty($value)) {
888 888
 			
889 889
 			return $value;
890 890
 			
@@ -892,16 +892,16 @@  discard block
 block discarded – undo
892 892
 		
893 893
 		
894 894
 		// force value to array
895
-		$value = acf_get_array( $value );
895
+		$value = acf_get_array($value);
896 896
 		
897 897
 					
898 898
 		// array
899
-		foreach( $value as $k => $v ){
899
+		foreach ($value as $k => $v) {
900 900
 		
901 901
 			// object?
902
-			if( is_object($v) && isset($v->ID) ) {
902
+			if (is_object($v) && isset($v->ID)) {
903 903
 			
904
-				$value[ $k ] = $v->ID;
904
+				$value[$k] = $v->ID;
905 905
 				
906 906
 			}
907 907
 			
Please login to merge, or discard this patch.
includes/acf/fields/select.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *  @subpackage	Fields
12 12
 */
13 13
 
14
-if( ! class_exists('acf_field_select') ) :
14
+if ( ! class_exists('acf_field_select')) :
15 15
 
16 16
 class acf_field_select extends acf_field {
17 17
 	
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		// vars
35 35
 		$this->name = 'select';
36
-		$this->label = __("Select",'acf');
36
+		$this->label = __("Select", 'acf');
37 37
 		$this->category = 'choice';
38 38
 		$this->defaults = array(
39 39
 			'multiple' 		=> 0,
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 		
50 50
 		
51 51
 		// ajax
52
-		add_action('wp_ajax_acf/fields/select/query',				array($this, 'ajax_query'));
53
-		add_action('wp_ajax_nopriv_acf/fields/select/query',		array($this, 'ajax_query'));
52
+		add_action('wp_ajax_acf/fields/select/query', array($this, 'ajax_query'));
53
+		add_action('wp_ajax_nopriv_acf/fields/select/query', array($this, 'ajax_query'));
54 54
 		
55 55
 		
56 56
 		// do not delete!
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	function ajax_query() {
76 76
 		
77 77
    		// options
78
-   		$options = acf_parse_args( $_POST, array(
78
+   		$options = acf_parse_args($_POST, array(
79 79
 			'post_id'					=>	0,
80 80
 			's'							=>	'',
81 81
 			'field_key'					=>	'',
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		
85 85
 		
86 86
 		// load field
87
-		$field = acf_get_field( $options['field_key'] );
87
+		$field = acf_get_field($options['field_key']);
88 88
 		
89
-		if( !$field ) {
89
+		if ( ! $field) {
90 90
 		
91 91
 			die();
92 92
 			
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		
100 100
 		
101 101
 		// search
102
-		if( $options['s'] !== '' ) {
102
+		if ($options['s'] !== '') {
103 103
 			
104 104
 			// search may be integer
105 105
 			$s = strval($options['s']);
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 		
113 113
 		
114 114
 		// loop through choices
115
-		if( !empty($field['choices']) ) {
115
+		if ( ! empty($field['choices'])) {
116 116
 		
117
-			foreach( $field['choices'] as $k => $v ) {
117
+			foreach ($field['choices'] as $k => $v) {
118 118
 				
119 119
 				// if searching, but doesn't exist
120
-				if( $s !== false && stripos($v, $s) === false ) {
120
+				if ($s !== false && stripos($v, $s) === false) {
121 121
 				
122 122
 					continue;
123 123
 					
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 				// append
128 128
 				$r[] = array(
129 129
 					'id'	=> $k,
130
-					'text'	=> strval( $v )
130
+					'text'	=> strval($v)
131 131
 				);
132 132
 				
133 133
 			}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		
137 137
 		
138 138
 		// return JSON
139
-		echo json_encode( $r );
139
+		echo json_encode($r);
140 140
 		die();
141 141
 			
142 142
 	}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	*  @date	23/01/13
155 155
 	*/
156 156
 	
157
-	function render_field( $field ) {
157
+	function render_field($field) {
158 158
 	
159 159
 		// convert
160 160
 		$field['value'] = acf_get_array($field['value'], false);
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 		
163 163
 		
164 164
 		// placeholder
165
-		if( empty($field['placeholder']) ) {
165
+		if (empty($field['placeholder'])) {
166 166
 		
167
-			$field['placeholder'] = __("Select",'acf');
167
+			$field['placeholder'] = __("Select", 'acf');
168 168
 			
169 169
 		}
170 170
 		
171 171
 		
172 172
 		// add empty value (allows '' to be selected)
173
-		if( !count($field['value']) ) {
173
+		if ( ! count($field['value'])) {
174 174
 			
175 175
 			$field['value'][''] = '';
176 176
 			
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 		
179 179
 		
180 180
 		// null
181
-		if( $field['allow_null'] && !$field['multiple'] ) {
181
+		if ($field['allow_null'] && ! $field['multiple']) {
182 182
 			
183
-			$prepend = array(''	=> '- ' . $field['placeholder'] . ' -');
183
+			$prepend = array(''	=> '- '.$field['placeholder'].' -');
184 184
 			$field['choices'] = $prepend + $field['choices'];
185 185
 			
186 186
 		}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		
201 201
 		
202 202
 		// multiple
203
-		if( $field['multiple'] ) {
203
+		if ($field['multiple']) {
204 204
 		
205 205
 			$atts['multiple'] = 'multiple';
206 206
 			$atts['size'] = 5;
@@ -210,19 +210,19 @@  discard block
 block discarded – undo
210 210
 		
211 211
 		
212 212
 		// special atts
213
-		foreach( array( 'readonly', 'disabled' ) as $k ) {
213
+		foreach (array('readonly', 'disabled') as $k) {
214 214
 		
215
-			if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
215
+			if ( ! empty($field[$k])) $atts[$k] = $k;
216 216
 			
217 217
 		}
218 218
 		
219 219
 		
220 220
 		// hidden input
221
-		if( $field['ui'] ) {
221
+		if ($field['ui']) {
222 222
 			
223 223
 			$v = $field['value'];
224 224
 			
225
-			if( $field['multiple'] ) {
225
+			if ($field['multiple']) {
226 226
 				
227 227
 				$v = implode('||', $v);
228 228
 				
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 			}
234 234
 			
235 235
 			acf_hidden_input(array(
236
-				'id'	=> $field['id'] . '-input',
236
+				'id'	=> $field['id'].'-input',
237 237
 				'name'	=> $field['name'],
238 238
 				'value'	=> $v
239 239
 			));
240 240
 			
241
-		} elseif( $field['multiple'] ) {
241
+		} elseif ($field['multiple']) {
242 242
 			
243 243
 			acf_hidden_input(array(
244
-				'id'	=> $field['id'] . '-input',
244
+				'id'	=> $field['id'].'-input',
245 245
 				'name'	=> $field['name']
246 246
 			));
247 247
 			
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 		
251 251
 		
252 252
 		// open
253
-		echo '<select ' . acf_esc_attr($atts) . '>';	
253
+		echo '<select '.acf_esc_attr($atts).'>';	
254 254
 		
255 255
 		
256 256
 		// walk
257
-		$this->walk( $field['choices'], $field['value'] );
257
+		$this->walk($field['choices'], $field['value']);
258 258
 		
259 259
 		
260 260
 		// close
@@ -276,24 +276,24 @@  discard block
 block discarded – undo
276 276
 	*  @return	$post_id (int)
277 277
 	*/
278 278
 	
279
-	function walk( $choices, $values ) {
279
+	function walk($choices, $values) {
280 280
 		
281 281
 		// bail ealry if no choices
282
-		if( empty($choices) ) return;
282
+		if (empty($choices)) return;
283 283
 		
284 284
 		
285 285
 		// loop
286
-		foreach( $choices as $k => $v ) {
286
+		foreach ($choices as $k => $v) {
287 287
 			
288 288
 			// optgroup
289
-			if( is_array($v) ){
289
+			if (is_array($v)) {
290 290
 				
291 291
 				// optgroup
292
-				echo '<optgroup label="' . esc_attr($k) . '">';
292
+				echo '<optgroup label="'.esc_attr($k).'">';
293 293
 				
294 294
 				
295 295
 				// walk
296
-				$this->walk( $v, $values );
296
+				$this->walk($v, $values);
297 297
 				
298 298
 				
299 299
 				// close optgroup
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 			// vars
310 310
 			$search = html_entity_decode($k);
311 311
 			$pos = array_search($search, $values);
312
-			$atts = array( 'value' => $k );
312
+			$atts = array('value' => $k);
313 313
 			
314 314
 			
315 315
 			// validate selected
316
-			if( $pos !== false ) {
316
+			if ($pos !== false) {
317 317
 				
318 318
 				$atts['selected'] = 'selected';
319 319
 				$atts['data-i'] = $pos;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 			
323 323
 			
324 324
 			// option
325
-			echo '<option ' . acf_esc_attr($atts) . '>' . $v . '</option>';
325
+			echo '<option '.acf_esc_attr($atts).'>'.$v.'</option>';
326 326
 			
327 327
 		}
328 328
 		
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	*  @param	$field	- an array holding all the field's data
343 343
 	*/
344 344
 	
345
-	function render_field_settings( $field ) {
345
+	function render_field_settings($field) {
346 346
 		
347 347
 		// encode choices (convert from array)
348 348
 		$field['choices'] = acf_encode_choices($field['choices']);
@@ -350,74 +350,74 @@  discard block
 block discarded – undo
350 350
 		
351 351
 		
352 352
 		// choices
353
-		acf_render_field_setting( $field, array(
354
-			'label'			=> __('Choices','acf'),
355
-			'instructions'	=> __('Enter each choice on a new line.','acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:','acf'). '<br /><br />' . __('red : Red','acf'),
353
+		acf_render_field_setting($field, array(
354
+			'label'			=> __('Choices', 'acf'),
355
+			'instructions'	=> __('Enter each choice on a new line.', 'acf').'<br /><br />'.__('For more control, you may specify both a value and label like this:', 'acf').'<br /><br />'.__('red : Red', 'acf'),
356 356
 			'type'			=> 'textarea',
357 357
 			'name'			=> 'choices',
358 358
 		));	
359 359
 		
360 360
 		
361 361
 		// default_value
362
-		acf_render_field_setting( $field, array(
363
-			'label'			=> __('Default Value','acf'),
364
-			'instructions'	=> __('Enter each default value on a new line','acf'),
362
+		acf_render_field_setting($field, array(
363
+			'label'			=> __('Default Value', 'acf'),
364
+			'instructions'	=> __('Enter each default value on a new line', 'acf'),
365 365
 			'type'			=> 'textarea',
366 366
 			'name'			=> 'default_value',
367 367
 		));
368 368
 		
369 369
 		
370 370
 		// allow_null
371
-		acf_render_field_setting( $field, array(
372
-			'label'			=> __('Allow Null?','acf'),
371
+		acf_render_field_setting($field, array(
372
+			'label'			=> __('Allow Null?', 'acf'),
373 373
 			'instructions'	=> '',
374 374
 			'type'			=> 'radio',
375 375
 			'name'			=> 'allow_null',
376 376
 			'choices'		=> array(
377
-				1				=> __("Yes",'acf'),
378
-				0				=> __("No",'acf'),
377
+				1				=> __("Yes", 'acf'),
378
+				0				=> __("No", 'acf'),
379 379
 			),
380 380
 			'layout'	=>	'horizontal',
381 381
 		));
382 382
 		
383 383
 		
384 384
 		// multiple
385
-		acf_render_field_setting( $field, array(
386
-			'label'			=> __('Select multiple values?','acf'),
385
+		acf_render_field_setting($field, array(
386
+			'label'			=> __('Select multiple values?', 'acf'),
387 387
 			'instructions'	=> '',
388 388
 			'type'			=> 'radio',
389 389
 			'name'			=> 'multiple',
390 390
 			'choices'		=> array(
391
-				1				=> __("Yes",'acf'),
392
-				0				=> __("No",'acf'),
391
+				1				=> __("Yes", 'acf'),
392
+				0				=> __("No", 'acf'),
393 393
 			),
394 394
 			'layout'	=>	'horizontal',
395 395
 		));
396 396
 		
397 397
 		
398 398
 		// ui
399
-		acf_render_field_setting( $field, array(
400
-			'label'			=> __('Stylised UI','acf'),
399
+		acf_render_field_setting($field, array(
400
+			'label'			=> __('Stylised UI', 'acf'),
401 401
 			'instructions'	=> '',
402 402
 			'type'			=> 'radio',
403 403
 			'name'			=> 'ui',
404 404
 			'choices'		=> array(
405
-				1				=> __("Yes",'acf'),
406
-				0				=> __("No",'acf'),
405
+				1				=> __("Yes", 'acf'),
406
+				0				=> __("No", 'acf'),
407 407
 			),
408 408
 			'layout'	=>	'horizontal',
409 409
 		));
410 410
 				
411 411
 		
412 412
 		// ajax
413
-		acf_render_field_setting( $field, array(
414
-			'label'			=> __('Use AJAX to lazy load choices?','acf'),
413
+		acf_render_field_setting($field, array(
414
+			'label'			=> __('Use AJAX to lazy load choices?', 'acf'),
415 415
 			'instructions'	=> '',
416 416
 			'type'			=> 'radio',
417 417
 			'name'			=> 'ajax',
418 418
 			'choices'		=> array(
419
-				1				=> __("Yes",'acf'),
420
-				0				=> __("No",'acf'),
419
+				1				=> __("Yes", 'acf'),
420
+				0				=> __("No", 'acf'),
421 421
 			),
422 422
 			'layout'	=>	'horizontal',
423 423
 		));
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	*  @return	$value
441 441
 	*/
442 442
 	
443
-	function load_value( $value, $post_id, $field ) {
443
+	function load_value($value, $post_id, $field) {
444 444
 		
445 445
 		// ACF4 null
446
-		if( $value === 'null' ) return false;
446
+		if ($value === 'null') return false;
447 447
 		
448 448
 		
449 449
 		// return
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	*  @return	$field - the modified field
467 467
 	*/
468 468
 
469
-	function update_field( $field ) {
469
+	function update_field($field) {
470 470
 		
471 471
 		// decode choices (convert to array)
472 472
 		$field['choices'] = acf_decode_choices($field['choices']);
@@ -494,10 +494,10 @@  discard block
 block discarded – undo
494 494
 	*  @return	$value - the modified value
495 495
 	*/
496 496
 	
497
-	function update_value( $value, $post_id, $field ) {
497
+	function update_value($value, $post_id, $field) {
498 498
 		
499 499
 		// validate
500
-		if( empty($value) ) {
500
+		if (empty($value)) {
501 501
 		
502 502
 			return $value;
503 503
 			
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		
506 506
 		
507 507
 		// array
508
-		if( is_array($value) ) {
508
+		if (is_array($value)) {
509 509
 			
510 510
 			// save value as strings, so we can clearly search for them in SQL LIKE statements
511 511
 			$value = array_map('strval', $value);
@@ -561,15 +561,15 @@  discard block
 block discarded – undo
561 561
 */
562 562
 		
563 563
 		// scripts
564
-		wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version, true );
564
+		wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version, true);
565 565
 		
566 566
 		
567 567
 		// styles
568
-		wp_enqueue_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version );
568
+		wp_enqueue_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version);
569 569
 		
570 570
 		
571 571
 		// bail early if no language
572
-		if( !$lang ) return;
572
+		if ( ! $lang) return;
573 573
 		
574 574
 		
575 575
 		// vars
@@ -579,11 +579,11 @@  discard block
 block discarded – undo
579 579
 		
580 580
 		
581 581
 		// attempt 1
582
-		if( file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js")) ) {
582
+		if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
583 583
 			
584 584
 			$src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
585 585
 			
586
-		} elseif( file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js")) ) {
586
+		} elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
587 587
 			
588 588
 			$src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
589 589
 			
@@ -591,11 +591,11 @@  discard block
 block discarded – undo
591 591
 		
592 592
 		
593 593
 		// bail early if no language
594
-		if( !$src ) return;
594
+		if ( ! $src) return;
595 595
 		
596 596
 		
597 597
 		// scripts
598
-		wp_enqueue_script('select2-l10n', $src, '', $version, true );
598
+		wp_enqueue_script('select2-l10n', $src, '', $version, true);
599 599
 		
600 600
 	}
601 601
 	
Please login to merge, or discard this patch.