Completed
Push — develop ( f84522...45f991 )
by Zack
30:47 queued 10:47
created
includes/class-common.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 		$form = false;
127 127
 
128
-		if( $entry ) {
129
-			$form = GFAPI::get_form( $entry['form_id'] );
128
+		if ( $entry ) {
129
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
130 130
 		}
131 131
 
132 132
 		return $form;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			}
203 203
 		}
204 204
 
205
-		return (bool) $has_transaction_data;
205
+		return (bool)$has_transaction_data;
206 206
 	}
207 207
 
208 208
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
242 242
 
243
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
243
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
244 244
 
245 245
 		return $result;
246 246
 	}
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
259 259
 	 */
260
-	public static function get_forms(  $active = true, $trash = false ) {
260
+	public static function get_forms( $active = true, $trash = false ) {
261 261
 		$forms = array();
262 262
 		if ( class_exists( 'GFAPI' ) ) {
263
-			if( 'any' === $active ) {
263
+			if ( 'any' === $active ) {
264 264
 				$active_forms = GFAPI::get_forms( true, $trash );
265 265
 				$inactive_forms = GFAPI::get_forms( false, $trash );
266 266
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		$has_post_fields = false;
292 292
 
293 293
 		if ( $form ) {
294
-			foreach ( $form['fields'] as $field ) {
295
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
296
-					$fields["{$field['id']}"] = array(
294
+			foreach ( $form[ 'fields' ] as $field ) {
295
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
296
+					$fields[ "{$field[ 'id' ]}" ] = array(
297 297
 						'label' => \GV\Utils::get( $field, 'label' ),
298 298
 						'parent' => null,
299 299
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
 					);
303 303
 				}
304 304
 
305
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
306
-					foreach ( $field['inputs'] as $input ) {
305
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
306
+					foreach ( $field[ 'inputs' ] as $input ) {
307 307
 
308
-						if( ! empty( $input['isHidden'] ) ) {
308
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
309 309
 							continue;
310 310
 						}
311 311
 
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
                          * @hack
314 314
                          * In case of email/email confirmation, the input for email has the same id as the parent field
315 315
                          */
316
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
316
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
317 317
                             continue;
318 318
                         }
319
-						$fields["{$input['id']}"] = array(
319
+						$fields[ "{$input[ 'id' ]}" ] = array(
320 320
 							'label' => \GV\Utils::get( $input, 'label' ),
321 321
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
322 322
 							'parent' => $field,
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 				}
329 329
 
330 330
 
331
-				if( GFCommon::is_product_field( $field['type'] ) ){
331
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
332 332
 					$has_product_fields = true;
333 333
 				}
334 334
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		 * @since 1.7
343 343
 		 */
344 344
 		if ( $has_post_fields ) {
345
-			$fields['post_id'] = array(
345
+			$fields[ 'post_id' ] = array(
346 346
 				'label' => __( 'Post ID', 'gravityview' ),
347 347
 				'type' => 'post_id',
348 348
 			);
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 			foreach ( $payment_fields as $payment_field ) {
356 356
 
357 357
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
358
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
358
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
359 359
 					continue;
360 360
 				}
361 361
 
362
-				$fields["{$payment_field->name}"] = array(
362
+				$fields[ "{$payment_field->name}" ] = array(
363 363
 					'label' => $payment_field->label,
364 364
 					'desc' => $payment_field->description,
365 365
 					'type' => $payment_field->name,
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 
392 392
 		$fields = array();
393 393
 
394
-		foreach ( $extra_fields as $key => $field ){
395
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
396
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
394
+		foreach ( $extra_fields as $key => $field ) {
395
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
396
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
397 397
 			}
398 398
 		}
399 399
 
@@ -433,33 +433,33 @@  discard block
 block discarded – undo
433 433
 			'search_criteria' => null,
434 434
 			'sorting' => null,
435 435
 			'paging' => null,
436
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
436
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
437 437
 			'context_view_id' => null,
438 438
 		);
439 439
 
440 440
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
441 441
 
442
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
443
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
442
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
443
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
444 444
 
445 445
 				if ( ! is_array( $filter ) ) {
446 446
 					continue;
447 447
 				}
448 448
 
449 449
 				// By default, we want searches to be wildcard for each field.
450
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
450
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
451 451
 
452 452
 				/**
453 453
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
454 454
 				 * @param string $operator Existing search operator
455 455
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
456 456
 				 */
457
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
457
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
458 458
 			}
459 459
 
460 460
 			// don't send just the [mode] without any field filter.
461
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
462
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
461
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
462
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
463 463
 			}
464 464
 
465 465
 		}
@@ -470,33 +470,33 @@  discard block
 block discarded – undo
470 470
 		 * Prepare date formats to be in Gravity Forms DB format;
471 471
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
472 472
 		 */
473
-		foreach ( array('start_date', 'end_date' ) as $key ) {
473
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
474 474
 
475
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
475
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
476 476
 
477 477
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
478
-				$date = date_create( $criteria['search_criteria'][ $key ] );
478
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
479 479
 
480 480
 				if ( $date ) {
481 481
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
482
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
482
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
483 483
 				} else {
484
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
484
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
485 485
 
486 486
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
487
-					unset( $criteria['search_criteria'][ $key ] );
487
+					unset( $criteria[ 'search_criteria' ][ $key ] );
488 488
 				}
489 489
 			}
490 490
 		}
491 491
 
492
-		if ( empty( $criteria['context_view_id'] ) ) {
492
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
493 493
 			// Calculate the context view id and send it to the advanced filter
494 494
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
495
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
495
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
496 496
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
497
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
497
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
498 498
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
499
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
499
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
500 500
 			}
501 501
 		}
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		 * @param array $form_ids Forms to search
507 507
 		 * @param int $view_id ID of the view being used to search
508 508
 		 */
509
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
509
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
510 510
 
511 511
 		return (array)$criteria;
512 512
 	}
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 		/** Reduce # of database calls */
542 542
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
543 543
 
544
-		if ( ! empty( $criteria['cache'] ) ) {
544
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
545 545
 
546 546
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
547 547
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 
550 550
 				// Still update the total count when using cached results
551 551
 				if ( ! is_null( $total ) ) {
552
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
552
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
553 553
 				}
554 554
 
555 555
 				$return = $entries;
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
572 572
 
573 573
 			// No entries returned from gravityview_before_get_entries
574
-			if( is_null( $entries ) ) {
574
+			if ( is_null( $entries ) ) {
575 575
 
576
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
576
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
577 577
 
578 578
 				if ( is_wp_error( $entries ) ) {
579 579
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				}
585 585
 			}
586 586
 
587
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
587
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
588 588
 
589 589
 				// Cache results
590 590
 				$Cache->set( $entries, 'entries' );
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
 		 */
694 694
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
695 695
 
696
-		if( $check_entry_display ) {
696
+		if ( $check_entry_display ) {
697 697
 			// Is the entry allowed
698 698
 			$entry = self::check_entry_display( $entry );
699 699
 		}
700 700
 
701
-		if( is_wp_error( $entry ) ) {
701
+		if ( is_wp_error( $entry ) ) {
702 702
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
703 703
 			return false;
704 704
 		}
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
 
733 733
 		$value = false;
734 734
 
735
-		if( 'context' === $val1 ) {
735
+		if ( 'context' === $val1 ) {
736 736
 
737 737
 			$matching_contexts = array( $val2 );
738 738
 
739 739
 			// We allow for non-standard contexts.
740
-			switch( $val2 ) {
740
+			switch ( $val2 ) {
741 741
 				// Check for either single or edit
742 742
 				case 'singular':
743 743
 					$matching_contexts = array( 'single', 'edit' );
@@ -780,18 +780,18 @@  discard block
 block discarded – undo
780 780
 				$json_val_1 = json_decode( $val1, true );
781 781
 				$json_val_2 = json_decode( $val2, true );
782 782
 
783
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
783
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
784 784
 
785 785
 					$json_in = false;
786
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
787
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
786
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
787
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
788 788
 
789 789
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
790 790
 					foreach ( $json_val_1 as $item_1 ) {
791 791
 						foreach ( $json_val_2 as $item_2 ) {
792 792
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
793 793
 
794
-							if( $json_in ) {
794
+							if ( $json_in ) {
795 795
 								break 2;
796 796
 							}
797 797
 						}
@@ -843,10 +843,10 @@  discard block
 block discarded – undo
843 843
 	public static function check_entry_display( $entry, $view = null ) {
844 844
 
845 845
 		if ( ! $entry || is_wp_error( $entry ) ) {
846
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
846
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
847 847
 		}
848 848
 
849
-		if ( empty( $entry['form_id'] ) ) {
849
+		if ( empty( $entry[ 'form_id' ] ) ) {
850 850
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
851 851
 		}
852 852
 
@@ -856,13 +856,13 @@  discard block
 block discarded – undo
856 856
 			 * Check whether the entry is in the entries subset by running a modified query.
857 857
 			 */
858 858
 			add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry ) {
859
-				$_tmp_query       = new \GF_Query( $view->form->ID, array(
859
+				$_tmp_query = new \GF_Query( $view->form->ID, array(
860 860
 					'field_filters' => array(
861 861
 						'mode' => 'all',
862 862
 						array(
863 863
 							'key' => 'id',
864 864
 							'operation' => 'is',
865
-							'value' => $entry['id']
865
+							'value' => $entry[ 'id' ]
866 866
 						)
867 867
 					)
868 868
 				) );
@@ -872,14 +872,14 @@  discard block
 block discarded – undo
872 872
 				/** @var \GF_Query $query */
873 873
 				$query_parts      = $query->_introspect();
874 874
 
875
-				$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
875
+				$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
876 876
 
877 877
 			}, 10, 3 );
878 878
 
879 879
 			// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
880 880
 			add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
881 881
 
882
-				$criteria['paging'] = array(
882
+				$criteria[ 'paging' ] = array(
883 883
 					'offset' => 0,
884 884
 					'page_size' => 25
885 885
 				);
@@ -898,20 +898,20 @@  discard block
 block discarded – undo
898 898
 			}
899 899
 
900 900
 			// This entry is on a View with joins
901
-			if( $entries[0]->is_multi() ) {
901
+			if ( $entries[ 0 ]->is_multi() ) {
902 902
 
903 903
 				$multi_entry_ids = array();
904 904
 
905
-				foreach ( $entries[0]->entries as $multi_entry ) {
906
-					$multi_entry_ids[] = (int) $multi_entry->ID;
905
+				foreach ( $entries[ 0 ]->entries as $multi_entry ) {
906
+					$multi_entry_ids[ ] = (int)$multi_entry->ID;
907 907
 				}
908 908
 
909
-				if( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
909
+				if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
910 910
 					remove_action( 'gravityview/view/query', $entry_subset_callback );
911 911
 					return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
912 912
 				}
913 913
 
914
-			} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
914
+			} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
915 915
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
916 916
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
917 917
 			}
@@ -924,59 +924,59 @@  discard block
 block discarded – undo
924 924
 			'context_view_id' => $view ? $view->ID : null,
925 925
 		) );
926 926
 
927
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
927
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
928 928
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No search criteria found:', array( 'data' => $criteria ) );
929 929
 			return $entry;
930 930
 		}
931 931
 
932 932
 		// Make sure the current View is connected to the same form as the Entry
933
-		if( ! empty( $criteria['context_view_id'] ) ) {
934
-			$context_view_id = intval( $criteria['context_view_id'] );
933
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
934
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
935 935
 			$context_form_id = gravityview_get_form_id( $context_view_id );
936
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
937
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
936
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
937
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
938 938
 			}
939 939
 		}
940 940
 
941
-		$search_criteria = $criteria['search_criteria'];
941
+		$search_criteria = $criteria[ 'search_criteria' ];
942 942
 
943 943
 		// check entry status
944
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
945
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
944
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
945
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
946 946
 		}
947 947
 
948 948
 		// check entry date
949 949
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
950 950
 
951 951
 		// field_filters
952
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
952
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
953 953
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No field filters criteria found:', array( 'data' => $search_criteria ) );
954 954
 			return $entry;
955 955
 		}
956 956
 
957
-		$filters = $search_criteria['field_filters'];
957
+		$filters = $search_criteria[ 'field_filters' ];
958 958
 
959
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
959
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
960 960
 
961
-		$mode = $mode ? : 'all'; // If mode is an empty string, assume it's 'all'
961
+		$mode = $mode ?: 'all'; // If mode is an empty string, assume it's 'all'
962 962
 
963 963
 		// Prevent the mode from being processed below
964
-		unset( $filters['mode'] );
964
+		unset( $filters[ 'mode' ] );
965 965
 
966
-		$form = self::get_form( $entry['form_id'] );
966
+		$form = self::get_form( $entry[ 'form_id' ] );
967 967
 
968 968
 		foreach ( $filters as $filter ) {
969
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
969
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
970 970
 
971
-			if ( ! isset( $filter['key'] ) ) {
971
+			if ( ! isset( $filter[ 'key' ] ) ) {
972 972
 				gravityview()->log->debug( '[apply_filters_to_entry] Filter key not set, any field mode', array( 'filter' => $filter ) );
973 973
 				/**
974 974
 				 * This is a cross-field search. Let's start digging'.
975 975
 				 */
976 976
 				foreach ( \GV\Utils::get( $form, 'fields', array() ) as $field ) {
977 977
 					$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
978
-					if ( $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ) ) {
979
-						if ( 'any' === $mode) {
978
+					if ( $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ) ) {
979
+						if ( 'any' === $mode ) {
980 980
 							return $entry; // All good here
981 981
 						} // mode === 'all'
982 982
 						continue 2; // Next filter
@@ -985,13 +985,13 @@  discard block
 block discarded – undo
985 985
 				}
986 986
 
987 987
 				if ( 'all' === $mode ) {
988
-					return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a subcriterium for any field in ALL mode', $filter );
988
+					return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a subcriterium for any field in ALL mode', $filter );
989 989
 				}
990 990
 
991 991
 				continue;
992 992
 			}
993 993
 
994
-			$k = $filter['key'];
994
+			$k = $filter[ 'key' ];
995 995
 
996 996
 			$field = self::get_field( $form, $k );
997 997
 
@@ -999,12 +999,12 @@  discard block
 block discarded – undo
999 999
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
1000 1000
 				$field = $k;
1001 1001
 			} else {
1002
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
1002
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
1003 1003
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
1004 1004
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? \GV\Utils::get( $field_value, $k ) : $field_value;
1005 1005
 			}
1006 1006
 
1007
-			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
1007
+			$is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
1008 1008
 
1009 1009
 			// Any match is all we need to know
1010 1010
 			if ( $is_value_match && 'any' === $mode ) {
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 
1014 1014
 			// Any failed match is a total fail
1015 1015
 			if ( ! $is_value_match && 'all' === $mode ) {
1016
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
1016
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
1017 1017
 			}
1018 1018
 		}
1019 1019
 
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 			gravityview()->log->debug( '[apply_filters_to_entry] Entry approved: all conditions were met' );
1024 1024
 			return $entry;
1025 1025
 		} else {
1026
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
1026
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
1027 1027
 		}
1028 1028
 
1029 1029
 	}
@@ -1064,18 +1064,18 @@  discard block
 block discarded – undo
1064 1064
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1065 1065
 		 * @see GFCommon::format_date() for original code
1066 1066
 		 */
1067
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1067
+		$date_gmt_time = mysql2date( 'G', $date_string );
1068 1068
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1069 1069
 
1070
-		$format  = \GV\Utils::get( $atts, 'format' );
1071
-		$is_human  = ! empty( $atts['human'] );
1072
-		$is_diff  = ! empty( $atts['diff'] );
1073
-		$is_raw = ! empty( $atts['raw'] );
1074
-		$is_timestamp = ! empty( $atts['timestamp'] );
1075
-		$include_time = ! empty( $atts['time'] );
1070
+		$format = \GV\Utils::get( $atts, 'format' );
1071
+		$is_human = ! empty( $atts[ 'human' ] );
1072
+		$is_diff = ! empty( $atts[ 'diff' ] );
1073
+		$is_raw = ! empty( $atts[ 'raw' ] );
1074
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1075
+		$include_time = ! empty( $atts[ 'time' ] );
1076 1076
 
1077 1077
 		// If we're using time diff, we want to have a different default format
1078
-		if( empty( $format ) ) {
1078
+		if ( empty( $format ) ) {
1079 1079
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1080 1080
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1081 1081
 		}
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 		// If raw was specified, don't modify the stored value
1084 1084
 		if ( $is_raw ) {
1085 1085
 			$formatted_date = $date_string;
1086
-		} elseif( $is_timestamp ) {
1086
+		} elseif ( $is_timestamp ) {
1087 1087
 			$formatted_date = $date_local_timestamp;
1088 1088
 		} elseif ( $is_diff ) {
1089 1089
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
 		$label = \GV\Utils::get( $field, 'label' );
1119 1119
 
1120
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1120
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1121 1121
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1122 1122
 		}
1123 1123
 
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 			$form = GFAPI::get_form( $form );
1146 1146
 		}
1147 1147
 
1148
-		if ( class_exists( 'GFFormsModel' ) ){
1148
+		if ( class_exists( 'GFFormsModel' ) ) {
1149 1149
 			return GFFormsModel::get_field( $form, $field_id );
1150 1150
 		} else {
1151 1151
 			return null;
@@ -1192,19 +1192,19 @@  discard block
 block discarded – undo
1192 1192
 			$shortcodes = array();
1193 1193
 
1194 1194
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1195
-			if ( empty( $matches ) ){
1195
+			if ( empty( $matches ) ) {
1196 1196
 				return false;
1197 1197
 			}
1198 1198
 
1199 1199
 			foreach ( $matches as $shortcode ) {
1200
-				if ( $tag === $shortcode[2] ) {
1200
+				if ( $tag === $shortcode[ 2 ] ) {
1201 1201
 
1202 1202
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1203
-					$shortcodes[] = $shortcode;
1203
+					$shortcodes[ ] = $shortcode;
1204 1204
 
1205
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1206
-					foreach( $results as $result ) {
1207
-						$shortcodes[] = $result;
1205
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1206
+					foreach ( $results as $result ) {
1207
+						$shortcodes[ ] = $result;
1208 1208
 					}
1209 1209
 				}
1210 1210
 			}
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 			'post_type'      => 'gravityview',
1237 1237
 			'posts_per_page' => 100,
1238 1238
 			'meta_key'       => '_gravityview_form_id',
1239
-			'meta_value'     => (int) $form_id,
1239
+			'meta_value'     => (int)$form_id,
1240 1240
 		);
1241 1241
 		$args     = wp_parse_args( $args, $defaults );
1242 1242
 		$views    = get_posts( $args );
@@ -1248,21 +1248,21 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 			$data = unserialize( $view->meta_value );
1250 1250
 
1251
-			if( ! $data || ! is_array( $data ) ) {
1251
+			if ( ! $data || ! is_array( $data ) ) {
1252 1252
 				continue;
1253 1253
 			}
1254 1254
 
1255 1255
 			foreach ( $data as $datum ) {
1256
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1257
-					$joined_forms[] = $view->post_id;
1256
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1257
+					$joined_forms[ ] = $view->post_id;
1258 1258
 				}
1259 1259
 			}
1260 1260
 		}
1261 1261
 
1262 1262
 		if ( $joined_forms ) {
1263
-			$joined_args  = array(
1263
+			$joined_args = array(
1264 1264
 				'post_type'      => 'gravityview',
1265
-				'posts_per_page' => $args['posts_per_page'],
1265
+				'posts_per_page' => $args[ 'posts_per_page' ],
1266 1266
 				'post__in'       => $joined_forms,
1267 1267
 			);
1268 1268
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 
1419 1419
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1420 1420
 
1421
-		if( $json_decode ) {
1421
+		if ( $json_decode ) {
1422 1422
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1423 1423
 		}
1424 1424
 
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 	 * @return string         html
1435 1435
 	 */
1436 1436
 	public static function get_sortable_fields( $formid, $current = '' ) {
1437
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1437
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1438 1438
 
1439 1439
 		if ( empty( $formid ) ) {
1440 1440
 			return $output;
@@ -1447,11 +1447,11 @@  discard block
 block discarded – undo
1447 1447
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1448 1448
 
1449 1449
 			foreach ( $fields as $id => $field ) {
1450
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1450
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1451 1451
 					continue;
1452 1452
 				}
1453 1453
 
1454
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1454
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1455 1455
 			}
1456 1456
 		}
1457 1457
 
@@ -1486,9 +1486,9 @@  discard block
 block discarded – undo
1486 1486
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1487 1487
 
1488 1488
 		// TODO: Convert to using array_filter
1489
-		foreach( $fields as $id => $field ) {
1489
+		foreach ( $fields as $id => $field ) {
1490 1490
 
1491
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1491
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1492 1492
 				unset( $fields[ $id ] );
1493 1493
 			}
1494 1494
 		}
@@ -1529,14 +1529,14 @@  discard block
 block discarded – undo
1529 1529
 	 * @param  int|array  $field field key or field array
1530 1530
 	 * @return boolean
1531 1531
 	 */
1532
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1532
+	public static function is_field_numeric( $form = null, $field = '' ) {
1533 1533
 
1534 1534
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1535 1535
 			$form = self::get_form( $form );
1536 1536
 		}
1537 1537
 
1538 1538
 		// If entry meta, it's a string. Otherwise, numeric
1539
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1539
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1540 1540
 			$type = $field;
1541 1541
 		} else {
1542 1542
 			$type = self::get_field_type( $form, $field );
@@ -1550,9 +1550,9 @@  discard block
 block discarded – undo
1550 1550
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1551 1551
 
1552 1552
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1553
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1554
-			if( true === $gv_field->is_numeric ) {
1555
-				$numeric_types[] = $gv_field->is_numeric;
1553
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1554
+			if ( true === $gv_field->is_numeric ) {
1555
+				$numeric_types[ ] = $gv_field->is_numeric;
1556 1556
 			}
1557 1557
 		}
1558 1558
 
@@ -1702,18 +1702,18 @@  discard block
 block discarded – undo
1702 1702
 		$final_atts = array_filter( $final_atts );
1703 1703
 
1704 1704
 		// If the href wasn't passed as an attribute, use the value passed to the function
1705
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1706
-			$final_atts['href'] = $href;
1705
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1706
+			$final_atts[ 'href' ] = $href;
1707 1707
 		}
1708 1708
 
1709
-		$final_atts['href'] = esc_url_raw( $href );
1709
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1710 1710
 
1711 1711
 		/**
1712 1712
 		 * Fix potential security issue with target=_blank
1713 1713
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1714 1714
 		 */
1715
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1716
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1715
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1716
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1717 1717
 		}
1718 1718
 
1719 1719
 		// Sort the attributes alphabetically, to help testing
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1726 1726
 		}
1727 1727
 
1728
-		if( '' !== $output ) {
1728
+		if ( '' !== $output ) {
1729 1729
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1730 1730
 		}
1731 1731
 
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1753 1753
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1754 1754
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1755
-				$merged[] = $value;
1755
+				$merged[ ] = $value;
1756 1756
 			} else {
1757 1757
 				$merged[ $key ] = $value;
1758 1758
 			}
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1786 1786
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1787 1787
 		 */
1788
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1788
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1789 1789
 
1790 1790
 		return get_users( $get_users_settings );
1791 1791
 	}
@@ -1805,11 +1805,11 @@  discard block
 block discarded – undo
1805 1805
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1806 1806
 
1807 1807
     	// If $cap is defined, only show notice if user has capability
1808
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1808
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1809 1809
     		return '';
1810 1810
 	    }
1811 1811
 
1812
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1812
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1813 1813
     }
1814 1814
 
1815 1815
 	/**
Please login to merge, or discard this patch.
includes/widgets/poll/class-gravityview-widget-poll.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	function __construct() {
23 23
 
24 24
 		$this->widget_id = 'poll';
25
-		$this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview' );
26
-		$this->widget_subtitle = sprintf( _x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' );
25
+		$this->widget_description = __( 'Displays the results of Poll Fields that exist in the form.', 'gravityview' );
26
+		$this->widget_subtitle = sprintf( _x( 'Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' );
27 27
 
28 28
 		$default_values = array(
29 29
 			'header' => 1,
@@ -32,27 +32,27 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$settings = array(
34 34
 			'percentages' => array(
35
-				'label' => __('Display Percentages', 'gravityview'),
35
+				'label' => __( 'Display Percentages', 'gravityview' ),
36 36
 				'type' => 'checkbox',
37 37
 				'value' => true,
38 38
 				'tooltip' => __( 'Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
39 39
 			),
40 40
 			'counts' => array(
41
-				'label' => __('Display Counts', 'gravityview'),
41
+				'label' => __( 'Display Counts', 'gravityview' ),
42 42
 				'type' => 'checkbox',
43 43
 				'value' => true,
44 44
 				'tooltip' => __( 'Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
45 45
 			),
46 46
 			'style' => array(
47 47
 				'type' => 'select',
48
-				'label' => __('Style', 'gravityview'),
48
+				'label' => __( 'Style', 'gravityview' ),
49 49
 				'tooltip' => __( 'The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview' ),
50 50
 				'value' => 'green',
51 51
 				'choices' => array(
52
-					'green' => __('Green', 'gravityview'),
53
-					'blue' => __('Blue', 'gravityview'),
54
-					'red' => __('Red', 'gravityview'),
55
-					'orange' => __('Orange', 'gravityview'),
52
+					'green' => __( 'Green', 'gravityview' ),
53
+					'blue' => __( 'Blue', 'gravityview' ),
54
+					'red' => __( 'Red', 'gravityview' ),
55
+					'orange' => __( 'Orange', 'gravityview' ),
56 56
 				),
57 57
 			),
58 58
 		);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
63 63
 		}
64 64
 
65
-		parent::__construct( __( 'Poll Results', 'gravityview' ) , null, $default_values, $settings );
65
+		parent::__construct( __( 'Poll Results', 'gravityview' ), null, $default_values, $settings );
66 66
 	}
67 67
 
68 68
 	/**
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$GFPolls = GFPolls::get_instance();
91 91
 
92
-		wp_enqueue_script('gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array('jquery'), $GFPolls->_version);
92
+		wp_enqueue_script( 'gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array( 'jquery' ), $GFPolls->_version );
93 93
 
94 94
 		$GFPolls->localize_scripts();
95 95
 
96
-		wp_enqueue_style('gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version);
96
+		wp_enqueue_style( 'gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version );
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function pre_render_frontend() {
105 105
 
106
-		if( ! class_exists('GFPolls') ) {
106
+		if ( ! class_exists( 'GFPolls' ) ) {
107 107
 
108 108
 			gravityview()->log->error( 'Poll Widget not displayed; the Poll Addon is not loaded' );
109 109
 
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 
113 113
 		$view = gravityview()->views->get();
114 114
 
115
-		$poll_fields = array( $view->form->form['id'] => GFCommon::get_fields_by_type( $view->form, array( 'poll' ) ) );
115
+		$poll_fields = array( $view->form->form[ 'id' ] => GFCommon::get_fields_by_type( $view->form, array( 'poll' ) ) );
116 116
 
117 117
 		foreach ( $view->joins as $join ) {
118
-			$poll_fields[ $join->join_on->form['id'] ] = GFCommon::get_fields_by_type( $join->join_on->form, array( 'poll' ) );
118
+			$poll_fields[ $join->join_on->form[ 'id' ] ] = GFCommon::get_fields_by_type( $join->join_on->form, array( 'poll' ) );
119 119
 		}
120 120
 
121 121
 		$poll_fields = array_filter( $poll_fields );
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function render_frontend( $widget_args, $content = '', $context = '' ) {
169 169
 
170
-		if( ! $this->pre_render_frontend() ) {
170
+		if ( ! $this->pre_render_frontend() ) {
171 171
 			return;
172 172
 		}
173 173
 
174 174
 		// Make sure the class is loaded in DataTables
175
-		if( !class_exists( 'GFFormDisplay' ) ) {
175
+		if ( ! class_exists( 'GFFormDisplay' ) ) {
176 176
 			include_once( GFCommon::get_base_path() . '/form_display.php' );
177 177
 		}
178 178
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$settings = $this->get_frontend_settings( $widget_args );
182 182
 
183
-		$percentages = empty( $settings['percentages'] ) ? 'false' : 'true';
183
+		$percentages = empty( $settings[ 'percentages' ] ) ? 'false' : 'true';
184 184
 
185
-		$counts = empty( $settings['counts'] ) ? 'false' : 'true';
185
+		$counts = empty( $settings[ 'counts' ] ) ? 'false' : 'true';
186 186
 
187
-		if( !empty( $settings['field'] ) ) {
188
-			$merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts );
187
+		if ( ! empty( $settings[ 'field' ] ) ) {
188
+			$merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings[ 'field' ], $settings[ 'style' ], $percentages, $counts );
189 189
 		} else {
190
-			$merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts );
190
+			$merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings[ 'style' ], $percentages, $counts );
191 191
 		}
192 192
 
193 193
 		$gravityview_view = GravityView_View::getInstance();
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$gravityview_view->poll_settings = $settings;
198 198
 		$gravityview_view->poll_fields = $this->poll_fields;
199 199
 
200
-		$gravityview_view->render('widget', 'poll', false );
200
+		$gravityview_view->render( 'widget', 'poll', false );
201 201
 
202 202
 		unset( $gravityview_view->poll_merge_tag, $gravityview_view->poll_settings, $gravityview_view->poll_form, $gravityview_view->poll_fields );
203 203
 	}
Please login to merge, or discard this patch.
future/_mocks.php 1 patch
Spacing   +44 added lines, -47 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
 			$entries = $view->get_entries( gravityview()->request );
103 103
 		}
104 104
 
105
-		$page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ?
106
-			: ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
105
+		$page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
107 106
 
108 107
 		/** Set paging, count and unwrap the entries. */
109 108
 		$paging = array(
@@ -142,17 +141,17 @@  discard block
 block discarded – undo
142 141
  * @return null|string The value of a field in an entry.
143 142
  */
144 143
 function GravityView_API_field_value( $entry, $field_settings, $format ) {
145
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
144
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
146 145
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
147 146
 		return null;
148 147
 	}
149 148
 
150
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
151
-		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry['_multi'] ) );
152
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
149
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
150
+		$multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry[ '_multi' ] ) );
151
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
153 152
 	}
154 153
 
155
-	if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
154
+	if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
156 155
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
157 156
 		return null;
158 157
 	}
@@ -162,18 +161,18 @@  discard block
 block discarded – undo
162 161
 	 *
163 162
 	 * Fields with a numeric ID are Gravity Forms ones.
164 163
 	 */
165
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;;
164
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ;
166 165
 
167 166
 	/** Initialize the future field. */
168 167
 	switch ( $source ):
169 168
 		/** The Gravity Forms backend. */
170 169
 		case \GV\Source::BACKEND_GRAVITYFORMS:
171
-			if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
170
+			if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
172 171
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
173 172
 				return null;
174 173
 			}
175 174
 
176
-			if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) {
175
+			if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) {
177 176
 				return null;
178 177
 			}
179 178
 
@@ -181,7 +180,7 @@  discard block
 block discarded – undo
181 180
 
182 181
 		/** Our internal backend. */
183 182
 		case \GV\Source::BACKEND_INTERNAL:
184
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
183
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
185 184
 				return null;
186 185
 			}
187 186
 
@@ -215,13 +214,13 @@  discard block
 block discarded – undo
215 214
 
216 215
 	/** A bail condition. */
217 216
 	$bail = function( $label, $field_settings, $entry, $force_show_label, $form ) {
218
-		if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) {
217
+		if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) {
219 218
 
220
-			$label = isset( $field_settings['label'] ) ? $field_settings['label'] : '';
219
+			$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
221 220
 
222 221
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
223
-			if ( ! empty( $field_settings['custom_label'] ) ) {
224
-				$label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry );
222
+			if ( ! empty( $field_settings[ 'custom_label' ] ) ) {
223
+				$label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry );
225 224
 			}
226 225
 
227 226
 			/**
@@ -247,19 +246,19 @@  discard block
 block discarded – undo
247 246
 
248 247
 	$label = '';
249 248
 
250
-	if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) {
251
-		$entry = $entry['_multi'][ $field_settings['form_id'] ];
252
-		if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) {
249
+	if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) {
250
+		$entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ];
251
+		if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) {
253 252
 			$form = $_form->form;
254 253
 		}
255 254
 	}
256 255
 
257
-	if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
256
+	if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
258 257
 		gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
259 258
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
260 259
 	}
261 260
 
262
-	if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) {
261
+	if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) {
263 262
 		gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) );
264 263
 		return $bail( $label, $field_settings, $entry, $force_show_label, $form );
265 264
 	}
@@ -271,31 +270,31 @@  discard block
 block discarded – undo
271 270
 	 *
272 271
 	 * Fields with a numeric ID are Gravity Forms ones.
273 272
 	 */
274
-	$source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
273
+	$source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;
275 274
 
276 275
 	/** Initialize the future field. */
277 276
 	switch ( $source ):
278 277
 		/** The Gravity Forms backend. */
279 278
 		case \GV\Source::BACKEND_GRAVITYFORMS:
280
-			if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) {
279
+			if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) {
281 280
 				gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) );
282 281
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
283 282
 			}
284 283
 
285
-			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) {
286
-				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) );
284
+			if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) {
285
+				gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) );
287 286
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form );
288 287
 			}
289
-			if ( empty( $field_settings['show_label'] ) ) {
288
+			if ( empty( $field_settings[ 'show_label' ] ) ) {
290 289
 				/** The label never wins... */
291
-				$field_settings['label'] = '';
290
+				$field_settings[ 'label' ] = '';
292 291
 			}
293 292
 
294 293
 			break;
295 294
 
296 295
 		/** Our internal backend. */
297 296
 		case \GV\Source::BACKEND_INTERNAL:
298
-			if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) {
297
+			if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) {
299 298
 				return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form );
300 299
 			}
301 300
 			break;
@@ -307,8 +306,8 @@  discard block
 block discarded – undo
307 306
 			break;
308 307
 	endswitch;
309 308
 
310
-	if( $force_show_label ) {
311
-		$field_settings['show_label'] = '1';
309
+	if ( $force_show_label ) {
310
+		$field_settings[ 'show_label' ] = '1';
312 311
 	}
313 312
 
314 313
 	/** Add the field settings. */
@@ -443,7 +442,7 @@  discard block
 block discarded – undo
443 442
 			'\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(),
444 443
 			'\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(),
445 444
 			'\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(),
446
-			'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'],
445
+			'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ],
447 446
 			'wp_query::in_the_loop' => $wp_query->in_the_loop,
448 447
 		);
449 448
 	}
@@ -531,7 +530,7 @@  discard block
 block discarded – undo
531 530
 					break;
532 531
 				case 'wp_actions[loop_start]':
533 532
 					global $wp_actions;
534
-					$wp_actions['loop_start'] = $value;
533
+					$wp_actions[ 'loop_start' ] = $value;
535 534
 					break;
536 535
 				case 'wp_query::in_the_loop':
537 536
 					global $wp_query;
@@ -627,9 +626,7 @@  discard block
 block discarded – undo
627 626
 				case 'request':
628 627
 					self::thaw( array(
629 628
 						'\GravityView_View::context' => (
630
-							$value->is_entry() ? 'single' :
631
-							( $value->is_edit_entry() ? 'edit' :
632
-									( $value->is_view() ? 'directory': null )
629
+							$value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null )
633 630
 								)
634 631
 						),
635 632
 						'\GravityView_frontend::is_search' => $value->is_search(),
@@ -683,14 +680,14 @@  discard block
 block discarded – undo
683 680
 		global $wp_query, $wp_actions;
684 681
 
685 682
 		$wp_query->in_the_loop = false;
686
-		$wp_actions['loop_start'] = 0;
683
+		$wp_actions[ 'loop_start' ] = 0;
687 684
 	}
688 685
 }
689 686
 
690 687
 
691 688
 /** Add some global fix for field capability discrepancies. */
692 689
 add_filter( 'gravityview/configuration/fields', function( $fields ) {
693
-	if ( empty( $fields  ) ) {
690
+	if ( empty( $fields ) ) {
694 691
 		return $fields;
695 692
 	}
696 693
 
@@ -717,11 +714,11 @@  discard block
 block discarded – undo
717 714
 		}
718 715
 
719 716
 		foreach ( $_fields as $uid => &$_field ) {
720
-			if ( ! isset( $_field['only_loggedin'] ) ) {
717
+			if ( ! isset( $_field[ 'only_loggedin' ] ) ) {
721 718
 				continue;
722 719
 			}
723 720
 			/** If we do not require login, we don't require a cap. */
724
-			$_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' );
721
+			$_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' );
725 722
 		}
726 723
 	}
727 724
 	return $fields;
@@ -752,8 +749,8 @@  discard block
 block discarded – undo
752 749
 		}
753 750
 
754 751
 		foreach ( $_fields as $uid => &$_field ) {
755
-			if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) {
756
-				$_field['form_id'] = $view->form->ID;
752
+			if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) {
753
+				$_field[ 'form_id' ] = $view->form->ID;
757 754
 			}
758 755
 		}
759 756
 	}
@@ -767,25 +764,25 @@  discard block
 block discarded – undo
767 764
 	if ( class_exists( '\GravityView_frontend' ) ) {
768 765
 		global $wp_filter;
769 766
 
770
-		if ( empty( $wp_filter['gravityview_after'] ) ) {
767
+		if ( empty( $wp_filter[ 'gravityview_after' ] ) ) {
771 768
 			return;
772 769
 		}
773 770
 
774 771
 		/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
775
-		if ( is_array( $wp_filter['gravityview_after'] ) ) {
776
-			if ( ! empty( $wp_filter['gravityview_after'][10] ) ) {
777
-				foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) {
772
+		if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) {
773
+			if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) {
774
+				foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) {
778 775
 					if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
779
-						unset( $wp_filter['gravityview_after'][10][ $function_key ] );
776
+						unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] );
780 777
 					}
781 778
 				}
782 779
 			}
783 780
 			return;
784 781
 		}
785 782
 
786
-		foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
783
+		foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) {
787 784
 			if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
788
-				unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
785
+				unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] );
789 786
 			}
790 787
 		}
791 788
 	}
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
230 230
 		$script_source = empty( $script_min ) ? '/source' : '';
231 231
 
232
-		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 );
232
+		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 );
233 233
 
234 234
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
235 235
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
252 252
 	 */
253 253
 	public function register_no_conflict( $allowed ) {
254
-		$allowed[] = 'gravityview_searchwidget_admin';
254
+		$allowed[ ] = 'gravityview_searchwidget_admin';
255 255
 		return $allowed;
256 256
 	}
257 257
 
@@ -264,24 +264,24 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public static function get_searchable_fields() {
266 266
 
267
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
267
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
268 268
 			exit( '0' );
269 269
 		}
270 270
 
271 271
 		$form = '';
272 272
 
273 273
 		// Fetch the form for the current View
274
-		if ( ! empty( $_POST['view_id'] ) ) {
274
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
275 275
 
276
-			$form = gravityview_get_form_id( $_POST['view_id'] );
276
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
277 277
 
278
-		} elseif ( ! empty( $_POST['formid'] ) ) {
278
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
279 279
 
280
-			$form = (int) $_POST['formid'];
280
+			$form = (int)$_POST[ 'formid' ];
281 281
 
282
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
282
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
283 283
 
284
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
284
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
285 285
 
286 286
 		}
287 287
 
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		);
332 332
 
333 333
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
334
-			$custom_fields['is_approved'] = array(
334
+			$custom_fields[ 'is_approved' ] = array(
335 335
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
336 336
 				'type' => 'multi',
337 337
 			);
338 338
 		}
339 339
 
340
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
341
-			$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'] );
340
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
341
+			$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' ] );
342 342
 		}
343 343
 
344 344
 		// Get fields with sub-inputs and no parent
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 
361 361
 			foreach ( $fields as $id => $field ) {
362 362
 
363
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
363
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
364 364
 					continue;
365 365
 				}
366 366
 
367
-				$types = self::get_search_input_types( $id, $field['type'] );
367
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
368 368
 
369
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
369
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
370 370
 			}
371 371
 		}
372 372
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
390 390
 
391 391
 		// @todo - This needs to be improved - many fields have . including products and addresses
392
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
392
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
393 393
 			$input_type = 'boolean'; // on/off checkbox
394 394
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
395 395
 			$input_type = 'multi'; //multiselect
@@ -433,19 +433,19 @@  discard block
 block discarded – undo
433 433
 			$post_id = 0;
434 434
 
435 435
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
436
-			if ( ! empty( $widget_args['post_id'] ) ) {
437
-				$post_id = absint( $widget_args['post_id'] );
436
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
437
+				$post_id = absint( $widget_args[ 'post_id' ] );
438 438
 			}
439 439
 			// We're in the WordPress Widget context, and the base View ID should be used
440
-			else if ( ! empty( $widget_args['view_id'] ) ) {
441
-				$post_id = absint( $widget_args['view_id'] );
440
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
441
+				$post_id = absint( $widget_args[ 'view_id' ] );
442 442
 			}
443 443
 
444 444
 			$args = gravityview_get_permalink_query_args( $post_id );
445 445
 
446 446
 			// Add hidden fields to the search form
447 447
 			foreach ( $args as $key => $value ) {
448
-				$search_fields[] = array(
448
+				$search_fields[ ] = array(
449 449
 					'name'  => $key,
450 450
 					'input' => 'hidden',
451 451
 					'value' => $value,
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
 		/**
485 485
 		 * Include the sidebar Widgets.
486 486
 		 */
487
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
487
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
488 488
 
489 489
 		foreach ( $widgets as $widget ) {
490
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
491
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
490
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
491
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
492 492
 					foreach ( $_fields as $field ) {
493
-						if ( empty( $field['form_id'] ) ) {
494
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
493
+						if ( empty( $field[ 'form_id' ] ) ) {
494
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
495 495
 						}
496
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
496
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
497 497
 					}
498 498
 				}
499 499
 			}
500 500
 		}
501 501
 
502 502
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
503
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
503
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
504 504
 				foreach ( $_fields as $field ) {
505
-					if ( empty( $field['form_id'] ) ) {
506
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
505
+					if ( empty( $field[ 'form_id' ] ) ) {
506
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
507 507
 					}
508
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
508
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
509 509
 				}
510 510
 			}
511 511
 		}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
536 536
 		}
537 537
 
538
-		if( 'post' === $this->search_method ) {
538
+		if ( 'post' === $this->search_method ) {
539 539
 			$get = $_POST;
540 540
 		} else {
541 541
 			$get = $_GET;
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
 		$get = gv_map_deep( $get, 'rawurldecode' );
555 555
 
556 556
 		// Make sure array key is set up
557
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
557
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
558 558
 
559 559
 		$searchable_fields = $this->get_view_searchable_fields( $view );
560 560
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
561 561
 
562 562
 		// add free search
563
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
563
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
564 564
 
565
-			$search_all_value = trim( $get['gv_search'] );
565
+			$search_all_value = trim( $get[ 'gv_search' ] );
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			}
588 588
 
589 589
 			foreach ( $words as $word ) {
590
-				$search_criteria['field_filters'][] = array(
590
+				$search_criteria[ 'field_filters' ][ ] = array(
591 591
 					'key' => null, // The field ID to search
592 592
 					'value' => $word, // The value to search
593 593
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -600,14 +600,14 @@  discard block
 block discarded – undo
600 600
 			/**
601 601
 			 * Get and normalize the dates according to the input format.
602 602
 			 */
603
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
604
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
603
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
604
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
605 605
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
606 606
 				}
607 607
 			}
608 608
 
609
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
610
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
609
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
610
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
611 611
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
612 612
 				}
613 613
 			}
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
 			 */
643 643
 			if ( ! empty( $curr_start ) ) {
644 644
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
645
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
645
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
646 646
 			}
647 647
 
648 648
 			if ( ! empty( $curr_end ) ) {
649 649
 				// Fast-forward 24 hour on the end time
650 650
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
651
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
651
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
654 654
 				}
655 655
 			}
656 656
 		}
657 657
 
658 658
 		// search for a specific entry ID
659 659
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
660
-			$search_criteria['field_filters'][] = array(
660
+			$search_criteria[ 'field_filters' ][ ] = array(
661 661
 				'key' => 'id',
662 662
 				'value' => absint( $get[ 'gv_id' ] ),
663 663
 				'operator' => '=',
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
 
667 667
 		// search for a specific Created_by ID
668 668
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
669
-			$search_criteria['field_filters'][] = array(
669
+			$search_criteria[ 'field_filters' ][ ] = array(
670 670
 				'key' => 'created_by',
671
-				'value' => $get['gv_by'],
671
+				'value' => $get[ 'gv_by' ],
672 672
 				'operator' => '=',
673 673
 			);
674 674
 		}
675 675
 
676 676
 		// Get search mode passed in URL
677
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
677
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
678 678
 
679 679
 		// get the other search filters
680 680
 		foreach ( $get as $key => $value ) {
681 681
 
682
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
682
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
683 683
 				continue;
684 684
 			}
685 685
 
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
 				continue;
690 690
 			}
691 691
 
692
-			if ( isset( $filter[0]['value'] ) ) {
693
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
692
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
693
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
694 694
 
695 695
 				// if date range type, set search mode to ALL
696
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
696
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
697 697
 					$mode = 'all';
698 698
 				}
699
-			} elseif( !empty( $filter ) ) {
700
-				$search_criteria['field_filters'][] = $filter;
699
+			} elseif ( ! empty( $filter ) ) {
700
+				$search_criteria[ 'field_filters' ][ ] = $filter;
701 701
 			}
702 702
 		}
703 703
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		 * @since 1.5.1
707 707
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
708 708
 		 */
709
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
709
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
710 710
 
711 711
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
712 712
 
@@ -733,19 +733,19 @@  discard block
 block discarded – undo
733 733
 
734 734
 		$query_class = $view->get_query_class();
735 735
 
736
-		if ( empty( $search_criteria['field_filters'] ) ) {
736
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
737 737
 			return;
738 738
 		}
739 739
 
740 740
 		$widgets = $view->widgets->by_id( $this->widget_id );
741 741
 		if ( $widgets->count() ) {
742 742
 			$widgets = $widgets->all();
743
-			$widget  = $widgets[0];
743
+			$widget  = $widgets[ 0 ];
744 744
 
745 745
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
746 746
 
747
-			foreach ( (array) $search_fields as $search_field ) {
748
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
747
+			foreach ( (array)$search_fields as $search_field ) {
748
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
749 749
 					$created_by_text_mode = true;
750 750
 				}
751 751
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		$extra_conditions = array();
755 755
 		$mode = 'any';
756 756
 
757
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
757
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
758 758
 			if ( ! is_array( $filter ) ) {
759 759
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
760 760
 					$mode = $filter;
@@ -763,13 +763,13 @@  discard block
 block discarded – undo
763 763
 			}
764 764
 
765 765
 			// Construct a manual query for unapproved statuses
766
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
767
-				$_tmp_query       = new $query_class( $view->form->ID, array(
766
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
767
+				$_tmp_query = new $query_class( $view->form->ID, array(
768 768
 					'field_filters' => array(
769 769
 						array(
770 770
 							'operator' => 'in',
771 771
 							'key'      => 'is_approved',
772
-							'value'    => (array) $filter['value'],
772
+							'value'    => (array)$filter[ 'value' ],
773 773
 						),
774 774
 						array(
775 775
 							'operator' => 'is',
@@ -781,30 +781,30 @@  discard block
 block discarded – undo
781 781
 				) );
782 782
 				$_tmp_query_parts = $_tmp_query->_introspect();
783 783
 
784
-				$extra_conditions[] = $_tmp_query_parts['where'];
784
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
785 785
 
786 786
 				$filter = false;
787 787
 				continue;
788 788
 			}
789 789
 
790 790
 			// Construct manual query for text mode creator search
791
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
792
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
791
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
792
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
793 793
 				$filter = false;
794 794
 				continue;
795 795
 			}
796 796
 
797 797
 			// By default, we want searches to be wildcard for each field.
798
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
798
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
799 799
 
800 800
 			// For multichoice, let's have an in (OR) search.
801
-			if ( is_array( $filter['value'] ) ) {
802
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
801
+			if ( is_array( $filter[ 'value' ] ) ) {
802
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
803 803
 			}
804 804
 
805 805
 			// Default form with joins functionality
806
-			if ( empty( $filter['form_id'] ) ) {
807
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
806
+			if ( empty( $filter[ 'form_id' ] ) ) {
807
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
808 808
 			}
809 809
 
810 810
 			/**
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
 			 * @param string $operator Existing search operator
813 813
 			 * @param array $filter array with `key`, `value`, `operator`, `type` keys
814 814
 			 */
815
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
815
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
816 816
 		}
817 817
 
818 818
 		$search_conditions = array();
819 819
 
820
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
820
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
821 821
 
822 822
 			foreach ( $filters as $filter ) {
823 823
 				if ( ! is_array( $filter ) ) {
@@ -830,22 +830,22 @@  discard block
 block discarded – undo
830 830
 				 * code by reusing what's inside GF_Query already as they
831 831
 				 * take care of many small things like forcing numeric, etc.
832 832
 				 */
833
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
833
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
834 834
 				$_tmp_query_parts = $_tmp_query->_introspect();
835
-				$search_condition = $_tmp_query_parts['where'];
835
+				$search_condition = $_tmp_query_parts[ 'where' ];
836 836
 
837
-				if ( empty( $filter['key'] ) &&  $search_condition->expressions ) {
837
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
838 838
 					 foreach ( $search_condition->expressions as $condition ) {
839
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
839
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
840 840
 					 }
841 841
 				} else {
842 842
 					$left = $search_condition->left;
843 843
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
844 844
 
845 845
 					if ( $view->joins && $left->field_id == GF_Query_Column::META ) {
846
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
846
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
847 847
 					} else {
848
-						$search_conditions[] = new GF_Query_Condition(
848
+						$search_conditions[ ] = new GF_Query_Condition(
849 849
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
850 850
 							$search_condition->operator,
851 851
 							$search_condition->right
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 		/**
868 868
 		 * Combine the parts as a new WHERE clause.
869 869
 		 */
870
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
870
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
871 871
 		$query->where( $where );
872 872
 	}
873 873
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 		$field_id = str_replace( 'filter_', '', $key );
891 891
 
892 892
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
893
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
893
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
894 894
 			$field_id = str_replace( '_', '.', $field_id );
895 895
 		}
896 896
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 			// form is in searchable fields
943 943
 			$found = false;
944 944
 			foreach ( $searchable_fields as $field ) {
945
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
945
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
946 946
 					$found = true;
947 947
 					break;
948 948
 				}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 
979 979
 			case 'select':
980 980
 			case 'radio':
981
-				$filter['operator'] = 'is';
981
+				$filter[ 'operator' ] = 'is';
982 982
 				break;
983 983
 
984 984
 			case 'post_category':
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 				foreach ( $value as $val ) {
994 994
 					$cat = get_term( $val, 'category' );
995
-					$filter[] = array(
995
+					$filter[ ] = array(
996 996
 						'key'      => $field_id,
997 997
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
998 998
 						'operator' => 'is',
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 				$filter = array();
1012 1012
 
1013 1013
 				foreach ( $value as $val ) {
1014
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1014
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1015 1015
 				}
1016 1016
 
1017 1017
 				break;
@@ -1020,9 +1020,9 @@  discard block
 block discarded – undo
1020 1020
 				// convert checkbox on/off into the correct search filter
1021 1021
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1022 1022
 					foreach ( $form_field->inputs as $k => $input ) {
1023
-						if ( $input['id'] == $field_id ) {
1024
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1025
-							$filter['operator'] = 'is';
1023
+						if ( $input[ 'id' ] == $field_id ) {
1024
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1025
+							$filter[ 'operator' ] = 'is';
1026 1026
 							break;
1027 1027
 						}
1028 1028
 					}
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 					$filter = array();
1033 1033
 
1034 1034
 					foreach ( $value as $val ) {
1035
-						$filter[] = array(
1035
+						$filter[ ] = array(
1036 1036
 							'key'      => $field_id,
1037 1037
 							'value'    => $val,
1038 1038
 							'operator' => 'is',
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
 					foreach ( $words as $word ) {
1054 1054
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1055 1055
 							// Keep the same key for each filter
1056
-							$filter['value'] = $word;
1056
+							$filter[ 'value' ] = $word;
1057 1057
 							// Add a search for the value
1058
-							$filters[] = $filter;
1058
+							$filters[ ] = $filter;
1059 1059
 						}
1060 1060
 					}
1061 1061
 
@@ -1069,19 +1069,19 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 					foreach ( $searchable_fields as $searchable_field ) {
1071 1071
 
1072
-						if( $form_field->ID !== $searchable_field['field'] ) {
1072
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1073 1073
 							continue;
1074 1074
 						}
1075 1075
 
1076 1076
 						// Only exact-match dropdowns, not text search
1077
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1077
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1078 1078
 							continue;
1079 1079
 						}
1080 1080
 
1081 1081
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1082 1082
 
1083 1083
 						if ( 4 === $input_id ) {
1084
-							$filter['operator'] = 'is';
1084
+							$filter[ 'operator' ] = 'is';
1085 1085
 						};
1086 1086
 					}
1087 1087
 				}
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 						 * @since 1.16.3
1109 1109
 						 * Safeguard until GF implements '<=' operator
1110 1110
 						 */
1111
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1111
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1112 1112
 							$operator = '<';
1113 1113
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1114 1114
 						}
1115 1115
 
1116
-						$filter[] = array(
1116
+						$filter[ ] = array(
1117 1117
 							'key'      => $field_id,
1118 1118
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1119 1119
 							'operator' => $operator,
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 					}
1122 1122
 				} else {
1123 1123
 					$date = $value;
1124
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1124
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1125 1125
 				}
1126 1126
 
1127 1127
 				break;
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 			'ymd_dot' => 'Y.m.d',
1153 1153
 		);
1154 1154
 
1155
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1155
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1156 1156
 			$format = $datepicker[ $field->dateFormat ];
1157 1157
 		}
1158 1158
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 	public function add_template_path( $file_paths ) {
1190 1190
 
1191 1191
 		// Index 100 is the default GravityView template path.
1192
-		$file_paths[102] = self::$file . 'templates/';
1192
+		$file_paths[ 102 ] = self::$file . 'templates/';
1193 1193
 
1194 1194
 		return $file_paths;
1195 1195
 	}
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		$has_date = false;
1209 1209
 
1210 1210
 		foreach ( $search_fields as $k => $field ) {
1211
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1211
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1212 1212
 				$has_date = true;
1213 1213
 				break;
1214 1214
 			}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 
1237 1237
 		// get configured search fields
1238
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1238
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1239 1239
 
1240 1240
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1241 1241
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1250,40 +1250,40 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 			$updated_field = $this->get_search_filter_details( $updated_field );
1252 1252
 
1253
-			switch ( $field['field'] ) {
1253
+			switch ( $field[ 'field' ] ) {
1254 1254
 
1255 1255
 				case 'search_all':
1256
-					$updated_field['key'] = 'search_all';
1257
-					$updated_field['input'] = 'search_all';
1258
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1256
+					$updated_field[ 'key' ] = 'search_all';
1257
+					$updated_field[ 'input' ] = 'search_all';
1258
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1259 1259
 					break;
1260 1260
 
1261 1261
 				case 'entry_date':
1262
-					$updated_field['key'] = 'entry_date';
1263
-					$updated_field['input'] = 'entry_date';
1264
-					$updated_field['value'] = array(
1262
+					$updated_field[ 'key' ] = 'entry_date';
1263
+					$updated_field[ 'input' ] = 'entry_date';
1264
+					$updated_field[ 'value' ] = array(
1265 1265
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1266 1266
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1267 1267
 					);
1268 1268
 					break;
1269 1269
 
1270 1270
 				case 'entry_id':
1271
-					$updated_field['key'] = 'entry_id';
1272
-					$updated_field['input'] = 'entry_id';
1273
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1271
+					$updated_field[ 'key' ] = 'entry_id';
1272
+					$updated_field[ 'input' ] = 'entry_id';
1273
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1274 1274
 					break;
1275 1275
 
1276 1276
 				case 'created_by':
1277
-					$updated_field['key'] = 'created_by';
1278
-					$updated_field['name'] = 'gv_by';
1279
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1280
-					$updated_field['choices'] = self::get_created_by_choices();
1277
+					$updated_field[ 'key' ] = 'created_by';
1278
+					$updated_field[ 'name' ] = 'gv_by';
1279
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1280
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
1281 1281
 					break;
1282 1282
 				
1283 1283
 				case 'is_approved':
1284
-					$updated_field['key'] = 'is_approved';
1285
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1286
-					$updated_field['choices'] = self::get_is_approved_choices();
1284
+					$updated_field[ 'key' ] = 'is_approved';
1285
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1286
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1287 1287
 					break;
1288 1288
 			}
1289 1289
 
@@ -1302,16 +1302,16 @@  discard block
 block discarded – undo
1302 1302
 		 */
1303 1303
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1304 1304
 
1305
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1305
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1306 1306
 
1307 1307
 		/** @since 1.14 */
1308
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1308
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1309 1309
 
1310
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1310
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1311 1311
 
1312 1312
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1313 1313
 
1314
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1314
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1315 1315
 
1316 1316
 		if ( $this->has_date_field( $search_fields ) ) {
1317 1317
 			// enqueue datepicker stuff only if needed!
@@ -1333,10 +1333,10 @@  discard block
 block discarded – undo
1333 1333
 	public static function get_search_class( $custom_class = '' ) {
1334 1334
 		$gravityview_view = GravityView_View::getInstance();
1335 1335
 
1336
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1336
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1337 1337
 
1338
-		if ( ! empty( $custom_class )  ) {
1339
-			$search_class .= ' '.$custom_class;
1338
+		if ( ! empty( $custom_class ) ) {
1339
+			$search_class .= ' ' . $custom_class;
1340 1340
 		}
1341 1341
 
1342 1342
 		/**
@@ -1380,9 +1380,9 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 		if ( ! $label ) {
1382 1382
 
1383
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1383
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1384 1384
 
1385
-			switch( $field['field'] ) {
1385
+			switch ( $field[ 'field' ] ) {
1386 1386
 				case 'search_all':
1387 1387
 					$label = __( 'Search Entries:', 'gravityview' );
1388 1388
 					break;
@@ -1394,10 +1394,10 @@  discard block
 block discarded – undo
1394 1394
 					break;
1395 1395
 				default:
1396 1396
 					// If this is a field input, not a field
1397
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1397
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1398 1398
 
1399 1399
 						// Get the label for the field in question, which returns an array
1400
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1400
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1401 1401
 
1402 1402
 						// Get the item with the `label` key
1403 1403
 						$values = wp_list_pluck( $items, 'label' );
@@ -1436,32 +1436,32 @@  discard block
 block discarded – undo
1436 1436
 		$form = $gravityview_view->getForm();
1437 1437
 
1438 1438
 		// for advanced field ids (eg, first name / last name )
1439
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1439
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1440 1440
 
1441 1441
 		// get searched value from $_GET/$_POST (string or array)
1442 1442
 		$value = $this->rgget_or_rgpost( $name );
1443 1443
 
1444 1444
 		// get form field details
1445
-		$form_field = gravityview_get_field( $form, $field['field'] );
1445
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1446 1446
 
1447 1447
 		$filter = array(
1448
-			'key' => $field['field'],
1448
+			'key' => $field[ 'field' ],
1449 1449
 			'name' => $name,
1450 1450
 			'label' => self::get_field_label( $field, $form_field ),
1451
-			'input' => $field['input'],
1451
+			'input' => $field[ 'input' ],
1452 1452
 			'value' => $value,
1453
-			'type' => $form_field['type'],
1453
+			'type' => $form_field[ 'type' ],
1454 1454
 		);
1455 1455
 
1456 1456
 		// collect choices
1457
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1458
-			$filter['choices'] = gravityview_get_terms_choices();
1459
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1460
-			$filter['choices'] = $form_field['choices'];
1457
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1458
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1459
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1460
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1461 1461
 		}
1462 1462
 
1463
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1464
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1463
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1464
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1465 1465
 		}
1466 1466
 
1467 1467
 		return $filter;
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 		$choices = array();
1487 1487
 		foreach ( $users as $user ) {
1488
-			$choices[] = array(
1488
+			$choices[ ] = array(
1489 1489
 				'value' => $user->ID,
1490 1490
 				'text' => $user->display_name,
1491 1491
 			);
@@ -1505,9 +1505,9 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
 		$choices = array();
1507 1507
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1508
-			$choices[] = array(
1509
-				'value' => $status['value'],
1510
-				'text' => $status['label'],
1508
+			$choices[ ] = array(
1509
+				'value' => $status[ 'value' ],
1510
+				'text' => $status[ 'label' ],
1511 1511
 			);
1512 1512
 		}
1513 1513
 
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 	 */
1560 1560
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1561 1561
 
1562
-		$js_dependencies[] = 'jquery-ui-datepicker';
1562
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1563 1563
 
1564 1564
 		return $js_dependencies;
1565 1565
 	}
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 			'isRTL'             => is_rtl(),
1604 1604
 		), $view_data );
1605 1605
 
1606
-		$localizations['datepicker'] = $datepicker_settings;
1606
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1607 1607
 
1608 1608
 		return $localizations;
1609 1609
 
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 	 * @return void
1631 1631
 	 */
1632 1632
 	private function maybe_enqueue_flexibility() {
1633
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1633
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1634 1634
 			wp_enqueue_script( 'gv-flexibility' );
1635 1635
 		}
1636 1636
 	}
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1653 1653
 
1654 1654
 		$scheme = is_ssl() ? 'https://' : 'http://';
1655
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1655
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1656 1656
 
1657 1657
 		/**
1658 1658
 		 * @filter `gravityview_search_datepicker_class`
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 	public function add_preview_inputs() {
1732 1732
 		global $wp;
1733 1733
 
1734
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1734
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1735 1735
 			return;
1736 1736
 		}
1737 1737
 
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
  */
1757 1757
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1758 1758
 	public function __construct( $filter, $view ) {
1759
-		$this->value = $filter['value'];
1759
+		$this->value = $filter[ 'value' ];
1760 1760
 		$this->view = $view;
1761 1761
 	}
1762 1762
 
@@ -1788,11 +1788,11 @@  discard block
 block discarded – undo
1788 1788
 		$conditions = array();
1789 1789
 
1790 1790
 		foreach ( $user_fields as $user_field ) {
1791
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
1791
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
1792 1792
 		}
1793 1793
 
1794 1794
 		foreach ( $user_meta_fields as $meta_field ) {
1795
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
1795
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
1796 1796
 		}
1797 1797
 
1798 1798
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
@@ -1821,9 +1821,9 @@  discard block
 block discarded – undo
1821 1821
 
1822 1822
 		$conditions = array();
1823 1823
 
1824
-		foreach ( $parameters['aliases'] as $key => $alias ) {
1825
-			if ( 'm' == $alias[0] && preg_match( '#\d+_\d+#', $key ) ) {
1826
-				$conditions[] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1824
+		foreach ( $parameters[ 'aliases' ] as $key => $alias ) {
1825
+			if ( 'm' == $alias[ 0 ] && preg_match( '#\d+_\d+#', $key ) ) {
1826
+				$conditions[ ] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1827 1827
 					$this->search_condition->operator, $this->search_condition->right->sql( $query ), $alias );
1828 1828
 			}
1829 1829
 		}
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$form = $gravityview_view->getForm();
33 33
 
34
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
34
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
35 35
 			/** Allow to fall through for back compatibility testing purposes. */
36 36
 		} else {
37 37
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$label = '';
41 41
 
42
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
42
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
43 43
 
44
-			$label = $field['label'];
44
+			$label = $field[ 'label' ];
45 45
 
46 46
 			// Support Gravity Forms 1.9+
47
-			if( class_exists( 'GF_Field' ) ) {
47
+			if ( class_exists( 'GF_Field' ) ) {
48 48
 
49
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
49
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
50 50
 
51
-				if( $field_object ) {
51
+				if ( $field_object ) {
52 52
 
53
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
53
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
54 54
 
55 55
 					// This is a complex field, with labels on a per-input basis
56
-					if( $input ) {
56
+					if ( $input ) {
57 57
 
58 58
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
59
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
59
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
60 60
 
61 61
 					} else {
62 62
 
63 63
 						// This is a field with one label
64
-						$label = $field_object->get_field_label( true, $field['label'] );
64
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
65 65
 
66 66
 					}
67 67
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 
72 72
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
73
-			if ( !empty( $field['custom_label'] ) ) {
73
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
74 74
 
75
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
75
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
76 76
 
77 77
 			}
78 78
 
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$width = NULL;
136 136
 
137
-		if( !empty( $field['width'] ) ) {
138
-			$width = absint( $field['width'] );
137
+		if ( ! empty( $field[ 'width' ] ) ) {
138
+			$width = absint( $field[ 'width' ] );
139 139
 
140 140
 			// If using percentages, limit to 100%
141
-			if( '%d%%' === $format && $width > 100 ) {
141
+			if ( '%d%%' === $format && $width > 100 ) {
142 142
 				$width = 100;
143 143
 			}
144 144
 
@@ -159,42 +159,42 @@  discard block
 block discarded – undo
159 159
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
160 160
 		$classes = array();
161 161
 
162
-		if( !empty( $field['custom_class'] ) ) {
162
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
163 163
 
164
-            $custom_class = $field['custom_class'];
164
+            $custom_class = $field[ 'custom_class' ];
165 165
 
166
-            if( !empty( $entry ) ) {
166
+            if ( ! empty( $entry ) ) {
167 167
 
168 168
                 // We want the merge tag to be formatted as a class. The merge tag may be
169 169
                 // replaced by a multiple-word value that should be output as a single class.
170 170
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
171
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
172 172
 
173
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
173
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
174 174
 
175 175
                 // And then we want life to return to normal
176
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
176
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
177 177
             }
178 178
 
179 179
 			// And now we want the spaces to be handled nicely.
180
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
180
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
181 181
 
182 182
 		}
183 183
 
184
-		if(!empty($field['id'])) {
185
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
186
-				$form_id = '-'.$form['id'];
184
+		if ( ! empty( $field[ 'id' ] ) ) {
185
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
186
+				$form_id = '-' . $form[ 'id' ];
187 187
 			} else {
188 188
 				// @deprecated path. Form should always be given.
189 189
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
190 190
 				$gravityview_view = GravityView_View::getInstance();
191
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
191
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
192 192
 			}
193 193
 
194
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
194
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
195 195
 		}
196 196
 
197
-		return esc_attr(implode(' ', $classes));
197
+		return esc_attr( implode( ' ', $classes ) );
198 198
 	}
199 199
 
200 200
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @return string Sanitized unique HTML `id` attribute for the field
211 211
 	 */
212 212
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
213
-		$id = $field['id'];
213
+		$id = $field[ 'id' ];
214 214
 
215 215
 		if ( ! empty( $id ) ) {
216
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
217
-				$form_id = '-' . $form['id'];
216
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
217
+				$form_id = '-' . $form[ 'id' ];
218 218
 			} else {
219 219
 				// @deprecated path. Form should always be given.
220 220
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
223 223
 			}
224 224
 
225
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
225
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
226 226
 		}
227 227
 
228 228
 		return esc_attr( $id );
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
264 264
 
265
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
265
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
266 266
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
267 267
 			return NULL;
268 268
 		}
269 269
 
270 270
 		$href = self::entry_link( $entry, $base_id );
271 271
 
272
-		if( '' === $href ) {
272
+		if ( '' === $href ) {
273 273
 			return NULL;
274 274
 		}
275 275
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		} else {
307 307
 			$gravityview_view = GravityView_View::getInstance();
308 308
 
309
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
309
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
310 310
 				$is_search = true;
311 311
 			}
312 312
 		}
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 
404 404
 		// If we've saved the permalink in memory, use it
405 405
 		// @since 1.3
406
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
406
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
407 407
 
408
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
408
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
409 409
 			$link = home_url();
410 410
 		}
411 411
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 			// If not yet saved, cache the permalink.
416 416
 			// @since 1.3
417
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
417
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
418 418
 		}
419 419
 
420 420
 		// Deal with returning to proper pagination for embedded views
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 
423 423
 			$args = array();
424 424
 
425
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
-				$args['pagenum'] = intval( $pagenum );
425
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
+				$args[ 'pagenum' ] = intval( $pagenum );
427 427
 			}
428 428
 
429
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
-				$args['sort'] = $sort;
431
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
429
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
+				$args[ 'sort' ] = $sort;
431
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
432 432
 			}
433 433
 
434 434
 			$link = add_query_arg( $args, $link );
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
466 466
 
467 467
 		// Generate an unique hash to use as the default value
468
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
468
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
469 469
 
470 470
 		/**
471 471
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
477 477
 
478 478
 		// Make sure we have something - use the original ID as backup.
479
-		if( empty( $slug ) ) {
479
+		if ( empty( $slug ) ) {
480 480
 			$slug = $id;
481 481
 		}
482 482
 
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
          * @param boolean $custom Should we process the custom entry slug?
571 571
          */
572 572
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
573
-        if( $custom ) {
573
+        if ( $custom ) {
574 574
             // create the gravityview_unique_id and save it
575 575
 
576 576
             // Get the entry hash
577
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
577
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
578 578
 
579
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
579
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
580 580
 
581
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
581
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
582 582
 
583 583
         }
584 584
     }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 
598 598
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
599 599
 			$entry = GVCommon::get_entry( $entry );
600
-		} else if( empty( $entry ) ) {
600
+		} else if ( empty( $entry ) ) {
601 601
 			// @deprecated path
602 602
 			$entry = GravityView_frontend::getInstance()->getEntry();
603 603
 		}
@@ -617,18 +617,18 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$query_arg_name = \GV\Entry::get_endpoint_name();
619 619
 
620
-		if ( ! empty( $entry['_multi'] ) ) {
620
+		if ( ! empty( $entry[ '_multi' ] ) ) {
621 621
 			$entry_slugs = array();
622
-			foreach ( $entry['_multi'] as $_multi ) {
623
-				$entry_slugs[] = self::get_entry_slug( $_multi['id'], $_multi );
624
-				$forms[] = $_multi['form_id'];
622
+			foreach ( $entry[ '_multi' ] as $_multi ) {
623
+				$entry_slugs[ ] = self::get_entry_slug( $_multi[ 'id' ], $_multi );
624
+				$forms[ ] = $_multi[ 'form_id' ];
625 625
 			}
626 626
 			$entry_slug = implode( ',', $entry_slugs );
627 627
 		} else {
628
-			$entry_slug = self::get_entry_slug( $entry['id'], $entry );
628
+			$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
629 629
 		}
630 630
 
631
-		if ( get_option('permalink_structure') && !is_preview() ) {
631
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
632 632
 
633 633
 			$args = array();
634 634
 
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 			 */
639 639
 			$link_parts = explode( '?', $directory_link );
640 640
 
641
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
641
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
642 642
 
643
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
643
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
644 644
 
645 645
 		} else {
646 646
 
@@ -652,21 +652,21 @@  discard block
 block discarded – undo
652 652
 		 */
653 653
 		if ( $add_directory_args ) {
654 654
 
655
-			if ( ! empty( $_GET['pagenum'] ) ) {
656
-				$args['pagenum'] = intval( $_GET['pagenum'] );
655
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
656
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
657 657
 			}
658 658
 
659 659
 			/**
660 660
 			 * @since 1.7
661 661
 			 */
662 662
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
663
-				$args['sort'] = $sort;
664
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
663
+				$args[ 'sort' ] = $sort;
664
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
665 665
 			}
666 666
 
667 667
 		}
668 668
 
669
-		if( $post_id ) {
669
+		if ( $post_id ) {
670 670
 			$passed_post = get_post( $post_id );
671 671
 			$views       = \GV\View_Collection::from_post( $passed_post );
672 672
 			$has_multiple_views = $views->count() > 1;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		}
676 676
 
677 677
 		if ( $has_multiple_views ) {
678
-			$args['gvid'] = gravityview_get_view_id();
678
+			$args[ 'gvid' ] = gravityview_get_view_id();
679 679
 		}
680 680
 
681 681
 		return add_query_arg( $args, $directory_link );
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 }
697 697
 
698 698
 function gv_class( $field, $form = NULL, $entry = array() ) {
699
-	return GravityView_API::field_class( $field, $form, $entry  );
699
+	return GravityView_API::field_class( $field, $form, $entry );
700 700
 }
701 701
 
702 702
 /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$view_id = 0;
720 720
 		if ( $context->view ) {
721 721
 			$view_id = $context->view->ID;
722
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
722
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
723 723
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
724 724
 			}
725 725
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$default_css_class .= ' gv-container-no-results';
748 748
 	}
749 749
 
750
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
750
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
751 751
 
752 752
 	/**
753 753
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
 	$value = GravityView_API::field_value( $entry, $field );
776 776
 
777
-	if( $value === '' ) {
777
+	if ( $value === '' ) {
778 778
 		/**
779 779
 		 * @filter `gravityview_empty_value` What to display when a field is empty
780 780
 		 * @param string $value (empty string)
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
  */
888 888
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
889 889
 
890
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
890
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
891 891
 
892 892
 		// For the complete field value as generated by Gravity Forms
893 893
 		return $display_value;
@@ -921,16 +921,16 @@  discard block
 block discarded – undo
921 921
 		$terms = explode( ', ', $value );
922 922
 	}
923 923
 
924
-	foreach ($terms as $term_name ) {
924
+	foreach ( $terms as $term_name ) {
925 925
 
926 926
 		// If we're processing a category,
927
-		if( $taxonomy === 'category' ) {
927
+		if ( $taxonomy === 'category' ) {
928 928
 
929 929
 			// Use rgexplode to prevent errors if : doesn't exist
930 930
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
931 931
 
932 932
 			// The explode was succesful; we have the category ID
933
-			if( !empty( $term_id )) {
933
+			if ( ! empty( $term_id ) ) {
934 934
 				$term = get_term_by( 'id', $term_id, $taxonomy );
935 935
 			} else {
936 936
 			// We have to fall back to the name
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 		}
944 944
 
945 945
 		// There's still a tag/category here.
946
-		if( $term ) {
946
+		if ( $term ) {
947 947
 
948 948
 			$term_link = get_term_link( $term, $taxonomy );
949 949
 
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
 			    continue;
953 953
 			}
954 954
 
955
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
955
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
956 956
 		}
957 957
 	}
958 958
 
959
-	return implode(', ', $output );
959
+	return implode( ', ', $output );
960 960
 }
961 961
 
962 962
 /**
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 
971 971
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
972 972
 
973
-	if( empty( $link ) ) {
974
-		return strip_tags( $output);
973
+	if ( empty( $link ) ) {
974
+		return strip_tags( $output );
975 975
 	}
976 976
 
977 977
 	return $output;
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 	$fe = GravityView_frontend::getInstance();
991 991
 
992 992
 	// Solve problem when loading content via admin-ajax.php
993
-	if( ! $fe->getGvOutputData() ) {
993
+	if ( ! $fe->getGvOutputData() ) {
994 994
 
995 995
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
996 996
 
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	}
999 999
 
1000 1000
 	// Make 100% sure that we're dealing with a properly called situation
1001
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1001
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1002 1002
 
1003 1003
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1004 1004
 
@@ -1220,12 +1220,12 @@  discard block
 block discarded – undo
1220 1220
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1221 1221
 	/** @define "GRAVITYVIEW_DIR" "../" */
1222 1222
 
1223
-	if( !class_exists( 'GravityView_Field' ) ) {
1224
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1223
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1224
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1225 1225
 	}
1226 1226
 
1227
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1228
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1227
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1228
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1229 1229
 	}
1230 1230
 
1231 1231
 	if ( is_null( $context ) ) {
@@ -1328,21 +1328,21 @@  discard block
 block discarded – undo
1328 1328
 	} else {
1329 1329
 		// @deprecated path
1330 1330
 		// Required fields.
1331
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1331
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1332 1332
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1333 1333
 			return '';
1334 1334
 		}
1335 1335
 	}
1336 1336
 
1337 1337
 	if ( $context instanceof \GV\Template_Context ) {
1338
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1339
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1340
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1338
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1339
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1340
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1341 1341
 	} else {
1342 1342
 		// @deprecated path
1343
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1344
-		$field = $args['field'];
1345
-		$form = $args['form'];
1343
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1344
+		$field = $args[ 'field' ];
1345
+		$form = $args[ 'form' ];
1346 1346
 	}
1347 1347
 
1348 1348
 	/**
@@ -1362,43 +1362,43 @@  discard block
 block discarded – undo
1362 1362
 	);
1363 1363
 
1364 1364
 	if ( $context instanceof \GV\Template_Context ) {
1365
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1365
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1366 1366
 	} else {
1367 1367
 		// @deprecated path
1368
-		$placeholders['value'] = gv_value( $entry, $field );
1368
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1369 1369
 	}
1370 1370
 
1371 1371
 	// If the value is empty and we're hiding empty, return empty.
1372
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1372
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1373 1373
 		return '';
1374 1374
 	}
1375 1375
 
1376
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1377
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1376
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1377
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1378 1378
 	}
1379 1379
 
1380 1380
 	// Get width setting, if exists
1381
-	$placeholders['width'] = GravityView_API::field_width( $field );
1381
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1382 1382
 
1383 1383
 	// If replacing with CSS inline formatting, let's do it.
1384
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1384
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1385 1385
 
1386 1386
 	// Grab the Class using `gv_class`
1387
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1388
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1387
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1388
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1389 1389
 
1390 1390
 	if ( $context instanceof \GV\Template_Context ) {
1391
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1391
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1392 1392
 	} else {
1393 1393
 		// Default Label value
1394
-		$placeholders['label_value'] = gv_label( $field, $entry );
1394
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1395 1395
 	}
1396 1396
 
1397
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1398
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1397
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1398
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1399 1399
 
1400
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1401
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1400
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1401
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1402 1402
 	}
1403 1403
 
1404 1404
 	/**
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 	 * @since 2.0
1410 1410
 	 * @param \GV\Template_Context $context The context.
1411 1411
 	 */
1412
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1412
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1413 1413
 
1414 1414
 	/**
1415 1415
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 	foreach ( $placeholders as $tag => $value ) {
1437 1437
 
1438 1438
 		// If the tag doesn't exist just skip it
1439
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1439
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1440 1440
 			continue;
1441 1441
 		}
1442 1442
 
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function the_field( \GV\Field $field ) {
28 28
 		$renderer = new Field_Renderer();
29
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
29
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
30 30
 
31 31
 		return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request );
32 32
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		foreach ( $fields->all() as $field ) {
64 64
 			$context = Template_Context::from_template( $this, compact( 'field' ) );
65 65
 
66
-			$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
66
+			$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
67 67
 			$entry = $this->entry->from_field( $field );
68 68
 
69 69
 			if ( ! $entry ) {
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function is_add_oembed_preview() {
47 47
 		/** The preview request is a parse-embed AJAX call without a type set. */
48
-		return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) );
48
+		return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return boolean
64 64
 	 */
65 65
 	public static function is_rest() {
66
-		return ! empty( $GLOBALS['wp']->query_vars['rest_route'] );
66
+		return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] );
67 67
 	}
68 68
 
69 69
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 						return false;
126 126
 					}
127 127
 
128
-					if ( ! in_array( $e['form_id'], $valid_forms ) ) {
128
+					if ( ! in_array( $e[ 'form_id' ], $valid_forms ) ) {
129 129
 						return false;
130 130
 					}
131 131
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				}
142 142
 
143 143
 				$entry = Multi_Entry::from_entries( array_filter( $multientry ) );
144
-			}  else {
144
+			} else {
145 145
 				/**
146 146
 				 * A regular one.
147 147
 				 */
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
 			$get = $_GET;
197 197
 		}
198 198
 
199
-		unset( $get['mode'] );
199
+		unset( $get[ 'mode' ] );
200 200
 
201 201
 		$get = array_filter( $get, 'gravityview_is_not_empty_string' );
202 202
 
203
-		if( $has_field_key = $this->_has_field_key( $get ) ) {
203
+		if ( $has_field_key = $this->_has_field_key( $get ) ) {
204 204
 			return true;
205 205
 		}
206 206
 
207
-		return isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] );
207
+		return isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] );
208 208
 	}
209 209
 
210 210
 	/**
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$meta = array();
229 229
 		foreach ( $fields as $field ) {
230
-			if( empty( $field->_gf_field_class_name ) ) {
231
-				$meta[] = preg_quote( $field->name );
230
+			if ( empty( $field->_gf_field_class_name ) ) {
231
+				$meta[ ] = preg_quote( $field->name );
232 232
 			}
233 233
 		}
234 234
 
235 235
 		foreach ( $get as $key => $value ) {
236
-			if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/sm', $key ) ) {
236
+			if ( preg_match( '/^filter_(([0-9_]+)|' . implode( '|', $meta ) . ')$/sm', $key ) ) {
237 237
 				$has_field_key = true;
238 238
 				break;
239 239
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-template-entry-list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @return string
27 27
 	 */
28 28
 	public function the_field( \GV\Field $field, $extras = null ) {
29
-		$form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form;
29
+		$form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form;
30 30
 		$entry = $this->entry->from_field( $field );
31 31
 
32 32
 		if ( ! $entry ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 
36 36
 		$renderer = new Field_Renderer();
37
-		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source();
37
+		$source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source();
38 38
 		
39 39
 		$value = $renderer->render( $field, $this->view, $source, $entry, $this->request );
40 40
 		
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
63 63
 
64 64
 		if ( is_numeric( $field->ID ) ) {
65
-			$extras['field'] = $field->as_configuration();
65
+			$extras[ 'field' ] = $field->as_configuration();
66 66
 		}
67 67
 
68
-		$extras['entry'] = $this->entry->as_entry();
69
-		$extras['hide_empty'] = $hide_empty;
70
-		$extras['label'] = $label;
71
-		$extras['value'] = $value;
68
+		$extras[ 'entry' ] = $this->entry->as_entry();
69
+		$extras[ 'hide_empty' ] = $hide_empty;
70
+		$extras[ 'label' ] = $label;
71
+		$extras[ 'value' ] = $value;
72 72
 
73 73
 		return \gravityview_field_output( $extras, $context );
74 74
 	}
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 		// autounapprove
51 51
 		add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 			return;
95 95
 		}
96 96
 
97
-		$form = GFAPI::get_form( $entry['form_id'] );
97
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
98 98
 
99 99
 		if ( ! $form ) {
100
-			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) );
100
+			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) );
101 101
 			return;
102 102
 		}
103 103
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public static function add_approval_notification_events( $notification_events = array(), $form = array() ) {
116 116
 
117
-		$notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
-		$notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
-		$notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
-		$notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
117
+		$notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
+		$notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
+		$notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
+		$notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
121 121
 
122 122
 		return $notification_events;
123 123
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
137 137
 
138
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
138
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
139 139
 
140 140
 		$status = gform_get_meta( $entry_id, self::meta_key );
141 141
 
142 142
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
143 143
 
144
-		if( 'value' === $value_or_label ) {
144
+		if ( 'value' === $value_or_label ) {
145 145
 			return $status;
146 146
 		}
147 147
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$nonce = \GV\Utils::_POST( 'nonce' );
180 180
 
181 181
 		// Valid status
182
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
182
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
183 183
 
184 184
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
185 185
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
212 212
 
213
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
213
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
214 214
 
215 215
 		}
216 216
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 		}
262 262
 
263 263
 		// Set default
264
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
264
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
265 265
 
266 266
 		// Then check for if there is an approval column, and use that value instead
267
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
267
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
268 268
 	}
269 269
 
270 270
 	/**
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
280 280
 
281
-		$approved_column = self::get_approved_column( $form['id'] );
281
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
282 282
 
283 283
 		/**
284 284
 		 * If the form doesn't contain the approve field, don't assume anything.
285 285
 		 */
286
-		if( empty( $approved_column ) ) {
286
+		if ( empty( $approved_column ) ) {
287 287
 			return;
288 288
 		}
289 289
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			$value = GravityView_Entry_Approval_Status::APPROVED;
298 298
 		}
299 299
 
300
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
300
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
301 301
 	}
302 302
 
303 303
 	/**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public static function update_bulk( $entries = array(), $approved, $form_id ) {
317 317
 
318
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
318
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
319 319
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
320 320
 			return NULL;
321 321
 		}
322 322
 
323
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
323
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
324 324
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
325 325
 			return NULL;
326 326
 		}
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 		$approved_column_id = self::get_approved_column( $form_id );
336 336
 
337 337
 		$success = true;
338
-		foreach( $entries as $entry_id ) {
338
+		foreach ( $entries as $entry_id ) {
339 339
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
340 340
 
341
-			if( ! $update_success ) {
341
+			if ( ! $update_success ) {
342 342
 				$success = false;
343 343
 			}
344 344
 		}
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
364 364
 
365
-		if( !class_exists( 'GFAPI' ) ) {
365
+		if ( ! class_exists( 'GFAPI' ) ) {
366 366
 			gravityview()->log->error( 'GFAPI does not exist' );
367 367
 			return false;
368 368
 		}
369 369
 
370
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
370
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
371 371
 			gravityview()->log->error( 'Not a valid approval value.' );
372 372
 			return false;
373 373
 		}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		// If the form has an Approve/Reject field, update that value
385 385
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
386 386
 
387
-		if( is_wp_error( $result ) ) {
387
+		if ( is_wp_error( $result ) ) {
388 388
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
389 389
 			return false;
390 390
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 		// add note to entry if approval field updating worked or there was no approved field
398 398
 		// There's no validation for the meta
399
-		if( true === $result ) {
399
+		if ( true === $result ) {
400 400
 
401 401
 			// Add an entry note
402 402
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		$note_id = false;
451 451
 
452
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
452
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
453 453
 
454 454
 			$current_user = wp_get_current_user();
455 455
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
473 473
 
474
-		if( empty( $approvedcolumn ) ) {
474
+		if ( empty( $approvedcolumn ) ) {
475 475
 			$approvedcolumn = self::get_approved_column( $form_id );
476 476
 		}
477 477
 
@@ -494,12 +494,12 @@  discard block
 block discarded – undo
494 494
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
495 495
 
496 496
 		$new_value = '';
497
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
497
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
498 498
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
499 499
 		}
500 500
 
501 501
 		//update entry
502
-		$entry["{$approvedcolumn}"] = $new_value;
502
+		$entry[ "{$approvedcolumn}" ] = $new_value;
503 503
 
504 504
 		/**
505 505
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -530,12 +530,12 @@  discard block
 block discarded – undo
530 530
 		// If the user has enabled a different value than the label (for some reason), use it.
531 531
 		// This is highly unlikely
532 532
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
533
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
533
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
534 534
 		}
535 535
 
536 536
 		// Otherwise, fall back on the inputs array
537 537
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
538
-			return $field->inputs[0]['label'];
538
+			return $field->inputs[ 0 ][ 'label' ];
539 539
 		}
540 540
 
541 541
 		return null;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		 * @since 1.18 Added "unapproved"
588 588
 		 * @param  int $entry_id ID of the Gravity Forms entry
589 589
 		 */
590
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
590
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
591 591
 	}
592 592
 
593 593
 	/**
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	static public function get_approved_column( $form ) {
602 602
 
603
-		if( empty( $form ) ) {
603
+		if ( empty( $form ) ) {
604 604
 			return null;
605 605
 		}
606 606
 
607
-		if( !is_array( $form ) ) {
607
+		if ( ! is_array( $form ) ) {
608 608
 			$form = GVCommon::get_form( $form );
609 609
 		}
610 610
 
@@ -614,22 +614,22 @@  discard block
 block discarded – undo
614 614
 		 * @var string $key
615 615
 		 * @var GF_Field $field
616 616
 		 */
617
-		foreach( $form['fields'] as $key => $field ) {
617
+		foreach ( $form[ 'fields' ] as $key => $field ) {
618 618
 
619 619
 			$inputs = $field->get_entry_inputs();
620 620
 
621
-			if( !empty( $field->gravityview_approved ) ) {
622
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
623
-					$approved_column_id = $inputs[0]['id'];
621
+			if ( ! empty( $field->gravityview_approved ) ) {
622
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
623
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
624 624
 					break;
625 625
 				}
626 626
 			}
627 627
 
628 628
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
629
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
629
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
630 630
 				foreach ( $inputs as $input ) {
631
-					if ( 'approved' === strtolower( $input['label'] ) ) {
632
-						$approved_column_id = $input['id'];
631
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
632
+						$approved_column_id = $input[ 'id' ];
633 633
 						break;
634 634
 					}
635 635
 				}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
 		$view_keys = array_keys( $gv_data->get_views() );
657 657
 
658
-		$view = \GV\View::by_id( $view_keys[0] );
658
+		$view = \GV\View::by_id( $view_keys[ 0 ] );
659 659
 
660 660
 		if ( ! $view->settings->get( 'unapprove_edit' ) ) {
661 661
 			return;
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
 			return;
681 681
 		}
682 682
 
683
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
683
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
684 684
 			$approval_status = GravityView_Entry_Approval_Status::UNAPPROVED;
685 685
 		}
686 686
 
687
-		self::update_approved_meta( $entry_id, $approval_status, $form['id'] );
687
+		self::update_approved_meta( $entry_id, $approval_status, $form[ 'id' ] );
688 688
 	}
689 689
 
690 690
 }
Please login to merge, or discard this patch.