Completed
Pull Request — master (#836)
by Zack
37:36 queued 17:35
created
class-gravityview-plugin-hooks-gravity-forms-coupon.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		$hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data );
55 55
 
56
-		return (bool) $hide_coupon_fields;
56
+		return (bool)$hide_coupon_fields;
57 57
 	}
58 58
 
59 59
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) {
70 70
 
71 71
 		if ( $this->should_hide_coupon_fields( $entry ) ) {
72
-			$blacklist[] = 'coupon';
72
+			$blacklist[ ] = 'coupon';
73 73
 		}
74 74
 
75 75
 		return $blacklist;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		// No coupons match the codes provided
108 108
 		$discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form );
109 109
 
110
-		if( ! $discounts ) {
110
+		if ( ! $discounts ) {
111 111
 			return $value;
112 112
 		}
113 113
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		 * @see GF_Field_Coupon::get_field_input
117 117
 		 */
118 118
 		$_POST = ! isset( $_POST ) ? array() : $_POST;
119
-		$_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts );
119
+		$_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts );
120 120
 		$_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes );
121 121
 
122 122
 		return $value;
Please login to merge, or discard this patch.
includes/class-common.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 						}
307 307
 
308 308
 						/**
309
-                         * @hack
310
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
311
-                         */
309
+						 * @hack
310
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
311
+						 */
312 312
 						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
313
-                            continue;
314
-                        }
313
+							continue;
314
+						}
315 315
 						$fields["{$input['id']}"] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
489 489
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
490 490
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
491
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
491
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
492 492
 			$criteria['context_view_id'] = null;
493 493
 		}
494 494
 
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 			),
1252 1252
 		);
1253 1253
 
1254
-        $fields = $date_created + $fields;
1254
+		$fields = $date_created + $fields;
1255 1255
 
1256 1256
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1257 1257
 
@@ -1263,13 +1263,13 @@  discard block
 block discarded – undo
1263 1263
 			}
1264 1264
 		}
1265 1265
 
1266
-        /**
1267
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1268
-         * @since 1.12
1269
-         * @param array $fields Sub-set of GF form fields that are sortable
1270
-         * @param int $formid The Gravity Forms form ID that the fields are from
1271
-         */
1272
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1266
+		/**
1267
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1268
+		 * @since 1.12
1269
+		 * @param array $fields Sub-set of GF form fields that are sortable
1270
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1271
+		 */
1272
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1273 1273
 
1274 1274
 		return $fields;
1275 1275
 	}
@@ -1561,26 +1561,26 @@  discard block
 block discarded – undo
1561 1561
 	}
1562 1562
 
1563 1563
 
1564
-    /**
1565
-     * Display updated/error notice
1566
-     *
1567
-     * @since 1.19.2 Added $cap and $object_id parameters
1568
-     *
1569
-     * @param string $notice text/HTML of notice
1570
-     * @param string $class CSS class for notice (`updated` or `error`)
1571
-     * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1572
-     *
1573
-     * @return string
1574
-     */
1575
-    public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1576
-
1577
-    	// If $cap is defined, only show notice if user has capability
1578
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1579
-    		return '';
1580
-	    }
1581
-
1582
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1583
-    }
1564
+	/**
1565
+	 * Display updated/error notice
1566
+	 *
1567
+	 * @since 1.19.2 Added $cap and $object_id parameters
1568
+	 *
1569
+	 * @param string $notice text/HTML of notice
1570
+	 * @param string $class CSS class for notice (`updated` or `error`)
1571
+	 * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1572
+	 *
1573
+	 * @return string
1574
+	 */
1575
+	public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1576
+
1577
+		// If $cap is defined, only show notice if user has capability
1578
+		if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1579
+			return '';
1580
+		}
1581
+
1582
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1583
+	}
1584 1584
 
1585 1585
 	/**
1586 1586
 	 * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if( GFCommon::is_product_field( $field['type'] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$fields = array();
386 386
 
387
-		foreach ( $extra_fields as $key => $field ){
387
+		foreach ( $extra_fields as $key => $field ) {
388 388
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
389 389
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390 390
 			}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 			$form = GFAPI::get_form( $form );
979 979
 		}
980 980
 
981
-		if ( class_exists( 'GFFormsModel' ) ){
981
+		if ( class_exists( 'GFFormsModel' ) ) {
982 982
 			return GFFormsModel::get_field( $form, $field_id );
983 983
 		} else {
984 984
 			return null;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			$shortcodes = array();
1026 1026
 
1027 1027
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1028
-			if ( empty( $matches ) ){
1028
+			if ( empty( $matches ) ) {
1029 1029
 				return false;
1030 1030
 			}
1031 1031
 
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$form = false;
128 128
 
129
-		if( $entry ) {
130
-			$form = GFAPI::get_form( $entry['form_id'] );
129
+		if ( $entry ) {
130
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
131 131
 		}
132 132
 
133 133
 		return $form;
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$has_transaction_data = rgar( $entry, $meta, false );
195 195
 
196
-			if( ! empty( $has_transaction_data ) ) {
196
+			if ( ! empty( $has_transaction_data ) ) {
197 197
 				break;
198 198
 			}
199 199
 		}
200 200
 
201
-		return (bool) $has_transaction_data;
201
+		return (bool)$has_transaction_data;
202 202
 	}
203 203
 
204 204
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
238 238
 
239
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
239
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
240 240
 
241 241
 		return $result;
242 242
 	}
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
255 255
 	 */
256
-	public static function get_forms(  $active = true, $trash = false ) {
256
+	public static function get_forms( $active = true, $trash = false ) {
257 257
 		$forms = array();
258 258
 		if ( class_exists( 'GFAPI' ) ) {
259
-			if( 'any' === $active ) {
259
+			if ( 'any' === $active ) {
260 260
 				$active_forms = GFAPI::get_forms( true, $trash );
261 261
 				$inactive_forms = GFAPI::get_forms( false, $trash );
262 262
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 		$has_post_fields = false;
288 288
 
289 289
 		if ( $form ) {
290
-			foreach ( $form['fields'] as $field ) {
291
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
292
-					$fields["{$field['id']}"] = array(
290
+			foreach ( $form[ 'fields' ] as $field ) {
291
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
292
+					$fields[ "{$field[ 'id' ]}" ] = array(
293 293
 						'label' => rgar( $field, 'label' ),
294 294
 						'parent' => null,
295 295
 						'type' => rgar( $field, 'type' ),
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					);
299 299
 				}
300 300
 
301
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
302
-					foreach ( $field['inputs'] as $input ) {
301
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
302
+					foreach ( $field[ 'inputs' ] as $input ) {
303 303
 
304
-						if( ! empty( $input['isHidden'] ) ) {
304
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
305 305
 							continue;
306 306
 						}
307 307
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
                          * @hack
310 310
                          * In case of email/email confirmation, the input for email has the same id as the parent field
311 311
                          */
312
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
312
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
313 313
                             continue;
314 314
                         }
315
-						$fields["{$input['id']}"] = array(
315
+						$fields[ "{$input[ 'id' ]}" ] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
318 318
 							'parent' => $field,
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @since 1.7
339 339
 		 */
340 340
 		if ( $has_post_fields ) {
341
-			$fields['post_id'] = array(
341
+			$fields[ 'post_id' ] = array(
342 342
 				'label' => __( 'Post ID', 'gravityview' ),
343 343
 				'type' => 'post_id',
344 344
 			);
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 			foreach ( $payment_fields as $payment_field ) {
352 352
 
353 353
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
354
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
355 355
 					continue;
356 356
 				}
357 357
 
358
-				$fields["{$payment_field->name}"] = array(
358
+				$fields[ "{$payment_field->name}" ] = array(
359 359
 					'label' => $payment_field->label,
360 360
 					'desc' => $payment_field->description,
361 361
 					'type' => $payment_field->name,
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$fields = array();
389 389
 
390
-		foreach ( $extra_fields as $key => $field ){
391
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
392
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390
+		foreach ( $extra_fields as $key => $field ) {
391
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
392
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
393 393
 			}
394 394
 		}
395 395
 
@@ -429,32 +429,32 @@  discard block
 block discarded – undo
429 429
 			'search_criteria' => null,
430 430
 			'sorting' => null,
431 431
 			'paging' => null,
432
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
432
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
433 433
 		);
434 434
 
435 435
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
436 436
 
437
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
438
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
437
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
438
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
439 439
 
440 440
 				if ( ! is_array( $filter ) ) {
441 441
 					continue;
442 442
 				}
443 443
 
444 444
 				// By default, we want searches to be wildcard for each field.
445
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
445
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
446 446
 
447 447
 				/**
448 448
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
449 449
 				 * @param string $operator Existing search operator
450 450
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
451 451
 				 */
452
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
452
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
453 453
 			}
454 454
 
455 455
 			// don't send just the [mode] without any field filter.
456
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
457
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
456
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
457
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
458 458
 			}
459 459
 
460 460
 		}
@@ -465,36 +465,36 @@  discard block
 block discarded – undo
465 465
 		 * Prepare date formats to be in Gravity Forms DB format;
466 466
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
467 467
 		 */
468
-		foreach ( array('start_date', 'end_date' ) as $key ) {
468
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
469 469
 
470
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
470
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
471 471
 
472 472
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
473
-				$date = date_create( $criteria['search_criteria'][ $key ] );
473
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
474 474
 
475 475
 				if ( $date ) {
476 476
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
477
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
477
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
478 478
 				} else {
479
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
479
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
480 480
 
481 481
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
482
-					unset( $criteria['search_criteria'][ $key ] );
482
+					unset( $criteria[ 'search_criteria' ][ $key ] );
483 483
 				}
484 484
 			}
485 485
 		}
486 486
 
487 487
 
488 488
 		// Calculate the context view id and send it to the advanced filter
489
-		if( GravityView_frontend::getInstance()->getSingleEntry() ) {
490
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
489
+		if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
490
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
491 491
 		} elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
492
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
492
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
493 493
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
494
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
495
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
494
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
495
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
496 496
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
497
-			$criteria['context_view_id'] = null;
497
+			$criteria[ 'context_view_id' ] = null;
498 498
 		}
499 499
 
500 500
 		/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		 * @param array $form_ids Forms to search
504 504
 		 * @param int $view_id ID of the view being used to search
505 505
 		 */
506
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
506
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
507 507
 
508 508
 		return (array)$criteria;
509 509
 	}
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 		/** Reduce # of database calls */
534 534
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
535 535
 
536
-		if ( ! empty( $criteria['cache'] ) ) {
536
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
537 537
 
538 538
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
539 539
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 
542 542
 				// Still update the total count when using cached results
543 543
 				if ( ! is_null( $total ) ) {
544
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
544
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
545 545
 				}
546 546
 
547 547
 				$return = $entries;
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
562 562
 
563 563
 			// No entries returned from gravityview_before_get_entries
564
-			if( is_null( $entries ) ) {
564
+			if ( is_null( $entries ) ) {
565 565
 
566
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
566
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
567 567
 
568 568
 				if ( is_wp_error( $entries ) ) {
569 569
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 				}
573 573
 			}
574 574
 
575
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
575
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
576 576
 
577 577
 				// Cache results
578 578
 				$Cache->set( $entries, 'entries' );
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 			 */
678 678
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
679 679
 
680
-			if( $check_entry_display ) {
680
+			if ( $check_entry_display ) {
681 681
 				// Is the entry allowed
682 682
 				$entry = self::check_entry_display( $entry );
683 683
 			}
@@ -710,12 +710,12 @@  discard block
 block discarded – undo
710 710
 
711 711
 		$value = false;
712 712
 
713
-		if( 'context' === $val1 ) {
713
+		if ( 'context' === $val1 ) {
714 714
 
715 715
 			$matching_contexts = array( $val2 );
716 716
 
717 717
 			// We allow for non-standard contexts.
718
-			switch( $val2 ) {
718
+			switch ( $val2 ) {
719 719
 				// Check for either single or edit
720 720
 				case 'singular':
721 721
 					$matching_contexts = array( 'single', 'edit' );
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			return false;
777 777
 		}
778 778
 
779
-		if ( empty( $entry['form_id'] ) ) {
779
+		if ( empty( $entry[ 'form_id' ] ) ) {
780 780
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
781 781
 			return false;
782 782
 		}
@@ -784,26 +784,26 @@  discard block
 block discarded – undo
784 784
 		$criteria = self::calculate_get_entries_criteria();
785 785
 
786 786
 		// Make sure the current View is connected to the same form as the Entry
787
-		if( ! empty( $criteria['context_view_id'] ) ) {
788
-			$context_view_id = intval( $criteria['context_view_id'] );
787
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
788
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
789 789
 			$context_form_id = gravityview_get_form_id( $context_view_id );
790
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
791
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
790
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
791
+				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
792 792
 				return false;
793 793
 			}
794 794
 		}
795 795
 
796
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
796
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
797 797
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
798 798
 			return $entry;
799 799
 		}
800 800
 
801
-		$search_criteria = $criteria['search_criteria'];
801
+		$search_criteria = $criteria[ 'search_criteria' ];
802 802
 		unset( $criteria );
803 803
 
804 804
 		// check entry status
805
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
806
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
805
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
806
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
807 807
 			return false;
808 808
 		}
809 809
 
@@ -811,41 +811,41 @@  discard block
 block discarded – undo
811 811
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
812 812
 
813 813
 		// field_filters
814
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
814
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
815 815
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
816 816
 			return $entry;
817 817
 		}
818 818
 
819
-		$filters = $search_criteria['field_filters'];
819
+		$filters = $search_criteria[ 'field_filters' ];
820 820
 		unset( $search_criteria );
821 821
 
822
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
823
-		unset( $filters['mode'] );
822
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
823
+		unset( $filters[ 'mode' ] );
824 824
 
825
-		$form = self::get_form( $entry['form_id'] );
825
+		$form = self::get_form( $entry[ 'form_id' ] );
826 826
 
827 827
 		foreach ( $filters as $filter ) {
828 828
 
829
-			if ( ! isset( $filter['key'] ) ) {
829
+			if ( ! isset( $filter[ 'key' ] ) ) {
830 830
 				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter );
831 831
 				continue;
832 832
 			}
833 833
 
834
-			$k = $filter['key'];
834
+			$k = $filter[ 'key' ];
835 835
 
836 836
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
837 837
 				$field_value = $entry[ $k ];
838 838
 				$field = null;
839 839
 			} else {
840 840
 				$field = self::get_field( $form, $k );
841
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
841
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
842 842
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
843 843
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value;
844 844
 			}
845 845
 
846
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
846
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
847 847
 
848
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
848
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
849 849
 
850 850
 			// verify if we are already free to go!
851 851
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -903,18 +903,18 @@  discard block
 block discarded – undo
903 903
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
904 904
 		 * @see GFCommon::format_date() for original code
905 905
 		 */
906
-		$date_gmt_time   = mysql2date( 'G', $date_string );
906
+		$date_gmt_time = mysql2date( 'G', $date_string );
907 907
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
908 908
 
909
-		$format  = rgar( $atts, 'format' );
910
-		$is_human  = ! empty( $atts['human'] );
911
-		$is_diff  = ! empty( $atts['diff'] );
912
-		$is_raw = ! empty( $atts['raw'] );
913
-		$is_timestamp = ! empty( $atts['timestamp'] );
914
-		$include_time = ! empty( $atts['time'] );
909
+		$format = rgar( $atts, 'format' );
910
+		$is_human = ! empty( $atts[ 'human' ] );
911
+		$is_diff = ! empty( $atts[ 'diff' ] );
912
+		$is_raw = ! empty( $atts[ 'raw' ] );
913
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
914
+		$include_time = ! empty( $atts[ 'time' ] );
915 915
 
916 916
 		// If we're using time diff, we want to have a different default format
917
-		if( empty( $format ) ) {
917
+		if ( empty( $format ) ) {
918 918
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
919 919
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
920 920
 		}
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 		// If raw was specified, don't modify the stored value
923 923
 		if ( $is_raw ) {
924 924
 			$formatted_date = $date_string;
925
-		} elseif( $is_timestamp ) {
925
+		} elseif ( $is_timestamp ) {
926 926
 			$formatted_date = $date_local_timestamp;
927 927
 		} elseif ( $is_diff ) {
928 928
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 
957 957
 		$label = rgar( $field, 'label' );
958 958
 
959
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
959
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
960 960
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
961 961
 		}
962 962
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 			$form = GFAPI::get_form( $form );
985 985
 		}
986 986
 
987
-		if ( class_exists( 'GFFormsModel' ) ){
987
+		if ( class_exists( 'GFFormsModel' ) ) {
988 988
 			return GFFormsModel::get_field( $form, $field_id );
989 989
 		} else {
990 990
 			return null;
@@ -1031,19 +1031,19 @@  discard block
 block discarded – undo
1031 1031
 			$shortcodes = array();
1032 1032
 
1033 1033
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1034
-			if ( empty( $matches ) ){
1034
+			if ( empty( $matches ) ) {
1035 1035
 				return false;
1036 1036
 			}
1037 1037
 
1038 1038
 			foreach ( $matches as $shortcode ) {
1039
-				if ( $tag === $shortcode[2] ) {
1039
+				if ( $tag === $shortcode[ 2 ] ) {
1040 1040
 
1041 1041
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1042
-					$shortcodes[] = $shortcode;
1042
+					$shortcodes[ ] = $shortcode;
1043 1043
 
1044
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1045
-					foreach( $results as $result ) {
1046
-						$shortcodes[] = $result;
1044
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1045
+					foreach ( $results as $result ) {
1046
+						$shortcodes[ ] = $result;
1047 1047
 					}
1048 1048
 				}
1049 1049
 			}
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1188 1188
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1189 1189
 
1190
-		if( $apply_filter ) {
1190
+		if ( $apply_filter ) {
1191 1191
 			/**
1192 1192
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1193 1193
 			 * @since 1.6.5
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 	 * @return string         html
1211 1211
 	 */
1212 1212
 	public static function get_sortable_fields( $formid, $current = '' ) {
1213
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1213
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1214 1214
 
1215 1215
 		if ( empty( $formid ) ) {
1216 1216
 			return $output;
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1224 1224
 
1225 1225
 			foreach ( $fields as $id => $field ) {
1226
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1226
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1227 1227
 					continue;
1228 1228
 				}
1229 1229
 
1230
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1230
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1231 1231
 			}
1232 1232
 		}
1233 1233
 
@@ -1262,9 +1262,9 @@  discard block
 block discarded – undo
1262 1262
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1263 1263
 
1264 1264
 		// TODO: Convert to using array_filter
1265
-		foreach( $fields as $id => $field ) {
1265
+		foreach ( $fields as $id => $field ) {
1266 1266
 
1267
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1267
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1268 1268
 				unset( $fields[ $id ] );
1269 1269
 			}
1270 1270
 		}
@@ -1305,14 +1305,14 @@  discard block
 block discarded – undo
1305 1305
 	 * @param  int|array  $field field key or field array
1306 1306
 	 * @return boolean
1307 1307
 	 */
1308
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1308
+	public static function is_field_numeric( $form = null, $field = '' ) {
1309 1309
 
1310 1310
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1311 1311
 			$form = self::get_form( $form );
1312 1312
 		}
1313 1313
 
1314 1314
 		// If entry meta, it's a string. Otherwise, numeric
1315
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1315
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1316 1316
 			$type = $field;
1317 1317
 		} else {
1318 1318
 			$type = self::get_field_type( $form, $field );
@@ -1326,9 +1326,9 @@  discard block
 block discarded – undo
1326 1326
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1327 1327
 
1328 1328
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1329
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1330
-			if( true === $gv_field->is_numeric ) {
1331
-				$numeric_types[] = $gv_field->is_numeric;
1329
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1330
+			if ( true === $gv_field->is_numeric ) {
1331
+				$numeric_types[ ] = $gv_field->is_numeric;
1332 1332
 			}
1333 1333
 		}
1334 1334
 
@@ -1478,18 +1478,18 @@  discard block
 block discarded – undo
1478 1478
 		$final_atts = array_filter( $final_atts );
1479 1479
 
1480 1480
 		// If the href wasn't passed as an attribute, use the value passed to the function
1481
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1482
-			$final_atts['href'] = $href;
1481
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1482
+			$final_atts[ 'href' ] = $href;
1483 1483
 		}
1484 1484
 
1485
-		$final_atts['href'] = esc_url_raw( $href );
1485
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1486 1486
 
1487 1487
 		/**
1488 1488
 		 * Fix potential security issue with target=_blank
1489 1489
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1490 1490
 		 */
1491
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1492
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1491
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1492
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1493 1493
 		}
1494 1494
 
1495 1495
 		// Sort the attributes alphabetically, to help testing
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1502 1502
 		}
1503 1503
 
1504
-		if( '' !== $output ) {
1504
+		if ( '' !== $output ) {
1505 1505
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1506 1506
 		}
1507 1507
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1529 1529
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1530 1530
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1531
-				$merged[] = $value;
1531
+				$merged[ ] = $value;
1532 1532
 			} else {
1533 1533
 				$merged[ $key ] = $value;
1534 1534
 			}
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1562 1562
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1563 1563
 		 */
1564
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1564
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1565 1565
 
1566 1566
 		return get_users( $get_users_settings );
1567 1567
 	}
@@ -1581,11 +1581,11 @@  discard block
 block discarded – undo
1581 1581
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1582 1582
 
1583 1583
     	// If $cap is defined, only show notice if user has capability
1584
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1584
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1585 1585
     		return '';
1586 1586
 	    }
1587 1587
 
1588
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1588
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1589 1589
     }
1590 1590
 
1591 1591
 	/**
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -18,80 +18,80 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 
44
-        $this->load_components( 'render' );
44
+		$this->load_components( 'render' );
45 45
 
46
-        // If GF User Registration Add-on exists
47
-        $this->load_components( 'user-registration' );
46
+		// If GF User Registration Add-on exists
47
+		$this->load_components( 'user-registration' );
48 48
 
49
-        $this->add_hooks();
49
+		$this->add_hooks();
50 50
 
51 51
 		// Process hooks for addons that may or may not be present
52 52
 		$this->addon_specific_hooks();
53 53
 	}
54 54
 
55 55
 
56
-    static function getInstance() {
56
+	static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
59
-            self::$instance = new GravityView_Edit_Entry;
60
-        }
58
+		if( empty( self::$instance ) ) {
59
+			self::$instance = new GravityView_Edit_Entry;
60
+		}
61 61
 
62
-        return self::$instance;
63
-    }
62
+		return self::$instance;
63
+	}
64 64
 
65 65
 
66
-    private function load_components( $component ) {
66
+	private function load_components( $component ) {
67 67
 
68
-        $dir = trailingslashit( self::$file );
68
+		$dir = trailingslashit( self::$file );
69 69
 
70
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
70
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
71
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
72 72
 
73
-        // Loads component and pass extension's instance so that component can
74
-        // talk each other.
75
-        require_once $filename;
76
-        $this->instances[ $component ] = new $classname( $this );
77
-        $this->instances[ $component ]->load();
73
+		// Loads component and pass extension's instance so that component can
74
+		// talk each other.
75
+		require_once $filename;
76
+		$this->instances[ $component ] = new $classname( $this );
77
+		$this->instances[ $component ]->load();
78 78
 
79
-    }
79
+	}
80 80
 
81
-    private function add_hooks() {
81
+	private function add_hooks() {
82 82
 
83
-        // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') );
83
+		// Add front-end access to Gravity Forms delete file action
84
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') );
85 85
 
86
-        // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') );
86
+		// Make sure this hook is run for non-admins
87
+		add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') );
88 88
 
89
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
89
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
91
-        // add template path to check for field
92
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
91
+		// add template path to check for field
92
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
93 93
 
94
-    }
94
+	}
95 95
 
96 96
 	/**
97 97
 	 * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin
@@ -105,75 +105,75 @@  discard block
 block discarded – undo
105 105
 
106 106
 	}
107 107
 
108
-    /**
109
-     * Include this extension templates path
110
-     * @param array $file_paths List of template paths ordered
111
-     */
112
-    public function add_template_path( $file_paths ) {
113
-
114
-        // Index 100 is the default GravityView template path.
115
-        $file_paths[ 110 ] = self::$file;
116
-
117
-        return $file_paths;
118
-    }
119
-
120
-    /**
121
-     *
122
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
123
-     *
124
-     * @param $view_id int GravityView view id
125
-     * @param $form_id int Gravity Forms form id
126
-     * @param $entry_id int Gravity Forms entry id
127
-     * @return string
128
-     */
129
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
130
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
131
-    }
132
-
133
-
134
-    /**
135
-     * The edit entry link creates a secure link with a nonce
136
-     *
137
-     * It also mimics the URL structure Gravity Forms expects to have so that
138
-     * it formats the display of the edit form like it does in the backend, like
139
-     * "You can edit this post from the post page" fields, for example.
140
-     *
141
-     * @param $entry array Gravity Forms entry object
142
-     * @param $view_id int GravityView view id
143
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
144
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
145
-     * @return string
146
-     */
147
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148
-
149
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
150
-
151
-        $base = gv_entry_link( $entry, $post_id );
152
-
153
-        $url = add_query_arg( array(
154
-            'page' => 'gf_entries', // Needed for GFForms::get_page()
155
-            'view' => 'entry', // Needed for GFForms::get_page()
156
-            'edit' => wp_create_nonce( $nonce_key )
157
-        ), $base );
158
-
159
-	    /**
160
-	     * Allow passing params to dynamically populate entry with values
161
-	     * @since 1.9.2
162
-	     */
163
-	    if( !empty( $field_values ) ) {
164
-
165
-		    if( is_array( $field_values ) ) {
166
-			    // If already an array, no parse_str() needed
167
-			    $params = $field_values;
168
-		    } else {
169
-			    parse_str( $field_values, $params );
170
-		    }
171
-
172
-		    $url = add_query_arg( $params, $url );
173
-	    }
174
-
175
-        return $url;
176
-    }
108
+	/**
109
+	 * Include this extension templates path
110
+	 * @param array $file_paths List of template paths ordered
111
+	 */
112
+	public function add_template_path( $file_paths ) {
113
+
114
+		// Index 100 is the default GravityView template path.
115
+		$file_paths[ 110 ] = self::$file;
116
+
117
+		return $file_paths;
118
+	}
119
+
120
+	/**
121
+	 *
122
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
123
+	 *
124
+	 * @param $view_id int GravityView view id
125
+	 * @param $form_id int Gravity Forms form id
126
+	 * @param $entry_id int Gravity Forms entry id
127
+	 * @return string
128
+	 */
129
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
130
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
131
+	}
132
+
133
+
134
+	/**
135
+	 * The edit entry link creates a secure link with a nonce
136
+	 *
137
+	 * It also mimics the URL structure Gravity Forms expects to have so that
138
+	 * it formats the display of the edit form like it does in the backend, like
139
+	 * "You can edit this post from the post page" fields, for example.
140
+	 *
141
+	 * @param $entry array Gravity Forms entry object
142
+	 * @param $view_id int GravityView view id
143
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
144
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
145
+	 * @return string
146
+	 */
147
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148
+
149
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
150
+
151
+		$base = gv_entry_link( $entry, $post_id );
152
+
153
+		$url = add_query_arg( array(
154
+			'page' => 'gf_entries', // Needed for GFForms::get_page()
155
+			'view' => 'entry', // Needed for GFForms::get_page()
156
+			'edit' => wp_create_nonce( $nonce_key )
157
+		), $base );
158
+
159
+		/**
160
+		 * Allow passing params to dynamically populate entry with values
161
+		 * @since 1.9.2
162
+		 */
163
+		if( !empty( $field_values ) ) {
164
+
165
+			if( is_array( $field_values ) ) {
166
+				// If already an array, no parse_str() needed
167
+				$params = $field_values;
168
+			} else {
169
+				parse_str( $field_values, $params );
170
+			}
171
+
172
+			$url = add_query_arg( $params, $url );
173
+		}
174
+
175
+		return $url;
176
+	}
177 177
 
178 178
 	/**
179 179
 	 * Edit mode doesn't allow certain field types.
@@ -225,81 +225,81 @@  discard block
 block discarded – undo
225 225
 	}
226 226
 
227 227
 
228
-    /**
229
-     * checks if user has permissions to edit a specific entry
230
-     *
231
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
232
-     *
233
-     * @param  array $entry Gravity Forms entry array
234
-     * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2}
235
-     * @return bool
236
-     */
237
-    public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) {
228
+	/**
229
+	 * checks if user has permissions to edit a specific entry
230
+	 *
231
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
232
+	 *
233
+	 * @param  array $entry Gravity Forms entry array
234
+	 * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2}
235
+	 * @return bool
236
+	 */
237
+	public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) {
238 238
 
239
-        // No permission by default
240
-        $user_can_edit = false;
239
+		// No permission by default
240
+		$user_can_edit = false;
241 241
 
242
-        // If they can edit any entries (as defined in Gravity Forms)
243
-        // Or if they can edit other people's entries
244
-        // Then we're good.
245
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
242
+		// If they can edit any entries (as defined in Gravity Forms)
243
+		// Or if they can edit other people's entries
244
+		// Then we're good.
245
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
246 246
 
247
-            do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
247
+			do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
248 248
 
249
-            $user_can_edit = true;
249
+			$user_can_edit = true;
250 250
 
251
-        } else if( !isset( $entry['created_by'] ) ) {
251
+		} else if( !isset( $entry['created_by'] ) ) {
252 252
 
253
-            do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
253
+			do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
254 254
 
255
-            $user_can_edit = false;
255
+			$user_can_edit = false;
256 256
 
257
-        } else {
257
+		} else {
258 258
 
259
-            // get user_edit setting
260
-            if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
261
-                // if View ID not specified or is the current view
262
-                $user_edit = GravityView_View::getInstance()->getAtts('user_edit');
263
-            } else {
264
-                // in case is specified and not the current view
265
-                $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
266
-            }
259
+			// get user_edit setting
260
+			if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
261
+				// if View ID not specified or is the current view
262
+				$user_edit = GravityView_View::getInstance()->getAtts('user_edit');
263
+			} else {
264
+				// in case is specified and not the current view
265
+				$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
266
+			}
267 267
 
268
-            $current_user = wp_get_current_user();
268
+			$current_user = wp_get_current_user();
269 269
 
270
-            // User edit is disabled
271
-            if( empty( $user_edit ) ) {
270
+			// User edit is disabled
271
+			if( empty( $user_edit ) ) {
272 272
 
273
-                do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
273
+				do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
274 274
 
275
-                $user_can_edit = false;
276
-            }
275
+				$user_can_edit = false;
276
+			}
277 277
 
278
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
279
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
278
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
279
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
280 280
 
281
-                do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
281
+				do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
282 282
 
283
-                $user_can_edit = true;
283
+				$user_can_edit = true;
284 284
 
285
-            } else if( ! is_user_logged_in() ) {
285
+			} else if( ! is_user_logged_in() ) {
286 286
 
287
-                do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
288
-            }
287
+				do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
288
+			}
289 289
 
290
-        }
290
+		}
291 291
 
292
-        /**
293
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
294
-         * @since 1.15 Added `$entry` and `$view_id` parameters
295
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
296
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
297
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
298
-         */
299
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
292
+		/**
293
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
294
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
295
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
296
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
297
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
298
+		 */
299
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
300 300
 
301
-        return (bool)$user_can_edit;
302
-    }
301
+		return (bool)$user_can_edit;
302
+	}
303 303
 
304 304
 
305 305
 
Please login to merge, or discard this patch.
future/includes/class-gv-collection-view.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 					continue;
72 72
 				}
73 73
 
74
-				if ( is_numeric( $shortcode->atts['id'] ) ) {
75
-					$views->append( View::by_id( $shortcode->atts['id'] ) );
74
+				if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
75
+					$views->append( View::by_id( $shortcode->atts[ 'id' ] ) );
76 76
 				}
77 77
 			}
78 78
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 						continue;
103 103
 					}
104 104
 
105
-					if ( is_numeric( $shortcode->atts['id'] ) ) {
106
-						$views->append( View::by_id( $shortcode->atts['id'] ) );
105
+					if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
106
+						$views->append( View::by_id( $shortcode->atts[ 'id' ] ) );
107 107
 					}
108 108
 				}
109 109
 			}
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@  discard block
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * A collection of \GV\View objects.
@@ -39,8 +40,9 @@  discard block
 block discarded – undo
39 40
 	 */
40 41
 	public function get( $view_id ) {
41 42
 		foreach ( $this->all() as $view ) {
42
-			if ( $view->ID == $view_id )
43
-				return $view;
43
+			if ( $view->ID == $view_id ) {
44
+							return $view;
45
+			}
44 46
 		}
45 47
 		return null;
46 48
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	 * @return string The version of PHP.
212 212
 	 */
213 213
 	private function get_php_version() {
214
-		return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
215
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
214
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
215
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
216 216
 	}
217 217
 
218 218
 	/**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @return string The version of WordPress.
224 224
 	 */
225 225
 	private function get_wordpress_version() {
226
-		return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
227
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
226
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
227
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
228 228
 	}
229 229
 
230 230
 	/**
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 	 * @return string The version of Gravity Forms.
237 237
 	 */
238 238
 	private function get_gravityforms_version() {
239
-		if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) )
239
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) )
240 240
 			throw new \ErrorException( 'Gravity Forms is inactive or not installed.' );
241 241
 
242
-		return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
243
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
242
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
243
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
244 244
 	}
245 245
 
246 246
 	private function __clone() { }
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@  discard block
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * The GravityView WordPress plugin class.
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 	 * @return \GV\Plugin The global instance of GravityView Plugin.
69 70
 	 */
70 71
 	public static function get() {
71
-		if ( ! self::$__instance instanceof self )
72
-			self::$__instance = new self;
72
+		if ( ! self::$__instance instanceof self ) {
73
+					self::$__instance = new self;
74
+		}
73 75
 		return self::$__instance;
74 76
 	}
75 77
 
@@ -92,8 +94,9 @@  discard block
 block discarded – undo
92 94
 		 * Stop all further functionality from loading if the WordPress
93 95
 		 * plugin is incompatible with the current environment.
94 96
 		 */
95
-		if ( ! $this->is_compatible() )
96
-			return;
97
+		if ( ! $this->is_compatible() ) {
98
+					return;
99
+		}
97 100
 
98 101
 		/** Register hooks that are fired when the plugin is activated and deactivated. */
99 102
 		register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) );
@@ -236,8 +239,9 @@  discard block
 block discarded – undo
236 239
 	 * @return string The version of Gravity Forms.
237 240
 	 */
238 241
 	private function get_gravityforms_version() {
239
-		if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) )
240
-			throw new \ErrorException( 'Gravity Forms is inactive or not installed.' );
242
+		if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
243
+					throw new \ErrorException( 'Gravity Forms is inactive or not installed.' );
244
+		}
241 245
 
242 246
 		return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
243 247
 			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
Please login to merge, or discard this patch.
future/includes/class-gv-collection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * @return void
25 25
 	 */
26 26
 	public function append( $value ) {
27
-		$this->storage []= $value;
27
+		$this->storage [ ] = $value;
28 28
 	}
29 29
 
30 30
 	/**
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * A generic Collection base class.
Please login to merge, or discard this patch.
future/includes/class-gv-request-frontend.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@
 block discarded – undo
2 2
 namespace GV;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * The default Request class.
Please login to merge, or discard this patch.
includes/class-data.php 2 patches
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	private function __construct( $passed_post = NULL ) {
19 19
 
20
-		if( !empty( $passed_post ) ) {
20
+		if ( ! empty( $passed_post ) ) {
21 21
 
22 22
 			$id_or_id_array = $this->maybe_get_view_id( $passed_post );
23 23
 
24
-			if( !empty( $id_or_id_array ) ) {
24
+			if ( ! empty( $id_or_id_array ) ) {
25 25
 				$this->add_view( $id_or_id_array );
26 26
 			}
27 27
 		}
@@ -58,40 +58,40 @@  discard block
 block discarded – undo
58 58
 	public function maybe_get_view_id( $passed_post ) {
59 59
 		$ids = array();
60 60
 
61
-		if( ! empty( $passed_post ) ) {
61
+		if ( ! empty( $passed_post ) ) {
62 62
 
63
-			if( is_numeric( $passed_post ) ) {
63
+			if ( is_numeric( $passed_post ) ) {
64 64
 				$passed_post = get_post( $passed_post );
65 65
 			}
66 66
 
67 67
 			// Convert WP_Posts into WP_Posts[] array
68
-			if( $passed_post instanceof WP_Post ) {
68
+			if ( $passed_post instanceof WP_Post ) {
69 69
 				$passed_post = array( $passed_post );
70 70
 			}
71 71
 
72
-			if( is_array( $passed_post ) ) {
72
+			if ( is_array( $passed_post ) ) {
73 73
 
74
-				foreach ( $passed_post as &$post) {
74
+				foreach ( $passed_post as &$post ) {
75 75
 					if ( function_exists( 'gravityview' ) && $post instanceof WP_Post ) {
76 76
 						$views = \GV\View_Collection::from_post( $post );
77 77
 						foreach ( $views->all() as $view ) {
78
-							$ids []= $view->ID;
78
+							$ids [ ] = $view->ID;
79 79
 						}
80 80
 					} else {
81 81
 						/** Deprecated, see \GV\View_Collection::from_post */
82
-						if( ( get_post_type( $post ) === 'gravityview' ) ) {
83
-							$ids[] = $post->ID;
84
-						} else{
82
+						if ( ( get_post_type( $post ) === 'gravityview' ) ) {
83
+							$ids[ ] = $post->ID;
84
+						} else {
85 85
 							// Parse the Post Content
86 86
 							$id = $this->parse_post_content( $post->post_content );
87
-							if( $id ) {
88
-								$ids = array_merge( $ids, (array) $id );
87
+							if ( $id ) {
88
+								$ids = array_merge( $ids, (array)$id );
89 89
 							}
90 90
 
91 91
 							// Parse the Post Meta
92 92
 							$id = $this->parse_post_meta( $post->ID );
93
-							if( $id ) {
94
-								$ids = array_merge( $ids, (array) $id );
93
+							if ( $id ) {
94
+								$ids = array_merge( $ids, (array)$id );
95 95
 							}
96 96
 						}
97 97
 					}
@@ -105,31 +105,31 @@  discard block
 block discarded – undo
105 105
 					if ( function_exists( 'gravityview' ) ) {
106 106
 						$shortcodes = \GV\Shortcode::parse( $passed_post );
107 107
 						foreach ( $shortcodes as $shortcode ) {
108
-							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) )
109
-								$ids []= $shortcode->atts['id'];
108
+							if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) )
109
+								$ids [ ] = $shortcode->atts[ 'id' ];
110 110
 						}
111 111
 					} else {
112 112
 						/** Deprecated, use \GV\Shortcode::parse. */
113 113
 						$id = $this->parse_post_content( $passed_post );
114
-						if( $id ) {
115
-							$ids = array_merge( $ids, (array) $id );
114
+						if ( $id ) {
115
+							$ids = array_merge( $ids, (array)$id );
116 116
 						}
117 117
 					}
118 118
 
119 119
 				} else {
120 120
 					$id = $this->get_id_from_atts( $passed_post );
121
-					$ids[] = intval( $id );
121
+					$ids[ ] = intval( $id );
122 122
 				}
123 123
 			}
124 124
 		}
125 125
 
126
-		if( empty($ids) ) {
126
+		if ( empty( $ids ) ) {
127 127
 			return NULL;
128 128
 		}
129 129
 
130 130
 		// If it's just one ID, return that.
131 131
 		// Otherwise, return array of IDs
132
-		return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids;
132
+		return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids;
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public static function getInstance( $passed_post = NULL ) {
139 139
 
140
-		if( empty( self::$instance ) ) {
140
+		if ( empty( self::$instance ) ) {
141 141
 			self::$instance = new GravityView_View_Data( $passed_post );
142 142
 		}
143 143
 
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function get_view( $view_id, $atts = NULL ) {
152 152
 
153
-		if( ! is_numeric( $view_id) ) {
154
-			do_action('gravityview_log_error', sprintf('GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id) );
153
+		if ( ! is_numeric( $view_id ) ) {
154
+			do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id ) );
155 155
 			return false;
156 156
 		}
157 157
 
158 158
 		// Backup: the view hasn't been fetched yet. Doing it now.
159 159
 		if ( ! isset( $this->views[ $view_id ] ) ) {
160
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] View #%s not set yet.', $view_id) );
160
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] View #%s not set yet.', $view_id ) );
161 161
 			return $this->add_view( $view_id, $atts );
162 162
 		}
163 163
 
164 164
 		if ( empty( $this->views[ $view_id ] ) ) {
165
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id) );
165
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id ) );
166 166
 			return false;
167 167
 		}
168 168
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	function add_view( $view_id, $atts = NULL ) {
194 194
 
195 195
 		// Handle array of IDs
196
-		if( is_array( $view_id ) ) {
197
-			foreach( $view_id as $id ) {
196
+		if ( is_array( $view_id ) ) {
197
+			foreach ( $view_id as $id ) {
198 198
 
199 199
 				$this->add_view( $id, $atts );
200 200
 			}
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
 		}
204 204
 
205 205
 		// The view has been set already; returning stored view.
206
-		if ( !empty( $this->views[ $view_id ] ) ) {
207
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id) );
206
+		if ( ! empty( $this->views[ $view_id ] ) ) {
207
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id ) );
208 208
 			return $this->views[ $view_id ];
209 209
 		}
210 210
 
211
-		if( ! $this->view_exists( $view_id ) ) {
212
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id) );
211
+		if ( ! $this->view_exists( $view_id ) ) {
212
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id ) );
213 213
 			return false;
214 214
 		}
215 215
 
216 216
 		$form_id = gravityview_get_form_id( $view_id );
217 217
 
218
-		if( empty( $form_id ) ) {
218
+		if ( empty( $form_id ) ) {
219 219
 
220
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id) );
220
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id ) );
221 221
 
222 222
 			return false;
223 223
 		}
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
 		// Get the settings for the View ID
226 226
 		$view_settings = gravityview_get_template_settings( $view_id );
227 227
 
228
-		do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id), $view_settings );
228
+		do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id ), $view_settings );
229 229
 
230 230
 		// Merge the view settings with the defaults
231 231
 		$view_defaults = wp_parse_args( $view_settings, self::get_default_args() );
232 232
 
233
-		do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults );
233
+		do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults );
234 234
 
235
-		if( ! empty( $atts ) && is_array( $atts ) ) {
235
+		if ( ! empty( $atts ) && is_array( $atts ) ) {
236 236
 
237
-			do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging  with the $view_defaults', $atts );
237
+			do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging  with the $view_defaults', $atts );
238 238
 
239 239
 			// Get the settings from the shortcode and merge them with defaults.
240 240
 			$atts = shortcode_atts( $view_defaults, $atts );
241 241
 
242
-			do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging  with the $view_defaults', $atts );
242
+			do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging  with the $view_defaults', $atts );
243 243
 
244 244
 		} else {
245 245
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		}
250 250
 
251
-		unset( $atts['id'], $view_defaults, $view_settings );
251
+		unset( $atts[ 'id' ], $view_defaults, $view_settings );
252 252
 
253 253
 		$data = array(
254 254
 			'id' => $view_id,
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			'form' => gravityview_get_form( $form_id ),
262 262
 		);
263 263
 
264
-		do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] View #%s being added.', $view_id), $data );
264
+		do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] View #%s being added.', $view_id ), $data );
265 265
 
266 266
 		$this->views[ $view_id ] = $data;
267 267
 
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	private function filter_fields( $dir_fields ) {
298 298
 
299
-		if( empty( $dir_fields ) || !is_array( $dir_fields ) ) {
299
+		if ( empty( $dir_fields ) || ! is_array( $dir_fields ) ) {
300 300
 			return $dir_fields;
301 301
 		}
302 302
 
303
-		foreach( $dir_fields as $area => $fields ) {
303
+		foreach ( $dir_fields as $area => $fields ) {
304 304
 
305
-			foreach( (array)$fields as $uniqid => $properties ) {
305
+			foreach ( (array)$fields as $uniqid => $properties ) {
306 306
 
307
-				if( $this->hide_field_check_conditions( $properties ) ) {
307
+				if ( $this->hide_field_check_conditions( $properties ) ) {
308 308
 					unset( $dir_fields[ $area ][ $uniqid ] );
309 309
 				}
310 310
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	private function hide_field_check_conditions( $properties ) {
327 327
 
328 328
 		// logged-in visibility
329
-		if( ! empty( $properties['only_loggedin'] ) && ! GVCommon::has_cap( $properties['only_loggedin_cap'] ) ) {
329
+		if ( ! empty( $properties[ 'only_loggedin' ] ) && ! GVCommon::has_cap( $properties[ 'only_loggedin_cap' ] ) ) {
330 330
 			return true;
331 331
 		}
332 332
 
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 		// Get the settings from the shortcode and merge them with defaults.
344 344
 		$atts = wp_parse_args( $atts, self::get_default_args() );
345 345
 
346
-		$view_id = ! empty( $atts['view_id'] ) ? (int)$atts['view_id'] : NULL;
346
+		$view_id = ! empty( $atts[ 'view_id' ] ) ? (int)$atts[ 'view_id' ] : NULL;
347 347
 
348
-		if( empty( $view_id ) && !empty( $atts['id'] ) ) {
349
-			$view_id = (int)$atts['id'];
348
+		if ( empty( $view_id ) && ! empty( $atts[ 'id' ] ) ) {
349
+			$view_id = (int)$atts[ 'id' ];
350 350
 		}
351 351
 
352
-		if( empty( $view_id ) ) {
353
-			do_action('gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts );
352
+		if ( empty( $view_id ) ) {
353
+			do_action( 'gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts );
354 354
 			return;
355 355
 		}
356 356
 
@@ -372,46 +372,46 @@  discard block
 block discarded – undo
372 372
 		 * @hack This is so that the shortcode is registered for the oEmbed preview in the Admin
373 373
 		 * @since 1.6
374 374
 		 */
375
-		if( ! shortcode_exists('gravityview') && class_exists( 'GravityView_Shortcode' ) ) {
375
+		if ( ! shortcode_exists( 'gravityview' ) && class_exists( 'GravityView_Shortcode' ) ) {
376 376
 			new GravityView_Shortcode;
377 377
 		}
378 378
 
379 379
 		$shortcodes = gravityview_has_shortcode_r( $content, 'gravityview' );
380 380
 
381
-		if( empty( $shortcodes ) ) {
381
+		if ( empty( $shortcodes ) ) {
382 382
 			return NULL;
383 383
 		}
384 384
 
385
-		do_action('gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes );
385
+		do_action( 'gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes );
386 386
 
387 387
 		$ids = array();
388 388
 
389
-		foreach ($shortcodes as $key => $shortcode) {
389
+		foreach ( $shortcodes as $key => $shortcode ) {
390 390
 
391
-			$shortcode[3] = htmlspecialchars_decode( $shortcode[3], ENT_QUOTES );
391
+			$shortcode[ 3 ] = htmlspecialchars_decode( $shortcode[ 3 ], ENT_QUOTES );
392 392
 
393
-			$args = shortcode_parse_atts( $shortcode[3] );
393
+			$args = shortcode_parse_atts( $shortcode[ 3 ] );
394 394
 
395
-			if( empty( $args['id'] ) ) {
396
-				do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode );
395
+			if ( empty( $args[ 'id' ] ) ) {
396
+				do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode );
397 397
 				continue;
398 398
 			}
399 399
 
400
-			do_action('gravityview_log_debug', sprintf('GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args['id']), $args );
400
+			do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args[ 'id' ] ), $args );
401 401
 
402 402
 			// Store the View to the object for later fetching.
403
-			$this->add_view( $args['id'], $args );
403
+			$this->add_view( $args[ 'id' ], $args );
404 404
 
405
-			$ids[] = $args['id'];
405
+			$ids[ ] = $args[ 'id' ];
406 406
 		}
407 407
 
408
-		if( empty($ids) ) {
408
+		if ( empty( $ids ) ) {
409 409
 			return NULL;
410 410
 		}
411 411
 
412 412
 		// If it's just one ID, return that.
413 413
 		// Otherwise, return array of IDs
414
-		return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids;
414
+		return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids;
415 415
 
416 416
 	}
417 417
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		 */
433 433
 		$meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', array(), $post_id );
434 434
 
435
-		if( empty( $meta_keys ) ) {
435
+		if ( empty( $meta_keys ) ) {
436 436
 			return NULL;
437 437
 		}
438 438
 
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$meta_content = '';
442 442
 
443
-		foreach( $meta_keys as $key ) {
444
-			$meta = get_post_meta( $post_id, $key , true );
445
-			if( ! is_string( $meta ) ) {
443
+		foreach ( $meta_keys as $key ) {
444
+			$meta = get_post_meta( $post_id, $key, true );
445
+			if ( ! is_string( $meta ) ) {
446 446
 				continue;
447 447
 			}
448 448
 			$meta_content .= $meta . ' ';
449 449
 		}
450 450
 
451
-		if( empty( $meta_content ) ) {
452
-			do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys );
451
+		if ( empty( $meta_content ) ) {
452
+			do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys );
453 453
 			return NULL;
454 454
 		}
455 455
 
@@ -476,16 +476,16 @@  discard block
 block discarded – undo
476 476
 		$message = NULL;
477 477
 
478 478
 		// Not invalid if not set!
479
-		if( empty( $post_id ) || empty( $view_id ) ) {
479
+		if ( empty( $post_id ) || empty( $view_id ) ) {
480 480
 
481
-			if( $empty_is_valid ) {
481
+			if ( $empty_is_valid ) {
482 482
 				return true;
483 483
 			}
484 484
 
485 485
 			$message = esc_html__( 'The ID is required.', 'gravityview' );
486 486
 		}
487 487
 
488
-		if( ! $message ) {
488
+		if ( ! $message ) {
489 489
 			$status = get_post_status( $post_id );
490 490
 
491 491
 			// Nothing exists with that post ID.
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 			}
498 498
 		}
499 499
 
500
-		if( ! $message ) {
500
+		if ( ! $message ) {
501 501
 
502 502
 			// Nothing exists with that post ID.
503 503
 			if ( empty( $status ) || in_array( $status, array( 'revision', 'attachment' ) ) ) {
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 
507 507
 		}
508 508
 
509
-		if( ! $message ) {
510
-			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) )  {
509
+		if ( ! $message ) {
510
+			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
511 511
 				$views = GV\View_Collection::from_post( $post );
512 512
 				$view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() );
513 513
 			} else {
@@ -516,21 +516,21 @@  discard block
 block discarded – undo
516 516
 			}
517 517
 
518 518
 			// The post or page specified does not contain the shortcode.
519
-			if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) {
519
+			if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) {
520 520
 				$message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' );
521 521
 			}
522 522
 		}
523 523
 
524
-		if( ! $message ) {
524
+		if ( ! $message ) {
525 525
 
526 526
 			// It's a View
527
-			if( 'gravityview' === get_post_type( $post_id ) ) {
528
-				$message = esc_html__( 'The ID is already a View.', 'gravityview' );;
527
+			if ( 'gravityview' === get_post_type( $post_id ) ) {
528
+				$message = esc_html__( 'The ID is already a View.', 'gravityview' ); ;
529 529
 			}
530 530
 
531 531
 		}
532 532
 
533
-		if( $message ) {
533
+		if ( $message ) {
534 534
 			return new WP_Error( 'invalid_embed_id', $message );
535 535
 		}
536 536
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 
548 548
 		$args = self::get_default_args( $with_details );
549 549
 
550
-		if( !isset( $args[ $key ] ) ) { return NULL; }
550
+		if ( ! isset( $args[ $key ] ) ) { return NULL; }
551 551
 
552 552
 		return $args[ $key ];
553 553
 	}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		 */
577 577
 		$default_settings = apply_filters( 'gravityview_default_args', array(
578 578
 			'id' => array(
579
-				'label' => __('View ID', 'gravityview'),
579
+				'label' => __( 'View ID', 'gravityview' ),
580 580
 				'type' => 'number',
581 581
 				'group'	=> 'default',
582 582
 				'value' => NULL,
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				'show_in_shortcode' => false,
585 585
 			),
586 586
 			'page_size' => array(
587
-				'label' 	=> __('Number of entries per page', 'gravityview'),
587
+				'label' 	=> __( 'Number of entries per page', 'gravityview' ),
588 588
 				'type' => 'number',
589 589
 				'class'	=> 'small-text',
590 590
 				'group'	=> 'default',
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 			),
609 609
 			'admin_show_all_statuses' => array(
610 610
 				'label' => __( 'Show all entries to administrators', 'gravityview' ),
611
-				'desc'	=> __('Administrators will be able to see entries with any approval status.', 'gravityview'),
612
-				'tooltip' => __('Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview'),
611
+				'desc'	=> __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ),
612
+				'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ),
613 613
 				'requires' => 'show_only_approved',
614 614
 				'type' => 'checkbox',
615 615
 				'group'	=> 'default',
@@ -634,40 +634,40 @@  discard block
 block discarded – undo
634 634
 			'user_edit' => array(
635 635
 				'label'	=> __( 'Allow User Edit', 'gravityview' ),
636 636
 				'group'	=> 'default',
637
-				'desc'	=> __('Allow logged-in users to edit entries they created.', 'gravityview'),
637
+				'desc'	=> __( 'Allow logged-in users to edit entries they created.', 'gravityview' ),
638 638
 				'value'	=> 0,
639
-				'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'),
639
+				'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ),
640 640
 				'type'	=> 'checkbox',
641 641
 				'show_in_shortcode' => true,
642 642
 			),
643 643
 			'user_delete' => array(
644 644
 				'label'	=> __( 'Allow User Delete', 'gravityview' ),
645 645
 				'group'	=> 'default',
646
-				'desc'	=> __('Allow logged-in users to delete entries they created.', 'gravityview'),
646
+				'desc'	=> __( 'Allow logged-in users to delete entries they created.', 'gravityview' ),
647 647
 				'value'	=> 0,
648
-				'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'),
648
+				'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ),
649 649
 				'type'	=> 'checkbox',
650 650
 				'show_in_shortcode' => true,
651 651
 			),
652 652
 			'sort_field' => array(
653
-				'label'	=> __('Sort by field', 'gravityview'),
653
+				'label'	=> __( 'Sort by field', 'gravityview' ),
654 654
 				'type' => 'select',
655 655
 				'value' => '',
656 656
 				'group'	=> 'sort',
657 657
 				'options' => array(
658
-					'' => __( 'Default', 'gravityview'),
659
-					'date_created' => __( 'Date Created', 'gravityview'),
658
+					'' => __( 'Default', 'gravityview' ),
659
+					'date_created' => __( 'Date Created', 'gravityview' ),
660 660
 				),
661 661
 				'show_in_shortcode' => true,
662 662
 			),
663 663
 			'sort_direction' => array(
664
-				'label' 	=> __('Sort direction', 'gravityview'),
664
+				'label' 	=> __( 'Sort direction', 'gravityview' ),
665 665
 				'type' => 'select',
666 666
 				'value' => 'ASC',
667 667
 				'group'	=> 'sort',
668 668
 				'options' => array(
669
-					'ASC' => __('ASC', 'gravityview'),
670
-					'DESC' => __('DESC', 'gravityview'),
669
+					'ASC' => __( 'ASC', 'gravityview' ),
670
+					'DESC' => __( 'DESC', 'gravityview' ),
671 671
 					//'RAND' => __('Random', 'gravityview'),
672 672
 				),
673 673
 				'show_in_shortcode' => true,
@@ -683,69 +683,69 @@  discard block
 block discarded – undo
683 683
 				'show_in_template' => array( 'default_table' ),
684 684
 			),
685 685
 			'start_date' => array(
686
-				'label' 	=> __('Filter by Start Date', 'gravityview'),
686
+				'label' 	=> __( 'Filter by Start Date', 'gravityview' ),
687 687
 				'class'	=> 'gv-datepicker',
688
-				'desc'	=> __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
688
+				'desc'	=> __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ),
689 689
 				'type' => 'text',
690 690
 				'value' => '',
691 691
 				'group'	=> 'filter',
692 692
 				'show_in_shortcode' => true,
693 693
 			),
694 694
 			'end_date' => array(
695
-				'label' 	=> __('Filter by End Date', 'gravityview'),
695
+				'label' 	=> __( 'Filter by End Date', 'gravityview' ),
696 696
 				'class'	=> 'gv-datepicker',
697
-				'desc'	=> __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
697
+				'desc'	=> __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ),
698 698
 				'type' => 'text',
699 699
 				'value' => '',
700 700
 				'group'	=> 'filter',
701 701
 				'show_in_shortcode' => true,
702 702
 			),
703 703
 			'class' => array(
704
-				'label' 	=> __('CSS Class', 'gravityview'),
705
-				'desc'	=> __('CSS class to add to the wrapping HTML container.', 'gravityview'),
704
+				'label' 	=> __( 'CSS Class', 'gravityview' ),
705
+				'desc'	=> __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ),
706 706
 				'group'	=> 'default',
707 707
 				'type' => 'text',
708 708
 				'value' => '',
709 709
 				'show_in_shortcode' => false,
710 710
 			),
711 711
 			'search_value' => array(
712
-				'label' 	=> __('Search Value', 'gravityview'),
713
-				'desc'	=> __('Define a default search value for the View', 'gravityview'),
712
+				'label' 	=> __( 'Search Value', 'gravityview' ),
713
+				'desc'	=> __( 'Define a default search value for the View', 'gravityview' ),
714 714
 				'type' => 'text',
715 715
 				'value' => '',
716 716
 				'group'	=> 'filter',
717 717
 				'show_in_shortcode' => false,
718 718
 			),
719 719
 			'search_field' => array(
720
-				'label' 	=> __('Search Field', 'gravityview'),
721
-				'desc'	=> __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'),
720
+				'label' 	=> __( 'Search Field', 'gravityview' ),
721
+				'desc'	=> __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ),
722 722
 				'type' => 'number',
723 723
 				'value' => '',
724 724
 				'group'	=> 'filter',
725 725
 				'show_in_shortcode' => false,
726 726
 			),
727 727
 			'single_title' => array(
728
-				'label'	=> __('Single Entry Title', 'gravityview'),
728
+				'label'	=> __( 'Single Entry Title', 'gravityview' ),
729 729
 				'type'	=> 'text',
730
-				'desc'	=> __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'),
730
+				'desc'	=> __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ),
731 731
 				'group'	=> 'default',
732 732
 				'value'	=> '',
733 733
 				'show_in_shortcode' => false,
734 734
 				'full_width' => true,
735 735
 			),
736 736
 			'back_link_label' => array(
737
-				'label'	=> __('Back Link Label', 'gravityview'),
737
+				'label'	=> __( 'Back Link Label', 'gravityview' ),
738 738
 				'group'	=> 'default',
739
-				'desc'	=> __('The text of the link that returns to the multiple entries view.', 'gravityview'),
739
+				'desc'	=> __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ),
740 740
 				'type'	=> 'text',
741 741
 				'value'	=> '',
742 742
 				'show_in_shortcode' => false,
743 743
 				'full_width' => true,
744 744
 			),
745 745
 			'embed_only' => array(
746
-				'label'	=> __('Prevent Direct Access', 'gravityview'),
746
+				'label'	=> __( 'Prevent Direct Access', 'gravityview' ),
747 747
 				'group'	=> 'default',
748
-				'desc'	=> __('Only allow access to this View when embedded using the shortcode.', 'gravityview'),
748
+				'desc'	=> __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ),
749 749
 				'type'	=> 'checkbox',
750 750
 				'value'	=> '',
751 751
 				'show_in_shortcode' => false,
@@ -756,15 +756,15 @@  discard block
 block discarded – undo
756 756
 				'value' => '',
757 757
 				'show_in_shortcode' => false,
758 758
 			),
759
-		));
759
+		) );
760 760
 
761 761
 		// By default, we only want the key => value pairing, not the whole array.
762
-		if( empty( $with_details ) ) {
762
+		if ( empty( $with_details ) ) {
763 763
 
764 764
 			$defaults = array();
765 765
 
766
-			foreach( $default_settings as $key => $value ) {
767
-				$defaults[ $key ] = $value['value'];
766
+			foreach ( $default_settings as $key => $value ) {
767
+				$defaults[ $key ] = $value[ 'value' ];
768 768
 			}
769 769
 
770 770
 			return $defaults;
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 		// But sometimes, we want all the details.
774 774
 		else {
775 775
 
776
-			foreach ($default_settings as $key => $value) {
776
+			foreach ( $default_settings as $key => $value ) {
777 777
 
778 778
 				// If the $group argument is set for the method,
779 779
 				// ignore any settings that aren't in that group.
780
-				if( !empty( $group ) && is_string( $group ) ) {
781
-					if( empty( $value['group'] ) || $value['group'] !== $group ) {
780
+				if ( ! empty( $group ) && is_string( $group ) ) {
781
+					if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) {
782 782
 						unset( $default_settings[ $key ] );
783 783
 					}
784 784
 				}
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 						/** Deprecated, see \GV\View_Collection::from_post */
82 82
 						if( ( get_post_type( $post ) === 'gravityview' ) ) {
83 83
 							$ids[] = $post->ID;
84
-						} else{
84
+						} else {
85 85
 							// Parse the Post Content
86 86
 							$id = $this->parse_post_content( $post->post_content );
87 87
 							if( $id ) {
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 					if ( function_exists( 'gravityview' ) ) {
106 106
 						$shortcodes = \GV\Shortcode::parse( $passed_post );
107 107
 						foreach ( $shortcodes as $shortcode ) {
108
-							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) )
109
-								$ids []= $shortcode->atts['id'];
108
+							if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) {
109
+															$ids []= $shortcode->atts['id'];
110
+							}
110 111
 						}
111 112
 					} else {
112 113
 						/** Deprecated, use \GV\Shortcode::parse. */
@@ -507,7 +508,7 @@  discard block
 block discarded – undo
507 508
 		}
508 509
 
509 510
 		if( ! $message ) {
510
-			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) )  {
511
+			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
511 512
 				$views = GV\View_Collection::from_post( $post );
512 513
 				$view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() );
513 514
 			} else {
Please login to merge, or discard this patch.
includes/class-oembed.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	static function getInstance() {
44 44
 
45
-		if( empty( self::$instance ) ) {
45
+		if ( empty( self::$instance ) ) {
46 46
 			self::$instance = new self;
47 47
 
48 48
 			self::$instance->initialize();
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// Catch either
100 100
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
101 101
 
102
-		return '#'.$match_regex.'#i';
102
+		return '#' . $match_regex . '#i';
103 103
 	}
104 104
 
105 105
 	/**
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$post_id = url_to_postid( $url );
120 120
 
121
-		if( empty( $post_id ) ) {
121
+		if ( empty( $post_id ) ) {
122 122
 
123 123
 			$args = array(
124 124
 				'post_status' => 'publish',
125 125
 				'name' => $slug,
126
-				'post_type' => array('any', 'gravityview'),
126
+				'post_type' => array( 'any', 'gravityview' ),
127 127
 			);
128 128
 
129 129
 			$posts = get_posts( $args );
130 130
 
131
-			if( !empty( $posts ) ) {
132
-				$post_id = $posts[0]->ID;
131
+			if ( ! empty( $posts ) ) {
132
+				$post_id = $posts[ 0 ]->ID;
133 133
 			}
134 134
 		}
135 135
 
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
163 163
 
164 164
 		// If not using permalinks, re-assign values for matching groups
165
-		if( !empty( $matches['entry_slug2'] ) ) {
166
-			$matches['is_cpt'] = $matches['is_cpt2'];
167
-			$matches['slug'] = $matches['slug2'];
168
-			$matches['entry_slug'] = $matches['entry_slug2'];
169
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
165
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
166
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
167
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
168
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
169
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
170 170
 		}
171 171
 
172 172
 		// No Entry was found
173
-		if( empty( $matches['entry_slug'] ) ) {
173
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
174 174
 
175
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
175
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
176 176
 
177 177
 			return '';
178 178
 		}
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 		// Setup the data used
183 183
 		$this->set_vars( $matches, $attr, $url, $rawattr );
184 184
 
185
-		if( is_admin() && !$this->is_full_oembed_preview ) {
185
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
186 186
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
187 187
 		} else {
188 188
 
189
-			if( $this->is_full_oembed_preview ) {
189
+			if ( $this->is_full_oembed_preview ) {
190 190
 				$return .= $this->generate_preview_notice();
191 191
 			}
192 192
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	private function generate_preview_notice() {
206 206
 		$floaty = GravityView_Admin::get_floaty();
207 207
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
208
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
209
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
208
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
209
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
210 210
 	}
211 211
 
212 212
 	/**
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
221 221
 
222
-		$this->entry_id = $matches['entry_slug'];
222
+		$this->entry_id = $matches[ 'entry_slug' ];
223 223
 
224
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
224
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
225 225
 
226 226
 		// The URL didn't have the View Custom Post Type structure.
227
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
227
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
228 228
 
229
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
229
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
230 230
 
231 231
 			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
232 232
 				$views = \GV\View_Collection::from_post( $post );
233 233
 				$views = $views->all();
234 234
 				if ( ! empty( $views ) )
235
-					$this->view_id = $views[0]->ID;
235
+					$this->view_id = $views[ 0 ]->ID;
236 236
 			} else {
237 237
 				/** Deprecated. */
238 238
 				$this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id );
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		}
246 246
 
247 247
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
248
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
248
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
249 249
 	}
250 250
 
251 251
 	/**
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 		// Floaty the astronaut
264 264
 		$image = GravityView_Admin::get_floaty();
265 265
 
266
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
266
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
267 267
 
268
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
268
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
269 269
 
270 270
 		return '
271 271
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
272
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
272
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
273 273
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
274
-				'.$embed_text.'
274
+				'.$embed_text . '
275 275
 			</p>
276 276
 			<br style="clear: both;">
277 277
 		</div>';
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
327 327
 
328 328
 		// If it's already been parsed, don't re-output it.
329
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
329
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
330 330
 			return $this->output[ $this->entry_id ];
331 331
 		}
332 332
 
333 333
 		$entry_output = $this->generate_entry_output();
334 334
 
335 335
 		// Wrap a container div around the output to allow for custom styling
336
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
336
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
337 337
 
338 338
 		/**
339 339
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		 *  @var string $url The original URL that was matched by the regex. \n
347 347
 		 *  @var array $rawattr The original unmodified attributes.
348 348
 		 */
349
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
349
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
350 350
 
351 351
 		unset( $entry_output );
352 352
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -231,8 +231,9 @@
 block discarded – undo
231 231
 			if ( function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) {
232 232
 				$views = \GV\View_Collection::from_post( $post );
233 233
 				$views = $views->all();
234
-				if ( ! empty( $views ) )
235
-					$this->view_id = $views[0]->ID;
234
+				if ( ! empty( $views ) ) {
235
+									$this->view_id = $views[0]->ID;
236
+				}
236 237
 			} else {
237 238
 				/** Deprecated. */
238 239
 				$this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id );
Please login to merge, or discard this patch.