@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,18 +234,18 @@ discard block |
||
234 | 234 | |
235 | 235 | if ( ! empty( $view_id ) ) { |
236 | 236 | |
237 | - $this->context_view_id = (int) $view_id; |
|
237 | + $this->context_view_id = (int)$view_id; |
|
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | */ |
244 | - $this->context_view_id = (int) $_GET['gvid']; |
|
244 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
245 | 245 | |
246 | 246 | } elseif ( ! $multiple_views ) { |
247 | 247 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
248 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
248 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
249 | 249 | unset( $array_keys ); |
250 | 250 | } |
251 | 251 | |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | global $wp_rewrite; |
279 | 279 | |
280 | 280 | $is_front_page = ( $query->is_home || $query->is_page ); |
281 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
282 | - $front_page_id = get_option('page_on_front'); |
|
281 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
282 | + $front_page_id = get_option( 'page_on_front' ); |
|
283 | 283 | |
284 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | 285 | |
286 | 286 | // Force to be an array, potentially a query string ( entry=16 ) |
287 | 287 | $_query = wp_parse_args( $query->query ); |
288 | 288 | |
289 | 289 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
290 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
291 | - unset( $_query['pagename'] ); |
|
290 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
291 | + unset( $_query[ 'pagename' ] ); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // this is where will break from core wordpress |
295 | 295 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
296 | 296 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
297 | 297 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | $blocks = parse_blocks( $post_content ); |
352 | 352 | |
353 | 353 | foreach ( $blocks as $block ) { |
354 | - if ( empty( $block['attrs']['ref'] ) ) { |
|
354 | + if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - $block_post = get_post( $block['attrs']['ref'] ); |
|
358 | + $block_post = get_post( $block[ 'attrs' ][ 'ref' ] ); |
|
359 | 359 | |
360 | 360 | if ( $block_post ) { |
361 | 361 | $post_content .= $block_post->post_content; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
410 | 410 | |
411 | - if( 'post' === $search_method ) { |
|
411 | + if ( 'post' === $search_method ) { |
|
412 | 412 | $get = $_POST; |
413 | 413 | } else { |
414 | 414 | $get = $_GET; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $gventry = gravityview()->request->is_entry(); |
461 | 461 | |
462 | 462 | // If this is the directory view, return. |
463 | - if( ! $gventry ) { |
|
463 | + if ( ! $gventry ) { |
|
464 | 464 | return $passed_title; |
465 | 465 | } |
466 | 466 | |
@@ -478,19 +478,19 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | // WooCommerce doesn't $post_id |
481 | - if ( empty( $passed_post_id ) ) { |
|
481 | + if ( empty( $passed_post_id ) ) { |
|
482 | 482 | return $passed_title; |
483 | 483 | } |
484 | 484 | |
485 | 485 | // Don't modify the title for anything other than the current view/post. |
486 | 486 | // This is true for embedded shortcodes and Views. |
487 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
487 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
488 | 488 | return $passed_title; |
489 | 489 | } |
490 | 490 | |
491 | 491 | $view = gravityview()->request->is_view(); |
492 | 492 | |
493 | - if( $view ) { |
|
493 | + if ( $view ) { |
|
494 | 494 | return $this->_get_single_entry_title( $view, $entry, $passed_title ); |
495 | 495 | } |
496 | 496 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | $view_collection = \GV\View_Collection::from_post( $post ); |
514 | 514 | |
515 | 515 | // We have multiple Views, but no gvid...this isn't valid security |
516 | - if( 1 < $view_collection->count() ) { |
|
516 | + if ( 1 < $view_collection->count() ) { |
|
517 | 517 | return $passed_title; |
518 | 518 | } |
519 | 519 | |
@@ -547,18 +547,18 @@ discard block |
||
547 | 547 | */ |
548 | 548 | $check_entry_display = apply_filters( 'gravityview/single/title/check_entry_display', true, $entry, $view ); |
549 | 549 | |
550 | - if( $check_entry_display ) { |
|
550 | + if ( $check_entry_display ) { |
|
551 | 551 | |
552 | 552 | $check_display = GVCommon::check_entry_display( $entry, $view ); |
553 | 553 | |
554 | - if( is_wp_error( $check_display ) ) { |
|
554 | + if ( is_wp_error( $check_display ) ) { |
|
555 | 555 | return $passed_title; |
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | 559 | $title = $view->settings->get( 'single_title', $passed_title ); |
560 | 560 | |
561 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
561 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
562 | 562 | |
563 | 563 | // We are allowing HTML in the fields, so no escaping the output |
564 | 564 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | $context = GravityView_View::getInstance()->getContext(); |
631 | 631 | |
632 | - switch( $context ) { |
|
632 | + switch ( $context ) { |
|
633 | 633 | case 'directory': |
634 | 634 | $tab = __( 'Multiple Entries', 'gravityview' ); |
635 | 635 | break; |
@@ -643,12 +643,12 @@ discard block |
||
643 | 643 | } |
644 | 644 | |
645 | 645 | |
646 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
646 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
647 | 647 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
648 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
648 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
649 | 649 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
650 | 650 | |
651 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
651 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
652 | 652 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
653 | 653 | |
654 | 654 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID ); |
696 | 696 | $embed_only = $view->settings->get( 'embed_only' ); |
697 | 697 | |
698 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
698 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
699 | 699 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
700 | 700 | } |
701 | 701 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $datetime_format = 'Y-m-d H:i:s'; |
743 | 743 | $search_is_outside_view_bounds = false; |
744 | 744 | |
745 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
745 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
746 | 746 | |
747 | 747 | $search_date = strtotime( $search_criteria[ $key ], GFCommon::get_local_timestamp() ); |
748 | 748 | |
@@ -770,14 +770,14 @@ discard block |
||
770 | 770 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
771 | 771 | |
772 | 772 | // Then we override the search and re-set the start date |
773 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
773 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
774 | 774 | } |
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
778 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
779 | 779 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
780 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
780 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
781 | 781 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
782 | 782 | } |
783 | 783 | } |
@@ -796,19 +796,19 @@ discard block |
||
796 | 796 | public static function process_search_only_approved( $args, $search_criteria ) { |
797 | 797 | |
798 | 798 | /** @since 1.19 */ |
799 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
799 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
800 | 800 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
801 | 801 | return $search_criteria; |
802 | 802 | } |
803 | 803 | |
804 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
804 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
805 | 805 | |
806 | - $search_criteria['field_filters'][] = array( |
|
806 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
807 | 807 | 'key' => GravityView_Entry_Approval::meta_key, |
808 | 808 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
809 | 809 | ); |
810 | 810 | |
811 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
811 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
812 | 812 | |
813 | 813 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
814 | 814 | } |
@@ -835,18 +835,18 @@ discard block |
||
835 | 835 | */ |
836 | 836 | public static function is_entry_approved( $entry, $args = array() ) { |
837 | 837 | |
838 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
838 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
839 | 839 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
840 | 840 | return true; |
841 | 841 | } |
842 | 842 | |
843 | 843 | /** @since 1.19 */ |
844 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
844 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
845 | 845 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
846 | 846 | return true; |
847 | 847 | } |
848 | 848 | |
849 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
849 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
850 | 850 | |
851 | 851 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
852 | 852 | } |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
871 | 871 | */ |
872 | 872 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
873 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
873 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -890,29 +890,29 @@ discard block |
||
890 | 890 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) ); |
891 | 891 | |
892 | 892 | // implicity search |
893 | - if ( ! empty( $args['search_value'] ) ) { |
|
893 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
894 | 894 | |
895 | 895 | // Search operator options. Options: `is` or `contains` |
896 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
896 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
897 | 897 | |
898 | - $search_criteria['field_filters'][] = array( |
|
898 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
899 | 899 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
900 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
900 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
901 | 901 | 'operator' => $operator, |
902 | 902 | ); |
903 | 903 | |
904 | 904 | // Lock search mode to "all" with implicit presearch filter. |
905 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
905 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
906 | 906 | } |
907 | 907 | |
908 | - if( $search_criteria !== $original_search_criteria ) { |
|
908 | + if ( $search_criteria !== $original_search_criteria ) { |
|
909 | 909 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) ); |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Handle setting date range |
913 | 913 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
914 | 914 | |
915 | - if( $search_criteria !== $original_search_criteria ) { |
|
915 | + if ( $search_criteria !== $original_search_criteria ) { |
|
916 | 916 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) ); |
917 | 917 | } |
918 | 918 | |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
924 | 924 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
925 | 925 | */ |
926 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
926 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
927 | 927 | |
928 | 928 | return $search_criteria; |
929 | 929 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | 'search_criteria' => $search_criteria, |
1036 | 1036 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1037 | 1037 | 'paging' => $paging, |
1038 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1038 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1039 | 1039 | ); |
1040 | 1040 | |
1041 | 1041 | /** |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1061 | 1061 | * @param array $args View configuration args. |
1062 | 1062 | */ |
1063 | - $parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1063 | + $parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1064 | 1064 | |
1065 | 1065 | gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) ); |
1066 | 1066 | |
@@ -1085,17 +1085,17 @@ discard block |
||
1085 | 1085 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1086 | 1086 | |
1087 | 1087 | // Paging & offset |
1088 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1088 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1089 | 1089 | |
1090 | 1090 | if ( -1 === $page_size ) { |
1091 | 1091 | $page_size = PHP_INT_MAX; |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1094 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1095 | 1095 | $offset = ( $curr_page - 1 ) * $page_size; |
1096 | 1096 | |
1097 | - if ( ! empty( $args['offset'] ) ) { |
|
1098 | - $offset += intval( $args['offset'] ); |
|
1097 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1098 | + $offset += intval( $args[ 'offset' ] ); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | $paging = array( |
@@ -1120,11 +1120,11 @@ discard block |
||
1120 | 1120 | public static function updateViewSorting( $args, $form_id ) { |
1121 | 1121 | $sorting = array(); |
1122 | 1122 | |
1123 | - $has_values = isset( $_GET['sort'] ); |
|
1123 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
1124 | 1124 | |
1125 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
1126 | - $sorts = array_keys( $_GET['sort'] ); |
|
1127 | - $dirs = array_values( $_GET['sort'] ); |
|
1125 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
1126 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
1127 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
1128 | 1128 | |
1129 | 1129 | if ( $has_values = array_filter( $dirs ) ) { |
1130 | 1130 | $sort_field_id = end( $sorts ); |
@@ -1133,11 +1133,11 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | if ( ! isset( $sort_field_id ) ) { |
1136 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1136 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | if ( ! isset( $sort_direction ) ) { |
1140 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1140 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | if ( is_array( $sort_field_id ) ) { |
@@ -1169,10 +1169,10 @@ discard block |
||
1169 | 1169 | $form = GFAPI::get_form( $form_id ); |
1170 | 1170 | |
1171 | 1171 | // Get the first GF_Field field ID, set as the key for entry randomization |
1172 | - if ( ! empty( $form['fields'] ) ) { |
|
1172 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1173 | 1173 | |
1174 | 1174 | /** @var GF_Field $field */ |
1175 | - foreach ( $form['fields'] as $field ) { |
|
1175 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1176 | 1176 | if ( ! is_a( $field, 'GF_Field' ) ) { |
1177 | 1177 | continue; |
1178 | 1178 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | if ( is_array( $sort_field_id ) ) { |
1218 | 1218 | $modified_ids = array(); |
1219 | 1219 | foreach ( $sort_field_id as $_sort_field_id ) { |
1220 | - $modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1220 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1221 | 1221 | } |
1222 | 1222 | return $modified_ids; |
1223 | 1223 | } |
@@ -1226,11 +1226,11 @@ discard block |
||
1226 | 1226 | |
1227 | 1227 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1228 | 1228 | |
1229 | - if( ! $sort_field ) { |
|
1229 | + if ( ! $sort_field ) { |
|
1230 | 1230 | return $sort_field_id; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - switch ( $sort_field['type'] ) { |
|
1233 | + switch ( $sort_field[ 'type' ] ) { |
|
1234 | 1234 | |
1235 | 1235 | case 'address': |
1236 | 1236 | // Sorting by full address |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | */ |
1248 | 1248 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1249 | 1249 | |
1250 | - switch( strtolower( $address_part ) ){ |
|
1250 | + switch ( strtolower( $address_part ) ) { |
|
1251 | 1251 | case 'street': |
1252 | 1252 | $sort_field_id .= '.1'; |
1253 | 1253 | break; |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | if ( ! class_exists( '\GV\Entry' ) ) { |
1321 | 1321 | |
1322 | 1322 | // Not using gravityview()->log->error(), since that may not exist yet either! |
1323 | - do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1323 | + do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1324 | 1324 | |
1325 | 1325 | return null; |
1326 | 1326 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | */ |
1338 | 1338 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1339 | 1339 | |
1340 | - if ( empty( $single_entry ) ){ |
|
1340 | + if ( empty( $single_entry ) ) { |
|
1341 | 1341 | return false; |
1342 | 1342 | } else { |
1343 | 1343 | return $single_entry; |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | $views = $this->getGvOutputData()->get_views(); |
1359 | 1359 | |
1360 | 1360 | foreach ( $views as $view_id => $data ) { |
1361 | - $view = \GV\View::by_id( $data['id'] ); |
|
1361 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1362 | 1362 | $view_id = $view->ID; |
1363 | 1363 | $template_id = gravityview_get_template_id( $view->ID ); |
1364 | 1364 | $data = $view->as_data(); |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1368 | 1368 | * @since 1.15 |
1369 | 1369 | */ |
1370 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1370 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1371 | 1371 | continue; |
1372 | 1372 | } |
1373 | 1373 | |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * @param \GV\View The View. |
1397 | 1397 | */ |
1398 | 1398 | $js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
1399 | - $js_dependencies[] = $js_dependency; |
|
1399 | + $js_dependencies[ ] = $js_dependency; |
|
1400 | 1400 | |
1401 | 1401 | /** |
1402 | 1402 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | * @param \GV\View The View. |
1413 | 1413 | */ |
1414 | 1414 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
1415 | - $css_dependencies[] = $css_dependency; |
|
1415 | + $css_dependencies[ ] = $css_dependency; |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /** |
@@ -1420,19 +1420,19 @@ discard block |
||
1420 | 1420 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1421 | 1421 | * @since 1.15 |
1422 | 1422 | */ |
1423 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1424 | - $css_dependencies[] = 'dashicons'; |
|
1423 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1424 | + $css_dependencies[ ] = 'dashicons'; |
|
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1428 | 1428 | |
1429 | 1429 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1430 | 1430 | |
1431 | - 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 ); |
|
1431 | + 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 ); |
|
1432 | 1432 | |
1433 | 1433 | wp_enqueue_script( 'gravityview-fe-view' ); |
1434 | 1434 | |
1435 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1435 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1436 | 1436 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1437 | 1437 | } |
1438 | 1438 | |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | public static function add_style( $template_id ) { |
1496 | 1496 | |
1497 | 1497 | if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
1498 | - gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1498 | + gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1499 | 1499 | wp_enqueue_style( 'gravityview_style_' . $template_id ); |
1500 | 1500 | } elseif ( empty( $template_id ) ) { |
1501 | 1501 | gravityview()->log->error( 'Cannot add template style; template_id is empty' ); |
@@ -1526,11 +1526,11 @@ discard block |
||
1526 | 1526 | * Not a table-based template; don't add sort icons |
1527 | 1527 | * @since 1.12 |
1528 | 1528 | */ |
1529 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1529 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1530 | 1530 | return $label; |
1531 | 1531 | } |
1532 | 1532 | |
1533 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1533 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1534 | 1534 | return $label; |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1538,29 +1538,29 @@ discard block |
||
1538 | 1538 | |
1539 | 1539 | $class = 'gv-sort'; |
1540 | 1540 | |
1541 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1541 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1542 | 1542 | |
1543 | 1543 | $sort_args = array( |
1544 | - 'sort' => $field['id'], |
|
1544 | + 'sort' => $field[ 'id' ], |
|
1545 | 1545 | 'dir' => 'asc', |
1546 | 1546 | ); |
1547 | 1547 | |
1548 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1548 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1549 | 1549 | //toggle sorting direction. |
1550 | - if ( 'asc' === $sorting['direction'] ) { |
|
1551 | - $sort_args['dir'] = 'desc'; |
|
1550 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1551 | + $sort_args[ 'dir' ] = 'desc'; |
|
1552 | 1552 | $class .= ' gv-icon-sort-desc'; |
1553 | 1553 | } else { |
1554 | - $sort_args['dir'] = 'asc'; |
|
1554 | + $sort_args[ 'dir' ] = 'asc'; |
|
1555 | 1555 | $class .= ' gv-icon-sort-asc'; |
1556 | 1556 | } |
1557 | 1557 | } else { |
1558 | 1558 | $class .= ' gv-icon-caret-up-down'; |
1559 | 1559 | } |
1560 | 1560 | |
1561 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1561 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1562 | 1562 | |
1563 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1563 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1564 | 1564 | |
1565 | 1565 | } |
1566 | 1566 | |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | |
1579 | 1579 | $field_type = $field_id; |
1580 | 1580 | |
1581 | - if( is_numeric( $field_id ) ) { |
|
1581 | + if ( is_numeric( $field_id ) ) { |
|
1582 | 1582 | $field = GFFormsModel::get_field( $form, $field_id ); |
1583 | 1583 | $field_type = $field ? $field->type : $field_id; |
1584 | 1584 | } |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | return false; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1604 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1605 | 1605 | |
1606 | 1606 | } |
1607 | 1607 |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | if ( ! $detailed ) { |
556 | 556 | $defaults = array(); |
557 | 557 | foreach ( $default_settings as $key => $value ) { |
558 | - $defaults[ $key ] = $value['value']; |
|
558 | + $defaults[ $key ] = $value[ 'value' ]; |
|
559 | 559 | } |
560 | 560 | return $defaults; |
561 | 561 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // If the $group argument is set for the method, |
567 | 567 | // ignore any settings that aren't in that group. |
568 | 568 | if ( ! empty( $group ) && is_string( $group ) ) { |
569 | - if ( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
569 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
570 | 570 | unset( $default_settings[ $key ] ); |
571 | 571 | } |
572 | 572 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | return; |
305 | 305 | } |
306 | 306 | |
307 | - $locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
307 | + $locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
308 | 308 | |
309 | 309 | gravityview()->log->error( sprintf( 'Unable to load textdomain for %s locale.', $locale ) ); |
310 | 310 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | */ |
527 | 527 | private function get_php_version() { |
528 | 528 | |
529 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
530 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
529 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
530 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | */ |
540 | 540 | private function get_wordpress_version() { |
541 | 541 | |
542 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
543 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
542 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
543 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | */ |
553 | 553 | private function get_gravityforms_version() { |
554 | 554 | |
555 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
555 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
556 | 556 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
557 | 557 | |
558 | 558 | return null; |
559 | 559 | } |
560 | 560 | |
561 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
562 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
561 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
562 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | $items = get_posts( array( |
606 | 606 | 'post_type' => 'gravityview', |
607 | 607 | 'post_status' => 'any', |
608 | - 'numberposts' => - 1, |
|
608 | + 'numberposts' => -1, |
|
609 | 609 | 'fields' => 'ids', |
610 | 610 | ) ); |
611 | 611 | |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $tables = array(); |
620 | 620 | |
621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
622 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
622 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
624 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
624 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | foreach ( $tables as $meta_table ) { |
@@ -640,9 +640,9 @@ discard block |
||
640 | 640 | $tables = array(); |
641 | 641 | |
642 | 642 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
643 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
643 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
644 | 644 | } elseif ( ! $this->is_GF_25() ) { |
645 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
645 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function maybe_add_article_to_tooltip( $tooltip = '', $article = array(), $url = '', $atts = '', $css_class = '', $anchor_text = '' ) { |
55 | 55 | |
56 | - if ( empty( $article['id'] ) ) { |
|
56 | + if ( empty( $article[ 'id' ] ) ) { |
|
57 | 57 | return $tooltip; |
58 | 58 | } |
59 | 59 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | $css_class .= ' gv_tooltip'; |
71 | 71 | |
72 | - if ( ! empty( $article['type'] ) ) { |
|
73 | - $atts = sprintf( 'data-beacon-article-%s="%s"', $article['type'], $article['id'] ); |
|
72 | + if ( ! empty( $article[ 'type' ] ) ) { |
|
73 | + $atts = sprintf( 'data-beacon-article-%s="%s"', $article[ 'type' ], $article[ 'id' ] ); |
|
74 | 74 | } else { |
75 | - $atts = sprintf( 'data-beacon-article="%s"', $article['id'] ); |
|
75 | + $atts = sprintf( 'data-beacon-article="%s"', $article[ 'id' ] ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $url = \GV\Utils::get( $article, 'url', '#' ); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | ) ); |
173 | 173 | |
174 | 174 | // This is just HTML we don't need. |
175 | - unset( $response['message'] ); |
|
175 | + unset( $response[ 'message' ] ); |
|
176 | 176 | |
177 | - switch ( intval( $response['price_id'] ) ) { |
|
177 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
178 | 178 | default: |
179 | 179 | case 1: |
180 | 180 | $package = 'Core'; |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | 'signature' => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ), |
203 | 203 | 'affiliate_id' => gravityview()->plugin->settings->get( 'affiliate_id' ), |
204 | 204 | 'is_super_admin' => is_super_admin(), |
205 | - 'license_key' => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')', |
|
205 | + 'license_key' => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')', |
|
206 | 206 | 'license_level' => $package, |
207 | 207 | 'alt_emails' => sprintf( 'Admin: %s, GV Support: %s', get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ), |
208 | - 'payment_details' => $response['customer_name'] . ' ' . $response['customer_email'], |
|
208 | + 'payment_details' => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ], |
|
209 | 209 | 'wordpress_version' => get_bloginfo( 'version', 'display' ), |
210 | - 'php_version' => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ), |
|
210 | + 'php_version' => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ), |
|
211 | 211 | 'no_conflict_mode' => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled', |
212 | 212 | 'gravityview_version' => \GV\Plugin::$version, |
213 | 213 | 'gravity_forms_version' => GFForms::$version, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ob_get_clean(); |
218 | 218 | |
219 | 219 | // Help Scout length limit is 200 characters |
220 | - foreach( $data as $key => $value ) { |
|
220 | + foreach ( $data as $key => $value ) { |
|
221 | 221 | if ( ! is_string( $value ) ) { |
222 | 222 | continue; |
223 | 223 | } |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | $this->api_data = $_api_data; |
49 | 49 | $this->name = plugin_basename( $_plugin_file ); |
50 | 50 | $this->slug = basename( $_plugin_file, '.php' ); |
51 | - $this->version = $_api_data['version']; |
|
52 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
53 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
54 | - $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
51 | + $this->version = $_api_data[ 'version' ]; |
|
52 | + $this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false; |
|
53 | + $this->beta = ! empty( $this->api_data[ 'beta' ] ) ? true : false; |
|
54 | + $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ); |
|
55 | 55 | |
56 | 56 | $edd_plugin_data[ $this->slug ] = $this->api_data; |
57 | 57 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
176 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
180 | - if( ! is_multisite() ) { |
|
180 | + if ( ! is_multisite() ) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
270 | 270 | esc_html( $version_info->new_version ), |
271 | 271 | '</a>', |
272 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
272 | + '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">', |
|
273 | 273 | '</a>' |
274 | 274 | ); |
275 | 275 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $_data->contributors = $this->convert_object_to_array( $_data->contributors ); |
354 | 354 | } |
355 | 355 | |
356 | - if( ! isset( $_data->plugin ) ) { |
|
356 | + if ( ! isset( $_data->plugin ) ) { |
|
357 | 357 | $_data->plugin = $this->name; |
358 | 358 | } |
359 | 359 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | $verify_ssl = $this->verify_ssl(); |
397 | 397 | if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
398 | - $args['sslverify'] = $verify_ssl; |
|
398 | + $args[ 'sslverify' ] = $verify_ssl; |
|
399 | 399 | } |
400 | 400 | return $args; |
401 | 401 | |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) { |
424 | 424 | $test_url_parts = parse_url( $this->api_url ); |
425 | 425 | |
426 | - $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http'; |
|
427 | - $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : ''; |
|
428 | - $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : ''; |
|
426 | + $scheme = ! empty( $test_url_parts[ 'scheme' ] ) ? $test_url_parts[ 'scheme' ] : 'http'; |
|
427 | + $host = ! empty( $test_url_parts[ 'host' ] ) ? $test_url_parts[ 'host' ] : ''; |
|
428 | + $port = ! empty( $test_url_parts[ 'port' ] ) ? ':' . $test_url_parts[ 'port' ] : ''; |
|
429 | 429 | |
430 | 430 | if ( empty( $host ) ) { |
431 | 431 | $edd_plugin_url_available[ $store_hash ] = false; |
@@ -442,27 +442,27 @@ discard block |
||
442 | 442 | |
443 | 443 | $data = array_merge( $this->api_data, $_data ); |
444 | 444 | |
445 | - if ( $data['slug'] != $this->slug ) { |
|
445 | + if ( $data[ 'slug' ] != $this->slug ) { |
|
446 | 446 | return false; |
447 | 447 | } |
448 | 448 | |
449 | - if ( $this->api_url == trailingslashit ( home_url() ) ) { |
|
449 | + if ( $this->api_url == trailingslashit( home_url() ) ) { |
|
450 | 450 | return false; // Don't allow a plugin to ping itself |
451 | 451 | } |
452 | 452 | |
453 | 453 | $api_params = array( |
454 | 454 | 'edd_action' => 'get_version', |
455 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
456 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
457 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
458 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
459 | - 'slug' => $data['slug'], |
|
460 | - 'author' => $data['author'], |
|
455 | + 'license' => ! empty( $data[ 'license' ] ) ? $data[ 'license' ] : '', |
|
456 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
457 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
458 | + 'version' => isset( $data[ 'version' ] ) ? $data[ 'version' ] : false, |
|
459 | + 'slug' => $data[ 'slug' ], |
|
460 | + 'author' => $data[ 'author' ], |
|
461 | 461 | 'url' => home_url(), |
462 | - 'beta' => ! empty( $data['beta'] ), |
|
462 | + 'beta' => ! empty( $data[ 'beta' ] ), |
|
463 | 463 | ); |
464 | 464 | |
465 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
465 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) ); |
|
466 | 466 | |
467 | 467 | if ( ! is_wp_error( $request ) ) { |
468 | 468 | $request = json_decode( wp_remote_retrieve_body( $request ) ); |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | if ( ! empty( $request->sections ) ) { |
486 | - foreach( $request->sections as $key => $section ) { |
|
487 | - $request->$key = (array) $section; |
|
486 | + foreach ( $request->sections as $key => $section ) { |
|
487 | + $request->$key = (array)$section; |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
@@ -498,35 +498,35 @@ discard block |
||
498 | 498 | |
499 | 499 | global $edd_plugin_data; |
500 | 500 | |
501 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
501 | + if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' != $_REQUEST[ 'edd_sl_action' ] ) { |
|
502 | 502 | return; |
503 | 503 | } |
504 | 504 | |
505 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
505 | + if ( empty( $_REQUEST[ 'plugin' ] ) ) { |
|
506 | 506 | return; |
507 | 507 | } |
508 | 508 | |
509 | - if( empty( $_REQUEST['slug'] ) ) { |
|
509 | + if ( empty( $_REQUEST[ 'slug' ] ) ) { |
|
510 | 510 | return; |
511 | 511 | } |
512 | 512 | |
513 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
513 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
514 | 514 | wp_die( __( 'You do not have permission to install plugin updates', 'gravityview' ), __( 'Error', 'gravityview' ), array( 'response' => 403 ) ); |
515 | 515 | } |
516 | 516 | |
517 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
517 | + $data = $edd_plugin_data[ $_REQUEST[ 'slug' ] ]; |
|
518 | 518 | $version_info = $this->get_cached_version_info(); |
519 | 519 | |
520 | - if( false === $version_info ) { |
|
520 | + if ( false === $version_info ) { |
|
521 | 521 | |
522 | 522 | $api_params = array( |
523 | 523 | 'edd_action' => 'get_version', |
524 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
525 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
526 | - 'slug' => $_REQUEST['slug'], |
|
527 | - 'author' => $data['author'], |
|
524 | + 'item_name' => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false, |
|
525 | + 'item_id' => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false, |
|
526 | + 'slug' => $_REQUEST[ 'slug' ], |
|
527 | + 'author' => $data[ 'author' ], |
|
528 | 528 | 'url' => home_url(), |
529 | - 'beta' => ! empty( $data['beta'] ) |
|
529 | + 'beta' => ! empty( $data[ 'beta' ] ) |
|
530 | 530 | ); |
531 | 531 | |
532 | 532 | $verify_ssl = $this->verify_ssl(); |
@@ -542,22 +542,22 @@ discard block |
||
542 | 542 | $version_info = false; |
543 | 543 | } |
544 | 544 | |
545 | - if( ! empty( $version_info ) ) { |
|
546 | - foreach( $version_info->sections as $key => $section ) { |
|
547 | - $version_info->$key = (array) $section; |
|
545 | + if ( ! empty( $version_info ) ) { |
|
546 | + foreach ( $version_info->sections as $key => $section ) { |
|
547 | + $version_info->$key = (array)$section; |
|
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | 551 | $this->set_version_info_cache( $version_info ); |
552 | 552 | |
553 | 553 | // Delete the unneeded option |
554 | - delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) ); |
|
554 | + delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST[ 'plugin' ] ) . '_' . $this->beta . '_version_info' ) ); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | if ( isset( $version_info->sections ) ) { |
558 | 558 | $sections = $this->convert_object_to_array( $version_info->sections ); |
559 | - if ( ! empty( $sections['changelog'] ) ) { |
|
560 | - echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>'; |
|
559 | + if ( ! empty( $sections[ 'changelog' ] ) ) { |
|
560 | + echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>'; |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
@@ -572,25 +572,25 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function get_cached_version_info( $cache_key = '' ) { |
574 | 574 | |
575 | - if( empty( $cache_key ) ) { |
|
575 | + if ( empty( $cache_key ) ) { |
|
576 | 576 | $cache_key = $this->cache_key; |
577 | 577 | } |
578 | 578 | |
579 | 579 | $cache = get_option( $cache_key ); |
580 | 580 | |
581 | - if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) { |
|
581 | + if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) { |
|
582 | 582 | return false; // Cache is expired |
583 | 583 | } |
584 | 584 | |
585 | 585 | // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point. |
586 | - $cache['value'] = json_decode( $cache['value'] ); |
|
587 | - if ( ! empty( $cache['value']->icons ) ) { |
|
588 | - $cache['value']->icons = (array) $cache['value']->icons; |
|
589 | - } elseif ( $cache['value'] ) { |
|
590 | - $cache['value']->icons = array(); |
|
586 | + $cache[ 'value' ] = json_decode( $cache[ 'value' ] ); |
|
587 | + if ( ! empty( $cache[ 'value' ]->icons ) ) { |
|
588 | + $cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons; |
|
589 | + } elseif ( $cache[ 'value' ] ) { |
|
590 | + $cache[ 'value' ]->icons = array(); |
|
591 | 591 | } |
592 | 592 | |
593 | - return $cache['value']; |
|
593 | + return $cache[ 'value' ]; |
|
594 | 594 | |
595 | 595 | } |
596 | 596 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | */ |
603 | 603 | public function set_version_info_cache( $value = '', $cache_key = '' ) { |
604 | 604 | |
605 | - if( empty( $cache_key ) ) { |
|
605 | + if ( empty( $cache_key ) ) { |
|
606 | 606 | $cache_key = $this->cache_key; |
607 | 607 | } |
608 | 608 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | update_option( $cache_key, $data, 'no' ); |
615 | 615 | |
616 | 616 | // Delete the duplicate option |
617 | - delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) ); |
|
617 | + delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) ); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /** |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | * @return bool |
625 | 625 | */ |
626 | 626 | private function verify_ssl() { |
627 | - return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
627 | + return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this ); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | array( |
84 | 84 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
85 | 85 | 'action' => 'entry_creator_get_users', |
86 | - 'gf25' => (bool) gravityview()->plugin->is_GF_25(), |
|
86 | + 'gf25' => (bool)gravityview()->plugin->is_GF_25(), |
|
87 | 87 | 'language' => array( |
88 | 88 | 'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ), |
89 | 89 | ), |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | ) |
108 | 108 | ); |
109 | 109 | |
110 | - if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) { |
|
110 | + if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) { |
|
111 | 111 | die(); |
112 | 112 | } |
113 | 113 | |
114 | - $search_string = $post_var['q']; |
|
114 | + $search_string = $post_var[ 'q' ]; |
|
115 | 115 | |
116 | 116 | if ( is_numeric( $search_string ) ) { |
117 | 117 | $user_args = array( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
161 | - $result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true ); |
|
161 | + $result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true ); |
|
162 | 162 | |
163 | 163 | if ( false === $result ) { |
164 | 164 | $status = __( 'Error', 'gravityview' ); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | - GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' ); |
|
183 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' ); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | // If screen mode isn't set, then we're in the wrong place. |
218 | - if ( empty( $_REQUEST['screen_mode'] ) ) { |
|
218 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
219 | 219 | return; |
220 | 220 | } |
221 | 221 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
243 | 243 | if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
244 | - $_POST["screen_mode"] = 'edit'; |
|
244 | + $_POST[ "screen_mode" ] = 'edit'; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' ); |
317 | 317 | |
318 | 318 | $entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) ); |
319 | - $entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array(); |
|
319 | + $entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array(); |
|
320 | 320 | |
321 | 321 | $output .= '<option value="0" ' . selected( true, empty( $entry_creator_user_id ), false ) . '> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
322 | 322 | |
@@ -335,18 +335,18 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | $user_count = count_users(); |
338 | - $user_count = $user_count['total_users']; |
|
338 | + $user_count = $user_count[ 'total_users' ]; |
|
339 | 339 | $users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 ); |
340 | 340 | if ( $user_count > $users_displayed ) { |
341 | 341 | $remaining_users = $user_count - $users_displayed; |
342 | - $user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users ); |
|
342 | + $user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users ); |
|
343 | 343 | $message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' ); |
344 | 344 | $message = sprintf( $message, $remaining_users, $user_users ); |
345 | - $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
345 | + $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | $output .= '</select>'; |
349 | - $output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />'; |
|
349 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
350 | 350 | $output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false ); |
351 | 351 | |
352 | 352 | echo $output; |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * @return array |
361 | 361 | */ |
362 | 362 | function register_gform_noconflict( $assets ) { |
363 | - $assets[] = 'gravityview_selectwoo'; |
|
364 | - $assets[] = 'gravityview_entry_creator'; |
|
363 | + $assets[ ] = 'gravityview_selectwoo'; |
|
364 | + $assets[ ] = 'gravityview_entry_creator'; |
|
365 | 365 | |
366 | 366 | return $assets; |
367 | 367 | } |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | |
45 | 45 | if ( $object->show_previous_button ) { |
46 | 46 | $previous_tabindex = GFCommon::get_tabindex(); |
47 | - $previous_label = GFCommon::replace_variables( $labels['previous'], $object->form, $object->entry ); |
|
47 | + $previous_label = GFCommon::replace_variables( $labels[ 'previous' ], $object->form, $object->entry ); |
|
48 | 48 | ?> |
49 | - <input id="gform_previous_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $previous_label ); ?>" name="save" /> |
|
49 | + <input id="gform_previous_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-previous" type="submit" <?php echo $previous_tabindex; ?> value="<?php echo esc_attr( $previous_label ); ?>" name="save" /> |
|
50 | 50 | <?php |
51 | 51 | } |
52 | 52 | |
53 | 53 | if ( $object->show_next_button ) { |
54 | - $next_tabindex = GFCommon::get_tabindex(); |
|
55 | - $next_label = GFCommon::replace_variables( $labels['next'], $object->form, $object->entry ); |
|
54 | + $next_tabindex = GFCommon::get_tabindex(); |
|
55 | + $next_label = GFCommon::replace_variables( $labels[ 'next' ], $object->form, $object->entry ); |
|
56 | 56 | ?> |
57 | - <input id="gform_next_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $next_label ); ?>" name="save" /> |
|
57 | + <input id="gform_next_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-next" type="submit" <?php echo $next_tabindex; ?> value="<?php echo esc_attr( $next_label ); ?>" name="save" /> |
|
58 | 58 | <?php |
59 | 59 | } |
60 | 60 | |
61 | 61 | if ( $object->show_update_button ) { |
62 | - $update_tabindex = GFCommon::get_tabindex(); |
|
63 | - $update_label = GFCommon::replace_variables( $labels['submit'], $object->form, $object->entry ); |
|
62 | + $update_tabindex = GFCommon::get_tabindex(); |
|
63 | + $update_label = GFCommon::replace_variables( $labels[ 'submit' ], $object->form, $object->entry ); |
|
64 | 64 | ?> |
65 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $update_label ); ?>" name="save" /> |
|
65 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" <?php echo $update_tabindex; ?> value="<?php echo esc_attr( $update_label ); ?>" name="save" /> |
|
66 | 66 | <?php |
67 | 67 | } |
68 | 68 | |
69 | - $cancel_tabindex = GFCommon::get_tabindex(); |
|
70 | - $cancel_label = GFCommon::replace_variables( $labels['cancel'], $object->form, $object->entry ); |
|
69 | + $cancel_tabindex = GFCommon::get_tabindex(); |
|
70 | + $cancel_label = GFCommon::replace_variables( $labels[ 'cancel' ], $object->form, $object->entry ); |
|
71 | 71 | |
72 | 72 | // If the entry has been edited, history.back() will keep pointing to the Edit Entry screen. Go back before editing, please! |
73 | 73 | // On first visit, will be history.go(-1) because (0 + 1 * -1). |
74 | 74 | // After updating twice, history.go(-3) because (2 + 1 * -1) |
75 | - $update_count = (int) \GV\Utils::_POST( 'update_count', 0 ); |
|
75 | + $update_count = (int)\GV\Utils::_POST( 'update_count', 0 ); |
|
76 | 76 | $cancel_onclick = 'history.go(' . ( $update_count + 1 ) * -1 . '); return false;'; |
77 | 77 | ?> |
78 | 78 | <a class="btn btn-sm button button-small gv-button-cancel" onclick="<?php echo esc_attr( $cancel_onclick ); ?>" <?php echo $cancel_tabindex; ?> href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $cancel_label ); ?></a> |
@@ -94,5 +94,5 @@ discard block |
||
94 | 94 | ?> |
95 | 95 | <input type='hidden' name='update_count' value='<?php echo $update_count + 1; ?>'/> |
96 | 96 | <input type="hidden" name="action" value="update" /> |
97 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
97 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
98 | 98 | </div> |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | foreach ( $field->choices as $choice ) { |
49 | 49 | if ( is_array( $value ) && RGFormsModel::choice_value_match( $field, $choice, $value[ $input_id ] ) ) { |
50 | - return $choice['score']; |
|
50 | + return $choice[ 'score' ]; |
|
51 | 51 | } else if ( ! is_array( $value ) && RGFormsModel::choice_value_match( $field, $choice, $value ) ) { |
52 | - return $choice['score']; |
|
52 | + return $choice[ 'score' ]; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
60 | 60 | |
61 | - unset( $field_options['search_filter'] ); |
|
61 | + unset( $field_options[ 'search_filter' ] ); |
|
62 | 62 | |
63 | 63 | if ( 'edit' === $context ) { |
64 | 64 | return $field_options; |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | 'text' => __( 'Text value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ), |
81 | 81 | ); |
82 | 82 | |
83 | - if( $field->field->gsurveyLikertEnableScoring ) { |
|
84 | - $likert_display_options['score'] = __( 'Score value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ); |
|
83 | + if ( $field->field->gsurveyLikertEnableScoring ) { |
|
84 | + $likert_display_options[ 'score' ] = __( 'Score value of the selected choice', 'gravityview' ) . ( $show_suffix ? '' : $multiple_rows_suffix ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // Maintain for back-compatibility |
88 | - $add_options['score'] = array( |
|
88 | + $add_options[ 'score' ] = array( |
|
89 | 89 | 'type' => 'hidden', |
90 | 90 | 'value' => '', |
91 | 91 | 'group' => 'display', |
92 | 92 | ); |
93 | 93 | |
94 | - $add_options['choice_display'] = array( |
|
94 | + $add_options[ 'choice_display' ] = array( |
|
95 | 95 | 'type' => 'radio', |
96 | 96 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
97 | 97 | 'options' => $likert_display_options, |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - if( 'checkbox' === $field->field->inputType && $input_id ) { |
|
107 | - $field_options['choice_display'] = array( |
|
106 | + if ( 'checkbox' === $field->field->inputType && $input_id ) { |
|
107 | + $field_options[ 'choice_display' ] = array( |
|
108 | 108 | 'type' => 'radio', |
109 | 109 | 'class' => 'vertical', |
110 | 110 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | if ( 'rating' === $field->field->inputType ) { |
123 | - $field_options['choice_display'] = array( |
|
123 | + $field_options[ 'choice_display' ] = array( |
|
124 | 124 | 'type' => 'radio', |
125 | 125 | 'class' => 'vertical', |
126 | 126 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'search_clear' => array( |
56 | 56 | 'type' => 'checkbox', |
57 | 57 | 'label' => __( 'Show Clear button', 'gravityview' ), |
58 | - 'desc' => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'), |
|
58 | + 'desc' => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ), |
|
59 | 59 | 'value' => true, |
60 | 60 | ), |
61 | 61 | 'search_fields' => array( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'type' => 'radio', |
69 | 69 | 'full_width' => true, |
70 | 70 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
71 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
71 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
72 | 72 | 'value' => 'any', |
73 | 73 | 'class' => 'hide-if-js', |
74 | 74 | 'options' => array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
89 | 89 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
90 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
90 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
91 | 91 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
92 | 92 | |
93 | 93 | // ajax - get the searchable fields |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function add_reserved_args( $args ) { |
125 | 125 | |
126 | - $args[] = 'gv_search'; |
|
127 | - $args[] = 'gv_start'; |
|
128 | - $args[] = 'gv_end'; |
|
129 | - $args[] = 'gv_id'; |
|
130 | - $args[] = 'gv_by'; |
|
131 | - $args[] = 'mode'; |
|
126 | + $args[ ] = 'gv_search'; |
|
127 | + $args[ ] = 'gv_start'; |
|
128 | + $args[ ] = 'gv_end'; |
|
129 | + $args[ ] = 'gv_id'; |
|
130 | + $args[ ] = 'gv_by'; |
|
131 | + $args[ ] = 'mode'; |
|
132 | 132 | |
133 | - $get = (array) $_GET; |
|
133 | + $get = (array)$_GET; |
|
134 | 134 | |
135 | 135 | // If the fields being searched as reserved; not to be considered user-passed variables |
136 | 136 | foreach ( $get as $key => $value ) { |
137 | 137 | if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) { |
138 | - $args[] = $key; |
|
138 | + $args[ ] = $key; |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
260 | 260 | $script_source = empty( $script_min ) ? '/source' : ''; |
261 | 261 | |
262 | - 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 ); |
|
262 | + 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 ); |
|
263 | 263 | |
264 | 264 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
265 | 265 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
282 | 282 | */ |
283 | 283 | public function register_no_conflict( $allowed ) { |
284 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
284 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
285 | 285 | return $allowed; |
286 | 286 | } |
287 | 287 | |
@@ -293,24 +293,24 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public static function get_searchable_fields() { |
295 | 295 | |
296 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
296 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
297 | 297 | exit( '0' ); |
298 | 298 | } |
299 | 299 | |
300 | 300 | $form = ''; |
301 | 301 | |
302 | 302 | // Fetch the form for the current View |
303 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
303 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
304 | 304 | |
305 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
305 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
306 | 306 | |
307 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
307 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
308 | 308 | |
309 | - $form = (int) $_POST['formid']; |
|
309 | + $form = (int)$_POST[ 'formid' ]; |
|
310 | 310 | |
311 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
311 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
312 | 312 | |
313 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
313 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
314 | 314 | |
315 | 315 | } |
316 | 316 | |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | ); |
361 | 361 | |
362 | 362 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
363 | - $custom_fields['is_approved'] = array( |
|
363 | + $custom_fields[ 'is_approved' ] = array( |
|
364 | 364 | 'text' => esc_html__( 'Approval Status', 'gravityview' ), |
365 | 365 | 'type' => 'multi', |
366 | 366 | ); |
367 | 367 | } |
368 | 368 | |
369 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
370 | - $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'] ); |
|
369 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
370 | + $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' ] ); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // Get fields with sub-inputs and no parent |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | |
390 | 390 | foreach ( $fields as $id => $field ) { |
391 | 391 | |
392 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
392 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
393 | 393 | continue; |
394 | 394 | } |
395 | 395 | |
396 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
396 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
397 | 397 | |
398 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
398 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
419 | 419 | |
420 | 420 | // @todo - This needs to be improved - many fields have . including products and addresses |
421 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
421 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
422 | 422 | $input_type = 'boolean'; // on/off checkbox |
423 | 423 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
424 | 424 | $input_type = 'multi'; //multiselect |
@@ -464,19 +464,19 @@ discard block |
||
464 | 464 | $post_id = 0; |
465 | 465 | |
466 | 466 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
467 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
468 | - $post_id = absint( $widget_args['post_id'] ); |
|
467 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
468 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
469 | 469 | } |
470 | 470 | // We're in the WordPress Widget context, and the base View ID should be used |
471 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
472 | - $post_id = absint( $widget_args['view_id'] ); |
|
471 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
472 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | $args = gravityview_get_permalink_query_args( $post_id ); |
476 | 476 | |
477 | 477 | // Add hidden fields to the search form |
478 | 478 | foreach ( $args as $key => $value ) { |
479 | - $search_fields[] = array( |
|
479 | + $search_fields[ ] = array( |
|
480 | 480 | 'name' => $key, |
481 | 481 | 'input' => 'hidden', |
482 | 482 | 'value' => $value, |
@@ -515,28 +515,28 @@ discard block |
||
515 | 515 | /** |
516 | 516 | * Include the sidebar Widgets. |
517 | 517 | */ |
518 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
518 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
519 | 519 | |
520 | 520 | foreach ( $widgets as $widget ) { |
521 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
522 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
521 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
522 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
523 | 523 | foreach ( $_fields as $field ) { |
524 | - if ( empty( $field['form_id'] ) ) { |
|
525 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
524 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
525 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
526 | 526 | } |
527 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
527 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
528 | 528 | } |
529 | 529 | } |
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | 533 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
534 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
534 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
535 | 535 | foreach ( $_fields as $field ) { |
536 | - if ( empty( $field['form_id'] ) ) { |
|
537 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
536 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
537 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
538 | 538 | } |
539 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
539 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
575 | 575 | } |
576 | 576 | |
577 | - if( 'post' === $this->search_method ) { |
|
577 | + if ( 'post' === $this->search_method ) { |
|
578 | 578 | $get = $_POST; |
579 | 579 | } else { |
580 | 580 | $get = $_GET; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $get = gv_map_deep( $get, 'rawurldecode' ); |
594 | 594 | |
595 | 595 | // Make sure array key is set up |
596 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
596 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
597 | 597 | |
598 | 598 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
599 | 599 | $searchable_field_objects = $this->get_view_searchable_fields( $view, true ); |
@@ -613,9 +613,9 @@ discard block |
||
613 | 613 | $trim_search_value = apply_filters( 'gravityview/search-trim-input', true ); |
614 | 614 | |
615 | 615 | // add free search |
616 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
616 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
617 | 617 | |
618 | - $search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search']; |
|
618 | + $search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ]; |
|
619 | 619 | |
620 | 620 | if ( $split_words ) { |
621 | 621 | // Search for a piece |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | } |
632 | 632 | |
633 | 633 | foreach ( $words as $word ) { |
634 | - $search_criteria['field_filters'][] = array( |
|
634 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
635 | 635 | 'key' => null, // The field ID to search |
636 | 636 | 'value' => $word, // The value to search |
637 | 637 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -644,14 +644,14 @@ discard block |
||
644 | 644 | /** |
645 | 645 | * Get and normalize the dates according to the input format. |
646 | 646 | */ |
647 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
648 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
647 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
648 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
649 | 649 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
650 | 650 | } |
651 | 651 | } |
652 | 652 | |
653 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
654 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
653 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
654 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
655 | 655 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
656 | 656 | } |
657 | 657 | } |
@@ -687,22 +687,22 @@ discard block |
||
687 | 687 | */ |
688 | 688 | if ( ! empty( $curr_start ) ) { |
689 | 689 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
690 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
690 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | if ( ! empty( $curr_end ) ) { |
694 | 694 | // Fast-forward 24 hour on the end time |
695 | 695 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
696 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
697 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
698 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
696 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
697 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
698 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
699 | 699 | } |
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
703 | 703 | // search for a specific entry ID |
704 | 704 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
705 | - $search_criteria['field_filters'][] = array( |
|
705 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
706 | 706 | 'key' => 'id', |
707 | 707 | 'value' => absint( $get[ 'gv_id' ] ), |
708 | 708 | 'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ), |
@@ -711,15 +711,15 @@ discard block |
||
711 | 711 | |
712 | 712 | // search for a specific Created_by ID |
713 | 713 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
714 | - $search_criteria['field_filters'][] = array( |
|
714 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
715 | 715 | 'key' => 'created_by', |
716 | - 'value' => $get['gv_by'], |
|
716 | + 'value' => $get[ 'gv_by' ], |
|
717 | 717 | 'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ), |
718 | 718 | ); |
719 | 719 | } |
720 | 720 | |
721 | 721 | // Get search mode passed in URL |
722 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
722 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
723 | 723 | |
724 | 724 | // get the other search filters |
725 | 725 | foreach ( $get as $key => $value ) { |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value ); |
729 | 729 | } |
730 | 730 | |
731 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
731 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
732 | 732 | continue; // Not a filter, or empty |
733 | 733 | } |
734 | 734 | |
@@ -742,21 +742,21 @@ discard block |
||
742 | 742 | continue; |
743 | 743 | } |
744 | 744 | |
745 | - if ( ! isset( $filter['operator'] ) ) { |
|
746 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
745 | + if ( ! isset( $filter[ 'operator' ] ) ) { |
|
746 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
747 | 747 | } |
748 | 748 | |
749 | - if ( isset( $filter[0]['value'] ) ) { |
|
750 | - $filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value']; |
|
749 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
750 | + $filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ]; |
|
751 | 751 | |
752 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
752 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
753 | 753 | |
754 | 754 | // if date range type, set search mode to ALL |
755 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
755 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
756 | 756 | $mode = 'all'; |
757 | 757 | } |
758 | - } elseif( !empty( $filter ) ) { |
|
759 | - $search_criteria['field_filters'][] = $filter; |
|
758 | + } elseif ( ! empty( $filter ) ) { |
|
759 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | * @since 1.5.1 |
766 | 766 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
767 | 767 | */ |
768 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
768 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
769 | 769 | |
770 | 770 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
771 | 771 | |
@@ -799,19 +799,19 @@ discard block |
||
799 | 799 | |
800 | 800 | $query_class = $view->get_query_class(); |
801 | 801 | |
802 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
802 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
803 | 803 | return; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $widgets = $view->widgets->by_id( $this->widget_id ); |
807 | 807 | if ( $widgets->count() ) { |
808 | 808 | $widgets = $widgets->all(); |
809 | - $widget = $widgets[0]; |
|
809 | + $widget = $widgets[ 0 ]; |
|
810 | 810 | |
811 | 811 | $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ); |
812 | 812 | |
813 | - foreach ( (array) $search_fields as $search_field ) { |
|
814 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
813 | + foreach ( (array)$search_fields as $search_field ) { |
|
814 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
815 | 815 | $created_by_text_mode = true; |
816 | 816 | } |
817 | 817 | } |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $extra_conditions = array(); |
821 | 821 | $mode = 'any'; |
822 | 822 | |
823 | - foreach ( $search_criteria['field_filters'] as &$filter ) { |
|
823 | + foreach ( $search_criteria[ 'field_filters' ] as &$filter ) { |
|
824 | 824 | if ( ! is_array( $filter ) ) { |
825 | 825 | if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) { |
826 | 826 | $mode = $filter; |
@@ -829,13 +829,13 @@ discard block |
||
829 | 829 | } |
830 | 830 | |
831 | 831 | // Construct a manual query for unapproved statuses |
832 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) { |
|
833 | - $_tmp_query = new $query_class( $view->form->ID, array( |
|
832 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) { |
|
833 | + $_tmp_query = new $query_class( $view->form->ID, array( |
|
834 | 834 | 'field_filters' => array( |
835 | 835 | array( |
836 | 836 | 'operator' => 'in', |
837 | 837 | 'key' => 'is_approved', |
838 | - 'value' => (array) $filter['value'], |
|
838 | + 'value' => (array)$filter[ 'value' ], |
|
839 | 839 | ), |
840 | 840 | array( |
841 | 841 | 'operator' => 'is', |
@@ -847,30 +847,30 @@ discard block |
||
847 | 847 | ) ); |
848 | 848 | $_tmp_query_parts = $_tmp_query->_introspect(); |
849 | 849 | |
850 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
850 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
851 | 851 | |
852 | 852 | $filter = false; |
853 | 853 | continue; |
854 | 854 | } |
855 | 855 | |
856 | 856 | // Construct manual query for text mode creator search |
857 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
858 | - $extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
857 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
858 | + $extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
859 | 859 | $filter = false; |
860 | 860 | continue; |
861 | 861 | } |
862 | 862 | |
863 | 863 | // By default, we want searches to be wildcard for each field. |
864 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
864 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
865 | 865 | |
866 | 866 | // For multichoice, let's have an in (OR) search. |
867 | - if ( is_array( $filter['value'] ) ) { |
|
868 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
867 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
868 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | // Default form with joins functionality |
872 | - if ( empty( $filter['form_id'] ) ) { |
|
873 | - $filter['form_id'] = $view->form ? $view->form->ID : 0; |
|
872 | + if ( empty( $filter[ 'form_id' ] ) ) { |
|
873 | + $filter[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -880,28 +880,28 @@ discard block |
||
880 | 880 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
881 | 881 | * @param \GV\View $view The View we're operating on. |
882 | 882 | */ |
883 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view ); |
|
883 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view ); |
|
884 | 884 | } |
885 | 885 | |
886 | - if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) { |
|
886 | + if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) { |
|
887 | 887 | $date_criteria = array(); |
888 | 888 | |
889 | - if ( isset( $search_criteria['start_date'] ) ) { |
|
890 | - $date_criteria['start_date'] = $search_criteria['start_date']; |
|
889 | + if ( isset( $search_criteria[ 'start_date' ] ) ) { |
|
890 | + $date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ]; |
|
891 | 891 | } |
892 | 892 | |
893 | - if ( isset( $search_criteria['end_date'] ) ) { |
|
894 | - $date_criteria['end_date'] = $search_criteria['end_date']; |
|
893 | + if ( isset( $search_criteria[ 'end_date' ] ) ) { |
|
894 | + $date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ]; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | $_tmp_query = new $query_class( $view->form->ID, $date_criteria ); |
898 | 898 | $_tmp_query_parts = $_tmp_query->_introspect(); |
899 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
899 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | $search_conditions = array(); |
903 | 903 | |
904 | - if ( $filters = array_filter( $search_criteria['field_filters'] ) ) { |
|
904 | + if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) { |
|
905 | 905 | foreach ( $filters as &$filter ) { |
906 | 906 | if ( ! is_array( $filter ) ) { |
907 | 907 | continue; |
@@ -913,12 +913,12 @@ discard block |
||
913 | 913 | * code by reusing what's inside GF_Query already as they |
914 | 914 | * take care of many small things like forcing numeric, etc. |
915 | 915 | */ |
916 | - $_tmp_query = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
916 | + $_tmp_query = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
917 | 917 | $_tmp_query_parts = $_tmp_query->_introspect(); |
918 | - $search_condition = $_tmp_query_parts['where']; |
|
918 | + $search_condition = $_tmp_query_parts[ 'where' ]; |
|
919 | 919 | |
920 | - if ( empty( $filter['key'] ) && $search_condition->expressions ) { |
|
921 | - $search_conditions[] = $search_condition; |
|
920 | + if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) { |
|
921 | + $search_conditions[ ] = $search_condition; |
|
922 | 922 | } else { |
923 | 923 | $left = $search_condition->left; |
924 | 924 | $alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' ); |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $on = $_join->join_on; |
929 | 929 | $join = $_join->join; |
930 | 930 | |
931 | - $search_conditions[] = GF_Query_Condition::_or( |
|
931 | + $search_conditions[ ] = GF_Query_Condition::_or( |
|
932 | 932 | // Join |
933 | 933 | new GF_Query_Condition( |
934 | 934 | new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ), |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | ); |
945 | 945 | } |
946 | 946 | } else { |
947 | - $search_conditions[] = new GF_Query_Condition( |
|
947 | + $search_conditions[ ] = new GF_Query_Condition( |
|
948 | 948 | new GF_Query_Column( $left->field_id, $left->source, $alias ), |
949 | 949 | $search_condition->operator, |
950 | 950 | $search_condition->right |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | /** |
967 | 967 | * Combine the parts as a new WHERE clause. |
968 | 968 | */ |
969 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) ); |
|
969 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) ); |
|
970 | 970 | $query->where( $where ); |
971 | 971 | } |
972 | 972 | |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | $field_id = str_replace( 'filter_', '', $key ); |
990 | 990 | |
991 | 991 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
992 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
992 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
993 | 993 | $field_id = str_replace( '_', '.', $field_id ); |
994 | 994 | } |
995 | 995 | |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | // form is in searchable fields |
1047 | 1047 | $found = false; |
1048 | 1048 | foreach ( $searchable_fields as $field ) { |
1049 | - if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) { |
|
1049 | + if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) { |
|
1050 | 1050 | $found = true; |
1051 | 1051 | break; |
1052 | 1052 | } |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | |
1087 | 1087 | case 'select': |
1088 | 1088 | case 'radio': |
1089 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1089 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1090 | 1090 | break; |
1091 | 1091 | |
1092 | 1092 | case 'post_category': |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | foreach ( $value as $val ) { |
1102 | 1102 | $cat = get_term( $val, 'category' ); |
1103 | - $filter[] = array( |
|
1103 | + $filter[ ] = array( |
|
1104 | 1104 | 'key' => $field_id, |
1105 | 1105 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
1106 | 1106 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $filter = array(); |
1120 | 1120 | |
1121 | 1121 | foreach ( $value as $val ) { |
1122 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
1122 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | break; |
@@ -1128,9 +1128,9 @@ discard block |
||
1128 | 1128 | // convert checkbox on/off into the correct search filter |
1129 | 1129 | if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
1130 | 1130 | foreach ( $form_field->inputs as $k => $input ) { |
1131 | - if ( $input['id'] == $field_id ) { |
|
1132 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
1133 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1131 | + if ( $input[ 'id' ] == $field_id ) { |
|
1132 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
1133 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1134 | 1134 | break; |
1135 | 1135 | } |
1136 | 1136 | } |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $filter = array(); |
1141 | 1141 | |
1142 | 1142 | foreach ( $value as $val ) { |
1143 | - $filter[] = array( |
|
1143 | + $filter[ ] = array( |
|
1144 | 1144 | 'key' => $field_id, |
1145 | 1145 | 'value' => $val, |
1146 | 1146 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | foreach ( $words as $word ) { |
1162 | 1162 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
1163 | 1163 | // Keep the same key for each filter |
1164 | - $filter['value'] = $word; |
|
1164 | + $filter[ 'value' ] = $word; |
|
1165 | 1165 | // Add a search for the value |
1166 | - $filters[] = $filter; |
|
1166 | + $filters[ ] = $filter; |
|
1167 | 1167 | } |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1177,19 +1177,19 @@ discard block |
||
1177 | 1177 | |
1178 | 1178 | foreach ( $searchable_fields as $searchable_field ) { |
1179 | 1179 | |
1180 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
1180 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
1181 | 1181 | continue; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | // Only exact-match dropdowns, not text search |
1185 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
1185 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
1186 | 1186 | continue; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
1190 | 1190 | |
1191 | 1191 | if ( 4 === $input_id ) { |
1192 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1192 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1193 | 1193 | }; |
1194 | 1194 | } |
1195 | 1195 | } |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @since 1.16.3 |
1218 | 1218 | * Safeguard until GF implements '<=' operator |
1219 | 1219 | */ |
1220 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1220 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1221 | 1221 | $operator = '<'; |
1222 | 1222 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
1223 | 1223 | } |
1224 | 1224 | |
1225 | - $filter[] = array( |
|
1225 | + $filter[ ] = array( |
|
1226 | 1226 | 'key' => $field_id, |
1227 | 1227 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
1228 | 1228 | 'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ), |
@@ -1230,12 +1230,12 @@ discard block |
||
1230 | 1230 | } |
1231 | 1231 | } else { |
1232 | 1232 | $date = $value; |
1233 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1234 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1233 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1234 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | - if ('payment_date' === $key) { |
|
1238 | - $filter['operator'] = 'contains'; |
|
1237 | + if ( 'payment_date' === $key ) { |
|
1238 | + $filter[ 'operator' ] = 'contains'; |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | break; |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | 'ymd_dot' => 'Y.m.d', |
1265 | 1265 | ); |
1266 | 1266 | |
1267 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
1267 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
1268 | 1268 | $format = $datepicker[ $field->dateFormat ]; |
1269 | 1269 | } |
1270 | 1270 | |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | public function add_template_path( $file_paths ) { |
1302 | 1302 | |
1303 | 1303 | // Index 100 is the default GravityView template path. |
1304 | - $file_paths[102] = self::$file . 'templates/'; |
|
1304 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
1305 | 1305 | |
1306 | 1306 | return $file_paths; |
1307 | 1307 | } |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | $has_date = false; |
1321 | 1321 | |
1322 | 1322 | foreach ( $search_fields as $k => $field ) { |
1323 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1323 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1324 | 1324 | $has_date = true; |
1325 | 1325 | break; |
1326 | 1326 | } |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | $view = \GV\View::by_id( $gravityview_view->view_id ); |
1350 | 1350 | |
1351 | 1351 | // get configured search fields |
1352 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
1352 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
1353 | 1353 | |
1354 | 1354 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
1355 | 1355 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1363,39 +1363,39 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | $updated_field = $this->get_search_filter_details( $updated_field, $context ); |
1365 | 1365 | |
1366 | - switch ( $field['field'] ) { |
|
1366 | + switch ( $field[ 'field' ] ) { |
|
1367 | 1367 | |
1368 | 1368 | case 'search_all': |
1369 | - $updated_field['key'] = 'search_all'; |
|
1370 | - $updated_field['input'] = 'search_all'; |
|
1371 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1369 | + $updated_field[ 'key' ] = 'search_all'; |
|
1370 | + $updated_field[ 'input' ] = 'search_all'; |
|
1371 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1372 | 1372 | break; |
1373 | 1373 | |
1374 | 1374 | case 'entry_date': |
1375 | - $updated_field['key'] = 'entry_date'; |
|
1376 | - $updated_field['input'] = 'entry_date'; |
|
1377 | - $updated_field['value'] = array( |
|
1375 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1376 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1377 | + $updated_field[ 'value' ] = array( |
|
1378 | 1378 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1379 | 1379 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1380 | 1380 | ); |
1381 | 1381 | break; |
1382 | 1382 | |
1383 | 1383 | case 'entry_id': |
1384 | - $updated_field['key'] = 'entry_id'; |
|
1385 | - $updated_field['input'] = 'entry_id'; |
|
1386 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1384 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1385 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1386 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1387 | 1387 | break; |
1388 | 1388 | |
1389 | 1389 | case 'created_by': |
1390 | - $updated_field['key'] = 'created_by'; |
|
1391 | - $updated_field['name'] = 'gv_by'; |
|
1392 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1390 | + $updated_field[ 'key' ] = 'created_by'; |
|
1391 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1392 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1393 | 1393 | break; |
1394 | 1394 | |
1395 | 1395 | case 'is_approved': |
1396 | - $updated_field['key'] = 'is_approved'; |
|
1397 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1398 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
1396 | + $updated_field[ 'key' ] = 'is_approved'; |
|
1397 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1398 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
1399 | 1399 | break; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1416,16 +1416,16 @@ discard block |
||
1416 | 1416 | |
1417 | 1417 | $gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args ); |
1418 | 1418 | |
1419 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1419 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1420 | 1420 | |
1421 | 1421 | /** @since 1.14 */ |
1422 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1422 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1423 | 1423 | |
1424 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1424 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1425 | 1425 | |
1426 | 1426 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1427 | 1427 | |
1428 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1428 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1429 | 1429 | |
1430 | 1430 | if ( $this->has_date_field( $search_fields ) ) { |
1431 | 1431 | // enqueue datepicker stuff only if needed! |
@@ -1447,10 +1447,10 @@ discard block |
||
1447 | 1447 | public static function get_search_class( $custom_class = '' ) { |
1448 | 1448 | $gravityview_view = GravityView_View::getInstance(); |
1449 | 1449 | |
1450 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1450 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1451 | 1451 | |
1452 | - if ( ! empty( $custom_class ) ) { |
|
1453 | - $search_class .= ' '.$custom_class; |
|
1452 | + if ( ! empty( $custom_class ) ) { |
|
1453 | + $search_class .= ' ' . $custom_class; |
|
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | /** |
@@ -1501,9 +1501,9 @@ discard block |
||
1501 | 1501 | |
1502 | 1502 | if ( ! $label ) { |
1503 | 1503 | |
1504 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1504 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1505 | 1505 | |
1506 | - switch( $field['field'] ) { |
|
1506 | + switch ( $field[ 'field' ] ) { |
|
1507 | 1507 | case 'search_all': |
1508 | 1508 | $label = __( 'Search Entries:', 'gravityview' ); |
1509 | 1509 | break; |
@@ -1515,10 +1515,10 @@ discard block |
||
1515 | 1515 | break; |
1516 | 1516 | default: |
1517 | 1517 | // If this is a field input, not a field |
1518 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1518 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1519 | 1519 | |
1520 | 1520 | // Get the label for the field in question, which returns an array |
1521 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1521 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1522 | 1522 | |
1523 | 1523 | // Get the item with the `label` key |
1524 | 1524 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1559,13 +1559,13 @@ discard block |
||
1559 | 1559 | $form = $gravityview_view->getForm(); |
1560 | 1560 | |
1561 | 1561 | // for advanced field ids (eg, first name / last name ) |
1562 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1562 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1563 | 1563 | |
1564 | 1564 | // get searched value from $_GET/$_POST (string or array) |
1565 | 1565 | $value = $this->rgget_or_rgpost( $name ); |
1566 | 1566 | |
1567 | 1567 | // get form field details |
1568 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1568 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1569 | 1569 | |
1570 | 1570 | $form_field_type = \GV\Utils::get( $form_field, 'type' ); |
1571 | 1571 | |
@@ -1579,22 +1579,22 @@ discard block |
||
1579 | 1579 | ); |
1580 | 1580 | |
1581 | 1581 | // collect choices |
1582 | - if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1583 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1584 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1585 | - $filter['choices'] = $form_field['choices']; |
|
1582 | + if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1583 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1584 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1585 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1589 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1588 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1589 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | - if ( 'created_by' === $field['field'] ) { |
|
1593 | - $filter['choices'] = self::get_created_by_choices( $context->view ); |
|
1594 | - $filter['type'] = 'created_by'; |
|
1592 | + if ( 'created_by' === $field[ 'field' ] ) { |
|
1593 | + $filter[ 'choices' ] = self::get_created_by_choices( $context->view ); |
|
1594 | + $filter[ 'type' ] = 'created_by'; |
|
1595 | 1595 | } |
1596 | 1596 | |
1597 | - if ( ! empty( $filter['choices'] ) ) { |
|
1597 | + if ( ! empty( $filter[ 'choices' ] ) ) { |
|
1598 | 1598 | /** |
1599 | 1599 | * @filter `gravityview/search/sieve_choices` Only output used choices for this field. |
1600 | 1600 | * @param[in,out] bool Yes or no. |
@@ -1602,7 +1602,7 @@ discard block |
||
1602 | 1602 | * @param \GV\Context The context. |
1603 | 1603 | */ |
1604 | 1604 | if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) { |
1605 | - $filter['choices'] = $this->sieve_filter_choices( $filter, $context ); |
|
1605 | + $filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context ); |
|
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | |
@@ -1631,12 +1631,12 @@ discard block |
||
1631 | 1631 | * @return array The filter choices. |
1632 | 1632 | */ |
1633 | 1633 | private function sieve_filter_choices( $filter, $context ) { |
1634 | - if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) { |
|
1634 | + if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) { |
|
1635 | 1635 | return $filter; // @todo Populate plugins might give us empty choices |
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | // Allow only created_by and field-ids to be sieved. |
1639 | - if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) { |
|
1639 | + if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) { |
|
1640 | 1640 | return $filter; |
1641 | 1641 | } |
1642 | 1642 | |
@@ -1647,13 +1647,13 @@ discard block |
||
1647 | 1647 | $entry_table_name = GFFormsModel::get_entry_table_name(); |
1648 | 1648 | $entry_meta_table_name = GFFormsModel::get_entry_meta_table_name(); |
1649 | 1649 | |
1650 | - $key_like = $wpdb->esc_like( $filter['key'] ) . '.%'; |
|
1650 | + $key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%'; |
|
1651 | 1651 | |
1652 | 1652 | switch ( \GV\Utils::get( $filter, 'type' ) ): |
1653 | 1653 | case 'post_category': |
1654 | 1654 | $choices = $wpdb->get_col( $wpdb->prepare( |
1655 | 1655 | "SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d", |
1656 | - $key_like, $filter['key'], $form_id |
|
1656 | + $key_like, $filter[ 'key' ], $form_id |
|
1657 | 1657 | ) ); |
1658 | 1658 | break; |
1659 | 1659 | case 'created_by': |
@@ -1665,17 +1665,17 @@ discard block |
||
1665 | 1665 | default: |
1666 | 1666 | $choices = $wpdb->get_col( $wpdb->prepare( |
1667 | 1667 | "SELECT DISTINCT meta_value FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d", |
1668 | - $key_like, $filter['key'], $form_id |
|
1668 | + $key_like, $filter[ 'key' ], $form_id |
|
1669 | 1669 | ) ); |
1670 | 1670 | |
1671 | - if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) { |
|
1671 | + if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) { |
|
1672 | 1672 | $choices = array_map( 'json_decode', $choices ); |
1673 | 1673 | $_choices_array = array(); |
1674 | 1674 | foreach ( $choices as $choice ) { |
1675 | 1675 | if ( is_array( $choice ) ) { |
1676 | 1676 | $_choices_array = array_merge( $_choices_array, $choice ); |
1677 | 1677 | } else { |
1678 | - $_choices_array []= $choice; |
|
1678 | + $_choices_array [ ] = $choice; |
|
1679 | 1679 | } |
1680 | 1680 | } |
1681 | 1681 | $choices = array_unique( $_choices_array ); |
@@ -1685,9 +1685,9 @@ discard block |
||
1685 | 1685 | endswitch; |
1686 | 1686 | |
1687 | 1687 | $filter_choices = array(); |
1688 | - foreach ( $filter['choices'] as $choice ) { |
|
1689 | - if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) { |
|
1690 | - $filter_choices[] = $choice; |
|
1688 | + foreach ( $filter[ 'choices' ] as $choice ) { |
|
1689 | + if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) { |
|
1690 | + $filter_choices[ ] = $choice; |
|
1691 | 1691 | } |
1692 | 1692 | } |
1693 | 1693 | |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | * @param \GV\View $view The view. |
1723 | 1723 | */ |
1724 | 1724 | $text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view ); |
1725 | - $choices[] = array( |
|
1725 | + $choices[ ] = array( |
|
1726 | 1726 | 'value' => $user->ID, |
1727 | 1727 | 'text' => $text, |
1728 | 1728 | ); |
@@ -1742,9 +1742,9 @@ discard block |
||
1742 | 1742 | |
1743 | 1743 | $choices = array(); |
1744 | 1744 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
1745 | - $choices[] = array( |
|
1746 | - 'value' => $status['value'], |
|
1747 | - 'text' => $status['label'], |
|
1745 | + $choices[ ] = array( |
|
1746 | + 'value' => $status[ 'value' ], |
|
1747 | + 'text' => $status[ 'label' ], |
|
1748 | 1748 | ); |
1749 | 1749 | } |
1750 | 1750 | |
@@ -1796,7 +1796,7 @@ discard block |
||
1796 | 1796 | */ |
1797 | 1797 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1798 | 1798 | |
1799 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1799 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1800 | 1800 | |
1801 | 1801 | return $js_dependencies; |
1802 | 1802 | } |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | 'isRTL' => is_rtl(), |
1841 | 1841 | ), $view_data ); |
1842 | 1842 | |
1843 | - $localizations['datepicker'] = $datepicker_settings; |
|
1843 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1844 | 1844 | |
1845 | 1845 | return $localizations; |
1846 | 1846 | |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | * @return void |
1868 | 1868 | */ |
1869 | 1869 | private function maybe_enqueue_flexibility() { |
1870 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1870 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1871 | 1871 | wp_enqueue_script( 'gv-flexibility' ); |
1872 | 1872 | } |
1873 | 1873 | } |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1890 | 1890 | |
1891 | 1891 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1892 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1892 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1893 | 1893 | |
1894 | 1894 | /** |
1895 | 1895 | * @filter `gravityview_search_datepicker_class` |
@@ -1968,7 +1968,7 @@ discard block |
||
1968 | 1968 | public function add_preview_inputs() { |
1969 | 1969 | global $wp; |
1970 | 1970 | |
1971 | - if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) { |
|
1971 | + if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) { |
|
1972 | 1972 | return; |
1973 | 1973 | } |
1974 | 1974 | |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | */ |
2021 | 2021 | class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition { |
2022 | 2022 | public function __construct( $filter, $view ) { |
2023 | - $this->value = $filter['value']; |
|
2023 | + $this->value = $filter[ 'value' ]; |
|
2024 | 2024 | $this->view = $view; |
2025 | 2025 | } |
2026 | 2026 | |
@@ -2052,11 +2052,11 @@ discard block |
||
2052 | 2052 | $conditions = array(); |
2053 | 2053 | |
2054 | 2054 | foreach ( $user_fields as $user_field ) { |
2055 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2055 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2056 | 2056 | } |
2057 | 2057 | |
2058 | 2058 | foreach ( $user_meta_fields as $meta_field ) { |
2059 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2059 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2060 | 2060 | } |
2061 | 2061 | |
2062 | 2062 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |