@@ -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 |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 225 | 225 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 226 | 226 | |
| 227 | - 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 ); |
|
| 227 | + 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 ); |
|
| 228 | 228 | |
| 229 | 229 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 230 | 230 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 247 | 247 | */ |
| 248 | 248 | public function register_no_conflict( $allowed ) { |
| 249 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 249 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 250 | 250 | return $allowed; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -259,24 +259,24 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public static function get_searchable_fields() { |
| 261 | 261 | |
| 262 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 262 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 263 | 263 | exit( '0' ); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $form = ''; |
| 267 | 267 | |
| 268 | 268 | // Fetch the form for the current View |
| 269 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 269 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 270 | 270 | |
| 271 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 271 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 272 | 272 | |
| 273 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 273 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 274 | 274 | |
| 275 | - $form = (int) $_POST['formid']; |
|
| 275 | + $form = (int)$_POST[ 'formid' ]; |
|
| 276 | 276 | |
| 277 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 277 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 278 | 278 | |
| 279 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 279 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | |
@@ -326,14 +326,14 @@ discard block |
||
| 326 | 326 | ); |
| 327 | 327 | |
| 328 | 328 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
| 329 | - $custom_fields['is_approved'] = array( |
|
| 329 | + $custom_fields[ 'is_approved' ] = array( |
|
| 330 | 330 | 'text' => esc_html__( 'Is Approved', 'gravityview' ), |
| 331 | 331 | 'type' => 'boolean', |
| 332 | 332 | ); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 336 | - $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'] ); |
|
| 335 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 336 | + $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' ] ); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // Get fields with sub-inputs and no parent |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | foreach ( $fields as $id => $field ) { |
| 357 | 357 | |
| 358 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 358 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 359 | 359 | continue; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 362 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 363 | 363 | |
| 364 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 364 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
| 385 | 385 | |
| 386 | 386 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 387 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 387 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 388 | 388 | $input_type = 'boolean'; // on/off checkbox |
| 389 | 389 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 390 | 390 | $input_type = 'multi'; //multiselect |
@@ -428,19 +428,19 @@ discard block |
||
| 428 | 428 | $post_id = 0; |
| 429 | 429 | |
| 430 | 430 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 431 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 432 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 431 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 432 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 433 | 433 | } |
| 434 | 434 | // We're in the WordPress Widget context, and the base View ID should be used |
| 435 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 436 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 435 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 436 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 440 | 440 | |
| 441 | 441 | // Add hidden fields to the search form |
| 442 | 442 | foreach ( $args as $key => $value ) { |
| 443 | - $search_fields[] = array( |
|
| 443 | + $search_fields[ ] = array( |
|
| 444 | 444 | 'name' => $key, |
| 445 | 445 | 'input' => 'hidden', |
| 446 | 446 | 'value' => $value, |
@@ -479,22 +479,22 @@ discard block |
||
| 479 | 479 | /** |
| 480 | 480 | * Include the sidebar Widgets. |
| 481 | 481 | */ |
| 482 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
| 482 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
| 483 | 483 | |
| 484 | 484 | foreach ( $widgets as $widget ) { |
| 485 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
| 486 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
| 485 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
| 486 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
| 487 | 487 | foreach ( $_fields as $field ) { |
| 488 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 488 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
| 495 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 495 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 496 | 496 | foreach ( $_fields as $field ) { |
| 497 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 497 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - if( 'post' === $this->search_method ) { |
|
| 527 | + if ( 'post' === $this->search_method ) { |
|
| 528 | 528 | $get = $_POST; |
| 529 | 529 | } else { |
| 530 | 530 | $get = $_GET; |
@@ -543,14 +543,14 @@ discard block |
||
| 543 | 543 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 544 | 544 | |
| 545 | 545 | // Make sure array key is set up |
| 546 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 546 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 547 | 547 | |
| 548 | 548 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
| 549 | 549 | |
| 550 | 550 | // add free search |
| 551 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 551 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 552 | 552 | |
| 553 | - $search_all_value = trim( $get['gv_search'] ); |
|
| 553 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
| 554 | 554 | |
| 555 | 555 | /** |
| 556 | 556 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | foreach ( $words as $word ) { |
| 578 | - $search_criteria['field_filters'][] = array( |
|
| 578 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 579 | 579 | 'key' => null, // The field ID to search |
| 580 | 580 | 'value' => $word, // The value to search |
| 581 | 581 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -588,14 +588,14 @@ discard block |
||
| 588 | 588 | /** |
| 589 | 589 | * Get and normalize the dates according to the input format. |
| 590 | 590 | */ |
| 591 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
| 592 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 591 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
| 592 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 593 | 593 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
| 598 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 597 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
| 598 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 599 | 599 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
| 600 | 600 | } |
| 601 | 601 | } |
@@ -630,22 +630,22 @@ discard block |
||
| 630 | 630 | */ |
| 631 | 631 | if ( ! empty( $curr_start ) ) { |
| 632 | 632 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
| 633 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 633 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | if ( ! empty( $curr_end ) ) { |
| 637 | 637 | // Fast-forward 24 hour on the end time |
| 638 | 638 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
| 639 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 640 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 641 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
| 639 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 640 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 641 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
| 642 | 642 | } |
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | // search for a specific entry ID |
| 647 | 647 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
| 648 | - $search_criteria['field_filters'][] = array( |
|
| 648 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 649 | 649 | 'key' => 'id', |
| 650 | 650 | 'value' => absint( $get[ 'gv_id' ] ), |
| 651 | 651 | 'operator' => '=', |
@@ -654,42 +654,42 @@ discard block |
||
| 654 | 654 | |
| 655 | 655 | // search for a specific Created_by ID |
| 656 | 656 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
| 657 | - $search_criteria['field_filters'][] = array( |
|
| 657 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 658 | 658 | 'key' => 'created_by', |
| 659 | - 'value' => absint( $get['gv_by'] ), |
|
| 659 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 660 | 660 | 'operator' => '=', |
| 661 | 661 | ); |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | |
| 665 | 665 | // Get search mode passed in URL |
| 666 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 666 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 667 | 667 | |
| 668 | 668 | // get the other search filters |
| 669 | 669 | foreach ( $get as $key => $value ) { |
| 670 | 670 | |
| 671 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
| 671 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
| 672 | 672 | continue; |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
| 676 | 676 | |
| 677 | 677 | // could return simple filter or multiple filters |
| 678 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
| 678 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
| 679 | 679 | continue; |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
| 683 | 683 | |
| 684 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 685 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 684 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 685 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 686 | 686 | |
| 687 | 687 | // if date range type, set search mode to ALL |
| 688 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 688 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 689 | 689 | $mode = 'all'; |
| 690 | 690 | } |
| 691 | - } elseif( !empty( $filter ) ) { |
|
| 692 | - $search_criteria['field_filters'][] = $filter; |
|
| 691 | + } elseif ( ! empty( $filter ) ) { |
|
| 692 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 693 | 693 | } |
| 694 | 694 | } |
| 695 | 695 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * @since 1.5.1 |
| 699 | 699 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 700 | 700 | */ |
| 701 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 701 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 702 | 702 | |
| 703 | 703 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
| 704 | 704 | |
@@ -723,25 +723,25 @@ discard block |
||
| 723 | 723 | */ |
| 724 | 724 | $search_criteria = $this->filter_entries( array(), null, array( 'id' => $view->ID ), true /** force search_criteria */ ); |
| 725 | 725 | |
| 726 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
| 726 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
| 727 | 727 | return; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | $extra_conditions = array(); |
| 731 | 731 | |
| 732 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
| 732 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
| 733 | 733 | if ( ! is_array( $filter ) ) { |
| 734 | 734 | continue; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | // Construct a manual query for unapproved statuses |
| 738 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, $filter['value'] ) ) { |
|
| 739 | - $_tmp_query = new GF_Query( $view->form->ID, array( |
|
| 738 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, $filter[ 'value' ] ) ) { |
|
| 739 | + $_tmp_query = new GF_Query( $view->form->ID, array( |
|
| 740 | 740 | 'field_filters' => array( |
| 741 | 741 | array( |
| 742 | 742 | 'operator' => 'in', |
| 743 | 743 | 'key' => 'is_approved', |
| 744 | - 'value' => $filter['value'], |
|
| 744 | + 'value' => $filter[ 'value' ], |
|
| 745 | 745 | ), |
| 746 | 746 | array( |
| 747 | 747 | 'operator' => 'is', |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | ) ); |
| 754 | 754 | $_tmp_query_parts = $_tmp_query->_introspect(); |
| 755 | 755 | |
| 756 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
| 756 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
| 757 | 757 | |
| 758 | 758 | $filter = false; |
| 759 | 759 | |
@@ -761,11 +761,11 @@ discard block |
||
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // By default, we want searches to be wildcard for each field. |
| 764 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 764 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 765 | 765 | |
| 766 | 766 | // For multichoice, let's have an in (OR) search. |
| 767 | - if ( is_array( $filter['value'] ) ) { |
|
| 768 | - $filter['operator'] = 'in'; |
|
| 767 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
| 768 | + $filter[ 'operator' ] = 'in'; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | /** |
@@ -773,10 +773,10 @@ discard block |
||
| 773 | 773 | * @param string $operator Existing search operator |
| 774 | 774 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 775 | 775 | */ |
| 776 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 776 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | - $search_criteria['field_filters'] = array_filter( $search_criteria['field_filters'] ); |
|
| 779 | + $search_criteria[ 'field_filters' ] = array_filter( $search_criteria[ 'field_filters' ] ); |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * Parse the filter criteria to generate the needed |
@@ -789,12 +789,12 @@ discard block |
||
| 789 | 789 | /** |
| 790 | 790 | * Grab the current clauses. We'll be combining them shortly. |
| 791 | 791 | */ |
| 792 | - $query_parts = $query->_introspect(); |
|
| 792 | + $query_parts = $query->_introspect(); |
|
| 793 | 793 | |
| 794 | 794 | /** |
| 795 | 795 | * Combine the parts as a new WHERE clause. |
| 796 | 796 | */ |
| 797 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'], $_tmp_query_parts['where'] ), $extra_conditions ) ); |
|
| 797 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ], $_tmp_query_parts[ 'where' ] ), $extra_conditions ) ); |
|
| 798 | 798 | $query->where( $where ); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $field_id = str_replace( 'filter_', '', $key ); |
| 818 | 818 | |
| 819 | 819 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 820 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 820 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 821 | 821 | $field_id = str_replace( '_', '.', $field_id ); |
| 822 | 822 | } |
| 823 | 823 | |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | case 'select': |
| 854 | 854 | case 'radio': |
| 855 | - $filter['operator'] = 'is'; |
|
| 855 | + $filter[ 'operator' ] = 'is'; |
|
| 856 | 856 | break; |
| 857 | 857 | |
| 858 | 858 | case 'post_category': |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | foreach ( $value as $val ) { |
| 868 | 868 | $cat = get_term( $val, 'category' ); |
| 869 | - $filter[] = array( |
|
| 869 | + $filter[ ] = array( |
|
| 870 | 870 | 'key' => $filter_key, |
| 871 | 871 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 872 | 872 | 'operator' => 'is', |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | $filter = array(); |
| 886 | 886 | |
| 887 | 887 | foreach ( $value as $val ) { |
| 888 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 888 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | break; |
@@ -894,9 +894,9 @@ discard block |
||
| 894 | 894 | // convert checkbox on/off into the correct search filter |
| 895 | 895 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
| 896 | 896 | foreach ( $form_field->inputs as $k => $input ) { |
| 897 | - if ( $input['id'] == $filter_key ) { |
|
| 898 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
| 899 | - $filter['operator'] = 'is'; |
|
| 897 | + if ( $input[ 'id' ] == $filter_key ) { |
|
| 898 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
| 899 | + $filter[ 'operator' ] = 'is'; |
|
| 900 | 900 | break; |
| 901 | 901 | } |
| 902 | 902 | } |
@@ -906,7 +906,7 @@ discard block |
||
| 906 | 906 | $filter = array(); |
| 907 | 907 | |
| 908 | 908 | foreach ( $value as $val ) { |
| 909 | - $filter[] = array( |
|
| 909 | + $filter[ ] = array( |
|
| 910 | 910 | 'key' => $filter_key, |
| 911 | 911 | 'value' => $val, |
| 912 | 912 | 'operator' => 'is', |
@@ -927,9 +927,9 @@ discard block |
||
| 927 | 927 | foreach ( $words as $word ) { |
| 928 | 928 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 929 | 929 | // Keep the same key for each filter |
| 930 | - $filter['value'] = $word; |
|
| 930 | + $filter[ 'value' ] = $word; |
|
| 931 | 931 | // Add a search for the value |
| 932 | - $filters[] = $filter; |
|
| 932 | + $filters[ ] = $filter; |
|
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | |
@@ -943,19 +943,19 @@ discard block |
||
| 943 | 943 | |
| 944 | 944 | foreach ( $searchable_fields as $searchable_field ) { |
| 945 | 945 | |
| 946 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
| 946 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
| 947 | 947 | continue; |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | // Only exact-match dropdowns, not text search |
| 951 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
| 951 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
| 952 | 952 | continue; |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
| 956 | 956 | |
| 957 | 957 | if ( 4 === $input_id ) { |
| 958 | - $filter['operator'] = 'is'; |
|
| 958 | + $filter[ 'operator' ] = 'is'; |
|
| 959 | 959 | }; |
| 960 | 960 | } |
| 961 | 961 | } |
@@ -982,12 +982,12 @@ discard block |
||
| 982 | 982 | * @since 1.16.3 |
| 983 | 983 | * Safeguard until GF implements '<=' operator |
| 984 | 984 | */ |
| 985 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 985 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 986 | 986 | $operator = '<'; |
| 987 | 987 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - $filter[] = array( |
|
| 990 | + $filter[ ] = array( |
|
| 991 | 991 | 'key' => $filter_key, |
| 992 | 992 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
| 993 | 993 | 'operator' => $operator, |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | } else { |
| 997 | 997 | $date = $value; |
| 998 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 998 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | 1001 | break; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | 'ymd_dot' => 'Y.m.d', |
| 1027 | 1027 | ); |
| 1028 | 1028 | |
| 1029 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 1029 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 1030 | 1030 | $format = $datepicker[ $field->dateFormat ]; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | public function add_template_path( $file_paths ) { |
| 1064 | 1064 | |
| 1065 | 1065 | // Index 100 is the default GravityView template path. |
| 1066 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 1066 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 1067 | 1067 | |
| 1068 | 1068 | return $file_paths; |
| 1069 | 1069 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | $has_date = false; |
| 1083 | 1083 | |
| 1084 | 1084 | foreach ( $search_fields as $k => $field ) { |
| 1085 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1085 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 1086 | 1086 | $has_date = true; |
| 1087 | 1087 | break; |
| 1088 | 1088 | } |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | // get configured search fields |
| 1112 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 1112 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 1113 | 1113 | |
| 1114 | 1114 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 1115 | 1115 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1124,41 +1124,41 @@ discard block |
||
| 1124 | 1124 | |
| 1125 | 1125 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 1126 | 1126 | |
| 1127 | - switch ( $field['field'] ) { |
|
| 1127 | + switch ( $field[ 'field' ] ) { |
|
| 1128 | 1128 | |
| 1129 | 1129 | case 'search_all': |
| 1130 | - $updated_field['key'] = 'search_all'; |
|
| 1131 | - $updated_field['input'] = 'search_all'; |
|
| 1132 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1130 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 1131 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 1132 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1133 | 1133 | break; |
| 1134 | 1134 | |
| 1135 | 1135 | case 'entry_date': |
| 1136 | - $updated_field['key'] = 'entry_date'; |
|
| 1137 | - $updated_field['input'] = 'entry_date'; |
|
| 1138 | - $updated_field['value'] = array( |
|
| 1136 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 1137 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 1138 | + $updated_field[ 'value' ] = array( |
|
| 1139 | 1139 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 1140 | 1140 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 1141 | 1141 | ); |
| 1142 | 1142 | break; |
| 1143 | 1143 | |
| 1144 | 1144 | case 'entry_id': |
| 1145 | - $updated_field['key'] = 'entry_id'; |
|
| 1146 | - $updated_field['input'] = 'entry_id'; |
|
| 1147 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1145 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 1146 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 1147 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1148 | 1148 | break; |
| 1149 | 1149 | |
| 1150 | 1150 | case 'created_by': |
| 1151 | - $updated_field['key'] = 'created_by'; |
|
| 1152 | - $updated_field['name'] = 'gv_by'; |
|
| 1153 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1154 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 1151 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 1152 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 1153 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1154 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 1155 | 1155 | break; |
| 1156 | 1156 | |
| 1157 | 1157 | case 'is_approved': |
| 1158 | - $updated_field['key'] = 'is_approved'; |
|
| 1159 | - $updated_field['input'] = 'checkbox'; |
|
| 1160 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1161 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
| 1158 | + $updated_field[ 'key' ] = 'is_approved'; |
|
| 1159 | + $updated_field[ 'input' ] = 'checkbox'; |
|
| 1160 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
| 1161 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
| 1162 | 1162 | break; |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1177,16 +1177,16 @@ discard block |
||
| 1177 | 1177 | */ |
| 1178 | 1178 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
| 1179 | 1179 | |
| 1180 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 1180 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 1181 | 1181 | |
| 1182 | 1182 | /** @since 1.14 */ |
| 1183 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 1183 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 1184 | 1184 | |
| 1185 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 1185 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 1186 | 1186 | |
| 1187 | 1187 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 1188 | 1188 | |
| 1189 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 1189 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 1190 | 1190 | |
| 1191 | 1191 | if ( $this->has_date_field( $search_fields ) ) { |
| 1192 | 1192 | // enqueue datepicker stuff only if needed! |
@@ -1208,10 +1208,10 @@ discard block |
||
| 1208 | 1208 | public static function get_search_class( $custom_class = '' ) { |
| 1209 | 1209 | $gravityview_view = GravityView_View::getInstance(); |
| 1210 | 1210 | |
| 1211 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 1211 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 1212 | 1212 | |
| 1213 | - if ( ! empty( $custom_class ) ) { |
|
| 1214 | - $search_class .= ' '.$custom_class; |
|
| 1213 | + if ( ! empty( $custom_class ) ) { |
|
| 1214 | + $search_class .= ' ' . $custom_class; |
|
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | 1217 | /** |
@@ -1255,9 +1255,9 @@ discard block |
||
| 1255 | 1255 | |
| 1256 | 1256 | if ( ! $label ) { |
| 1257 | 1257 | |
| 1258 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 1258 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 1259 | 1259 | |
| 1260 | - switch( $field['field'] ) { |
|
| 1260 | + switch ( $field[ 'field' ] ) { |
|
| 1261 | 1261 | case 'search_all': |
| 1262 | 1262 | $label = __( 'Search Entries:', 'gravityview' ); |
| 1263 | 1263 | break; |
@@ -1269,10 +1269,10 @@ discard block |
||
| 1269 | 1269 | break; |
| 1270 | 1270 | default: |
| 1271 | 1271 | // If this is a field input, not a field |
| 1272 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 1272 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 1273 | 1273 | |
| 1274 | 1274 | // Get the label for the field in question, which returns an array |
| 1275 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 1275 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 1276 | 1276 | |
| 1277 | 1277 | // Get the item with the `label` key |
| 1278 | 1278 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1311,32 +1311,32 @@ discard block |
||
| 1311 | 1311 | $form = $gravityview_view->getForm(); |
| 1312 | 1312 | |
| 1313 | 1313 | // for advanced field ids (eg, first name / last name ) |
| 1314 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1314 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1315 | 1315 | |
| 1316 | 1316 | // get searched value from $_GET/$_POST (string or array) |
| 1317 | 1317 | $value = $this->rgget_or_rgpost( $name ); |
| 1318 | 1318 | |
| 1319 | 1319 | // get form field details |
| 1320 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1320 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1321 | 1321 | |
| 1322 | 1322 | $filter = array( |
| 1323 | - 'key' => $field['field'], |
|
| 1323 | + 'key' => $field[ 'field' ], |
|
| 1324 | 1324 | 'name' => $name, |
| 1325 | 1325 | 'label' => self::get_field_label( $field, $form_field ), |
| 1326 | - 'input' => $field['input'], |
|
| 1326 | + 'input' => $field[ 'input' ], |
|
| 1327 | 1327 | 'value' => $value, |
| 1328 | - 'type' => $form_field['type'], |
|
| 1328 | + 'type' => $form_field[ 'type' ], |
|
| 1329 | 1329 | ); |
| 1330 | 1330 | |
| 1331 | 1331 | // collect choices |
| 1332 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1333 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1334 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1335 | - $filter['choices'] = $form_field['choices']; |
|
| 1332 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1333 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1334 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1335 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1339 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1338 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1339 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | return $filter; |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | |
| 1361 | 1361 | $choices = array(); |
| 1362 | 1362 | foreach ( $users as $user ) { |
| 1363 | - $choices[] = array( |
|
| 1363 | + $choices[ ] = array( |
|
| 1364 | 1364 | 'value' => $user->ID, |
| 1365 | 1365 | 'text' => $user->display_name, |
| 1366 | 1366 | ); |
@@ -1380,9 +1380,9 @@ discard block |
||
| 1380 | 1380 | |
| 1381 | 1381 | $choices = array(); |
| 1382 | 1382 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
| 1383 | - $choices[] = array( |
|
| 1384 | - 'value' => $status['value'], |
|
| 1385 | - 'text' => $status['label'], |
|
| 1383 | + $choices[ ] = array( |
|
| 1384 | + 'value' => $status[ 'value' ], |
|
| 1385 | + 'text' => $status[ 'label' ], |
|
| 1386 | 1386 | ); |
| 1387 | 1387 | } |
| 1388 | 1388 | |
@@ -1434,7 +1434,7 @@ discard block |
||
| 1434 | 1434 | */ |
| 1435 | 1435 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1436 | 1436 | |
| 1437 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1437 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1438 | 1438 | |
| 1439 | 1439 | return $js_dependencies; |
| 1440 | 1440 | } |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | 'isRTL' => is_rtl(), |
| 1479 | 1479 | ), $view_data ); |
| 1480 | 1480 | |
| 1481 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1481 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1482 | 1482 | |
| 1483 | 1483 | return $localizations; |
| 1484 | 1484 | |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | * @return void |
| 1506 | 1506 | */ |
| 1507 | 1507 | private function maybe_enqueue_flexibility() { |
| 1508 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1508 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1509 | 1509 | wp_enqueue_script( 'gv-flexibility' ); |
| 1510 | 1510 | } |
| 1511 | 1511 | } |
@@ -1527,7 +1527,7 @@ discard block |
||
| 1527 | 1527 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1528 | 1528 | |
| 1529 | 1529 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1530 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1530 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1531 | 1531 | |
| 1532 | 1532 | /** |
| 1533 | 1533 | * @filter `gravityview_search_datepicker_class` |