Completed
Pull Request — master (#1461)
by Zack
17:37 queued 14:56
created
includes/class-gravityview-entry-approval.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 * @param  int $entry_id ID of the Gravity Forms entry
372 372
 	 * @param  string $status String whether entry is approved or not. `0` for not approved, `Approved` for approved.
373 373
 	 * @param int $form_id ID of the form of the entry being updated. Improves query performance.
374
-	 * @param string $approvedcolumn Gravity Forms Field ID
374
+	 * @param integer $approvedcolumn Gravity Forms Field ID
375 375
 	 *
376 376
 	 * @return true|WP_Error
377 377
 	 */
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 *
425 425
 	 * @since 1.19
426 426
 	 *
427
-	 * @param array|int $form Form ID or form array
427
+	 * @param integer $form Form ID or form array
428 428
 	 * @param string $approved_column Approved column field ID
429 429
 	 *
430 430
 	 * @return string|null
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -326,6 +326,6 @@
 block discarded – undo
326 326
 <a href="#" data-approved="{$choices['approved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices['approved']['action']}"><span class="screen-reader-text">{$choices['approved']['action']}</span></a>
327 327
 <a href="#" data-approved="{$choices['disapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices['disapproved']['action']}"><span class="screen-reader-text">{$choices['disapproved']['action']}</span></a>
328 328
 <a href="#" data-approved="{$choices['unapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices['unapproved']['action']}"><span class="screen-reader-text">{$choices['unapproved']['action']}</span></a>
329
-TEMPLATE;
329
+template;
330 330
 	}
331 331
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 		// autounapprove
51 51
 		add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 );
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 			return;
95 95
 		}
96 96
 
97
-		$form = GFAPI::get_form( $entry['form_id'] );
97
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
98 98
 
99 99
 		if ( ! $form ) {
100
-			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) );
100
+			gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) );
101 101
 			return;
102 102
 		}
103 103
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public static function add_approval_notification_events( $notification_events = array(), $form = array() ) {
116 116
 
117
-		$notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
-		$notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
-		$notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
-		$notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
117
+		$notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' );
118
+		$notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' );
119
+		$notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' );
120
+		$notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' );
121 121
 
122 122
 		return $notification_events;
123 123
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
137 137
 
138
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true );
138
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true );
139 139
 
140 140
 		$status = gform_get_meta( $entry_id, self::meta_key );
141 141
 
142 142
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
143 143
 
144
-		if( 'value' === $value_or_label ) {
144
+		if ( 'value' === $value_or_label ) {
145 145
 			return $status;
146 146
 		}
147 147
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		$nonce = \GV\Utils::_POST( 'nonce' );
180 180
 
181 181
 		// Valid status
182
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
182
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
183 183
 
184 184
 			gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) );
185 185
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
212 212
 
213
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
213
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
214 214
 
215 215
 		}
216 216
 
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 		}
273 273
 
274 274
 		// Set default
275
-		self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] );
275
+		self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] );
276 276
 
277 277
 		// Then check for if there is an approval column, and use that value instead
278
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
278
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
279 279
 	}
280 280
 
281 281
 	/**
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
291 291
 
292
-		$approved_column = self::get_approved_column( $form['id'] );
292
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
293 293
 
294 294
 		/**
295 295
 		 * If the form doesn't contain the approve field, don't assume anything.
296 296
 		 */
297
-		if( empty( $approved_column ) ) {
297
+		if ( empty( $approved_column ) ) {
298 298
 			return;
299 299
 		}
300 300
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		 */
317 317
 		$value = apply_filters( 'gravityview/approve_entries/update_unapproved_meta', $value, $form, $entry );
318 318
 
319
-		self::update_approved_meta( $entry_id, $value, $form['id'] );
319
+		self::update_approved_meta( $entry_id, $value, $form[ 'id' ] );
320 320
 	}
321 321
 
322 322
 	/**
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public static function update_bulk( $entries = array(), $approved = 0, $form_id = 0 ) {
336 336
 
337
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
337
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
338 338
 			gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) );
339 339
 			return NULL;
340 340
 		}
341 341
 
342
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
342
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
343 343
 			gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' );
344 344
 			return NULL;
345 345
 		}
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 		$approved_column_id = self::get_approved_column( $form_id );
355 355
 
356 356
 		$success = true;
357
-		foreach( $entries as $entry_id ) {
357
+		foreach ( $entries as $entry_id ) {
358 358
 			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
359 359
 
360
-			if( ! $update_success ) {
360
+			if ( ! $update_success ) {
361 361
 				$success = false;
362 362
 			}
363 363
 		}
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) {
383 383
 
384
-		if( !class_exists( 'GFAPI' ) ) {
384
+		if ( ! class_exists( 'GFAPI' ) ) {
385 385
 			gravityview()->log->error( 'GFAPI does not exist' );
386 386
 			return false;
387 387
 		}
388 388
 
389
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
389
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
390 390
 			gravityview()->log->error( 'Not a valid approval value.' );
391 391
 			return false;
392 392
 		}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		// If the form has an Approve/Reject field, update that value
404 404
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
405 405
 
406
-		if( is_wp_error( $result ) ) {
406
+		if ( is_wp_error( $result ) ) {
407 407
 			gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) );
408 408
 			return false;
409 409
 		}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 		// add note to entry if approval field updating worked or there was no approved field
417 417
 		// There's no validation for the meta
418
-		if( true === $result ) {
418
+		if ( true === $result ) {
419 419
 
420 420
 			// Add an entry note
421 421
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 		$note_id = false;
470 470
 
471
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
471
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
472 472
 
473 473
 			$current_user = wp_get_current_user();
474 474
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
492 492
 
493
-		if( empty( $approvedcolumn ) ) {
493
+		if ( empty( $approvedcolumn ) ) {
494 494
 			$approvedcolumn = self::get_approved_column( $form_id );
495 495
 		}
496 496
 
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
514 514
 
515 515
 		$new_value = '';
516
-		if( GravityView_Entry_Approval_Status::APPROVED === $status ) {
516
+		if ( GravityView_Entry_Approval_Status::APPROVED === $status ) {
517 517
 			$new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn );
518 518
 		}
519 519
 
520 520
 		//update entry
521
-		$entry["{$approvedcolumn}"] = $new_value;
521
+		$entry[ "{$approvedcolumn}" ] = $new_value;
522 522
 
523 523
 		/**
524 524
 		 * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 		// If the user has enabled a different value than the label (for some reason), use it.
550 550
 		// This is highly unlikely
551 551
 		if ( is_array( $field->choices ) && ! empty( $field->choices ) ) {
552
-			return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text'];
552
+			return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ];
553 553
 		}
554 554
 
555 555
 		// Otherwise, fall back on the inputs array
556 556
 		if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) {
557
-			return $field->inputs[0]['label'];
557
+			return $field->inputs[ 0 ][ 'label' ];
558 558
 		}
559 559
 
560 560
 		return null;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		 * @since 1.18 Added "unapproved"
607 607
 		 * @param  int $entry_id ID of the Gravity Forms entry
608 608
 		 */
609
-		do_action( 'gravityview/approve_entries/' . $action , $entry_id );
609
+		do_action( 'gravityview/approve_entries/' . $action, $entry_id );
610 610
 	}
611 611
 
612 612
 	/**
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	static public function get_approved_column( $form ) {
621 621
 
622
-		if( empty( $form ) ) {
622
+		if ( empty( $form ) ) {
623 623
 			return null;
624 624
 		}
625 625
 
626
-		if( !is_array( $form ) ) {
626
+		if ( ! is_array( $form ) ) {
627 627
 			$form = GVCommon::get_form( $form );
628 628
 		}
629 629
 
@@ -633,22 +633,22 @@  discard block
 block discarded – undo
633 633
 		 * @var string $key
634 634
 		 * @var GF_Field $field
635 635
 		 */
636
-		foreach( $form['fields'] as $key => $field ) {
636
+		foreach ( $form[ 'fields' ] as $key => $field ) {
637 637
 
638 638
 			$inputs = $field->get_entry_inputs();
639 639
 
640
-			if( !empty( $field->gravityview_approved ) ) {
641
-				if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) {
642
-					$approved_column_id = $inputs[0]['id'];
640
+			if ( ! empty( $field->gravityview_approved ) ) {
641
+				if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) {
642
+					$approved_column_id = $inputs[ 0 ][ 'id' ];
643 643
 					break;
644 644
 				}
645 645
 			}
646 646
 
647 647
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
648
-			if( 'checkbox' === $field->type && ! empty( $inputs ) ) {
648
+			if ( 'checkbox' === $field->type && ! empty( $inputs ) ) {
649 649
 				foreach ( $inputs as $input ) {
650
-					if ( 'approved' === strtolower( $input['label'] ) ) {
651
-						$approved_column_id = $input['id'];
650
+					if ( 'approved' === strtolower( $input[ 'label' ] ) ) {
651
+						$approved_column_id = $input[ 'id' ];
652 652
 						break;
653 653
 					}
654 654
 				}
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 		$view_keys = array_keys( $gv_data->get_views() );
676 676
 
677
-		$view = \GV\View::by_id( $view_keys[0] );
677
+		$view = \GV\View::by_id( $view_keys[ 0 ] );
678 678
 
679 679
 		if ( ! $view->settings->get( 'unapprove_edit' ) ) {
680 680
 			return;
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 			return;
700 700
 		}
701 701
 
702
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
702
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
703 703
 			$approval_status = GravityView_Entry_Approval_Status::UNAPPROVED;
704 704
 		}
705 705
 
706
-		self::update_approved_meta( $entry_id, $approval_status, $form['id'] );
706
+		self::update_approved_meta( $entry_id, $approval_status, $form[ 'id' ] );
707 707
 	}
708 708
 
709 709
 	/**
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
 		$choices = GravityView_Entry_Approval_Status::get_all();
742 742
 
743 743
 		return <<<TEMPLATE
744
-<a href="#" data-approved="{$choices['approved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices['approved']['action']}"><span class="screen-reader-text">{$choices['approved']['action']}</span></a>
745
-<a href="#" data-approved="{$choices['disapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices['disapproved']['action']}"><span class="screen-reader-text">{$choices['disapproved']['action']}</span></a>
746
-<a href="#" data-approved="{$choices['unapproved']['value']}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices['unapproved']['action']}"><span class="screen-reader-text">{$choices['unapproved']['action']}</span></a>
744
+<a href="#" data-approved="{$choices[ 'approved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-approved popover" title="{$choices[ 'approved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'approved' ][ 'action' ]}</span></a>
745
+<a href="#" data-approved="{$choices[ 'disapproved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-disapproved popover" title="{$choices[ 'disapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'disapproved' ][ 'action' ]}</span></a>
746
+<a href="#" data-approved="{$choices[ 'unapproved' ][ 'value' ]}" aria-role="button"  aria-live="polite" class="gv-approval-toggle gv-approval-unapproved popover" title="{$choices[ 'unapproved' ][ 'action' ]}"><span class="screen-reader-text">{$choices[ 'unapproved' ][ 'action' ]}</span></a>
747 747
 TEMPLATE;
748 748
 	}
749 749
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 	 * @param bool $url_encode Whether to URL-encode output
246 246
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
247 247
 	 *
248
-	 * @return mixed
248
+	 * @return string
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * Auto-assign label from Gravity Forms label, if exists
153 153
 		 * @since 1.20
154 154
 		 */
155
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
155
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
156 156
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
157 157
 		}
158 158
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			'type'  => $this->name
176 176
 		);
177 177
 
178
-		$fields["{$this->entry_meta_key}"] = $added_field;
178
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
179 179
 
180 180
 		return $fields;
181 181
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
197 197
 
198
-		if( $this->name === $field['field'] && '' === $label ) {
198
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
199 199
 			$label = esc_html( $this->default_search_label );
200 200
 		}
201 201
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
218 218
 	 */
219
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
219
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220 220
 
221 221
 		// Is there is field merge tag? Strip whitespace off the ned, too.
222 222
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
252
-		foreach( $matches as $match ) {
252
+		foreach ( $matches as $match ) {
253 253
 
254
-			$full_tag = $match[0];
254
+			$full_tag = $match[ 0 ];
255 255
 
256 256
 			// Strip the Merge Tags
257
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
257
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
258 258
 
259 259
 			// Replace the value from the entry, if exists
260
-			if( isset( $entry[ $tag ] ) ) {
260
+			if ( isset( $entry[ $tag ] ) ) {
261 261
 
262 262
 				$value = $entry[ $tag ];
263 263
 
264
-				if( is_callable( array( $this, 'get_content') ) ) {
264
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
265 265
 					$value = $this->get_content( $value );
266 266
 				}
267 267
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function _filter_sortable_fields( $not_sortable ) {
336 336
 
337
-		if( ! $this->is_sortable ) {
338
-			$not_sortable[] = $this->name;
337
+		if ( ! $this->is_sortable ) {
338
+			$not_sortable[ ] = $this->name;
339 339
 		}
340 340
 
341 341
 		return $not_sortable;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	function add_entry_meta( $entry_meta ) {
354 354
 
355
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
355
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
356 356
 
357 357
 			$added_meta = array(
358 358
 				'label'             => $this->label,
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 			);
362 362
 
363 363
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
364
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
364
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
365 365
 			}
366 366
 
367
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
367
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
368 368
 
369 369
 		} else {
370
-			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta["{$this->entry_meta_key}"] ) );
370
+			gravityview()->log->error( 'Entry meta already set: {meta_key}', array( 'meta_key' => $this->entry_meta_key, 'data' =>  $entry_meta[ "{$this->entry_meta_key}" ] ) );
371 371
 		}
372 372
 
373 373
 		return $entry_meta;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			'date_display' => array(
397 397
 				'type' => 'text',
398 398
 				'label' => __( 'Override Date Format', 'gravityview' ),
399
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
399
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
400 400
 				/**
401 401
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
402 402
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 		$options = $this->field_support_options();
423 423
 
424
-		if( isset( $options[ $key ] ) ) {
424
+		if ( isset( $options[ $key ] ) ) {
425 425
 			$field_options[ $key ] = $options[ $key ];
426 426
 		}
427 427
 
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 		$connected_form = \GV\Utils::_POST( 'form_id' );
486 486
 
487 487
 		// Otherwise, get the Form ID from the Post page
488
-		if( empty( $connected_form ) ) {
488
+		if ( empty( $connected_form ) ) {
489 489
 			$connected_form = gravityview_get_form_id( get_the_ID() );
490 490
 		}
491 491
 
492
-		if( empty( $connected_form ) ) {
492
+		if ( empty( $connected_form ) ) {
493 493
 			gravityview()->log->error( 'Form not found for form ID "{form_id}"', array( 'form_id' => $connected_form ) );
494 494
 			return false;
495 495
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-type.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) {
60 60
 
61 61
 		/** Overridden by a template. */
62
-		if( ! empty( $field['field_path'] ) ) { return $output; }
62
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
63 63
 
64 64
 		return $this->get_string_from_value( $output );
65 65
 	}
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 		switch ( intval( $value ) ) {
79 79
 			case self::ONE_TIME_PAYMENT:
80 80
 			default:
81
-				$return = __('One-Time Payment', 'gravityview');
81
+				$return = __( 'One-Time Payment', 'gravityview' );
82 82
 				break;
83 83
 
84 84
 			case self::SUBSCRIPTION:
85
-				$return = __('Subscription', 'gravityview');
85
+				$return = __( 'Subscription', 'gravityview' );
86 86
 				break;
87 87
 		}
88 88
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 *
73 73
 	 * @param mixed $value The value in.
74 74
 	 *
75
-	 * @return mixed The value out.
75
+	 * @return string The value out.
76 76
 	 */
77 77
 	public function get_value( $value ) {
78 78
 		return $this->get_string_from_value( $value );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,6 @@
 block discarded – undo
40 40
 	 * Get the default date format for a field based on the field ID and the time format setting
41 41
 	 *
42 42
 	 * @since 1.16.4
43
-
44 43
 	 * @param string $date_format The Gravity Forms date format for the field. Default: "mdy"
45 44
 	 * @param int $field_id The ID of the field. Used to figure out full date/day/month/year
46 45
 	 *
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
38
-		$this->add_field_support('date_display', $field_options );
38
+		$this->add_field_support( 'date_display', $field_options );
39 39
 
40 40
 		return $field_options;
41 41
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$field_input_id = gravityview_get_input_id_from_id( $field_id );
84 84
 
85 85
 		$date_field_output = '';
86
-		switch( $field_input_id ) {
86
+		switch ( $field_input_id ) {
87 87
 			case 1:
88 88
 				$date_field_output = \GV\Utils::get( $parsed_date, 'month' );
89 89
 				break;
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function edit_entry_fix_uid_fields( $fields ) {
51 51
 
52 52
 		/** @var GF_Field $field */
53
-		foreach( $fields as &$field ) {
53
+		foreach ( $fields as &$field ) {
54 54
 			if ( 'uid' === $field->type ) {
55 55
 
56 56
 				// Replace GF_Field with GF_Field_Text, copying all the data from $field
Please login to merge, or discard this patch.
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/admin/field-types/type_multiselect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		?>
14 14
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
15 15
 
16
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
16
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
17 17
 
18 18
 			echo $this->get_tooltip() . $this->get_field_desc();
19 19
 
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 
27 27
 	function render_input( $override_input = null ) {
28 28
 
29
-		if( isset( $override_input ) ) {
29
+		if ( isset( $override_input ) ) {
30 30
 			echo $override_input;
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		?>
35 35
 		<select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple">
36
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
36
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
37 37
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option>
38 38
 			<?php endforeach; ?>
39 39
 		</select>
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
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.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * Return array of fields' id and label, for a given Form ID
271 271
 	 *
272 272
 	 * @access public
273
-	 * @param string|array $form_id (default: '') or $form object
273
+	 * @param string|array $form (default: '') or $form object
274 274
 	 * @param bool $add_default_properties
275 275
 	 * @param bool $include_parent_field
276 276
 	 * @return array
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 	 *
1013 1013
 	 * @param array $form Gravity Forms form array
1014 1014
 	 * @param string $field_id ID of the field. If an input, full input ID (like `1.3`)
1015
-	 * @param string|array $field_value Raw value of the field.
1015
+	 * @param string $field_value Raw value of the field.
1016 1016
 	 * @return string
1017 1017
 	 */
1018 1018
 	public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) {
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 	 *
1516 1516
 	 * Do the same than parse_str without max_input_vars limitation:
1517 1517
 	 * Parses $string as if it were the query string passed via a URL and sets variables in the current scope.
1518
-	 * @param $string string string to parse (not altered like in the original parse_str(), use the second parameter!)
1518
+	 * @param string $string string string to parse (not altered like in the original parse_str(), use the second parameter!)
1519 1519
 	 * @param $result array  If the second parameter is present, variables are stored in this variable as array elements
1520 1520
 	 * @return bool true or false if $string is an empty string
1521 1521
 	 * @since  1.5.3
@@ -1750,9 +1750,9 @@  discard block
 block discarded – undo
1750 1750
 	 * @param string $message            Message body (required)
1751 1751
 	 * @param string $from_name          Displayed name of the sender
1752 1752
 	 * @param string $message_format     If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html".
1753
-	 * @param string|array $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1753
+	 * @param string $attachments  Optional. Files to attach. {@see wp_mail()} for usage. Default: "".
1754 1754
 	 * @param array|false $entry         Gravity Forms entry array, related to the email. Default: false.
1755
-	 * @param array|false $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1755
+	 * @param boolean $notification  Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false.
1756 1756
 	 */
1757 1757
 	public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) {
1758 1758
 
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -310,12 +310,12 @@  discard block
 block discarded – undo
310 310
 						}
311 311
 
312 312
 						/**
313
-                         * @hack
314
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
315
-                         */
313
+						 * @hack
314
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
315
+						 */
316 316
 						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
317
-                            continue;
318
-                        }
317
+							continue;
318
+						}
319 319
 						$fields["{$input['id']}"] = array(
320 320
 							'label' => \GV\Utils::get( $input, 'label' ),
321 321
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 			),
1489 1489
 		);
1490 1490
 
1491
-        $fields = $date_created + $fields;
1491
+		$fields = $date_created + $fields;
1492 1492
 
1493 1493
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1494 1494
 
@@ -1516,13 +1516,13 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
 		}
1518 1518
 
1519
-        /**
1520
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1521
-         * @since 1.12
1522
-         * @param array $fields Sub-set of GF form fields that are sortable
1523
-         * @param int $formid The Gravity Forms form ID that the fields are from
1524
-         */
1525
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1519
+		/**
1520
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1521
+		 * @since 1.12
1522
+		 * @param array $fields Sub-set of GF form fields that are sortable
1523
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1524
+		 */
1525
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1526 1526
 
1527 1527
 		return $fields;
1528 1528
 	}
@@ -1814,26 +1814,26 @@  discard block
 block discarded – undo
1814 1814
 	}
1815 1815
 
1816 1816
 
1817
-    /**
1818
-     * Display updated/error notice
1819
-     *
1820
-     * @since 1.19.2 Added $cap and $object_id parameters
1821
-     *
1822
-     * @param string $notice text/HTML of notice
1823
-     * @param string $class CSS class for notice (`updated` or `error`)
1824
-     * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1825
-     *
1826
-     * @return string
1827
-     */
1828
-    public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1829
-
1830
-    	// If $cap is defined, only show notice if user has capability
1831
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1832
-    		return '';
1833
-	    }
1834
-
1835
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1836
-    }
1817
+	/**
1818
+	 * Display updated/error notice
1819
+	 *
1820
+	 * @since 1.19.2 Added $cap and $object_id parameters
1821
+	 *
1822
+	 * @param string $notice text/HTML of notice
1823
+	 * @param string $class CSS class for notice (`updated` or `error`)
1824
+	 * @param string $cap [Optional] Define a capability required to show a notice. If not set, displays to all caps.
1825
+	 *
1826
+	 * @return string
1827
+	 */
1828
+	public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1829
+
1830
+		// If $cap is defined, only show notice if user has capability
1831
+		if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1832
+			return '';
1833
+		}
1834
+
1835
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1836
+	}
1837 1837
 
1838 1838
 	/**
1839 1839
 	 * 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.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 		$form = false;
127 127
 
128
-		if( $entry ) {
129
-			$form = GFAPI::get_form( $entry['form_id'] );
128
+		if ( $entry ) {
129
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
130 130
 		}
131 131
 
132 132
 		return $form;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			}
203 203
 		}
204 204
 
205
-		return (bool) $has_transaction_data;
205
+		return (bool)$has_transaction_data;
206 206
 	}
207 207
 
208 208
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
242 242
 
243
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
243
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
244 244
 
245 245
 		return $result;
246 246
 	}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
262 262
 	 */
263
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
263
+	public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
264 264
 		$forms = array();
265 265
 		if ( ! class_exists( 'GFAPI' ) ) {
266 266
 			return array();
267 267
 		}
268 268
 
269
-		if( 'any' === $active ) {
269
+		if ( 'any' === $active ) {
270 270
 			$active_forms = GFAPI::get_forms( true, $trash );
271 271
 			$inactive_forms = GFAPI::get_forms( false, $trash );
272 272
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 		$has_post_fields = false;
300 300
 
301 301
 		if ( $form ) {
302
-			foreach ( $form['fields'] as $field ) {
303
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
304
-					$fields["{$field['id']}"] = array(
302
+			foreach ( $form[ 'fields' ] as $field ) {
303
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
304
+					$fields[ "{$field[ 'id' ]}" ] = array(
305 305
 						'label' => \GV\Utils::get( $field, 'label' ),
306 306
 						'parent' => null,
307 307
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 					);
311 311
 				}
312 312
 
313
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
314
-					foreach ( $field['inputs'] as $input ) {
313
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
314
+					foreach ( $field[ 'inputs' ] as $input ) {
315 315
 
316
-						if( ! empty( $input['isHidden'] ) ) {
316
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
317 317
 							continue;
318 318
 						}
319 319
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
                          * @hack
322 322
                          * In case of email/email confirmation, the input for email has the same id as the parent field
323 323
                          */
324
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
324
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
325 325
                             continue;
326 326
                         }
327
-						$fields["{$input['id']}"] = array(
327
+						$fields[ "{$input[ 'id' ]}" ] = array(
328 328
 							'label' => \GV\Utils::get( $input, 'label' ),
329 329
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
330 330
 							'parent' => $field,
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 				}
337 337
 
338 338
 
339
-				if( GFCommon::is_product_field( $field['type'] ) ){
339
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
340 340
 					$has_product_fields = true;
341 341
 				}
342 342
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 * @since 1.7
351 351
 		 */
352 352
 		if ( $has_post_fields ) {
353
-			$fields['post_id'] = array(
353
+			$fields[ 'post_id' ] = array(
354 354
 				'label' => __( 'Post ID', 'gravityview' ),
355 355
 				'type' => 'post_id',
356 356
 			);
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 			foreach ( $payment_fields as $payment_field ) {
364 364
 
365 365
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
366
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
366
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
367 367
 					continue;
368 368
 				}
369 369
 
370
-				$fields["{$payment_field->name}"] = array(
370
+				$fields[ "{$payment_field->name}" ] = array(
371 371
 					'label' => $payment_field->label,
372 372
 					'desc' => $payment_field->description,
373 373
 					'type' => $payment_field->name,
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 
400 400
 		$fields = array();
401 401
 
402
-		foreach ( $extra_fields as $key => $field ){
403
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
404
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
402
+		foreach ( $extra_fields as $key => $field ) {
403
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
404
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
405 405
 			}
406 406
 		}
407 407
 
@@ -441,33 +441,33 @@  discard block
 block discarded – undo
441 441
 			'search_criteria' => null,
442 442
 			'sorting' => null,
443 443
 			'paging' => null,
444
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
444
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
445 445
 			'context_view_id' => null,
446 446
 		);
447 447
 
448 448
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
449 449
 
450
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
451
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
450
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
451
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
452 452
 
453 453
 				if ( ! is_array( $filter ) ) {
454 454
 					continue;
455 455
 				}
456 456
 
457 457
 				// By default, we want searches to be wildcard for each field.
458
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
458
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
459 459
 
460 460
 				/**
461 461
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
462 462
 				 * @param string $operator Existing search operator
463 463
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
464 464
 				 */
465
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
465
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
466 466
 			}
467 467
 
468 468
 			// don't send just the [mode] without any field filter.
469
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
470
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
469
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
470
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
471 471
 			}
472 472
 
473 473
 		}
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
 		 * Prepare date formats to be in Gravity Forms DB format;
479 479
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
480 480
 		 */
481
-		foreach ( array('start_date', 'end_date' ) as $key ) {
481
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
482 482
 
483
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
483
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
484 484
 
485 485
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
486
-				$date = date_create( $criteria['search_criteria'][ $key ] );
486
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
487 487
 
488 488
 				if ( $date ) {
489 489
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
490
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
490
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
491 491
 				} else {
492
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
492
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
493 493
 
494 494
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
495
-					unset( $criteria['search_criteria'][ $key ] );
495
+					unset( $criteria[ 'search_criteria' ][ $key ] );
496 496
 				}
497 497
 			}
498 498
 		}
499 499
 
500
-		if ( empty( $criteria['context_view_id'] ) ) {
500
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
501 501
 			// Calculate the context view id and send it to the advanced filter
502 502
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
503
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
505
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
505
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
506 506
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
507
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
507
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
508 508
 			}
509 509
 		}
510 510
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		/** Reduce # of database calls */
550 550
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
551 551
 
552
-		if ( ! empty( $criteria['cache'] ) ) {
552
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
553 553
 
554 554
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
555 555
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 				// Still update the total count when using cached results
559 559
 				if ( ! is_null( $total ) ) {
560
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
560
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
561 561
 				}
562 562
 
563 563
 				$return = $entries;
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
580 580
 
581 581
 			// No entries returned from gravityview_before_get_entries
582
-			if( is_null( $entries ) ) {
582
+			if ( is_null( $entries ) ) {
583 583
 
584
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
584
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
585 585
 
586 586
 				if ( is_wp_error( $entries ) ) {
587 587
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 				}
593 593
 			}
594 594
 
595
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
595
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
596 596
 
597 597
 				// Cache results
598 598
 				$Cache->set( $entries, 'entries' );
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view );
707 707
 
708 708
 		// Is the entry allowed
709
-		if( $check_entry_display ) {
709
+		if ( $check_entry_display ) {
710 710
 
711 711
 			$gvid = \GV\Utils::_GET( 'gvid' );
712 712
 
713
-			if( $gvid ) {
713
+			if ( $gvid ) {
714 714
 				$view = \GV\View::by_id( $gvid );
715 715
 			}
716 716
 
717 717
 			$entry = self::check_entry_display( $entry, $view );
718 718
 		}
719 719
 
720
-		if( is_wp_error( $entry ) ) {
720
+		if ( is_wp_error( $entry ) ) {
721 721
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
722 722
 			return false;
723 723
 		}
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$value = false;
753 753
 
754
-		if( 'context' === $val1 ) {
754
+		if ( 'context' === $val1 ) {
755 755
 
756 756
 			$matching_contexts = array( $val2 );
757 757
 
758 758
 			// We allow for non-standard contexts.
759
-			switch( $val2 ) {
759
+			switch ( $val2 ) {
760 760
 				// Check for either single or edit
761 761
 				case 'singular':
762 762
 					$matching_contexts = array( 'single', 'edit' );
@@ -799,18 +799,18 @@  discard block
 block discarded – undo
799 799
 				$json_val_1 = json_decode( $val1, true );
800 800
 				$json_val_2 = json_decode( $val2, true );
801 801
 
802
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
802
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
803 803
 
804 804
 					$json_in = false;
805
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
806
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
805
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
806
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
807 807
 
808 808
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
809 809
 					foreach ( $json_val_1 as $item_1 ) {
810 810
 						foreach ( $json_val_2 as $item_2 ) {
811 811
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
812 812
 
813
-							if( $json_in ) {
813
+							if ( $json_in ) {
814 814
 								break 2;
815 815
 							}
816 816
 						}
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry, $view = null ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 
880 880
 		$_gvid = \GV\Utils::_GET( 'gvid' );
881 881
 
882
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
882
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
883 883
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
884 884
 		}
885 885
 
886 886
 		$view_form_id = $view->form->ID;
887 887
 
888 888
 		if ( $view->joins ) {
889
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
-				$view_form_id = $entry['form_id'];
889
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
+				$view_form_id = $entry[ 'form_id' ];
891 891
 			}
892 892
 		}
893 893
 
894
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
894
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
895 895
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
896 896
 		}
897 897
 
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 		 * Check whether the entry is in the entries subset by running a modified query.
900 900
 		 */
901 901
 		add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) {
902
-			$_tmp_query       = new \GF_Query( $view_form_id, array(
902
+			$_tmp_query = new \GF_Query( $view_form_id, array(
903 903
 				'field_filters' => array(
904 904
 					'mode' => 'all',
905 905
 					array(
906 906
 						'key' => 'id',
907 907
 						'operation' => 'is',
908
-						'value' => $entry['id']
908
+						'value' => $entry[ 'id' ]
909 909
 					)
910 910
 				)
911 911
 			) );
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 			/** @var \GF_Query $query */
916 916
 			$query_parts      = $query->_introspect();
917 917
 
918
-			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
918
+			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
919 919
 
920 920
 		}, 10, 3 );
921 921
 
922 922
 		// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
923 923
 		add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
924 924
 
925
-			$criteria['paging'] = array(
925
+			$criteria[ 'paging' ] = array(
926 926
 				'offset' => 0,
927 927
 				'page_size' => 25
928 928
 			);
@@ -941,20 +941,20 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 		// This entry is on a View with joins
944
-		if ( $entries[0]->is_multi() ) {
944
+		if ( $entries[ 0 ]->is_multi() ) {
945 945
 
946 946
 			$multi_entry_ids = array();
947 947
 
948
-			foreach ( $entries[0]->entries as $multi_entry ) {
949
-				$multi_entry_ids[] = (int) $multi_entry->ID;
948
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
949
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
950 950
 			}
951 951
 
952
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
952
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
953 953
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
954 954
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
955 955
 			}
956 956
 
957
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
957
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
958 958
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
959 959
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
960 960
 		}
@@ -999,18 +999,18 @@  discard block
 block discarded – undo
999 999
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1000 1000
 		 * @see GFCommon::format_date() for original code
1001 1001
 		 */
1002
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1002
+		$date_gmt_time = mysql2date( 'G', $date_string );
1003 1003
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1004 1004
 
1005
-		$format  = \GV\Utils::get( $atts, 'format' );
1006
-		$is_human  = ! empty( $atts['human'] );
1007
-		$is_diff  = ! empty( $atts['diff'] );
1008
-		$is_raw = ! empty( $atts['raw'] );
1009
-		$is_timestamp = ! empty( $atts['timestamp'] );
1010
-		$include_time = ! empty( $atts['time'] );
1005
+		$format = \GV\Utils::get( $atts, 'format' );
1006
+		$is_human = ! empty( $atts[ 'human' ] );
1007
+		$is_diff = ! empty( $atts[ 'diff' ] );
1008
+		$is_raw = ! empty( $atts[ 'raw' ] );
1009
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1010
+		$include_time = ! empty( $atts[ 'time' ] );
1011 1011
 
1012 1012
 		// If we're using time diff, we want to have a different default format
1013
-		if( empty( $format ) ) {
1013
+		if ( empty( $format ) ) {
1014 1014
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1015 1015
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1016 1016
 		}
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		// If raw was specified, don't modify the stored value
1019 1019
 		if ( $is_raw ) {
1020 1020
 			$formatted_date = $date_string;
1021
-		} elseif( $is_timestamp ) {
1021
+		} elseif ( $is_timestamp ) {
1022 1022
 			$formatted_date = $date_local_timestamp;
1023 1023
 		} elseif ( $is_diff ) {
1024 1024
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		$label = \GV\Utils::get( $field, 'label' );
1054 1054
 
1055
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1055
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1056 1056
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1057 1057
 		}
1058 1058
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 			$form = GFAPI::get_form( $form );
1081 1081
 		}
1082 1082
 
1083
-		if ( class_exists( 'GFFormsModel' ) ){
1083
+		if ( class_exists( 'GFFormsModel' ) ) {
1084 1084
 			return GFFormsModel::get_field( $form, $field_id );
1085 1085
 		} else {
1086 1086
 			return null;
@@ -1127,19 +1127,19 @@  discard block
 block discarded – undo
1127 1127
 			$shortcodes = array();
1128 1128
 
1129 1129
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1130
-			if ( empty( $matches ) ){
1130
+			if ( empty( $matches ) ) {
1131 1131
 				return false;
1132 1132
 			}
1133 1133
 
1134 1134
 			foreach ( $matches as $shortcode ) {
1135
-				if ( $tag === $shortcode[2] ) {
1135
+				if ( $tag === $shortcode[ 2 ] ) {
1136 1136
 
1137 1137
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1138
-					$shortcodes[] = $shortcode;
1138
+					$shortcodes[ ] = $shortcode;
1139 1139
 
1140
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1141
-					foreach( $results as $result ) {
1142
-						$shortcodes[] = $result;
1140
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1141
+					foreach ( $results as $result ) {
1142
+						$shortcodes[ ] = $result;
1143 1143
 					}
1144 1144
 				}
1145 1145
 			}
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 			'post_type'      => 'gravityview',
1172 1172
 			'posts_per_page' => 100,
1173 1173
 			'meta_key'       => '_gravityview_form_id',
1174
-			'meta_value'     => (int) $form_id,
1174
+			'meta_value'     => (int)$form_id,
1175 1175
 		);
1176 1176
 		$args     = wp_parse_args( $args, $defaults );
1177 1177
 		$views    = get_posts( $args );
@@ -1183,21 +1183,21 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
 			$data = unserialize( $view->meta_value );
1185 1185
 
1186
-			if( ! $data || ! is_array( $data ) ) {
1186
+			if ( ! $data || ! is_array( $data ) ) {
1187 1187
 				continue;
1188 1188
 			}
1189 1189
 
1190 1190
 			foreach ( $data as $datum ) {
1191
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1192
-					$joined_forms[] = $view->post_id;
1191
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1192
+					$joined_forms[ ] = $view->post_id;
1193 1193
 				}
1194 1194
 			}
1195 1195
 		}
1196 1196
 
1197 1197
 		if ( $joined_forms ) {
1198
-			$joined_args  = array(
1198
+			$joined_args = array(
1199 1199
 				'post_type'      => 'gravityview',
1200
-				'posts_per_page' => $args['posts_per_page'],
1200
+				'posts_per_page' => $args[ 'posts_per_page' ],
1201 1201
 				'post__in'       => $joined_forms,
1202 1202
 			);
1203 1203
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1355 1355
 
1356
-		if( $json_decode ) {
1356
+		if ( $json_decode ) {
1357 1357
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1358 1358
 		}
1359 1359
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 	 * @return string         html
1370 1370
 	 */
1371 1371
 	public static function get_sortable_fields( $formid, $current = '' ) {
1372
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1372
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1373 1373
 
1374 1374
 		if ( empty( $formid ) ) {
1375 1375
 			return $output;
@@ -1382,11 +1382,11 @@  discard block
 block discarded – undo
1382 1382
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1383 1383
 
1384 1384
 			foreach ( $fields as $id => $field ) {
1385
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1385
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1386 1386
 					continue;
1387 1387
 				}
1388 1388
 
1389
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1389
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1390 1390
 			}
1391 1391
 		}
1392 1392
 
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1422 1422
 
1423 1423
 		// TODO: Convert to using array_filter
1424
-		foreach( $fields as $id => $field ) {
1424
+		foreach ( $fields as $id => $field ) {
1425 1425
 
1426
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1426
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1427 1427
 				unset( $fields[ $id ] );
1428 1428
 			}
1429 1429
 
1430 1430
 			/**
1431 1431
 			 * Merge date and time subfields.
1432 1432
 			 */
1433
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1433
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1434 1434
 				$fields[ intval( $id ) ] = array(
1435 1435
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1436 1436
 					'parent' => null,
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 	 * @param  int|array  $field field key or field array
1481 1481
 	 * @return boolean
1482 1482
 	 */
1483
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1483
+	public static function is_field_numeric( $form = null, $field = '' ) {
1484 1484
 
1485 1485
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1486 1486
 			$form = self::get_form( $form );
1487 1487
 		}
1488 1488
 
1489 1489
 		// If entry meta, it's a string. Otherwise, numeric
1490
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1490
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1491 1491
 			$type = $field;
1492 1492
 		} else {
1493 1493
 			$type = self::get_field_type( $form, $field );
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1502 1502
 
1503 1503
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1504
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1505
-			if( true === $gv_field->is_numeric ) {
1506
-				$numeric_types[] = $gv_field->is_numeric;
1504
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1505
+			if ( true === $gv_field->is_numeric ) {
1506
+				$numeric_types[ ] = $gv_field->is_numeric;
1507 1507
 			}
1508 1508
 		}
1509 1509
 
@@ -1653,18 +1653,18 @@  discard block
 block discarded – undo
1653 1653
 		$final_atts = array_filter( $final_atts );
1654 1654
 
1655 1655
 		// If the href wasn't passed as an attribute, use the value passed to the function
1656
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1657
-			$final_atts['href'] = $href;
1656
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1657
+			$final_atts[ 'href' ] = $href;
1658 1658
 		}
1659 1659
 
1660
-		$final_atts['href'] = esc_url_raw( $href );
1660
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1661 1661
 
1662 1662
 		/**
1663 1663
 		 * Fix potential security issue with target=_blank
1664 1664
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1665 1665
 		 */
1666
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1666
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1668 1668
 		}
1669 1669
 
1670 1670
 		// Sort the attributes alphabetically, to help testing
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1677 1677
 		}
1678 1678
 
1679
-		if( '' !== $output ) {
1679
+		if ( '' !== $output ) {
1680 1680
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1681 1681
 		}
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1704 1704
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1705 1705
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1706
-				$merged[] = $value;
1706
+				$merged[ ] = $value;
1707 1707
 			} else {
1708 1708
 				$merged[ $key ] = $value;
1709 1709
 			}
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1737 1737
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1738 1738
 		 */
1739
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1739
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1740 1740
 
1741 1741
 		return get_users( $get_users_settings );
1742 1742
 	}
@@ -1756,11 +1756,11 @@  discard block
 block discarded – undo
1756 1756
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1757 1757
 
1758 1758
     	// If $cap is defined, only show notice if user has capability
1759
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1759
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1760 1760
     		return '';
1761 1761
 	    }
1762 1762
 
1763
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1763
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1764 1764
     }
1765 1765
 
1766 1766
 	/**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-total.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total.
52 52
 	 */
53
-	public function add_to_blacklist( $blacklist = array(), $context = NULL  ){
53
+	public function add_to_blacklist( $blacklist = array(), $context = NULL  ) {
54 54
 
55 55
 		if( empty( $context ) || $context !== 'edit' ) {
56 56
 			return $blacklist;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total.
52 52
 	 */
53
-	public function add_to_blacklist( $blacklist = array(), $context = NULL  ){
53
+	public function add_to_blacklist( $blacklist = array(), $context = NULL ) {
54 54
 
55
-		if( empty( $context ) || $context !== 'edit' ) {
55
+		if ( empty( $context ) || $context !== 'edit' ) {
56 56
 			return $blacklist;
57 57
 		}
58 58
 
59
-		$blacklist[] = 'total';
59
+		$blacklist[ ] = 'total';
60 60
 
61 61
 		return $blacklist;
62 62
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
76 76
 
77
-		$original_form = GFAPI::get_form( $form['id'] );
77
+		$original_form = GFAPI::get_form( $form[ 'id' ] );
78 78
 
79 79
 		$total_fields = GFCommon::get_fields_by_type( $original_form, 'total' );
80 80
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 
86 86
 			/** @var GF_Field_Total $total_field */
87 87
 			foreach ( $total_fields as $total_field ) {
88
-				$entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry );
88
+				$entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry );
89 89
 			}
90 90
 
91 91
 			$return_entry = GFAPI::update_entry( $entry );
92 92
 
93
-			if( is_wp_error( $return_entry ) ) {
93
+			if ( is_wp_error( $return_entry ) ) {
94 94
 				gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) );
95 95
 			} else {
96 96
 				gravityview()->log->debug( 'Updating the entry total fields succeeded' );
Please login to merge, or discard this patch.