Completed
Push — develop ( d59912...bac1d6 )
by Zack
19:26
created
class-gravityview-plugin-hooks-gravity-forms-dropbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 		}
53 53
 
54 54
 		// The image source has ?raw=1; don't check for valid image extensions.
55
-		$image_atts['validate_src'] = false;
55
+		$image_atts[ 'validate_src' ] = false;
56 56
 
57 57
 		return $image_atts;
58 58
 	}
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
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$form = false;
126 126
 
127
-		if( $entry ) {
128
-			$form = GFAPI::get_form( $entry['form_id'] );
127
+		if ( $entry ) {
128
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
129 129
 		}
130 130
 
131 131
 		return $form;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			}
202 202
 		}
203 203
 
204
-		return (bool) $has_transaction_data;
204
+		return (bool)$has_transaction_data;
205 205
 	}
206 206
 
207 207
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
241 241
 
242
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
242
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
243 243
 
244 244
 		return $result;
245 245
 	}
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 *
260 260
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
261 261
 	 */
262
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
262
+	public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
263 263
 		$forms = array();
264 264
 		if ( ! class_exists( 'GFAPI' ) ) {
265 265
 			return array();
266 266
 		}
267 267
 
268
-		if( 'any' === $active ) {
268
+		if ( 'any' === $active ) {
269 269
 			$active_forms = GFAPI::get_forms( true, $trash );
270 270
 			$inactive_forms = GFAPI::get_forms( false, $trash );
271 271
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 		$has_post_fields = false;
298 298
 
299 299
 		if ( $form ) {
300
-			foreach ( $form['fields'] as $field ) {
301
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
302
-					$fields["{$field['id']}"] = array(
300
+			foreach ( $form[ 'fields' ] as $field ) {
301
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
302
+					$fields[ "{$field[ 'id' ]}" ] = array(
303 303
 						'label' => \GV\Utils::get( $field, 'label' ),
304 304
 						'parent' => null,
305 305
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 					);
309 309
 				}
310 310
 
311
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
312
-					foreach ( $field['inputs'] as $input ) {
311
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
312
+					foreach ( $field[ 'inputs' ] as $input ) {
313 313
 
314
-						if( ! empty( $input['isHidden'] ) ) {
314
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
315 315
 							continue;
316 316
 						}
317 317
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
                          * @hack
320 320
                          * In case of email/email confirmation, the input for email has the same id as the parent field
321 321
                          */
322
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
322
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
323 323
                             continue;
324 324
                         }
325
-						$fields["{$input['id']}"] = array(
325
+						$fields[ "{$input[ 'id' ]}" ] = array(
326 326
 							'label' => \GV\Utils::get( $input, 'label' ),
327 327
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
328 328
 							'parent' => $field,
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				}
335 335
 
336 336
 
337
-				if( GFCommon::is_product_field( $field['type'] ) ){
337
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
338 338
 					$has_product_fields = true;
339 339
 				}
340 340
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		 * @since 1.7
349 349
 		 */
350 350
 		if ( $has_post_fields ) {
351
-			$fields['post_id'] = array(
351
+			$fields[ 'post_id' ] = array(
352 352
 				'label' => __( 'Post ID', 'gravityview' ),
353 353
 				'type' => 'post_id',
354 354
 			);
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
 			foreach ( $payment_fields as $payment_field ) {
362 362
 
363 363
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
364
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
364
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
365 365
 					continue;
366 366
 				}
367 367
 
368
-				$fields["{$payment_field->name}"] = array(
368
+				$fields[ "{$payment_field->name}" ] = array(
369 369
 					'label' => $payment_field->label,
370 370
 					'desc' => $payment_field->description,
371 371
 					'type' => $payment_field->name,
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 
398 398
 		$fields = array();
399 399
 
400
-		foreach ( $extra_fields as $key => $field ){
401
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
402
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
400
+		foreach ( $extra_fields as $key => $field ) {
401
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
402
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
403 403
 			}
404 404
 		}
405 405
 
@@ -439,33 +439,33 @@  discard block
 block discarded – undo
439 439
 			'search_criteria' => null,
440 440
 			'sorting' => null,
441 441
 			'paging' => null,
442
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
442
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
443 443
 			'context_view_id' => null,
444 444
 		);
445 445
 
446 446
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
447 447
 
448
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
449
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
448
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
449
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
450 450
 
451 451
 				if ( ! is_array( $filter ) ) {
452 452
 					continue;
453 453
 				}
454 454
 
455 455
 				// By default, we want searches to be wildcard for each field.
456
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
456
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
457 457
 
458 458
 				/**
459 459
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
460 460
 				 * @param string $operator Existing search operator
461 461
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
462 462
 				 */
463
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
463
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
464 464
 			}
465 465
 
466 466
 			// don't send just the [mode] without any field filter.
467
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
468
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
467
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
468
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
469 469
 			}
470 470
 
471 471
 		}
@@ -476,33 +476,33 @@  discard block
 block discarded – undo
476 476
 		 * Prepare date formats to be in Gravity Forms DB format;
477 477
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
478 478
 		 */
479
-		foreach ( array('start_date', 'end_date' ) as $key ) {
479
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
480 480
 
481
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
481
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
482 482
 
483 483
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
484
-				$date = date_create( $criteria['search_criteria'][ $key ] );
484
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
485 485
 
486 486
 				if ( $date ) {
487 487
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
488
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
488
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
489 489
 				} else {
490
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
490
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
491 491
 
492 492
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
493
-					unset( $criteria['search_criteria'][ $key ] );
493
+					unset( $criteria[ 'search_criteria' ][ $key ] );
494 494
 				}
495 495
 			}
496 496
 		}
497 497
 
498
-		if ( empty( $criteria['context_view_id'] ) ) {
498
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
499 499
 			// Calculate the context view id and send it to the advanced filter
500 500
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
501
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
501
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
502 502
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
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 ( 'delete' === GFForms::get( 'action' ) ) {
505
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
505
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
506 506
 			}
507 507
 		}
508 508
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		 * @param array $form_ids Forms to search
513 513
 		 * @param int $view_id ID of the view being used to search
514 514
 		 */
515
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
515
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
516 516
 
517 517
 		return (array)$criteria;
518 518
 	}
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		/** Reduce # of database calls */
547 547
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
548 548
 
549
-		if ( ! empty( $criteria['cache'] ) ) {
549
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
550 550
 
551 551
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
552 552
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 				// Still update the total count when using cached results
556 556
 				if ( ! is_null( $total ) ) {
557
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
557
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
558 558
 				}
559 559
 
560 560
 				$return = $entries;
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
577 577
 
578 578
 			// No entries returned from gravityview_before_get_entries
579
-			if( is_null( $entries ) ) {
579
+			if ( is_null( $entries ) ) {
580 580
 
581
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
581
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
582 582
 
583 583
 				if ( is_wp_error( $entries ) ) {
584 584
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 				}
590 590
 			}
591 591
 
592
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
592
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
593 593
 
594 594
 				// Cache results
595 595
 				$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
 			/** @type \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 ) );
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 		$label = \GV\Utils::get( $field, 'label' );
1053 1053
 
1054
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1054
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1055 1055
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1056 1056
 		}
1057 1057
 
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			$form = GFAPI::get_form( $form );
1079 1079
 		}
1080 1080
 
1081
-		if ( class_exists( 'GFFormsModel' ) ){
1081
+		if ( class_exists( 'GFFormsModel' ) ) {
1082 1082
 			return GFFormsModel::get_field( $form, $field_id );
1083 1083
 		} else {
1084 1084
 			return null;
@@ -1125,19 +1125,19 @@  discard block
 block discarded – undo
1125 1125
 			$shortcodes = array();
1126 1126
 
1127 1127
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1128
-			if ( empty( $matches ) ){
1128
+			if ( empty( $matches ) ) {
1129 1129
 				return false;
1130 1130
 			}
1131 1131
 
1132 1132
 			foreach ( $matches as $shortcode ) {
1133
-				if ( $tag === $shortcode[2] ) {
1133
+				if ( $tag === $shortcode[ 2 ] ) {
1134 1134
 
1135 1135
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1136
-					$shortcodes[] = $shortcode;
1136
+					$shortcodes[ ] = $shortcode;
1137 1137
 
1138
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1139
-					foreach( $results as $result ) {
1140
-						$shortcodes[] = $result;
1138
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1139
+					foreach ( $results as $result ) {
1140
+						$shortcodes[ ] = $result;
1141 1141
 					}
1142 1142
 				}
1143 1143
 			}
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			'post_type'      => 'gravityview',
1170 1170
 			'posts_per_page' => 100,
1171 1171
 			'meta_key'       => '_gravityview_form_id',
1172
-			'meta_value'     => (int) $form_id,
1172
+			'meta_value'     => (int)$form_id,
1173 1173
 		);
1174 1174
 		$args     = wp_parse_args( $args, $defaults );
1175 1175
 		$views    = get_posts( $args );
@@ -1181,21 +1181,21 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
 			$data = unserialize( $view->meta_value );
1183 1183
 
1184
-			if( ! $data || ! is_array( $data ) ) {
1184
+			if ( ! $data || ! is_array( $data ) ) {
1185 1185
 				continue;
1186 1186
 			}
1187 1187
 
1188 1188
 			foreach ( $data as $datum ) {
1189
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1190
-					$joined_forms[] = $view->post_id;
1189
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1190
+					$joined_forms[ ] = $view->post_id;
1191 1191
 				}
1192 1192
 			}
1193 1193
 		}
1194 1194
 
1195 1195
 		if ( $joined_forms ) {
1196
-			$joined_args  = array(
1196
+			$joined_args = array(
1197 1197
 				'post_type'      => 'gravityview',
1198
-				'posts_per_page' => $args['posts_per_page'],
1198
+				'posts_per_page' => $args[ 'posts_per_page' ],
1199 1199
 				'post__in'       => $joined_forms,
1200 1200
 			);
1201 1201
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1353 1353
 
1354
-		if( $json_decode ) {
1354
+		if ( $json_decode ) {
1355 1355
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1356 1356
 		}
1357 1357
 
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	 * @return string         html
1367 1367
 	 */
1368 1368
 	public static function get_sortable_fields( $formid, $current = '' ) {
1369
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default (Entry ID)', 'gravityview' ) .'</option>';
1369
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default (Entry ID)', 'gravityview' ) . '</option>';
1370 1370
 
1371 1371
 		if ( empty( $formid ) ) {
1372 1372
 			return $output;
@@ -1383,11 +1383,11 @@  discard block
 block discarded – undo
1383 1383
 			$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1384 1384
 
1385 1385
 			foreach ( $fields as $id => $field ) {
1386
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
1386
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1387 1387
 					continue;
1388 1388
 				}
1389 1389
 
1390
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1390
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1391 1391
 			}
1392 1392
 		}
1393 1393
 
@@ -1430,16 +1430,16 @@  discard block
 block discarded – undo
1430 1430
 		$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1431 1431
 
1432 1432
 		// TODO: Convert to using array_filter
1433
-		foreach( $fields as $id => $field ) {
1433
+		foreach ( $fields as $id => $field ) {
1434 1434
 
1435
-			if( in_array( $field['type'], $blocklist_field_types ) ) {
1435
+			if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1436 1436
 				unset( $fields[ $id ] );
1437 1437
 			}
1438 1438
 
1439 1439
 			/**
1440 1440
 			 * Merge date and time subfields.
1441 1441
 			 */
1442
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1442
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1443 1443
 				$fields[ intval( $id ) ] = array(
1444 1444
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1445 1445
 					'parent' => null,
@@ -1489,14 +1489,14 @@  discard block
 block discarded – undo
1489 1489
 	 * @param  int|array  $field field key or field array
1490 1490
 	 * @return boolean
1491 1491
 	 */
1492
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1492
+	public static function is_field_numeric( $form = null, $field = '' ) {
1493 1493
 
1494 1494
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1495 1495
 			$form = self::get_form( $form );
1496 1496
 		}
1497 1497
 
1498 1498
 		// If entry meta, it's a string. Otherwise, numeric
1499
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1499
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1500 1500
 			$type = $field;
1501 1501
 		} else {
1502 1502
 			$type = self::get_field_type( $form, $field );
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1511 1511
 
1512 1512
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1513
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1514
-			if( true === $gv_field->is_numeric ) {
1515
-				$numeric_types[] = $gv_field->is_numeric;
1513
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1514
+			if ( true === $gv_field->is_numeric ) {
1515
+				$numeric_types[ ] = $gv_field->is_numeric;
1516 1516
 			}
1517 1517
 		}
1518 1518
 
@@ -1663,18 +1663,18 @@  discard block
 block discarded – undo
1663 1663
 		$final_atts = array_filter( $final_atts );
1664 1664
 
1665 1665
 		// If the href wasn't passed as an attribute, use the value passed to the function
1666
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1667
-			$final_atts['href'] = $href;
1666
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1667
+			$final_atts[ 'href' ] = $href;
1668 1668
 		}
1669 1669
 
1670
-		$final_atts['href'] = esc_url_raw( $final_atts['href'] );
1670
+		$final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] );
1671 1671
 
1672 1672
 		/**
1673 1673
 		 * Fix potential security issue with target=_blank
1674 1674
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1675 1675
 		 */
1676
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1677
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1676
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1677
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1678 1678
 		}
1679 1679
 
1680 1680
 		// Sort the attributes alphabetically, to help testing
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1687 1687
 		}
1688 1688
 
1689
-		if( '' !== $output ) {
1689
+		if ( '' !== $output ) {
1690 1690
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1691 1691
 		}
1692 1692
 
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1714 1714
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1715 1715
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1716
-				$merged[] = $value;
1716
+				$merged[ ] = $value;
1717 1717
 			} else {
1718 1718
 				$merged[ $key ] = $value;
1719 1719
 			}
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1747 1747
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1748 1748
 		 */
1749
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1749
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1750 1750
 
1751 1751
 		return get_users( $get_users_settings );
1752 1752
 	}
@@ -1766,11 +1766,11 @@  discard block
 block discarded – undo
1766 1766
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1767 1767
 
1768 1768
     	// If $cap is defined, only show notice if user has capability
1769
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1769
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1770 1770
     		return '';
1771 1771
 	    }
1772 1772
 
1773
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1773
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1774 1774
     }
1775 1775
 
1776 1776
 	/**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
28 28
 
29
-		unset( $field_options['search_filter'] );
29
+		unset( $field_options[ 'search_filter' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$add_options['link_to_file'] = array(
35
+		$add_options[ 'link_to_file' ] = array(
36 36
 			'type' => 'checkbox',
37 37
 			'label' => __( 'Display as a Link:', 'gravityview' ),
38
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
38
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
39 39
 			'value' => false,
40 40
 			'merge_tags' => false,
41 41
 		);
42 42
 
43
-		$add_options['image_width'] = array(
43
+		$add_options[ 'image_width' ] = array(
44 44
 			'type' => 'text',
45 45
 			'label' => __( 'Custom Width:', 'gravityview' ),
46 46
 			'desc' => __( 'Override the default image width (250).', 'gravityview' ),
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 			$base_id = null;
159 159
 
160 160
 			$is_single = gravityview_get_context() === 'single';
161
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
161
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
162 162
 			$field_compat = $gravityview_view->getCurrentField();
163 163
 		}
164 164
 
165 165
 		$output_arr = array();
166 166
 
167 167
 		// Get an array of file paths for the field.
168
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
168
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
169 169
 
170 170
 		// The $value JSON was probably truncated; let's check lead_detail_long.
171 171
 		if ( ! is_array( $file_paths ) ) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			$rendered = null;
186 186
 
187 187
 			// If the site is HTTPS, use HTTPS
188
-			if ( function_exists('set_url_scheme') ) {
188
+			if ( function_exists( 'set_url_scheme' ) ) {
189 189
 				$file_path = set_url_scheme( $file_path );
190 190
 			}
191 191
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			$file_path_info = pathinfo( $file_path );
197 197
 
198 198
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
199
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
199
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
200 200
 
201 201
 			/**
202 202
 			 * @filter `gravityview/fields/fileupload/extension` Modify the file extension before it's used in display logic
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			$extension = apply_filters( 'gravityview/fields/fileupload/extension', $extension, $file_path );
208 208
 
209
-			$basename = $file_path_info['basename'];
209
+			$basename = $file_path_info[ 'basename' ];
210 210
 
211 211
 			// Get the secure download URL
212 212
 			$is_secure = false;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 					 */
247 247
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
248 248
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
249
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
249
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
250 250
 					), $context );
251 251
 
252 252
 					/**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 					 */
276 276
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
277 277
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
278
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
278
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
279 279
 					), $context );
280 280
 
281 281
 					/**
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
 					$file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path );
300 300
 				}
301 301
 
302
-				$field_settings['link_to_file'] = true;
302
+				$field_settings[ 'link_to_file' ] = true;
303 303
 
304 304
 			// Images
305 305
 			} else if ( in_array( $extension, GravityView_Image::get_image_extensions() ) ) {
306 306
 				$width = \GV\Utils::get( $field_settings, 'image_width', 250 );
307 307
 				$image_atts = array(
308 308
 					'src'   => $file_path,
309
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
310
-					'alt'   => $field_settings['label'],
311
-					'width' => ( $is_single ? null : ( $width ? $width: 250 ) )
309
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
310
+					'alt'   => $field_settings[ 'label' ],
311
+					'width' => ( $is_single ? null : ( $width ? $width : 250 ) )
312 312
 				);
313 313
 
314 314
 				if ( $is_secure ) {
315
-					$image_atts['validate_src'] = false;
315
+					$image_atts[ 'validate_src' ] = false;
316 316
 				}
317 317
 
318 318
 				/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 				unset( $gv_entry );
335 335
 
336
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
336
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
337 337
 
338 338
 					$lightbox_link_atts = array(
339 339
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 				}
349 349
 
350 350
 				// Show as link should render the image regardless.
351
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
351
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
352 352
 					$text = $rendered;
353 353
 				}
354 354
 			}
355 355
 			// For all other non-media file types (ZIP, for example), always show as a link regardless of setting.
356 356
 			else {
357
-				$field_settings['link_to_file'] = true;
357
+				$field_settings[ 'link_to_file' ] = true;
358 358
 				$disable_lightbox = true;
359 359
 			}
360 360
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
371 371
 
372 372
 			// Output textualized content where
373
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
373
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
374 374
 				/**
375 375
 				 * Modify the link text (defaults to the file name)
376 376
 				 *
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 				 */
384 384
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
385 385
 
386
-				if ( empty( $field_settings['show_as_link'] ) ) {
386
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
387 387
 					/**
388 388
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
389 389
 					 * @since 2.0 Added $context
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				$content = empty( $rendered ) ? $text : $rendered;
405 405
 			}
406 406
 
407
-			$output_arr[] = array(
407
+			$output_arr[ ] = array(
408 408
 				'file_path' => $file_path,
409 409
 				'content' => $content
410 410
 			);
Please login to merge, or discard this patch.
includes/class-gravityview-image.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$atts = wp_parse_args( $atts, $defaults );
67 67
 
68
-		foreach( $atts as $key => $val ) {
68
+		foreach ( $atts as $key => $val ) {
69 69
 			$this->{$key} = $val;
70 70
 		}
71 71
 
72
-		$this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
72
+		$this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
73 73
 
74 74
 		$this->set_image_size();
75 75
 
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function validate_image_src() {
87 87
 
88
-		if ( !$this->validate_src ) { return true; }
88
+		if ( ! $this->validate_src ) { return true; }
89 89
 
90 90
 		$info = pathinfo( $this->src );
91 91
 
92 92
 		$image_exts = self::get_image_extensions();
93 93
 
94
-		return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts);
94
+		return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts );
95 95
 	}
96 96
 
97 97
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		 */
110 110
 		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp' ) );
111 111
 
112
-		return (array) $image_exts;
112
+		return (array)$image_exts;
113 113
 	}
114 114
 
115 115
 	/**
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 
126 126
 			// And there is no string size passed
127 127
 			// 		And we want to get the image size using PHP
128
-			if ( empty( $string ) && !empty( $this->getimagesize ) ) {
128
+			if ( empty( $string ) && ! empty( $this->getimagesize ) ) {
129 129
 
130 130
 				$image_size = @getimagesize( $this->src );
131 131
 
132 132
 				// If it didn't return a response, it may be a HTTPS/SSL error
133
-				if ( empty( $image_size[0] ) ) {
133
+				if ( empty( $image_size[ 0 ] ) ) {
134 134
 					$image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) );
135 135
 				}
136 136
 
137
-				if ( !empty( $image_size ) ) {
137
+				if ( ! empty( $image_size ) ) {
138 138
 					list( $width, $height ) = $image_size;
139 139
 				}
140 140
 
@@ -147,33 +147,33 @@  discard block
 block discarded – undo
147 147
 				 * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels
148 148
 				 */
149 149
 				$image_sizes = apply_filters( 'gravityview_image_sizes', array(
150
-					'tiny' => array('width' => 40, 'height' => 30),
151
-					'small' => array('width' => 100, 'height' => 75),
152
-					'medium' => array('width' => 250, 'height' => 188),
153
-					'large' => array('width' => 448, 'height' => 336),
150
+					'tiny' => array( 'width' => 40, 'height' => 30 ),
151
+					'small' => array( 'width' => 100, 'height' => 75 ),
152
+					'medium' => array( 'width' => 250, 'height' => 188 ),
153
+					'large' => array( 'width' => 448, 'height' => 336 ),
154 154
 				) );
155 155
 
156
-				switch( $this->size ) {
156
+				switch ( $this->size ) {
157 157
 					case 'tiny':
158
-						extract($image_sizes['tiny']);
158
+						extract( $image_sizes[ 'tiny' ] );
159 159
 						break;
160 160
 					case 'small':
161 161
 					case 's':
162 162
 					case 'thumb':
163
-						extract($image_sizes['small']);
163
+						extract( $image_sizes[ 'small' ] );
164 164
 						break;
165 165
 					case 'm':
166 166
 					case 'medium':
167
-						extract($image_sizes['medium']);
167
+						extract( $image_sizes[ 'medium' ] );
168 168
 						break;
169 169
 					case 'large':
170 170
 					case 'l':
171
-						extract($image_sizes['large']);
171
+						extract( $image_sizes[ 'large' ] );
172 172
 						break;
173 173
 					default:
174 174
 						// Verify that the passed sizes are integers.
175
-						$width = !empty( $width ) ? intval( $width ) : intval( $this->width );
176
-						$height = !empty( $height ) ? intval( $height ) : intval( $this->height );
175
+						$width = ! empty( $width ) ? intval( $width ) : intval( $this->width );
176
+						$height = ! empty( $height ) ? intval( $height ) : intval( $this->height );
177 177
 				}
178 178
 
179 179
 			}
Please login to merge, or discard this patch.