@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $is_table_layout = preg_match( '/table/ism', $template_id ); |
55 | 55 | |
56 | - if( 'field' === $field_type ) { |
|
56 | + if ( 'field' === $field_type ) { |
|
57 | 57 | |
58 | 58 | // Default options - fields |
59 | 59 | $field_options = array( |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | ); |
106 | 106 | |
107 | 107 | // Match Table as well as DataTables |
108 | - if( $is_table_layout && 'directory' === $context ) { |
|
109 | - $field_options['width'] = array( |
|
108 | + if ( $is_table_layout && 'directory' === $context ) { |
|
109 | + $field_options[ 'width' ] = array( |
|
110 | 110 | 'type' => 'number', |
111 | - 'label' => __('Percent Width', 'gk-gravityview'), |
|
112 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview'), |
|
111 | + 'label' => __( 'Percent Width', 'gk-gravityview' ), |
|
112 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gk-gravityview' ), |
|
113 | 113 | 'class' => 'code widefat', |
114 | 114 | 'value' => '', |
115 | 115 | 'priority' => 200, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | // Remove suffix ":" from the labels to standardize style. Using trim() instead of rtrim() for i18n. |
123 | 123 | foreach ( $field_options as $key => $field_option ) { |
124 | - $field_options[ $key ]['label'] = trim( $field_option['label'], ':' ); |
|
124 | + $field_options[ $key ][ 'label' ] = trim( $field_option[ 'label' ], ':' ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
148 | 148 | |
149 | - if ( 'directory' === $context && isset( $field_options['show_as_link'] ) && ! isset( $field_options['new_window'] ) ) { |
|
150 | - $field_options['new_window'] = array( |
|
149 | + if ( 'directory' === $context && isset( $field_options[ 'show_as_link' ] ) && ! isset( $field_options[ 'new_window' ] ) ) { |
|
150 | + $field_options[ 'new_window' ] = array( |
|
151 | 151 | 'type' => 'checkbox', |
152 | 152 | 'label' => __( 'Open link in a new tab or window?', 'gk-gravityview' ), |
153 | 153 | 'value' => false, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | switch ( $key ) { |
169 | 169 | case 'show_as_link': |
170 | 170 | $_group = 'display'; |
171 | - $field_option['priority'] = 100; |
|
171 | + $field_option[ 'priority' ] = 100; |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | $_group = \GV\Utils::get( $field_option, 'group', 'display' ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $field_options = array(); |
186 | - foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
186 | + foreach ( self::get_field_groups() as $group_key => $group_name ) { |
|
187 | 187 | $field_options[ $group_key ] = \GV\Utils::get( $option_groups, $group_key, array() ); |
188 | 188 | } |
189 | 189 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return 0; |
215 | 215 | } |
216 | 216 | |
217 | - return ( $a_priority < $b_priority ) ? - 1 : 1; |
|
217 | + return ( $a_priority < $b_priority ) ? -1 : 1; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | 'manage_options' => __( 'Administrator', 'gk-gravityview' ), |
240 | 240 | ); |
241 | 241 | |
242 | - if( is_multisite() ) { |
|
243 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gk-gravityview' ); |
|
242 | + if ( is_multisite() ) { |
|
243 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gk-gravityview' ); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
254 | 254 | * @param string $input_type Optional. (textarea, list, select, etc.) |
255 | 255 | */ |
256 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
256 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
257 | 257 | |
258 | 258 | return $select_cap_choices; |
259 | 259 | } |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * @return string HTML of dialog box |
280 | 280 | */ |
281 | 281 | public static function render_field_options( $form_id, $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
282 | - if( empty( $uniqid ) ) { |
|
282 | + if ( empty( $uniqid ) ) { |
|
283 | 283 | //generate a unique field id |
284 | - $uniqid = uniqid('', false); |
|
284 | + $uniqid = uniqid( '', false ); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | $grouped = ( 'field' === $field_type ); |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | // get field/widget options |
290 | 290 | $option_groups = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type, $form_id, $grouped ); |
291 | 291 | |
292 | - if( ! $grouped ) { |
|
292 | + if ( ! $grouped ) { |
|
293 | 293 | $option_groups = array( $option_groups ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | $option_groups = array_filter( $option_groups ); |
297 | 297 | |
298 | 298 | // two different post arrays, depending of the field type |
299 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
299 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
300 | 300 | |
301 | 301 | // build output |
302 | - $hidden_fields = '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
303 | - $hidden_fields .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
302 | + $hidden_fields = '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
303 | + $hidden_fields .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
304 | 304 | |
305 | 305 | $form_title = ''; |
306 | 306 | if ( $form_id ) { |
307 | - $hidden_fields .= '<input type="hidden" class="field-form-id" name="'. $name_prefix .'[form_id]" value="'. esc_attr( $form_id ) .'">'; |
|
307 | + $hidden_fields .= '<input type="hidden" class="field-form-id" name="' . $name_prefix . '[form_id]" value="' . esc_attr( $form_id ) . '">'; |
|
308 | 308 | $form = GVCommon::get_form_or_form_template( $form_id ); |
309 | - $form_title = $form['title']; |
|
309 | + $form_title = $form[ 'title' ]; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | // If there are no options, return what we got. |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | return $hidden_fields . '<!-- No Options -->'; // The HTML comment is here for checking if the output is empty in render_label() |
315 | 315 | } |
316 | 316 | |
317 | - $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
317 | + $settings_title = esc_attr( sprintf( __( '%s Settings', 'gk-gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ); |
|
318 | 318 | |
319 | 319 | $field_details = ''; |
320 | 320 | |
321 | 321 | // Get the pretty name for the input type |
322 | 322 | $gv_field = GravityView_Fields::get( $input_type ); |
323 | 323 | |
324 | - if( $gv_field ) { |
|
324 | + if ( $gv_field ) { |
|
325 | 325 | $input_type_label = $gv_field->label; |
326 | 326 | } else { |
327 | 327 | $input_type_label = $input_type; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | if ( $grouped ) { |
338 | - $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
338 | + $group_name = rgar( self::get_field_groups(), $group_key, '' ); |
|
339 | 339 | $field_settings .= '<fieldset class="item-settings-group item-settings-group-' . esc_attr( $group_key ) . '">'; |
340 | 340 | $field_settings .= '<legend>' . esc_attr( $group_name ) . '</legend>'; |
341 | 341 | } |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $show_if = ''; |
355 | - if ( ! empty( $option['requires'] ) ) { |
|
356 | - $show_if .= sprintf( ' data-requires="%s"', $option['requires'] ); |
|
355 | + if ( ! empty( $option[ 'requires' ] ) ) { |
|
356 | + $show_if .= sprintf( ' data-requires="%s"', $option[ 'requires' ] ); |
|
357 | 357 | } |
358 | 358 | |
359 | - if ( ! empty( $option['requires_not'] ) ) { |
|
360 | - $show_if .= sprintf( ' data-requires-not="%s"', $option['requires_not'] ); |
|
359 | + if ( ! empty( $option[ 'requires_not' ] ) ) { |
|
360 | + $show_if .= sprintf( ' data-requires-not="%s"', $option[ 'requires_not' ] ); |
|
361 | 361 | } |
362 | 362 | |
363 | - switch ( $option['type'] ) { |
|
363 | + switch ( $option[ 'type' ] ) { |
|
364 | 364 | // Hide hidden fields |
365 | 365 | case 'hidden': |
366 | 366 | $field_settings .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -378,30 +378,30 @@ discard block |
||
378 | 378 | $item_details = ''; |
379 | 379 | $subtitle = ''; |
380 | 380 | |
381 | - if( 'field' === $field_type ) { |
|
382 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
381 | + if ( 'field' === $field_type ) { |
|
382 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
383 | 383 | |
384 | 384 | $item_details .= ' |
385 | 385 | <div class="gv-field-details--container"> |
386 | - <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) .' <i class="dashicons dashicons-arrow-right"></i></label> |
|
386 | + <label class="gv-field-details--toggle">' . esc_html__( 'Field Details', 'gk-gravityview' ) . ' <i class="dashicons dashicons-arrow-right"></i></label> |
|
387 | 387 | <section class="gv-field-details gv-field-details--closed">'; |
388 | 388 | |
389 | 389 | if ( $field_id && is_numeric( $field_id ) ) { |
390 | 390 | $item_details .= ' |
391 | 391 | <div class="gv-field-detail gv-field-detail--field"> |
392 | - <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
392 | + <span class="gv-field-detail--label">' . esc_html__( 'Field ID', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">#{{field_id}}</span> |
|
393 | 393 | </div>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $item_details .= ' |
397 | 397 | <div class="gv-field-detail gv-field-detail--type"> |
398 | - <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
398 | + <span class="gv-field-detail--label">' . esc_html_x( 'Type', 'The type of field being configured (eg: "Single Line Text")', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{input_type_label}}</span> |
|
399 | 399 | </div>'; |
400 | 400 | |
401 | - if( $form_id ) { |
|
401 | + if ( $form_id ) { |
|
402 | 402 | $item_details .= ' |
403 | 403 | <div class="gv-field-detail gv-field-detail--form"> |
404 | - <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) .'</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
404 | + <span class="gv-field-detail--label">' . esc_html__( 'Form', 'gk-gravityview' ) . '</span><span class="gv-field-detail--value">{{form_title}} (#{{form_id}})</span> |
|
405 | 405 | </div>'; |
406 | 406 | } |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | </section> |
410 | 410 | </div>'; |
411 | 411 | } else { |
412 | - $subtitle = ! empty( $item['subtitle'] ) ? '<div class="subtitle">' . $item['subtitle'] . '</div>' : ''; |
|
412 | + $subtitle = ! empty( $item[ 'subtitle' ] ) ? '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>' : ''; |
|
413 | 413 | $widget_details_content = \GV\Utils::get( $item, 'description', '' ); |
414 | 414 | |
415 | 415 | // Intentionally not escaping to allow HTML. |
@@ -476,17 +476,17 @@ discard block |
||
476 | 476 | * @deprecated setting index 'default' was replaced by 'value' |
477 | 477 | * @see GravityView_FieldType::get_field_defaults |
478 | 478 | */ |
479 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
480 | - $option['value'] = $option['default']; |
|
481 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
479 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
480 | + $option[ 'value' ] = $option[ 'default' ]; |
|
481 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | // prepare to render option field type |
485 | - if( isset( $option['type'] ) ) { |
|
485 | + if ( isset( $option[ 'type' ] ) ) { |
|
486 | 486 | |
487 | 487 | $type_class = self::load_type_class( $option ); |
488 | 488 | |
489 | - if( class_exists( $type_class ) ) { |
|
489 | + if ( class_exists( $type_class ) ) { |
|
490 | 490 | |
491 | 491 | /** @type GravityView_FieldType $render_type */ |
492 | 492 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param string $output field class name |
504 | 504 | * @param array $option option field data |
505 | 505 | */ |
506 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
506 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | } // isset option[type] |
@@ -538,27 +538,27 @@ discard block |
||
538 | 538 | * @deprecated setting index 'name' was replaced by 'label' |
539 | 539 | * @see GravityView_FieldType::get_field_defaults |
540 | 540 | */ |
541 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
542 | - $setting['label'] = $setting['name']; |
|
543 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
541 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
542 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
543 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | $name = esc_attr( sprintf( $name, $key ) ); |
547 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
548 | - $setting['tooltip'] = 'gv_' . $key; |
|
547 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
548 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
549 | 549 | |
550 | 550 | // Use default if current setting isn't set. |
551 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
551 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
552 | 552 | |
553 | 553 | // default setting type = text |
554 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
554 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
555 | 555 | |
556 | 556 | // merge tags |
557 | - if( !isset( $setting['merge_tags'] ) ) { |
|
558 | - if( $setting['type'] === 'text' ) { |
|
559 | - $setting['merge_tags'] = true; |
|
557 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
558 | + if ( $setting[ 'type' ] === 'text' ) { |
|
559 | + $setting[ 'merge_tags' ] = true; |
|
560 | 560 | } else { |
561 | - $setting['merge_tags'] = false; |
|
561 | + $setting[ 'merge_tags' ] = false; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | // render the setting |
568 | 568 | $type_class = self::load_type_class( $setting ); |
569 | - if( class_exists( $type_class ) ) { |
|
569 | + if ( class_exists( $type_class ) ) { |
|
570 | 570 | /** @type GravityView_FieldType $render_type */ |
571 | 571 | $render_type = new $type_class( $name, $setting, $curr_value ); |
572 | 572 | ob_start(); |
@@ -575,25 +575,25 @@ discard block |
||
575 | 575 | } |
576 | 576 | |
577 | 577 | // Check if setting is specific for a template |
578 | - if( !empty( $setting['show_in_template'] ) ) { |
|
579 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
580 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
578 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
579 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
580 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
581 | 581 | } |
582 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
582 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
583 | 583 | } else { |
584 | 584 | $show_if = ''; |
585 | 585 | } |
586 | 586 | |
587 | - if( ! empty( $setting['requires'] ) ) { |
|
588 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
587 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
588 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
589 | 589 | } |
590 | 590 | |
591 | - if( ! empty( $setting['requires_not'] ) ) { |
|
592 | - $show_if .= sprintf( ' data-requires-not="%s"', $setting['requires_not'] ); |
|
591 | + if ( ! empty( $setting[ 'requires_not' ] ) ) { |
|
592 | + $show_if .= sprintf( ' data-requires-not="%s"', $setting[ 'requires_not' ] ); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // output |
596 | - echo '<tr style="vertical-align: top;" '. $show_if .'>' . $output . '</tr>'; |
|
596 | + echo '<tr style="vertical-align: top;" ' . $show_if . '>' . $output . '</tr>'; |
|
597 | 597 | |
598 | 598 | } |
599 | 599 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public static function load_type_class( $field = NULL ) { |
607 | 607 | |
608 | - if( empty( $field['type'] ) ) { |
|
608 | + if ( empty( $field[ 'type' ] ) ) { |
|
609 | 609 | return NULL; |
610 | 610 | } |
611 | 611 | |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
615 | 615 | * @param array $field field data |
616 | 616 | */ |
617 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
617 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
618 | 618 | |
619 | - if( class_exists( $type_class ) ) { |
|
619 | + if ( class_exists( $type_class ) ) { |
|
620 | 620 | return $type_class; |
621 | 621 | } |
622 | 622 | |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | * @param string $field_type_include_path field class file path |
626 | 626 | * @param array $field field data |
627 | 627 | */ |
628 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
628 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
629 | 629 | |
630 | - if( $class_file && file_exists( $class_file ) ) { |
|
630 | + if ( $class_file && file_exists( $class_file ) ) { |
|
631 | 631 | require_once( $class_file ); |
632 | 632 | } |
633 | 633 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | |
650 | 650 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
651 | 651 | |
652 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
653 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
652 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
653 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
654 | 654 | |
655 | 655 | return $output; |
656 | 656 | } |
@@ -670,22 +670,22 @@ discard block |
||
670 | 670 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
671 | 671 | |
672 | 672 | // Show the merge tags if the field is a list view |
673 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
673 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
674 | 674 | |
675 | 675 | // Or is a single entry view |
676 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
676 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
677 | 677 | $show = ( $is_single || $is_list ); |
678 | 678 | |
679 | 679 | $class = ''; |
680 | 680 | // and $add_merge_tags is not false |
681 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
681 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
682 | 682 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
683 | 683 | } |
684 | 684 | |
685 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
686 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
685 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
686 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
687 | 687 | |
688 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
688 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | /** |
@@ -702,21 +702,21 @@ discard block |
||
702 | 702 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
703 | 703 | |
704 | 704 | // Show the merge tags if the field is a list view |
705 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
705 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
706 | 706 | |
707 | 707 | // Or is a single entry view |
708 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
708 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
709 | 709 | $show = ( $is_single || $is_list ); |
710 | 710 | |
711 | 711 | $class = ''; |
712 | 712 | // and $add_merge_tags is not false |
713 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
713 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
714 | 714 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
715 | 715 | } |
716 | 716 | |
717 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
717 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
718 | 718 | |
719 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
719 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -732,9 +732,9 @@ discard block |
||
732 | 732 | |
733 | 733 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
734 | 734 | |
735 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
736 | - foreach( $choices as $value => $label ) { |
|
737 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
735 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
736 | + foreach ( $choices as $value => $label ) { |
|
737 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
738 | 738 | } |
739 | 739 | $output .= '</select>'; |
740 | 740 |
@@ -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( |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // translators: Do not translate [b], [/b], [link], or [/link]; they are placeholders for HTML and links to documentation. |
84 | 84 | 'desc' => strtr( |
85 | 85 | esc_html__( 'For fields with choices: Instead of showing all choices for each field, show only field choices that exist in submitted form entries.', 'gk-gravityview' ) . |
86 | - '<p><strong>⚠️ ' . esc_html__('This setting affects security.', 'gk-gravityview' ) . '</strong> ' . esc_html__( '[link]Learn about the Pre-Filter Choices setting[/link] before enabling it.', 'gk-gravityview') . '</p>', |
|
86 | + '<p><strong>⚠️ ' . esc_html__( 'This setting affects security.', 'gk-gravityview' ) . '</strong> ' . esc_html__( '[link]Learn about the Pre-Filter Choices setting[/link] before enabling it.', 'gk-gravityview' ) . '</p>', |
|
87 | 87 | array( |
88 | 88 | '[b]' => '<strong>', |
89 | 89 | '[/b]' => '</strong>', |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
111 | 111 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
112 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
112 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
113 | 113 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
114 | 114 | |
115 | 115 | // ajax - get the searchable fields |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function add_reserved_args( $args ) { |
147 | 147 | |
148 | - $args[] = 'gv_search'; |
|
149 | - $args[] = 'gv_start'; |
|
150 | - $args[] = 'gv_end'; |
|
151 | - $args[] = 'gv_id'; |
|
152 | - $args[] = 'gv_by'; |
|
153 | - $args[] = 'mode'; |
|
148 | + $args[ ] = 'gv_search'; |
|
149 | + $args[ ] = 'gv_start'; |
|
150 | + $args[ ] = 'gv_end'; |
|
151 | + $args[ ] = 'gv_id'; |
|
152 | + $args[ ] = 'gv_by'; |
|
153 | + $args[ ] = 'mode'; |
|
154 | 154 | |
155 | - $get = (array) $_GET; |
|
155 | + $get = (array)$_GET; |
|
156 | 156 | |
157 | 157 | // If the fields being searched as reserved; not to be considered user-passed variables |
158 | 158 | foreach ( $get as $key => $value ) { |
159 | 159 | if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) { |
160 | - $args[] = $key; |
|
160 | + $args[ ] = $key; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
282 | 282 | $script_source = empty( $script_min ) ? '/source' : ''; |
283 | 283 | |
284 | - 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 ); |
|
284 | + 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 ); |
|
285 | 285 | |
286 | 286 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
287 | 287 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
304 | 304 | */ |
305 | 305 | public function register_no_conflict( $allowed ) { |
306 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
306 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
307 | 307 | return $allowed; |
308 | 308 | } |
309 | 309 | |
@@ -315,24 +315,24 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public static function get_searchable_fields() { |
317 | 317 | |
318 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
318 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
319 | 319 | exit( '0' ); |
320 | 320 | } |
321 | 321 | |
322 | 322 | $form = ''; |
323 | 323 | |
324 | 324 | // Fetch the form for the current View |
325 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
325 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
326 | 326 | |
327 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
327 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
328 | 328 | |
329 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
329 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
330 | 330 | |
331 | - $form = (int) $_POST['formid']; |
|
331 | + $form = (int)$_POST[ 'formid' ]; |
|
332 | 332 | |
333 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
333 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
334 | 334 | |
335 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
335 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
336 | 336 | |
337 | 337 | } |
338 | 338 | |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | ); |
383 | 383 | |
384 | 384 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
385 | - $custom_fields['is_approved'] = array( |
|
385 | + $custom_fields[ 'is_approved' ] = array( |
|
386 | 386 | 'text' => esc_html__( 'Approval Status', 'gk-gravityview' ), |
387 | 387 | 'type' => 'multi', |
388 | 388 | ); |
389 | 389 | } |
390 | 390 | |
391 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
392 | - $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'] ); |
|
391 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
392 | + $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' ] ); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | // Get fields with sub-inputs and no parent |
@@ -411,13 +411,13 @@ discard block |
||
411 | 411 | |
412 | 412 | foreach ( $fields as $id => $field ) { |
413 | 413 | |
414 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
414 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
415 | 415 | continue; |
416 | 416 | } |
417 | 417 | |
418 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
418 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
419 | 419 | |
420 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
420 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
441 | 441 | |
442 | 442 | // @todo - This needs to be improved - many fields have . including products and addresses |
443 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
443 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
444 | 444 | $input_type = 'boolean'; // on/off checkbox |
445 | 445 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
446 | 446 | $input_type = 'multi'; //multiselect |
@@ -486,19 +486,19 @@ discard block |
||
486 | 486 | $post_id = 0; |
487 | 487 | |
488 | 488 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
489 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
490 | - $post_id = absint( $widget_args['post_id'] ); |
|
489 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
490 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
491 | 491 | } |
492 | 492 | // We're in the WordPress Widget context, and the base View ID should be used |
493 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
494 | - $post_id = absint( $widget_args['view_id'] ); |
|
493 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
494 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | $args = gravityview_get_permalink_query_args( $post_id ); |
498 | 498 | |
499 | 499 | // Add hidden fields to the search form |
500 | 500 | foreach ( $args as $key => $value ) { |
501 | - $search_fields[] = array( |
|
501 | + $search_fields[ ] = array( |
|
502 | 502 | 'name' => $key, |
503 | 503 | 'input' => 'hidden', |
504 | 504 | 'value' => $value, |
@@ -537,28 +537,28 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * Include the sidebar Widgets. |
539 | 539 | */ |
540 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
540 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
541 | 541 | |
542 | 542 | foreach ( $widgets as $widget ) { |
543 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
544 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
543 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
544 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
545 | 545 | foreach ( $_fields as $field ) { |
546 | - if ( empty( $field['form_id'] ) ) { |
|
547 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
546 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
547 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
548 | 548 | } |
549 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
549 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | 555 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
556 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
556 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
557 | 557 | foreach ( $_fields as $field ) { |
558 | - if ( empty( $field['form_id'] ) ) { |
|
559 | - $field['form_id'] = $view->form ? $view->form->ID : 0; |
|
558 | + if ( empty( $field[ 'form_id' ] ) ) { |
|
559 | + $field[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
560 | 560 | } |
561 | - $searchable_fields[] = $with_full_field ? $field : $field['field']; |
|
561 | + $searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | return $search_criteria; // Return the original criteria, GF_Query modification kicks in later |
605 | 605 | } |
606 | 606 | |
607 | - if( 'post' === $this->search_method ) { |
|
607 | + if ( 'post' === $this->search_method ) { |
|
608 | 608 | $get = $_POST; |
609 | 609 | } else { |
610 | 610 | $get = $_GET; |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | } |
628 | 628 | |
629 | 629 | // Make sure array key is set up |
630 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
630 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
631 | 631 | |
632 | 632 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
633 | 633 | $searchable_field_objects = $this->get_view_searchable_fields( $view, true ); |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | $trim_search_value = apply_filters( 'gravityview/search-trim-input', true ); |
648 | 648 | |
649 | 649 | // add free search |
650 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
650 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
651 | 651 | |
652 | - $search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search']; |
|
652 | + $search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ]; |
|
653 | 653 | |
654 | 654 | if ( $split_words ) { |
655 | 655 | // Search for a piece |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | foreach ( $words as $word ) { |
668 | - $search_criteria['field_filters'][] = array( |
|
668 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
669 | 669 | 'key' => null, // The field ID to search |
670 | 670 | 'value' => $word, // The value to search |
671 | 671 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -678,14 +678,14 @@ discard block |
||
678 | 678 | /** |
679 | 679 | * Get and normalize the dates according to the input format. |
680 | 680 | */ |
681 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
682 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
681 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
682 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
683 | 683 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
684 | 684 | } |
685 | 685 | } |
686 | 686 | |
687 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
688 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
687 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
688 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
689 | 689 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
690 | 690 | } |
691 | 691 | } |
@@ -721,22 +721,22 @@ discard block |
||
721 | 721 | */ |
722 | 722 | if ( ! empty( $curr_start ) ) { |
723 | 723 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
724 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
724 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | if ( ! empty( $curr_end ) ) { |
728 | 728 | // Fast-forward 24 hour on the end time |
729 | 729 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
730 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
731 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
732 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
730 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
731 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
732 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
733 | 733 | } |
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | 737 | // search for a specific entry ID |
738 | 738 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
739 | - $search_criteria['field_filters'][] = array( |
|
739 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
740 | 740 | 'key' => 'id', |
741 | 741 | 'value' => absint( $get[ 'gv_id' ] ), |
742 | 742 | 'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ), |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | |
746 | 746 | // search for a specific Created_by ID |
747 | 747 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
748 | - $search_criteria['field_filters'][] = array( |
|
748 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
749 | 749 | 'key' => 'created_by', |
750 | - 'value' => $get['gv_by'], |
|
750 | + 'value' => $get[ 'gv_by' ], |
|
751 | 751 | 'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ), |
752 | 752 | ); |
753 | 753 | } |
754 | 754 | |
755 | 755 | // Get search mode passed in URL |
756 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
756 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
757 | 757 | |
758 | 758 | // get the other search filters |
759 | 759 | foreach ( $get as $key => $value ) { |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value ); |
772 | 772 | } |
773 | 773 | |
774 | - if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
774 | + if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
775 | 775 | /** |
776 | 776 | * @filter `gravityview/search/ignore-empty-values` Filter to control if empty field values should be ignored or strictly matched (default: true) |
777 | 777 | * @since 2.14.2.1 |
@@ -802,21 +802,21 @@ discard block |
||
802 | 802 | continue; |
803 | 803 | } |
804 | 804 | |
805 | - if ( ! isset( $filter['operator'] ) ) { |
|
806 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
805 | + if ( ! isset( $filter[ 'operator' ] ) ) { |
|
806 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' ); |
|
807 | 807 | } |
808 | 808 | |
809 | - if ( isset( $filter[0]['value'] ) ) { |
|
810 | - $filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value']; |
|
809 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
810 | + $filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ]; |
|
811 | 811 | |
812 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
812 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
813 | 813 | |
814 | 814 | // if date range type, set search mode to ALL |
815 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
815 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
816 | 816 | $mode = 'all'; |
817 | 817 | } |
818 | - } elseif( !empty( $filter ) ) { |
|
819 | - $search_criteria['field_filters'][] = $filter; |
|
818 | + } elseif ( ! empty( $filter ) ) { |
|
819 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
820 | 820 | } |
821 | 821 | } |
822 | 822 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | * @since 1.5.1 |
826 | 826 | * @param string $mode Search mode (`any` vs `all`) |
827 | 827 | */ |
828 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
828 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
829 | 829 | |
830 | 830 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
831 | 831 | |
@@ -859,19 +859,19 @@ discard block |
||
859 | 859 | |
860 | 860 | $query_class = $view->get_query_class(); |
861 | 861 | |
862 | - if ( empty( $search_criteria['field_filters'] ) ) { |
|
862 | + if ( empty( $search_criteria[ 'field_filters' ] ) ) { |
|
863 | 863 | return; |
864 | 864 | } |
865 | 865 | |
866 | 866 | $widgets = $view->widgets->by_id( $this->widget_id ); |
867 | 867 | if ( $widgets->count() ) { |
868 | 868 | $widgets = $widgets->all(); |
869 | - $widget = $widgets[0]; |
|
869 | + $widget = $widgets[ 0 ]; |
|
870 | 870 | |
871 | 871 | $search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ); |
872 | 872 | |
873 | - foreach ( (array) $search_fields as $search_field ) { |
|
874 | - if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) { |
|
873 | + foreach ( (array)$search_fields as $search_field ) { |
|
874 | + if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) { |
|
875 | 875 | $created_by_text_mode = true; |
876 | 876 | } |
877 | 877 | } |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $extra_conditions = array(); |
881 | 881 | $mode = 'any'; |
882 | 882 | |
883 | - foreach ( $search_criteria['field_filters'] as $key => &$filter ) { |
|
883 | + foreach ( $search_criteria[ 'field_filters' ] as $key => &$filter ) { |
|
884 | 884 | if ( ! is_array( $filter ) ) { |
885 | 885 | if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) { |
886 | 886 | $mode = $filter; |
@@ -889,13 +889,13 @@ discard block |
||
889 | 889 | } |
890 | 890 | |
891 | 891 | // Construct a manual query for unapproved statuses |
892 | - if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) { |
|
893 | - $_tmp_query = new $query_class( $view->form->ID, array( |
|
892 | + if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) { |
|
893 | + $_tmp_query = new $query_class( $view->form->ID, array( |
|
894 | 894 | 'field_filters' => array( |
895 | 895 | array( |
896 | 896 | 'operator' => 'in', |
897 | 897 | 'key' => 'is_approved', |
898 | - 'value' => (array) $filter['value'], |
|
898 | + 'value' => (array)$filter[ 'value' ], |
|
899 | 899 | ), |
900 | 900 | array( |
901 | 901 | 'operator' => 'is', |
@@ -907,30 +907,30 @@ discard block |
||
907 | 907 | ) ); |
908 | 908 | $_tmp_query_parts = $_tmp_query->_introspect(); |
909 | 909 | |
910 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
910 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
911 | 911 | |
912 | 912 | $filter = false; |
913 | 913 | continue; |
914 | 914 | } |
915 | 915 | |
916 | 916 | // Construct manual query for text mode creator search |
917 | - if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) { |
|
918 | - $extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
917 | + if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) { |
|
918 | + $extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view ); |
|
919 | 919 | $filter = false; |
920 | 920 | continue; |
921 | 921 | } |
922 | 922 | |
923 | 923 | // By default, we want searches to be wildcard for each field. |
924 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
924 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
925 | 925 | |
926 | 926 | // For multichoice, let's have an in (OR) search. |
927 | - if ( is_array( $filter['value'] ) ) { |
|
928 | - $filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
927 | + if ( is_array( $filter[ 'value' ] ) ) { |
|
928 | + $filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)? |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | // Default form with joins functionality |
932 | - if ( empty( $filter['form_id'] ) ) { |
|
933 | - $filter['form_id'] = $view->form ? $view->form->ID : 0; |
|
932 | + if ( empty( $filter[ 'form_id' ] ) ) { |
|
933 | + $filter[ 'form_id' ] = $view->form ? $view->form->ID : 0; |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | /** |
@@ -940,32 +940,32 @@ discard block |
||
940 | 940 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
941 | 941 | * @param \GV\View $view The View we're operating on. |
942 | 942 | */ |
943 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view ); |
|
943 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view ); |
|
944 | 944 | |
945 | - if ( 'is' !== $filter['operator'] && '' === $filter['value'] ) { |
|
946 | - unset( $search_criteria['field_filters'][ $key ] ); |
|
945 | + if ( 'is' !== $filter[ 'operator' ] && '' === $filter[ 'value' ] ) { |
|
946 | + unset( $search_criteria[ 'field_filters' ][ $key ] ); |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
950 | - if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) { |
|
950 | + if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) { |
|
951 | 951 | $date_criteria = array(); |
952 | 952 | |
953 | - if ( isset( $search_criteria['start_date'] ) ) { |
|
954 | - $date_criteria['start_date'] = $search_criteria['start_date']; |
|
953 | + if ( isset( $search_criteria[ 'start_date' ] ) ) { |
|
954 | + $date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ]; |
|
955 | 955 | } |
956 | 956 | |
957 | - if ( isset( $search_criteria['end_date'] ) ) { |
|
958 | - $date_criteria['end_date'] = $search_criteria['end_date']; |
|
957 | + if ( isset( $search_criteria[ 'end_date' ] ) ) { |
|
958 | + $date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ]; |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | $_tmp_query = new $query_class( $view->form->ID, $date_criteria ); |
962 | 962 | $_tmp_query_parts = $_tmp_query->_introspect(); |
963 | - $extra_conditions[] = $_tmp_query_parts['where']; |
|
963 | + $extra_conditions[ ] = $_tmp_query_parts[ 'where' ]; |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | $search_conditions = array(); |
967 | 967 | |
968 | - if ( $filters = array_filter( $search_criteria['field_filters'] ) ) { |
|
968 | + if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) { |
|
969 | 969 | foreach ( $filters as &$filter ) { |
970 | 970 | if ( ! is_array( $filter ) ) { |
971 | 971 | continue; |
@@ -977,12 +977,12 @@ discard block |
||
977 | 977 | * code by reusing what's inside GF_Query already as they |
978 | 978 | * take care of many small things like forcing numeric, etc. |
979 | 979 | */ |
980 | - $_tmp_query = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
980 | + $_tmp_query = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) ); |
|
981 | 981 | $_tmp_query_parts = $_tmp_query->_introspect(); |
982 | - $search_condition = $_tmp_query_parts['where']; |
|
982 | + $search_condition = $_tmp_query_parts[ 'where' ]; |
|
983 | 983 | |
984 | - if ( empty( $filter['key'] ) && $search_condition->expressions ) { |
|
985 | - $search_conditions[] = $search_condition; |
|
984 | + if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) { |
|
985 | + $search_conditions[ ] = $search_condition; |
|
986 | 986 | } else { |
987 | 987 | $left = $search_condition->left; |
988 | 988 | |
@@ -994,8 +994,8 @@ discard block |
||
994 | 994 | |
995 | 995 | $value = $reflectionProperty->getValue( $left ); |
996 | 996 | |
997 | - if ( ! empty( $value[0] ) && $value[0] instanceof GF_Query_Column ) { |
|
998 | - $left = $value[0]; |
|
997 | + if ( ! empty( $value[ 0 ] ) && $value[ 0 ] instanceof GF_Query_Column ) { |
|
998 | + $left = $value[ 0 ]; |
|
999 | 999 | } else { |
1000 | 1000 | continue; |
1001 | 1001 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | $on = $_join->join_on; |
1012 | 1012 | $join = $_join->join; |
1013 | 1013 | |
1014 | - $search_conditions[] = GF_Query_Condition::_or( |
|
1014 | + $search_conditions[ ] = GF_Query_Condition::_or( |
|
1015 | 1015 | // Join |
1016 | 1016 | new GF_Query_Condition( |
1017 | 1017 | new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ), |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | ); |
1028 | 1028 | } |
1029 | 1029 | } else { |
1030 | - $search_conditions[] = new GF_Query_Condition( |
|
1030 | + $search_conditions[ ] = new GF_Query_Condition( |
|
1031 | 1031 | new GF_Query_Column( $left->field_id, $left->source, $alias ), |
1032 | 1032 | $search_condition->operator, |
1033 | 1033 | $search_condition->right |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | /** |
1050 | 1050 | * Combine the parts as a new WHERE clause. |
1051 | 1051 | */ |
1052 | - $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) ); |
|
1052 | + $where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) ); |
|
1053 | 1053 | $query->where( $where ); |
1054 | 1054 | } |
1055 | 1055 | |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $field_id = str_replace( array( 'filter_', 'input_' ), '', $key ); |
1073 | 1073 | |
1074 | 1074 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
1075 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
1075 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
1076 | 1076 | $field_id = str_replace( '_', '.', $field_id ); |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | // form is in searchable fields |
1130 | 1130 | $found = false; |
1131 | 1131 | foreach ( $searchable_fields as $field ) { |
1132 | - if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) { |
|
1132 | + if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) { |
|
1133 | 1133 | $found = true; |
1134 | 1134 | break; |
1135 | 1135 | } |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | |
1170 | 1170 | case 'select': |
1171 | 1171 | case 'radio': |
1172 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1172 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1173 | 1173 | break; |
1174 | 1174 | |
1175 | 1175 | case 'post_category': |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | foreach ( $value as $val ) { |
1185 | 1185 | $cat = get_term( $val, 'category' ); |
1186 | - $filter[] = array( |
|
1186 | + $filter[ ] = array( |
|
1187 | 1187 | 'key' => $field_id, |
1188 | 1188 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
1189 | 1189 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | $filter = array(); |
1203 | 1203 | |
1204 | 1204 | foreach ( $value as $val ) { |
1205 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
1205 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | break; |
@@ -1211,9 +1211,9 @@ discard block |
||
1211 | 1211 | // convert checkbox on/off into the correct search filter |
1212 | 1212 | if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
1213 | 1213 | foreach ( $form_field->inputs as $k => $input ) { |
1214 | - if ( $input['id'] == $field_id ) { |
|
1215 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
1216 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1214 | + if ( $input[ 'id' ] == $field_id ) { |
|
1215 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
1216 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1217 | 1217 | break; |
1218 | 1218 | } |
1219 | 1219 | } |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | $filter = array(); |
1224 | 1224 | |
1225 | 1225 | foreach ( $value as $val ) { |
1226 | - $filter[] = array( |
|
1226 | + $filter[ ] = array( |
|
1227 | 1227 | 'key' => $field_id, |
1228 | 1228 | 'value' => $val, |
1229 | 1229 | 'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ), |
@@ -1244,9 +1244,9 @@ discard block |
||
1244 | 1244 | foreach ( $words as $word ) { |
1245 | 1245 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
1246 | 1246 | // Keep the same key for each filter |
1247 | - $filter['value'] = $word; |
|
1247 | + $filter[ 'value' ] = $word; |
|
1248 | 1248 | // Add a search for the value |
1249 | - $filters[] = $filter; |
|
1249 | + $filters[ ] = $filter; |
|
1250 | 1250 | } |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1260,19 +1260,19 @@ discard block |
||
1260 | 1260 | |
1261 | 1261 | foreach ( $searchable_fields as $searchable_field ) { |
1262 | 1262 | |
1263 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
1263 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
1264 | 1264 | continue; |
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | // Only exact-match dropdowns, not text search |
1268 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
1268 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
1269 | 1269 | continue; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
1273 | 1273 | |
1274 | 1274 | if ( 4 === $input_id ) { |
1275 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1275 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1276 | 1276 | }; |
1277 | 1277 | } |
1278 | 1278 | } |
@@ -1300,12 +1300,12 @@ discard block |
||
1300 | 1300 | * @since 1.16.3 |
1301 | 1301 | * Safeguard until GF implements '<=' operator |
1302 | 1302 | */ |
1303 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1303 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
1304 | 1304 | $operator = '<'; |
1305 | 1305 | $date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) ); |
1306 | 1306 | } |
1307 | 1307 | |
1308 | - $filter[] = array( |
|
1308 | + $filter[ ] = array( |
|
1309 | 1309 | 'key' => $field_id, |
1310 | 1310 | 'value' => self::get_formatted_date( $date, 'Y-m-d', $date_format ), |
1311 | 1311 | 'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ), |
@@ -1313,12 +1313,12 @@ discard block |
||
1313 | 1313 | } |
1314 | 1314 | } else { |
1315 | 1315 | $date = $value; |
1316 | - $filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1317 | - $filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1316 | + $filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format ); |
|
1317 | + $filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' ); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | - if ('payment_date' === $key) { |
|
1321 | - $filter['operator'] = 'contains'; |
|
1320 | + if ( 'payment_date' === $key ) { |
|
1321 | + $filter[ 'operator' ] = 'contains'; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | break; |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | 'ymd_dot' => 'Y.m.d', |
1348 | 1348 | ); |
1349 | 1349 | |
1350 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
1350 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
1351 | 1351 | $format = $datepicker[ $field->dateFormat ]; |
1352 | 1352 | } |
1353 | 1353 | |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | public function add_template_path( $file_paths ) { |
1385 | 1385 | |
1386 | 1386 | // Index 100 is the default GravityView template path. |
1387 | - $file_paths[102] = self::$file . 'templates/'; |
|
1387 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
1388 | 1388 | |
1389 | 1389 | return $file_paths; |
1390 | 1390 | } |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | $has_date = false; |
1404 | 1404 | |
1405 | 1405 | foreach ( $search_fields as $k => $field ) { |
1406 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1406 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
1407 | 1407 | $has_date = true; |
1408 | 1408 | break; |
1409 | 1409 | } |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | $view = \GV\View::by_id( $gravityview_view->view_id ); |
1433 | 1433 | |
1434 | 1434 | // get configured search fields |
1435 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
1435 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
1436 | 1436 | |
1437 | 1437 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
1438 | 1438 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1446,39 +1446,39 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | $updated_field = $this->get_search_filter_details( $updated_field, $context, $widget_args ); |
1448 | 1448 | |
1449 | - switch ( $field['field'] ) { |
|
1449 | + switch ( $field[ 'field' ] ) { |
|
1450 | 1450 | |
1451 | 1451 | case 'search_all': |
1452 | - $updated_field['key'] = 'search_all'; |
|
1453 | - $updated_field['input'] = 'search_all'; |
|
1454 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1452 | + $updated_field[ 'key' ] = 'search_all'; |
|
1453 | + $updated_field[ 'input' ] = 'search_all'; |
|
1454 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
1455 | 1455 | break; |
1456 | 1456 | |
1457 | 1457 | case 'entry_date': |
1458 | - $updated_field['key'] = 'entry_date'; |
|
1459 | - $updated_field['input'] = 'entry_date'; |
|
1460 | - $updated_field['value'] = array( |
|
1458 | + $updated_field[ 'key' ] = 'entry_date'; |
|
1459 | + $updated_field[ 'input' ] = 'entry_date'; |
|
1460 | + $updated_field[ 'value' ] = array( |
|
1461 | 1461 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
1462 | 1462 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
1463 | 1463 | ); |
1464 | 1464 | break; |
1465 | 1465 | |
1466 | 1466 | case 'entry_id': |
1467 | - $updated_field['key'] = 'entry_id'; |
|
1468 | - $updated_field['input'] = 'entry_id'; |
|
1469 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1467 | + $updated_field[ 'key' ] = 'entry_id'; |
|
1468 | + $updated_field[ 'input' ] = 'entry_id'; |
|
1469 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
1470 | 1470 | break; |
1471 | 1471 | |
1472 | 1472 | case 'created_by': |
1473 | - $updated_field['key'] = 'created_by'; |
|
1474 | - $updated_field['name'] = 'gv_by'; |
|
1475 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1473 | + $updated_field[ 'key' ] = 'created_by'; |
|
1474 | + $updated_field[ 'name' ] = 'gv_by'; |
|
1475 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
1476 | 1476 | break; |
1477 | 1477 | |
1478 | 1478 | case 'is_approved': |
1479 | - $updated_field['key'] = 'is_approved'; |
|
1480 | - $updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1481 | - $updated_field['choices'] = self::get_is_approved_choices(); |
|
1479 | + $updated_field[ 'key' ] = 'is_approved'; |
|
1480 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' ); |
|
1481 | + $updated_field[ 'choices' ] = self::get_is_approved_choices(); |
|
1482 | 1482 | break; |
1483 | 1483 | } |
1484 | 1484 | |
@@ -1499,16 +1499,16 @@ discard block |
||
1499 | 1499 | |
1500 | 1500 | $gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args ); |
1501 | 1501 | |
1502 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
1502 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
1503 | 1503 | |
1504 | 1504 | /** @since 1.14 */ |
1505 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
1505 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
1506 | 1506 | |
1507 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
1507 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
1508 | 1508 | |
1509 | 1509 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
1510 | 1510 | |
1511 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
1511 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
1512 | 1512 | |
1513 | 1513 | if ( $this->has_date_field( $search_fields ) ) { |
1514 | 1514 | // enqueue datepicker stuff only if needed! |
@@ -1530,10 +1530,10 @@ discard block |
||
1530 | 1530 | public static function get_search_class( $custom_class = '' ) { |
1531 | 1531 | $gravityview_view = GravityView_View::getInstance(); |
1532 | 1532 | |
1533 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
1533 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
1534 | 1534 | |
1535 | - if ( ! empty( $custom_class ) ) { |
|
1536 | - $search_class .= ' '.$custom_class; |
|
1535 | + if ( ! empty( $custom_class ) ) { |
|
1536 | + $search_class .= ' ' . $custom_class; |
|
1537 | 1537 | } |
1538 | 1538 | |
1539 | 1539 | /** |
@@ -1584,9 +1584,9 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | if ( ! $label ) { |
1586 | 1586 | |
1587 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
1587 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
1588 | 1588 | |
1589 | - switch( $field['field'] ) { |
|
1589 | + switch ( $field[ 'field' ] ) { |
|
1590 | 1590 | case 'search_all': |
1591 | 1591 | $label = __( 'Search Entries:', 'gk-gravityview' ); |
1592 | 1592 | break; |
@@ -1598,10 +1598,10 @@ discard block |
||
1598 | 1598 | break; |
1599 | 1599 | default: |
1600 | 1600 | // If this is a field input, not a field |
1601 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
1601 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
1602 | 1602 | |
1603 | 1603 | // Get the label for the field in question, which returns an array |
1604 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
1604 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
1605 | 1605 | |
1606 | 1606 | // Get the item with the `label` key |
1607 | 1607 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1645,13 +1645,13 @@ discard block |
||
1645 | 1645 | $form = $gravityview_view->getForm(); |
1646 | 1646 | |
1647 | 1647 | // for advanced field ids (eg, first name / last name ) |
1648 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
1648 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
1649 | 1649 | |
1650 | 1650 | // get searched value from $_GET/$_POST (string or array) |
1651 | 1651 | $value = $this->rgget_or_rgpost( $name ); |
1652 | 1652 | |
1653 | 1653 | // get form field details |
1654 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
1654 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
1655 | 1655 | |
1656 | 1656 | $form_field_type = \GV\Utils::get( $form_field, 'type' ); |
1657 | 1657 | |
@@ -1665,22 +1665,22 @@ discard block |
||
1665 | 1665 | ); |
1666 | 1666 | |
1667 | 1667 | // collect choices |
1668 | - if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
1669 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
1670 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
1671 | - $filter['choices'] = $form_field['choices']; |
|
1668 | + if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
1669 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
1670 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
1671 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
1672 | 1672 | } |
1673 | 1673 | |
1674 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
1675 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
1674 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
1675 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
1676 | 1676 | } |
1677 | 1677 | |
1678 | - if ( 'created_by' === $field['field'] ) { |
|
1679 | - $filter['choices'] = self::get_created_by_choices( ( isset( $context->view ) ? $context->view : null ) ); |
|
1680 | - $filter['type'] = 'created_by'; |
|
1678 | + if ( 'created_by' === $field[ 'field' ] ) { |
|
1679 | + $filter[ 'choices' ] = self::get_created_by_choices( ( isset( $context->view ) ? $context->view : null ) ); |
|
1680 | + $filter[ 'type' ] = 'created_by'; |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | - if ( ! empty( $filter['choices'] ) ) { |
|
1683 | + if ( ! empty( $filter[ 'choices' ] ) ) { |
|
1684 | 1684 | |
1685 | 1685 | $sieve_choices = \GV\Utils::get( $widget_args, 'sieve_choices', false ); |
1686 | 1686 | |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | * @param \GV\Context The context. |
1693 | 1693 | */ |
1694 | 1694 | if ( apply_filters( 'gravityview/search/sieve_choices', $sieve_choices, $field, $context, $widget_args ) ) { |
1695 | - $filter['choices'] = $this->sieve_filter_choices( $filter, $context ); |
|
1695 | + $filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context ); |
|
1696 | 1696 | } |
1697 | 1697 | } |
1698 | 1698 | |
@@ -1721,18 +1721,18 @@ discard block |
||
1721 | 1721 | * @return array The filter choices. |
1722 | 1722 | */ |
1723 | 1723 | private function sieve_filter_choices( $filter, $context ) { |
1724 | - if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) { |
|
1724 | + if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) { |
|
1725 | 1725 | return $filter; // @todo Populate plugins might give us empty choices |
1726 | 1726 | } |
1727 | 1727 | |
1728 | 1728 | // Allow only created_by and field-ids to be sieved. |
1729 | - if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) { |
|
1729 | + if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) { |
|
1730 | 1730 | return $filter; |
1731 | 1731 | } |
1732 | 1732 | |
1733 | 1733 | $form_id = $context->view->form->ID; // @todo Support multiple forms (joins) |
1734 | 1734 | |
1735 | - $cache = new GravityView_Cache( $form_id, [ 'sieve', $filter['key'], $context->view->ID ] ); |
|
1735 | + $cache = new GravityView_Cache( $form_id, [ 'sieve', $filter[ 'key' ], $context->view->ID ] ); |
|
1736 | 1736 | |
1737 | 1737 | $filter_choices = $cache->get(); |
1738 | 1738 | |
@@ -1745,13 +1745,13 @@ discard block |
||
1745 | 1745 | $entry_table_name = GFFormsModel::get_entry_table_name(); |
1746 | 1746 | $entry_meta_table_name = GFFormsModel::get_entry_meta_table_name(); |
1747 | 1747 | |
1748 | - $key_like = $wpdb->esc_like( $filter['key'] ) . '.%'; |
|
1748 | + $key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%'; |
|
1749 | 1749 | |
1750 | 1750 | switch ( \GV\Utils::get( $filter, 'type' ) ) { |
1751 | 1751 | case 'post_category': |
1752 | 1752 | $choices = $wpdb->get_col( $wpdb->prepare( |
1753 | 1753 | "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", |
1754 | - $key_like, $filter['key'], $form_id |
|
1754 | + $key_like, $filter[ 'key' ], $form_id |
|
1755 | 1755 | ) ); |
1756 | 1756 | break; |
1757 | 1757 | case 'created_by': |
@@ -1763,17 +1763,17 @@ discard block |
||
1763 | 1763 | default: |
1764 | 1764 | $choices = $wpdb->get_col( $wpdb->prepare( |
1765 | 1765 | "SELECT DISTINCT `meta_value` FROM $entry_meta_table_name WHERE ( `meta_key` LIKE %s OR `meta_key` = %d) AND `form_id` = %d", |
1766 | - $key_like, $filter['key'], $form_id |
|
1766 | + $key_like, $filter[ 'key' ], $form_id |
|
1767 | 1767 | ) ); |
1768 | 1768 | |
1769 | - if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) { |
|
1769 | + if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) { |
|
1770 | 1770 | $choices = array_map( 'json_decode', $choices ); |
1771 | 1771 | $_choices_array = array(); |
1772 | 1772 | foreach ( $choices as $choice ) { |
1773 | 1773 | if ( is_array( $choice ) ) { |
1774 | 1774 | $_choices_array = array_merge( $_choices_array, $choice ); |
1775 | 1775 | } else { |
1776 | - $_choices_array [] = $choice; |
|
1776 | + $_choices_array [ ] = $choice; |
|
1777 | 1777 | } |
1778 | 1778 | } |
1779 | 1779 | $choices = array_unique( $_choices_array ); |
@@ -1783,9 +1783,9 @@ discard block |
||
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | $filter_choices = array(); |
1786 | - foreach ( $filter['choices'] as $choice ) { |
|
1787 | - if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) { |
|
1788 | - $filter_choices[] = $choice; |
|
1786 | + foreach ( $filter[ 'choices' ] as $choice ) { |
|
1787 | + if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) { |
|
1788 | + $filter_choices[ ] = $choice; |
|
1789 | 1789 | } |
1790 | 1790 | } |
1791 | 1791 | |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | * @param \GV\View|null $view The view. |
1823 | 1823 | */ |
1824 | 1824 | $text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view ); |
1825 | - $choices[] = array( |
|
1825 | + $choices[ ] = array( |
|
1826 | 1826 | 'value' => $user->ID, |
1827 | 1827 | 'text' => $text, |
1828 | 1828 | ); |
@@ -1842,9 +1842,9 @@ discard block |
||
1842 | 1842 | |
1843 | 1843 | $choices = array(); |
1844 | 1844 | foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) { |
1845 | - $choices[] = array( |
|
1846 | - 'value' => $status['value'], |
|
1847 | - 'text' => $status['label'], |
|
1845 | + $choices[ ] = array( |
|
1846 | + 'value' => $status[ 'value' ], |
|
1847 | + 'text' => $status[ 'label' ], |
|
1848 | 1848 | ); |
1849 | 1849 | } |
1850 | 1850 | |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | */ |
1899 | 1899 | public function add_datepicker_js_dependency( $js_dependencies ) { |
1900 | 1900 | |
1901 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
1901 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
1902 | 1902 | |
1903 | 1903 | return $js_dependencies; |
1904 | 1904 | } |
@@ -1942,7 +1942,7 @@ discard block |
||
1942 | 1942 | 'isRTL' => is_rtl(), |
1943 | 1943 | ), $view_data ); |
1944 | 1944 | |
1945 | - $localizations['datepicker'] = $datepicker_settings; |
|
1945 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
1946 | 1946 | |
1947 | 1947 | return $localizations; |
1948 | 1948 | |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | * @return void |
1970 | 1970 | */ |
1971 | 1971 | private function maybe_enqueue_flexibility() { |
1972 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1972 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
1973 | 1973 | wp_enqueue_script( 'gv-flexibility' ); |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1991,7 +1991,7 @@ discard block |
||
1991 | 1991 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
1992 | 1992 | |
1993 | 1993 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1994 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1994 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1995 | 1995 | |
1996 | 1996 | /** |
1997 | 1997 | * @filter `gravityview_search_datepicker_class` |
@@ -2070,7 +2070,7 @@ discard block |
||
2070 | 2070 | public function add_preview_inputs() { |
2071 | 2071 | global $wp; |
2072 | 2072 | |
2073 | - if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) { |
|
2073 | + if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) { |
|
2074 | 2074 | return; |
2075 | 2075 | } |
2076 | 2076 | |
@@ -2128,7 +2128,7 @@ discard block |
||
2128 | 2128 | */ |
2129 | 2129 | class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition { |
2130 | 2130 | public function __construct( $filter, $view ) { |
2131 | - $this->value = $filter['value']; |
|
2131 | + $this->value = $filter[ 'value' ]; |
|
2132 | 2132 | $this->view = $view; |
2133 | 2133 | } |
2134 | 2134 | |
@@ -2160,11 +2160,11 @@ discard block |
||
2160 | 2160 | $conditions = array(); |
2161 | 2161 | |
2162 | 2162 | foreach ( $user_fields as $user_field ) { |
2163 | - $conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2163 | + $conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2164 | 2164 | } |
2165 | 2165 | |
2166 | 2166 | foreach ( $user_meta_fields as $meta_field ) { |
2167 | - $conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2167 | + $conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' ); |
|
2168 | 2168 | } |
2169 | 2169 | |
2170 | 2170 | $conditions = '(' . implode( ' OR ', $conditions ) . ')'; |