@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'type' => 'radio', |
65 | 65 | 'full_width' => true, |
66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
68 | 68 | 'value' => 'any', |
69 | 69 | 'class' => 'hide-if-js', |
70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
91 | 91 | |
92 | 92 | // ajax - get the searchable fields |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
228 | 228 | $script_source = empty( $script_min ) ? '/source' : ''; |
229 | 229 | |
230 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
230 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
231 | 231 | |
232 | 232 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
233 | 233 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
250 | 250 | */ |
251 | 251 | public function register_no_conflict( $allowed ) { |
252 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
252 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
253 | 253 | return $allowed; |
254 | 254 | } |
255 | 255 | |
@@ -262,24 +262,24 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public static function get_searchable_fields() { |
264 | 264 | |
265 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
265 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
266 | 266 | exit( '0' ); |
267 | 267 | } |
268 | 268 | |
269 | 269 | $form = ''; |
270 | 270 | |
271 | 271 | // Fetch the form for the current View |
272 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
272 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
273 | 273 | |
274 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
274 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
275 | 275 | |
276 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
276 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
277 | 277 | |
278 | - $form = (int) $_POST['formid']; |
|
278 | + $form = (int)$_POST[ 'formid' ]; |
|
279 | 279 | |
280 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
280 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
281 | 281 | |
282 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
282 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | ); |
330 | 330 | |
331 | 331 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
332 | - $custom_fields['is_approved'] = array( |
|
332 | + $custom_fields[ 'is_approved' ] = array( |
|
333 | 333 | 'text' => esc_html__( 'Approval Status', 'gravityview' ), |
334 | 334 | 'type' => 'multi', |
335 | 335 | ); |
336 | 336 | } |
337 | 337 | |
338 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
339 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
338 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
339 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // Get fields with sub-inputs and no parent |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | |
359 | 359 | foreach ( $fields as $id => $field ) { |
360 | 360 | |
361 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
361 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
362 | 362 | continue; |
363 | 363 | } |
364 | 364 | |
365 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
365 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
366 | 366 | |
367 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
367 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
388 | 388 | |
389 | 389 | // @todo - This needs to be improved - many fields have . including products and addresses |
390 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
390 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
391 | 391 | $input_type = 'boolean'; // on/off checkbox |
392 | 392 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
393 | 393 | $input_type = 'multi'; //multiselect |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | $post_id = 0; |
432 | 432 | |
433 | 433 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
434 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
435 | - $post_id = absint( $widget_args['post_id'] ); |
|
434 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
435 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
436 | 436 | } |
437 | 437 | // We're in the WordPress Widget context, and the base View ID should be used |
438 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
439 | - $post_id = absint( $widget_args['view_id'] ); |
|
438 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
439 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | $args = gravityview_get_permalink_query_args( $post_id ); |
443 | 443 | |
444 | 444 | // Add hidden fields to the search form |
445 | 445 | foreach ( $args as $key => $value ) { |
446 | - $search_fields[] = array( |
|
446 | + $search_fields[ ] = array( |
|
447 | 447 | 'name' => $key, |
448 | 448 | 'input' => 'hidden', |
449 | 449 | 'value' => $value, |
@@ -482,22 +482,22 @@ discard block |
||
482 | 482 | /** |
483 | 483 | * Include the sidebar Widgets. |
484 | 484 | */ |
485 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
485 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
486 | 486 | |
487 | 487 | foreach ( $widgets as $widget ) { |
488 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
489 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
488 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
489 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
490 | 490 | foreach ( $_fields as $field ) { |
491 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
491 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
497 | 497 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
498 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
498 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
499 | 499 | foreach ( $_fields as $field ) { |
500 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
500 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
528 | 528 | } |
529 | 529 | |
530 | - if( 'post' === $this->search_method ) { |
|
530 | + if ( 'post' === $this->search_method ) { |
|
531 | 531 | $get = $_POST; |
532 | 532 | } else { |
533 | 533 | $get = $_GET; |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | $get = gv_map_deep( $get, 'rawurldecode' ); |
547 | 547 | |
548 | 548 | // Make sure array key is set up |
549 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
549 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
550 | 550 | |
551 | 551 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
552 | 552 | |
553 | 553 | // add free search |
554 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
554 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
555 | 555 | |
556 | - $search_all_value = trim( $get['gv_search'] ); |
|
556 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
557 | 557 | |
558 | 558 | /** |
559 | 559 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | foreach ( $words as $word ) { |
581 | - $search_criteria['field_filters'][] = array( |
|
581 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
582 | 582 | 'key' => null, // The field ID to search |
583 | 583 | 'value' => $word, // The value to search |
584 | 584 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -591,14 +591,14 @@ discard block |
||
591 | 591 | /** |
592 | 592 | * Get and normalize the dates according to the input format. |
593 | 593 | */ |
594 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
595 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
594 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
595 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
596 | 596 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
601 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
600 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
601 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
602 | 602 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
603 | 603 | } |
604 | 604 | } |
@@ -633,22 +633,22 @@ discard block |
||
633 | 633 | */ |
634 | 634 | if ( ! empty( $curr_start ) ) { |
635 | 635 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
636 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
636 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | if ( ! empty( $curr_end ) ) { |
640 | 640 | // Fast-forward 24 hour on the end time |
641 | 641 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
642 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
643 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
644 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
642 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
643 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
644 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | 649 | // search for a specific entry ID |
650 | 650 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
651 | - $search_criteria['field_filters'][] = array( |
|
651 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
652 | 652 | 'key' => 'id', |
653 | 653 | 'value' => absint( $get[ 'gv_id' ] ), |
654 | 654 | 'operator' => '=', |
@@ -657,41 +657,41 @@ discard block |
||
657 | 657 | |
658 | 658 | // search for a specific Created_by ID |
659 | 659 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
660 | - $search_criteria['field_filters'][] = array( |
|
660 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
661 | 661 | 'key' => 'created_by', |
662 | - 'value' => $get['gv_by'], |
|
662 | + 'value' => $get[ 'gv_by' ], |
|
663 | 663 | 'operator' => '=', |
664 | 664 | ); |
665 | 665 | } |
666 | 666 | |
667 | 667 | // Get search mode passed in URL |
668 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
668 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
669 | 669 | |
670 | 670 | // get the other search filters |
671 | 671 | foreach ( $get as $key => $value ) { |
672 | 672 | |
673 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
673 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
674 | 674 | continue; |
675 | 675 | } |
676 | 676 | |
677 | 677 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
678 | 678 | |
679 | 679 | // could return simple filter or multiple filters |
680 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
680 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
681 | 681 | continue; |
682 | 682 | } |
683 | 683 | |
684 | 684 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
685 | 685 | |
686 | - if ( isset( $filter[0]['value'] ) ) { |
|
687 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
686 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
687 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
688 | 688 | |
689 | 689 | // if date range type, set search mode to ALL |
690 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
690 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
691 | 691 | $mode = 'all'; |
692 | 692 | } |
693 | - } elseif( !empty( $filter ) ) { |
|
694 | - $search_criteria['field_filters'][] = $filter; |
|
693 | + } elseif ( ! empty( $filter ) ) { |
|
694 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @since 1.5.1 |
701 | 701 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
702 | 702 | */ |
703 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
703 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
704 | 704 | |
705 | 705 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
706 | 706 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | */ |
726 | 726 | $search_criteria = $this->filter_entries( array(), null, array( 'id' => $view->ID ), true /** force search_criteria */ ); |
727 | 727 | |
728 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
728 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
729 | 729 | return; |
730 | 730 | } |
731 | 731 | |
732 | 732 | $widgets = $view->widgets->by_id( $this->widget_id ); |
733 | 733 | if ( $widgets->count() ) { |
734 | 734 | $widgets = $widgets->all(); |
735 | - $widget = $widgets[0]; |
|
735 | + $widget = $widgets[ 0 ]; |
|
736 | 736 | foreach ( $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) as $search_field ) { |
737 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
737 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
738 | 738 | $created_by_text_mode = true; |
739 | 739 | } |
740 | 740 | } |
@@ -742,19 +742,19 @@ discard block |
||
742 | 742 | |
743 | 743 | $extra_conditions = array(); |
744 | 744 | |
745 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
745 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
746 | 746 | if ( ! is_array( $filter ) ) { |
747 | 747 | continue; |
748 | 748 | } |
749 | 749 | |
750 | 750 | // Construct a manual query for unapproved statuses |
751 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) { |
|
752 | - $_tmp_query = new GF_Query( $view->form->ID, array( |
|
751 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) { |
|
752 | + $_tmp_query = new GF_Query( $view->form->ID, array( |
|
753 | 753 | 'field_filters' => array( |
754 | 754 | array( |
755 | 755 | 'operator' => 'in', |
756 | 756 | 'key' => 'is_approved', |
757 | - 'value' => (array) $filter['value'], |
|
757 | + 'value' => (array)$filter[ 'value' ], |
|
758 | 758 | ), |
759 | 759 | array( |
760 | 760 | 'operator' => 'is', |
@@ -766,25 +766,25 @@ discard block |
||
766 | 766 | ) ); |
767 | 767 | $_tmp_query_parts = $_tmp_query->_introspect(); |
768 | 768 | |
769 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
769 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
770 | 770 | |
771 | 771 | $filter = false; |
772 | 772 | continue; |
773 | 773 | } |
774 | 774 | |
775 | 775 | // Construct manual query for text mode creator search |
776 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
777 | - $extra_conditions[] = new GravityView_Widget_Search_GF_Query_Condition( $filter, $view ); |
|
776 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
777 | + $extra_conditions[ ] = new GravityView_Widget_Search_GF_Query_Condition( $filter, $view ); |
|
778 | 778 | $filter = false; |
779 | 779 | continue; |
780 | 780 | } |
781 | 781 | |
782 | 782 | // By default, we want searches to be wildcard for each field. |
783 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
783 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
784 | 784 | |
785 | 785 | // For multichoice, let's have an in (OR) search. |
786 | - if ( is_array( $filter['value'] ) ) { |
|
787 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
786 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
787 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | * @param string $operator Existing search operator |
793 | 793 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
794 | 794 | */ |
795 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
795 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
796 | 796 | } |
797 | 797 | |
798 | - $search_criteria['field_filters'] = array_filter( $search_criteria['field_filters'] ); |
|
798 | + $search_criteria[ 'field_filters' ] = array_filter( $search_criteria[ 'field_filters' ] ); |
|
799 | 799 | |
800 | 800 | /** |
801 | 801 | * Parse the filter criteria to generate the needed |
@@ -808,12 +808,12 @@ discard block |
||
808 | 808 | /** |
809 | 809 | * Grab the current clauses. We'll be combining them shortly. |
810 | 810 | */ |
811 | - $query_parts = $query->_introspect(); |
|
811 | + $query_parts = $query->_introspect(); |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * Combine the parts as a new WHERE clause. |
815 | 815 | */ |
816 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'], $_tmp_query_parts['where'] ), $extra_conditions ) ); |
|
816 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ], $_tmp_query_parts[ 'where' ] ), $extra_conditions ) ); |
|
817 | 817 | $query->where( $where ); |
818 | 818 | } |
819 | 819 | |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | $field_id = str_replace( 'filter_', '', $key ); |
837 | 837 | |
838 | 838 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
839 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
839 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
840 | 840 | $field_id = str_replace( '_', '.', $field_id ); |
841 | 841 | } |
842 | 842 | |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | |
872 | 872 | case 'select': |
873 | 873 | case 'radio': |
874 | - $filter['operator'] = 'is'; |
|
874 | + $filter[ 'operator' ] = 'is'; |
|
875 | 875 | break; |
876 | 876 | |
877 | 877 | case 'post_category': |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | foreach ( $value as $val ) { |
887 | 887 | $cat = get_term( $val, 'category' ); |
888 | - $filter[] = array( |
|
888 | + $filter[ ] = array( |
|
889 | 889 | 'key' => $filter_key, |
890 | 890 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
891 | 891 | 'operator' => 'is', |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | $filter = array(); |
905 | 905 | |
906 | 906 | foreach ( $value as $val ) { |
907 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
907 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | break; |
@@ -913,9 +913,9 @@ discard block |
||
913 | 913 | // convert checkbox on/off into the correct search filter |
914 | 914 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
915 | 915 | foreach ( $form_field->inputs as $k => $input ) { |
916 | - if ( $input['id'] == $filter_key ) { |
|
917 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
918 | - $filter['operator'] = 'is'; |
|
916 | + if ( $input[ 'id' ] == $filter_key ) { |
|
917 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
918 | + $filter[ 'operator' ] = 'is'; |
|
919 | 919 | break; |
920 | 920 | } |
921 | 921 | } |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | $filter = array(); |
926 | 926 | |
927 | 927 | foreach ( $value as $val ) { |
928 | - $filter[] = array( |
|
928 | + $filter[ ] = array( |
|
929 | 929 | 'key' => $filter_key, |
930 | 930 | 'value' => $val, |
931 | 931 | 'operator' => 'is', |
@@ -946,9 +946,9 @@ discard block |
||
946 | 946 | foreach ( $words as $word ) { |
947 | 947 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
948 | 948 | // Keep the same key for each filter |
949 | - $filter['value'] = $word; |
|
949 | + $filter[ 'value' ] = $word; |
|
950 | 950 | // Add a search for the value |
951 | - $filters[] = $filter; |
|
951 | + $filters[ ] = $filter; |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | |
@@ -962,19 +962,19 @@ discard block |
||
962 | 962 | |
963 | 963 | foreach ( $searchable_fields as $searchable_field ) { |
964 | 964 | |
965 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
965 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
966 | 966 | continue; |
967 | 967 | } |
968 | 968 | |
969 | 969 | // Only exact-match dropdowns, not text search |
970 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
970 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
971 | 971 | continue; |
972 | 972 | } |
973 | 973 | |
974 | 974 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
975 | 975 | |
976 | 976 | if ( 4 === $input_id ) { |
977 | - $filter['operator'] = 'is'; |
|
977 | + $filter[ 'operator' ] = 'is'; |
|
978 | 978 | }; |
979 | 979 | } |
980 | 980 | } |
@@ -1001,12 +1001,12 @@ discard block |
||
1001 | 1001 | * @since 1.16.3 |
1002 | 1002 | * Safeguard until GF implements '<=' operator |
1003 | 1003 | */ |
1004 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1004 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1005 | 1005 | $operator = '<'; |
1006 | 1006 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - $filter[] = array( |
|
1009 | + $filter[ ] = array( |
|
1010 | 1010 | 'key' => $filter_key, |
1011 | 1011 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
1012 | 1012 | 'operator' => $operator, |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | } |
1015 | 1015 | } else { |
1016 | 1016 | $date = $value; |
1017 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1017 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | break; |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | 'ymd_dot' => 'Y.m.d', |
1046 | 1046 | ); |
1047 | 1047 | |
1048 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
1048 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
1049 | 1049 | $format = $datepicker[ $field->dateFormat ]; |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | public function add_template_path( $file_paths ) { |
1083 | 1083 | |
1084 | 1084 | // Index 100 is the default GravityView template path. |
1085 | - $file_paths[102] = self::$file . 'templates/'; |
|
1085 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
1086 | 1086 | |
1087 | 1087 | return $file_paths; |
1088 | 1088 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | $has_date = false; |
1102 | 1102 | |
1103 | 1103 | foreach ( $search_fields as $k => $field ) { |
1104 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1104 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1105 | 1105 | $has_date = true; |
1106 | 1106 | break; |
1107 | 1107 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | // get configured search fields |
1131 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
1131 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
1132 | 1132 | |
1133 | 1133 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
1134 | 1134 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1143,40 +1143,40 @@ discard block |
||
1143 | 1143 | |
1144 | 1144 | $updated_field = $this->get_search_filter_details( $updated_field ); |
1145 | 1145 | |
1146 | - switch ( $field['field'] ) { |
|
1146 | + switch ( $field[ 'field' ] ) { |
|
1147 | 1147 | |
1148 | 1148 | case 'search_all': |
1149 | - $updated_field['key'] = 'search_all'; |
|
1150 | - $updated_field['input'] = 'search_all'; |
|
1151 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1149 | + $updated_field[ 'key' ] = 'search_all'; |
|
1150 | + $updated_field[ 'input' ] = 'search_all'; |
|
1151 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1152 | 1152 | break; |
1153 | 1153 | |
1154 | 1154 | case 'entry_date': |
1155 | - $updated_field['key'] = 'entry_date'; |
|
1156 | - $updated_field['input'] = 'entry_date'; |
|
1157 | - $updated_field['value'] = array( |
|
1155 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1156 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1157 | + $updated_field[ 'value' ] = array( |
|
1158 | 1158 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1159 | 1159 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1160 | 1160 | ); |
1161 | 1161 | break; |
1162 | 1162 | |
1163 | 1163 | case 'entry_id': |
1164 | - $updated_field['key'] = 'entry_id'; |
|
1165 | - $updated_field['input'] = 'entry_id'; |
|
1166 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1164 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1165 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1166 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1167 | 1167 | break; |
1168 | 1168 | |
1169 | 1169 | case 'created_by': |
1170 | - $updated_field['key'] = 'created_by'; |
|
1171 | - $updated_field['name'] = 'gv_by'; |
|
1172 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1173 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
1170 | + $updated_field[ 'key' ] = 'created_by'; |
|
1171 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1172 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1173 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
1174 | 1174 | break; |
1175 | 1175 | |
1176 | 1176 | case 'is_approved': |
1177 | - $updated_field['key'] = 'is_approved'; |
|
1178 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1179 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
1177 | + $updated_field[ 'key' ] = 'is_approved'; |
|
1178 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1179 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
1180 | 1180 | break; |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1195,16 +1195,16 @@ discard block |
||
1195 | 1195 | */ |
1196 | 1196 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
1197 | 1197 | |
1198 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1198 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1199 | 1199 | |
1200 | 1200 | /** @since 1.14 */ |
1201 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1201 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1202 | 1202 | |
1203 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1203 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1204 | 1204 | |
1205 | 1205 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1206 | 1206 | |
1207 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1207 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1208 | 1208 | |
1209 | 1209 | if ( $this->has_date_field( $search_fields ) ) { |
1210 | 1210 | // enqueue datepicker stuff only if needed! |
@@ -1226,10 +1226,10 @@ discard block |
||
1226 | 1226 | public static function get_search_class( $custom_class = '' ) { |
1227 | 1227 | $gravityview_view = GravityView_View::getInstance(); |
1228 | 1228 | |
1229 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1229 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1230 | 1230 | |
1231 | - if ( ! empty( $custom_class ) ) { |
|
1232 | - $search_class .= ' '.$custom_class; |
|
1231 | + if ( ! empty( $custom_class ) ) { |
|
1232 | + $search_class .= ' ' . $custom_class; |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | /** |
@@ -1273,9 +1273,9 @@ discard block |
||
1273 | 1273 | |
1274 | 1274 | if ( ! $label ) { |
1275 | 1275 | |
1276 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1276 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1277 | 1277 | |
1278 | - switch( $field['field'] ) { |
|
1278 | + switch ( $field[ 'field' ] ) { |
|
1279 | 1279 | case 'search_all': |
1280 | 1280 | $label = __( 'Search Entries:', 'gravityview' ); |
1281 | 1281 | break; |
@@ -1287,10 +1287,10 @@ discard block |
||
1287 | 1287 | break; |
1288 | 1288 | default: |
1289 | 1289 | // If this is a field input, not a field |
1290 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1290 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1291 | 1291 | |
1292 | 1292 | // Get the label for the field in question, which returns an array |
1293 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1293 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1294 | 1294 | |
1295 | 1295 | // Get the item with the `label` key |
1296 | 1296 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1329,32 +1329,32 @@ discard block |
||
1329 | 1329 | $form = $gravityview_view->getForm(); |
1330 | 1330 | |
1331 | 1331 | // for advanced field ids (eg, first name / last name ) |
1332 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1332 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1333 | 1333 | |
1334 | 1334 | // get searched value from $_GET/$_POST (string or array) |
1335 | 1335 | $value = $this->rgget_or_rgpost( $name ); |
1336 | 1336 | |
1337 | 1337 | // get form field details |
1338 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1338 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1339 | 1339 | |
1340 | 1340 | $filter = array( |
1341 | - 'key' => $field['field'], |
|
1341 | + 'key' => $field[ 'field' ], |
|
1342 | 1342 | 'name' => $name, |
1343 | 1343 | 'label' => self::get_field_label( $field, $form_field ), |
1344 | - 'input' => $field['input'], |
|
1344 | + 'input' => $field[ 'input' ], |
|
1345 | 1345 | 'value' => $value, |
1346 | - 'type' => $form_field['type'], |
|
1346 | + 'type' => $form_field[ 'type' ], |
|
1347 | 1347 | ); |
1348 | 1348 | |
1349 | 1349 | // collect choices |
1350 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1351 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1352 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1353 | - $filter['choices'] = $form_field['choices']; |
|
1350 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1351 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1352 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1353 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1357 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1356 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1357 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | return $filter; |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | |
1379 | 1379 | $choices = array(); |
1380 | 1380 | foreach ( $users as $user ) { |
1381 | - $choices[] = array( |
|
1381 | + $choices[ ] = array( |
|
1382 | 1382 | 'value' => $user->ID, |
1383 | 1383 | 'text' => $user->display_name, |
1384 | 1384 | ); |
@@ -1398,9 +1398,9 @@ discard block |
||
1398 | 1398 | |
1399 | 1399 | $choices = array(); |
1400 | 1400 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
1401 | - $choices[] = array( |
|
1402 | - 'value' => $status['value'], |
|
1403 | - 'text' => $status['label'], |
|
1401 | + $choices[ ] = array( |
|
1402 | + 'value' => $status[ 'value' ], |
|
1403 | + 'text' => $status[ 'label' ], |
|
1404 | 1404 | ); |
1405 | 1405 | } |
1406 | 1406 | |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | */ |
1453 | 1453 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1454 | 1454 | |
1455 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1455 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1456 | 1456 | |
1457 | 1457 | return $js_dependencies; |
1458 | 1458 | } |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | 'isRTL' => is_rtl(), |
1497 | 1497 | ), $view_data ); |
1498 | 1498 | |
1499 | - $localizations['datepicker'] = $datepicker_settings; |
|
1499 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1500 | 1500 | |
1501 | 1501 | return $localizations; |
1502 | 1502 | |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | * @return void |
1524 | 1524 | */ |
1525 | 1525 | private function maybe_enqueue_flexibility() { |
1526 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1526 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1527 | 1527 | wp_enqueue_script( 'gv-flexibility' ); |
1528 | 1528 | } |
1529 | 1529 | } |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1546 | 1546 | |
1547 | 1547 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1548 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1548 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1549 | 1549 | |
1550 | 1550 | /** |
1551 | 1551 | * @filter `gravityview_search_datepicker_class` |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | */ |
1629 | 1629 | class GravityView_Widget_Search_GF_Query_Condition extends \GF_Query_Condition { |
1630 | 1630 | public function __construct( $filter, $view ) { |
1631 | - $this->value = $filter['value']; |
|
1631 | + $this->value = $filter[ 'value' ]; |
|
1632 | 1632 | $this->view = $view; |
1633 | 1633 | } |
1634 | 1634 | |
@@ -1660,11 +1660,11 @@ discard block |
||
1660 | 1660 | $conditions = array(); |
1661 | 1661 | |
1662 | 1662 | foreach ( $user_fields as $user_field ) { |
1663 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
1663 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | foreach ( $user_meta_fields as $meta_field ) { |
1667 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
1667 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |