Completed
Push — develop ( 7a4cee...8b20d3 )
by
unknown
06:37
created
includes/extensions/duplicate-entry/class-duplicate-entry.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
 	public function duplicate_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
116 116
 
117 117
 		// Always a link, never a filter, always same window
118
-		unset( $field_options['show_as_link'], $field_options['search_filter'], $field_options['new_window'] );
118
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ], $field_options[ 'new_window' ] );
119 119
 
120 120
 		// Duplicate Entry link should only appear to visitors capable of editing entries
121
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
121
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
122 122
 
123
-		$add_option['duplicate_link'] = array(
123
+		$add_option[ 'duplicate_link' ] = array(
124 124
 			'type' => 'text',
125 125
 			'label' => __( 'Duplicate Link Text', 'gravityview' ),
126 126
 			'desc' => NULL,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'merge_tags' => true,
129 129
 		);
130 130
 
131
-		$field_options['allow_duplicate_cap'] = array(
131
+		$field_options[ 'allow_duplicate_cap' ] = array(
132 132
 			'type' => 'select',
133 133
 			'label' => __( 'Allow the following users to duplicate the entry:', 'gravityview' ),
134 134
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
156 156
 
157 157
 		if ( 'edit' !== $zone ) {
158
-			$entry_default_fields['duplicate_link'] = array(
158
+			$entry_default_fields[ 'duplicate_link' ] = array(
159 159
 				'label' => __( 'Duplicate Entry', 'gravityview' ),
160 160
 				'type'  => 'duplicate_link',
161 161
 				'desc'  => __( 'A link to duplicate the entry. Respects the Duplicate Entry permissions.', 'gravityview' ),
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function add_available_field( $available_fields = array() ) {
178 178
 
179
-		$available_fields['duplicate_link'] = array(
179
+		$available_fields[ 'duplicate_link' ] = array(
180 180
 			'label_text' => __( 'Duplicate Entry', 'gravityview' ),
181 181
 			'field_id' => 'duplicate_link',
182 182
 			'label_type' => 'field',
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		if ( 'duplicate_link' === $field_id ) {
210 210
 
211 211
 			// Remove other built-in caps.
212
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['duplicate_others_posts'] );
212
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'duplicate_others_posts' ] );
213 213
 
214
-			$caps['read'] = _x( 'Entry Creator', 'User capability', 'gravityview' );
214
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
215 215
 		}
216 216
 
217 217
 		return $caps;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function get_duplicate_link( $entry, $view_id, $post_id = null ) {
248 248
 
249
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
249
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
250 250
 
251 251
 		if ( empty( $base ) ) {
252 252
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$actionurl = add_query_arg( array(
257 257
 			'action'	=> 'duplicate',
258
-			'entry_id'	=> $entry['id'],
258
+			'entry_id'	=> $entry[ 'id' ],
259 259
 			'gvid' => $view_id,
260 260
             'view_id' => $view_id,
261 261
 		), $base );
262 262
 
263
-		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry['id'] ) ), $actionurl );
263
+		return add_query_arg( 'duplicate', wp_create_nonce( self::get_nonce_key( $entry[ 'id' ] ) ), $actionurl );
264 264
 	}
265 265
 
266 266
 	/**
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	public function process_duplicate() {
282 282
 
283 283
 		// If the form is submitted
284
-		if ( ( ! isset( $_GET['action'] ) ) || 'duplicate' !== $_GET['action'] || ( ! isset( $_GET['entry_id'] ) ) ) {
284
+		if ( ( ! isset( $_GET[ 'action' ] ) ) || 'duplicate' !== $_GET[ 'action' ] || ( ! isset( $_GET[ 'entry_id' ] ) ) ) {
285 285
 			return;
286 286
 		}
287 287
 
288 288
 		// Make sure it's a GravityView request
289
-		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET['entry_id'] ) );
289
+		$valid_nonce_key = wp_verify_nonce( \GV\Utils::_GET( 'duplicate' ), self::get_nonce_key( $_GET[ 'entry_id' ] ) );
290 290
 
291 291
 		if ( ! $valid_nonce_key ) {
292 292
 			gravityview()->log->debug( 'Duplicate entry not processed: nonce validation failed.' );
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		}
295 295
 
296 296
 		// Get the entry slug
297
-		$entry_slug = esc_attr( $_GET['entry_id'] );
297
+		$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
298 298
 
299 299
 		// See if there's an entry there
300 300
 		$entry = gravityview_get_entry( $entry_slug, true, false );
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 			return new WP_Error( 'gravityview-duplicate-entry-missing', __( 'The entry does not exist.', 'gravityview' ) );
389 389
 		}
390 390
 
391
-		$form = GFAPI::get_form( $entry['form_id'] );
391
+		$form = GFAPI::get_form( $entry[ 'form_id' ] );
392 392
 
393
-		$row['id'] = null;
394
-		$row['date_created'] = date( 'Y-m-d H:i:s', time() );
395
-		$row['date_updated'] = $row['date_created'];
396
-		$row['is_starred'] = false;
397
-		$row['is_read'] = false;
398
-		$row['ip'] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
399
-		$row['source_url'] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
400
-		$row['user_agent'] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
401
-		$row['created_by'] = wp_get_current_user()->ID;
393
+		$row[ 'id' ] = null;
394
+		$row[ 'date_created' ] = date( 'Y-m-d H:i:s', time() );
395
+		$row[ 'date_updated' ] = $row[ 'date_created' ];
396
+		$row[ 'is_starred' ] = false;
397
+		$row[ 'is_read' ] = false;
398
+		$row[ 'ip' ] = rgars( $form, 'personalData/preventIP' ) ? '' : GFFormsModel::get_ip();
399
+		$row[ 'source_url' ] = esc_url_raw( remove_query_arg( array( 'action', 'gvid', 'result', 'duplicate', 'entry_id' ) ) );
400
+		$row[ 'user_agent' ] = \GV\Utils::_SERVER( 'HTTP_USER_AGENT' );
401
+		$row[ 'created_by' ] = wp_get_current_user()->ID;
402 402
 
403 403
 		/**
404 404
 		 * @filter `gravityview/entry/duplicate/details` Modify the new entry details before it's created.
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
 
427 427
 		$save_this_meta = array();
428 428
 		foreach ( $duplicate_meta->get_output() as $m ) {
429
-			$save_this_meta[] = array(
430
-				'meta_key' => $m['meta_key'],
431
-				'meta_value' => $m['meta_value'],
432
-				'item_index' => $m['item_index'],
429
+			$save_this_meta[ ] = array(
430
+				'meta_key' => $m[ 'meta_key' ],
431
+				'meta_value' => $m[ 'meta_value' ],
432
+				'item_index' => $m[ 'item_index' ],
433 433
 			);
434 434
 		}
435 435
 
436 436
 		// Update the row ID for later usage
437
-		$row['id'] = $duplicated_id;
437
+		$row[ 'id' ] = $duplicated_id;
438 438
 
439 439
 		/**
440 440
 		 * @filter `gravityview/entry/duplicate/meta` Modify the new entry meta details.
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 		$save_this_meta = apply_filters( 'gravityview/entry/duplicate/meta', $save_this_meta, $row, $entry );
446 446
 
447 447
 		foreach ( $save_this_meta as $data ) {
448
-			$data['form_id'] = $entry['form_id'];
449
-			$data['entry_id'] = $duplicated_id;
448
+			$data[ 'form_id' ] = $entry[ 'form_id' ];
449
+			$data[ 'entry_id' ] = $duplicated_id;
450 450
 
451 451
 			if ( ! $wpdb->insert( $entry_meta_table, $data ) ) {
452 452
 				return new WP_Error( 'gravityview-duplicate-entry-db-meta', __( 'There was an error duplicating the entry.', 'gravityview' ) );
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 	public function verify_nonce() {
481 481
 
482 482
 		// No duplicate entry request was made
483
-		if ( empty( $_GET['entry_id'] ) || empty( $_GET['duplicate'] ) ) {
483
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
484 484
 			return false;
485 485
 		}
486 486
 
487
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
487
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
488 488
 
489
-		$valid = wp_verify_nonce( $_GET['duplicate'], $nonce_key );
489
+		$valid = wp_verify_nonce( $_GET[ 'duplicate' ], $nonce_key );
490 490
 
491 491
 		/**
492 492
 		 * @filter `gravityview/duplicate-entry/verify_nonce` Override Duplicate Entry nonce validation. Return true to declare nonce valid.
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			return '';
523 523
 		}
524 524
 
525
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
525
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
526 526
 	}
527 527
 
528 528
 	/**
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	public static function check_user_cap_duplicate_entry( $entry, $field = array(), $view_id = 0 ) {
577 577
 		$current_user = wp_get_current_user();
578 578
 
579
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : null;
579
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : null;
580 580
 
581 581
 		// Or if they can duplicate any entries (as defined in Gravity Forms), we're good.
582 582
 		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gform_full_access', 'gravityview_full_access' ), $entry_id ) ) {
@@ -591,17 +591,17 @@  discard block
 block discarded – undo
591 591
 		if ( ! empty( $field ) ) {
592 592
 
593 593
 			// If capability is not defined, something is not right!
594
-			if ( empty( $field['allow_duplicate_cap'] ) ) {
594
+			if ( empty( $field[ 'allow_duplicate_cap' ] ) ) {
595 595
 
596 596
 				gravityview()->log->error( 'Cannot read duplicate entry field caps', array( 'data' => $field ) );
597 597
 
598 598
 				return false;
599 599
 			}
600 600
 
601
-			if ( GVCommon::has_cap( $field['allow_duplicate_cap'] ) ) {
601
+			if ( GVCommon::has_cap( $field[ 'allow_duplicate_cap' ] ) ) {
602 602
 
603 603
 				// Do not return true if cap is read, as we need to check if the current user created the entry
604
-				if ( 'read' !== $field['allow_duplicate_cap'] ) {
604
+				if ( 'read' !== $field[ 'allow_duplicate_cap' ] ) {
605 605
 					return true;
606 606
 				}
607 607
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 
615 615
 		}
616 616
 
617
-		if ( ! isset( $entry['created_by'] ) ) {
617
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
618 618
 
619 619
 			gravityview()->log->error( 'Cannot duplicate entry; entry `created_by` doesn\'t exist.' );
620 620
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 		}
640 640
 
641 641
 		// If the logged-in user is the same as the user who created the entry, we're good.
642
-		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
642
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
643 643
 
644 644
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
645 645
 
@@ -663,12 +663,12 @@  discard block
 block discarded – undo
663 663
 	 * @return void
664 664
 	 */
665 665
 	public function maybe_display_message( $current_view_id = 0 ) {
666
-		if ( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
666
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
667 667
 			return;
668 668
 		}
669 669
 
670 670
 		// Entry wasn't duplicated from current View
671
-		if ( isset( $_GET['view_id'] ) && ( intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) ) {
671
+		if ( isset( $_GET[ 'view_id' ] ) && ( intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) ) {
672 672
 			return;
673 673
 		}
674 674
 
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	}
677 677
 
678 678
 	public function display_message() {
679
-		if ( empty( $_GET['status'] ) || empty( $_GET['duplicate'] ) ) {
679
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'duplicate' ] ) ) {
680 680
 			return;
681 681
 		}
682 682
 
683
-		$status = esc_attr( $_GET['status'] );
683
+		$status = esc_attr( $_GET[ 'status' ] );
684 684
 		$message_from_url = \GV\Utils::_GET( 'message' );
685 685
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
686 686
 		$class = '';
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		$message = apply_filters( 'gravityview/duplicate-entry/message', esc_attr( $message ), $status, $message_from_url );
707 707
 
708 708
 		// DISPLAY ERROR/SUCCESS MESSAGE
709
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
709
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
710 710
 	}
711 711
 
712 712
 	/**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		?>
738 738
 		<span class="gv-duplicate">
739 739
 			|
740
-			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry['id'] ), self::get_nonce_key( $entry['id'] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
740
+			<a href="<?php echo wp_nonce_url( add_query_arg( 'entry_id', $entry[ 'id' ] ), self::get_nonce_key( $entry[ 'id' ] ), 'duplicate' ); ?>"><?php esc_html_e( 'Duplicate', 'gravityview' ); ?></a>
741 741
 		</span>
742 742
 		<?php
743 743
 	}
@@ -759,9 +759,9 @@  discard block
 block discarded – undo
759 759
 
760 760
 		if ( 'success' === \GV\Utils::_GET( 'result' ) ) {
761 761
 			add_filter( 'gform_admin_messages', function( $messages ) {
762
-				$messages = (array) $messages;
762
+				$messages = (array)$messages;
763 763
 
764
-				$messages[] = esc_html__( 'Entry duplicated.', 'gravityview' );
764
+				$messages[ ] = esc_html__( 'Entry duplicated.', 'gravityview' );
765 765
 				return $messages;
766 766
 			} );
767 767
 		}
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 
773 773
 			$check_logs_message = '';
774 774
 
775
-			if( $is_logging_active ) {
775
+			if ( $is_logging_active ) {
776 776
 				$check_logs_message = sprintf( ' <a href="%s">%s</a>',
777 777
 					esc_url( admin_url( 'admin.php?page=gf_settings&subview=gravityformslogging' ) ),
778 778
 					esc_html_x( 'Check the GravityView logs for more information.', 'Error message links to logging page', 'gravityview' )
@@ -780,9 +780,9 @@  discard block
 block discarded – undo
780 780
 			}
781 781
 
782 782
 			add_filter( 'gform_admin_error_messages', function( $messages ) use ( $check_logs_message ) {
783
-				$messages = (array) $messages;
783
+				$messages = (array)$messages;
784 784
 
785
-				$messages[] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
785
+				$messages[ ] = esc_html__( 'There was an error duplicating the entry.', 'gravityview' ) . $check_logs_message;
786 786
 
787 787
 				return $messages;
788 788
 			} );
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +79 added lines, -80 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$supports = array( 'title', 'revisions' );
126 126
 
127 127
 		if ( $is_hierarchical ) {
128
-			$supports[] = 'page-attributes';
128
+			$supports[ ] = 'page-attributes';
129 129
 		}
130 130
 
131 131
 		/**
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
228 228
 
229 229
 		add_filter( 'query_vars', function( $query_vars ) {
230
-			$query_vars[] = 'csv';
230
+			$query_vars[ ] = 'csv';
231 231
 			return $query_vars;
232 232
 		} );
233 233
 
234
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
234
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
235 235
 			call_user_func_array( 'add_rewrite_rule', $rule );
236 236
 		}
237 237
 	}
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
 			return $content;
309 309
 		}
310 310
 
311
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
311
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
312 312
 
313 313
 		/**
314 314
 		 * Editing a single entry.
315 315
 		 */
316 316
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
317
-			if ( $entry['status'] != 'active' ) {
317
+			if ( $entry[ 'status' ] != 'active' ) {
318 318
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
319 319
 				return __( 'You are not allowed to view this content.', 'gravityview' );
320 320
 			}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 			}
326 326
 
327 327
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
328
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
328
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
329 329
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
330 330
 					return __( 'You are not allowed to view this content.', 'gravityview' );
331 331
 				}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 			foreach ( $entryset as $e ) {
350 350
 
351
-				if ( 'active' !== $e['status'] ) {
351
+				if ( 'active' !== $e[ 'status' ] ) {
352 352
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
353 353
 					return __( 'You are not allowed to view this content.', 'gravityview' );
354 354
 				}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				}
360 360
 
361 361
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
362
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
362
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
363 363
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
364 364
 						return __( 'You are not allowed to view this content.', 'gravityview' );
365 365
 					}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
535 535
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
536 536
 
537
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
537
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
538 538
 		}
539 539
 
540 540
 		return $joins;
@@ -624,13 +624,13 @@  discard block
 block discarded – undo
624 624
 			}
625 625
 
626 626
 			foreach ( $_fields as $field ) {
627
-				if ( ! empty( $field['unions'] ) ) {
628
-					foreach ( $field['unions'] as $form_id => $field_id ) {
627
+				if ( ! empty( $field[ 'unions' ] ) ) {
628
+					foreach ( $field[ 'unions' ] as $form_id => $field_id ) {
629 629
 						if ( ! isset( $unions[ $form_id ] ) ) {
630 630
 							$unions[ $form_id ] = array();
631 631
 						}
632 632
 
633
-						$unions[ $form_id ][ $field['id'] ] =
633
+						$unions[ $form_id ][ $field[ 'id' ] ] =
634 634
 							is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id );
635 635
 					}
636 636
 				}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 		if ( ! $view->form ) {
686 686
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
687 687
 				'view_id' => $view->ID,
688
-				'form_id' => $view->_gravityview_form_id ? : 0,
688
+				'form_id' => $view->_gravityview_form_id ?: 0,
689 689
 			) );
690 690
 		}
691 691
 
@@ -924,11 +924,11 @@  discard block
 block discarded – undo
924 924
 			 * Remove multiple sorting before calling legacy filters.
925 925
 			 * This allows us to fake it till we make it.
926 926
 			 */
927
-			if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) {
927
+			if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) {
928 928
 				$has_multisort = true;
929
-				$parameters['sort_field'] = reset( $parameters['sort_field'] );
930
-				if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) {
931
-					$parameters['sort_direction'] = reset( $parameters['sort_direction'] );
929
+				$parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] );
930
+				if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) {
931
+					$parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] );
932 932
 				}
933 933
 			}
934 934
 
@@ -937,31 +937,30 @@  discard block
 block discarded – undo
937 937
 			 */
938 938
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID );
939 939
 
940
-			$parameters['context_view_id'] = $this->ID;
940
+			$parameters[ 'context_view_id' ] = $this->ID;
941 941
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
942 942
 
943 943
 			if ( ! is_array( $parameters ) ) {
944 944
 				$parameters = array();
945 945
 			}
946 946
 
947
-			if ( ! is_array( $parameters['search_criteria'] ) ) {
948
-				$parameters['search_criteria'] = array();
947
+			if ( ! is_array( $parameters[ 'search_criteria' ] ) ) {
948
+				$parameters[ 'search_criteria' ] = array();
949 949
 			}
950 950
 
951
-			if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) {
952
-				$parameters['search_criteria']['field_filters'] = array();
951
+			if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) {
952
+				$parameters[ 'search_criteria' ][ 'field_filters' ] = array();
953 953
 			}
954 954
 
955 955
 			if ( $request instanceof REST\Request ) {
956 956
 				$atts = $this->settings->as_atts();
957 957
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
958
-						'paging' => array( 'page_size' => $atts['page_size'] ),
958
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
959 959
 					) );
960
-				$parameters['paging'] = $paging_parameters['paging'];
960
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
961 961
 			}
962 962
 
963
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
964
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
963
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 );
965 964
 
966 965
 			/**
967 966
 			 * Cleanup duplicate field_filter parameters to simplify the query.
@@ -969,14 +968,14 @@  discard block
 block discarded – undo
969 968
 			$unique_field_filters = array();
970 969
 			foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) {
971 970
 				if ( 'mode' === $key ) {
972
-					$unique_field_filters['mode'] = $filter;
971
+					$unique_field_filters[ 'mode' ] = $filter;
973 972
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
974
-					$unique_field_filters[] = $filter;
973
+					$unique_field_filters[ ] = $filter;
975 974
 				}
976 975
 			}
977
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
976
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
978 977
 
979
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
978
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
980 979
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
981 980
 			}
982 981
 
@@ -985,7 +984,7 @@  discard block
 block discarded – undo
985 984
 				$query_class = $this->get_query_class();
986 985
 
987 986
 				/** @var \GF_Query $query */
988
-				$query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) );
987
+				$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) );
989 988
 
990 989
 				/**
991 990
 				 * Apply multisort.
@@ -996,15 +995,15 @@  discard block
 block discarded – undo
996 995
 					$view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() );
997 996
 					$view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() );
998 997
 
999
-					$has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] );
998
+					$has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] );
1000 999
 
1001
-					if( $has_sort_query_param ) {
1002
-						$has_sort_query_param = array_filter( array_values( $_GET['sort'] ) );
1000
+					if ( $has_sort_query_param ) {
1001
+						$has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) );
1003 1002
 					}
1004 1003
 
1005 1004
 					if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) {
1006
-						$sort_field_ids = array_keys( $_GET['sort'] );
1007
-						$sort_directions = array_values( $_GET['sort'] );
1005
+						$sort_field_ids = array_keys( $_GET[ 'sort' ] );
1006
+						$sort_directions = array_values( $_GET[ 'sort' ] );
1008 1007
 					} else {
1009 1008
 						$sort_field_ids = $view_setting_sort_field_ids;
1010 1009
 						$sort_directions = $view_setting_sort_directions;
@@ -1012,7 +1011,7 @@  discard block
 block discarded – undo
1012 1011
 
1013 1012
 					$skip_first = false;
1014 1013
 
1015
-					foreach ( (array) $sort_field_ids as $key => $sort_field_id ) {
1014
+					foreach ( (array)$sort_field_ids as $key => $sort_field_id ) {
1016 1015
 
1017 1016
 						if ( ! $skip_first && ! $has_sort_query_param ) {
1018 1017
 							$skip_first = true; // Skip the first one, it's already in the query
@@ -1042,15 +1041,15 @@  discard block
 block discarded – undo
1042 1041
 
1043 1042
 					$merged_time = false;
1044 1043
 
1045
-					foreach ( $q['order'] as $oid => $order ) {
1046
-						if ( $order[0] instanceof \GF_Query_Column ) {
1047
-							$column = $order[0];
1048
-						} else if ( $order[0] instanceof \GF_Query_Call ) {
1049
-							if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) {
1044
+					foreach ( $q[ 'order' ] as $oid => $order ) {
1045
+						if ( $order[ 0 ] instanceof \GF_Query_Column ) {
1046
+							$column = $order[ 0 ];
1047
+						} else if ( $order[ 0 ] instanceof \GF_Query_Call ) {
1048
+							if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) {
1050 1049
 								$orders[ $oid ] = $order;
1051 1050
 								continue; // Need something that resembles a single sort
1052 1051
 							}
1053
-							$column = $order[0]->columns[0];
1052
+							$column = $order[ 0 ]->columns[ 0 ];
1054 1053
 						}
1055 1054
 
1056 1055
 						if ( ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) {
@@ -1064,7 +1063,7 @@  discard block
 block discarded – undo
1064 1063
 
1065 1064
 						$orders[ $oid ] = array(
1066 1065
 							new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ),
1067
-							$order[1] // Mock it!
1066
+							$order[ 1 ] // Mock it!
1068 1067
 						);
1069 1068
 
1070 1069
 						$merged_time = true;
@@ -1075,15 +1074,15 @@  discard block
 block discarded – undo
1075 1074
 						 * ORDER again.
1076 1075
 						 */
1077 1076
 						if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) {
1078
-							$sql['order'] = 'ORDER BY ' . implode( ', ', $_orders );
1077
+							$sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders );
1079 1078
 						}
1080 1079
 					}
1081 1080
 
1082 1081
 					return $sql;
1083 1082
 				} );
1084 1083
 
1085
-				$query->limit( $parameters['paging']['page_size'] )
1086
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
1084
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
1085
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
1087 1086
 
1088 1087
 				/**
1089 1088
 				 * Any joins?
@@ -1106,7 +1105,7 @@  discard block
 block discarded – undo
1106 1105
 
1107 1106
 							$query_parameters = $query->_introspect();
1108 1107
 
1109
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1108
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1110 1109
 						}
1111 1110
 
1112 1111
 						/**
@@ -1140,7 +1139,7 @@  discard block
 block discarded – undo
1140 1139
 						}
1141 1140
 
1142 1141
 						$q = $query->_introspect();
1143
-						$query->where( \GF_Query_Condition::_and( $q['where'], $condition ) );
1142
+						$query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) );
1144 1143
 
1145 1144
 						if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
1146 1145
 
@@ -1165,7 +1164,7 @@  discard block
 block discarded – undo
1165 1164
 
1166 1165
 							$query_parameters = $query->_introspect();
1167 1166
 
1168
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
1167
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
1169 1168
 						}
1170 1169
 					}
1171 1170
 
@@ -1189,7 +1188,7 @@  discard block
 block discarded – undo
1189 1188
 							$conditions = array();
1190 1189
 
1191 1190
 							foreach ( $condition->expressions as $_condition ) {
1192
-								$conditions[] = $recurse( $_condition, $fields, $recurse );
1191
+								$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1193 1192
 							}
1194 1193
 
1195 1194
 							return call_user_func_array(
@@ -1218,10 +1217,10 @@  discard block
 block discarded – undo
1218 1217
 						$q = new $query_class( $form_id );
1219 1218
 
1220 1219
 						// Copy the WHERE clauses but substitute the field_ids to the respective ones
1221
-						$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1220
+						$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1222 1221
 
1223 1222
 						// Copy the ORDER clause and substitute the field_ids to the respective ones
1224
-						foreach ( $query_parameters['order'] as $order ) {
1223
+						foreach ( $query_parameters[ 'order' ] as $order ) {
1225 1224
 							list( $column, $_order ) = $order;
1226 1225
 
1227 1226
 							if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1235,15 +1234,15 @@  discard block
 block discarded – undo
1235 1234
 
1236 1235
 						add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1237 1236
 							// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1238
-							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1237
+							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1239 1238
 
1240 1239
 							// Record the SQL
1241
-							$unions_sql[] = array(
1240
+							$unions_sql[ ] = array(
1242 1241
 								// Remove columns, we'll rebuild them
1243 1242
 								'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1244
-								'from'    => $sql['from'],
1245
-								'join'    => $sql['join'],
1246
-								'where'   => $sql['where'],
1243
+								'from'    => $sql[ 'from' ],
1244
+								'join'    => $sql[ 'join' ],
1245
+								'where'   => $sql[ 'where' ],
1247 1246
 								// Remove order and limit
1248 1247
 							);
1249 1248
 
@@ -1260,11 +1259,11 @@  discard block
 block discarded – undo
1260 1259
 
1261 1260
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1262 1261
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1263
-						$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1262
+						$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1264 1263
 
1265 1264
 						// Remove columns, we'll rebuild them
1266
-						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1267
-						$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1265
+						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1266
+						$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1268 1267
 
1269 1268
 						$unions = array();
1270 1269
 
@@ -1275,30 +1274,30 @@  discard block
 block discarded – undo
1275 1274
 						};
1276 1275
 
1277 1276
 						// Add all the order columns into the selects, so we can order by the whole union group
1278
-						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1277
+						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1279 1278
 
1280 1279
 						$columns = array(
1281
-							sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1280
+							sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1282 1281
 						);
1283 1282
 
1284 1283
 						foreach ( array_slice( $order_matches, 1 ) as $match ) {
1285
-							$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1284
+							$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1286 1285
 
1287 1286
 							// Rewrite the order columns to the shared aliases
1288
-							$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1287
+							$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1289 1288
 						}
1290 1289
 
1291 1290
 						$columns = array_unique( $columns );
1292 1291
 
1293 1292
 						// Add the columns to every UNION
1294 1293
 						foreach ( $unions_sql as $union_sql ) {
1295
-							$union_sql['select'] .= implode( ', ', $columns );
1296
-							$unions []= implode( ' ', $union_sql );
1294
+							$union_sql[ 'select' ] .= implode( ', ', $columns );
1295
+							$unions [ ] = implode( ' ', $union_sql );
1297 1296
 						}
1298 1297
 
1299 1298
 						// Add the columns to the main SELECT, but only grab the entry id column
1300
-						$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1301
-						$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1299
+						$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1300
+						$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1302 1301
 
1303 1302
 						return $sql;
1304 1303
 					} );
@@ -1343,20 +1342,20 @@  discard block
 block discarded – undo
1343 1342
 				} );
1344 1343
 			} else {
1345 1344
 				$entries = $this->form->entries
1346
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1345
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1347 1346
 					->offset( $this->settings->get( 'offset' ) )
1348
-					->limit( $parameters['paging']['page_size'] )
1347
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
1349 1348
 					->page( $page );
1350 1349
 
1351
-				if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) {
1350
+				if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) {
1352 1351
 					// Pluck off multisort arrays
1353
-					$parameters['sorting'] = $parameters['sorting'][0];
1352
+					$parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ];
1354 1353
 				}
1355 1354
 
1356
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1355
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1357 1356
 					$field = new \GV\Field();
1358
-					$field->ID = $parameters['sorting']['key'];
1359
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1357
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
1358
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1360 1359
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1361 1360
 				}
1362 1361
 			}
@@ -1431,7 +1430,7 @@  discard block
 block discarded – undo
1431 1430
 		$allowed = $headers = array();
1432 1431
 
1433 1432
 		foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) {
1434
-			$allowed[] = $field;
1433
+			$allowed[ ] = $field;
1435 1434
 		}
1436 1435
 
1437 1436
 		$renderer = new Field_Renderer();
@@ -1453,17 +1452,17 @@  discard block
 block discarded – undo
1453 1452
 			} );
1454 1453
 
1455 1454
 			foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) {
1456
-				$allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1455
+				$allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id );
1457 1456
 			}
1458 1457
 
1459 1458
 			foreach ( $allowed as $field ) {
1460 1459
 				$source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source();
1461 1460
 
1462
-				$return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1461
+				$return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' );
1463 1462
 
1464 1463
 				if ( ! $headers_done ) {
1465 1464
 					$label = $field->get_label( $view, $source, $entry );
1466
-					$headers[] = $label ? $label : $field->ID;
1465
+					$headers[ ] = $label ? $label : $field->ID;
1467 1466
 				}
1468 1467
 			}
1469 1468
 
Please login to merge, or discard this patch.
includes/extensions/delete-entry/class-delete-entry.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 		add_action( 'wp', array( $this, 'process_delete' ), 10000 );
44 44
 
45
-		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 );
45
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
46 46
 
47 47
 		add_action( 'gravityview_before', array( $this, 'maybe_display_message' ) );
48 48
 
49 49
 		// For the Delete Entry Link, you don't want visible to all users.
50
-		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 );
50
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
51 51
 
52 52
 		// Modify the field options based on the name of the field type
53 53
 		add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 );
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 		// add template path to check for field
56 56
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
57 57
 
58
-		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 4 );
58
+		add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 4 );
59 59
 
60
-		add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
-		add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
60
+		add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 );
61
+		add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 );
62 62
 
63 63
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
64 64
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	static function getInstance() {
73 73
 
74
-		if( empty( self::$instance ) ) {
74
+		if ( empty( self::$instance ) ) {
75 75
 			self::$instance = new self;
76 76
 		}
77 77
 
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 	function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
152 152
 
153 153
 		// Always a link, never a filter
154
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
154
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
155 155
 
156 156
 		// Delete Entry link should only appear to visitors capable of editing entries
157
-		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
157
+		unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
158 158
 
159
-		$add_option['delete_link'] = array(
159
+		$add_option[ 'delete_link' ] = array(
160 160
 			'type' => 'text',
161 161
 			'label' => __( 'Delete Link Text', 'gravityview' ),
162 162
 			'desc' => NULL,
163
-			'value' => __('Delete Entry', 'gravityview'),
163
+			'value' => __( 'Delete Entry', 'gravityview' ),
164 164
 			'merge_tags' => true,
165 165
 		);
166 166
 
167
-		$field_options['allow_edit_cap'] = array(
167
+		$field_options[ 'allow_edit_cap' ] = array(
168 168
 			'type' => 'select',
169 169
 			'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ),
170 170
 			'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
190 190
 
191
-		if( 'edit' !== $zone ) {
192
-			$entry_default_fields['delete_link'] = array(
191
+		if ( 'edit' !== $zone ) {
192
+			$entry_default_fields[ 'delete_link' ] = array(
193 193
 				'label' => __( 'Delete Entry', 'gravityview' ),
194 194
 				'type'  => 'delete_link',
195 195
 				'desc'  => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ),
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function add_available_field( $available_fields = array() ) {
208 208
 
209
-		$available_fields['delete_link'] = array(
209
+		$available_fields[ 'delete_link' ] = array(
210 210
 			'label_text' => __( 'Delete Entry', 'gravityview' ),
211 211
 			'field_id' => 'delete_link',
212 212
 			'label_type' => 'field',
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		$caps = $visibility_caps;
235 235
 
236 236
 		// If we're configuring fields in the edit context, we want a limited selection
237
-		if( $field_id === 'delete_link' ) {
237
+		if ( $field_id === 'delete_link' ) {
238 238
 
239 239
 			// Remove other built-in caps.
240
-			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
240
+			unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
241 241
 
242
-			$caps['read'] = _x('Entry Creator', 'User capability', 'gravityview');
242
+			$caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
243 243
 		}
244 244
 
245 245
 		return $caps;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param [type] $entry [description]
253 253
 	 */
254 254
 	function set_entry( $entry = null ) {
255
-		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry;
255
+		$this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry;
256 256
 	}
257 257
 
258 258
 	/**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 		self::getInstance()->set_entry( $entry );
287 287
 
288
-        $base = GravityView_API::directory_link( $post_id ? : $view_id, true );
288
+        $base = GravityView_API::directory_link( $post_id ?: $view_id, true );
289 289
 
290 290
 		if ( empty( $base ) ) {
291 291
 			gravityview()->log->error( 'Post ID does not exist: {post_id}', array( 'post_id' => $post_id ) );
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             'view_id' => $view_id,
305 305
 		), $base );
306 306
 
307
-		$url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' );
307
+		$url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' );
308 308
 
309 309
 		return $url;
310 310
 	}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	public function add_delete_button( $form = array(), $entry = array(), $view_id = null, $post_id = null ) {
327 327
 
328 328
 		// Only show the link to those who are allowed to see it.
329
-		if( !self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
329
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
330 330
 			return;
331 331
 		}
332 332
 
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
 		$show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true );
338 338
 
339 339
 		// If the button is hidden by the filter, don't show.
340
-		if( !$show_delete_button ) {
340
+		if ( ! $show_delete_button ) {
341 341
 			return;
342 342
 		}
343 343
 
344 344
 		$attributes = array(
345 345
 			'class' => 'btn btn-sm button button-small alignright pull-right btn-danger gv-button-delete',
346
-			'tabindex' => ( GFCommon::$tab_index ++ ),
346
+			'tabindex' => ( GFCommon::$tab_index++ ),
347 347
 			'onclick' => self::get_confirm_dialog(),
348 348
 		);
349 349
 
@@ -367,27 +367,27 @@  discard block
 block discarded – undo
367 367
 	function process_delete() {
368 368
 
369 369
 		// If the form is submitted
370
-		if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) {
370
+		if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) {
371 371
 
372 372
 			// Make sure it's a GravityView request
373
-			$valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) );
373
+			$valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) );
374 374
 
375
-			if( ! $valid_nonce_key ) {
375
+			if ( ! $valid_nonce_key ) {
376 376
 				gravityview()->log->debug( 'Delete entry not processed: nonce validation failed.' );
377 377
 				return;
378 378
 			}
379 379
 
380 380
 			// Get the entry slug
381
-			$entry_slug = esc_attr( $_GET['entry_id'] );
381
+			$entry_slug = esc_attr( $_GET[ 'entry_id' ] );
382 382
 
383 383
 			// See if there's an entry there
384 384
 			$entry = gravityview_get_entry( $entry_slug, true, false );
385 385
 
386
-			if( $entry ) {
386
+			if ( $entry ) {
387 387
 
388 388
 				$has_permission = $this->user_can_delete_entry( $entry, \GV\Utils::_GET( 'gvid', \GV\Utils::_GET( 'view_id' ) ) );
389 389
 
390
-				if( is_wp_error( $has_permission ) ) {
390
+				if ( is_wp_error( $has_permission ) ) {
391 391
 
392 392
 					$messages = array(
393 393
 						'message' => urlencode( $has_permission->get_error_message() ),
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 					// Delete the entry
400 400
 					$delete_response = $this->delete_or_trash_entry( $entry );
401 401
 
402
-					if( is_wp_error( $delete_response ) ) {
402
+					if ( is_wp_error( $delete_response ) ) {
403 403
 
404 404
 						$messages = array(
405 405
 							'message' => urlencode( $delete_response->get_error_message() ),
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 				gravityview()->log->debug( 'Delete entry failed: there was no entry with the entry slug {entry_slug}', array( 'entry_slug' => $entry_slug ) );
422 422
 
423 423
 				$messages = array(
424
-					'message' => urlencode( __('The entry does not exist.', 'gravityview') ),
424
+					'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ),
425 425
 					'status' => 'error',
426 426
 				);
427 427
 			}
@@ -461,18 +461,18 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	private function delete_or_trash_entry( $entry ) {
463 463
 
464
-		$entry_id = $entry['id'];
464
+		$entry_id = $entry[ 'id' ];
465 465
 		
466 466
 		$mode = $this->get_delete_mode();
467 467
 
468
-		if( 'delete' === $mode ) {
468
+		if ( 'delete' === $mode ) {
469 469
 
470 470
 			gravityview()->log->debug( 'Starting delete entry: {entry_id}', array( 'entry_id' => $entry_id ) );
471 471
 
472 472
 			// Delete the entry
473 473
 			$delete_response = GFAPI::delete_entry( $entry_id );
474 474
 
475
-			if( ! is_wp_error( $delete_response ) ) {
475
+			if ( ! is_wp_error( $delete_response ) ) {
476 476
 				$delete_response = 'deleted';
477 477
 
478 478
 				/**
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 			$trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' );
494 494
 			new GravityView_Cache;
495 495
 
496
-			if( ! $trashed ) {
497
-				$delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) );
496
+			if ( ! $trashed ) {
497
+				$delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) );
498 498
 			} else {
499 499
 
500 500
 				/**
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	public function process_connected_posts( $entry_id = 0, $entry = array() ) {
526 526
 
527 527
 		// The entry had no connected post
528
-		if( empty( $entry['post_id'] ) ) {
528
+		if ( empty( $entry[ 'post_id' ] ) ) {
529 529
 			return;
530 530
 		}
531 531
 
@@ -536,19 +536,19 @@  discard block
 block discarded – undo
536 536
 		 */
537 537
 		$delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true );
538 538
 		
539
-		if( false === $delete_post ) {
539
+		if ( false === $delete_post ) {
540 540
 			return;
541 541
 		}
542 542
 
543 543
 		$action = current_action();
544 544
 
545
-		if( 'gravityview/delete-entry/deleted' === $action ) {
546
-			$result = wp_delete_post( $entry['post_id'], true );
545
+		if ( 'gravityview/delete-entry/deleted' === $action ) {
546
+			$result = wp_delete_post( $entry[ 'post_id' ], true );
547 547
 		} else {
548
-			$result = wp_trash_post( $entry['post_id'] );
548
+			$result = wp_trash_post( $entry[ 'post_id' ] );
549 549
 		}
550 550
 
551
-		if( false === $result ) {
551
+		if ( false === $result ) {
552 552
 			gravityview()->log->error( '(called by {action}): Error processing the Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
553 553
 		} else {
554 554
 			gravityview()->log->debug( '(called by {action}): Successfully processed Post connected to the entry.', array( 'action' => $action, 'data' => $entry ) );
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 	public function verify_nonce() {
565 565
 
566 566
 		// No delete entry request was made
567
-		if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) {
567
+		if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) {
568 568
 			return false;
569 569
 		}
570 570
 
571
-		$nonce_key = self::get_nonce_key( $_GET['entry_id'] );
571
+		$nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] );
572 572
 
573
-		$valid = wp_verify_nonce( $_GET['delete'], $nonce_key );
573
+		$valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key );
574 574
 
575 575
 		/**
576 576
 		 * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid.
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public static function get_confirm_dialog() {
594 594
 
595
-		$confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview');
595
+		$confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' );
596 596
 
597 597
 		/**
598 598
 		 * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 		 */
601 601
 		$confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm );
602 602
 
603
-		return 'return window.confirm(\''. esc_js( $confirm ) .'\');';
603
+		return 'return window.confirm(\'' . esc_js( $confirm ) . '\');';
604 604
 	}
605 605
 
606 606
 	/**
@@ -618,16 +618,16 @@  discard block
 block discarded – undo
618 618
 
619 619
 		$error = NULL;
620 620
 
621
-		if( ! $this->verify_nonce() ) {
622
-			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview');
621
+		if ( ! $this->verify_nonce() ) {
622
+			$error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' );
623 623
 		}
624 624
 
625
-		if( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
626
-			$error = __( 'You do not have permission to delete this entry.', 'gravityview');
625
+		if ( ! self::check_user_cap_delete_entry( $entry, array(), $view_id ) ) {
626
+			$error = __( 'You do not have permission to delete this entry.', 'gravityview' );
627 627
 		}
628 628
 
629
-		if( $entry['status'] === 'trash' ) {
630
-			if( 'trash' === $this->get_delete_mode() ) {
629
+		if ( $entry[ 'status' ] === 'trash' ) {
630
+			if ( 'trash' === $this->get_delete_mode() ) {
631 631
 				$error = __( 'The entry is already in the trash.', 'gravityview' );
632 632
 			} else {
633 633
 				$error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' );
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		}
636 636
 
637 637
 		// No errors; everything's fine here!
638
-		if( empty( $error ) ) {
638
+		if ( empty( $error ) ) {
639 639
 			return true;
640 640
 		}
641 641
 
@@ -663,17 +663,17 @@  discard block
 block discarded – undo
663 663
 			$view = \GV\View::by_id( $view_id );
664 664
 		} else {
665 665
 			if ( ! $view instanceof \GV\View ) {
666
-				$view = \GV\View::by_id ( $view );
666
+				$view = \GV\View::by_id( $view );
667 667
 			}
668 668
 			$view_id = $view->ID;
669 669
 		}
670 670
 
671 671
 		$current_user = wp_get_current_user();
672 672
 
673
-		$entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL;
673
+		$entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL;
674 674
 
675 675
 		// Or if they can delete any entries (as defined in Gravity Forms), we're good.
676
-		if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
676
+		if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) {
677 677
 
678 678
 			gravityview()->log->debug( 'Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' );
679 679
 
@@ -682,20 +682,20 @@  discard block
 block discarded – undo
682 682
 
683 683
 
684 684
 		// If field options are passed, check if current user can view the link
685
-		if( !empty( $field ) ) {
685
+		if ( ! empty( $field ) ) {
686 686
 
687 687
 			// If capability is not defined, something is not right!
688
-			if( empty( $field['allow_edit_cap'] ) ) {
688
+			if ( empty( $field[ 'allow_edit_cap' ] ) ) {
689 689
 
690 690
 				gravityview()->log->error( 'Cannot read delete entry field caps', array( 'data' => $field ) );
691 691
 
692 692
 				return false;
693 693
 			}
694 694
 
695
-			if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) {
695
+			if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) {
696 696
 
697 697
 				// Do not return true if cap is read, as we need to check if the current user created the entry
698
-				if( $field['allow_edit_cap'] !== 'read' ) {
698
+				if ( $field[ 'allow_edit_cap' ] !== 'read' ) {
699 699
 					return true;
700 700
 				}
701 701
 
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 
709 709
 		}
710 710
 
711
-		if( !isset( $entry['created_by'] ) ) {
711
+		if ( ! isset( $entry[ 'created_by' ] ) ) {
712 712
 
713
-			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
713
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
714 714
 
715 715
 			return false;
716 716
 		}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		}
725 725
 
726 726
 		// If the logged-in user is the same as the user who created the entry, we're good.
727
-		if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
727
+		if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
728 728
 
729 729
 			gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id' => $current_user->ID ) );
730 730
 
@@ -748,12 +748,12 @@  discard block
 block discarded – undo
748 748
 	 * @return void
749 749
 	 */
750 750
 	public function maybe_display_message( $current_view_id = 0 ) {
751
-		if( empty( $_GET['status'] ) || ! self::verify_nonce() ) {
751
+		if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) {
752 752
 			return;
753 753
 		}
754 754
 
755 755
 		// Entry wasn't deleted from current View
756
-		if( isset( $_GET['view_id'] ) && intval( $_GET['view_id'] ) !== intval( $current_view_id ) ) {
756
+		if ( isset( $_GET[ 'view_id' ] ) && intval( $_GET[ 'view_id' ] ) !== intval( $current_view_id ) ) {
757 757
 			return;
758 758
 		}
759 759
 
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
 
763 763
 	public function display_message() {
764 764
 
765
-		if ( empty( $_GET['status'] ) || empty( $_GET['delete'] ) ) {
765
+		if ( empty( $_GET[ 'status' ] ) || empty( $_GET[ 'delete' ] ) ) {
766 766
 			return;
767 767
 		}
768 768
 
769
-		$status = esc_attr( $_GET['status'] );
769
+		$status = esc_attr( $_GET[ 'status' ] );
770 770
 		$message_from_url = \GV\Utils::_GET( 'message' );
771 771
 		$message_from_url = rawurldecode( stripslashes_deep( $message_from_url ) );
772 772
 		$class = '';
@@ -774,14 +774,14 @@  discard block
 block discarded – undo
774 774
 		switch ( $status ) {
775 775
 			case 'error':
776 776
 				$class = ' gv-error error';
777
-				$error_message = __('There was an error deleting the entry: %s', 'gravityview');
777
+				$error_message = __( 'There was an error deleting the entry: %s', 'gravityview' );
778 778
 				$message = sprintf( $error_message, $message_from_url );
779 779
 				break;
780 780
 			case 'trashed':
781
-				$message = __('The entry was successfully moved to the trash.', 'gravityview');
781
+				$message = __( 'The entry was successfully moved to the trash.', 'gravityview' );
782 782
 				break;
783 783
 			default:
784
-				$message = __('The entry was successfully deleted.', 'gravityview');
784
+				$message = __( 'The entry was successfully deleted.', 'gravityview' );
785 785
 				break;
786 786
 		}
787 787
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		$message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url );
796 796
 
797 797
 		// DISPLAY ERROR/SUCCESS MESSAGE
798
-		echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>';
798
+		echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>';
799 799
 	}
800 800
 
801 801
 
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 		add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) );
65 65
 
66
-		add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 );
67
-		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') );
68
-		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') );
66
+		add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 );
67
+		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
68
+		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
69 69
 
70
-		add_action( 'wp', array( $this, 'maybe_add_note'), 1000 );
71
-		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') );
72
-		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') );
70
+		add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 );
71
+		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) );
72
+		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) );
73 73
 
74 74
 		// add template path to check for field
75 75
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
76 76
 		add_filter( 'gravityview/template/fields_template_paths', array( $this, 'add_template_path' ) );
77 77
 
78
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
78
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
79 79
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
80 80
 
81 81
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 );
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function add_entry_default_field( $entry_default_fields, $form, $zone ) {
99 99
 
100
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
101
-			$entry_default_fields['notes'] = array(
100
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
101
+			$entry_default_fields[ 'notes' ] = array(
102 102
 				'label' => __( 'Entry Notes', 'gravityview' ),
103 103
 				'type'  => 'notes',
104 104
 				'desc'  => __( 'Display, add, and delete notes for an entry.', 'gravityview' ),
@@ -131,23 +131,23 @@  discard block
 block discarded – undo
131 131
 	public function enqueue_scripts() {
132 132
 		global $wp_actions;
133 133
 
134
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
134
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
135 135
 			wp_enqueue_style( 'gravityview-notes' );
136 136
 			wp_enqueue_script( 'gravityview-notes' );
137 137
 		}
138 138
 
139
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
139
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
140 140
 
141 141
 			$strings = self::strings();
142 142
 
143 143
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
144 144
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
145 145
 				'text' => array(
146
-					'processing' => $strings['processing'],
147
-					'delete_confirm' => $strings['delete-confirm'],
148
-					'note_added' => $strings['added-note'],
149
-					'error_invalid' => $strings['error-invalid'],
150
-					'error_empty_note' => $strings['error-empty-note'],
146
+					'processing' => $strings[ 'processing' ],
147
+					'delete_confirm' => $strings[ 'delete-confirm' ],
148
+					'note_added' => $strings[ 'added-note' ],
149
+					'error_invalid' => $strings[ 'error-invalid' ],
150
+					'error_empty_note' => $strings[ 'error-empty-note' ],
151 151
 				),
152 152
 			) );
153 153
 		}
@@ -164,31 +164,31 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	function maybe_add_note() {
166 166
 
167
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
167
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
168 168
 			gravityview()->log->error( 'The user isnt allowed to add entry notes.' );
169 169
 			return;
170 170
 		}
171 171
 
172
-		if( ! isset( $_POST['action'] ) ) {
172
+		if ( ! isset( $_POST[ 'action' ] ) ) {
173 173
 			return;
174 174
 		}
175 175
 
176
-		if( 'gv_note_add' === $_POST['action'] ) {
176
+		if ( 'gv_note_add' === $_POST[ 'action' ] ) {
177 177
 
178
-            if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
178
+            if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
179 179
                 do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
180 180
                 return;
181 181
             }
182 182
 
183 183
 			$post = wp_unslash( $_POST );
184 184
 
185
-			if( $this->doing_ajax ) {
186
-				parse_str( $post['data'], $data );
185
+			if ( $this->doing_ajax ) {
186
+				parse_str( $post[ 'data' ], $data );
187 187
 			} else {
188 188
 				$data = $post;
189 189
 			}
190 190
 
191
-			$this->process_add_note( (array) $data );
191
+			$this->process_add_note( (array)$data );
192 192
 		}
193 193
 	}
194 194
 
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 		$error = false;
216 216
 		$success = false;
217 217
 
218
-		if( empty( $data['entry-slug'] ) ) {
218
+		if ( empty( $data[ 'entry-slug' ] ) ) {
219 219
 
220
-			$error = self::strings('error-invalid');
220
+			$error = self::strings( 'error-invalid' );
221 221
 			gravityview()->log->error( 'The note is missing an Entry ID.' );
222 222
 
223 223
 		} else {
224 224
 
225
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
225
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
226 226
 
227 227
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
228 228
 
229
-			if( ! $has_cap ) {
229
+			if ( ! $has_cap ) {
230 230
 				$error = self::strings( 'error-cap-add' );
231 231
 				gravityview()->log->error( 'Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
232 232
 			} elseif ( $valid ) {
233 233
 
234
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
234
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
235 235
 
236 236
 				$added = $this->add_note( $entry, $data );
237 237
 
@@ -249,22 +249,22 @@  discard block
 block discarded – undo
249 249
 					$this->maybe_send_entry_notes( $note, $entry, $data );
250 250
 
251 251
 					if ( $note ) {
252
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
252
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
253 253
 						gravityview()->log->debug( 'The note was successfully created', array( 'data' => compact( 'note', 'data' ) ) );
254 254
 					} else {
255
-						$error = self::strings('error-add-note');
255
+						$error = self::strings( 'error-add-note' );
256 256
 						gravityview()->log->error( 'The note was not successfully created', array( 'data' => compact( 'note', 'data' ) ) );
257 257
 					}
258 258
 				}
259 259
 			} else {
260
-				$error = self::strings('error-invalid');
260
+				$error = self::strings( 'error-invalid' );
261 261
 				gravityview()->log->error( 'Nonce validation failed; the note was not created' );
262 262
 			}
263 263
 		}
264 264
 
265 265
 
266
-		if( $this->doing_ajax ) {
267
-			if( $success ) {
266
+		if ( $this->doing_ajax ) {
267
+			if ( $success ) {
268 268
 				wp_send_json_success( array( 'html' => $success ) );
269 269
 			} else {
270 270
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 			return;
291 291
 		}
292 292
 
293
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
293
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
294 294
 
295 295
 			$post = wp_unslash( $_POST );
296 296
 			if ( $this->doing_ajax ) {
297
-				parse_str( $post['data'], $data );
297
+				parse_str( $post[ 'data' ], $data );
298 298
 			} else {
299 299
 				$data = $post;
300 300
 			}
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	function process_delete_notes( $data ) {
327 327
 
328
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
328
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
329 329
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
330 330
 		$success = false;
331 331
 
332 332
 		if ( $valid && $has_cap ) {
333
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
333
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
334 334
 			$success = true;
335 335
 		}
336 336
 
337
-		if( $this->doing_ajax ) {
337
+		if ( $this->doing_ajax ) {
338 338
 
339
-			if( $success ) {
339
+			if ( $success ) {
340 340
 				wp_send_json_success();
341 341
 			} else {
342 342
 				if ( ! $valid ) {
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
 
370 370
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
371 371
 
372
-		unset( $field_options['show_as_link'] );
372
+		unset( $field_options[ 'show_as_link' ] );
373 373
 
374 374
 		$notes_options = array(
375 375
 			'notes' => array(
376 376
 				'type' => 'checkboxes',
377
-				'label' => __('Note Settings', 'gravityview'),
378
-				'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
377
+				'label' => __( 'Note Settings', 'gravityview' ),
378
+				'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
379 379
 				'options' => array(
380 380
 					'view' => array(
381 381
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
428 428
 			'other-email' => __( 'Other email address', 'gravityview' ),
429 429
 			'email-label' => __( 'Email address', 'gravityview' ),
430
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
430
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
431 431
 			'subject-label' => __( 'Subject', 'gravityview' ),
432 432
 			'subject' => __( 'Email subject', 'gravityview' ),
433 433
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		 */
448 448
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
449 449
 
450
-		if( $key ) {
450
+		if ( $key ) {
451 451
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
452 452
 		}
453 453
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	static public function display_note( $note, $show_delete = false, $context = null ) {
471 471
 
472
-		if( ! is_object( $note ) ) {
472
+		if ( ! is_object( $note ) ) {
473 473
 			return '';
474 474
 		}
475 475
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		}
525 525
 
526 526
 		$replacements = array(
527
-			'{note_id}' => $note_content['note_id'],
527
+			'{note_id}' => $note_content[ 'note_id' ],
528 528
 			'{row_class}' => 'gv-note',
529 529
 			'{note_detail}' => $note_detail_html
530 530
 		);
@@ -556,13 +556,13 @@  discard block
 block discarded – undo
556 556
 
557 557
 		$user_data = get_userdata( $current_user->ID );
558 558
 
559
-		$note_content = trim( $data['gv-note-content'] );
559
+		$note_content = trim( $data[ 'gv-note-content' ] );
560 560
 
561
-		if( empty( $note_content ) ) {
561
+		if ( empty( $note_content ) ) {
562 562
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
563 563
 		}
564 564
 
565
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
565
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
566 566
 
567 567
 		return $return;
568 568
 	}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
 		$atts = shortcode_atts( array( 'entry' => null ), $atts );
584 584
 
585
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
585
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
586 586
 			gravityview()->log->error( 'User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
587 587
 			return '';
588 588
 		}
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 
605 605
 			$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
606 606
 
607
-			if ( $atts['entry'] ) {
608
-				$entry = GFAPI::get_entry( $atts['entry'] );
607
+			if ( $atts[ 'entry' ] ) {
608
+				$entry = GFAPI::get_entry( $atts[ 'entry' ] );
609 609
 			}
610 610
 
611 611
 			if ( ! isset( $entry ) || ! $entry ) {
@@ -623,14 +623,14 @@  discard block
 block discarded – undo
623 623
 
624 624
 		// Only generate the dropdown if the field settings allow it
625 625
 		$email_fields = '';
626
-		if( ! empty( $visibility_settings['email'] ) ) {
626
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
627 627
 			$email_fields = self::get_note_email_fields( $entry_slug );
628 628
 		}
629 629
 
630 630
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
631 631
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
632
-		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings['delete'] ) ? 0 : $visibility_settings['delete'] ), $add_note_html );
633
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
632
+		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings[ 'delete' ] ) ? 0 : $visibility_settings[ 'delete' ] ), $add_note_html );
633
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
634 634
 		$add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html );
635 635
 
636 636
 		return $add_note_html;
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
 		$note_emails = array();
656 656
 
657 657
 		foreach ( $email_fields as $email_field ) {
658
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
659
-				$note_emails[] = $entry["{$email_field->id}"];
658
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
659
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
660 660
 			}
661 661
 		}
662 662
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 		 */
669 669
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
670 670
 
671
-		return (array) $note_emails;
671
+		return (array)$note_emails;
672 672
 	}
673 673
 
674 674
 	/**
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 */
685 685
 	private static function get_note_email_fields( $entry_slug = '' ) {
686 686
 
687
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
687
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
688 688
 			gravityview()->log->error( 'User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
689 689
 			return '';
690 690
 		}
@@ -706,27 +706,27 @@  discard block
 block discarded – undo
706 706
 
707 707
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
708 708
 			<div class="gv-note-email-container">
709
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
709
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
710 710
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
711
-					<option value=""><?php echo $strings['also-email'];  ?></option>
711
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
712 712
 					<?php foreach ( $note_emails as  $email ) {
713 713
 						?>
714 714
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
715 715
 					<?php }
716
-					if( $include_custom ) { ?>
717
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
716
+					if ( $include_custom ) { ?>
717
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
718 718
 					<?php } ?>
719 719
 				</select>
720 720
 				<fieldset class="gv-note-to-container">
721
-					<?php if( $include_custom ) { ?>
721
+					<?php if ( $include_custom ) { ?>
722 722
 					<div class='gv-note-to-custom-container'>
723
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
724
-						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
723
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
724
+						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
725 725
 					</div>
726 726
 					<?php } ?>
727 727
 		            <div class='gv-note-subject-container'>
728
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
729
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
728
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
729
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
730 730
 		            </div>
731 731
 				</fieldset>
732 732
 			</div>
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 */
750 750
 	private function maybe_send_entry_notes( $note = false, $entry, $data ) {
751 751
 
752
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
752
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
753 753
 			gravityview()->log->debug( 'User doesn\'t have "gravityview_email_entry_notes" cap, or $note is empty', array( 'data' => $note ) );
754 754
 			return;
755 755
 		}
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 		gravityview()->log->debug( '$data', array( 'data' => $data ) );
758 758
 
759 759
 		//emailing notes if configured
760
-		if ( ! empty( $data['gv-note-to'] ) ) {
760
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
761 761
 
762 762
 			$default_data = array(
763 763
 				'gv-note-to' => '',
@@ -767,11 +767,11 @@  discard block
 block discarded – undo
767 767
                 'current-url' => '',
768 768
 			);
769 769
 
770
-			$current_user  = wp_get_current_user();
770
+			$current_user = wp_get_current_user();
771 771
 			$email_data = wp_parse_args( $data, $default_data );
772 772
 
773
-			$from    = $current_user->user_email;
774
-			$to = $email_data['gv-note-to'];
773
+			$from = $current_user->user_email;
774
+			$to = $email_data[ 'gv-note-to' ];
775 775
 
776 776
 			/**
777 777
 			 * Documented in get_note_email_fields
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 			 */
780 780
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
781 781
 
782
-			if( 'custom' === $to && $include_custom ) {
783
-				$to = $email_data['gv-note-to-custom'];
782
+			if ( 'custom' === $to && $include_custom ) {
783
+				$to = $email_data[ 'gv-note-to-custom' ];
784 784
 				gravityview()->log->debug( 'Sending note to a custom email address: {to}' . array( 'to' => $to ) );
785 785
 			}
786 786
 
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 
792 792
 			$bcc = false;
793 793
 			$reply_to = $from;
794
-			$subject = trim( $email_data['gv-note-subject'] );
794
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
795 795
 
796 796
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
797 797
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
798
-			$message = $email_data['gv-note-content'];
798
+			$message = $email_data[ 'gv-note-content' ];
799 799
 			$email_footer = self::strings( 'email-footer' );
800
-			$from_name     = $current_user->display_name;
800
+			$from_name = $current_user->display_name;
801 801
 			$message_format = 'html';
802 802
 
803 803
 			/**
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
830 830
 
831
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
831
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
832 832
 
833 833
 			/**
834 834
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
 	    $output = '';
856 856
 
857
-		if( ! empty( $email_footer ) ) {
857
+		if ( ! empty( $email_footer ) ) {
858 858
 		    $url = \GV\Utils::get( $email_data, 'current-url' );
859 859
 			$url = html_entity_decode( $url );
860 860
 			$url = site_url( $url );
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-locking.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
 		$result = array();
68 68
 		if ( ! $lock_holder_user_id ) {
69 69
 			$this->set_lock( $object_id );
70
-			$result['html']   = __( 'You now have control', 'gravityview' );
71
-			$result['status'] = 'lock_obtained';
70
+			$result[ 'html' ]   = __( 'You now have control', 'gravityview' );
71
+			$result[ 'status' ] = 'lock_obtained';
72 72
 		} else {
73 73
 
74
-			if( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) {
74
+			if ( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) {
75 75
 				$user = get_userdata( $lock_holder_user_id );
76
-				$result['html']   = sprintf( __( 'Your request has been sent to %s.', 'gravityview' ), $user->display_name );
76
+				$result[ 'html' ]   = sprintf( __( 'Your request has been sent to %s.', 'gravityview' ), $user->display_name );
77 77
 			} else {
78
-				$result['html']   = __( 'Your request has been sent.', 'gravityview' );
78
+				$result[ 'html' ]   = __( 'Your request has been sent.', 'gravityview' );
79 79
 			}
80 80
 
81 81
 			$this->update_lock_request_meta( $object_id, $user_id );
82 82
 
83
-			$result['status'] = 'lock_requested';
83
+			$result[ 'status' ] = 'lock_requested';
84 84
 		}
85 85
 
86 86
 		return $result;
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 		$continue_enqueuing = false;
123 123
 
124 124
 		// If any Views being loaded have entry locking, enqueue the scripts
125
-		foreach( $views->all() as $view ) {
125
+		foreach ( $views->all() as $view ) {
126 126
 
127 127
 			// Make sure the View has edit locking enabled
128
-			if( ! $view->settings->get( 'edit_locking' ) ) {
128
+			if ( ! $view->settings->get( 'edit_locking' ) ) {
129 129
 				continue;
130 130
 			}
131 131
 
132 132
 			// Make sure that the entry belongs to one of the forms connected to one of the Views in this request
133 133
 			$joined_forms = $view::get_joined_forms( $view->ID );
134 134
 
135
-			$entry_form_id = $entry_array['form_id'];
135
+			$entry_form_id = $entry_array[ 'form_id' ];
136 136
 
137
-			if( ! isset( $joined_forms[ $entry_form_id ] ) ) {
137
+			if ( ! isset( $joined_forms[ $entry_form_id ] ) ) {
138 138
 				continue;
139 139
 			}
140 140
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			break;
144 144
 		}
145 145
 
146
-		if( ! $continue_enqueuing ) {
146
+		if ( ! $continue_enqueuing ) {
147 147
 			return;
148 148
 		}
149 149
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	protected function enqueue_scripts( $entry ) {
165 165
 
166
-		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET['gform_debug'] ) ? '' : '.min';
166
+		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || isset( $_GET[ 'gform_debug' ] ) ? '' : '.min';
167 167
 		$locking_path = GFCommon::get_base_url() . '/includes/locking/';
168 168
 
169 169
 		wp_enqueue_script( 'gforms_locking', $locking_path . "js/locking{$min}.js", array( 'jquery', 'heartbeat' ), GFCommon::$version );
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
 		$translations = array_map( 'wp_strip_all_tags', $this->get_strings() );
173 173
 
174 174
 		$strings = array(
175
-			'noResponse'    => $translations['no_response'],
176
-			'requestAgain'  => $translations['request_again'],
177
-			'requestError'  => $translations['request_error'],
178
-			'gainedControl' => $translations['gained_control'],
179
-			'rejected'      => $translations['request_rejected'],
180
-			'pending'       => $translations['request_pending'],
175
+			'noResponse'    => $translations[ 'no_response' ],
176
+			'requestAgain'  => $translations[ 'request_again' ],
177
+			'requestError'  => $translations[ 'request_error' ],
178
+			'gainedControl' => $translations[ 'gained_control' ],
179
+			'rejected'      => $translations[ 'request_rejected' ],
180
+			'pending'       => $translations[ 'request_pending' ],
181 181
 		);
182 182
 
183
-		$lock_user_id = $this->check_lock( $entry['id'] );
183
+		$lock_user_id = $this->check_lock( $entry[ 'id' ] );
184 184
 
185 185
 		$vars = array(
186 186
 			'hasLock'    => ! $lock_user_id ? 1 : 0,
187 187
 			'lockUI'     => $this->get_lock_ui( $lock_user_id ),
188
-			'objectID'   => $entry['id'],
188
+			'objectID'   => $entry[ 'id' ],
189 189
 			'objectType' => 'entry',
190 190
 			'strings'    => $strings,
191 191
 		);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		$hidden = $locked ? '' : ' hidden';
216 216
 		if ( $locked ) {
217 217
 
218
-			if( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) {
218
+			if ( GVCommon::has_cap( 'gravityforms_edit_entries' ) ) {
219 219
 				$avatar = get_avatar( $user->ID, 64 );
220 220
 				$person_editing_text = $user->display_name;
221 221
 			} else {
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
 		$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
324 324
 
325
-		if ( isset( $_GET['get-edit-lock'] ) ) {
325
+		if ( isset( $_GET[ 'get-edit-lock' ] ) ) {
326 326
 			$this->set_lock( $entry_id );
327 327
 			echo '<script>window.location = ' . json_encode( remove_query_arg( 'get-edit-lock', $current_url ) ) . ';</script>';
328 328
 			exit();
329
-		} else if ( isset( $_GET['release-edit-lock'] ) ) {
329
+		} else if ( isset( $_GET[ 'release-edit-lock' ] ) ) {
330 330
 			$this->delete_lock_meta( $entry_id );
331 331
 			$current_url = remove_query_arg( 'edit', $current_url );
332 332
 			echo '<script>window.location = ' . json_encode( remove_query_arg( 'release-edit-lock', $current_url ) ) . ';</script>';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,21 +24,21 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
26 26
 
27
-		unset( $field_options['search_filter'] );
27
+		unset( $field_options[ 'search_filter' ] );
28 28
 
29
-		if( 'edit' === $context ) {
29
+		if ( 'edit' === $context ) {
30 30
 			return $field_options;
31 31
 		}
32 32
 
33
-		$add_options['link_to_file'] = array(
33
+		$add_options[ 'link_to_file' ] = array(
34 34
 			'type' => 'checkbox',
35 35
 			'label' => __( 'Display as a Link:', 'gravityview' ),
36
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
36
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
37 37
 			'value' => false,
38 38
 			'merge_tags' => false,
39 39
 		);
40 40
 
41
-		$add_options['image_width'] = array(
41
+		$add_options[ 'image_width' ] = array(
42 42
 			'type' => 'text',
43 43
 			'label' => __( 'Custom Width:', 'gravityview' ),
44 44
 			'desc' => __( 'Override the default image width (250).', 'gravityview' ),
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 			$base_id = null;
128 128
 
129 129
 			$is_single = gravityview_get_context() === 'single';
130
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
130
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
131 131
 			$field_compat = $gravityview_view->getCurrentField();
132 132
 		}
133 133
 
134 134
 		$output_arr = array();
135 135
 
136 136
 		// Get an array of file paths for the field.
137
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
137
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
138 138
 
139 139
 		// The $value JSON was probably truncated; let's check lead_detail_long.
140 140
 		if ( ! is_array( $file_paths ) ) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			$rendered = null;
154 154
 
155 155
 			// If the site is HTTPS, use HTTPS
156
-			if ( function_exists('set_url_scheme') ) {
156
+			if ( function_exists( 'set_url_scheme' ) ) {
157 157
 				$file_path = set_url_scheme( $file_path );
158 158
 			}
159 159
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 			$file_path_info = pathinfo( $file_path );
165 165
 
166 166
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
167
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
168
-			$basename = $file_path_info['basename'];
167
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
168
+			$basename = $file_path_info[ 'basename' ];
169 169
 
170 170
 			// Get the secure download URL
171 171
 			$is_secure = false;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					 */
203 203
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
204 204
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
205
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
205
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
206 206
 					), $context );
207 207
 
208 208
 					/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					 */
239 239
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
240 240
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
241
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
241
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
242 242
 					), $context );
243 243
 
244 244
 					/**
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 				$width = \GV\Utils::get( $field_settings, 'image_width', 250 );
272 272
 				$image_atts = array(
273 273
 					'src'   => $file_path,
274
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
275
-					'alt'   => $field_settings['label'],
276
-					'width' => ( $is_single ? null : ( $width ? $width: 250 ) )
274
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
275
+					'alt'   => $field_settings[ 'label' ],
276
+					'width' => ( $is_single ? null : ( $width ? $width : 250 ) )
277 277
 				);
278 278
 
279 279
 				if ( $is_secure ) {
280
-					$image_atts['validate_src'] = false;
280
+					$image_atts[ 'validate_src' ] = false;
281 281
 				}
282 282
 
283 283
 				/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				 */
308 308
 				$override_security = apply_filters( 'gravityview/fields/fileupload/allow_insecure_lightbox', false, $file_path, $field_settings, $context );
309 309
 
310
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) && ( ! $is_secure || $override_security ) ) {
310
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) && ( ! $is_secure || $override_security ) ) {
311 311
 					$lightbox_link_atts = array(
312 312
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
313 313
 						'class' => 'thickbox',
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 					$lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context );
317 317
 
318 318
 					if ( $override_security ) {
319
-						$image_atts['src'] = $insecure_file_path;
319
+						$image_atts[ 'src' ] = $insecure_file_path;
320 320
 						$image = new GravityView_Image( $image_atts );
321 321
 						$file_path = $insecure_file_path;
322 322
 						// :( a kitten died somewhere
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 				}
329 329
 
330 330
 				// Show as link should render the image regardless.
331
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
331
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
332 332
 					$text = $rendered;
333 333
 				}
334 334
 			}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
346 346
 
347 347
 			// Output textualized content where
348
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
348
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
349 349
 				/**
350 350
 				 * Modify the link text (defaults to the file name)
351 351
 				 *
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				 */
359 359
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
360 360
 
361
-				if ( empty( $field_settings['show_as_link'] ) ) {
361
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
362 362
 					/**
363 363
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
364 364
 					 * @param array|string $link_atts Array or attributes string
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 				$content = empty( $rendered ) ? $text : $rendered;
375 375
 			}
376 376
 
377
-			$output_arr[] = array(
377
+			$output_arr[ ] = array(
378 378
 				'file_path' => $file_path,
379 379
 				'content' => $content
380 380
 			);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @var GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 
54 54
 			if ( 'hidden' === $field->type ) {
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				 */
63 63
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field );
64 64
 
65
-				if( ! $reveal_hidden_field ) {
65
+				if ( ! $reveal_hidden_field ) {
66 66
 					continue;
67 67
 				}
68 68
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		/** @var WP_Admin_Bar $wp_admin_bar */
39 39
 		global $wp_admin_bar;
40 40
 
41
-		if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
41
+		if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
42 42
 			return;
43 43
 		}
44 44
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 				'meta' => array(
104 104
 					'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), $entry->get_slug() ),
105 105
 				),
106
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
106
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
107 107
 			) );
108 108
 
109 109
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		/** @var WP_Admin_Bar $wp_admin_bar */
120 120
 		global $wp_admin_bar;
121 121
 
122
-		if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
122
+		if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
123 123
 
124 124
 			$view_data = GravityView_View_Data::getInstance();
125 125
 			$views = $view_data->get_views();
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 				$added_views = array();
132 132
 
133 133
 				foreach ( $views as $view ) {
134
-					$view = \GV\View::by_id( $view['id'] );
134
+					$view = \GV\View::by_id( $view[ 'id' ] );
135 135
 					$view_id = $view->ID;
136 136
 					$form_id = $view->form ? $view->form->ID : null;
137 137
 
138 138
 					$edit_view_title = __( 'Edit View', 'gravityview' );
139 139
 					$edit_form_title = __( 'Edit Form', 'gravityview' );
140 140
 
141
-					if( sizeof( $views ) > 1 ) {
141
+					if ( sizeof( $views ) > 1 ) {
142 142
 						$edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view_id );
143 143
 						$edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $form_id );
144 144
 					}
145 145
 
146
-					if( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) {
146
+					if ( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) {
147 147
 
148
-						$added_views[] = $view_id;
148
+						$added_views[ ] = $view_id;
149 149
 
150 150
 						$wp_admin_bar->add_menu( array(
151 151
 							'id'    => 'edit-view-' . $view_id,
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 						) );
156 156
 					}
157 157
 
158
-					if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms )  ) {
158
+					if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) {
159 159
 
160
-						$added_forms[] = $form_id;
160
+						$added_forms[ ] = $form_id;
161 161
 
162 162
 						$wp_admin_bar->add_menu( array(
163 163
 							'id'    => 'edit-form-' . $form_id,
Please login to merge, or discard this patch.
future/includes/class-gv-entry.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$args = array();
115 115
 
116
-		$view_id = is_null ( $view ) ? null : $view->ID;
116
+		$view_id = is_null( $view ) ? null : $view->ID;
117 117
 
118 118
 		$permalink = null;
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 				$view_collection = View_Collection::from_post( $post );
128 128
 
129
-				if( 1 < $view_collection->count() ) {
130
-					$args['gvid'] = $view_id;
129
+				if ( 1 < $view_collection->count() ) {
130
+					$args[ 'gvid' ] = $view_id;
131 131
 				}
132 132
 			}
133 133
 		}
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 			 */
158 158
 			$link_parts = explode( '?', $permalink );
159 159
 
160
-			$query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : '';
160
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
161 161
 
162
-			$permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query;
162
+			$permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query;
163 163
 		} else {
164 164
 			$args[ $entry_endpoint_name ] = $entry_slug;
165 165
 		}
166 166
 
167 167
 		if ( $track_directory ) {
168
-			if ( ! empty( $_GET['pagenum'] ) ) {
169
-				$args['pagenum'] = intval( $_GET['pagenum'] );
168
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
169
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
170 170
 			}
171 171
 
172 172
 			if ( $sort = Utils::_GET( 'sort' ) ) {
173
-				$args['sort'] = $sort;
174
-				$args['dir'] = Utils::_GET( 'dir' );
173
+				$args[ 'sort' ] = $sort;
174
+				$args[ 'dir' ] = Utils::_GET( 'dir' );
175 175
 			}
176 176
 		}
177 177
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 		$entry_slug = \GravityView_API::get_entry_slug( $this->ID, $this->as_entry() );
211 211
 
212
-		if( ! $apply_filter ) {
212
+		if ( ! $apply_filter ) {
213 213
 			return $entry_slug;
214 214
 		}
215 215
 
Please login to merge, or discard this patch.