@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
93 | 93 | */ |
94 | - foreach( $this->lead_db_columns as $column ) { |
|
94 | + foreach ( $this->lead_db_columns as $column ) { |
|
95 | 95 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
96 | 96 | } |
97 | 97 | |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
125 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
126 | 126 | |
127 | - $this->blocklist_add( $entry['form_id'] ); |
|
127 | + $this->blocklist_add( $entry[ 'form_id' ] ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function entry_updated( $form, $lead_id ) { |
139 | 139 | |
140 | - gravityview()->log->debug(' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) ); |
|
140 | + gravityview()->log->debug( ' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) ); |
|
141 | 141 | |
142 | - $this->blocklist_add( $form['id'] ); |
|
142 | + $this->blocklist_add( $form[ 'id' ] ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function entry_created( $entry, $form ) { |
156 | 156 | |
157 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
157 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
158 | 158 | |
159 | - $this->blocklist_add( $form['id'] ); |
|
159 | + $this->blocklist_add( $form[ 'id' ] ); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
175 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
176 | 176 | |
177 | - $this->blocklist_add( $form['id'] ); |
|
177 | + $this->blocklist_add( $form[ 'id' ] ); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Normally just one form, but supports multiple forms |
194 | 194 | // |
195 | 195 | // Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14` |
196 | - $forms = 'f:' . implode( '-f:', (array) $form_ids ); |
|
196 | + $forms = 'f:' . implode( '-f:', (array)$form_ids ); |
|
197 | 197 | |
198 | 198 | // Prefix for transient keys |
199 | 199 | // Now the prefix would be: `gv-cache-f:12-f:5-f:14-` |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids ); |
244 | 244 | |
245 | 245 | // Add the passed form IDs |
246 | - $blocklist = array_merge( (array) $blocklist, $form_ids ); |
|
246 | + $blocklist = array_merge( (array)$blocklist, $form_ids ); |
|
247 | 247 | |
248 | 248 | // Don't duplicate |
249 | 249 | $blocklist = array_unique( $blocklist ); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $blocklist = get_option( self::BLOCKLIST_OPTION_NAME, array() ); |
288 | 288 | |
289 | - $updated_list = array_diff( $blocklist, (array) $form_ids ); |
|
289 | + $updated_list = array_diff( $blocklist, (array)$form_ids ); |
|
290 | 290 | |
291 | 291 | gravityview()->log->debug( 'Removing form IDs from cache blocklist', array( 'data' => array( |
292 | 292 | '$form_ids' => $form_ids, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return false; |
345 | 345 | } |
346 | 346 | |
347 | - foreach ( (array) $form_ids as $form_id ) { |
|
347 | + foreach ( (array)$form_ids as $form_id ) { |
|
348 | 348 | |
349 | 349 | if ( in_array( $form_id, $blocklist, true ) ) { |
350 | 350 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
423 | 423 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
424 | 424 | */ |
425 | - $expiration = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, $expiration ); |
|
425 | + $expiration = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, $expiration ); |
|
426 | 426 | |
427 | 427 | gravityview()->log->debug( 'Setting cache with transient key {key} for {expiration} seconds', array( 'key' => $this->key, 'expiration' => $expiration ) ); |
428 | 428 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | - foreach ( (array) $form_ids as $form_id ) { |
|
465 | + foreach ( (array)$form_ids as $form_id ) { |
|
466 | 466 | |
467 | 467 | $key = '_transient_gv-cache-'; |
468 | 468 | |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | public function use_cache() { |
574 | 574 | |
575 | 575 | // Exit early if debugging (unless running PHPUnit) |
576 | - if ( defined( 'GRAVITYVIEW_DISABLE_CACHE' ) && GRAVITYVIEW_DISABLE_CACHE && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
577 | - return (boolean) apply_filters( 'gravityview_use_cache', false, $this ); |
|
576 | + if ( defined( 'GRAVITYVIEW_DISABLE_CACHE' ) && GRAVITYVIEW_DISABLE_CACHE && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
577 | + return (boolean)apply_filters( 'gravityview_use_cache', false, $this ); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | // Only run once per instance. |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
588 | 588 | |
589 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
589 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
590 | 590 | |
591 | 591 | gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' ); |
592 | 592 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * @param boolean $use_cache Previous setting |
611 | 611 | * @param GravityView_Cache $this The GravityView_Cache object |
612 | 612 | */ |
613 | - $this->use_cache = (boolean) apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
|
613 | + $this->use_cache = (boolean)apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
|
614 | 614 | |
615 | 615 | return $this->use_cache; |
616 | 616 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'search_clear' => array( |
56 | 56 | 'type' => 'checkbox', |
57 | 57 | 'label' => __( 'Show Clear button', 'gk-gravityview' ), |
58 | - 'desc' => __( 'When a search is performed, display a button that removes all search values.', 'gk-gravityview'), |
|
58 | + 'desc' => __( 'When a search is performed, display a button that removes all search values.', 'gk-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', 'gk-gravityview' ), |
71 | - 'desc' => __('Should search results match all search fields, or any?', 'gk-gravityview'), |
|
71 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gk-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', 'gk-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'], $blocklist_field_types ) ) { |
|
392 | + if ( in_array( $field[ 'type' ], $blocklist_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 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
583 | 583 | } |
584 | 584 | |
585 | - if( 'post' === $this->search_method ) { |
|
585 | + if ( 'post' === $this->search_method ) { |
|
586 | 586 | $get = $_POST; |
587 | 587 | } else { |
588 | 588 | $get = $_GET; |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | } |
606 | 606 | |
607 | 607 | // Make sure array key is set up |
608 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
608 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
609 | 609 | |
610 | 610 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
611 | 611 | $searchable_field_objects = $this->get_view_searchable_fields( $view, true ); |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | $trim_search_value = apply_filters( 'gravityview/search-trim-input', true ); |
626 | 626 | |
627 | 627 | // add free search |
628 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
628 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
629 | 629 | |
630 | - $search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search']; |
|
630 | + $search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ]; |
|
631 | 631 | |
632 | 632 | if ( $split_words ) { |
633 | 633 | // Search for a piece |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | } |
644 | 644 | |
645 | 645 | foreach ( $words as $word ) { |
646 | - $search_criteria['field_filters'][] = array( |
|
646 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
647 | 647 | 'key' => null, // The field ID to search |
648 | 648 | 'value' => $word, // The value to search |
649 | 649 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | /** |
657 | 657 | * Get and normalize the dates according to the input format. |
658 | 658 | */ |
659 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
660 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
659 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
660 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
661 | 661 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
662 | 662 | } |
663 | 663 | } |
664 | 664 | |
665 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
666 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
665 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
666 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
667 | 667 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
668 | 668 | } |
669 | 669 | } |
@@ -699,22 +699,22 @@ discard block |
||
699 | 699 | */ |
700 | 700 | if ( ! empty( $curr_start ) ) { |
701 | 701 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
702 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
702 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | if ( ! empty( $curr_end ) ) { |
706 | 706 | // Fast-forward 24 hour on the end time |
707 | 707 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
708 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
709 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
710 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
708 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
709 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
710 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
711 | 711 | } |
712 | 712 | } |
713 | 713 | } |
714 | 714 | |
715 | 715 | // search for a specific entry ID |
716 | 716 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
717 | - $search_criteria['field_filters'][] = array( |
|
717 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
718 | 718 | 'key' => 'id', |
719 | 719 | 'value' => absint( $get[ 'gv_id' ] ), |
720 | 720 | 'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ), |
@@ -723,15 +723,15 @@ discard block |
||
723 | 723 | |
724 | 724 | // search for a specific Created_by ID |
725 | 725 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
726 | - $search_criteria['field_filters'][] = array( |
|
726 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
727 | 727 | 'key' => 'created_by', |
728 | - 'value' => $get['gv_by'], |
|
728 | + 'value' => $get[ 'gv_by' ], |
|
729 | 729 | 'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ), |
730 | 730 | ); |
731 | 731 | } |
732 | 732 | |
733 | 733 | // Get search mode passed in URL |
734 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
734 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
735 | 735 | |
736 | 736 | // get the other search filters |
737 | 737 | foreach ( $get as $key => $value ) { |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value ); |
750 | 750 | } |
751 | 751 | |
752 | - if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
752 | + if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
753 | 753 | /** |
754 | 754 | * @filter `gravityview/search/ignore-empty-values` Filter to control if empty field values should be ignored or strictly matched (default: true) |
755 | 755 | * @since 2.14.2.1 |
@@ -780,21 +780,21 @@ discard block |
||
780 | 780 | continue; |
781 | 781 | } |
782 | 782 | |
783 | - if ( ! isset( $filter['operator'] ) ) { |
|
784 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
783 | + if ( ! isset( $filter[ 'operator' ] ) ) { |
|
784 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
785 | 785 | } |
786 | 786 | |
787 | - if ( isset( $filter[0]['value'] ) ) { |
|
788 | - $filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value']; |
|
787 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
788 | + $filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ]; |
|
789 | 789 | |
790 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
790 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
791 | 791 | |
792 | 792 | // if date range type, set search mode to ALL |
793 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
793 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
794 | 794 | $mode = 'all'; |
795 | 795 | } |
796 | - } elseif( !empty( $filter ) ) { |
|
797 | - $search_criteria['field_filters'][] = $filter; |
|
796 | + } elseif ( ! empty( $filter ) ) { |
|
797 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @since 1.5.1 |
804 | 804 | * @param string $mode Search mode (`any` vs `all`) |
805 | 805 | */ |
806 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
806 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
807 | 807 | |
808 | 808 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
809 | 809 | |
@@ -837,19 +837,19 @@ discard block |
||
837 | 837 | |
838 | 838 | $query_class = $view->get_query_class(); |
839 | 839 | |
840 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
840 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
841 | 841 | return; |
842 | 842 | } |
843 | 843 | |
844 | 844 | $widgets = $view->widgets->by_id( $this->widget_id ); |
845 | 845 | if ( $widgets->count() ) { |
846 | 846 | $widgets = $widgets->all(); |
847 | - $widget = $widgets[0]; |
|
847 | + $widget = $widgets[ 0 ]; |
|
848 | 848 | |
849 | 849 | $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ); |
850 | 850 | |
851 | - foreach ( (array) $search_fields as $search_field ) { |
|
852 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
851 | + foreach ( (array)$search_fields as $search_field ) { |
|
852 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
853 | 853 | $created_by_text_mode = true; |
854 | 854 | } |
855 | 855 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | $extra_conditions = array(); |
859 | 859 | $mode = 'any'; |
860 | 860 | |
861 | - foreach ( $search_criteria['field_filters'] as $key => &$filter ) { |
|
861 | + foreach ( $search_criteria[ 'field_filters' ] as $key => &$filter ) { |
|
862 | 862 | if ( ! is_array( $filter ) ) { |
863 | 863 | if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) { |
864 | 864 | $mode = $filter; |
@@ -867,13 +867,13 @@ discard block |
||
867 | 867 | } |
868 | 868 | |
869 | 869 | // Construct a manual query for unapproved statuses |
870 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) { |
|
871 | - $_tmp_query = new $query_class( $view->form->ID, array( |
|
870 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) { |
|
871 | + $_tmp_query = new $query_class( $view->form->ID, array( |
|
872 | 872 | 'field_filters' => array( |
873 | 873 | array( |
874 | 874 | 'operator' => 'in', |
875 | 875 | 'key' => 'is_approved', |
876 | - 'value' => (array) $filter['value'], |
|
876 | + 'value' => (array)$filter[ 'value' ], |
|
877 | 877 | ), |
878 | 878 | array( |
879 | 879 | 'operator' => 'is', |
@@ -885,30 +885,30 @@ discard block |
||
885 | 885 | ) ); |
886 | 886 | $_tmp_query_parts = $_tmp_query->_introspect(); |
887 | 887 | |
888 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
888 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
889 | 889 | |
890 | 890 | $filter = false; |
891 | 891 | continue; |
892 | 892 | } |
893 | 893 | |
894 | 894 | // Construct manual query for text mode creator search |
895 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
896 | - $extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
895 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
896 | + $extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
897 | 897 | $filter = false; |
898 | 898 | continue; |
899 | 899 | } |
900 | 900 | |
901 | 901 | // By default, we want searches to be wildcard for each field. |
902 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
902 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
903 | 903 | |
904 | 904 | // For multichoice, let's have an in (OR) search. |
905 | - if ( is_array( $filter['value'] ) ) { |
|
906 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
905 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
906 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | // Default form with joins functionality |
910 | - if ( empty( $filter['form_id'] ) ) { |
|
911 | - $filter['form_id'] = $view->form ? $view->form->ID : 0; |
|
910 | + if ( empty( $filter[ 'form_id' ] ) ) { |
|
911 | + $filter[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | /** |
@@ -918,32 +918,32 @@ discard block |
||
918 | 918 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
919 | 919 | * @param \GV\View $view The View we're operating on. |
920 | 920 | */ |
921 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view ); |
|
921 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view ); |
|
922 | 922 | |
923 | - if ( 'is' !== $filter['operator'] && '' === $filter['value'] ) { |
|
924 | - unset( $search_criteria['field_filters'][ $key ] ); |
|
923 | + if ( 'is' !== $filter[ 'operator' ] && '' === $filter[ 'value' ] ) { |
|
924 | + unset( $search_criteria[ 'field_filters' ][ $key ] ); |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | - if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) { |
|
928 | + if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) { |
|
929 | 929 | $date_criteria = array(); |
930 | 930 | |
931 | - if ( isset( $search_criteria['start_date'] ) ) { |
|
932 | - $date_criteria['start_date'] = $search_criteria['start_date']; |
|
931 | + if ( isset( $search_criteria[ 'start_date' ] ) ) { |
|
932 | + $date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ]; |
|
933 | 933 | } |
934 | 934 | |
935 | - if ( isset( $search_criteria['end_date'] ) ) { |
|
936 | - $date_criteria['end_date'] = $search_criteria['end_date']; |
|
935 | + if ( isset( $search_criteria[ 'end_date' ] ) ) { |
|
936 | + $date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ]; |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | $_tmp_query = new $query_class( $view->form->ID, $date_criteria ); |
940 | 940 | $_tmp_query_parts = $_tmp_query->_introspect(); |
941 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
941 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | $search_conditions = array(); |
945 | 945 | |
946 | - if ( $filters = array_filter( $search_criteria['field_filters'] ) ) { |
|
946 | + if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) { |
|
947 | 947 | foreach ( $filters as &$filter ) { |
948 | 948 | if ( ! is_array( $filter ) ) { |
949 | 949 | continue; |
@@ -955,12 +955,12 @@ discard block |
||
955 | 955 | * code by reusing what's inside GF_Query already as they |
956 | 956 | * take care of many small things like forcing numeric, etc. |
957 | 957 | */ |
958 | - $_tmp_query = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
958 | + $_tmp_query = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
959 | 959 | $_tmp_query_parts = $_tmp_query->_introspect(); |
960 | - $search_condition = $_tmp_query_parts['where']; |
|
960 | + $search_condition = $_tmp_query_parts[ 'where' ]; |
|
961 | 961 | |
962 | - if ( empty( $filter['key'] ) && $search_condition->expressions ) { |
|
963 | - $search_conditions[] = $search_condition; |
|
962 | + if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) { |
|
963 | + $search_conditions[ ] = $search_condition; |
|
964 | 964 | } else { |
965 | 965 | $left = $search_condition->left; |
966 | 966 | |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | |
973 | 973 | $value = $reflectionProperty->getValue( $left ); |
974 | 974 | |
975 | - if ( ! empty( $value[0] ) && $value[0] instanceof GF_Query_Column ) { |
|
976 | - $left = $value[0]; |
|
975 | + if ( ! empty( $value[ 0 ] ) && $value[ 0 ] instanceof GF_Query_Column ) { |
|
976 | + $left = $value[ 0 ]; |
|
977 | 977 | } else { |
978 | 978 | continue; |
979 | 979 | } |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | $on = $_join->join_on; |
990 | 990 | $join = $_join->join; |
991 | 991 | |
992 | - $search_conditions[] = GF_Query_Condition::_or( |
|
992 | + $search_conditions[ ] = GF_Query_Condition::_or( |
|
993 | 993 | // Join |
994 | 994 | new GF_Query_Condition( |
995 | 995 | new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ), |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | ); |
1006 | 1006 | } |
1007 | 1007 | } else { |
1008 | - $search_conditions[] = new GF_Query_Condition( |
|
1008 | + $search_conditions[ ] = new GF_Query_Condition( |
|
1009 | 1009 | new GF_Query_Column( $left->field_id, $left->source, $alias ), |
1010 | 1010 | $search_condition->operator, |
1011 | 1011 | $search_condition->right |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | /** |
1028 | 1028 | * Combine the parts as a new WHERE clause. |
1029 | 1029 | */ |
1030 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) ); |
|
1030 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) ); |
|
1031 | 1031 | $query->where( $where ); |
1032 | 1032 | } |
1033 | 1033 | |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $field_id = str_replace( array( 'filter_', 'input_' ), '', $key ); |
1051 | 1051 | |
1052 | 1052 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
1053 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
1053 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
1054 | 1054 | $field_id = str_replace( '_', '.', $field_id ); |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | // form is in searchable fields |
1108 | 1108 | $found = false; |
1109 | 1109 | foreach ( $searchable_fields as $field ) { |
1110 | - if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) { |
|
1110 | + if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) { |
|
1111 | 1111 | $found = true; |
1112 | 1112 | break; |
1113 | 1113 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | |
1148 | 1148 | case 'select': |
1149 | 1149 | case 'radio': |
1150 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1150 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1151 | 1151 | break; |
1152 | 1152 | |
1153 | 1153 | case 'post_category': |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | |
1162 | 1162 | foreach ( $value as $val ) { |
1163 | 1163 | $cat = get_term( $val, 'category' ); |
1164 | - $filter[] = array( |
|
1164 | + $filter[ ] = array( |
|
1165 | 1165 | 'key' => $field_id, |
1166 | 1166 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
1167 | 1167 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $filter = array(); |
1181 | 1181 | |
1182 | 1182 | foreach ( $value as $val ) { |
1183 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
1183 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | break; |
@@ -1189,9 +1189,9 @@ discard block |
||
1189 | 1189 | // convert checkbox on/off into the correct search filter |
1190 | 1190 | if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
1191 | 1191 | foreach ( $form_field->inputs as $k => $input ) { |
1192 | - if ( $input['id'] == $field_id ) { |
|
1193 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
1194 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1192 | + if ( $input[ 'id' ] == $field_id ) { |
|
1193 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
1194 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1195 | 1195 | break; |
1196 | 1196 | } |
1197 | 1197 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $filter = array(); |
1202 | 1202 | |
1203 | 1203 | foreach ( $value as $val ) { |
1204 | - $filter[] = array( |
|
1204 | + $filter[ ] = array( |
|
1205 | 1205 | 'key' => $field_id, |
1206 | 1206 | 'value' => $val, |
1207 | 1207 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1222,9 +1222,9 @@ discard block |
||
1222 | 1222 | foreach ( $words as $word ) { |
1223 | 1223 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
1224 | 1224 | // Keep the same key for each filter |
1225 | - $filter['value'] = $word; |
|
1225 | + $filter[ 'value' ] = $word; |
|
1226 | 1226 | // Add a search for the value |
1227 | - $filters[] = $filter; |
|
1227 | + $filters[ ] = $filter; |
|
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | |
@@ -1238,19 +1238,19 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | foreach ( $searchable_fields as $searchable_field ) { |
1240 | 1240 | |
1241 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
1241 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
1242 | 1242 | continue; |
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | // Only exact-match dropdowns, not text search |
1246 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
1246 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
1247 | 1247 | continue; |
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
1251 | 1251 | |
1252 | 1252 | if ( 4 === $input_id ) { |
1253 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1253 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1254 | 1254 | }; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1278,12 +1278,12 @@ discard block |
||
1278 | 1278 | * @since 1.16.3 |
1279 | 1279 | * Safeguard until GF implements '<=' operator |
1280 | 1280 | */ |
1281 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1281 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1282 | 1282 | $operator = '<'; |
1283 | 1283 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
1284 | 1284 | } |
1285 | 1285 | |
1286 | - $filter[] = array( |
|
1286 | + $filter[ ] = array( |
|
1287 | 1287 | 'key' => $field_id, |
1288 | 1288 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
1289 | 1289 | 'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ), |
@@ -1291,12 +1291,12 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | } else { |
1293 | 1293 | $date = $value; |
1294 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1295 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1294 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1295 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | - if ('payment_date' === $key) { |
|
1299 | - $filter['operator'] = 'contains'; |
|
1298 | + if ( 'payment_date' === $key ) { |
|
1299 | + $filter[ 'operator' ] = 'contains'; |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | break; |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | 'ymd_dot' => 'Y.m.d', |
1326 | 1326 | ); |
1327 | 1327 | |
1328 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
1328 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
1329 | 1329 | $format = $datepicker[ $field->dateFormat ]; |
1330 | 1330 | } |
1331 | 1331 | |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | public function add_template_path( $file_paths ) { |
1363 | 1363 | |
1364 | 1364 | // Index 100 is the default GravityView template path. |
1365 | - $file_paths[102] = self::$file . 'templates/'; |
|
1365 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
1366 | 1366 | |
1367 | 1367 | return $file_paths; |
1368 | 1368 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | $has_date = false; |
1382 | 1382 | |
1383 | 1383 | foreach ( $search_fields as $k => $field ) { |
1384 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1384 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1385 | 1385 | $has_date = true; |
1386 | 1386 | break; |
1387 | 1387 | } |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $view = \GV\View::by_id( $gravityview_view->view_id ); |
1411 | 1411 | |
1412 | 1412 | // get configured search fields |
1413 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
1413 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
1414 | 1414 | |
1415 | 1415 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
1416 | 1416 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1424,39 +1424,39 @@ discard block |
||
1424 | 1424 | |
1425 | 1425 | $updated_field = $this->get_search_filter_details( $updated_field, $context ); |
1426 | 1426 | |
1427 | - switch ( $field['field'] ) { |
|
1427 | + switch ( $field[ 'field' ] ) { |
|
1428 | 1428 | |
1429 | 1429 | case 'search_all': |
1430 | - $updated_field['key'] = 'search_all'; |
|
1431 | - $updated_field['input'] = 'search_all'; |
|
1432 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1430 | + $updated_field[ 'key' ] = 'search_all'; |
|
1431 | + $updated_field[ 'input' ] = 'search_all'; |
|
1432 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1433 | 1433 | break; |
1434 | 1434 | |
1435 | 1435 | case 'entry_date': |
1436 | - $updated_field['key'] = 'entry_date'; |
|
1437 | - $updated_field['input'] = 'entry_date'; |
|
1438 | - $updated_field['value'] = array( |
|
1436 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1437 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1438 | + $updated_field[ 'value' ] = array( |
|
1439 | 1439 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1440 | 1440 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1441 | 1441 | ); |
1442 | 1442 | break; |
1443 | 1443 | |
1444 | 1444 | case 'entry_id': |
1445 | - $updated_field['key'] = 'entry_id'; |
|
1446 | - $updated_field['input'] = 'entry_id'; |
|
1447 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1445 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1446 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1447 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1448 | 1448 | break; |
1449 | 1449 | |
1450 | 1450 | case 'created_by': |
1451 | - $updated_field['key'] = 'created_by'; |
|
1452 | - $updated_field['name'] = 'gv_by'; |
|
1453 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1451 | + $updated_field[ 'key' ] = 'created_by'; |
|
1452 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1453 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1454 | 1454 | break; |
1455 | 1455 | |
1456 | 1456 | case 'is_approved': |
1457 | - $updated_field['key'] = 'is_approved'; |
|
1458 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1459 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
1457 | + $updated_field[ 'key' ] = 'is_approved'; |
|
1458 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1459 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
1460 | 1460 | break; |
1461 | 1461 | } |
1462 | 1462 | |
@@ -1477,16 +1477,16 @@ discard block |
||
1477 | 1477 | |
1478 | 1478 | $gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args ); |
1479 | 1479 | |
1480 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1480 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1481 | 1481 | |
1482 | 1482 | /** @since 1.14 */ |
1483 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1483 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1484 | 1484 | |
1485 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1485 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1486 | 1486 | |
1487 | 1487 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1488 | 1488 | |
1489 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1489 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1490 | 1490 | |
1491 | 1491 | if ( $this->has_date_field( $search_fields ) ) { |
1492 | 1492 | // enqueue datepicker stuff only if needed! |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | public static function get_search_class( $custom_class = '' ) { |
1509 | 1509 | $gravityview_view = GravityView_View::getInstance(); |
1510 | 1510 | |
1511 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1511 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1512 | 1512 | |
1513 | - if ( ! empty( $custom_class ) ) { |
|
1514 | - $search_class .= ' '.$custom_class; |
|
1513 | + if ( ! empty( $custom_class ) ) { |
|
1514 | + $search_class .= ' ' . $custom_class; |
|
1515 | 1515 | } |
1516 | 1516 | |
1517 | 1517 | /** |
@@ -1562,9 +1562,9 @@ discard block |
||
1562 | 1562 | |
1563 | 1563 | if ( ! $label ) { |
1564 | 1564 | |
1565 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1565 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1566 | 1566 | |
1567 | - switch( $field['field'] ) { |
|
1567 | + switch ( $field[ 'field' ] ) { |
|
1568 | 1568 | case 'search_all': |
1569 | 1569 | $label = __( 'Search Entries:', 'gk-gravityview' ); |
1570 | 1570 | break; |
@@ -1576,10 +1576,10 @@ discard block |
||
1576 | 1576 | break; |
1577 | 1577 | default: |
1578 | 1578 | // If this is a field input, not a field |
1579 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1579 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1580 | 1580 | |
1581 | 1581 | // Get the label for the field in question, which returns an array |
1582 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1582 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1583 | 1583 | |
1584 | 1584 | // Get the item with the `label` key |
1585 | 1585 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1620,13 +1620,13 @@ discard block |
||
1620 | 1620 | $form = $gravityview_view->getForm(); |
1621 | 1621 | |
1622 | 1622 | // for advanced field ids (eg, first name / last name ) |
1623 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1623 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1624 | 1624 | |
1625 | 1625 | // get searched value from $_GET/$_POST (string or array) |
1626 | 1626 | $value = $this->rgget_or_rgpost( $name ); |
1627 | 1627 | |
1628 | 1628 | // get form field details |
1629 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1629 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1630 | 1630 | |
1631 | 1631 | $form_field_type = \GV\Utils::get( $form_field, 'type' ); |
1632 | 1632 | |
@@ -1640,22 +1640,22 @@ discard block |
||
1640 | 1640 | ); |
1641 | 1641 | |
1642 | 1642 | // collect choices |
1643 | - if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1644 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1645 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1646 | - $filter['choices'] = $form_field['choices']; |
|
1643 | + if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1644 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1645 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1646 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1647 | 1647 | } |
1648 | 1648 | |
1649 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1650 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1649 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1650 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1651 | 1651 | } |
1652 | 1652 | |
1653 | - if ( 'created_by' === $field['field'] ) { |
|
1654 | - $filter['choices'] = self::get_created_by_choices( ( isset( $context->view ) ? $context->view : null ) ); |
|
1655 | - $filter['type'] = 'created_by'; |
|
1653 | + if ( 'created_by' === $field[ 'field' ] ) { |
|
1654 | + $filter[ 'choices' ] = self::get_created_by_choices( ( isset( $context->view ) ? $context->view : null ) ); |
|
1655 | + $filter[ 'type' ] = 'created_by'; |
|
1656 | 1656 | } |
1657 | 1657 | |
1658 | - if ( ! empty( $filter['choices'] ) ) { |
|
1658 | + if ( ! empty( $filter[ 'choices' ] ) ) { |
|
1659 | 1659 | /** |
1660 | 1660 | * @filter `gravityview/search/sieve_choices` Only output used choices for this field. |
1661 | 1661 | * @since 2.16 Modified default value to `true`. |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | * @param \GV\Context The context. |
1665 | 1665 | */ |
1666 | 1666 | if ( apply_filters( 'gravityview/search/sieve_choices', true, $field, $context ) ) { |
1667 | - $filter['choices'] = $this->sieve_filter_choices( $filter, $context ); |
|
1667 | + $filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context ); |
|
1668 | 1668 | } |
1669 | 1669 | } |
1670 | 1670 | |
@@ -1693,22 +1693,22 @@ discard block |
||
1693 | 1693 | * @return array The filter choices. |
1694 | 1694 | */ |
1695 | 1695 | private function sieve_filter_choices( $filter, $context ) { |
1696 | - if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) { |
|
1696 | + if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) { |
|
1697 | 1697 | return $filter; // @todo Populate plugins might give us empty choices |
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | // Allow only created_by and field-ids to be sieved. |
1701 | - if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) { |
|
1701 | + if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) { |
|
1702 | 1702 | return $filter; |
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | $form_id = $context->view->form->ID; // @todo Support multiple forms (joins) |
1706 | 1706 | |
1707 | - $cache = new GravityView_Cache( $form_id, [ 'sieve', $filter['key'], $context->view->ID ] ); |
|
1707 | + $cache = new GravityView_Cache( $form_id, [ 'sieve', $filter[ 'key' ], $context->view->ID ] ); |
|
1708 | 1708 | |
1709 | 1709 | $filter_choices = $cache->get(); |
1710 | 1710 | |
1711 | - if( $filter_choices ) { |
|
1711 | + if ( $filter_choices ) { |
|
1712 | 1712 | return $filter_choices; |
1713 | 1713 | } |
1714 | 1714 | |
@@ -1717,13 +1717,13 @@ discard block |
||
1717 | 1717 | $entry_table_name = GFFormsModel::get_entry_table_name(); |
1718 | 1718 | $entry_meta_table_name = GFFormsModel::get_entry_meta_table_name(); |
1719 | 1719 | |
1720 | - $key_like = $wpdb->esc_like( $filter['key'] ) . '.%'; |
|
1720 | + $key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%'; |
|
1721 | 1721 | |
1722 | 1722 | switch ( \GV\Utils::get( $filter, 'type' ) ): |
1723 | 1723 | case 'post_category': |
1724 | 1724 | $choices = $wpdb->get_col( $wpdb->prepare( |
1725 | 1725 | "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", |
1726 | - $key_like, $filter['key'], $form_id |
|
1726 | + $key_like, $filter[ 'key' ], $form_id |
|
1727 | 1727 | ) ); |
1728 | 1728 | break; |
1729 | 1729 | case 'created_by': |
@@ -1735,17 +1735,17 @@ discard block |
||
1735 | 1735 | default: |
1736 | 1736 | $choices = $wpdb->get_col( $wpdb->prepare( |
1737 | 1737 | "SELECT DISTINCT meta_value FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d", |
1738 | - $key_like, $filter['key'], $form_id |
|
1738 | + $key_like, $filter[ 'key' ], $form_id |
|
1739 | 1739 | ) ); |
1740 | 1740 | |
1741 | - if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) { |
|
1741 | + if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) { |
|
1742 | 1742 | $choices = array_map( 'json_decode', $choices ); |
1743 | 1743 | $_choices_array = array(); |
1744 | 1744 | foreach ( $choices as $choice ) { |
1745 | 1745 | if ( is_array( $choice ) ) { |
1746 | 1746 | $_choices_array = array_merge( $_choices_array, $choice ); |
1747 | 1747 | } else { |
1748 | - $_choices_array []= $choice; |
|
1748 | + $_choices_array [ ] = $choice; |
|
1749 | 1749 | } |
1750 | 1750 | } |
1751 | 1751 | $choices = array_unique( $_choices_array ); |
@@ -1755,9 +1755,9 @@ discard block |
||
1755 | 1755 | endswitch; |
1756 | 1756 | |
1757 | 1757 | $filter_choices = array(); |
1758 | - foreach ( $filter['choices'] as $choice ) { |
|
1759 | - if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) { |
|
1760 | - $filter_choices[] = $choice; |
|
1758 | + foreach ( $filter[ 'choices' ] as $choice ) { |
|
1759 | + if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) { |
|
1760 | + $filter_choices[ ] = $choice; |
|
1761 | 1761 | } |
1762 | 1762 | } |
1763 | 1763 | |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | * @param \GV\View|null $view The view. |
1795 | 1795 | */ |
1796 | 1796 | $text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view ); |
1797 | - $choices[] = array( |
|
1797 | + $choices[ ] = array( |
|
1798 | 1798 | 'value' => $user->ID, |
1799 | 1799 | 'text' => $text, |
1800 | 1800 | ); |
@@ -1814,9 +1814,9 @@ discard block |
||
1814 | 1814 | |
1815 | 1815 | $choices = array(); |
1816 | 1816 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
1817 | - $choices[] = array( |
|
1818 | - 'value' => $status['value'], |
|
1819 | - 'text' => $status['label'], |
|
1817 | + $choices[ ] = array( |
|
1818 | + 'value' => $status[ 'value' ], |
|
1819 | + 'text' => $status[ 'label' ], |
|
1820 | 1820 | ); |
1821 | 1821 | } |
1822 | 1822 | |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | */ |
1871 | 1871 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1872 | 1872 | |
1873 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1873 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1874 | 1874 | |
1875 | 1875 | return $js_dependencies; |
1876 | 1876 | } |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | 'isRTL' => is_rtl(), |
1915 | 1915 | ), $view_data ); |
1916 | 1916 | |
1917 | - $localizations['datepicker'] = $datepicker_settings; |
|
1917 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1918 | 1918 | |
1919 | 1919 | return $localizations; |
1920 | 1920 | |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | * @return void |
1942 | 1942 | */ |
1943 | 1943 | private function maybe_enqueue_flexibility() { |
1944 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1944 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1945 | 1945 | wp_enqueue_script( 'gv-flexibility' ); |
1946 | 1946 | } |
1947 | 1947 | } |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1964 | 1964 | |
1965 | 1965 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1966 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1966 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1967 | 1967 | |
1968 | 1968 | /** |
1969 | 1969 | * @filter `gravityview_search_datepicker_class` |
@@ -2042,7 +2042,7 @@ discard block |
||
2042 | 2042 | public function add_preview_inputs() { |
2043 | 2043 | global $wp; |
2044 | 2044 | |
2045 | - if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) { |
|
2045 | + if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) { |
|
2046 | 2046 | return; |
2047 | 2047 | } |
2048 | 2048 | |
@@ -2100,7 +2100,7 @@ discard block |
||
2100 | 2100 | */ |
2101 | 2101 | class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition { |
2102 | 2102 | public function __construct( $filter, $view ) { |
2103 | - $this->value = $filter['value']; |
|
2103 | + $this->value = $filter[ 'value' ]; |
|
2104 | 2104 | $this->view = $view; |
2105 | 2105 | } |
2106 | 2106 | |
@@ -2132,11 +2132,11 @@ discard block |
||
2132 | 2132 | $conditions = array(); |
2133 | 2133 | |
2134 | 2134 | foreach ( $user_fields as $user_field ) { |
2135 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2135 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2136 | 2136 | } |
2137 | 2137 | |
2138 | 2138 | foreach ( $user_meta_fields as $meta_field ) { |
2139 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2139 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2140 | 2140 | } |
2141 | 2141 | |
2142 | 2142 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |