@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $format = '(?:\.(?P<format>html|json))?'; |
134 | 134 | |
135 | - register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array( |
|
135 | + register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array( |
|
136 | 136 | array( |
137 | 137 | 'methods' => \WP_REST_Server::READABLE, |
138 | 138 | 'callback' => array( $this, 'get_sub_item' ), |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @return \WP_REST_Response |
383 | 383 | */ |
384 | 384 | protected function not_implemented() { |
385 | - $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
385 | + $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
386 | 386 | return new \WP_REST_Response( $error, 501 ); |
387 | 387 | } |
388 | 388 |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
29 | 29 | |
30 | - if( 'edit' === $context ) { |
|
30 | + if ( 'edit' === $context ) { |
|
31 | 31 | return $field_options; |
32 | 32 | } |
33 | 33 | |
34 | - $field_options['trim_words'] = array( |
|
34 | + $field_options[ 'trim_words' ] = array( |
|
35 | 35 | 'type' => 'number', |
36 | 36 | 'merge_tags' => false, |
37 | 37 | 'value' => null, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
40 | 40 | ); |
41 | 41 | |
42 | - $field_options['make_clickable'] = array( |
|
42 | + $field_options[ 'make_clickable' ] = array( |
|
43 | 43 | 'type' => 'checkbox', |
44 | 44 | 'merge_tags' => false, |
45 | 45 | 'value' => 0, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ), |
48 | 48 | ); |
49 | 49 | |
50 | - $field_options['allow_html'] = array( |
|
50 | + $field_options[ 'allow_html' ] = array( |
|
51 | 51 | 'type' => 'checkbox', |
52 | 52 | 'merge_tags' => false, |
53 | 53 | 'value' => 1, |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * number input type |
4 | 4 | */ |
5 | 5 | |
6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
6 | +if ( ! class_exists( 'GravityView_FieldType_text' ) ) { |
|
7 | 7 | include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
8 | 8 | } |
9 | 9 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $show_mt = $this->show_merge_tags(); |
22 | 22 | |
23 | - if ( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
23 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
24 | 24 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
25 | 25 | } |
26 | 26 | |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | $step = \GV\Utils::get( $this->field, 'step', null ); |
32 | 32 | |
33 | 33 | $atts = ''; |
34 | - $atts .= $max ? ' max="' . (int) $max . '"' : ''; |
|
35 | - $atts .= $min ? ' min="' . (int) $min . '"' : ''; |
|
36 | - $atts .= $step ? ' step="' . (int) $step . '"' : ''; |
|
34 | + $atts .= $max ? ' max="' . (int)$max . '"' : ''; |
|
35 | + $atts .= $min ? ' min="' . (int)$min . '"' : ''; |
|
36 | + $atts .= $step ? ' step="' . (int)$step . '"' : ''; |
|
37 | 37 | ?> |
38 | 38 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" |
39 | 39 | value="<?php echo esc_attr( $this->value ); ?>" |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $partial_entries_addon = GF_Partial_Entries::get_instance(); |
55 | 55 | |
56 | - $feed_settings = $partial_entries_addon->get_feed_settings( $form['id'] ); |
|
56 | + $feed_settings = $partial_entries_addon->get_feed_settings( $form[ 'id' ] ); |
|
57 | 57 | |
58 | 58 | $is_enabled = \GV\Utils::get( $feed_settings, 'enable', 0 ); |
59 | 59 | |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | $partial_entry_id = \GV\Utils::get( $entry, 'partial_entry_id' ); |
67 | 67 | |
68 | 68 | // Set the expected $_POST key for the Add-On to use |
69 | - $_POST['partial_entry_id'] = $partial_entry_id; |
|
69 | + $_POST[ 'partial_entry_id' ] = $partial_entry_id; |
|
70 | 70 | |
71 | 71 | gravityview()->log->debug( 'Saving partial entry (ID #{partial_entry_id}) for Entry #{entry_id}', array( |
72 | 72 | 'partial_entry_id' => $partial_entry_id, |
73 | 73 | 'entry_id' => $entry_id |
74 | 74 | ) ); |
75 | 75 | |
76 | - $partial_entries_addon->maybe_save_partial_entry( $form['id'] ); |
|
76 | + $partial_entries_addon->maybe_save_partial_entry( $form[ 'id' ] ); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | $form = false; |
127 | 127 | |
128 | - if( $entry ) { |
|
129 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
128 | + if ( $entry ) { |
|
129 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $form; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | - return (bool) $has_transaction_data; |
|
205 | + return (bool)$has_transaction_data; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
242 | 242 | |
243 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
243 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
244 | 244 | |
245 | 245 | return $result; |
246 | 246 | } |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
262 | 262 | */ |
263 | - public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) { |
|
263 | + public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) { |
|
264 | 264 | $forms = array(); |
265 | 265 | if ( ! class_exists( 'GFAPI' ) ) { |
266 | 266 | return array(); |
267 | 267 | } |
268 | 268 | |
269 | - if( 'any' === $active ) { |
|
269 | + if ( 'any' === $active ) { |
|
270 | 270 | $active_forms = GFAPI::get_forms( true, $trash ); |
271 | 271 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
272 | 272 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | $has_post_fields = false; |
300 | 300 | |
301 | 301 | if ( $form ) { |
302 | - foreach ( $form['fields'] as $field ) { |
|
303 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
304 | - $fields["{$field['id']}"] = array( |
|
302 | + foreach ( $form[ 'fields' ] as $field ) { |
|
303 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
304 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
305 | 305 | 'label' => \GV\Utils::get( $field, 'label' ), |
306 | 306 | 'parent' => null, |
307 | 307 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | ); |
311 | 311 | } |
312 | 312 | |
313 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
314 | - foreach ( $field['inputs'] as $input ) { |
|
313 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
314 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
315 | 315 | |
316 | - if( ! empty( $input['isHidden'] ) ) { |
|
316 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | 319 | |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | * @hack |
322 | 322 | * In case of email/email confirmation, the input for email has the same id as the parent field |
323 | 323 | */ |
324 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
324 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
325 | 325 | continue; |
326 | 326 | } |
327 | - $fields["{$input['id']}"] = array( |
|
327 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
328 | 328 | 'label' => \GV\Utils::get( $input, 'label' ), |
329 | 329 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
330 | 330 | 'parent' => $field, |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | |
339 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
339 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
340 | 340 | $has_product_fields = true; |
341 | 341 | } |
342 | 342 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @since 1.7 |
351 | 351 | */ |
352 | 352 | if ( $has_post_fields ) { |
353 | - $fields['post_id'] = array( |
|
353 | + $fields[ 'post_id' ] = array( |
|
354 | 354 | 'label' => __( 'Post ID', 'gravityview' ), |
355 | 355 | 'type' => 'post_id', |
356 | 356 | ); |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | foreach ( $payment_fields as $payment_field ) { |
364 | 364 | |
365 | 365 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
366 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
366 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
370 | - $fields["{$payment_field->name}"] = array( |
|
370 | + $fields[ "{$payment_field->name}" ] = array( |
|
371 | 371 | 'label' => $payment_field->label, |
372 | 372 | 'desc' => $payment_field->description, |
373 | 373 | 'type' => $payment_field->name, |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | |
400 | 400 | $fields = array(); |
401 | 401 | |
402 | - foreach ( $extra_fields as $key => $field ){ |
|
403 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
404 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
402 | + foreach ( $extra_fields as $key => $field ) { |
|
403 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
404 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -441,33 +441,33 @@ discard block |
||
441 | 441 | 'search_criteria' => null, |
442 | 442 | 'sorting' => null, |
443 | 443 | 'paging' => null, |
444 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
444 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
445 | 445 | 'context_view_id' => null, |
446 | 446 | ); |
447 | 447 | |
448 | 448 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
449 | 449 | |
450 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
451 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
450 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
451 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
452 | 452 | |
453 | 453 | if ( ! is_array( $filter ) ) { |
454 | 454 | continue; |
455 | 455 | } |
456 | 456 | |
457 | 457 | // By default, we want searches to be wildcard for each field. |
458 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
458 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
459 | 459 | |
460 | 460 | /** |
461 | 461 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
462 | 462 | * @param string $operator Existing search operator |
463 | 463 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
464 | 464 | */ |
465 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
465 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | // don't send just the [mode] without any field filter. |
469 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
470 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
469 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
470 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | } |
@@ -478,33 +478,33 @@ discard block |
||
478 | 478 | * Prepare date formats to be in Gravity Forms DB format; |
479 | 479 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
480 | 480 | */ |
481 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
481 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
482 | 482 | |
483 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
483 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
484 | 484 | |
485 | 485 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
486 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
486 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
487 | 487 | |
488 | 488 | if ( $date ) { |
489 | 489 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
490 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
490 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
491 | 491 | } else { |
492 | - gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) ); |
|
492 | + gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) ); |
|
493 | 493 | |
494 | 494 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
495 | - unset( $criteria['search_criteria'][ $key ] ); |
|
495 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
500 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
501 | 501 | // Calculate the context view id and send it to the advanced filter |
502 | 502 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
503 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
503 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
504 | 504 | } else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
505 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
505 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
506 | 506 | } else if ( 'delete' === GFForms::get( 'action' ) ) { |
507 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
507 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param array $form_ids Forms to search |
515 | 515 | * @param int $view_id ID of the view being used to search |
516 | 516 | */ |
517 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
517 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
518 | 518 | |
519 | 519 | return (array)$criteria; |
520 | 520 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | /** Reduce # of database calls */ |
550 | 550 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
551 | 551 | |
552 | - if ( ! empty( $criteria['cache'] ) ) { |
|
552 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
553 | 553 | |
554 | 554 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
555 | 555 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // Still update the total count when using cached results |
559 | 559 | if ( ! is_null( $total ) ) { |
560 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
560 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | $return = $entries; |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | $entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) ); |
580 | 580 | |
581 | 581 | // No entries returned from gravityview_before_get_entries |
582 | - if( is_null( $entries ) ) { |
|
582 | + if ( is_null( $entries ) ) { |
|
583 | 583 | |
584 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
584 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
585 | 585 | |
586 | 586 | if ( is_wp_error( $entries ) ) { |
587 | 587 | gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) ); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
595 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
596 | 596 | |
597 | 597 | // Cache results |
598 | 598 | $Cache->set( $entries, 'entries' ); |
@@ -706,18 +706,18 @@ discard block |
||
706 | 706 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view ); |
707 | 707 | |
708 | 708 | // Is the entry allowed |
709 | - if( $check_entry_display ) { |
|
709 | + if ( $check_entry_display ) { |
|
710 | 710 | |
711 | 711 | $gvid = \GV\Utils::_GET( 'gvid' ); |
712 | 712 | |
713 | - if( $gvid ) { |
|
713 | + if ( $gvid ) { |
|
714 | 714 | $view = \GV\View::by_id( $gvid ); |
715 | 715 | } |
716 | 716 | |
717 | 717 | $entry = self::check_entry_display( $entry, $view ); |
718 | 718 | } |
719 | 719 | |
720 | - if( is_wp_error( $entry ) ) { |
|
720 | + if ( is_wp_error( $entry ) ) { |
|
721 | 721 | gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); |
722 | 722 | return false; |
723 | 723 | } |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | |
752 | 752 | $value = false; |
753 | 753 | |
754 | - if( 'context' === $val1 ) { |
|
754 | + if ( 'context' === $val1 ) { |
|
755 | 755 | |
756 | 756 | $matching_contexts = array( $val2 ); |
757 | 757 | |
758 | 758 | // We allow for non-standard contexts. |
759 | - switch( $val2 ) { |
|
759 | + switch ( $val2 ) { |
|
760 | 760 | // Check for either single or edit |
761 | 761 | case 'singular': |
762 | 762 | $matching_contexts = array( 'single', 'edit' ); |
@@ -799,18 +799,18 @@ discard block |
||
799 | 799 | $json_val_1 = json_decode( $val1, true ); |
800 | 800 | $json_val_2 = json_decode( $val2, true ); |
801 | 801 | |
802 | - if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
802 | + if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
803 | 803 | |
804 | 804 | $json_in = false; |
805 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
806 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
805 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
806 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
807 | 807 | |
808 | 808 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
809 | 809 | foreach ( $json_val_1 as $item_1 ) { |
810 | 810 | foreach ( $json_val_2 as $item_2 ) { |
811 | 811 | $json_in = self::matches_operation( $item_1, $item_2, 'is' ); |
812 | 812 | |
813 | - if( $json_in ) { |
|
813 | + if ( $json_in ) { |
|
814 | 814 | break 2; |
815 | 815 | } |
816 | 816 | } |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | public static function check_entry_display( $entry, $view = null ) { |
862 | 862 | |
863 | 863 | if ( ! $entry || is_wp_error( $entry ) ) { |
864 | - return new WP_Error('entry_not_found', 'Entry was not found.', $entry ); |
|
864 | + return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
|
865 | 865 | } |
866 | 866 | |
867 | - if ( empty( $entry['form_id'] ) ) { |
|
867 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
868 | 868 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
869 | 869 | } |
870 | 870 | |
@@ -879,19 +879,19 @@ discard block |
||
879 | 879 | |
880 | 880 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
881 | 881 | |
882 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
882 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
883 | 883 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
884 | 884 | } |
885 | 885 | |
886 | 886 | $view_form_id = $view->form->ID; |
887 | 887 | |
888 | 888 | if ( $view->joins ) { |
889 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
890 | - $view_form_id = $entry['form_id']; |
|
889 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
890 | + $view_form_id = $entry[ 'form_id' ]; |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
894 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
894 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
895 | 895 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
896 | 896 | } |
897 | 897 | |
@@ -899,13 +899,13 @@ discard block |
||
899 | 899 | * Check whether the entry is in the entries subset by running a modified query. |
900 | 900 | */ |
901 | 901 | add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) { |
902 | - $_tmp_query = new \GF_Query( $view_form_id, array( |
|
902 | + $_tmp_query = new \GF_Query( $view_form_id, array( |
|
903 | 903 | 'field_filters' => array( |
904 | 904 | 'mode' => 'all', |
905 | 905 | array( |
906 | 906 | 'key' => 'id', |
907 | 907 | 'operation' => 'is', |
908 | - 'value' => $entry['id'] |
|
908 | + 'value' => $entry[ 'id' ] |
|
909 | 909 | ) |
910 | 910 | ) |
911 | 911 | ) ); |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | /** @var \GF_Query $query */ |
916 | 916 | $query_parts = $query->_introspect(); |
917 | 917 | |
918 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
918 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
919 | 919 | |
920 | 920 | }, 10, 3 ); |
921 | 921 | |
922 | 922 | // Prevent page offset from being applied to the single entry query; it's used to return to the referring page number |
923 | 923 | add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) { |
924 | 924 | |
925 | - $criteria['paging'] = array( |
|
925 | + $criteria[ 'paging' ] = array( |
|
926 | 926 | 'offset' => 0, |
927 | 927 | 'page_size' => 25 |
928 | 928 | ); |
@@ -941,20 +941,20 @@ discard block |
||
941 | 941 | } |
942 | 942 | |
943 | 943 | // This entry is on a View with joins |
944 | - if ( $entries[0]->is_multi() ) { |
|
944 | + if ( $entries[ 0 ]->is_multi() ) { |
|
945 | 945 | |
946 | 946 | $multi_entry_ids = array(); |
947 | 947 | |
948 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
949 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
948 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
949 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
950 | 950 | } |
951 | 951 | |
952 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
952 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
953 | 953 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
954 | 954 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
955 | 955 | } |
956 | 956 | |
957 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
957 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
958 | 958 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
959 | 959 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
960 | 960 | } |
@@ -999,18 +999,18 @@ discard block |
||
999 | 999 | * Gravity Forms code to adjust date to locally-configured Time Zone |
1000 | 1000 | * @see GFCommon::format_date() for original code |
1001 | 1001 | */ |
1002 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1002 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1003 | 1003 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1004 | 1004 | |
1005 | - $format = \GV\Utils::get( $atts, 'format' ); |
|
1006 | - $is_human = ! empty( $atts['human'] ); |
|
1007 | - $is_diff = ! empty( $atts['diff'] ); |
|
1008 | - $is_raw = ! empty( $atts['raw'] ); |
|
1009 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1010 | - $include_time = ! empty( $atts['time'] ); |
|
1005 | + $format = \GV\Utils::get( $atts, 'format' ); |
|
1006 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1007 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1008 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1009 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1010 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1011 | 1011 | |
1012 | 1012 | // If we're using time diff, we want to have a different default format |
1013 | - if( empty( $format ) ) { |
|
1013 | + if ( empty( $format ) ) { |
|
1014 | 1014 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
1015 | 1015 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
1016 | 1016 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | // If raw was specified, don't modify the stored value |
1019 | 1019 | if ( $is_raw ) { |
1020 | 1020 | $formatted_date = $date_string; |
1021 | - } elseif( $is_timestamp ) { |
|
1021 | + } elseif ( $is_timestamp ) { |
|
1022 | 1022 | $formatted_date = $date_local_timestamp; |
1023 | 1023 | } elseif ( $is_diff ) { |
1024 | 1024 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | $label = \GV\Utils::get( $field, 'label' ); |
1054 | 1054 | |
1055 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1055 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1056 | 1056 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
1057 | 1057 | } |
1058 | 1058 | |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | $form = GFAPI::get_form( $form ); |
1081 | 1081 | } |
1082 | 1082 | |
1083 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
1083 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
1084 | 1084 | return GFFormsModel::get_field( $form, $field_id ); |
1085 | 1085 | } else { |
1086 | 1086 | return null; |
@@ -1127,19 +1127,19 @@ discard block |
||
1127 | 1127 | $shortcodes = array(); |
1128 | 1128 | |
1129 | 1129 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1130 | - if ( empty( $matches ) ){ |
|
1130 | + if ( empty( $matches ) ) { |
|
1131 | 1131 | return false; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | foreach ( $matches as $shortcode ) { |
1135 | - if ( $tag === $shortcode[2] ) { |
|
1135 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1136 | 1136 | |
1137 | 1137 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1138 | - $shortcodes[] = $shortcode; |
|
1138 | + $shortcodes[ ] = $shortcode; |
|
1139 | 1139 | |
1140 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1141 | - foreach( $results as $result ) { |
|
1142 | - $shortcodes[] = $result; |
|
1140 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1141 | + foreach ( $results as $result ) { |
|
1142 | + $shortcodes[ ] = $result; |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | 'post_type' => 'gravityview', |
1172 | 1172 | 'posts_per_page' => 100, |
1173 | 1173 | 'meta_key' => '_gravityview_form_id', |
1174 | - 'meta_value' => (int) $form_id, |
|
1174 | + 'meta_value' => (int)$form_id, |
|
1175 | 1175 | ); |
1176 | 1176 | $args = wp_parse_args( $args, $defaults ); |
1177 | 1177 | $views = get_posts( $args ); |
@@ -1183,21 +1183,21 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | $data = unserialize( $view->meta_value ); |
1185 | 1185 | |
1186 | - if( ! $data || ! is_array( $data ) ) { |
|
1186 | + if ( ! $data || ! is_array( $data ) ) { |
|
1187 | 1187 | continue; |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | foreach ( $data as $datum ) { |
1191 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1192 | - $joined_forms[] = $view->post_id; |
|
1191 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1192 | + $joined_forms[ ] = $view->post_id; |
|
1193 | 1193 | } |
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | if ( $joined_forms ) { |
1198 | - $joined_args = array( |
|
1198 | + $joined_args = array( |
|
1199 | 1199 | 'post_type' => 'gravityview', |
1200 | - 'posts_per_page' => $args['posts_per_page'], |
|
1200 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1201 | 1201 | 'post__in' => $joined_forms, |
1202 | 1202 | ); |
1203 | 1203 | $views = array_merge( $views, get_posts( $joined_args ) ); |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | |
1354 | 1354 | $directory_widgets = wp_parse_args( $view_widgets, $defaults ); |
1355 | 1355 | |
1356 | - if( $json_decode ) { |
|
1356 | + if ( $json_decode ) { |
|
1357 | 1357 | $directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' ); |
1358 | 1358 | } |
1359 | 1359 | |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | * @return string html |
1370 | 1370 | */ |
1371 | 1371 | public static function get_sortable_fields( $formid, $current = '' ) { |
1372 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1372 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1373 | 1373 | |
1374 | 1374 | if ( empty( $formid ) ) { |
1375 | 1375 | return $output; |
@@ -1382,11 +1382,11 @@ discard block |
||
1382 | 1382 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1383 | 1383 | |
1384 | 1384 | foreach ( $fields as $id => $field ) { |
1385 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1385 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1386 | 1386 | continue; |
1387 | 1387 | } |
1388 | 1388 | |
1389 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1389 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1390 | 1390 | } |
1391 | 1391 | } |
1392 | 1392 | |
@@ -1421,16 +1421,16 @@ discard block |
||
1421 | 1421 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1422 | 1422 | |
1423 | 1423 | // TODO: Convert to using array_filter |
1424 | - foreach( $fields as $id => $field ) { |
|
1424 | + foreach ( $fields as $id => $field ) { |
|
1425 | 1425 | |
1426 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1426 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1427 | 1427 | unset( $fields[ $id ] ); |
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | /** |
1431 | 1431 | * Merge date and time subfields. |
1432 | 1432 | */ |
1433 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1433 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1434 | 1434 | $fields[ intval( $id ) ] = array( |
1435 | 1435 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1436 | 1436 | 'parent' => null, |
@@ -1480,14 +1480,14 @@ discard block |
||
1480 | 1480 | * @param int|array $field field key or field array |
1481 | 1481 | * @return boolean |
1482 | 1482 | */ |
1483 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1483 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1484 | 1484 | |
1485 | 1485 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1486 | 1486 | $form = self::get_form( $form ); |
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | // If entry meta, it's a string. Otherwise, numeric |
1490 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1490 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1491 | 1491 | $type = $field; |
1492 | 1492 | } else { |
1493 | 1493 | $type = self::get_field_type( $form, $field ); |
@@ -1501,9 +1501,9 @@ discard block |
||
1501 | 1501 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1502 | 1502 | |
1503 | 1503 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1504 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1505 | - if( true === $gv_field->is_numeric ) { |
|
1506 | - $numeric_types[] = $gv_field->is_numeric; |
|
1504 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1505 | + if ( true === $gv_field->is_numeric ) { |
|
1506 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1653,18 +1653,18 @@ discard block |
||
1653 | 1653 | $final_atts = array_filter( $final_atts ); |
1654 | 1654 | |
1655 | 1655 | // If the href wasn't passed as an attribute, use the value passed to the function |
1656 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1657 | - $final_atts['href'] = $href; |
|
1656 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1657 | + $final_atts[ 'href' ] = $href; |
|
1658 | 1658 | } |
1659 | 1659 | |
1660 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1660 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1661 | 1661 | |
1662 | 1662 | /** |
1663 | 1663 | * Fix potential security issue with target=_blank |
1664 | 1664 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1665 | 1665 | */ |
1666 | - if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1667 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1666 | + if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1667 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | // Sort the attributes alphabetically, to help testing |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1677 | 1677 | } |
1678 | 1678 | |
1679 | - if( '' !== $output ) { |
|
1679 | + if ( '' !== $output ) { |
|
1680 | 1680 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1681 | 1681 | } |
1682 | 1682 | |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1704 | 1704 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1705 | 1705 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1706 | - $merged[] = $value; |
|
1706 | + $merged[ ] = $value; |
|
1707 | 1707 | } else { |
1708 | 1708 | $merged[ $key ] = $value; |
1709 | 1709 | } |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1737 | 1737 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1738 | 1738 | */ |
1739 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1739 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1740 | 1740 | |
1741 | 1741 | return get_users( $get_users_settings ); |
1742 | 1742 | } |
@@ -1756,11 +1756,11 @@ discard block |
||
1756 | 1756 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1757 | 1757 | |
1758 | 1758 | // If $cap is defined, only show notice if user has capability |
1759 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1759 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1760 | 1760 | return ''; |
1761 | 1761 | } |
1762 | 1762 | |
1763 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1763 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1764 | 1764 | } |
1765 | 1765 | |
1766 | 1766 | /** |
@@ -88,15 +88,15 @@ |
||
88 | 88 | */ |
89 | 89 | public function maybe_modify_button_label( $label = '', $atts = array() ) { |
90 | 90 | |
91 | - if( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
91 | + if ( $this->template_id !== \GV\Utils::get( $atts, 'template_id' ) ) { |
|
92 | 92 | return $label; |
93 | 93 | } |
94 | 94 | |
95 | - if( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
95 | + if ( 'field' !== \GV\Utils::get( $atts, 'type' ) ) { |
|
96 | 96 | return $label; |
97 | 97 | } |
98 | 98 | |
99 | - if( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
99 | + if ( 'edit' === \GV\Utils::get( $atts, 'zone' ) ) { |
|
100 | 100 | return $label; |
101 | 101 | } |
102 | 102 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | |
65 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
66 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
65 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
66 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
67 | 67 | $form = GravityView_View::getInstance()->getForm(); |
68 | 68 | |
69 | 69 | /** @var GF_Field_Address $address_field */ |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $choices = array(); |
73 | 73 | |
74 | 74 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
75 | - if( method_exists( $this, $method_name ) ) { |
|
75 | + if ( method_exists( $this, $method_name ) ) { |
|
76 | 76 | /** |
77 | 77 | * @uses GravityView_Field_Address::get_choices_country() |
78 | 78 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $choices = $this->{$method_name}( $address_field, $form ); |
81 | 81 | } |
82 | 82 | |
83 | - if( ! empty( $choices ) ) { |
|
84 | - $search_field['choices'] = $choices; |
|
85 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
83 | + if ( ! empty( $choices ) ) { |
|
84 | + $search_field[ 'choices' ] = $choices; |
|
85 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
86 | 86 | } else { |
87 | - $search_field['type'] = 'text'; |
|
88 | - $search_field['input'] = 'input_text'; |
|
87 | + $search_field[ 'type' ] = 'text'; |
|
88 | + $search_field[ 'input' ] = 'input_text'; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $country_choices = array(); |
111 | 111 | |
112 | 112 | foreach ( $countries as $key => $country ) { |
113 | - $country_choices[] = array( |
|
113 | + $country_choices[ ] = array( |
|
114 | 114 | 'value' => $country, |
115 | 115 | 'text' => $country, |
116 | 116 | ); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function get_choices_state( $address_field, $form ) { |
137 | 137 | |
138 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
138 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
139 | 139 | |
140 | 140 | $state_choices = array(); |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | $states = GFCommon::get_canadian_provinces(); |
148 | 148 | break; |
149 | 149 | default: |
150 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
151 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
150 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
151 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
152 | 152 | break; |
153 | 153 | } |
154 | 154 | |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | $state_subchoices = array(); |
158 | 158 | |
159 | 159 | foreach ( $state as $key => $substate ) { |
160 | - $state_subchoices[] = array( |
|
160 | + $state_subchoices[ ] = array( |
|
161 | 161 | 'value' => is_numeric( $key ) ? $substate : $key, |
162 | 162 | 'text' => $substate, |
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
166 | - $state_choices[] = array( |
|
166 | + $state_choices[ ] = array( |
|
167 | 167 | 'text' => $key, |
168 | 168 | 'value' => $state_subchoices, |
169 | 169 | ); |
170 | 170 | |
171 | 171 | } else { |
172 | - $state_choices[] = array( |
|
172 | + $state_choices[ ] = array( |
|
173 | 173 | 'value' => is_numeric( $key ) ? $state : $key, |
174 | 174 | 'text' => $state, |
175 | 175 | ); |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | // Use the same inputs as the "text" input type allows |
194 | 194 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
195 | 195 | |
196 | - $input_types['street'] = $text_inputs; |
|
197 | - $input_types['street2'] = $text_inputs; |
|
198 | - $input_types['city'] = $text_inputs; |
|
196 | + $input_types[ 'street' ] = $text_inputs; |
|
197 | + $input_types[ 'street2' ] = $text_inputs; |
|
198 | + $input_types[ 'city' ] = $text_inputs; |
|
199 | 199 | |
200 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
201 | - $input_types['zip'] = array( 'input_text' ); |
|
202 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
201 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
202 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
203 | 203 | |
204 | 204 | return $input_types; |
205 | 205 | } |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
221 | 221 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
222 | 222 | |
223 | - if( 'address' !== $field_type && $input_id ) { |
|
223 | + if ( 'address' !== $field_type && $input_id ) { |
|
224 | 224 | return $input_type; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
228 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
228 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
229 | 229 | $input_type = $address_field_name; |
230 | 230 | } |
231 | 231 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
274 | 274 | |
275 | 275 | // If this is NOT the full address field, return default options. |
276 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
276 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
277 | 277 | return $field_options; |
278 | 278 | } |
279 | 279 | |
280 | - if( 'edit' === $context ) { |
|
280 | + if ( 'edit' === $context ) { |
|
281 | 281 | return $field_options; |
282 | 282 | } |
283 | 283 | |
284 | 284 | $add_options = array(); |
285 | 285 | |
286 | - $add_options['show_map_link'] = array( |
|
286 | + $add_options[ 'show_map_link' ] = array( |
|
287 | 287 | 'type' => 'checkbox', |
288 | 288 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
289 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
289 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
290 | 290 | 'value' => true, |
291 | 291 | 'merge_tags' => false, |
292 | 292 | ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) { |
55 | 55 | |
56 | - if ( empty( $article['id'] ) ) { |
|
56 | + if ( empty( $article[ 'id' ] ) ) { |
|
57 | 57 | return $tooltip; |
58 | 58 | } |
59 | 59 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | $css_class .= ' gv_tooltip'; |
71 | 71 | |
72 | - if ( ! empty( $article['type'] ) ) { |
|
73 | - $atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] ); |
|
72 | + if ( ! empty( $article[ 'type' ] ) ) { |
|
73 | + $atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] ); |
|
74 | 74 | } else { |
75 | - $atts = sprintf( 'data-beacon-article="%s"', $article['id'] ); |
|
75 | + $atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $url = \GV\Utils::get( $article, 'url', '#' ); |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | ) ); |
172 | 172 | |
173 | 173 | // This is just HTML we don't need. |
174 | - unset( $response['message'] ); |
|
174 | + unset( $response[ 'message' ] ); |
|
175 | 175 | |
176 | - switch ( intval( $response['price_id'] ) ) { |
|
176 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
177 | 177 | default: |
178 | 178 | case 1: |
179 | 179 | $package = 'Core'; |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | 'email' => $current_user->user_email, |
200 | 200 | 'name' => mb_substr( $current_user->display_name, 0, 80 ), |
201 | 201 | 'signature' => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ), |
202 | - 'License Key' => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')', |
|
202 | + 'License Key' => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')', |
|
203 | 203 | 'License Level' => $package, |
204 | 204 | 'Alt Emails' => sprintf( "Admin: %s, GV Support: %s", get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ), |
205 | - 'Payment Details' => $response['customer_name'] . ' ' . $response['customer_email'], |
|
205 | + 'Payment Details' => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ], |
|
206 | 206 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
207 | - 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ), |
|
207 | + 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ), |
|
208 | 208 | 'No-Conflict Mode' => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled', |
209 | 209 | 'GravityView Version' => \GV\Plugin::$version, |
210 | 210 | 'Gravity Forms Version' => GFForms::$version, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ob_get_clean(); |
215 | 215 | |
216 | 216 | // Help Scout length limit is 200 characters |
217 | - foreach( $data as $key => $value ) { |
|
217 | + foreach ( $data as $key => $value ) { |
|
218 | 218 | if ( ! is_string( $value ) ) { |
219 | 219 | continue; |
220 | 220 | } |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
36 | + if ( ! empty( $field[ 'choices' ] ) ) { |
|
37 | + $field[ 'options' ] = $field[ 'choices' ]; |
|
38 | + unset( $field[ 'choices' ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | function get_tooltip() { |
82 | - if( ! function_exists('gform_tooltip') ) { |
|
82 | + if ( ! function_exists( 'gform_tooltip' ) ) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | 'url' => '#', |
90 | 90 | ) ); |
91 | 91 | |
92 | - return !empty( $this->field['tooltip'] ) ? ' '. $this->tooltip( $this->field['tooltip'], false, true, $article ) : null; |
|
92 | + return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . $this->tooltip( $this->field[ 'tooltip' ], false, true, $article ) : null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Below this line has been modified by GravityView. |
133 | 133 | */ |
134 | 134 | |
135 | - if ( empty( $tooltip_text ) && empty( $article['id'] ) ) { |
|
135 | + if ( empty( $tooltip_text ) && empty( $article[ 'id' ] ) ) { |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return string |
169 | 169 | */ |
170 | 170 | function get_field_id() { |
171 | - if( isset( $this->field['id'] ) ) { |
|
172 | - return esc_attr( $this->field['id'] ); |
|
171 | + if ( isset( $this->field[ 'id' ] ) ) { |
|
172 | + return esc_attr( $this->field[ 'id' ] ); |
|
173 | 173 | } |
174 | 174 | return esc_attr( sanitize_html_class( $this->name ) ); |
175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string |
180 | 180 | */ |
181 | 181 | function get_field_label() { |
182 | - return esc_html( trim( $this->field['label'] ) ); |
|
182 | + return esc_html( trim( $this->field[ 'label' ] ) ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | function get_field_left_label() { |
193 | - return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
193 | + return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | function get_label_class() { |
201 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
201 | + return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] ); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return string |
208 | 208 | */ |
209 | 209 | function get_field_desc() { |
210 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
210 | + return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : ''; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function render_setting( $override_input = NULL ) { |
242 | 242 | |
243 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
243 | + if ( ! empty( $this->field[ 'full_width' ] ) ) { ?> |
|
244 | 244 | <th scope="row" colspan="2"> |
245 | 245 | <div> |
246 | 246 | <label for="<?php echo $this->get_field_id(); ?>"> |