Completed
Push — develop ( cb1f6a...6a19ab )
by Zack
20:14 queued 03:24
created
includes/fields/class-gravityview-field-gravatar.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	static public function get_email( $field_settings, $entry ) {
72 72
 
73 73
 		// There was no logged in user.
74
-		switch ( $field_settings['email_field'] ) {
74
+		switch ( $field_settings[ 'email_field' ] ) {
75 75
 			case 'created_by_email':
76 76
 
77 77
 				$created_by = \GV\Utils::get( $entry, 'created_by', null );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			return $field_options;
103 103
 		}
104 104
 
105
-		$field_options['email_field'] = array(
105
+		$field_options[ 'email_field' ] = array(
106 106
 			'type'    => 'select',
107 107
 			'label'   => __( 'Email to Use', 'gravityview' ),
108 108
 			'value'   => 'created_by_email',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'choices' => $this->_get_email_field_choices( $form_id ),
111 111
 		);
112 112
 
113
-		$field_options['default'] = array(
113
+		$field_options[ 'default' ] = array(
114 114
 			'type'    => 'select',
115 115
 			'label'   => __( 'Default Image', 'gravityview' ),
116 116
 			'desc'    => __( 'Choose the default image to be shown when an email has no Gravatar.', 'gravityview' ) . ' <a href="https://en.gravatar.com/site/implement/images/">' . esc_html( sprintf( __( 'Read more about %s', 'gravityview' ), __( 'Default Image', 'gravityview' ) ) ) . '</a>',
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			),
127 127
 		);
128 128
 
129
-		$field_options['size'] = array(
129
+		$field_options[ 'size' ] = array(
130 130
 			'type'  => 'number',
131 131
 			'label' => __( 'Size in Pixels', 'gravityview' ),
132 132
 			'value' => 80,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$email_fields = GFAPI::get_fields_by_type( $form, array( 'email' ) );
160 160
 
161 161
 		foreach ( $email_fields as $email_field ) {
162
-			$email_field_id                   = $email_field['id'];
162
+			$email_field_id                   = $email_field[ 'id' ];
163 163
 			$email_field_label                = GVCommon::get_field_label( $form, $email_field_id );
164 164
 			$email_field_label                = sprintf( __( 'Field: %s', 'gravityview' ), $email_field_label );
165 165
 			$field_choices[ $email_field_id ] = esc_html( $email_field_label );
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +113 added lines, -113 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
 	}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
262 262
 	 */
263
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'date_created', $order = 'ASC' ) {
263
+	public static function get_forms( $active = true, $trash = false, $order_by = 'date_created', $order = 'ASC' ) {
264 264
 		$forms = array();
265 265
 		if ( ! class_exists( 'GFAPI' ) ) {
266 266
 			return array();
267 267
 		}
268 268
 
269
-		if( 'any' === $active ) {
269
+		if ( 'any' === $active ) {
270 270
 			$active_forms = GFAPI::get_forms( true, $trash );
271 271
 			$inactive_forms = GFAPI::get_forms( false, $trash );
272 272
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 		$has_post_fields = false;
300 300
 
301 301
 		if ( $form ) {
302
-			foreach ( $form['fields'] as $field ) {
303
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
304
-					$fields["{$field['id']}"] = array(
302
+			foreach ( $form[ 'fields' ] as $field ) {
303
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
304
+					$fields[ "{$field[ 'id' ]}" ] = array(
305 305
 						'label' => \GV\Utils::get( $field, 'label' ),
306 306
 						'parent' => null,
307 307
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 					);
311 311
 				}
312 312
 
313
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
314
-					foreach ( $field['inputs'] as $input ) {
313
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
314
+					foreach ( $field[ 'inputs' ] as $input ) {
315 315
 
316
-						if( ! empty( $input['isHidden'] ) ) {
316
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
317 317
 							continue;
318 318
 						}
319 319
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
                          * @hack
322 322
                          * In case of email/email confirmation, the input for email has the same id as the parent field
323 323
                          */
324
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
324
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
325 325
                             continue;
326 326
                         }
327
-						$fields["{$input['id']}"] = array(
327
+						$fields[ "{$input[ 'id' ]}" ] = array(
328 328
 							'label' => \GV\Utils::get( $input, 'label' ),
329 329
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
330 330
 							'parent' => $field,
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 				}
337 337
 
338 338
 
339
-				if( GFCommon::is_product_field( $field['type'] ) ){
339
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
340 340
 					$has_product_fields = true;
341 341
 				}
342 342
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 * @since 1.7
351 351
 		 */
352 352
 		if ( $has_post_fields ) {
353
-			$fields['post_id'] = array(
353
+			$fields[ 'post_id' ] = array(
354 354
 				'label' => __( 'Post ID', 'gravityview' ),
355 355
 				'type' => 'post_id',
356 356
 			);
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 			foreach ( $payment_fields as $payment_field ) {
364 364
 
365 365
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
366
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
366
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
367 367
 					continue;
368 368
 				}
369 369
 
370
-				$fields["{$payment_field->name}"] = array(
370
+				$fields[ "{$payment_field->name}" ] = array(
371 371
 					'label' => $payment_field->label,
372 372
 					'desc' => $payment_field->description,
373 373
 					'type' => $payment_field->name,
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 
400 400
 		$fields = array();
401 401
 
402
-		foreach ( $extra_fields as $key => $field ){
403
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
404
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
402
+		foreach ( $extra_fields as $key => $field ) {
403
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
404
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
405 405
 			}
406 406
 		}
407 407
 
@@ -441,33 +441,33 @@  discard block
 block discarded – undo
441 441
 			'search_criteria' => null,
442 442
 			'sorting' => null,
443 443
 			'paging' => null,
444
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
444
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
445 445
 			'context_view_id' => null,
446 446
 		);
447 447
 
448 448
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
449 449
 
450
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
451
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
450
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
451
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
452 452
 
453 453
 				if ( ! is_array( $filter ) ) {
454 454
 					continue;
455 455
 				}
456 456
 
457 457
 				// By default, we want searches to be wildcard for each field.
458
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
458
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
459 459
 
460 460
 				/**
461 461
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
462 462
 				 * @param string $operator Existing search operator
463 463
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
464 464
 				 */
465
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
465
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
466 466
 			}
467 467
 
468 468
 			// don't send just the [mode] without any field filter.
469
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
470
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
469
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
470
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
471 471
 			}
472 472
 
473 473
 		}
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
 		 * Prepare date formats to be in Gravity Forms DB format;
479 479
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
480 480
 		 */
481
-		foreach ( array('start_date', 'end_date' ) as $key ) {
481
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
482 482
 
483
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
483
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
484 484
 
485 485
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
486
-				$date = date_create( $criteria['search_criteria'][ $key ] );
486
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
487 487
 
488 488
 				if ( $date ) {
489 489
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
490
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
490
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
491 491
 				} else {
492
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
492
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
493 493
 
494 494
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
495
-					unset( $criteria['search_criteria'][ $key ] );
495
+					unset( $criteria[ 'search_criteria' ][ $key ] );
496 496
 				}
497 497
 			}
498 498
 		}
499 499
 
500
-		if ( empty( $criteria['context_view_id'] ) ) {
500
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
501 501
 			// Calculate the context view id and send it to the advanced filter
502 502
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
503
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
505
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
505
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
506 506
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
507
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
507
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
508 508
 			}
509 509
 		}
510 510
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		/** Reduce # of database calls */
550 550
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
551 551
 
552
-		if ( ! empty( $criteria['cache'] ) ) {
552
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
553 553
 
554 554
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
555 555
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 				// Still update the total count when using cached results
559 559
 				if ( ! is_null( $total ) ) {
560
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
560
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
561 561
 				}
562 562
 
563 563
 				$return = $entries;
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
580 580
 
581 581
 			// No entries returned from gravityview_before_get_entries
582
-			if( is_null( $entries ) ) {
582
+			if ( is_null( $entries ) ) {
583 583
 
584
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
584
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
585 585
 
586 586
 				if ( is_wp_error( $entries ) ) {
587 587
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 				}
593 593
 			}
594 594
 
595
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
595
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
596 596
 
597 597
 				// Cache results
598 598
 				$Cache->set( $entries, 'entries' );
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view );
707 707
 
708 708
 		// Is the entry allowed
709
-		if( $check_entry_display ) {
709
+		if ( $check_entry_display ) {
710 710
 
711 711
 			$gvid = \GV\Utils::_GET( 'gvid' );
712 712
 
713
-			if( $gvid ) {
713
+			if ( $gvid ) {
714 714
 				$view = \GV\View::by_id( $gvid );
715 715
 			}
716 716
 
717 717
 			$entry = self::check_entry_display( $entry, $view );
718 718
 		}
719 719
 
720
-		if( is_wp_error( $entry ) ) {
720
+		if ( is_wp_error( $entry ) ) {
721 721
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
722 722
 			return false;
723 723
 		}
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$value = false;
753 753
 
754
-		if( 'context' === $val1 ) {
754
+		if ( 'context' === $val1 ) {
755 755
 
756 756
 			$matching_contexts = array( $val2 );
757 757
 
758 758
 			// We allow for non-standard contexts.
759
-			switch( $val2 ) {
759
+			switch ( $val2 ) {
760 760
 				// Check for either single or edit
761 761
 				case 'singular':
762 762
 					$matching_contexts = array( 'single', 'edit' );
@@ -799,18 +799,18 @@  discard block
 block discarded – undo
799 799
 				$json_val_1 = json_decode( $val1, true );
800 800
 				$json_val_2 = json_decode( $val2, true );
801 801
 
802
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
802
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
803 803
 
804 804
 					$json_in = false;
805
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
806
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
805
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
806
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
807 807
 
808 808
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
809 809
 					foreach ( $json_val_1 as $item_1 ) {
810 810
 						foreach ( $json_val_2 as $item_2 ) {
811 811
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
812 812
 
813
-							if( $json_in ) {
813
+							if ( $json_in ) {
814 814
 								break 2;
815 815
 							}
816 816
 						}
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry, $view = null ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 
880 880
 		$_gvid = \GV\Utils::_GET( 'gvid' );
881 881
 
882
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
882
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
883 883
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
884 884
 		}
885 885
 
886 886
 		$view_form_id = $view->form->ID;
887 887
 
888 888
 		if ( $view->joins ) {
889
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
-				$view_form_id = $entry['form_id'];
889
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
+				$view_form_id = $entry[ 'form_id' ];
891 891
 			}
892 892
 		}
893 893
 
894
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
894
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
895 895
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
896 896
 		}
897 897
 
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 		 * Check whether the entry is in the entries subset by running a modified query.
900 900
 		 */
901 901
 		add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) {
902
-			$_tmp_query       = new \GF_Query( $view_form_id, array(
902
+			$_tmp_query = new \GF_Query( $view_form_id, array(
903 903
 				'field_filters' => array(
904 904
 					'mode' => 'all',
905 905
 					array(
906 906
 						'key' => 'id',
907 907
 						'operation' => 'is',
908
-						'value' => $entry['id']
908
+						'value' => $entry[ 'id' ]
909 909
 					)
910 910
 				)
911 911
 			) );
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 			/** @var \GF_Query $query */
916 916
 			$query_parts      = $query->_introspect();
917 917
 
918
-			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
918
+			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
919 919
 
920 920
 		}, 10, 3 );
921 921
 
922 922
 		// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
923 923
 		add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
924 924
 
925
-			$criteria['paging'] = array(
925
+			$criteria[ 'paging' ] = array(
926 926
 				'offset' => 0,
927 927
 				'page_size' => 25
928 928
 			);
@@ -941,20 +941,20 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 		// This entry is on a View with joins
944
-		if ( $entries[0]->is_multi() ) {
944
+		if ( $entries[ 0 ]->is_multi() ) {
945 945
 
946 946
 			$multi_entry_ids = array();
947 947
 
948
-			foreach ( $entries[0]->entries as $multi_entry ) {
949
-				$multi_entry_ids[] = (int) $multi_entry->ID;
948
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
949
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
950 950
 			}
951 951
 
952
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
952
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
953 953
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
954 954
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
955 955
 			}
956 956
 
957
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
957
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
958 958
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
959 959
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
960 960
 		}
@@ -999,18 +999,18 @@  discard block
 block discarded – undo
999 999
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1000 1000
 		 * @see GFCommon::format_date() for original code
1001 1001
 		 */
1002
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1002
+		$date_gmt_time = mysql2date( 'G', $date_string );
1003 1003
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1004 1004
 
1005
-		$format  = \GV\Utils::get( $atts, 'format' );
1006
-		$is_human  = ! empty( $atts['human'] );
1007
-		$is_diff  = ! empty( $atts['diff'] );
1008
-		$is_raw = ! empty( $atts['raw'] );
1009
-		$is_timestamp = ! empty( $atts['timestamp'] );
1010
-		$include_time = ! empty( $atts['time'] );
1005
+		$format = \GV\Utils::get( $atts, 'format' );
1006
+		$is_human = ! empty( $atts[ 'human' ] );
1007
+		$is_diff = ! empty( $atts[ 'diff' ] );
1008
+		$is_raw = ! empty( $atts[ 'raw' ] );
1009
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1010
+		$include_time = ! empty( $atts[ 'time' ] );
1011 1011
 
1012 1012
 		// If we're using time diff, we want to have a different default format
1013
-		if( empty( $format ) ) {
1013
+		if ( empty( $format ) ) {
1014 1014
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1015 1015
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1016 1016
 		}
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		// If raw was specified, don't modify the stored value
1019 1019
 		if ( $is_raw ) {
1020 1020
 			$formatted_date = $date_string;
1021
-		} elseif( $is_timestamp ) {
1021
+		} elseif ( $is_timestamp ) {
1022 1022
 			$formatted_date = $date_local_timestamp;
1023 1023
 		} elseif ( $is_diff ) {
1024 1024
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		$label = \GV\Utils::get( $field, 'label' );
1054 1054
 
1055
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1055
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1056 1056
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1057 1057
 		}
1058 1058
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 			$form = GFAPI::get_form( $form );
1081 1081
 		}
1082 1082
 
1083
-		if ( class_exists( 'GFFormsModel' ) ){
1083
+		if ( class_exists( 'GFFormsModel' ) ) {
1084 1084
 			return GFFormsModel::get_field( $form, $field_id );
1085 1085
 		} else {
1086 1086
 			return null;
@@ -1127,19 +1127,19 @@  discard block
 block discarded – undo
1127 1127
 			$shortcodes = array();
1128 1128
 
1129 1129
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1130
-			if ( empty( $matches ) ){
1130
+			if ( empty( $matches ) ) {
1131 1131
 				return false;
1132 1132
 			}
1133 1133
 
1134 1134
 			foreach ( $matches as $shortcode ) {
1135
-				if ( $tag === $shortcode[2] ) {
1135
+				if ( $tag === $shortcode[ 2 ] ) {
1136 1136
 
1137 1137
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1138
-					$shortcodes[] = $shortcode;
1138
+					$shortcodes[ ] = $shortcode;
1139 1139
 
1140
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1141
-					foreach( $results as $result ) {
1142
-						$shortcodes[] = $result;
1140
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1141
+					foreach ( $results as $result ) {
1142
+						$shortcodes[ ] = $result;
1143 1143
 					}
1144 1144
 				}
1145 1145
 			}
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 			'post_type'      => 'gravityview',
1172 1172
 			'posts_per_page' => 100,
1173 1173
 			'meta_key'       => '_gravityview_form_id',
1174
-			'meta_value'     => (int) $form_id,
1174
+			'meta_value'     => (int)$form_id,
1175 1175
 		);
1176 1176
 		$args     = wp_parse_args( $args, $defaults );
1177 1177
 		$views    = get_posts( $args );
@@ -1183,21 +1183,21 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
 			$data = unserialize( $view->meta_value );
1185 1185
 
1186
-			if( ! $data || ! is_array( $data ) ) {
1186
+			if ( ! $data || ! is_array( $data ) ) {
1187 1187
 				continue;
1188 1188
 			}
1189 1189
 
1190 1190
 			foreach ( $data as $datum ) {
1191
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1192
-					$joined_forms[] = $view->post_id;
1191
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1192
+					$joined_forms[ ] = $view->post_id;
1193 1193
 				}
1194 1194
 			}
1195 1195
 		}
1196 1196
 
1197 1197
 		if ( $joined_forms ) {
1198
-			$joined_args  = array(
1198
+			$joined_args = array(
1199 1199
 				'post_type'      => 'gravityview',
1200
-				'posts_per_page' => $args['posts_per_page'],
1200
+				'posts_per_page' => $args[ 'posts_per_page' ],
1201 1201
 				'post__in'       => $joined_forms,
1202 1202
 			);
1203 1203
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1355 1355
 
1356
-		if( $json_decode ) {
1356
+		if ( $json_decode ) {
1357 1357
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1358 1358
 		}
1359 1359
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 	 * @return string         html
1370 1370
 	 */
1371 1371
 	public static function get_sortable_fields( $formid, $current = '' ) {
1372
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1372
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1373 1373
 
1374 1374
 		if ( empty( $formid ) ) {
1375 1375
 			return $output;
@@ -1382,11 +1382,11 @@  discard block
 block discarded – undo
1382 1382
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1383 1383
 
1384 1384
 			foreach ( $fields as $id => $field ) {
1385
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1385
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1386 1386
 					continue;
1387 1387
 				}
1388 1388
 
1389
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1389
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1390 1390
 			}
1391 1391
 		}
1392 1392
 
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1422 1422
 
1423 1423
 		// TODO: Convert to using array_filter
1424
-		foreach( $fields as $id => $field ) {
1424
+		foreach ( $fields as $id => $field ) {
1425 1425
 
1426
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1426
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1427 1427
 				unset( $fields[ $id ] );
1428 1428
 			}
1429 1429
 
1430 1430
 			/**
1431 1431
 			 * Merge date and time subfields.
1432 1432
 			 */
1433
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1433
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1434 1434
 				$fields[ intval( $id ) ] = array(
1435 1435
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1436 1436
 					'parent' => null,
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 	 * @param  int|array  $field field key or field array
1481 1481
 	 * @return boolean
1482 1482
 	 */
1483
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1483
+	public static function is_field_numeric( $form = null, $field = '' ) {
1484 1484
 
1485 1485
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1486 1486
 			$form = self::get_form( $form );
1487 1487
 		}
1488 1488
 
1489 1489
 		// If entry meta, it's a string. Otherwise, numeric
1490
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1490
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1491 1491
 			$type = $field;
1492 1492
 		} else {
1493 1493
 			$type = self::get_field_type( $form, $field );
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1502 1502
 
1503 1503
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1504
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1505
-			if( true === $gv_field->is_numeric ) {
1506
-				$numeric_types[] = $gv_field->is_numeric;
1504
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1505
+			if ( true === $gv_field->is_numeric ) {
1506
+				$numeric_types[ ] = $gv_field->is_numeric;
1507 1507
 			}
1508 1508
 		}
1509 1509
 
@@ -1653,18 +1653,18 @@  discard block
 block discarded – undo
1653 1653
 		$final_atts = array_filter( $final_atts );
1654 1654
 
1655 1655
 		// If the href wasn't passed as an attribute, use the value passed to the function
1656
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1657
-			$final_atts['href'] = $href;
1656
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1657
+			$final_atts[ 'href' ] = $href;
1658 1658
 		}
1659 1659
 
1660
-		$final_atts['href'] = esc_url_raw( $href );
1660
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1661 1661
 
1662 1662
 		/**
1663 1663
 		 * Fix potential security issue with target=_blank
1664 1664
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1665 1665
 		 */
1666
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1666
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1668 1668
 		}
1669 1669
 
1670 1670
 		// Sort the attributes alphabetically, to help testing
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1677 1677
 		}
1678 1678
 
1679
-		if( '' !== $output ) {
1679
+		if ( '' !== $output ) {
1680 1680
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1681 1681
 		}
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1704 1704
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1705 1705
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1706
-				$merged[] = $value;
1706
+				$merged[ ] = $value;
1707 1707
 			} else {
1708 1708
 				$merged[ $key ] = $value;
1709 1709
 			}
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1737 1737
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1738 1738
 		 */
1739
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1739
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1740 1740
 
1741 1741
 		return get_users( $get_users_settings );
1742 1742
 	}
@@ -1756,11 +1756,11 @@  discard block
 block discarded – undo
1756 1756
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1757 1757
 
1758 1758
     	// If $cap is defined, only show notice if user has capability
1759
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1759
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1760 1760
     		return '';
1761 1761
 	    }
1762 1762
 
1763
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1763
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1764 1764
     }
1765 1765
 
1766 1766
 	/**
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 
235 235
 		if ( ! empty( $view_id ) ) {
236 236
 
237
-			$this->context_view_id = (int) $view_id;
237
+			$this->context_view_id = (int)$view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 */
244
-			$this->context_view_id = (int) $_GET['gvid'];
244
+			$this->context_view_id = (int)$_GET[ 'gvid' ];
245 245
 
246 246
 		} elseif ( ! $multiple_views ) {
247 247
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
248
-			$this->context_view_id = (int) array_pop( $array_keys );
248
+			$this->context_view_id = (int)array_pop( $array_keys );
249 249
 			unset( $array_keys );
250 250
 		}
251 251
 
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
 		global $wp_rewrite;
279 279
 
280 280
 		$is_front_page = ( $query->is_home || $query->is_page );
281
-		$show_on_front = ( 'page' === get_option('show_on_front') );
282
-		$front_page_id = get_option('page_on_front');
281
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
282
+		$front_page_id = get_option( 'page_on_front' );
283 283
 
284
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
284
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
285 285
 
286 286
 			// Force to be an array, potentially a query string ( entry=16 )
287 287
 			$_query = wp_parse_args( $query->query );
288 288
 
289 289
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
290
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
291
-				unset( $_query['pagename'] );
290
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
291
+				unset( $_query[ 'pagename' ] );
292 292
 			}
293 293
 
294 294
 			// this is where will break from core wordpress
295 295
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
296 296
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
297 297
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		$gventry = gravityview()->request->is_entry();
434 434
 
435 435
 		// If this is the directory view, return.
436
-		if( ! $gventry ) {
436
+		if ( ! $gventry ) {
437 437
 			return $passed_title;
438 438
 		}
439 439
 
@@ -451,19 +451,19 @@  discard block
 block discarded – undo
451 451
 		}
452 452
 
453 453
 		// WooCommerce doesn't $post_id
454
-		if ( empty( $passed_post_id ) )  {
454
+		if ( empty( $passed_post_id ) ) {
455 455
 			return $passed_title;
456 456
 		}
457 457
 
458 458
 		// Don't modify the title for anything other than the current view/post.
459 459
 		// This is true for embedded shortcodes and Views.
460
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
460
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
461 461
 			return $passed_title;
462 462
 		}
463 463
 
464 464
 		$view = gravityview()->request->is_view();
465 465
 
466
-		if( $view ) {
466
+		if ( $view ) {
467 467
 			return $this->_get_single_entry_title( $view, $entry, $passed_title );
468 468
 		}
469 469
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		$view_collection = \GV\View_Collection::from_post( $post );
487 487
 
488 488
 		// We have multiple Views, but no gvid...this isn't valid security
489
-		if( 1 < $view_collection->count() ) {
489
+		if ( 1 < $view_collection->count() ) {
490 490
 			return $passed_title;
491 491
 		}
492 492
 
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 		 */
521 521
 		$check_entry_display = apply_filters( 'gravityview/single/title/check_entry_display', true, $entry, $view );
522 522
 
523
-		if( $check_entry_display ) {
523
+		if ( $check_entry_display ) {
524 524
 
525 525
 			$check_display = GVCommon::check_entry_display( $entry, $view );
526 526
 
527
-			if( is_wp_error( $check_display ) ) {
527
+			if ( is_wp_error( $check_display ) ) {
528 528
 				return $passed_title;
529 529
 			}
530 530
 		}
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 
533 533
 		$title = $view->settings->get( 'single_title', $passed_title );
534 534
 
535
-		$form = GVCommon::get_form( $entry['form_id'] );
535
+		$form = GVCommon::get_form( $entry[ 'form_id' ] );
536 536
 
537 537
 		// We are allowing HTML in the fields, so no escaping the output
538 538
 		$title = GravityView_API::replace_variables( $title, $form, $entry );
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		$context = GravityView_View::getInstance()->getContext();
606 606
 
607
-		switch( $context ) {
607
+		switch ( $context ) {
608 608
 			case 'directory':
609 609
 				$tab = __( 'Multiple Entries', 'gravityview' );
610 610
 				break;
@@ -618,12 +618,12 @@  discard block
 block discarded – undo
618 618
 		}
619 619
 
620 620
 
621
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
621
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
622 622
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
623
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
623
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
624 624
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
625 625
 
626
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
626
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
627 627
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
628 628
 
629 629
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		$direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID );
672 672
 		$embed_only = $view->settings->get( 'embed_only' );
673 673
 
674
-		if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
674
+		if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
675 675
 			return __( 'You are not allowed to view this content.', 'gravityview' );
676 676
 		}
677 677
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 				$datetime_format = 'Y-m-d H:i:s';
719 719
 				$search_is_outside_view_bounds = false;
720 720
 
721
-				if( ! empty( $search_criteria[ $key ] ) ) {
721
+				if ( ! empty( $search_criteria[ $key ] ) ) {
722 722
 
723 723
 					$search_date = strtotime( $search_criteria[ $key ] );
724 724
 
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
747 747
 
748 748
 					// Then we override the search and re-set the start date
749
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
749
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
750 750
 				}
751 751
 			}
752 752
 		}
753 753
 
754
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
754
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
755 755
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
756
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
756
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
757 757
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
758 758
 			}
759 759
 		}
@@ -772,19 +772,19 @@  discard block
 block discarded – undo
772 772
 	public static function process_search_only_approved( $args, $search_criteria ) {
773 773
 
774 774
 		/** @since 1.19 */
775
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
775
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
776 776
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
777 777
 			return $search_criteria;
778 778
 		}
779 779
 
780
-		if ( ! empty( $args['show_only_approved'] ) ) {
780
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
781 781
 
782
-			$search_criteria['field_filters'][] = array(
782
+			$search_criteria[ 'field_filters' ][ ] = array(
783 783
 				'key' => GravityView_Entry_Approval::meta_key,
784 784
 				'value' => GravityView_Entry_Approval_Status::APPROVED
785 785
 			);
786 786
 
787
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
787
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
788 788
 
789 789
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
790 790
 		}
@@ -811,18 +811,18 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public static function is_entry_approved( $entry, $args = array() ) {
813 813
 
814
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
814
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
815 815
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
816 816
 			return true;
817 817
 		}
818 818
 
819 819
 		/** @since 1.19 */
820
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
820
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
821 821
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
822 822
 			return true;
823 823
 		}
824 824
 
825
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
825
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
826 826
 
827 827
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
828 828
 	}
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
847 847
 		 */
848 848
 		$criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
849
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
849
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
850 850
 
851 851
 		/**
852 852
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -866,29 +866,29 @@  discard block
 block discarded – undo
866 866
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) );
867 867
 
868 868
 		// implicity search
869
-		if ( ! empty( $args['search_value'] ) ) {
869
+		if ( ! empty( $args[ 'search_value' ] ) ) {
870 870
 
871 871
 			// Search operator options. Options: `is` or `contains`
872
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
872
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
873 873
 
874
-			$search_criteria['field_filters'][] = array(
874
+			$search_criteria[ 'field_filters' ][ ] = array(
875 875
 				'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
876
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
876
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
877 877
 				'operator' => $operator,
878 878
 			);
879 879
 
880 880
 			// Lock search mode to "all" with implicit presearch filter.
881
-			$search_criteria['field_filters']['mode'] = 'all';
881
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
882 882
 		}
883 883
 
884
-		if( $search_criteria !== $original_search_criteria ) {
884
+		if ( $search_criteria !== $original_search_criteria ) {
885 885
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) );
886 886
 		}
887 887
 
888 888
 		// Handle setting date range
889 889
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
890 890
 
891
-		if( $search_criteria !== $original_search_criteria ) {
891
+		if ( $search_criteria !== $original_search_criteria ) {
892 892
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) );
893 893
 		}
894 894
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
900 900
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
901 901
 		 */
902
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
902
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
903 903
 
904 904
 		return $search_criteria;
905 905
 	}
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 			'search_criteria' => $search_criteria,
1013 1013
 			'sorting' => self::updateViewSorting( $args, $form_id ),
1014 1014
 			'paging' => $paging,
1015
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1015
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1016 1016
 		);
1017 1017
 
1018 1018
 		/**
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1038 1038
 		 * @param array $args View configuration args.
1039 1039
 		 */
1040
-		$parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
1040
+		$parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
1041 1041
 
1042 1042
 		gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) );
1043 1043
 
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1063 1063
 
1064 1064
 		// Paging & offset
1065
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1065
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1066 1066
 
1067 1067
 		if ( -1 === $page_size ) {
1068 1068
 			$page_size = PHP_INT_MAX;
1069 1069
 		}
1070 1070
 
1071
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1071
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1072 1072
 		$offset = ( $curr_page - 1 ) * $page_size;
1073 1073
 
1074
-		if ( ! empty( $args['offset'] ) ) {
1075
-			$offset += intval( $args['offset'] );
1074
+		if ( ! empty( $args[ 'offset' ] ) ) {
1075
+			$offset += intval( $args[ 'offset' ] );
1076 1076
 		}
1077 1077
 
1078 1078
 		$paging = array(
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	public static function updateViewSorting( $args, $form_id ) {
1098 1098
 		$sorting = array();
1099 1099
 
1100
-		$has_values = isset( $_GET['sort'] );
1100
+		$has_values = isset( $_GET[ 'sort' ] );
1101 1101
 
1102
-		if ( $has_values && is_array( $_GET['sort'] ) ) {
1103
-			$sorts = array_keys( $_GET['sort'] );
1104
-			$dirs  = array_values( $_GET['sort'] );
1102
+		if ( $has_values && is_array( $_GET[ 'sort' ] ) ) {
1103
+			$sorts = array_keys( $_GET[ 'sort' ] );
1104
+			$dirs  = array_values( $_GET[ 'sort' ] );
1105 1105
 
1106 1106
 			if ( $has_values = array_filter( $dirs ) ) {
1107 1107
 				$sort_field_id = end( $sorts );
@@ -1110,11 +1110,11 @@  discard block
 block discarded – undo
1110 1110
 		}
1111 1111
 
1112 1112
 		if ( ! isset( $sort_field_id ) ) {
1113
-			$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1113
+			$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1114 1114
 		}
1115 1115
 
1116 1116
 		if ( ! isset( $sort_direction ) ) {
1117
-			$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1117
+			$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1118 1118
 		}
1119 1119
 
1120 1120
 		if ( is_array( $sort_field_id ) ) {
@@ -1146,10 +1146,10 @@  discard block
 block discarded – undo
1146 1146
 				$form = GFAPI::get_form( $form_id );
1147 1147
 
1148 1148
 				// Get the first GF_Field field ID, set as the key for entry randomization
1149
-				if ( ! empty( $form['fields'] ) ) {
1149
+				if ( ! empty( $form[ 'fields' ] ) ) {
1150 1150
 
1151 1151
 					/** @var GF_Field $field */
1152
-					foreach ( $form['fields'] as $field ) {
1152
+					foreach ( $form[ 'fields' ] as $field ) {
1153 1153
 						if ( ! is_a( $field, 'GF_Field' ) ) {
1154 1154
 							continue;
1155 1155
 						}
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		if ( is_array( $sort_field_id ) ) {
1195 1195
 			$modified_ids = array();
1196 1196
 			foreach ( $sort_field_id as $_sort_field_id ) {
1197
-				$modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1197
+				$modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1198 1198
 			}
1199 1199
 			return $modified_ids;
1200 1200
 		}
@@ -1203,11 +1203,11 @@  discard block
 block discarded – undo
1203 1203
 
1204 1204
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1205 1205
 
1206
-		if( ! $sort_field ) {
1206
+		if ( ! $sort_field ) {
1207 1207
 			return $sort_field_id;
1208 1208
 		}
1209 1209
 
1210
-		switch ( $sort_field['type'] ) {
1210
+		switch ( $sort_field[ 'type' ] ) {
1211 1211
 
1212 1212
 			case 'address':
1213 1213
 				// Sorting by full address
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 					 */
1225 1225
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1226 1226
 
1227
-					switch( strtolower( $address_part ) ){
1227
+					switch ( strtolower( $address_part ) ) {
1228 1228
 						case 'street':
1229 1229
 							$sort_field_id .= '.1';
1230 1230
 							break;
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		if ( ! class_exists( '\GV\Entry' ) ) {
1298 1298
 
1299 1299
 			// Not using gravityview()->log->error(), since that may not exist yet either!
1300
-			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary()  );
1300
+			do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() );
1301 1301
 
1302 1302
 			return null;
1303 1303
 		}
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
 		 */
1315 1315
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1316 1316
 
1317
-		if ( empty( $single_entry ) ){
1317
+		if ( empty( $single_entry ) ) {
1318 1318
 			return false;
1319 1319
 		} else {
1320 1320
 			return $single_entry;
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 			$views = $this->getGvOutputData()->get_views();
1337 1337
 
1338 1338
 			foreach ( $views as $view_id => $data ) {
1339
-				$view = \GV\View::by_id( $data['id'] );
1339
+				$view = \GV\View::by_id( $data[ 'id' ] );
1340 1340
 				$view_id = $view->ID;
1341 1341
 				$template_id = gravityview_get_template_id( $view->ID );
1342 1342
 				$data = $view->as_data();
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1346 1346
 				 * @since 1.15
1347 1347
 				 */
1348
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1348
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1349 1349
 					continue;
1350 1350
 				}
1351 1351
 
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 					 * @param \GV\View The View.
1379 1379
 					 */
1380 1380
 					apply_filters( 'gravityview_lightbox_script', $js_dependency, $view );
1381
-					$js_dependencies[] = $js_dependency;
1381
+					$js_dependencies[ ] = $js_dependency;
1382 1382
 
1383 1383
 					if ( ! empty( $wp_filter[ 'gravity_view_lightbox_style' ] ) ) {
1384 1384
 						gravityview()->log->warning( 'gravity_view_lightbox_style filter is deprecated use gravityview_lightbox_style instead' );
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 					 * @param \GV\View The View.
1399 1399
 					 */
1400 1400
 					$css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view );
1401
-					$css_dependencies[] = $css_dependency;
1401
+					$css_dependencies[ ] = $css_dependency;
1402 1402
 				}
1403 1403
 
1404 1404
 				/**
@@ -1406,19 +1406,19 @@  discard block
 block discarded – undo
1406 1406
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1407 1407
 				 * @since 1.15
1408 1408
 				 */
1409
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1410
-					$css_dependencies[] = 'dashicons';
1409
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1410
+					$css_dependencies[ ] = 'dashicons';
1411 1411
 				}
1412 1412
 
1413 1413
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1414 1414
 
1415 1415
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1416 1416
 
1417
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1417
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1418 1418
 
1419 1419
 				wp_enqueue_script( 'gravityview-fe-view' );
1420 1420
 
1421
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1421
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1422 1422
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1423 1423
 				}
1424 1424
 
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 	public static function add_style( $template_id ) {
1482 1482
 
1483 1483
 		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1484
-			gravityview()->log->debug(  'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1484
+			gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1485 1485
 			wp_enqueue_style( 'gravityview_style_' . $template_id );
1486 1486
 		} elseif ( empty( $template_id ) ) {
1487 1487
 			gravityview()->log->error( 'Cannot add template style; template_id is empty' );
@@ -1512,11 +1512,11 @@  discard block
 block discarded – undo
1512 1512
 		 * Not a table-based template; don't add sort icons
1513 1513
 		 * @since 1.12
1514 1514
 		 */
1515
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1515
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1516 1516
 			return $label;
1517 1517
 		}
1518 1518
 
1519
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1519
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1520 1520
 			return $label;
1521 1521
 		}
1522 1522
 
@@ -1524,29 +1524,29 @@  discard block
 block discarded – undo
1524 1524
 
1525 1525
 		$class = 'gv-sort';
1526 1526
 
1527
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1527
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1528 1528
 
1529 1529
 		$sort_args = array(
1530
-			'sort' => $field['id'],
1530
+			'sort' => $field[ 'id' ],
1531 1531
 			'dir' => 'asc',
1532 1532
 		);
1533 1533
 
1534
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1534
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1535 1535
 			//toggle sorting direction.
1536
-			if ( 'asc' === $sorting['direction'] ) {
1537
-				$sort_args['dir'] = 'desc';
1536
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1537
+				$sort_args[ 'dir' ] = 'desc';
1538 1538
 				$class .= ' gv-icon-sort-desc';
1539 1539
 			} else {
1540
-				$sort_args['dir'] = 'asc';
1540
+				$sort_args[ 'dir' ] = 'asc';
1541 1541
 				$class .= ' gv-icon-sort-asc';
1542 1542
 			}
1543 1543
 		} else {
1544 1544
 			$class .= ' gv-icon-caret-up-down';
1545 1545
 		}
1546 1546
 
1547
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1547
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1548 1548
 
1549
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1549
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1550 1550
 
1551 1551
 	}
1552 1552
 
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
 		$field_type = $field_id;
1566 1566
 
1567
-		if( is_numeric( $field_id ) ) {
1567
+		if ( is_numeric( $field_id ) ) {
1568 1568
 			$field = GFFormsModel::get_field( $form, $field_id );
1569 1569
 			$field_type = $field ? $field->type : $field_id;
1570 1570
 		}
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 			return false;
1588 1588
 		}
1589 1589
 
1590
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1590
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1591 1591
 
1592 1592
 	}
1593 1593
 
Please login to merge, or discard this patch.