@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_taxonomy') ) : |
|
14 | +if ( ! class_exists('acf_field_taxonomy')) : |
|
15 | 15 | |
16 | 16 | class acf_field_taxonomy extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'taxonomy'; |
36 | - $this->label = __("Taxonomy",'acf'); |
|
36 | + $this->label = __("Taxonomy", 'acf'); |
|
37 | 37 | $this->category = 'relational'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'taxonomy' => 'category', |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | // extra |
52 | - add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query')); |
|
53 | - add_action('wp_ajax_nopriv_acf/fields/taxonomy/query', array($this, 'ajax_query')); |
|
54 | - add_action('wp_ajax_acf/fields/taxonomy/add_term', array($this, 'ajax_add_term')); |
|
52 | + add_action('wp_ajax_acf/fields/taxonomy/query', array($this, 'ajax_query')); |
|
53 | + add_action('wp_ajax_nopriv_acf/fields/taxonomy/query', array($this, 'ajax_query')); |
|
54 | + add_action('wp_ajax_acf/fields/taxonomy/add_term', array($this, 'ajax_add_term')); |
|
55 | 55 | |
56 | 56 | |
57 | 57 | // do not delete! |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return (array) |
74 | 74 | */ |
75 | 75 | |
76 | - function get_choices( $options = array() ) { |
|
76 | + function get_choices($options = array()) { |
|
77 | 77 | |
78 | 78 | // defaults |
79 | 79 | $options = acf_parse_args($options, array( |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | // load field |
88 | - $field = acf_get_field( $options['field_key'] ); |
|
88 | + $field = acf_get_field($options['field_key']); |
|
89 | 89 | |
90 | - if( !$field ) { |
|
90 | + if ( ! $field) { |
|
91 | 91 | |
92 | 92 | return false; |
93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // vars |
98 | 98 | $r = array(); |
99 | 99 | $args = array(); |
100 | - $is_hierarchical = is_taxonomy_hierarchical( $field['taxonomy'] ); |
|
100 | + $is_hierarchical = is_taxonomy_hierarchical($field['taxonomy']); |
|
101 | 101 | $is_pagination = ($options['paged'] > 0); |
102 | 102 | $limit = 20; |
103 | 103 | $offset = 20 * ($options['paged'] - 1); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // pagination |
111 | 111 | // - don't bother for hierarchial terms, we will need to load all terms anyway |
112 | - if( !$is_hierarchical && $is_pagination ) { |
|
112 | + if ( ! $is_hierarchical && $is_pagination) { |
|
113 | 113 | |
114 | 114 | $args['offset'] = $offset; |
115 | 115 | $args['number'] = $limit; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | |
120 | 120 | // search |
121 | - if( $options['s'] ) { |
|
121 | + if ($options['s']) { |
|
122 | 122 | |
123 | 123 | $args['search'] = $options['s']; |
124 | 124 | |
@@ -127,32 +127,32 @@ discard block |
||
127 | 127 | |
128 | 128 | // filters |
129 | 129 | $args = apply_filters('acf/fields/taxonomy/query', $args, $field, $options['post_id']); |
130 | - $args = apply_filters('acf/fields/taxonomy/query/name=' . $field['name'], $args, $field, $options['post_id'] ); |
|
131 | - $args = apply_filters('acf/fields/taxonomy/query/key=' . $field['key'], $args, $field, $options['post_id'] ); |
|
130 | + $args = apply_filters('acf/fields/taxonomy/query/name='.$field['name'], $args, $field, $options['post_id']); |
|
131 | + $args = apply_filters('acf/fields/taxonomy/query/key='.$field['key'], $args, $field, $options['post_id']); |
|
132 | 132 | |
133 | 133 | |
134 | 134 | // get terms |
135 | - $terms = get_terms( $field['taxonomy'], $args ); |
|
135 | + $terms = get_terms($field['taxonomy'], $args); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // sort into hierachial order! |
139 | - if( $is_hierarchical ) { |
|
139 | + if ($is_hierarchical) { |
|
140 | 140 | |
141 | 141 | // get parent |
142 | - $parent = acf_maybe_get( $args, 'parent', 0 ); |
|
143 | - $parent = acf_maybe_get( $args, 'child_of', $parent ); |
|
142 | + $parent = acf_maybe_get($args, 'parent', 0); |
|
143 | + $parent = acf_maybe_get($args, 'child_of', $parent); |
|
144 | 144 | |
145 | 145 | |
146 | 146 | // this will fail if a search has taken place because parents wont exist |
147 | - if( empty($args['search']) ) { |
|
147 | + if (empty($args['search'])) { |
|
148 | 148 | |
149 | - $terms = _get_term_children( $parent, $terms, $field['taxonomy'] ); |
|
149 | + $terms = _get_term_children($parent, $terms, $field['taxonomy']); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | // fake pagination |
155 | - if( $is_pagination ) { |
|
155 | + if ($is_pagination) { |
|
156 | 156 | |
157 | 157 | $terms = array_slice($terms, $offset, $limit); |
158 | 158 | |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | /// append to r |
165 | - foreach( $terms as $term ) { |
|
165 | + foreach ($terms as $term) { |
|
166 | 166 | |
167 | 167 | // add to json |
168 | 168 | $r[] = array( |
169 | 169 | 'id' => $term->term_id, |
170 | - 'text' => $this->get_term_title( $term, $field, $options['post_id'] ) |
|
170 | + 'text' => $this->get_term_title($term, $field, $options['post_id']) |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | function ajax_query() { |
196 | 196 | |
197 | 197 | // validate |
198 | - if( !acf_verify_ajax() ) { |
|
198 | + if ( ! acf_verify_ajax()) { |
|
199 | 199 | |
200 | 200 | die(); |
201 | 201 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | |
204 | 204 | |
205 | 205 | // get choices |
206 | - $choices = $this->get_choices( $_POST ); |
|
206 | + $choices = $this->get_choices($_POST); |
|
207 | 207 | |
208 | 208 | |
209 | 209 | // validate |
210 | - if( !$choices ) { |
|
210 | + if ( ! $choices) { |
|
211 | 211 | |
212 | 212 | die(); |
213 | 213 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | |
217 | 217 | // return JSON |
218 | - echo json_encode( $choices ); |
|
218 | + echo json_encode($choices); |
|
219 | 219 | die(); |
220 | 220 | |
221 | 221 | } |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | * @return (string) |
237 | 237 | */ |
238 | 238 | |
239 | - function get_term_title( $term, $field, $post_id = 0 ) { |
|
239 | + function get_term_title($term, $field, $post_id = 0) { |
|
240 | 240 | |
241 | 241 | // get post_id |
242 | - if( !$post_id ) { |
|
242 | + if ( ! $post_id) { |
|
243 | 243 | |
244 | 244 | $form_data = acf_get_setting('form_data'); |
245 | 245 | |
246 | - if( !empty($form_data['post_id']) ) { |
|
246 | + if ( ! empty($form_data['post_id'])) { |
|
247 | 247 | |
248 | 248 | $post_id = $form_data['post_id']; |
249 | 249 | |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | |
261 | 261 | |
262 | 262 | // ancestors |
263 | - $ancestors = get_ancestors( $term->term_id, $field['taxonomy'] ); |
|
263 | + $ancestors = get_ancestors($term->term_id, $field['taxonomy']); |
|
264 | 264 | |
265 | - if( !empty($ancestors) ) { |
|
265 | + if ( ! empty($ancestors)) { |
|
266 | 266 | |
267 | 267 | $title .= str_repeat('- ', count($ancestors)); |
268 | 268 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | // filters |
277 | 277 | $title = apply_filters('acf/fields/taxonomy/result', $title, $term, $field, $post_id); |
278 | - $title = apply_filters('acf/fields/taxonomy/result/name=' . $field['_name'] , $title, $term, $field, $post_id); |
|
279 | - $title = apply_filters('acf/fields/taxonomy/result/key=' . $field['key'], $title, $term, $field, $post_id); |
|
278 | + $title = apply_filters('acf/fields/taxonomy/result/name='.$field['_name'], $title, $term, $field, $post_id); |
|
279 | + $title = apply_filters('acf/fields/taxonomy/result/key='.$field['key'], $title, $term, $field, $post_id); |
|
280 | 280 | |
281 | 281 | |
282 | 282 | // return |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | * @return $value |
298 | 298 | */ |
299 | 299 | |
300 | - function get_terms( $value, $taxonomy = 'category' ) { |
|
300 | + function get_terms($value, $taxonomy = 'category') { |
|
301 | 301 | |
302 | 302 | // load terms in 1 query to save multiple DB calls from following code |
303 | - if( count($value) > 1 ) { |
|
303 | + if (count($value) > 1) { |
|
304 | 304 | |
305 | 305 | $terms = get_terms($taxonomy, array( |
306 | 306 | 'hide_empty' => false, |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | |
312 | 312 | |
313 | 313 | // update value to include $post |
314 | - foreach( array_keys($value) as $i ) { |
|
314 | + foreach (array_keys($value) as $i) { |
|
315 | 315 | |
316 | - $value[ $i ] = get_term( $value[ $i ], $taxonomy ); |
|
316 | + $value[$i] = get_term($value[$i], $taxonomy); |
|
317 | 317 | |
318 | 318 | } |
319 | 319 | |
@@ -343,21 +343,21 @@ discard block |
||
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 | // get valid terms |
349 | 349 | $value = acf_get_valid_terms($value, $field['taxonomy']); |
350 | 350 | |
351 | 351 | |
352 | 352 | // load/save |
353 | - if( $field['load_terms'] ) { |
|
353 | + if ($field['load_terms']) { |
|
354 | 354 | |
355 | 355 | // get terms |
356 | 356 | $term_ids = wp_get_object_terms($post_id, $field['taxonomy'], array('fields' => 'ids', 'orderby' => 'none')); |
357 | 357 | |
358 | 358 | |
359 | 359 | // error |
360 | - if( is_wp_error($term_ids) ) { |
|
360 | + if (is_wp_error($term_ids)) { |
|
361 | 361 | |
362 | 362 | return false; |
363 | 363 | |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @return $value - the modified value |
393 | 393 | */ |
394 | 394 | |
395 | - function update_value( $value, $post_id, $field ) { |
|
395 | + function update_value($value, $post_id, $field) { |
|
396 | 396 | |
397 | 397 | // vars |
398 | - if( is_array($value) ) { |
|
398 | + if (is_array($value)) { |
|
399 | 399 | |
400 | 400 | $value = array_filter($value); |
401 | 401 | |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | |
404 | 404 | |
405 | 405 | // save_terms |
406 | - if( $field['save_terms'] ) { |
|
406 | + if ($field['save_terms']) { |
|
407 | 407 | |
408 | 408 | // vars |
409 | 409 | $taxonomy = $field['taxonomy']; |
410 | 410 | |
411 | 411 | |
412 | 412 | // force value to array |
413 | - $term_ids = acf_get_array( $value ); |
|
413 | + $term_ids = acf_get_array($value); |
|
414 | 414 | |
415 | 415 | |
416 | 416 | // convert to int |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | |
419 | 419 | |
420 | 420 | // bypass $this->set_terms if called directly from update_field |
421 | - if( !did_action('acf/save_post') ) { |
|
421 | + if ( ! did_action('acf/save_post')) { |
|
422 | 422 | |
423 | - wp_set_object_terms( $post_id, $term_ids, $taxonomy, false ); |
|
423 | + wp_set_object_terms($post_id, $term_ids, $taxonomy, false); |
|
424 | 424 | |
425 | 425 | return $value; |
426 | 426 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | |
430 | 430 | // initialize |
431 | - if( empty($this->set_terms) ) { |
|
431 | + if (empty($this->set_terms)) { |
|
432 | 432 | |
433 | 433 | // create holder |
434 | 434 | $this->set_terms = array(); |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | |
442 | 442 | |
443 | 443 | // append |
444 | - if( empty($this->set_terms[ $taxonomy ]) ) { |
|
444 | + if (empty($this->set_terms[$taxonomy])) { |
|
445 | 445 | |
446 | - $this->set_terms[ $taxonomy ] = array(); |
|
446 | + $this->set_terms[$taxonomy] = array(); |
|
447 | 447 | |
448 | 448 | } |
449 | 449 | |
450 | - $this->set_terms[ $taxonomy ] = array_merge($this->set_terms[ $taxonomy ], $term_ids); |
|
450 | + $this->set_terms[$taxonomy] = array_merge($this->set_terms[$taxonomy], $term_ids); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | * @return $post_id (int) |
472 | 472 | */ |
473 | 473 | |
474 | - function set_terms( $post_id ) { |
|
474 | + function set_terms($post_id) { |
|
475 | 475 | |
476 | 476 | // bail ealry if no terms |
477 | - if( empty($this->set_terms) ) { |
|
477 | + if (empty($this->set_terms)) { |
|
478 | 478 | |
479 | 479 | return; |
480 | 480 | |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | |
483 | 483 | |
484 | 484 | // loop over terms |
485 | - foreach( $this->set_terms as $taxonomy => $term_ids ){ |
|
485 | + foreach ($this->set_terms as $taxonomy => $term_ids) { |
|
486 | 486 | |
487 | - wp_set_object_terms( $post_id, $term_ids, $taxonomy, false ); |
|
487 | + wp_set_object_terms($post_id, $term_ids, $taxonomy, false); |
|
488 | 488 | |
489 | 489 | } |
490 | 490 | |
@@ -511,10 +511,10 @@ discard block |
||
511 | 511 | * @return $value (mixed) the modified value |
512 | 512 | */ |
513 | 513 | |
514 | - function format_value( $value, $post_id, $field ) { |
|
514 | + function format_value($value, $post_id, $field) { |
|
515 | 515 | |
516 | 516 | // bail early if no value |
517 | - if( empty($value) ) { |
|
517 | + if (empty($value)) { |
|
518 | 518 | |
519 | 519 | return $value; |
520 | 520 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | |
524 | 524 | // force value to array |
525 | - $value = acf_get_array( $value ); |
|
525 | + $value = acf_get_array($value); |
|
526 | 526 | |
527 | 527 | |
528 | 528 | // convert values to int |
@@ -530,16 +530,16 @@ discard block |
||
530 | 530 | |
531 | 531 | |
532 | 532 | // load posts if needed |
533 | - if( $field['return_format'] == 'object' ) { |
|
533 | + if ($field['return_format'] == 'object') { |
|
534 | 534 | |
535 | 535 | // get posts |
536 | - $value = $this->get_terms( $value, $field["taxonomy"] ); |
|
536 | + $value = $this->get_terms($value, $field["taxonomy"]); |
|
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | 540 | |
541 | 541 | // convert back from array if neccessary |
542 | - if( $field['field_type'] == 'select' || $field['field_type'] == 'radio' ) { |
|
542 | + if ($field['field_type'] == 'select' || $field['field_type'] == 'radio') { |
|
543 | 543 | |
544 | 544 | $value = array_shift($value); |
545 | 545 | |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | * @param $field - an array holding all the field's data |
564 | 564 | */ |
565 | 565 | |
566 | - function render_field( $field ) { |
|
566 | + function render_field($field) { |
|
567 | 567 | |
568 | 568 | // force value to array |
569 | - $field['value'] = acf_get_array( $field['value'] ); |
|
569 | + $field['value'] = acf_get_array($field['value']); |
|
570 | 570 | |
571 | 571 | |
572 | 572 | // convert values to int |
@@ -583,33 +583,33 @@ discard block |
||
583 | 583 | |
584 | 584 | |
585 | 585 | // get taxonomy |
586 | - $taxonomy = get_taxonomy( $field['taxonomy'] ); |
|
586 | + $taxonomy = get_taxonomy($field['taxonomy']); |
|
587 | 587 | |
588 | 588 | ?> |
589 | 589 | <div <?php acf_esc_attr_e($div); ?>> |
590 | - <?php if( $field['add_term'] && current_user_can( $taxonomy->cap->manage_terms) ): ?> |
|
590 | + <?php if ($field['add_term'] && current_user_can($taxonomy->cap->manage_terms)): ?> |
|
591 | 591 | <a href="#" class="acf-icon -plus acf-js-tooltip small acf-soh-target" data-name="add" title="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>"></a> |
592 | 592 | <?php endif; |
593 | 593 | |
594 | - if( $field['field_type'] == 'select' ) { |
|
594 | + if ($field['field_type'] == 'select') { |
|
595 | 595 | |
596 | 596 | $field['multiple'] = 0; |
597 | 597 | |
598 | - $this->render_field_select( $field ); |
|
598 | + $this->render_field_select($field); |
|
599 | 599 | |
600 | - } elseif( $field['field_type'] == 'multi_select' ) { |
|
600 | + } elseif ($field['field_type'] == 'multi_select') { |
|
601 | 601 | |
602 | 602 | $field['multiple'] = 1; |
603 | 603 | |
604 | - $this->render_field_select( $field ); |
|
604 | + $this->render_field_select($field); |
|
605 | 605 | |
606 | - } elseif( $field['field_type'] == 'radio' ) { |
|
606 | + } elseif ($field['field_type'] == 'radio') { |
|
607 | 607 | |
608 | - $this->render_field_checkbox( $field ); |
|
608 | + $this->render_field_checkbox($field); |
|
609 | 609 | |
610 | - } elseif( $field['field_type'] == 'checkbox' ) { |
|
610 | + } elseif ($field['field_type'] == 'checkbox') { |
|
611 | 611 | |
612 | - $this->render_field_checkbox( $field ); |
|
612 | + $this->render_field_checkbox($field); |
|
613 | 613 | |
614 | 614 | } |
615 | 615 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @param $field - an array holding all the field's data |
632 | 632 | */ |
633 | 633 | |
634 | - function render_field_select( $field ) { |
|
634 | + function render_field_select($field) { |
|
635 | 635 | |
636 | 636 | // Change Field into a select |
637 | 637 | $field['type'] = 'select'; |
@@ -641,23 +641,23 @@ discard block |
||
641 | 641 | |
642 | 642 | |
643 | 643 | // value |
644 | - if( !empty($field['value']) ) { |
|
644 | + if ( ! empty($field['value'])) { |
|
645 | 645 | |
646 | 646 | // get terms |
647 | - $terms = $this->get_terms( $field['value'], $field['taxonomy'] ); |
|
647 | + $terms = $this->get_terms($field['value'], $field['taxonomy']); |
|
648 | 648 | |
649 | 649 | |
650 | 650 | // set choices |
651 | - if( !empty($terms) ) { |
|
651 | + if ( ! empty($terms)) { |
|
652 | 652 | |
653 | - foreach( array_keys($terms) as $i ) { |
|
653 | + foreach (array_keys($terms) as $i) { |
|
654 | 654 | |
655 | 655 | // vars |
656 | - $term = acf_extract_var( $terms, $i ); |
|
656 | + $term = acf_extract_var($terms, $i); |
|
657 | 657 | |
658 | 658 | |
659 | 659 | // append to choices |
660 | - $field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field ); |
|
660 | + $field['choices'][$term->term_id] = $this->get_term_title($term, $field); |
|
661 | 661 | |
662 | 662 | } |
663 | 663 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | |
668 | 668 | |
669 | 669 | // render select |
670 | - acf_render_field( $field ); |
|
670 | + acf_render_field($field); |
|
671 | 671 | |
672 | 672 | } |
673 | 673 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @param $field - an array holding all the field's data |
685 | 685 | */ |
686 | 686 | |
687 | - function render_field_checkbox( $field ) { |
|
687 | + function render_field_checkbox($field) { |
|
688 | 688 | |
689 | 689 | // hidden input |
690 | 690 | acf_hidden_input(array( |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | |
695 | 695 | |
696 | 696 | // checkbox saves an array |
697 | - if( $field['field_type'] == 'checkbox' ) { |
|
697 | + if ($field['field_type'] == 'checkbox') { |
|
698 | 698 | |
699 | 699 | $field['name'] .= '[]'; |
700 | 700 | |
@@ -708,23 +708,23 @@ discard block |
||
708 | 708 | // vars |
709 | 709 | $args = array( |
710 | 710 | 'taxonomy' => $field['taxonomy'], |
711 | - 'show_option_none' => __('No', 'acf') . ' ' . $taxonomy_obj->labels->name, |
|
711 | + 'show_option_none' => __('No', 'acf').' '.$taxonomy_obj->labels->name, |
|
712 | 712 | 'hide_empty' => false, |
713 | 713 | 'style' => 'none', |
714 | - 'walker' => new acf_taxonomy_field_walker( $field ), |
|
714 | + 'walker' => new acf_taxonomy_field_walker($field), |
|
715 | 715 | ); |
716 | 716 | |
717 | 717 | |
718 | 718 | // filter for 3rd party customization |
719 | 719 | $args = apply_filters('acf/fields/taxonomy/wp_list_categories', $args, $field); |
720 | - $args = apply_filters('acf/fields/taxonomy/wp_list_categories/name=' . $field['_name'], $args, $field); |
|
721 | - $args = apply_filters('acf/fields/taxonomy/wp_list_categories/key=' . $field['key'], $args, $field); |
|
720 | + $args = apply_filters('acf/fields/taxonomy/wp_list_categories/name='.$field['_name'], $args, $field); |
|
721 | + $args = apply_filters('acf/fields/taxonomy/wp_list_categories/key='.$field['key'], $args, $field); |
|
722 | 722 | |
723 | 723 | ?><div class="categorychecklist-holder"> |
724 | 724 | |
725 | 725 | <ul class="acf-checkbox-list acf-bl"> |
726 | 726 | |
727 | - <?php if( $field['field_type'] == 'radio' && $field['allow_null'] ): ?> |
|
727 | + <?php if ($field['field_type'] == 'radio' && $field['allow_null']): ?> |
|
728 | 728 | <li> |
729 | 729 | <label class="selectit"> |
730 | 730 | <input type="radio" name="<?php echo $field['name']; ?>" value="" /> <?php _e("None", 'acf'); ?> |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | </li> |
733 | 733 | <?php endif; ?> |
734 | 734 | |
735 | - <?php wp_list_categories( $args ); ?> |
|
735 | + <?php wp_list_categories($args); ?> |
|
736 | 736 | |
737 | 737 | </ul> |
738 | 738 | |
@@ -754,12 +754,12 @@ discard block |
||
754 | 754 | * @param $field - an array holding all the field's data |
755 | 755 | */ |
756 | 756 | |
757 | - function render_field_settings( $field ) { |
|
757 | + function render_field_settings($field) { |
|
758 | 758 | |
759 | 759 | // default_value |
760 | - acf_render_field_setting( $field, array( |
|
761 | - 'label' => __('Taxonomy','acf'), |
|
762 | - 'instructions' => __('Select the taxonomy to be displayed','acf'), |
|
760 | + acf_render_field_setting($field, array( |
|
761 | + 'label' => __('Taxonomy', 'acf'), |
|
762 | + 'instructions' => __('Select the taxonomy to be displayed', 'acf'), |
|
763 | 763 | 'type' => 'select', |
764 | 764 | 'name' => 'taxonomy', |
765 | 765 | 'choices' => acf_get_taxonomies(), |
@@ -767,18 +767,18 @@ discard block |
||
767 | 767 | |
768 | 768 | |
769 | 769 | // field_type |
770 | - acf_render_field_setting( $field, array( |
|
771 | - 'label' => __('Appearance','acf'), |
|
772 | - 'instructions' => __('Select the appearance of this field','acf'), |
|
770 | + acf_render_field_setting($field, array( |
|
771 | + 'label' => __('Appearance', 'acf'), |
|
772 | + 'instructions' => __('Select the appearance of this field', 'acf'), |
|
773 | 773 | 'type' => 'select', |
774 | 774 | 'name' => 'field_type', |
775 | 775 | 'optgroup' => true, |
776 | 776 | 'choices' => array( |
777 | - __("Multiple Values",'acf') => array( |
|
777 | + __("Multiple Values", 'acf') => array( |
|
778 | 778 | 'checkbox' => __('Checkbox', 'acf'), |
779 | 779 | 'multi_select' => __('Multi Select', 'acf') |
780 | 780 | ), |
781 | - __("Single Value",'acf') => array( |
|
781 | + __("Single Value", 'acf') => array( |
|
782 | 782 | 'radio' => __('Radio Buttons', 'acf'), |
783 | 783 | 'select' => __('Select', 'acf') |
784 | 784 | ) |
@@ -787,70 +787,70 @@ discard block |
||
787 | 787 | |
788 | 788 | |
789 | 789 | // allow_null |
790 | - acf_render_field_setting( $field, array( |
|
791 | - 'label' => __('Allow Null?','acf'), |
|
790 | + acf_render_field_setting($field, array( |
|
791 | + 'label' => __('Allow Null?', 'acf'), |
|
792 | 792 | 'instructions' => '', |
793 | 793 | 'type' => 'radio', |
794 | 794 | 'name' => 'allow_null', |
795 | 795 | 'choices' => array( |
796 | - 1 => __("Yes",'acf'), |
|
797 | - 0 => __("No",'acf'), |
|
796 | + 1 => __("Yes", 'acf'), |
|
797 | + 0 => __("No", 'acf'), |
|
798 | 798 | ), |
799 | 799 | 'layout' => 'horizontal', |
800 | 800 | )); |
801 | 801 | |
802 | 802 | |
803 | 803 | // add_term |
804 | - acf_render_field_setting( $field, array( |
|
805 | - 'label' => __('Create Terms','acf'), |
|
806 | - 'instructions' => __('Allow new terms to be created whilst editing','acf'), |
|
804 | + acf_render_field_setting($field, array( |
|
805 | + 'label' => __('Create Terms', 'acf'), |
|
806 | + 'instructions' => __('Allow new terms to be created whilst editing', 'acf'), |
|
807 | 807 | 'type' => 'radio', |
808 | 808 | 'name' => 'add_term', |
809 | 809 | 'choices' => array( |
810 | - 1 => __("Yes",'acf'), |
|
811 | - 0 => __("No",'acf'), |
|
810 | + 1 => __("Yes", 'acf'), |
|
811 | + 0 => __("No", 'acf'), |
|
812 | 812 | ), |
813 | 813 | 'layout' => 'horizontal', |
814 | 814 | )); |
815 | 815 | |
816 | 816 | |
817 | 817 | // save_terms |
818 | - acf_render_field_setting( $field, array( |
|
819 | - 'label' => __('Save Terms','acf'), |
|
820 | - 'instructions' => __('Connect selected terms to the post','acf'), |
|
818 | + acf_render_field_setting($field, array( |
|
819 | + 'label' => __('Save Terms', 'acf'), |
|
820 | + 'instructions' => __('Connect selected terms to the post', 'acf'), |
|
821 | 821 | 'type' => 'radio', |
822 | 822 | 'name' => 'save_terms', |
823 | 823 | 'choices' => array( |
824 | - 1 => __("Yes",'acf'), |
|
825 | - 0 => __("No",'acf'), |
|
824 | + 1 => __("Yes", 'acf'), |
|
825 | + 0 => __("No", 'acf'), |
|
826 | 826 | ), |
827 | 827 | 'layout' => 'horizontal', |
828 | 828 | )); |
829 | 829 | |
830 | 830 | |
831 | 831 | // load_terms |
832 | - acf_render_field_setting( $field, array( |
|
833 | - 'label' => __('Load Terms','acf'), |
|
834 | - 'instructions' => __('Load value from posts terms','acf'), |
|
832 | + acf_render_field_setting($field, array( |
|
833 | + 'label' => __('Load Terms', 'acf'), |
|
834 | + 'instructions' => __('Load value from posts terms', 'acf'), |
|
835 | 835 | 'type' => 'radio', |
836 | 836 | 'name' => 'load_terms', |
837 | 837 | 'choices' => array( |
838 | - 1 => __("Yes",'acf'), |
|
839 | - 0 => __("No",'acf'), |
|
838 | + 1 => __("Yes", 'acf'), |
|
839 | + 0 => __("No", 'acf'), |
|
840 | 840 | ), |
841 | 841 | 'layout' => 'horizontal', |
842 | 842 | )); |
843 | 843 | |
844 | 844 | |
845 | 845 | // return_format |
846 | - acf_render_field_setting( $field, array( |
|
847 | - 'label' => __('Return Value','acf'), |
|
846 | + acf_render_field_setting($field, array( |
|
847 | + 'label' => __('Return Value', 'acf'), |
|
848 | 848 | 'instructions' => '', |
849 | 849 | 'type' => 'radio', |
850 | 850 | 'name' => 'return_format', |
851 | 851 | 'choices' => array( |
852 | - 'object' => __("Term Object",'acf'), |
|
853 | - 'id' => __("Term ID",'acf') |
|
852 | + 'object' => __("Term Object", 'acf'), |
|
853 | + 'id' => __("Term ID", 'acf') |
|
854 | 854 | ), |
855 | 855 | 'layout' => 'horizontal', |
856 | 856 | )); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | // verify nonce |
886 | - if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) { |
|
886 | + if ( ! wp_verify_nonce($args['nonce'], 'acf_nonce')) { |
|
887 | 887 | |
888 | 888 | die(); |
889 | 889 | |
@@ -891,9 +891,9 @@ discard block |
||
891 | 891 | |
892 | 892 | |
893 | 893 | // load field |
894 | - $field = acf_get_field( $args['field_key'] ); |
|
894 | + $field = acf_get_field($args['field_key']); |
|
895 | 895 | |
896 | - if( !$field ) { |
|
896 | + if ( ! $field) { |
|
897 | 897 | |
898 | 898 | die(); |
899 | 899 | |
@@ -907,22 +907,22 @@ discard block |
||
907 | 907 | |
908 | 908 | // validate cap |
909 | 909 | // note: this situation should never occur due to condition of the add new button |
910 | - if( !current_user_can( $taxonomy_obj->cap->manage_terms) ) { |
|
910 | + if ( ! current_user_can($taxonomy_obj->cap->manage_terms)) { |
|
911 | 911 | |
912 | - echo '<p><strong>' . __("Error", 'acf') . '.</strong> ' . sprintf( __('User unable to add new %s', 'acf'), $taxonomy_label ) . '</p>'; |
|
912 | + echo '<p><strong>'.__("Error", 'acf').'.</strong> '.sprintf(__('User unable to add new %s', 'acf'), $taxonomy_label).'</p>'; |
|
913 | 913 | die; |
914 | 914 | |
915 | 915 | } |
916 | 916 | |
917 | 917 | |
918 | 918 | // save? |
919 | - if( $args['term_name'] ) { |
|
919 | + if ($args['term_name']) { |
|
920 | 920 | |
921 | 921 | // exists |
922 | - if( term_exists($args['term_name'], $field['taxonomy']) ) { |
|
922 | + if (term_exists($args['term_name'], $field['taxonomy'])) { |
|
923 | 923 | |
924 | 924 | wp_send_json_error(array( |
925 | - 'error' => sprintf( __('%s already exists', 'acf'), $taxonomy_label ) |
|
925 | + 'error' => sprintf(__('%s already exists', 'acf'), $taxonomy_label) |
|
926 | 926 | )); |
927 | 927 | |
928 | 928 | } |
@@ -931,17 +931,17 @@ discard block |
||
931 | 931 | // insert |
932 | 932 | $extra = array(); |
933 | 933 | |
934 | - if( $args['term_parent'] ) { |
|
934 | + if ($args['term_parent']) { |
|
935 | 935 | |
936 | 936 | $extra['parent'] = $args['term_parent']; |
937 | 937 | |
938 | 938 | } |
939 | 939 | |
940 | - $data = wp_insert_term( $args['term_name'], $field['taxonomy'], $extra ); |
|
940 | + $data = wp_insert_term($args['term_name'], $field['taxonomy'], $extra); |
|
941 | 941 | |
942 | 942 | |
943 | 943 | // error? |
944 | - if( is_wp_error($data) ) { |
|
944 | + if (is_wp_error($data)) { |
|
945 | 945 | |
946 | 946 | wp_send_json_error(array( |
947 | 947 | 'error' => $data->get_error_message() |
@@ -952,9 +952,9 @@ discard block |
||
952 | 952 | |
953 | 953 | // ancestors |
954 | 954 | $prefix = ''; |
955 | - $ancestors = get_ancestors( $data['term_id'], $field['taxonomy'] ); |
|
955 | + $ancestors = get_ancestors($data['term_id'], $field['taxonomy']); |
|
956 | 956 | |
957 | - if( !empty($ancestors) ) { |
|
957 | + if ( ! empty($ancestors)) { |
|
958 | 958 | |
959 | 959 | $prefix = str_repeat('- ', count($ancestors)); |
960 | 960 | |
@@ -963,10 +963,10 @@ discard block |
||
963 | 963 | |
964 | 964 | // success |
965 | 965 | wp_send_json_success(array( |
966 | - 'message' => sprintf( __('%s added', 'acf'), $taxonomy_label ), |
|
966 | + 'message' => sprintf(__('%s added', 'acf'), $taxonomy_label), |
|
967 | 967 | 'term_id' => $data['term_id'], |
968 | 968 | 'term_name' => $args['term_name'], |
969 | - 'term_label' => $prefix . $args['term_name'], |
|
969 | + 'term_label' => $prefix.$args['term_name'], |
|
970 | 970 | 'term_parent' => $args['term_parent'] |
971 | 971 | )); |
972 | 972 | |
@@ -981,16 +981,16 @@ discard block |
||
981 | 981 | )); |
982 | 982 | |
983 | 983 | |
984 | - if( is_taxonomy_hierarchical( $field['taxonomy'] ) ) { |
|
984 | + if (is_taxonomy_hierarchical($field['taxonomy'])) { |
|
985 | 985 | |
986 | 986 | $choices = array(); |
987 | - $choices2 = $this->get_choices(array( 'field_key' => $field['key'] )); |
|
987 | + $choices2 = $this->get_choices(array('field_key' => $field['key'])); |
|
988 | 988 | |
989 | - if( $choices2 ) { |
|
989 | + if ($choices2) { |
|
990 | 990 | |
991 | - foreach( $choices2 as $v) { |
|
991 | + foreach ($choices2 as $v) { |
|
992 | 992 | |
993 | - $choices[ $v['id'] ] = $v['text']; |
|
993 | + $choices[$v['id']] = $v['text']; |
|
994 | 994 | |
995 | 995 | } |
996 | 996 | |
@@ -1023,49 +1023,49 @@ discard block |
||
1023 | 1023 | |
1024 | 1024 | endif; |
1025 | 1025 | |
1026 | -if( ! class_exists('acf_taxonomy_field_walker') ) : |
|
1026 | +if ( ! class_exists('acf_taxonomy_field_walker')) : |
|
1027 | 1027 | |
1028 | 1028 | class acf_taxonomy_field_walker extends Walker { |
1029 | 1029 | |
1030 | 1030 | var $field = null, |
1031 | 1031 | $tree_type = 'category', |
1032 | - $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' ); |
|
1032 | + $db_fields = array('parent' => 'parent', 'id' => 'term_id'); |
|
1033 | 1033 | |
1034 | - function __construct( $field ) { |
|
1034 | + function __construct($field) { |
|
1035 | 1035 | |
1036 | 1036 | $this->field = $field; |
1037 | 1037 | |
1038 | 1038 | } |
1039 | 1039 | |
1040 | - function start_el( &$output, $term, $depth = 0, $args = array(), $current_object_id = 0) { |
|
1040 | + function start_el(&$output, $term, $depth = 0, $args = array(), $current_object_id = 0) { |
|
1041 | 1041 | |
1042 | 1042 | // vars |
1043 | - $selected = in_array( $term->term_id, $this->field['value'] ); |
|
1043 | + $selected = in_array($term->term_id, $this->field['value']); |
|
1044 | 1044 | |
1045 | 1045 | |
1046 | 1046 | // append |
1047 | - $output .= '<li data-id="' . $term->term_id . '"><label><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>' . $term->name . '</span></label>'; |
|
1047 | + $output .= '<li data-id="'.$term->term_id.'"><label><input type="'.$this->field['field_type'].'" name="'.$this->field['name'].'" value="'.$term->term_id.'" '.($selected ? 'checked="checked"' : '').' /> <span>'.$term->name.'</span></label>'; |
|
1048 | 1048 | |
1049 | 1049 | } |
1050 | 1050 | |
1051 | - function end_el( &$output, $term, $depth = 0, $args = array() ) { |
|
1051 | + function end_el(&$output, $term, $depth = 0, $args = array()) { |
|
1052 | 1052 | |
1053 | 1053 | // append |
1054 | - $output .= '</li>' . "\n"; |
|
1054 | + $output .= '</li>'."\n"; |
|
1055 | 1055 | |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
1058 | + function start_lvl(&$output, $depth = 0, $args = array()) { |
|
1059 | 1059 | |
1060 | 1060 | // append |
1061 | - $output .= '<ul class="children acf-bl">' . "\n"; |
|
1061 | + $output .= '<ul class="children acf-bl">'."\n"; |
|
1062 | 1062 | |
1063 | 1063 | } |
1064 | 1064 | |
1065 | - function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
1065 | + function end_lvl(&$output, $depth = 0, $args = array()) { |
|
1066 | 1066 | |
1067 | 1067 | // append |
1068 | - $output .= '</ul>' . "\n"; |
|
1068 | + $output .= '</ul>'."\n"; |
|
1069 | 1069 | |
1070 | 1070 | } |
1071 | 1071 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_text') ) : |
|
14 | +if ( ! class_exists('acf_field_text')) : |
|
15 | 15 | |
16 | 16 | class acf_field_text extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'text'; |
36 | - $this->label = __("Text",'acf'); |
|
36 | + $this->label = __("Text", 'acf'); |
|
37 | 37 | $this->defaults = array( |
38 | 38 | 'default_value' => '', |
39 | 39 | 'maxlength' => '', |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | * @date 23/01/13 |
63 | 63 | */ |
64 | 64 | |
65 | - function render_field( $field ) { |
|
65 | + function render_field($field) { |
|
66 | 66 | |
67 | 67 | // vars |
68 | - $o = array( 'type', 'id', 'class', 'name', 'value', 'placeholder' ); |
|
69 | - $s = array( 'readonly', 'disabled' ); |
|
68 | + $o = array('type', 'id', 'class', 'name', 'value', 'placeholder'); |
|
69 | + $s = array('readonly', 'disabled'); |
|
70 | 70 | $e = ''; |
71 | 71 | |
72 | 72 | |
73 | 73 | // maxlength |
74 | - if( $field['maxlength'] !== "" ) { |
|
74 | + if ($field['maxlength'] !== "") { |
|
75 | 75 | |
76 | 76 | $o[] = 'maxlength'; |
77 | 77 | |
@@ -79,38 +79,38 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | // prepend |
82 | - if( $field['prepend'] !== "" ) { |
|
82 | + if ($field['prepend'] !== "") { |
|
83 | 83 | |
84 | 84 | $field['class'] .= ' acf-is-prepended'; |
85 | - $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>'; |
|
85 | + $e .= '<div class="acf-input-prepend">'.$field['prepend'].'</div>'; |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | // append |
91 | - if( $field['append'] !== "" ) { |
|
91 | + if ($field['append'] !== "") { |
|
92 | 92 | |
93 | 93 | $field['class'] .= ' acf-is-appended'; |
94 | - $e .= '<div class="acf-input-append">' . $field['append'] . '</div>'; |
|
94 | + $e .= '<div class="acf-input-append">'.$field['append'].'</div>'; |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | 99 | // populate atts |
100 | 100 | $atts = array(); |
101 | - foreach( $o as $k ) { |
|
101 | + foreach ($o as $k) { |
|
102 | 102 | |
103 | - $atts[ $k ] = $field[ $k ]; |
|
103 | + $atts[$k] = $field[$k]; |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | // special atts |
109 | - foreach( $s as $k ) { |
|
109 | + foreach ($s as $k) { |
|
110 | 110 | |
111 | - if( $field[ $k ] ) { |
|
111 | + if ($field[$k]) { |
|
112 | 112 | |
113 | - $atts[ $k ] = $k; |
|
113 | + $atts[$k] = $k; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // render |
121 | 121 | $e .= '<div class="acf-input-wrap">'; |
122 | - $e .= '<input ' . acf_esc_attr( $atts ) . ' />'; |
|
122 | + $e .= '<input '.acf_esc_attr($atts).' />'; |
|
123 | 123 | $e .= '</div>'; |
124 | 124 | |
125 | 125 | |
@@ -141,48 +141,48 @@ discard block |
||
141 | 141 | * @date 23/01/13 |
142 | 142 | */ |
143 | 143 | |
144 | - function render_field_settings( $field ) { |
|
144 | + function render_field_settings($field) { |
|
145 | 145 | |
146 | 146 | // default_value |
147 | - acf_render_field_setting( $field, array( |
|
148 | - 'label' => __('Default Value','acf'), |
|
149 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
147 | + acf_render_field_setting($field, array( |
|
148 | + 'label' => __('Default Value', 'acf'), |
|
149 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
150 | 150 | 'type' => 'text', |
151 | 151 | 'name' => 'default_value', |
152 | 152 | )); |
153 | 153 | |
154 | 154 | |
155 | 155 | // placeholder |
156 | - acf_render_field_setting( $field, array( |
|
157 | - 'label' => __('Placeholder Text','acf'), |
|
158 | - 'instructions' => __('Appears within the input','acf'), |
|
156 | + acf_render_field_setting($field, array( |
|
157 | + 'label' => __('Placeholder Text', 'acf'), |
|
158 | + 'instructions' => __('Appears within the input', 'acf'), |
|
159 | 159 | 'type' => 'text', |
160 | 160 | 'name' => 'placeholder', |
161 | 161 | )); |
162 | 162 | |
163 | 163 | |
164 | 164 | // prepend |
165 | - acf_render_field_setting( $field, array( |
|
166 | - 'label' => __('Prepend','acf'), |
|
167 | - 'instructions' => __('Appears before the input','acf'), |
|
165 | + acf_render_field_setting($field, array( |
|
166 | + 'label' => __('Prepend', 'acf'), |
|
167 | + 'instructions' => __('Appears before the input', 'acf'), |
|
168 | 168 | 'type' => 'text', |
169 | 169 | 'name' => 'prepend', |
170 | 170 | )); |
171 | 171 | |
172 | 172 | |
173 | 173 | // append |
174 | - acf_render_field_setting( $field, array( |
|
175 | - 'label' => __('Append','acf'), |
|
176 | - 'instructions' => __('Appears after the input','acf'), |
|
174 | + acf_render_field_setting($field, array( |
|
175 | + 'label' => __('Append', 'acf'), |
|
176 | + 'instructions' => __('Appears after the input', 'acf'), |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'name' => 'append', |
179 | 179 | )); |
180 | 180 | |
181 | 181 | |
182 | 182 | // maxlength |
183 | - acf_render_field_setting( $field, array( |
|
184 | - 'label' => __('Character Limit','acf'), |
|
185 | - 'instructions' => __('Leave blank for no limit','acf'), |
|
183 | + acf_render_field_setting($field, array( |
|
184 | + 'label' => __('Character Limit', 'acf'), |
|
185 | + 'instructions' => __('Leave blank for no limit', 'acf'), |
|
186 | 186 | 'type' => 'number', |
187 | 187 | 'name' => 'maxlength', |
188 | 188 | )); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_textarea') ) : |
|
14 | +if ( ! class_exists('acf_field_textarea')) : |
|
15 | 15 | |
16 | 16 | class acf_field_textarea extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'textarea'; |
36 | - $this->label = __("Text Area",'acf'); |
|
36 | + $this->label = __("Text Area", 'acf'); |
|
37 | 37 | $this->defaults = array( |
38 | 38 | 'default_value' => '', |
39 | 39 | 'new_lines' => '', |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | * @date 23/01/13 |
63 | 63 | */ |
64 | 64 | |
65 | - function render_field( $field ) { |
|
65 | + function render_field($field) { |
|
66 | 66 | |
67 | 67 | // vars |
68 | - $o = array( 'id', 'class', 'name', 'placeholder', 'rows' ); |
|
69 | - $s = array( 'readonly', 'disabled' ); |
|
68 | + $o = array('id', 'class', 'name', 'placeholder', 'rows'); |
|
69 | + $s = array('readonly', 'disabled'); |
|
70 | 70 | $e = ''; |
71 | 71 | |
72 | 72 | |
73 | 73 | // maxlength |
74 | - if( $field['maxlength'] !== '' ) { |
|
74 | + if ($field['maxlength'] !== '') { |
|
75 | 75 | |
76 | 76 | $o[] = 'maxlength'; |
77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | // rows |
82 | - if( empty($field['rows']) ) { |
|
82 | + if (empty($field['rows'])) { |
|
83 | 83 | |
84 | 84 | $field['rows'] = 8; |
85 | 85 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | |
89 | 89 | // populate atts |
90 | 90 | $atts = array(); |
91 | - foreach( $o as $k ) { |
|
91 | + foreach ($o as $k) { |
|
92 | 92 | |
93 | - $atts[ $k ] = $field[ $k ]; |
|
93 | + $atts[$k] = $field[$k]; |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | // special atts |
99 | - foreach( $s as $k ) { |
|
99 | + foreach ($s as $k) { |
|
100 | 100 | |
101 | - if( $field[ $k ] ) { |
|
101 | + if ($field[$k]) { |
|
102 | 102 | |
103 | - $atts[ $k ] = $k; |
|
103 | + $atts[$k] = $k; |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | - $e .= '<textarea ' . acf_esc_attr( $atts ) . ' >'; |
|
111 | - $e .= esc_textarea( $field['value'] ); |
|
110 | + $e .= '<textarea '.acf_esc_attr($atts).' >'; |
|
111 | + $e .= esc_textarea($field['value']); |
|
112 | 112 | $e .= '</textarea>'; |
113 | 113 | |
114 | 114 | |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | * @date 23/01/13 |
131 | 131 | */ |
132 | 132 | |
133 | - function render_field_settings( $field ) { |
|
133 | + function render_field_settings($field) { |
|
134 | 134 | |
135 | 135 | // ACF4 migration |
136 | - if( empty($field['ID']) ) { |
|
136 | + if (empty($field['ID'])) { |
|
137 | 137 | |
138 | 138 | $field['new_lines'] = 'wpautop'; |
139 | 139 | |
@@ -141,36 +141,36 @@ discard block |
||
141 | 141 | |
142 | 142 | |
143 | 143 | // default_value |
144 | - acf_render_field_setting( $field, array( |
|
145 | - 'label' => __('Default Value','acf'), |
|
146 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
144 | + acf_render_field_setting($field, array( |
|
145 | + 'label' => __('Default Value', 'acf'), |
|
146 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
147 | 147 | 'type' => 'textarea', |
148 | 148 | 'name' => 'default_value', |
149 | 149 | )); |
150 | 150 | |
151 | 151 | |
152 | 152 | // placeholder |
153 | - acf_render_field_setting( $field, array( |
|
154 | - 'label' => __('Placeholder Text','acf'), |
|
155 | - 'instructions' => __('Appears within the input','acf'), |
|
153 | + acf_render_field_setting($field, array( |
|
154 | + 'label' => __('Placeholder Text', 'acf'), |
|
155 | + 'instructions' => __('Appears within the input', 'acf'), |
|
156 | 156 | 'type' => 'text', |
157 | 157 | 'name' => 'placeholder', |
158 | 158 | )); |
159 | 159 | |
160 | 160 | |
161 | 161 | // maxlength |
162 | - acf_render_field_setting( $field, array( |
|
163 | - 'label' => __('Character Limit','acf'), |
|
164 | - 'instructions' => __('Leave blank for no limit','acf'), |
|
162 | + acf_render_field_setting($field, array( |
|
163 | + 'label' => __('Character Limit', 'acf'), |
|
164 | + 'instructions' => __('Leave blank for no limit', 'acf'), |
|
165 | 165 | 'type' => 'number', |
166 | 166 | 'name' => 'maxlength', |
167 | 167 | )); |
168 | 168 | |
169 | 169 | |
170 | 170 | // rows |
171 | - acf_render_field_setting( $field, array( |
|
172 | - 'label' => __('Rows','acf'), |
|
173 | - 'instructions' => __('Sets the textarea height','acf'), |
|
171 | + acf_render_field_setting($field, array( |
|
172 | + 'label' => __('Rows', 'acf'), |
|
173 | + 'instructions' => __('Sets the textarea height', 'acf'), |
|
174 | 174 | 'type' => 'number', |
175 | 175 | 'name' => 'rows', |
176 | 176 | 'placeholder' => 8 |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | |
179 | 179 | |
180 | 180 | // formatting |
181 | - acf_render_field_setting( $field, array( |
|
182 | - 'label' => __('New Lines','acf'), |
|
183 | - 'instructions' => __('Controls how new lines are rendered','acf'), |
|
181 | + acf_render_field_setting($field, array( |
|
182 | + 'label' => __('New Lines', 'acf'), |
|
183 | + 'instructions' => __('Controls how new lines are rendered', 'acf'), |
|
184 | 184 | 'type' => 'select', |
185 | 185 | 'name' => 'new_lines', |
186 | 186 | 'choices' => array( |
187 | - 'wpautop' => __("Automatically add paragraphs",'acf'), |
|
188 | - 'br' => __("Automatically add <br>",'acf'), |
|
189 | - '' => __("No Formatting",'acf') |
|
187 | + 'wpautop' => __("Automatically add paragraphs", 'acf'), |
|
188 | + 'br' => __("Automatically add <br>", 'acf'), |
|
189 | + '' => __("No Formatting", 'acf') |
|
190 | 190 | ) |
191 | 191 | )); |
192 | 192 | |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | * @return $value (mixed) the modified value |
210 | 210 | */ |
211 | 211 | |
212 | - function format_value( $value, $post_id, $field ) { |
|
212 | + function format_value($value, $post_id, $field) { |
|
213 | 213 | |
214 | 214 | // bail early if no value or not for template |
215 | - if( empty($value) || !is_string($value) ) { |
|
215 | + if (empty($value) || ! is_string($value)) { |
|
216 | 216 | |
217 | 217 | return $value; |
218 | 218 | |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | |
221 | 221 | |
222 | 222 | // new lines |
223 | - if( $field['new_lines'] == 'wpautop' ) { |
|
223 | + if ($field['new_lines'] == 'wpautop') { |
|
224 | 224 | |
225 | 225 | $value = wpautop($value); |
226 | 226 | |
227 | - } elseif( $field['new_lines'] == 'br' ) { |
|
227 | + } elseif ($field['new_lines'] == 'br') { |
|
228 | 228 | |
229 | 229 | $value = nl2br($value); |
230 | 230 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_true_false') ) : |
|
14 | +if ( ! class_exists('acf_field_true_false')) : |
|
15 | 15 | |
16 | 16 | class acf_field_true_false extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'true_false'; |
36 | - $this->label = __("True / False",'acf'); |
|
36 | + $this->label = __("True / False", 'acf'); |
|
37 | 37 | $this->category = 'choice'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'default_value' => 0, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @date 23/01/13 |
60 | 60 | */ |
61 | 61 | |
62 | - function render_field( $field ) { |
|
62 | + function render_field($field) { |
|
63 | 63 | |
64 | 64 | // vars |
65 | 65 | $atts = array( |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | // checked |
74 | - if( !empty($field['value']) ) { |
|
74 | + if ( ! empty($field['value'])) { |
|
75 | 75 | |
76 | 76 | $atts['checked'] = 'checked'; |
77 | 77 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | // html |
82 | - echo '<ul class="acf-checkbox-list acf-bl ' . acf_esc_attr($field['class']) . '">'; |
|
83 | - echo '<input type="hidden" name="' . acf_esc_attr($field['name']) . '" value="0" />'; |
|
84 | - echo '<li><label><input ' . acf_esc_attr($atts) . '/>' . $field['message'] . '</label></li>'; |
|
82 | + echo '<ul class="acf-checkbox-list acf-bl '.acf_esc_attr($field['class']).'">'; |
|
83 | + echo '<input type="hidden" name="'.acf_esc_attr($field['name']).'" value="0" />'; |
|
84 | + echo '<li><label><input '.acf_esc_attr($atts).'/>'.$field['message'].'</label></li>'; |
|
85 | 85 | echo '</ul>'; |
86 | 86 | } |
87 | 87 | |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | * @param $field - an array holding all the field's data |
100 | 100 | */ |
101 | 101 | |
102 | - function render_field_settings( $field ) { |
|
102 | + function render_field_settings($field) { |
|
103 | 103 | |
104 | 104 | // message |
105 | - acf_render_field_setting( $field, array( |
|
106 | - 'label' => __('Message','acf'), |
|
107 | - 'instructions' => __('eg. Show extra content','acf'), |
|
105 | + acf_render_field_setting($field, array( |
|
106 | + 'label' => __('Message', 'acf'), |
|
107 | + 'instructions' => __('eg. Show extra content', 'acf'), |
|
108 | 108 | 'type' => 'text', |
109 | 109 | 'name' => 'message', |
110 | 110 | )); |
111 | 111 | |
112 | 112 | |
113 | 113 | // default_value |
114 | - acf_render_field_setting( $field, array( |
|
115 | - 'label' => __('Default Value','acf'), |
|
114 | + acf_render_field_setting($field, array( |
|
115 | + 'label' => __('Default Value', 'acf'), |
|
116 | 116 | 'instructions' => '', |
117 | 117 | 'type' => 'true_false', |
118 | 118 | 'name' => 'default_value', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return $value (mixed) the modified value |
138 | 138 | */ |
139 | 139 | |
140 | - function format_value( $value, $post_id, $field ) { |
|
140 | + function format_value($value, $post_id, $field) { |
|
141 | 141 | |
142 | 142 | return empty($value) ? false : true; |
143 | 143 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | * @return $post_id (int) |
158 | 158 | */ |
159 | 159 | |
160 | - function validate_value( $valid, $value, $field, $input ){ |
|
160 | + function validate_value($valid, $value, $field, $input) { |
|
161 | 161 | |
162 | 162 | // bail early if not required |
163 | - if( ! $field['required'] ) { |
|
163 | + if ( ! $field['required']) { |
|
164 | 164 | |
165 | 165 | return $valid; |
166 | 166 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | // value may be '0' |
171 | - if( !$value ) { |
|
171 | + if ( ! $value) { |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_url') ) : |
|
14 | +if ( ! class_exists('acf_field_url')) : |
|
15 | 15 | |
16 | 16 | class acf_field_url extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'url'; |
36 | - $this->label = __("Url",'acf'); |
|
36 | + $this->label = __("Url", 'acf'); |
|
37 | 37 | $this->defaults = array( |
38 | 38 | 'default_value' => '', |
39 | 39 | 'placeholder' => '', |
@@ -57,28 +57,28 @@ discard block |
||
57 | 57 | * @date 23/01/13 |
58 | 58 | */ |
59 | 59 | |
60 | - function render_field( $field ) { |
|
60 | + function render_field($field) { |
|
61 | 61 | |
62 | 62 | // vars |
63 | - $o = array( 'type', 'id', 'class', 'name', 'value', 'placeholder' ); |
|
63 | + $o = array('type', 'id', 'class', 'name', 'value', 'placeholder'); |
|
64 | 64 | $e = ''; |
65 | 65 | |
66 | 66 | |
67 | 67 | // populate atts |
68 | 68 | $atts = array(); |
69 | - foreach( $o as $k ) { |
|
69 | + foreach ($o as $k) { |
|
70 | 70 | |
71 | - $atts[ $k ] = $field[ $k ]; |
|
71 | + $atts[$k] = $field[$k]; |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | // special atts |
77 | - foreach( array( 'readonly', 'disabled' ) as $k ) { |
|
77 | + foreach (array('readonly', 'disabled') as $k) { |
|
78 | 78 | |
79 | - if( !empty($field[ $k ]) ) { |
|
79 | + if ( ! empty($field[$k])) { |
|
80 | 80 | |
81 | - $atts[ $k ] = $k; |
|
81 | + $atts[$k] = $k; |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | // render |
89 | 89 | $e .= '<div class="acf-input-wrap acf-url">'; |
90 | - $e .= '<i class="acf-icon -globe small"></i><input ' . acf_esc_attr( $atts ) . ' />'; |
|
90 | + $e .= '<i class="acf-icon -globe small"></i><input '.acf_esc_attr($atts).' />'; |
|
91 | 91 | $e .= '</div>'; |
92 | 92 | |
93 | 93 | |
@@ -110,21 +110,21 @@ discard block |
||
110 | 110 | * @param $field - an array holding all the field's data |
111 | 111 | */ |
112 | 112 | |
113 | - function render_field_settings( $field ) { |
|
113 | + function render_field_settings($field) { |
|
114 | 114 | |
115 | 115 | // default_value |
116 | - acf_render_field_setting( $field, array( |
|
117 | - 'label' => __('Default Value','acf'), |
|
118 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
116 | + acf_render_field_setting($field, array( |
|
117 | + 'label' => __('Default Value', 'acf'), |
|
118 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
119 | 119 | 'type' => 'text', |
120 | 120 | 'name' => 'default_value', |
121 | 121 | )); |
122 | 122 | |
123 | 123 | |
124 | 124 | // placeholder |
125 | - acf_render_field_setting( $field, array( |
|
126 | - 'label' => __('Placeholder Text','acf'), |
|
127 | - 'instructions' => __('Appears within the input','acf'), |
|
125 | + acf_render_field_setting($field, array( |
|
126 | + 'label' => __('Placeholder Text', 'acf'), |
|
127 | + 'instructions' => __('Appears within the input', 'acf'), |
|
128 | 128 | 'type' => 'text', |
129 | 129 | 'name' => 'placeholder', |
130 | 130 | )); |
@@ -145,21 +145,21 @@ discard block |
||
145 | 145 | * @return $post_id (int) |
146 | 146 | */ |
147 | 147 | |
148 | - function validate_value( $valid, $value, $field, $input ){ |
|
148 | + function validate_value($valid, $value, $field, $input) { |
|
149 | 149 | |
150 | 150 | // bail early if empty |
151 | - if( empty($value) ) { |
|
151 | + if (empty($value)) { |
|
152 | 152 | |
153 | 153 | return $valid; |
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | 157 | |
158 | - if( strpos($value, '://') !== false ) { |
|
158 | + if (strpos($value, '://') !== false) { |
|
159 | 159 | |
160 | 160 | // url |
161 | 161 | |
162 | - } elseif( strpos($value, '//') === 0 ) { |
|
162 | + } elseif (strpos($value, '//') === 0) { |
|
163 | 163 | |
164 | 164 | // protocol relative url |
165 | 165 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_user') ) : |
|
14 | +if ( ! class_exists('acf_field_user')) : |
|
15 | 15 | |
16 | 16 | class acf_field_user extends acf_field { |
17 | 17 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // vars |
35 | 35 | $this->name = 'user'; |
36 | - $this->label = __("User",'acf'); |
|
36 | + $this->label = __("User", 'acf'); |
|
37 | 37 | $this->category = 'relational'; |
38 | 38 | $this->defaults = array( |
39 | 39 | 'role' => '', |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | // extra |
46 | - add_action('wp_ajax_acf/fields/user/query', array($this, 'ajax_query')); |
|
47 | - add_action('wp_ajax_nopriv_acf/fields/user/query', array($this, 'ajax_query')); |
|
46 | + add_action('wp_ajax_acf/fields/user/query', array($this, 'ajax_query')); |
|
47 | + add_action('wp_ajax_nopriv_acf/fields/user/query', array($this, 'ajax_query')); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | // do not delete! |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return (array) |
67 | 67 | */ |
68 | 68 | |
69 | - function get_choices( $options = array() ) { |
|
69 | + function get_choices($options = array()) { |
|
70 | 70 | |
71 | 71 | // defaults |
72 | 72 | $options = acf_parse_args($options, array( |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | |
84 | 84 | // load field |
85 | - $field = acf_get_field( $options['field_key'] ); |
|
85 | + $field = acf_get_field($options['field_key']); |
|
86 | 86 | |
87 | - if( !$field ) { |
|
87 | + if ( ! $field) { |
|
88 | 88 | |
89 | 89 | return false; |
90 | 90 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | // editable roles |
95 | 95 | $editable_roles = get_editable_roles(); |
96 | 96 | |
97 | - if( !empty($field['role']) ) { |
|
97 | + if ( ! empty($field['role'])) { |
|
98 | 98 | |
99 | - foreach( $editable_roles as $role => $role_info ) { |
|
99 | + foreach ($editable_roles as $role => $role_info) { |
|
100 | 100 | |
101 | - if( !in_array($role, $field['role']) ) { |
|
101 | + if ( ! in_array($role, $field['role'])) { |
|
102 | 102 | |
103 | - unset( $editable_roles[ $role ] ); |
|
103 | + unset($editable_roles[$role]); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | |
111 | 111 | |
112 | 112 | // search |
113 | - if( $options['s'] ) { |
|
113 | + if ($options['s']) { |
|
114 | 114 | |
115 | 115 | // append to $args |
116 | - $args['search'] = '*' . $options['s'] . '*'; |
|
116 | + $args['search'] = '*'.$options['s'].'*'; |
|
117 | 117 | |
118 | 118 | |
119 | 119 | // add reference |
@@ -127,17 +127,17 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | // filters |
130 | - $args = apply_filters("acf/fields/user/query", $args, $field, $options['post_id']); |
|
131 | - $args = apply_filters("acf/fields/user/query/name={$field['_name']}", $args, $field, $options['post_id']); |
|
132 | - $args = apply_filters("acf/fields/user/query/key={$field['key']}", $args, $field, $options['post_id']); |
|
130 | + $args = apply_filters("acf/fields/user/query", $args, $field, $options['post_id']); |
|
131 | + $args = apply_filters("acf/fields/user/query/name={$field['_name']}", $args, $field, $options['post_id']); |
|
132 | + $args = apply_filters("acf/fields/user/query/key={$field['key']}", $args, $field, $options['post_id']); |
|
133 | 133 | |
134 | 134 | |
135 | 135 | // get users |
136 | - $users = get_users( $args ); |
|
136 | + $users = get_users($args); |
|
137 | 137 | |
138 | - if( !empty($users) && !empty($editable_roles) ) { |
|
138 | + if ( ! empty($users) && ! empty($editable_roles)) { |
|
139 | 139 | |
140 | - foreach( $editable_roles as $role => $role_info ) { |
|
140 | + foreach ($editable_roles as $role => $role_info) { |
|
141 | 141 | |
142 | 142 | // vars |
143 | 143 | $this_users = array(); |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | // loop over users |
148 | - foreach( array_keys($users) as $key ) { |
|
148 | + foreach (array_keys($users) as $key) { |
|
149 | 149 | |
150 | - if( in_array($role, $users[ $key ]->roles) ) { |
|
150 | + if (in_array($role, $users[$key]->roles)) { |
|
151 | 151 | |
152 | 152 | // extract user |
153 | - $user = acf_extract_var( $users, $key ); |
|
153 | + $user = acf_extract_var($users, $key); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | // append to $this_users |
157 | - $this_users[ $user->ID ] = $this->get_result( $user, $field, $options['post_id'] ); |
|
157 | + $this_users[$user->ID] = $this->get_result($user, $field, $options['post_id']); |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | // bail early if no users for this role |
165 | - if( empty($this_users) ) { |
|
165 | + if (empty($this_users)) { |
|
166 | 166 | |
167 | 167 | continue; |
168 | 168 | |
@@ -170,34 +170,34 @@ discard block |
||
170 | 170 | |
171 | 171 | |
172 | 172 | // order by search |
173 | - if( !empty($args['s']) ) { |
|
173 | + if ( ! empty($args['s'])) { |
|
174 | 174 | |
175 | - $this_users = acf_order_by_search( $this_users, $args['s'] ); |
|
175 | + $this_users = acf_order_by_search($this_users, $args['s']); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | 180 | // append to json |
181 | - foreach( array_keys($this_users) as $user_id ) { |
|
181 | + foreach (array_keys($this_users) as $user_id) { |
|
182 | 182 | |
183 | 183 | // add to json |
184 | 184 | $this_json[] = array( |
185 | 185 | 'id' => $user_id, |
186 | - 'text' => $this_users[ $user_id ] |
|
186 | + 'text' => $this_users[$user_id] |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | 191 | |
192 | 192 | // add as optgroup or results |
193 | - if( count($editable_roles) == 1 ) { |
|
193 | + if (count($editable_roles) == 1) { |
|
194 | 194 | |
195 | 195 | $r = $this_json; |
196 | 196 | |
197 | 197 | } else { |
198 | 198 | |
199 | 199 | $r[] = array( |
200 | - 'text' => translate_user_role( $role_info['name'] ), |
|
200 | + 'text' => translate_user_role($role_info['name']), |
|
201 | 201 | 'children' => $this_json |
202 | 202 | ); |
203 | 203 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function ajax_query() { |
231 | 231 | |
232 | 232 | // validate |
233 | - if( !acf_verify_ajax() ) { |
|
233 | + if ( ! acf_verify_ajax()) { |
|
234 | 234 | |
235 | 235 | die(); |
236 | 236 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | |
239 | 239 | |
240 | 240 | // get choices |
241 | - $choices = $this->get_choices( $_POST ); |
|
241 | + $choices = $this->get_choices($_POST); |
|
242 | 242 | |
243 | 243 | |
244 | 244 | // validate |
245 | - if( !$choices ) { |
|
245 | + if ( ! $choices) { |
|
246 | 246 | |
247 | 247 | die(); |
248 | 248 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | |
252 | 252 | // return JSON |
253 | - echo json_encode( $choices ); |
|
253 | + echo json_encode($choices); |
|
254 | 254 | die(); |
255 | 255 | |
256 | 256 | } |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * @return (string) |
272 | 272 | */ |
273 | 273 | |
274 | - function get_result( $user, $field, $post_id = 0 ) { |
|
274 | + function get_result($user, $field, $post_id = 0) { |
|
275 | 275 | |
276 | 276 | // get post_id |
277 | - if( !$post_id ) { |
|
277 | + if ( ! $post_id) { |
|
278 | 278 | |
279 | 279 | $post_id = acf_get_setting('form_data/post_id', get_the_ID()); |
280 | 280 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | |
287 | 287 | |
288 | 288 | // append name |
289 | - if( $user->first_name ) { |
|
289 | + if ($user->first_name) { |
|
290 | 290 | |
291 | - $result .= ' (' . $user->first_name; |
|
291 | + $result .= ' ('.$user->first_name; |
|
292 | 292 | |
293 | - if( $user->last_name ) { |
|
293 | + if ($user->last_name) { |
|
294 | 294 | |
295 | - $result .= ' ' . $user->last_name; |
|
295 | + $result .= ' '.$user->last_name; |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | |
303 | 303 | |
304 | 304 | // filters |
305 | - $result = apply_filters("acf/fields/user/result", $result, $user, $field, $post_id); |
|
306 | - $result = apply_filters("acf/fields/user/result/name={$field['_name']}", $result, $user, $field, $post_id); |
|
307 | - $result = apply_filters("acf/fields/user/result/key={$field['key']}", $result, $user, $field, $post_id); |
|
305 | + $result = apply_filters("acf/fields/user/result", $result, $user, $field, $post_id); |
|
306 | + $result = apply_filters("acf/fields/user/result/name={$field['_name']}", $result, $user, $field, $post_id); |
|
307 | + $result = apply_filters("acf/fields/user/result/key={$field['key']}", $result, $user, $field, $post_id); |
|
308 | 308 | |
309 | 309 | |
310 | 310 | // return |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | * @return $columns |
327 | 327 | */ |
328 | 328 | |
329 | - function user_search_columns( $columns, $search, $WP_User_Query ) { |
|
329 | + function user_search_columns($columns, $search, $WP_User_Query) { |
|
330 | 330 | |
331 | 331 | // bail early if no field |
332 | - if( empty($this->field) ) { |
|
332 | + if (empty($this->field)) { |
|
333 | 333 | |
334 | 334 | return $columns; |
335 | 335 | |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | |
342 | 342 | |
343 | 343 | // filter for 3rd party customization |
344 | - $columns = apply_filters("acf/fields/user/search_columns", $columns, $search, $WP_User_Query, $field); |
|
345 | - $columns = apply_filters("acf/fields/user/search_columns/name={$field['_name']}", $columns, $search, $WP_User_Query, $field); |
|
346 | - $columns = apply_filters("acf/fields/user/search_columns/key={$field['key']}", $columns, $search, $WP_User_Query, $field); |
|
344 | + $columns = apply_filters("acf/fields/user/search_columns", $columns, $search, $WP_User_Query, $field); |
|
345 | + $columns = apply_filters("acf/fields/user/search_columns/name={$field['_name']}", $columns, $search, $WP_User_Query, $field); |
|
346 | + $columns = apply_filters("acf/fields/user/search_columns/key={$field['key']}", $columns, $search, $WP_User_Query, $field); |
|
347 | 347 | |
348 | 348 | |
349 | 349 | // return |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @param $field - an array holding all the field's data |
364 | 364 | */ |
365 | 365 | |
366 | - function render_field( $field ) { |
|
366 | + function render_field($field) { |
|
367 | 367 | |
368 | 368 | // Change Field into a select |
369 | 369 | $field['type'] = 'select'; |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | |
374 | 374 | |
375 | 375 | // populate choices |
376 | - if( !empty($field['value']) ) { |
|
376 | + if ( ! empty($field['value'])) { |
|
377 | 377 | |
378 | 378 | // force value to array |
379 | - $field['value'] = acf_get_array( $field['value'] ); |
|
379 | + $field['value'] = acf_get_array($field['value']); |
|
380 | 380 | |
381 | 381 | |
382 | 382 | // convert values to int |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | )); |
389 | 389 | |
390 | 390 | |
391 | - if( !empty($users) ) { |
|
391 | + if ( ! empty($users)) { |
|
392 | 392 | |
393 | - foreach( $users as $user ) { |
|
393 | + foreach ($users as $user) { |
|
394 | 394 | |
395 | - $field['choices'][ $user->ID ] = $this->get_result( $user, $field ); |
|
395 | + $field['choices'][$user->ID] = $this->get_result($user, $field); |
|
396 | 396 | |
397 | 397 | } |
398 | 398 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | |
404 | 404 | // render |
405 | - acf_render_field( $field ); |
|
405 | + acf_render_field($field); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | * @param $field - an array holding all the field's data |
421 | 421 | */ |
422 | 422 | |
423 | - function render_field_settings( $field ) { |
|
423 | + function render_field_settings($field) { |
|
424 | 424 | |
425 | 425 | // role |
426 | 426 | $choices = array(); |
427 | 427 | $editable_roles = get_editable_roles(); |
428 | 428 | |
429 | - foreach( $editable_roles as $role => $details ) { |
|
429 | + foreach ($editable_roles as $role => $details) { |
|
430 | 430 | |
431 | 431 | // only translate the output not the value |
432 | - $choices[ $role ] = translate_user_role( $details['name'] ); |
|
432 | + $choices[$role] = translate_user_role($details['name']); |
|
433 | 433 | |
434 | 434 | } |
435 | 435 | |
436 | - acf_render_field_setting( $field, array( |
|
437 | - 'label' => __('Filter by role','acf'), |
|
436 | + acf_render_field_setting($field, array( |
|
437 | + 'label' => __('Filter by role', 'acf'), |
|
438 | 438 | 'instructions' => '', |
439 | 439 | 'type' => 'select', |
440 | 440 | 'name' => 'role', |
@@ -442,34 +442,34 @@ discard block |
||
442 | 442 | 'multiple' => 1, |
443 | 443 | 'ui' => 1, |
444 | 444 | 'allow_null' => 1, |
445 | - 'placeholder' => __("All user roles",'acf'), |
|
445 | + 'placeholder' => __("All user roles", 'acf'), |
|
446 | 446 | )); |
447 | 447 | |
448 | 448 | |
449 | 449 | |
450 | 450 | // allow_null |
451 | - acf_render_field_setting( $field, array( |
|
452 | - 'label' => __('Allow Null?','acf'), |
|
451 | + acf_render_field_setting($field, array( |
|
452 | + 'label' => __('Allow Null?', 'acf'), |
|
453 | 453 | 'instructions' => '', |
454 | 454 | 'type' => 'radio', |
455 | 455 | 'name' => 'allow_null', |
456 | 456 | 'choices' => array( |
457 | - 1 => __("Yes",'acf'), |
|
458 | - 0 => __("No",'acf'), |
|
457 | + 1 => __("Yes", 'acf'), |
|
458 | + 0 => __("No", 'acf'), |
|
459 | 459 | ), |
460 | 460 | 'layout' => 'horizontal', |
461 | 461 | )); |
462 | 462 | |
463 | 463 | |
464 | 464 | // multiple |
465 | - acf_render_field_setting( $field, array( |
|
466 | - 'label' => __('Select multiple values?','acf'), |
|
465 | + acf_render_field_setting($field, array( |
|
466 | + 'label' => __('Select multiple values?', 'acf'), |
|
467 | 467 | 'instructions' => '', |
468 | 468 | 'type' => 'radio', |
469 | 469 | 'name' => 'multiple', |
470 | 470 | 'choices' => array( |
471 | - 1 => __("Yes",'acf'), |
|
472 | - 0 => __("No",'acf'), |
|
471 | + 1 => __("Yes", 'acf'), |
|
472 | + 0 => __("No", 'acf'), |
|
473 | 473 | ), |
474 | 474 | 'layout' => 'horizontal', |
475 | 475 | )); |
@@ -494,17 +494,17 @@ discard block |
||
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 | // array? |
500 | - if( is_array($value) && isset($value['ID']) ) { |
|
500 | + if (is_array($value) && isset($value['ID'])) { |
|
501 | 501 | |
502 | 502 | $value = $value['ID']; |
503 | 503 | |
504 | 504 | } |
505 | 505 | |
506 | 506 | // object? |
507 | - if( is_object($value) && isset($value->ID) ) { |
|
507 | + if (is_object($value) && isset($value->ID)) { |
|
508 | 508 | |
509 | 509 | $value = $value->ID; |
510 | 510 | |
@@ -531,10 +531,10 @@ discard block |
||
531 | 531 | * @return $value |
532 | 532 | */ |
533 | 533 | |
534 | - function load_value( $value, $post_id, $field ) { |
|
534 | + function load_value($value, $post_id, $field) { |
|
535 | 535 | |
536 | 536 | // ACF4 null |
537 | - if( $value === 'null' ) { |
|
537 | + if ($value === 'null') { |
|
538 | 538 | |
539 | 539 | return false; |
540 | 540 | |
@@ -562,10 +562,10 @@ discard block |
||
562 | 562 | * @return $value (mixed) the modified value |
563 | 563 | */ |
564 | 564 | |
565 | - function format_value( $value, $post_id, $field ) { |
|
565 | + function format_value($value, $post_id, $field) { |
|
566 | 566 | |
567 | 567 | // bail early if no value |
568 | - if( empty($value) ) { |
|
568 | + if (empty($value)) { |
|
569 | 569 | |
570 | 570 | return $value; |
571 | 571 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | |
574 | 574 | |
575 | 575 | // force value to array |
576 | - $value = acf_get_array( $value ); |
|
576 | + $value = acf_get_array($value); |
|
577 | 577 | |
578 | 578 | |
579 | 579 | // convert values to int |
@@ -581,41 +581,41 @@ discard block |
||
581 | 581 | |
582 | 582 | |
583 | 583 | // load users |
584 | - foreach( array_keys($value) as $i ) { |
|
584 | + foreach (array_keys($value) as $i) { |
|
585 | 585 | |
586 | 586 | // vars |
587 | - $user_id = $value[ $i ]; |
|
588 | - $user_data = get_userdata( $user_id ); |
|
587 | + $user_id = $value[$i]; |
|
588 | + $user_data = get_userdata($user_id); |
|
589 | 589 | |
590 | 590 | |
591 | 591 | //cope with deleted users by @adampope |
592 | - if( !is_object($user_data) ) { |
|
592 | + if ( ! is_object($user_data)) { |
|
593 | 593 | |
594 | - unset( $value[ $i ] ); |
|
594 | + unset($value[$i]); |
|
595 | 595 | continue; |
596 | 596 | |
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | 600 | // append to array |
601 | - $value[ $i ] = array(); |
|
602 | - $value[ $i ]['ID'] = $user_id; |
|
603 | - $value[ $i ]['user_firstname'] = $user_data->user_firstname; |
|
604 | - $value[ $i ]['user_lastname'] = $user_data->user_lastname; |
|
605 | - $value[ $i ]['nickname'] = $user_data->nickname; |
|
606 | - $value[ $i ]['user_nicename'] = $user_data->user_nicename; |
|
607 | - $value[ $i ]['display_name'] = $user_data->display_name; |
|
608 | - $value[ $i ]['user_email'] = $user_data->user_email; |
|
609 | - $value[ $i ]['user_url'] = $user_data->user_url; |
|
610 | - $value[ $i ]['user_registered'] = $user_data->user_registered; |
|
611 | - $value[ $i ]['user_description'] = $user_data->user_description; |
|
612 | - $value[ $i ]['user_avatar'] = get_avatar( $user_id ); |
|
601 | + $value[$i] = array(); |
|
602 | + $value[$i]['ID'] = $user_id; |
|
603 | + $value[$i]['user_firstname'] = $user_data->user_firstname; |
|
604 | + $value[$i]['user_lastname'] = $user_data->user_lastname; |
|
605 | + $value[$i]['nickname'] = $user_data->nickname; |
|
606 | + $value[$i]['user_nicename'] = $user_data->user_nicename; |
|
607 | + $value[$i]['display_name'] = $user_data->display_name; |
|
608 | + $value[$i]['user_email'] = $user_data->user_email; |
|
609 | + $value[$i]['user_url'] = $user_data->user_url; |
|
610 | + $value[$i]['user_registered'] = $user_data->user_registered; |
|
611 | + $value[$i]['user_description'] = $user_data->user_description; |
|
612 | + $value[$i]['user_avatar'] = get_avatar($user_id); |
|
613 | 613 | |
614 | 614 | } |
615 | 615 | |
616 | 616 | |
617 | 617 | // convert back from array if neccessary |
618 | - if( !$field['multiple'] ) { |
|
618 | + if ( ! $field['multiple']) { |
|
619 | 619 | |
620 | 620 | $value = array_shift($value); |
621 | 621 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @subpackage Fields |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! class_exists('acf_field_wysiwyg') ) : |
|
14 | +if ( ! class_exists('acf_field_wysiwyg')) : |
|
15 | 15 | |
16 | 16 | class acf_field_wysiwyg extends acf_field { |
17 | 17 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | // vars |
36 | 36 | $this->name = 'wysiwyg'; |
37 | - $this->label = __("Wysiwyg Editor",'acf'); |
|
37 | + $this->label = __("Wysiwyg Editor", 'acf'); |
|
38 | 38 | $this->category = 'content'; |
39 | 39 | $this->defaults = array( |
40 | 40 | 'tabs' => 'all', |
@@ -45,31 +45,31 @@ discard block |
||
45 | 45 | |
46 | 46 | |
47 | 47 | // Create an acf version of the_content filter (acf_the_content) |
48 | - if( !empty($GLOBALS['wp_embed']) ) { |
|
48 | + if ( ! empty($GLOBALS['wp_embed'])) { |
|
49 | 49 | |
50 | - add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 ); |
|
51 | - add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 ); |
|
50 | + add_filter('acf_the_content', array($GLOBALS['wp_embed'], 'run_shortcode'), 8); |
|
51 | + add_filter('acf_the_content', array($GLOBALS['wp_embed'], 'autoembed'), 8); |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | - add_filter( 'acf_the_content', 'capital_P_dangit', 11 ); |
|
56 | - add_filter( 'acf_the_content', 'wptexturize' ); |
|
57 | - add_filter( 'acf_the_content', 'convert_smilies' ); |
|
58 | - add_filter( 'acf_the_content', 'convert_chars' ); // not found in WP 4.4 |
|
59 | - add_filter( 'acf_the_content', 'wpautop' ); |
|
60 | - add_filter( 'acf_the_content', 'shortcode_unautop' ); |
|
55 | + add_filter('acf_the_content', 'capital_P_dangit', 11); |
|
56 | + add_filter('acf_the_content', 'wptexturize'); |
|
57 | + add_filter('acf_the_content', 'convert_smilies'); |
|
58 | + add_filter('acf_the_content', 'convert_chars'); // not found in WP 4.4 |
|
59 | + add_filter('acf_the_content', 'wpautop'); |
|
60 | + add_filter('acf_the_content', 'shortcode_unautop'); |
|
61 | 61 | //add_filter( 'acf_the_content', 'prepend_attachment' ); should only be for the_content (causes double image on attachment page) |
62 | - if( function_exists('wp_make_content_images_responsive') ) { |
|
62 | + if (function_exists('wp_make_content_images_responsive')) { |
|
63 | 63 | |
64 | - add_filter( 'acf_the_content', 'wp_make_content_images_responsive' ); // added in WP 4.4 |
|
64 | + add_filter('acf_the_content', 'wp_make_content_images_responsive'); // added in WP 4.4 |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | - add_filter( 'acf_the_content', 'do_shortcode', 11); |
|
68 | + add_filter('acf_the_content', 'do_shortcode', 11); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | // actions |
72 | - add_action('acf/input/admin_footer_js', array($this, 'input_admin_footer_js')); |
|
72 | + add_action('acf/input/admin_footer_js', array($this, 'input_admin_footer_js')); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | // do not delete! |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | $editor_id = 'acf_content'; |
103 | 103 | |
104 | 104 | |
105 | - if( version_compare($wp_version, '3.9', '>=' ) ) { |
|
105 | + if (version_compare($wp_version, '3.9', '>=')) { |
|
106 | 106 | |
107 | 107 | // Full |
108 | 108 | $toolbars['Full'] = array( |
109 | 109 | |
110 | - 1 => apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id), |
|
110 | + 1 => apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv'), $editor_id), |
|
111 | 111 | |
112 | - 2 => apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id), |
|
112 | + 2 => apply_filters('mce_buttons_2', array('formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help'), $editor_id), |
|
113 | 113 | |
114 | 114 | 3 => apply_filters('mce_buttons_3', array(), $editor_id), |
115 | 115 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | // Full |
131 | 131 | $toolbars['Full'] = array( |
132 | 132 | |
133 | - 1 => apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id), |
|
133 | + 1 => apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv'), $editor_id), |
|
134 | 134 | |
135 | - 2 => apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id), |
|
135 | + 2 => apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help'), $editor_id), |
|
136 | 136 | |
137 | 137 | 3 => apply_filters('mce_buttons_3', array(), $editor_id), |
138 | 138 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Basic |
145 | 145 | $toolbars['Basic'] = array( |
146 | 146 | |
147 | - 1 => apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id ), |
|
147 | + 1 => apply_filters('teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id), |
|
148 | 148 | |
149 | 149 | ); |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | // Filter for 3rd party |
155 | - $toolbars = apply_filters( 'acf/fields/wysiwyg/toolbars', $toolbars ); |
|
155 | + $toolbars = apply_filters('acf/fields/wysiwyg/toolbars', $toolbars); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | // return |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | |
184 | 184 | // bail ealry if no toolbars |
185 | - if( empty($toolbars) ) { |
|
185 | + if (empty($toolbars)) { |
|
186 | 186 | |
187 | 187 | return; |
188 | 188 | |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | |
191 | 191 | |
192 | 192 | // loop through toolbars |
193 | - foreach( $toolbars as $label => $rows ) { |
|
193 | + foreach ($toolbars as $label => $rows) { |
|
194 | 194 | |
195 | 195 | // vars |
196 | - $label = sanitize_title( $label ); |
|
196 | + $label = sanitize_title($label); |
|
197 | 197 | $label = str_replace('-', '_', $label); |
198 | 198 | |
199 | 199 | |
200 | 200 | // append to $json |
201 | - $json[ $label ] = array(); |
|
201 | + $json[$label] = array(); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | // convert to strings |
205 | - if( !empty($rows) ) { |
|
205 | + if ( ! empty($rows)) { |
|
206 | 206 | |
207 | - foreach( $rows as $i => $row ) { |
|
207 | + foreach ($rows as $i => $row) { |
|
208 | 208 | |
209 | - $json[ $label ][ $i ] = implode(',', $row); |
|
209 | + $json[$label][$i] = implode(',', $row); |
|
210 | 210 | |
211 | 211 | } |
212 | 212 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @date 23/01/13 |
234 | 234 | */ |
235 | 235 | |
236 | - function render_field( $field ) { |
|
236 | + function render_field($field) { |
|
237 | 237 | |
238 | 238 | // global |
239 | 239 | global $wp_version; |
@@ -252,22 +252,22 @@ discard block |
||
252 | 252 | |
253 | 253 | // get height |
254 | 254 | $height = acf_get_user_setting('wysiwyg_height', 300); |
255 | - $height = max( $height, 300 ); // minimum height is 300 |
|
255 | + $height = max($height, 300); // minimum height is 300 |
|
256 | 256 | |
257 | 257 | |
258 | 258 | // detect mode |
259 | - if( $field['tabs'] == 'visual' ) { |
|
259 | + if ($field['tabs'] == 'visual') { |
|
260 | 260 | |
261 | 261 | // case: visual tab only |
262 | 262 | $default_editor = 'tinymce'; |
263 | 263 | $show_tabs = false; |
264 | 264 | |
265 | - } elseif( $field['tabs'] == 'text' ) { |
|
265 | + } elseif ($field['tabs'] == 'text') { |
|
266 | 266 | |
267 | 267 | // case: text tab only |
268 | 268 | $show_tabs = false; |
269 | 269 | |
270 | - } elseif( wp_default_editor() == 'tinymce' ) { |
|
270 | + } elseif (wp_default_editor() == 'tinymce') { |
|
271 | 271 | |
272 | 272 | // case: both tabs |
273 | 273 | $default_editor = 'tinymce'; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | |
278 | 278 | // must be logged in tp upload |
279 | - if( !current_user_can('upload_files') ) { |
|
279 | + if ( ! current_user_can('upload_files')) { |
|
280 | 280 | |
281 | 281 | $field['media_upload'] = 0; |
282 | 282 | |
@@ -288,17 +288,17 @@ discard block |
||
288 | 288 | |
289 | 289 | |
290 | 290 | // filter value for editor |
291 | - remove_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 ); |
|
292 | - remove_filter( 'acf_the_editor_content', 'wp_htmledit_pre', 10, 1 ); |
|
293 | - remove_filter( 'acf_the_editor_content', 'wp_richedit_pre', 10, 1 ); |
|
291 | + remove_filter('acf_the_editor_content', 'format_for_editor', 10, 2); |
|
292 | + remove_filter('acf_the_editor_content', 'wp_htmledit_pre', 10, 1); |
|
293 | + remove_filter('acf_the_editor_content', 'wp_richedit_pre', 10, 1); |
|
294 | 294 | |
295 | 295 | |
296 | 296 | // WP 4.3 |
297 | - if( version_compare($wp_version, '4.3', '>=' ) ) { |
|
297 | + if (version_compare($wp_version, '4.3', '>=')) { |
|
298 | 298 | |
299 | - add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 ); |
|
299 | + add_filter('acf_the_editor_content', 'format_for_editor', 10, 2); |
|
300 | 300 | |
301 | - $button = 'data-wp-editor-id="' . $id . '"'; |
|
301 | + $button = 'data-wp-editor-id="'.$id.'"'; |
|
302 | 302 | |
303 | 303 | // WP < 4.3 |
304 | 304 | } else { |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | |
314 | 314 | |
315 | 315 | // filter |
316 | - $field['value'] = apply_filters( 'acf_the_editor_content', $field['value'], $default_editor ); |
|
316 | + $field['value'] = apply_filters('acf_the_editor_content', $field['value'], $default_editor); |
|
317 | 317 | |
318 | 318 | ?> |
319 | 319 | <div id="wp-<?php echo $id; ?>-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php echo $switch_class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>"> |
320 | 320 | <div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js"> |
321 | - <?php if( $field['media_upload'] ): ?> |
|
321 | + <?php if ($field['media_upload']): ?> |
|
322 | 322 | <div id="wp-<?php echo $id; ?>-media-buttons" class="wp-media-buttons"> |
323 | - <?php do_action( 'media_buttons', $id ); ?> |
|
323 | + <?php do_action('media_buttons', $id); ?> |
|
324 | 324 | </div> |
325 | 325 | <?php endif; ?> |
326 | - <?php if( user_can_richedit() && $show_tabs ): ?> |
|
326 | + <?php if (user_can_richedit() && $show_tabs): ?> |
|
327 | 327 | <div class="wp-editor-tabs"> |
328 | 328 | <button id="<?php echo $id; ?>-tmce" class="wp-switch-editor switch-tmce" <?php echo $button; ?> type="button"><?php echo __('Visual', 'acf'); ?></button> |
329 | - <button id="<?php echo $id; ?>-html" class="wp-switch-editor switch-html" <?php echo $button; ?> type="button"><?php echo _x( 'Text', 'Name for the Text editor tab (formerly HTML)', 'acf' ); ?></button> |
|
329 | + <button id="<?php echo $id; ?>-html" class="wp-switch-editor switch-html" <?php echo $button; ?> type="button"><?php echo _x('Text', 'Name for the Text editor tab (formerly HTML)', 'acf'); ?></button> |
|
330 | 330 | </div> |
331 | 331 | <?php endif; ?> |
332 | 332 | </div> |
333 | 333 | <div id="wp-<?php echo $id; ?>-editor-container" class="wp-editor-container"> |
334 | - <textarea id="<?php echo $id; ?>" class="wp-editor-area" name="<?php echo $field['name']; ?>" <?php if($height): ?>style="height:<?php echo $height; ?>px;"<?php endif; ?>><?php echo $field['value']; ?></textarea> |
|
334 | + <textarea id="<?php echo $id; ?>" class="wp-editor-area" name="<?php echo $field['name']; ?>" <?php if ($height): ?>style="height:<?php echo $height; ?>px;"<?php endif; ?>><?php echo $field['value']; ?></textarea> |
|
335 | 335 | </div> |
336 | 336 | </div> |
337 | 337 | <?php |
@@ -352,51 +352,51 @@ discard block |
||
352 | 352 | * @param $field - an array holding all the field's data |
353 | 353 | */ |
354 | 354 | |
355 | - function render_field_settings( $field ) { |
|
355 | + function render_field_settings($field) { |
|
356 | 356 | |
357 | 357 | // vars |
358 | 358 | $toolbars = $this->get_toolbars(); |
359 | 359 | $choices = array(); |
360 | 360 | |
361 | - if( !empty($toolbars) ) { |
|
361 | + if ( ! empty($toolbars)) { |
|
362 | 362 | |
363 | - foreach( $toolbars as $k => $v ) { |
|
363 | + foreach ($toolbars as $k => $v) { |
|
364 | 364 | |
365 | 365 | $label = $k; |
366 | - $name = sanitize_title( $label ); |
|
366 | + $name = sanitize_title($label); |
|
367 | 367 | $name = str_replace('-', '_', $name); |
368 | 368 | |
369 | - $choices[ $name ] = $label; |
|
369 | + $choices[$name] = $label; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | 373 | |
374 | 374 | // default_value |
375 | - acf_render_field_setting( $field, array( |
|
376 | - 'label' => __('Default Value','acf'), |
|
377 | - 'instructions' => __('Appears when creating a new post','acf'), |
|
375 | + acf_render_field_setting($field, array( |
|
376 | + 'label' => __('Default Value', 'acf'), |
|
377 | + 'instructions' => __('Appears when creating a new post', 'acf'), |
|
378 | 378 | 'type' => 'textarea', |
379 | 379 | 'name' => 'default_value', |
380 | 380 | )); |
381 | 381 | |
382 | 382 | |
383 | 383 | // tabs |
384 | - acf_render_field_setting( $field, array( |
|
385 | - 'label' => __('Tabs','acf'), |
|
384 | + acf_render_field_setting($field, array( |
|
385 | + 'label' => __('Tabs', 'acf'), |
|
386 | 386 | 'instructions' => '', |
387 | 387 | 'type' => 'select', |
388 | 388 | 'name' => 'tabs', |
389 | 389 | 'choices' => array( |
390 | - 'all' => __("Visual & Text",'acf'), |
|
391 | - 'visual' => __("Visual Only",'acf'), |
|
392 | - 'text' => __("Text Only",'acf'), |
|
390 | + 'all' => __("Visual & Text", 'acf'), |
|
391 | + 'visual' => __("Visual Only", 'acf'), |
|
392 | + 'text' => __("Text Only", 'acf'), |
|
393 | 393 | ) |
394 | 394 | )); |
395 | 395 | |
396 | 396 | |
397 | 397 | // toolbar |
398 | - acf_render_field_setting( $field, array( |
|
399 | - 'label' => __('Toolbar','acf'), |
|
398 | + acf_render_field_setting($field, array( |
|
399 | + 'label' => __('Toolbar', 'acf'), |
|
400 | 400 | 'instructions' => '', |
401 | 401 | 'type' => 'select', |
402 | 402 | 'name' => 'toolbar', |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | |
406 | 406 | |
407 | 407 | // media_upload |
408 | - acf_render_field_setting( $field, array( |
|
409 | - 'label' => __('Show Media Upload Buttons?','acf'), |
|
408 | + acf_render_field_setting($field, array( |
|
409 | + 'label' => __('Show Media Upload Buttons?', 'acf'), |
|
410 | 410 | 'instructions' => '', |
411 | 411 | 'type' => 'radio', |
412 | 412 | 'name' => 'media_upload', |
413 | 413 | 'layout' => 'horizontal', |
414 | 414 | 'choices' => array( |
415 | - 1 => __("Yes",'acf'), |
|
416 | - 0 => __("No",'acf'), |
|
415 | + 1 => __("Yes", 'acf'), |
|
416 | + 0 => __("No", 'acf'), |
|
417 | 417 | ) |
418 | 418 | )); |
419 | 419 | |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | * @return $value (mixed) the modified value |
437 | 437 | */ |
438 | 438 | |
439 | - function format_value( $value, $post_id, $field ) { |
|
439 | + function format_value($value, $post_id, $field) { |
|
440 | 440 | |
441 | 441 | // bail early if no value |
442 | - if( empty($value) ) { |
|
442 | + if (empty($value)) { |
|
443 | 443 | |
444 | 444 | return $value; |
445 | 445 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | |
448 | 448 | |
449 | 449 | // apply filters |
450 | - $value = apply_filters( 'acf_the_content', $value ); |
|
450 | + $value = apply_filters('acf_the_content', $value); |
|
451 | 451 | |
452 | 452 | |
453 | 453 | // follow the_content function in /wp-includes/post-template.php |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Forms |
11 | 11 | */ |
12 | 12 | |
13 | -if( ! class_exists('acf_form_attachment') ) : |
|
13 | +if ( ! class_exists('acf_form_attachment')) : |
|
14 | 14 | |
15 | 15 | class acf_form_attachment { |
16 | 16 | |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | function __construct() { |
32 | 32 | |
33 | 33 | // actions |
34 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | // render |
38 | - add_filter('attachment_fields_to_edit', array($this, 'edit_attachment'), 10, 2); |
|
38 | + add_filter('attachment_fields_to_edit', array($this, 'edit_attachment'), 10, 2); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // save |
42 | - add_filter('attachment_fields_to_save', array($this, 'save_attachment'), 10, 2); |
|
42 | + add_filter('attachment_fields_to_save', array($this, 'save_attachment'), 10, 2); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | // validate page |
67 | - if( $pagenow === 'post.php' && $typenow === 'attachment' ) { |
|
67 | + if ($pagenow === 'post.php' && $typenow === 'attachment') { |
|
68 | 68 | |
69 | 69 | return true; |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | |
74 | 74 | // validate page |
75 | - if( $pagenow === 'upload.php' && version_compare($wp_version, '4.0', '>=') ) { |
|
75 | + if ($pagenow === 'upload.php' && version_compare($wp_version, '4.0', '>=')) { |
|
76 | 76 | |
77 | 77 | add_action('admin_footer', array($this, 'admin_footer'), 0); |
78 | 78 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | function admin_enqueue_scripts() { |
104 | 104 | |
105 | 105 | // bail early if not valid page |
106 | - if( !$this->validate_page() ) { |
|
106 | + if ( ! $this->validate_page()) { |
|
107 | 107 | |
108 | 108 | return; |
109 | 109 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @return $post_id (int) |
155 | 155 | */ |
156 | 156 | |
157 | - function edit_attachment( $form_fields, $post ) { |
|
157 | + function edit_attachment($form_fields, $post) { |
|
158 | 158 | |
159 | 159 | // vars |
160 | 160 | $el = 'tr'; |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | |
166 | 166 | |
167 | 167 | // $el |
168 | - if( $this->validate_page() ) { |
|
168 | + if ($this->validate_page()) { |
|
169 | 169 | |
170 | 170 | //$el = 'div'; |
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | 174 | // get field groups |
175 | - $field_groups = acf_get_field_groups( $args ); |
|
175 | + $field_groups = acf_get_field_groups($args); |
|
176 | 176 | |
177 | 177 | |
178 | 178 | // render |
179 | - if( !empty($field_groups) ) { |
|
179 | + if ( ! empty($field_groups)) { |
|
180 | 180 | |
181 | 181 | // get acf_form_data |
182 | 182 | ob_start(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | )); |
189 | 189 | |
190 | 190 | |
191 | - if( $this->validate_page() ) { |
|
191 | + if ($this->validate_page()) { |
|
192 | 192 | |
193 | 193 | echo '<style type="text/css"> |
194 | 194 | .compat-attachment-fields, |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | //} |
224 | 224 | |
225 | 225 | |
226 | - foreach( $field_groups as $field_group ) { |
|
226 | + foreach ($field_groups as $field_group) { |
|
227 | 227 | |
228 | - $fields = acf_get_fields( $field_group ); |
|
228 | + $fields = acf_get_fields($field_group); |
|
229 | 229 | |
230 | - acf_render_fields( $post_id, $fields, $el, 'field' ); |
|
230 | + acf_render_fields($post_id, $fields, $el, 'field'); |
|
231 | 231 | |
232 | 232 | } |
233 | 233 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | ob_end_clean(); |
247 | 247 | |
248 | 248 | |
249 | - $form_fields[ 'acf-form-data' ] = array( |
|
249 | + $form_fields['acf-form-data'] = array( |
|
250 | 250 | 'label' => '', |
251 | 251 | 'input' => 'html', |
252 | 252 | 'html' => $html |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | * @return $post_id (int) |
275 | 275 | */ |
276 | 276 | |
277 | - function save_attachment( $post, $attachment ) { |
|
277 | + function save_attachment($post, $attachment) { |
|
278 | 278 | |
279 | 279 | // bail early if not valid nonce |
280 | - if( ! acf_verify_nonce('attachment') ) { |
|
280 | + if ( ! acf_verify_nonce('attachment')) { |
|
281 | 281 | |
282 | 282 | return $post; |
283 | 283 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | |
287 | 287 | // validate and save |
288 | - if( acf_validate_save_post(true) ) { |
|
288 | + if (acf_validate_save_post(true)) { |
|
289 | 289 | |
290 | - acf_save_post( $post['ID'] ); |
|
290 | + acf_save_post($post['ID']); |
|
291 | 291 | |
292 | 292 | } |
293 | 293 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Forms |
11 | 11 | */ |
12 | 12 | |
13 | -if( ! class_exists('acf_form_comment') ) : |
|
13 | +if ( ! class_exists('acf_form_comment')) : |
|
14 | 14 | |
15 | 15 | class acf_form_comment { |
16 | 16 | |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | function __construct() { |
32 | 32 | |
33 | 33 | // actions |
34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | // render |
38 | - add_action( 'comment_form_logged_in_after', array( $this, 'add_comment') ); |
|
39 | - add_action( 'comment_form_after_fields', array( $this, 'add_comment') ); |
|
38 | + add_action('comment_form_logged_in_after', array($this, 'add_comment')); |
|
39 | + add_action('comment_form_after_fields', array($this, 'add_comment')); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | // save |
43 | - add_action( 'edit_comment', array( $this, 'save_comment' ), 10, 1 ); |
|
44 | - add_action( 'comment_post', array( $this, 'save_comment' ), 10, 1 ); |
|
43 | + add_action('edit_comment', array($this, 'save_comment'), 10, 1); |
|
44 | + add_action('comment_post', array($this, 'save_comment'), 10, 1); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | // validate page |
69 | - if( $pagenow == 'comment.php' ) { |
|
69 | + if ($pagenow == 'comment.php') { |
|
70 | 70 | |
71 | 71 | return true; |
72 | 72 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | function admin_enqueue_scripts() { |
96 | 96 | |
97 | 97 | // validate page |
98 | - if( ! $this->validate_page() ) { |
|
98 | + if ( ! $this->validate_page()) { |
|
99 | 99 | |
100 | 100 | return; |
101 | 101 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | |
109 | 109 | // actions |
110 | - add_action('admin_footer', array($this, 'admin_footer'), 10, 1); |
|
111 | - add_action('add_meta_boxes_comment', array($this, 'edit_comment'), 10, 1); |
|
110 | + add_action('admin_footer', array($this, 'admin_footer'), 10, 1); |
|
111 | + add_action('add_meta_boxes_comment', array($this, 'edit_comment'), 10, 1); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return n/a |
127 | 127 | */ |
128 | 128 | |
129 | - function edit_comment( $comment ) { |
|
129 | + function edit_comment($comment) { |
|
130 | 130 | |
131 | 131 | // vars |
132 | 132 | $post_id = "comment_{$comment->comment_ID}"; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | |
141 | 141 | // render |
142 | - if( !empty($field_groups) ) { |
|
142 | + if ( ! empty($field_groups)) { |
|
143 | 143 | |
144 | 144 | // render post data |
145 | 145 | acf_form_data(array( |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | )); |
149 | 149 | |
150 | 150 | |
151 | - foreach( $field_groups as $field_group ) { |
|
151 | + foreach ($field_groups as $field_group) { |
|
152 | 152 | |
153 | 153 | // load fields |
154 | - $fields = acf_get_fields( $field_group ); |
|
154 | + $fields = acf_get_fields($field_group); |
|
155 | 155 | |
156 | 156 | |
157 | 157 | // vars |
158 | 158 | $o = array( |
159 | - 'id' => 'acf-' . $field_group['ID'], |
|
159 | + 'id' => 'acf-'.$field_group['ID'], |
|
160 | 160 | 'key' => $field_group['key'], |
161 | 161 | 'label' => $field_group['label_placement'] |
162 | 162 | ); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div id="acf-<?php echo $field_group['ID']; ?>" class="stuffbox"> |
166 | 166 | <h3 class="hndle"><?php echo $field_group['title']; ?></h3> |
167 | 167 | <div class="inside"> |
168 | - <?php acf_render_fields( $post_id, $fields, 'div', $field_group['instruction_placement'] ); ?> |
|
168 | + <?php acf_render_fields($post_id, $fields, 'div', $field_group['instruction_placement']); ?> |
|
169 | 169 | <script type="text/javascript"> |
170 | 170 | if( typeof acf !== 'undefined' ) { |
171 | 171 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | )); |
210 | 210 | |
211 | 211 | |
212 | - if( !empty($field_groups) ) { |
|
212 | + if ( ! empty($field_groups)) { |
|
213 | 213 | |
214 | 214 | // render post data |
215 | 215 | acf_form_data(array( |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | )); |
219 | 219 | |
220 | 220 | |
221 | - foreach( $field_groups as $field_group ) { |
|
221 | + foreach ($field_groups as $field_group) { |
|
222 | 222 | |
223 | - $fields = acf_get_fields( $field_group ); |
|
223 | + $fields = acf_get_fields($field_group); |
|
224 | 224 | |
225 | 225 | ?> |
226 | 226 | <div class="acf-fields -<?php echo $field_group['label_placement']; ?>"> |
227 | - <?php acf_render_fields( $post_id, $fields, 'div', $field_group['instruction_placement'] ); ?> |
|
227 | + <?php acf_render_fields($post_id, $fields, 'div', $field_group['instruction_placement']); ?> |
|
228 | 228 | </div> |
229 | 229 | <?php |
230 | 230 | |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | * @return n/a |
249 | 249 | */ |
250 | 250 | |
251 | - function save_comment( $comment_id ) { |
|
251 | + function save_comment($comment_id) { |
|
252 | 252 | |
253 | 253 | // bail early if not valid nonce |
254 | - if( ! acf_verify_nonce('comment') ) { |
|
254 | + if ( ! acf_verify_nonce('comment')) { |
|
255 | 255 | |
256 | 256 | return $comment_id; |
257 | 257 | |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | |
260 | 260 | |
261 | 261 | // validate and save |
262 | - if( acf_validate_save_post(true) ) { |
|
262 | + if (acf_validate_save_post(true)) { |
|
263 | 263 | |
264 | - acf_save_post( "comment_{$comment_id}" ); |
|
264 | + acf_save_post("comment_{$comment_id}"); |
|
265 | 265 | |
266 | 266 | } |
267 | 267 |