Completed
Pull Request — develop (#1800)
by Zack
31:41 queued 11:38
created
includes/class-gravityview-entry-approval-status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 		$new_value = $old_value;
115 115
 
116 116
 		// Meta value does not exist yet
117
-		if( false === $old_value ) {
117
+		if ( false === $old_value ) {
118 118
 			return self::UNAPPROVED;
119 119
 		}
120 120
 
121 121
 		// Meta value does not exist yet
122
-		if( true === $old_value ) {
122
+		if ( true === $old_value ) {
123 123
 			return self::APPROVED;
124 124
 		}
125 125
 
126
-		switch ( (string) $old_value ) {
126
+		switch ( (string)$old_value ) {
127 127
 
128 128
 			// Approved values
129 129
 			case 'Approved':
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 		foreach ( $choices as $key => $choice ) {
250 250
 
251 251
 			// Is the passed status value the same as the choice value or key?
252
-			if ( $status === $choice['value'] || $status === $key ) {
253
-				if( 'key' === $attr_key ) {
252
+			if ( $status === $choice[ 'value' ] || $status === $key ) {
253
+				if ( 'key' === $attr_key ) {
254 254
 					return $key;
255 255
 				} else {
256 256
 					return \GV\Utils::get( $choice, $attr_key, false );
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval-merge-tags.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 		$global_default = gravityview()->plugin->settings->get( 'public_entry_moderation', '0' );
79 79
 
80
-		$fields['restrictions']['fields'][] = array(
80
+		$fields[ 'restrictions' ][ 'fields' ][ ] = array(
81 81
 			'name'          => self::FORM_SETTINGS_KEY,
82 82
 			'type'          => 'radio',
83 83
 			'horizontal'    => true,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					'value' => '0',
95 95
 				),
96 96
 			),
97
-			'default_value' => (string) $global_default,
97
+			'default_value' => (string)$global_default,
98 98
 		);
99 99
 
100 100
 		return $fields;
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
 		foreach ( $matches as $match ) {
183 183
 
184
-			$full_tag         = $match[0];
185
-			$action           = $match[1];
186
-			$expiration_value = ! empty( $match[2] ) ? (int) $match[2] : self::DEFAULT_EXPIRATION_VALUE;
187
-			$expiration_unit  = ! empty( $match[3] ) ? $match[3] : self::DEFAULT_EXPIRATION_UNIT;
188
-			$privacy          = isset( $match[4] ) ? $match[4] : 'private';
184
+			$full_tag         = $match[ 0 ];
185
+			$action           = $match[ 1 ];
186
+			$expiration_value = ! empty( $match[ 2 ] ) ? (int)$match[ 2 ] : self::DEFAULT_EXPIRATION_VALUE;
187
+			$expiration_unit  = ! empty( $match[ 3 ] ) ? $match[ 3 ] : self::DEFAULT_EXPIRATION_UNIT;
188
+			$privacy          = isset( $match[ 4 ] ) ? $match[ 4 ] : 'private';
189 189
 
190 190
 			switch ( $expiration_unit ) {
191 191
 				case 'd':
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 					break;
204 204
 			}
205 205
 
206
-			if ( false === (bool) \GV\Utils::get( $form, self::FORM_SETTINGS_KEY, false ) ) {
206
+			if ( false === (bool)\GV\Utils::get( $form, self::FORM_SETTINGS_KEY, false ) ) {
207 207
 				$privacy = 'private';
208 208
 			}
209 209
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function get_token( $action = false, $expiration_timestamp = 0, $privacy = 'private', $entry = array() ) {
244 244
 
245
-		if ( ! $action || ! $entry['id'] ) {
245
+		if ( ! $action || ! $entry[ 'id' ] ) {
246 246
 			return false;
247 247
 		}
248 248
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$expiration_seconds = $expiration_timestamp - time();
265 265
 
266 266
 		$scopes = array(
267
-			'entry_id'           => $entry['id'],
267
+			'entry_id'           => $entry[ 'id' ],
268 268
 			'approval_status'    => $approval_status,
269 269
 			'expiration_seconds' => $expiration_seconds,
270 270
 			'privacy'            => $privacy,
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 			$query_args[ self::TOKEN_URL_ARG ] = $token;
338 338
 		}
339 339
 
340
-		if ( 'private' === $privacy && DAY_IN_SECONDS >= (int) $expiration_seconds ) {
341
-			$query_args['nonce'] = wp_create_nonce( self::TOKEN_URL_ARG );
340
+		if ( 'private' === $privacy && DAY_IN_SECONDS >= (int)$expiration_seconds ) {
341
+			$query_args[ 'nonce' ] = wp_create_nonce( self::TOKEN_URL_ARG );
342 342
 		}
343 343
 
344 344
 		return add_query_arg( $query_args, $base_url );
@@ -394,10 +394,10 @@  discard block
 block discarded – undo
394 394
 			wp_die( sprintf( __( 'Entry moderation failed: %s', 'gravityview' ), $is_request_valid->get_error_message() ) );
395 395
 		}
396 396
 
397
-		$scopes = $token['scopes'];
397
+		$scopes = $token[ 'scopes' ];
398 398
 
399
-		$entry_id        = $scopes['entry_id'];
400
-		$approval_status = $scopes['approval_status'];
399
+		$entry_id        = $scopes[ 'entry_id' ];
400
+		$approval_status = $scopes[ 'approval_status' ];
401 401
 
402 402
 		$entry = GFAPI::get_entry( $entry_id );
403 403
 
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 			wp_die( $entry->get_error_message() );
408 408
 		}
409 409
 
410
-		$form_id = $entry['form_id'];
410
+		$form_id = $entry[ 'form_id' ];
411 411
 
412
-		if ( 'private' === $scopes['privacy'] ) {
412
+		if ( 'private' === $scopes[ 'privacy' ] ) {
413 413
 			$return_url = admin_url( '/admin.php?page=gf_entries&s=' . $entry_id . '&field_id=entry_id&operator=is&id=' . $form_id );
414 414
 		} else {
415 415
 			$return_url = home_url( '/' );
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			exit;
435 435
 		}
436 436
 
437
-		if ( 'private' === $scopes['privacy'] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) {
437
+		if ( 'private' === $scopes[ 'privacy' ] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) {
438 438
 
439 439
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
440 440
 
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	protected function is_request_valid( $token ) {
459 459
 
460
-		if ( 'private' === $token['scopes']['privacy'] && ! is_user_logged_in() ) {
460
+		if ( 'private' === $token[ 'scopes' ][ 'privacy' ] && ! is_user_logged_in() ) {
461 461
 			return new WP_Error( 'user_not_logged_in', __( 'You are not allowed to perform this operation.', 'gravityview' ) );
462 462
 		}
463 463
 
464
-		if ( $token['exp'] < time() ) {
464
+		if ( $token[ 'exp' ] < time() ) {
465 465
 			gravityview()->log->error( 'The entry moderation link expired.', array( 'data' => $is_valid_token ) );
466 466
 
467 467
 			return new WP_Error( 'link_expired', esc_html__( 'The link has expired.', 'gk-gravityview' ) );
468 468
 		}
469 469
 
470 470
 		// Since nonces are only valid for 24 hours, we only check the nonce if the token is valid for less than 24 hours.
471
-		if ( 'private' === $token['scopes']['privacy'] && DAY_IN_SECONDS >= $token['scopes']['expiration_seconds'] ) {
471
+		if ( 'private' === $token[ 'scopes' ][ 'privacy' ] && DAY_IN_SECONDS >= $token[ 'scopes' ][ 'expiration_seconds' ] ) {
472 472
 
473
-			if ( ! isset( $_REQUEST['nonce'] ) ) {
473
+			if ( ! isset( $_REQUEST[ 'nonce' ] ) ) {
474 474
 				gravityview()->log->error( 'Entry moderation failed: No nonce was set for entry approval.' );
475 475
 
476 476
 				return new WP_Error( 'missing_nonce', esc_html__( 'The link is invalid.', 'gk-gravityview' ) );
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			return;
512 512
 		}
513 513
 
514
-		$approval_label = GravityView_Entry_Approval_Status::get_label( (int) $approval_status );
514
+		$approval_label = GravityView_Entry_Approval_Status::get_label( (int)$approval_status );
515 515
 		$approval_label = mb_strtolower( $approval_label );
516 516
 
517 517
 		if ( 'success' === $result ) {
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 		);
632 632
 
633 633
 		foreach ( $required_scopes as $required_scope ) {
634
-			if ( ! isset( $token['scopes'][ $required_scope ] ) ) {
634
+			if ( ! isset( $token[ 'scopes' ][ $required_scope ] ) ) {
635 635
 				return new WP_Error( 'approve_link_no_' . $required_scope . '_scope', esc_html__( 'The link is invalid.', 'gk-gravityview' ) );
636 636
 			}
637 637
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-settings-plugin.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @var array
32 32
 	 */
33
-	private $_plugin_settings = [];
33
+	private $_plugin_settings = [ ];
34 34
 
35 35
 	public function __construct() {
36 36
 		// GravityKitFoundation may not yet be available when this class is instantiated, so let's temporarily use the Settings framework from Foundation that's included with GravityView and then possibly replace it with the latest version.
37 37
 		$this->_foundation_settings = SettingsFramework::get_instance();
38 38
 
39
-		add_action( 'gk/foundation/initialized', function () {
39
+		add_action( 'gk/foundation/initialized', function() {
40 40
 			$this->_foundation_settings = GravityKitFoundation::settings();
41 41
 		} );
42 42
 
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 
134 134
 		if ( empty( $legacy_settings ) ) {
135
-			return [];
135
+			return [ ];
136 136
 		}
137 137
 
138 138
 		// Migrate legacy GravityView settings that are still part of GravityView.
139 139
 		$plugin_settings = [
140
-			'rest_api' => (int) Arr::get( $legacy_settings, 'rest_api' ),
140
+			'rest_api' => (int)Arr::get( $legacy_settings, 'rest_api' ),
141 141
 		];
142 142
 
143 143
 		$this->_foundation_settings->save_plugin_settings( self::SETTINGS_PLUGIN_ID, $plugin_settings );
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 			$gk_settings = [
154 154
 				'support_email'    => Arr::get( $legacy_settings, 'support-email' ),
155 155
 				'support_port'     => Arr::get( $legacy_settings, 'support_port' ),
156
-				'powered_by'       => (int) Arr::get( $legacy_settings, 'powered_by' ),
156
+				'powered_by'       => (int)Arr::get( $legacy_settings, 'powered_by' ),
157 157
 				'affiliate_id'     => Arr::get( $legacy_settings, 'affiliate_id' ),
158
-				'beta'             => (int) Arr::get( $legacy_settings, 'beta' ),
158
+				'beta'             => (int)Arr::get( $legacy_settings, 'beta' ),
159 159
 				'support_email'    => Arr::get( $legacy_settings, 'support-email' ),
160
-				'support_port'     => (int) Arr::get( $legacy_settings, 'support_port' ),
161
-				'no_conflict_mode' => (int) Arr::get( $legacy_settings, 'no-conflict-mode' ),
160
+				'support_port'     => (int)Arr::get( $legacy_settings, 'support_port' ),
161
+				'no_conflict_mode' => (int)Arr::get( $legacy_settings, 'no-conflict-mode' ),
162 162
 			];
163 163
 
164 164
 			$this->_foundation_settings->save_plugin_settings( $gk_settings_id, $gk_settings );
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 							'type'        => 'checkbox',
240 240
 							'title'       => esc_html__( 'REST API', 'gk-gravityview' ),
241 241
 							'description' => esc_html__( 'Enable View and Entry access via the REST API? Regular per-View restrictions apply (private, password protected, etc.).', 'gk-gravityview' ) . ' ' . esc_html__( 'If you are unsure, disable this setting.', 'gk-gravityview' ),
242
-							'value'       => $this->get( 'rest_api', $default_settings['rest_api'] ),
242
+							'value'       => $this->get( 'rest_api', $default_settings[ 'rest_api' ] ),
243 243
 						],
244 244
 					],
245 245
 				],
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 									'{/link}' => '<span class="screen-reader-text"> ' . esc_html__( '(This link opens in a new window.)', 'gk-gravitycalendar' ) . '</span></a>',
260 260
 								)
261 261
 							),
262
-							'value'       => $this->get( 'public_entry_moderation', $default_settings['public_entry_moderation'] ),
262
+							'value'       => $this->get( 'public_entry_moderation', $default_settings[ 'public_entry_moderation' ] ),
263 263
 						],
264 264
 					],
265 265
 				],
266 266
 			],
267 267
 		];
268 268
 
269
-		return array_merge( (array) $plugins_data, [ self::SETTINGS_PLUGIN_ID => $settings ] );
269
+		return array_merge( (array)$plugins_data, [ self::SETTINGS_PLUGIN_ID => $settings ] );
270 270
 	}
271 271
 
272 272
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function maybe_save_app_settings() {
329 329
 		if ( $this->is_save_postback() ) {
330 330
 			if ( ! \GVCommon::has_cap( 'gravityview_edit_settings' ) ) {
331
-				$_POST = []; // If you don't reset the $_POST array, it *looks* like the settings were changed, but they weren't
331
+				$_POST = [ ]; // If you don't reset the $_POST array, it *looks* like the settings were changed, but they weren't
332 332
 				\GFCommon::add_error_message( __( 'You don\'t have the ability to edit plugin settings.', 'gk-gravityview' ) );
333 333
 
334 334
 				return;
Please login to merge, or discard this patch.
includes/class-common.php 2 patches
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$form = false;
146 146
 
147
-		if( $entry ) {
148
-			$form = GFAPI::get_form( $entry['form_id'] );
147
+		if ( $entry ) {
148
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
149 149
 		}
150 150
 
151 151
 		return $form;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			}
222 222
 		}
223 223
 
224
-		return (bool) $has_transaction_data;
224
+		return (bool)$has_transaction_data;
225 225
 	}
226 226
 
227 227
 	/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
261 261
 
262
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
262
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
263 263
 
264 264
 		return $result;
265 265
 	}
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
281 281
 	 */
282
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
282
+	public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
283 283
 		$forms = array();
284 284
 		if ( ! class_exists( 'GFAPI' ) ) {
285 285
 			return array();
286 286
 		}
287 287
 
288
-		if( 'any' === $active ) {
288
+		if ( 'any' === $active ) {
289 289
 			$active_forms = GFAPI::get_forms( true, $trash );
290 290
 			$inactive_forms = GFAPI::get_forms( false, $trash );
291 291
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 		$has_post_fields = false;
318 318
 
319 319
 		if ( $form ) {
320
-			foreach ( $form['fields'] as $field ) {
321
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
322
-					$fields["{$field['id']}"] = array(
320
+			foreach ( $form[ 'fields' ] as $field ) {
321
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
322
+					$fields[ "{$field[ 'id' ]}" ] = array(
323 323
 						'label' => \GV\Utils::get( $field, 'label' ),
324 324
 						'parent' => null,
325 325
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 					);
329 329
 				}
330 330
 
331
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
332
-					foreach ( $field['inputs'] as $input ) {
331
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
332
+					foreach ( $field[ 'inputs' ] as $input ) {
333 333
 
334
-						if( ! empty( $input['isHidden'] ) ) {
334
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
335 335
 							continue;
336 336
 						}
337 337
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
                          * @hack
340 340
                          * In case of email/email confirmation, the input for email has the same id as the parent field
341 341
                          */
342
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
342
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
343 343
                             continue;
344 344
                         }
345
-						$fields["{$input['id']}"] = array(
345
+						$fields[ "{$input[ 'id' ]}" ] = array(
346 346
 							'label' => \GV\Utils::get( $input, 'label' ),
347 347
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
348 348
 							'parent' => $field,
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 
356 356
 
357
-				if( GFCommon::is_product_field( $field['type'] ) ){
357
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
358 358
 					$has_product_fields = true;
359 359
 				}
360 360
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		 * @since 1.7
369 369
 		 */
370 370
 		if ( $has_post_fields ) {
371
-			$fields['post_id'] = array(
371
+			$fields[ 'post_id' ] = array(
372 372
 				'label' => __( 'Post ID', 'gk-gravityview' ),
373 373
 				'type' => 'post_id',
374 374
 			);
@@ -381,11 +381,11 @@  discard block
 block discarded – undo
381 381
 			foreach ( $payment_fields as $payment_field ) {
382 382
 
383 383
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
384
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
384
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
385 385
 					continue;
386 386
 				}
387 387
 
388
-				$fields["{$payment_field->name}"] = array(
388
+				$fields[ "{$payment_field->name}" ] = array(
389 389
 					'label' => $payment_field->label,
390 390
 					'desc' => $payment_field->description,
391 391
 					'type' => $payment_field->name,
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 
418 418
 		$fields = array();
419 419
 
420
-		foreach ( $extra_fields as $key => $field ){
421
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
422
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
420
+		foreach ( $extra_fields as $key => $field ) {
421
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
422
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
423 423
 			}
424 424
 		}
425 425
 
@@ -459,33 +459,33 @@  discard block
 block discarded – undo
459 459
 			'search_criteria' => null,
460 460
 			'sorting' => null,
461 461
 			'paging' => null,
462
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
462
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
463 463
 			'context_view_id' => null,
464 464
 		);
465 465
 
466 466
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
467 467
 
468
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
469
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
468
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
469
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
470 470
 
471 471
 				if ( ! is_array( $filter ) ) {
472 472
 					continue;
473 473
 				}
474 474
 
475 475
 				// By default, we want searches to be wildcard for each field.
476
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
476
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
477 477
 
478 478
 				/**
479 479
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
480 480
 				 * @param string $operator Existing search operator
481 481
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
482 482
 				 */
483
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
483
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
484 484
 			}
485 485
 
486 486
 			// don't send just the [mode] without any field filter.
487
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
488
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
487
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
488
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
489 489
 			}
490 490
 
491 491
 		}
@@ -496,33 +496,33 @@  discard block
 block discarded – undo
496 496
 		 * Prepare date formats to be in Gravity Forms DB format;
497 497
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
498 498
 		 */
499
-		foreach ( array('start_date', 'end_date' ) as $key ) {
499
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
500 500
 
501
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
501
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
502 502
 
503 503
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
504
-				$date = date_create( $criteria['search_criteria'][ $key ] );
504
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
505 505
 
506 506
 				if ( $date ) {
507 507
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
508
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
508
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
509 509
 				} else {
510
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
510
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
511 511
 
512 512
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
513
-					unset( $criteria['search_criteria'][ $key ] );
513
+					unset( $criteria[ 'search_criteria' ][ $key ] );
514 514
 				}
515 515
 			}
516 516
 		}
517 517
 
518
-		if ( empty( $criteria['context_view_id'] ) ) {
518
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
519 519
 			// Calculate the context view id and send it to the advanced filter
520 520
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
521
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
521
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
522 522
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
523
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
523
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
524 524
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
525
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
525
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
526 526
 			}
527 527
 		}
528 528
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 * @param array $form_ids Forms to search
533 533
 		 * @param int $view_id ID of the view being used to search
534 534
 		 */
535
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
535
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
536 536
 
537 537
 		return (array)$criteria;
538 538
 	}
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		/** Reduce # of database calls */
567 567
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
568 568
 
569
-		if ( ! empty( $criteria['cache'] ) ) {
569
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
570 570
 
571 571
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
572 572
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
 				// Still update the total count when using cached results
576 576
 				if ( ! is_null( $total ) ) {
577
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
577
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
578 578
 				}
579 579
 
580 580
 				$return = $entries;
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
597 597
 
598 598
 			// No entries returned from gravityview_before_get_entries
599
-			if( is_null( $entries ) ) {
599
+			if ( is_null( $entries ) ) {
600 600
 
601
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
601
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
602 602
 
603 603
 				if ( is_wp_error( $entries ) ) {
604 604
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 				}
610 610
 			}
611 611
 
612
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
612
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
613 613
 
614 614
 				// Cache results
615 615
 				$Cache->set( $entries, 'entries' );
@@ -726,18 +726,18 @@  discard block
 block discarded – undo
726 726
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view );
727 727
 
728 728
 		// Is the entry allowed
729
-		if( $check_entry_display ) {
729
+		if ( $check_entry_display ) {
730 730
 
731 731
 			$gvid = \GV\Utils::_GET( 'gvid' );
732 732
 
733
-			if( $gvid ) {
733
+			if ( $gvid ) {
734 734
 				$view = \GV\View::by_id( $gvid );
735 735
 			}
736 736
 
737 737
 			$entry = self::check_entry_display( $entry, $view );
738 738
 		}
739 739
 
740
-		if( is_wp_error( $entry ) ) {
740
+		if ( is_wp_error( $entry ) ) {
741 741
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
742 742
 			return false;
743 743
 		}
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
 
772 772
 		$value = false;
773 773
 
774
-		if( 'context' === $val1 ) {
774
+		if ( 'context' === $val1 ) {
775 775
 
776 776
 			$matching_contexts = array( $val2 );
777 777
 
778 778
 			// We allow for non-standard contexts.
779
-			switch( $val2 ) {
779
+			switch ( $val2 ) {
780 780
 				// Check for either single or edit
781 781
 				case 'singular':
782 782
 					$matching_contexts = array( 'single', 'edit' );
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 
797 797
 		// If both are timestamps, cast to string so we can use the > and < comparisons below.
798 798
 		if ( $timestamp_1 && $timestamp_2 ) {
799
-			$val1 = (string) $timestamp_1;
800
-			$val2 = (string) $timestamp_2;
799
+			$val1 = (string)$timestamp_1;
800
+			$val2 = (string)$timestamp_2;
801 801
 		}
802 802
 
803 803
 		switch ( $operation ) {
@@ -829,18 +829,18 @@  discard block
 block discarded – undo
829 829
 				$json_val_1 = json_decode( $val1, true );
830 830
 				$json_val_2 = json_decode( $val2, true );
831 831
 
832
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
832
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
833 833
 
834 834
 					$json_in = false;
835
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
836
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
835
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
836
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
837 837
 
838 838
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
839 839
 					foreach ( $json_val_1 as $item_1 ) {
840 840
 						foreach ( $json_val_2 as $item_2 ) {
841 841
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
842 842
 
843
-							if( $json_in ) {
843
+							if ( $json_in ) {
844 844
 								break 2;
845 845
 							}
846 846
 						}
@@ -891,10 +891,10 @@  discard block
 block discarded – undo
891 891
 	public static function check_entry_display( $entry, $view = null ) {
892 892
 
893 893
 		if ( ! $entry || is_wp_error( $entry ) ) {
894
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
894
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
895 895
 		}
896 896
 
897
-		if ( empty( $entry['form_id'] ) ) {
897
+		if ( empty( $entry[ 'form_id' ] ) ) {
898 898
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
899 899
 		}
900 900
 
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 
910 910
 		$_gvid = \GV\Utils::_GET( 'gvid' );
911 911
 
912
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
912
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
913 913
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
914 914
 		}
915 915
 
916 916
 		$view_form_id = $view->form->ID;
917 917
 
918 918
 		if ( $view->joins ) {
919
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
920
-				$view_form_id = $entry['form_id'];
919
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
920
+				$view_form_id = $entry[ 'form_id' ];
921 921
 			}
922 922
 		}
923 923
 
924
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
924
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
925 925
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
926 926
 		}
927 927
 
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 		 * Check whether the entry is in the entries subset by running a modified query.
930 930
 		 */
931 931
 		add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) {
932
-			$_tmp_query       = new \GF_Query( $view_form_id, array(
932
+			$_tmp_query = new \GF_Query( $view_form_id, array(
933 933
 				'field_filters' => array(
934 934
 					'mode' => 'all',
935 935
 					array(
936 936
 						'key' => 'id',
937 937
 						'operation' => 'is',
938
-						'value' => $entry['id']
938
+						'value' => $entry[ 'id' ]
939 939
 					)
940 940
 				)
941 941
 			) );
@@ -945,14 +945,14 @@  discard block
 block discarded – undo
945 945
 			/** @type \GF_Query $query */
946 946
 			$query_parts      = $query->_introspect();
947 947
 
948
-			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
948
+			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
949 949
 
950 950
 		}, 10, 3 );
951 951
 
952 952
 		// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
953 953
 		add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
954 954
 
955
-			$criteria['paging'] = array(
955
+			$criteria[ 'paging' ] = array(
956 956
 				'offset' => 0,
957 957
 				'page_size' => 25
958 958
 			);
@@ -971,20 +971,20 @@  discard block
 block discarded – undo
971 971
 		}
972 972
 
973 973
 		// This entry is on a View with joins
974
-		if ( $entries[0]->is_multi() ) {
974
+		if ( $entries[ 0 ]->is_multi() ) {
975 975
 
976 976
 			$multi_entry_ids = array();
977 977
 
978
-			foreach ( $entries[0]->entries as $multi_entry ) {
979
-				$multi_entry_ids[] = (int) $multi_entry->ID;
978
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
979
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
980 980
 			}
981 981
 
982
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
982
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
983 983
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
984 984
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
985 985
 			}
986 986
 
987
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
987
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
988 988
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
989 989
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
990 990
 		}
@@ -1029,18 +1029,18 @@  discard block
 block discarded – undo
1029 1029
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1030 1030
 		 * @see GFCommon::format_date() for original code
1031 1031
 		 */
1032
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1032
+		$date_gmt_time = mysql2date( 'G', $date_string );
1033 1033
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1034 1034
 
1035
-		$format  = \GV\Utils::get( $atts, 'format' );
1036
-		$is_human  = ! empty( $atts['human'] );
1037
-		$is_diff  = ! empty( $atts['diff'] );
1038
-		$is_raw = ! empty( $atts['raw'] );
1039
-		$is_timestamp = ! empty( $atts['timestamp'] );
1040
-		$include_time = ! empty( $atts['time'] );
1035
+		$format = \GV\Utils::get( $atts, 'format' );
1036
+		$is_human = ! empty( $atts[ 'human' ] );
1037
+		$is_diff = ! empty( $atts[ 'diff' ] );
1038
+		$is_raw = ! empty( $atts[ 'raw' ] );
1039
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1040
+		$include_time = ! empty( $atts[ 'time' ] );
1041 1041
 
1042 1042
 		// If we're using time diff, we want to have a different default format
1043
-		if( empty( $format ) ) {
1043
+		if ( empty( $format ) ) {
1044 1044
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1045 1045
 			$format = $is_diff ? esc_html__( '%s ago', 'gk-gravityview' ) : get_option( 'date_format' );
1046 1046
 		}
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 		// If raw was specified, don't modify the stored value
1049 1049
 		if ( $is_raw ) {
1050 1050
 			$formatted_date = $date_string;
1051
-		} elseif( $is_timestamp ) {
1051
+		} elseif ( $is_timestamp ) {
1052 1052
 			$formatted_date = $date_local_timestamp;
1053 1053
 		} elseif ( $is_diff ) {
1054 1054
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
 		$label = \GV\Utils::get( $field, 'label' );
1083 1083
 
1084
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1084
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1085 1085
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1086 1086
 		}
1087 1087
 
@@ -1149,19 +1149,19 @@  discard block
 block discarded – undo
1149 1149
 			$shortcodes = array();
1150 1150
 
1151 1151
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1152
-			if ( empty( $matches ) ){
1152
+			if ( empty( $matches ) ) {
1153 1153
 				return false;
1154 1154
 			}
1155 1155
 
1156 1156
 			foreach ( $matches as $shortcode ) {
1157
-				if ( $tag === $shortcode[2] ) {
1157
+				if ( $tag === $shortcode[ 2 ] ) {
1158 1158
 
1159 1159
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1160
-					$shortcodes[] = $shortcode;
1160
+					$shortcodes[ ] = $shortcode;
1161 1161
 
1162
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1163
-					foreach( $results as $result ) {
1164
-						$shortcodes[] = $result;
1162
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1163
+					foreach ( $results as $result ) {
1164
+						$shortcodes[ ] = $result;
1165 1165
 					}
1166 1166
 				}
1167 1167
 			}
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 			'post_type'      => 'gravityview',
1194 1194
 			'posts_per_page' => 100,
1195 1195
 			'meta_key'       => '_gravityview_form_id',
1196
-			'meta_value'     => (int) $form_id,
1196
+			'meta_value'     => (int)$form_id,
1197 1197
 		);
1198 1198
 		$args     = wp_parse_args( $args, $defaults );
1199 1199
 		$views    = get_posts( $args );
@@ -1205,21 +1205,21 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 			$data = unserialize( $view->meta_value );
1207 1207
 
1208
-			if( ! $data || ! is_array( $data ) ) {
1208
+			if ( ! $data || ! is_array( $data ) ) {
1209 1209
 				continue;
1210 1210
 			}
1211 1211
 
1212 1212
 			foreach ( $data as $datum ) {
1213
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1214
-					$joined_forms[] = $view->post_id;
1213
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1214
+					$joined_forms[ ] = $view->post_id;
1215 1215
 				}
1216 1216
 			}
1217 1217
 		}
1218 1218
 
1219 1219
 		if ( $joined_forms ) {
1220
-			$joined_args  = array(
1220
+			$joined_args = array(
1221 1221
 				'post_type'      => 'gravityview',
1222
-				'posts_per_page' => $args['posts_per_page'],
1222
+				'posts_per_page' => $args[ 'posts_per_page' ],
1223 1223
 				'post__in'       => $joined_forms,
1224 1224
 			);
1225 1225
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1377 1377
 
1378
-		if( $json_decode ) {
1378
+		if ( $json_decode ) {
1379 1379
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1380 1380
 		}
1381 1381
 
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 	 * @return string         html
1391 1391
 	 */
1392 1392
 	public static function get_sortable_fields( $formid, $current = '' ) {
1393
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default (Entry ID)', 'gk-gravityview' ) .'</option>';
1393
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default (Entry ID)', 'gk-gravityview' ) . '</option>';
1394 1394
 
1395 1395
 		if ( empty( $formid ) ) {
1396 1396
 			return $output;
@@ -1407,11 +1407,11 @@  discard block
 block discarded – undo
1407 1407
 			$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1408 1408
 
1409 1409
 			foreach ( $fields as $id => $field ) {
1410
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
1410
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1411 1411
 					continue;
1412 1412
 				}
1413 1413
 
1414
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1414
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1415 1415
 			}
1416 1416
 		}
1417 1417
 
@@ -1454,16 +1454,16 @@  discard block
 block discarded – undo
1454 1454
 		$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1455 1455
 
1456 1456
 		// TODO: Convert to using array_filter
1457
-		foreach( $fields as $id => $field ) {
1457
+		foreach ( $fields as $id => $field ) {
1458 1458
 
1459
-			if( in_array( $field['type'], $blocklist_field_types ) ) {
1459
+			if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1460 1460
 				unset( $fields[ $id ] );
1461 1461
 			}
1462 1462
 
1463 1463
 			/**
1464 1464
 			 * Merge date and time subfields.
1465 1465
 			 */
1466
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1466
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1467 1467
 				$fields[ intval( $id ) ] = array(
1468 1468
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1469 1469
 					'parent' => null,
@@ -1513,14 +1513,14 @@  discard block
 block discarded – undo
1513 1513
 	 * @param  int|array  $field field key or field array
1514 1514
 	 * @return boolean
1515 1515
 	 */
1516
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1516
+	public static function is_field_numeric( $form = null, $field = '' ) {
1517 1517
 
1518 1518
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1519 1519
 			$form = self::get_form( $form );
1520 1520
 		}
1521 1521
 
1522 1522
 		// If entry meta, it's a string. Otherwise, numeric
1523
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1523
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1524 1524
 			$type = $field;
1525 1525
 		} else {
1526 1526
 			$type = self::get_field_type( $form, $field );
@@ -1534,9 +1534,9 @@  discard block
 block discarded – undo
1534 1534
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1535 1535
 
1536 1536
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1537
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1538
-			if( true === $gv_field->is_numeric ) {
1539
-				$numeric_types[] = $gv_field->is_numeric;
1537
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1538
+			if ( true === $gv_field->is_numeric ) {
1539
+				$numeric_types[ ] = $gv_field->is_numeric;
1540 1540
 			}
1541 1541
 		}
1542 1542
 
@@ -1687,20 +1687,20 @@  discard block
 block discarded – undo
1687 1687
 		$final_atts = array_filter( $final_atts );
1688 1688
 
1689 1689
 		// If the href wasn't passed as an attribute, use the value passed to the function
1690
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1691
-			$final_atts['href'] = $href;
1690
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1691
+			$final_atts[ 'href' ] = $href;
1692 1692
 		}
1693 1693
 
1694
-		if ( isset( $final_atts['href'] ) ) {
1695
-			$final_atts['href'] = esc_url_raw( $final_atts['href'] );
1694
+		if ( isset( $final_atts[ 'href' ] ) ) {
1695
+			$final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] );
1696 1696
 		}
1697 1697
 
1698 1698
 		/**
1699 1699
 		 * Fix potential security issue with target=_blank
1700 1700
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1701 1701
 		 */
1702
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1703
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1702
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1703
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1704 1704
 		}
1705 1705
 
1706 1706
 		// Sort the attributes alphabetically, to help testing
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1713 1713
 		}
1714 1714
 
1715
-		if( '' !== $output ) {
1715
+		if ( '' !== $output ) {
1716 1716
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1717 1717
 		}
1718 1718
 
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1740 1740
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1741 1741
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1742
-				$merged[] = $value;
1742
+				$merged[ ] = $value;
1743 1743
 			} else {
1744 1744
 				$merged[ $key ] = $value;
1745 1745
 			}
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1773 1773
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1774 1774
 		 */
1775
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1775
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1776 1776
 
1777 1777
 		return get_users( $get_users_settings );
1778 1778
 	}
@@ -1792,11 +1792,11 @@  discard block
 block discarded – undo
1792 1792
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1793 1793
 
1794 1794
     	// If $cap is defined, only show notice if user has capability
1795
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1795
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1796 1796
     		return '';
1797 1797
 	    }
1798 1798
 
1799
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1799
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1800 1800
     }
1801 1801
 
1802 1802
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				}
355 355
 
356 356
 
357
-				if( GFCommon::is_product_field( $field['type'] ) ){
357
+				if( GFCommon::is_product_field( $field['type'] ) ) {
358 358
 					$has_product_fields = true;
359 359
 				}
360 360
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 		$fields = array();
419 419
 
420
-		foreach ( $extra_fields as $key => $field ){
420
+		foreach ( $extra_fields as $key => $field ) {
421 421
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
422 422
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
423 423
 			}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			$shortcodes = array();
1150 1150
 
1151 1151
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1152
-			if ( empty( $matches ) ){
1152
+			if ( empty( $matches ) ) {
1153 1153
 				return false;
1154 1154
 			}
1155 1155
 
Please login to merge, or discard this patch.