Completed
Push — master ( 1b7620...a4da27 )
by Zack
12s
created
includes/fields/class-gravityview-field-post-excerpt.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 
23 23
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24 24
 
25
-		unset( $field_options['show_as_link'] );
25
+		unset( $field_options[ 'show_as_link' ] );
26 26
 
27
-		if( 'edit' === $context ) {
27
+		if ( 'edit' === $context ) {
28 28
 			return $field_options;
29 29
 		}
30 30
 
31
-		$this->add_field_support('dynamic_data', $field_options );
31
+		$this->add_field_support( 'dynamic_data', $field_options );
32 32
 
33 33
 		return $field_options;
34 34
 	}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 
943 943
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
944 944
 
945
-			if( ! $this->is_valid ){
945
+			if( ! $this->is_valid ) {
946 946
 
947 947
 				// Keeping this compatible with Gravity Forms.
948 948
 				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
@@ -1996,9 +1996,7 @@  discard block
 block discarded – undo
1996 1996
 		// Verify
1997 1997
 		else if( ! $this->is_edit_entry() ) {
1998 1998
 			$valid = false;
1999
-		}
2000
-
2001
-		else {
1999
+		} else {
2002 2000
 			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2003 2001
 		}
2004 2002
 
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	function load() {
107 107
 
108 108
 		/** @define "GRAVITYVIEW_DIR" "../../../" */
109
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
109
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
110 110
 
111 111
 		// Don't display an embedded form when editing an entry
112 112
 		add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
113 113
 		add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
114 114
 
115 115
 		// Stop Gravity Forms processing what is ours!
116
-		add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
116
+		add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
117 117
 
118
-		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
118
+		add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
119 119
 
120 120
 		add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
127 127
 
128 128
 		// Add fields expected by GFFormDisplay::validate()
129
-		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
129
+		add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
130 130
 
131 131
 		// Fix multiselect value for GF 2.2
132 132
 		add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 );
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @return void
144 144
 	 */
145 145
 	public function prevent_render_form() {
146
-		if( $this->is_edit_entry() ) {
147
-			if( 'wp_head' === current_filter() ) {
146
+		if ( $this->is_edit_entry() ) {
147
+			if ( 'wp_head' === current_filter() ) {
148 148
 				add_filter( 'gform_shortcode_form', '__return_empty_string' );
149 149
 			} else {
150 150
 				remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function prevent_maybe_process_form() {
161 161
 
162
-		if( ! empty( $_POST ) ) {
162
+		if ( ! empty( $_POST ) ) {
163 163
 			do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
164 164
 		}
165 165
 
166
-		if( $this->is_edit_entry_submission() ) {
167
-			remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
168
-			remove_action( 'wp',  array( 'GFForms', 'maybe_process_form'), 9 );
166
+		if ( $this->is_edit_entry_submission() ) {
167
+			remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
168
+			remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 );
169 169
 		}
170 170
 	}
171 171
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function is_edit_entry() {
177 177
 
178
-		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] );
178
+		$is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] );
179 179
 
180 180
 		return ( $is_edit_entry || $this->is_edit_entry_submission() );
181 181
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return boolean
187 187
 	 */
188 188
 	public function is_edit_entry_submission() {
189
-		return !empty( $_POST[ self::$nonce_field ] );
189
+		return ! empty( $_POST[ self::$nonce_field ] );
190 190
 	}
191 191
 
192 192
 	/**
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 		$entries = $gravityview_view->getEntries();
200
-		self::$original_entry = $entries[0];
201
-		$this->entry = $entries[0];
200
+		self::$original_entry = $entries[ 0 ];
201
+		$this->entry = $entries[ 0 ];
202 202
 
203 203
 		self::$original_form = $gravityview_view->getForm();
204 204
 		$this->form = $gravityview_view->getForm();
205 205
 		$this->form_id = $gravityview_view->getFormId();
206 206
 		$this->view_id = $gravityview_view->getViewId();
207 207
 
208
-		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
208
+		self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
209 209
 	}
210 210
 
211 211
 
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 
227 227
 		// Multiple Views embedded, don't proceed if nonce fails
228 228
 		$multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $gv_data->has_multiple_views();
229
-		if( $multiple_views && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
230
-			do_action('gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' );
229
+		if ( $multiple_views && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
230
+			do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed for the Edit Entry request; returning' );
231 231
 			return;
232 232
 		}
233 233
 
234 234
 		// Sorry, you're not allowed here.
235
-		if( false === $this->user_can_edit_entry( true ) ) {
236
-			do_action('gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry );
235
+		if ( false === $this->user_can_edit_entry( true ) ) {
236
+			do_action( 'gravityview_log_error', __METHOD__ . ': User is not allowed to edit this entry; returning', $this->entry );
237 237
 			return;
238 238
 		}
239 239
 
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 	private function print_scripts() {
254 254
 		$gravityview_view = GravityView_View::getInstance();
255 255
 
256
-		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
256
+		wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
257 257
 
258
-		GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
258
+		GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
259 259
 
260 260
 		// Sack is required for images
261 261
 		wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	private function process_save() {
269 269
 
270
-		if( empty( $_POST ) || ! isset( $_POST['lid'] ) ) {
270
+		if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) {
271 271
 			return;
272 272
 		}
273 273
 
274 274
 		// Make sure the entry, view, and form IDs are all correct
275 275
 		$valid = $this->verify_nonce();
276 276
 
277
-		if( !$valid ) {
278
-			do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
277
+		if ( ! $valid ) {
278
+			do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
279 279
 			return;
280 280
 		}
281 281
 
282
-		if( $this->entry['id'] !== $_POST['lid'] ) {
283
-			do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
282
+		if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
283
+			do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
284 284
 			return;
285 285
 		}
286 286
 
287
-		do_action('gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
287
+		do_action( 'gravityview_log_debug', __METHOD__ . ': $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
288 288
 
289 289
 		$this->process_save_process_files( $this->form_id );
290 290
 
291 291
 		$this->validate();
292 292
 
293
-		if( $this->is_valid ) {
293
+		if ( $this->is_valid ) {
294 294
 
295
-			do_action('gravityview_log_debug', __METHOD__ . ': Submission is valid.' );
295
+			do_action( 'gravityview_log_debug', __METHOD__ . ': Submission is valid.' );
296 296
 
297 297
 			/**
298 298
 			 * @hack This step is needed to unset the adminOnly from form fields, to add the calculation fields
@@ -302,22 +302,22 @@  discard block
 block discarded – undo
302 302
 			/**
303 303
 			 * @hack to avoid the capability validation of the method save_lead for GF 1.9+
304 304
 			 */
305
-			unset( $_GET['page'] );
305
+			unset( $_GET[ 'page' ] );
306 306
 
307
-			$date_created = $this->entry['date_created'];
307
+			$date_created = $this->entry[ 'date_created' ];
308 308
 
309 309
 			/**
310 310
 			 * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead()
311 311
 			 * @since 1.17.2
312 312
 			 */
313
-			unset( $this->entry['date_created'] );
313
+			unset( $this->entry[ 'date_created' ] );
314 314
 
315 315
 			GFFormsModel::save_lead( $form, $this->entry );
316 316
 
317 317
 			// Delete the values for hidden inputs
318 318
 			$this->unset_hidden_field_values();
319 319
 			
320
-			$this->entry['date_created'] = $date_created;
320
+			$this->entry[ 'date_created' ] = $date_created;
321 321
 
322 322
 			// Process calculation fields
323 323
 			$this->update_calculation_fields();
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
 			 * @param string $entry_id Numeric ID of the entry that was updated
338 338
 			 * @param GravityView_Edit_Entry_Render $this This object
339 339
 			 */
340
-			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this );
340
+			do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this );
341 341
 
342 342
 		} else {
343
-			do_action('gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry );
343
+			do_action( 'gravityview_log_error', __METHOD__ . ': Submission is NOT valid.', $this->entry );
344 344
 		}
345 345
 
346 346
 	} // process_save
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 
360 360
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
361 361
 			$entry_meta_table = GFFormsModel::get_entry_meta_table_name();
362
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) );
362
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) );
363 363
 		} else {
364 364
 			$lead_detail_table = GFFormsModel::get_lead_details_table_name();
365
-			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) );
365
+			$current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) );
366 366
 		}
367 367
 
368 368
 		foreach ( $this->entry as $input_id => $field_value ) {
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 		}
444 444
 
445 445
 		/** No file is being uploaded. */
446
-		if ( empty( $_FILES[ $input_name ]['name'] ) ) {
446
+		if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) {
447 447
 			/** So return the original upload */
448 448
 			return $entry[ $input_id ];
449 449
 		}
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 * @return mixed
462 462
 	 */
463 463
 	public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
464
-		if( ! $this->is_edit_entry() ) {
464
+		if ( ! $this->is_edit_entry() ) {
465 465
 			return $plupload_init;
466 466
 		}
467 467
 
468
-		$plupload_init['gf_vars']['max_files'] = 0;
468
+		$plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
469 469
 
470 470
 		return $plupload_init;
471 471
 	}
@@ -480,22 +480,22 @@  discard block
 block discarded – undo
480 480
 		$form = $this->form;
481 481
 
482 482
 		/** @var GF_Field $field */
483
-		foreach( $form['fields'] as $k => &$field ) {
483
+		foreach ( $form[ 'fields' ] as $k => &$field ) {
484 484
 
485 485
 			/**
486 486
 			 * Remove the fields with calculation formulas before save to avoid conflicts with GF logic
487 487
 			 * @since 1.16.3
488 488
 			 * @var GF_Field $field
489 489
 			 */
490
-			if( $field->has_calculation() ) {
491
-				unset( $form['fields'][ $k ] );
490
+			if ( $field->has_calculation() ) {
491
+				unset( $form[ 'fields' ][ $k ] );
492 492
 			}
493 493
 
494 494
 			$field->adminOnly = false;
495 495
 
496
-			if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
497
-				foreach( $field->inputs as $key => $input ) {
498
-					$field->inputs[ $key ][ 'id' ] = (string)$input['id'];
496
+			if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
497
+				foreach ( $field->inputs as $key => $input ) {
498
+					$field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
499 499
 				}
500 500
 			}
501 501
 		}
@@ -509,21 +509,21 @@  discard block
 block discarded – undo
509 509
 		$update = false;
510 510
 
511 511
 		// get the most up to date entry values
512
-		$entry = GFAPI::get_entry( $this->entry['id'] );
512
+		$entry = GFAPI::get_entry( $this->entry[ 'id' ] );
513 513
 
514
-		if( !empty( $this->fields_with_calculation ) ) {
514
+		if ( ! empty( $this->fields_with_calculation ) ) {
515 515
 			$update = true;
516 516
 			foreach ( $this->fields_with_calculation as $calc_field ) {
517 517
 				$inputs = $calc_field->get_entry_inputs();
518 518
 				if ( is_array( $inputs ) ) {
519 519
 					foreach ( $inputs as $input ) {
520
-						$input_name = 'input_' . str_replace( '.', '_', $input['id'] );
520
+						$input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] );
521 521
 						list( $prefix, $field_id, $input_id ) = rgexplode( '_', $input_name, 3 );
522 522
 
523 523
 						switch ( $input_id ) {
524 524
 							case 1:
525 525
 								/** Never void the labels. */
526
-								$value = $entry[ $input['id'] ];
526
+								$value = $entry[ $input[ 'id' ] ];
527 527
 								break;
528 528
 							case 2:
529 529
 								/** Always recalcualte the final price. */
@@ -531,25 +531,25 @@  discard block
 block discarded – undo
531 531
 								break;
532 532
 							case 3:
533 533
 								/** Fetch the quantity form the request. */
534
-								$value = rgpost( $input_name, $entry[ $input['id'] ] );
534
+								$value = rgpost( $input_name, $entry[ $input[ 'id' ] ] );
535 535
 								break;
536 536
 						}
537 537
 
538
-						$entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry['id'], $entry );
538
+						$entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, $value, $input_name, $entry[ 'id' ], $entry );
539 539
 					}
540 540
 				} else {
541
-					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id);
542
-					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry );
541
+					$input_name = 'input_' . str_replace( '.', '_', $calc_field->id );
542
+					$entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry );
543 543
 				}
544 544
 			}
545 545
 
546 546
 		}
547 547
 
548
-		if( $update ) {
548
+		if ( $update ) {
549 549
 
550 550
 			$return_entry = GFAPI::update_entry( $entry );
551 551
 
552
-			if( is_wp_error( $return_entry ) ) {
552
+			if ( is_wp_error( $return_entry ) ) {
553 553
 				do_action( 'gravityview_log_error', 'Updating the entry calculation fields failed', $return_entry );
554 554
 			} else {
555 555
 				do_action( 'gravityview_log_debug', 'Updating the entry calculation fields succeeded' );
@@ -580,18 +580,18 @@  discard block
 block discarded – undo
580 580
 
581 581
 		$input_name = 'input_' . $field_id;
582 582
 
583
-		if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
583
+		if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
584 584
 
585 585
 			// We have a new image
586 586
 
587
-			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] );
587
+			$value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] );
588 588
 
589 589
 			$ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
590 590
 			$img_url = rgar( $ary, 0 );
591 591
 
592
-			$img_title	   = count( $ary ) > 1 ? $ary[1] : '';
593
-			$img_caption	 = count( $ary ) > 2 ? $ary[2] : '';
594
-			$img_description = count( $ary ) > 3 ? $ary[3] : '';
592
+			$img_title	   = count( $ary ) > 1 ? $ary[ 1 ] : '';
593
+			$img_caption	 = count( $ary ) > 2 ? $ary[ 2 ] : '';
594
+			$img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
595 595
 
596 596
 			$image_meta = array(
597 597
 				'post_excerpt' => $img_caption,
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
 			//adding title only if it is not empty. It will default to the file name if it is not in the array
602 602
 			if ( ! empty( $img_title ) ) {
603
-				$image_meta['post_title'] = $img_title;
603
+				$image_meta[ 'post_title' ] = $img_title;
604 604
 			}
605 605
 
606 606
 			/**
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 				set_post_thumbnail( $post_id, $media_id );
616 616
 			}
617 617
 
618
-		} elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
618
+		} elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
619 619
 
620 620
 			$img_url = $_POST[ $input_name ];
621 621
 
622
-			$img_title	   = rgar( $_POST, $input_name.'_1' );
623
-			$img_caption	 = rgar( $_POST, $input_name .'_4' );
624
-			$img_description = rgar( $_POST, $input_name .'_7' );
622
+			$img_title	   = rgar( $_POST, $input_name . '_1' );
623
+			$img_caption	 = rgar( $_POST, $input_name . '_4' );
624
+			$img_description = rgar( $_POST, $input_name . '_7' );
625 625
 
626 626
 			$value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : '';
627 627
 
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	private function maybe_update_post_fields( $form ) {
661 661
 
662
-		if( empty( $this->entry['post_id'] ) ) {
662
+		if ( empty( $this->entry[ 'post_id' ] ) ) {
663 663
 			do_action( 'gravityview_log_debug', __METHOD__ . ': This entry has no post fields. Continuing...' );
664 664
 			return;
665 665
 		}
666 666
 
667
-		$post_id = $this->entry['post_id'];
667
+		$post_id = $this->entry[ 'post_id' ];
668 668
 
669 669
 		// Security check
670
-		if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
671
-			do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
670
+		if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
671
+			do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
672 672
 			return;
673 673
 		}
674 674
 
@@ -680,25 +680,25 @@  discard block
 block discarded – undo
680 680
 
681 681
 			$field = RGFormsModel::get_field( $form, $field_id );
682 682
 
683
-			if( ! $field ) {
683
+			if ( ! $field ) {
684 684
 				continue;
685 685
 			}
686 686
 
687
-			if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
687
+			if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) {
688 688
 
689 689
 				// Get the value of the field, including $_POSTed value
690 690
 				$value = RGFormsModel::get_field_value( $field );
691 691
 
692 692
 				// Use temporary entry variable, to make values available to fill_post_template() and update_post_image()
693 693
 				$entry_tmp = $this->entry;
694
-				$entry_tmp["{$field_id}"] = $value;
694
+				$entry_tmp[ "{$field_id}" ] = $value;
695 695
 
696
-				switch( $field->type ) {
696
+				switch ( $field->type ) {
697 697
 
698 698
 					case 'post_title':
699 699
 						$post_title = $value;
700
-						if( rgar( $form, 'postTitleTemplateEnabled' ) ) {
701
-							$post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp );
700
+						if ( rgar( $form, 'postTitleTemplateEnabled' ) ) {
701
+							$post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp );
702 702
 						}
703 703
 						$updated_post->post_title = $post_title;
704 704
 						$updated_post->post_name  = $post_title;
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 
708 708
 					case 'post_content':
709 709
 						$post_content = $value;
710
-						if( rgar( $form, 'postContentTemplateEnabled' ) ) {
711
-							$post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true );
710
+						if ( rgar( $form, 'postContentTemplateEnabled' ) ) {
711
+							$post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true );
712 712
 						}
713 713
 						$updated_post->post_content = $post_content;
714 714
 						unset( $post_content );
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
 							$value = $value[ $field_id ];
727 727
 						}
728 728
 
729
-						if( ! empty( $field->customFieldTemplateEnabled ) ) {
729
+						if ( ! empty( $field->customFieldTemplateEnabled ) ) {
730 730
 							$value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true );
731 731
 						}
732 732
 
733 733
 						if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) {
734
-							$value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
734
+							$value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
735 735
 						}
736 736
 
737 737
 						update_post_meta( $post_id, $field->postCustomFieldName, $value );
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 				}
745 745
 
746 746
 				// update entry after
747
-				$this->entry["{$field_id}"] = $value;
747
+				$this->entry[ "{$field_id}" ] = $value;
748 748
 
749 749
 				$update_entry = true;
750 750
 
@@ -753,25 +753,25 @@  discard block
 block discarded – undo
753 753
 
754 754
 		}
755 755
 
756
-		if( $update_entry ) {
756
+		if ( $update_entry ) {
757 757
 
758 758
 			$return_entry = GFAPI::update_entry( $this->entry );
759 759
 
760
-			if( is_wp_error( $return_entry ) ) {
760
+			if ( is_wp_error( $return_entry ) ) {
761 761
 			   do_action( 'gravityview_log_error', 'Updating the entry post fields failed', array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) );
762 762
 			} else {
763
-				do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
763
+				do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
764 764
 			}
765 765
 
766 766
 		}
767 767
 
768 768
 		$return_post = wp_update_post( $updated_post, true );
769 769
 
770
-		if( is_wp_error( $return_post ) ) {
770
+		if ( is_wp_error( $return_post ) ) {
771 771
 			$return_post->add_data( $updated_post, '$updated_post' );
772 772
 			do_action( 'gravityview_log_error', 'Updating the post content failed', compact( 'updated_post', 'return_post' ) );
773 773
 		} else {
774
-			do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post );
774
+			do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post );
775 775
 		}
776 776
 	}
777 777
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		$input_type = RGFormsModel::get_input_type( $field );
790 790
 
791 791
 		// Only certain custom field types are supported
792
-		switch( $input_type ) {
792
+		switch ( $input_type ) {
793 793
 			case 'fileupload':
794 794
 			case 'list':
795 795
 			case 'multiselect':
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = GFCommon::replace_variables( $output, $form, $entry, false, false, false );
827 827
 
828 828
 		// replace conditional shortcodes
829
-		if( $do_shortcode ) {
829
+		if ( $do_shortcode ) {
830 830
 			$output = do_shortcode( $output );
831 831
 		}
832 832
 
@@ -845,19 +845,19 @@  discard block
 block discarded – undo
845 845
 	 */
846 846
 	private function after_update() {
847 847
 
848
-		do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry );
849
-		do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry );
848
+		do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry );
849
+		do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry );
850 850
 
851 851
 		// Re-define the entry now that we've updated it.
852
-		$entry = RGFormsModel::get_lead( $this->entry['id'] );
852
+		$entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
853 853
 
854 854
 		$entry = GFFormsModel::set_entry_meta( $entry, $this->form );
855 855
 
856 856
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) {
857 857
 			// We need to clear the cache because Gravity Forms caches the field values, which
858 858
 			// we have just updated.
859
-			foreach ($this->form['fields'] as $key => $field) {
860
-				GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
859
+			foreach ( $this->form[ 'fields' ] as $key => $field ) {
860
+				GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
861 861
 			}
862 862
 		}
863 863
 
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
 		<div class="gv-edit-entry-wrapper"><?php
878 878
 
879
-			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
879
+			$javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
880 880
 
881 881
 			/**
882 882
 			 * Fixes weird wpautop() issue
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 					 * @param string $edit_entry_title Modify the "Edit Entry" title
893 893
 					 * @param GravityView_Edit_Entry_Render $this This object
894 894
 					 */
895
-					$edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
895
+					$edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
896 896
 
897 897
 					echo esc_attr( $edit_entry_title );
898 898
 			?></span>
@@ -938,20 +938,20 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	private function maybe_print_message() {
940 940
 
941
-		if( rgpost('action') === 'update' ) {
941
+		if ( rgpost( 'action' ) === 'update' ) {
942 942
 
943 943
 			$back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
944 944
 
945
-			if( ! $this->is_valid ){
945
+			if ( ! $this->is_valid ) {
946 946
 
947 947
 				// Keeping this compatible with Gravity Forms.
948
-				$validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
949
-				$message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
948
+				$validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
949
+				$message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
950 950
 
951
-				echo GVCommon::generate_notice( $message , 'gv-error' );
951
+				echo GVCommon::generate_notice( $message, 'gv-error' );
952 952
 
953 953
 			} else {
954
-				$entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
954
+				$entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
955 955
 
956 956
 				/**
957 957
 				 * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 				 * @param array $entry Gravity Forms entry array
962 962
 				 * @param string $back_link URL to return to the original entry. @since 1.6
963 963
 				 */
964
-				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
964
+				$message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
965 965
 
966 966
 				echo GVCommon::generate_notice( $message );
967 967
 			}
@@ -985,21 +985,21 @@  discard block
 block discarded – undo
985 985
 		 */
986 986
 		do_action( 'gravityview/edit-entry/render/before', $this );
987 987
 
988
-		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
989
-		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
988
+		add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
989
+		add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
990 990
 		add_filter( 'gform_disable_view_counter', '__return_true' );
991 991
 
992 992
 		add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
993 993
 		add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
994 994
 
995 995
 		// We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
996
-		unset( $_GET['page'] );
996
+		unset( $_GET[ 'page' ] );
997 997
 
998 998
 		// TODO: Verify multiple-page forms
999 999
 
1000 1000
 		ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic
1001 1001
 
1002
-		$html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
1002
+		$html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
1003 1003
 
1004 1004
 		ob_get_clean();
1005 1005
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return string
1026 1026
 	 */
1027 1027
 	public function render_form_buttons() {
1028
-		return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
1028
+		return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
 	public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
1046 1046
 
1047 1047
 		// In case we have validated the form, use it to inject the validation results into the form render
1048
-		if( isset( $this->form_after_validation ) ) {
1048
+		if ( isset( $this->form_after_validation ) ) {
1049 1049
 			$form = $this->form_after_validation;
1050 1050
 		} else {
1051
-			$form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
1051
+			$form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
1052 1052
 		}
1053 1053
 
1054 1054
 		$form = $this->filter_conditional_logic( $form );
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 		$form = $this->prefill_conditional_logic( $form );
1057 1057
 
1058 1058
 		// for now we don't support Save and Continue feature.
1059
-		if( ! self::$supports_save_and_continue ) {
1060
-			unset( $form['save'] );
1059
+		if ( ! self::$supports_save_and_continue ) {
1060
+			unset( $form[ 'save' ] );
1061 1061
 		}
1062 1062
 
1063 1063
 		return $form;
@@ -1078,29 +1078,29 @@  discard block
 block discarded – undo
1078 1078
 	 */
1079 1079
 	public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
1080 1080
 
1081
-		if( GFCommon::is_post_field( $field ) ) {
1081
+		if ( GFCommon::is_post_field( $field ) ) {
1082 1082
 
1083 1083
 			$message = null;
1084 1084
 
1085 1085
 			// First, make sure they have the capability to edit the post.
1086
-			if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
1086
+			if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
1087 1087
 
1088 1088
 				/**
1089 1089
 				 * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
1090 1090
 				 * @param string $message The existing "You don't have permission..." text
1091 1091
 				 */
1092
-				$message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
1092
+				$message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
1093 1093
 
1094
-			} elseif( null === get_post( $this->entry['post_id'] ) ) {
1094
+			} elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
1095 1095
 				/**
1096 1096
 				 * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
1097 1097
 				 * @param string $message The existing "This field is not editable; the post no longer exists." text
1098 1098
 				 */
1099
-				$message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
1099
+				$message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
1100 1100
 			}
1101 1101
 
1102
-			if( $message ) {
1103
-				$field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1102
+			if ( $message ) {
1103
+				$field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
1104 1104
 			}
1105 1105
 		}
1106 1106
 
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		// If the form has been submitted, then we don't need to pre-fill the values,
1127 1127
 		// Except for fileupload type and when a field input is overridden- run always!!
1128
-		if(
1129
-			( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1128
+		if (
1129
+			( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
1130 1130
 			&& false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
1131 1131
 			&& ! GFCommon::is_product_field( $field->type )
1132 1132
 			|| ! empty( $field_content )
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		$return = null;
1147 1147
 
1148 1148
 		/** @var GravityView_Field $gv_field */
1149
-		if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1149
+		if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
1150 1150
 			$return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
1151 1151
 		} else {
1152 1152
 			$return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 		// If there was output, it's an error
1156 1156
 		$warnings = ob_get_clean();
1157 1157
 
1158
-		if( !empty( $warnings ) ) {
1158
+		if ( ! empty( $warnings ) ) {
1159 1159
 			do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
1160 1160
 		}
1161 1161
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 		$override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
1181 1181
 
1182 1182
 		// We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
1183
-		if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
1183
+		if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
1184 1184
 
1185 1185
 			$field_value = array();
1186 1186
 
@@ -1189,10 +1189,10 @@  discard block
 block discarded – undo
1189 1189
 
1190 1190
 			foreach ( (array)$field->inputs as $input ) {
1191 1191
 
1192
-				$input_id = strval( $input['id'] );
1192
+				$input_id = strval( $input[ 'id' ] );
1193 1193
 				
1194 1194
 				if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
1195
-					$field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1195
+					$field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
1196 1196
 					$allow_pre_populated = false;
1197 1197
 				}
1198 1198
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
 			$pre_value = $field->get_value_submission( array(), false );
1202 1202
 
1203
-			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1203
+			$field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
1204 1204
 
1205 1205
 		} else {
1206 1206
 
@@ -1211,13 +1211,13 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 			// saved field entry value (if empty, fallback to the pre-populated value, if exists)
1213 1213
 			// or pre-populated value if not empty and set to override saved value
1214
-			$field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1214
+			$field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
1215 1215
 
1216 1216
 			// in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
1217
-			if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
1217
+			if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
1218 1218
 				$categories = array();
1219 1219
 				foreach ( explode( ',', $field_value ) as $cat_string ) {
1220
-					$categories[] = GFCommon::format_post_category( $cat_string, true );
1220
+					$categories[ ] = GFCommon::format_post_category( $cat_string, true );
1221 1221
 				}
1222 1222
 				$field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
1223 1223
 			}
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 		 * @param GF_Field $field Gravity Forms field object
1246 1246
 		 * @param GravityView_Edit_Entry_Render $this Current object
1247 1247
 		 */
1248
-		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this );
1248
+		$field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this );
1249 1249
 
1250 1250
 		return $field_value;
1251 1251
 	}
@@ -1262,12 +1262,12 @@  discard block
 block discarded – undo
1262 1262
 	 */
1263 1263
 	public function gform_pre_validation( $form ) {
1264 1264
 
1265
-		if( ! $this->verify_nonce() ) {
1265
+		if ( ! $this->verify_nonce() ) {
1266 1266
 			return $form;
1267 1267
 		}
1268 1268
 
1269 1269
 		// Fix PHP warning regarding undefined index.
1270
-		foreach ( $form['fields'] as &$field) {
1270
+		foreach ( $form[ 'fields' ] as &$field ) {
1271 1271
 
1272 1272
 			// This is because we're doing admin form pretending to be front-end, so Gravity Forms
1273 1273
 			// expects certain field array items to be set.
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 				$field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL;
1276 1276
 			}
1277 1277
 
1278
-			switch( RGFormsModel::get_input_type( $field ) ) {
1278
+			switch ( RGFormsModel::get_input_type( $field ) ) {
1279 1279
 
1280 1280
 				/**
1281 1281
 				 * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend.
@@ -1289,37 +1289,37 @@  discard block
 block discarded – undo
1289 1289
 					// Set the previous value
1290 1290
 					$entry = $this->get_entry();
1291 1291
 
1292
-					$input_name = 'input_'.$field->id;
1293
-					$form_id = $form['id'];
1292
+					$input_name = 'input_' . $field->id;
1293
+					$form_id = $form[ 'id' ];
1294 1294
 
1295 1295
 					$value = NULL;
1296 1296
 
1297 1297
 					// Use the previous entry value as the default.
1298
-					if( isset( $entry[ $field->id ] ) ) {
1298
+					if ( isset( $entry[ $field->id ] ) ) {
1299 1299
 						$value = $entry[ $field->id ];
1300 1300
 					}
1301 1301
 
1302 1302
 					// If this is a single upload file
1303
-					if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1304
-						$file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1305
-						$value = $file_path['url'];
1303
+					if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1304
+						$file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1305
+						$value = $file_path[ 'url' ];
1306 1306
 
1307 1307
 					} else {
1308 1308
 
1309 1309
 						// Fix PHP warning on line 1498 of form_display.php for post_image fields
1310 1310
 						// Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1311
-						$_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1311
+						$_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1312 1312
 
1313 1313
 					}
1314 1314
 
1315
-					if( rgar($field, "multipleFiles") ) {
1315
+					if ( rgar( $field, "multipleFiles" ) ) {
1316 1316
 
1317 1317
 						// If there are fresh uploads, process and merge them.
1318 1318
 						// Otherwise, use the passed values, which should be json-encoded array of URLs
1319
-						if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1319
+						if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1320 1320
 							$value = empty( $value ) ? '[]' : $value;
1321 1321
 							$value = stripslashes_deep( $value );
1322
-							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1322
+							$value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1323 1323
 						}
1324 1324
 
1325 1325
 					} else {
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 
1338 1338
 				case 'number':
1339 1339
 					// Fix "undefined index" issue at line 1286 in form_display.php
1340
-					if( !isset( $_POST['input_'.$field->id ] ) ) {
1341
-						$_POST['input_'.$field->id ] = NULL;
1340
+					if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1341
+						$_POST[ 'input_' . $field->id ] = NULL;
1342 1342
 					}
1343 1343
 					break;
1344 1344
 			}
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 		 * You can enter whatever you want!
1381 1381
 		 * We try validating, and customize the results using `self::custom_validation()`
1382 1382
 		 */
1383
-		add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1383
+		add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1384 1384
 
1385 1385
 		// Needed by the validate funtion
1386 1386
 		$failed_validation_page = NULL;
@@ -1388,14 +1388,14 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
 		// Prevent entry limit from running when editing an entry, also
1390 1390
 		// prevent form scheduling from preventing editing
1391
-		unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1391
+		unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1392 1392
 
1393 1393
 		// Hide fields depending on Edit Entry settings
1394
-		$this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1394
+		$this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1395 1395
 
1396 1396
 		$this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1397 1397
 
1398
-		remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1398
+		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1399 1399
 		remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'user_registration_validation' ), 10 );
1400 1400
 	}
1401 1401
 
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		$user_registration = GF_User_Registration::get_instance();
1413 1413
 
1414 1414
 		$entry = $this->get_entry();
1415
-		$form = $validation_results['form'];
1415
+		$form = $validation_results[ 'form' ];
1416 1416
 
1417 1417
 		if ( ! $feed = $user_registration->get_single_submission_feed( $entry, $form ) ) {
1418 1418
 			return $validation_results;
@@ -1428,18 +1428,18 @@  discard block
 block discarded – undo
1428 1428
 		if ( $user_email != $value && email_exists( $value ) ) {
1429 1429
 			$email_field->failed_validation = 1;
1430 1430
 			$email_field->validation_message = __( 'This email is already in use', 'gravityview' );
1431
-			$validation_results['is_valid'] = false;
1431
+			$validation_results[ 'is_valid' ] = false;
1432 1432
 		}
1433 1433
 
1434 1434
 		$value = RGFormsModel::get_field_value( $username_field );
1435 1435
 		if ( $username != $value ) {
1436 1436
 			$username_field->failed_validation = 1;
1437 1437
 			$username_field->validation_message = __( 'Usernames cannot be changed', 'gravityview' );
1438
-			$validation_results['is_valid'] = false;
1438
+			$validation_results[ 'is_valid' ] = false;
1439 1439
 		}
1440 1440
 
1441 1441
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1442
-		$this->form_after_validation = $validation_results['form'];
1442
+		$this->form_after_validation = $validation_results[ 'form' ];
1443 1443
 
1444 1444
 		return $validation_results;
1445 1445
 	}
@@ -1457,13 +1457,13 @@  discard block
 block discarded – undo
1457 1457
 	 */
1458 1458
 	public function custom_validation( $validation_results ) {
1459 1459
 
1460
-		do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1460
+		do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1461 1461
 
1462
-		do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1462
+		do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1463 1463
 
1464 1464
 		$gv_valid = true;
1465 1465
 
1466
-		foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1466
+		foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1467 1467
 
1468 1468
 			$value = RGFormsModel::get_field_value( $field );
1469 1469
 			$field_type = RGFormsModel::get_input_type( $field );
@@ -1476,35 +1476,35 @@  discard block
 block discarded – undo
1476 1476
 				case 'post_image':
1477 1477
 
1478 1478
 					// in case nothing is uploaded but there are already files saved
1479
-					if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1479
+					if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1480 1480
 						$field->failed_validation = false;
1481 1481
 						unset( $field->validation_message );
1482 1482
 					}
1483 1483
 
1484 1484
 					// validate if multi file upload reached max number of files [maxFiles] => 2
1485
-					if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1485
+					if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1486 1486
 
1487 1487
 						$input_name = 'input_' . $field->id;
1488 1488
 						//uploaded
1489
-						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1489
+						$file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1490 1490
 
1491 1491
 						//existent
1492 1492
 						$entry = $this->get_entry();
1493 1493
 						$value = NULL;
1494
-						if( isset( $entry[ $field->id ] ) ) {
1494
+						if ( isset( $entry[ $field->id ] ) ) {
1495 1495
 							$value = json_decode( $entry[ $field->id ], true );
1496 1496
 						}
1497 1497
 
1498 1498
 						// count uploaded files and existent entry files
1499 1499
 						$count_files = count( $file_names ) + count( $value );
1500 1500
 
1501
-						if( $count_files > $field->maxFiles ) {
1501
+						if ( $count_files > $field->maxFiles ) {
1502 1502
 							$field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1503 1503
 							$field->failed_validation = 1;
1504 1504
 							$gv_valid = false;
1505 1505
 
1506 1506
 							// in case of error make sure the newest upload files are removed from the upload input
1507
-							GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1507
+							GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1508 1508
 						}
1509 1509
 
1510 1510
 					}
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 			}
1516 1516
 
1517 1517
 			// This field has failed validation.
1518
-			if( !empty( $field->failed_validation ) ) {
1518
+			if ( ! empty( $field->failed_validation ) ) {
1519 1519
 
1520 1520
 				do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1521 1521
 
@@ -1533,32 +1533,32 @@  discard block
 block discarded – undo
1533 1533
 				}
1534 1534
 
1535 1535
 				// You can't continue inside a switch, so we do it after.
1536
-				if( empty( $field->failed_validation ) ) {
1536
+				if ( empty( $field->failed_validation ) ) {
1537 1537
 					continue;
1538 1538
 				}
1539 1539
 
1540 1540
 				// checks if the No Duplicates option is not validating entry against itself, since
1541 1541
 				// we're editing a stored entry, it would also assume it's a duplicate.
1542
-				if( !empty( $field->noDuplicates ) ) {
1542
+				if ( ! empty( $field->noDuplicates ) ) {
1543 1543
 
1544 1544
 					$entry = $this->get_entry();
1545 1545
 
1546 1546
 					// If the value of the entry is the same as the stored value
1547 1547
 					// Then we can assume it's not a duplicate, it's the same.
1548
-					if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1548
+					if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1549 1549
 						//if value submitted was not changed, then don't validate
1550 1550
 						$field->failed_validation = false;
1551 1551
 
1552 1552
 						unset( $field->validation_message );
1553 1553
 
1554
-						do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1554
+						do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1555 1555
 
1556 1556
 						continue;
1557 1557
 					}
1558 1558
 				}
1559 1559
 
1560 1560
 				// if here then probably we are facing the validation 'At least one field must be filled out'
1561
-				if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1561
+				if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1562 1562
 					unset( $field->validation_message );
1563 1563
 					$field->validation_message = false;
1564 1564
 					continue;
@@ -1570,12 +1570,12 @@  discard block
 block discarded – undo
1570 1570
 
1571 1571
 		}
1572 1572
 
1573
-		$validation_results['is_valid'] = $gv_valid;
1573
+		$validation_results[ 'is_valid' ] = $gv_valid;
1574 1574
 
1575
-		do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1575
+		do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1576 1576
 
1577 1577
 		// We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1578
-		$this->form_after_validation = $validation_results['form'];
1578
+		$this->form_after_validation = $validation_results[ 'form' ];
1579 1579
 
1580 1580
 		return $validation_results;
1581 1581
 	}
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 	 */
1589 1589
 	public function get_entry() {
1590 1590
 
1591
-		if( empty( $this->entry ) ) {
1591
+		if ( empty( $this->entry ) ) {
1592 1592
 			// Get the database value of the entry that's being edited
1593 1593
 			$this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1594 1594
 		}
@@ -1623,10 +1623,10 @@  discard block
 block discarded – undo
1623 1623
 		}
1624 1624
 
1625 1625
 		// If edit tab not yet configured, show all fields
1626
-		$edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1626
+		$edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1627 1627
 
1628 1628
 		// Hide fields depending on admin settings
1629
-		$fields = $this->filter_fields( $form['fields'], $edit_fields );
1629
+		$fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1630 1630
 
1631 1631
 		// If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1632 1632
 		$fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 	 */
1659 1659
 	private function filter_fields( $fields, $configured_fields ) {
1660 1660
 
1661
-		if( empty( $fields ) || !is_array( $fields ) ) {
1661
+		if ( empty( $fields ) || ! is_array( $fields ) ) {
1662 1662
 			return $fields;
1663 1663
 		}
1664 1664
 
@@ -1671,18 +1671,18 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 			// Remove the fields that have calculation properties and keep them to be used later
1673 1673
 			// @since 1.16.2
1674
-			if( $field->has_calculation() ) {
1675
-				$this->fields_with_calculation[] = $field;
1674
+			if ( $field->has_calculation() ) {
1675
+				$this->fields_with_calculation[ ] = $field;
1676 1676
 				// don't remove the calculation fields on form render.
1677 1677
 			}
1678 1678
 
1679
-			if( in_array( $field->type, $field_type_blacklist ) ) {
1679
+			if ( in_array( $field->type, $field_type_blacklist ) ) {
1680 1680
 				unset( $fields[ $key ] );
1681 1681
 			}
1682 1682
 		}
1683 1683
 
1684 1684
 		// The Edit tab has not been configured, so we return all fields by default.
1685
-		if( empty( $configured_fields ) ) {
1685
+		if ( empty( $configured_fields ) ) {
1686 1686
 			return $fields;
1687 1687
 		}
1688 1688
 
@@ -1692,8 +1692,8 @@  discard block
 block discarded – undo
1692 1692
 			/** @var GF_Field $field */
1693 1693
 			foreach ( $fields as $field ) {
1694 1694
 
1695
-				if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1696
-					$edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1695
+				if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1696
+					$edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1697 1697
 					break;
1698 1698
 				}
1699 1699
 
@@ -1716,14 +1716,14 @@  discard block
 block discarded – undo
1716 1716
 
1717 1717
 		$return_field = $field;
1718 1718
 
1719
-		if( empty( $field_setting['show_label'] ) ) {
1719
+		if ( empty( $field_setting[ 'show_label' ] ) ) {
1720 1720
 			$return_field->label = '';
1721
-		} elseif ( !empty( $field_setting['custom_label'] ) ) {
1722
-			$return_field->label = $field_setting['custom_label'];
1721
+		} elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1722
+			$return_field->label = $field_setting[ 'custom_label' ];
1723 1723
 		}
1724 1724
 
1725
-		if( !empty( $field_setting['custom_class'] ) ) {
1726
-			$return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1725
+		if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1726
+			$return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1727 1727
 		}
1728 1728
 
1729 1729
 		/**
@@ -1761,16 +1761,16 @@  discard block
 block discarded – undo
1761 1761
 		 */
1762 1762
 		$use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1763 1763
 
1764
-		if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1765
-			foreach( $fields as $k => $field ) {
1766
-				if( $field->adminOnly ) {
1764
+		if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1765
+			foreach ( $fields as $k => $field ) {
1766
+				if ( $field->adminOnly ) {
1767 1767
 					unset( $fields[ $k ] );
1768 1768
 				}
1769 1769
 			}
1770 1770
 			return $fields;
1771 1771
 		}
1772 1772
 
1773
-		foreach( $fields as &$field ) {
1773
+		foreach ( $fields as &$field ) {
1774 1774
 			$field->adminOnly = false;
1775 1775
 		}
1776 1776
 
@@ -1794,22 +1794,22 @@  discard block
 block discarded – undo
1794 1794
 	 */
1795 1795
 	function prefill_conditional_logic( $form ) {
1796 1796
 
1797
-		if( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1797
+		if ( ! GFFormDisplay::has_conditional_logic( $form ) ) {
1798 1798
 			return $form;
1799 1799
 		}
1800 1800
 
1801 1801
 		// Have Conditional Logic pre-fill fields as if the data were default values
1802 1802
 		/** @var GF_Field $field */
1803
-		foreach ( $form['fields'] as &$field ) {
1803
+		foreach ( $form[ 'fields' ] as &$field ) {
1804 1804
 
1805
-			if( 'checkbox' === $field->type ) {
1805
+			if ( 'checkbox' === $field->type ) {
1806 1806
 				foreach ( $field->get_entry_inputs() as $key => $input ) {
1807
-					$input_id = $input['id'];
1807
+					$input_id = $input[ 'id' ];
1808 1808
 					$choice = $field->choices[ $key ];
1809 1809
 					$value = rgar( $this->entry, $input_id );
1810 1810
 					$match = RGFormsModel::choice_value_match( $field, $choice, $value );
1811
-					if( $match ) {
1812
-						$field->choices[ $key ]['isSelected'] = true;
1811
+					if ( $match ) {
1812
+						$field->choices[ $key ][ 'isSelected' ] = true;
1813 1813
 					}
1814 1814
 				}
1815 1815
 			} else {
@@ -1817,15 +1817,15 @@  discard block
 block discarded – undo
1817 1817
 				// We need to run through each field to set the default values
1818 1818
 				foreach ( $this->entry as $field_id => $field_value ) {
1819 1819
 
1820
-					if( floatval( $field_id ) === floatval( $field->id ) ) {
1820
+					if ( floatval( $field_id ) === floatval( $field->id ) ) {
1821 1821
 
1822
-						if( 'list' === $field->type ) {
1822
+						if ( 'list' === $field->type ) {
1823 1823
 							$list_rows = maybe_unserialize( $field_value );
1824 1824
 
1825 1825
 							$list_field_value = array();
1826
-							foreach ( (array) $list_rows as $row ) {
1827
-								foreach ( (array) $row as $column ) {
1828
-									$list_field_value[] = $column;
1826
+							foreach ( (array)$list_rows as $row ) {
1827
+								foreach ( (array)$row as $column ) {
1828
+									$list_field_value[ ] = $column;
1829 1829
 								}
1830 1830
 							}
1831 1831
 
@@ -1860,16 +1860,16 @@  discard block
 block discarded – undo
1860 1860
 		 */
1861 1861
 		$use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1862 1862
 
1863
-		if( $use_conditional_logic ) {
1863
+		if ( $use_conditional_logic ) {
1864 1864
 			return $form;
1865 1865
 		}
1866 1866
 
1867
-		foreach( $form['fields'] as &$field ) {
1867
+		foreach ( $form[ 'fields' ] as &$field ) {
1868 1868
 			/* @var GF_Field $field */
1869 1869
 			$field->conditionalLogic = null;
1870 1870
 		}
1871 1871
 
1872
-		unset( $form['button']['conditionalLogic'] );
1872
+		unset( $form[ 'button' ][ 'conditionalLogic' ] );
1873 1873
 
1874 1874
 		return $form;
1875 1875
 
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
 	 */
1887 1887
 	public function manage_conditional_logic( $has_conditional_logic, $form ) {
1888 1888
 
1889
-		if( ! $this->is_edit_entry() ) {
1889
+		if ( ! $this->is_edit_entry() ) {
1890 1890
 			return $has_conditional_logic;
1891 1891
 		}
1892 1892
 
@@ -1918,44 +1918,44 @@  discard block
 block discarded – undo
1918 1918
 		 *  2. There are two entries embedded using oEmbed
1919 1919
 		 *  3. One of the entries has just been saved
1920 1920
 		 */
1921
-		if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1921
+		if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1922 1922
 
1923 1923
 			$error = true;
1924 1924
 
1925 1925
 		}
1926 1926
 
1927
-		if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1927
+		if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1928 1928
 
1929 1929
 			$error = true;
1930 1930
 
1931
-		} elseif( ! $this->verify_nonce() ) {
1931
+		} elseif ( ! $this->verify_nonce() ) {
1932 1932
 
1933 1933
 			/**
1934 1934
 			 * If the Entry is embedded, there may be two entries on the same page.
1935 1935
 			 * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1936 1936
 			 */
1937
-			if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1937
+			if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1938 1938
 				$error = true;
1939 1939
 			} else {
1940
-				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1940
+				$error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1941 1941
 			}
1942 1942
 
1943 1943
 		}
1944 1944
 
1945
-		if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1946
-			$error = __( 'You do not have permission to edit this entry.', 'gravityview');
1945
+		if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1946
+			$error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1947 1947
 		}
1948 1948
 
1949
-		if( $this->entry['status'] === 'trash' ) {
1950
-			$error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1949
+		if ( $this->entry[ 'status' ] === 'trash' ) {
1950
+			$error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1951 1951
 		}
1952 1952
 
1953 1953
 		// No errors; everything's fine here!
1954
-		if( empty( $error ) ) {
1954
+		if ( empty( $error ) ) {
1955 1955
 			return true;
1956 1956
 		}
1957 1957
 
1958
-		if( $echo && $error !== true ) {
1958
+		if ( $echo && $error !== true ) {
1959 1959
 
1960 1960
 			$error = esc_html( $error );
1961 1961
 
@@ -1963,13 +1963,13 @@  discard block
 block discarded – undo
1963 1963
 			 * @since 1.9
1964 1964
 			 */
1965 1965
 			if ( ! empty( $this->entry ) ) {
1966
-				$error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1966
+				$error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) );
1967 1967
 			}
1968 1968
 
1969
-			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1969
+			echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1970 1970
 		}
1971 1971
 
1972
-		do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1972
+		do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1973 1973
 
1974 1974
 		return false;
1975 1975
 	}
@@ -1986,20 +1986,20 @@  discard block
 block discarded – undo
1986 1986
 
1987 1987
 		$error = NULL;
1988 1988
 
1989
-		if( ! $this->check_user_cap_edit_field( $field ) ) {
1990
-			$error = __( 'You do not have permission to edit this field.', 'gravityview');
1989
+		if ( ! $this->check_user_cap_edit_field( $field ) ) {
1990
+			$error = __( 'You do not have permission to edit this field.', 'gravityview' );
1991 1991
 		}
1992 1992
 
1993 1993
 		// No errors; everything's fine here!
1994
-		if( empty( $error ) ) {
1994
+		if ( empty( $error ) ) {
1995 1995
 			return true;
1996 1996
 		}
1997 1997
 
1998
-		if( $echo ) {
1999
-			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1998
+		if ( $echo ) {
1999
+			echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
2000 2000
 		}
2001 2001
 
2002
-		do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
2002
+		do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
2003 2003
 
2004 2004
 		return false;
2005 2005
 
@@ -2017,15 +2017,15 @@  discard block
 block discarded – undo
2017 2017
 	private function check_user_cap_edit_field( $field ) {
2018 2018
 
2019 2019
 		// If they can edit any entries (as defined in Gravity Forms), we're good.
2020
-		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2020
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
2021 2021
 			return true;
2022 2022
 		}
2023 2023
 
2024
-		$field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
2024
+		$field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
2025 2025
 
2026 2026
 		// If the field has custom editing capaibilities set, check those
2027
-		if( $field_cap ) {
2028
-			return GVCommon::has_cap( $field['allow_edit_cap'] );
2027
+		if ( $field_cap ) {
2028
+			return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
2029 2029
 		}
2030 2030
 
2031 2031
 		return false;
@@ -2039,17 +2039,17 @@  discard block
 block discarded – undo
2039 2039
 	public function verify_nonce() {
2040 2040
 
2041 2041
 		// Verify form submitted for editing single
2042
-		if( $this->is_edit_entry_submission() ) {
2042
+		if ( $this->is_edit_entry_submission() ) {
2043 2043
 			$valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
2044 2044
 		}
2045 2045
 
2046 2046
 		// Verify
2047
-		else if( ! $this->is_edit_entry() ) {
2047
+		else if ( ! $this->is_edit_entry() ) {
2048 2048
 			$valid = false;
2049 2049
 		}
2050 2050
 
2051 2051
 		else {
2052
-			$valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
2052
+			$valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
2053 2053
 		}
2054 2054
 
2055 2055
 		/**
Please login to merge, or discard this patch.
includes/class-gravityview-uninstall.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		$tables = array();
43 43
 
44 44
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
45
-			$tables []= GFFormsModel::get_entry_meta_table_name();
45
+			$tables [ ] = GFFormsModel::get_entry_meta_table_name();
46 46
 		}
47
-		$tables []= GFFormsModel::get_lead_meta_table_name();
47
+		$tables [ ] = GFFormsModel::get_lead_meta_table_name();
48 48
 
49 49
 		$suppress = $wpdb->suppress_errors();
50 50
 		foreach ( $tables as $meta_table ) {
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 		$tables = array();
71 71
 
72 72
 		if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
73
-			$tables []= GFFormsModel::get_entry_notes_table_name();
73
+			$tables [ ] = GFFormsModel::get_entry_notes_table_name();
74 74
 		}
75
-		$tables []= GFFormsModel::get_lead_notes_table_name();
75
+		$tables [ ] = GFFormsModel::get_lead_notes_table_name();
76 76
 
77
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
78
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
77
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
78
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
79 79
 
80 80
 		$suppress = $wpdb->suppress_errors();
81 81
 		foreach ( $tables as $notes_table ) {
Please login to merge, or discard this patch.
future/includes/class-gv-form-gravityforms.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$self = new self();
56 56
 		$self->form = $form;
57 57
 
58
-		$self->ID = $self->form['id'];
58
+		$self->ID = $self->form[ 'id' ];
59 59
 
60 60
 		return $self;
61 61
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 
99 99
 			/** The offset and limit */
100 100
 			if ( ! empty( $offset->limit ) ) {
101
-				$paging['page_size'] = $offset->limit;
101
+				$paging[ 'page_size' ] = $offset->limit;
102 102
 			}
103 103
 
104 104
 			if ( ! empty( $offset->offset ) ) {
105
-				$paging['offset'] = $offset->offset;
105
+				$paging[ 'offset' ] = $offset->offset;
106 106
 			}
107 107
 
108 108
 			foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return bool Whether the offset exists or not.
139 139
 	 */
140 140
 	public function offsetExists( $offset ) {
141
-		return isset( $this->form[$offset] );
141
+		return isset( $this->form[ $offset ] );
142 142
 	}
143 143
 
144 144
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return mixed The value of the requested form data.
154 154
 	 */
155 155
 	public function offsetGet( $offset ) {
156
-		return $this->form[$offset];
156
+		return $this->form[ $offset ];
157 157
 	}
158 158
 
159 159
 	/**
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/data-source.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' );
11 11
 
12 12
 //current value
13
-$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
13
+$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) );
14 14
 
15 15
 // check for available gravity forms
16
-$forms = gravityview_get_forms('any');
16
+$forms = gravityview_get_forms( 'any' );
17 17
 
18 18
 /**
19 19
  * @param int $current_form Form currently selected in the View (0 if none selected)
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
 		?>
33 33
 		<a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a>
34 34
 
35
-		<?php if( !empty( $forms ) ) { ?>
35
+		<?php if ( ! empty( $forms ) ) { ?>
36 36
 			<span>&nbsp;<?php esc_html_e( 'or use an existing form', 'gravityview' ); ?>&nbsp;</span>
37 37
 		<?php }
38 38
 	}
39 39
 
40 40
 	// If there are no forms to select, show no forms.
41
-	if( !empty( $forms ) ) { ?>
41
+	if ( ! empty( $forms ) ) { ?>
42 42
 		<select name="gravityview_form_id" id="gravityview_form_id">
43 43
 			<option value="" <?php selected( '', $current_form, true ); ?>>&mdash; <?php esc_html_e( 'list of forms', 'gravityview' ); ?> &mdash;</option>
44
-			<?php foreach( $forms as $form ) { ?>
45
-				<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
44
+			<?php foreach ( $forms as $form ) { ?>
45
+				<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
46 46
 			<?php } ?>
47 47
 		</select>
48 48
 	<?php } else { ?>
49 49
 		<select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select>
50 50
 	<?php } ?>
51 51
 
52
-	&nbsp;<a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
52
+	&nbsp;<a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a>
53 53
 </p>
54 54
 
55 55
 <?php // confirm dialog box ?>
Please login to merge, or discard this patch.
includes/class-oembed.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		add_action( 'init', array( $this, 'register_handler' ) );
36 36
 		add_action( 'init', array( $this, 'add_provider' ) );
37 37
 
38
-		if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) {
38
+		if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) {
39 39
 			add_action( 'template_redirect', array( $this, 'render_provider_request' ) );
40 40
 		}
41 41
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	static function getInstance() {
48 48
 
49
-		if( empty( self::$instance ) ) {
49
+		if ( empty( self::$instance ) ) {
50 50
 			self::$instance = new self;
51 51
 
52 52
 			self::$instance->initialize();
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 * @return void
91 91
 	 */
92 92
 	function render_provider_request() {
93
-		if ( ! empty( $_GET['url'] ) ) {
94
-			$url = $_GET['url'];
93
+		if ( ! empty( $_GET[ 'url' ] ) ) {
94
+			$url = $_GET[ 'url' ];
95 95
 		} else {
96 96
 			header( 'HTTP/1.0 404 Not Found' );
97 97
 			exit;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 		preg_match( $this->get_handler_regex(), $url, $matches );
101 101
 
102 102
 		// If not using permalinks, re-assign values for matching groups
103
-		if ( ! empty( $matches['entry_slug2'] ) ) {
104
-			$matches['is_cpt'] = $matches['is_cpt2'];
105
-			$matches['slug'] = $matches['slug2'];
106
-			$matches['entry_slug'] = $matches['entry_slug2'];
107
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
103
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
104
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
105
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
106
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
107
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
108 108
 		}
109 109
 
110 110
 		// No Entry was found
111
-		if ( empty( $matches['entry_slug'] ) ) {
112
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
111
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
112
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
113 113
 			header( 'HTTP/1.0 404 Not Found' );
114 114
 			exit;
115 115
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		// Catch either
163 163
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
164 164
 
165
-		return '#'.$match_regex.'#i';
165
+		return '#' . $match_regex . '#i';
166 166
 	}
167 167
 
168 168
 	/**
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$page_on_front = get_option( 'page_on_front' );
185 185
 
186
-		if( (int) $post_id === (int) $page_on_front || empty( $post_id ) ) {
186
+		if ( (int)$post_id === (int)$page_on_front || empty( $post_id ) ) {
187 187
 
188 188
 			$args = array(
189 189
 				'post_status' => 'publish',
190 190
 				'name' => $slug,
191
-				'post_type' => array('any', 'gravityview'),
191
+				'post_type' => array( 'any', 'gravityview' ),
192 192
 			);
193 193
 
194 194
 			$posts = get_posts( $args );
195 195
 
196
-			if( !empty( $posts ) ) {
197
-				$post_id = $posts[0]->ID;
196
+			if ( ! empty( $posts ) ) {
197
+				$post_id = $posts[ 0 ]->ID;
198 198
 			}
199 199
 		}
200 200
 
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
228 228
 
229 229
 		// If not using permalinks, re-assign values for matching groups
230
-		if( !empty( $matches['entry_slug2'] ) ) {
231
-			$matches['is_cpt'] = $matches['is_cpt2'];
232
-			$matches['slug'] = $matches['slug2'];
233
-			$matches['entry_slug'] = $matches['entry_slug2'];
234
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
230
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
231
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
232
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
233
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
234
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
235 235
 		}
236 236
 
237 237
 		// No Entry was found
238
-		if( empty( $matches['entry_slug'] ) ) {
238
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
239 239
 
240
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
240
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
241 241
 
242 242
 			return '';
243 243
 		}
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 		// Setup the data used
248 248
 		$this->set_vars( $matches, $attr, $url, $rawattr );
249 249
 
250
-		if( is_admin() && !$this->is_full_oembed_preview ) {
250
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
251 251
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
252 252
 		} else {
253 253
 
254
-			if( $this->is_full_oembed_preview ) {
254
+			if ( $this->is_full_oembed_preview ) {
255 255
 				$return .= $this->generate_preview_notice();
256 256
 			}
257 257
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	private function generate_preview_notice() {
271 271
 		$floaty = GravityView_Admin::get_floaty();
272 272
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
273
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
274
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
273
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
274
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
275 275
 	}
276 276
 
277 277
 	/**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
286 286
 
287
-		$this->entry_id = $matches['entry_slug'];
287
+		$this->entry_id = $matches[ 'entry_slug' ];
288 288
 
289
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
289
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
290 290
 
291 291
 		// The URL didn't have the View Custom Post Type structure.
292
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
292
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
293 293
 
294
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
294
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
295 295
 
296 296
 			if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && $post = get_post( $post_id ) ) {
297 297
 				$views = \GV\View_Collection::from_post( $post );
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 						}
305 305
 					}
306 306
 
307
-					$this->view_id = $views[0]->ID;
307
+					$this->view_id = $views[ 0 ]->ID;
308 308
 				}
309 309
 			} else {
310 310
 				/** Deprecated. */
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		}
319 319
 
320 320
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
321
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
321
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
322 322
 	}
323 323
 
324 324
 	/**
@@ -336,15 +336,15 @@  discard block
 block discarded – undo
336 336
 		// Floaty the astronaut
337 337
 		$image = GravityView_Admin::get_floaty();
338 338
 
339
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
339
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
340 340
 
341
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
341
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
342 342
 
343 343
 		return '
344 344
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
345
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
345
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
346 346
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
347
-				'.$embed_text.'
347
+				'.$embed_text . '
348 348
 			</p>
349 349
 			<br style="clear: both;">
350 350
 		</div>';
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
400 400
 
401 401
 		// If it's already been parsed, don't re-output it.
402
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
402
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
403 403
 			return $this->output[ $this->entry_id ];
404 404
 		}
405 405
 
406 406
 		$entry_output = $this->generate_entry_output();
407 407
 
408 408
 		// Wrap a container div around the output to allow for custom styling
409
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
409
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
410 410
 
411 411
 		/**
412 412
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		 *  @var string $url The original URL that was matched by the regex. \n
420 420
 		 *  @var array $rawattr The original unmodified attributes.
421 421
 		 */
422
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
422
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
423 423
 
424 424
 		unset( $entry_output );
425 425
 
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
 		$form = false;
128 128
 
129
-		if( $entry ) {
130
-			$form = GFAPI::get_form( $entry['form_id'] );
129
+		if ( $entry ) {
130
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
131 131
 		}
132 132
 
133 133
 		return $form;
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$has_transaction_data = rgar( $entry, $meta, false );
195 195
 
196
-			if( ! empty( $has_transaction_data ) ) {
196
+			if ( ! empty( $has_transaction_data ) ) {
197 197
 				break;
198 198
 			}
199 199
 		}
200 200
 
201
-		return (bool) $has_transaction_data;
201
+		return (bool)$has_transaction_data;
202 202
 	}
203 203
 
204 204
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
238 238
 
239
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
239
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
240 240
 
241 241
 		return $result;
242 242
 	}
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
255 255
 	 */
256
-	public static function get_forms(  $active = true, $trash = false ) {
256
+	public static function get_forms( $active = true, $trash = false ) {
257 257
 		$forms = array();
258 258
 		if ( class_exists( 'GFAPI' ) ) {
259
-			if( 'any' === $active ) {
259
+			if ( 'any' === $active ) {
260 260
 				$active_forms = GFAPI::get_forms( true, $trash );
261 261
 				$inactive_forms = GFAPI::get_forms( false, $trash );
262 262
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 		$has_post_fields = false;
288 288
 
289 289
 		if ( $form ) {
290
-			foreach ( $form['fields'] as $field ) {
291
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
292
-					$fields["{$field['id']}"] = array(
290
+			foreach ( $form[ 'fields' ] as $field ) {
291
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
292
+					$fields[ "{$field[ 'id' ]}" ] = array(
293 293
 						'label' => rgar( $field, 'label' ),
294 294
 						'parent' => null,
295 295
 						'type' => rgar( $field, 'type' ),
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					);
299 299
 				}
300 300
 
301
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
302
-					foreach ( $field['inputs'] as $input ) {
301
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
302
+					foreach ( $field[ 'inputs' ] as $input ) {
303 303
 
304
-						if( ! empty( $input['isHidden'] ) ) {
304
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
305 305
 							continue;
306 306
 						}
307 307
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
                          * @hack
310 310
                          * In case of email/email confirmation, the input for email has the same id as the parent field
311 311
                          */
312
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
312
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
313 313
                             continue;
314 314
                         }
315
-						$fields["{$input['id']}"] = array(
315
+						$fields[ "{$input[ 'id' ]}" ] = array(
316 316
 							'label' => rgar( $input, 'label' ),
317 317
 							'customLabel' => rgar( $input, 'customLabel' ),
318 318
 							'parent' => $field,
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				}
325 325
 
326 326
 
327
-				if( GFCommon::is_product_field( $field['type'] ) ){
327
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
328 328
 					$has_product_fields = true;
329 329
 				}
330 330
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		 * @since 1.7
339 339
 		 */
340 340
 		if ( $has_post_fields ) {
341
-			$fields['post_id'] = array(
341
+			$fields[ 'post_id' ] = array(
342 342
 				'label' => __( 'Post ID', 'gravityview' ),
343 343
 				'type' => 'post_id',
344 344
 			);
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 			foreach ( $payment_fields as $payment_field ) {
352 352
 
353 353
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
354
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
354
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
355 355
 					continue;
356 356
 				}
357 357
 
358
-				$fields["{$payment_field->name}"] = array(
358
+				$fields[ "{$payment_field->name}" ] = array(
359 359
 					'label' => $payment_field->label,
360 360
 					'desc' => $payment_field->description,
361 361
 					'type' => $payment_field->name,
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$fields = array();
389 389
 
390
-		foreach ( $extra_fields as $key => $field ){
391
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
392
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
390
+		foreach ( $extra_fields as $key => $field ) {
391
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
392
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
393 393
 			}
394 394
 		}
395 395
 
@@ -429,32 +429,32 @@  discard block
 block discarded – undo
429 429
 			'search_criteria' => null,
430 430
 			'sorting' => null,
431 431
 			'paging' => null,
432
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
432
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
433 433
 		);
434 434
 
435 435
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
436 436
 
437
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
438
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
437
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
438
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
439 439
 
440 440
 				if ( ! is_array( $filter ) ) {
441 441
 					continue;
442 442
 				}
443 443
 
444 444
 				// By default, we want searches to be wildcard for each field.
445
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
445
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
446 446
 
447 447
 				/**
448 448
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
449 449
 				 * @param string $operator Existing search operator
450 450
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
451 451
 				 */
452
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
452
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
453 453
 			}
454 454
 
455 455
 			// don't send just the [mode] without any field filter.
456
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
457
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
456
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
457
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
458 458
 			}
459 459
 
460 460
 		}
@@ -465,21 +465,21 @@  discard block
 block discarded – undo
465 465
 		 * Prepare date formats to be in Gravity Forms DB format;
466 466
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
467 467
 		 */
468
-		foreach ( array('start_date', 'end_date' ) as $key ) {
468
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
469 469
 
470
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
470
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
471 471
 
472 472
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
473
-				$date = date_create( $criteria['search_criteria'][ $key ] );
473
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
474 474
 
475 475
 				if ( $date ) {
476 476
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
477
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
477
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
478 478
 				} else {
479
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
479
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
480 480
 
481 481
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
482
-					unset( $criteria['search_criteria'][ $key ] );
482
+					unset( $criteria[ 'search_criteria' ][ $key ] );
483 483
 				}
484 484
 			}
485 485
 		}
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 
499 499
 		// Calculate the context view id and send it to the advanced filter
500 500
 		if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
501
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
501
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
502 502
 		} elseif ( $multiple_original ) {
503
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 		} elseif ( 'delete' === GFForms::get( 'action' ) ) {
505
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
506
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
505
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
506
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
507 507
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
508
-			$criteria['context_view_id'] = null;
508
+			$criteria[ 'context_view_id' ] = null;
509 509
 		}
510 510
 
511 511
 		/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		/** Reduce # of database calls */
545 545
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
546 546
 
547
-		if ( ! empty( $criteria['cache'] ) ) {
547
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
548 548
 
549 549
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
550 550
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 				// Still update the total count when using cached results
554 554
 				if ( ! is_null( $total ) ) {
555
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
555
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
556 556
 				}
557 557
 
558 558
 				$return = $entries;
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
574 574
 
575 575
 			// No entries returned from gravityview_before_get_entries
576
-			if( is_null( $entries ) ) {
576
+			if ( is_null( $entries ) ) {
577 577
 
578
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
578
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
579 579
 
580 580
 				if ( is_wp_error( $entries ) ) {
581 581
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 				}
587 587
 			}
588 588
 
589
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
589
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
590 590
 
591 591
 				// Cache results
592 592
 				$Cache->set( $entries, 'entries' );
@@ -691,12 +691,12 @@  discard block
 block discarded – undo
691 691
 			 */
692 692
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
693 693
 
694
-			if( $check_entry_display ) {
694
+			if ( $check_entry_display ) {
695 695
 				// Is the entry allowed
696 696
 				$entry = self::check_entry_display( $entry );
697 697
 			}
698 698
 
699
-			if( is_wp_error( $entry ) ) {
699
+			if ( is_wp_error( $entry ) ) {
700 700
 				do_action( 'gravityview_log_error', __METHOD__ . ': ' . $entry->get_error_message() );
701 701
 				return false;
702 702
 			}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public static function matches_operation( $val1, $val2, $operation ) {
729 729
 
730
-		$json_function = function_exists('wp_json_encode') ? 'wp_json_encode' : 'json_encode';
730
+		$json_function = function_exists( 'wp_json_encode' ) ? 'wp_json_encode' : 'json_encode';
731 731
 
732 732
 		// Only process strings
733 733
 		$val1 = ! is_string( $val1 ) ? $json_function( $val1 ) : $val1;
@@ -735,12 +735,12 @@  discard block
 block discarded – undo
735 735
 
736 736
 		$value = false;
737 737
 
738
-		if( 'context' === $val1 ) {
738
+		if ( 'context' === $val1 ) {
739 739
 
740 740
 			$matching_contexts = array( $val2 );
741 741
 
742 742
 			// We allow for non-standard contexts.
743
-			switch( $val2 ) {
743
+			switch ( $val2 ) {
744 744
 				// Check for either single or edit
745 745
 				case 'singular':
746 746
 					$matching_contexts = array( 'single', 'edit' );
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 				$json_val_1 = json_decode( $val1, true );
784 784
 				$json_val_2 = json_decode( $val2, true );
785 785
 
786
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
786
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
787 787
 
788 788
 					$json_in = false;
789 789
 					$json_val_1 = $json_val_1 ? $json_val_1 : array( $val1 );
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 						foreach ( $json_val_2 as $item_2 ) {
795 795
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
796 796
 
797
-							if( $json_in ) {
797
+							if ( $json_in ) {
798 798
 								break 2;
799 799
 							}
800 800
 						}
@@ -861,76 +861,76 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
871 871
 		$criteria = self::calculate_get_entries_criteria();
872 872
 
873
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
873
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
874 874
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
875 875
 			return $entry;
876 876
 		}
877 877
 
878 878
 		// Make sure the current View is connected to the same form as the Entry
879
-		if( ! empty( $criteria['context_view_id'] ) ) {
880
-			$context_view_id = intval( $criteria['context_view_id'] );
879
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
880
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
881 881
 			$context_form_id = gravityview_get_form_id( $context_view_id );
882
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
883
-				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
882
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
883
+				return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
884 884
 			}
885 885
 		}
886 886
 
887
-		$search_criteria = $criteria['search_criteria'];
887
+		$search_criteria = $criteria[ 'search_criteria' ];
888 888
 
889 889
 		// check entry status
890
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
891
-			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
890
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
891
+			return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
892 892
 		}
893 893
 
894 894
 		// check entry date
895 895
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
896 896
 
897 897
 		// field_filters
898
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
898
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
899 899
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
900 900
 			return $entry;
901 901
 		}
902 902
 
903
-		$filters = $search_criteria['field_filters'];
903
+		$filters = $search_criteria[ 'field_filters' ];
904 904
 
905
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
905
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
906 906
 
907 907
 		// Prevent the mode from being processed below
908
-		unset( $filters['mode'] );
908
+		unset( $filters[ 'mode' ] );
909 909
 
910
-		$form = self::get_form( $entry['form_id'] );
910
+		$form = self::get_form( $entry[ 'form_id' ] );
911 911
 
912 912
 		foreach ( $filters as $filter ) {
913 913
 
914
-			if ( ! isset( $filter['key'] ) ) {
914
+			if ( ! isset( $filter[ 'key' ] ) ) {
915 915
 				do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Filter key not set', $filter );
916 916
 				continue;
917 917
 			}
918 918
 
919
-			$k = $filter['key'];
919
+			$k = $filter[ 'key' ];
920 920
 
921 921
 			$field = self::get_field( $form, $k );
922 922
 
923 923
 			if ( is_null( $field ) ) {
924 924
 				$field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null;
925 925
 			} else {
926
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
926
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
927 927
 				 // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it
928 928
 				$field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? rgar( $field_value, $k ) : $field_value;
929 929
 			}
930 930
 
931
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
931
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
932 932
 
933
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
933
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
934 934
 
935 935
 			// Any match is all we need to know
936 936
 			if ( $is_value_match && 'any' === $mode ) {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 
940 940
 			// Any failed match is a total fail
941 941
 			if ( ! $is_value_match && 'all' === $mode ) {
942
-				return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
942
+				return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter );
943 943
 			}
944 944
 		}
945 945
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved: all conditions were met' );
950 950
 			return $entry;
951 951
 		} else {
952
-			return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
952
+			return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters );
953 953
 		}
954 954
 
955 955
 	}
@@ -990,18 +990,18 @@  discard block
 block discarded – undo
990 990
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
991 991
 		 * @see GFCommon::format_date() for original code
992 992
 		 */
993
-		$date_gmt_time   = mysql2date( 'G', $date_string );
993
+		$date_gmt_time = mysql2date( 'G', $date_string );
994 994
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
995 995
 
996
-		$format  = rgar( $atts, 'format' );
997
-		$is_human  = ! empty( $atts['human'] );
998
-		$is_diff  = ! empty( $atts['diff'] );
999
-		$is_raw = ! empty( $atts['raw'] );
1000
-		$is_timestamp = ! empty( $atts['timestamp'] );
1001
-		$include_time = ! empty( $atts['time'] );
996
+		$format = rgar( $atts, 'format' );
997
+		$is_human = ! empty( $atts[ 'human' ] );
998
+		$is_diff = ! empty( $atts[ 'diff' ] );
999
+		$is_raw = ! empty( $atts[ 'raw' ] );
1000
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1001
+		$include_time = ! empty( $atts[ 'time' ] );
1002 1002
 
1003 1003
 		// If we're using time diff, we want to have a different default format
1004
-		if( empty( $format ) ) {
1004
+		if ( empty( $format ) ) {
1005 1005
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1006 1006
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1007 1007
 		}
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 		// If raw was specified, don't modify the stored value
1010 1010
 		if ( $is_raw ) {
1011 1011
 			$formatted_date = $date_string;
1012
-		} elseif( $is_timestamp ) {
1012
+		} elseif ( $is_timestamp ) {
1013 1013
 			$formatted_date = $date_local_timestamp;
1014 1014
 		} elseif ( $is_diff ) {
1015 1015
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$label = rgar( $field, 'label' );
1045 1045
 
1046
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1046
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1047 1047
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1048 1048
 		}
1049 1049
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			$form = GFAPI::get_form( $form );
1072 1072
 		}
1073 1073
 
1074
-		if ( class_exists( 'GFFormsModel' ) ){
1074
+		if ( class_exists( 'GFFormsModel' ) ) {
1075 1075
 			return GFFormsModel::get_field( $form, $field_id );
1076 1076
 		} else {
1077 1077
 			return null;
@@ -1118,19 +1118,19 @@  discard block
 block discarded – undo
1118 1118
 			$shortcodes = array();
1119 1119
 
1120 1120
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1121
-			if ( empty( $matches ) ){
1121
+			if ( empty( $matches ) ) {
1122 1122
 				return false;
1123 1123
 			}
1124 1124
 
1125 1125
 			foreach ( $matches as $shortcode ) {
1126
-				if ( $tag === $shortcode[2] ) {
1126
+				if ( $tag === $shortcode[ 2 ] ) {
1127 1127
 
1128 1128
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1129
-					$shortcodes[] = $shortcode;
1129
+					$shortcodes[ ] = $shortcode;
1130 1130
 
1131
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1132
-					foreach( $results as $result ) {
1133
-						$shortcodes[] = $result;
1131
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1132
+					foreach ( $results as $result ) {
1133
+						$shortcodes[ ] = $result;
1134 1134
 					}
1135 1135
 				}
1136 1136
 			}
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1275 1275
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1276 1276
 
1277
-		if( $apply_filter ) {
1277
+		if ( $apply_filter ) {
1278 1278
 			/**
1279 1279
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1280 1280
 			 * @since 1.6.5
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	 * @return string         html
1298 1298
 	 */
1299 1299
 	public static function get_sortable_fields( $formid, $current = '' ) {
1300
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1300
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1301 1301
 
1302 1302
 		if ( empty( $formid ) ) {
1303 1303
 			return $output;
@@ -1310,11 +1310,11 @@  discard block
 block discarded – undo
1310 1310
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1311 1311
 
1312 1312
 			foreach ( $fields as $id => $field ) {
1313
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1313
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1314 1314
 					continue;
1315 1315
 				}
1316 1316
 
1317
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1317
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1318 1318
 			}
1319 1319
 		}
1320 1320
 
@@ -1349,9 +1349,9 @@  discard block
 block discarded – undo
1349 1349
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1350 1350
 
1351 1351
 		// TODO: Convert to using array_filter
1352
-		foreach( $fields as $id => $field ) {
1352
+		foreach ( $fields as $id => $field ) {
1353 1353
 
1354
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1354
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1355 1355
 				unset( $fields[ $id ] );
1356 1356
 			}
1357 1357
 		}
@@ -1392,14 +1392,14 @@  discard block
 block discarded – undo
1392 1392
 	 * @param  int|array  $field field key or field array
1393 1393
 	 * @return boolean
1394 1394
 	 */
1395
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1395
+	public static function is_field_numeric( $form = null, $field = '' ) {
1396 1396
 
1397 1397
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1398 1398
 			$form = self::get_form( $form );
1399 1399
 		}
1400 1400
 
1401 1401
 		// If entry meta, it's a string. Otherwise, numeric
1402
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1402
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1403 1403
 			$type = $field;
1404 1404
 		} else {
1405 1405
 			$type = self::get_field_type( $form, $field );
@@ -1413,9 +1413,9 @@  discard block
 block discarded – undo
1413 1413
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1414 1414
 
1415 1415
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1416
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1417
-			if( true === $gv_field->is_numeric ) {
1418
-				$numeric_types[] = $gv_field->is_numeric;
1416
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1417
+			if ( true === $gv_field->is_numeric ) {
1418
+				$numeric_types[ ] = $gv_field->is_numeric;
1419 1419
 			}
1420 1420
 		}
1421 1421
 
@@ -1565,18 +1565,18 @@  discard block
 block discarded – undo
1565 1565
 		$final_atts = array_filter( $final_atts );
1566 1566
 
1567 1567
 		// If the href wasn't passed as an attribute, use the value passed to the function
1568
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1569
-			$final_atts['href'] = $href;
1568
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1569
+			$final_atts[ 'href' ] = $href;
1570 1570
 		}
1571 1571
 
1572
-		$final_atts['href'] = esc_url_raw( $href );
1572
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1573 1573
 
1574 1574
 		/**
1575 1575
 		 * Fix potential security issue with target=_blank
1576 1576
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1577 1577
 		 */
1578
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1579
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1578
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1579
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1580 1580
 		}
1581 1581
 
1582 1582
 		// Sort the attributes alphabetically, to help testing
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1589 1589
 		}
1590 1590
 
1591
-		if( '' !== $output ) {
1591
+		if ( '' !== $output ) {
1592 1592
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1593 1593
 		}
1594 1594
 
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1616 1616
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1617 1617
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1618
-				$merged[] = $value;
1618
+				$merged[ ] = $value;
1619 1619
 			} else {
1620 1620
 				$merged[ $key ] = $value;
1621 1621
 			}
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1649 1649
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1650 1650
 		 */
1651
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1651
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1652 1652
 
1653 1653
 		return get_users( $get_users_settings );
1654 1654
 	}
@@ -1668,11 +1668,11 @@  discard block
 block discarded – undo
1668 1668
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1669 1669
 
1670 1670
     	// If $cap is defined, only show notice if user has capability
1671
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1671
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1672 1672
     		return '';
1673 1673
 	    }
1674 1674
 
1675
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1675
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1676 1676
     }
1677 1677
 
1678 1678
 	/**
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
121 121
 
122
-		if( $with_values ) {
122
+		if ( $with_values ) {
123 123
 			$operators_with_values = array();
124
-			foreach( $operators as $key ) {
124
+			foreach ( $operators as $key ) {
125 125
 				$operators_with_values[ $key ] = '';
126 126
 			}
127 127
 			return $operators_with_values;
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	private function set_operation( $operation = '' ) {
140 140
 
141
-		if( empty( $operation ) ) {
141
+		if ( empty( $operation ) ) {
142 142
 			return false;
143 143
 		}
144 144
 
145 145
 		$operators = $this->get_operators( false );
146 146
 
147
-		if( !in_array( $operation, $operators ) ) {
148
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
147
+		if ( ! in_array( $operation, $operators ) ) {
148
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
149 149
 			return false;
150 150
 		}
151 151
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	private function setup_operation_and_comparison() {
167 167
 
168
-		foreach( $this->atts as $key => $value ) {
168
+		foreach ( $this->atts as $key => $value ) {
169 169
 
170 170
 			$valid = $this->set_operation( $key );
171 171
 
172
-			if( $valid ) {
172
+			if ( $valid ) {
173 173
 				$this->comparison = $value;
174 174
 				return true;
175 175
 			}
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 			return null;
196 196
 		}
197 197
 
198
-		if( empty( $atts ) ) {
199
-			do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts );
198
+		if ( empty( $atts ) ) {
199
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts );
200 200
 			return null;
201 201
 		}
202 202
 
@@ -210,16 +210,16 @@  discard block
 block discarded – undo
210 210
 		$this->parse_atts();
211 211
 
212 212
 		// We need an "if"
213
-		if( false === $this->if ) {
214
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts );
213
+		if ( false === $this->if ) {
214
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts );
215 215
 			return null;
216 216
 		}
217 217
 
218 218
 		$setup = $this->setup_operation_and_comparison();
219 219
 
220 220
 		// We need an operation and comparison value
221
-		if( ! $setup ) {
222
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
221
+		if ( ! $setup ) {
222
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
223 223
 			return null;
224 224
 		}
225 225
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	private function get_output() {
254 254
 
255
-		if( $this->is_match ) {
255
+		if ( $this->is_match ) {
256 256
 			$output = $this->content;
257 257
 		} else {
258 258
 			$output = $this->else_content;
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 		 * @param string $output HTML/text output
267 267
 		 * @param GVLogic_Shortcode $this This class
268 268
 		 */
269
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
269
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
270 270
 
271
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
271
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
272 272
 
273 273
 		return $output;
274 274
 	}
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 		list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL );
287 287
 		list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL );
288 288
 
289
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
289
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
290 290
 		$else_content = isset( $after_else ) ? $after_else : $else_attr;
291 291
 
292 292
 		// The content is everything OTHER than the [else]
293 293
 		$this->content = $before_else_if;
294 294
 
295 295
 		if ( ! $this->is_match ) {
296
-			if( $elseif_content = $this->process_elseif( $before_else ) ) {
296
+			if ( $elseif_content = $this->process_elseif( $before_else ) ) {
297 297
 				$this->else_content = $elseif_content;
298 298
 			} else {
299 299
 				$this->else_content = $else_content;
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
 		foreach ( $else_if_matches as $key => $else_if_match ) {
322 322
 
323 323
 			// If $else_if_match[5] exists and has content, check for more shortcodes
324
-			preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER );
324
+			preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER );
325 325
 
326 326
 			// If the logic passes, this is the value that should be used for $this->else_content
327
-			$else_if_value = $else_if_match[5];
328
-			$check_elseif_match = $else_if_match[0];
327
+			$else_if_value = $else_if_match[ 5 ];
328
+			$check_elseif_match = $else_if_match[ 0 ];
329 329
 
330 330
 			// Retrieve the value of the match that is currently being checked, without any other [else] tags
331
-			if( ! empty( $recursive_matches[0][0] ) ) {
332
-				$else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value );
333
-				$check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match );
331
+			if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) {
332
+				$else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value );
333
+				$check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match );
334 334
 			}
335 335
 
336 336
 			$check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match );
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			}
348 348
 
349 349
 			// Process any remaining [else] tags
350
-			return $this->process_elseif( $else_if_match[5] );
350
+			return $this->process_elseif( $else_if_match[ 5 ] );
351 351
 		}
352 352
 
353 353
 		return false;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
374 374
 
375 375
 		// Strip whitespace if it's not default false
376
-		$this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false;
376
+		$this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false;
377 377
 
378 378
 		/**
379 379
 		 * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		do_action( 'gravityview/gvlogic/parse_atts/after', $this );
385 385
 
386 386
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
387
-		unset( $this->atts['if'] );
387
+		unset( $this->atts[ 'if' ] );
388 388
 	}
389 389
 }
390 390
 
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 
170 170
 		if( 'gv_note_add' === $_POST['action'] ) {
171 171
 
172
-            if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
173
-                do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
174
-                return;
175
-            }
172
+			if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
173
+				do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
174
+				return;
175
+			}
176 176
 
177 177
 			$post = wp_unslash( $_POST );
178 178
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes
274 274
 	 *
275
-  	 * @since 1.17
275
+	 * @since 1.17
276 276
 	 *
277 277
 	 * @see process_delete_notes
278 278
 	 *
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 			'subject-label' => __( 'Subject', 'gravityview' ),
426 426
 			'subject' => __( 'Email subject', 'gravityview' ),
427 427
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
428
-            'email-footer' => __( 'This note was sent from {url}', 'gravityview' ),
428
+			'email-footer' => __( 'This note was sent from {url}', 'gravityview' ),
429 429
 			'also-email' => __( 'Also email this note to', 'gravityview' ),
430 430
 			'error-add-note' => __( 'There was an error adding the note.', 'gravityview' ),
431 431
 			'error-invalid' => __( 'The request was invalid. Refresh the page and try again.', 'gravityview' ),
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 				'gv-note-to-custom' => '',
718 718
 				'gv-note-subject' => '',
719 719
 				'gv-note-content' => '',
720
-                'current-url' => '',
720
+				'current-url' => '',
721 721
 			);
722 722
 
723 723
 			$current_user  = wp_get_current_user();
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
 			$message .= $this->get_email_footer( $email_footer, $is_html, $email_data );
770 770
 
771 771
 			/**
772
-             * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format
772
+			 * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format
773 773
 			 * @since 1.18
774
-             * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true)
774
+			 * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true)
775 775
 			 */
776 776
 			$wpautop_email = apply_filters( 'gravityview/field/notes/wpautop_email', true );
777 777
 
@@ -791,12 +791,12 @@  discard block
 block discarded – undo
791 791
 	}
792 792
 
793 793
 	/**
794
-     * Get the footer for Entry Note emails
795
-     *
796
-     * `{url}` is replaced by the URL of the page where the note form was embedded
797
-     *
798
-     * @since 1.18
799
-     * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer'
794
+	 * Get the footer for Entry Note emails
795
+	 *
796
+	 * `{url}` is replaced by the URL of the page where the note form was embedded
797
+	 *
798
+	 * @since 1.18
799
+	 * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer'
800 800
 	 *
801 801
 	 * @param string $email_footer The message footer value
802 802
 	 * @param bool $is_html True: Email is being sent as HTML; False: sent as text
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 	 */
806 806
 	private function get_email_footer( $email_footer = '', $is_html = true, $email_data = array() ) {
807 807
 
808
-	    $output = '';
808
+		$output = '';
809 809
 
810 810
 		if( ! empty( $email_footer ) ) {
811
-		    $url = rgar( $email_data, 'current-url' );
811
+			$url = rgar( $email_data, 'current-url' );
812 812
 			$url = html_entity_decode( $url );
813 813
 			$url = site_url( $url );
814 814
 
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -63,18 +63,18 @@  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
 
77
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
77
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
78 78
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
79 79
 		
80 80
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 );
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function add_entry_default_field( $entry_default_fields, $form, $zone ) {
98 98
 
99
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
-			$entry_default_fields['notes'] = array(
99
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
+			$entry_default_fields[ 'notes' ] = array(
101 101
 				'label' => __( 'Entry Notes', 'gravityview' ),
102 102
 				'type'  => 'notes',
103 103
 				'desc'  => __( 'Display, add, and delete notes for an entry.', 'gravityview' ),
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	public function enqueue_scripts() {
131 131
 		global $wp_actions;
132 132
 
133
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
133
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
134 134
 			wp_enqueue_style( 'gravityview-notes' );
135 135
 			wp_enqueue_script( 'gravityview-notes' );
136 136
 		}
137 137
 
138
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
138
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
139 139
 
140 140
 			$strings = self::strings();
141 141
 
142 142
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
143 143
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
144 144
 				'text' => array(
145
-					'processing' => $strings['processing'],
146
-					'delete_confirm' => $strings['delete-confirm'],
147
-					'note_added' => $strings['added-note'],
148
-					'error_invalid' => $strings['error-invalid'],
149
-					'error_empty_note' => $strings['error-empty-note'],
145
+					'processing' => $strings[ 'processing' ],
146
+					'delete_confirm' => $strings[ 'delete-confirm' ],
147
+					'note_added' => $strings[ 'added-note' ],
148
+					'error_invalid' => $strings[ 'error-invalid' ],
149
+					'error_empty_note' => $strings[ 'error-empty-note' ],
150 150
 				),
151 151
 			) );
152 152
 		}
@@ -163,26 +163,26 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	function maybe_add_note() {
165 165
 
166
-		if( ! isset( $_POST['action'] ) ) {
166
+		if ( ! isset( $_POST[ 'action' ] ) ) {
167 167
 			return;
168 168
 		}
169 169
 
170
-		if( 'gv_note_add' === $_POST['action'] ) {
170
+		if ( 'gv_note_add' === $_POST[ 'action' ] ) {
171 171
 
172
-            if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
172
+            if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
173 173
                 do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
174 174
                 return;
175 175
             }
176 176
 
177 177
 			$post = wp_unslash( $_POST );
178 178
 
179
-			if( $this->doing_ajax ) {
180
-				parse_str( $post['data'], $data );
179
+			if ( $this->doing_ajax ) {
180
+				parse_str( $post[ 'data' ], $data );
181 181
 			} else {
182 182
 				$data = $post;
183 183
 			}
184 184
 
185
-			$this->process_add_note( (array) $data );
185
+			$this->process_add_note( (array)$data );
186 186
 		}
187 187
 	}
188 188
 
@@ -209,23 +209,23 @@  discard block
 block discarded – undo
209 209
 		$error = false;
210 210
 		$success = false;
211 211
 
212
-		if( empty( $data['entry-slug'] ) ) {
212
+		if ( empty( $data[ 'entry-slug' ] ) ) {
213 213
 
214
-			$error = self::strings('error-invalid');
214
+			$error = self::strings( 'error-invalid' );
215 215
 			do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' );
216 216
 
217 217
 		} else {
218 218
 
219
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
219
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
220 220
 			
221 221
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
222 222
 
223
-			if( ! $has_cap ) {
223
+			if ( ! $has_cap ) {
224 224
 				$error = self::strings( 'error-cap-add' );
225 225
 				do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
226 226
 			} elseif ( $valid ) {
227 227
 
228
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
228
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
229 229
 
230 230
 				$added = $this->add_note( $entry, $data );
231 231
 
@@ -243,22 +243,22 @@  discard block
 block discarded – undo
243 243
 					$this->maybe_send_entry_notes( $note, $entry, $data );
244 244
 
245 245
 					if ( $note ) {
246
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
247
-						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') );
246
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
247
+						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) );
248 248
 					} else {
249
-						$error = self::strings('error-add-note');
250
-						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') );
249
+						$error = self::strings( 'error-add-note' );
250
+						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) );
251 251
 					}
252 252
 				}
253 253
 			} else {
254
-				$error = self::strings('error-invalid');
254
+				$error = self::strings( 'error-invalid' );
255 255
 				do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' );
256 256
 			}
257 257
 		}
258 258
 
259 259
 
260
-		if( $this->doing_ajax ) {
261
-			if( $success ) {
260
+		if ( $this->doing_ajax ) {
261
+			if ( $success ) {
262 262
 				wp_send_json_success( array( 'html' => $success ) );
263 263
 			} else {
264 264
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 			return;
285 285
 		}
286 286
 
287
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
287
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
288 288
 
289 289
 			$post = wp_unslash( $_POST );
290 290
 			if ( $this->doing_ajax ) {
291
-				parse_str( $post['data'], $data );
291
+				parse_str( $post[ 'data' ], $data );
292 292
 			} else {
293 293
 				$data = $post;
294 294
 			}
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	function process_delete_notes( $data ) {
321 321
 
322
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
322
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
323 323
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
324 324
 		$success = false;
325 325
 
326 326
 		if ( $valid && $has_cap ) {
327
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
327
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
328 328
 			$success = true;
329 329
 		}
330 330
 
331
-		if( $this->doing_ajax ) {
331
+		if ( $this->doing_ajax ) {
332 332
 
333
-			if( $success ) {
333
+			if ( $success ) {
334 334
 				wp_send_json_success();
335 335
 			} else {
336 336
 				if ( ! $valid ) {
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 
364 364
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
365 365
 
366
-		unset( $field_options['show_as_link'] );
366
+		unset( $field_options[ 'show_as_link' ] );
367 367
 
368 368
 		$notes_options = array(
369 369
 			'notes' => array(
370 370
 				'type' => 'checkboxes',
371
-				'label' => __('Note Settings', 'gravityview'),
372
-				'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>' ),
371
+				'label' => __( 'Note Settings', 'gravityview' ),
372
+				'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>' ),
373 373
 				'options' => array(
374 374
 					'view' => array(
375 375
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
422 422
 			'other-email' => __( 'Other email address', 'gravityview' ),
423 423
 			'email-label' => __( 'Email address', 'gravityview' ),
424
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
424
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
425 425
 			'subject-label' => __( 'Subject', 'gravityview' ),
426 426
 			'subject' => __( 'Email subject', 'gravityview' ),
427 427
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 		 */
442 442
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
443 443
 
444
-		if( $key ) {
444
+		if ( $key ) {
445 445
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
446 446
 		}
447 447
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	static public function display_note( $note, $show_delete = false ) {
462 462
 
463
-		if( ! is_object( $note ) ) {
463
+		if ( ! is_object( $note ) ) {
464 464
 			return '';
465 465
 		}
466 466
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		$note_row = ob_get_clean();
502 502
 
503 503
 		$replacements = array(
504
-			'{note_id}' => $note_content['note_id'],
504
+			'{note_id}' => $note_content[ 'note_id' ],
505 505
 			'{row_class}' => 'gv-note',
506 506
 			'{note_detail}' => $note_detail_html
507 507
 		);
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 
534 534
 		$user_data = get_userdata( $current_user->ID );
535 535
 
536
-		$note_content = trim( $data['gv-note-content'] );
536
+		$note_content = trim( $data[ 'gv-note-content' ] );
537 537
 
538
-		if( empty( $note_content ) ) {
538
+		if ( empty( $note_content ) ) {
539 539
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
540 540
 		}
541 541
 
542
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
542
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
543 543
 
544 544
 		return $return;
545 545
 	}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	 */
556 556
 	public static function get_add_note_part() {
557 557
 
558
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
558
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
559 559
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
560 560
 			return '';
561 561
 		}
@@ -571,19 +571,19 @@  discard block
 block discarded – undo
571 571
 
572 572
 		$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
573 573
 		$entry = $gravityview_view->getCurrentEntry();
574
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
574
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
575 575
 		$nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false );
576 576
 
577 577
 		// Only generate the dropdown if the field settings allow it
578 578
 		$email_fields = '';
579
-		if( ! empty( $visibility_settings['email'] ) ) {
579
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
580 580
 			$email_fields = self::get_note_email_fields( $entry_slug );
581 581
 		}
582 582
 
583 583
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
584 584
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
585
-		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html );
586
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
585
+		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html );
586
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
587 587
 		$add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html );
588 588
 
589 589
 		return $add_note_html;
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 		$note_emails = array();
609 609
 
610 610
 		foreach ( $email_fields as $email_field ) {
611
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
612
-				$note_emails[] = $entry["{$email_field->id}"];
611
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
612
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
613 613
 			}
614 614
 		}
615 615
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		 */
622 622
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
623 623
 
624
-		return (array) $note_emails;
624
+		return (array)$note_emails;
625 625
 	}
626 626
 
627 627
 	/**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 	 */
638 638
 	private static function get_note_email_fields( $entry_slug = '' ) {
639 639
 
640
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
640
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
641 641
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
642 642
 			return '';
643 643
 		}
@@ -659,27 +659,27 @@  discard block
 block discarded – undo
659 659
 
660 660
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
661 661
 			<div class="gv-note-email-container">
662
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
662
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
663 663
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
664
-					<option value=""><?php echo $strings['also-email'];  ?></option>
664
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
665 665
 					<?php foreach ( $note_emails as  $email ) {
666 666
 						?>
667 667
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
668 668
 					<?php }
669
-					if( $include_custom ) { ?>
670
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
669
+					if ( $include_custom ) { ?>
670
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
671 671
 					<?php } ?>
672 672
 				</select>
673 673
 				<fieldset class="gv-note-to-container">
674
-					<?php if( $include_custom ) { ?>
674
+					<?php if ( $include_custom ) { ?>
675 675
 					<div class='gv-note-to-custom-container'>
676
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
677
-						<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="" />
676
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
677
+						<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="" />
678 678
 					</div>
679 679
 					<?php } ?>
680 680
 		            <div class='gv-note-subject-container'>
681
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
682
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
681
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
682
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
683 683
 		            </div>
684 684
 				</fieldset>
685 685
 			</div>
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	private function maybe_send_entry_notes( $note = false, $entry, $data ) {
704 704
 
705
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
705
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
706 706
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note );
707 707
 			return;
708 708
 		}
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data );
711 711
 
712 712
 		//emailing notes if configured
713
-		if ( ! empty( $data['gv-note-to'] ) ) {
713
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
714 714
 
715 715
 			$default_data = array(
716 716
 				'gv-note-to' => '',
@@ -720,11 +720,11 @@  discard block
 block discarded – undo
720 720
                 'current-url' => '',
721 721
 			);
722 722
 
723
-			$current_user  = wp_get_current_user();
723
+			$current_user = wp_get_current_user();
724 724
 			$email_data = wp_parse_args( $data, $default_data );
725 725
 
726
-			$from    = $current_user->user_email;
727
-			$to = $email_data['gv-note-to'];
726
+			$from = $current_user->user_email;
727
+			$to = $email_data[ 'gv-note-to' ];
728 728
 
729 729
 			/**
730 730
 			 * Documented in get_note_email_fields
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 			 */
733 733
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
734 734
 
735
-			if( 'custom' === $to && $include_custom ) {
736
-				$to = $email_data['gv-note-to-custom'];
735
+			if ( 'custom' === $to && $include_custom ) {
736
+				$to = $email_data[ 'gv-note-to-custom' ];
737 737
 				do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to );
738 738
 			}
739 739
 
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
 
745 745
 			$bcc = false;
746 746
 			$reply_to = $from;
747
-			$subject = trim( $email_data['gv-note-subject'] );
747
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
748 748
 
749 749
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
750 750
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
751
-			$message = $email_data['gv-note-content'];
751
+			$message = $email_data[ 'gv-note-content' ];
752 752
 			$email_footer = self::strings( 'email-footer' );
753
-			$from_name     = $current_user->display_name;
753
+			$from_name = $current_user->display_name;
754 754
 			$message_format = 'html';
755 755
 
756 756
 			/**
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 
782 782
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
783 783
 
784
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
784
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
785 785
 
786 786
 			/**
787 787
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 
808 808
 	    $output = '';
809 809
 
810
-		if( ! empty( $email_footer ) ) {
810
+		if ( ! empty( $email_footer ) ) {
811 811
 		    $url = rgar( $email_data, 'current-url' );
812 812
 			$url = html_entity_decode( $url );
813 813
 			$url = site_url( $url );
Please login to merge, or discard this patch.