@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; |
| 235 | 235 | |
| 236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | 237 | /** |
| 238 | 238 | * used on a has_multiple_views context |
| 239 | 239 | * @see GravityView_API::entry_link |
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 241 | 241 | */ |
| 242 | - $this->context_view_id = $_GET['gvid']; |
|
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 285 | 285 | $this->setPostId( $post_id ); |
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 319 | 319 | |
| 320 | - if( 'post' === $search_method ) { |
|
| 320 | + if ( 'post' === $search_method ) { |
|
| 321 | 321 | $get = $_POST; |
| 322 | 322 | } else { |
| 323 | 323 | $get = $_GET; |
@@ -373,20 +373,20 @@ discard block |
||
| 373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 374 | 374 | * @param array $entry Current entry |
| 375 | 375 | */ |
| 376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 377 | 377 | |
| 378 | 378 | if ( ! $apply_outside_loop ) { |
| 379 | 379 | return $title; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // User reported WooCommerce doesn't pass two args. |
| 383 | - if ( empty( $passed_post_id ) ) { |
|
| 383 | + if ( empty( $passed_post_id ) ) { |
|
| 384 | 384 | return $title; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Don't modify the title for anything other than the current view/post. |
| 388 | 388 | // This is true for embedded shortcodes and Views. |
| 389 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 389 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 390 | 390 | return $title; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -396,19 +396,19 @@ discard block |
||
| 396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 397 | 397 | } else { |
| 398 | 398 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 399 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 399 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 400 | 400 | $view_meta = $view_data; |
| 401 | 401 | break; |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 406 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 407 | 407 | |
| 408 | - $title = $view_meta['atts']['single_title']; |
|
| 408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 409 | 409 | |
| 410 | 410 | // We are allowing HTML in the fields, so no escaping the output |
| 411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 412 | 412 | |
| 413 | 413 | $title = do_shortcode( $title ); |
| 414 | 414 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | public function render_view( $passed_args ) { |
| 510 | 510 | |
| 511 | 511 | // validate attributes |
| 512 | - if ( empty( $passed_args['id'] ) ) { |
|
| 512 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 514 | 514 | return null; |
| 515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | return null; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - $view_id = $passed_args['id']; |
|
| 534 | + $view_id = $passed_args[ 'id' ]; |
|
| 535 | 535 | |
| 536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 545 | 545 | |
| 546 | 546 | //Override shortcode args over View template settings |
| 547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 548 | 548 | |
| 549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 550 | 550 | |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | * Don't render View if user isn't allowed to see it |
| 567 | 567 | * @since 1.15 |
| 568 | 568 | */ |
| 569 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 569 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 570 | 570 | return null; |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if( $this->isGravityviewPostType() ) { |
|
| 573 | + if ( $this->isGravityviewPostType() ) { |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | */ |
| 583 | 583 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 584 | 584 | |
| 585 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 585 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 586 | 586 | |
| 587 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 587 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 588 | 588 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 589 | 589 | } |
| 590 | 590 | } |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | $gravityview_view = new GravityView_View( $view_data ); |
| 601 | 601 | |
| 602 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 602 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 603 | 603 | |
| 604 | 604 | $gravityview_view->setPostId( $post_id ); |
| 605 | 605 | |
@@ -609,20 +609,20 @@ discard block |
||
| 609 | 609 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 610 | 610 | |
| 611 | 611 | //fetch template and slug |
| 612 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 612 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 613 | 613 | |
| 614 | 614 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | 617 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 618 | 618 | */ |
| 619 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 619 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | 622 | * Hide View data until search is performed |
| 623 | 623 | * @since 1.5.4 |
| 624 | 624 | */ |
| 625 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 625 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 626 | 626 | $gravityview_view->setHideUntilSearched( true ); |
| 627 | 627 | $get_entries = false; |
| 628 | 628 | } |
@@ -630,23 +630,23 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | if ( $get_entries ) { |
| 632 | 632 | |
| 633 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 633 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 634 | 634 | // add filter to enable column sorting |
| 635 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 635 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 638 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 639 | 639 | |
| 640 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 640 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 641 | 641 | |
| 642 | 642 | } else { |
| 643 | 643 | |
| 644 | 644 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 645 | 645 | |
| 646 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 646 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 649 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 650 | 650 | $gravityview_view->setContext( 'directory' ); |
| 651 | 651 | $sections = array( 'header', 'body', 'footer' ); |
| 652 | 652 | |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | // user requested Single Entry View |
| 656 | 656 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
| 657 | 657 | |
| 658 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 658 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 659 | 659 | |
| 660 | 660 | $entry = $this->getEntry(); |
| 661 | 661 | |
@@ -682,20 +682,20 @@ discard block |
||
| 682 | 682 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 683 | 683 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 684 | 684 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 685 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
| 685 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
| 686 | 686 | return null; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | //fetch template and slug |
| 690 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 690 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 691 | 691 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 692 | 692 | |
| 693 | 693 | //fetch entry detail |
| 694 | - $view_entries['count'] = 1; |
|
| 695 | - $view_entries['entries'][] = $entry; |
|
| 696 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 694 | + $view_entries[ 'count' ] = 1; |
|
| 695 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 696 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 697 | 697 | |
| 698 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 698 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 699 | 699 | |
| 700 | 700 | // set back link label |
| 701 | 701 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -705,11 +705,11 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // add template style |
| 708 | - self::add_style( $view_data['template_id'] ); |
|
| 708 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 709 | 709 | |
| 710 | 710 | // Prepare to render view and set vars |
| 711 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 712 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 711 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 712 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 713 | 713 | |
| 714 | 714 | // If Edit |
| 715 | 715 | if ( 'edit' === gravityview_get_context() ) { |
@@ -722,11 +722,11 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | } else { |
| 724 | 724 | // finaly we'll render some html |
| 725 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 725 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 726 | 726 | |
| 727 | 727 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 728 | 728 | foreach ( $sections as $section ) { |
| 729 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 729 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 730 | 730 | $gravityview_view->render( $view_slug, $section, false ); |
| 731 | 731 | } |
| 732 | 732 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $datetime_format = 'Y-m-d H:i:s'; |
| 781 | 781 | $search_is_outside_view_bounds = false; |
| 782 | 782 | |
| 783 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 783 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 784 | 784 | |
| 785 | 785 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 786 | 786 | |
@@ -808,14 +808,14 @@ discard block |
||
| 808 | 808 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 809 | 809 | |
| 810 | 810 | // Then we override the search and re-set the start date |
| 811 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 811 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 816 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 817 | 817 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 818 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 818 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 819 | 819 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 820 | 820 | } |
| 821 | 821 | } |
@@ -833,9 +833,9 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 835 | 835 | |
| 836 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 837 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 836 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 837 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 838 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 839 | 839 | |
| 840 | 840 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 841 | 841 | } |
@@ -859,12 +859,12 @@ discard block |
||
| 859 | 859 | */ |
| 860 | 860 | public static function is_entry_approved( $entry, $args = array() ) { |
| 861 | 861 | |
| 862 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 862 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 863 | 863 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 864 | 864 | return true; |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 867 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 868 | 868 | |
| 869 | 869 | if ( $is_approved ) { |
| 870 | 870 | return true; |
@@ -897,26 +897,26 @@ discard block |
||
| 897 | 897 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 898 | 898 | |
| 899 | 899 | // implicity search |
| 900 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 900 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 901 | 901 | |
| 902 | 902 | // Search operator options. Options: `is` or `contains` |
| 903 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 903 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 904 | 904 | |
| 905 | - $search_criteria['field_filters'][] = array( |
|
| 905 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 906 | 906 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 907 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 907 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 908 | 908 | 'operator' => $operator, |
| 909 | 909 | ); |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 912 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 913 | 913 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // Handle setting date range |
| 917 | 917 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 918 | 918 | |
| 919 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 919 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 920 | 920 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 921 | 921 | } |
| 922 | 922 | |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 928 | 928 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 929 | 929 | */ |
| 930 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 930 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 931 | 931 | |
| 932 | 932 | return $search_criteria; |
| 933 | 933 | } |
@@ -973,16 +973,16 @@ discard block |
||
| 973 | 973 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 974 | 974 | |
| 975 | 975 | // Paging & offset |
| 976 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 976 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 977 | 977 | |
| 978 | 978 | if ( -1 === $page_size ) { |
| 979 | 979 | $page_size = PHP_INT_MAX; |
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - if ( isset( $args['offset'] ) ) { |
|
| 983 | - $offset = intval( $args['offset'] ); |
|
| 982 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 983 | + $offset = intval( $args[ 'offset' ] ); |
|
| 984 | 984 | } else { |
| 985 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 985 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 986 | 986 | $offset = ( $curr_page - 1 ) * $page_size; |
| 987 | 987 | } |
| 988 | 988 | |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | 'search_criteria' => $search_criteria, |
| 1001 | 1001 | 'sorting' => $sorting, |
| 1002 | 1002 | 'paging' => $paging, |
| 1003 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1003 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1004 | 1004 | ); |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1026 | 1026 | * @param array $args View configuration args. |
| 1027 | 1027 | */ |
| 1028 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1028 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1029 | 1029 | |
| 1030 | 1030 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1031 | 1031 | |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | */ |
| 1066 | 1066 | public static function updateViewSorting( $args, $form_id ) { |
| 1067 | 1067 | $sorting = array(); |
| 1068 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1069 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1068 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1069 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1070 | 1070 | |
| 1071 | 1071 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1072 | 1072 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1108 | 1108 | |
| 1109 | - switch ( $sort_field['type'] ) { |
|
| 1109 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1110 | 1110 | |
| 1111 | 1111 | case 'address': |
| 1112 | 1112 | // Sorting by full address |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | */ |
| 1124 | 1124 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1125 | 1125 | |
| 1126 | - switch( strtolower( $address_part ) ){ |
|
| 1126 | + switch ( strtolower( $address_part ) ) { |
|
| 1127 | 1127 | case 'street': |
| 1128 | 1128 | $sort_field_id .= '.1'; |
| 1129 | 1129 | break; |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | */ |
| 1204 | 1204 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1205 | 1205 | |
| 1206 | - if ( empty( $single_entry ) ){ |
|
| 1206 | + if ( empty( $single_entry ) ) { |
|
| 1207 | 1207 | return false; |
| 1208 | 1208 | } else { |
| 1209 | 1209 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1231 | 1231 | * @since 1.15 |
| 1232 | 1232 | */ |
| 1233 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1233 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1234 | 1234 | continue; |
| 1235 | 1235 | } |
| 1236 | 1236 | |
@@ -1239,19 +1239,19 @@ discard block |
||
| 1239 | 1239 | $css_dependencies = array(); |
| 1240 | 1240 | |
| 1241 | 1241 | // If the thickbox is enqueued, add dependencies |
| 1242 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1242 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1243 | 1243 | |
| 1244 | 1244 | /** |
| 1245 | 1245 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1246 | 1246 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1247 | 1247 | */ |
| 1248 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1248 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1249 | 1249 | |
| 1250 | 1250 | /** |
| 1251 | 1251 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1252 | 1252 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1253 | 1253 | */ |
| 1254 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1254 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | /** |
@@ -1259,25 +1259,25 @@ discard block |
||
| 1259 | 1259 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1260 | 1260 | * @since 1.15 |
| 1261 | 1261 | */ |
| 1262 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1263 | - $css_dependencies[] = 'dashicons'; |
|
| 1262 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1263 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1267 | 1267 | |
| 1268 | 1268 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1269 | 1269 | |
| 1270 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1270 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1271 | 1271 | |
| 1272 | 1272 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1273 | 1273 | |
| 1274 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1274 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1275 | 1275 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1279 | 1279 | |
| 1280 | - self::add_style( $data['template_id'] ); |
|
| 1280 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1281 | 1281 | |
| 1282 | 1282 | } |
| 1283 | 1283 | |
@@ -1313,7 +1313,7 @@ discard block |
||
| 1313 | 1313 | } elseif ( empty( $template_id ) ) { |
| 1314 | 1314 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1315 | 1315 | } else { |
| 1316 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1316 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | } |
@@ -1338,11 +1338,11 @@ discard block |
||
| 1338 | 1338 | * Not a table-based template; don't add sort icons |
| 1339 | 1339 | * @since 1.12 |
| 1340 | 1340 | */ |
| 1341 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1341 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1342 | 1342 | return $label; |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1345 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1346 | 1346 | return $label; |
| 1347 | 1347 | } |
| 1348 | 1348 | |
@@ -1350,29 +1350,29 @@ discard block |
||
| 1350 | 1350 | |
| 1351 | 1351 | $class = 'gv-sort'; |
| 1352 | 1352 | |
| 1353 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1353 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1354 | 1354 | |
| 1355 | 1355 | $sort_args = array( |
| 1356 | - 'sort' => $field['id'], |
|
| 1356 | + 'sort' => $field[ 'id' ], |
|
| 1357 | 1357 | 'dir' => 'asc', |
| 1358 | 1358 | ); |
| 1359 | 1359 | |
| 1360 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1360 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1361 | 1361 | //toggle sorting direction. |
| 1362 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1363 | - $sort_args['dir'] = 'desc'; |
|
| 1362 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1363 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1364 | 1364 | $class .= ' gv-icon-sort-desc'; |
| 1365 | 1365 | } else { |
| 1366 | - $sort_args['dir'] = 'asc'; |
|
| 1366 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1367 | 1367 | $class .= ' gv-icon-sort-asc'; |
| 1368 | 1368 | } |
| 1369 | 1369 | } else { |
| 1370 | 1370 | $class .= ' gv-icon-caret-up-down'; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1373 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1374 | 1374 | |
| 1375 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1375 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1376 | 1376 | |
| 1377 | 1377 | } |
| 1378 | 1378 | |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | |
| 1391 | 1391 | $field_type = $field_id; |
| 1392 | 1392 | |
| 1393 | - if( is_numeric( $field_id ) ) { |
|
| 1393 | + if ( is_numeric( $field_id ) ) { |
|
| 1394 | 1394 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1395 | 1395 | $field_type = $field->type; |
| 1396 | 1396 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | return false; |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1416 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1417 | 1417 | |
| 1418 | 1418 | } |
| 1419 | 1419 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'type' => 'radio', |
| 64 | 64 | 'full_width' => true, |
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 67 | 67 | 'value' => 'any', |
| 68 | 68 | 'class' => 'hide-if-js', |
| 69 | 69 | 'options' => array( |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 149 | 149 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 150 | 150 | |
| 151 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 151 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * Add admin script to the whitelist |
| 201 | 201 | */ |
| 202 | 202 | public function register_no_conflict( $required ) { |
| 203 | - $required[] = 'gravityview_searchwidget_admin'; |
|
| 203 | + $required[ ] = 'gravityview_searchwidget_admin'; |
|
| 204 | 204 | return $required; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -213,24 +213,24 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public static function get_searchable_fields() { |
| 215 | 215 | |
| 216 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 216 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 217 | 217 | exit( '0' ); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $form = ''; |
| 221 | 221 | |
| 222 | 222 | // Fetch the form for the current View |
| 223 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 223 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 224 | 224 | |
| 225 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 225 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 226 | 226 | |
| 227 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 227 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 228 | 228 | |
| 229 | - $form = (int) $_POST['formid']; |
|
| 229 | + $form = (int)$_POST[ 'formid' ]; |
|
| 230 | 230 | |
| 231 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 231 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 232 | 232 | |
| 233 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 233 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | ) |
| 279 | 279 | ); |
| 280 | 280 | |
| 281 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 282 | - $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'] ); |
|
| 281 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 282 | + $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' ] ); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if ( ! empty( $fields ) ) { |
@@ -288,13 +288,13 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | foreach ( $fields as $id => $field ) { |
| 290 | 290 | |
| 291 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 291 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 292 | 292 | continue; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 295 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 296 | 296 | |
| 297 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 297 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 317 | 317 | |
| 318 | 318 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 319 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 319 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 320 | 320 | $input_type = 'boolean'; // on/off checkbox |
| 321 | 321 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 322 | 322 | $input_type = 'multi'; //multiselect |
@@ -358,19 +358,19 @@ discard block |
||
| 358 | 358 | $post_id = 0; |
| 359 | 359 | |
| 360 | 360 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 361 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 362 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 361 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 362 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 363 | 363 | } |
| 364 | 364 | // We're in the WordPress Widget context, and the base View ID should be used |
| 365 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 366 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 365 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 366 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 370 | 370 | |
| 371 | 371 | // Add hidden fields to the search form |
| 372 | 372 | foreach ( $args as $key => $value ) { |
| 373 | - $search_fields[] = array( |
|
| 373 | + $search_fields[ ] = array( |
|
| 374 | 374 | 'name' => $key, |
| 375 | 375 | 'input' => 'hidden', |
| 376 | 376 | 'value' => $value, |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function filter_entries( $search_criteria ) { |
| 393 | 393 | |
| 394 | - if( 'post' === $this->search_method ) { |
|
| 394 | + if ( 'post' === $this->search_method ) { |
|
| 395 | 395 | $get = $_POST; |
| 396 | 396 | } else { |
| 397 | 397 | $get = $_GET; |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | $get = gv_map_deep( $get, 'urldecode' ); |
| 409 | 409 | |
| 410 | 410 | // add free search |
| 411 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 411 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 412 | 412 | |
| 413 | 413 | // Search for a piece |
| 414 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 414 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 415 | 415 | |
| 416 | 416 | $words = array_filter( $words ); |
| 417 | 417 | |
| 418 | 418 | foreach ( $words as $word ) { |
| 419 | - $search_criteria['field_filters'][] = array( |
|
| 419 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 420 | 420 | 'key' => null, // The field ID to search |
| 421 | 421 | 'value' => $word, // The value to search |
| 422 | 422 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | //start date & end date |
| 428 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 429 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 428 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 429 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -441,16 +441,16 @@ discard block |
||
| 441 | 441 | /** |
| 442 | 442 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 443 | 443 | */ |
| 444 | - if( !empty( $curr_start ) ) { |
|
| 445 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 444 | + if ( ! empty( $curr_start ) ) { |
|
| 445 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 446 | 446 | } |
| 447 | - if( !empty( $curr_end ) ) { |
|
| 448 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 447 | + if ( ! empty( $curr_end ) ) { |
|
| 448 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // search for a specific entry ID |
| 452 | 452 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 453 | - $search_criteria['field_filters'][] = array( |
|
| 453 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 454 | 454 | 'key' => 'id', |
| 455 | 455 | 'value' => absint( $get[ 'gv_id' ] ), |
| 456 | 456 | 'operator' => '=', |
@@ -459,36 +459,36 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // search for a specific Created_by ID |
| 461 | 461 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 462 | - $search_criteria['field_filters'][] = array( |
|
| 462 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 463 | 463 | 'key' => 'created_by', |
| 464 | - 'value' => absint( $get['gv_by'] ), |
|
| 464 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 465 | 465 | 'operator' => '=', |
| 466 | 466 | ); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | // Get search mode passed in URL |
| 471 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 471 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 472 | 472 | |
| 473 | 473 | // get the other search filters |
| 474 | 474 | foreach ( $get as $key => $value ) { |
| 475 | 475 | |
| 476 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 476 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 477 | 477 | continue; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | // could return simple filter or multiple filters |
| 481 | 481 | $filter = $this->prepare_field_filter( $key, $value ); |
| 482 | 482 | |
| 483 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 484 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 483 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 484 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 485 | 485 | |
| 486 | 486 | // if date range type, set search mode to ALL |
| 487 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 487 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 488 | 488 | $mode = 'all'; |
| 489 | 489 | } |
| 490 | - } elseif( !empty( $filter ) ) { |
|
| 491 | - $search_criteria['field_filters'][] = $filter; |
|
| 490 | + } elseif ( ! empty( $filter ) ) { |
|
| 491 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @since 1.5.1 |
| 498 | 498 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 499 | 499 | */ |
| 500 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 500 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 501 | 501 | |
| 502 | 502 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 503 | 503 | |
@@ -535,11 +535,11 @@ discard block |
||
| 535 | 535 | 'value' => $value, |
| 536 | 536 | ); |
| 537 | 537 | |
| 538 | - switch ( $form_field['type'] ) { |
|
| 538 | + switch ( $form_field[ 'type' ] ) { |
|
| 539 | 539 | |
| 540 | 540 | case 'select': |
| 541 | 541 | case 'radio': |
| 542 | - $filter['operator'] = 'is'; |
|
| 542 | + $filter[ 'operator' ] = 'is'; |
|
| 543 | 543 | break; |
| 544 | 544 | |
| 545 | 545 | case 'post_category': |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | foreach ( $value as $val ) { |
| 555 | 555 | $cat = get_term( $val, 'category' ); |
| 556 | - $filter[] = array( |
|
| 556 | + $filter[ ] = array( |
|
| 557 | 557 | 'key' => $field_id, |
| 558 | 558 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 559 | 559 | 'operator' => 'is', |
@@ -572,18 +572,18 @@ discard block |
||
| 572 | 572 | $filter = array(); |
| 573 | 573 | |
| 574 | 574 | foreach ( $value as $val ) { |
| 575 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 575 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | break; |
| 579 | 579 | |
| 580 | 580 | case 'checkbox': |
| 581 | 581 | // convert checkbox on/off into the correct search filter |
| 582 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 583 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 584 | - if ( $input['id'] == $field_id ) { |
|
| 585 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 586 | - $filter['operator'] = 'is'; |
|
| 582 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 583 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 584 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 585 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 586 | + $filter[ 'operator' ] = 'is'; |
|
| 587 | 587 | break; |
| 588 | 588 | } |
| 589 | 589 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $filter = array(); |
| 594 | 594 | |
| 595 | 595 | foreach ( $value as $val ) { |
| 596 | - $filter[] = array( |
|
| 596 | + $filter[ ] = array( |
|
| 597 | 597 | 'key' => $field_id, |
| 598 | 598 | 'value' => $val, |
| 599 | 599 | 'operator' => 'is', |
@@ -614,9 +614,9 @@ discard block |
||
| 614 | 614 | foreach ( $words as $word ) { |
| 615 | 615 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 616 | 616 | // Keep the same key for each filter |
| 617 | - $filter['value'] = $word; |
|
| 617 | + $filter[ 'value' ] = $word; |
|
| 618 | 618 | // Add a search for the value |
| 619 | - $filters[] = $filter; |
|
| 619 | + $filters[ ] = $filter; |
|
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
@@ -643,19 +643,19 @@ discard block |
||
| 643 | 643 | * @since 1.16.3 |
| 644 | 644 | * Safeguard until GF implements '<=' operator |
| 645 | 645 | */ |
| 646 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 646 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 647 | 647 | $operator = '<'; |
| 648 | 648 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | - $filter[] = array( |
|
| 651 | + $filter[ ] = array( |
|
| 652 | 652 | 'key' => $field_id, |
| 653 | 653 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 654 | 654 | 'operator' => $operator, |
| 655 | 655 | ); |
| 656 | 656 | } |
| 657 | 657 | } else { |
| 658 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 658 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | break; |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | 'ymd_dot' => 'Y.m.d', |
| 687 | 687 | ); |
| 688 | 688 | |
| 689 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 689 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 690 | 690 | $format = $datepicker[ $field->dateFormat ]; |
| 691 | 691 | } |
| 692 | 692 | |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | public function add_template_path( $file_paths ) { |
| 718 | 718 | |
| 719 | 719 | // Index 100 is the default GravityView template path. |
| 720 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 720 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 721 | 721 | |
| 722 | 722 | return $file_paths; |
| 723 | 723 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // get configured search fields |
| 742 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 742 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 743 | 743 | |
| 744 | 744 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 745 | 745 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -753,24 +753,24 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $updated_field = $field; |
| 755 | 755 | |
| 756 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 756 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 757 | 757 | $has_date = true; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 761 | 761 | |
| 762 | - switch ( $field['field'] ) { |
|
| 762 | + switch ( $field[ 'field' ] ) { |
|
| 763 | 763 | |
| 764 | 764 | case 'search_all': |
| 765 | - $updated_field['key'] = 'search_all'; |
|
| 766 | - $updated_field['input'] = 'search_all'; |
|
| 767 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 765 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 766 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 767 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 768 | 768 | break; |
| 769 | 769 | |
| 770 | 770 | case 'entry_date': |
| 771 | - $updated_field['key'] = 'entry_date'; |
|
| 772 | - $updated_field['input'] = 'entry_date'; |
|
| 773 | - $updated_field['value'] = array( |
|
| 771 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 772 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 773 | + $updated_field[ 'value' ] = array( |
|
| 774 | 774 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 775 | 775 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 776 | 776 | ); |
@@ -778,16 +778,16 @@ discard block |
||
| 778 | 778 | break; |
| 779 | 779 | |
| 780 | 780 | case 'entry_id': |
| 781 | - $updated_field['key'] = 'entry_id'; |
|
| 782 | - $updated_field['input'] = 'entry_id'; |
|
| 783 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 781 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 782 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 783 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 784 | 784 | break; |
| 785 | 785 | |
| 786 | 786 | case 'created_by': |
| 787 | - $updated_field['key'] = 'created_by'; |
|
| 788 | - $updated_field['name'] = 'gv_by'; |
|
| 789 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 790 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 787 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 788 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 789 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 790 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 791 | 791 | break; |
| 792 | 792 | } |
| 793 | 793 | |
@@ -805,16 +805,16 @@ discard block |
||
| 805 | 805 | */ |
| 806 | 806 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 807 | 807 | |
| 808 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 808 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 809 | 809 | |
| 810 | 810 | /** @since 1.14 */ |
| 811 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 811 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 812 | 812 | |
| 813 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 813 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 814 | 814 | |
| 815 | 815 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 816 | 816 | |
| 817 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 817 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 818 | 818 | |
| 819 | 819 | if ( $has_date ) { |
| 820 | 820 | // enqueue datepicker stuff only if needed! |
@@ -834,10 +834,10 @@ discard block |
||
| 834 | 834 | public static function get_search_class( $custom_class = '' ) { |
| 835 | 835 | $gravityview_view = GravityView_View::getInstance(); |
| 836 | 836 | |
| 837 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 837 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 838 | 838 | |
| 839 | - if ( ! empty( $custom_class ) ) { |
|
| 840 | - $search_class .= ' '.$custom_class; |
|
| 839 | + if ( ! empty( $custom_class ) ) { |
|
| 840 | + $search_class .= ' ' . $custom_class; |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -880,11 +880,11 @@ discard block |
||
| 880 | 880 | |
| 881 | 881 | $label = rgget( 'label', $field ); |
| 882 | 882 | |
| 883 | - if( '' === $label ) { |
|
| 883 | + if ( '' === $label ) { |
|
| 884 | 884 | |
| 885 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 885 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 886 | 886 | |
| 887 | - switch( $field['field'] ) { |
|
| 887 | + switch ( $field[ 'field' ] ) { |
|
| 888 | 888 | case 'search_all': |
| 889 | 889 | $label = __( 'Search Entries:', 'gravityview' ); |
| 890 | 890 | break; |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | break; |
| 903 | 903 | default: |
| 904 | 904 | // If this is a field input, not a field |
| 905 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 905 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 906 | 906 | |
| 907 | 907 | // Get the label for the field in question, which returns an array |
| 908 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 908 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 909 | 909 | |
| 910 | 910 | // Get the item with the `label` key |
| 911 | 911 | $values = wp_list_pluck( $items, 'label' ); |
@@ -942,32 +942,32 @@ discard block |
||
| 942 | 942 | $form = $gravityview_view->getForm(); |
| 943 | 943 | |
| 944 | 944 | // for advanced field ids (eg, first name / last name ) |
| 945 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 945 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 946 | 946 | |
| 947 | 947 | // get searched value from $_GET/$_POST (string or array) |
| 948 | 948 | $value = $this->rgget_or_rgpost( $name ); |
| 949 | 949 | |
| 950 | 950 | // get form field details |
| 951 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 951 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 952 | 952 | |
| 953 | 953 | $filter = array( |
| 954 | - 'key' => $field['field'], |
|
| 954 | + 'key' => $field[ 'field' ], |
|
| 955 | 955 | 'name' => $name, |
| 956 | 956 | 'label' => self::get_field_label( $field, $form_field ), |
| 957 | - 'input' => $field['input'], |
|
| 957 | + 'input' => $field[ 'input' ], |
|
| 958 | 958 | 'value' => $value, |
| 959 | - 'type' => $form_field['type'], |
|
| 959 | + 'type' => $form_field[ 'type' ], |
|
| 960 | 960 | ); |
| 961 | 961 | |
| 962 | 962 | // collect choices |
| 963 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 964 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 965 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 966 | - $filter['choices'] = $form_field['choices']; |
|
| 963 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 964 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 965 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 966 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 970 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 969 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 970 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | return $filter; |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | $choices = array(); |
| 993 | 993 | foreach ( $users as $user ) { |
| 994 | - $choices[] = array( |
|
| 994 | + $choices[ ] = array( |
|
| 995 | 995 | 'value' => $user->ID, |
| 996 | 996 | 'text' => $user->display_name, |
| 997 | 997 | ); |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | */ |
| 1046 | 1046 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1047 | 1047 | |
| 1048 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1048 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1049 | 1049 | |
| 1050 | 1050 | return $js_dependencies; |
| 1051 | 1051 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | 'isRTL' => is_rtl(), |
| 1090 | 1090 | ), $view_data ); |
| 1091 | 1091 | |
| 1092 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1092 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1093 | 1093 | |
| 1094 | 1094 | return $localizations; |
| 1095 | 1095 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1113 | 1113 | |
| 1114 | 1114 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1115 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1115 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1116 | 1116 | |
| 1117 | 1117 | /** |
| 1118 | 1118 | * @filter `gravityview_search_datepicker_class` |