@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
| 126 | 126 | |
| 127 | - $form = self::get_form( $entry['form_id'] ); |
|
| 127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 128 | 128 | |
| 129 | 129 | return $form; |
| 130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
| 177 | 177 | |
| 178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
| 178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
| 179 | 179 | |
| 180 | 180 | return $result; |
| 181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
| 194 | 194 | $gf_forms = GFAPI::get_forms(); |
| 195 | 195 | foreach ( $gf_forms as $form ) { |
| 196 | - $forms[] = array( |
|
| 197 | - 'id' => $form['id'], |
|
| 198 | - 'title' => $form['title'], |
|
| 196 | + $forms[ ] = array( |
|
| 197 | + 'id' => $form[ 'id' ], |
|
| 198 | + 'title' => $form[ 'title' ], |
|
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ( $form ) { |
| 230 | - foreach ( $form['fields'] as $field ) { |
|
| 231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 232 | - $fields[ $field['id'] ] = array( |
|
| 230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 231 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 232 | + $fields[ $field[ 'id' ] ] = array( |
|
| 233 | 233 | 'label' => rgar( $field, 'label' ), |
| 234 | 234 | 'parent' => null, |
| 235 | 235 | 'type' => rgar( $field, 'type' ), |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 242 | - foreach ( $field['inputs'] as $input ) { |
|
| 241 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 242 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 243 | 243 | /** |
| 244 | 244 | * @hack |
| 245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 246 | 246 | */ |
| 247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 247 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | - $fields[ (string)$input['id'] ] = array( |
|
| 250 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
| 251 | 251 | 'label' => rgar( $input, 'label' ), |
| 252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 253 | 253 | 'parent' => $field, |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** @since 1.14 */ |
| 262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
| 262 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
| 263 | 263 | |
| 264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
| 264 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
| 265 | 265 | |
| 266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
| 266 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
| 267 | 267 | |
| 268 | 268 | $fields[ $input_id ] = array( |
| 269 | 269 | 'label' => rgar( $input, 'text' ), |
@@ -279,25 +279,25 @@ discard block |
||
| 279 | 279 | /** |
| 280 | 280 | * @since 1.8 |
| 281 | 281 | */ |
| 282 | - if( 'quiz' === $field['type'] ) { |
|
| 282 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
| 283 | 283 | $has_quiz_fields = true; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * @since 1.8 |
| 288 | 288 | */ |
| 289 | - if( 'poll' === $field['type'] ) { |
|
| 289 | + if ( 'poll' === $field[ 'type' ] ) { |
|
| 290 | 290 | $has_poll_fields = true; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 293 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 294 | 294 | $has_product_fields = true; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @hack Version 1.9 |
| 299 | 299 | */ |
| 300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
| 300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
| 301 | 301 | |
| 302 | 302 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
| 303 | 303 | $has_post_fields = true; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @since 1.7 |
| 310 | 310 | */ |
| 311 | 311 | if ( $has_post_fields ) { |
| 312 | - $fields['post_id'] = array( |
|
| 312 | + $fields[ 'post_id' ] = array( |
|
| 313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), |
| 314 | 314 | 'type' => 'post_id', |
| 315 | 315 | ); |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 321 | 321 | |
| 322 | 322 | foreach ( $payment_fields as $payment_field ) { |
| 323 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 323 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 324 | 324 | continue; |
| 325 | 325 | } |
| 326 | - $fields["{$payment_field->name}"] = array( |
|
| 326 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 327 | 327 | 'label' => $payment_field->label, |
| 328 | 328 | 'desc' => $payment_field->description, |
| 329 | 329 | 'type' => $payment_field->name, |
@@ -334,24 +334,24 @@ discard block |
||
| 334 | 334 | /** |
| 335 | 335 | * @since 1.8 |
| 336 | 336 | */ |
| 337 | - if( $has_quiz_fields ) { |
|
| 337 | + if ( $has_quiz_fields ) { |
|
| 338 | 338 | |
| 339 | - $fields['gquiz_score'] = array( |
|
| 339 | + $fields[ 'gquiz_score' ] = array( |
|
| 340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 341 | 341 | 'type' => 'quiz_score', |
| 342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 343 | 343 | ); |
| 344 | - $fields['gquiz_percent'] = array( |
|
| 344 | + $fields[ 'gquiz_percent' ] = array( |
|
| 345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 346 | 346 | 'type' => 'quiz_percent', |
| 347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 348 | 348 | ); |
| 349 | - $fields['gquiz_grade'] = array( |
|
| 349 | + $fields[ 'gquiz_grade' ] = array( |
|
| 350 | 350 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 351 | 351 | 'type' => 'quiz_grade', |
| 352 | 352 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 353 | 353 | ); |
| 354 | - $fields['gquiz_is_pass'] = array( |
|
| 354 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 355 | 355 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 356 | 356 | 'type' => 'quiz_is_pass', |
| 357 | 357 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -373,9 +373,9 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $fields = array(); |
| 375 | 375 | |
| 376 | - foreach ( $extra_fields as $key => $field ){ |
|
| 377 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 378 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 376 | + foreach ( $extra_fields as $key => $field ) { |
|
| 377 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 378 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -415,32 +415,32 @@ discard block |
||
| 415 | 415 | 'search_criteria' => null, |
| 416 | 416 | 'sorting' => null, |
| 417 | 417 | 'paging' => null, |
| 418 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 418 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 419 | 419 | ); |
| 420 | 420 | |
| 421 | 421 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 422 | 422 | |
| 423 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 424 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 423 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 424 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 425 | 425 | |
| 426 | 426 | if ( ! is_array( $filter ) ) { |
| 427 | 427 | continue; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // By default, we want searches to be wildcard for each field. |
| 431 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 431 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 432 | 432 | |
| 433 | 433 | /** |
| 434 | 434 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 435 | 435 | * @param string $operator Existing search operator |
| 436 | 436 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 437 | 437 | */ |
| 438 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 438 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // don't send just the [mode] without any field filter. |
| 442 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 443 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 442 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 443 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | } |
@@ -451,21 +451,21 @@ discard block |
||
| 451 | 451 | * Prepare date formats to be in Gravity Forms DB format; |
| 452 | 452 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 453 | 453 | */ |
| 454 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 454 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 455 | 455 | |
| 456 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 456 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 457 | 457 | |
| 458 | 458 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 459 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 459 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 460 | 460 | |
| 461 | 461 | if ( $date ) { |
| 462 | 462 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 463 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 463 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 464 | 464 | } else { |
| 465 | 465 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 466 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 466 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 467 | 467 | |
| 468 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 468 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
@@ -473,12 +473,12 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 475 | 475 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 476 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 476 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 477 | 477 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 478 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
| 479 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 478 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; |
|
| 479 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 480 | 480 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 481 | - $criteria['context_view_id'] = null; |
|
| 481 | + $criteria[ 'context_view_id' ] = null; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * @param array $form_ids Forms to search |
| 488 | 488 | * @param int $view_id ID of the view being used to search |
| 489 | 489 | */ |
| 490 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 490 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 491 | 491 | |
| 492 | 492 | return (array)$criteria; |
| 493 | 493 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | /** Reduce # of database calls */ |
| 519 | 519 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 520 | 520 | |
| 521 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 521 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 522 | 522 | |
| 523 | 523 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 524 | 524 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | // Still update the total count when using cached results |
| 528 | 528 | if ( ! is_null( $total ) ) { |
| 529 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 529 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | $return = $entries; |
@@ -546,9 +546,9 @@ discard block |
||
| 546 | 546 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 547 | 547 | |
| 548 | 548 | // No entries returned from gravityview_before_get_entries |
| 549 | - if( is_null( $entries ) ) { |
|
| 549 | + if ( is_null( $entries ) ) { |
|
| 550 | 550 | |
| 551 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 551 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 552 | 552 | |
| 553 | 553 | if ( is_wp_error( $entries ) ) { |
| 554 | 554 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 560 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 561 | 561 | |
| 562 | 562 | // Cache results |
| 563 | 563 | $Cache->set( $entries, 'entries' ); |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | // fetch the entry |
| 637 | 637 | $entry = GFAPI::get_entry( $entry_id ); |
| 638 | 638 | |
| 639 | - if( $check_entry_display ) { |
|
| 639 | + if ( $check_entry_display ) { |
|
| 640 | 640 | // Is the entry allowed |
| 641 | 641 | $entry = self::check_entry_display( $entry ); |
| 642 | 642 | } |
@@ -669,12 +669,12 @@ discard block |
||
| 669 | 669 | |
| 670 | 670 | $value = false; |
| 671 | 671 | |
| 672 | - if( 'context' === $val1 ) { |
|
| 672 | + if ( 'context' === $val1 ) { |
|
| 673 | 673 | |
| 674 | 674 | $matching_contexts = array( $val2 ); |
| 675 | 675 | |
| 676 | 676 | // We allow for non-standard contexts. |
| 677 | - switch( $val2 ) { |
|
| 677 | + switch ( $val2 ) { |
|
| 678 | 678 | // Check for either single or edit |
| 679 | 679 | case 'singular': |
| 680 | 680 | $matching_contexts = array( 'single', 'edit' ); |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | return false; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - if ( empty( $entry['form_id'] ) ) { |
|
| 737 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 738 | 738 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 739 | 739 | return false; |
| 740 | 740 | } |
@@ -742,26 +742,26 @@ discard block |
||
| 742 | 742 | $criteria = self::calculate_get_entries_criteria(); |
| 743 | 743 | |
| 744 | 744 | // Make sure the current View is connected to the same form as the Entry |
| 745 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 746 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 745 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 746 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 747 | 747 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 748 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 749 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
| 748 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 749 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
| 750 | 750 | return false; |
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 754 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 755 | 755 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 756 | 756 | return $entry; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - $search_criteria = $criteria['search_criteria']; |
|
| 759 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 760 | 760 | unset( $criteria ); |
| 761 | 761 | |
| 762 | 762 | // check entry status |
| 763 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 764 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 763 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 764 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 765 | 765 | return false; |
| 766 | 766 | } |
| 767 | 767 | |
@@ -769,37 +769,37 @@ discard block |
||
| 769 | 769 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 770 | 770 | |
| 771 | 771 | // field_filters |
| 772 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 772 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 773 | 773 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 774 | 774 | return $entry; |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | - $filters = $search_criteria['field_filters']; |
|
| 777 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 778 | 778 | unset( $search_criteria ); |
| 779 | 779 | |
| 780 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 781 | - unset( $filters['mode'] ); |
|
| 780 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 781 | + unset( $filters[ 'mode' ] ); |
|
| 782 | 782 | |
| 783 | - $form = self::get_form( $entry['form_id'] ); |
|
| 783 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 784 | 784 | |
| 785 | 785 | foreach ( $filters as $filter ) { |
| 786 | 786 | |
| 787 | - if ( ! isset( $filter['key'] ) ) { |
|
| 787 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 788 | 788 | continue; |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - $k = $filter['key']; |
|
| 791 | + $k = $filter[ 'key' ]; |
|
| 792 | 792 | |
| 793 | 793 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 794 | 794 | $field_value = $entry[ $k ]; |
| 795 | 795 | $field = null; |
| 796 | 796 | } else { |
| 797 | 797 | $field = self::get_field( $form, $k ); |
| 798 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 798 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 802 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 801 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 802 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 803 | 803 | |
| 804 | 804 | // verify if we are already free to go! |
| 805 | 805 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -857,25 +857,25 @@ discard block |
||
| 857 | 857 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 858 | 858 | * @see GFCommon::format_date() for original code |
| 859 | 859 | */ |
| 860 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 860 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 861 | 861 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 862 | 862 | |
| 863 | - $format = rgar( $atts, 'format' ); |
|
| 864 | - $is_human = ! empty( $atts['human'] ); |
|
| 865 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 866 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 867 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 868 | - $include_time = ! empty( $atts['time'] ); |
|
| 863 | + $format = rgar( $atts, 'format' ); |
|
| 864 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 865 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 866 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 867 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 868 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 869 | 869 | |
| 870 | 870 | // If we're using time diff, we want to have a different default format |
| 871 | - if( empty( $format ) ) { |
|
| 871 | + if ( empty( $format ) ) { |
|
| 872 | 872 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | // If raw was specified, don't modify the stored value |
| 876 | 876 | if ( $is_raw ) { |
| 877 | 877 | $formatted_date = $date_string; |
| 878 | - } elseif( $is_timestamp ) { |
|
| 878 | + } elseif ( $is_timestamp ) { |
|
| 879 | 879 | $formatted_date = $date_local_timestamp; |
| 880 | 880 | } elseif ( $is_diff ) { |
| 881 | 881 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | $field = self::get_field( $form, $field_id ); |
| 906 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
| 906 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; |
|
| 907 | 907 | |
| 908 | 908 | } |
| 909 | 909 | |
@@ -921,7 +921,7 @@ discard block |
||
| 921 | 921 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
| 922 | 922 | */ |
| 923 | 923 | public static function get_field( $form, $field_id ) { |
| 924 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 924 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 925 | 925 | return GFFormsModel::get_field( $form, $field_id ); |
| 926 | 926 | } else { |
| 927 | 927 | return null; |
@@ -968,17 +968,17 @@ discard block |
||
| 968 | 968 | $shortcodes = array(); |
| 969 | 969 | |
| 970 | 970 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 971 | - if ( empty( $matches ) ){ |
|
| 971 | + if ( empty( $matches ) ) { |
|
| 972 | 972 | return false; |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | foreach ( $matches as $shortcode ) { |
| 976 | - if ( $tag === $shortcode[2] ) { |
|
| 976 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 977 | 977 | |
| 978 | 978 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 979 | - $shortcodes[] = $shortcode; |
|
| 979 | + $shortcodes[ ] = $shortcode; |
|
| 980 | 980 | |
| 981 | - } else if ( isset( $shortcode[5] ) && $result = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 981 | + } else if ( isset( $shortcode[ 5 ] ) && $result = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 982 | 982 | $shortcodes = $result; |
| 983 | 983 | } |
| 984 | 984 | } |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | * @return string html |
| 1130 | 1130 | */ |
| 1131 | 1131 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1132 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1132 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1133 | 1133 | |
| 1134 | 1134 | if ( empty( $formid ) ) { |
| 1135 | 1135 | return $output; |
@@ -1142,11 +1142,11 @@ discard block |
||
| 1142 | 1142 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1143 | 1143 | |
| 1144 | 1144 | foreach ( $fields as $id => $field ) { |
| 1145 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1145 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1146 | 1146 | continue; |
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1149 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1182 | 1182 | |
| 1183 | 1183 | // TODO: Convert to using array_filter |
| 1184 | - foreach( $fields as $id => $field ) { |
|
| 1184 | + foreach ( $fields as $id => $field ) { |
|
| 1185 | 1185 | |
| 1186 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1186 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1187 | 1187 | unset( $fields[ $id ] ); |
| 1188 | 1188 | } |
| 1189 | 1189 | } |
@@ -1224,14 +1224,14 @@ discard block |
||
| 1224 | 1224 | * @param int|array $field field key or field array |
| 1225 | 1225 | * @return boolean |
| 1226 | 1226 | */ |
| 1227 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1227 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1228 | 1228 | |
| 1229 | 1229 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1230 | 1230 | $form = self::get_form( $form ); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | // If entry meta, it's a string. Otherwise, numeric |
| 1234 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1234 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1235 | 1235 | $type = $field; |
| 1236 | 1236 | } else { |
| 1237 | 1237 | $type = self::get_field_type( $form, $field ); |
@@ -1245,9 +1245,9 @@ discard block |
||
| 1245 | 1245 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1246 | 1246 | |
| 1247 | 1247 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1248 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1249 | - if( true === $gv_field->is_numeric ) { |
|
| 1250 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1248 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1249 | + if ( true === $gv_field->is_numeric ) { |
|
| 1250 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1251 | 1251 | } |
| 1252 | 1252 | } |
| 1253 | 1253 | |
@@ -1397,11 +1397,11 @@ discard block |
||
| 1397 | 1397 | $final_atts = array_filter( $final_atts ); |
| 1398 | 1398 | |
| 1399 | 1399 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1400 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1401 | - $final_atts['href'] = $href; |
|
| 1400 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1401 | + $final_atts[ 'href' ] = $href; |
|
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1404 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1405 | 1405 | |
| 1406 | 1406 | // For each attribute, generate the code |
| 1407 | 1407 | $output = ''; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | - $output = '<a'. $output .'>'. $anchor_text .'</a>'; |
|
| 1412 | + $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
|
| 1413 | 1413 | |
| 1414 | 1414 | return $output; |
| 1415 | 1415 | } |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1432 | 1432 | $merged = $array1; |
| 1433 | 1433 | |
| 1434 | - foreach ( $array2 as $key => &$value ) { |
|
| 1434 | + foreach ( $array2 as $key => &$value ) { |
|
| 1435 | 1435 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1436 | 1436 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1437 | 1437 | } else { |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1467 | 1467 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1468 | 1468 | */ |
| 1469 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1469 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1470 | 1470 | |
| 1471 | 1471 | return get_users( $get_users_settings ); |
| 1472 | 1472 | } |
@@ -1481,7 +1481,7 @@ discard block |
||
| 1481 | 1481 | * @return string |
| 1482 | 1482 | */ |
| 1483 | 1483 | public static function generate_notice( $notice, $class = '' ) { |
| 1484 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1484 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | |
@@ -386,14 +386,14 @@ |
||
| 386 | 386 | $curr_start = esc_attr( rgget( 'gv_start' ) ); |
| 387 | 387 | $curr_end = esc_attr( rgget( 'gv_end' ) ); |
| 388 | 388 | |
| 389 | - /** |
|
| 390 | - * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | - * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | - * @since 1.12 |
|
| 393 | - * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | - * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | - */ |
|
| 396 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 389 | + /** |
|
| 390 | + * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | + * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | + * @since 1.12 |
|
| 393 | + * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | + * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | + */ |
|
| 396 | + $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 397 | 397 | |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'type' => 'radio', |
| 57 | 57 | 'full_width' => true, |
| 58 | 58 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 59 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 59 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 60 | 60 | 'value' => 'any', |
| 61 | 61 | 'class' => 'hide-if-js', |
| 62 | 62 | 'options' => array( |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 112 | 112 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 113 | 113 | |
| 114 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 114 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * Add admin script to the whitelist |
| 164 | 164 | */ |
| 165 | 165 | public function register_no_conflict( $required ) { |
| 166 | - $required[] = 'gravityview_searchwidget_admin'; |
|
| 166 | + $required[ ] = 'gravityview_searchwidget_admin'; |
|
| 167 | 167 | return $required; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,24 +176,24 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public static function get_searchable_fields() { |
| 178 | 178 | |
| 179 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 179 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 180 | 180 | exit( '0' ); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $form = ''; |
| 184 | 184 | |
| 185 | 185 | // Fetch the form for the current View |
| 186 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 186 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 187 | 187 | |
| 188 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 188 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 189 | 189 | |
| 190 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 190 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 191 | 191 | |
| 192 | - $form = (int) $_POST['formid']; |
|
| 192 | + $form = (int)$_POST[ 'formid' ]; |
|
| 193 | 193 | |
| 194 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 194 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 195 | 195 | |
| 196 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 196 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | ) |
| 242 | 242 | ); |
| 243 | 243 | |
| 244 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 245 | - $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'] ); |
|
| 244 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 245 | + $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' ] ); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if ( ! empty( $fields ) ) { |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | foreach ( $fields as $id => $field ) { |
| 253 | 253 | |
| 254 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 254 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 258 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 259 | 259 | |
| 260 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 260 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 280 | 280 | |
| 281 | 281 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 282 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 282 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 283 | 283 | // on/off checkbox |
| 284 | 284 | $input_type = 'boolean'; |
| 285 | 285 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
@@ -326,19 +326,19 @@ discard block |
||
| 326 | 326 | $post_id = 0; |
| 327 | 327 | |
| 328 | 328 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 329 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 330 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 329 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 330 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 331 | 331 | } |
| 332 | 332 | // We're in the WordPress Widget context, and the base View ID should be used |
| 333 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 334 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 333 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 334 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 338 | 338 | |
| 339 | 339 | // Add hidden fields to the search form |
| 340 | 340 | foreach ( $args as $key => $value ) { |
| 341 | - $search_fields[] = array( |
|
| 341 | + $search_fields[ ] = array( |
|
| 342 | 342 | 'name' => $key, |
| 343 | 343 | 'input' => 'hidden', |
| 344 | 344 | 'value' => $value, |
@@ -366,15 +366,15 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | // add free search |
| 369 | - if ( ! empty( $_GET['gv_search'] ) ) { |
|
| 369 | + if ( ! empty( $_GET[ 'gv_search' ] ) ) { |
|
| 370 | 370 | |
| 371 | 371 | // Search for a piece |
| 372 | - $words = explode( ' ', stripslashes_deep( urldecode( $_GET['gv_search'] ) ) ); |
|
| 372 | + $words = explode( ' ', stripslashes_deep( urldecode( $_GET[ 'gv_search' ] ) ) ); |
|
| 373 | 373 | |
| 374 | 374 | $words = array_filter( $words ); |
| 375 | 375 | |
| 376 | 376 | foreach ( $words as $word ) { |
| 377 | - $search_criteria['field_filters'][] = array( |
|
| 377 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 378 | 378 | 'key' => null, // The field ID to search |
| 379 | 379 | 'value' => $word, // The value to search |
| 380 | 380 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -399,16 +399,16 @@ discard block |
||
| 399 | 399 | /** |
| 400 | 400 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 401 | 401 | */ |
| 402 | - if( !empty( $curr_start ) ) { |
|
| 403 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 402 | + if ( ! empty( $curr_start ) ) { |
|
| 403 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 404 | 404 | } |
| 405 | - if( !empty( $curr_end ) ) { |
|
| 406 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 405 | + if ( ! empty( $curr_end ) ) { |
|
| 406 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | // search for a specific entry ID |
| 410 | 410 | if ( ! empty( $_GET[ 'gv_id' ] ) ) { |
| 411 | - $search_criteria['field_filters'][] = array( |
|
| 411 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 412 | 412 | 'key' => 'id', |
| 413 | 413 | 'value' => absint( $_GET[ 'gv_id' ] ), |
| 414 | 414 | 'operator' => '=', |
@@ -417,9 +417,9 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | // search for a specific Created_by ID |
| 419 | 419 | if ( ! empty( $_GET[ 'gv_by' ] ) ) { |
| 420 | - $search_criteria['field_filters'][] = array( |
|
| 420 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 421 | 421 | 'key' => 'created_by', |
| 422 | - 'value' => absint( $_GET['gv_by'] ), |
|
| 422 | + 'value' => absint( $_GET[ 'gv_by' ] ), |
|
| 423 | 423 | 'operator' => '=', |
| 424 | 424 | ); |
| 425 | 425 | } |
@@ -431,22 +431,22 @@ discard block |
||
| 431 | 431 | // get the other search filters |
| 432 | 432 | foreach ( $_GET as $key => $value ) { |
| 433 | 433 | |
| 434 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 434 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 435 | 435 | continue; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | // could return simple filter or multiple filters |
| 439 | 439 | $filter = $this->prepare_field_filter( $key, $value ); |
| 440 | 440 | |
| 441 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 442 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 441 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 442 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 443 | 443 | |
| 444 | 444 | // if date range type, set search mode to ALL |
| 445 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>', '<' ) ) ) { |
|
| 445 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>', '<' ) ) ) { |
|
| 446 | 446 | $mode = 'all'; |
| 447 | 447 | } |
| 448 | - } elseif( !empty( $filter ) ) { |
|
| 449 | - $search_criteria['field_filters'][] = $filter; |
|
| 448 | + } elseif ( ! empty( $filter ) ) { |
|
| 449 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * @since 1.5.1 |
| 456 | 456 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 457 | 457 | */ |
| 458 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 458 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 459 | 459 | |
| 460 | 460 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 461 | 461 | |
@@ -489,11 +489,11 @@ discard block |
||
| 489 | 489 | 'value' => $value, |
| 490 | 490 | ); |
| 491 | 491 | |
| 492 | - switch ( $form_field['type'] ) { |
|
| 492 | + switch ( $form_field[ 'type' ] ) { |
|
| 493 | 493 | |
| 494 | 494 | case 'select': |
| 495 | 495 | case 'radio': |
| 496 | - $filter['operator'] = 'is'; |
|
| 496 | + $filter[ 'operator' ] = 'is'; |
|
| 497 | 497 | break; |
| 498 | 498 | |
| 499 | 499 | case 'post_category': |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | foreach ( $value as $val ) { |
| 509 | 509 | $cat = get_term( $val, 'category' ); |
| 510 | - $filter[] = array( |
|
| 510 | + $filter[ ] = array( |
|
| 511 | 511 | 'key' => $field_id, |
| 512 | 512 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 513 | 513 | 'operator' => 'is', |
@@ -526,18 +526,18 @@ discard block |
||
| 526 | 526 | $filter = array(); |
| 527 | 527 | |
| 528 | 528 | foreach ( $value as $val ) { |
| 529 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 529 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | break; |
| 533 | 533 | |
| 534 | 534 | case 'checkbox': |
| 535 | 535 | // convert checkbox on/off into the correct search filter |
| 536 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 537 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 538 | - if ( $input['id'] == $field_id ) { |
|
| 539 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 540 | - $filter['operator'] = 'is'; |
|
| 536 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 537 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 538 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 539 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 540 | + $filter[ 'operator' ] = 'is'; |
|
| 541 | 541 | break; |
| 542 | 542 | } |
| 543 | 543 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $filter = array(); |
| 548 | 548 | |
| 549 | 549 | foreach ( $value as $val ) { |
| 550 | - $filter[] = array( |
|
| 550 | + $filter[ ] = array( |
|
| 551 | 551 | 'key' => $field_id, |
| 552 | 552 | 'value' => $val, |
| 553 | 553 | 'operator' => 'is', |
@@ -568,9 +568,9 @@ discard block |
||
| 568 | 568 | foreach ( $words as $word ) { |
| 569 | 569 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 570 | 570 | // Keep the same key for each filter |
| 571 | - $filter['value'] = $word; |
|
| 571 | + $filter[ 'value' ] = $word; |
|
| 572 | 572 | // Add a search for the value |
| 573 | - $filters[] = $filter; |
|
| 573 | + $filters[ ] = $filter; |
|
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
@@ -592,14 +592,14 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | $operator = 'start' === $k ? '>' : '<'; |
| 594 | 594 | |
| 595 | - $filter[] = array( |
|
| 595 | + $filter[ ] = array( |
|
| 596 | 596 | 'key' => $field_id, |
| 597 | 597 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 598 | 598 | 'operator' => $operator, |
| 599 | 599 | ); |
| 600 | 600 | } |
| 601 | 601 | } else { |
| 602 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 602 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | break; |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | 'ymd_dot' => 'Y.m.d', |
| 631 | 631 | ); |
| 632 | 632 | |
| 633 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 633 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 634 | 634 | $format = $datepicker[ $field->dateFormat ]; |
| 635 | 635 | } |
| 636 | 636 | |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | public function add_template_path( $file_paths ) { |
| 662 | 662 | |
| 663 | 663 | // Index 100 is the default GravityView template path. |
| 664 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 664 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 665 | 665 | |
| 666 | 666 | return $file_paths; |
| 667 | 667 | } |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | // get configured search fields |
| 686 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 686 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 687 | 687 | |
| 688 | 688 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 689 | 689 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -697,24 +697,24 @@ discard block |
||
| 697 | 697 | |
| 698 | 698 | $updated_field = $field; |
| 699 | 699 | |
| 700 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 700 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 701 | 701 | $has_date = true; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 705 | 705 | |
| 706 | - switch ( $field['field'] ) { |
|
| 706 | + switch ( $field[ 'field' ] ) { |
|
| 707 | 707 | |
| 708 | 708 | case 'search_all': |
| 709 | - $updated_field['key'] = 'search_all'; |
|
| 710 | - $updated_field['input'] = 'search_all'; |
|
| 711 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
| 709 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 710 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 711 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
| 712 | 712 | break; |
| 713 | 713 | |
| 714 | 714 | case 'entry_date': |
| 715 | - $updated_field['key'] = 'entry_date'; |
|
| 716 | - $updated_field['input'] = 'entry_date'; |
|
| 717 | - $updated_field['value'] = array( |
|
| 715 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 716 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 717 | + $updated_field[ 'value' ] = array( |
|
| 718 | 718 | 'start' => esc_attr( stripslashes_deep( rgget( 'gv_start' ) ) ), |
| 719 | 719 | 'end' => esc_attr( stripslashes_deep( rgget( 'gv_end' ) ) ), |
| 720 | 720 | ); |
@@ -722,16 +722,16 @@ discard block |
||
| 722 | 722 | break; |
| 723 | 723 | |
| 724 | 724 | case 'entry_id': |
| 725 | - $updated_field['key'] = 'entry_id'; |
|
| 726 | - $updated_field['input'] = 'entry_id'; |
|
| 727 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
| 725 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 726 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 727 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
| 728 | 728 | break; |
| 729 | 729 | |
| 730 | 730 | case 'created_by': |
| 731 | - $updated_field['key'] = 'created_by'; |
|
| 732 | - $updated_field['name'] = 'gv_by'; |
|
| 733 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
| 734 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 731 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 732 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 733 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
| 734 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 735 | 735 | break; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -749,16 +749,16 @@ discard block |
||
| 749 | 749 | */ |
| 750 | 750 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 751 | 751 | |
| 752 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 752 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 753 | 753 | |
| 754 | 754 | /** @since 1.14 */ |
| 755 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 755 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 756 | 756 | |
| 757 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 757 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 758 | 758 | |
| 759 | 759 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 760 | 760 | |
| 761 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 761 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 762 | 762 | |
| 763 | 763 | if ( $has_date ) { |
| 764 | 764 | // enqueue datepicker stuff only if needed! |
@@ -778,10 +778,10 @@ discard block |
||
| 778 | 778 | public static function get_search_class( $custom_class = '' ) { |
| 779 | 779 | $gravityview_view = GravityView_View::getInstance(); |
| 780 | 780 | |
| 781 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 781 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 782 | 782 | |
| 783 | - if ( ! empty( $custom_class ) ) { |
|
| 784 | - $search_class .= ' '.$custom_class; |
|
| 783 | + if ( ! empty( $custom_class ) ) { |
|
| 784 | + $search_class .= ' ' . $custom_class; |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | /** |
@@ -824,11 +824,11 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | $label = rgget( 'label', $field ); |
| 826 | 826 | |
| 827 | - if( '' === $label ) { |
|
| 827 | + if ( '' === $label ) { |
|
| 828 | 828 | |
| 829 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 829 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 830 | 830 | |
| 831 | - switch( $field['field'] ) { |
|
| 831 | + switch ( $field[ 'field' ] ) { |
|
| 832 | 832 | case 'search_all': |
| 833 | 833 | $label = __( 'Search Entries:', 'gravityview' ); |
| 834 | 834 | break; |
@@ -846,10 +846,10 @@ discard block |
||
| 846 | 846 | break; |
| 847 | 847 | default: |
| 848 | 848 | // If this is a field input, not a field |
| 849 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 849 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 850 | 850 | |
| 851 | 851 | // Get the label for the field in question, which returns an array |
| 852 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 852 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 853 | 853 | |
| 854 | 854 | // Get the item with the `label` key |
| 855 | 855 | $values = wp_list_pluck( $items, 'label' ); |
@@ -886,32 +886,32 @@ discard block |
||
| 886 | 886 | $form = $gravityview_view->getForm(); |
| 887 | 887 | |
| 888 | 888 | // for advanced field ids (eg, first name / last name ) |
| 889 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 889 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 890 | 890 | |
| 891 | 891 | // get searched value from $_GET (string or array) |
| 892 | 892 | $value = rgget( $name ); |
| 893 | 893 | |
| 894 | 894 | // get form field details |
| 895 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 895 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 896 | 896 | |
| 897 | 897 | $filter = array( |
| 898 | - 'key' => $field['field'], |
|
| 898 | + 'key' => $field[ 'field' ], |
|
| 899 | 899 | 'name' => $name, |
| 900 | 900 | 'label' => self::get_field_label( $field, $form_field ), |
| 901 | - 'input' => $field['input'], |
|
| 901 | + 'input' => $field[ 'input' ], |
|
| 902 | 902 | 'value' => $value, |
| 903 | - 'type' => $form_field['type'], |
|
| 903 | + 'type' => $form_field[ 'type' ], |
|
| 904 | 904 | ); |
| 905 | 905 | |
| 906 | 906 | // collect choices |
| 907 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 908 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 909 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 910 | - $filter['choices'] = $form_field['choices']; |
|
| 907 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 908 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 909 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 910 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 914 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 913 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 914 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | return $filter; |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | $choices = array(); |
| 937 | 937 | foreach ( $users as $user ) { |
| 938 | - $choices[] = array( |
|
| 938 | + $choices[ ] = array( |
|
| 939 | 939 | 'value' => $user->ID, |
| 940 | 940 | 'text' => $user->display_name, |
| 941 | 941 | ); |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | */ |
| 970 | 970 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 971 | 971 | |
| 972 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 972 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 973 | 973 | |
| 974 | 974 | return $js_dependencies; |
| 975 | 975 | } |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | 'isRTL' => is_rtl(), |
| 1014 | 1014 | ), $view_data ); |
| 1015 | 1015 | |
| 1016 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1016 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1017 | 1017 | |
| 1018 | 1018 | return $localizations; |
| 1019 | 1019 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1037 | 1037 | |
| 1038 | 1038 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1039 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1039 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1040 | 1040 | |
| 1041 | 1041 | /** |
| 1042 | 1042 | * @filter `gravityview_search_datepicker_class` |